當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。