当前位置: 首页>>代码示例>>PHP>>正文


PHP UserHelper::isJoomlaAdmin方法代码示例

本文整理汇总了PHP中UserHelper::isJoomlaAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP UserHelper::isJoomlaAdmin方法的具体用法?PHP UserHelper::isJoomlaAdmin怎么用?PHP UserHelper::isJoomlaAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserHelper的用法示例。


在下文中一共展示了UserHelper::isJoomlaAdmin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isJoomlaAdmin

 public function isJoomlaAdmin()
 {
     $user = $this->getJoomlaUser();
     return UserHelper::isJoomlaAdmin($user);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:5,代码来源:commentauthor.php

示例2: save

 public function save()
 {
     // check for request forgeries
     YRequest::checkToken() or jexit('Invalid Token');
     // init vars
     $post = JRequest::get('post');
     $db = YDatabase::getInstance();
     $tzoffset = JFactory::getConfig()->getValue('config.offset');
     $now = JFactory::getDate();
     $now->setOffset($tzoffset);
     $msg = '';
     try {
         $this->_init();
         // is this an item edit?
         $edit = (int) $this->item->id;
         // is current user the item owner and does the user have sufficient user rights
         if ($edit && (!$this->item->canAccess($this->user) || $this->item->created_by != $this->user->id)) {
             throw new YControllerException('You are not allowed to make changes to this item.');
         }
         // get default category - only in none trusted mode
         $categories = array();
         if (!$this->submission->isInTrustedMode() && ($category = $this->submission->getForm($this->type->id)->get('category'))) {
             $categories[] = $category;
         }
         // get element data from post
         if (isset($post['elements'])) {
             // filter element data
             if (!$this->submission->isInTrustedMode() && !UserHelper::isJoomlaAdmin($this->user)) {
                 JRequest::setVar('elements', SubmissionHelper::filterData($post['elements']));
                 $post = JRequest::get('post');
             }
             // merge elements into post
             $post = array_merge($post, $post['elements']);
         }
         // fix publishing dates in trusted mode
         if ($this->submission->isInTrustedMode()) {
             // set publish up date
             if (isset($post['publish_up'])) {
                 if (empty($post['publish_up'])) {
                     $post['publish_up'] = $now->toMySQL(true);
                 }
             }
             // set publish down date
             if (isset($post['publish_down'])) {
                 if (trim($post['publish_down']) == JText::_('Never') || trim($post['publish_down']) == '') {
                     $post['publish_down'] = $db->getNullDate();
                 }
             }
         }
         // sanatize tags
         if (!isset($post['tags'])) {
             $post['tags'] = array();
         }
         // build new item form and bind it with post data
         $form = new ItemForm(array('submission' => $this->submission, 'item' => $this->item, 'elements_config' => $this->elements_config));
         $form->bind($post);
         // save item if form is valid
         if ($form->isValid()) {
             // set name
             $this->item->name = $form->getValue('name');
             // bind elements
             foreach ($this->elements_config as $data) {
                 if (($element = $this->item->getElement($data->element)) && ($field = $form->getFormField($data->element))) {
                     if ($field_data = $field->hasError() ? $field->getTaintedValue() : $field->getValue()) {
                         $element->bindData($field_data);
                     } else {
                         $element->bindData();
                     }
                     // perform submission uploads
                     if ($element instanceof iSubmissionUpload) {
                         $element->doUpload();
                     }
                 }
             }
             // set alias
             $this->item->alias = ItemHelper::getUniqueAlias($this->item->id, YString::sluggify($this->item->name));
             // set modified
             $this->item->modified = $now->toMySQL();
             $this->item->modified_by = $this->user->get('id');
             // creating new item
             if (!$edit) {
                 // set state
                 $this->item->state = 0;
                 // set created date
                 $this->item->created = $now->toMySQL();
                 $this->item->created_by = $this->user->get('id');
                 $this->item->created_by_alias = '';
                 // set publish up - publish down
                 $this->item->publish_up = $now->toMySQL();
                 $this->item->publish_down = $db->getNullDate();
                 // set access
                 $this->item->access = 0;
                 // set searchable
                 $this->item->searchable = 1;
             }
             if ($this->submission->isInTrustedMode()) {
                 // set state
                 $this->item->state = $form->getValue('state');
                 // set publish up
                 if (($publish_up = $form->getValue('publish_up')) && !empty($publish_up)) {
//.........这里部分代码省略.........
开发者ID:bizanto,项目名称:Hooked,代码行数:101,代码来源:submission.php


注:本文中的UserHelper::isJoomlaAdmin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。