/** * Category selector. * * @param array $params All attributes passed to this function from the template. * @param Zikula_View $view Reference to the Zikula_View object. * * @return string */ function smarty_function_selector_category($params, Zikula_View $view) { $categoryRegistryModule = isset($params['categoryRegistryModule']) ? $params['categoryRegistryModule'] : ''; $categoryRegistryTable = isset($params['categoryRegistryTable']) ? $params['categoryRegistryTable'] : ''; $categoryRegistryProperty = isset($params['categoryRegistryProperty']) ? $params['categoryRegistryProperty'] : ''; $category = isset($params['category']) ? $params['category'] : 0; $path = isset($params['path']) ? $params['path'] : ''; $pathfield = isset($params['pathfield']) ? $params['pathfield'] : 'path'; $field = isset($params['field']) ? $params['field'] : 'id'; $fieldIsAttribute = isset($params['fieldIsAttribute']) ? $params['fieldIsAttribute'] : null; $selectedValue = isset($params['selectedValue']) ? $params['selectedValue'] : 0; $defaultValue = isset($params['defaultValue']) ? $params['defaultValue'] : 0; $defaultText = isset($params['defaultText']) ? $params['defaultText'] : ''; $allValue = isset($params['allValue']) ? $params['allValue'] : 0; $allText = isset($params['allText']) ? $params['allText'] : ''; $name = isset($params['name']) ? $params['name'] : 'defaultselectorname'; $submit = isset($params['submit']) ? $params['submit'] : false; $recurse = isset($params['recurse']) ? $params['recurse'] : true; $relative = isset($params['relative']) ? $params['relative'] : true; $includeRoot = isset($params['includeRoot']) ? $params['includeRoot'] : false; $includeLeaf = isset($params['includeLeaf']) ? $params['includeLeaf'] : true; $all = isset($params['all']) ? $params['all'] : false; $displayPath = isset($params['displayPath']) ? $params['displayPath'] : false; $attributes = isset($params['attributes']) ? $params['attributes'] : null; $assign = isset($params['assign']) ? $params['assign'] : null; $editLink = isset($params['editLink']) ? $params['editLink'] : true; $multipleSize = isset($params['multipleSize']) ? $params['multipleSize'] : 1; $sortField = isset($params['sortField']) ? $params['sortField'] : 'sort_value'; $doReplaceRootCat = isset($params['doReplaceRootCat']) ? $params['doReplaceRootCat'] : null; $cssClass = isset($params['cssClass']) ? $params['cssClass'] : ''; if (isset($params['lang'])) { $lang = $params['lang']; $oldLocale = ZLanguage::getLocale(); ZLanguage::setLocale($lang); } else { $lang = ZLanguage::getLanguageCode(); } if (!$category && !$path && $categoryRegistryModule && $categoryRegistryTable && $categoryRegistryProperty) { $category = CategoryRegistryUtil::getRegisteredModuleCategory($categoryRegistryModule, $categoryRegistryTable, $categoryRegistryProperty); } // if we don't have a category-id we see if we can get a category by path if (!$category && $path) { $category = CategoryUtil::getCategoryByPath($path, $pathfield); } elseif (is_numeric($category)) { // check if we have a numeric category $category = CategoryUtil::getCategoryByID($category); } elseif (is_string($category) && strpos($category, '/') === 0) { // check if we have a string/path category $category = CategoryUtil::getCategoryByPath($category, $pathfield); } static $catCache; if (!$catCache) { $catCache = array(); } $cacheKey = "{$category['id']}||{$recurse}|{$relative}|{$includeRoot}|{$includeLeaf}|{$all}|||{$attributes}|{$sortField}"; if (!isset($catCache[$cacheKey])) { $catCache[$cacheKey] = CategoryUtil::getSubCategoriesForCategory($category, $recurse, $relative, $includeRoot, $includeLeaf, $all, '', '', $attributes, $sortField); } $html = CategoryUtil::getSelector_Categories($catCache[$cacheKey], $field, $selectedValue, $name, $defaultValue, $defaultText, $allValue, $allText, $submit, $displayPath, $doReplaceRootCat, $multipleSize, $fieldIsAttribute, $cssClass, $lang); if ($editLink && !empty($category) && SecurityUtil::checkPermission('ZikulaCategoriesModule::', "{$category['id']}::", ACCESS_EDIT)) { $url = DataUtil::formatForDisplay(ModUtil::url('ZikulaCategoriesModule', 'user', 'edit', array('dr' => $category['id']))); $html .= " <a href=\"{$url}\"><img src=\"" . System::getBaseUrl() . "images/icons/extrasmall/xedit.png\" title=\"" . __('Edit sub-category') . '" alt="' . __('Edit sub-category') . '" /></a>'; } if (isset($params['lang'])) { // Reset language again. ZLanguage::setLocale($oldLocale); } if ($assign) { $view->assign($assign, $html); } else { return $html; } }
/** * Return an rss/atom feed of the last x comments * * @author Mark west */ public function feed($args) { $mod = isset($args['mod']) ? $args['mod'] : FormUtil::getPassedValue('mod', null, 'POST'); $objectid = isset($args['objectid']) ? $args['objectid'] : FormUtil::getPassedValue('objectid', null, 'POST'); $feedtype = isset($args['feedtype']) ? $args['feedtype'] : FormUtil::getPassedValue('feedtype', null, 'POST'); $feedcount = isset($args['feedcount']) ? $args['feedcount'] : FormUtil::getPassedValue('feedcount', null, 'POST'); // check our input if (!isset($feedcount) || !is_numeric($feedcount) || $feedcount < 1 || $feedcount > 999) { $feedcount = $this->getVar('feedcount'); } if (!isset($feedtype) || !is_string($feedtype) || $feedtype !== 'rss' && $feedtype !== 'atom') { $feedtype = $this->getVar('feedtype'); } if (!isset($mod) || !is_string($mod) || !ModUtil::available($mod)) { $mod = null; } if (!isset($objectid) || !is_string($objectid)) { $objectid = null; } // get the last x comments $comments = ModUtil::apiFunc('EZComments', 'user', 'getall', array('mod' => $mod, 'objectid' => $objectid, 'numitems' => $feedcount, 'sortorder' => 'DESC', 'status' => 0)); // grab the item url from one of the comments $itemUrl = ''; if (isset($comments[0]['url'])) { $itemUrl = $comments[0]['url']; } else { // attempt to guess the url (api compliant mods only....) $itemUrl = ModUtil::url($mod, 'user', 'display', array('objectid' => $objectid)); } $this->view->assign('comments', $comments)->assign('language', ZLanguage::getLocale())->assign('sitename', System::getVar('sitename'))->assign('slogan', System::getVar('slogan'))->assign('adminmail', System::getVar('adminmail'))->assign('current_date', date(DATE_RSS))->assign('itemurl', $itemUrl); // display the feed and notify the core that we're done $this->view->display("ezcomments_user_{$feedtype}.tpl"); return true; }
/** * Initialise the settings module. * * @return boolean */ public function install() { // Set up an initial value for a module variable. Note that all module // variables should be initialised with some value in this way rather // than just left blank, this helps the user-side code and means that // there doesn't need to be a check to see if the variable is set in // the rest of the code as it always will be System::setVar('debug', '0'); System::setVar('sitename', $this->__('Site name')); System::setVar('slogan', $this->__('Site description')); System::setVar('metakeywords', $this->__('zikula, portal, portal web, open source, web site, website, weblog, blog, content management, content management system, web content management, web content management system, enterprise web content management, cms, application framework')); System::setVar('defaultpagetitle', $this->__('Site name')); System::setVar('defaultmetadescription', $this->__('Site description')); System::setVar('startdate', date('m/Y', time())); System::setVar('adminmail', '*****@*****.**'); System::setVar('Default_Theme', 'Andreas08'); System::setVar('timezone_offset', '0'); System::setVar('timezone_server', '0'); System::setVar('funtext', '1'); System::setVar('reportlevel', '0'); System::setVar('startpage', ''); System::setVar('Version_Num', Zikula_Core::VERSION_NUM); System::setVar('Version_ID', Zikula_Core::VERSION_ID); System::setVar('Version_Sub', Zikula_Core::VERSION_SUB); System::setVar('debug_sql', '0'); System::setVar('multilingual', '1'); System::setVar('useflags', '0'); System::setVar('theme_change', '0'); System::setVar('UseCompression', '0'); System::setVar('siteoff', 0); System::setVar('siteoffreason', ''); System::setVar('starttype', ''); System::setVar('startfunc', ''); System::setVar('startargs', ''); System::setVar('entrypoint', 'index.php'); System::setVar('language_detect', 0); System::setVar('shorturls', false); System::setVar('shorturlstype', '0'); System::setVar('shorturlsseparator', '-'); System::setVar('shorturlsstripentrypoint', false); System::setVar('shorturlsdefaultmodule', ''); System::setVar('profilemodule', ModUtil::available('Profile') ? 'Profile' : ''); System::setVar('messagemodule', ''); System::setVar('languageurl', 0); System::setVar('ajaxtimeout', 5000); //! this is a comma-separated list of special characters to search for in permalinks System::setVar('permasearch', $this->__('À,Á,Â,Ã,Å,à,á,â,ã,å,Ò,Ó,Ô,Õ,Ø,ò,ó,ô,õ,ø,È,É,Ê,Ë,è,é,ê,ë,Ç,ç,Ì,Í,Î,Ï,ì,í,î,ï,Ù,Ú,Û,ù,ú,û,ÿ,Ñ,ñ,ß,ä,Ä,ö,Ö,ü,Ü')); //! this is a comma-separated list of special characters to replace in permalinks System::setVar('permareplace', $this->__('A,A,A,A,A,a,a,a,a,a,O,O,O,O,O,o,o,o,o,o,E,E,E,E,e,e,e,e,C,c,I,I,I,I,i,i,i,i,U,U,U,u,u,u,y,N,n,ss,ae,Ae,oe,Oe,ue,Ue')); System::setVar('language',ZLanguage::getLanguageCodeLegacy()); System::setVar('locale', ZLanguage::getLocale()); System::setVar('language_i18n', ZLanguage::getlanguageCode()); System::setVar('idnnames', 1); if (!DBUtil::createTable('workflows')) { return false; } if (!DBUtil::createTable('objectdata_attributes')) { return false; } if (!DBUtil::createTable('objectdata_log')) { return false; } if (!DBUtil::createTable('objectdata_meta')) { return false; } // Initialisation successful return true; }