From 13f2734f42b88a477fa1aa3f8ac0cf6b2bd9c903 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 21 Oct 2018 02:53:07 -0400 Subject: [PATCH 1/6] [advancedcontentfilter] Move NULL_DATE to DBA::NULL_DATETIME --- advancedcontentfilter/advancedcontentfilter.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/advancedcontentfilter/advancedcontentfilter.php b/advancedcontentfilter/advancedcontentfilter.php index ce5da9c3..3f036488 100644 --- a/advancedcontentfilter/advancedcontentfilter.php +++ b/advancedcontentfilter/advancedcontentfilter.php @@ -39,7 +39,6 @@ use Friendica\Content\Text\Markdown; use Friendica\Core\Addon; use Friendica\Core\Cache; use Friendica\Core\L10n; -use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Database\DBStructure; use Friendica\Model\Item; @@ -47,7 +46,6 @@ use Friendica\Model\Term; use Friendica\Module\Login; use Friendica\Network\HTTPException; use Friendica\Util\DateTimeFormat; -use Friendica\Util\Security; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Symfony\Component\ExpressionLanguage; @@ -91,7 +89,7 @@ function advancedcontentfilter_dbstructure_definition(App $a, &$database) "expression" => ["type" => "mediumtext" , "not null" => "1", "comment" => "Expression text"], "serialized" => ["type" => "mediumtext" , "not null" => "1", "comment" => "Serialized parsed expression"], "active" => ["type" => "boolean" , "not null" => "1", "default" => "1", "comment" => "Whether the rule is active or not"], - "created" => ["type" => "datetime" , "not null" => "1", "default" => NULL_DATE, "comment" => "Creation date"], + "created" => ["type" => "datetime" , "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Creation date"], ], "indexes" => [ "PRIMARY" => ["id"], From 6c9788aa0496c815444c0ad822a88c57d445cd08 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 21 Oct 2018 02:54:09 -0400 Subject: [PATCH 2/6] [public_server] Move NULL_DATE to DBA::NUL_DATETIME - Remove useless DBA::escape when used with database constant --- public_server/public_server.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/public_server/public_server.php b/public_server/public_server.php index 4d552951..2b36f3f6 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -6,13 +6,13 @@ * Author: Keith Fernie */ +use Friendica\App; use Friendica\BaseModule; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Database\DBA; use Friendica\Util\DateTimeFormat; -use Friendica\Util\Security; function public_server_install() { @@ -32,7 +32,7 @@ function public_server_uninstall() Addon::unregisterHook('logged_in', 'addon/public_server/public_server.php', 'public_server_login'); } -function public_server_load_config(\Friendica\App $a) +function public_server_load_config(App $a) { $a->loadConfigFile(__DIR__. '/config/public_server.ini.php'); } @@ -59,7 +59,7 @@ function public_server_cron($a, $b) $r = q("SELECT * FROM `user` WHERE `account_expires_on` < UTC_TIMESTAMP() + INTERVAL 5 DAY AND `account_expires_on` > '%s' AND `expire_notification_sent` <= '%s'", - DBA::escape(NULL_DATE), DBA::escape(NULL_DATE)); + DBA::NULL_DATETIME, DBA::NULL_DATETIME); if (DBA::isResult($r)) { foreach ($r as $rr) { @@ -83,7 +83,7 @@ function public_server_cron($a, $b) $nologin = Config::get('public_server', 'nologin', false); if ($nologin) { $r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND `login_date` <= '%s' AND `register_date` < UTC_TIMESTAMP() - INTERVAL %d DAY AND `account_expires_on` <= '%s'", - DBA::escape(NULL_DATE), intval($nologin), DBA::escape(NULL_DATE)); + DBA::NULL_DATETIME, intval($nologin), DBA::NULL_DATETIME); if (DBA::isResult($r)) { foreach ($r as $rr) { $fields = ['account_expires_on' => DateTimeFormat::utc('now +6 days')]; @@ -95,7 +95,7 @@ function public_server_cron($a, $b) $flagusers = Config::get('public_server', 'flagusers', false); if ($flagusers) { $r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND `login_date` < UTC_TIMESTAMP() - INTERVAL %d DAY AND `account_expires_on` <= '%s' AND `page-flags` = 0", - intval($flagusers), DBA::escape(NULL_DATE)); + intval($flagusers), DBA::NULL_DATETIME); if (DBA::isResult($r)) { foreach ($r as $rr) { $fields = ['account_expires_on' => DateTimeFormat::utc('now +6 days')]; @@ -108,7 +108,7 @@ function public_server_cron($a, $b) $flagpostsexpire = Config::get('public_server', 'flagpostsexpire'); if ($flagposts && $flagpostsexpire) { $r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND `login_date` < UTC_TIMESTAMP() - INTERVAL %d DAY AND `account_expires_on` <= '%s' and `expire` = 0 AND `page-flags` = 0", - intval($flagposts), DBA::escape(NULL_DATE)); + intval($flagposts), DBA::NULL_DATETIME); if (DBA::isResult($r)) { foreach ($r as $rr) { DBA::update('user', ['expire' => $flagpostsexpire], ['uid' => $rr['uid']]); @@ -138,7 +138,7 @@ function public_server_login($a, $b) } $fields = ['account_expires_on' => DateTimeFormat::utc('now +' . $days . ' days')]; - $condition = ["`uid` = ? AND `account_expires_on` > ?", local_user(), NULL_DATE]; + $condition = ["`uid` = ? AND `account_expires_on` > ?", local_user(), DBA::NULL_DATETIME]; DBA::update('user', $fields, $condition); } From b9c39e50b3587520565e76781cb111cf33aa423a Mon Sep 17 00:00:00 2001 From: Vinzenz Vietzke Date: Tue, 23 Oct 2018 16:38:01 +0200 Subject: [PATCH 3/6] resize images to 300px for frio compliance --- catavatar/catavatar.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/catavatar/catavatar.php b/catavatar/catavatar.php index 27e48b7a..b321ae33 100644 --- a/catavatar/catavatar.php +++ b/catavatar/catavatar.php @@ -141,7 +141,7 @@ function catavatar_lookup(App $a, &$b) $url = $a->getBaseURL() . '/catavatar/' . $user['uid']; switch($b['size']) { - case 175: $url .= "/4"; break; + case 300: $url .= "/4"; break; case 80: $url .= "/5"; break; case 47: $url .= "/6"; break; } @@ -245,7 +245,7 @@ function build_cat($seed = '', $size = 0) if ($size > 3 && $size < 7) { switch ($size) { case 4: - $size = 175; + $size = 300; break; case 5: $size = 80; From 6f421a74c68449afbe0007f4b9f400fb0932b0a8 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 24 Oct 2018 02:38:54 -0400 Subject: [PATCH 4/6] [forumdirectory] Use Content\Pager instead of App->pager --- forumdirectory/forumdirectory.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index 0c2aa265..a5d27d4b 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -8,6 +8,7 @@ use Friendica\App; use Friendica\Content\Nav; +use Friendica\Content\Pager; use Friendica\Content\Widget; use Friendica\Core\Addon; use Friendica\Core\Config; @@ -45,8 +46,6 @@ function forumdirectory_init(App $a) { $a->page['htmlhead'] .= ''; - $a->set_pager_itemspage(60); - if (local_user()) { $a->page['aside'] .= Widget::findPeople(); } else { @@ -107,19 +106,22 @@ function forumdirectory_content(App $a) $publish = Config::get('system', 'publish_all') ? '' : " AND `publish` = 1 "; + $total = 0; $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`" . " WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `page-flags` = 2 $sql_extra "); if (DBA::isResult($r)) { - $a->set_pager_total($r[0]['total']); + $total = $r[0]['total']; } + $pager = new Pager($a->query_string, $total, 60); + $order = " ORDER BY `name` ASC "; $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` , `user`.`page-flags`" . " FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish" . " AND `user`.`blocked` = 0 AND `page-flags` = 2 $sql_extra $order LIMIT %d , %d ", - intval($a->pager['start']), - intval($a->pager['itemspage']) + $pager->getStart(), + $pager->getItemsPerPage() ); if (DBA::isResult($r)) { @@ -208,7 +210,7 @@ function forumdirectory_content(App $a) } $o .= "
\r\n"; - $o .= paginate($a); + $o .= $pager->renderFull(); } else { info(L10n::t("No entries \x28some entries may be hidden\x29.") . EOL); } From d197bf4c2b6889c9e52feb720a7abd6d8c5d3017 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Wed, 24 Oct 2018 20:09:36 +0200 Subject: [PATCH 5/6] Bugfix - Replacing goaway() --- blackout/blackout.php | 2 +- impressum/impressum.php | 2 +- notifyall/notifyall.php | 2 +- startpage/startpage.php | 2 +- statusnet/statusnet.php | 6 +++--- twitter/twitter.php | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/blackout/blackout.php b/blackout/blackout.php index 28e5567f..9b2d5b62 100644 --- a/blackout/blackout.php +++ b/blackout/blackout.php @@ -85,7 +85,7 @@ function blackout_redirect ($a, $b) { } if (( $date1 <= $now ) && ( $now <= $date2 )) { logger('redirecting user to blackout page'); - goaway($myurl); + System::externalRedirect($myurl); } } diff --git a/impressum/impressum.php b/impressum/impressum.php index 74d87180..90775116 100644 --- a/impressum/impressum.php +++ b/impressum/impressum.php @@ -31,7 +31,7 @@ function impressum_module() { } function impressum_content() { $a = get_app(); - goaway('friendica/'); + $a->internalRedirect('friendica/'); } function obfuscate_email ($s) { diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index 824e306b..852972c3 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -93,7 +93,7 @@ function notifyall_post(App $a) } notice(L10n::t('Emails sent')); - goaway('admin'); + $a->internalRedirect('admin'); } function notifyall_content(&$a) diff --git a/startpage/startpage.php b/startpage/startpage.php index 14b8abbb..b955161b 100644 --- a/startpage/startpage.php +++ b/startpage/startpage.php @@ -31,7 +31,7 @@ function startpage_home_init($a, $b) $page = PConfig::get(local_user(), 'startpage', 'startpage'); if (strlen($page)) { - goaway($page); + $a->internalRedirect($page); } return; } diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 42c31d75..6cdc2372 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -160,7 +160,7 @@ function statusnet_settings_post(App $a, $post) } } } - goaway('settings/connectors'); + $a->internalRedirect('settings/connectors'); } else { if (isset($_POST['statusnet-consumersecret'])) { // check if we can reach the API of the GNU Social server @@ -188,7 +188,7 @@ function statusnet_settings_post(App $a, $post) notice(L10n::t('We could not contact the GNU Social API with the Path you entered.') . EOL); } } - goaway('settings/connectors'); + $a->internalRedirect('settings/connectors'); } else { if (isset($_POST['statusnet-pin'])) { // if the user supplied us with a PIN from GNU Social, let the magic of OAuth happen @@ -206,7 +206,7 @@ function statusnet_settings_post(App $a, $post) PConfig::set(local_user(), 'statusnet', 'post', 1); PConfig::set(local_user(), 'statusnet', 'post_taglinks', 1); // reload the Addon Settings page, if we don't do it see Bug #42 - goaway('settings/connectors'); + $a->internalRedirect('settings/connectors'); } else { // if no PIN is supplied in the POST variables, the user has changed the setting // to post a dent for every new __public__ posting to the wall diff --git a/twitter/twitter.php b/twitter/twitter.php index d3440d53..597278ca 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -258,7 +258,7 @@ function twitter_settings_post(App $a) info($e->getMessage()); } // reload the Addon Settings page, if we don't do it see Bug #42 - goaway('settings/connectors'); + $a->internalRedirect('settings/connectors'); } else { // if no PIN is supplied in the POST variables, the user has changed the setting // to post a tweet for every new __public__ posting to the wall From d4340af4fc30e0d5c14d59d068517d04b856c73f Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 24 Oct 2018 20:18:22 -0400 Subject: [PATCH 6/6] [forumdirectory] Use new Pager constructor and renderFull signatures --- forumdirectory/forumdirectory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index a5d27d4b..54818cdb 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -113,7 +113,7 @@ function forumdirectory_content(App $a) $total = $r[0]['total']; } - $pager = new Pager($a->query_string, $total, 60); + $pager = new Pager($a->query_string, 60); $order = " ORDER BY `name` ASC "; @@ -210,7 +210,7 @@ function forumdirectory_content(App $a) } $o .= "
\r\n"; - $o .= $pager->renderFull(); + $o .= $pager->renderFull($total); } else { info(L10n::t("No entries \x28some entries may be hidden\x29.") . EOL); }