function update($blockinfo) { $vars = BlockUtil::varsFromContent($blockinfo['content']); $vars['page'] = FormUtil::getPassedValue('page', 0, 'POST'); $blockinfo['content'] = BlockUtil::varsToContent($vars); return $blockinfo; }
function get_geodata() { if (!SecurityUtil::checkPermission('AddressBook::', "::", ACCESS_EDIT)) { AjaxUtil::error($this->__('Error! No authorization to access this module.')); } $val_1 = FormUtil::getPassedValue('val_1', NULL, 'GETPOST'); $val_2 = FormUtil::getPassedValue('val_2', NULL, 'GETPOST'); $val_3 = FormUtil::getPassedValue('val_3', NULL, 'GETPOST'); $val_4 = FormUtil::getPassedValue('val_4', NULL, 'GETPOST'); //GMaps test include_once 'modules/AddressBook/lib/vendor/GMaps/GoogleMapV3.php'; $key = ModUtil::getVar('AddressBook', 'google_api_key'); $map = new GoogleMapAPI(); $map->setApiKey($key); $geocode = $map->getGeocode($val_1 . ', ' . $val_2 . ', ' . $val_3 . ', ' . $val_4); if (isset($geocode['lat']) && isset($geocode['lon'])) { $result = $geocode['lat'] . ',' . $geocode['lon']; } else { $result = ''; } if (FormUtil::getPassedValue('plane', NULL, 'GETPOST')) { return $result; } return new Zikula_Response_Ajax(array('lat_lon' => $result, 'result' => $result ? true : false)); }
/** * display items for a day * * @param $args array Arguments array. * * @return string html string */ public function display($args) { $eid = FormUtil::getPassedValue('eid', isset($args['eid']) ? $args['eid'] : null, 'REQUEST'); $objectid = FormUtil::getPassedValue('objectid', isset($args['objectid']) ? $args['objectid'] : null, 'REQUEST'); if (!empty($objectid)) { $eid = $objectid; } if (!isset($args['eid']) and !empty($eid)) { $args['eid'] = $eid; } // Chek permissions $this->throwForbiddenUnless(SecurityUtil::checkPermission('Ephemerides::', '::', ACCESS_READ), LogUtil::getErrorMsgPermission()); // check if the contents are cached. $template = 'ephemerides_user_display.tpl'; if ($this->view->is_cached($template)) { return $this->view->fetch($template); } // get items if (isset($args['eid']) and $args['eid'] > 0) { $items = ModUtil::apiFunc($this->name, 'user', 'getall', $args); } else { $items = ModUtil::apiFunc($this->name, 'user', 'gettoday', $args); } $this->view->assign('items', $items); return $this->view->fetch($template); }
/** * Function to delete an ids log entry */ public function deleteidsentry() { // verify auth-key $this->checkCsrfToken(); // Security check if (!SecurityUtil::checkPermission('SecurityCenter::', '::', ACCESS_DELETE)) { return LogUtil::registerPermissionError(); } // get paramters $id = (int)FormUtil::getPassedValue('id', 0, 'GETPOST'); // sanity check if (!is_numeric($id)) { return LogUtil::registerError($this->__f("Error! Received a non-numeric object ID '%s'.", $id)); } $class = 'SecurityCenter_DBObject_Intrusion'; $object = new $class(); $data = $object->get($id); // check for valid object if (!$data) { return LogUtil::registerError($this->__f('Error! Invalid %s received.', "object ID [$id]")); } else { // delete object $object->delete(); } // redirect back to view function $this->redirect(ModUtil::url('SecurityCenter', 'admin', 'viewidslog')); }
public function initialize(Zikula_Form_View $view) { $this->pageId = FormUtil::getPassedValue('pid', isset($this->args['pid']) ? $this->args['pid'] : null); $offset = (int) FormUtil::getPassedValue('offset'); if ((bool) $this->getVar('inheritPermissions', false) === true) { if (!ModUtil::apiFunc('Content', 'page', 'checkPermissionForPageInheritance', array('pageId' => $this->pageId, 'level' => ACCESS_EDIT))) { throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission()); } } else { if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) { throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission()); } } $page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'editing' => false, 'filter' => array('checkActive' => false), 'enableEscape' => true, 'translate' => false, 'includeContent' => false, 'includeCategories' => false)); if ($page === false) { return $this->view->registerError(null); } $versionscnt = ModUtil::apiFunc('Content', 'History', 'getPageVersionsCount', array('pageId' => $this->pageId)); $versions = ModUtil::apiFunc('Content', 'History', 'getPageVersions', array('pageId' => $this->pageId, 'offset' => $offset)); if ($versions === false) { return $this->view->registerError(null); } $this->view->assign('page', $page); $this->view->assign('versions', $versions); Content_Util::contentAddAccess($this->view, $this->pageId); // Assign the values for the smarty plugin to produce a pager $this->view->assign('numitems', $versionscnt); PageUtil::setVar('title', $this->__("Page history") . ' : ' . $page['title']); if (!$this->view->isPostBack() && FormUtil::getPassedValue('back', 0)) { $this->backref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null; } return true; }
function FlashChatBridge_user_showChat() { // perform permission check if (!SecurityUtil::checkPermission('FlashChatBridge::', '::', ACCESS_READ)) { return LogUtil::registerPermissionError(); } $popup = FormUtil::getPassedValue('popup', false); // Security check $render =& pnRender::getInstance('FlashChatBridge', false); $UserVars = pnUserGetVars(SessionUtil::getVar('uid')); $client_type = FormUtil::getPassedValue('client_type', 'standard'); $settings = pnModGetVar('FlashChatBridge'); $settings['init_user'] = $UserVars['uname']; $settings['init_password'] = $UserVars['pass']; if ($settings['autosize'] == 1) { $settings['width'] = "100%"; $settings['height'] = "100%"; } if ($popup) { $settings['width'] = "100%"; $settings['height'] = "100%"; $render->assign('settings', $settings); $chat = $render->fetch("flashchatbridge_user_chat_{$client_type}.htm"); $render->assign('chat', $chat); echo $render->fetch('flashchatbridge_user_popup.htm'); exit; } else { $render->assign('settings', $settings); return $render->fetch("flashchatbridge_user_chat_{$client_type}.htm"); } }
/** * Setup form. * * @param Zikula_Form_View $view Current Zikula_Form_View instance. * * @return boolean */ public function initialize(Zikula_Form_View $view) { // load and assign registred categories $categories = CategoryRegistryUtil::getRegisteredModuleCategories('ExampleDoctrine', 'User', 'id'); $view->assign('registries', $categories); $id = FormUtil::getPassedValue('id', null, "GET", FILTER_SANITIZE_NUMBER_INT); if ($id) { // load user with id $user = $this->entityManager->find('ExampleDoctrine_Entity_User', $id); if ($user) { // switch to edit mode $this->_id = $id; } else { return LogUtil::registerError($this->__f('User with id %s not found', $id)); } } else { $user = new ExampleDoctrine_Entity_User(); } $userData = $user->toArray(); // overwrite attributes array entry with a form compitable format $field1 = $user->getAttributes()->get('field1') ? $user->getAttributes()->get('field1')->getValue() : ''; $field2 = $user->getAttributes()->get('field2') ? $user->getAttributes()->get('field2')->getValue() : ''; $userData['attributes'] = array('field1' => $field1, 'field2' => $field2); // assign current values to form fields $view->assign('user', $user)->assign('meta', $user->getMetadata() != null ? $user->getMetadata()->toArray() : array())->assign($userData); $this->_user = $user; return true; }
public function updateConfig($args) { // Security check if (!SecurityUtil::checkPermission('SiriusXtecAuth::', '::', ACCESS_ADMIN)) { return LogUtil::registerPermissionError(); } $items = array( 'ldap_active' => FormUtil::getPassedValue('ldap_active', false, 'POST')?true:false, 'users_creation' => FormUtil::getPassedValue('users_creation', false, 'POST')?true:false, 'new_users_activation' => FormUtil::getPassedValue('new_users_activation', false, 'POST')?true:false, 'iw_write' => FormUtil::getPassedValue('iw_write', false, 'POST')?true:false, 'iw_lastnames' => FormUtil::getPassedValue('iw_lastnames', false, 'POST')?true:false, 'new_users_groups' => FormUtil::getPassedValue('new_users_groups', array(), 'POST'), 'ldap_server' => FormUtil::getPassedValue('ldap_server', false, 'POST'), 'ldap_basedn' => FormUtil::getPassedValue('ldap_basedn', false, 'POST'), 'ldap_searchattr' => FormUtil::getPassedValue('ldap_searchattr', false, 'POST'), 'loginXtecApps' => FormUtil::getPassedValue('loginXtecApps', false, 'POST'), 'logoutXtecApps' => FormUtil::getPassedValue('logoutXtecApps', false, 'POST'), 'gtafProtocol' => FormUtil::getPassedValue('gtafProtocol', false, 'POST'), 'e13Protocol' => FormUtil::getPassedValue('e13Protocol', false, 'POST'), 'gtafURL' => FormUtil::getPassedValue('gtafURL', false, 'POST'), 'e13URL' => FormUtil::getPassedValue('e13URL', false, 'POST'), 'loginTime' => FormUtil::getPassedValue('loginTime', false, 'POST'), 'logoutTime' => FormUtil::getPassedValue('logoutTime', false, 'POST')); ModUtil::setVars($this->name,$items); LogUtil::registerStatus($this->__('S\'ha actualitzat la configuració del mòdul.')); return System::redirect(ModUtil::url('SiriusXtecAuth', 'admin', 'main')); }
function mediashare_external_pasteitem($args) { // FIXME access check $albumId = mediashareGetIntUrl('aid', $args, 0); $mediaId = mediashareGetIntUrl('mid', $args, 0); $mode = FormUtil::getPassedValue('mode'); if (isset($_POST['backButton'])) { return pnRedirect(pnModUrl('mediashare', 'external', 'finditem', array('aid' => $albumId, 'mid' => $mediaId, 'mode' => $mode))); } $mediaItem = pnModAPIFunc('mediashare', 'user', 'getMediaItem', array('mediaId' => $mediaId)); /* if (!($handler = pnModAPIFunc('mediashare', 'mediahandler', 'loadHandler', array('handlerName' => $mediaItem['mediaHandler'])))) { return false; } */ $render =& pnRender::getInstance('mediashare', false); mediashareExternalLoadTheme($render); $render->assign('albumId', $albumId); $render->assign('mediaId', $mediaId); $render->assign('mediaItem', $mediaItem); if ($mediaItem['mediaHandler'] != 'extapp') { $mediadir = pnModAPIFunc('mediashare', 'user', 'getRelativeMediadir'); $render->assign('thumbnailUrl', $mediadir . $mediaItem['thumbnailRef']); $render->assign('previewUrl', $mediadir . $mediaItem['previewRef']); $render->assign('originalUrl', $mediadir . $mediaItem['originalRef']); } else { $render->assign('thumbnailUrl', "{$mediaItem['thumbnailRef']}"); $render->assign('previewUrl', "{$mediaItem['previewRef']}"); $render->assign('originalUrl', "{$mediaItem['originalRef']}"); } $render->assign('mode', $mode); echo $render->fetch('mediashare_external_pasteitem.html'); return true; }
/** * Event listener for 'core.postinit' event. * * @param Zikula_Event $event * * @return void */ public static function coreinit(Zikula_Event $event) { // get the module name $args = array(); $args['modulename'] = ModUtil::getName(); $module = $args['modulename']; // exit if Content module active - to avoid double loadings if user has given ids and functions if ($args['modulename'] == 'content') { return; } // Security check if user has COMMENT permission for scribite if (!SecurityUtil::checkPermission('Scribite::', "{$module}::", ACCESS_COMMENT)) { return; } // get passed func $func = FormUtil::getPassedValue('func', isset($args['func']) ? $args['func'] : null, 'GET'); // get config for current module $modconfig = array(); $modconfig = ModUtil::apiFunc('Scribite', 'user', 'getModuleConfig', array('modulename' => $args['modulename'])); // return if module is not supported or editor is not set if (!$modconfig['mid'] || $modconfig['modeditor'] == '-') { return; } // check if current func is fine for editors or funcs is empty (or all funcs) if (is_array($modconfig['modfuncs']) && (in_array($func, $modconfig['modfuncs']) || $modconfig['modfuncs'][0] == 'all')) { $args['areas'] = $modconfig['modareas']; $args['editor'] = $modconfig['modeditor']; $scribite = ModUtil::apiFunc('Scribite', 'user', 'loader', array('modulename' => $args['modulename'], 'editor' => $args['editor'], 'areas' => $args['areas'])); // add the scripts to page header if ($scribite) { PageUtil::AddVar('header', $scribite); } } }
/** * Update the module configuration * @author: Albert Pérez Monfort (aperezm@xtec.cat) * @param: Configuration values * @return: The form with needed to change the parameters */ public function updateConf($args) { $jclicJarBase = FormUtil::getPassedValue('jclicJarBase', isset($args['jclicJarBase']) ? $args['jclicJarBase'] : null, 'POST'); $timeLap = FormUtil::getPassedValue('timeLap', isset($args['timeLap']) ? $args['timeLap'] : null, 'POST'); $groups = FormUtil::getPassedValue('groups', isset($args['groups']) ? $args['groups'] : null, 'POST'); $jclicUpdatedFiles = FormUtil::getPassedValue('jclicUpdatedFiles', isset($args['jclicUpdatedFiles']) ? $args['jclicUpdatedFiles'] : null, 'POST'); // Security check if (!SecurityUtil::checkPermission('IWjclic::', "::", ACCESS_ADMIN)) { throw new Zikula_Exception_Forbidden(); } // Confirm authorisation code $this->checkCsrfToken(); $groupsString = '$'; foreach ($groups as $group) $groupsString .= '$' . $group . '$'; $this->setVar('jclicUpdatedFiles', $jclicUpdatedFiles) ->setVar('jclicJarBase', $jclicJarBase) ->setVar('timeLap', $timeLap) ->setVar('groupsProAssign', $groupsString); LogUtil::registerStatus($this->__('The module configuration has changed')); return System::redirect(ModUtil::url('IWjclic', 'admin', 'main')); }
function delete() { // security check if (!SecurityUtil::checkPermission('AddressBook::', '::', ACCESS_ADMIN)) { return LogUtil::registerPermissionError(); } $ot = FormUtil::getPassedValue('ot', 'categories', 'GETPOST'); $id = (int) FormUtil::getPassedValue('id', 0, 'GETPOST'); $url = ModUtil::url('AddressBook', 'admin', 'view', array('ot' => $ot)); $class = 'AddressBook_DBObject_' . ucfirst($ot); if (!class_exists($class)) { return z_exit(__f('Error! Unable to load class [%s]', $ot)); } $object = new $class(); $data = $object->get($id); if (!$data) { LogUtil::registerError(__f('%1$s with ID of %2$s doesn\'\\t seem to exist', array($ot, $id))); return System::redirect($url); } $object->delete(); if ($ot == "customfield") { $sql = "ALTER TABLE addressbook_address DROP adr_custom_" . $id; try { DBUtil::executeSQL($sql, -1, -1, true, true); } catch (Exception $e) { } } LogUtil::registerStatus($this->__('Done! Item deleted.')); return System::redirect($url); }
public function decode(Zikula_Form_View $view) { $this->value = FormUtil::getPassedValue($this->inputName, null, 'POST'); if (get_magic_quotes_gpc()) { $this->value = stripslashes($this->value); } }
function initialize(Zikula_Form_View $view) { $this->id = (int) FormUtil::getPassedValue('id', -1, 'GETPOST'); $objectid = FormUtil::getPassedValue('objectid', '', 'GETPOST'); $redirect = base64_decode(FormUtil::getPassedValue('redirect', '', 'GETPOST')); $view->caching = false; $comment = ModUtil::apiFunc('EZComments', 'user', 'get', array('id' => $this->id)); if ($comment == false || !is_array($comment)) { return LogUtil::registerError($this->__('No such comment found.'), ModUtil::url('EZComments', 'user', 'main')); } // check if user is allowed to modify this content $modifyowntime = (int) ModUtil::getVar('EZComments', 'modifyowntime'); $ts = strtotime($comment['date']); if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_ADMIN)) { // user has no admin permissions. Only commenting user should be able to modify if ($comment['uid'] != UserUtil::getVar('uid')) { // foreign content and no admin permissions $view->assign('nomodify', 1); $this->nomodify = 1; } else { if ($modifyowntime > 0 && $ts + $modifyowntime * 60 * 60 < time()) { $view->assign('nomodify', 1); $this->nomodify = 1; } } } else { $view->assign('nomodify', 0); $this->nomodify = 0; } $view->assign('redirect', isset($redirect) && !empty($redirect) ? true : false); // finally asign the comment information $view->assign($comment); return true; }
public function initialize(Zikula_Form_View $view) { $this->pageId = FormUtil::getPassedValue('pid', isset($this->args['pid']) ? $this->args['pid'] : null); if (!SecurityUtil::checkPermission('Content:page:', '::', ACCESS_ADD)) { throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission()); } if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) { throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission()); } $page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'filter' => array('checkActive' => false), 'includeContent' => false)); if ($page === false) { throw new Zikula_Exception_Fatal($this->__('Page not found')); } // Only allow subpages if edit access on parent page if (!SecurityUtil::checkPermission('Content:page:', $page['id'] . '::', ACCESS_EDIT)) { throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission()); } PageUtil::setVar('title', $this->__('Clone page') . ' : ' . $page['title']); $this->view->assign('page', $page); Content_Util::contentAddAccess($this->view, $this->pageId); return true; }
/** * Update the configuration values * @author: Sara Arjona Téllez (sarjona@xtec.cat) * @params The config values from the form * @return Thue if success */ public function confupdate($args) { $skins = FormUtil::getPassedValue('skins', isset($args['skins']) ? $args['skins'] : null, 'POST'); $langs = FormUtil::getPassedValue('langs', isset($args['langs']) ? $args['langs'] : null, 'POST'); $maxdelivers = FormUtil::getPassedValue('maxdelivers', isset($args['maxdelivers']) ? $args['maxdelivers'] : null, 'POST'); $basedisturl = FormUtil::getPassedValue('basedisturl', isset($args['basedisturl']) ? $args['basedisturl'] : null, 'POST'); // Security check if (!SecurityUtil::checkPermission('IWqv::', "::", ACCESS_ADMIN)) { throw new Zikula_Exception_Forbidden(); } // Confirm authorisation code $this->checkCsrfToken(); if (isset($skins)) ModUtil::setVar('IWqv', 'skins', $skins); if (isset($langs)) ModUtil::setVar('IWqv', 'langs', $langs); if (isset($maxdelivers)) ModUtil::setVar('IWqv', 'maxdelivers', $maxdelivers); if (isset($basedisturl)) ModUtil::setVar('IWqv', 'basedisturl', $basedisturl); LogUtil::registerStatus($this->__f('Done! %1$s updated.', $this->__('settings'))); return System::redirect(ModUtil::url('IWqv', 'admin', 'main')); }
/** * display theme changing user interface */ public function main() { // check if theme switching is allowed if (!System::getVar('theme_change')) { LogUtil::registerError($this->__('Notice: Theme switching is currently disabled.')); $this->redirect(ModUtil::url('Users', 'user', 'main')); } if (!SecurityUtil::checkPermission('Theme::', '::', ACCESS_COMMENT)) { return LogUtil::registerPermissionError(); } // get our input $startnum = FormUtil::getPassedValue('startnum', isset($args['startnum']) ? $args['startnum'] : 1, 'GET'); // we need this value multiple times, so we keep it $itemsperpage = $this->getVar('itemsperpage'); // get some use information about our environment $currenttheme = ThemeUtil::getInfo(ThemeUtil::getIDFromName(UserUtil::getTheme())); // get all themes in our environment $allthemes = ThemeUtil::getAllThemes(ThemeUtil::FILTER_USER); $previewthemes = array(); $currentthemepic = null; foreach ($allthemes as $key => $themeinfo) { $themename = $themeinfo['name']; if (file_exists($themepic = 'themes/'.DataUtil::formatForOS($themeinfo['directory']).'/images/preview_medium.png')) { $themeinfo['previewImage'] = $themepic; $themeinfo['largeImage'] = 'themes/'.DataUtil::formatForOS($themeinfo['directory']).'/images/preview_large.png'; } else { $themeinfo['previewImage'] = 'system/Theme/images/preview_medium.png'; $themeinfo['largeImage'] = 'system/Theme/images/preview_large.png'; } if ($themename == $currenttheme['name']) { $currentthemepic = $themepic; unset($allthemes[$key]); } else { $previewthemes[$themename] = $themeinfo; } } $previewthemes = array_slice($previewthemes, $startnum-1, $itemsperpage); $this->view->setCaching(Zikula_View::CACHE_DISABLED); $this->view->assign('currentthemepic', $currentthemepic) ->assign('currenttheme', $currenttheme) ->assign('themes', $previewthemes) ->assign('defaulttheme', ThemeUtil::getInfo(ThemeUtil::getIDFromName(System::getVar('Default_Theme')))); // assign the values for the pager plugin $this->view->assign('pager', array('numitems' => sizeof($allthemes), 'itemsperpage' => $itemsperpage)); // Return the output that has been generated by this function return $this->view->fetch('theme_user_main.tpl'); }
/** * Collect available actions for this entity. */ protected function prepareItemActions() { if (!empty($this->_actions)) { return; } $currentType = FormUtil::getPassedValue('type', 'user', 'GETPOST', FILTER_SANITIZE_STRING); $currentFunc = FormUtil::getPassedValue('func', 'main', 'GETPOST', FILTER_SANITIZE_STRING); $dom = ZLanguage::getModuleDomain('Reviews'); if ($currentType == 'admin') { if (in_array($currentFunc, array('main', 'view'))) { $this->_actions[] = array('url' => array('type' => 'user', 'func' => 'display', 'arguments' => array('ot' => 'review', 'id' => $this['id'], 'slug' => $this->slug)), 'icon' => 'preview', 'linkTitle' => __('Open preview page', $dom), 'linkText' => __('Preview', $dom)); $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'display', 'arguments' => array('ot' => 'review', 'id' => $this['id'], 'slug' => $this->slug)), 'icon' => 'display', 'linkTitle' => str_replace('"', '', $this->getTitleFromDisplayPattern()), 'linkText' => __('Details', $dom)); } if (in_array($currentFunc, array('main', 'view', 'display'))) { $component = 'Reviews:Review:'; $instance = $this->id . '::'; if (SecurityUtil::checkPermission($component, $instance, ACCESS_EDIT)) { $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'edit', 'arguments' => array('ot' => 'review', 'id' => $this['id'])), 'icon' => 'edit', 'linkTitle' => __('Edit', $dom), 'linkText' => __('Edit', $dom)); $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'edit', 'arguments' => array('ot' => 'review', 'astemplate' => $this['id'])), 'icon' => 'saveas', 'linkTitle' => __('Reuse for new item', $dom), 'linkText' => __('Reuse', $dom)); } if (SecurityUtil::checkPermission($component, $instance, ACCESS_DELETE)) { $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'delete', 'arguments' => array('ot' => 'review', 'id' => $this['id'])), 'icon' => 'delete', 'linkTitle' => __('Delete', $dom), 'linkText' => __('Delete', $dom)); } } if ($currentFunc == 'display') { $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'view', 'arguments' => array('ot' => 'review')), 'icon' => 'back', 'linkTitle' => __('Back to overview', $dom), 'linkText' => __('Back to overview', $dom)); } } if ($currentType == 'user') { if (in_array($currentFunc, array('main', 'view'))) { if (ModUtil::getVar('Reviews', 'addcategorytitletopermalink') == 1 && ModUtil::getVar('Reviews', 'enablecategorization') == 1) { $this->_actions[] = array('url' => array('type' => 'user', 'func' => 'display', 'arguments' => array('ot' => 'review', 'id' => $this['id'], 'slug' => $this->slug)), 'icon' => 'display', 'linkTitle' => str_replace('"', '', $this->getTitleFromDisplayPattern()), 'linkText' => __('Details', $dom)); } else { $this->_actions[] = array('url' => array('type' => 'user', 'func' => 'display', 'arguments' => array('ot' => 'review', 'id' => $this['id'], 'slug' => $this->slug)), 'icon' => 'display', 'linkTitle' => str_replace('"', '', $this->getTitleFromDisplayPattern()), 'linkText' => __('Details', $dom)); } } /* if (in_array($currentFunc, array('main', 'view', 'display'))) { $component = 'Reviews:Review:'; $instance = $this->id . '::'; if (SecurityUtil::checkPermission($component, $instance, ACCESS_EDIT)) { $this->_actions[] = array( 'url' => array('type' => 'user', 'func' => 'edit', 'arguments' => array('ot' => 'review', 'id' => $this['id'])), 'icon' => 'edit', 'linkTitle' => __('Edit', $dom), 'linkText' => __('Edit', $dom) ); $this->_actions[] = array( 'url' => array('type' => 'user', 'func' => 'edit', 'arguments' => array('ot' => 'review', 'astemplate' => $this['id'])), 'icon' => 'saveas', 'linkTitle' => __('Reuse for new item', $dom), 'linkText' => __('Reuse', $dom) ); } } */ if ($currentFunc == 'display') { $this->_actions[] = array('url' => array('type' => 'user', 'func' => 'view', 'arguments' => array('ot' => 'review')), 'icon' => 'back', 'linkTitle' => __('Back to overview', $dom), 'linkText' => __('Back to overview', $dom)); } } }
function mediashareGetStringUrl($param, $args, $default = null) { $s = isset($args[$param]) ? $args[$param] : FormUtil::getPassedValue($param); if ($s == '') { $s = $default; } return $s; }
public function getFile($args) { // File name with the path $fileName = FormUtil::getPassedValue('fileName', isset($args['fileName']) ? $args['fileName'] : 0, 'GET'); $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); return ModUtil::func('IWmain', 'user', 'getFile', array('fileName' => $fileName, 'sv' => $sv)); }
/** * Get a cookie. * * @param string $name Name of cookie. * @param boolean $signed Override system setting to use signatures. * @param boolean $default Default value. * * @return mixed Cookie value as string or bool false. */ public static function getCookie($name, $signed = true, $default = '') { $cookie = FormUtil::getPassedValue($name, $default, 'COOKIE'); if (System::getVar('signcookies') && !$signed == false) { return SecurityUtil::checkSignedData($cookie); } return $cookie; }
/** * Collect available actions for this entity. */ protected function prepareItemActions() { if (!empty($this->_actions)) { return; } $currentType = FormUtil::getPassedValue('type', 'user', 'GETPOST', FILTER_SANITIZE_STRING); $currentFunc = FormUtil::getPassedValue('func', 'main', 'GETPOST', FILTER_SANITIZE_STRING); $dom = ZLanguage::getModuleDomain('MUBoard'); if ($currentType == 'admin') { if (in_array($currentFunc, array('main', 'view'))) { $this->_actions[] = array('url' => array('type' => 'user', 'func' => 'display', 'arguments' => array('ot' => 'posting', 'id' => $this['id'])), 'icon' => 'preview', 'linkTitle' => __('Open preview page', $dom), 'linkText' => __('Preview', $dom)); $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'display', 'arguments' => array('ot' => 'posting', 'id' => $this['id'])), 'icon' => 'display', 'linkTitle' => str_replace('"', '', $this['title']), 'linkText' => __('Details', $dom)); } if (in_array($currentFunc, array('main', 'view', 'display'))) { if (SecurityUtil::checkPermission('MUBoard::', '.*', ACCESS_EDIT)) { $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'edit', 'arguments' => array('ot' => 'posting', 'id' => $this['id'])), 'icon' => 'edit', 'linkTitle' => __('Edit', $dom), 'linkText' => __('Edit', $dom)); $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'edit', 'arguments' => array('ot' => 'posting', 'astemplate' => $this['id'])), 'icon' => 'saveas', 'linkTitle' => __('Reuse for new item', $dom), 'linkText' => __('Reuse', $dom)); } if (SecurityUtil::checkPermission('MUBoard::', '.*', ACCESS_DELETE)) { $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'delete', 'arguments' => array('ot' => 'posting', 'id' => $this['id'])), 'icon' => 'delete', 'linkTitle' => __('Delete', $dom), 'linkText' => __('Delete', $dom)); } } if ($currentFunc == 'display') { $this->_actions[] = array('url' => array('type' => 'admin', 'func' => 'view', 'arguments' => array('ot' => 'posting')), 'icon' => 'back', 'linkTitle' => __('Back to overview', $dom), 'linkText' => __('Back to overview', $dom)); } } if ($currentType == 'user') { if (in_array($currentFunc, array('main', 'view'))) { $this->_actions[] = array('url' => array('type' => 'user', 'func' => 'display', 'arguments' => array('ot' => 'posting', 'id' => $this['id'])), 'icon' => 'display', 'linkTitle' => str_replace('"', '', $this['title']), 'linkText' => __('Details', $dom)); } if (in_array($currentFunc, array('main', 'view', 'display'))) { if (SecurityUtil::checkPermission('MUBoard::', '.*', ACCESS_EDIT)) { /*$this->_actions[] = array( 'url' => array('type' => 'user', 'func' => 'edit', 'arguments' => array('ot' => 'posting')), 'icon' => 'save', 'linkTitle' => __('Create new issue', $dom), 'linkText' => __('', $dom) ); $this->_actions[] = array( 'url' => array('type' => 'user', 'func' => 'edit', 'arguments' => array('ot' => 'posting', 'id' => $this['id'])), 'icon' => 'edit', 'linkTitle' => __('Edit', $dom), 'linkText' => __('Edit', $dom) ); $this->_actions[] = array( 'url' => array('type' => 'user', 'func' => 'edit', 'arguments' => array('ot' => 'posting', 'astemplate' => $this['id'])), 'icon' => 'saveas', 'linkTitle' => __('Reuse for new item', $dom), 'linkText' => __('Reuse', $dom) );*/ } } if ($currentFunc == 'display') { $this->_actions[] = array('url' => array('type' => 'user', 'func' => 'display', 'arguments' => array('ot' => 'forum', 'id' => $posting . Forum . id)), 'icon' => 'back', 'linkTitle' => __('Back to forum ', $dom) . $posting . Forum . title, 'linkText' => __('Back to forum overview', $dom)); $this->_actions[] = array('url' => array('type' => 'user', 'func' => 'view', 'arguments' => array('ot' => 'category')), 'icon' => 'back', 'linkTitle' => __('Back to forum overview', $dom), 'linkText' => __('', $dom)); } } }
/** * Sets custom plugin variables. */ public function setParameters() { // Object types to be used in the newsletter $objectTypes = FormUtil::getPassedValue($this->modname . 'ObjectTypes', array(), 'POST'); $this->setPluginVar('ObjectTypes', array_keys($objectTypes)); // Additional arguments $args = FormUtil::getPassedValue($this->modname . 'Args', array(), 'POST'); $this->setPluginVar('Args', $args); }
public function initialize(Zikula_Form_View $view) { $this->contentId = (int) FormUtil::getPassedValue('cid', isset($this->args['cid']) ? $this->args['cid'] : -1); $this->language = ZLanguage::getLanguageCode(); $content = ModUtil::apiFunc('Content', 'Content', 'getContent', array('id' => $this->contentId, 'language' => $this->language, 'translate' => false)); if ($content === false) { return $this->view->registerError(null); } $this->contentType = ModUtil::apiFunc('Content', 'Content', 'getContentType', $content); if ($this->contentType === false) { return $this->view->registerError(null); } $this->pageId = $content['pageId']; if ((bool) $this->getVar('inheritPermissions', false) === true) { if (!ModUtil::apiFunc('Content', 'page', 'checkPermissionForPageInheritance', array('pageId' => $this->pageId, 'level' => ACCESS_EDIT))) { throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission()); } } else { if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) { throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission()); } } $page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'includeContent' => false, 'filter' => array('checkActive' => false))); if ($page === false) { return $this->view->registerError(null); } if ($this->language == $page['language']) { return $this->view->registerError(LogUtil::registerError($this->__f('Sorry, you cannot translate an item to the same language as it\'s default language ("%1$s"). Change the current site language ("%2$s") to some other language on the <a href="%3$s">localisation settings</a> page.<br /> Another way is to add, for instance, <strong>&lang=de</strong> to the url for changing the current site language to German and after that the item can be translated to German.', array($page['language'], $this->language, ModUtil::url('Settings', 'admin', 'multilingual'))))); } $translationInfo = ModUtil::apiFunc('Content', 'Content', 'getTranslationInfo', array('contentId' => $this->contentId)); if ($translationInfo === false) { return $this->view->registerError(null); } PageUtil::setVar('title', $this->__("Translate content item") . ' : ' . $page['title']); $templates = $this->contentType['plugin']->getTranslationTemplates(); $this->view->assign('translationtemplates', $templates); $this->view->assign('page', $page); $this->view->assign('data', $content['data']); $this->view->assign('isTranslatable', $content['isTranslatable']); $this->view->assign('translated', isset($content['translated']) ? $content['translated'] : array()); $this->view->assign('translationInfo', $translationInfo); $this->view->assign('translationStep', $this->contentId); $this->view->assign('language', $this->language); $this->view->assign('contentType', $this->contentType); Content_Util::contentAddAccess($this->view, $this->pageId); if (!$this->view->isPostBack() && FormUtil::getPassedValue('back', 0)) { $this->backref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null; } if ($this->backref != null) { $returnUrl = $this->backref; } else { $returnUrl = ModUtil::url('Content', 'admin', 'editpage', array('pid' => $this->pageId)); } ModUtil::apiFunc('PageLock', 'user', 'pageLock', array('lockName' => "contentTranslateContent{$this->contentId}", 'returnUrl' => $returnUrl)); return true; }
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; }
public function initialize(Zikula_Form_View $view) { $this->pageId = (int) FormUtil::getPassedValue('pid', isset($this->args['pid']) ? $this->args['pid'] : -1); if ((bool) $this->getVar('inheritPermissions', false) === true) { if (!ModUtil::apiFunc('Content', 'page', 'checkPermissionForPageInheritance', array('pageId' => $this->pageId, 'level' => ACCESS_EDIT))) { throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission()); } } else { if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) { throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission()); } } $page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'editing' => true, 'filter' => array('checkActive' => false), 'enableEscape' => false, 'translate' => false, 'includeContent' => true, 'includeCategories' => true)); if ($page === false) { return $this->view->registerError(null); } // load the category registry util $mainCategory = CategoryRegistryUtil::getRegisteredModuleCategory('Content', 'content_page', $this->getVar('categoryPropPrimary'), 30); $secondCategory = CategoryRegistryUtil::getRegisteredModuleCategory('Content', 'content_page', $this->getVar('categoryPropSecondary')); $multilingual = ModUtil::getVar(ModUtil::CONFIG_MODULE, 'multilingual'); if ($page['language'] == ZLanguage::getLanguageCode()) { $multilingual = false; } PageUtil::setVar('title', $this->__("Edit page") . ' : ' . $page['title']); $pagelayout = ModUtil::apiFunc('Content', 'Layout', 'getLayout', array('layout' => $page['layout'])); if ($pagelayout === false) { return $this->view->registerError(null); } $layouts = ModUtil::apiFunc('Content', 'Layout', 'getLayouts'); if ($layouts === false) { return $this->view->registerError(null); } $layoutTemplate = $page['layoutEditTemplate']; $this->view->assign('layoutTemplate', $layoutTemplate); $this->view->assign('mainCategory', $mainCategory); $this->view->assign('secondCategory', $secondCategory); $this->view->assign('page', $page); $this->view->assign('multilingual', $multilingual); $this->view->assign('layouts', $layouts); $this->view->assign('pagelayout', $pagelayout); $this->view->assign('enableVersioning', $this->getVar('enableVersioning')); $this->view->assign('categoryUsage', $this->getVar('categoryUsage')); Content_Util::contentAddAccess($this->view, $this->pageId); if (!$this->view->isPostBack() && FormUtil::getPassedValue('back', 0)) { $this->backref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null; } if ($this->backref != null) { $returnUrl = $this->backref; } else { $returnUrl = ModUtil::url('Content', 'admin', 'main'); } ModUtil::apiFunc('PageLock', 'user', 'pageLock', array('lockName' => "contentPage{$this->pageId}", 'returnUrl' => $returnUrl)); return true; }
/** * This function returns the name of the tab * * @return string */ public function getTitle() { $uid = (int) FormUtil::getPassedValue('uid'); $settings = ModUtil::apiFunc('MyProfile', 'user', 'getSettings', array('uid' => $uid)); if ($settings['nocomments'] == 1) { // Show no tab header return false; } else { return $this->__("User's pinboard"); } }
/** * 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; }
/** * Show the month calendar into a bloc * * @param array $blockinfo The month and the year to show * * @return The calendar content */ public function display($blockinfo) { $mes = FormUtil::getPassedValue('mes', isset($args['mes']) ? $args['mes'] : 0, 'REQUEST'); $any = FormUtil::getPassedValue('any', isset($args['any']) ? $args['any'] : 0, 'REQUEST'); // Security check if (!SecurityUtil::checkPermission("IWagendas:calendarblock:", $blockinfo['title'] . "::", ACCESS_READ)) return; // Check if the module is available if (!ModUtil::available('IWagendas')) return; $user = (UserUtil::isLoggedIn()) ? UserUtil::getVar('uid') : '-1'; //get the calendar saved in the user vars. $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); $exists = ModUtil::apiFunc('IWmain', 'user', 'userVarExists', array('name' => 'Calendar', 'module' => 'IWagendas', 'uid' => $user, 'sv' => $sv)); /* if ($exists) { $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); $s = ModUtil::func('IWmain', 'user', 'userGetVar', array('uid' => $user, 'name' => 'calendar', 'module' => 'IWagendas', 'sv' => $sv, 'nult' => true)); $blockinfo['content'] = $s; return BlockUtil::themesideblock($blockinfo); } * */ $s = ModUtil::func('IWagendas', 'user', 'getCalendarContent', array('mes' => $mes, 'any' => $any)); //Copy the block information into user vars $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); ModUtil::func('IWmain', 'user', 'userSetVar', array('uid' => $user, 'name' => 'calendar', 'module' => 'IWagendas', 'sv' => $sv, 'value' => $s, 'lifetime' => '700')); //Copy the block information into user vars $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); ModUtil::func('IWmain', 'user', 'userSetVar', array('uid' => $user, 'name' => 'month', 'module' => 'IWagendas', 'sv' => $sv, 'value' => $mes)); // Populate block info and pass to theme $blockinfo['content'] = $s; return BlockUtil::themesideblock($blockinfo); }
/** * Mediashare AJAX handler * * @copyright (C) 2007, Jorn Wildt * @link http://www.elfisk.dk * @version $Id$ * @license See license.txt */ function mediashare_ajax_getitems($args) { $items = pnModAPIFunc('mediashare', 'user', 'getMediaItems', array('albumId' => FormUtil::getPassedValue('aid'))); if ($items === false) { AjaxUtil::error(LogUtil::getErrorMessagesText(' - '), '403 Forbidden'); } $mediaItems = array(); foreach ($items as $item) { $mediaItems[] = array('id' => $item['id'], 'isExternal' => $item['mediaHandler'] == 'extapp', 'thumbnailRef' => $item['thumbnailRef'], 'previewRef' => $item['previewRef'], 'title' => $item['title']); } return array('mediaItems' => $mediaItems); }