/** * load a block * * @deprecated * @see BlockUtil::load() * * @param string $modname module name * @param string $block name of the block * @return bool true on successful load, false otherwise */ function pnBlockLoad($modname, $block) { LogUtil::log(__f('Warning! Function %1$s is deprecated. Please use %2$s instead.', array(__FUNCTION__, 'BlockUtil::load()')), E_USER_DEPRECATED); return BlockUtil::load($modname, $block); }
/** * Update a block. * * @param int $bid block id to update. * @param string $title the new title of the block. * @param string $description the new description of the block. * @param array $positions the new position(s) of the block. * @param array $modules the modules to display the block on. * @param string $url the new URL of the block. * @param string $language the new language of the block. * @param string $content the new content of the block. * * @see blocks_admin_modify() * * @return bool true if succesful, false otherwise */ public function update() { $this->checkCsrfToken(); // Get parameters $bid = FormUtil::getPassedValue('bid'); $title = FormUtil::getPassedValue('title'); $description = FormUtil::getPassedValue('description'); $language = FormUtil::getPassedValue('language'); $collapsable = FormUtil::getPassedValue('collapsable', 0); $defaultstate = FormUtil::getPassedValue('defaultstate', 1); $content = FormUtil::getPassedValue('content'); $refresh = FormUtil::getPassedValue('refresh'); $positions = FormUtil::getPassedValue('positions'); $filter = FormUtil::getPassedValue('filters', array()); $returntoblock = FormUtil::getPassedValue('returntoblock'); // not stored in a block $redirect = FormUtil::getPassedValue('redirect', null); $cancel = FormUtil::getPassedValue('cancel', null); if (isset($cancel)) { if (isset($redirect) && !empty($redirect)) { $this->redirect(urldecode($redirect)); } $this->redirect(ModUtil::url('Blocks', 'admin', 'view')); } // Fix for null language if (!isset($language)) { $language = ''; } // Get and update block info $blockinfo = BlockUtil::getBlockInfo($bid); $blockinfo['title'] = $title; $blockinfo['description'] = $description; $blockinfo['bid'] = $bid; $blockinfo['language'] = $language; $blockinfo['collapsable'] = $collapsable; $blockinfo['defaultstate'] = $defaultstate; $blockinfo['content'] = $content; $blockinfo['refresh'] = $refresh; $blockinfo['positions'] = $positions; $blockinfo['filter'] = $filter; // Load block $modinfo = ModUtil::getInfo($blockinfo['mid']); $blockObj = BlockUtil::load($modinfo['name'], $blockinfo['bkey']); if (!$blockObj) { return LogUtil::registerError($this->__('Sorry! No such block found.'), 404); } // Do block-specific update if ($blockObj instanceof Zikula_Controller_AbstractBlock) { $blockinfo = call_user_func(array($blockObj, 'update'), $blockinfo); } else { $usname = preg_replace('/ /', '_', $modinfo['name']); $updatefunc = $usname . '_' . $blockinfo['bkey'] . 'block_update'; if (function_exists($updatefunc)) { $blockinfo = $updatefunc($blockinfo); } } if (!$blockinfo) { $this->redirect(ModUtil::url('Blocks', 'admin', 'modify', array('bid' => $bid))); } // Pass to API if (ModUtil::apiFunc('Blocks', 'admin', 'update', $blockinfo)) { // Success LogUtil::registerStatus($this->__('Done! Block saved.')); } if (isset($redirect) && !empty($redirect)) { $this->redirect(urldecode($redirect)); } if (!empty($returntoblock)) { // load the block config again $this->redirect(ModUtil::url('Blocks', 'admin', 'modify', array('bid' => $returntoblock))); } $this->redirect(ModUtil::url('Blocks', 'admin', 'view')); }
function getPNlanguage() { BlockUtil::load('Core', 'thelang'); // All entries use ISO 639-2/T $lang['ara'] = "Arabic"; $lang['alb'] = "Albanian"; $lang['bul'] = "Bulgarian"; $lang['zho'] = "Chinese"; $lang['cat'] = "Catalan"; $lang['ces'] = "Czech"; $lang['hrv'] = "Croatian HRV"; $lang['cro'] = "Croatian CRO"; $lang['dan'] = "Danish"; $lang['nld'] = "Dutch"; $lang['eng'] = "English"; $lang['epo'] = "Esperanto"; $lang['est'] = "Estonian"; $lang['fin'] = "Finnish"; $lang['fra'] = "French"; $lang['deu'] = "German"; $lang['ell'] = "Greek"; $lang['heb'] = "Hebrew"; $lang['hun'] = "Hungarian"; $lang['isl'] = "Icelandic"; $lang['ind'] = "Indonesian"; $lang['ita'] = "Italian"; $lang['jpn'] = "Japanese"; $lang['kor'] = "Korean"; $lang['lav'] = "Latvian"; $lang['lit'] = "Lithuanian"; $lang['mas'] = "Malay"; $lang['mkd'] = "Macedonian"; $lang['nor'] = "Norwegian"; $lang['pol'] = "Polish"; $lang['por'] = "Portuguese"; $lang['ron'] = "Romanian"; $lang['rus'] = "Russian"; $lang['slv'] = "Slovenian"; $lang['spa'] = "Spanish"; $lang['swe'] = "Swedish"; $lang['tha'] = "Thai"; $lang['tur'] = "Turkish"; $lang['ukr'] = "Ukrainian"; $lang['yid'] = "Yiddish"; // ZphpBB2 //return strtolower($lang[SessionUtil::getVar('lang')]); return strtolower($lang[ZLanguage::getLanguageCodeLegacy()]); }