本文整理汇总了PHP中SecurityUtil类的典型用法代码示例。如果您正苦于以下问题:PHP SecurityUtil类的具体用法?PHP SecurityUtil怎么用?PHP SecurityUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SecurityUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: smarty_function_securityutil_checkpermission
/**
* Example:
* {securityutil_checkpermission component='Users::' instance='.*' level='ACCESS_ADMIN' assign='auth'}
*
* true/false will be returned.
*
* This file is a plugin for Zikula_View, the Zikula implementation of Smarty
* @param array $params All attributes passed to this function from the template
* @param object $smarty Reference to the Smarty object
* @return boolean authorized?
*/
function smarty_function_securityutil_checkpermission($params, $smarty)
{
LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated, please use {%2$s} instead.', array('securityutil_checkpermission', 'checkpermission')), E_USER_DEPRECATED);
if (!isset($params['component'])) {
$smarty->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('securityutil_checkpermission', 'component')));
return false;
}
if (!isset($params['instance'])) {
$smarty->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('securityutil_checkpermission', 'instance')));
return false;
}
if (!isset($params['level'])) {
$smarty->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('securityutil_checkpermission', 'level')));
return false;
}
$result = SecurityUtil::checkPermission($params['component'], $params['instance'], constant($params['level']));
if (isset($params['assign'])) {
$smarty->assign($params['assign'], $result);
} else {
return $result;
}
}
开发者ID:,项目名称:,代码行数:38,代码来源:
示例2: smarty_function_selector_user_category
/**
* User category selector.
*
* Available parameters:
* - btnText: If set, the results are assigned to the corresponding variable instead of printed out
* - cid: category ID
*
* Example
* {selector_user_category cid="1" assign="category"}
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @return string HTML code of the selector.
*/
function smarty_function_selector_user_category($params, Zikula_View $view)
{
$field = isset($params['field']) ? $params['field'] : 'id';
$selectedValue = isset($params['selectedValue']) ? $params['selectedValue'] : 0;
$defaultValue = isset($params['defaultValue']) ? $params['defaultValue'] : 0;
$defaultText = isset($params['defaultText']) ? $params['defaultText'] : '';
$lang = isset($params['lang']) ? $params['lang'] : ZLanguage::getLanguageCode();
$name = isset($params['name']) ? $params['name'] : 'defautlselectorname';
$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;
$submit = isset($params['submit']) ? $params['submit'] : false;
$multipleSize = isset($params['multipleSize']) ? $params['multipleSize'] : 1;
$doReplaceRootCat = false;
$userCats = ModUtil::apiFunc('ZikulaCategoriesModule', 'user', 'getusercategories', array('returnCategory' => 1, 'relative' => $relative));
$html = CategoryUtil::getSelector_Categories($userCats, $field, $selectedValue, $name, $defaultValue, $defaultText, $submit, $displayPath, $doReplaceRootCat, $multipleSize);
if ($editLink && $allowUserEdit && UserUtil::isLoggedIn() && SecurityUtil::checkPermission('ZikulaCategoriesModule::', "{$category['id']}::", ACCESS_EDIT)) {
$url = ModUtil::url('ZikulaCategoriesModule', 'user', 'edituser');
$html .= " <a href=\"{$url}\">" . __('Edit sub-categories') . '</a>';
}
if ($assign) {
$view->assign($assign, $html);
} else {
return $html;
}
}
开发者ID:rmaiwald,项目名称:core,代码行数:47,代码来源:function.selector_user_category.php
示例3: smarty_function_secauthaction
/**
* Example:
* {secauthaction comp="Stories::" inst=".*" level="ACCESS_ADMIN" assign="auth"}
*
* true/false will be returned.
*
* This file is a plugin for Zikula_View, the Zikula implementation of Smarty
* @param array $params All attributes passed to this function from the template
* @param object &$smarty Reference to the Smarty object
* @return boolean authorized?
*/
function smarty_function_secauthaction($params, &$smarty)
{
LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated, please use {%2$s} instead.', array('secauthaction', 'checkpermission')), E_USER_DEPRECATED);
$assign = isset($params['assign']) ? $params['assign'] : null;
$comp = isset($params['comp']) ? $params['comp'] : null;
$inst = isset($params['inst']) ? $params['inst'] : null;
$level = isset($params['level']) ? $params['level'] : null;
if (!$comp) {
$smarty->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('smarty_function_secauthaction', 'comp')));
return false;
}
if (!$inst) {
$smarty->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('smarty_function_secauthaction', 'inst')));
return false;
}
if (!$level) {
$smarty->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('smarty_function_secauthaction', 'level')));
return false;
}
$result = SecurityUtil::checkPermission($comp, $inst, constant($level));
if ($assign) {
$smarty->assign($assign, $result);
} else {
return $result;
}
}
开发者ID:,项目名称:,代码行数:43,代码来源:
示例4: uninstall
/**
* Desinstal·lació del mòdul Cataleg
*
* @return bool true si ha anat tot bé, false en qualsevol altre cas.
*/
public function uninstall()
{
if (!SecurityUtil::checkPermission('Cataleg::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
// Esborrar taules del mòdul
if (!DBUtil::dropTable('cataleg')||
!DBUtil::dropTable('cataleg_eixos')||
!DBUtil::dropTable('cataleg_prioritats')||
!DBUtil::dropTable('cataleg_unitatsImplicades')||
!DBUtil::dropTable('cataleg_subprioritats')||
!DBUtil::dropTable('cataleg_activitats')||
!DBUtil::dropTable('cataleg_activitatsZona')||
!DBUtil::dropTable('cataleg_unitats')||
!DBUtil::dropTable('cataleg_responsables')||
!DBUtil::dropTable('cataleg_contactes')||
!DBUtil::dropTable('cataleg_auxiliar')||
!DBUtil::dropTable('cataleg_centresActivitat')||
!DBUtil::dropTable('cataleg_centres')||
!DBUtil::dropTable('cataleg_gestioActivitatDefaults')||
!DBUtil::dropTable('cataleg_importTaules')||
!DBUtil::dropTable('cataleg_importAssign')||
!DBUtil::dropTable('cataleg_gtafEntities')||
!DBUtil::dropTable('cataleg_gtafGroups')
)
return false;
//Esborrar variables del mòdul
$this->delVars();
// unregister hook handlers
HookUtil::unregisterSubscriberBundles($this->version->getHookSubscriberBundles());
return true;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:37,代码来源:Installer.php
示例5: mediashare_mediahandlerapi_scanMediaHandlers
function mediashare_mediahandlerapi_scanMediaHandlers()
{
// Check access
if (!SecurityUtil::checkPermission('mediashare::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
$dom = ZLanguage::getModuleDomain('mediashare');
// Clear existing handler table
if (!DBUtil::truncateTable('mediashare_mediahandlers')) {
return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('mediahandlerapi.scanMediaHandlers', __f("Could not clear the '%s' table.", 'mediahandlers', $dom)), $dom));
}
// Scan for handlers APIs
$files = FileUtil::getFiles('modules/mediashare', false, true, 'php', 'f');
foreach ($files as $file) {
if (preg_match('/^pnmedia_([-a-zA-Z0-9_]+)api.php$/', $file, $matches)) {
$handlerName = $matches[1];
$handlerApi = "media_{$handlerName}";
// Force load - it is used during pninit
pnModAPILoad('mediashare', $handlerApi, true);
if (!($handler = pnModAPIFunc('mediashare', $handlerApi, 'buildHandler'))) {
return false;
}
$fileTypes = $handler->getMediaTypes();
foreach ($fileTypes as $fileType) {
$fileType['handler'] = $handlerName;
$fileType['title'] = $handler->getTitle();
if (!pnModAPIFunc('mediashare', 'mediahandler', 'addMediaHandler', $fileType)) {
return false;
}
}
}
}
return true;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:34,代码来源:pnmediahandlerapi.php
示例6: getlinks
/**
* get available Admin panel links
*
* @return array Array of admin links
*/
public function getlinks()
{
$links = array();
if (SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_READ)) {
$links[] = array('url' => ModUtil::url($this->name, 'user', 'main'), 'text' => $this->__('Frontend'), 'title' => $this->__('Switch to user area.'), 'class' => 'z-icon-es-home');
}
if (SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN)) {
$links[] = array('url' => ModUtil::url($this->name, 'admin', 'view', array('ot' => 'category')), 'text' => $this->__('Categories'), 'title' => $this->__('Category list'));
}
if (SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN)) {
$links[] = array('url' => ModUtil::url($this->name, 'admin', 'view', array('ot' => 'forum')), 'text' => $this->__('Forums'), 'title' => $this->__('Forum list'));
}
if (SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN)) {
$links[] = array('url' => ModUtil::url($this->name, 'admin', 'view', array('ot' => 'posting')), 'text' => $this->__('Postings'), 'title' => $this->__('Posting list'));
}
if (SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN)) {
$links[] = array('url' => ModUtil::url($this->name, 'admin', 'view', array('ot' => 'abo')), 'text' => $this->__('Abos'), 'title' => $this->__('Abo list'));
}
if (SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN)) {
$links[] = array('url' => ModUtil::url($this->name, 'admin', 'view', array('ot' => 'user')), 'text' => $this->__('Users'), 'title' => $this->__('User list'));
}
if (SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN)) {
$links[] = array('url' => ModUtil::url($this->name, 'admin', 'view', array('ot' => 'rank')), 'text' => $this->__('Ranks'), 'title' => $this->__('Rank list'));
}
if (SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN)) {
$links[] = array('url' => ModUtil::url($this->name, 'admin', 'config'), 'text' => $this->__('Configuration'), 'title' => $this->__('Manage settings for this application'));
}
return $links;
}
开发者ID:rmaiwald,项目名称:MUBoard,代码行数:34,代码来源:Admin.php
示例7: initialize
public function initialize(Zikula_Form_View $view)
{
if (!SecurityUtil::checkPermission('Content::', '::', ACCESS_ADMIN)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
$catoptions = array( array('text' => $this->__('Use 2 category levels (1st level single, 2nd level multi selection)'), 'value' => '1'),
array('text' => $this->__('Use 2 category levels (both single selection)'), 'value' => '2'),
array('text' => $this->__('Use 1 category level'), 'value' => '3'),
array('text' => $this->__("Don't use Categories at all"), 'value' => '4') );
$this->view->assign('catoptions', $catoptions);
$this->view->assign('categoryusage', 1);
$activeoptions = array( array('text' => $this->__('New pages will be active and available in the menu'), 'value' => '1'),
array('text' => $this->__('New pages will be inactive and available in the menu'), 'value' => '2'),
array('text' => $this->__('New pages will be active and not available in the menu'), 'value' => '3'),
array('text' => $this->__('New pages will be inactive and not available in the menu'), 'value' => '4') );
$this->view->assign('activeoptions', $activeoptions);
$pageinfolocationoptions = array( array('text' => $this->__('Top of the page, left of the page title'), 'value' => 'top'),
array('text' => $this->__('Bottom of the page'), 'value' => 'bottom') );
$this->view->assign('pageinfolocationoptions', $pageinfolocationoptions);
// Assign all module vars
$this->view->assign('config', ModUtil::getVar('Content'));
return true;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:27,代码来源:Settings.php
示例8: mediashare_sourcesapi_scanSources
function mediashare_sourcesapi_scanSources()
{
// Check access
if (!SecurityUtil::checkPermission('mediashare::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
$dom = ZLanguage::getModuleDomain('mediashare');
// Clear existing sources table
if (!DBUtil::truncateTable('mediashare_sources')) {
return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('sourcesapi.scanSources', __f("Could not clear the '%s' table.", 'sources', $dom)), $dom));
}
// Scan for sources APIs
$files = FileUtil::getFiles('modules/mediashare', false, true, 'php', 'f');
foreach ($files as $file) {
if (preg_match('/^pnsource_([-a-zA-Z0-9_]+)api.php$/', $file, $matches)) {
$sourceName = $matches[1];
$sourceApi = "source_{$sourceName}";
// Force load - it is used during pninit
pnModAPILoad('mediashare', $sourceApi, true);
if (!($title = pnModAPIFunc('mediashare', $sourceApi, 'getTitle'))) {
return false;
}
if (!pnModAPIFunc('mediashare', 'sources', 'addSource', array('title' => $title, 'name' => $sourceName))) {
return false;
}
}
}
return true;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:29,代码来源:pnsourcesapi.php
示例9: setstatus
/**
* This function sets active/inactive status.
*
* @param eid
*
* @return mixed true or Ajax error
*/
public function setstatus()
{
$this->checkAjaxToken();
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Ephemerides::', '::', ACCESS_ADMIN));
$eid = $this->request->request->get('eid', 0);
$status = $this->request->request->get('status', 0);
$alert = '';
if ($eid == 0) {
$alert .= $this->__('No ID passed.');
} else {
$item = array('eid' => $eid, 'status' => $status);
$res = DBUtil::updateObject($item, 'ephem', '', 'eid');
if (!$res) {
$alert .= $item['eid'] . ', ' . $this->__f('Could not change item, ID %s.', DataUtil::formatForDisplay($eid));
if ($item['status']) {
$item['status'] = 0;
} else {
$item['status'] = 1;
}
}
}
// get current status to return
$item = ModUtil::apiFunc($this->name, 'user', 'get', array('eid' => $eid));
if (!$item) {
$alert .= $this->__f('Could not get data, ID %s.', DataUtil::formatForDisplay($eid));
}
return new Zikula_Response_Ajax(array('eid' => $eid, 'status' => $item['status'], 'alert' => $alert));
}
开发者ID:nmpetkov,项目名称:Ephemerides,代码行数:35,代码来源:Ajax.php
示例10: edit
/**
* Create or edit record.
*
* @return string|boolean Output.
*/
public function edit()
{
if (!SecurityUtil::checkPermission('ExampleDoctrine::', '::', ACCESS_ADD)) {
return LogUtil::registerPermissionError(ModUtil::url('ExampleDoctrine', 'user', 'index'));
}
$id = $this->request->query->getInt('id');
if ($id) {
// load user with id
$user = $this->entityManager->find('ExampleDoctrine_Entity_User', $id);
if (!$user) {
return LogUtil::registerError($this->__f('User with id %s not found', $id));
}
} else {
$user = new ExampleDoctrine_Entity_User();
}
/* @var $form Symfony\Component\Form\Form */
$form = $this->serviceManager->getService('symfony.formfactory')->create(new ExampleDoctrine_Form_UserType(), $user);
if ($this->request->getMethod() == 'POST') {
$form->bindRequest($this->request);
if ($form->isValid()) {
$data = $form->getData();
$this->entityManager->persist($data);
$this->entityManager->flush();
return $this->redirect(ModUtil::url('ExampleDoctrine', 'user', 'view'));
}
}
return $this->view->assign('form', $form->createView())->fetch('exampledoctrine_user_edit.tpl');
}
开发者ID:planetenkiller,项目名称:core,代码行数:33,代码来源:User.php
示例11: display
/**
* display block
*
* @param array $blockinfo a blockinfo structure
* @return output the rendered bock
*/
public function display($blockinfo)
{
// Security check
if (!SecurityUtil::checkPermission('Searchblock::', "{$blockinfo['title']}::", ACCESS_READ)) {
return;
}
// Get current content
$vars = BlockUtil::varsFromContent($blockinfo['content']);
// set some defaults
if (!isset($vars['displaySearchBtn'])) {
$vars['displaySearchBtn'] = 0;
}
if (!isset($vars['active'])) {
$vars['active'] = array();
}
// assign the block vars array
$this->view->assign('vars', $vars);
// set a title if one isn't present
if (empty($blockinfo['title'])) {
$blockinfo['title'] = __('Search');
}
// return the rendered block
$blockinfo['content'] = $this->view->fetch('search_block_search.tpl');
return BlockUtil::themeBlock($blockinfo);
}
开发者ID:,项目名称:,代码行数:31,代码来源:
示例12: initialize
public function initialize(Zikula_Form_View $view)
{
if (!SecurityUtil::checkPermission('Content::', '::', ACCESS_ADMIN)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
$catoptions = array(array('text' => $this->__('Use 2 category levels (1st level single, 2nd level multi selection)'), 'value' => '1'), array('text' => $this->__('Use 2 category levels (both single selection)'), 'value' => '2'), array('text' => $this->__('Use 1 category level'), 'value' => '3'), array('text' => $this->__("Don't use Categories at all"), 'value' => '4'));
$this->view->assign('catoptions', $catoptions);
$this->view->assign('categoryusage', 1);
$activeoptions = array(array('text' => $this->__('New pages will be active and available in the menu'), 'value' => '1'), array('text' => $this->__('New pages will be inactive and available in the menu'), 'value' => '2'), array('text' => $this->__('New pages will be active and not available in the menu'), 'value' => '3'), array('text' => $this->__('New pages will be inactive and not available in the menu'), 'value' => '4'));
$this->view->assign('activeoptions', $activeoptions);
$pageinfolocationoptions = array(array('text' => $this->__('Top of the page, left of the page title'), 'value' => 'top'), array('text' => $this->__('Bottom of the page'), 'value' => 'bottom'));
$this->view->assign('pageinfolocationoptions', $pageinfolocationoptions);
// get all module variables
$modvars = ModUtil::getVar('Content');
// Prepare list of layout options that are displayed for new pages
$layoutdisplayoptions = array();
$layoutDisplaySelection = array();
foreach ($modvars['layoutDisplay'] as $layout) {
$layoutdisplayoptions[] = array('text' => $layout['description'], 'value' => $layout['name']);
if ($layout['display']) {
$layoutDisplaySelection[] = $layout['name'];
}
}
$this->view->assign('layoutdisplayoptions', $layoutdisplayoptions);
$this->view->assign('layoutDisplaySelection', $layoutDisplaySelection);
// Assign all module vars
$this->view->assign('config', $modvars);
return true;
}
开发者ID:robbrandt,项目名称:Content,代码行数:29,代码来源:Settings.php
示例13: getContent
public function getContent($args)
{
switch ($args['pluginid']) {
case 1:
//$uid = $args['uid'];
// Get matching news stories published since last newsletter
// No selection on categories made !!
$items = ModUtil::apiFunc('News', 'user', 'getall',
array('numitems' => $this->getVar('itemsperpage'),
'status' => 0,
'from' => DateUtil::getDatetime($args['last']),
'filterbydate' => true));
if ($items != false) {
if ($args['contenttype'] == 't') {
$counter = 0;
$output.="\n";
foreach ($items as $item) {
$counter++;
$output .= $counter . '. ' . $item['title'] . " (" . $this->__f('by %1$s on %2$s', array($item['contributor'], DateUtil::formatDatetime($item['from'], 'datebrief'))) . ")\n";
}
} else {
$render = Zikula_View::getInstance('News');
$render->assign('readperm', SecurityUtil::checkPermission('News::', "::", ACCESS_READ));
$render->assign('articles', $items);
$output = $render->fetch('mailz/listarticles.tpl');
}
} else {
$output = $this->__f('No News publisher articles since last newsletter on %s.', DateUtil::formatDatetime($args['last'], 'datebrief')) . "\n";
}
return $output;
}
return '';
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:33,代码来源:Mailz.php
示例14: authenticate
private function authenticate($column, $loginstr, $password)
{
$fromTable = $this->_websoccer->getConfig('db_prefix') . '_user';
// get user data
$columns = 'id, passwort, passwort_neu, passwort_salt';
$wherePart = $column . ' = \'%s\' AND status = 1';
$parameter = $loginstr;
$result = $this->_db->querySelect($columns, $fromTable, $wherePart, $parameter);
$userdata = $result->fetch_array();
$result->free();
// user does not exist
if (!$userdata['id']) {
return FALSE;
}
// check password
$inputPassword = SecurityUtil::hashPassword($password, $userdata['passwort_salt']);
if ($inputPassword != $userdata['passwort'] && $inputPassword != $userdata['passwort_neu']) {
return FALSE;
}
// update password after a generated one
if ($userdata['passwort_neu'] == $inputPassword) {
$columns = array('passwort' => $inputPassword, 'passwort_neu_angefordert' => 0, 'passwort_neu' => '');
$whereCondition = 'id = %d';
$parameter = $userdata['id'];
$this->_db->queryUpdate($columns, $fromTable, $whereCondition, $parameter);
}
return $userdata['id'];
}
开发者ID:astroChasqui,项目名称:open-websoccer,代码行数:28,代码来源:DefaultUserLoginMethod.class.php
示例15: dispatch
/**
* Dispatch a module view request.
*
* @return mixed
*/
public function dispatch()
{
if (!SecurityUtil::checkPermission('Extensions::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
// Get input.
$moduleName = $this->request->getGet()->filter('_module', null, FILTER_SANITIZE_STRING);
$pluginName = $this->request->getGet()->filter('_plugin', null, FILTER_SANITIZE_STRING);
$action = $this->request->getGet()->filter('_action', null, FILTER_SANITIZE_STRING);
// Load plugins.
if (!$moduleName) {
$type = 'SystemPlugin';
PluginUtil::loadAllSystemPlugins();
} else {
$type = 'ModulePlugin';
PluginUtil::loadAllModulePlugins();
}
if ($moduleName) {
$serviceId = PluginUtil::getServiceId("{$type}_{$moduleName}_{$pluginName}_Plugin");
} else {
$serviceId = PluginUtil::getServiceId("{$type}_{$pluginName}_Plugin");
}
$this->throwNotFoundUnless($this->serviceManager->hasService($serviceId));
$this->plugin = $this->serviceManager->getService($serviceId);
// Sanity checks.
$this->throwNotFoundUnless($this->plugin->isInstalled(), __f('Plugin "%s" is not installed', $this->plugin->getMetaDisplayName()));
$this->throwForbiddenUnless($this->plugin instanceof Zikula_Plugin_ConfigurableInterface, __f('Plugin "%s" is not configurable', $this->plugin->getMetaDisplayName()));
$this->pluginController = $this->plugin->getConfigurationController();
$this->throwNotFoundUnless($this->pluginController->getReflection()->hasMethod($action));
return $this->pluginController->{$action}();
}
开发者ID:,项目名称:,代码行数:36,代码来源:
示例16: editsmilies
/**
* editsmilies
*
*
*/
public function editsmilies()
{
if (!SecurityUtil::checkPermission('BBSmile::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError(System::getHomepageUrl());
}
$submit = $this->getPassedValue('submit', null, 'POST');
if (!$submit) {
$smilies = $this->getVar('smilie_array');
$this->view->assign('smilies', $smilies);
return $this->view->fetch('admin/editsmiles.tpl');
}
// submit is set
$this->checkCsrfToken();
// Get input
$keys = $this->getPassedValue('key', array(), 'POST');
$shorts = $this->getPassedValue('short', array(), 'POST');
$imgsrcs = $this->getPassedValue('imgsrc', array(), 'POST');
$alts = $this->getPassedValue('alt', array(), 'POST');
$aliases = $this->getPassedValue('alias', array(), 'POST');
$types = $this->getPassedValue('smilietype', array(), 'POST');
$active = $this->getPassedValue('active', array(), 'POST');
$smilies = array();
// Create an array with the input and deaktivate all smilies
for ($i = 0; $i < sizeof($keys); $i++) {
$smilies[$keys[$i]] = array('type' => $types[$i], 'short' => $shorts[$i], 'imgsrc' => $imgsrcs[$i], 'alt' => $alts[$i], 'alias' => $aliases[$i], 'active' => 0);
}
// And now set the active flag for all selected smilies
for ($i = 0; $i < sizeof($active); $i++) {
$smilies[$active[$i]]['active'] = 1;
}
$this->setVar('smilie_array', $smilies);
LogUtil::registerStatus($this->__('The edited smilies have been saved.'));
$this->redirect(ModUtil::url('BBSmile', 'admin', 'main'));
}
开发者ID:rmaiwald,项目名称:BBSmile,代码行数:39,代码来源:Admin.php
示例17: toggleblock
/**
* Toggleblock.
*
* This function toggles active/inactive.
*
* @param bid int id of block to toggle.
*
* @return mixed true or Ajax error
*/
public function toggleblock()
{
$this->checkAjaxToken();
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Blocks::', '::', ACCESS_ADMIN));
$bid = $this->request->request->get('bid', -1);
if ($bid == -1) {
throw new Zikula_Exception_Fatal($this->__('No block ID passed.'));
}
// read the block information
$blockinfo = BlockUtil::getBlockInfo($bid);
if ($blockinfo == false) {
throw new Zikula_Exception_Fatal($this->__f('Error! Could not retrieve block information for block ID %s.', DataUtil::formatForDisplay($bid)));
}
if ($blockinfo['active'] == 1) {
ModUtil::apiFunc('Blocks', 'admin', 'deactivate', array('bid' => $bid));
} else {
ModUtil::apiFunc('Blocks', 'admin', 'activate', array('bid' => $bid));
}
return new Zikula_Response_Ajax(array('bid' => $bid));
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:34,代码来源:Ajax.php
示例18: display
/**
* Display block
*/
public function display($blockinfo)
{
if (!SecurityUtil::checkPermission('Zgoodies:marqueeblock:', "{$blockinfo['bid']}::", ACCESS_OVERVIEW)) {
return;
}
if (!ModUtil::available('Zgoodies')) {
return;
}
$vars = BlockUtil::varsFromContent($blockinfo['content']);
$lang = ZLanguage::getLanguageCode();
// block title
if (isset($vars['block_title'][$lang]) && !empty($vars['block_title'][$lang])) {
$blockinfo['title'] = $vars['block_title'][$lang];
}
// marquee content
if (isset($vars['marquee_content'][$lang]) && !empty($vars['marquee_content'][$lang])) {
$vars['marquee_content_lang'] = $vars['marquee_content'][$lang];
}
if (!isset($vars['marquee_content'])) {
$vars['marquee_content_lang'] = '';
}
$this->view->assign('vars', $vars);
$this->view->assign('bid', $blockinfo['bid']);
$blockinfo['content'] = $this->view->fetch('blocks/' . $vars['block_template']);
if (isset($vars['block_wrap']) && !$vars['block_wrap']) {
if (empty($blockinfo['title'])) {
return $blockinfo['content'];
} else {
return '<h4>' . DataUtil::formatForDisplayHTML($blockinfo['title']) . '</h4>' . "\n" . $blockinfo['content'];
}
}
return BlockUtil::themeBlock($blockinfo);
}
开发者ID:nmpetkov,项目名称:Zgoodies,代码行数:36,代码来源:Marquee.php
示例19: renderDocument
/**
* Render and display the specified legal document, or redirect to the specified custom URL if it exists.
*
* If a custom URL for the legal document exists, as specified by the module variable identified by $customUrlKey, then
* this function will redirect the user to that URL.
*
* If no custom URL exists, then this function will render and return the appropriate template for the legal document, as
* specified by $documentName. If the legal document
*
* @param string $documentName The "name" of the document, as specified by the names of the user and text template
* files in the format 'legal_user_documentname.tpl' and 'legal_text_documentname.tpl'.
* @param string $accessInstanceKey The string used in the instance_right part of the permission access key for this document.
* @param string $activeFlagKey The string used to name the module variable that indicates whether this legal document is
* active or not; typically this is a constant from {@link Legal_Constant}, such as
* {@link Legal_Constant::MODVAR_LEGALNOTICE_ACTIVE}.
* @param string $customUrlKey The string used to name the module variable that contains a custom static URL for the
* legal document; typically this is a constant from {@link Legal_Constant}, such as
* {@link Legal_Constant::MODVAR_TERMS_URL}.
*
* @return string HTML output string
*
* @throws Zikula_Exception_Forbidden Thrown if the user does not have the appropriate access level for the function.
*/
private function renderDocument($documentName, $accessInstanceKey, $activeFlagKey, $customUrlKey)
{
// Security check
if (!SecurityUtil::checkPermission($this->name . '::' . $accessInstanceKey, '::', ACCESS_OVERVIEW)) {
throw new Zikula_Exception_Forbidden();
}
if (!$this->getVar($activeFlagKey)) {
return $this->view->fetch('legal_user_policynotactive.tpl');
} else {
$customUrl = $this->getVar($customUrlKey, '');
if (empty($customUrl)) {
// work out the template path
$template = "legal_user_{$documentName}.tpl";
// get the current users language
$languageCode = ZLanguage::transformFS(ZLanguage::getLanguageCode());
if (!$this->view->template_exists("{$languageCode}/legal_text_{$documentName}.tpl")) {
$languageCode = 'en';
}
return $this->view->assign('languageCode', $languageCode)
->fetch($template);
} else {
$this->redirect($customUrl);
}
}
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:52,代码来源:User.php
示例20: search
public function search(){
// Check permission
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Llicencies::', '::', ACCESS_READ));
//path to zk jquery lib
$js = new JCSSUtil;
$scripts = $js->scriptsMap();
$jquery = $scripts['jquery']['path'];
// Omplim les llistes desplegables del fromulari
$cursos = ModUtil::apiFunc('Llicencies', 'user', 'getYears');
$temes = ModUtil::apiFunc('Llicencies', 'user', 'getTopicList');
$subtemes = ModUtil::apiFunc('Llicencies', 'user', 'getSubtopicList');
$tipus = ModUtil::apiFunc('Llicencies', 'user', 'getTypeList');
$view = Zikula_View::getInstance($this->name);
$view->assign('jquery' , $jquery);
$view->assign('cursos' , $cursos);
$view->assign('temes' , $temes);
$view->assign('subtemes', $subtemes);
$view->assign('tipus' , $tipus);
$view->assign('admin' , false);
// Carreagr el formulari per a fer la cerca de llicències d'estudi
return $this->view->display('Llicencies_main.tpl');
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:25,代码来源:User.php
注:本文中的SecurityUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论