function toHTML($label, $name) { $link = expCore::makeLink(array("module" => $this->controller->baseclassname, "action" => "edit", "parent" => 0)); $html = ""; if ($this->menu == "true") { if ($this->addable) { $html = '<a class="add" href="' . $link . '">Add a Category</a> | '; } $html .= '<a href="#" id="expandall">Expand All</a> | '; $html .= '<a href="#" id="collapseall">Collapse All</a>'; } $html .= ' <div id="' . $this->id . '" class="nodetree"></div> <div class="loadingdiv">Loading Categories</div>'; foreach ($this->tags as $i => $val) { if (!empty($this->values) && in_array($val->id, $this->values)) { $this->tags[$i]->value = true; } else { $this->tags[$i]->value = false; } $this->tags[$i]->draggable = $this->draggable; $this->tags[$i]->checkable = $this->checkable; } $obj = json_encode($this->tags); $script = "\n\t\tEXPONENT.YUI3_CONFIG.modules = {\n 'exp-tree' : {\n fullpath: EXPONENT.PATH_RELATIVE+'framework/core/assets/js/exp-tree.js',\n requires : ['node','yui2-container','yui2-menu','yui2-treeview','yui2-animation','yui2-dragdrop','yui2-json','yui2-connection']\n }\n }\n\n \t\t//EXPONENT.YUI3_CONFIG.filter = \".js\";\n\n YUI(EXPONENT.YUI3_CONFIG).use('node','exp-tree', function(Y) {\n \t\t\tvar obj2json = " . $obj . ";\n\t\t\t\tEXPONENT.DragDropTree.init('" . $this->id . "',obj2json,'" . $this->modelname . "','" . $this->menu . "','" . $this->expandonstart . "');\n\t\t\t\tY.one('.nodetree').next().remove();\n\t\t\t});\n\t\t"; // exponent_javascript_toFoot('expddtree', 'treeview,menu,animation,dragdrop,json,container,connection', null, $script, PATH_RELATIVE.'framework/core/assets/js/exp-tree.js'); expJavascript::pushToFoot(array("unique" => 'expddtree', "yui3mods" => 1, "content" => $script)); return $html; }
/** * Smarty {securelink} function plugin * * Type: function<br> * Name: securelink<br> * Purpose: create a secure link * * @param $params * @param \Smarty $smarty * @return bool */ function smarty_function_securelink($params, &$smarty) { /*$loc = $smarty->getTemplateVars('__loc'); if (!isset($params['module'])) $params['module'] = $loc->mod; if (!isset($params['src'])) $params['src'] = $loc->src; if (!isset($params['int'])) $params['int'] = $loc->int; $params['expid'] = session_id(); */ $loc = $smarty->getTemplateVars('__loc'); if (!isset($params['module'])) { $params['module'] = empty($params['controller']) ? $loc->mod : $params['controller']; } if (!isset($params['src'])) { if (expModules::controllerExists($params['module'])) { $params['src'] = $loc->src; } elseif (@call_user_func(array($loc->mod, 'hasSources'))) { $params['src'] = $loc->src; } } if (!isset($params['int'])) { $params['int'] = $loc->int; } echo expCore::makeSecureLink($params); }
function addToCart($params) { global $order; expSession::set('params', $params); //get the configuration $cfg->mod = "ecomconfig"; $cfg->src = "@globalstoresettings"; $cfg->int = ""; $config = new expConfig($cfg); $this->config = empty($catConfig->config) || @$catConfig->config['use_global'] == 1 ? $config->config : $catConfig->config; $min_amount = $this->config['minimum_gift_card_purchase']; $custom_message_product = $this->config['custom_message_product']; if (empty($params['product_id'])) { flash('error', gt("Please specify the style of the gift card you want to purchase.")); expHistory::back(); } if (empty($params['card_amount']) && empty($params['card_amount_txt'])) { flash('error', gt("You need to specify the card amount for the gift card.")); expHistory::back(); } else { // eDebug($params, true); $item = new orderitem($params); $sm = $order->getCurrentShippingMethod(); $item->shippingmethods_id = $sm->id; if (isset($params['card_amount_txt'])) { $params['card_amount_txt'] = preg_replace("/[^0-9.]/", "", $params['card_amount_txt']); } if (!empty($params['card_amount_txt']) && $params['card_amount_txt'] > 0) { $item->products_price = preg_replace("/[^0-9.]/", "", $params['card_amount_txt']); } else { $item->products_price = preg_replace("/[^0-9.]/", "", $params['card_amount']); } if ($item->products_price < $min_amount) { flash('error', gt("The minimum amount of gift card is") . " " . $min_amount); expHistory::back(); } $item->products_name = expCore::getCurrencySymbol() . $params['card_amount'] . ' ' . $this->title . " Style Gift Card"; if (!empty($params['toname'])) { $ed['To'] = isset($params['toname']) ? $params['toname'] : ''; } if (!empty($params['fromname'])) { $ed['From'] = isset($params['fromname']) ? $params['fromname'] : ''; } if (!empty($params['msg'])) { $ed['Message'] = isset($params['msg']) ? $params['msg'] : ''; $item->products_price += $custom_message_product; $item->products_name = $item->products_name . " (with message)"; } $item->extra_data = serialize($ed); // we need to unset the orderitem's ID to force a new entry..other wise we will overwrite any // other giftcards in the cart already $item->id = null; $item->quantity = $this->getDefaultQuantity(); $item->save(); return true; } }
/** * Smarty {rsslink} function plugin * * Type: function<br> * Name: rsslink<br> * Purpose: create an rss link * * @param $params * @param \Smarty $smarty * @return bool */ function smarty_function_rsslink($params, &$smarty) { $loc = $smarty->getTemplateVars('__loc'); if (!isset($params['module'])) { $params['module'] = $loc->mod; } if (!isset($params['src'])) { $params['src'] = $loc->src; } if (!isset($params['int'])) { $params['int'] = $loc->int; } echo expCore::makeRSSLink($params); }
/** * Smarty {scaffold} function plugin * * Type: function<br> * Name: scaffold<br> * Purpose: scaffold * * @param $params * @param \Smarty $smarty * @return bool */ function smarty_function_scaffold($params, &$smarty) { if (isset($params['model'])) { global $db; require_once $smarty->_get_plugin_filepath('function', 'control'); $table = $db->getDataDefinition($params['model']); foreach ($table as $key => $col) { if ($key != 'created_at' && $key != 'edited_at' && $key != 'poster' && $key != 'editor' && $key != 'location_data') { $ctl = array(); //Get the default value if (isset($params['item'])) { $ctl['value'] = isset($params['item']->{$key}) ? $params['item']->{$key} : ""; } //Get the base control if ($key == 'id') { $ctl['type'] = 'hidden'; } else { $ctl['type'] = expTemplate::guessControlType($col, $default_value, $key); } //format the values if needed if (isset($col[FORM_FIELD_FILTER])) { switch ($col[FORM_FIELD_FILTER]) { case MONEY: case DECIMAL_MONEY: $ctl['value'] = expCore::getCurrencySymbol('USD') . number_format($ctl['value'], 2, '.', ','); $ctl['filter'] = 'money'; break; } } //write out the control itself...and then we're done. if (isset($col[FORM_FIELD_ONCLICK])) { $ctl['onclick'] = $col[FORM_FIELD_ONCLICK]; } $ctl['label'] = isset($col[FORM_FIELD_LABEL]) ? $col[FORM_FIELD_LABEL] : $key; $ctl['name'] = isset($col[FORM_FIELD_NAME]) ? $col[FORM_FIELD_NAME] : $key; echo smarty_function_control($ctl, $smarty); //echo $control->controlToHTML($control_label, $control_name); } } } $submit = new buttongroupcontrol(gt('Submit'), gt('Reset'), gt('Cancel')); echo $submit->controlToHTML('submit'); }
/** * Smarty {includemiscfiles} postfilter plugin * * Type: postfilter<br> * Name: includemiscfiles<br> * Purpose: This function creates html loaders for - currently - JS and CSS Files * Please note it will only work for newtype __names (SomeModule, SomeForm, SomeTheme, SomeControl...) * * @param $compiledsource * @param \Smarty $smarty * * @return bool */ function smarty_postfilter_includemiscfiles($compiledsource, &$smarty) { ob_start(); //CSS $myCSS = expCore::resolveFilePaths("guess", $smarty->getTemplateVars('__name'), "css", $smarty->getTemplateVars('__view') . "*"); if ($myCSS != false) { foreach ($myCSS as $myCSSFile) { echo "<link rel='stylesheet' type='text/css' href='" . expCore::abs2rel($myCSSFile) . "'></link>\n"; } } //JavaScript $myJS = expCore::resolveFilePaths("guess", $smarty->getTemplateVars('__name'), "js", $smarty->getTemplateVars('__view') . "*"); if ($myJS != false) { foreach ($myJS as $myJSFile) { echo "<script type='text/javascript' src='" . expCore::abs2rel($myJSFile) . "'></script>\n"; } } $html = ob_get_contents(); ob_end_clean(); return $html . $compiledsource; }
static function update($values, $object, $loc) { global $db; // check if this is a controller or module $iscontroller = expModules::controllerExists($values['i_mod']); if (!isset($values['id'])) { // Only deal with the inc/dec stuff if adding a module. $src = ""; if (empty($values['existing_source'])) { $src = "@random" . uniqid(""); $object->is_existing = 0; $object->is_existing = 0; } else { $src = $values['existing_source']; $object->is_existing = 1; } // set the location data for the new module/controller $newInternal = expCore::makeLocation($values['modcntrol'], $src); // REFERENCES - Section and Location //$sect = $db->selectObject('section','id='.$_POST['current_section']); expCore::incrementLocationReference($newInternal, intval($_POST['current_section'])); // Rank is only updateable from the order action $object->rank = $values['rank']; // if (isset($values['rerank'])) $db->increment("container","rank",1,"external='".serialize($loc)."' AND rank >= " . $values['rank']); if (isset($values['rerank']) && $values['rerank']) { $db->increment("container", "rank", 1, "external='" . serialize($loc) . "' AND rank >= " . $values['rank']); } $object->internal = serialize($newInternal); $object->external = serialize($loc); } $object->is_private = isset($_POST['is_private']) ? 1 : 0; // UPDATE the container $object->action = isset($values['actions']) ? $values['actions'] : null; //$object->view = $iscontroller ? $values['ctlview'] : $values['view']; $object->view = $values['views']; $object->title = $values['title']; return $object; }
/** * Smarty {link} function plugin * * Type: function<br> * Name: link<br> * Purpose: create a link * * @param $params * @param \Smarty $smarty * @return bool */ function smarty_function_link($params, &$smarty) { $loc = $smarty->getTemplateVars('__loc'); if ($params['parse_attrs']) { $record = $params['record']; foreach ($params['parse_attrs'] as $key => $value) { $params[$key] = $value; if ($params['showby']) { $params[$params['showby']] = $record->{$params}['showby']; unset($params['showby']); } } unset($params['parse_attrs']); unset($params['record']); } // if the module wasn't passed in we will assume it is the same as the module for this view if (!isset($params['module']) && !isset($params['controller'])) { $params['module'] = $loc->mod; } // make sure the module isn't really a controller if (expModules::controllerExists($params['module'])) { $params['controller'] = $params['module']; unset($params['module']); } // guess the src if it is not set if (!isset($params['src'])) { if (!empty($params['controller']) || @call_user_func(array($loc->mod, 'hasSources'))) { $params['src'] = $loc->src; } } // greb the int value if (!isset($params['int'])) { $params['int'] = $loc->int; } echo expCore::makeLink($params); }
function __construct($module, $view = null, $loc = null, $caching = false, $type = null) { $type = !isset($type) ? 'modules' : $type; //parent::__construct("modules", $module, $view); parent::__construct($type, $module, $view); $this->viewparams = expTemplate::getViewParams($this->viewfile); if ($loc == null) { $loc = expCore::makeLocation($module); } $this->tpl->assign("__loc", $loc); $this->tpl->assign("__name", $module); // View Config global $db; $container_key = serialize($loc); $cache = expSession::getCacheValue('containermodule'); if (isset($cache[$container_key])) { $container = $cache[$container_key]; } else { $container = $db->selectObject("container", "internal='" . $container_key . "'"); $cache[$container_key] = $container; } $this->viewconfig = $container && isset($container->view_data) && $container->view_data != "" ? unserialize($container->view_data) : array(); $this->tpl->assign("__viewconfig", $this->viewconfig); }
/** exdoc * Calls the necessary methods to show a specific module * * @param string $module The classname of the module to display * @param string $view The name of the view to display the module with * @param string $title The title of the module (support is view-dependent) * @param string $source The source of the module. * @param bool $pickable Whether or not the module is pickable in the Source Picker. * @param null $section * @param bool $hide_menu * @param array $params * @return * @node Subsystems:Theme */ public static function showModule($module, $view = "Default", $title = "", $source = null, $pickable = false, $section = null, $hide_menu = false, $params = array()) { if (!AUTHORIZED_SECTION && $module != 'navigationmodule' && $module != 'loginController') { return; } global $db, $sectionObj, $module_scope; // Ensure that we have a section //FJD - changed to $sectionObj if ($sectionObj == null) { $section_id = expSession::get('last_section'); if ($section_id == null) { $section_id = SITE_DEFAULT_SECTION; } $sectionObj = $db->selectObject('section', 'id=' . $section_id); //$section->id = $section_id; } if ($module == "loginController" && defined('PREVIEW_READONLY') && PREVIEW_READONLY == 1) { return; } // if (expSession::is_set("themeopt_override")) { // $config = expSession::get("themeopt_override"); // if (in_array($module,$config['ignore_mods'])) return; // } $loc = expCore::makeLocation($module, $source . ""); if (empty($module_scope[$source][$module]->scope)) { $module_scope[$source][$module]->scope = 'global'; } // make sure we've added this module to the sectionref table if ($db->selectObject("sectionref", "module='{$module}' AND source='" . $loc->src . "'") == null) { $secref = null; $secref->module = $module; $secref->source = $loc->src; $secref->internal = ""; $secref->refcount = 1000; if ($sectionObj != null) { $secref->section = $sectionObj->id; } $secref->is_original = 1; $db->insertObject($secref, 'sectionref'); } $iscontroller = expModules::controllerExists($module); if (defined('SELECTOR') && call_user_func(array($module, "hasSources"))) { containermodule::wrapOutput($module, $view, $loc, $title); } else { if (is_callable(array($module, "show")) || $iscontroller) { // FIXME: we are checking here for a new MVC style controller or an old school module. We only need to perform // this check until we get the old modules all gone...until then we have the check and a lot of code duplication // in the if blocks below...oh well, that's life. if (!$iscontroller) { if (!$hide_menu && $loc->mod != "containermodule" && (call_user_func(array($module, "hasSources")) || $db->tableExists($loc->mod . "_config"))) { $container->permissions = array('administrate' => expPermissions::check('administrate', $loc) ? 1 : 0, 'configure' => expPermissions::check('configure', $loc) ? 1 : 0); if ($container->permissions['administrate'] || $container->permissions['configure']) { $container->randomizer = mt_rand(1, ceil(microtime(1))); $container->view = $view; $container->info['class'] = $loc->mod; $container->info['module'] = call_user_func(array($module, "name")); $container->info['source'] = $loc->src; $container->info['hasConfig'] = $db->tableExists($loc->mod . "_config"); $template = new template('containermodule', '_hardcoded_module_menu', $loc); $template->assign('container', $container); $template->output(); } } } else { // if we hit here we're dealing with a controller...not a module if (!$hide_menu) { $controller = expModules::getController($module); $container->permissions = array('administrate' => expPermissions::check('administrate', $loc) ? 1 : 0, 'configure' => expPermissions::check('configure', $loc) ? 1 : 0); if ($container->permissions['administrate'] || $container->permissions['configure']) { $container->randomizer = mt_rand(1, ceil(microtime(1))); $container->view = $view; $container->action = $params['action']; $container->info['class'] = $loc->mod; $container->info['module'] = $controller->displayname(); $container->info['source'] = $loc->src; $container->info['hasConfig'] = true; $template = new template('containermodule', '_hardcoded_module_menu', $loc); $template->assign('container', $container); $template->output(); } } } if ($iscontroller) { $params['src'] = $loc->src; $params['controller'] = $module; $params['view'] = $view; $params['moduletitle'] = $title; if (empty($params['action'])) { $params['action'] = $view; } renderAction($params); } else { call_user_func(array($module, "show"), $view, $loc, $title); } } else { echo sprintf(gt('The module "%s" was not found in the system.'), $module); } } }
/** * @param null $src * @param array $params * @return expController * */ function __construct($src = null, $params = array()) { // setup some basic information about this class $this->classinfo = new ReflectionClass($this); $this->classname = $this->classinfo->getName(); $this->baseclassname = substr($this->classinfo->getName(), 0, -10); $this->filepath = __realpath($this->classinfo->getFileName()); // figure out which "module" we belong to and setup view path information $controllerpath = explode('/', $this->filepath); $this->module_name = $controllerpath[count($controllerpath) - 2]; // set up the path to this module view files array_pop($controllerpath); $controllerpath[count($controllerpath) - 1] = 'views'; array_push($controllerpath, $this->baseclassname); $this->relative_viewpath = implode('/', array_slice($controllerpath, -3, 3)); $this->viewpath = BASE . 'framework/modules/' . $this->relative_viewpath; //grab the path to the module's assets array_pop($controllerpath); $controllerpath[count($controllerpath) - 1] = 'assets'; $this->asset_path = PATH_RELATIVE . 'framework/' . implode('/', array_slice($controllerpath, -3, 3)) . "/"; // figure out which model we're using and setup some info about it if (empty($this->basemodel_name)) { $this->basemodel_name = get_model_for_controller($this->classname); } $modelname = $this->basemodel_name; if (class_exists($modelname)) { $this->{$modelname} = new $modelname(null, false, false); $this->model_table = $this->{$modelname}->tablename; } else { $this->basemodel_name = 'expRecord'; $this->{$modelname} = new expRecord(null, false, false); $this->model_table = null; } // set the location data $this->loc = expCore::makeLocation($this->baseclassname, $src, null); // get this controllers config data if there is any $config = new expConfig($this->loc); $this->config = $config->config; $this->params = $params; }
/** * Routine to obtain online version information * * @return object */ private static function getOnlineVersion() { //FIXME we need a good installation to place this in $over = expCore::loadData('http://www.exponentcms.org/' . 'getswversion.php'); $onlineversion = json_decode($over)->data; if (empty($onlineversion)) { $onlineversion->major = 0; $onlineversion->minor = 0; $onlineversion->revision = 0; $onlineversion->type = ''; $onlineversion->iteration = ''; $onlineversion->builddate = ''; } return $onlineversion; }
// if ($config->enable_categories == 1) { // $ddopts = array(); // foreach ($db->selectObjects('category',"location_data='".serialize($loc)."' ORDER BY rank ASC") as $opt) { // $ddopts[$opt->id] = $opt->name; // } // // uasort($ddopts,'strnatcmp'); // if (!isset($item->category_id)) $item->category_id = null; // $form->registerAfter('eventend','category',gt('Category'),new dropdowncontrol($item->category_id,$ddopts)); // $form->registerBefore('category', null, '', new htmlcontrol('<hr size="1" />')); // } if ($config->enable_feedback == 1) { $form->registerBefore('submit', null, '', new htmlcontrol('<hr size="1" />')); $allforms = array(); $allforms[''] = gt('Disallow Feedback'); // $allforms = array_merge($allforms, expTemplate::listFormTemplates("forms/calendar")); $allforms = array_merge($allforms, expCore::buildNameList("forms", "forms/calendar", "tpl", "[!_]*")); $feedback_form = $item == null ? 0 : $item->feedback_form; $feedback_email = $item == null ? '' : $item->feedback_email; $form->registerAfter('eventend', 'feedback_form', gt('Feedback Form'), new dropdowncontrol($feedback_form, $allforms)); $form->registerAfter('feedback_form', 'feedback_email', gt('Feedback Email'), new textcontrol($feedback_email, 20)); $form->registerBefore('feedback_form', null, '', new htmlcontrol('<hr size="1" />')); } if (isset($_GET['id']) && $_GET['id'] != 0) { $form->unregister('submit'); // $buttons = "<div id=\"submitControl\" class=\"control buttongroup\"> "; // $buttons = "<input name=\"submitSubmit\" class=\"button\" type=\"submit\" value=\"Save\" onclick=\"if (checkRequired(this.form)) { if (validate(this.form)) { return true; } else { return false; } } else { return false; }\" /> "; $buttons = '<button name="submitSubmit" type="submit" id="' . $_GET['id'] . 'Submit" class="submit button awesome ' . BTN_SIZE . ' ' . BTN_COLOR; $buttons .= '" type="submit" value="' . "Save" . '"'; $buttons .= ' onclick="if (checkRequired(this.form)) { if (validate(this.form)) { return true; } else { return false; } } else { return false; }"'; $buttons .= ' />'; $buttons .= "Save";
# 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" "../../../.." */ if (!defined('EXPONENT')) { exit(''); } // 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'])) { $loc = expCore::makeLocation('calendarmodule', $_GET['src'], ''); $locsql = "(location_data='" . serialize($loc) . "'"; $config = $db->selectObject("calendarmodule_config", "location_data='" . serialize($loc) . "'"); if (!$config) { $config->enable_ical = 1; } if ($config->enable_ical) { if (isset($_GET['date_id'])) { // get single specific event only $dates = array($db->selectObject("eventdate", "id=" . intval($_GET['date_id']))); $Filename = "Event-" . $_GET['date_id']; } else { if (!empty($config->aggregate)) { $locations = unserialize($config->aggregate); foreach ($locations as $source) { $tmploc = null;
$view = "_sourcePicker"; $clickable_mods = null; // Show all $dest = null; if (expSession::is_set("source_select") && defined('SOURCE_SELECTOR')) { $source_select = expSession::get("source_select"); $view = $source_select["view"]; $module = $source_select["module"]; $clickable_mods = $source_select["showmodules"]; $dest = $source_select['dest']; } expSession::clearAllUsersSessionCache('containermodule'); $orphans = array(); foreach ($db->selectObjects("sectionref", "module='" . preg_replace('/[^A-Za-z0-9_]/', '', $_GET['module']) . "' AND refcount=0") as $orphan) { $obj = null; $loc = expCore::makeLocation($orphan->module, $orphan->source, $orphan->internal); if (class_exists($orphan->module)) { $modclass = $orphan->module; $mod = new $modclass(); if (class_exists($modclass)) { ob_start(); if (expModules::controllerExists($modclass)) { renderAction(array('controller' => $modclass, 'action' => 'showall', 'src' => $orphan->source)); } else { $mod->show("Default", $loc); } $obj->output = ob_get_contents(); ob_end_clean(); } $obj->info = array("module" => $mod->name(), "source" => $orphan->source, "hasContent" => $mod->hasContent(), "hasSources" => $mod->hasSources(), "hasViews" => $mod->hasViews(), "class" => $modclass, "clickable" => $clickable_mods == null || in_array($modclass, $clickable_mods) ? 1 : 0); } else {
<a href="<?php echo expCore::makeLink(array('section' => SITE_DEFAULT_SECTION)); ?> "><?php echo gt('Home'); ?> </a> | <a href="<?php echo expCore::makeLink(array('section' => 16)); ?> "><?php echo gt('Contact Us'); ?> </a> | <a href="<?php echo expCore::makeLink(array('section' => 10)); ?> "><?php echo gt('Site-map'); ?> </a> </div> <div id="header-login"> <?php expTheme::module(array("controller" => "login", "action" => "showlogin", "view" => "showlogin_expanded")); ?> </div> </div> <!-- navigation --> <div id="menu"> <?php
# # 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 # ################################################## // 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::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'); while (($file = readdir($dh)) !== false) { $botfile = BASE . 'framework/modules-1/bots/bots/' . $file; if (is_file($botfile) && is_readable($botfile) && substr($file, -4) == '.php') { include_once $botfile; $botname = substr($file, 0, -4); $bot = $db->selectObject('bots', "name='" . $botname . "'"); if (empty($bot)) { $botobj = new $botname(); $bot = null; $bot->name = $botname;
# # This file is part of Exponent # # 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 # ################################################## if (!defined('EXPONENT')) { exit(''); } //if ($user->is_acting_admin == 1) { if (expPermissions::check('manage', expCore::makeLocation('navigationmodule', '', intval($_GET['id'])))) { $section = $db->selectObject('section', 'id=' . intval($_GET['id'])); if ($section) { navigationmodule::removeLevel($section->id); $db->decrement('section', 'rank', 1, 'rank > ' . $section->rank . ' AND parent=' . $section->parent); $section->parent = -1; $db->updateObject($section, 'section'); expSession::clearAllUsersSessionCache('navigationmodule'); expHistory::back(); } else { echo SITE_403_HTML; } } else { echo SITE_404_HTML; }
public function manage_group_memberships() { global $db, $user; expHistory::set('manageable', $this->params); $memb = $db->selectObject('groupmembership', 'member_id=' . $user->id . ' AND group_id=' . $this->params['id'] . ' AND is_admin=1'); $perm_level = 0; if ($memb) { $perm_level = 1; } if (expPermissions::check('user_management', expCore::makeLocation('administrationmodule'))) { $perm_level = 2; } $group = $db->selectObject('group', 'id=' . $this->params['id']); $users = user::getAllUsers(0); $members = array(); $admins = array(); foreach ($db->selectObjects('groupmembership', 'group_id=' . $group->id) as $m) { $members[] = $m->member_id; if ($m->is_admin == 1) { $admins[] = $m->member_id; } } for ($i = 0; $i < count($users); $i++) { if (in_array($users[$i]->id, $members)) { $users[$i]->is_member = 1; } else { $users[$i]->is_member = 0; } if (in_array($users[$i]->id, $admins)) { $users[$i]->is_admin = 1; } else { $users[$i]->is_admin = 0; } } //$limit = empty($this->config['limit']) ? 10 : $this->config['limit']; $order = empty($this->config['order']) ? 'username' : $this->config['order']; $page = new expPaginator(array('records' => $users, 'where' => 1, 'limit' => 9999, 'order' => $order, 'controller' => $this->baseclassname, 'action' => $this->params['action'], 'columns' => array('Username' => 'username', 'First Name' => 'firstname', 'Last Name' => 'lastname', 'Is Member' => 'is_member', 'Is Admin' => 'is_admin'))); assign_to_template(array('page' => $page, 'group' => $group, 'users' => $users, 'canAdd' => count($members) < count($users) ? 1 : 0, 'hasMember' => count($members) > 0 ? 1 : 0, 'perm_level' => $perm_level)); }
* 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 eDebug($var, $halt = false) { if (DEVELOPMENT) { echo "<xmp>"; print_r($var); echo "</xmp>"; if ($halt) { die;
for ($i = 0; $i < $totaldays; $i++) { $start = mktime(0, 0, 0, $info['mon'], $info['mday'] + $i, $info['year']); // if ( $viewparams['range'] == "week" ) { // $start = mktime(0,0,0,$info['mon'],$info['mday']+$i,$info['year']); // } else if ( $viewparams['range'] == "twoweek" ) { // $start = mktime(0,0,0,$info['mon'],$info['mday']+$i,$info['year']); // // $start = $startperiod + ($i*86400); // } else { // range = month // $start = mktime(0,0,0,$info['mon'],$i,$info['year']); // } //$edates = $db->selectObjects("eventdate",$locsql." AND date = '".$start."'"); $edates = $db->selectObjects("eventdate", $locsql . " AND date = {$start}"); $days[$start] = array(); $days[$start] = calendarmodule::_getEventsForDates($edates); for ($j = 0; $j < count($days[$start]); $j++) { $thisloc = expCore::makeLocation($loc->mod, $loc->src, $days[$start][$j]->id); $days[$start][$j]->permissions = array("administrate" => expPermissions::check("administrate", $thisloc) || expPermissions::check("administrate", $loc), "edit" => expPermissions::check("edit", $thisloc) || expPermissions::check("edit", $loc), "delete" => expPermissions::check("delete", $thisloc) || expPermissions::check("delete", $loc)); } $counts[$start] = count($days[$start]); $count += count($days[$start]); $days[$start] = expSorter::sort(array('array' => $days[$start], 'sortby' => 'eventstart', 'order' => 'ASC')); } $template->assign("days", $days); $template->assign("counts", $counts); $template->assign("start", $startperiod); $template->assign("totaldays", $totaldays); // } else if ($viewparams['type'] == "monthly") { // $monthly = array(); // $counts = array(); // $info = getdate($time); // $nowinfo = getdate(time());
/** exdoc * * Looks through the module's views directory and returns * all non-internal views that are found there. * Returns an array of all standard view names. * This array is unsorted. * * @param string $module The classname of the module to get views for. * @return array * @node Subsystems:Template */ public static function listModuleViews($module) { //FIXME only used by containermodule edit action and administrationmodule examplecontent action return expCore::buildNameList("modules", $module, "tpl", "[!_]*"); }
# # 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 # ################################################## if (!defined('EXPONENT')) { exit(''); } //$nav = navigationmodule::levelTemplate(intval($_REQUEST['id'], 0)); $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $nav = $db->selectObjects('section', 'parent=' . $id, 'rank'); $manage_all = false; if (expPermissions::check('manage', expCore::makeLocation('navigationmodule', '', $id))) { $manage_all = true; } $navcount = count($nav); for ($i = 0; $i < $navcount; $i++) { if ($manage_all || expPermissions::check('manage', expCore::makeLocation('navigationmodule', '', $nav[$i]->id))) { $nav[$i]->manage = 1; } else { $nav[$i]->manage = 0; } $nav[$i]->link = expCore::makeLink(array('section' => $nav[$i]->id), '', $nav[$i]->sef_name); } $nav[$navcount - 1]->last = true; echo expJavascript::ajaxReply(201, '', $nav);
// Sanitize the parent parameter up here to make things more clear and straightforward. $_GET['parent'] = intval($_GET['parent']); // May have been passed a '0', indicating that we want a top-level section if ($_GET['parent'] <= 0) { // Set $parent->id to passed value, so that $parent is not null. The view will use this information // to output the appropriate messages to the user. $parent->id = $_GET['parent']; } else { // Passed a non-zero parent id - Adding a subsection. Try to read // the parent from the database. $parent = $db->selectObject('section', 'id=' . $_GET['parent']); } } // Check to see that A) a parent ID was passed in GET, and B) the id was valid if ($parent) { if (expPermissions::check('manage', expCore::makeLocation('navigationmodule', '', $parent->id))) { // For this action, all we need to do is output a basically // non-variable template the asks the user what type of page // they want to add to the site Navigation. $template = new template('navigationmodule', '_add_whichtype'); // We do, however need to know if there are any Pagesets. $template->assign('havePagesets', $db->countObjects('section_template', 'parent=0') && $parent->id >= 0); // We also need to know if there are any standalone pages. $template->assign('haveStandalone', $db->countObjects('section', 'parent=-1') && $parent->id >= 0); // Assign the parent we were passed, so that it can propagated along to the actual form action. $template->assign('parent', $parent); $template->assign('isAdministrator', $user && ($user->is_admin || $user->is_acting_admin) ? 1 : 0); $template->output(); } else { // Current user is not allowed to manage sections. Throw a 403. echo SITE_403_HTML;
$old_parent = null; if (isset($_POST['id'])) { // Saving an existing content page. Read it from the database. $section = $db->selectObject('section', 'id=' . intval($_POST['id'])); if ($section) { $old_parent = $section->parent; $check_id = $section->id; } } echo $old_parent; // Update the section from the _POST data. $section = section::update($_POST, $section); if ($check_id == -1) { $check_id = $section->parent; } if ($check_id != -1 && expPermissions::check('manage', expCore::makeLocation('navigationmodule', '', $check_id))) { // make sure the SEF name is valid global $router; if (empty($section->sef_name)) { $section->sef_name = $router->encode($section->name); } if (!section::isValidName($section->sef_name)) { expValidator::failAndReturnToForm('You have invalid characters in the SEF Name field.'); } if (section::isDuplicateName($section)) { expValidator::failAndReturnToForm(gt('The name specified in the SEF Name field is a duplicate of an existing page.')); } if (isset($section->id)) { if ($section->parent != $old_parent) { // Old_parent id was different than the new parent id. Need to decrement the ranks // of the old children (after ours), and then add
static function show($view, $loc = null, $title = '') { global $user; global $db; $locsql = "(location_data='" . serialize($loc) . "'"; $config = $db->selectObject("calendarmodule_config", "location_data='" . serialize($loc) . "'"); if (!empty($config->aggregate)) { $locations = unserialize($config->aggregate); foreach ($locations as $source) { $tmploc = null; $tmploc->mod = 'calendarmodule'; $tmploc->src = $source; $tmploc->int = ''; $locsql .= " OR location_data='" . serialize($tmploc) . "'"; } } $locsql .= ')'; $template = new template('calendarmodule', $view, $loc); if ($title == '') { $title = $db->selectValue('container', 'title', "internal='" . serialize($loc) . "'"); } $template->assign('moduletitle', $title); $canviewapproval = false; $inapproval = false; global $user; if ($user) { $canviewapproval = expPermissions::check("approve", $loc) || expPermissions::check("manage_approval", $loc); } if ($db->countObjects("calendar", "location_data='" . serialize($loc) . "' AND approved!=1")) { foreach ($db->selectObjects("calendar", "location_data='" . serialize($loc) . "' AND approved!=1") as $c) { if ($c->poster == $user->id) { $canviewapproval = true; } } $inapproval = true; } $time = isset($_GET['time']) ? $_GET['time'] : time(); $template->assign("time", $time); $viewparams = $template->viewparams; if ($viewparams === null) { $viewparams = array("type" => "default"); } if ($viewparams['type'] == "minical") { $monthly = expDateTime::monthlyDaysTimestamp($time); $info = getdate($time); $timefirst = mktime(12, 0, 0, $info['mon'], 1, $info['year']); $now = getdate(time()); $currentday = $now['mday']; $endofmonth = date('t', $time); foreach ($monthly as $weekNum => $week) { foreach ($week as $dayNum => $day) { if ($dayNum == $now['mday']) { $currentweek = $weekNum; } if ($dayNum <= $endofmonth) { $monthly[$weekNum][$dayNum]['number'] = $monthly[$weekNum][$dayNum]['ts'] != -1 ? $db->countObjects("eventdate", $locsql . " AND date = " . $day['ts']) : -1; } } } //eDebug($monthly); $template->assign("monthly", $monthly); $template->assign("currentweek", $currentweek); $template->assign("currentday", $currentday); $template->assign("now", $timefirst); $prevmonth = mktime(0, 0, 0, date("m", $timefirst) - 1, date("d", $timefirst) + 10, date("Y", $timefirst)); $nextmonth = mktime(0, 0, 0, date("m", $timefirst) + 1, date("d", $timefirst) + 10, date("Y", $timefirst)); $template->assign("prevmonth", $prevmonth); $template->assign("thismonth", $timefirst); $template->assign("nextmonth", $nextmonth); } else { if ($viewparams['type'] == "byday") { // Remember this is the code for weekly view and monthly listview // Test your fixes on both views before submitting your changes to cvs $startperiod = 0; $totaldays = 0; if ($viewparams['range'] == "week") { $startperiod = expDateTime::startOfWeekTimestamp($time); $totaldays = 7; $template->assign("prev_timestamp3", strtotime('-21 days', $startperiod)); $template->assign("prev_timestamp2", strtotime('-14 days', $startperiod)); $template->assign("prev_timestamp", strtotime('-7 days', $startperiod)); $template->assign("next_timestamp", strtotime('+7 days', $startperiod)); $template->assign("next_timestamp2", strtotime('+14 days', $startperiod)); $template->assign("next_timestamp3", strtotime('+21 days', $startperiod)); } else { if ($viewparams['range'] == "twoweek") { $time = time(); $startperiod = expDateTime::startOfWeekTimestamp($time); $totaldays = 14; $template->assign("prev_timestamp3", strtotime('-42 days', $startperiod)); $template->assign("prev_timestamp2", strtotime('-28 days', $startperiod)); $template->assign("prev_timestamp", strtotime('-14 days', $startperiod)); $template->assign("next_timestamp", strtotime('+14 days', $startperiod)); $template->assign("next_timestamp2", strtotime('+28 days', $startperiod)); $template->assign("next_timestamp3", strtotime('+42 days', $startperiod)); } else { // range = month $startperiod = expDateTime::startOfMonthTimestamp($time); $totaldays = date('t', $time); $template->assign("prev_timestamp3", strtotime('-3 months', $startperiod)); $template->assign("prev_timestamp2", strtotime('-2 months', $startperiod)); $template->assign("prev_timestamp", strtotime('-1 months', $startperiod)); $template->assign("next_timestamp", strtotime('+1 months', $startperiod)); $template->assign("next_timestamp2", strtotime('+2 months', $startperiod)); $template->assign("next_timestamp3", strtotime('+3 months', $startperiod)); } } $days = array(); // added per Ignacio $endofmonth = date('t', $time); for ($i = 1; $i <= $totaldays; $i++) { $info = getdate($time); if ($viewparams['range'] == "week") { $start = mktime(12, 0, 0, $info['mon'], $i, $info['year']); } else { if ($viewparams['range'] == "twoweek") { $start = mktime(12, 0, 0, $info['mon'], $info['mday'] + ($i - 1), $info['year']); // $start = $startperiod + ($i*86400); } else { // range = month $start = mktime(0, 0, 0, $info['mon'], $i, $info['year']); } } $edates = $db->selectObjects("eventdate", $locsql . " AND date = '" . $start . "'"); $days[$start] = calendarmodule::_getEventsForDates($edates); for ($j = 0; $j < count($days[$start]); $j++) { $thisloc = expCore::makeLocation($loc->mod, $loc->src, $days[$start][$j]->id); $days[$start][$j]->permissions = array("administrate" => expPermissions::check("administrate", $thisloc) || expPermissions::check("administrate", $loc), "edit" => expPermissions::check("edit", $thisloc) || expPermissions::check("edit", $loc), "delete" => expPermissions::check("delete", $thisloc) || expPermissions::check("delete", $loc)); } $days[$start] = expSorter::sort(array('array' => $days[$start], 'sortby' => 'eventstart', 'order' => 'ASC')); } $template->assign("days", $days); } else { if ($viewparams['type'] == "monthly") { $monthly = array(); $counts = array(); $info = getdate($time); $nowinfo = getdate(time()); if ($info['mon'] != $nowinfo['mon']) { $nowinfo['mday'] = -10; } // Grab non-day numbers only (before end of month) $week = 0; $currentweek = -1; $timefirst = mktime(12, 0, 0, $info['mon'], 1, $info['year']); $infofirst = getdate($timefirst); $monthly[$week] = array(); // initialize for non days $counts[$week] = array(); if ($infofirst['wday'] == 0 && DISPLAY_START_OF_WEEK == 1) { for ($i = -6; $i < 1 - DISPLAY_START_OF_WEEK; $i++) { $monthly[$week][$i] = array(); $counts[$week][$i] = -1; } $weekday = $infofirst['wday'] + 7; // day number in grid. if 7+, switch weeks } else { for ($i = 1 - $infofirst['wday']; $i < 1 - DISPLAY_START_OF_WEEK; $i++) { $monthly[$week][$i] = array(); $counts[$week][$i] = -1; } $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks } // Grab day counts (deprecated, handled by the date function) // $endofmonth = expDateTime::endOfMonthDay($time); $endofmonth = date('t', $time); for ($i = 1; $i <= $endofmonth; $i++) { $start = mktime(0, 0, 0, $info['mon'], $i, $info['year']); if ($i == $nowinfo['mday']) { $currentweek = $week; } #$monthly[$week][$i] = $db->selectObjects("calendar","location_data='".serialize($loc)."' AND (eventstart >= $start AND eventend <= " . ($start+86399) . ") AND approved!=0"); //$dates = $db->selectObjects("eventdate",$locsql." AND date = $start"); $dates = $db->selectObjects("eventdate", $locsql . " AND date = '" . $start . "'"); $monthly[$week][$i] = calendarmodule::_getEventsForDates($dates); $counts[$week][$i] = count($monthly[$week][$i]); if ($weekday >= 6 + DISPLAY_START_OF_WEEK) { $week++; $monthly[$week] = array(); // allocate an array for the next week $counts[$week] = array(); $weekday = DISPLAY_START_OF_WEEK; } else { $weekday++; } } // Grab non-day numbers only (after end of month) for ($i = 1; $weekday && $i < 8 + DISPLAY_START_OF_WEEK - $weekday; $i++) { $monthly[$week][$i + $endofmonth] = array(); $counts[$week][$i + $endofmonth] = -1; } //eDebug($monthly); $template->assign("currentweek", $currentweek); $template->assign("monthly", $monthly); $template->assign("counts", $counts); $template->assign("prevmonth3", strtotime('-3 months', $timefirst)); $template->assign("prevmonth2", strtotime('-2 months', $timefirst)); $template->assign("prevmonth", strtotime('-1 months', $timefirst)); $template->assign("nextmonth", strtotime('+1 months', $timefirst)); $template->assign("nextmonth2", strtotime('+2 months', $timefirst)); $template->assign("nextmonth3", strtotime('+3 months', $timefirst)); $template->assign("now", $timefirst); $template->assign("today", strtotime('today') - 43200); } else { if ($viewparams['type'] == "administration") { // Check perms and return if cant view if ($viewparams['type'] == "administration" && !$user) { return; } $continue = expPermissions::check("administrate", $loc) || expPermissions::check("post", $loc) || expPermissions::check("edit", $loc) || expPermissions::check("delete", $loc) || expPermissions::check("approve", $loc) || expPermissions::check("manage_approval", $loc) ? 1 : 0; $dates = $db->selectObjects("eventdate", $locsql . " AND date >= '" . expDateTime::startOfDayTimestamp(time()) . "'"); $items = calendarmodule::_getEventsForDates($dates); if (!$continue) { foreach ($items as $i) { $iloc = expCore::makeLocation($loc->mod, $loc->src, $i->id); if (expPermissions::check("edit", $iloc) || expPermissions::check("delete", $iloc) || expPermissions::check("administrate", $iloc)) { $continue = true; } } } if (!$continue) { return; } for ($i = 0; $i < count($items); $i++) { $thisloc = expCore::makeLocation($loc->mod, $loc->src, $items[$i]->id); if ($user && $items[$i]->poster == $user->id) { $canviewapproval = 1; } $items[$i]->permissions = array("administrate" => expPermissions::check("administrate", $thisloc) || expPermissions::check("administrate", $loc), "edit" => expPermissions::check("edit", $thisloc) || expPermissions::check("edit", $loc), "delete" => expPermissions::check("delete", $thisloc) || expPermissions::check("delete", $loc)); } $items = expSorter::sort(array('array' => $items, 'sortby' => 'eventstart', 'order' => 'ASC')); $template->assign("items", $items); } else { if ($viewparams['type'] == "default") { if (!isset($viewparams['range'])) { $viewparams['range'] = "all"; } $items = null; $dates = null; $day = expDateTime::startOfDayTimestamp(time()); $sort_asc = true; // For the getEventsForDates call $moreevents = false; switch ($viewparams['range']) { case "all": $dates = $db->selectObjects("eventdate", $locsql); break; case "upcoming": if (!empty($config->rss_limit) && $config->rss_limit > 0) { $eventlimit = " AND date <= " . ($day + $config->rss_limit * 86400); } else { $eventlimit = ""; } $dates = $db->selectObjects("eventdate", $locsql . " AND date >= " . $day . $eventlimit . " ORDER BY date ASC "); // $moreevents = count($dates) < $db->countObjects("eventdate",$locsql." AND date >= $day"); break; case "past": $dates = $db->selectObjects("eventdate", $locsql . " AND date < {$day} ORDER BY date DESC "); // $moreevents = count($dates) < $db->countObjects("eventdate",$locsql." AND date < $day"); $sort_asc = false; break; case "today": $dates = $db->selectObjects("eventdate", $locsql . " AND date = {$day}"); break; case "next": $dates = array($db->selectObject("eventdate", $locsql . " AND date >= {$day}")); break; case "month": $dates = $db->selectObjects("eventdate", $locsql . " AND date >= " . expDateTime::startOfMonthTimestamp(time()) . " AND date <= " . expDateTime::endOfMonthTimestamp(time())); break; } $items = calendarmodule::_getEventsForDates($dates, $sort_asc, isset($template->viewconfig['featured_only']) ? true : false); // Upcoming events can be configured to show a specific number of events. // The previous call gets all events in the future from today // If configured, cut the array to the configured number of events // if ($template->viewconfig['num_events']) { // switch ($viewparams['range']) { // case "upcoming": // case "past": // $moreevents = $template->viewconfig['num_events'] < count($items); // break; // } // $items = array_slice($items, 0, $template->viewconfig['num_events']); //eDebug($items); // } for ($i = 0; $i < count($items); $i++) { $thisloc = expCore::makeLocation($loc->mod, $loc->src, $items[$i]->id); if ($user && $items[$i]->poster == $user->id) { $canviewapproval = 1; } $items[$i]->permissions = array('administrate' => expPermissions::check('administrate', $thisloc) || expPermissions::check('administrate', $loc), 'edit' => expPermissions::check('edit', $thisloc) || expPermissions::check('edit', $loc), 'delete' => expPermissions::check('delete', $thisloc) || expPermissions::check('delete', $loc)); } //Get the image file if there is one. // for ($i = 0; $i < count($items); $i++) { // if (isset($items[$i]->file_id) && $items[$i]->file_id > 0) { // $file = $db->selectObject('file', 'id='.$items[$i]->file_id); // $items[$i]->image_path = $file->directory.'/'.$file->filename; // } // } //eDebug($items); $template->assign('items', $items); $template->assign('moreevents', $moreevents); } } } } } $template->assign('in_approval', $inapproval); $template->assign('canview_approval_link', $canviewapproval); $template->register_permissions(array('administrate', 'configure', 'post', 'edit', 'delete', 'manage_approval', 'manage_categories'), $loc); // $cats = $db->selectObjectsIndexedArray("category","location_data='".serialize($loc)."'"); // $cats = $db->selectObjectsIndexedArray("category"); // $cats[0] = null; // $cats[0]->name = '<i>'.gt('No category').'</i>'; // $cats[0]->color = "#000000"; // $template->assign("categories",$cats); if (!$config) { // $config->enable_categories = 0; $config->enable_ical = 1; } $template->assign("config", $config); if (!isset($config->enable_ical)) { $config->enable_ical = 1; } $template->assign("enable_ical", $config->enable_ical); //Get the tags that have been selected to be shown in the grouped by tag views // if (isset($config->show_tags)) { // $available_tags = unserialize($config->show_tags); // } else { // $available_tags = array(); // } // if (isset($items) && is_array($items)) { // for ($i = 0; $i < count($items); $i++) { // //Get the tags for this calendar event // $selected_tags = array(); // $tag_ids = unserialize($items[$i]->tags); // if(is_array($tag_ids)) {$selected_tags = $db->selectObjectsInArray('tags', $tag_ids, 'name');} // $items[$i]->tags = $selected_tags; // //If this module was configured to group the newsitems by tags, then we need to change the data array a bit // if (isset($config->group_by_tags) && $config->group_by_tags == true) { // $grouped_news = array(); // foreach($items[$i]->tags as $tag) { // if (in_array($tag->id, $available_tags) || count($available_tags) == 0) { // if (!isset($grouped_news[$tag->name])) { $grouped_news[$tag->name] = array();} // array_push($grouped_news[$tag->name],$items[$i]); // } // } // } // } // } $template->output(); }
function copyContent($oloc, $nloc, $section = 0) { global $db; foreach ($db->selectObjects('container', "external='" . serialize($oloc) . "'") as $c) { unset($c->id); $c->external = serialize($nloc); if (!$c->is_existing == 1) { // Copy over content to a new source $oldinternal = unserialize($c->internal); $iloc = expCore::makeLocation($oldinternal->mod, '@random' . uniqid('')); $c->internal = serialize($iloc); $db->insertObject($c, 'container'); // Now copy over content if (call_user_func(array($oldinternal->mod, 'hasContent')) == true) { call_user_func(array($oldinternal->mod, 'copyContent'), $oldinternal, $iloc); // Incrementors! expCore::incrementLocationReference($iloc, $section); // SECTION } } else { $db->insertObject($c, 'container'); expCore::incrementLocationReference($iloc, $section); // SECTION } } }
function show($view, $loc = null) { global $db; // require_once(BASE."framework/core/subsystems/forms/baseform.php"); // require_once(BASE."framework/core/subsystems/forms/form.php"); if (defined('PREVIEW_READONLY') && !defined('SELECTOR')) { // Pass } else { $f = null; $f = $db->selectObject("formbuilder_form", "location_data='" . serialize($loc) . "'"); if (!$f) { //Create a form if it's missing... $f->name = "New Form"; $f->description = ""; $f->location_data = serialize($loc); $f->table_name = ""; $f->is_email = 0; $f->is_saved = 0; $f->submitbtn = gt('Submit'); $f->resetbtn = gt('Reset'); $f->response = gt('Your form has been submitted'); $f->subject = gt('Submitted form from site'); $frmid = $db->insertObject($f, "formbuilder_form"); //Create Default Report; $rpt->name = gt('Default Report'); $rpt->description = ""; $rpt->location_data = $f->location_data; $rpt->text = ""; $rpt->column_names = ""; $rpt->form_id = $frmid; $db->insertObject($rpt, "formbuilder_report"); $f->id = $frmid; } $floc = unserialize($f->location_data); $controls = $db->selectObjects("formbuilder_control", "form_id=" . $f->id); $controls = expSorter::sort(array('array' => $controls, 'sortby' => 'rank', 'order' => 'ASC')); $form = new form(); $data = expSession::get('formmodule_data_' . $f->id); foreach ($controls as $c) { $ctl = unserialize($c->data); $ctl->_id = $c->id; $ctl->_readonly = $c->is_readonly; if (!empty($data[$c->name])) { $ctl->default = $data[$c->name]; } $form->register($c->name, $c->caption, $ctl); } $form->register("submit", "", new buttongroupcontrol($f->submitbtn, $f->resetbtn, "")); //$form->meta("action","submit_form"); $form->meta("action", "confirm_form"); $form->meta("m", $floc->mod); $form->meta("s", $floc->src); $form->meta("i", $floc->int); $form->meta("id", $f->id); $formmsg = ''; $form->location(expCore::makeLocation("formbuilder", $floc->src, $floc->int)); if (count($controls) == 0) { $form->controls['submit']->disabled = true; $formmsg .= gt('This form is blank. Select "Edit Form" to add input fields.') . '<br>'; } if ($f->is_saved == 0 && $f->is_email == 0) { $form->controls['submit']->disabled = true; $formmsg .= gt('There are no actions assigned to this form. Select "Edit Form Settings" then select "Email Form" and/or "Save to Database".'); } $count = $db->countObjects("formbuilder_" . $f->table_name); $template = new template("formmodule", $view, $loc); $template->assign("moduletitle", $f->name); $template->assign("description", $f->description); if ($formmsg) { flash('notice', $formmsg); } $template->assign("form_html", $form->toHTML($f->id)); $template->assign("form", $f); $template->assign("count", $count); $template->register_permissions(array("administrate", "editform", "editformsettings", "editreport", "viewdata", "editdata", "deletedata"), $loc); $template->output(); } }
$cloc = unserialize($container->external); $cloc->int = $container->id; } } else { $container->rank = $_GET['rank']; } $loc->src = urldecode($loc->src); if (expPermissions::check('edit_module', $loc) || expPermissions::check('add_module', $loc) || $iloc != null && expPermissions::check('administrate', $iloc) || $cloc != null && expPermissions::check('delete_module', $cloc)) { # # Initialize Container, in case its null # $secref = null; if (!isset($container->id)) { $secref->description = ''; $container->view = ''; $container->internal = expCore::makeLocation(); $container->title = ''; $container->rank = $_GET['rank']; $container->is_private = 0; } else { $container->internal = unserialize($container->internal); $secref = $db->selectObject('sectionref', "module='" . $container->internal->mod . "' AND source='" . $container->internal->src . "'"); } expSession::clearAllUsersSessionCache('containermodule'); $template = new template('containermodule', '_form_edit', $loc); // $template->assign('rerank', (isset($_GET['rerank']) ? 1 : 0) ); $template->assign('rerank', isset($_GET['rerank']) ? $_GET['rerank'] : 0); $template->assign('container', $container); $template->assign('locref', $secref); $template->assign('is_edit', isset($container->id) ? 1 : 0); $template->assign('can_activate_modules', $user->is_acting_admin);
################################################## # # Copyright (c) 2004-2011 OIC Group, Inc. # Written and Designed by James Hunt # # This file is part of Exponent # # 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 # ################################################## if (!defined('EXPONENT')) { exit(''); } if (expPermissions::check('database', expCore::makeLocation('administrationmodule'))) { $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 'start'; $exporter = isset($_REQUEST['exporter']) ? $_REQUEST['exporter'] : ''; $file = BASE . 'framework/modules-1/exporter/exporters/' . $exporter . '/' . $page . '.php'; if ($exporter != '' && is_readable($file) && is_file($file)) { include $file; } else { echo SITE_404_HTML; } } else { echo SITE_403_HTML; }