1
0
Fork 0

Merge pull request #3043 from Quix0r/rewrites/dbm_is_result

More usage of dbm::is_result + coding convention applied
This commit is contained in:
Michael Vogel 2017-01-07 17:09:23 +01:00 committed by GitHub
commit ee39aba490
161 changed files with 720 additions and 668 deletions

View file

@ -1540,7 +1540,7 @@ function check_db() {
* Sets the base url for use in cmdline programs which don't have * Sets the base url for use in cmdline programs which don't have
* $_SERVER variables * $_SERVER variables
*/ */
function check_url(&$a) { function check_url(App &$a) {
$url = get_config('system','url'); $url = get_config('system','url');
@ -1562,7 +1562,7 @@ function check_url(&$a) {
/** /**
* @brief Automatic database updates * @brief Automatic database updates
*/ */
function update_db(&$a) { function update_db(App &$a) {
$build = get_config('system','build'); $build = get_config('system','build');
if(! x($build)) if(! x($build))
$build = set_config('system','build',DB_UPDATE_VERSION); $build = set_config('system','build',DB_UPDATE_VERSION);
@ -1678,7 +1678,7 @@ function run_update_function($x) {
* @param App $a * @param App $a
* *
*/ */
function check_plugins(&$a) { function check_plugins(App &$a) {
$r = q("SELECT * FROM `addon` WHERE `installed` = 1"); $r = q("SELECT * FROM `addon` WHERE `installed` = 1");
if (dbm::is_result($r)) if (dbm::is_result($r))
@ -2413,7 +2413,8 @@ function get_temppath() {
return(""); return("");
} }
function set_template_engine(&$a, $engine = 'internal') { /// @deprecated
function set_template_engine(App &$a, $engine = 'internal') {
/// @note This function is no longer necessary, but keep it as a wrapper to the class method /// @note This function is no longer necessary, but keep it as a wrapper to the class method
/// to avoid breaking themes again unnecessarily /// to avoid breaking themes again unnecessarily

View file

@ -77,9 +77,9 @@ This will include:
$a->argc = 3 $a->argc = 3
$a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2'); $a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2');
Your module functions will often contain the function plugin_name_content(&$a), which defines and returns the page body content. Your module functions will often contain the function plugin_name_content(App &$a), which defines and returns the page body content.
They may also contain plugin_name_post(&$a) which is called before the _content function and typically handles the results of POST forms. They may also contain plugin_name_post(App &$a) which is called before the _content function and typically handles the results of POST forms.
You may also have plugin_name_init(&$a) which is called very early on and often does module initialisation. You may also have plugin_name_init(App &$a) which is called very early on and often does module initialisation.
Templates Templates
--- ---

View file

@ -68,7 +68,7 @@ The code will be something like:
file: mod/network.php file: mod/network.php
<?php <?php
function network_content(&$a) { function network_content(App &$a) {
$itemsmanager = new \Friendica\ItemsManager(); $itemsmanager = new \Friendica\ItemsManager();
$items = $itemsmanager->getAll(); $items = $itemsmanager->getAll();

View file

@ -67,9 +67,9 @@ So würde http://example.com/plugin/arg1/arg2 nach einem Modul "plugin" suchen u
$a->argc = 3 $a->argc = 3
$a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2'); $a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2');
Deine Modulfunktionen umfassen oft die Funktion plugin_name_content(&$a), welche den Seiteninhalt definiert und zurückgibt. Deine Modulfunktionen umfassen oft die Funktion plugin_name_content(App &$a), welche den Seiteninhalt definiert und zurückgibt.
Sie können auch plugin_name_post(&$a) umfassen, welches vor der content-Funktion aufgerufen wird und normalerweise die Resultate der POST-Formulare handhabt. Sie können auch plugin_name_post(App &$a) umfassen, welches vor der content-Funktion aufgerufen wird und normalerweise die Resultate der POST-Formulare handhabt.
Du kannst ebenso plugin_name_init(&$a) nutzen, was oft frühzeitig aufgerufen wird und das Modul initialisert. Du kannst ebenso plugin_name_init(App &$a) nutzen, was oft frühzeitig aufgerufen wird und das Modul initialisert.
Derzeitige Hooks Derzeitige Hooks

View file

@ -122,7 +122,7 @@ the 1st part of the line is the name of the CSS file (without the .css) the 2nd
Calling the t() function with the common name makes the string translateable. Calling the t() function with the common name makes the string translateable.
The selected 1st part will be saved in the database by the theme_post function. The selected 1st part will be saved in the database by the theme_post function.
function theme_post(&$a){ function theme_post(App &$a){
// non local users shall not pass // non local users shall not pass
if (! local_user()) { if (! local_user()) {
return; return;
@ -168,7 +168,7 @@ The content of this file should be something like
<?php <?php
/* meta informations for the theme, see below */ /* meta informations for the theme, see below */
function duepuntozero_lr_init(&$a) { function duepuntozero_lr_init(App &$a) {
$a-> theme_info = array( $a-> theme_info = array(
'extends' => 'duepuntozero'. 'extends' => 'duepuntozero'.
); );
@ -251,7 +251,7 @@ Next crucial part of the theme.php file is a definition of an init function.
The name of the function is <theme-name>_init. The name of the function is <theme-name>_init.
So in the case of quattro it is So in the case of quattro it is
function quattro_init(&$a) { function quattro_init(App &$a) {
$a->theme_info = array(); $a->theme_info = array();
set_template_engine($a, 'smarty3'); set_template_engine($a, 'smarty3');
} }

View file

@ -85,7 +85,7 @@ function contact_remove($id) {
function terminate_friendship($user,$self,$contact) { function terminate_friendship($user,$self,$contact) {
/// @TODO Get rid of this, include/datetime.php should care about by itself /// @TODO Get rid of this, include/datetime.php should care about it by itself
$a = get_app(); $a = get_app();
require_once('include/datetime.php'); require_once('include/datetime.php');
@ -226,14 +226,14 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) {
dbesc(normalise_link($url)), intval($uid)); dbesc(normalise_link($url)), intval($uid));
// Fetch the data from the contact table with "uid=0" (which is filled automatically) // Fetch the data from the contact table with "uid=0" (which is filled automatically)
if (!$r) if (!dbm::is_result($r))
$r = q("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`, $r = q("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
`keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, 0 AS `self` `keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, 0 AS `self`
FROM `contact` WHERE `nurl` = '%s' AND `uid` = 0", FROM `contact` WHERE `nurl` = '%s' AND `uid` = 0",
dbesc(normalise_link($url))); dbesc(normalise_link($url)));
// Fetch the data from the gcontact table // Fetch the data from the gcontact table
if (!$r) if (!dbm::is_result($r))
$r = q("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, '' AS `xmpp`, $r = q("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, '' AS `xmpp`,
`keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, `community` AS `forum`, 0 AS `prv`, `community`, `contact-type`, `birthday`, 0 AS `self` `keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, `community` AS `forum`, 0 AS `prv`, `community`, `contact-type`, `birthday`, 0 AS `self`
FROM `gcontact` WHERE `nurl` = '%s'", FROM `gcontact` WHERE `nurl` = '%s'",

View file

@ -272,7 +272,7 @@ function prune_deadguys($arr) {
$r = q("SELECT `id` FROM `contact` WHERE `id` IN ( " . $str . ") AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 "); $r = q("SELECT `id` FROM `contact` WHERE `id` IN ( " . $str . ") AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 ");
if ($r) { if (dbm::is_result($r)) {
$ret = array(); $ret = array();
foreach ($r as $rr) { foreach ($r as $rr) {
$ret[] = intval($rr['id']); $ret[] = intval($rr['id']);
@ -585,9 +585,9 @@ function acl_lookup(&$a, $out_type = 'json') {
); );
echo json_encode($o); echo json_encode($o);
killme(); killme();
} } else {
else
$r = array(); $r = array();
}
if (dbm::is_result($r)) { if (dbm::is_result($r)) {
@ -691,7 +691,7 @@ function acl_lookup(&$a, $out_type = 'json') {
* @param App $a * @param App $a
* @return array with the search results * @return array with the search results
*/ */
function navbar_complete(&$a) { function navbar_complete(App &$a) {
// logger('navbar_complete'); // logger('navbar_complete');

View file

@ -133,7 +133,7 @@
* @hook 'logged_in' * @hook 'logged_in'
* array $user logged user record * array $user logged user record
*/ */
function api_login(&$a){ function api_login(App &$a){
// login with oauth // login with oauth
try{ try{
$oauth = new FKOAuth1(); $oauth = new FKOAuth1();
@ -251,8 +251,8 @@
* @param App $a * @param App $a
* @return string API call result * @return string API call result
*/ */
function api_call(&$a){ function api_call(App &$a){
GLOBAL $API, $called_api; global $API, $called_api;
$type="json"; $type="json";
if (strpos($a->query_string, ".xml")>0) $type="xml"; if (strpos($a->query_string, ".xml")>0) $type="xml";
@ -3590,7 +3590,7 @@
intval($gid), intval($gid),
dbesc($name)); dbesc($name));
// error message if specified gid is not in database // error message if specified gid is not in database
if (count($rname) == 0) if (!dbm::is_result($rname))
throw new BadRequestException('wrong group name'); throw new BadRequestException('wrong group name');
// delete group // delete group
@ -3629,7 +3629,7 @@
intval($uid), intval($uid),
dbesc($name)); dbesc($name));
// error message if specified group name already exists // error message if specified group name already exists
if (count($rname) != 0) if (dbm::is_result($rname))
throw new BadRequestException('group name already exists'); throw new BadRequestException('group name already exists');
// check if specified group name is a deleted group // check if specified group name is a deleted group
@ -3637,7 +3637,7 @@
intval($uid), intval($uid),
dbesc($name)); dbesc($name));
// error message if specified group name already exists // error message if specified group name already exists
if (count($rname) != 0) if (dbm::is_result($rname))
$reactivate_group = true; $reactivate_group = true;
// create group // create group

View file

@ -158,12 +158,14 @@ function categories_widget($baseurl,$selected = '') {
$a = get_app(); $a = get_app();
if(! feature_enabled($a->profile['profile_uid'],'categories')) if (! feature_enabled($a->profile['profile_uid'],'categories')) {
return ''; return '';
}
$saved = get_pconfig($a->profile['profile_uid'],'system','filetags'); $saved = get_pconfig($a->profile['profile_uid'],'system','filetags');
if(! strlen($saved)) if (! strlen($saved)) {
return; return;
}
$matches = false; $matches = false;
$terms = array(); $terms = array();

View file

@ -264,7 +264,7 @@ function cron_poll_contacts($argc, $argv) {
intval($c['id']) intval($c['id'])
); );
if((! $res) || (! count($res))) if (dbm::is_result($res))
continue; continue;
foreach($res as $contact) { foreach($res as $contact) {
@ -343,7 +343,7 @@ function cron_poll_contacts($argc, $argv) {
* *
* @param App $a * @param App $a
*/ */
function cron_clear_cache(&$a) { function cron_clear_cache(App &$a) {
$last = get_config('system','cache_last_cleared'); $last = get_config('system','cache_last_cleared');
@ -430,7 +430,7 @@ function cron_clear_cache(&$a) {
* *
* @param App $a * @param App $a
*/ */
function cron_repair_diaspora(&$a) { function cron_repair_diaspora(App &$a) {
$r = q("SELECT `id`, `url` FROM `contact` $r = q("SELECT `id`, `url` FROM `contact`
WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '') WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '')
ORDER BY RAND() LIMIT 50", dbesc(NETWORK_DIASPORA)); ORDER BY RAND() LIMIT 50", dbesc(NETWORK_DIASPORA));

View file

@ -2355,7 +2355,7 @@ class dfrn {
dbesc($xt->id), dbesc($xt->id),
intval($importer["importer_uid"]) intval($importer["importer_uid"])
); );
if(count($i)) { if (dbm::is_result($i)) {
// For tags, the owner cannot remove the tag on the author's copy of the post. // For tags, the owner cannot remove the tag on the author's copy of the post.

View file

@ -2283,8 +2283,9 @@ class Diaspora {
dbesc($target_guid), dbesc($target_guid),
intval($importer["uid"]) intval($importer["uid"])
); );
if (!$r) if (!$r) {
return false; return false;
}
// Check if the sender is the thread owner // Check if the sender is the thread owner
$p = q("SELECT `id`, `author-link`, `origin` FROM `item` WHERE `id` = %d", $p = q("SELECT `id`, `author-link`, `origin` FROM `item` WHERE `id` = %d",
@ -2478,15 +2479,17 @@ class Diaspora {
* @return string the handle in the format user@domain.tld * @return string the handle in the format user@domain.tld
*/ */
private static function my_handle($contact) { private static function my_handle($contact) {
if ($contact["addr"] != "") if ($contact["addr"] != "") {
return $contact["addr"]; return $contact["addr"];
}
// Normally we should have a filled "addr" field - but in the past this wasn't the case // Normally we should have a filled "addr" field - but in the past this wasn't the case
// So - just in case - we build the the address here. // So - just in case - we build the the address here.
if ($contact["nickname"] != "") if ($contact["nickname"] != "") {
$nick = $contact["nickname"]; $nick = $contact["nickname"];
else } else {
$nick = $contact["nick"]; $nick = $contact["nick"];
}
return $nick."@".substr(App::get_baseurl(), strpos(App::get_baseurl(),"://") + 3); return $nick."@".substr(App::get_baseurl(), strpos(App::get_baseurl(),"://") + 3);
} }

View file

@ -206,7 +206,7 @@ function bbtoevent($s) {
} }
function sort_by_date($a) { function sort_by_date(App &$a) {
usort($a,'ev_compare'); usort($a,'ev_compare');
return $a; return $a;

View file

@ -102,8 +102,7 @@ function new_contact($uid,$url,$interactive = false) {
if ($interactive) { if ($interactive) {
if (strlen($a->path)) { if (strlen($a->path)) {
$myaddr = bin2hex(App::get_baseurl() . '/profile/' . $a->user['nickname']); $myaddr = bin2hex(App::get_baseurl() . '/profile/' . $a->user['nickname']);
} } else {
else {
$myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname()); $myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());
} }
@ -111,35 +110,30 @@ function new_contact($uid,$url,$interactive = false) {
// NOTREACHED // NOTREACHED
} }
} } elseif (get_config('system','dfrn_only')) {
else {
if(get_config('system','dfrn_only')) {
$result['message'] = t('This site is not configured to allow communications with other networks.') . EOL; $result['message'] = t('This site is not configured to allow communications with other networks.') . EOL;
$result['message'] != t('No compatible communication protocols or feeds were discovered.') . EOL; $result['message'] != t('No compatible communication protocols or feeds were discovered.') . EOL;
return $result; return $result;
} }
}
// This extra param just confuses things, remove it // This extra param just confuses things, remove it
if($ret['network'] === NETWORK_DIASPORA) if ($ret['network'] === NETWORK_DIASPORA) {
$ret['url'] = str_replace('?absolute=true','',$ret['url']); $ret['url'] = str_replace('?absolute=true','',$ret['url']);
}
// do we have enough information? // do we have enough information?
if (! ((x($ret,'name')) && (x($ret,'poll')) && ((x($ret,'url')) || (x($ret,'addr'))))) { if (! ((x($ret,'name')) && (x($ret,'poll')) && ((x($ret,'url')) || (x($ret,'addr'))))) {
$result['message'] .= t('The profile address specified does not provide adequate information.') . EOL; $result['message'] .= t('The profile address specified does not provide adequate information.') . EOL;
if(! x($ret,'poll')) if (! x($ret,'poll')) {
$result['message'] .= t('No compatible communication protocols or feeds were discovered.') . EOL; $result['message'] .= t('No compatible communication protocols or feeds were discovered.') . EOL;
if(! x($ret,'name')) }
if (! x($ret,'name')) {
$result['message'] .= t('An author or name was not found.') . EOL; $result['message'] .= t('An author or name was not found.') . EOL;
if(! x($ret,'url')) }
if (! x($ret,'url')) {
$result['message'] .= t('No browser URL could be matched to this address.') . EOL; $result['message'] .= t('No browser URL could be matched to this address.') . EOL;
}
if (strpos($url,'@') !== false) { if (strpos($url,'@') !== false) {
$result['message'] .= t('Unable to match @-style Identity Address with a known protocol or email contact.') . EOL; $result['message'] .= t('Unable to match @-style Identity Address with a known protocol or email contact.') . EOL;
$result['message'] .= t('Use mailto: in front of address to force email check.') . EOL; $result['message'] .= t('Use mailto: in front of address to force email check.') . EOL;
@ -152,11 +146,6 @@ function new_contact($uid,$url,$interactive = false) {
$ret['notify'] = ''; $ret['notify'] = '';
} }
if (! $ret['notify']) { if (! $ret['notify']) {
$result['message'] .= t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . EOL; $result['message'] .= t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . EOL;
} }
@ -167,8 +156,9 @@ function new_contact($uid,$url,$interactive = false) {
$hidden = (($ret['network'] === NETWORK_MAIL) ? 1 : 0); $hidden = (($ret['network'] === NETWORK_MAIL) ? 1 : 0);
if(in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA))) if (in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA))) {
$writeable = 1; $writeable = 1;
}
// check if we already have a contact // check if we already have a contact
// the poll url is more reliable than the profile url, as we may have // the poll url is more reliable than the profile url, as we may have
@ -197,11 +187,9 @@ function new_contact($uid,$url,$interactive = false) {
); );
} }
} else { } else {
// check service class limits // check service class limits
$r = q("select count(*) as total from contact where uid = %d and pending = 0 and self = 0", $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `pending` = 0 AND `self` = 0",
intval($uid) intval($uid)
); );
if (dbm::is_result($r)) if (dbm::is_result($r))
@ -212,12 +200,13 @@ function new_contact($uid,$url,$interactive = false) {
return $result; return $result;
} }
$r = q("select count(network) as total from contact where uid = %d and network = '%s' and pending = 0 and self = 0", $r = q("SELECT COUNT(`network`) AS `total` FROM `contact` WHERE `uid` = %d AND `network` = '%s' AND `pending` = 0 AND `self` = 0",
intval($uid), intval($uid),
dbesc($network) dbesc($network)
); );
if (dbm::is_result($r)) if (dbm::is_result($r)) {
$total_network = $r[0]['total']; $total_network = $r[0]['total'];
}
if (! service_class_allows($uid,'total_contacts_' . $network,$total_network)) { if (! service_class_allows($uid,'total_contacts_' . $network,$total_network)) {
$result['message'] .= upgrade_message(); $result['message'] .= upgrade_message();
@ -268,8 +257,9 @@ function new_contact($uid,$url,$interactive = false) {
$result['cid'] = $contact_id; $result['cid'] = $contact_id;
$def_gid = get_default_group($uid, $contact["network"]); $def_gid = get_default_group($uid, $contact["network"]);
if (intval($def_gid)) if (intval($def_gid)) {
group_add_member($uid, '', $contact_id, $def_gid); group_add_member($uid, '', $contact_id, $def_gid);
}
// Update the avatar // Update the avatar
update_contact_avatar($ret['photo'],$uid,$contact_id); update_contact_avatar($ret['photo'],$uid,$contact_id);
@ -285,7 +275,6 @@ function new_contact($uid,$url,$interactive = false) {
if (dbm::is_result($r)) { if (dbm::is_result($r)) {
if (($contact['network'] == NETWORK_OSTATUS) && (strlen($contact['notify']))) { if (($contact['network'] == NETWORK_OSTATUS) && (strlen($contact['notify']))) {
// create a follow slap // create a follow slap
$item = array(); $item = array();
$item['verb'] = ACTIVITY_FOLLOW; $item['verb'] = ACTIVITY_FOLLOW;

View file

@ -231,8 +231,7 @@ function profile_sidebar($profile, $block = 0) {
if ($connect AND local_user()) { if ($connect AND local_user()) {
if (isset($profile["url"])) { if (isset($profile["url"])) {
$profile_url = normalise_link($profile["url"]); $profile_url = normalise_link($profile["url"]);
} } else {
else {
$profile_url = normalise_link(App::get_baseurl()."/profile/".$profile["nickname"]); $profile_url = normalise_link(App::get_baseurl()."/profile/".$profile["nickname"]);
} }
@ -599,7 +598,7 @@ function get_events() {
)); ));
} }
function advanced_profile(&$a) { function advanced_profile(App &$a) {
$o = ''; $o = '';
$uid = $a->profile['uid']; $uid = $a->profile['uid'];
@ -638,49 +637,86 @@ function advanced_profile(&$a) {
if($a->profile['marital']) $profile['marital'] = array( t('Status:'), $a->profile['marital']); if($a->profile['marital']) $profile['marital'] = array( t('Status:'), $a->profile['marital']);
/// @TODO Maybe use x() here, plus below?
if($a->profile['with']) $profile['marital']['with'] = $a->profile['with']; if ($a->profile['with']) {
$profile['marital']['with'] = $a->profile['with'];
}
if (strlen($a->profile['howlong']) && $a->profile['howlong'] !== '0000-00-00 00:00:00') { if (strlen($a->profile['howlong']) && $a->profile['howlong'] !== '0000-00-00 00:00:00') {
$profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s')); $profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
} }
if($a->profile['sexual']) $profile['sexual'] = array( t('Sexual Preference:'), $a->profile['sexual'] ); if ($a->profile['sexual']) {
$profile['sexual'] = array( t('Sexual Preference:'), $a->profile['sexual'] );
}
if($a->profile['homepage']) $profile['homepage'] = array( t('Homepage:'), linkify($a->profile['homepage']) ); if ($a->profile['homepage']) {
$profile['homepage'] = array( t('Homepage:'), linkify($a->profile['homepage']) );
}
if($a->profile['hometown']) $profile['hometown'] = array( t('Hometown:'), linkify($a->profile['hometown']) ); if ($a->profile['hometown']) {
$profile['hometown'] = array( t('Hometown:'), linkify($a->profile['hometown']) );
}
if($a->profile['pub_keywords']) $profile['pub_keywords'] = array( t('Tags:'), $a->profile['pub_keywords']); if ($a->profile['pub_keywords']) {
$profile['pub_keywords'] = array( t('Tags:'), $a->profile['pub_keywords']);
}
if($a->profile['politic']) $profile['politic'] = array( t('Political Views:'), $a->profile['politic']); if ($a->profile['politic']) {
$profile['politic'] = array( t('Political Views:'), $a->profile['politic']);
}
if($a->profile['religion']) $profile['religion'] = array( t('Religion:'), $a->profile['religion']); if ($a->profile['religion']) {
$profile['religion'] = array( t('Religion:'), $a->profile['religion']);
}
if($txt = prepare_text($a->profile['about'])) $profile['about'] = array( t('About:'), $txt ); if ($txt = prepare_text($a->profile['about'])) {
$profile['about'] = array( t('About:'), $txt );
}
if($txt = prepare_text($a->profile['interest'])) $profile['interest'] = array( t('Hobbies/Interests:'), $txt); if ($txt = prepare_text($a->profile['interest'])) {
$profile['interest'] = array( t('Hobbies/Interests:'), $txt);
}
if($txt = prepare_text($a->profile['likes'])) $profile['likes'] = array( t('Likes:'), $txt); if ($txt = prepare_text($a->profile['likes'])) {
$profile['likes'] = array( t('Likes:'), $txt);
}
if($txt = prepare_text($a->profile['dislikes'])) $profile['dislikes'] = array( t('Dislikes:'), $txt); if ($txt = prepare_text($a->profile['dislikes'])) {
$profile['dislikes'] = array( t('Dislikes:'), $txt);
}
if ($txt = prepare_text($a->profile['contact'])) {
$profile['contact'] = array( t('Contact information and Social Networks:'), $txt);
}
if($txt = prepare_text($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt); if ($txt = prepare_text($a->profile['music'])) {
$profile['music'] = array( t('Musical interests:'), $txt);
}
if($txt = prepare_text($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt); if ($txt = prepare_text($a->profile['book'])) {
$profile['book'] = array( t('Books, literature:'), $txt);
}
if($txt = prepare_text($a->profile['book'])) $profile['book'] = array( t('Books, literature:'), $txt); if ($txt = prepare_text($a->profile['tv'])) {
$profile['tv'] = array( t('Television:'), $txt);
}
if($txt = prepare_text($a->profile['tv'])) $profile['tv'] = array( t('Television:'), $txt); if ($txt = prepare_text($a->profile['film'])) {
$profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt);
}
if($txt = prepare_text($a->profile['film'])) $profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt); if ($txt = prepare_text($a->profile['romance'])) {
$profile['romance'] = array( t('Love/Romance:'), $txt);
}
if($txt = prepare_text($a->profile['romance'])) $profile['romance'] = array( t('Love/Romance:'), $txt); if ($txt = prepare_text($a->profile['work'])) {
$profile['work'] = array( t('Work/employment:'), $txt);
}
if($txt = prepare_text($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt); if ($txt = prepare_text($a->profile['education'])) {
$profile['education'] = array( t('School/education:'), $txt );
if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt ); }
//show subcribed forum if it is enabled in the usersettings //show subcribed forum if it is enabled in the usersettings
if (feature_enabled($uid,'forumlist_profile')) { if (feature_enabled($uid,'forumlist_profile')) {
@ -705,11 +741,13 @@ function advanced_profile(&$a) {
function profile_tabs($a, $is_owner=False, $nickname=Null){ function profile_tabs($a, $is_owner=False, $nickname=Null){
//echo "<pre>"; var_dump($a->user); killme(); //echo "<pre>"; var_dump($a->user); killme();
if (is_null($nickname)) if (is_null($nickname)) {
$nickname = $a->user['nickname']; $nickname = $a->user['nickname'];
}
if(x($_GET,'tab')) if (x($_GET,'tab')) {
$tab = notags(trim($_GET['tab'])); $tab = notags(trim($_GET['tab']));
}
$url = App::get_baseurl() . '/profile/' . $nickname; $url = App::get_baseurl() . '/profile/' . $nickname;
@ -807,7 +845,7 @@ function get_my_url() {
return false; return false;
} }
function zrl_init(&$a) { function zrl_init(App &$a) {
$tmp_str = get_my_url(); $tmp_str = get_my_url();
if(validate_url($tmp_str)) { if(validate_url($tmp_str)) {

View file

@ -704,7 +704,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
// If its a post from myself then tag the thread as "mention" // If its a post from myself then tag the thread as "mention"
logger("item_store: Checking if parent ".$parent_id." has to be tagged as mention for user ".$arr['uid'], LOGGER_DEBUG); logger("item_store: Checking if parent ".$parent_id." has to be tagged as mention for user ".$arr['uid'], LOGGER_DEBUG);
$u = q("SELECT `nickname` FROM `user` WHERE `uid` = %d", intval($arr['uid'])); $u = q("SELECT `nickname` FROM `user` WHERE `uid` = %d", intval($arr['uid']));
if (count($u)) { if (dbm::is_result($u)) {
$a = get_app(); $a = get_app();
$self = normalise_link(App::get_baseurl() . '/profile/' . $u[0]['nickname']); $self = normalise_link(App::get_baseurl() . '/profile/' . $u[0]['nickname']);
logger("item_store: 'myself' is ".$self." for parent ".$parent_id." checking against ".$arr['author-link']." and ".$arr['owner-link'], LOGGER_DEBUG); logger("item_store: 'myself' is ".$self." for parent ".$parent_id." checking against ".$arr['author-link']." and ".$arr['owner-link'], LOGGER_DEBUG);
@ -953,15 +953,17 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
// in it. // in it.
if (!$deleted AND !$dontcache) { if (!$deleted AND !$dontcache) {
$r = q('SELECT * FROM `item` WHERE id = %d', intval($current_post)); $r = q('SELECT * FROM `item` WHERE `id` = %d', intval($current_post));
if (count($r) == 1) { if ((dbm::is_result($r)) && (count($r) == 1)) {
if ($notify) if ($notify) {
call_hooks('post_local_end', $r[0]); call_hooks('post_local_end', $r[0]);
else } else {
call_hooks('post_remote_end', $r[0]); call_hooks('post_remote_end', $r[0]);
} else }
} else {
logger('item_store: new item not found in DB, id ' . $current_post); logger('item_store: new item not found in DB, id ' . $current_post);
} }
}
if ($arr['parent-uri'] === $arr['uri']) { if ($arr['parent-uri'] === $arr['uri']) {
add_thread($current_post); add_thread($current_post);
@ -994,8 +996,9 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
check_item_notification($current_post, $uid); check_item_notification($current_post, $uid);
if ($notify) if ($notify) {
proc_run(PRIORITY_HIGH, "include/notifier.php", $notify_type, $current_post); proc_run(PRIORITY_HIGH, "include/notifier.php", $notify_type, $current_post);
}
return $current_post; return $current_post;
} }
@ -1188,19 +1191,22 @@ function tag_deliver($uid,$item_id) {
$u = q("select * from user where uid = %d limit 1", $u = q("select * from user where uid = %d limit 1",
intval($uid) intval($uid)
); );
if (! count($u))
if (! dbm::is_result($u)) {
return; return;
}
$community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false); $community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
$prvgroup = (($u[0]['page-flags'] == PAGE_PRVGROUP) ? true : false); $prvgroup = (($u[0]['page-flags'] == PAGE_PRVGROUP) ? true : false);
$i = q("select * from item where id = %d and uid = %d limit 1", $i = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($item_id), intval($item_id),
intval($uid) intval($uid)
); );
if (! count($i)) if (! dbm::is_result($i)) {
return; return;
}
$item = $i[0]; $item = $i[0];
@ -1257,7 +1263,7 @@ function tag_deliver($uid,$item_id) {
$c = q("select name, url, thumb from contact where self = 1 and uid = %d limit 1", $c = q("select name, url, thumb from contact where self = 1 and uid = %d limit 1",
intval($u[0]['uid']) intval($u[0]['uid'])
); );
if (! count($c)) { if (! dbm::is_result($c)) {
return; return;
} }
@ -1290,8 +1296,6 @@ function tag_deliver($uid,$item_id) {
function tgroup_check($uid,$item) { function tgroup_check($uid,$item) {
$a = get_app();
$mention = false; $mention = false;
// check that the message originated elsewhere and is a top-level post // check that the message originated elsewhere and is a top-level post
@ -1299,12 +1303,13 @@ function tgroup_check($uid,$item) {
if (($item['wall']) || ($item['origin']) || ($item['uri'] != $item['parent-uri'])) if (($item['wall']) || ($item['origin']) || ($item['uri'] != $item['parent-uri']))
return false; return false;
/// @TODO Encapsulate this or find it encapsulated and replace all occurrances
$u = q("select * from user where uid = %d limit 1", $u = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid) intval($uid)
); );
if (! count($u)) if (! dbm::is_result($u)) {
return false; return false;
}
$community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false); $community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
$prvgroup = (($u[0]['page-flags'] == PAGE_PRVGROUP) ? true : false); $prvgroup = (($u[0]['page-flags'] == PAGE_PRVGROUP) ? true : false);
@ -2228,7 +2233,7 @@ function posted_date_widget($url,$uid,$wall) {
$ret = list_post_dates($uid,$wall); $ret = list_post_dates($uid,$wall);
if (! count($ret)) if (! dbm::is_result($ret))
return $o; return $o;
$cutoff_year = intval(datetime_convert('',date_default_timezone_get(),'now','Y')) - $visible_years; $cutoff_year = intval(datetime_convert('',date_default_timezone_get(),'now','Y')) - $visible_years;

View file

@ -112,9 +112,10 @@ function do_like($item_id, $verb) {
intval($_SESSION['visitor_id']), intval($_SESSION['visitor_id']),
intval($owner_uid) intval($owner_uid)
); );
if (dbm::is_result($r)) if (dbm::is_result($r)) {
$contact = $r[0]; $contact = $r[0];
} }
}
if (! $contact) { if (! $contact) {
return false; return false;
} }

View file

@ -1,6 +1,6 @@
<?php <?php
function nav(&$a) { function nav(App &$a) {
/* /*
* *

View file

@ -543,8 +543,9 @@ function parse_xml_string($s,$strict = true) {
$x = @simplexml_load_string($s2); $x = @simplexml_load_string($s2);
if (! $x) { if (! $x) {
logger('libxml: parse: error: ' . $s2, LOGGER_DATA); logger('libxml: parse: error: ' . $s2, LOGGER_DATA);
foreach(libxml_get_errors() as $err) foreach (libxml_get_errors() as $err) {
logger('libxml: parse: ' . $err->code." at ".$err->line.":".$err->column." : ".$err->message, LOGGER_DATA); logger('libxml: parse: ' . $err->code." at ".$err->line.":".$err->column." : ".$err->message, LOGGER_DATA);
}
libxml_clear_errors(); libxml_clear_errors();
} }
return $x; return $x;
@ -553,8 +554,9 @@ function parse_xml_string($s,$strict = true) {
function scale_external_images($srctext, $include_link = true, $scale_replace = false) { function scale_external_images($srctext, $include_link = true, $scale_replace = false) {
// Suppress "view full size" // Suppress "view full size"
if (intval(get_config('system','no_view_full_size'))) if (intval(get_config('system','no_view_full_size'))) {
$include_link = false; $include_link = false;
}
$a = get_app(); $a = get_app();
@ -569,21 +571,24 @@ function scale_external_images($srctext, $include_link = true, $scale_replace =
logger('scale_external_image: ' . $mtch[1]); logger('scale_external_image: ' . $mtch[1]);
$hostname = str_replace('www.','',substr(App::get_baseurl(),strpos(App::get_baseurl(),'://')+3)); $hostname = str_replace('www.','',substr(App::get_baseurl(),strpos(App::get_baseurl(),'://')+3));
if(stristr($mtch[1],$hostname)) if (stristr($mtch[1],$hostname)) {
continue; continue;
}
// $scale_replace, if passed, is an array of two elements. The // $scale_replace, if passed, is an array of two elements. The
// first is the name of the full-size image. The second is the // first is the name of the full-size image. The second is the
// name of a remote, scaled-down version of the full size image. // name of a remote, scaled-down version of the full size image.
// This allows Friendica to display the smaller remote image if // This allows Friendica to display the smaller remote image if
// one exists, while still linking to the full-size image // one exists, while still linking to the full-size image
if($scale_replace) if ($scale_replace) {
$scaled = str_replace($scale_replace[0], $scale_replace[1], $mtch[1]); $scaled = str_replace($scale_replace[0], $scale_replace[1], $mtch[1]);
else } else {
$scaled = $mtch[1]; $scaled = $mtch[1];
$i = @fetch_url($scaled); }
if(! $i) $i = fetch_url($scaled);
if (! $i) {
return $srctext; return $srctext;
}
// guess mimetype from headers or filename // guess mimetype from headers or filename
$type = guess_image_type($mtch[1],true); $type = guess_image_type($mtch[1],true);
@ -641,14 +646,14 @@ function fix_contact_ssl_policy(&$contact,$new_policy) {
} }
if ($ssl_changed) { if ($ssl_changed) {
q("update contact set q("UPDATE `contact` SET
url = '%s', `url` = '%s',
request = '%s', `request` = '%s',
notify = '%s', `notify` = '%s',
poll = '%s', `poll` = '%s',
confirm = '%s', `confirm` = '%s',
poco = '%s' `poco` = '%s'
where id = %d limit 1", WHERE `id` = %d LIMIT 1",
dbesc($contact['url']), dbesc($contact['url']),
dbesc($contact['request']), dbesc($contact['request']),
dbesc($contact['notify']), dbesc($contact['notify']),

View file

@ -129,7 +129,7 @@ function reload_plugins() {
*/ */
function plugin_enabled($plugin) { function plugin_enabled($plugin) {
$r = q("SELECT * FROM `addon` WHERE `installed` = 1 AND `name` = '%s'", $plugin); $r = q("SELECT * FROM `addon` WHERE `installed` = 1 AND `name` = '%s'", $plugin);
return((bool)(count($r) > 0)); return ((dbm::is_result($r)) && (count($r) > 0));
} }
@ -425,7 +425,7 @@ if (! function_exists('uninstall_theme')){
function uninstall_theme($theme){ function uninstall_theme($theme){
logger("Addons: uninstalling theme " . $theme); logger("Addons: uninstalling theme " . $theme);
@include_once("view/theme/$theme/theme.php"); include_once("view/theme/$theme/theme.php");
if (function_exists("{$theme}_uninstall")) { if (function_exists("{$theme}_uninstall")) {
$func = "{$theme}_uninstall"; $func = "{$theme}_uninstall";
$func(); $func();
@ -436,19 +436,19 @@ if (! function_exists('install_theme')){
function install_theme($theme) { function install_theme($theme) {
// silently fail if theme was removed // silently fail if theme was removed
if(! file_exists("view/theme/$theme/theme.php")) if (! file_exists("view/theme/$theme/theme.php")) {
return false; return false;
}
logger("Addons: installing theme $theme"); logger("Addons: installing theme $theme");
@include_once("view/theme/$theme/theme.php"); include_once("view/theme/$theme/theme.php");
if (function_exists("{$theme}_install")) { if (function_exists("{$theme}_install")) {
$func = "{$theme}_install"; $func = "{$theme}_install";
$func(); $func();
return true; return true;
} } else {
else {
logger("Addons: FAILED installing theme $theme"); logger("Addons: FAILED installing theme $theme");
return false; return false;
} }
@ -469,8 +469,7 @@ function service_class_allows($uid,$property,$usage = false) {
if ($uid == local_user()) { if ($uid == local_user()) {
$service_class = $a->user['service_class']; $service_class = $a->user['service_class'];
} } else {
else {
$r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1", $r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid) intval($uid)
); );
@ -478,18 +477,23 @@ function service_class_allows($uid,$property,$usage = false) {
$service_class = $r[0]['service_class']; $service_class = $r[0]['service_class'];
} }
} }
if(! x($service_class))
return true; // everything is allowed if (! x($service_class)) {
// everything is allowed
return true;
}
$arr = get_config('service_class',$service_class); $arr = get_config('service_class',$service_class);
if(! is_array($arr) || (! count($arr))) if (! is_array($arr) || (! count($arr))) {
return true; return true;
}
if($usage === false) if ($usage === false) {
return ((x($arr[$property])) ? (bool) $arr['property'] : true); return ((x($arr[$property])) ? (bool) $arr['property'] : true);
else { } else {
if(! array_key_exists($property,$arr)) if (! array_key_exists($property,$arr)) {
return true; return true;
}
return (((intval($usage)) < intval($arr[$property])) ? true : false); return (((intval($usage)) < intval($arr[$property])) ? true : false);
} }
} }
@ -499,8 +503,7 @@ function service_class_fetch($uid,$property) {
if ($uid == local_user()) { if ($uid == local_user()) {
$service_class = $a->user['service_class']; $service_class = $a->user['service_class'];
} } else {
else {
$r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1", $r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid) intval($uid)
); );

View file

@ -213,7 +213,7 @@ function poller_max_connections_reached() {
// The processlist only shows entries of the current user // The processlist only shows entries of the current user
if ($max != 0) { if ($max != 0) {
$r = q("SHOW PROCESSLIST"); $r = q("SHOW PROCESSLIST");
if (!$r) if (!dbm::is_result($r))
return false; return false;
$used = count($r); $used = count($r);

View file

@ -127,7 +127,7 @@ function queue_run(&$argv, &$argc){
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", $c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($qi[0]['cid']) intval($qi[0]['cid'])
); );
if(! count($c)) { if (! dbm::is_result($c)) {
remove_queue_item($q_item['id']); remove_queue_item($q_item['id']);
continue; continue;
} }
@ -157,7 +157,7 @@ function queue_run(&$argv, &$argc){
FROM `user` WHERE `uid` = %d LIMIT 1", FROM `user` WHERE `uid` = %d LIMIT 1",
intval($c[0]['uid']) intval($c[0]['uid'])
); );
if(! count($u)) { if (! dbm::is_result($u)) {
remove_queue_item($q_item['id']); remove_queue_item($q_item['id']);
continue; continue;
} }

View file

@ -220,8 +220,9 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
$r = q("SELECT `network` FROM `contact` WHERE `nurl` = '%s' AND `network` != '' AND `network` != '%s' LIMIT 1", $r = q("SELECT `network` FROM `contact` WHERE `nurl` = '%s' AND `network` != '' AND `network` != '%s' LIMIT 1",
dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET) dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET)
); );
if (dbm::is_result($r)) if (dbm::is_result($r)) {
$network = $r[0]["network"]; $network = $r[0]["network"];
}
if (($network == "") OR ($network == NETWORK_OSTATUS)) { if (($network == "") OR ($network == NETWORK_OSTATUS)) {
$r = q("SELECT `network`, `url` FROM `contact` WHERE `alias` IN ('%s', '%s') AND `network` != '' AND `network` != '%s' LIMIT 1", $r = q("SELECT `network`, `url` FROM `contact` WHERE `alias` IN ('%s', '%s') AND `network` != '' AND `network` != '%s' LIMIT 1",
@ -1575,7 +1576,7 @@ function get_gcontact_id($contact) {
proc_run(PRIORITY_LOW, 'include/gprobe.php', bin2hex($contact["url"])); proc_run(PRIORITY_LOW, 'include/gprobe.php', bin2hex($contact["url"]));
} }
if ((count($r) > 1) AND ($gcontact_id > 0) AND ($contact["url"] != "")) if ((dbm::is_result($r)) AND (count($r) > 1) AND ($gcontact_id > 0) AND ($contact["url"] != ""))
q("DELETE FROM `gcontact` WHERE `nurl` = '%s' AND `id` != %d", q("DELETE FROM `gcontact` WHERE `nurl` = '%s' AND `id` != %d",
dbesc(normalise_link($contact["url"])), dbesc(normalise_link($contact["url"])),
intval($gcontact_id)); intval($gcontact_id));

View file

@ -369,7 +369,7 @@ if(! function_exists('paginate')) {
* @param App $a App instance * @param App $a App instance
* @return string html for pagination #FIXME remove html * @return string html for pagination #FIXME remove html
*/ */
function paginate(&$a) { function paginate(App &$a) {
$data = paginate_data($a); $data = paginate_data($a);
$tpl = get_markup_template("paginate.tpl"); $tpl = get_markup_template("paginate.tpl");

View file

@ -241,7 +241,7 @@ function create_user($arr) {
WHERE `nickname` = '%s' ", WHERE `nickname` = '%s' ",
dbesc($nickname) dbesc($nickname)
); );
if((count($r) > 1) && $newuid) { if ((dbm::is_result($r)) && (count($r) > 1) && $newuid) {
$result['message'] .= t('Nickname is already registered. Please choose another.') . EOL; $result['message'] .= t('Nickname is already registered. Please choose another.') . EOL;
q("DELETE FROM `user` WHERE `uid` = %d", q("DELETE FROM `user` WHERE `uid` = %d",
intval($newuid) intval($newuid)
@ -325,22 +325,25 @@ function create_user($arr) {
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4 ); $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4 );
if($r === false) if ($r === false) {
$photo_failure = true; $photo_failure = true;
}
$img->scaleImage(80); $img->scaleImage(80);
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 5 ); $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 5 );
if($r === false) if ($r === false) {
$photo_failure = true; $photo_failure = true;
}
$img->scaleImage(48); $img->scaleImage(48);
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 6 ); $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 6 );
if($r === false) if ($r === false) {
$photo_failure = true; $photo_failure = true;
}
if (! $photo_failure) { if (! $photo_failure) {
q("UPDATE `photo` SET `profile` = 1 WHERE `resource-id` = '%s' ", q("UPDATE `photo` SET `profile` = 1 WHERE `resource-id` = '%s' ",

View file

@ -123,15 +123,17 @@ class b8_storage_frndc extends b8_storage_base
function __destruct() function __destruct()
{ {
if($this->_connection === NULL) if ($this->_connection === NULL) {
return; return;
}
# Commit any changes before closing // Commit any changes before closing
$this->_commit(); $this->_commit();
# Just close the connection if no link-resource was passed and b8 created it's own connection // Just close the connection if no link-resource was passed and b8 created it's own connection
if($this->config['connection'] === NULL) if ($this->config['connection'] === NULL) {
mysql_close($this->_connection); mysql_close($this->_connection);
}
$this->connected = FALSE; $this->connected = FALSE;
@ -163,8 +165,7 @@ class b8_storage_frndc extends b8_storage_base
protected function _get_query($tokens, $uid) protected function _get_query($tokens, $uid)
{ {
# Construct the query ... // Construct the query ...
if (count($tokens) > 0) { if (count($tokens) > 0) {
$where = array(); $where = array();
@ -175,24 +176,22 @@ class b8_storage_frndc extends b8_storage_base
} }
$where = 'term IN ("' . implode('", "', $where) . '")'; $where = 'term IN ("' . implode('", "', $where) . '")';
} } else {
else {
$token = dbesc($token); $token = dbesc($token);
$where = 'term = "' . $token . '"'; $where = 'term = "' . $token . '"';
} }
# ... and fetch the data // ... and fetch the data
$result = q(' $result = q('SELECT * FROM `spam` WHERE ' . $where . ' AND `uid` = ' . $uid );
SELECT * FROM spam WHERE ' . $where . ' AND uid = ' . $uid );
$returned_tokens = array(); $returned_tokens = array();
if(count($result)) { if (dbm::is_result($result)) {
foreach($result as $rr) foreach ($result as $rr) {
$returned_tokens[] = $rr['term']; $returned_tokens[] = $rr['term'];
} }
}
$to_create = array(); $to_create = array();
if (count($tokens) > 0) { if (count($tokens) > 0) {
@ -203,14 +202,16 @@ class b8_storage_frndc extends b8_storage_base
if (count($to_create)) { if (count($to_create)) {
$sql = ''; $sql = '';
foreach ($to_create as $term) { foreach ($to_create as $term) {
if(strlen($sql)) if (strlen($sql)) {
$sql .= ','; $sql .= ',';
$sql .= sprintf("(term,datetime,uid) values('%s','%s',%d)", }
dbesc(str_tolower($term)) $sql .= sprintf("(`term`,`datetime`,`uid`) VALUES('%s','%s',%d)",
dbesc(str_tolower($term)),
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($uid) intval($uid)
); );
q("insert into spam " . $sql); }
q("INSERT INTO `spam` " . $sql);
} }
return $result; return $result;
@ -225,7 +226,6 @@ class b8_storage_frndc extends b8_storage_base
* @param string $count * @param string $count
* @return void * @return void
*/ */
protected function _put($token, $count, $uid) { protected function _put($token, $count, $uid) {
$token = dbesc($token); $token = dbesc($token);
$count = dbesc($count); $count = dbesc($count);
@ -241,7 +241,6 @@ class b8_storage_frndc extends b8_storage_base
* @param string $count * @param string $count
* @return void * @return void
*/ */
protected function _update($token, $count, $uid) protected function _update($token, $count, $uid)
{ {
$token = dbesc($token); $token = dbesc($token);
@ -257,7 +256,6 @@ class b8_storage_frndc extends b8_storage_base
* @param string $token * @param string $token
* @return void * @return void
*/ */
protected function _del($token, $uid) protected function _del($token, $uid)
{ {
$token = dbesc($token); $token = dbesc($token);
@ -272,7 +270,6 @@ class b8_storage_frndc extends b8_storage_base
* @access protected * @access protected
* @return void * @return void
*/ */
protected function _commit($uid) protected function _commit($uid)
{ {
@ -314,5 +311,3 @@ class b8_storage_frndc extends b8_storage_base
} }
} }
?>

View file

@ -1,8 +1,9 @@
<?php <?php
/// @TODO This file has DOS line endings!
require_once("mod/hostxrd.php"); require_once("mod/hostxrd.php");
require_once("mod/nodeinfo.php"); require_once("mod/nodeinfo.php");
function _well_known_init(&$a){ function _well_known_init(App &$a){
if ($a->argc > 1) { if ($a->argc > 1) {
switch($a->argv[1]) { switch($a->argv[1]) {
case "host-meta": case "host-meta":
@ -20,7 +21,7 @@ function _well_known_init(&$a){
killme(); killme();
} }
function wk_social_relay(&$a) { function wk_social_relay(App &$a) {
define('SR_SCOPE_ALL', 'all'); define('SR_SCOPE_ALL', 'all');
define('SR_SCOPE_TAGS', 'tags'); define('SR_SCOPE_TAGS', 'tags');

View file

@ -2,7 +2,7 @@
require_once('include/Scrape.php'); require_once('include/Scrape.php');
function acctlink_init(&$a) { function acctlink_init(App &$a) {
if(x($_GET,'addr')) { if(x($_GET,'addr')) {
$addr = trim($_GET['addr']); $addr = trim($_GET['addr']);

View file

@ -3,7 +3,7 @@
require_once("include/acl_selectors.php"); require_once("include/acl_selectors.php");
function acl_init(&$a){ function acl_init(App &$a){
acl_lookup($a); acl_lookup($a);
} }

View file

@ -23,7 +23,7 @@ require_once("include/text.php");
* @param App $a * @param App $a
* *
*/ */
function admin_post(&$a){ function admin_post(App &$a){
if(!is_site_admin()) { if(!is_site_admin()) {
@ -127,7 +127,7 @@ function admin_post(&$a){
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_content(&$a) { function admin_content(App &$a) {
if(!is_site_admin()) { if(!is_site_admin()) {
return login(false); return login(false);
@ -260,7 +260,7 @@ function admin_content(&$a) {
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_federation(&$a) { function admin_page_federation(App &$a) {
// get counts on active friendica, diaspora, redmatrix, hubzilla, gnu // get counts on active friendica, diaspora, redmatrix, hubzilla, gnu
// social and statusnet nodes this node is knowing // social and statusnet nodes this node is knowing
// //
@ -393,7 +393,7 @@ function admin_page_federation(&$a) {
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_queue(&$a) { function admin_page_queue(App &$a) {
// get content from the queue table // get content from the queue table
$r = q("SELECT `c`.`name`, `c`.`nurl`, `q`.`id`, `q`.`network`, `q`.`created`, `q`.`last` $r = q("SELECT `c`.`name`, `c`.`nurl`, `q`.`id`, `q`.`network`, `q`.`created`, `q`.`last`
FROM `queue` AS `q`, `contact` AS `c` FROM `queue` AS `q`, `contact` AS `c`
@ -427,7 +427,7 @@ function admin_page_queue(&$a) {
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_summary(&$a) { function admin_page_summary(App &$a) {
global $db; global $db;
// are there MyISAM tables in the DB? If so, trigger a warning message // are there MyISAM tables in the DB? If so, trigger a warning message
$r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1", $r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1",
@ -504,7 +504,7 @@ function admin_page_summary(&$a) {
* *
* @param App $a * @param App $a
*/ */
function admin_page_site_post(&$a) { function admin_page_site_post(App &$a) {
if(!x($_POST,"page_site")) { if(!x($_POST,"page_site")) {
return; return;
} }
@ -845,7 +845,7 @@ function admin_page_site_post(&$a) {
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_site(&$a) { function admin_page_site(App &$a) {
/* Installed langs */ /* Installed langs */
$lang_choices = get_available_languages(); $lang_choices = get_available_languages();
@ -1072,7 +1072,7 @@ function admin_page_site(&$a) {
* @param App $a * @param App $a
* @return string * @return string
**/ **/
function admin_page_dbsync(&$a) { function admin_page_dbsync(App &$a) {
$o = ''; $o = '';
@ -1155,7 +1155,7 @@ function admin_page_dbsync(&$a) {
* *
* @param App $a * @param App $a
*/ */
function admin_page_users_post(&$a){ function admin_page_users_post(App &$a){
$pending = (x($_POST, 'pending') ? $_POST['pending'] : array()); $pending = (x($_POST, 'pending') ? $_POST['pending'] : array());
$users = (x($_POST, 'user') ? $_POST['user'] : array()); $users = (x($_POST, 'user') ? $_POST['user'] : array());
$nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : ''); $nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : '');
@ -1260,7 +1260,7 @@ function admin_page_users_post(&$a){
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_users(&$a){ function admin_page_users(App &$a){
if($a->argc>2) { if($a->argc>2) {
$uid = $a->argv[3]; $uid = $a->argv[3];
$user = q("SELECT `username`, `blocked` FROM `user` WHERE `uid` = %d", intval($uid)); $user = q("SELECT `username`, `blocked` FROM `user` WHERE `uid` = %d", intval($uid));
@ -1460,7 +1460,7 @@ function admin_page_users(&$a){
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_plugins(&$a){ function admin_page_plugins(App &$a){
/* /*
* Single plugin * Single plugin
@ -1669,7 +1669,7 @@ function rebuild_theme_table($themes) {
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_themes(&$a){ function admin_page_themes(App &$a){
$allowed_themes_str = get_config('system','allowed_themes'); $allowed_themes_str = get_config('system','allowed_themes');
$allowed_themes_raw = explode(',',$allowed_themes_str); $allowed_themes_raw = explode(',',$allowed_themes_str);
@ -1850,7 +1850,7 @@ function admin_page_themes(&$a){
* *
* @param App $a * @param App $a
*/ */
function admin_page_logs_post(&$a) { function admin_page_logs_post(App &$a) {
if (x($_POST,"page_logs")) { if (x($_POST,"page_logs")) {
check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs'); check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs');
@ -1884,7 +1884,7 @@ function admin_page_logs_post(&$a) {
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_logs(&$a){ function admin_page_logs(App &$a){
$log_choices = array( $log_choices = array(
LOGGER_NORMAL => 'Normal', LOGGER_NORMAL => 'Normal',
@ -1941,7 +1941,7 @@ function admin_page_logs(&$a){
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_viewlogs(&$a){ function admin_page_viewlogs(App &$a){
$t = get_markup_template("admin_viewlogs.tpl"); $t = get_markup_template("admin_viewlogs.tpl");
$f = get_config('system','logfile'); $f = get_config('system','logfile');
$data = ''; $data = '';
@ -1983,7 +1983,7 @@ function admin_page_viewlogs(&$a){
* *
* @param App $a * @param App $a
*/ */
function admin_page_features_post(&$a) { function admin_page_features_post(App &$a) {
check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features'); check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features');
@ -2029,7 +2029,7 @@ function admin_page_features_post(&$a) {
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_features(&$a) { function admin_page_features(App &$a) {
if((argc() > 1) && (argv(1) === 'features')) { if((argc() > 1) && (argv(1) === 'features')) {
$arr = array(); $arr = array();

View file

@ -5,7 +5,7 @@ require_once('include/Contact.php');
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');
require_once('mod/contacts.php'); require_once('mod/contacts.php');
function allfriends_content(&$a) { function allfriends_content(App &$a) {
$o = ''; $o = '';
if (! local_user()) { if (! local_user()) {
@ -21,14 +21,14 @@ function allfriends_content(&$a) {
return; return;
} }
$uid = $a->user[uid]; $uid = $a->user['uid'];
$c = q("SELECT `name`, `url`, `photo` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", $c = q("SELECT `name`, `url`, `photo` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($cid), intval($cid),
intval(local_user()) intval(local_user())
); );
if (! count($c)) { if (! dbm::is_result($c)) {
return; return;
} }

View file

@ -1,6 +1,6 @@
<?php <?php
function amcd_content(&$a) { function amcd_content(App &$a) {
//header("Content-type: text/json"); //header("Content-type: text/json");
echo <<< EOT echo <<< EOT
{ {

View file

@ -20,7 +20,7 @@ function oauth_get_client($request){
return $r[0]; return $r[0];
} }
function api_post(&$a) { function api_post(App &$a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
@ -34,7 +34,7 @@ function api_post(&$a) {
} }
function api_content(&$a) { function api_content(App &$a) {
if ($a->cmd=='api/oauth/authorize'){ if ($a->cmd=='api/oauth/authorize'){
/* /*
* api/oauth/authorize interact with the user. return a standard page * api/oauth/authorize interact with the user. return a standard page

View file

@ -1,6 +1,6 @@
<?php <?php
function apps_content(&$a) { function apps_content(App &$a) {
$privateaddons = get_config('config','private_addons'); $privateaddons = get_config('config','private_addons');
if ($privateaddons === "1") { if ($privateaddons === "1") {
if((! (local_user()))) { if((! (local_user()))) {

View file

@ -2,7 +2,7 @@
require_once('include/security.php'); require_once('include/security.php');
function attach_init(&$a) { function attach_init(App &$a) {
if($a->argc != 2) { if($a->argc != 2) {
notice( t('Item not available.') . EOL); notice( t('Item not available.') . EOL);

View file

@ -9,7 +9,7 @@ function visible_lf($s) {
return str_replace("\n",'<br />', $s); return str_replace("\n",'<br />', $s);
} }
function babel_content(&$a) { function babel_content(App &$a) {
$o .= '<h1>Babel Diagnostic</h1>'; $o .= '<h1>Babel Diagnostic</h1>';

View file

@ -3,11 +3,11 @@
require_once('include/conversation.php'); require_once('include/conversation.php');
require_once('include/items.php'); require_once('include/items.php');
function bookmarklet_init(&$a) { function bookmarklet_init(App &$a) {
$_GET["mode"] = "minimal"; $_GET["mode"] = "minimal";
} }
function bookmarklet_content(&$a) { function bookmarklet_content(App &$a) {
if (!local_user()) { if (!local_user()) {
$o = '<h2>'.t('Login').'</h2>'; $o = '<h2>'.t('Login').'</h2>';
$o .= login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true); $o .= login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);

View file

@ -9,7 +9,7 @@
require_once('include/event.php'); require_once('include/event.php');
require_once('include/redir.php'); require_once('include/redir.php');
function cal_init(&$a) { function cal_init(App &$a) {
if($a->argc > 1) if($a->argc > 1)
auto_redir($a, $a->argv[1]); auto_redir($a, $a->argv[1]);
@ -64,7 +64,7 @@ function cal_init(&$a) {
return; return;
} }
function cal_content(&$a) { function cal_content(App &$a) {
nav_set_selected('events'); nav_set_selected('events');
$editselect = 'none'; $editselect = 'none';

View file

@ -5,19 +5,19 @@
*/ */
function cb_init(&$a) { function cb_init(App &$a) {
call_hooks('cb_init'); call_hooks('cb_init');
} }
function cb_post(&$a) { function cb_post(App &$a) {
call_hooks('cb_post', $_POST); call_hooks('cb_post', $_POST);
} }
function cb_afterpost(&$a) { function cb_afterpost(App &$a) {
call_hooks('cb_afterpost'); call_hooks('cb_afterpost');
} }
function cb_content(&$a) { function cb_content(App &$a) {
$o = ''; $o = '';
call_hooks('cb_content', $o); call_hooks('cb_content', $o);
return $o; return $o;

View file

@ -5,7 +5,7 @@ require_once('include/Contact.php');
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');
require_once('mod/contacts.php'); require_once('mod/contacts.php');
function common_content(&$a) { function common_content(App &$a) {
$o = ''; $o = '';
@ -53,8 +53,9 @@ function common_content(&$a) {
$a->page['aside'] .= $vcard_widget; $a->page['aside'] .= $vcard_widget;
} }
if(! count($c)) if (! dbm::is_result($c)) {
return; return;
}
if(! $cid) { if(! $cid) {
if(get_my_url()) { if(get_my_url()) {

View file

@ -1,6 +1,6 @@
<?php <?php
function community_init(&$a) { function community_init(App &$a) {
if (! local_user()) { if (! local_user()) {
unset($_SESSION['theme']); unset($_SESSION['theme']);
unset($_SESSION['mobile-theme']); unset($_SESSION['mobile-theme']);

View file

@ -2,7 +2,7 @@
require_once('include/group.php'); require_once('include/group.php');
function contactgroup_content(&$a) { function contactgroup_content(App &$a) {
if (! local_user()) { if (! local_user()) {

View file

@ -7,7 +7,7 @@ require_once('include/Scrape.php');
require_once('mod/proxy.php'); require_once('mod/proxy.php');
require_once('include/Photo.php'); require_once('include/Photo.php');
function contacts_init(&$a) { function contacts_init(App &$a) {
if (! local_user()) { if (! local_user()) {
return; return;
} }
@ -28,20 +28,24 @@ function contacts_init(&$a) {
require_once('include/group.php'); require_once('include/group.php');
require_once('include/contact_widgets.php'); require_once('include/contact_widgets.php');
if ($_GET['nets'] == "all") if ($_GET['nets'] == "all") {
$_GET['nets'] = ""; $_GET['nets'] = "";
}
if(! x($a->page,'aside')) if (! x($a->page,'aside')) {
$a->page['aside'] = ''; $a->page['aside'] = '';
}
if ($contact_id) { if ($contact_id) {
$a->data['contact'] = $r[0]; $a->data['contact'] = $r[0];
if (($a->data['contact']['network'] != "") AND ($a->data['contact']['network'] != NETWORK_DFRN)) { if (($a->data['contact']['network'] != "") AND ($a->data['contact']['network'] != NETWORK_DFRN)) {
$networkname = format_network_name($a->data['contact']['network'],$a->data['contact']['url']); $networkname = format_network_name($a->data['contact']['network'],$a->data['contact']['url']);
} else } else {
$networkname = ''; $networkname = '';
}
/// @TODO Add nice spaces
$vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array( $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array(
'$name' => htmlentities($a->data['contact']['name']), '$name' => htmlentities($a->data['contact']['name']),
'$photo' => $a->data['contact']['photo'], '$photo' => $a->data['contact']['photo'],
@ -51,17 +55,18 @@ function contacts_init(&$a) {
'$network' => t('Network:'), '$network' => t('Network:'),
'$account_type' => account_type($a->data['contact']) '$account_type' => account_type($a->data['contact'])
)); ));
$finpeople_widget = ''; $finpeople_widget = '';
$follow_widget = ''; $follow_widget = '';
$networks_widget = ''; $networks_widget = '';
} } else {
else {
$vcard_widget = ''; $vcard_widget = '';
$networks_widget .= networks_widget('contacts',$_GET['nets']); $networks_widget .= networks_widget('contacts',$_GET['nets']);
if (isset($_GET['add'])) if (isset($_GET['add'])) {
$follow_widget = follow_widget($_GET['add']); $follow_widget = follow_widget($_GET['add']);
else } else {
$follow_widget = follow_widget(); $follow_widget = follow_widget();
}
$findpeople_widget .= findpeople_widget(); $findpeople_widget .= findpeople_widget();
} }
@ -92,7 +97,7 @@ function contacts_init(&$a) {
} }
function contacts_batch_actions(&$a){ function contacts_batch_actions(App &$a){
$contacts_id = $_POST['contact_batch']; $contacts_id = $_POST['contact_batch'];
if (!is_array($contacts_id)) return; if (!is_array($contacts_id)) return;
@ -139,7 +144,7 @@ function contacts_batch_actions(&$a){
} }
function contacts_post(&$a) { function contacts_post(App &$a) {
if (! local_user()) { if (! local_user()) {
return; return;
@ -344,7 +349,7 @@ function _contact_drop($contact_id, $orig_record) {
} }
function contacts_content(&$a) { function contacts_content(App &$a) {
$sort_type = 0; $sort_type = 0;
$o = ''; $o = '';

View file

@ -5,7 +5,7 @@
* addons repository will be listed though ATM) * addons repository will be listed though ATM)
*/ */
function credits_content (&$a) { function credits_content (App &$a) {
/* fill the page with credits */ /* fill the page with credits */
$f = fopen('util/credits.txt','r'); $f = fopen('util/credits.txt','r');
$names = fread($f, filesize('util/credits.txt')); $names = fread($f, filesize('util/credits.txt'));

View file

@ -2,7 +2,7 @@
require_once("include/contact_selectors.php"); require_once("include/contact_selectors.php");
require_once("mod/contacts.php"); require_once("mod/contacts.php");
function crepair_init(&$a) { function crepair_init(App &$a) {
if (! local_user()) { if (! local_user()) {
return; return;
} }
@ -30,7 +30,7 @@ function crepair_init(&$a) {
} }
} }
function crepair_post(&$a) { function crepair_post(App &$a) {
if (! local_user()) { if (! local_user()) {
return; return;
} }
@ -96,7 +96,7 @@ function crepair_post(&$a) {
function crepair_content(&$a) { function crepair_content(App &$a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View file

@ -1,12 +1,12 @@
<?php <?php
require_once('mod/settings.php'); require_once('mod/settings.php');
function delegate_init(&$a) { function delegate_init(App &$a) {
return settings_init($a); return settings_init($a);
} }
function delegate_content(&$a) { function delegate_content(App &$a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
@ -21,7 +21,6 @@ function delegate_content(&$a) {
goaway(App::get_baseurl() . '/delegate'); goaway(App::get_baseurl() . '/delegate');
} }
$id = $a->argv[2]; $id = $a->argv[2];
$r = q("select `nickname` from user where uid = %d limit 1", $r = q("select `nickname` from user where uid = %d limit 1",
@ -45,12 +44,11 @@ function delegate_content(&$a) {
if ($a->argc > 2 && $a->argv[1] === 'remove' && intval($a->argv[2])) { if ($a->argc > 2 && $a->argv[1] === 'remove' && intval($a->argv[2])) {
// delegated admins can view but not change delegation permissions // delegated admins can view but not change delegation permissions
if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) { if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
goaway(App::get_baseurl() . '/delegate'); goaway(App::get_baseurl() . '/delegate');
} }
q("delete from manage where uid = %d and mid = %d limit 1", q("DELETE FROM `manage` WHERE `uid` = %d AND `mid` = %d LIMIT 1",
intval($a->argv[2]), intval($a->argv[2]),
intval(local_user()) intval(local_user())
); );

View file

@ -415,18 +415,21 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
); );
} }
if($r === false) /// @TODO is dbm::is_result() working here?
if ($r === false) {
notice( t('Unable to set contact photo.') . EOL); notice( t('Unable to set contact photo.') . EOL);
}
// reload contact info // reload contact info
$r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($contact_id) intval($contact_id)
); );
if (dbm::is_result($r)) if (dbm::is_result($r)) {
$contact = $r[0]; $contact = $r[0];
else } else {
$contact = null; $contact = null;
}
if ((isset($new_relation) && $new_relation == CONTACT_IS_FRIEND)) { if ((isset($new_relation) && $new_relation == CONTACT_IS_FRIEND)) {

View file

@ -11,7 +11,7 @@ require_once('include/event.php');
require_once('library/defuse/php-encryption-1.2.1/Crypto.php'); require_once('library/defuse/php-encryption-1.2.1/Crypto.php');
function dfrn_notify_post(&$a) { function dfrn_notify_post(App &$a) {
logger(__function__, LOGGER_TRACE); logger(__function__, LOGGER_TRACE);
$dfrn_id = ((x($_POST,'dfrn_id')) ? notags(trim($_POST['dfrn_id'])) : ''); $dfrn_id = ((x($_POST,'dfrn_id')) ? notags(trim($_POST['dfrn_id'])) : '');
$dfrn_version = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version'] : 2.0); $dfrn_version = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version'] : 2.0);
@ -221,7 +221,7 @@ function dfrn_notify_post(&$a) {
} }
function dfrn_notify_content(&$a) { function dfrn_notify_content(App &$a) {
if(x($_GET,'dfrn_id')) { if(x($_GET,'dfrn_id')) {

View file

@ -4,7 +4,7 @@ require_once('include/auth.php');
require_once('include/dfrn.php'); require_once('include/dfrn.php');
function dfrn_poll_init(&$a) { function dfrn_poll_init(App &$a) {
$dfrn_id = ((x($_GET,'dfrn_id')) ? $_GET['dfrn_id'] : ''); $dfrn_id = ((x($_GET,'dfrn_id')) ? $_GET['dfrn_id'] : '');
@ -137,7 +137,7 @@ function dfrn_poll_init(&$a) {
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", $c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($r[0]['cid']) intval($r[0]['cid'])
); );
if(! count($c)) { if (! dbm::is_result($c)) {
xml_status(3, 'No profile'); xml_status(3, 'No profile');
} }
$contact = $c[0]; $contact = $c[0];
@ -203,7 +203,7 @@ function dfrn_poll_init(&$a) {
function dfrn_poll_post(&$a) { function dfrn_poll_post(App &$a) {
$dfrn_id = ((x($_POST,'dfrn_id')) ? $_POST['dfrn_id'] : ''); $dfrn_id = ((x($_POST,'dfrn_id')) ? $_POST['dfrn_id'] : '');
$challenge = ((x($_POST,'challenge')) ? $_POST['challenge'] : ''); $challenge = ((x($_POST,'challenge')) ? $_POST['challenge'] : '');
@ -234,7 +234,7 @@ function dfrn_poll_post(&$a) {
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", $c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($r[0]['cid']) intval($r[0]['cid'])
); );
if(! count($c)) { if (! dbm::is_result($c)) {
xml_status(3, 'No profile'); xml_status(3, 'No profile');
} }
$contact = $c[0]; $contact = $c[0];
@ -383,7 +383,7 @@ function dfrn_poll_post(&$a) {
} }
} }
function dfrn_poll_content(&$a) { function dfrn_poll_content(App &$a) {
$dfrn_id = ((x($_GET,'dfrn_id')) ? $_GET['dfrn_id'] : ''); $dfrn_id = ((x($_GET,'dfrn_id')) ? $_GET['dfrn_id'] : '');
$type = ((x($_GET,'type')) ? $_GET['type'] : 'data'); $type = ((x($_GET,'type')) ? $_GET['type'] : 'data');

View file

@ -17,7 +17,7 @@ require_once('include/Scrape.php');
require_once('include/Probe.php'); require_once('include/Probe.php');
require_once('include/group.php'); require_once('include/group.php');
function dfrn_request_init(&$a) { function dfrn_request_init(App &$a) {
if($a->argc > 1) if($a->argc > 1)
$which = $a->argv[1]; $which = $a->argv[1];
@ -42,7 +42,7 @@ function dfrn_request_init(&$a) {
* After logging in, we click 'submit' to approve the linkage. * After logging in, we click 'submit' to approve the linkage.
* *
*/ */
function dfrn_request_post(&$a) { function dfrn_request_post(App &$a) {
if(($a->argc != 2) || (! count($a->profile))) { if(($a->argc != 2) || (! count($a->profile))) {
logger('Wrong count of argc or profiles: argc=' . $a->argc . ',profile()=' . count($a->profile)); logger('Wrong count of argc or profiles: argc=' . $a->argc . ',profile()=' . count($a->profile));
@ -658,7 +658,7 @@ function dfrn_request_post(&$a) {
} }
function dfrn_request_content(&$a) { function dfrn_request_content(App &$a) {
if (($a->argc != 2) || (! count($a->profile))) { if (($a->argc != 2) || (! count($a->profile))) {
return ""; return "";
@ -810,19 +810,17 @@ function dfrn_request_content(&$a) {
// At first look if an address was provided // At first look if an address was provided
// Otherwise take the local address // Otherwise take the local address
if (x($_GET,'addr') AND ($_GET['addr'] != "")) if (x($_GET,'addr') AND ($_GET['addr'] != "")) {
$myaddr = hex2bin($_GET['addr']); $myaddr = hex2bin($_GET['addr']);
elseif (x($_GET,'address') AND ($_GET['address'] != "")) } elseif (x($_GET,'address') AND ($_GET['address'] != "")) {
$myaddr = $_GET['address']; $myaddr = $_GET['address'];
elseif (local_user()) { } elseif (local_user()) {
if (strlen($a->path)) { if (strlen($a->path)) {
$myaddr = App::get_baseurl() . '/profile/' . $a->user['nickname']; $myaddr = App::get_baseurl() . '/profile/' . $a->user['nickname'];
} } else {
else {
$myaddr = $a->user['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 ); $myaddr = $a->user['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
} }
} } else {
else {
// last, try a zrl // last, try a zrl
$myaddr = get_my_url(); $myaddr = get_my_url();
} }
@ -840,8 +838,7 @@ function dfrn_request_content(&$a) {
if ($a->profile['page-flags'] == PAGE_NORMAL) { if ($a->profile['page-flags'] == PAGE_NORMAL) {
$tpl = get_markup_template('dfrn_request.tpl'); $tpl = get_markup_template('dfrn_request.tpl');
} } else {
else {
$tpl = get_markup_template('auto_request.tpl'); $tpl = get_markup_template('auto_request.tpl');
} }
@ -850,8 +847,10 @@ function dfrn_request_content(&$a) {
// see if we are allowed to have NETWORK_MAIL2 contacts // see if we are allowed to have NETWORK_MAIL2 contacts
$mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
if(get_config('system','dfrn_only'))
if (get_config('system','dfrn_only')) {
$mail_disabled = 1; $mail_disabled = 1;
}
if (! $mail_disabled) { if (! $mail_disabled) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",

View file

@ -1,6 +1,6 @@
<?php <?php
function directory_init(&$a) { function directory_init(App &$a) {
$a->set_pager_itemspage(60); $a->set_pager_itemspage(60);
if(local_user()) { if(local_user()) {
@ -20,14 +20,14 @@ function directory_init(&$a) {
} }
function directory_post(&$a) { function directory_post(App &$a) {
if(x($_POST,'search')) if(x($_POST,'search'))
$a->data['search'] = $_POST['search']; $a->data['search'] = $_POST['search'];
} }
function directory_content(&$a) { function directory_content(App &$a) {
global $db; global $db;
require_once("mod/proxy.php"); require_once("mod/proxy.php");

View file

@ -5,7 +5,7 @@ require_once('include/Contact.php');
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');
require_once('mod/contacts.php'); require_once('mod/contacts.php');
function dirfind_init(&$a) { function dirfind_init(App &$a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL ); notice( t('Permission denied.') . EOL );

View file

@ -1,6 +1,6 @@
<?php <?php
function display_init(&$a) { function display_init(App &$a) {
if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
return; return;

View file

@ -2,7 +2,7 @@
require_once('include/acl_selectors.php'); require_once('include/acl_selectors.php');
function editpost_content(&$a) { function editpost_content(App &$a) {
$o = ''; $o = '';
@ -23,7 +23,7 @@ function editpost_content(&$a) {
intval(local_user()) intval(local_user())
); );
if (! count($itm)) { if (! dbm::is_result($itm)) {
notice( t('Item not found') . EOL); notice( t('Item not found') . EOL);
return; return;
} }

View file

@ -8,7 +8,7 @@ require_once('include/datetime.php');
require_once('include/event.php'); require_once('include/event.php');
require_once('include/items.php'); require_once('include/items.php');
function events_init(&$a) { function events_init(App &$a) {
if (! local_user()) { if (! local_user()) {
return; return;
} }
@ -21,8 +21,9 @@ function events_init(&$a) {
$cal_widget = widget_events(); $cal_widget = widget_events();
if (! x($a->page,'aside')) if (! x($a->page,'aside')) {
$a->page['aside'] = ''; $a->page['aside'] = '';
}
$a->page['aside'] .= $cal_widget; $a->page['aside'] .= $cal_widget;
} }
@ -30,7 +31,7 @@ function events_init(&$a) {
return; return;
} }
function events_post(&$a) { function events_post(App &$a) {
logger('post: ' . print_r($_REQUEST,true)); logger('post: ' . print_r($_REQUEST,true));
@ -188,7 +189,7 @@ function events_post(&$a) {
function events_content(&$a) { function events_content(App &$a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View file

@ -10,8 +10,7 @@ require_once('include/Photo.php');
/** /**
* @param App $a * @param App $a
*/ */
/// @TODO & is missing or App ? function fbrowser_content(App &$a){
function fbrowser_content($a){
if (!local_user()) if (!local_user())
killme(); killme();

View file

@ -8,7 +8,7 @@ require_once("include/xml.php");
/// @TODO You always make it like this: function foo(&$a) /// @TODO You always make it like this: function foo(&$a)
/// @TODO This means that the value of $a can be changed in anything, remove & and use App as type-hint /// @TODO This means that the value of $a can be changed in anything, remove & and use App as type-hint
function fetch_init(&$a){ function fetch_init(App &$a){
if (($a->argc != 3) OR (!in_array($a->argv[1], array("post", "status_message", "reshare")))) { if (($a->argc != 3) OR (!in_array($a->argv[1], array("post", "status_message", "reshare")))) {
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found')); header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found'));

View file

@ -5,7 +5,7 @@ require_once('include/bbcode.php');
require_once('include/items.php'); require_once('include/items.php');
function filer_content(&$a) { function filer_content(App &$a) {
if (! local_user()) { if (! local_user()) {
killme(); killme();

View file

@ -1,6 +1,6 @@
<?php <?php
function filerm_content(&$a) { function filerm_content(App &$a) {
if (! local_user()) { if (! local_user()) {
killme(); killme();

View file

@ -5,7 +5,7 @@ require_once('include/follow.php');
require_once('include/Contact.php'); require_once('include/Contact.php');
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');
function follow_content(&$a) { function follow_content(App &$a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
@ -152,7 +152,7 @@ function follow_content(&$a) {
return $o; return $o;
} }
function follow_post(&$a) { function follow_post(App &$a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View file

@ -1,6 +1,6 @@
<?php <?php
function friendica_init(&$a) { function friendica_init(App &$a) {
if ($a->argv[1]=="json"){ if ($a->argv[1]=="json"){
$register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'); $register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
@ -59,7 +59,7 @@ function friendica_init(&$a) {
function friendica_content(&$a) { function friendica_content(App &$a) {
$o = ''; $o = '';
$o .= '<h3>Friendica</h3>'; $o .= '<h3>Friendica</h3>';

View file

@ -1,7 +1,7 @@
<?php <?php
function fsuggest_post(&$a) { function fsuggest_post(App &$a) {
if (! local_user()) { if (! local_user()) {
return; return;
@ -71,7 +71,7 @@ function fsuggest_post(&$a) {
function fsuggest_content(&$a) { function fsuggest_content(App &$a) {
require_once('include/acl_selectors.php'); require_once('include/acl_selectors.php');

View file

@ -4,7 +4,7 @@ function validate_members(&$item) {
$item = intval($item); $item = intval($item);
} }
function group_init(&$a) { function group_init(App &$a) {
if(local_user()) { if(local_user()) {
require_once('include/group.php'); require_once('include/group.php');
$a->page['aside'] = group_side('contacts','group','extended',(($a->argc > 1) ? intval($a->argv[1]) : 0)); $a->page['aside'] = group_side('contacts','group','extended',(($a->argc > 1) ? intval($a->argv[1]) : 0));
@ -13,7 +13,7 @@ function group_init(&$a) {
function group_post(&$a) { function group_post(App &$a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
@ -31,8 +31,7 @@ function group_post(&$a) {
if ($r) { if ($r) {
goaway(App::get_baseurl() . '/group/' . $r); goaway(App::get_baseurl() . '/group/' . $r);
} }
} } else {
else {
notice( t('Could not create group.') . EOL ); notice( t('Could not create group.') . EOL );
} }
goaway(App::get_baseurl() . '/group'); goaway(App::get_baseurl() . '/group');
@ -70,7 +69,7 @@ function group_post(&$a) {
return; return;
} }
function group_content(&$a) { function group_content(App &$a) {
$change = false; $change = false;
if (! local_user()) { if (! local_user()) {

View file

@ -1,6 +1,6 @@
<?php <?php
function hcard_init(&$a) { function hcard_init(App &$a) {
$blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false); $blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
@ -52,4 +52,3 @@ function hcard_init(&$a) {
} }
} }

View file

@ -18,7 +18,7 @@ if (!function_exists('load_doc_file')) {
} }
function help_content(&$a) { function help_content(App &$a) {
nav_set_selected('help'); nav_set_selected('help');

View file

@ -1,7 +1,7 @@
<?php <?php
if(! function_exists('home_init')) { if(! function_exists('home_init')) {
function home_init(&$a) { function home_init(App &$a) {
$ret = array(); $ret = array();
call_hooks('home_init',$ret); call_hooks('home_init',$ret);
@ -17,7 +17,7 @@ function home_init(&$a) {
}} }}
if(! function_exists('home_content')) { if(! function_exists('home_content')) {
function home_content(&$a) { function home_content(App &$a) {
$o = ''; $o = '';

View file

@ -2,7 +2,7 @@
require_once('include/crypto.php'); require_once('include/crypto.php');
function hostxrd_init(&$a) { function hostxrd_init(App &$a) {
header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Origin: *');
header("Content-type: text/xml"); header("Content-type: text/xml");
$pubkey = get_config('system','site_pubkey'); $pubkey = get_config('system','site_pubkey');

View file

@ -11,7 +11,7 @@
require_once("include/socgraph.php"); require_once("include/socgraph.php");
require_once("include/Contact.php"); require_once("include/Contact.php");
function hovercard_init(&$a) { function hovercard_init(App &$a) {
// Just for testing purposes // Just for testing purposes
$_GET["mode"] = "minimal"; $_GET["mode"] = "minimal";
} }

View file

@ -1,7 +1,7 @@
<?php <?php
function ignored_init(&$a) { function ignored_init(App &$a) {
$ignored = 0; $ignored = 0;

View file

@ -4,7 +4,7 @@ require_once "include/Photo.php";
$install_wizard_pass=1; $install_wizard_pass=1;
function install_init(&$a){ function install_init(App &$a){
// $baseurl/install/testrwrite to test if rewite in .htaccess is working // $baseurl/install/testrwrite to test if rewite in .htaccess is working
if ($a->argc==2 && $a->argv[1]=="testrewrite") { if ($a->argc==2 && $a->argv[1]=="testrewrite") {
@ -24,7 +24,7 @@ function install_init(&$a){
} }
function install_post(&$a) { function install_post(App &$a) {
global $install_wizard_pass, $db; global $install_wizard_pass, $db;
switch($install_wizard_pass) { switch($install_wizard_pass) {
@ -132,7 +132,7 @@ function get_db_errno() {
} }
} }
function install_content(&$a) { function install_content(App &$a) {
global $install_wizard_pass, $db; global $install_wizard_pass, $db;
$o = ''; $o = '';
@ -565,7 +565,7 @@ function check_imagik(&$checks) {
} }
} }
function manual_config(&$a) { function manual_config(App &$a) {
$data = htmlentities($a->data['txt'],ENT_COMPAT,'UTF-8'); $data = htmlentities($a->data['txt'],ENT_COMPAT,'UTF-8');
$o = t('The database configuration file ".htconfig.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.'); $o = t('The database configuration file ".htconfig.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.');
$o .= "<textarea rows=\"24\" cols=\"80\" >$data</textarea>"; $o .= "<textarea rows=\"24\" cols=\"80\" >$data</textarea>";
@ -581,7 +581,6 @@ function load_database_rem($v, $i){
} }
} }
function load_database($db) { function load_database($db) {
require_once("include/dbstructure.php"); require_once("include/dbstructure.php");

View file

@ -9,7 +9,7 @@
require_once('include/email.php'); require_once('include/email.php');
function invite_post(&$a) { function invite_post(App &$a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
@ -97,7 +97,7 @@ function invite_post(&$a) {
} }
function invite_content(&$a) { function invite_content(App &$a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View file

@ -27,7 +27,7 @@ require_once('include/Scrape.php');
require_once('include/diaspora.php'); require_once('include/diaspora.php');
require_once('include/Contact.php'); require_once('include/Contact.php');
function item_post(&$a) { function item_post(App &$a) {
if((! local_user()) && (! remote_user()) && (! x($_REQUEST,'commenter'))) if((! local_user()) && (! remote_user()) && (! x($_REQUEST,'commenter')))
return; return;
@ -138,7 +138,7 @@ function item_post(&$a) {
// If the contact id doesn't fit with the contact, then set the contact to null // If the contact id doesn't fit with the contact, then set the contact to null
$thrparent = q("SELECT `author-link`, `network` FROM `item` WHERE `uri` = '%s' LIMIT 1", dbesc($thr_parent)); $thrparent = q("SELECT `author-link`, `network` FROM `item` WHERE `uri` = '%s' LIMIT 1", dbesc($thr_parent));
if (count($thrparent) AND ($thrparent[0]["network"] === NETWORK_OSTATUS) if (dbm::is_result($thrparent) AND ($thrparent[0]["network"] === NETWORK_OSTATUS)
AND (normalise_link($parent_contact["url"]) != normalise_link($thrparent[0]["author-link"]))) { AND (normalise_link($parent_contact["url"]) != normalise_link($thrparent[0]["author-link"]))) {
$parent_contact = get_contact_details_by_url($thrparent[0]["author-link"]); $parent_contact = get_contact_details_by_url($thrparent[0]["author-link"]);
@ -218,8 +218,9 @@ function item_post(&$a) {
intval($profile_uid), intval($profile_uid),
intval($post_id) intval($post_id)
); );
if(! count($i)) if (! dbm::is_result($i)) {
killme(); killme();
}
$orig_post = $i[0]; $orig_post = $i[0];
} }
@ -605,8 +606,9 @@ function item_post(&$a) {
continue; continue;
$success = handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag, $network); $success = handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag, $network);
if($success['replaced']) if ($success['replaced']) {
$tagged[] = $tag; $tagged[] = $tag;
}
if (is_array($success['contact']) && intval($success['contact']['prv'])) { if (is_array($success['contact']) && intval($success['contact']['prv'])) {
$private_forum = true; $private_forum = true;
$private_id = $success['contact']['id']; $private_id = $success['contact']['id'];
@ -1064,7 +1066,7 @@ function item_post_return($baseurl, $api_source, $return_path) {
function item_content(&$a) { function item_content(App &$a) {
if ((! local_user()) && (! remote_user())) { if ((! local_user()) && (! remote_user())) {
return; return;

View file

@ -5,7 +5,7 @@ require_once('include/bbcode.php');
require_once('include/items.php'); require_once('include/items.php');
require_once('include/like.php'); require_once('include/like.php');
function like_content(&$a) { function like_content(App &$a) {
if(! local_user() && ! remote_user()) { if(! local_user() && ! remote_user()) {
return false; return false;
} }

View file

@ -3,7 +3,7 @@
require_once('include/datetime.php'); require_once('include/datetime.php');
function localtime_post(&$a) { function localtime_post(App &$a) {
$t = $_REQUEST['time']; $t = $_REQUEST['time'];
if(! $t) if(! $t)
@ -16,7 +16,7 @@ function localtime_post(&$a) {
} }
function localtime_content(&$a) { function localtime_content(App &$a) {
$t = $_REQUEST['time']; $t = $_REQUEST['time'];
if(! $t) if(! $t)
$t = 'now'; $t = 'now';

View file

@ -1,7 +1,7 @@
<?php <?php
function lockview_content(&$a) { function lockview_content(App &$a) {
$type = (($a->argc > 1) ? $a->argv[1] : 0); $type = (($a->argc > 1) ? $a->argv[1] : 0);
if (is_numeric($type)) { if (is_numeric($type)) {

View file

@ -1,6 +1,6 @@
<?php <?php
function login_content(&$a) { function login_content(App &$a) {
if(x($_SESSION,'theme')) if(x($_SESSION,'theme'))
unset($_SESSION['theme']); unset($_SESSION['theme']);
if(x($_SESSION,'mobile-theme')) if(x($_SESSION,'mobile-theme'))

View file

@ -4,7 +4,7 @@ require_once('include/email.php');
require_once('include/enotify.php'); require_once('include/enotify.php');
require_once('include/text.php'); require_once('include/text.php');
function lostpass_post(&$a) { function lostpass_post(App &$a) {
$loginame = notags(trim($_POST['login-name'])); $loginame = notags(trim($_POST['login-name']));
if(! $loginame) if(! $loginame)
@ -77,7 +77,7 @@ function lostpass_post(&$a) {
} }
function lostpass_content(&$a) { function lostpass_content(App &$a) {
if(x($_GET,'verify')) { if(x($_GET,'verify')) {
@ -102,6 +102,8 @@ function lostpass_content(&$a) {
dbesc($new_password_encoded), dbesc($new_password_encoded),
intval($uid) intval($uid)
); );
/// @TODO Is dbm::is_result() okay here?
if ($r) { if ($r) {
$tpl = get_markup_template('pwdreset.tpl'); $tpl = get_markup_template('pwdreset.tpl');
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(

View file

@ -1,6 +1,6 @@
<?php <?php
function maintenance_content(&$a) { function maintenance_content(App &$a) {
header('HTTP/1.1 503 Service Temporarily Unavailable'); header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable'); header('Status: 503 Service Temporarily Unavailable');
header('Retry-After: 600'); header('Retry-After: 600');

View file

@ -3,7 +3,7 @@
require_once("include/text.php"); require_once("include/text.php");
function manage_post(&$a) { function manage_post(App &$a) {
if (! local_user()) { if (! local_user()) {
return; return;
@ -92,7 +92,7 @@ function manage_post(&$a) {
function manage_content(&$a) { function manage_content(App &$a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View file

@ -13,7 +13,7 @@ require_once('mod/proxy.php');
* @param App &$a * @param App &$a
* @return void|string * @return void|string
*/ */
function match_content(&$a) { function match_content(App &$a) {
$o = ''; $o = '';
if (! local_user()) { if (! local_user()) {

View file

@ -4,7 +4,7 @@ require_once('include/acl_selectors.php');
require_once('include/message.php'); require_once('include/message.php');
require_once('include/Smilies.php'); require_once('include/Smilies.php');
function message_init(&$a) { function message_init(App &$a) {
$tabs = ''; $tabs = '';
@ -40,7 +40,7 @@ function message_init(&$a) {
} }
function message_post(&$a) { function message_post(App &$a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
@ -173,7 +173,7 @@ function item_redir_and_replace_images($body, $images, $cid) {
function message_content(&$a) { function message_content(App &$a) {
$o = ''; $o = '';
nav_set_selected('messages'); nav_set_selected('messages');

View file

@ -2,7 +2,7 @@
require_once('library/asn1.php'); require_once('library/asn1.php');
function modexp_init(&$a) { function modexp_init(App &$a) {
if($a->argc != 2) if($a->argc != 2)
killme(); killme();

View file

@ -5,7 +5,7 @@ require_once('include/bbcode.php');
require_once('include/items.php'); require_once('include/items.php');
function mood_init(&$a) { function mood_init(App &$a) {
if (! local_user()) { if (! local_user()) {
return; return;
@ -109,7 +109,7 @@ function mood_init(&$a) {
function mood_content(&$a) { function mood_content(App &$a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View file

@ -1,6 +1,6 @@
<?php <?php
function msearch_post(&$a) { function msearch_post(App &$a) {
$perpage = (($_POST['n']) ? $_POST['n'] : 80); $perpage = (($_POST['n']) ? $_POST['n'] : 80);
$page = (($_POST['p']) ? intval($_POST['p'] - 1) : 0); $page = (($_POST['p']) ? intval($_POST['p'] - 1) : 0);

View file

@ -2,7 +2,7 @@
require_once("include/nav.php"); require_once("include/nav.php");
function navigation_content(&$a) { function navigation_content(App &$a) {
$nav_info = nav_info($a); $nav_info = nav_info($a);

View file

@ -1,13 +1,14 @@
<?php <?php
function network_init(&$a) { function network_init(App &$a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
return; return;
} }
$is_a_date_query = false; $is_a_date_query = false;
if(x($_GET['cid']) && intval($_GET['cid']) != 0) if (x($_GET['cid']) && intval($_GET['cid']) != 0) {
$cid = $_GET['cid']; $cid = $_GET['cid'];
}
if ($a->argc > 1) { if ($a->argc > 1) {
for ($x = 1; $x < $a->argc; $x ++) { for ($x = 1; $x < $a->argc; $x ++) {
@ -24,7 +25,6 @@ function network_init(&$a) {
parse_str($query_string, $query_array); parse_str($query_string, $query_array);
array_shift($query_array); array_shift($query_array);
// fetch last used network view and redirect if needed // fetch last used network view and redirect if needed
if (! $is_a_date_query) { if (! $is_a_date_query) {
$sel_tabs = network_query_get_sel_tab($a); $sel_tabs = network_query_get_sel_tab($a);
@ -43,8 +43,7 @@ function network_init(&$a) {
if ($remember_group) { if ($remember_group) {
$net_baseurl .= '/' . $last_sel_groups; // Note that the group number must come before the "/new" tab selection $net_baseurl .= '/' . $last_sel_groups; // Note that the group number must come before the "/new" tab selection
} } elseif($sel_groups !== false) {
else if($sel_groups !== false) {
$net_baseurl .= '/' . $sel_groups; $net_baseurl .= '/' . $sel_groups;
} }
@ -222,7 +221,7 @@ function saved_searches($search) {
* *
* @return Array ( $no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active ); * @return Array ( $no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active );
*/ */
function network_query_get_sel_tab($a) { function network_query_get_sel_tab(App &$a) {
$no_active=''; $no_active='';
$starred_active = ''; $starred_active = '';
$new_active = ''; $new_active = '';
@ -293,7 +292,7 @@ function network_query_get_sel_net() {
return $network; return $network;
} }
function network_query_get_sel_group($a) { function network_query_get_sel_group(App &$a) {
$group = false; $group = false;
if($a->argc >= 2 && is_numeric($a->argv[1])) { if($a->argc >= 2 && is_numeric($a->argv[1])) {
@ -810,7 +809,7 @@ function network_content(&$a, $update = 0) {
* @param app $a The global App * @param app $a The global App
* @return string Html of the networktab * @return string Html of the networktab
*/ */
function network_tabs($a) { function network_tabs(App &$a) {
// item filter tabs // item filter tabs
/// @TODO fix this logic, reduce duplication /// @TODO fix this logic, reduce duplication
/// $a->page['content'] .= '<div class="tabs-wrapper">'; /// $a->page['content'] .= '<div class="tabs-wrapper">';

View file

@ -1,6 +1,6 @@
<?php <?php
function newmember_content(&$a) { function newmember_content(App &$a) {
$o = '<h1>' . t('Welcome to Friendica') . '</h1>'; $o = '<h1>' . t('Welcome to Friendica') . '</h1>';

View file

@ -7,7 +7,7 @@
require_once("include/plugin.php"); require_once("include/plugin.php");
function nodeinfo_wellknown(&$a) { function nodeinfo_wellknown(App &$a) {
if (!get_config("system", "nodeinfo")) { if (!get_config("system", "nodeinfo")) {
http_status_exit(404); http_status_exit(404);
killme(); killme();
@ -20,7 +20,7 @@ function nodeinfo_wellknown(&$a) {
exit; exit;
} }
function nodeinfo_init(&$a){ function nodeinfo_init(App &$a){
if (!get_config("system", "nodeinfo")) { if (!get_config("system", "nodeinfo")) {
http_status_exit(404); http_status_exit(404);
killme(); killme();

View file

@ -4,7 +4,7 @@ require_once('include/Contact.php');
require_once('include/socgraph.php'); require_once('include/socgraph.php');
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');
function nogroup_init(&$a) { function nogroup_init(App &$a) {
if (! local_user()) { if (! local_user()) {
return; return;
@ -21,7 +21,7 @@ function nogroup_init(&$a) {
} }
function nogroup_content(&$a) { function nogroup_content(App &$a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View file

@ -1,6 +1,6 @@
<?php <?php
function noscrape_init(&$a) { function noscrape_init(App &$a) {
if($a->argc > 1) if($a->argc > 1)
$which = $a->argv[1]; $which = $a->argv[1];

View file

@ -1,6 +1,6 @@
<?php <?php
function notes_init(&$a) { function notes_init(App &$a) {
if (! local_user()) { if (! local_user()) {
return; return;

View file

@ -1,7 +1,7 @@
<?php <?php
/* identi.ca -> friendica items permanent-url compatibility */ /* identi.ca -> friendica items permanent-url compatibility */
function notice_init(&$a){ function notice_init(App &$a){
$id = $a->argv[1]; $id = $a->argv[1];
$r = q("SELECT user.nickname FROM user LEFT JOIN item ON item.uid=user.uid WHERE item.id=%d", $r = q("SELECT user.nickname FROM user LEFT JOIN item ON item.uid=user.uid WHERE item.id=%d",
intval($id) intval($id)

View file

@ -9,7 +9,7 @@ require_once("include/NotificationsManager.php");
require_once("include/contact_selectors.php"); require_once("include/contact_selectors.php");
require_once("include/network.php"); require_once("include/network.php");
function notifications_post(&$a) { function notifications_post(App &$a) {
if (! local_user()) { if (! local_user()) {
goaway(z_root()); goaway(z_root());
@ -65,7 +65,7 @@ function notifications_post(&$a) {
} }
} }
function notifications_content(&$a) { function notifications_content(App &$a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View file

@ -1,8 +1,7 @@
<?php <?php
require_once('include/NotificationsManager.php'); require_once('include/NotificationsManager.php');
function notify_init(App &$a) {
function notify_init(&$a) {
if (! local_user()) { if (! local_user()) {
return; return;
} }
@ -40,7 +39,7 @@ function notify_init(&$a) {
} }
function notify_content(&$a) { function notify_content(App &$a) {
if (! local_user()) { if (! local_user()) {
return login(); return login();
} }

View file

@ -1,7 +1,7 @@
<?php <?php
require_once("include/oembed.php"); require_once("include/oembed.php");
function oembed_content(&$a){ function oembed_content(App &$a){
// logger('mod_oembed ' . $a->query_string, LOGGER_ALL); // logger('mod_oembed ' . $a->query_string, LOGGER_ALL);
if ($a->argv[1]=='b2h'){ if ($a->argv[1]=='b2h'){

View file

@ -1,7 +1,7 @@
<?php <?php
function oexchange_init(&$a) { function oexchange_init(App &$a) {
if(($a->argc > 1) && ($a->argv[1] === 'xrd')) { if(($a->argc > 1) && ($a->argv[1] === 'xrd')) {
$tpl = get_markup_template('oexchange_xrd.tpl'); $tpl = get_markup_template('oexchange_xrd.tpl');
@ -14,7 +14,7 @@ function oexchange_init(&$a) {
} }
function oexchange_content(&$a) { function oexchange_content(App &$a) {
if (! local_user()) { if (! local_user()) {
$o = login(false); $o = login(false);

View file

@ -4,7 +4,7 @@
require_once('library/openid.php'); require_once('library/openid.php');
function openid_content(&$a) { function openid_content(App &$a) {
$noid = get_config('system','no_openid'); $noid = get_config('system','no_openid');
if($noid) if($noid)

View file

@ -1,5 +1,5 @@
<?php <?php
function opensearch_content(&$a) { function opensearch_content(App &$a) {
$tpl = get_markup_template('opensearch.tpl'); $tpl = get_markup_template('opensearch.tpl');

View file

@ -3,7 +3,7 @@
require_once('include/Scrape.php'); require_once('include/Scrape.php');
require_once('include/follow.php'); require_once('include/follow.php');
function ostatus_subscribe_content(&$a) { function ostatus_subscribe_content(App &$a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View file

@ -19,7 +19,7 @@ use \Friendica\ParseUrl;
require_once("include/items.php"); require_once("include/items.php");
function parse_url_content(&$a) { function parse_url_content(App &$a) {
$text = null; $text = null;
$str_tags = ""; $str_tags = "";

Some files were not shown because too many files have changed in this diff Show more