public function getTextBySection($section) { global $db; $id = is_object($section) ? $section->id : $section; $refs = $db->selectObjects('sectionref', 'section=' . $id); ob_start(); $mods = array(); foreach ($refs as $ref) { $loc = null; $loc->mod = $ref->module; $loc->src = $ref->source; $loc->int = $ref->internal; if (!empty($loc->src)) { if ($ref->module == 'containermodule') { foreach ($db->selectObjects('container', "external='" . serialize($loc) . "'") as $mod) { $mods[] = $mod; $modloc = unserialize($mod->internal); expTheme::showAction($modloc->mod, 'index', $modloc->src, array('view' => $mod->view, 'title' => $mod->title)); } } else { foreach ($db->selectObjects('container', "internal='" . serialize($loc) . "'") as $mod) { $mods[] = $mod; } } } } $text = search::removeHTML(ob_get_contents()); ob_end_clean(); return $text; }
public function show() { $where = "location_data='" . serialize($this->loc) . "'"; $db_headline = $this->headline->find('first', $where); $this->metainfo = expTheme::pageMetaInfo(); $title = !empty($db_headline) ? $db_headline->title : $this->metainfo['title']; assign_to_template(array('headline' => $title, 'record' => $db_headline)); }
static function form($object = null) { $form = new form(); if (!isset($object->id)) { $object->name = ''; $object->active = 1; $object->public = 1; $object->subtheme = ''; $object->page_title = SITE_TITLE; $object->keywords = SITE_KEYWORDS; $object->description = SITE_DESCRIPTION; if (!isset($object->parent)) { $object->parent = 0; } // NOT IMPLEMENTED YET //$object->subtheme=''; } else { $form->meta('id', $object->id); } $form->meta('parent', $object->parent); $form->register('name', gt('Name'), new textcontrol($object->name)); if (!isset($object->id) && $object->parent != 0) { // Add the 'Add' drop down if not a top level global $db; $sections = $db->selectObjects('section_template', 'parent=' . $object->parent); if (count($sections)) { $sections = expSorter::sort(array('array' => $sections, 'sortby' => 'rank', 'order' => 'ASC')); $dd = array(gt('At the Top')); foreach ($sections as $s) { $dd[] = sprintf(gt('After') . " %s", $s->name); } $form->register('rank', gt('Position'), new dropdowncontrol(count($dd) - 1, $dd)); } else { $form->meta('rank', 0); } } else { $form->meta('rank', 0); } if (is_readable(THEME_ABSOLUTE . 'subthemes')) { // grab sub themes $form->register('subtheme', gt('Theme Variation'), new dropdowncontrol($object->subtheme, expTheme::getSubThemes())); } $form->register('active', gt('Active'), new checkboxcontrol($object->active)); $form->register('public', gt('Public'), new checkboxcontrol($object->public)); // Register the Page Meta Data controls. $form->register('page_title', gt('Page Title'), new textcontrol($object->page_title)); $form->register('keywords', gt('keywords'), new texteditorcontrol($object->keywords, 5, 25)); $form->register('description', gt('Page Description'), new texteditorcontrol($object->keywords, 5, 25)); $form->register('submit', '', new buttongroupcontrol(gt('Save'), '', gt('Cancel'))); return $form; }
function __construct($src = null, $params = array()) { global $db, $router, $section, $user; parent::__construct($src = null, $params); // we're setting the config here globably $this->grabConfig(); if (expTheme::inAction() && !empty($router->url_parts[1]) && ($router->url_parts[0] == "store" && $router->url_parts[1] == "showall")) { if (isset($router->url_parts[array_search('title', $router->url_parts) + 1]) && is_string($router->url_parts[array_search('title', $router->url_parts) + 1])) { $default_id = $db->selectValue('storeCategories', 'id', "sef_url='" . $router->url_parts[array_search('title', $router->url_parts) + 1] . "'"); $active = $db->selectValue('storeCategories', 'is_active', "sef_url='" . $router->url_parts[array_search('title', $router->url_parts) + 1] . "'"); if (empty($active) && $user->is_acting_admin != 1) { redirect_to(array("section" => SITE_DEFAULT_SECTION)); } expSession::set('catid', $default_id); } } elseif (expTheme::inAction() && !empty($router->url_parts[1]) && ($router->url_parts[0] == "store" && ($router->url_parts[1] == "show" || $router->url_parts[1] == "showByTitle"))) { if (isset($router->url_parts[array_search('id', $router->url_parts) + 1]) && $router->url_parts[array_search('id', $router->url_parts) + 1] != 0) { $default_id = $db->selectValue('product_storeCategories', 'storecategories_id', "product_id='" . $router->url_parts[array_search('id', $router->url_parts) + 1] . "'"); expSession::set('catid', $default_id); } else { $prod_id = $db->selectValue('product', 'id', "sef_url='" . $router->url_parts[array_search('title', $router->url_parts) + 1] . "'"); $default_id = $db->selectValue('product_storeCategories', 'storecategories_id', "product_id='" . $prod_id . "'"); expSession::set('catid', $default_id); } } elseif (isset($this->config['show_first_category']) || !expTheme::inAction() && $section == SITE_DEFAULT_SECTION) { if (!empty($this->config['show_first_category'])) { $default_id = $db->selectValue('storeCategories', 'id', 'lft=1'); } else { $default_id = 0; } expSession::set('catid', $default_id); } elseif (!isset($this->config['show_first_category']) && !expTheme::inAction()) { expSession::set('catid', 0); } else { $default_id = 0; } // figure out if we need to show all categories and products or default to showing the first category. // elseif (!empty($this->config['category'])) { // $default_id = $this->config['category']; // } elseif (ecomconfig::getConfig('show_first_category')) { // $default_id = $db->selectValue('storeCategories', 'id', 'lft=1'); // } else { // $default_id = 0; // } $this->parent = expSession::get('catid'); $this->category = new storeCategory($this->parent); // we're setting the config here for the category $this->grabConfig($this->category); }
/** * Smarty {chain} function plugin * * Type: function<br> * Name: chain<br> * Purpose: chain/append templates * * @param $params * @param \Smarty $smarty * @return bool */ function smarty_function_chain($params, &$smarty) { if (empty($params['module']) && empty($params['controller'])) { return false; } if (isset($params['source'])) { $params['src'] = $params['source']; } $src = isset($params['src']) ? $params['src'] : $smarty->getTemplateVars('__loc')->src; if (isset($params['module'])) { // $chrome = $params['chrome'] == "none" ? true : false; $chrome = empty($params['chrome']) ? true : false; $title = isset($params['title']) ? $params['title'] : ''; $view = isset($params['view']) ? $params['view'] : 'Default'; $action = isset($params['action']) ? $params['action'] : null; $parms = isset($params['params']) ? $params['params'] : null; if (!$parms) { //return; } else { eval('$new_parms = ' . $parms . ';'); $parms = $new_parms; } if (empty($action)) { echo expTheme::showModule($params['module'], $view, $title, $src, false, null, $chrome); } else { echo expTheme::showAction($params['module'], $action, $src, $parms); } } elseif (isset($params['controller'])) { $view = isset($params['view']) ? $params['view'] : $params['action']; $action = isset($params['action']) ? $params['action'] : 'index'; $scope = isset($params['scope']) ? $params['scope'] : 'global'; //$chrome = isset($params['chrome']) ? '"chrome"=>true' : ''; $source = isset($params['source']) ? $params['source'] : $smarty->getTemplateVars('__loc')->src; $cfg = array("controller" => $params['controller'], "action" => $action, "view" => $view, "source" => $source, "scope" => $scope); //because of the silly way we have to toggle chrome if (!empty($params['chrome'])) { $cfg['chrome'] = true; } else { $cfg['chrome'] = false; } //eDebug($cfg); expTheme::module($cfg); } }
/** * Smarty {showaction} function plugin * * Type: function<br> * Name: showaction<br> * Purpose: Display an action.<br> * * @param array $params * @param mixed $smarty */ function smarty_function_showaction($params, &$smarty) { //echo $params['module']."|".$params['action']."|".$params['source']; expTheme::showAction($params['module'], $params['action'], $params['source'], $params['params']); }
/** * Smarty {ddrerank} function plugin * * Type: function<br> * Name: ddrerank<br> * Purpose: display item re-ranking popup * * @param $params * @param \Smarty $smarty * @return bool */ function smarty_function_ddrerank($params, &$smarty) { global $db; $loc = $smarty->getTemplateVars('__loc'); $badvals = array("[", "]", ",", " ", "'", "\"", "&", "#", "%", "@", "!", "\$", "(", ")", "{", "}"); $uniqueid = str_replace($badvals, "", $loc->src) . $params['id']; $controller = !empty($params['controller']) ? $params['controller'] : $loc->mod; if ($params['sql']) { $sql = explode("LIMIT", $params['sql']); $params['items'] = $db->selectObjectsBySQL($sql[0]); } else { if ($params['items'][0]->id) { $model = empty($params['model']) ? $params['items'][0]->classname : $params['model']; $only = !empty($params['only']) ? ' AND ' . $params['only'] : ''; $obj = new $model(); $params['items'] = $obj->find('all', "location_data='" . serialize($loc) . "'" . $only, "rank"); } else { $params['items'] = array(); } } if (count($params['items']) >= 2) { expCSS::pushToHead(array("corecss" => "rerank,panel")); $sortfield = empty($params['sortfield']) ? 'title' : $params['sortfield']; //what was this even for? // attempt to translate the label if (!empty($params['label'])) { $params['label'] = gt($params['label']); } echo '<a id="rerank' . $uniqueid . '" class="reranklink" href="#">' . gt("Order") . ' ' . $params['label'] . '</a>'; $html = ' <div id="panel' . $uniqueid . '" class="exp-skin-panel exp-skin-rerank hide"> <div class="yui3-widget-hd">Order ' . $params['label'] . '</div> <div class="yui3-widget-bd"> <form method="post" action="' . URL_FULL . '"> <input type="hidden" name="model" value="' . $model . '" /> <input type="hidden" name="controller" value="' . $controller . '" /> <input type="hidden" name="lastpage" value="' . curPageURL() . '" /> <input type="hidden" name="src" value="' . $loc->src . '" />'; if (!empty($params['items'])) { // we may need to pass through an ID for some reason, like a category ID for products $html .= $params['id'] ? '<input type="hidden" name="id" value="' . $params['id'] . '" />' : ''; $html .= '<input type="hidden" name="action" value="manage_ranks" /> <ul id="listToOrder' . $uniqueid . '" style="' . (count($params['items'] < 12) ? "" : "height:350px") . ';overflow-y:auto;"> '; $odd = "even"; foreach ($params['items'] as $item) { $html .= ' <li class="' . $odd . '"> <input type="hidden" name="rerank[]" value="' . $item->id . '" /> <div class="fpdrag"></div>'; //Do we include the picture? It depends on if there is one set. $html .= $item->expFile[0]->id && $item->expFile[0]->is_image ? '<img class="filepic" src="' . URL_FULL . 'thumb.php?id=' . $item->expFile[0]->id . '&w=16&h=16&zc=1">' : ''; $html .= '<span class="label">' . (!empty($item->{$sortfield}) ? substr($item->{$sortfield}, 0, 40) : gt('Untitled')) . '</span> </li>'; $odd = $odd == "even" ? "odd" : "even"; } $html .= '</ul> <div class="yui3-widget-ft"> <button type="submit" class="awesome small ' . BTN_COLOR . '">' . gt('Save') . '</button> </div> </form> </div> </div> '; } else { $html .= '<strong>' . gt('Nothing to re-rank') . '</strong> </div> </div> '; } echo $html; $script = "\n YUI(EXPONENT.YUI3_CONFIG).use('node','dd','dd-plugin','panel', function(Y) {\n var panel = new Y.Panel({\n srcNode:'#panel" . $uniqueid . "',\n width : 500,\n visible : false,\n zIndex : 50,\n centered : false,\n render : 'body',\n // plugins : [Y.Plugin.Drag]\n }).plug(Y.Plugin.Drag);\n \n panel.dd.addHandle('.yui3-widget-hd');\n \n var panelContainer = Y.one('#panel" . $uniqueid . "').get('parentNode');\n panelContainer.addClass('exp-panel-container');\n Y.one('#panel" . $uniqueid . "').removeClass('hide');\n \n Y.one('#rerank" . $uniqueid . "').on('click',function(e){\n e.halt();\n panel.show();\n panel.set('centered',true);\n });\n\n //Static Vars\n var goingUp = false, lastY = 0;\n\n // the list\n var ul = '#listToOrder" . $uniqueid . "';\n\n //Get the list of li's in the lists and make them draggable\n var lis = Y.Node.all('#listToOrder" . $uniqueid . " li');\n// lis.each(function(v, k) {\n // var dragItem = new Y.DD.Drag({\n // node: v,\n // target: {\n // padding: '0 0 0 0'\n // }\n // }).plug(Y.Plugin.DDProxy, {\n // moveOnEnd: false\n // }).plug(Y.Plugin.DDConstrained, {\n // constrain2node: ul,\n // stickY:true\n // }).plug(Y.Plugin.DDNodeScroll, {\n // node: ul\n // }).addHandle('.fpdrag');\n\n var dragItems = new Y.DD.Delegate({\n container: ul,\n nodes: 'li',\n target: {\n padding: '0 0 0 0'\n }\n })\n \n dragItems.dd.plug(Y.Plugin.DDConstrained, {\n constrain2node: ul,\n stickY:true\n }).plug(Y.Plugin.DDProxy, {\n moveOnEnd: false\n }).plug(Y.Plugin.DDConstrained, {\n constrain2node: ul,\n stickY:true\n }).plug(Y.Plugin.DDNodeScroll, {\n node: ul\n }).addHandle('.fpdrag');\n\n dragItems.on('drop:over', function(e) {\n //Get a reference to out drag and drop nodes\n var drag = e.drag.get('node'),\n drop = e.drop.get('node');\n\n //Are we dropping on a li node?\n if (drop.get('tagName').toLowerCase() === 'li') {\n //Are we not going up?\n if (!goingUp) {\n drop = drop.get('nextSibling');\n }\n //Add the node to this list\n e.drop.get('node').get('parentNode').insertBefore(drag, drop);\n //Resize this nodes shim, so we can drop on it later.\n e.drop.sizeShim();\n }\n });\n //Listen for all drag:drag events\n dragItems.on('drag:drag', function(e) {\n //Get the last y point\n var y = e.target.lastXY[1];\n //is it greater than the lastY var?\n if (y < lastY) {\n //We are going up\n goingUp = true;\n } else {\n //We are going down..\n goingUp = false;\n }\n //Cache for next check\n lastY = y;\n Y.DD.DDM.syncActiveShims(true);\n });\n //Listen for all drag:start events\n dragItems.on('drag:start', function(e) {\n //Get our drag object\n var drag = e.target;\n //Set some styles here\n drag.get('node').setStyle('opacity', '.25');\n drag.get('dragNode').addClass('rerank-proxy').set('innerHTML', drag.get('node').get('innerHTML'));\n drag.get('dragNode').setStyles({\n opacity: '.5'\n // borderColor: drag.get('node').getStyle('borderColor'),\n // backgroundColor: drag.get('node').getStyle('backgroundColor')\n });\n });\n //Listen for a drag:end events\n dragItems.on('drag:end', function(e) {\n var drag = e.target;\n //Put out styles back\n drag.get('node').setStyles({\n visibility: '',\n opacity: '1'\n });\n });\n //Listen for all drag:drophit events\n dragItems.on('drag:drophit', function(e) {\n var drop = e.drop.get('node'),\n drag = e.drag.get('node');\n\n //if we are not on an li, we must have been dropped on a ul\n if (drop.get('tagName').toLowerCase() !== 'li') {\n if (!drop.contains(drag)) {\n drop.appendChild(drag);\n }\n }\n });\n// });\n\n //Create simple targets for the 2 lists..\n var tar = new Y.DD.Drop({\n node: ul\n }); \n });\n \n "; if (!expTheme::inPreview()) { expJavascript::pushToFoot(array("unique" => $uniqueid, "yui3mods" => 1, "content" => $script)); } } }
function exponent_theme_satisfyThemeRequirements() { expTheme::satisfyThemeRequirements(); }
<?php expTheme::module(array("controller" => "login", "action" => "showlogin", "view" => "showlogin_flyoutYUI")); ?> <?php expTheme::module(array("module" => "navigation", "view" => "YUI Top Nav", "source" => "@top")); ?> </div> <div id="content-wrap"> <div id="content"> <?php expTheme::main(); ?> </div> <div id="sidebar"> <?php expTheme::module(array("module" => "container", "view" => "Default", "source" => "@left")); ?> </div> </div> </div> <div id="footer"> <?php expTheme::module(array("controller" => "text", "action" => "showall", "view" => "single", "source" => "@footer", "chrome" => 1)); ?> </div> <?php expTheme::foot(); ?> </body> </html>
# Exponent is free software; you can redistribute # it and/or modify it under the terms of the GNU # General Public License as published by the Free # Software Foundation; either version 2 of the # License, or (at your option) any later version. # # GPL: http://www.gnu.org/licenses/gpl.txt # ################################################## /** @define "BASE" "." */ define('SCRIPT_EXP_RELATIVE', ''); define('SCRIPT_FILENAME', 'popup.php'); ob_start(); // Initialize the Exponent Framework require_once 'exponent.php'; $loc = expCore::makeLocation(isset($_GET['module']) ? $_GET['module'] : '', isset($_GET['src']) ? $_GET['src'] : '', isset($_GET['int']) ? $_GET['int'] : ''); if (expTheme::inAction()) { expTheme::runAction(); } else { if (isset($_GET['module']) && isset($_GET['view'])) { // 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'] : ''); } } $str = ob_get_contents(); ob_end_clean(); $template = new standalonetemplate('popup_' . (isset($_GET['template']) ? $_GET['template'] : 'general')); $template->assign('output', $str); $template->output();
public function setHistory($url_type, $params) { global $router; // if the history gets bigger than 10 then we will trim it. $size = empty($this->history[$url_type]) ? 0 : count($this->history[$url_type]); if ($size > 10) { array_shift($this->history[$url_type]); $size = $size - 1; } // if we're in an action, we'll only set history if the action we're trying to set // matches the action the we're in...otherwise if we're on a page we check to make sure // the page we're trying to set isn't the same as the last one we just set. This will keep // page refreshes the controllers on the same page from loading up the viewable array with a // bunch of identical entries $url = ''; if (stristr($router->current_url, 'EXPONENT.')) { return false; } if (expTheme::inAction()) { // we don't want to save history for these action...it screws up the flow when logging in if (!isset($router->params['action']) || $router->params['action'] == 'loginredirect' || $router->params['action'] == 'logout') { return false; } // figure out the module/controller names $router_name = isset($router->params['controller']) ? $router->params['controller'] : $router->params['module']; $params_name = isset($params['controller']) ? $params['controller'] : $params['module']; // make sure the controller action is the one specified via the URL if (expModules::getControllerName($router_name) == expModules::getControllerName($params_name) && $router->params['action'] == $params['action']) { $url = array('url_type' => $router->url_type, 'params' => $router->params); } } else { //if we hit here it should be a page, not an action $url = array('url_type' => $router->url_type, 'params' => $router->params); } if (!empty($url)) { $diff = array(); // if this url is the exact same as the last for this type we won't save it..that way refresh won't fill up our history if ($size > 0) { $diff = array_diff_assoc($router->params, $this->history[$url_type][$size - 1]['params']); } if (!empty($diff) || $size == 0) { $this->history[$url_type][] = $url; } // save the "lasts" information $this->history['lasts']['type'] = $url_type; if ($url_type != 'editable') { $this->history['lasts']['not_editable'] = $url_type; } } expSession::set('history', $this->history); }
public function toggle_mobile() { if (!expSession::is_set('mobile')) { // account for FORCE_MOBILE initial state expSession::set('mobile', MOBILE); } expSession::set('mobile', !expSession::get('mobile')); expTheme::removeSmartyCache(); expHistory::back(); }
/** * Content Page Form method * * This method returns a Form object to be used when allowing the user * to create a new normal Content Page or edit an existing one. * * @param Object $object The section object to build the form from. * * @return Form A form object that can be used to create a new section, or * edit an existing one. */ static function form($object = null) { // Initialize the forms subsystem for use. // Grab the basic form that all page types share // This has the name and positional dropdowns registered. // This call also initializes the section object, if it is not an existing section. $form = section::_commonForm($object); // Register the 'Active?' and 'Public?' checkboxes. $form->register('active', gt('Active'), new checkboxcontrol($object->active)); $form->register('public', gt('Public'), new checkboxcontrol($object->public)); // Register the sub themes dropdown. $form->register('subtheme', gt('Theme Variation'), new dropdowncontrol($object->subtheme, expTheme::getSubThemes())); // Register the 'Secured?' checkboxes for SSL pages if (ENABLE_SSL) { $form->register('secured', "Secured?", new checkboxcontrol($object->secured)); } $form->register(null, '', new htmlcontrol('<h2>SEO Information</h2>')); // Register the Page Meta Data controls. $form->register('page_title', gt('Page Title'), new textcontrol($object->page_title)); $form->register('keywords', gt('Keywords'), new texteditorcontrol($object->keywords, 5)); $form->register('description', gt('Page Description'), new texteditorcontrol($object->description, 5)); // Add a Submit / Cancel button. $form->register('submit', '', new buttongroupcontrol(gt('Save'), '', gt('Cancel'))); // Return the form to the calling scope (usually an action in the navigation module). return $form; }
public function getSection() { if (expTheme::inAction()) { if (isset($_REQUEST['section'])) { $section = $this->url_type == "sef" ? $this->getPageByName($_REQUEST['section']) : $_REQUEST['section']; } else { $section = expSession::is_set('last_section') ? expSession::get('last_section') : SITE_DEFAULT_SECTION; } } else { $section = isset($_REQUEST['section']) ? $_REQUEST['section'] : SITE_DEFAULT_SECTION; } return $section; }
public function makeSortDropdown($params) { global $router; if (!empty($this->columns) && is_array($this->columns)) { $this->sort_dropdown = array(); // get the parameters used to make this page. if (!expTheme::inAction()) { unset($params['section']); if (empty($params['controller'])) { $params['controller'] = $this->controller; } if (empty($params['action'])) { $params['action'] = $this->action; } } /*$current = ''; if (isset($params['order'])) { $current = $params['order']; unset($params['order']); } else { $current = $this->order; } */ //loop over the columns and build out a list of <th>'s to be used in the page table // eDebug($router); $defaultParams['controller'] = $params['controller']; $defaultParams['action'] = $params['action']; if (isset($params['title'])) { $defaultParams['title'] = $params['title']; } if (isset($params['page'])) { $defaultParams['page'] = $params['page']; } $this->sort_dropdown[$router->makeLink($defaultParams, null, null, true)] = "Default"; foreach ($this->columns as $colname => $col) { // if this is the column we are sorting on right now we need to setup some class info /*$class = isset($this->class) ? $this->class : 'page'; $params['dir'] = 'ASC';*/ /*if ($col == $current) { $class = 'current'; $class .= ' '.$this->order_direction; if (isset($_REQUEST['dir'])) { $params['dir'] = $_REQUEST['dir'] == 'ASC' ? 'DESC' : 'ASC'; } else { $params['dir'] = $this->order_direction == 'ASC' ? 'DESC' : 'ASC'; } } */ $params['order'] = $col; if (!empty($col)) { if ($colname == 'Price') { $params['dir'] = 'ASC'; $this->sort_dropdown[$router->makeLink($params, null, null, true)] = $colname . " - Lowest to Highest"; $params['dir'] = 'DESC'; $this->sort_dropdown[$router->makeLink($params, null, null, true)] = $colname . " - Highest to Lowest"; } else { $params['dir'] = 'ASC'; $this->sort_dropdown[$router->makeLink($params, null, null, true)] = $colname . " - A-Z"; $params['dir'] = 'DESC'; $this->sort_dropdown[$router->makeLink($params, null, null, true)] = $colname . " - Z-A"; } } } } }
</div> <div id="bd"> <div id="leftcol"> <?php expTheme::module(array("module" => "container", "view" => "Default", "source" => "@left")); ?> </div> <div id="centercol"> <?php expTheme::main(); ?> </div> <div id="rightcol"> <?php expTheme::module(array("module" => "container", "view" => "Default", "source" => "@right", "scope" => "sectional")); ?> </div> </div> <div id="ft"> <?php expTheme::module(array("controller" => "text", "action" => "showall", "view" => "single", "source" => "@footer")); ?> <div id="oicinfo"><a href="http://www.oicgroup.net" target="_blank">Website Design</a> and <a href="http://www.oicgroup.net" target="_blank">Website Development</a> by <a href="http://www.oicgroup.net" target="_blank"><strong>Online Innovative Creations</strong></a></div> </div> </div> <?php echo expTheme::foot(); ?> </body> </html>
} else { $source_select['showmodules'] = explode(',', $_REQUEST['showmodules']); } } } else { if (!isset($source_select['showmodules'])) { $source_select['showmodules'] = null; } } if (isset($_REQUEST['dest'])) { $source_select['dest'] = $_REQUEST['dest']; } else { if (!isset($source_select['dest'])) { $source_select['dest'] = null; } } if (isset($_REQUEST['hideOthers'])) { $source_select['hideOthers'] = $_REQUEST['hideOthers']; } else { if (!isset($source_select['hideOthers'])) { $source_select['hideOthers'] = 0; } } expSession::set('source_select', $source_select); // Include the rendering page. include_once BASE . $page; expTheme::satisfyThemeRequirements(); } else { echo sprintf(gt('Page') . ' "%s" ' . gt('not readable.'), BASE . $page); } ob_end_flush();
if (expJavascript::inAjaxAction()) { set_error_handler('handleErrors'); } // Validate the session and populate the $user variable if ($db->havedb) { $user = new user(); expSession::validate(); } /* exdoc * The flag to use a mobile theme variation. */ if (!defined('MOBILE')) { if (defined('FORCE_MOBILE') && FORCE_MOBILE && $user->isAdmin()) { define('MOBILE', true); } else { define('MOBILE', expTheme::is_mobile()); } } // Initialize permissions variables $exponent_permissions_r = expSession::get("permissions"); // initialize the expRouter $router = new expRouter(); // Initialize the navigation hierarchy if ($db->havedb) { $sections = expCore::initializeNavigation(); } /** * dumps the passed variable to screen, but only if in development mode * @param $var the variable to dump * @param bool $halt if set to true will halt execution * @return void
function renderAction(array $parms = array()) { global $user; //Get some info about the controller $baseControllerName = expModules::getControllerName($parms['controller']); $fullControllerName = expModules::getControllerClassName($parms['controller']); $controllerClass = new ReflectionClass($fullControllerName); // Figure out the action to use...if the specified action doesn't exist then // we look for the index action. if ($controllerClass->hasMethod($parms['action'])) { $action = $parms['action']; /* TODO: Not sure if this needs to be here. FJD $meth = $controllerClass->getMethod($action); if ($meth->isPrivate()) expQueue::flashAndFlow('error', 'The requested action could not be performed: Action not found');*/ } elseif ($controllerClass->hasMethod('index')) { $action = 'index'; } elseif ($controllerClass->hasMethod('showall')) { $action = 'showall'; } else { expQueue::flashAndFlow('error', gt('The requested action could not be performed: Action not found')); } // initialize the controller. $src = isset($parms['src']) ? $parms['src'] : null; $controller = new $fullControllerName($src, $parms); //Set up the template to use for this action global $template; $view = !empty($parms['view']) ? $parms['view'] : $action; $template = get_template_for_action($controller, $view, $controller->loc); // have the controller assign knowledge about itself to the template. // this has to be done after the controller get the template for its actions $controller->moduleSelfAwareness(); //if this controller is being called by a container then we should have a module title. if (isset($parms['moduletitle'])) { $template->assign('moduletitle', $parms['moduletitle']); } //setup some default models for this controller's actions to use foreach ($controller->getModels() as $model) { $controller->{$model} = new $model(null, false, false); //added null,false,false to reduce unnecessary queries. FJD } // add the $_REQUEST values to the controller <- pb: took this out and passed in the params to the controller constructor above //$controller->params = $parms; //check the perms for this action $perms = $controller->permissions(); //we have to treat the update permission a little different..it's tied to the create/edit //permissions. Really the only way this will fail will be if someone bypasses the perm check //on the edit form somehow..like a hacker trying to bypass the form and just submit straight to //the action. To safeguard, we'll catch if the action is update and change it either to create or //edit depending on whether an id param is passed to. that should be sufficient. $common_action = null; if ($parms['action'] == 'update') { $perm_action = !isset($parms['id']) || $parms['id'] == 0 ? 'create' : 'edit'; } elseif ($parms['action'] == 'saveconfig') { $perm_action = 'configure'; } else { // action convention for controllers that manage more than one model (datatype). // if you preface the name action name with a common crud action name we can check perms on // it with the developer needing to specify any...better safe than sorry. // i.e if the action is edit_mymodel it will be checked against the edit permission if (stristr($parms['action'], '_')) { $parts = explode("_", $parms['action']); } $common_action = isset($parts[0]) ? $parts[0] : null; $perm_action = $parms['action']; } if (array_key_exists($perm_action, $perms)) { if (!expPermissions::check($perm_action, $controller->loc)) { if (expTheme::inAction()) { flash('error', gt("You don't have permission to") . " " . $perms[$perm_action]); expHistory::returnTo('viewable'); } else { return false; } } } elseif (array_key_exists($common_action, $perms)) { if (!expPermissions::check($common_action, $controller->loc)) { if (expTheme::inAction()) { flash('error', gt("You don't have permission to") . " " . $perms[$common_action]); expHistory::returnTo('viewable'); } else { return false; } } } elseif (array_key_exists($perm_action, $controller->requires_login)) { // check if the action requires the user to be logged in if (!$user->isLoggedIn()) { $msg = empty($controller->requires_login[$perm_action]) ? gt("You must be logged in to perform this action") : $controller->requires_login[$perm_action]; flash('error', $msg); expHistory::redirecto_login(); } } elseif (array_key_exists($common_action, $controller->requires_login)) { // check if the action requires the user to be logged in if (!$user->isLoggedIn()) { $msg = empty($controller->requires_login[$common_action]) ? gt("You must be logged in to perform this action") : $controller->requires_login[$common_action]; flash('error', $msg); expHistory::redirecto_login(); } } // run the action $controller->{$action}(); //register this controllers permissions to the view for in view perm checks $template->register_permissions(array_keys($perms), $controller->loc); // pass this controllers config off to the view $template->assign('config', $controller->config); // globalizing $user inside all templates $template->assign('user', $user); //assign the controllers basemodel to the view $template->assign('modelname', $controller->basemodel_name); if (empty($parms['no_output'])) { $template->output(); } else { $html = $template->render(); return $html; } //$html = $template->output(); //return $html; }