From dbc6eb5422b81c95d6e1eea63c8ace794ccd2039 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 7 Jan 2019 01:23:49 -0500 Subject: [PATCH] Remove unused code in mod/ - Remove commented code - Remove unused/immediately overwritten variables - Remove extraneous parameters - Remove unreachable code --- mod/allfriends.php | 2 -- mod/api.php | 4 +--- mod/delegate.php | 2 +- mod/dfrn_notify.php | 1 - mod/dfrn_poll.php | 6 +----- mod/dfrn_request.php | 11 +++-------- mod/directory.php | 1 - mod/display.php | 4 ---- mod/editpost.php | 21 +-------------------- mod/events.php | 23 ++++------------------- mod/fbrowser.php | 12 +++--------- mod/fsuggest.php | 2 +- mod/home.php | 3 --- mod/hovercard.php | 1 - mod/item.php | 10 ++-------- mod/lostpass.php | 2 -- mod/message.php | 2 -- mod/network.php | 12 ++---------- mod/notes.php | 6 ------ mod/photos.php | 3 +-- mod/profile.php | 4 +--- mod/profile_photo.php | 10 ++++------ mod/profiles.php | 25 ++++--------------------- mod/pubsub.php | 1 - mod/pubsubhubbub.php | 1 - mod/register.php | 3 --- mod/repair_ostatus.php | 2 +- mod/salmon.php | 1 - mod/settings.php | 7 ++----- mod/videos.php | 16 ---------------- mod/view.php | 1 - mod/wall_attach.php | 3 --- mod/wall_upload.php | 2 -- src/Worker/PubSubPublish.php | 1 - 34 files changed, 32 insertions(+), 173 deletions(-) diff --git a/mod/allfriends.php b/mod/allfriends.php index 5234ee8c69..ce648cc25a 100644 --- a/mod/allfriends.php +++ b/mod/allfriends.php @@ -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 diff --git a/mod/api.php b/mod/api.php index 466bd7b34d..4a1db1be55 100644 --- a/mod/api.php +++ b/mod/api.php @@ -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']; diff --git a/mod/delegate.php b/mod/delegate.php index b373c20402..4560784515 100644 --- a/mod/delegate.php +++ b/mod/delegate.php @@ -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) diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index c675258107..41b7684ac6 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -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 = ""; diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index 928690060f..5b72c0bf94 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -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), diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index 7b446b5ead..7c76af1b6a 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -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. } diff --git a/mod/directory.php b/mod/directory.php index 0a37c1dc04..c32cf5dbb8 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -112,7 +112,6 @@ function directory_content(App $a) } while ($rr = DBA::fetch($r)) { - $itemurl= ''; $itemurl = (($rr['addr'] != "") ? $rr['addr'] : $rr['profile_url']); diff --git a/mod/display.php b/mod/display.php index dc43e08d34..3922c83f35 100644 --- a/mod/display.php +++ b/mod/display.php @@ -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]; diff --git a/mod/editpost.php b/mod/editpost.php index bf103cf23c..c1c0d16d7f 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -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"); diff --git a/mod/events.php b/mod/events.php index 60fa039221..008cf643ce 100644 --- a/mod/events.php +++ b/mod/events.php @@ -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:') . ' *', '$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', diff --git a/mod/fbrowser.php b/mod/fbrowser.php index 3401359052..d302383157 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -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']; diff --git a/mod/fsuggest.php b/mod/fsuggest.php index 2195f455af..e84a42734c 100644 --- a/mod/fsuggest.php +++ b/mod/fsuggest.php @@ -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), diff --git a/mod/home.php b/mod/home.php index 8e53c24f3d..34f6d43683 100644 --- a/mod/home.php +++ b/mod/home.php @@ -61,7 +61,4 @@ function home_content(App $a) { '$login' => $login, '$content' => $content ]); - - return $o; - }} diff --git a/mod/hovercard.php b/mod/hovercard.php index f71977f074..047502fc34 100644 --- a/mod/hovercard.php +++ b/mod/hovercard.php @@ -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]); diff --git a/mod/item.php b/mod/item.php index 576ad09d6d..6276ba4d1e 100644 --- a/mod/item.php +++ b/mod/item.php @@ -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); diff --git a/mod/lostpass.php b/mod/lostpass.php index cb2dd3ca3c..548cea185c 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -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); diff --git a/mod/message.php b/mod/message.php index 3f1ec6a2e6..3ff84a1e66 100644 --- a/mod/message.php +++ b/mod/message.php @@ -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 { diff --git a/mod/network.php b/mod/network.php index a71447e5e5..e05f9814a0 100644 --- a/mod/network.php +++ b/mod/network.php @@ -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`'; diff --git a/mod/notes.php b/mod/notes.php index 6ecc819240..fdb12d6cc5 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -17,13 +17,7 @@ function notes_init(App $a) return; } - $profile = 0; - - $which = $a->user['nickname']; - Nav::setSelected('home'); - - //Profile::load($a, $which, $profile); } diff --git a/mod/photos.php b/mod/photos.php index 3a92774654..31b026f899 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -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'] . ''; $arr['target'] .= '' . XML::escape('' . "\n" . '') . ''; - $item_id = Item::insert($arr); + Item::insert($arr); } } } diff --git a/mod/profile.php b/mod/profile.php index 858748bb82..8a21e24dc1 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -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()]); } } diff --git a/mod/profile_photo.php b/mod/profile_photo.php index b802050b63..a0faa40cf5 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -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) diff --git a/mod/profiles.php b/mod/profiles.php index 74a3d91f07..b56a7911d3 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -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]♥[/color] ' . L10n::t('Marital Status'); - $value = $marital; } if ($withchanged) { $changes[] = '[color=#ff0000]♥[/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()) ); diff --git a/mod/pubsub.php b/mod/pubsub.php index 9b5bf1209e..c5744f399b 100644 --- a/mod/pubsub.php +++ b/mod/pubsub.php @@ -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); diff --git a/mod/pubsubhubbub.php b/mod/pubsubhubbub.php index 843406fe6f..342facd107 100644 --- a/mod/pubsubhubbub.php +++ b/mod/pubsubhubbub.php @@ -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'); diff --git a/mod/register.php b/mod/register.php index 0125ae417e..e69315a33a 100644 --- a/mod/register.php +++ b/mod/register.php @@ -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); diff --git a/mod/repair_ostatus.php b/mod/repair_ostatus.php index 5a6afd9fb4..51a6aadaad 100644 --- a/mod/repair_ostatus.php +++ b/mod/repair_ostatus.php @@ -57,7 +57,7 @@ function repair_ostatus_content(App $a) { $o .= "

