Skip to content

Commit

Permalink
Deprecates expHistory:flowSet in favor of expHistory:set since the fl…
Browse files Browse the repository at this point in the history
…ow stuff was not being used and fell through to a generic expHistory::set call always setting them as 'viewable' history entries [#355 ]
  • Loading branch information
dleffler committed Oct 19, 2011
1 parent 11d042b commit 46ec44b
Show file tree
Hide file tree
Showing 26 changed files with 91 additions and 54 deletions.
2 changes: 1 addition & 1 deletion exponent.php
Expand Up @@ -58,7 +58,7 @@

// Initialize the History (Flow) subsystem.
$history = new expHistory(); //<--This is the new flow subsystem
$SYS_FLOW_REDIRECTIONPATH = 'exponent_default';
//$SYS_FLOW_REDIRECTIONPATH = 'exponent_default';

// Initialize the javascript subsystem
if (expJavascript::inAjaxAction()) set_error_handler('handleErrors');
Expand Down
2 changes: 1 addition & 1 deletion framework/core/expFramework.php
Expand Up @@ -46,7 +46,7 @@
* @name $history
*/
$history = null;
$SYS_FLOW_REDIRECTIONPATH = '';
//$SYS_FLOW_REDIRECTIONPATH = '';

/**
* the current user object
Expand Down
16 changes: 8 additions & 8 deletions framework/core/subsystems/expHistory.php
Expand Up @@ -180,20 +180,20 @@ public function setHistory($url_type, $params) {
*
* @param integer $access_level The access level of the current page.
* Either SYS_FLOW_PUBLIC or SYS_FLOW_PROTECTED
* @param integer $url_type The type of URSL being set. Either
* @param integer $url_type The type of URL being set. Either
* SYS_FLOW_SECTIONAL or SYS_FLOW_ACTION
* @node Subsystems:Flow
*/
public static function flowSet($access_level,$url_type) {
global $SYS_FLOW_REDIRECTIONPATH;
// global $SYS_FLOW_REDIRECTIONPATH;
global $router;
//echo '<h1>setting flow</h1>'.$router->current_url;
if ($access_level == SYS_FLOW_PUBLIC) {
expSession::set($SYS_FLOW_REDIRECTIONPATH.'_flow_' . SYS_FLOW_PROTECTED . '_' . $url_type, $router->current_url);
expSession::set($SYS_FLOW_REDIRECTIONPATH.'_flow_last_' . SYS_FLOW_PROTECTED, $router->current_url);
}
expSession::set($SYS_FLOW_REDIRECTIONPATH.'_flow_' . $access_level . '_' . $url_type, $router->current_url);
expSession::set($SYS_FLOW_REDIRECTIONPATH.'_flow_last_' . $access_level, $router->current_url);
// if ($access_level == SYS_FLOW_PUBLIC) {
// expSession::set($SYS_FLOW_REDIRECTIONPATH.'_flow_' . SYS_FLOW_PROTECTED . '_' . $url_type, $router->current_url);
// expSession::set($SYS_FLOW_REDIRECTIONPATH.'_flow_last_' . SYS_FLOW_PROTECTED, $router->current_url);
// }
// expSession::set($SYS_FLOW_REDIRECTIONPATH.'_flow_' . $access_level . '_' . $url_type, $router->current_url);
// expSession::set($SYS_FLOW_REDIRECTIONPATH.'_flow_last_' . $access_level, $router->current_url);

//FIXME: Glue code to try to get new history and old flow to play nicely together.
expHistory::set('viewable', $router->params);
Expand Down
14 changes: 11 additions & 3 deletions framework/core/subsystems/expTheme.php
Expand Up @@ -916,15 +916,23 @@ public static function goDefaultSection() {
* @node Subsystems:Theme
*/
public static function mainContainer() {
global $router;

if (!AUTHORIZED_SECTION) {
// Set this so that a login on an Auth Denied page takes them back to the previously Auth-Denied page
expHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_SECTIONAL);
// expHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_SECTIONAL);
expHistory::set('manageable', $router->params);
echo SITE_403_HTML;
return;
}

if (PUBLIC_SECTION) expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_SECTIONAL);
else expHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_SECTIONAL);
if (PUBLIC_SECTION) {
// expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_SECTIONAL);
expHistory::set('viewable', $router->params);
} else {
// expHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_SECTIONAL);
expHistory::set('manageable', $router->params);
}

# if (expSession::is_set("themeopt_override")) {
# $config = expSession::get("themeopt_override");
Expand Down
6 changes: 4 additions & 2 deletions framework/modules-1/bots/actions/manage_bots.php
Expand Up @@ -20,10 +20,12 @@
// Part of the Extensions category

if (!defined('EXPONENT')) exit('');
global $router;

if (expPermissions::check('extensions',expCore::makeLocation('administrationmodule'))) {
expHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_ACTION);

// expHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_ACTION);
expHistory::set('manageable', $router->params);

// get new bots into the database
if (is_readable(BASE.'framework/modules-1/bots/bots')) {
$dh = opendir(BASE.'framework/modules-1/bots/bots');
Expand Down
2 changes: 1 addition & 1 deletion framework/modules-1/calendarmodule/actions/ical.php
Expand Up @@ -20,7 +20,7 @@

if (!defined('EXPONENT')) exit('');

//expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
//expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION); //FIXME we don't need to return here, do we?
// id & date_id set if single event, else
// src & time (opt?) set for longer list/month, etc...
if (isset($_GET['date_id']) || isset($_GET['src'])) {
Expand Down
4 changes: 3 additions & 1 deletion framework/modules-1/calendarmodule/actions/search.php
Expand Up @@ -33,8 +33,10 @@
/** @define "BASE" "../../../.." */

if (!defined('EXPONENT')) exit('');
global $router;

expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
//expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
expHistory::set('viewable', $router->params);

$template = new template("calendarmodule","_search",$loc,false);
$time = (isset($_GET['time']) ? $_GET['time'] : time());
Expand Down
4 changes: 3 additions & 1 deletion framework/modules-1/calendarmodule/actions/view.php
Expand Up @@ -18,8 +18,10 @@
##################################################

if (!defined('EXPONENT')) exit('');
global $router;

expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
//expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
expHistory::set('viewable', $router->params);

$item = $db->selectObject("calendar","id=" . intval($_GET['id']));
if ($item) {
Expand Down
4 changes: 3 additions & 1 deletion framework/modules-1/calendarmodule/actions/viewday.php
Expand Up @@ -18,8 +18,10 @@
##################################################

if (!defined('EXPONENT')) exit('');
global $router;

expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
//expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
expHistory::set('viewable', $router->params);

$time = (isset($_GET['time']) ? $_GET['time'] : time());
$info = getdate(intval($time));
Expand Down
4 changes: 3 additions & 1 deletion framework/modules-1/calendarmodule/actions/viewmonth.php
Expand Up @@ -18,8 +18,10 @@
##################################################

if (!defined('EXPONENT')) exit('');
global $router;

expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
//expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
expHistory::set('viewable', $router->params);

$view = (isset($_GET['view']) ? $_GET['view'] : "Default");
$title = $db->selectValue('container', 'title', "internal='".serialize($loc)."'");
Expand Down
4 changes: 3 additions & 1 deletion framework/modules-1/calendarmodule/actions/viewtag.php
Expand Up @@ -19,8 +19,10 @@
/** @define "BASE" "../../../.." */

if (!defined('EXPONENT')) exit('');
global $router;

expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
//expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
expHistory::set('viewable', $router->params);

$locsql = "(location_data='".serialize($loc)."'";
// look for possible aggregate
Expand Down
4 changes: 3 additions & 1 deletion framework/modules-1/calendarmodule/actions/viewweek.php
Expand Up @@ -19,8 +19,10 @@
/** @define "BASE" "../../../.." */

if (!defined('EXPONENT')) exit('');
global $router;

expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
//expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
expHistory::set('viewable', $router->params);

$title = $db->selectValue('container', 'title', "internal='".serialize($loc)."'");

Expand Down
6 changes: 3 additions & 3 deletions framework/modules-1/formbuilder/actions/edit_record.php
Expand Up @@ -64,7 +64,7 @@

// $form->register(uniqid(''),'', new htmlcontrol('<br /><br />'));
$form->register(uniqid(''),'', new htmlcontrol($antispam));
$form->register('submit','',new buttongroupcontrol(gt('Save'),'',gt('Cancel'),"","",1));
$form->register('submit','',new buttongroupcontrol(gt('Save'),'',gt('Cancel'),"","",'editable'));
$form->meta('action','submit_form');
$form->meta('m',$loc->mod);
$form->meta('s',$loc->src);
Expand All @@ -74,8 +74,8 @@
$form->meta('data_id',$data->id);
$form->location($loc);

global $SYS_FLOW_REDIRECTIONPATH;
$SYS_FLOW_REDIRECTIONPATH = "editfallback";
// global $SYS_FLOW_REDIRECTIONPATH;
// $SYS_FLOW_REDIRECTIONPATH = "editfallback";
$template = new template('formbuilder','_view_form');
$template->assign('form_html',$form->toHTML($f->id));
$template->assign('form',$f);
Expand Down
4 changes: 2 additions & 2 deletions framework/modules-1/formbuilder/actions/export_csv.php
Expand Up @@ -21,7 +21,7 @@
if (!defined('EXPONENT')) exit('');

$template = new template('formbuilder','_data_view');
expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
//expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION); //FIXME we shouldn't need to return here, right?
if (isset($_GET['id'])) {
$_GET['id'] = intval($_GET['id']);
Expand Down Expand Up @@ -141,7 +141,7 @@
//Read the file out directly

readfile($tmpfname);
exit();
if (DEVELOPMENT == 0) exit();

unlink($tmpfname);

Expand Down
6 changes: 3 additions & 3 deletions framework/modules-1/formbuilder/actions/view_data.php
Expand Up @@ -100,11 +100,11 @@

// $template->assign("items",$items);
$template->assign("f",$f);
global $SYS_FLOW_REDIRECTIONPATH;
$SYS_FLOW_REDIRECTIONPATH = "editfallback";
// global $SYS_FLOW_REDIRECTIONPATH;
// $SYS_FLOW_REDIRECTIONPATH = "editfallback";
$template->assign("backlink",expHistory::getLastNotEditable());
$template->register_permissions(array("administrate","editform","editformsettings","editreport","viewdata","editdata","deletedata"),unserialize($f->location_data));
$SYS_FLOW_REDIRECTIONPATH = "exponent_default";
// $SYS_FLOW_REDIRECTIONPATH = "exponent_default";
$columndef .= 'new cColumn("Links","",links,null)';
$columndef .= ');';

Expand Down
6 changes: 3 additions & 3 deletions framework/modules-1/formbuilder/actions/view_form.php
Expand Up @@ -44,10 +44,10 @@
$template = new template("formbuilder","_view_form");
$template->assign("form_html",$form->toHTML($f->id));
$template->assign("form",$f);
global $SYS_FLOW_REDIRECTIONPATH;
$SYS_FLOW_REDIRECTIONPATH = "editfallback";
// global $SYS_FLOW_REDIRECTIONPATH;
// $SYS_FLOW_REDIRECTIONPATH = "editfallback";
$template->assign("backlink",expHistory::getLastNotEditable());
$SYS_FLOW_REDIRECTIONPATH = "exponent_default";
// $SYS_FLOW_REDIRECTIONPATH = "exponent_default";

$types = expTemplate::listControlTypes();
$types[".break"] = gt('Spacer');
Expand Down
10 changes: 5 additions & 5 deletions framework/modules-1/formmodule/class.php
Expand Up @@ -87,11 +87,11 @@ function show($view,$loc = null) {
$db->insertObject($rpt,"formbuilder_report");
$f->id = $frmid;
}
global $SYS_FLOW_REDIRECTIONPATH;
//expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
$SYS_FLOW_REDIRECTIONPATH = "editfallback";
//expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
$SYS_FLOW_REDIRECTIONPATH = "exponent_default";
// global $SYS_FLOW_REDIRECTIONPATH;
// expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
// $SYS_FLOW_REDIRECTIONPATH = "editfallback";
// expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
// $SYS_FLOW_REDIRECTIONPATH = "exponent_default";

$floc = unserialize($f->location_data);
$controls = $db->selectObjects("formbuilder_control","form_id=".$f->id);
Expand Down
6 changes: 4 additions & 2 deletions framework/modules-1/navigationmodule/actions/manage.php
Expand Up @@ -18,11 +18,13 @@
##################################################

if (!defined('EXPONENT')) exit('');
global $router;

if (expPermissions::check('manage','navigationmodule')) {
global $user;
expHistory::flowSet(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);

// expHistory::flowSet(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);
expHistory::set('manageable', $router->params);

$template = new template('navigationmodule','_manager',$loc);

$template->assign('sections',navigationmodule::levelTemplate(0,0));
Expand Down
Expand Up @@ -18,10 +18,12 @@
##################################################

if (!defined('EXPONENT')) exit('');
global $router;

if ($user && $user->is_acting_admin == 1) {
expHistory::flowSet(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);

// expHistory::flowSet(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);
expHistory::set('manageable', $router->params);

$template = new template('navigationmodule','_manager_pagesets',$loc);

$tpls = $db->selectObjects('section_template','parent=0');
Expand Down
Expand Up @@ -18,10 +18,12 @@
##################################################

if (!defined('EXPONENT')) exit('');
global $router;

if ($user && $user->is_acting_admin == 1) {
expHistory::flowSet(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);

// expHistory::flowSet(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);
expHistory::set('manageable', $router->params);

$template = new template('navigationmodule','_manager_standalone',$loc);

$sections = $db->selectObjects('section','parent=-1');
Expand Down
Expand Up @@ -18,6 +18,7 @@
##################################################

if (!defined('EXPONENT')) exit('');
global $router;

if ($user && $user->is_acting_admin == 1) {
$page = null;
Expand All @@ -26,8 +27,9 @@
}

if ($page) {
expHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_ACTION);

// expHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_ACTION);
expHistory::set('manageable', $router->params);

$template = new template('navigationmodule','_view_template',$loc);
$template->assign('template',$page);
$template->assign('subs',navigationmodule::getTemplateHierarchyFlat($page->id));
Expand Down
Expand Up @@ -33,6 +33,7 @@
/** @define "BASE" "../../.." */

if (!defined('EXPONENT')) exit('');
global $router;

$question = null;
if (isset($_GET['id'])) {
Expand All @@ -44,8 +45,9 @@

if ($question) {
if (expPermissions::check('manage_question',$loc) || expPermissions::check('manage_answer',$loc)) {
expHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_ACTION);

// expHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_ACTION);
expHistory::set('manageable', $router->params);

$answers = $db->selectObjects('poll_answer','question_id='.$question->id);
$answers = expSorter::sort(array('array'=>$answers,'sortby'=>'rank', 'order'=>'ASC', 'type'=>'a'));

Expand Down
Expand Up @@ -32,10 +32,12 @@
##################################################

if (!defined('EXPONENT')) exit('');
global $router;

if (expPermissions::check('manage_question',$loc) || expPermissions::check('manage_answer',$loc)) {
expHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_ACTION);

// expHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_ACTION);
expHistory::set('manageable', $router->params);

$questions = $db->selectObjects('poll_question',"location_data='".serialize($loc)."'");
for ($i = 0; $i < count($questions); $i++) {
$questions[$i]->answer_count = $db->countObjects('poll_answer','question_id='.$questions[$i]->id);
Expand Down
4 changes: 3 additions & 1 deletion framework/modules/users/controllers/loginController.php
Expand Up @@ -133,6 +133,7 @@ public static function login() {
*/
public static function loginredirect() {
global $user;
global $router;

ob_start();
if ($user->isLoggedIn()) {
Expand All @@ -141,7 +142,8 @@ public static function loginredirect() {
//expSession::set('redirecturl', expHistory::getLastNotEditable());
expSession::set('redirecturl', expHistory::getLast());
expSession::set('redirecturl_error', makeLink(array('controller'=>'login', 'action'=>'loginredirect')));
expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
// expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
expHistory::set('viewable', $router->params);
}
redirect_to(array('controller'=>'login', 'action'=>'showlogin'));
}
Expand Down
5 changes: 3 additions & 2 deletions popup.php
Expand Up @@ -32,12 +32,13 @@
(isset($_GET['int'])?$_GET['int']:'')
);

$SYS_FLOW_REDIRECTIONPATH='popup';
//$SYS_FLOW_REDIRECTIONPATH='popup';

if (expTheme::inAction()) {
expTheme::runAction();
} else if (isset($_GET['module']) && isset($_GET['view'])) {
expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_SECTIONAL);
// expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_SECTIONAL);
expHistory::set('viewable', $router->params);

$mod = new $_GET['module']();
$mod->show($_GET['view'],$loc,(isset($_GET['title'])?$_GET['title']:''));
Expand Down
2 changes: 1 addition & 1 deletion selector.php
Expand Up @@ -41,7 +41,7 @@ function epb($buffer, $mode) {
if (is_readable(BASE.$page)) {
define('PREVIEW_READONLY',1); // for mods
define('SELECTOR',1);
$SYS_FLOW_REDIRECTIONPATH='source_selector';
// $SYS_FLOW_REDIRECTIONPATH='source_selector';

$source_select = array();
if (expSession::is_set('source_select')) $source_select = expSession::get('source_select');
Expand Down

0 comments on commit 46ec44b

Please sign in to comment.