convert all network search params to get requests (no url path args)

This commit is contained in:
friendica 2012-07-23 17:35:58 -07:00
parent d8e79061d6
commit b0f1d03a8a
5 changed files with 36 additions and 36 deletions

View File

@ -12,7 +12,7 @@ require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica Red'); define ( 'FRIENDICA_PLATFORM', 'Friendica Red');
define ( 'FRIENDICA_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'FRIENDICA_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1153 ); define ( 'DB_UPDATE_VERSION', 1154 );
define ( 'EOL', "<br />\r\n" ); define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View File

@ -226,7 +226,7 @@ function group_side($every="contacts",$each="group",$edit = false, $group_id = 0
'cid' => $cid, 'cid' => $cid,
'text' => $rr['name'], 'text' => $rr['name'],
'selected' => $selected, 'selected' => $selected,
'href' => $each."/".$rr['id'], 'href' => (($each === 'network') ? $each.'?f=&gid='.$rr['id'] : $each."/".$rr['id']),
'edit' => $groupedit, 'edit' => $groupedit,
'ismember' => in_array($rr['id'],$member_of), 'ismember' => in_array($rr['id'],$member_of),
); );

View File

@ -111,7 +111,7 @@ function reload_plugins() {
if(! function_exists('register_hook')) { 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", $r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `function` = '%s' LIMIT 1",
dbesc($hook), dbesc($hook),
@ -121,10 +121,11 @@ function register_hook($hook,$file,$function) {
if(count($r)) if(count($r))
return true; 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($hook),
dbesc($file), dbesc($file),
dbesc($function) dbesc($function),
dbesc($priority)
); );
return $r; return $r;
}} }}
@ -145,7 +146,7 @@ if(! function_exists('load_hooks')) {
function load_hooks() { function load_hooks() {
$a = get_app(); $a = get_app();
$a->hooks = array(); $a->hooks = array();
$r = q("SELECT * FROM `hook` WHERE 1"); $r = q("SELECT * FROM `hook` WHERE 1 ORDER BY `priority` DESC");
if(count($r)) { if(count($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if(! array_key_exists($rr['hook'],$a->hooks)) if(! array_key_exists($rr['hook'],$a->hooks))

View File

@ -56,11 +56,11 @@ function network_init(&$a) {
$dest_url .= "/".$a->argv[1]; $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/group.php');
require_once('include/contact_widgets.php'); require_once('include/contact_widgets.php');
@ -194,9 +194,8 @@ function network_query_get_sel_tab($a) {
$spam_active = ''; $spam_active = '';
$postord_active = ''; $postord_active = '';
if(($a->argc > 1 && $a->argv[1] === 'new') if(x($_GET,'new')) {
|| ($a->argc > 2 && $a->argv[2] === 'new')) { $new_active = 'active';
$new_active = 'active';
} }
if(x($_GET,'search')) { if(x($_GET,'search')) {
@ -256,27 +255,20 @@ function network_content(&$a, $update = 0) {
$nouveau = false; $nouveau = false;
if($a->argc > 1) { $datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : '');
for($x = 1; $x < $a->argc; $x ++) { $datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : '');
if(is_a_date_arg($a->argv[$x])) { $nouveau = ((x($_GET,'new')) ? intval($_GET['new']) : 0);
if($datequery) $gid = ((x($_GET,'gid')) ? intval($_GET['gid']) : 0);
$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 . '>');
}
}
}
if($datequery)
$_GET['order'] = 'post';
if($gid) {
$group = $gid;
$def_acl = array('allow_gid' => '<' . $group . '>');
}
$o = ''; $o = '';
// item filter tabs // item filter tabs
@ -295,32 +287,32 @@ function network_content(&$a, $update = 0) {
$tabs = array( $tabs = array(
array( array(
'label' => t('Commented Order'), '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, 'sel'=>$all_active,
'title'=> t('Sort by Comment Date'), 'title'=> t('Sort by Comment Date'),
), ),
array( array(
'label' => t('Posted Order'), '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, 'sel'=>$postord_active,
'title' => t('Sort by Post Date'), 'title' => t('Sort by Post Date'),
), ),
array( array(
'label' => t('Personal'), '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, 'sel' => $conv_active,
'title' => t('Posts that mention or involve you'), 'title' => t('Posts that mention or involve you'),
), ),
array( array(
'label' => t('New'), '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, 'sel' => $new_active,
'title' => t('Activity Stream - by date'), 'title' => t('Activity Stream - by date'),
), ),
array( array(
'label' => t('Starred'), '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, 'sel'=>$starred_active,
'title' => t('Favourite Posts'), 'title' => t('Favourite Posts'),
), ),

View File

@ -1,6 +1,6 @@
<?php <?php
define( 'UPDATE_VERSION' , 1153 ); define( 'UPDATE_VERSION' , 1154 );
/** /**
* *
@ -1337,3 +1337,10 @@ function update_1152() {
return UPDATE_SUCCESS; return UPDATE_SUCCESS;
} }
function update_1153() {
$r = q("ALTER TABLE `hook` ADD `priority` INT(11) UNSIGNED NOT NULL DEFAULT '0'");
if(!$r) return UPDATE_FAILED;
return UPDATE_SUCCESS;
}