Remove unused code in mod/

- Remove commented code
- Remove unused/immediately overwritten variables
- Remove extraneous parameters
- Remove unreachable code
This commit is contained in:
Hypolite Petovan 2019-01-07 01:23:49 -05:00
parent 4a95ca280d
commit dbc6eb5422
34 changed files with 32 additions and 173 deletions

View file

@ -60,8 +60,6 @@ function allfriends_content(App $a)
//get further details of the contact
$contact_details = Model\Contact::getDetailsByURL($rr['url'], $uid, $rr);
$photo_menu = '';
$connlnk = '';
// $rr[cid] is only available for common contacts. So if the contact is a common one, use contact_photo_menu to generate the photo_menu
// If the contact is not common to the user, Connect/Follow' will be added to the photo menu

View file

@ -11,10 +11,8 @@ use Friendica\Module\Login;
require_once 'include/api.php';
function oauth_get_client($request)
function oauth_get_client(OAuthRequest $request)
{
$params = $request->get_parameters();
$token = $params['oauth_token'];

View file

@ -17,7 +17,7 @@ require_once 'mod/settings.php';
function delegate_init(App $a)
{
return settings_init($a);
settings_init($a);
}
function delegate_post(App $a)

View file

@ -253,7 +253,6 @@ function dfrn_notify_content(App $a) {
*/
$dfrn_id = Strings::escapeTags(trim($_GET['dfrn_id']));
$dfrn_version = (float) $_GET['dfrn_version'];
$rino_remote = (!empty($_GET['rino']) ? intval($_GET['rino']) : 0);
$type = "";
$last_update = "";

View file

@ -28,7 +28,6 @@ function dfrn_poll_init(App $a)
$challenge = defaults($_GET, 'challenge' , '');
$sec = defaults($_GET, 'sec' , '');
$dfrn_version = (float) defaults($_GET, 'dfrn_version' , 2.0);
$perm = defaults($_GET, 'perm' , 'r');
$quiet = !empty($_GET['quiet']);
// Possibly it is an OStatus compatible server that requests a user feed
@ -319,15 +318,12 @@ function dfrn_poll_post(App $a)
switch ($direction) {
case -1:
$sql_extra = sprintf(" AND `issued-id` = '%s' ", DBA::escape($dfrn_id));
$my_id = $dfrn_id;
break;
case 0:
$sql_extra = sprintf(" AND `issued-id` = '%s' AND `duplex` = 1 ", DBA::escape($dfrn_id));
$my_id = '1:' . $dfrn_id;
break;
case 1:
$sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", DBA::escape($dfrn_id));
$my_id = '0:' . $dfrn_id;
break;
default:
$a->internalRedirect();
@ -420,7 +416,7 @@ function dfrn_poll_content(App $a)
DBA::delete('challenge', ["`expire` < ?", time()]);
if ($type !== 'profile') {
$r = q("INSERT INTO `challenge` ( `challenge`, `dfrn-id`, `expire` , `type`, `last_update` )
q("INSERT INTO `challenge` ( `challenge`, `dfrn-id`, `expire` , `type`, `last_update` )
VALUES( '%s', '%s', '%s', '%s', '%s' ) ",
DBA::escape($hash),
DBA::escape($dfrn_id),

View file

@ -188,7 +188,7 @@ function dfrn_request_post(App $a)
}
if (strlen($dfrn_request) && strlen($confirm_key)) {
$s = Network::fetchUrl($dfrn_request . '?confirm_key=' . $confirm_key);
Network::fetchUrl($dfrn_request . '?confirm_key=' . $confirm_key);
}
// (ignore reply, nothing we can do it failed)
@ -230,7 +230,6 @@ function dfrn_request_post(App $a)
}
$nickname = $a->profile['nickname'];
$notify_flags = $a->profile['notify-flags'];
$uid = $a->profile['uid'];
$maxreq = intval($a->profile['maxreq']);
$contact_record = null;
@ -271,8 +270,6 @@ function dfrn_request_post(App $a)
}
}
$real_name = !empty($_POST['realname']) ? Strings::escapeTags(trim($_POST['realname'])) : '';
$url = trim($_POST['dfrn_url']);
if (!strlen($url)) {
notice(L10n::t("Invalid locator") . EOL);
@ -420,7 +417,7 @@ function dfrn_request_post(App $a)
$hash = Strings::getRandomHex() . (string) time(); // Generate a confirm_key
if (is_array($contact_record)) {
$ret = q("INSERT INTO `intro` ( `uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)
q("INSERT INTO `intro` ( `uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)
VALUES ( %d, %d, 1, %d, '%s', '%s', '%s' )",
intval($uid),
intval($contact_record['id']),
@ -586,7 +583,7 @@ function dfrn_request_content(App $a)
// If we are auto_confirming, this record will have already been nuked
// in dfrn_confirm_post()
$r = q("UPDATE `intro` SET `blocked` = 0 WHERE `hash` = '%s'",
q("UPDATE `intro` SET `blocked` = 0 WHERE `hash` = '%s'",
DBA::escape($_GET['confirm_key'])
);
}
@ -657,6 +654,4 @@ function dfrn_request_content(App $a)
]);
return $o;
}
return; // Somebody is fishing.
}

View file

@ -112,7 +112,6 @@ function directory_content(App $a)
}
while ($rr = DBA::fetch($r)) {
$itemurl= '';
$itemurl = (($rr['addr'] != "") ? $rr['addr'] : $rr['profile_url']);

View file

@ -35,7 +35,6 @@ function display_init(App $a)
}
$nick = (($a->argc > 1) ? $a->argv[1] : '');
$profiledata = [];
if ($a->argc == 3) {
if (substr($a->argv[2], -5) == '.atom') {
@ -157,7 +156,6 @@ function display_fetchauthor($a, $item)
}
if (!$skip) {
$author = "";
preg_match("/author='(.*?)'/ism", $attributes, $matches);
if (!empty($matches[1])) {
$profiledata["name"] = html_entity_decode($matches[1],ENT_QUOTES,'UTF-8');
@ -166,7 +164,6 @@ function display_fetchauthor($a, $item)
if (!empty($matches[1])) {
$profiledata["name"] = html_entity_decode($matches[1],ENT_QUOTES,'UTF-8');
}
$profile = "";
preg_match("/profile='(.*?)'/ism", $attributes, $matches);
if (!empty($matches[1])) {
$profiledata["url"] = $matches[1];
@ -175,7 +172,6 @@ function display_fetchauthor($a, $item)
if (!empty($matches[1])) {
$profiledata["url"] = $matches[1];
}
$avatar = "";
preg_match("/avatar='(.*?)'/ism", $attributes, $matches);
if (!empty($matches[1])) {
$profiledata["photo"] = $matches[1];

View file

@ -2,9 +2,9 @@
/**
* @file mod/editpost.php
*/
use Friendica\App;
use Friendica\Content\Feature;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
@ -63,25 +63,6 @@ function editpost_content(App $a)
$jotplugins = '';
$jotnets = '';
$mail_disabled = ((function_exists('imap_open') && !Config::get('system', 'imap_disabled')) ? 0 : 1);
$mail_enabled = false;
$pubmail_enabled = false;
if (!$mail_disabled) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
intval(local_user())
);
if (DBA::isResult($r)) {
$mail_enabled = true;
if (intval($r[0]['pubmail'])) {
$pubmail_enabled = true;
}
}
}
Hook::callAll('jot_tool', $jotplugins);
$tpl = Renderer::getMarkupTemplate("jot.tpl");

View file

@ -213,14 +213,14 @@ function events_content(App $a)
}
if (($a->argc > 2) && ($a->argv[1] === 'ignore') && intval($a->argv[2])) {
$r = q("UPDATE `event` SET `ignore` = 1 WHERE `id` = %d AND `uid` = %d",
q("UPDATE `event` SET `ignore` = 1 WHERE `id` = %d AND `uid` = %d",
intval($a->argv[2]),
intval(local_user())
);
}
if (($a->argc > 2) && ($a->argv[1] === 'unignore') && intval($a->argv[2])) {
$r = q("UPDATE `event` SET `ignore` = 0 WHERE `id` = %d AND `uid` = %d",
q("UPDATE `event` SET `ignore` = 0 WHERE `id` = %d AND `uid` = %d",
intval($a->argv[2]),
intval(local_user())
);
@ -300,21 +300,6 @@ function events_content(App $a)
$y = 2100;
}
$nextyear = $y;
$nextmonth = $m + 1;
if ($nextmonth > 12) {
$nextmonth = 1;
$nextyear ++;
}
$prevyear = $y;
if ($m > 1) {
$prevmonth = $m - 1;
} else {
$prevmonth = 12;
$prevyear --;
}
$dim = Temporal::getDaysInMonth($y, $m);
$start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
$finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
@ -526,7 +511,7 @@ function events_content(App $a)
'$s_text' => L10n::t('Event Starts:') . ' <span class="required" title="' . L10n::t('Required') . '">*</span>',
'$s_dsel' => Temporal::getDateTimeField(
new DateTime(),
DateTime::createFromFormat('Y', $syear+5),
DateTime::createFromFormat('Y', intval($syear) + 5),
DateTime::createFromFormat('Y-m-d H:i', "$syear-$smonth-$sday $shour:$sminute"),
L10n::t('Event Starts:'),
'start_text',
@ -541,7 +526,7 @@ function events_content(App $a)
'$f_text' => L10n::t('Event Finishes:'),
'$f_dsel' => Temporal::getDateTimeField(
new DateTime(),
DateTime::createFromFormat('Y', $fyear+5),
DateTime::createFromFormat('Y', intval($fyear) + 5),
DateTime::createFromFormat('Y-m-d H:i', "$fyear-$fmonth-$fday $fhour:$fminute"),
L10n::t('Event Finishes:'),
'finish_text',

View file

@ -28,10 +28,6 @@ function fbrowser_content(App $a)
}
$template_file = "filebrowser.tpl";
$mode = "";
if (!empty($_GET['mode'])) {
$mode = "?mode=".$_GET['mode'];
}
switch ($a->argv[1]) {
case "image":
@ -55,12 +51,11 @@ function fbrowser_content(App $a)
$albums = array_map("_map_folder1", $albums);
}
$album = "";
if ($a->argc==3) {
if ($a->argc == 3) {
$album = hex2bin($a->argv[2]);
$sql_extra = sprintf("AND `album` = '%s' ", DBA::escape($album));
$sql_extra2 = "";
$path[]=[$a->argv[2], $album];
$path[] = [$a->argv[2], $album];
}
$r = q("SELECT `resource-id`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`filename`) AS `filename`, ANY_VALUE(`type`) AS `type`,
@ -118,8 +113,7 @@ function fbrowser_content(App $a)
function _map_files2($rr)
{
$a = \get_app();
list($m1,$m2) = explode("/", $rr['filetype']);
list($m1, $m2) = explode("/", $rr['filetype']);
$filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip");
$filename_e = $rr['filename'];

View file

@ -45,7 +45,7 @@ function fsuggest_post(App $a)
intval(local_user())
);
if (DBA::isResult($r)) {
$x = q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`)
q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`)
VALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')",
intval(local_user()),
intval($contact_id),

View file

@ -61,7 +61,4 @@ function home_content(App $a) {
'$login' => $login,
'$content' => $content
]);
return $o;
}}

View file

@ -47,7 +47,6 @@ function hovercard_content()
// If a contact is connected the url is internally changed to 'redir/CID'. We need the pure url to search for
// the contact. So we strip out the contact id from the internal url and look in the contact table for
// the real url (nurl)
$cid = 0;
if (strpos($profileurl, 'redir/') === 0) {
$cid = intval(substr($profileurl, 6));
$remote_contact = DBA::selectFirst('contact', ['nurl'], ['id' => $cid]);

View file

@ -125,8 +125,6 @@ function item_post(App $a) {
$parent = $parent_item['id'];
$parent_user = $parent_item['uid'];
$parent_contact = Contact::getDetailsByURL($parent_item["author-link"]);
$objecttype = ACTIVITY_OBJ_COMMENT;
}
@ -386,7 +384,7 @@ function item_post(App $a) {
continue;
}
$success = handle_tag($a, $body, $inform, $str_tags, local_user() ? local_user() : $profile_uid, $tag, $network);
$success = handle_tag($body, $inform, $str_tags, local_user() ? local_user() : $profile_uid, $tag, $network);
if ($success['replaced']) {
$tagged[] = $tag;
}
@ -723,8 +721,6 @@ function item_post(App $a) {
$a->internalRedirect($return_path);
}
exit();
} else {
$post_id = 0;
}
unset($datarray['edit']);
@ -924,11 +920,10 @@ function item_content(App $a)
* @throws ImagickException
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $network = "")
function handle_tag(&$body, &$inform, &$str_tags, $profile_uid, $tag, $network = "")
{
$replaced = false;
$r = null;
$tag_type = '@';
//is it a person tag?
if ((strpos($tag, '@') === 0) || (strpos($tag, '!') === 0)) {
@ -964,7 +959,6 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n
return $replaced;
}
$stat = false;
//get the person's name
$name = substr($tag, 1);

View file

@ -81,7 +81,6 @@ function lostpass_post(App $a)
function lostpass_content(App $a)
{
$o = '';
if ($a->argc > 1) {
$pwdreset_token = $a->argv[1];
@ -127,7 +126,6 @@ function lostpass_form()
function lostpass_generate_password($user)
{
$o = '';
$a = \get_app();
$new_password = User::generateNewPassword();
$result = User::updatePassword($user['uid'], $new_password);

View file

@ -185,7 +185,6 @@ function message_content(App $a)
);
if (DBA::isResult($r)) {
$parent = $r[0]['parent-uri'];
$convid = $r[0]['convid'];
if (DBA::delete('mail', ['parent-uri' => $parent, 'uid' => local_user()])) {
info(L10n::t('Conversation removed.') . EOL);
@ -230,7 +229,6 @@ function message_content(App $a)
if (DBA::isResult($r)) {
$prename = $r[0]['name'];
$preurl = $r[0]['url'];
$preid = $r[0]['id'];
$preselect = [$preid];
} else {

View file

@ -314,7 +314,7 @@ function networkSetSeen($condition)
$unseen = Item::exists($condition);
if ($unseen) {
$r = Item::update(['unseen' => false], $condition);
Item::update(['unseen' => false], $condition);
}
}
@ -407,12 +407,6 @@ function networkFlatView(App $a, $update = 0)
// Rawmode is used for fetching new content at the end of the page
$rawmode = (isset($_GET['mode']) && ($_GET['mode'] == 'raw'));
if (isset($_GET['last_id'])) {
$last_id = intval($_GET['last_id']);
} else {
$last_id = 0;
}
$o = '';
$file = defaults($_GET, 'file', '');
@ -449,8 +443,7 @@ function networkFlatView(App $a, $update = 0)
$pager = new Pager($a->query_string);
/// @TODO Figure out why this variable is unused
$pager_sql = networkPager($a, $pager, $update);
networkPager($a, $pager, $update);
if (strlen($file)) {
$condition = ["`term` = ? AND `otype` = ? AND `type` = ? AND `uid` = ?",
@ -621,7 +614,6 @@ function networkThreadedView(App $a, $update, $parent)
$sql_extra3 = '';
$sql_table = '`thread`';
$sql_parent = '`iid`';
$sql_order = '';
if ($update) {
$sql_table = '`item`';

View file

@ -17,13 +17,7 @@ function notes_init(App $a)
return;
}
$profile = 0;
$which = $a->user['nickname'];
Nav::setSelected('home');
//Profile::load($a, $which, $profile);
}

View file

@ -518,7 +518,6 @@ function photos_post(App $a)
$taginfo[] = [$newname, $profile, $salmon];
} else {
$newname = $name;
$alias = '';
$tagcid = 0;
if (strrpos($newname, '+')) {
@ -655,7 +654,7 @@ function photos_post(App $a)
. System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '</id>';
$arr['target'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '" />' . "\n" . '<link rel="preview" type="'.$photo['type'].'" href="' . System::baseUrl() . "/photo/" . $photo['resource-id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>';
$item_id = Item::insert($arr);
Item::insert($arr);
}
}
}

View file

@ -130,7 +130,6 @@ function profile_content(App $a, $update = 0)
$groups = [];
$remote_cid = null;
$tab = 'posts';
$o = '';
if ($update) {
@ -310,8 +309,7 @@ function profile_content(App $a, $update = 0)
if ($is_owner) {
$unseen = Item::exists(['wall' => true, 'unseen' => true, 'uid' => local_user()]);
if ($unseen) {
$r = Item::update(['unseen' => false],
['wall' => true, 'unseen' => true, 'uid' => local_user()]);
Item::update(['unseen' => false], ['wall' => true, 'unseen' => true, 'uid' => local_user()]);
}
}

View file

@ -109,11 +109,11 @@ function profile_photo_post(App $a)
// If setting for the default profile, unset the profile photo flag from any other photos I own
if ($is_default_profile) {
$r = q("UPDATE `photo` SET `profile` = 0 WHERE `profile` = 1 AND `resource-id` != '%s' AND `uid` = %d",
q("UPDATE `photo` SET `profile` = 0 WHERE `profile` = 1 AND `resource-id` != '%s' AND `uid` = %d",
DBA::escape($base_image['resource-id']), intval(local_user())
);
} else {
$r = q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d",
q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d",
DBA::escape(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-4.' . $Image->getExt()),
DBA::escape(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-5.' . $Image->getExt()),
intval($_REQUEST['profile']), intval(local_user())
@ -215,9 +215,9 @@ function profile_photo_content(App $a)
// set an already uloaded photo as profile photo
// if photo is in 'Profile Photos', change it in db
if (($r[0]['album'] == L10n::t('Profile Photos')) && ($havescale)) {
$r = q("UPDATE `photo` SET `profile`=0 WHERE `profile`=1 AND `uid`=%d", intval(local_user()));
q("UPDATE `photo` SET `profile`=0 WHERE `profile`=1 AND `uid`=%d", intval(local_user()));
$r = q("UPDATE `photo` SET `profile`=1 WHERE `uid` = %d AND `resource-id` = '%s'", intval(local_user()),
q("UPDATE `photo` SET `profile`=1 WHERE `uid` = %d AND `resource-id` = '%s'", intval(local_user()),
DBA::escape($resource_id)
);
@ -275,8 +275,6 @@ function profile_photo_content(App $a)
]);
return $o;
}
return; // NOTREACHED
}
function profile_photo_crop_ui_head(App $a, Image $image)

View file

@ -48,12 +48,12 @@ function profiles_init(App $a) {
// move every contact using this profile as their default to the user default
$r = q("UPDATE `contact` SET `profile-id` = (SELECT `profile`.`id` AS `profile-id` FROM `profile` WHERE `profile`.`is-default` = 1 AND `profile`.`uid` = %d LIMIT 1) WHERE `profile-id` = %d AND `uid` = %d ",
q("UPDATE `contact` SET `profile-id` = (SELECT `profile`.`id` AS `profile-id` FROM `profile` WHERE `profile`.`is-default` = 1 AND `profile`.`uid` = %d LIMIT 1) WHERE `profile-id` = %d AND `uid` = %d ",
intval(local_user()),
intval($a->argv[2]),
intval(local_user())
);
$r = q("DELETE FROM `profile` WHERE `id` = %d AND `uid` = %d",
q("DELETE FROM `profile` WHERE `id` = %d AND `uid` = %d",
intval($a->argv[2]),
intval(local_user())
);
@ -79,7 +79,7 @@ function profiles_init(App $a) {
$r1 = q("SELECT `name`, `photo`, `thumb` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
intval(local_user()));
$r2 = q("INSERT INTO `profile` (`uid` , `profile-name` , `name`, `photo`, `thumb`)
q("INSERT INTO `profile` (`uid` , `profile-name` , `name`, `photo`, `thumb`)
VALUES ( %d, '%s', '%s', '%s', '%s' )",
intval(local_user()),
DBA::escape($name),
@ -118,7 +118,6 @@ function profiles_init(App $a) {
if(! DBA::isResult($r1)) {
notice(L10n::t('Profile unavailable to clone.') . EOL);
exit();
return;
}
unset($r1[0]['id']);
$r1[0]['is-default'] = 0;
@ -151,7 +150,6 @@ function profiles_init(App $a) {
if (! DBA::isResult($r)) {
notice(L10n::t('Profile not found.') . EOL);
exit();
return;
}
Profile::load($a, $a->user['nickname'], $r[0]['id']);
@ -342,54 +340,42 @@ function profiles_post(App $a) {
PConfig::set(local_user(), 'system', 'detailled_profile', (($_POST['detailled_profile'] == 1) ? 1: 0));
$changes = [];
$value = '';
if ($is_default) {
if ($marital != $orig[0]['marital']) {
$changes[] = '[color=#ff0000]&hearts;[/color] ' . L10n::t('Marital Status');
$value = $marital;
}
if ($withchanged) {
$changes[] = '[color=#ff0000]&hearts;[/color] ' . L10n::t('Romantic Partner');
$value = strip_tags($with);
}
if ($likes != $orig[0]['likes']) {
$changes[] = L10n::t('Likes');
$value = $likes;
}
if ($dislikes != $orig[0]['dislikes']) {
$changes[] = L10n::t('Dislikes');
$value = $dislikes;
}
if ($work != $orig[0]['work']) {
$changes[] = L10n::t('Work/Employment');
}
if ($religion != $orig[0]['religion']) {
$changes[] = L10n::t('Religion');
$value = $religion;
}
if ($politic != $orig[0]['politic']) {
$changes[] = L10n::t('Political Views');
$value = $politic;
}
if ($gender != $orig[0]['gender']) {
$changes[] = L10n::t('Gender');
$value = $gender;
}
if ($sexual != $orig[0]['sexual']) {
$changes[] = L10n::t('Sexual Preference');
$value = $sexual;
}
if ($xmpp != $orig[0]['xmpp']) {
$changes[] = L10n::t('XMPP');
$value = $xmpp;
}
if ($homepage != $orig[0]['homepage']) {
$changes[] = L10n::t('Homepage');
$value = $homepage;
}
if ($interest != $orig[0]['interest']) {
$changes[] = L10n::t('Interests');
$value = $interest;
}
if ($address != $orig[0]['address']) {
$changes[] = L10n::t('Address');
@ -400,9 +386,6 @@ function profiles_post(App $a) {
if ($locality != $orig[0]['locality'] || $region != $orig[0]['region']
|| $country_name != $orig[0]['country-name']) {
$changes[] = L10n::t('Location');
$comma1 = ((($locality) && ($region || $country_name)) ? ', ' : ' ');
$comma2 = (($region && $country_name) ? ', ' : '');
$value = $locality . $comma1 . $region . $comma2 . $country_name;
}
}
@ -487,7 +470,7 @@ function profiles_post(App $a) {
if ($is_default) {
if ($namechanged) {
$r = q("UPDATE `user` set `username` = '%s' where `uid` = %d",
q("UPDATE `user` set `username` = '%s' where `uid` = %d",
DBA::escape($name),
intval(local_user())
);

View file

@ -36,7 +36,6 @@ function pubsub_init(App $a)
$hub_mode = Strings::escapeTags(trim(defaults($_GET, 'hub_mode', '')));
$hub_topic = Strings::escapeTags(trim(defaults($_GET, 'hub_topic', '')));
$hub_challenge = Strings::escapeTags(trim(defaults($_GET, 'hub_challenge', '')));
$hub_lease = Strings::escapeTags(trim(defaults($_GET, 'hub_lease_seconds', '')));
$hub_verify = Strings::escapeTags(trim(defaults($_GET, 'hub_verify_token', '')));
Logger::log('Subscription from ' . $_SERVER['REMOTE_ADDR'] . ' Mode: ' . $hub_mode . ' Nick: ' . $nick);

View file

@ -33,7 +33,6 @@ function pubsubhubbub_init(App $a) {
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$hub_mode = post_var('hub_mode');
$hub_callback = post_var('hub_callback');
$hub_verify = post_var('hub_verify');
$hub_verify_token = post_var('hub_verify_token');
$hub_secret = post_var('hub_secret');
$hub_topic = post_var('hub_topic');

View file

@ -22,9 +22,6 @@ function register_post(App $a)
{
BaseModule::checkFormSecurityTokenRedirectOnError('/register', 'register');
$verified = 0;
$blocked = 1;
$arr = ['post' => $_POST];
Hook::callAll('register_post', $arr);

View file

@ -57,7 +57,7 @@ function repair_ostatus_content(App $a) {
$o .= "<p>".L10n::t("Keep this window open until done.")."</p>";
$result = Contact::createFromProbe($uid, $r[0]["url"], true);
Contact::createFromProbe($uid, $r[0]["url"], true);
$a->page['htmlhead'] = '<meta http-equiv="refresh" content="1; URL='.System::baseUrl().'/repair_ostatus?counter='.$counter.'">';

View file

@ -23,7 +23,6 @@ function salmon_post(App $a, $xml = '') {
Logger::log('new salmon ' . $xml, Logger::DATA);
$nick = (($a->argc > 1) ? Strings::escapeTags(trim($a->argv[1])) : '');
$mentions = (($a->argc > 2 && $a->argv[2] === 'mention') ? true : false);
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
DBA::escape($nick)

View file

@ -367,7 +367,7 @@ function settings_post(App $a)
}
Theme::install($theme);
$r = q("UPDATE `user` SET `theme` = '%s' WHERE `uid` = %d",
q("UPDATE `user` SET `theme` = '%s' WHERE `uid` = %d",
DBA::escape($theme),
intval(local_user())
);
@ -484,8 +484,6 @@ function settings_post(App $a)
$page_flags = Contact::PAGE_COMMUNITY;
}
$email_changed = false;
$err = '';
if ($username != $a->user['username']) {
@ -498,7 +496,6 @@ function settings_post(App $a)
}
if ($email != $a->user['email']) {
$email_changed = true;
// check for the correct password
if (!User::authenticate(intval(local_user()), $_POST['mpassword'])) {
$err .= L10n::t('Wrong Password') . EOL;
@ -611,7 +608,7 @@ function settings_post(App $a)
// clear session language
unset($_SESSION['language']);
$r = q("UPDATE `profile`
q("UPDATE `profile`
SET `publish` = %d,
`name` = '%s',
`net-publish` = %d,

View file

@ -31,8 +31,6 @@ function videos_init(App $a)
Nav::setSelected('home');
$o = '';
if ($a->argc > 1) {
$nick = $a->argv[1];
$user = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1",
@ -163,19 +161,12 @@ function videos_content(App $a)
//
if ($a->argc > 3) {
$datatype = $a->argv[2];
$datum = $a->argv[3];
} elseif(($a->argc > 2) && ($a->argv[2] === 'upload')) {
$datatype = 'upload';
} else {
$datatype = 'summary';
}
if ($a->argc > 4) {
$cmd = $a->argv[4];
} else {
$cmd = 'view';
}
//
// Setup permissions structures
//
@ -209,7 +200,6 @@ function videos_content(App $a)
if (DBA::isResult($r)) {
$can_post = true;
$contact = $r[0];
$remote_contact = true;
$visitor = $contact_id;
}
@ -239,17 +229,11 @@ function videos_content(App $a)
);
if (DBA::isResult($r)) {
$contact = $r[0];
$remote_contact = true;
}
}
}
if (!$remote_contact && local_user()) {
$contact_id = $_SESSION['cid'];
$contact = $a->contact;
}
if ($a->data['user']['hidewall'] && (local_user() != $owner_uid) && (!$remote_contact)) {
notice(L10n::t('Access to this item is restricted.') . EOL);
return;

View file

@ -13,7 +13,6 @@ function view_init(App $a)
if ($a->argc == 4){
$theme = $a->argv[2];
$THEMEPATH = "view/theme/$theme";
if(file_exists("view/theme/$theme/style.php"))
require_once("view/theme/$theme/style.php");
}

View file

@ -38,11 +38,9 @@ function wall_attach_post(App $a) {
}
$can_post = false;
$visitor = 0;
$page_owner_uid = $r[0]['uid'];
$page_owner_cid = $r[0]['id'];
$page_owner_nick = $r[0]['nickname'];
$community_page = (($r[0]['page-flags'] == Contact::PAGE_COMMUNITY) ? true : false);
if ((local_user()) && (local_user() == $page_owner_uid)) {
@ -68,7 +66,6 @@ function wall_attach_post(App $a) {
if (DBA::isResult($r)) {
$can_post = true;
$visitor = $contact_id;
}
}
}

View file

@ -272,8 +272,6 @@ function wall_upload_post(App $a, $desktopmode = true)
}
}
$basename = basename($filename);
if (!$desktopmode) {
$r = q("SELECT `id`, `datasize`, `width`, `height`, `type` FROM `photo`
WHERE `resource-id` = '%s'

View file

@ -5,7 +5,6 @@
namespace Friendica\Worker;
use Friendica\BaseObject;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;