From: <se...@us...> - 2010-01-07 15:35:16
|
Revision: 24191 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=24191&view=rev Author: sept_7 Date: 2010-01-07 15:35:07 +0000 (Thu, 07 Jan 2010) Log Message: ----------- [FIX] fix tab browsing with agressive filtering. Marc please test ! ;p Modified Paths: -------------- trunk/lib/setup/cookies.php trunk/templates/tiki-edit_perspective.tpl trunk/tiki-edit_perspective.php trunk/tiki-filter-base.php Modified: trunk/lib/setup/cookies.php =================================================================== --- trunk/lib/setup/cookies.php 2010-01-07 15:29:13 UTC (rev 24190) +++ trunk/lib/setup/cookies.php 2010-01-07 15:35:07 UTC (rev 24191) @@ -56,9 +56,8 @@ global $cookietab; if ($prefs['feature_tabs'] == 'y') { if( isset($_REQUEST['cookietab'])) { - $smarty->assign('cookietab',$_REQUEST['cookietab']); $cookietab = $_REQUEST['cookietab']; - } else if (count($_POST) > 0 and preg_replace(array('/\?.*$/','/^http.?:\/\//'),'',$_SERVER['HTTP_REFERER']) == preg_replace('/\?.*$/','',$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']) && isset($_COOKIE['tab'])) { + } elseif (count($_POST) > 0 and preg_replace(array('/\?.*$/','/^http.?:\/\//'),'',$_SERVER['HTTP_REFERER']) == preg_replace('/\?.*$/','',$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']) && isset($_COOKIE['tab'])) { // AJAX call (probably) and same URI, reset cookietab if changed "page" if ($prefs['feature_ajax'] == 'y' && isset($_POST['xjxfun'])) { if (isset($_COOKIE['tab_last_query']) && $_COOKIE['tab_last_query'] != $_SERVER['QUERY_STRING']) { @@ -67,17 +66,15 @@ } setcookie('tab_last_query', $_SERVER['QUERY_STRING']); } - $smarty->assign('cookietab',$_COOKIE['tab']); $cookietab = $_COOKIE['tab']; - } else if (isset($_SERVER['HTTP_REFERER']) && preg_replace(array('/\?.*$/','/^http.?:\/\//'),'',$_SERVER['HTTP_REFERER']) == preg_replace('/\?.*$/','',$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']) && isset($_COOKIE['tab'])) { + } elseif (isset($_SERVER['HTTP_REFERER']) && preg_replace(array('/\?.*$/','/^http.?:\/\//'),'',$_SERVER['HTTP_REFERER']) == preg_replace('/\?.*$/','',$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']) && isset($_COOKIE['tab'])) { preg_match('/[\?\&]page=([^\&]*)/', $_SERVER['REQUEST_URI'], $q_match); // TODO replace with better way to get a param? preg_match('/[\?\&]page=([^\&]*)/', $_SERVER['HTTP_REFERER'], $ref_match); if ($q_match == $ref_match) { // for admin includes when staying on same panel - $smarty->assign('cookietab',$_COOKIE['tab']); $cookietab = $_COOKIE['tab']; } } else { - $smarty->assign('cookietab',1); $cookietab = '1'; } + $smarty->assign('cookietab',$cookietab); } Modified: trunk/templates/tiki-edit_perspective.tpl =================================================================== --- trunk/templates/tiki-edit_perspective.tpl 2010-01-07 15:29:13 UTC (rev 24190) +++ trunk/templates/tiki-edit_perspective.tpl 2010-01-07 15:35:07 UTC (rev 24191) @@ -13,7 +13,7 @@ <td> <a href="tiki-switch_perspective.php?perspective={$persp.perspectiveId|escape:url}">{icon _id=arrow_right}</a> {if $persp.can_edit} - {self_link action=edit id=$persp.perspectiveId cookietab=3}{icon _id=page_edit}{/self_link} + {self_link _icon=page_edit action=edit _ajax='y' id=$persp.perspectiveId cookietab=3}{tr}edit{/tr}{/self_link} {/if} {if $persp.can_remove} {self_link action=remove id=$persp.perspectiveId}{icon _id=cross}{/self_link} Modified: trunk/tiki-edit_perspective.php =================================================================== --- trunk/tiki-edit_perspective.php 2010-01-07 15:29:13 UTC (rev 24190) +++ trunk/tiki-edit_perspective.php 2010-01-07 15:35:07 UTC (rev 24191) @@ -21,9 +21,10 @@ ) ); $auto_query_args = array( 'offset', 'id', 'cookietab' ); +$section='admin'; -require_once 'tiki-setup.php'; -require_once 'lib/perspectivelib.php'; +require_once('tiki-setup.php'); +require_once('lib/perspectivelib.php'); $access->check_feature( array('feature_perspective', 'feature_jquery_ui') ); Modified: trunk/tiki-filter-base.php =================================================================== --- trunk/tiki-filter-base.php 2010-01-07 15:29:13 UTC (rev 24190) +++ trunk/tiki-filter-base.php 2010-01-07 15:35:07 UTC (rev 24191) @@ -70,6 +70,19 @@ if ( substr($tikiroot,-1,1) != '/' ) $tikiroot .= '/'; if ( substr($tikipath,-1,1) != '/' ) $tikipath .= '/'; +// Add global filter for xajax and cookie +global $inputConfiguration; +array_unshift($inputConfiguration,array( + 'staticKeyFilters' => array( + 'cookietab' => 'int', + 'xjxfun' => 'striptags', + 'xjxr' => 'int' + ), + 'staticKeyFiltersForArrays' => array( + 'xjxargs' => 'striptags', + ) +)); + require_once('lib/init/initlib.php'); TikiInit::prependIncludePath($tikipath.'lib/pear'); TikiInit::appendIncludePath($tikipath.'lib/core/lib'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |