From b0f1d03a8ad51769c347a2056ce872972380d48f Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 23 Jul 2012 17:35:58 -0700 Subject: convert all network search params to get requests (no url path args) --- boot.php | 2 +- include/group.php | 2 +- include/plugin.php | 9 +++++---- mod/network.php | 50 +++++++++++++++++++++----------------------------- update.php | 9 ++++++++- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/boot.php b/boot.php index f8966e8fe..ac5ce2461 100644 --- a/boot.php +++ b/boot.php @@ -12,7 +12,7 @@ require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica Red'); define ( 'FRIENDICA_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); -define ( 'DB_UPDATE_VERSION', 1153 ); +define ( 'DB_UPDATE_VERSION', 1154 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/include/group.php b/include/group.php index 1071f5c78..8aaeb513f 100644 --- a/include/group.php +++ b/include/group.php @@ -226,7 +226,7 @@ function group_side($every="contacts",$each="group",$edit = false, $group_id = 0 'cid' => $cid, 'text' => $rr['name'], 'selected' => $selected, - 'href' => $each."/".$rr['id'], + 'href' => (($each === 'network') ? $each.'?f=&gid='.$rr['id'] : $each."/".$rr['id']), 'edit' => $groupedit, 'ismember' => in_array($rr['id'],$member_of), ); diff --git a/include/plugin.php b/include/plugin.php index ffa562273..f60a7d296 100644 --- a/include/plugin.php +++ b/include/plugin.php @@ -111,7 +111,7 @@ function reload_plugins() { if(! function_exists('register_hook')) { -function register_hook($hook,$file,$function) { +function register_hook($hook,$file,$function,$priority=0) { $r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `function` = '%s' LIMIT 1", dbesc($hook), @@ -121,10 +121,11 @@ function register_hook($hook,$file,$function) { if(count($r)) return true; - $r = q("INSERT INTO `hook` (`hook`, `file`, `function`) VALUES ( '%s', '%s', '%s' ) ", + $r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`) VALUES ( '%s', '%s', '%s', '%s' ) ", dbesc($hook), dbesc($file), - dbesc($function) + dbesc($function), + dbesc($priority) ); return $r; }} @@ -145,7 +146,7 @@ if(! function_exists('load_hooks')) { function load_hooks() { $a = get_app(); $a->hooks = array(); - $r = q("SELECT * FROM `hook` WHERE 1"); + $r = q("SELECT * FROM `hook` WHERE 1 ORDER BY `priority` DESC"); if(count($r)) { foreach($r as $rr) { if(! array_key_exists($rr['hook'],$a->hooks)) diff --git a/mod/network.php b/mod/network.php index 6b92d9b85..85f76b0b0 100644 --- a/mod/network.php +++ b/mod/network.php @@ -56,11 +56,11 @@ function network_init(&$a) { $dest_url .= "/".$a->argv[1]; } - goaway($a->get_baseurl() . $dest_url."?".$dest_qs); +// goaway($a->get_baseurl() . $dest_url."?".$dest_qs); } } - $group_id = (($a->argc > 1 && intval($a->argv[1])) ? intval($a->argv[1]) : 0); + $group_id = ((x($_GET,'gid')) ? intval($_GET['gid']) : 0); require_once('include/group.php'); require_once('include/contact_widgets.php'); @@ -194,9 +194,8 @@ function network_query_get_sel_tab($a) { $spam_active = ''; $postord_active = ''; - if(($a->argc > 1 && $a->argv[1] === 'new') - || ($a->argc > 2 && $a->argv[2] === 'new')) { - $new_active = 'active'; + if(x($_GET,'new')) { + $new_active = 'active'; } if(x($_GET,'search')) { @@ -256,26 +255,19 @@ function network_content(&$a, $update = 0) { $nouveau = false; - if($a->argc > 1) { - for($x = 1; $x < $a->argc; $x ++) { - if(is_a_date_arg($a->argv[$x])) { - if($datequery) - $datequery2 = escape_tags($a->argv[$x]); - else { - $datequery = escape_tags($a->argv[$x]); - $_GET['order'] = 'post'; - } - } - elseif($a->argv[$x] === 'new') { - $nouveau = true; - } - elseif(intval($a->argv[$x])) { - $group = intval($a->argv[$x]); - $def_acl = array('allow_gid' => '<' . $group . '>'); - } - } - } + $datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : ''); + $datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : ''); + $nouveau = ((x($_GET,'new')) ? intval($_GET['new']) : 0); + $gid = ((x($_GET,'gid')) ? intval($_GET['gid']) : 0); + + if($datequery) + $_GET['order'] = 'post'; + + if($gid) { + $group = $gid; + $def_acl = array('allow_gid' => '<' . $group . '>'); + } $o = ''; @@ -295,32 +287,32 @@ function network_content(&$a, $update = 0) { $tabs = array( array( 'label' => t('Commented Order'), - 'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), + 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), 'sel'=>$all_active, 'title'=> t('Sort by Comment Date'), ), array( 'label' => t('Posted Order'), - 'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), + 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), 'sel'=>$postord_active, 'title' => t('Sort by Post Date'), ), array( 'label' => t('Personal'), - 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&conv=1', + 'url' => $a->get_baseurl(true) . '/' . $cmd . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&conv=1', 'sel' => $conv_active, 'title' => t('Posts that mention or involve you'), ), array( 'label' => t('New'), - 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ($len_naked_cmd ? '/' : '') . 'new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''), + 'url' => $a->get_baseurl(true) . '/' . $cmd . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&new=1', 'sel' => $new_active, 'title' => t('Activity Stream - by date'), ), array( 'label' => t('Starred'), - 'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&star=1', + 'url'=>$a->get_baseurl(true) . '/' . $cmd . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&star=1', 'sel'=>$starred_active, 'title' => t('Favourite Posts'), ), diff --git a/update.php b/update.php index d752eaa6d..9442f825b 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@