".L10n::t("Keep this window open until done.")."

"; - $result = Contact::createFromProbe($uid, $r[0]["url"], true); + Contact::createFromProbe($uid, $r[0]["url"], true); $a->page['htmlhead'] = ''; diff --git a/mod/salmon.php b/mod/salmon.php index eef2510762..536a4516ce 100644 --- a/mod/salmon.php +++ b/mod/salmon.php @@ -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) diff --git a/mod/settings.php b/mod/settings.php index 14c0cc64d7..567270c6ea 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -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, diff --git a/mod/videos.php b/mod/videos.php index 408e2acaa6..df0fb23756 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -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; diff --git a/mod/view.php b/mod/view.php index 640606bce1..c59eea2982 100644 --- a/mod/view.php +++ b/mod/view.php @@ -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"); } diff --git a/mod/wall_attach.php b/mod/wall_attach.php index 40f82eef91..fb665ac2fa 100644 --- a/mod/wall_attach.php +++ b/mod/wall_attach.php @@ -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; } } } diff --git a/mod/wall_upload.php b/mod/wall_upload.php index d1fb918bfe..ea06b1d1c1 100644 --- a/mod/wall_upload.php +++ b/mod/wall_upload.php @@ -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' diff --git a/src/Worker/PubSubPublish.php b/src/Worker/PubSubPublish.php index 1fb1969310..b6061f8199 100644 --- a/src/Worker/PubSubPublish.php +++ b/src/Worker/PubSubPublish.php @@ -5,7 +5,6 @@ namespace Friendica\Worker; -use Friendica\BaseObject; use Friendica\Core\Logger; use Friendica\Core\System; use Friendica\Database\DBA;