function update($blockinfo) { $vars = BlockUtil::varsFromContent($blockinfo['content']); $vars['page'] = FormUtil::getPassedValue('page', 0, 'POST'); $blockinfo['content'] = BlockUtil::varsToContent($vars); return $blockinfo; }
/** * Handle module install event "installer.module.installed". * Receives $modinfo as $args * * @param Zikula_Event $event * * @return void */ public static function moduleInstall(Zikula_Event $event) { $mod = $event['name']; // determine search capability if (ModUtil::apiFunc($mod, 'search', 'info')) { // get all search blocks $blocks = BlockUtil::getBlocksInfo(); foreach ($blocks as $block) { $block = $block->toArray(); if ($block['bkey'] != 'Search') { continue; } $content = BlockUtil::varsFromContent($block['content']); if (!isset($content['active'])) { $content['active'] = array(); } $content['active'][$mod] = 1; $block['content'] = BlockUtil::varsToContent($content); ModUtil::apiFunc('Blocks', 'admin', 'update', $block); } } }
public function update($blockinfo) { $vars = BlockUtil::varsFromContent($blockinfo['content']); $vars['root'] = FormUtil::getPassedValue('root', 0, 'POST'); $vars['usecaching'] = (bool) FormUtil::getPassedValue('usecaching', false, 'POST'); $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('block/menu.tpl'); return $blockinfo; }
/** * update block settings * * @author Albert P�rez Monfort (intraweb@xtec.cat) * @param array $blockinfo a blockinfo structure * @return $blockinfo the modified blockinfo structure */ public function update($row) { $vars['weburlvalue'] = FormUtil::getPassedValue('weburlvalue', -1, 'POST'); $vars['widthvalue'] = FormUtil::getPassedValue('widthvalue', -1, 'POST'); $vars['heightvalue'] = FormUtil::getPassedValue('heightvalue', -1, 'POST'); $vars['titlevalue'] = FormUtil::getPassedValue('titlevalue', -1, 'POST'); $vars['notunregvalue'] = FormUtil::getPassedValue('notunregvalue', -1, 'POST'); $vars['scrollvalue'] = FormUtil::getPassedValue('scrollvalue', -1, 'POST'); $row['content'] = BlockUtil::varsToContent($vars); return $row; }
/** * Update block settings. * * @param array $blockinfo the blockinfo structure * * @return array the modified blockinfo structure. */ public function update($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); $vars['objectType'] = $this->request->request->filter('objecttype', 'collection', FILTER_SANITIZE_STRING); $vars['sorting'] = $this->request->request->filter('sorting', 'default', FILTER_SANITIZE_STRING); $vars['amount'] = (int) $this->request->request->filter('amount', 5, FILTER_VALIDATE_INT); $vars['template'] = $this->request->request->get('template', ''); $vars['customTemplate'] = $this->request->request->get('customtemplate', ''); $vars['filter'] = $this->request->request->get('filter', ''); $controllerHelper = new MUVideo_Util_Controller($this->serviceManager); if (!in_array($vars['objectType'], $controllerHelper->getObjectTypes('block'))) { $vars['objectType'] = $controllerHelper->getDefaultObjectType('block'); } $primaryRegistry = ModUtil::apiFunc('MUVideo', 'category', 'getPrimaryProperty', array('ot' => $vars['objectType'])); $vars['catIds'] = array($primaryRegistry => array()); if (in_array($vars['objectType'], $this->categorisableObjectTypes)) { $vars['catIds'] = ModUtil::apiFunc('MUVideo', 'category', 'retrieveCategoriesFromRequest', array('ot' => $vars['objectType'])); } // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('block/itemlist_display.tpl'); $this->view->clear_cache('block/itemlist_' . ucfirst($vars['objectType']) . '_display.tpl'); $this->view->clear_cache('block/itemlist_display_description.tpl'); $this->view->clear_cache('block/itemlist_' . ucfirst($vars['objectType']) . '_display_description.tpl'); return $blockinfo; }
/** * update block settings * * @param array $blockinfo A blockinfo structure. * * @return array The modified blockinfo structure. */ public function update($blockinfo) { // get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // alter the corresponding variable $vars['pid'] = (int)FormUtil::getPassedValue('pid', null, 'POST'); // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('block/pageslist.tpl'); return $blockinfo; }
/** * update block settings * * @param array $blockinfo a blockinfo structure * @return $blockinfo the modified blockinfo structure */ public function update($blockinfo) { // list of vars that don't need to be saved $search_reserved_vars = array('authid', 'csrftoken', 'bid', 'title', 'positions', 'language', 'submit', 'refresh', 'filter', 'type', 'functions', 'customargs'); // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); foreach ($_POST as $key => $value) { if (in_array($key, $search_reserved_vars)) { continue; } $vars[$key] = $value; } // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('search_block_search.tpl'); // and clear the theme cache Zikula_View_Theme::getInstance()->clear_cache(); return($blockinfo); }
public function update($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // alter the corresponding variable $vars['format'] = FormUtil::getPassedValue('format', 1, 'POST'); // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('theme_block_themeswitcher.tpl'); // and clear the theme cache Zikula_View_Theme::getInstance()->clear_cache(); return $blockinfo; }
function update($blockinfo) { // Security check if (!SecurityUtil::checkPermission("IWstats:usersonlineblock:", "::", ACCESS_ADMIN)) { return; } $refreshtime = (int) FormUtil::getPassedValue('refreshtime', 100, 'POST'); $sessiontime = (int) FormUtil::getPassedValue('sessiontime', 100, 'POST'); $unsee = (int) FormUtil::getPassedValue('unsee', 0, 'POST'); // default values in case they are not correct $refreshtime = (!is_numeric($refreshtime) || $refreshtime > 100) ? $refreshtime : 100; $sessiontime = (!is_numeric($sessiontime) || $sessiontime < 10 || $sessiontime > 120) ? 100 : $sessiontime; $unsee = ($unsee != 1) ? 0 : 1; // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // alter the corresponding variable $vars['refreshtime'] = $refreshtime; $vars['sessiontime'] = $sessiontime; $vars['unsee'] = $unsee; // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); return $blockinfo; }
/** * Display an existing Zikula block. * * The block is choosen by its id. * The block state is ignored, so even deactivated blocks can be shown. * The parameters specific to the block can be overridden. * * Available parameters: * - id (numeric) ID of the block to be displayed * - name (string) Name of the block to be displayed (not used) * - title (string) Overrides the block title * - position (string) Overrides the block position * - assign (string) The name of a template variable to which the output * of the block is assigned, instead of sending the * output to the template (optional) * - Any additional parameters are passed to the block as block variables, * overriding any existing values. * * Examples: * * Insert the block with block ID (bid) 4 at the current position in the template * * <samp>{block id=4}</samp> * * Insert the block with block ID (bid) 5 at the current position in the * template, overriding the block's title. * * <samp>{block id=5 title='My Block 5'}</samp> * * Store the output generated by retrieving the block with ID 6 in the template * variable $myBlockContents. * * <samp>{block id=6 assign='myBlockContents'}</samp> * * @param array $params All attributes passed to this function from the template. * @param Zikula_View $view Reference to the {@link Zikula_View} object. * * @return string The block. * * @todo the attribute 'name' is not used. * */ function smarty_function_block($params, Zikula_View $view) { $bid = isset($params['bid']) ? (int) $params['bid'] : 0; $name = isset($params['name']) ? $params['name'] : null; $title = isset($params['title']) ? $params['title'] : null; $position = isset($params['position']) ? $params['position'] : null; $assign = isset($params['assign']) ? $params['assign'] : null; // unset the variables for the function, leaving the ones for the block unset($params['bid']); unset($params['name']); unset($params['title']); unset($params['position']); unset($params['assign']); if (!$bid) { $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('pnblock', 'bid'))); return false; } // render the block $blockinfo = BlockUtil::getBlockInfo($bid); // overwrite block title if ($title) { $blockinfo['title'] = $title; } if ($position) { $blockinfo['position'] = $position; } $blockinfo['bid'] = $bid; // bid is not return by BlockGetInfo. // Overwrite block specific config vars. // Only the new style is supported. if (count($params) > 0) { $_vars = BlockUtil::varsFromContent($blockinfo['content']); $_vars = array_merge($_vars, $params); $blockinfo['content'] = BlockUtil::varsToContent($_vars); } // We need the module name. $modinfo = ModUtil::getInfo($blockinfo['mid']); if (!is_array($modinfo) || !isset($modinfo['name'])) { $modinfo = array('name' => 'core'); } // show the block and capture its contents $content = BlockUtil::show($modinfo['name'], $blockinfo['bkey'], $blockinfo); if ($assign) { $view->assign($assign, $content); } else { return $content; } }
/** * update block settings * * @author The Zikula Development Team * @param array $blockinfo a blockinfo structure * @return $blockinfo the modified blockinfo structure */ public function update($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // alter the corresponding variable $vars['hourfrom'] = FormUtil::getPassedValue('hourfrom'); $vars['hourto'] = FormUtil::getPassedValue('hourto'); $vars['monfrom'] = FormUtil::getPassedValue('monfrom'); $vars['monto'] = FormUtil::getPassedValue('monto'); $vars['mdayfrom'] = FormUtil::getPassedValue('mdayfrom'); $vars['mdayto'] = FormUtil::getPassedValue('mdayto'); $vars['wdayfrom'] = FormUtil::getPassedValue('wdayfrom'); $vars['wdayto'] = FormUtil::getPassedValue('wdayto'); $vars['cache_time'] = FormUtil::getPassedValue('cache_time'); $vars['cache_dir'] = FormUtil::getPassedValue('cache_dir'); $vars['category'] = FormUtil::getPassedValue('category', null); $ballooncolor = FormUtil::getPassedValue('ballooncolor', 'grey'); // Make sure color is allowed. switch ($ballooncolor) { case 'black': case 'grey': case 'green': case 'white': case 'yellow': break; default: $ballooncolor = 'grey'; } $vars['ballooncolor'] = $ballooncolor; $vars['enablefacebookshare'] = FormUtil::getPassedValue('enablefacebookshare', false); // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('quotes_block_quote.tpl'); return $blockinfo; }
/** * Update the block * * @param $blockinfo old blockinfo array * @return array new blockinfo array */ public function update($blockinfo) { if (!SecurityUtil::checkPermission('Theme:Renderblock:', "$blockinfo[bid]::", ACCESS_ADMIN)) { return false; } $module = FormUtil::getPassedValue('rmodule', null, 'POST'); $template = FormUtil::getPassedValue('rtemplate', null, 'POST'); $parameters = FormUtil::getPassedValue('rparameters', null, 'POST'); $blockinfo['content'] = BlockUtil::varsToContent(compact('module', 'template', 'parameters' )); return($blockinfo); }
/** * Update block settings * * @param array $blockinfo a blockinfo structure * @return $blockinfo the modified blockinfo structure */ public function update($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); $vars['objectType'] = $this->request->getPost()->filter('objecttype', 'category', FILTER_SANITIZE_STRING); $vars['sorting'] = $this->request->getPost()->filter('sorting', 'default', FILTER_SANITIZE_STRING); $vars['amount'] = (int) $this->request->getPost()->filter('amount', 5, FILTER_VALIDATE_INT); $vars['template'] = $this->request->getPost()->get('template', ''); $vars['filter'] = $this->request->getPost()->get('filter', ''); if (!in_array($vars['objectType'], MUBoard_Util_Controller::getObjectTypes('block'))) { $vars['objectType'] = MUBoard_Util_Controller::getDefaultObjectType('block'); } // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('block/itemlist_display.tpl'); $this->view->clear_cache('block/itemlist_' . ucwords($vars['objectType']) . '_display.tpl'); $this->view->clear_cache('block/itemlist_display_description.tpl'); $this->view->clear_cache('block/itemlist_' . ucwords($vars['objectType']) . '_display_description.tpl'); return $blockinfo; }
/** * update block settings * * @param array $blockinfo a blockinfo structure * @return $blockinfo the modified blockinfo structure */ public function update($blockinfo) { $vars['docurl'] = FormUtil::getPassedValue('docurl', '', 'POST'); $vars['styleurl'] = FormUtil::getPassedValue('styleurl', '', 'POST'); $vars['doccontents'] = FormUtil::getPassedValue('doccontents', '', 'POST'); $vars['stylecontents'] = FormUtil::getPassedValue('stylecontents', '', 'POST'); $blockinfo['content'] = BlockUtil::varsToContent($vars); return $blockinfo; }
/** * update block settings * * @author Erik Spaan [espaan] * @param array $blockinfo a blockinfo structure * @return $blockinfo the modified blockinfo structure */ public function update($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // alter the corresponding variable $vars['show'] = (int)FormUtil::getPassedValue('show', 1, 'POST'); $vars['category'] = FormUtil::getPassedValue('category', null, 'POST'); $vars['limit'] = (int)FormUtil::getPassedValue('limit', 10, 'POST'); $vars['status'] = (int)FormUtil::getPassedValue('status', 0, 'POST'); $vars['order'] = (int)FormUtil::getPassedValue('order', 0, 'POST'); $vars['dayslimit'] = (int)FormUtil::getPassedValue('dayslimit', 0, 'POST'); $vars['maxtitlelength'] = (int)FormUtil::getPassedValue('maxtitlelength', 0, 'POST'); $vars['titlewraptxt'] = FormUtil::getPassedValue('titlewraptxt', null, 'POST'); $vars['showemptyresult'] = (bool)FormUtil::getPassedValue('showemptyresult', false, 'POST'); $vars['blocktemplate'] = FormUtil::getPassedValue('blocktemplate', null, 'POST'); $vars['rowtemplate'] = FormUtil::getPassedValue('rowtemplate', null, 'POST'); $vars['dispuname'] = (bool)FormUtil::getPassedValue('dispuname', false, 'POST'); $vars['dispdate'] = (bool)FormUtil::getPassedValue('dispdate', false, 'POST'); $vars['dateformat'] = FormUtil::getPassedValue('dateformat', null, 'POST'); $vars['dispreads'] = (bool)FormUtil::getPassedValue('dispreads', false, 'POST'); $vars['dispcomments'] = (bool)FormUtil::getPassedValue('dispcomments', false, 'POST'); $vars['dispsplitchar'] = FormUtil::getPassedValue('dispsplitchar', null, 'POST'); $vars['disphometext'] = (bool)FormUtil::getPassedValue('disphometext', false, 'POST'); $vars['maxhometextlength'] = (int)FormUtil::getPassedValue('maxhometextlength', 0, 'POST'); $vars['hometextwraptxt'] = FormUtil::getPassedValue('hometextwraptxt', null, 'POST'); $vars['dispnewimage'] = (bool)FormUtil::getPassedValue('dispnewimage', false, 'POST'); $vars['newimagelimit'] = (int)FormUtil::getPassedValue('newimagelimit', 0, 'POST'); $vars['newimageset'] = FormUtil::getPassedValue('newimageset', null, 'POST'); $vars['newimagesrc'] = FormUtil::getPassedValue('newimagesrc', null, 'POST'); $vars['scrolling'] = (int)FormUtil::getPassedValue('scrolling', 1, 'POST'); $vars['scrollstyle'] = FormUtil::getPassedValue('scrollstyle', null, 'POST'); $vars['scrolldelay'] = (int)FormUtil::getPassedValue('scrolldelay', 0, 'POST'); $vars['scrollmspeed'] = (int)FormUtil::getPassedValue('scrollmspeed', 0, 'POST'); // Check the templates if (!$this->view->template_exists($vars['rowtemplate'])) { $vars['rowtemplate'] = ''; } if (!$this->view->template_exists($vars['blocktemplate'])) { $vars['blocktemplate'] = ''; } // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_all_cache(); return $blockinfo; }
/** * Update block settings. * * Parameters passed in via POST: * ------------------------------ * string username The user name of the featured user. * array fieldstoshow An array of dud item labels corresponding to the information to display in the block. * boolean showregdate True to show the featured user's registration date, false to supress it. * * @param array $blockinfo A blockinfo structure. * * @return array The modified blockinfo structure. */ public function update($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // alter the corresponding variables $vars['username'] = $this->request->getPost()->get('username', null); $vars['fieldstoshow'] = $this->request->getPost()->get('fieldstoshow', null); $vars['showregdate'] = (bool)$this->request->getPost()->get('showregdate', null); if (!isset($vars['fieldstoshow']) || !is_array($vars['fieldstoshow']) || empty($vars['fieldstoshow'])) { $vars['fieldstoshow'] = array(); } // validate the passed duds if (!empty($vars['fieldstoshow'])) { $activeduds = ModUtil::apiFunc('Profile', 'user', 'getallactive'); $activeduds = array_keys($activeduds); foreach ($vars['fieldstoshow'] as $k => $v) { if (!in_array($v, $activeduds)) { unset($vars['fieldstoshow'][$k]); } } } // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('profile_block_featureduser.tpl'); return $blockinfo; }
/** * Update block settings. * * @param array $blockinfo A blockinfo structure. * * @return array The modified blockinfo structure. */ public function update($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // alter the corresponding variable $vars['lengthmax'] = (int)$this->request->getPost()->get('lengthmax', null); // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('profile_block_membersonline.tpl'); return $blockinfo; }
/** * update block settings */ public function update($blockinfo) { // get old variable values from database $vars = BlockUtil::varsFromContent($blockinfo['content']); // get new variable values from form $vars['block_template'] = FormUtil::getPassedValue('block_template', 'slider.tpl', 'POST'); $vars['block_title'] = FormUtil::getPassedValue('block_title', array(), 'POST'); $vars['block_wrap'] = FormUtil::getPassedValue('block_wrap', true, 'POST'); $vars['slider_content'] = FormUtil::getPassedValue('slider_content', array(), 'POST'); $vars['slider_htmlcaption'] = FormUtil::getPassedValue('slider_htmlcaption', array(), 'POST'); $vars['slider_content_editor'] = FormUtil::getPassedValue('slider_content_editor', false, 'POST'); $vars['slider_theme'] = FormUtil::getPassedValue('slider_theme', 'default', 'POST'); $vars['slider_effect'] = FormUtil::getPassedValue('slider_effect', 'random', 'POST'); $vars['slider_slices'] = FormUtil::getPassedValue('slider_slices', 15, 'POST'); $vars['slider_boxCols'] = FormUtil::getPassedValue('slider_boxCols', 8, 'POST'); $vars['slider_boxRows'] = FormUtil::getPassedValue('slider_boxRows', 4, 'POST'); $vars['slider_animSpeed'] = FormUtil::getPassedValue('slider_animSpeed', 500, 'POST'); $vars['slider_pauseTime'] = FormUtil::getPassedValue('slider_pauseTime', 3000, 'POST'); $vars['slider_startSlide'] = FormUtil::getPassedValue('slider_startSlide', 0, 'POST'); $vars['slider_directionNav'] = FormUtil::getPassedValue('slider_directionNav', true, 'POST'); $vars['slider_controlNav'] = FormUtil::getPassedValue('slider_controlNav', true, 'POST'); $vars['slider_controlNavThumbs'] = FormUtil::getPassedValue('slider_controlNavThumbs', false, 'POST'); $vars['slider_pauseOnHover'] = FormUtil::getPassedValue('slider_pauseOnHover', true, 'POST'); $vars['slider_manualAdvance'] = FormUtil::getPassedValue('slider_manualAdvance', false, 'POST'); $vars['slider_randomStart'] = FormUtil::getPassedValue('slider_randomStart', false, 'POST'); // write new values $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('blocks/slider.tpl'); return $blockinfo; }
/** * update block configuration */ public function update($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // check if import old menu $menutree_menus = FormUtil::getPassedValue('menutree_menus', 'null'); if ($menutree_menus != 'null') { $vars['menutree_content'] = $this->_import_menu($menutree_menus); } else { $vars['menutree_content'] = FormUtil::getPassedValue('menutree_content', '', 'POST'); $vars['menutree_content'] = DataUtil::urlsafeJsonDecode($vars['menutree_content']); } if (!$this->validate_menu($vars['menutree_content'])) { return LogUtil::registerError($this->__('Error! Could not save your changes.')); } // sort tree array according to lineno key uasort($vars['menutree_content'], array('Blocks_Block_Menutree','sort_menu')); // get other form data $menutree_data = FormUtil::getPassedValue('menutree'); $vars['menutree_tpl'] = isset($menutree_data['tpl']) ? $menutree_data['tpl'] : ''; if (empty($vars['menutree_tpl']) || !$this->view->template_exists($vars['menutree_tpl'])) { $vars['menutree_tpl'] = 'menutree/blocks_block_menutree_default.tpl'; } $vars['menutree_stylesheet'] = isset($menutree_data['stylesheet']) ? $menutree_data['stylesheet'] : ''; if (empty($vars['menutree_stylesheet']) || $vars['menutree_stylesheet'] == 'null' || !file_exists($vars['menutree_stylesheet'])) { $vars['menutree_stylesheet'] = ''; } $vars['menutree_titles'] = isset($menutree_data['titles']) ? $menutree_data['titles'] : array(); $vars['menutree_linkclass'] = isset($menutree_data['linkclass']) ? (bool)$menutree_data['linkclass'] : false; // if class list is provided - rebuild array and fill empty entries if ($vars['menutree_linkclass'] && isset($menutree_data['linkclasses'])) { foreach ((array)$menutree_data['linkclasses'] as $k => $class) { if (empty($class['name'])) { unset($menutree_data['linkclasses'][$k]); } elseif (empty($class['title'])) { $menutree_data['linkclasses'][$k]['title'] = $class['name']; } } $vars['menutree_linkclasses'] = $menutree_data['linkclasses']; if (count($vars['menutree_linkclasses']) < 1) { $vars['menutree_linkclass'] = false; } } $vars['menutree_maxdepth'] = isset($menutree_data['maxdepth']) ? (int)$menutree_data['maxdepth'] : 0; $vars['menutree_editlinks'] = isset($menutree_data['editlinks']) ? (bool)$menutree_data['editlinks'] : false; $vars['menutree_stripbaseurl'] = isset($menutree_data['stripbaseurl']) ? (bool)$menutree_data['stripbaseurl'] : false; $vars['menutree_titlesperms'] = isset($menutree_data['titlesperms']) && array_key_exists($menutree_data['titlesperms'],$this->_permlevels()) ? $menutree_data['titlesperms'] : 'ACCESS_EDIT'; $vars['menutree_displayperms'] = isset($menutree_data['displayperms']) && array_key_exists($menutree_data['displayperms'],$this->_permlevels()) ? $menutree_data['displayperms'] : 'ACCESS_EDIT'; $vars['menutree_settingsperms'] = isset($menutree_data['settingsperms']) && array_key_exists($menutree_data['settingsperms'],$this->_permlevels()) ? $menutree_data['settingsperms'] : 'ACCESS_EDIT'; if (empty($vars['menutree_content'])) { unset($vars['menutree_content']); } else { // check langs and save current langs list and current default lang $tmp = current($vars['menutree_content']); $vars['oldlanguages'] = array_keys($tmp); $vars['olddefaultanguage'] = $vars['oldlanguages'][0]; // strip base url - if needed if ($vars['menutree_stripbaseurl'] === true) { $baseurl = System::getBaseUrl(); foreach ($vars['menutree_content'] as $itemid => $item) { foreach ($item as $lang => $_item) { // strip base url only when it occurs at the beginning of url and only once if (strpos($_item['href'], $baseurl) === 0) { $vars['menutree_content'][$itemid][$lang]['href'] = substr_replace($_item['href'], '', 0, strlen($baseurl)); } } } } } // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache(null, $blockinfo['bkey'].'/bid'.$blockinfo['bid']); // and clear the theme cache Zikula_View_Theme::getInstance()->clear_cache(); return $blockinfo; }
/** * put an array of config variables in the content field of a block * * @deprecated * @see BlockUtil::varsToContent() * * @param the $ config vars array, in key->value form */ function pnBlockVarsToContent($vars) { LogUtil::log(__f('Warning! Function %1$s is deprecated. Please use %2$s instead.', array(__FUNCTION__, 'BlockUtil::varsToContent()')), E_USER_DEPRECATED); return BlockUtil::varsToContent($vars); }
/** * Update block settings * * @param array $blockInfo blockinfo array * * @return array $blockinfo */ public function update($blockInfo) { $vars = BlockUtil::varsFromContent($blockInfo['content']); // write back the new contents $blockInfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache(null, $blockInfo['bkey'] . '/bid' . $blockInfo['bid']); // and clear the theme cache Zikula_View_Theme::getInstance()->clear_cache(); return $blockInfo; }
/** * update block settings * * @param array $blockinfo a blockinfo structure * @return $blockinfo the modified blockinfo structure */ public function update($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // Read inputs $vars['format'] = FormUtil::getPassedValue('format'); // Read inputs $vars['fulltranslation'] = FormUtil::getPassedValue('fulltranslation'); // Scan for languages and save cached version $vars['languages'] = $this->getAvailableLanguages(); // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('blocks_block_thelang.tpl'); // and clear the theme cache Zikula_View_Theme::getInstance()->clear_cache(); return $blockinfo; }
/** * update block settings */ public function update($blockinfo) { // get old variable values from database $vars = BlockUtil::varsFromContent($blockinfo['content']); // get new variable values from form $vars['block_template'] = FormUtil::getPassedValue('block_template', 'marquee.tpl', 'POST'); $vars['block_title'] = FormUtil::getPassedValue('block_title', array(), 'POST'); $vars['block_wrap'] = FormUtil::getPassedValue('block_wrap', true, 'POST'); $vars['marquee_content'] = FormUtil::getPassedValue('marquee_content', array(), 'POST'); $vars['marquee_content_editor'] = FormUtil::getPassedValue('marquee_content_editor', false, 'POST'); $vars['marquee_duration'] = FormUtil::getPassedValue('marquee_duration', 15000, 'POST'); $vars['marquee_gap'] = FormUtil::getPassedValue('marquee_gap', 200, 'POST'); $vars['marquee_delayBeforeStart'] = FormUtil::getPassedValue('marquee_delayBeforeStart', 0, 'POST'); $vars['marquee_direction'] = FormUtil::getPassedValue('marquee_direction', 'left', 'POST'); $vars['marquee_duplicated'] = FormUtil::getPassedValue('marquee_duplicated', true, 'POST'); $vars['marquee_pauseOnHover'] = FormUtil::getPassedValue('marquee_pauseOnHover', true, 'POST'); $vars['marquee_pauseOnCycle'] = FormUtil::getPassedValue('marquee_pauseOnCycle', false, 'POST'); // write new values $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('blocks/marquee.tpl'); return $blockinfo; }
/** * update block settings */ public function update($blockinfo) { $vars = array(); $vars['feedid'] = FormUtil::getPassedValue('feedid', 1, 'POST'); $vars['numitems'] = FormUtil::getPassedValue('numitems', 0, 'POST'); $vars['displayimage'] = FormUtil::getPassedValue('displayimage', -1, 'POST'); $vars['displaydescription'] = FormUtil::getPassedValue('displaydescription', -1, 'POST'); $vars['alternatelayout'] = FormUtil::getPassedValue('alternatelayout', -1, 'POST'); $blockinfo['content'] = BlockUtil::varsToContent($vars); return $blockinfo; }
/** * update block settings * * @param array $blockinfo a blockinfo structure * @return $blockinfo the modified blockinfo structure */ public function update($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // alter the corresponding variable $vars['filo'] = FormUtil::getPassedValue('filo'); $vars['typo'] = FormUtil::getPassedValue('typo'); // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); return $blockinfo; }
/** * update block settings * * @param array $blockinfo a blockinfo structure * @return $blockinfo the modified blockinfo structure */ public function update($blockinfo) { $vars['displaymodules'] = FormUtil::getPassedValue('displaymodules'); $vars['style'] = FormUtil::getPassedValue('style'); $vars['stylesheet'] = FormUtil::getPassedValue('stylesheet'); // Defaults if (empty($vars['displaymodules'])) { $vars['displaymodules'] = 0; } if (empty($vars['style'])) { $vars['style'] = 1; } if (empty($vars['template'])) { $vars['template'] = 'menu'; } // User links $content = array(); $c = 1; $linkname = FormUtil::getPassedValue('linkname'); $linkurl = FormUtil::getPassedValue('linkurl'); $linkdesc = FormUtil::getPassedValue('linkdesc'); $linkdelete = FormUtil::getPassedValue('linkdelete'); $linkinsert = FormUtil::getPassedValue('linkinsert'); if (isset($linkname)) { foreach ($linkname as $v) { if (empty($linkdelete[$c])) { $content[] = "$linkurl[$c]|$linkname[$c]|$linkdesc[$c]"; } if (!empty($linkinsert[$c])) { $content[] = '||'; } $c++; } } $new_linkname = FormUtil::getPassedValue('new_linkname'); $new_linkurl = FormUtil::getPassedValue('new_linkurl'); $new_linkdesc = FormUtil::getPassedValue('new_linkdesc'); $new_linkinsert = (bool)FormUtil::getPassedValue('new_linkinsert'); if ($new_linkname) { $content[] = $new_linkurl . '|' . $new_linkname . '|' . $new_linkdesc; if ($new_linkinsert) { $content[] = '||'; } } $vars['content'] = implode('LINESPLIT', $content); $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('blocks_block_menu.tpl'); // and clear the theme cache Zikula_View_Theme::getInstance()->clear_cache(); return($blockinfo); }
/** * update block settings * * @param array $blockinfo a blockinfo structure * @return $blockinfo the modified blockinfo structure */ public function update($blockinfo) { $vars['displaymodules'] = FormUtil::getPassedValue('displaymodules'); $vars['stylesheet'] = FormUtil::getPassedValue('stylesheet'); $vars['template'] = FormUtil::getPassedValue('template'); $vars['blocktitles'] = FormUtil::getPassedValue('blocktitles'); // Defaults if (empty($vars['displaymodules'])) { $vars['displaymodules'] = 0; } if (empty($vars['template'])) { $vars['template'] = 'blocks_block_extmenu.tpl'; } if (empty($vars['stylesheet'])) { $vars['stylesheet'] = 'extmenu.css'; } // User links $content = array(); $vars['links'] = FormUtil::getPassedValue('links'); $vars['blockversion'] = 1; // Save links hierarchy $linksorder = FormUtil::getPassedValue('linksorder'); $linksorder = json_decode($linksorder, true); if (is_array($linksorder) && !empty($linksorder)) { foreach ((array) $vars['links'] as $lang => $langlinks) { foreach ($langlinks as $linkid => $link) { $vars['links'][$lang][$linkid]['parentid'] = $linksorder[$linkid]['parentid']; $vars['links'][$lang][$linkid]['haschildren'] = $linksorder[$linkid]['haschildren']; } } } $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache(null, $blockinfo['bkey'] . '/bid' . $blockinfo['bid']); // and clear the theme cache Zikula_View_Theme::getInstance()->clear_cache(); return $blockinfo; }
/** * update block settings * * @author The Zikula Development Team * @param array $blockinfo a blockinfo structure * @return $blockinfo the modified blockinfo structure */ public function update($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // alter the corresponding variable $vars['storiestype'] = FormUtil::getPassedValue('storiestype', null, 'POST'); $vars['category'] = FormUtil::getPassedValue('category', null, 'POST'); $vars['limit'] = (int)FormUtil::getPassedValue('limit', null, 'POST'); // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('block/stories.tpl'); return $blockinfo; }
/** * update block settings * * @param array $blockinfo a blockinfo structure * @return $blockinfo the modified blockinfo structure */ public function update($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // alter the corresponding variable $vars['mod'] = (string) FormUtil::getPassedValue('mod', '', 'POST'); $vars['numentries'] = (int) FormUtil::getPassedValue('numentries', 5, 'POST'); $vars['numdays'] = (int) FormUtil::getPassedValue('numdays', 0, 'POST'); $vars['showusername'] = (bool) FormUtil::getPassedValue('showusername', false, 'POST'); $vars['linkusername'] = (bool) FormUtil::getPassedValue('linkusername', false, 'POST'); $vars['showdate'] = (bool) FormUtil::getPassedValue('showdate', false, 'POST'); $vars['showpending'] = (bool) FormUtil::getPassedValue('showpending', false, 'POST'); // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('ezcomments_block_ezcomments.tpl'); return $blockinfo; }
/** * update block settings * * @author The Zikula Development Team * @param array $blockinfo a blockinfo structure * @return $blockinfo the modified blockinfo structure */ public function update($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // alter the corresponding variable $vars['cache_time'] = FormUtil::getPassedValue('cache_time'); $vars['cache_dir'] = FormUtil::getPassedValue('cache_dir'); $vars['category'] = FormUtil::getPassedValue('category', null); $vars['enablefacebookshare'] = FormUtil::getPassedValue('enablefacebookshare', false); // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('ephemerides_block_ephemeride.tpl'); return $blockinfo; }