本文整理汇总了PHP中FormUtil类的典型用法代码示例。如果您正苦于以下问题:PHP FormUtil类的具体用法?PHP FormUtil怎么用?PHP FormUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FormUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mediashare_external_pasteitem
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;
}
示例2: coreinit
/**
* 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);
}
}
}
示例3: confupdate
/**
* 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'));
}
示例4: initialize
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;
}
示例5: FlashChatBridge_user_showChat
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");
}
}
示例6: updateConfig
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'));
}
示例7: modifyconfig
public function modifyconfig()
{
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Scribite::', '::', ACCESS_ADMIN), LogUtil::getErrorMsgPermission());
// Create form
$form = FormUtil::newForm('Scribite', $this);
return $form->execute('admin/modifyconfig.tpl', new Scribite_FormHandler_ModifyConfig());
}
示例8: initialize
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;
}
示例9: decode
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);
}
}
示例10: update
function update($blockinfo)
{
$vars = BlockUtil::varsFromContent($blockinfo['content']);
$vars['page'] = FormUtil::getPassedValue('page', 0, 'POST');
$blockinfo['content'] = BlockUtil::varsToContent($vars);
return $blockinfo;
}
示例11: deleteidsentry
/**
* 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'));
}
示例12: initialize
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;
}
示例13: initialize
/**
* 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;
}
示例14: delete
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);
}
示例15: updateConf
/**
* 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'));
}