* Sets the base url for use in cmdline programs which don't have
* $_SERVER variables
*/
-function check_url(&$a) {
+function check_url(App &$a) {
$url = get_config('system','url');
/**
* @brief Automatic database updates
*/
-function update_db(&$a) {
+function update_db(App &$a) {
$build = get_config('system','build');
if(! x($build))
$build = set_config('system','build',DB_UPDATE_VERSION);
* @param App $a
*
*/
-function check_plugins(&$a) {
+function check_plugins(App &$a) {
$r = q("SELECT * FROM `addon` WHERE `installed` = 1");
if (dbm::is_result($r))
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
/// to avoid breaking themes again unnecessarily
$a->argc = 3
$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.
-They may also contain plugin_name_post(&$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.
+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(App &$a) which is called before the _content function and typically handles the results of POST forms.
+You may also have plugin_name_init(App &$a) which is called very early on and often does module initialisation.
Templates
---
file: mod/network.php\r
<?php\r
\r
- function network_content(&$a) {\r
+ function network_content(App &$a) {\r
$itemsmanager = new \Friendica\ItemsManager();\r
$items = $itemsmanager->getAll();\r
\r
$a->argc = 3
$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.
-Sie können auch plugin_name_post(&$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.
+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(App &$a) umfassen, welches vor der content-Funktion aufgerufen wird und normalerweise die Resultate der POST-Formulare handhabt.
+Du kannst ebenso plugin_name_init(App &$a) nutzen, was oft frühzeitig aufgerufen wird und das Modul initialisert.
Derzeitige Hooks
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.
- function theme_post(&$a){
+ function theme_post(App &$a){
// non local users shall not pass
if (! local_user()) {
return;
<?php
/* meta informations for the theme, see below */
- function duepuntozero_lr_init(&$a) {
+ function duepuntozero_lr_init(App &$a) {
$a-> theme_info = array(
'extends' => 'duepuntozero'.
);
The name of the function is <theme-name>_init.
So in the case of quattro it is
- function quattro_init(&$a) {
+ function quattro_init(App &$a) {
$a->theme_info = array();
set_template_engine($a, 'smarty3');
}
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();
require_once('include/datetime.php');
dbesc(normalise_link($url)), intval($uid));
// 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`,
`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",
dbesc(normalise_link($url)));
// 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`,
`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'",
$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();
foreach ($r as $rr) {
$ret[] = intval($rr['id']);
);
echo json_encode($o);
killme();
- }
- else
+ } else {
$r = array();
+ }
if (dbm::is_result($r)) {
* @param App $a
* @return array with the search results
*/
-function navbar_complete(&$a) {
+function navbar_complete(App &$a) {
// logger('navbar_complete');
* @hook 'logged_in'
* array $user logged user record
*/
- function api_login(&$a){
+ function api_login(App &$a){
// login with oauth
try{
$oauth = new FKOAuth1();
* @param App $a
* @return string API call result
*/
- function api_call(&$a){
- GLOBAL $API, $called_api;
+ function api_call(App &$a){
+ global $API, $called_api;
$type="json";
if (strpos($a->query_string, ".xml")>0) $type="xml";
intval($gid),
dbesc($name));
// error message if specified gid is not in database
- if (count($rname) == 0)
+ if (!dbm::is_result($rname))
throw new BadRequestException('wrong group name');
// delete group
intval($uid),
dbesc($name));
// error message if specified group name already exists
- if (count($rname) != 0)
+ if (dbm::is_result($rname))
throw new BadRequestException('group name already exists');
// check if specified group name is a deleted group
intval($uid),
dbesc($name));
// error message if specified group name already exists
- if (count($rname) != 0)
+ if (dbm::is_result($rname))
$reactivate_group = true;
// create group
$matches = false;
$terms = array();
- $cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
- if($cnt) {
+ $cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
+ if ($cnt) {
foreach($matches as $mtch) {
$unescaped = xmlify(file_tag_decode($mtch[1]));
$terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
$a = get_app();
- if(! feature_enabled($a->profile['profile_uid'],'categories'))
+ if (! feature_enabled($a->profile['profile_uid'],'categories')) {
return '';
+ }
$saved = get_pconfig($a->profile['profile_uid'],'system','filetags');
- if(! strlen($saved))
+ if (! strlen($saved)) {
return;
+ }
$matches = false;
$terms = array();
intval($c['id'])
);
- if((! $res) || (! count($res)))
+ if (dbm::is_result($res))
continue;
foreach($res as $contact) {
*
* @param App $a
*/
-function cron_clear_cache(&$a) {
+function cron_clear_cache(App &$a) {
$last = get_config('system','cache_last_cleared');
*
* @param App $a
*/
-function cron_repair_diaspora(&$a) {
+function cron_repair_diaspora(App &$a) {
$r = q("SELECT `id`, `url` FROM `contact`
WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '')
ORDER BY RAND() LIMIT 50", dbesc(NETWORK_DIASPORA));
dbesc($xt->id),
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.
dbesc($target_guid),
intval($importer["uid"])
);
- if (!$r)
+ if (!$r) {
return false;
+ }
// Check if the sender is the thread owner
$p = q("SELECT `id`, `author-link`, `origin` FROM `item` WHERE `id` = %d",
logger("Deleted target ".$target_guid." (".$r[0]["id"].") from user ".$importer["uid"]." parent: ".$p[0]["id"], LOGGER_DEBUG);
// Now check if the retraction needs to be relayed by us
- if($p[0]["origin"]) {
+ if ($p[0]["origin"]) {
// notify others
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $r[0]["id"]);
}
* @return string the handle in the format user@domain.tld
*/
private function my_handle($contact) {
- if ($contact["addr"] != "")
+ if ($contact["addr"] != "") {
return $contact["addr"];
+ }
// 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.
- if ($contact["nickname"] != "")
+ if ($contact["nickname"] != "") {
$nick = $contact["nickname"];
- else
+ } else {
$nick = $contact["nick"];
+ }
return $nick."@".substr(App::get_baseurl(), strpos(App::get_baseurl(),"://") + 3);
}
}
-function sort_by_date($a) {
+function sort_by_date(App &$a) {
usort($a,'ev_compare');
return $a;
if ($interactive) {
if (strlen($a->path)) {
$myaddr = bin2hex(App::get_baseurl() . '/profile/' . $a->user['nickname']);
- }
- else {
+ } else {
$myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());
}
// NOTREACHED
}
- }
- else {
- if(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('No compatible communication protocols or feeds were discovered.') . EOL;
return $result;
}
}
-
-
-
-
-
// 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']);
-
+ }
// 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;
- if(! x($ret,'poll'))
+ if (! x($ret,'poll')) {
$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;
- if(! x($ret,'url'))
+ }
+ if (! x($ret,'url')) {
$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('Use mailto: in front of address to force email check.') . EOL;
}
return $result;
}
- if($ret['network'] === NETWORK_OSTATUS && get_config('system','ostatus_disabled')) {
+ if ($ret['network'] === NETWORK_OSTATUS && get_config('system','ostatus_disabled')) {
$result['message'] .= t('The profile address specified belongs to a network which has been disabled on this site.') . EOL;
$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;
}
$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;
+ }
// check if we already have a contact
// the poll url is more reliable than the profile url, as we may have
if (dbm::is_result($r)) {
// update contact
- if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) {
+ if ($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) {
q("UPDATE `contact` SET `rel` = %d , `subhub` = %d, `readonly` = 0 WHERE `id` = %d AND `uid` = %d",
intval(CONTACT_IS_FRIEND),
intval($subhub),
);
}
} else {
-
-
// 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)
);
if (dbm::is_result($r))
$total_contacts = $r[0]['total'];
- if(! service_class_allows($uid,'total_contacts',$total_contacts)) {
+ if (! service_class_allows($uid,'total_contacts',$total_contacts)) {
$result['message'] .= upgrade_message();
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),
dbesc($network)
);
- if (dbm::is_result($r))
+ if (dbm::is_result($r)) {
$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();
return $result;
}
$result['cid'] = $contact_id;
$def_gid = get_default_group($uid, $contact["network"]);
- if (intval($def_gid))
+ if (intval($def_gid)) {
group_add_member($uid, '', $contact_id, $def_gid);
+ }
// Update the avatar
update_contact_avatar($ret['photo'],$uid,$contact_id);
if (dbm::is_result($r)) {
if (($contact['network'] == NETWORK_OSTATUS) && (strlen($contact['notify']))) {
-
// create a follow slap
$item = array();
$item['verb'] = ACTIVITY_FOLLOW;
if ($connect AND local_user()) {
if (isset($profile["url"])) {
$profile_url = normalise_link($profile["url"]);
- }
- else {
+ } else {
$profile_url = normalise_link(App::get_baseurl()."/profile/".$profile["nickname"]);
}
));
}
-function advanced_profile(&$a) {
+function advanced_profile(App &$a) {
$o = '';
$uid = $a->profile['uid'];
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') {
- $profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
+ 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'));
}
- 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
if (feature_enabled($uid,'forumlist_profile')) {
$profile['forumlist'] = array( t('Forums:'), ForumManager::profile_advanced($uid));
function profile_tabs($a, $is_owner=False, $nickname=Null){
//echo "<pre>"; var_dump($a->user); killme();
- if (is_null($nickname))
+ if (is_null($nickname)) {
$nickname = $a->user['nickname'];
+ }
- if(x($_GET,'tab'))
+ if (x($_GET,'tab')) {
$tab = notags(trim($_GET['tab']));
+ }
$url = App::get_baseurl() . '/profile/' . $nickname;
return false;
}
-function zrl_init(&$a) {
+function zrl_init(App &$a) {
$tmp_str = get_my_url();
if(validate_url($tmp_str)) {
// 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);
$u = q("SELECT `nickname` FROM `user` WHERE `uid` = %d", intval($arr['uid']));
- if (count($u)) {
+ if (dbm::is_result($u)) {
$a = get_app();
$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);
// in it.
if (!$deleted AND !$dontcache) {
- $r = q('SELECT * FROM `item` WHERE id = %d', intval($current_post));
- if (count($r) == 1) {
+ $r = q('SELECT * FROM `item` WHERE `id` = %d', intval($current_post));
+ if ((dbm::is_result($r)) && (count($r) == 1)) {
if ($notify)
call_hooks('post_local_end', $r[0]);
else
$u = q("select * from user where uid = %d limit 1",
intval($uid)
);
- if (! count($u))
+
+ if (! dbm::is_result($u)) {
return;
+ }
$community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? 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($uid)
);
- if (! count($i))
+ if (! dbm::is_result($i)) {
return;
+ }
$item = $i[0];
$c = q("select name, url, thumb from contact where self = 1 and uid = %d limit 1",
intval($u[0]['uid'])
);
- if (! count($c)) {
+ if (! dbm::is_result($c)) {
return;
}
function tgroup_check($uid,$item) {
- $a = get_app();
-
$mention = false;
// check that the message originated elsewhere and is a top-level post
if (($item['wall']) || ($item['origin']) || ($item['uri'] != $item['parent-uri']))
return false;
-
- $u = q("select * from user where uid = %d limit 1",
+ /// @TODO Encapsulate this or find it encapsulated and replace all occurrances
+ $u = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
- if (! count($u))
+ if (! dbm::is_result($u)) {
return false;
+ }
$community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
$prvgroup = (($u[0]['page-flags'] == PAGE_PRVGROUP) ? true : false);
$ret = list_post_dates($uid,$wall);
- if (! count($ret))
+ if (! dbm::is_result($ret))
return $o;
$cutoff_year = intval(datetime_convert('',date_default_timezone_get(),'now','Y')) - $visible_years;
intval($_SESSION['visitor_id']),
intval($owner_uid)
);
- if (dbm::is_result($r))
+ if (dbm::is_result($r)) {
$contact = $r[0];
+ }
}
if (! $contact) {
return false;
<?php
-function nav(&$a) {
+function nav(App &$a) {
/*
*
libxml_use_internal_errors(true);
$x = @simplexml_load_string($s2);
- if(! $x) {
+ if (! $x) {
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);
+ }
libxml_clear_errors();
}
return $x;
function scale_external_images($srctext, $include_link = true, $scale_replace = false) {
// 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;
+ }
$a = get_app();
$matches = null;
$c = preg_match_all('/\[img.*?\](.*?)\[\/img\]/ism',$s,$matches,PREG_SET_ORDER);
- if($c) {
+ if ($c) {
require_once('include/Photo.php');
- foreach($matches as $mtch) {
+ foreach ($matches as $mtch) {
logger('scale_external_image: ' . $mtch[1]);
$hostname = str_replace('www.','',substr(App::get_baseurl(),strpos(App::get_baseurl(),'://')+3));
- if(stristr($mtch[1],$hostname))
+ if (stristr($mtch[1],$hostname)) {
continue;
+ }
// $scale_replace, if passed, is an array of two elements. 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.
// This allows Friendica to display the smaller remote image if
// 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]);
- else
+ } else {
$scaled = $mtch[1];
- $i = @fetch_url($scaled);
- if(! $i)
+ }
+ $i = fetch_url($scaled);
+ if (! $i) {
return $srctext;
+ }
// guess mimetype from headers or filename
$type = guess_image_type($mtch[1],true);
- if($i) {
+ if ($i) {
$ph = new Photo($i, $type);
- if($ph->is_valid()) {
+ if ($ph->is_valid()) {
$orig_width = $ph->getWidth();
$orig_height = $ph->getHeight();
- if($orig_width > 640 || $orig_height > 640) {
+ if ($orig_width > 640 || $orig_height > 640) {
$ph->scaleImage(640);
$new_width = $ph->getWidth();
function fix_contact_ssl_policy(&$contact,$new_policy) {
$ssl_changed = false;
- if((intval($new_policy) == SSL_POLICY_SELFSIGN || $new_policy === 'self') && strstr($contact['url'],'https:')) {
+ if ((intval($new_policy) == SSL_POLICY_SELFSIGN || $new_policy === 'self') && strstr($contact['url'],'https:')) {
$ssl_changed = true;
$contact['url'] = str_replace('https:','http:',$contact['url']);
$contact['request'] = str_replace('https:','http:',$contact['request']);
$contact['poco'] = str_replace('https:','http:',$contact['poco']);
}
- if((intval($new_policy) == SSL_POLICY_FULL || $new_policy === 'full') && strstr($contact['url'],'http:')) {
+ if ((intval($new_policy) == SSL_POLICY_FULL || $new_policy === 'full') && strstr($contact['url'],'http:')) {
$ssl_changed = true;
$contact['url'] = str_replace('http:','https:',$contact['url']);
$contact['request'] = str_replace('http:','https:',$contact['request']);
$contact['poco'] = str_replace('http:','https:',$contact['poco']);
}
- if($ssl_changed) {
- q("update contact set
- url = '%s',
- request = '%s',
- notify = '%s',
- poll = '%s',
- confirm = '%s',
- poco = '%s'
- where id = %d limit 1",
+ if ($ssl_changed) {
+ q("UPDATE `contact` SET
+ `url` = '%s',
+ `request` = '%s',
+ `notify` = '%s',
+ `poll` = '%s',
+ `confirm` = '%s',
+ `poco` = '%s'
+ WHERE `id` = %d LIMIT 1",
dbesc($contact['url']),
dbesc($contact['request']),
dbesc($contact['notify']),
*/
function plugin_enabled($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));
}
function get_theme_screenshot($theme) {
$exts = array('.png','.jpg');
foreach($exts as $ext) {
- if(file_exists('view/theme/' . $theme . '/screenshot' . $ext)) {
+ if (file_exists('view/theme/' . $theme . '/screenshot' . $ext)) {
return(App::get_baseurl() . '/view/theme/' . $theme . '/screenshot' . $ext);
}
}
function uninstall_theme($theme){
logger("Addons: uninstalling theme " . $theme);
- @include_once("view/theme/$theme/theme.php");
- if(function_exists("{$theme}_uninstall")) {
+ include_once("view/theme/$theme/theme.php");
+ if (function_exists("{$theme}_uninstall")) {
$func = "{$theme}_uninstall";
$func();
}
function install_theme($theme) {
// silently fail if theme was removed
- if(! file_exists("view/theme/$theme/theme.php"))
+ if (! file_exists("view/theme/$theme/theme.php")) {
return false;
+ }
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();
return true;
- }
- else {
+ } else {
logger("Addons: FAILED installing theme $theme");
return false;
}
function service_class_allows($uid,$property,$usage = false) {
- if($uid == local_user()) {
+ if ($uid == local_user()) {
$service_class = $a->user['service_class'];
- }
- else {
+ } else {
$r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
$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);
- if(! is_array($arr) || (! count($arr)))
+ if (! is_array($arr) || (! count($arr))) {
return true;
+ }
- if($usage === false)
+ if ($usage === false) {
return ((x($arr[$property])) ? (bool) $arr['property'] : true);
- else {
- if(! array_key_exists($property,$arr))
+ } else {
+ if (! array_key_exists($property,$arr)) {
return true;
+ }
return (((intval($usage)) < intval($arr[$property])) ? true : false);
}
}
function service_class_fetch($uid,$property) {
- if($uid == local_user()) {
+ if ($uid == local_user()) {
$service_class = $a->user['service_class'];
- }
- else {
+ } else {
$r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
// The processlist only shows entries of the current user
if ($max != 0) {
$r = q("SHOW PROCESSLIST");
- if (!$r)
+ if (!dbm::is_result($r))
return false;
$used = count($r);
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($qi[0]['cid'])
);
- if(! count($c)) {
+ if (! dbm::is_result($c)) {
remove_queue_item($q_item['id']);
continue;
}
FROM `user` WHERE `uid` = %d LIMIT 1",
intval($c[0]['uid'])
);
- if(! count($u)) {
+ if (! dbm::is_result($u)) {
remove_queue_item($q_item['id']);
continue;
}
$r = q("SELECT `network` FROM `contact` WHERE `nurl` = '%s' AND `network` != '' AND `network` != '%s' LIMIT 1",
dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET)
);
- if (dbm::is_result($r))
+ if (dbm::is_result($r)) {
$network = $r[0]["network"];
+ }
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",
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",
dbesc(normalise_link($contact["url"])),
intval($gcontact_id));
* @param App $a App instance
* @return string html for pagination #FIXME remove html
*/
-function paginate(&$a) {
+function paginate(App &$a) {
$data = paginate_data($a);
$tpl = get_markup_template("paginate.tpl");
WHERE `nickname` = '%s' ",
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;
q("DELETE FROM `user` WHERE `uid` = %d",
intval($newuid)
intval($netpublish)
);
- if($r === false) {
+ if ($r === false) {
$result['message'] .= t('An error occurred creating your default profile. Please try again.') . EOL;
// Start fresh next time.
$r = q("DELETE FROM `user` WHERE `uid` = %d",
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4 );
- if($r === false)
+ if ($r === false) {
$photo_failure = true;
+ }
$img->scaleImage(80);
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 5 );
- if($r === false)
+ if ($r === false) {
$photo_failure = true;
+ }
$img->scaleImage(48);
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 6 );
- if($r === false)
+ if ($r === false) {
$photo_failure = true;
+ }
- if(! $photo_failure) {
+ if (! $photo_failure) {
q("UPDATE `photo` SET `profile` = 1 WHERE `resource-id` = '%s' ",
dbesc($hash)
);
function __destruct()
{
- if($this->_connection === NULL)
+ if ($this->_connection === NULL) {
return;
+ }
- # Commit any changes before closing
+ // Commit any changes before closing
$this->_commit();
- # Just close the connection if no link-resource was passed and b8 created it's own connection
- if($this->config['connection'] === NULL)
+ // Just close the connection if no link-resource was passed and b8 created it's own connection
+ if ($this->config['connection'] === NULL) {
mysql_close($this->_connection);
+ }
$this->connected = FALSE;
protected function _get_query($tokens, $uid)
{
- # Construct the query ...
-
- if(count($tokens) > 0) {
+ // Construct the query ...
+ if (count($tokens) > 0) {
$where = array();
}
$where = 'term IN ("' . implode('", "', $where) . '")';
- }
-
- else {
+ } else {
$token = dbesc($token);
$where = 'term = "' . $token . '"';
}
- # ... and fetch the data
+ // ... and fetch the data
- $result = q('
- SELECT * FROM spam WHERE ' . $where . ' AND uid = ' . $uid );
+ $result = q('SELECT * FROM `spam` WHERE ' . $where . ' AND `uid` = ' . $uid );
$returned_tokens = array();
- if(count($result)) {
- foreach($result as $rr)
+ if (dbm::is_result($result)) {
+ foreach ($result as $rr) {
$returned_tokens[] = $rr['term'];
+ }
}
$to_create = array();
- if(count($tokens) > 0) {
+ if (count($tokens) > 0) {
foreach($tokens as $token)
if(! in_array($token,$returned_tokens))
$to_create[] = str_tolower($token);
}
- if(count($to_create)) {
+ if (count($to_create)) {
$sql = '';
- foreach($to_create as $term) {
- if(strlen($sql))
+ foreach ($to_create as $term) {
+ if (strlen($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()),
intval($uid)
);
- q("insert into spam " . $sql);
+ }
+ q("INSERT INTO `spam` " . $sql);
}
return $result;
* @param string $count
* @return void
*/
-
protected function _put($token, $count, $uid) {
$token = dbesc($token);
$count = dbesc($count);
* @param string $count
* @return void
*/
-
protected function _update($token, $count, $uid)
{
$token = dbesc($token);
* @param string $token
* @return void
*/
-
protected function _del($token, $uid)
{
$token = dbesc($token);
* @access protected
* @return void
*/
-
protected function _commit($uid)
{
}
}
-
-?>
\ No newline at end of file
<?php\r
+/// @TODO This file has DOS line endings!\r
require_once("mod/hostxrd.php");\r
require_once("mod/nodeinfo.php");\r
\r
-function _well_known_init(&$a){\r
+function _well_known_init(App &$a){\r
if ($a->argc > 1) {\r
switch($a->argv[1]) {\r
case "host-meta":\r
killme();\r
}\r
\r
-function wk_social_relay(&$a) {\r
+function wk_social_relay(App &$a) {\r
\r
define('SR_SCOPE_ALL', 'all');\r
define('SR_SCOPE_TAGS', 'tags');\r
require_once('include/Scrape.php');
-function acctlink_init(&$a) {
+function acctlink_init(App &$a) {
if(x($_GET,'addr')) {
$addr = trim($_GET['addr']);
require_once("include/acl_selectors.php");
-function acl_init(&$a){
+function acl_init(App &$a){
acl_lookup($a);
}
* @param App $a
*
*/
-function admin_post(&$a){
+function admin_post(App &$a){
if(!is_site_admin()) {
* @param App $a
* @return string
*/
-function admin_content(&$a) {
+function admin_content(App &$a) {
if(!is_site_admin()) {
return login(false);
* @param App $a
* @return string
*/
-function admin_page_federation(&$a) {
+function admin_page_federation(App &$a) {
// get counts on active friendica, diaspora, redmatrix, hubzilla, gnu
// social and statusnet nodes this node is knowing
//
* @param App $a
* @return string
*/
-function admin_page_queue(&$a) {
+function admin_page_queue(App &$a) {
// get content from the queue table
$r = q("SELECT `c`.`name`, `c`.`nurl`, `q`.`id`, `q`.`network`, `q`.`created`, `q`.`last`
FROM `queue` AS `q`, `contact` AS `c`
* @param App $a
* @return string
*/
-function admin_page_summary(&$a) {
+function admin_page_summary(App &$a) {
global $db;
// 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",
*
* @param App $a
*/
-function admin_page_site_post(&$a) {
+function admin_page_site_post(App &$a) {
if(!x($_POST,"page_site")) {
return;
}
* @param App $a
* @return string
*/
-function admin_page_site(&$a) {
+function admin_page_site(App &$a) {
/* Installed langs */
$lang_choices = get_available_languages();
* @param App $a
* @return string
**/
-function admin_page_dbsync(&$a) {
+function admin_page_dbsync(App &$a) {
$o = '';
*
* @param App $a
*/
-function admin_page_users_post(&$a){
- $pending = (x($_POST, 'pending') ? $_POST['pending'] : array());
- $users = (x($_POST, 'user') ? $_POST['user'] : array());
- $nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : '');
- $nu_nickname = (x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : '');
- $nu_email = (x($_POST, 'new_user_email') ? $_POST['new_user_email'] : '');
+function admin_page_users_post(App &$a){
+ $pending = (x($_POST, 'pending') ? $_POST['pending'] : array());
+ $users = (x($_POST, 'user') ? $_POST['user'] : array());
+ $nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : '');
+ $nu_nickname = (x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : '');
+ $nu_email = (x($_POST, 'new_user_email') ? $_POST['new_user_email'] : '');
$nu_language = get_config('system', 'language');
check_form_security_token_redirectOnErr('/admin/users', 'admin_users');
- if(!($nu_name==="") && !($nu_email==="") && !($nu_nickname==="")) {
+ if (!($nu_name==="") && !($nu_email==="") && !($nu_nickname==="")) {
require_once('include/user.php');
$result = create_user(array('username'=>$nu_name, 'email'=>$nu_email,
'nickname'=>$nu_nickname, 'verified'=>1, 'language'=>$nu_language));
- if(! $result['success']) {
+ if (! $result['success']) {
notice($result['message']);
return;
}
* @param App $a
* @return string
*/
-function admin_page_users(&$a){
+function admin_page_users(App &$a){
if($a->argc>2) {
$uid = $a->argv[3];
$user = q("SELECT `username`, `blocked` FROM `user` WHERE `uid` = %d", intval($uid));
* @param App $a
* @return string
*/
-function admin_page_plugins(&$a){
+function admin_page_plugins(App &$a){
/*
* Single plugin
* @param App $a
* @return string
*/
-function admin_page_themes(&$a){
+function admin_page_themes(App &$a){
$allowed_themes_str = get_config('system','allowed_themes');
$allowed_themes_raw = explode(',',$allowed_themes_str);
*
* @param App $a
*/
-function admin_page_logs_post(&$a) {
- if(x($_POST,"page_logs")) {
+function admin_page_logs_post(App &$a) {
+ if (x($_POST,"page_logs")) {
check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs');
- $logfile = ((x($_POST,'logfile')) ? notags(trim($_POST['logfile'])) : '');
- $debugging = ((x($_POST,'debugging')) ? true : false);
- $loglevel = ((x($_POST,'loglevel')) ? intval(trim($_POST['loglevel'])) : 0);
+ $logfile = ((x($_POST,'logfile')) ? notags(trim($_POST['logfile'])) : '');
+ $debugging = ((x($_POST,'debugging')) ? true : false);
+ $loglevel = ((x($_POST,'loglevel')) ? intval(trim($_POST['loglevel'])) : 0);
set_config('system','logfile', $logfile);
set_config('system','debugging', $debugging);
* @param App $a
* @return string
*/
-function admin_page_logs(&$a){
+function admin_page_logs(App &$a){
$log_choices = array(
LOGGER_NORMAL => 'Normal',
* @param App $a
* @return string
*/
-function admin_page_viewlogs(&$a){
+function admin_page_viewlogs(App &$a){
$t = get_markup_template("admin_viewlogs.tpl");
$f = get_config('system','logfile');
$data = '';
*
* @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');
* @param App $a
* @return string
*/
-function admin_page_features(&$a) {
+function admin_page_features(App &$a) {
if((argc() > 1) && (argv(1) === 'features')) {
$arr = array();
require_once('include/contact_selectors.php');
require_once('mod/contacts.php');
-function allfriends_content(&$a) {
+function allfriends_content(App &$a) {
$o = '';
if (! local_user()) {
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",
intval($cid),
intval(local_user())
);
- if (! count($c)) {
+ if (! dbm::is_result($c)) {
return;
}
}
$entry = array(
- 'url' => $rr['url'],
- 'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
- 'name' => htmlentities($contact_details['name']),
- 'thumb' => proxy_url($contact_details['thumb'], false, PROXY_SIZE_THUMB),
- 'img_hover' => htmlentities($contact_details['name']),
- 'details' => $contact_details['location'],
- 'tags' => $contact_details['keywords'],
- 'about' => $contact_details['about'],
- 'account_type' => account_type($contact_details),
- 'network' => network_to_name($contact_details['network'], $contact_details['url']),
- 'photo_menu' => $photo_menu,
- 'conntxt' => t('Connect'),
- 'connlnk' => $connlnk,
- 'id' => ++$id,
+ 'url' => $rr['url'],
+ 'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
+ 'name' => htmlentities($contact_details['name']),
+ 'thumb' => proxy_url($contact_details['thumb'], false, PROXY_SIZE_THUMB),
+ 'img_hover' => htmlentities($contact_details['name']),
+ 'details' => $contact_details['location'],
+ 'tags' => $contact_details['keywords'],
+ 'about' => $contact_details['about'],
+ 'account_type' => account_type($contact_details),
+ 'network' => network_to_name($contact_details['network'], $contact_details['url']),
+ 'photo_menu' => $photo_menu,
+ 'conntxt' => t('Connect'),
+ 'connlnk' => $connlnk,
+ 'id' => ++$id,
);
$entries[] = $entry;
}
<?php
-function amcd_content(&$a) {
+function amcd_content(App &$a) {
//header("Content-type: text/json");
echo <<< EOT
{
return $r[0];
}
-function api_post(&$a) {
+function api_post(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
}
-function api_content(&$a) {
+function api_content(App &$a) {
if ($a->cmd=='api/oauth/authorize'){
/*
* api/oauth/authorize interact with the user. return a standard page
<?php
-function apps_content(&$a) {
+function apps_content(App &$a) {
$privateaddons = get_config('config','private_addons');
if ($privateaddons === "1") {
if((! (local_user()))) {
require_once('include/security.php');
-function attach_init(&$a) {
+function attach_init(App &$a) {
if($a->argc != 2) {
notice( t('Item not available.') . EOL);
return str_replace("\n",'<br />', $s);
}
-function babel_content(&$a) {
+function babel_content(App &$a) {
$o .= '<h1>Babel Diagnostic</h1>';
require_once('include/conversation.php');
require_once('include/items.php');
-function bookmarklet_init(&$a) {
+function bookmarklet_init(App &$a) {
$_GET["mode"] = "minimal";
}
-function bookmarklet_content(&$a) {
+function bookmarklet_content(App &$a) {
if (!local_user()) {
$o = '<h2>'.t('Login').'</h2>';
$o .= login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
require_once('include/event.php');
require_once('include/redir.php');
-function cal_init(&$a) {
+function cal_init(App &$a) {
if($a->argc > 1)
auto_redir($a, $a->argv[1]);
return;
}
-function cal_content(&$a) {
+function cal_content(App &$a) {
nav_set_selected('events');
$editselect = 'none';
*/
-function cb_init(&$a) {
+function cb_init(App &$a) {
call_hooks('cb_init');
}
-function cb_post(&$a) {
+function cb_post(App &$a) {
call_hooks('cb_post', $_POST);
}
-function cb_afterpost(&$a) {
+function cb_afterpost(App &$a) {
call_hooks('cb_afterpost');
}
-function cb_content(&$a) {
+function cb_content(App &$a) {
$o = '';
call_hooks('cb_content', $o);
return $o;
require_once('include/contact_selectors.php');
require_once('mod/contacts.php');
-function common_content(&$a) {
+function common_content(App &$a) {
$o = '';
$a->page['aside'] .= $vcard_widget;
}
- if(! count($c))
+ if (! dbm::is_result($c)) {
return;
+ }
if(! $cid) {
if(get_my_url()) {
<?php
-function community_init(&$a) {
+function community_init(App &$a) {
if (! local_user()) {
unset($_SESSION['theme']);
unset($_SESSION['mobile-theme']);
require_once('include/group.php');
-function contactgroup_content(&$a) {
+function contactgroup_content(App &$a) {
if (! local_user()) {
require_once('mod/proxy.php');
require_once('include/Photo.php');
-function contacts_init(&$a) {
+function contacts_init(App &$a) {
if (! local_user()) {
return;
}
require_once('include/group.php');
require_once('include/contact_widgets.php');
- if ($_GET['nets'] == "all")
- $_GET['nets'] = "";
+ if ($_GET['nets'] == "all") {
+ $_GET['nets'] = "";
+ }
- if(! x($a->page,'aside'))
+ if (! x($a->page,'aside')) {
$a->page['aside'] = '';
+ }
- if($contact_id) {
+ if ($contact_id) {
$a->data['contact'] = $r[0];
if (($a->data['contact']['network'] != "") AND ($a->data['contact']['network'] != NETWORK_DFRN)) {
$networkname = format_network_name($a->data['contact']['network'],$a->data['contact']['url']);
- } else
+ } else {
$networkname = '';
+ }
$vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array(
'$name' => htmlentities($a->data['contact']['name']),
}
-function contacts_batch_actions(&$a){
+function contacts_batch_actions(App &$a){
$contacts_id = $_POST['contact_batch'];
if (!is_array($contacts_id)) return;
}
-function contacts_post(&$a) {
+function contacts_post(App &$a) {
if (! local_user()) {
return;
}
-function contacts_content(&$a) {
+function contacts_content(App &$a) {
$sort_type = 0;
$o = '';
* addons repository will be listed though ATM)
*/
-function credits_content (&$a) {
+function credits_content (App &$a) {
/* fill the page with credits */
$f = fopen('util/credits.txt','r');
$names = fread($f, filesize('util/credits.txt'));
require_once("include/contact_selectors.php");
require_once("mod/contacts.php");
-function crepair_init(&$a) {
+function crepair_init(App &$a) {
if (! local_user()) {
return;
}
}
}
-function crepair_post(&$a) {
+function crepair_post(App &$a) {
if (! local_user()) {
return;
}
-function crepair_content(&$a) {
+function crepair_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
<?php
require_once('mod/settings.php');
-function delegate_init(&$a) {
+function delegate_init(App &$a) {
return settings_init($a);
}
-function delegate_content(&$a) {
+function delegate_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
goaway(App::get_baseurl() . '/delegate');
}
-
$id = $a->argv[2];
$r = q("select `nickname` from user where uid = %d limit 1",
if ($a->argc > 2 && $a->argv[1] === 'remove' && intval($a->argv[2])) {
// delegated admins can view but not change delegation permissions
-
if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
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(local_user())
);
);
}
- if($r === false)
- notice( t('Unable to set contact photo.') . EOL);
+ /// @TODO is dbm::is_result() working here?
+ if ($r === false) {
+ notice( t('Unable to set contact photo.') . EOL);
+ }
// reload contact info
$r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($contact_id)
);
- if (dbm::is_result($r))
+ if (dbm::is_result($r)) {
$contact = $r[0];
- else
+ } else {
$contact = null;
+ }
- if((isset($new_relation) && $new_relation == CONTACT_IS_FRIEND)) {
+ if ((isset($new_relation) && $new_relation == CONTACT_IS_FRIEND)) {
- if(($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
+ if (($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
require_once('include/diaspora.php');
$ret = Diaspora::send_share($user[0],$r[0]);
logger('share returns: ' . $ret);
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);
$dfrn_id = ((x($_POST,'dfrn_id')) ? notags(trim($_POST['dfrn_id'])) : '');
$dfrn_version = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version'] : 2.0);
}
-function dfrn_notify_content(&$a) {
+function dfrn_notify_content(App &$a) {
if(x($_GET,'dfrn_id')) {
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'] : '');
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($r[0]['cid'])
);
- if(! count($c)) {
+ if (! dbm::is_result($c)) {
xml_status(3, 'No profile');
}
$contact = $c[0];
-function dfrn_poll_post(&$a) {
+function dfrn_poll_post(App &$a) {
$dfrn_id = ((x($_POST,'dfrn_id')) ? $_POST['dfrn_id'] : '');
$challenge = ((x($_POST,'challenge')) ? $_POST['challenge'] : '');
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($r[0]['cid'])
);
- if(! count($c)) {
+ if (! dbm::is_result($c)) {
xml_status(3, 'No profile');
}
$contact = $c[0];
}
}
-function dfrn_poll_content(&$a) {
+function dfrn_poll_content(App &$a) {
$dfrn_id = ((x($_GET,'dfrn_id')) ? $_GET['dfrn_id'] : '');
$type = ((x($_GET,'type')) ? $_GET['type'] : 'data');
require_once('include/Probe.php');
require_once('include/group.php');
-function dfrn_request_init(&$a) {
+function dfrn_request_init(App &$a) {
if($a->argc > 1)
$which = $a->argv[1];
* 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))) {
logger('Wrong count of argc or profiles: argc=' . $a->argc . ',profile()=' . count($a->profile));
}
-function dfrn_request_content(&$a) {
+function dfrn_request_content(App &$a) {
if (($a->argc != 2) || (! count($a->profile))) {
return "";
// At first look if an address was provided
// Otherwise take the local address
- if (x($_GET,'addr') AND ($_GET['addr'] != ""))
+ if (x($_GET,'addr') AND ($_GET['addr'] != "")) {
$myaddr = hex2bin($_GET['addr']);
- elseif (x($_GET,'address') AND ($_GET['address'] != ""))
+ } elseif (x($_GET,'address') AND ($_GET['address'] != "")) {
$myaddr = $_GET['address'];
- elseif (local_user()) {
+ } elseif (local_user()) {
if (strlen($a->path)) {
$myaddr = App::get_baseurl() . '/profile/' . $a->user['nickname'];
- }
- else {
+ } else {
$myaddr = $a->user['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
}
- }
- else {
+ } else {
// last, try a zrl
$myaddr = get_my_url();
}
if ($a->profile['page-flags'] == PAGE_NORMAL) {
$tpl = get_markup_template('dfrn_request.tpl');
- }
- else {
+ } else {
$tpl = get_markup_template('auto_request.tpl');
}
// see if we are allowed to have NETWORK_MAIL2 contacts
$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;
+ }
- if(! $mail_disabled) {
+ if (! $mail_disabled) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval($a->profile['uid'])
);
<?php
-function directory_init(&$a) {
+function directory_init(App &$a) {
$a->set_pager_itemspage(60);
if(local_user()) {
}
-function directory_post(&$a) {
+function directory_post(App &$a) {
if(x($_POST,'search'))
$a->data['search'] = $_POST['search'];
}
-function directory_content(&$a) {
+function directory_content(App &$a) {
global $db;
require_once("mod/proxy.php");
require_once('include/contact_selectors.php');
require_once('mod/contacts.php');
-function dirfind_init(&$a) {
+function dirfind_init(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL );
<?php
-function display_init(&$a) {
+function display_init(App &$a) {
if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
return;
require_once('include/acl_selectors.php');
-function editpost_content(&$a) {
+function editpost_content(App &$a) {
$o = '';
intval(local_user())
);
- if (! count($itm)) {
+ if (! dbm::is_result($itm)) {
notice( t('Item not found') . EOL);
return;
}
require_once('include/event.php');
require_once('include/items.php');
-function events_init(&$a) {
+function events_init(App &$a) {
if (! local_user()) {
return;
}
$cal_widget = widget_events();
- if (! x($a->page,'aside'))
+ if (! x($a->page,'aside')) {
$a->page['aside'] = '';
+ }
$a->page['aside'] .= $cal_widget;
}
return;
}
-function events_post(&$a) {
+function events_post(App &$a) {
logger('post: ' . print_r($_REQUEST,true));
-function events_content(&$a) {
+function events_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
}
}
- $events=array();
+ $events = array();
// transform the event in a usable array
if (dbm::is_result($r)) {
/**
* @param App $a
*/
-/// @TODO & is missing or App ?
-function fbrowser_content($a){
+function fbrowser_content(App &$a){
if (!local_user())
killme();
/// @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
-function fetch_init(&$a){
+function fetch_init(App &$a){
if (($a->argc != 3) OR (!in_array($a->argv[1], array("post", "status_message", "reshare")))) {
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found'));
require_once('include/items.php');
-function filer_content(&$a) {
+function filer_content(App &$a) {
if (! local_user()) {
killme();
<?php
-function filerm_content(&$a) {
+function filerm_content(App &$a) {
if (! local_user()) {
killme();
require_once('include/Contact.php');
require_once('include/contact_selectors.php');
-function follow_content(&$a) {
+function follow_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
return $o;
}
-function follow_post(&$a) {
+function follow_post(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
<?php
-function friendica_init(&$a) {
+function friendica_init(App &$a) {
if ($a->argv[1]=="json"){
$register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
-function friendica_content(&$a) {
+function friendica_content(App &$a) {
$o = '';
$o .= '<h3>Friendica</h3>';
<?php
-function fsuggest_post(&$a) {
+function fsuggest_post(App &$a) {
if (! local_user()) {
return;
-function fsuggest_content(&$a) {
+function fsuggest_content(App &$a) {
require_once('include/acl_selectors.php');
$item = intval($item);
}
-function group_init(&$a) {
+function group_init(App &$a) {
if(local_user()) {
require_once('include/group.php');
$a->page['aside'] = group_side('contacts','group','extended',(($a->argc > 1) ? intval($a->argv[1]) : 0));
-function group_post(&$a) {
+function group_post(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
if ($r) {
goaway(App::get_baseurl() . '/group/' . $r);
}
- }
- else {
+ } else {
notice( t('Could not create group.') . EOL );
}
goaway(App::get_baseurl() . '/group');
return;
}
-function group_content(&$a) {
+function group_content(App &$a) {
$change = false;
if (! local_user()) {
'$submit' => t('Save Group'),
);
- if(($a->argc == 2) && ($a->argv[1] === 'new')) {
+ if (($a->argc == 2) && ($a->argv[1] === 'new')) {
return replace_macros($tpl, $context + array(
'$title' => t('Create a group of contacts/friends.'),
<?php
-function hcard_init(&$a) {
+function hcard_init(App &$a) {
$blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
}
}
-
}
-function help_content(&$a) {
+function help_content(App &$a) {
nav_set_selected('help');
<?php
if(! function_exists('home_init')) {
-function home_init(&$a) {
+function home_init(App &$a) {
$ret = array();
call_hooks('home_init',$ret);
}}
if(! function_exists('home_content')) {
-function home_content(&$a) {
+function home_content(App &$a) {
$o = '';
require_once('include/crypto.php');
-function hostxrd_init(&$a) {
+function hostxrd_init(App &$a) {
header('Access-Control-Allow-Origin: *');
header("Content-type: text/xml");
$pubkey = get_config('system','site_pubkey');
require_once("include/socgraph.php");
require_once("include/Contact.php");
-function hovercard_init(&$a) {
+function hovercard_init(App &$a) {
// Just for testing purposes
$_GET["mode"] = "minimal";
}
<?php
-function ignored_init(&$a) {
+function ignored_init(App &$a) {
$ignored = 0;
$install_wizard_pass=1;
-function install_init(&$a){
+function install_init(App &$a){
// $baseurl/install/testrwrite to test if rewite in .htaccess is working
if ($a->argc==2 && $a->argv[1]=="testrewrite") {
}
-function install_post(&$a) {
+function install_post(App &$a) {
global $install_wizard_pass, $db;
switch($install_wizard_pass) {
}
}
-function install_content(&$a) {
+function install_content(App &$a) {
global $install_wizard_pass, $db;
$o = '';
}
}
-function manual_config(&$a) {
+function manual_config(App &$a) {
$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 .= "<textarea rows=\"24\" cols=\"80\" >$data</textarea>";
}
}
-
function load_database($db) {
require_once("include/dbstructure.php");
require_once('include/email.php');
-function invite_post(&$a) {
+function invite_post(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
}
-function invite_content(&$a) {
+function invite_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
if (strlen($dirloc)) {
if ($a->config['register_policy'] == REGISTER_CLOSED) {
$linktxt = sprintf( t('Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks.'), $dirloc . '/siteinfo');
- } elseif($a->config['register_policy'] != REGISTER_CLOSED) {
+ } elseif ($a->config['register_policy'] != REGISTER_CLOSED) {
$linktxt = sprintf( t('To accept this invitation, please visit and register at %s or any other public Friendica website.'), App::get_baseurl())
. "\r\n" . "\r\n" . sprintf( t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks. See %s for a list of alternate Friendica sites you can join.'),$dirloc . '/siteinfo');
}
require_once('include/diaspora.php');
require_once('include/Contact.php');
-function item_post(&$a) {
+function item_post(App &$a) {
if((! local_user()) && (! remote_user()) && (! x($_REQUEST,'commenter')))
return;
// 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));
- 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"]))) {
$parent_contact = null;
intval($profile_uid),
intval($post_id)
);
- if(! count($i))
+ if (! dbm::is_result($i)) {
killme();
+ }
$orig_post = $i[0];
}
continue;
$success = handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag, $network);
- if($success['replaced'])
+ if ($success['replaced']) {
$tagged[] = $tag;
- if(is_array($success['contact']) && intval($success['contact']['prv'])) {
+ }
+ if (is_array($success['contact']) && intval($success['contact']['prv'])) {
$private_forum = true;
$private_id = $success['contact']['id'];
}
}
}
- if(($private_forum) && (! $parent) && (! $private)) {
+ if (($private_forum) && (! $parent) && (! $private)) {
// we tagged a private forum in a top level post and the message was public.
// Restrict it.
$private = 1;
$attachments = '';
$match = false;
- if(preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) {
- foreach($match[2] as $mtch) {
+ if (preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) {
+ foreach ($match[2] as $mtch) {
$r = q("SELECT `id`,`filename`,`filesize`,`filetype` FROM `attach` WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval($profile_uid),
intval($mtch)
-function item_content(&$a) {
+function item_content(App &$a) {
if ((! local_user()) && (! remote_user())) {
return;
require_once('include/items.php');
require_once('include/like.php');
-function like_content(&$a) {
+function like_content(App &$a) {
if(! local_user() && ! remote_user()) {
return false;
}
require_once('include/datetime.php');
-function localtime_post(&$a) {
+function localtime_post(App &$a) {
$t = $_REQUEST['time'];
if(! $t)
}
-function localtime_content(&$a) {
+function localtime_content(App &$a) {
$t = $_REQUEST['time'];
if(! $t)
$t = 'now';
<?php
-function lockview_content(&$a) {
+function lockview_content(App &$a) {
$type = (($a->argc > 1) ? $a->argv[1] : 0);
if (is_numeric($type)) {
<?php
-function login_content(&$a) {
+function login_content(App &$a) {
if(x($_SESSION,'theme'))
unset($_SESSION['theme']);
if(x($_SESSION,'mobile-theme'))
require_once('include/enotify.php');
require_once('include/text.php');
-function lostpass_post(&$a) {
+function lostpass_post(App &$a) {
$loginame = notags(trim($_POST['login-name']));
if(! $loginame)
}
-function lostpass_content(&$a) {
+function lostpass_content(App &$a) {
if(x($_GET,'verify')) {
dbesc($new_password_encoded),
intval($uid)
);
+
+ /// @TODO Is dbm::is_result() okay here?
if ($r) {
$tpl = get_markup_template('pwdreset.tpl');
$o .= replace_macros($tpl,array(
<?php
-function maintenance_content(&$a) {
+function maintenance_content(App &$a) {
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
header('Retry-After: 600');
require_once("include/text.php");
-function manage_post(&$a) {
+function manage_post(App &$a) {
if (! local_user()) {
return;
-function manage_content(&$a) {
+function manage_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
* @param App &$a
* @return void|string
*/
-function match_content(&$a) {
+function match_content(App &$a) {
$o = '';
if (! local_user()) {
require_once('include/message.php');
require_once('include/Smilies.php');
-function message_init(&$a) {
+function message_init(App &$a) {
$tabs = '';
}
-function message_post(&$a) {
+function message_post(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
-function message_content(&$a) {
+function message_content(App &$a) {
$o = '';
nav_set_selected('messages');
$_SESSION['return_url'] = $a->query_string;
- if($a->argc == 1) {
+ if ($a->argc == 1) {
// List messages
require_once('library/asn1.php');
-function modexp_init(&$a) {
+function modexp_init(App &$a) {
if($a->argc != 2)
killme();
require_once('include/items.php');
-function mood_init(&$a) {
+function mood_init(App &$a) {
if (! local_user()) {
return;
-function mood_content(&$a) {
+function mood_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
<?php
-function msearch_post(&$a) {
+function msearch_post(App &$a) {
$perpage = (($_POST['n']) ? $_POST['n'] : 80);
$page = (($_POST['p']) ? intval($_POST['p'] - 1) : 0);
require_once("include/nav.php");
-function navigation_content(&$a) {
+function navigation_content(App &$a) {
$nav_info = nav_info($a);
<?php
-function network_init(&$a) {
+function network_init(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
return;
}
$is_a_date_query = false;
- if(x($_GET['cid']) && intval($_GET['cid']) != 0)
+ if (x($_GET['cid']) && intval($_GET['cid']) != 0) {
$cid = $_GET['cid'];
+ }
- if($a->argc > 1) {
- for($x = 1; $x < $a->argc; $x ++) {
- if(is_a_date_arg($a->argv[$x])) {
+ if ($a->argc > 1) {
+ for ($x = 1; $x < $a->argc; $x ++) {
+ if (is_a_date_arg($a->argv[$x])) {
$is_a_date_query = true;
break;
}
parse_str($query_string, $query_array);
array_shift($query_array);
-
// 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_nets = network_query_get_sel_net();
$sel_groups = network_query_get_sel_group($a);
$net_baseurl = '/network';
$net_args = array();
- if($remember_group) {
+ if ($remember_group) {
$net_baseurl .= '/' . $last_sel_groups; // Note that the group number must come before the "/new" tab selection
- }
- else if($sel_groups !== false) {
+ } elseif($sel_groups !== false) {
$net_baseurl .= '/' . $sel_groups;
}
*
* @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='';
$starred_active = '';
$new_active = '';
return $network;
}
-function network_query_get_sel_group($a) {
+function network_query_get_sel_group(App &$a) {
$group = false;
if($a->argc >= 2 && is_numeric($a->argv[1])) {
* @param app $a The global App
* @return string Html of the networktab
*/
-function network_tabs($a) {
+function network_tabs(App &$a) {
// item filter tabs
/// @TODO fix this logic, reduce duplication
/// $a->page['content'] .= '<div class="tabs-wrapper">';
<?php
-function newmember_content(&$a) {
+function newmember_content(App &$a) {
$o = '<h1>' . t('Welcome to Friendica') . '</h1>';
require_once("include/plugin.php");
-function nodeinfo_wellknown(&$a) {
+function nodeinfo_wellknown(App &$a) {
if (!get_config("system", "nodeinfo")) {
http_status_exit(404);
killme();
exit;
}
-function nodeinfo_init(&$a){
+function nodeinfo_init(App &$a){
if (!get_config("system", "nodeinfo")) {
http_status_exit(404);
killme();
require_once('include/socgraph.php');
require_once('include/contact_selectors.php');
-function nogroup_init(&$a) {
+function nogroup_init(App &$a) {
if (! local_user()) {
return;
}
-function nogroup_content(&$a) {
+function nogroup_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
<?php
-function noscrape_init(&$a) {
+function noscrape_init(App &$a) {
if($a->argc > 1)
$which = $a->argv[1];
<?php
-function notes_init(&$a) {
+function notes_init(App &$a) {
if (! local_user()) {
return;
<?php
/* identi.ca -> friendica items permanent-url compatibility */
- function notice_init(&$a){
+ function notice_init(App &$a){
$id = $a->argv[1];
$r = q("SELECT user.nickname FROM user LEFT JOIN item ON item.uid=user.uid WHERE item.id=%d",
intval($id)
require_once("include/contact_selectors.php");
require_once("include/network.php");
-function notifications_post(&$a) {
+function notifications_post(App &$a) {
if (! local_user()) {
goaway(z_root());
}
}
-function notifications_content(&$a) {
+function notifications_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
<?php
require_once('include/NotificationsManager.php');
-
-function notify_init(&$a) {
+function notify_init(App &$a) {
if (! local_user()) {
return;
}
}
-function notify_content(&$a) {
+function notify_content(App &$a) {
if (! local_user()) {
return login();
}
<?php
require_once("include/oembed.php");
-function oembed_content(&$a){
+function oembed_content(App &$a){
// logger('mod_oembed ' . $a->query_string, LOGGER_ALL);
if ($a->argv[1]=='b2h'){
<?php
-function oexchange_init(&$a) {
+function oexchange_init(App &$a) {
if(($a->argc > 1) && ($a->argv[1] === 'xrd')) {
$tpl = get_markup_template('oexchange_xrd.tpl');
}
-function oexchange_content(&$a) {
+function oexchange_content(App &$a) {
if (! local_user()) {
$o = login(false);
require_once('library/openid.php');
-function openid_content(&$a) {
+function openid_content(App &$a) {
$noid = get_config('system','no_openid');
if($noid)
<?php
- function opensearch_content(&$a) {
+ function opensearch_content(App &$a) {
$tpl = get_markup_template('opensearch.tpl');
require_once('include/Scrape.php');
require_once('include/follow.php');
-function ostatus_subscribe_content(&$a) {
+function ostatus_subscribe_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
require_once("include/items.php");
-function parse_url_content(&$a) {
+function parse_url_content(App &$a) {
$text = null;
$str_tags = "";
require_once('include/security.php');
require_once('include/Photo.php');
-function photo_init(&$a) {
+function photo_init(App &$a) {
global $_SERVER;
$prvcachecontrol = false;
require_once('include/threads.php');
require_once('include/Probe.php');
-function photos_init(&$a) {
+function photos_init(App &$a) {
if ($a->argc > 1)
auto_redir($a, $a->argv[1]);
-function photos_post(&$a) {
+function photos_post(App &$a) {
logger('mod-photos: photos_post: begin' , LOGGER_DEBUG);
dbesc($r[0]['resource-id']),
intval($page_owner_uid)
);
- if (count($i)) {
+ if (dbm::is_result($i)) {
q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
dbesc(datetime_convert()),
dbesc(datetime_convert()),
-function photos_content(&$a) {
+function photos_content(App &$a) {
// URLs:
// photos/name
// See here for a documentation for portable contacts:
// https://web.archive.org/web/20160405005550/http://portablecontacts.net/draft-spec.html
-function poco_init(&$a) {
+function poco_init(App &$a) {
require_once("include/bbcode.php");
$system_mode = false;
}
if(! x($user)) {
$c = q("SELECT * FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1");
- if(! count($c))
+ if (! dbm::is_result($c)) {
http_status_exit(401);
+ }
$system_mode = true;
}
require_once('include/items.php');
-function poke_init(&$a) {
+function poke_init(App &$a) {
if (! local_user()) {
return;
-function poke_content(&$a) {
+function poke_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
// not yet ready for prime time
//require_once('include/zot.php');
-function post_post(&$a) {
+function post_post(App &$a) {
$bulk_delivery = false;
- if($a->argc == 1) {
+ if ($a->argc == 1) {
$bulk_delivery = true;
}
else {
<?php
-function pretheme_init(&$a) {
+function pretheme_init(App &$a) {
if($_REQUEST['theme']) {
$theme = $_REQUEST['theme'];
require_once('include/Scrape.php');
-function probe_content(&$a) {
+function probe_content(App &$a) {
$o .= '<h3>Probe Diagnostic</h3>';
require_once('include/redir.php');
-function profile_init(&$a) {
+function profile_init(App &$a) {
if(! x($a->page,'aside'))
$a->page['aside'] = '';
if((x($a->profile,'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY)) {
$a->page['htmlhead'] .= '<meta name="friendica.community" content="true" />';
}
- if(x($a->profile,'openidserver'))
+ if (x($a->profile,'openidserver')) {
$a->page['htmlhead'] .= '<link rel="openid.server" href="' . $a->profile['openidserver'] . '" />' . "\r\n";
- if(x($a->profile,'openid')) {
+ }
+ if (x($a->profile,'openid')) {
$delegate = ((strstr($a->profile['openid'],'://')) ? $a->profile['openid'] : 'https://' . $a->profile['openid']);
$a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $delegate . '" />' . "\r\n";
}
// site block
- if((! $blocked) && (! $userblock)) {
+ if ((! $blocked) && (! $userblock)) {
$keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : '');
$keywords = str_replace(array('#',',',' ',',,'),array('',' ',',',','),$keywords);
if(strlen($keywords))
$category = $datequery = $datequery2 = '';
- if($a->argc > 2) {
- for($x = 2; $x < $a->argc; $x ++) {
- if(is_a_date_arg($a->argv[$x])) {
- if($datequery)
+ if ($a->argc > 2) {
+ for ($x = 2; $x < $a->argc; $x ++) {
+ if (is_a_date_arg($a->argv[$x])) {
+ if ($datequery) {
$datequery2 = escape_tags($a->argv[$x]);
- else
+ } else {
$datequery = escape_tags($a->argv[$x]);
- }
- else
+ }
+ } else {
$category = $a->argv[$x];
+ }
}
}
- if(! x($category)) {
+ if (! x($category)) {
$category = ((x($_GET,'category')) ? $_GET['category'] : '');
}
- if(get_config('system','block_public') && (! local_user()) && (! remote_user())) {
+ if (get_config('system','block_public') && (! local_user()) && (! remote_user())) {
return login();
}
$tab = 'posts';
$o = '';
- if($update) {
+ if ($update) {
// Ensure we've got a profile owner if updating.
$a->profile['profile_uid'] = $update;
- }
- else {
- if($a->profile['profile_uid'] == local_user()) {
+ } else {
+ if ($a->profile['profile_uid'] == local_user()) {
nav_set_selected('home');
}
}
-
$contact = null;
$remote_contact = false;
$contact_id = 0;
- if(is_array($_SESSION['remote'])) {
- foreach($_SESSION['remote'] as $v) {
- if($v['uid'] == $a->profile['profile_uid']) {
+ if (is_array($_SESSION['remote'])) {
+ foreach ($_SESSION['remote'] as $v) {
+ if ($v['uid'] == $a->profile['profile_uid']) {
$contact_id = $v['cid'];
break;
}
}
}
- if($contact_id) {
+ if ($contact_id) {
$groups = init_groups_visitor($contact_id);
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
}
}
- if(! $remote_contact) {
- if(local_user()) {
+ if (! $remote_contact) {
+ if (local_user()) {
$contact_id = $_SESSION['cid'];
$contact = $a->contact;
}
$is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
- if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
+ if ($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
notice( t('Access to this profile has been restricted.') . EOL);
return;
}
- if(! $update) {
-
-
- if(x($_GET,'tab'))
+ if (! $update) {
+ if (x($_GET,'tab'))
$tab = notags(trim($_GET['tab']));
$o.=profile_tabs($a, $is_owner, $a->profile['nickname']);
- if($tab === 'profile') {
+ if ($tab === 'profile') {
$o .= advanced_profile($a);
call_hooks('profile_advanced',$o);
return $o;
}
-
$o .= common_friends_visitor_widget($a->profile['profile_uid']);
-
- if(x($_SESSION,'new_member') && $_SESSION['new_member'] && $is_owner)
+ if (x($_SESSION,'new_member') && $_SESSION['new_member'] && $is_owner) {
$o .= '<a href="newmember" id="newmember-tips" style="font-size: 1.2em;"><b>' . t('Tips for New Members') . '</b></a>' . EOL;
+ }
$commpage = (($a->profile['page-flags'] == PAGE_COMMUNITY) ? true : false);
$commvisitor = (($commpage && $remote_contact == true) ? true : false);
$a->page['aside'] .= posted_date_widget(App::get_baseurl(true) . '/profile/' . $a->profile['nickname'],$a->profile['profile_uid'],true);
$a->page['aside'] .= categories_widget(App::get_baseurl(true) . '/profile/' . $a->profile['nickname'],(x($category) ? xmlify($category) : ''));
- if(can_write_wall($a,$a->profile['profile_uid'])) {
+ if (can_write_wall($a,$a->profile['profile_uid'])) {
$x = array(
'is_owner' => $is_owner,
$sql_extra = item_permissions_sql($a->profile['profile_uid'],$remote_contact,$groups);
- if($update) {
+ if ($update) {
$r = q("SELECT distinct(parent) AS `item_id`, `item`.`network` AS `item_network`
FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
} else {
$sql_post_table = "";
- if(x($category)) {
+ if (x($category)) {
$sql_post_table = sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ",
dbesc(protect_sprintf($category)), intval(TERM_OBJ_POST), intval(TERM_CATEGORY), intval($a->profile['profile_uid']));
//$sql_extra .= protect_sprintf(file_tag_file_query('item',$category,'category'));
}
- if($datequery) {
+ if ($datequery) {
$sql_extra2 .= protect_sprintf(sprintf(" AND `thread`.`created` <= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery))));
}
- if($datequery2) {
+ if ($datequery2) {
$sql_extra2 .= protect_sprintf(sprintf(" AND `thread`.`created` >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
}
require_once("include/Photo.php");
-function profile_photo_init(&$a) {
+function profile_photo_init(App &$a) {
if (! local_user()) {
return;
}
-function profile_photo_post(&$a) {
+function profile_photo_post(App &$a) {
if (! local_user()) {
notice ( t('Permission denied.') . EOL );
$r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 4, $is_default_profile);
- if($r === false)
+ if ($r === false) {
notice ( sprintf(t('Image size reduction [%s] failed.'),"175") . EOL );
+ }
$im->scaleImage(80);
$r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 5, $is_default_profile);
- if($r === false)
+ if ($r === false) {
notice( sprintf(t('Image size reduction [%s] failed.'),"80") . EOL );
+ }
$im->scaleImage(48);
$r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 6, $is_default_profile);
- if($r === false)
+ if ($r === false) {
notice( sprintf(t('Image size reduction [%s] failed.'),"48") . EOL );
+ }
// If setting for the default profile, unset the profile photo flag from any other photos I own
require_once('include/profile_update.php');
profile_change();
- }
- else
+ } else {
notice( t('Unable to process image') . EOL);
+ }
}
goaway(App::get_baseurl() . '/profiles');
$filename = basename($_FILES['userfile']['name']);
$filesize = intval($_FILES['userfile']['size']);
$filetype = $_FILES['userfile']['type'];
- if ($filetype=="") $filetype=guess_image_type($filename);
-
+ if ($filetype == "") {
+ $filetype = guess_image_type($filename);
+ }
+
$maximagesize = get_config('system','maximagesize');
- if(($maximagesize) && ($filesize > $maximagesize)) {
+ if (($maximagesize) && ($filesize > $maximagesize)) {
notice( sprintf(t('Image exceeds size limit of %s'), formatBytes($maximagesize)) . EOL);
@unlink($src);
return;
$imagedata = @file_get_contents($src);
$ph = new Photo($imagedata, $filetype);
- if(! $ph->is_valid()) {
+ if (! $ph->is_valid()) {
notice( t('Unable to process image.') . EOL );
@unlink($src);
return;
$ph->orient($src);
@unlink($src);
return profile_photo_crop_ui_head($a, $ph);
-
}
if(! function_exists('profile_photo_content')) {
-function profile_photo_content(&$a) {
+function profile_photo_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL );
if(! function_exists('profile_photo_crop_ui_head')) {
function profile_photo_crop_ui_head(&$a, $ph){
$max_length = get_config('system','max_image_length');
- if(! $max_length)
+ if (! $max_length) {
$max_length = MAX_IMAGE_LENGTH;
- if($max_length > 0)
+ }
+ if ($max_length > 0) {
$ph->scaleImage($max_length);
+ }
$width = $ph->getWidth();
$height = $ph->getHeight();
- if($width < 175 || $height < 175) {
+ if ($width < 175 || $height < 175) {
$ph->scaleImageUp(200);
$width = $ph->getWidth();
$height = $ph->getHeight();
$r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 0 );
- if($r)
+ if ($r) {
info( t('Image uploaded successfully.') . EOL );
- else
+ } else {
notice( t('Image upload failed.') . EOL );
+ }
- if($width > 640 || $height > 640) {
+ if ($width > 640 || $height > 640) {
$ph->scaleImage(640);
$r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 1 );
-
- if($r === false)
+
+ if ($r === false) {
notice( sprintf(t('Image size reduction [%s] failed.'),"640") . EOL );
- else
+ } else {
$smallest = 1;
+ }
}
$a->config['imagecrop'] = $hash;
require_once("include/Contact.php");
require_once('include/Probe.php');
-function profiles_init(&$a) {
+function profiles_init(App &$a) {
nav_set_selected('profiles');
intval(local_user()),
intval($a->argv[2])
);
- if(! count($r1)) {
+ if(! dbm::is_result($r1)) {
notice( t('Profile unavailable to clone.') . EOL);
killme();
return;
dbesc($name)
);
info( t('New profile created.') . EOL);
- if(count($r3) == 1)
+ if ((dbm::is_result($r3)) && (count($r3) == 1))
goaway('profiles/'.$r3[0]['id']);
goaway('profiles');
return $keywords;
}
-function profiles_post(&$a) {
+function profiles_post(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
}
-function profiles_content(&$a) {
+function profiles_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
<?php
-function profperm_init(&$a) {
+function profperm_init(App &$a) {
if (! local_user()) {
return;
}
-function profperm_content(&$a) {
+function profperm_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied') . EOL);
-function pubsub_init(&$a) {
+function pubsub_init(App &$a) {
$nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
$contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0 );
require_once('include/security.php');
-function pubsub_post(&$a) {
+function pubsub_post(App &$a) {
$xml = file_get_contents('php://input');
return (x($_POST, $name)) ? notags(trim($_POST[$name])) : '';
}
-function pubsubhubbub_init(&$a) {
+function pubsubhubbub_init(App &$a) {
// PuSH subscription must be considered "public" so just block it
// if public access isn't enabled.
if (get_config('system', 'block_public')) {
<?php
-function qsearch_init(&$a) {
+function qsearch_init(App &$a) {
if (! local_user()) {
killme();
<?php
-function randprof_init(&$a) {
+function randprof_init(App &$a) {
require_once('include/Contact.php');
$x = random_profile();
require_once('include/diaspora.php');
-function receive_post(&$a) {
+function receive_post(App &$a) {
$enabled = intval(get_config('system','diaspora_enabled'));
<?php
-function redir_init(&$a) {
+function redir_init(App &$a) {
$url = ((x($_GET,'url')) ? $_GET['url'] : '');
$quiet = ((x($_GET,'quiet')) ? '&quiet=1' : '');
require_once('include/user.php');
if(! function_exists('register_post')) {
-function register_post(&$a) {
+function register_post(App &$a) {
global $lang;
if(! function_exists('register_content')) {
-function register_content(&$a) {
+function register_content(App &$a) {
// logged in users can register others (people/pages/groups)
// even with closed registrations, unless specifically prohibited by site policy.
);
- if(! count($register))
+ if (! dbm::is_result($register)) {
return false;
+ }
$user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($register[0]['uid'])
);
- if(! count($user))
+ if (! dbm::is_result($user)) {
killme();
+ }
$r = q("DELETE FROM `register` WHERE `hash` = '%s'",
dbesc($register[0]['hash'])
dbesc($hash)
);
- if(! count($register))
+ if(! dbm::is_result($register))
return false;
$user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
}
-function regmod_content(&$a) {
+function regmod_content(App &$a) {
global $lang;
<?php
-function removeme_post(&$a) {
+function removeme_post(App &$a) {
if (! local_user()) {
return;
}
-function removeme_content(&$a) {
+function removeme_content(App &$a) {
if (! local_user()) {
goaway(z_root());
require_once('include/Scrape.php');
require_once('include/follow.php');
-function repair_ostatus_content(&$a) {
+function repair_ostatus_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
-function rsd_xml_content(&$a) {
+function rsd_xml_content(App &$a) {
header ("Content-Type: text/xml");
echo '<?xml version="1.0" encoding="UTF-8"?>
<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
}
-function salmon_post(&$a) {
+function salmon_post(App &$a) {
$xml = file_get_contents('php://input');
}
-function search_init(&$a) {
+function search_init(App &$a) {
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
-function search_post(&$a) {
+function search_post(App &$a) {
if(x($_POST,'search'))
$a->data['search'] = $_POST['search'];
}
-function search_content(&$a) {
+function search_content(App &$a) {
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL);
return null;
}
-function settings_init(&$a) {
+function settings_init(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL );
}
-function settings_post(&$a) {
+function settings_post(App &$a) {
if (! local_user()) {
return;
}
-function settings_content(&$a) {
+function settings_content(App &$a) {
$o = '';
nav_set_selected('settings');
<?php
-function share_init(&$a) {
+function share_init(App &$a) {
$post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
if((! $post_id) || (! local_user()))
require_once("include/Smilies.php");
-function smilies_content(&$a) {
+function smilies_content(App &$a) {
if ($a->argv[1]==="json"){
$tmp = Smilies::get_list();
$results = array();
<?php
-function starred_init(&$a) {
+function starred_init(App &$a) {
require_once("include/threads.php");
require_once("include/plugin.php");
-function statistics_json_init(&$a) {
+function statistics_json_init(App &$a) {
if (!get_config("system", "nodeinfo")) {
http_status_exit(404);
require_once('include/items.php');
-function subthread_content(&$a) {
+function subthread_content(App &$a) {
if(! local_user() && ! remote_user()) {
return;
if ((local_user()) && (local_user() == $owner_uid)) {
$contact = $owner;
- }
- else {
+ } else {
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($_SESSION['visitor_id']),
intval($owner_uid)
require_once('include/socgraph.php');
require_once('include/contact_widgets.php');
-
-function suggest_init(&$a) {
+function suggest_init(App &$a) {
if (! local_user()) {
return;
}
// so add any arguments as hidden inputs
$query = explode_querystring($a->query_string);
$inputs = array();
- foreach($query['args'] as $arg) {
- if(strpos($arg, 'confirm=') === false) {
+ foreach ($query['args'] as $arg) {
+ if (strpos($arg, 'confirm=') === false) {
$arg_parts = explode('=', $arg);
$inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]);
}
-function suggest_content(&$a) {
+function suggest_content(App &$a) {
require_once("mod/proxy.php");
require_once('include/items.php');
-function tagger_content(&$a) {
+function tagger_content(App &$a) {
if(! local_user() && ! remote_user()) {
return;
require_once('include/bbcode.php');
-function tagrm_post(&$a) {
+function tagrm_post(App &$a) {
if (! local_user()) {
goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']);
-function tagrm_content(&$a) {
+function tagrm_content(App &$a) {
$o = '';
<?php
-function toggle_mobile_init(&$a) {
+function toggle_mobile_init(App &$a) {
if (isset($_GET['off'])) {
$_SESSION['show-mobile'] = false;
<?php
-function uexport_init(&$a){
+function uexport_init(App &$a){
if (! local_user()) {
killme();
}
settings_init($a);
}
-function uexport_content(&$a){
+/// @TODO Change space -> tab where wanted
+function uexport_content(App &$a){
if ($a->argc > 1) {
header("Content-type: application/json");
/**
* echoes account data and items as separated json, one per line
*/
-function uexport_all(&$a) {
+function uexport_all(App &$a) {
uexport_account($a);
echo "\n";
<?php\r
/**\r
* View for user import\r
+ * @TODO This file has DOS line endings!\r
*/\r
\r
require_once("include/uimport.php");\r
\r
-function uimport_post(&$a) {\r
+function uimport_post(App &$a) {\r
switch($a->config['register_policy']) {\r
case REGISTER_OPEN:\r
$blocked = 0;\r
}\r
}\r
\r
-function uimport_content(&$a) {\r
+function uimport_content(App &$a) {\r
\r
if((! local_user()) && ($a->config['register_policy'] == REGISTER_CLOSED)) {\r
notice("Permission denied." . EOL);\r
require_once("mod/community.php");
-function update_community_content(&$a) {
+function update_community_content(App &$a) {
header("Content-type: text/html");
echo "<!DOCTYPE html><html><body>\r\n";
require_once("mod/display.php");
require_once("include/group.php");
-function update_display_content(&$a) {
+function update_display_content(App &$a) {
$profile_uid = intval($_GET["p"]);
require_once("mod/network.php");
require_once("include/group.php");
-function update_network_content(&$a) {
+function update_network_content(App &$a) {
$profile_uid = intval($_GET["p"]);
require_once("mod/notes.php");
-function update_notes_content(&$a) {
+function update_notes_content(App &$a) {
$profile_uid = intval($_GET["p"]);
require_once("mod/profile.php");
-function update_profile_content(&$a) {
+function update_profile_content(App &$a) {
$profile_uid = intval($_GET["p"]);
require_once('include/redir.php');
-function videos_init(&$a) {
+function videos_init(App &$a) {
if($a->argc > 1)
auto_redir($a, $a->argv[1]);
-function videos_post(&$a) {
+function videos_post(App &$a) {
$owner_uid = $a->data['user']['uid'];
if (($a->argc == 2) && x($_POST,'delete') && x($_POST, 'id')) {
// Check if we should do HTML-based delete confirmation
- if(!x($_REQUEST,'confirm')) {
+ if (!x($_REQUEST,'confirm')) {
if (x($_REQUEST,'canceled')) {
goaway(App::get_baseurl() . '/videos/' . $a->data['user']['nickname']);
}
$video_id = $_POST['id'];
-
$r = q("SELECT `id` FROM `attach` WHERE `uid` = %d AND `id` = '%s' LIMIT 1",
intval(local_user()),
dbesc($video_id)
intval(local_user())
);
//echo "<pre>"; var_dump($i); killme();
- if(count($i)) {
+ if (dbm::is_result($i)) {
q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
dbesc(datetime_convert()),
dbesc(datetime_convert()),
$url = App::get_baseurl();
$drop_id = intval($i[0]['id']);
- if($i[0]['visible'])
+ if ($i[0]['visible']) {
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
+ }
}
}
-function videos_content(&$a) {
+function videos_content(App &$a) {
// URLs (most aren't currently implemented):
// videos/name
$o .= paginate($a);
return $o;
}
-
require_once('include/Contact.php');
require_once('include/contact_selectors.php');
-function viewcontacts_init(&$a) {
+function viewcontacts_init(App &$a) {
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
return;
}
-function viewcontacts_content(&$a) {
+function viewcontacts_content(App &$a) {
require_once("mod/proxy.php");
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
<?php
-function viewsrc_content(&$a) {
+function viewsrc_content(App &$a) {
if (! local_user()) {
notice( t('Access denied.') . EOL);
require_once('include/attach.php');
require_once('include/datetime.php');
-function wall_attach_post(&$a) {
+function wall_attach_post(App &$a) {
$r_json = (x($_GET,'response') && $_GET['response']=='json');
require_once('include/message.php');
-function wallmessage_post(&$a) {
+function wallmessage_post(App &$a) {
$replyto = get_my_url();
if(! $replyto) {
}
-function wallmessage_content(&$a) {
+function wallmessage_content(App &$a) {
if(! get_my_url()) {
notice( t('Permission denied.') . EOL);
<?php
require_once("include/Probe.php");
-function webfinger_content(&$a) {
+function webfinger_content(App &$a) {
$o .= '<h3>Webfinger Diagnostic</h3>';
require_once('include/crypto.php');
-function xrd_init(&$a) {
+function xrd_init(App &$a) {
$uri = urldecode(notags(trim($_GET['uri'])));
$this->set_template('wall');
$this->toplevel = ($this->get_id() == $this->get_data_value('parent'));
- if(is_array($_SESSION['remote'])) {
- foreach($_SESSION['remote'] as $visitor) {
- if($visitor['cid'] == $this->get_data_value('contact-id')) {
+ if (is_array($_SESSION['remote'])) {
+ foreach ($_SESSION['remote'] as $visitor) {
+ if ($visitor['cid'] == $this->get_data_value('contact-id')) {
$this->visiting = true;
break;
}
* Theme settings
*/
-
-
-function theme_content(&$a){
+function theme_content(App &$a){
if (!local_user()) {
return;
}
return clean_form($a, $colorset, $user);
}
-function theme_post(&$a){
-
+function theme_post(App &$a){
if (! local_user()) {
return;
}
}
}
-
-function theme_admin(&$a){
+function theme_admin(App &$a){
$colorset = get_config( 'duepuntozero', 'colorset');
$user = false;
return clean_form($a, $colorset, $user);
}
-function theme_admin_post(&$a){
+function theme_admin_post(App &$a){
if (isset($_POST['duepuntozero-settings-submit'])){
set_config('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
}
/// @TODO $a is no longer used
function clean_form(&$a, &$colorset, $user){
$colorset = array(
- 'default'=>t('default'),
- 'greenzero'=>t('greenzero'),
- 'purplezero'=>t('purplezero'),
- 'easterbunny'=>t('easterbunny'),
- 'darkzero'=>t('darkzero'),
- 'comix'=>t('comix'),
- 'slackr'=>t('slackr'),
+ 'default' =>t('default'),
+ 'greenzero' =>t('greenzero'),
+ 'purplezero' =>t('purplezero'),
+ 'easterbunny' =>t('easterbunny'),
+ 'darkzero' =>t('darkzero'),
+ 'comix' =>t('comix'),
+ 'slackr' =>t('slackr'),
);
if ($user) {
$o .= replace_macros($t, array(
'$submit' => t('Submit'),
'$baseurl' => App::get_baseurl(),
- '$title'=> t("Theme settings"),
+ '$title' => t("Theme settings"),
'$colorset' => array('duepuntozero_colorset', t('Variations'), $color, '', $colorset),
));
<?php
-function duepuntozero_init(&$a) {
+function duepuntozero_init(App &$a) {
set_template_engine($a, 'smarty3');
<?php
require_once('view/theme/frio/php/Image.php');
-function theme_content(&$a) {
+function theme_content(App &$a) {
if (!local_user()) {
return;
}
return frio_form($a, $arr);
}
-function theme_post(&$a) {
+function theme_post(App &$a) {
if (!local_user()) {
return;
}
*
* @todo Check if this is really needed.
*/
-function load_page(&$a) {
+function load_page(App &$a) {
if(isset($_GET["mode"]) AND ($_GET["mode"] == "minimal")) {
require "view/theme/frio/minimal.php";
} elseif((isset($_GET["mode"]) AND ($_GET["mode"] == "none"))) {
global $frio;
-function frio_init(&$a) {
+function frio_init(App &$a) {
// disable the events module link in the profile tab
$a->theme_events_in_profile = false;
* Maintainer: Zach P <techcity@f.shmuz.in>
*/
-function frost_mobile_init(&$a) {
+function frost_mobile_init(App &$a) {
$a->sourcename = 'Friendica mobile web';
$a->videowidth = 250;
$a->videoheight = 200;
set_template_engine($a, 'smarty3');
}
-function frost_mobile_content_loaded(&$a) {
+function frost_mobile_content_loaded(App &$a) {
// I could do this in style.php, but by having the CSS in a file the browser will cache it,
// making pages load faster
* Maintainer: Zach P <techcity@f.shmuz.in>
*/
-function frost_init(&$a) {
+function frost_init(App &$a) {
$a->videowidth = 400;
$a->videoheight = 330;
$a->theme_thread_allow = false;
set_template_engine($a, 'smarty3');
}
-function frost_content_loaded(&$a) {
+function frost_content_loaded(App &$a) {
// I could do this in style.php, but by having the CSS in a file the browser will cache it,
// making pages load faster
* Theme settings
*/
-
-
-function theme_content(&$a){
+function theme_content(App &$a){
if (!local_user()) {
return;
}
return quattro_form($a,$align, $color, $tfs, $pfs);
}
-function theme_post(&$a){
+function theme_post(App &$a){
if (! local_user()) {
return;
}
}
}
-
-function theme_admin(&$a){
+function theme_admin(App &$a){
$align = get_config('quattro', 'align' );
$color = get_config('quattro', 'color' );
- $tfs = get_config("quattro","tfs");
- $pfs = get_config("quattro","pfs");
+ $tfs = get_config("quattro","tfs");
+ $pfs = get_config("quattro","pfs");
return quattro_form($a,$align, $color, $tfs, $pfs);
}
-function theme_admin_post(&$a){
+function theme_admin_post(App &$a){
if (isset($_POST['quattro-settings-submit'])){
set_config('quattro', 'align', $_POST['quattro_align']);
set_config('quattro', 'color', $_POST['quattro_color']);
- set_config('quattro', 'tfs', $_POST['quattro_tfs']);
+ set_config('quattro', 'tfs', $_POST['quattro_tfs']);
set_config('quattro', 'pfs', $_POST['quattro_pfs']);
}
}
/// @TODO $a is no longer used here
-function quattro_form(&$a, $align, $color, $tfs, $pfs){
+function quattro_form(App &$a, $align, $color, $tfs, $pfs){
$colors = array(
- "dark"=>"Quattro",
- "lilac"=>"Lilac",
- "green"=>"Green"
+ "dark" => "Quattro",
+ "lilac" => "Lilac",
+ "green" => "Green",
);
-
- if ($tfs===false) $tfs="20";
- if ($pfs===false) $pfs="12";
-
+
+ if ($tfs === false) {
+ $tfs = "20";
+ }
+ if ($pfs === false) {
+ $pfs = "12";
+ }
+
$t = get_markup_template("theme_settings.tpl" );
$o .= replace_macros($t, array(
- '$submit' => t('Submit'),
+ '$submit' => t('Submit'),
'$baseurl' => App::get_baseurl(),
- '$title' => t("Theme settings"),
- '$align' => array('quattro_align', t('Alignment'), $align, '', array('left'=>t('Left'), 'center'=>t('Center'))),
- '$color' => array('quattro_color', t('Color scheme'), $color, '', $colors),
- '$pfs' => array('quattro_pfs', t('Posts font size'), $pfs),
- '$tfs' => array('quattro_tfs',t('Textareas font size'), $tfs),
+ '$title' => t("Theme settings"),
+ '$align' => array('quattro_align', t('Alignment'), $align, '', array('left'=>t('Left'), 'center'=>t('Center'))),
+ '$color' => array('quattro_color', t('Color scheme'), $color, '', $colors),
+ '$pfs' => array('quattro_pfs', t('Posts font size'), $pfs),
+ '$tfs' => array('quattro_tfs',t('Textareas font size'), $tfs),
));
return $o;
}
* Maintainer: Tobias <https://diekershoff.homeunix.net/friendica/profile/tobias>
*/
-function quattro_init(&$a) {
+function quattro_init(App &$a) {
$a->page['htmlhead'] .= '<script src="'.App::get_baseurl().'/view/theme/quattro/tinycon.min.js"></script>';
$a->page['htmlhead'] .= '<script src="'.App::get_baseurl().'/view/theme/quattro/js/quattro.js"></script>';;
}
* Screenshot: <a href="screenshot.png">Screenshot</a>
*/
-function smoothly_init(&$a) {
+function smoothly_init(App &$a) {
set_template_engine($a, 'smarty3');
$cssFile = null;
-function theme_content(&$a){
+function theme_content(App &$a){
if (!local_user()) {
return;
}
$show_services, $show_friends, $show_lastusers);
}
-function theme_post(&$a){
+function theme_post(App &$a){
if (! local_user()) {
return;
}
}
-function theme_admin(&$a){
+function theme_admin(App &$a){
if (!function_exists('get_vier_config'))
return;
return $o;
}
-function theme_admin_post(&$a){
+function theme_admin_post(App &$a){
if (isset($_POST['vier-settings-submit'])){
set_config('vier', 'style', $_POST['vier_style']);
set_config('vier', 'show_pages', $_POST['vier_show_pages']);
require_once("include/socgraph.php");
require_once("mod/proxy.php");
-function vier_init(&$a) {
+function vier_init(App &$a) {
$a->theme_events_in_profile = false;