Merge remote-tracking branch 'upstream/develop' into 1612-unused-indexes

This commit is contained in:
Michael 2017-01-07 16:13:57 +00:00
commit ed0143c9f0
162 changed files with 766 additions and 683 deletions

View file

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

View file

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

View file

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

View file

@ -23,7 +23,7 @@ require_once("include/text.php");
* @param App $a
*
*/
function admin_post(&$a){
function admin_post(App &$a){
if(!is_site_admin()) {
@ -127,7 +127,7 @@ function admin_post(&$a){
* @param App $a
* @return string
*/
function admin_content(&$a) {
function admin_content(App &$a) {
if(!is_site_admin()) {
return login(false);
@ -260,7 +260,7 @@ function admin_content(&$a) {
* @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
//
@ -393,7 +393,7 @@ function admin_page_federation(&$a) {
* @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`
@ -427,7 +427,7 @@ function admin_page_queue(&$a) {
* @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",
@ -504,7 +504,7 @@ function admin_page_summary(&$a) {
*
* @param App $a
*/
function admin_page_site_post(&$a) {
function admin_page_site_post(App &$a) {
if(!x($_POST,"page_site")) {
return;
}
@ -845,7 +845,7 @@ function admin_page_site_post(&$a) {
* @param App $a
* @return string
*/
function admin_page_site(&$a) {
function admin_page_site(App &$a) {
/* Installed langs */
$lang_choices = get_available_languages();
@ -1072,7 +1072,7 @@ function admin_page_site(&$a) {
* @param App $a
* @return string
**/
function admin_page_dbsync(&$a) {
function admin_page_dbsync(App &$a) {
$o = '';
@ -1155,22 +1155,22 @@ function admin_page_dbsync(&$a) {
*
* @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;
}
@ -1260,7 +1260,7 @@ function admin_page_users_post(&$a){
* @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));
@ -1460,7 +1460,7 @@ function admin_page_users(&$a){
* @param App $a
* @return string
*/
function admin_page_plugins(&$a){
function admin_page_plugins(App &$a){
/*
* Single plugin
@ -1669,7 +1669,7 @@ function rebuild_theme_table($themes) {
* @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);
@ -1850,13 +1850,13 @@ function admin_page_themes(&$a){
*
* @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);
@ -1884,7 +1884,7 @@ function admin_page_logs_post(&$a) {
* @param App $a
* @return string
*/
function admin_page_logs(&$a){
function admin_page_logs(App &$a){
$log_choices = array(
LOGGER_NORMAL => 'Normal',
@ -1941,7 +1941,7 @@ function admin_page_logs(&$a){
* @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 = '';
@ -1983,7 +1983,7 @@ function admin_page_viewlogs(&$a){
*
* @param App $a
*/
function admin_page_features_post(&$a) {
function admin_page_features_post(App &$a) {
check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features');
@ -2029,7 +2029,7 @@ function admin_page_features_post(&$a) {
* @param App $a
* @return string
*/
function admin_page_features(&$a) {
function admin_page_features(App &$a) {
if((argc() > 1) && (argv(1) === 'features')) {
$arr = array();

View file

@ -5,7 +5,7 @@ require_once('include/Contact.php');
require_once('include/contact_selectors.php');
require_once('mod/contacts.php');
function allfriends_content(&$a) {
function allfriends_content(App &$a) {
$o = '';
if (! local_user()) {
@ -21,14 +21,14 @@ function allfriends_content(&$a) {
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;
}
@ -71,20 +71,20 @@ function allfriends_content(&$a) {
}
$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;
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,11 +3,11 @@
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);

View file

@ -9,7 +9,7 @@
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]);
@ -64,7 +64,7 @@ function cal_init(&$a) {
return;
}
function cal_content(&$a) {
function cal_content(App &$a) {
nav_set_selected('events');
$editselect = 'none';

View file

@ -5,19 +5,19 @@
*/
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;

View file

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

View file

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

View file

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

View file

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

View file

@ -5,7 +5,7 @@
* 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'));

View file

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

View file

@ -1,12 +1,12 @@
<?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);
@ -21,7 +21,6 @@ function delegate_content(&$a) {
goaway(App::get_baseurl() . '/delegate');
}
$id = $a->argv[2];
$r = q("select `nickname` from user where uid = %d limit 1",
@ -45,12 +44,11 @@ function delegate_content(&$a) {
if ($a->argc > 2 && $a->argv[1] === 'remove' && intval($a->argv[2])) {
// 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())
);

View file

@ -415,23 +415,26 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
);
}
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);

View file

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

View file

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

View file

@ -17,7 +17,7 @@ require_once('include/Scrape.php');
require_once('include/Probe.php');
require_once('include/group.php');
function dfrn_request_init(&$a) {
function dfrn_request_init(App &$a) {
if($a->argc > 1)
$which = $a->argv[1];
@ -42,7 +42,7 @@ function dfrn_request_init(&$a) {
* 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));
@ -658,7 +658,7 @@ function dfrn_request_post(&$a) {
}
function dfrn_request_content(&$a) {
function dfrn_request_content(App &$a) {
if (($a->argc != 2) || (! count($a->profile))) {
return "";
@ -810,19 +810,17 @@ function dfrn_request_content(&$a) {
// 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();
}
@ -840,8 +838,7 @@ function dfrn_request_content(&$a) {
if ($a->profile['page-flags'] == PAGE_NORMAL) {
$tpl = get_markup_template('dfrn_request.tpl');
}
else {
} else {
$tpl = get_markup_template('auto_request.tpl');
}
@ -850,10 +847,12 @@ function dfrn_request_content(&$a) {
// 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'))
$mail_disabled = 1;
if(! $mail_disabled) {
if (get_config('system','dfrn_only')) {
$mail_disabled = 1;
}
if (! $mail_disabled) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval($a->profile['uid'])
);

View file

@ -1,6 +1,6 @@
<?php
function directory_init(&$a) {
function directory_init(App &$a) {
$a->set_pager_itemspage(60);
if(local_user()) {
@ -20,14 +20,14 @@ function directory_init(&$a) {
}
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");

View file

@ -5,7 +5,7 @@ require_once('include/Contact.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 );

View file

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

View file

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

View file

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

View file

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

View file

@ -8,7 +8,7 @@ require_once("include/xml.php");
/// @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'));

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,7 +4,7 @@ function validate_members(&$item) {
$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));
@ -13,7 +13,7 @@ function group_init(&$a) {
function group_post(&$a) {
function group_post(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
@ -31,8 +31,7 @@ function group_post(&$a) {
if ($r) {
goaway(App::get_baseurl() . '/group/' . $r);
}
}
else {
} else {
notice( t('Could not create group.') . EOL );
}
goaway(App::get_baseurl() . '/group');
@ -70,7 +69,7 @@ function group_post(&$a) {
return;
}
function group_content(&$a) {
function group_content(App &$a) {
$change = false;
if (! local_user()) {
@ -92,7 +91,7 @@ function group_content(&$a) {
'$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.'),

View file

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

View file

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

View file

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

View file

@ -2,7 +2,7 @@
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');

View file

@ -11,7 +11,7 @@
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";
}

View file

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

View file

@ -4,7 +4,7 @@ require_once "include/Photo.php";
$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") {
@ -24,7 +24,7 @@ function install_init(&$a){
}
function install_post(&$a) {
function install_post(App &$a) {
global $install_wizard_pass, $db;
switch($install_wizard_pass) {
@ -132,7 +132,7 @@ function get_db_errno() {
}
}
function install_content(&$a) {
function install_content(App &$a) {
global $install_wizard_pass, $db;
$o = '';
@ -565,7 +565,7 @@ function check_imagik(&$checks) {
}
}
function manual_config(&$a) {
function manual_config(App &$a) {
$data = htmlentities($a->data['txt'],ENT_COMPAT,'UTF-8');
$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>";
@ -581,7 +581,6 @@ function load_database_rem($v, $i){
}
}
function load_database($db) {
require_once("include/dbstructure.php");

View file

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

View file

@ -27,7 +27,7 @@ require_once('include/Scrape.php');
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;
@ -138,7 +138,7 @@ function item_post(&$a) {
// 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 = get_contact_details_by_url($thrparent[0]["author-link"]);
@ -218,8 +218,9 @@ function item_post(&$a) {
intval($profile_uid),
intval($post_id)
);
if(! count($i))
if (! dbm::is_result($i)) {
killme();
}
$orig_post = $i[0];
}
@ -605,16 +606,17 @@ function item_post(&$a) {
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;
@ -624,8 +626,8 @@ function item_post(&$a) {
$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)
@ -1064,7 +1066,7 @@ function item_post_return($baseurl, $api_source, $return_path) {
function item_content(&$a) {
function item_content(App &$a) {
if ((! local_user()) && (! remote_user())) {
return;

View file

@ -5,7 +5,7 @@ require_once('include/bbcode.php');
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;
}

View file

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

View file

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

View file

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

View file

@ -4,7 +4,7 @@ require_once('include/email.php');
require_once('include/enotify.php');
require_once('include/text.php');
function lostpass_post(&$a) {
function lostpass_post(App &$a) {
$loginame = notags(trim($_POST['login-name']));
if(! $loginame)
@ -77,7 +77,7 @@ function lostpass_post(&$a) {
}
function lostpass_content(&$a) {
function lostpass_content(App &$a) {
if(x($_GET,'verify')) {
@ -102,6 +102,8 @@ function lostpass_content(&$a) {
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(

View file

@ -1,6 +1,6 @@
<?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');

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,17 +1,18 @@
<?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;
}
@ -24,9 +25,8 @@ function network_init(&$a) {
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);
@ -41,10 +41,9 @@ function network_init(&$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;
}
@ -222,7 +221,7 @@ function saved_searches($search) {
*
* @return Array ( $no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active );
*/
function network_query_get_sel_tab($a) {
function network_query_get_sel_tab(App &$a) {
$no_active='';
$starred_active = '';
$new_active = '';
@ -293,7 +292,7 @@ function network_query_get_sel_net() {
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])) {
@ -810,7 +809,7 @@ function network_content(&$a, $update = 0) {
* @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">';

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
<?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)

View file

@ -9,7 +9,7 @@ require_once("include/NotificationsManager.php");
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());
@ -65,7 +65,7 @@ function notifications_post(&$a) {
}
}
function notifications_content(&$a) {
function notifications_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);

View file

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

View file

@ -1,7 +1,7 @@
<?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'){

View file

@ -1,7 +1,7 @@
<?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');
@ -14,7 +14,7 @@ function oexchange_init(&$a) {
}
function oexchange_content(&$a) {
function oexchange_content(App &$a) {
if (! local_user()) {
$o = login(false);

View file

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

View file

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

View file

@ -3,7 +3,7 @@
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);

View file

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

View file

@ -3,7 +3,7 @@
require_once('include/security.php');
require_once('include/Photo.php');
function photo_init(&$a) {
function photo_init(App &$a) {
global $_SERVER;
$prvcachecontrol = false;

View file

@ -10,7 +10,7 @@ require_once('include/tags.php');
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]);
@ -112,7 +112,7 @@ function photos_init(&$a) {
function photos_post(&$a) {
function photos_post(App &$a) {
logger('mod-photos: photos_post: begin' , LOGGER_DEBUG);
@ -353,7 +353,7 @@ function photos_post(&$a) {
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()),
@ -946,7 +946,7 @@ function photos_post(&$a) {
function photos_content(&$a) {
function photos_content(App &$a) {
// URLs:
// photos/name

View file

@ -2,7 +2,7 @@
// 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;
@ -16,8 +16,9 @@ function poco_init(&$a) {
}
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;
}

View file

@ -19,7 +19,7 @@ require_once('include/bbcode.php');
require_once('include/items.php');
function poke_init(&$a) {
function poke_init(App &$a) {
if (! local_user()) {
return;
@ -148,7 +148,7 @@ function poke_init(&$a) {
function poke_content(&$a) {
function poke_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);

View file

@ -10,11 +10,11 @@ require_once('include/crypto.php');
// 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 {

View file

@ -1,6 +1,6 @@
<?php
function pretheme_init(&$a) {
function pretheme_init(App &$a) {
if($_REQUEST['theme']) {
$theme = $_REQUEST['theme'];

View file

@ -2,7 +2,7 @@
require_once('include/Scrape.php');
function probe_content(&$a) {
function probe_content(App &$a) {
$o .= '<h3>Probe Diagnostic</h3>';

View file

@ -4,7 +4,7 @@ require_once('include/contact_widgets.php');
require_once('include/redir.php');
function profile_init(&$a) {
function profile_init(App &$a) {
if(! x($a->page,'aside'))
$a->page['aside'] = '';
@ -41,14 +41,15 @@ function profile_init(&$a) {
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))
@ -74,24 +75,25 @@ function profile_content(&$a, $update = 0) {
$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();
}
@ -106,32 +108,28 @@ function profile_content(&$a, $update = 0) {
$tab = 'posts';
$o = '';
if($update) {
if ($update) {
// Ensure we've got a profile owner if updating.
$a->profile['profile_uid'] = $update;
} elseif ($a->profile['profile_uid'] == local_user()) {
nav_set_selected('home');
}
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),
@ -143,8 +141,8 @@ function profile_content(&$a, $update = 0) {
}
}
if(! $remote_contact) {
if(local_user()) {
if (! $remote_contact) {
if (local_user()) {
$contact_id = $_SESSION['cid'];
$contact = $a->contact;
}
@ -152,32 +150,29 @@ function profile_content(&$a, $update = 0) {
$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);
@ -185,7 +180,7 @@ function profile_content(&$a, $update = 0) {
$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,
@ -204,18 +199,16 @@ function profile_content(&$a, $update = 0) {
$o .= status_editor($a,$x);
}
}
/**
* Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups
*/
$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`
@ -234,16 +227,16 @@ function profile_content(&$a, $update = 0) {
} 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))));
}

View file

@ -2,7 +2,7 @@
require_once("include/Photo.php");
function profile_photo_init(&$a) {
function profile_photo_init(App &$a) {
if (! local_user()) {
return;
@ -13,7 +13,7 @@ function profile_photo_init(&$a) {
}
function profile_photo_post(&$a) {
function profile_photo_post(App &$a) {
if (! local_user()) {
notice ( t('Permission denied.') . EOL );
@ -73,22 +73,25 @@ function profile_photo_post(&$a) {
$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
@ -130,9 +133,9 @@ function profile_photo_post(&$a) {
require_once('include/profile_update.php');
profile_change();
}
else
} else {
notice( t('Unable to process image') . EOL);
}
}
goaway(App::get_baseurl() . '/profiles');
@ -143,11 +146,13 @@ function profile_photo_post(&$a) {
$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;
@ -156,7 +161,7 @@ function profile_photo_post(&$a) {
$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;
@ -165,12 +170,11 @@ function profile_photo_post(&$a) {
$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 );
@ -282,15 +286,17 @@ function profile_photo_content(&$a) {
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();
@ -303,19 +309,21 @@ function profile_photo_crop_ui_head(&$a, $ph){
$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;

View file

@ -2,7 +2,7 @@
require_once("include/Contact.php");
require_once('include/Probe.php');
function profiles_init(&$a) {
function profiles_init(App &$a) {
nav_set_selected('profiles');
@ -92,7 +92,7 @@ function profiles_init(&$a) {
intval(local_user()),
intval($a->argv[2])
);
if(! count($r1)) {
if(! dbm::is_result($r1)) {
notice( t('Profile unavailable to clone.') . EOL);
killme();
return;
@ -116,7 +116,7 @@ function profiles_init(&$a) {
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');
@ -160,7 +160,7 @@ function profile_clean_keywords($keywords) {
return $keywords;
}
function profiles_post(&$a) {
function profiles_post(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);
@ -601,7 +601,7 @@ function profile_activity($changed, $value) {
}
function profiles_content(&$a) {
function profiles_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL);

View file

@ -1,6 +1,6 @@
<?php
function profperm_init(&$a) {
function profperm_init(App &$a) {
if (! local_user()) {
return;
@ -14,7 +14,7 @@ function profperm_init(&$a) {
}
function profperm_content(&$a) {
function profperm_content(App &$a) {
if (! local_user()) {
notice( t('Permission denied') . EOL);

View file

@ -26,7 +26,7 @@ function hub_post_return() {
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 );
@ -98,7 +98,7 @@ function pubsub_init(&$a) {
require_once('include/security.php');
function pubsub_post(&$a) {
function pubsub_post(App &$a) {
$xml = file_get_contents('php://input');

View file

@ -4,7 +4,7 @@ function post_var($name) {
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')) {

View file

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

View file

@ -1,7 +1,7 @@
<?php
function randprof_init(&$a) {
function randprof_init(App &$a) {
require_once('include/Contact.php');
$x = random_profile();

View file

@ -10,7 +10,7 @@ require_once('include/crypto.php');
require_once('include/diaspora.php');
function receive_post(&$a) {
function receive_post(App &$a) {
$enabled = intval(get_config('system','diaspora_enabled'));

View file

@ -1,6 +1,6 @@
<?php
function redir_init(&$a) {
function redir_init(App &$a) {
$url = ((x($_GET,'url')) ? $_GET['url'] : '');
$quiet = ((x($_GET,'quiet')) ? '&quiet=1' : '');

View file

@ -5,7 +5,7 @@ require_once('include/bbcode.php');
require_once('include/user.php');
if(! function_exists('register_post')) {
function register_post(&$a) {
function register_post(App &$a) {
global $lang;
@ -172,7 +172,7 @@ function register_post(&$a) {
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.

View file

@ -12,15 +12,17 @@ function user_allow($hash) {
);
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'])
@ -70,7 +72,7 @@ function user_deny($hash) {
dbesc($hash)
);
if(! count($register))
if(! dbm::is_result($register))
return false;
$user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
@ -95,7 +97,7 @@ function user_deny($hash) {
}
function regmod_content(&$a) {
function regmod_content(App &$a) {
global $lang;

View file

@ -1,6 +1,6 @@
<?php
function removeme_post(&$a) {
function removeme_post(App &$a) {
if (! local_user()) {
return;
@ -32,7 +32,7 @@ function removeme_post(&$a) {
}
function removeme_content(&$a) {
function removeme_content(App &$a) {
if (! local_user()) {
goaway(z_root());

View file

@ -3,7 +3,7 @@
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);

View file

@ -2,7 +2,7 @@
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">

View file

@ -19,7 +19,7 @@ function salmon_return($val) {
}
function salmon_post(&$a) {
function salmon_post(App &$a) {
$xml = file_get_contents('php://input');

View file

@ -43,7 +43,7 @@ function search_saved_searches() {
}
function search_init(&$a) {
function search_init(App &$a) {
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
@ -81,13 +81,13 @@ function search_init(&$a) {
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);

View file

@ -16,7 +16,7 @@ function get_theme_config_file($theme){
return null;
}
function settings_init(&$a) {
function settings_init(App &$a) {
if (! local_user()) {
notice( t('Permission denied.') . EOL );
@ -116,7 +116,7 @@ function settings_init(&$a) {
}
function settings_post(&$a) {
function settings_post(App &$a) {
if (! local_user()) {
return;
@ -654,7 +654,7 @@ function settings_post(&$a) {
}
function settings_content(&$a) {
function settings_content(App &$a) {
$o = '';
nav_set_selected('settings');

View file

@ -1,5 +1,5 @@
<?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()))

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