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


PHP Sobi::Can方法代码示例

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


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

示例1: menu

 protected function menu(&$data)
 {
     if (Sobi::Cfg('general.top_menu', true)) {
         $data['menu'] = array('front' => array('_complex' => 1, '_data' => Sobi::Reg('current_section_name'), '_attributes' => array('lang' => Sobi::Lang(false), 'url' => Sobi::Url(array('sid' => Sobi::Section())))));
         if (Sobi::Can('section.search')) {
             $data['menu']['search'] = array('_complex' => 1, '_data' => Sobi::Txt('MN.SEARCH'), '_attributes' => array('lang' => Sobi::Lang(false), 'url' => Sobi::Url(array('task' => 'search', 'sid' => Sobi::Section()))));
         }
         if (Sobi::Can('entry', 'add', 'own', Sobi::Section())) {
             $data['menu']['add'] = array('_complex' => 1, '_data' => Sobi::Txt('MN.ADD_ENTRY'), '_attributes' => array('lang' => Sobi::Lang(false), 'url' => Sobi::Url(array('task' => 'entry.add', 'sid' => SPRequest::sid()))));
         }
     }
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:12,代码来源:view.php

示例2: add

 /**
  * @param double $amount
  * @param string $reference - just a text to save in the db
  * @param int $sid - id of the entry
  * @param string $fid - field id or unique reference identifier
  * @return void
  */
 public function add($amount, $reference, $sid = 0, $fid = null)
 {
     if ($sid && $this->check($sid, $fid) || Sobi::Can('entry.payment.free')) {
         return true;
     }
     $this->payments[$sid][] = array('reference' => $reference, 'amount' => $amount, 'id' => $fid);
     Sobi::Trigger('Payment', ucfirst(__FUNCTION__), array(&$this->payments, $sid));
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:15,代码来源:payment.php

示例3: userPermissionsQuery

 protected function userPermissionsQuery(&$conditions, $oPrefix = null)
 {
     $db =& SPFactory::db();
     if (!Sobi::Can('entry.access.*')) {
         if (Sobi::Can('entry.access.unpublished_own')) {
             $conditions[] = $db->argsOr(array($oPrefix . 'state' => '1', $oPrefix . 'owner' => Sobi::My('id')));
             if (Sobi::Can('entry.access.unapproved_own')) {
                 $conditions[] = $db->argsOr(array($oPrefix . 'approved' => '1', $oPrefix . 'owner' => Sobi::My('id')));
             } elseif (!(Sobi::Can('entry.access.unapproved_own') || Sobi::Can('entry.access.unapproved_any'))) {
                 $conditions[$oPrefix . 'approved'] = '1';
             }
         } elseif (!Sobi::Can('entry.access.unpublished_any')) {
             $conditions[$oPrefix . 'state'] = '1';
         }
     }
     if (!Sobi::Can('entry.access.*')) {
         // @todo: expired permission
         if (Sobi::Can('entry.access.expired_own')) {
             $conditions[] = $db->argsOr(array('@VALID' => $db->valid($oPrefix . 'validUntil', $oPrefix . 'validSince'), 'owner' => Sobi::My('id')));
         } else {
             // conflicts with "entry.access.unpublished_own" See #521
             //$conditions[ 'state' ] = '1';
             //				if ( false && ( Sobi::Can( 'entry.access.unpublished_own' ) ) ) {
             //					$conditions[ '@VALID' ] = $db->valid( $oPrefix . 'validUntil', $oPrefix . 'validSince', null, array( 'owner' => Sobi::My( 'id' ) ) );
             //				}
             //				elseif ( !( Sobi::Can( 'entry.access.unpublished_any' ) ) ) {
             $conditions['@VALID'] = $db->valid($oPrefix . 'validUntil', $oPrefix . 'validSince');
             //				}
         }
     }
     return $conditions;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:32,代码来源:section.php

示例4: __construct

 /**
  */
 public function __construct()
 {
     if (!Sobi::Can('template.manage')) {
         Sobi::Error($this->name(), SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
         exit;
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:9,代码来源:template.php

示例5: __construct

 /**
  */
 public function __construct()
 {
     if (!Sobi::Can('acl.manage')) {
         Sobi::Error('ACL', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::WARNING, 403, __LINE__, __FILE__);
         exit;
     }
     parent::__construct();
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:10,代码来源:acl.php

示例6: __construct

 /**
  */
 public function __construct()
 {
     if (Sobi::Section()) {
         if (!Sobi::Can('section.configure')) {
             Sobi::Error($this->name(), SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
             exit;
         }
     } elseif (!Sobi::Can('cms.apps')) {
         Sobi::Error($this->name(), SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
         exit;
     }
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:14,代码来源:template.php

示例7: view

 private function view()
 {
     $type = $this->key('template_type', 'xslt');
     if ($type != 'php' && Sobi::Cfg('global.disable_xslt', false)) {
         $type = 'php';
     }
     if ($type == 'xslt') {
         $visitor = $this->get('visitor');
         $current = $this->get('section');
         $categories = $this->get('categories');
         $entries = $this->get('entries');
         $data = array();
         $data['id'] = $current->get('id');
         $data['section'] = array('_complex' => 1, '_data' => Sobi::Section(true), '_attributes' => array('id' => Sobi::Section(), 'lang' => Sobi::Lang(false)));
         $data['name'] = array('_complex' => 1, '_data' => $this->get('listing_name'), '_attributes' => array('lang' => Sobi::Lang(false)));
         if (Sobi::Cfg('category.show_desc')) {
             $desc = $current->get('description');
             if (Sobi::Cfg('category.parse_desc')) {
                 Sobi::Trigger('prepare', 'Content', array(&$desc, $current));
             }
             $data['description'] = array('_complex' => 1, '_cdata' => 1, '_data' => $desc, '_attributes' => array('lang' => Sobi::Lang(false)));
         }
         $data['meta'] = array('description' => $current->get('metaDesc'), 'keys' => $this->metaKeys($current), 'author' => $current->get('metaAuthor'), 'robots' => $current->get('metaRobots'));
         $data['entries_in_line'] = $this->get('$eInLine');
         $data['categories_in_line'] = $this->get('$cInLine');
         $this->menu($data);
         $this->alphaMenu($data);
         $data['visitor'] = $this->visitorArray($visitor);
         if (count($categories)) {
             foreach ($categories as $category) {
                 if (is_numeric($category)) {
                     $category = SPFactory::Category($category);
                 }
                 $data['categories'][] = array('_complex' => 1, '_attributes' => array('id' => $category->get('id'), 'nid' => $category->get('nid')), '_data' => $this->category($category));
                 unset($category);
             }
         }
         if (count($entries)) {
             $this->loadNonStaticData($entries);
             $manager = Sobi::Can('entry', 'edit', '*', Sobi::Section()) ? true : false;
             foreach ($entries as $eid) {
                 $en = $this->entry($eid, $manager);
                 $data['entries'][] = array('_complex' => 1, '_attributes' => array('id' => $en['id']), '_data' => $en);
             }
             $this->navigation($data);
         }
         $this->_attr = $data;
     }
     // general listing trigger
     Sobi::Trigger('Listing', ucfirst(__FUNCTION__), array(&$this->_attr));
     // specific lisitng trigger
     Sobi::Trigger($this->_type, ucfirst(__FUNCTION__), array(&$this->_attr));
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:53,代码来源:listing.php

示例8: __construct

 public function __construct()
 {
     $registry =& SPFactory::registry();
     $registry->loadDBSection('config');
     $this->_task = strlen($this->_task) ? $this->_task : $this->_defTask;
     if (!Sobi::Reg('current_section') && $this->_task == 'general') {
         $this->_task = 'global';
         if (!Sobi::Can('cms.admin')) {
             Sobi::Error('ACL', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::WARNING, 403, __LINE__, __FILE__);
         }
     } else {
         if (!$this->_aclCheck) {
             Sobi::Error('ACL', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::WARNING, 403, __LINE__, __FILE__);
         }
     }
     parent::__construct();
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:17,代码来源:config.php

示例9: getSections

 /**
  */
 private function getSections()
 {
     try {
         $sections = SPFactory::db()->select('*', 'spdb_object', array('oType' => 'section'), 'id')->loadObjectList();
     } catch (SPException $x) {
         Sobi::Error($this->name(), SPLang::e('CANNOT_GET_SECTIONS_LIST', $x->getMessage()), SPC::WARNING, 500, __LINE__, __FILE__);
     }
     if (count($sections)) {
         foreach ($sections as $section) {
             if (Sobi::Can('section', 'access', $section->id, 'valid')) {
                 $s = SPFactory::Section($section->id);
                 $s->extend($section);
                 $this->_sections[] = $s;
             }
         }
         Sobi::Trigger($this->name(), __FUNCTION__, array(&$this->_sections));
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:20,代码来源:front.php

示例10: getSections

 /**
  */
 private function getSections()
 {
     $order = $this->parseOrdering();
     try {
         $sections = SPFactory::db()->select('*', 'spdb_object', array('oType' => 'section'), $order)->loadObjectList();
     } catch (SPException $x) {
         Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 500, __LINE__, __FILE__);
     }
     if (count($sections)) {
         SPLoader::loadClass('models.datamodel');
         SPLoader::loadClass('models.dbobject');
         SPLoader::loadModel('section');
         foreach ($sections as $section) {
             if (Sobi::Can('section', 'access', 'any', $section->id)) {
                 $s = new SPSection();
                 $s->extend($section);
                 $this->_sections[] = $s;
             }
         }
     }
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:23,代码来源:front.php

示例11: iconChooser

 protected function iconChooser()
 {
     if (!Sobi::Can('category.edit')) {
         Sobi::Error('category', 'You have no permission to access this site', SPC::ERROR, 403, __LINE__, __FILE__);
     }
     if (strlen(SPRequest::cmd('font'))) {
         return $this->iconFont();
     }
     $folder = SPRequest::cmd('iconFolder', null);
     $callback = SPRequest::cmd('callback', 'SPSelectIcon');
     $dir = $folder ? Sobi::Cfg('images.category_icons') . str_replace('.', '/', $folder) . '/' : Sobi::Cfg('images.category_icons');
     $files = array();
     $dirs = array();
     if ($folder) {
         $up = explode('.', $folder);
         unset($up[count($up) - 1]);
         $dirs[] = array('name' => Sobi::Txt('FOLEDR_UP'), 'count' => count(scandir($dir . '..')) - 2, 'url' => Sobi::Url(array('task' => 'category.icon', 'out' => 'html', 'iconFolder' => count($up) ? implode('.', $up) : null)));
     }
     $ext = array('png', 'jpg', 'jpeg', 'gif');
     if (is_dir($dir) && ($dh = opendir($dir))) {
         while (($file = readdir($dh)) !== false) {
             if (filetype($dir . $file) == 'file' && in_array(strtolower(SPFs::getExt($file)), $ext)) {
                 $files[] = array('name' => $folder ? str_replace('.', '/', $folder) . '/' . $file : $file, 'path' => str_replace('\\', '/', str_replace(SOBI_ROOT, Sobi::Cfg('live_site'), str_replace('//', '/', $dir . $file))));
             } elseif (filetype($dir . $file) == 'dir' && !($file == '.' || $file == '..')) {
                 $dirs[] = array('name' => $file, 'count' => count(scandir($dir . $file)) - 2, 'path' => str_replace('\\', '/', str_replace(SOBI_ROOT, Sobi::Cfg('live_site'), str_replace('//', '/', $dir . $file))), 'url' => Sobi::Url(array('task' => 'category.icon', 'out' => 'html', 'iconFolder' => $folder ? $folder . '.' . $file : $file)));
             }
         }
         closedir($dh);
     }
     sort($files);
     sort($dirs);
     $view = SPFactory::View('category');
     $view->setTemplate('category.icon');
     $view->assign($this->_task, 'task');
     $view->assign($callback, 'callback');
     $view->assign($files, 'files');
     $view->assign(Sobi::Cfg('images.folder_ico'), 'folder');
     $view->assign($dirs, 'directories');
     $view->icon();
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:40,代码来源:category.php

示例12: execute

 /**
  */
 public function execute()
 {
     if (!Sobi::Can('section.search')) {
         if ($this->_task != 'suggest') {
             if (Sobi::Cfg('redirects.section_search_enabled') && strlen(Sobi::Cfg('redirects.section_search_url', null))) {
                 $this->escape(Sobi::Cfg('redirects.section_search_url', null), SPLang::e(Sobi::Cfg('redirects.section_search_msg', 'UNAUTHORIZED_ACCESS')), Sobi::Cfg('redirects.section_search_msgtype', SPC::ERROR_MSG));
             } else {
                 Sobi::Error($this->name(), SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
             }
         } else {
             exit;
         }
     }
     $r = false;
     SPLoader::loadClass('env.cookie');
     SPLoader::loadClass('env.browser');
     SPRequest::set('task', $this->_type . '.' . $this->_task);
     switch ($this->_task) {
         case 'results':
         case 'view':
             $this->form();
             $r = true;
             break;
         case 'search':
             $this->search();
             $r = true;
             break;
         case 'suggest':
             $this->suggest();
             $r = true;
             break;
         default:
             if (!parent::execute()) {
                 Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
             }
             break;
     }
     return $r;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:41,代码来源:search.php

示例13: verify

 /**
  * @param SPEntry $entry
  * @param string $request
  * @throws SPException
  * @return array
  */
 protected function verify($entry, $request)
 {
     $save = array();
     $data = SPRequest::raw($this->nid . '_url', null, $request);
     $dexs = strlen($data);
     $data = SPFactory::db()->escape($data);
     if ($this->ownLabel) {
         $save['label'] = SPRequest::raw($this->nid, null, $request);
         /* check if there was a filter */
         if ($this->filter && strlen($save['label'])) {
             $registry =& SPFactory::registry();
             $registry->loadDBSection('fields_filter');
             $filters = $registry->get('fields_filter');
             $filter = isset($filters[$this->filter]) ? $filters[$this->filter] : null;
             if (!count($filter)) {
                 throw new SPException(SPLang::e('FIELD_FILTER_ERR', $this->filter));
             } else {
                 if (!preg_match(base64_decode($filter['params']), $save['label'])) {
                     throw new SPException(str_replace('$field', $this->name, SPLang::e($filter['description'])));
                 }
             }
         }
     }
     /* check if it was required */
     if ($this->required && !$dexs) {
         throw new SPException(SPLang::e('FIELD_REQUIRED_ERR', $this->name));
     }
     /* check if there was an adminField */
     if ($this->adminField && $dexs) {
         if (!Sobi::Can('adm_fields.edit')) {
             throw new SPException(SPLang::e('FIELD_NOT_AUTH', $this->name));
         }
     }
     /* check if it was free */
     if (!$this->isFree && $this->fee && $dexs) {
         SPFactory::payment()->add($this->fee, $this->name, $entry->get('id'), $this->fid);
     }
     /* check if it should contains unique data */
     if ($this->uniqueData && $dexs) {
         $matches = $this->searchData($data, Sobi::Reg('current_section'));
         if (count($matches)) {
             throw new SPException(SPLang::e('FIELD_NOT_UNIQUE', $this->name));
         }
     }
     /* check if it was editLimit */
     if ($this->editLimit == 0 && !Sobi::Can('entry.adm_fields.edit') && $dexs) {
         throw new SPException(SPLang::e('FIELD_NOT_AUTH_EXP', $this->name));
     }
     /* check if it was editable */
     if (!$this->editable && !Sobi::Can('entry.adm_fields.edit') && $dexs && $entry->get('version') > 1) {
         throw new SPException(SPLang::e('FIELD_NOT_AUTH_NOT_ED', $this->name));
     }
     /* check the response code */
     if ($dexs && $this->validateUrl) {
         if (preg_match('/[a-z0-9]@[a-z0-9].[a-z]/i', $data)) {
             $domain = explode('@', $data, 2);
             $domain = $domain[1];
             if (!checkdnsrr($domain, 'MX')) {
                 throw new SPException(SPLang::e('FIELD_MAIL_NO_MX', $data));
             }
         } else {
             throw new SPException(SPLang::e('FIELD_MAIL_WRONG_FORM', $data));
         }
     }
     if ($dexs) {
         /* if we are here, we can save these data */
         $save['url'] = $data;
     } else {
         $save = null;
     }
     $this->setData($save);
     return $save;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:79,代码来源:email.php

示例14: verify

 /**
  * @param SPEntry $entry
  * @param string $request
  * @throws SPException
  * @return bool
  */
 private function verify($entry, $request)
 {
     static $store = null;
     $directory = SPRequest::string($this->nid, null, false, $request);
     if (strtolower($request) == 'post' || strtolower($request) == 'get') {
         $data = SPRequest::file($this->nid, 'tmp_name');
     } else {
         $data = SPRequest::file($this->nid, 'tmp_name', $request);
     }
     if ($store == null) {
         $store = SPFactory::registry()->get('requestcache_stored');
     }
     if (is_array($store) && isset($store[$this->nid])) {
         if (!strstr($store[$this->nid], 'file://') && !strstr($store[$this->nid], 'directory://')) {
             $data = $store[$this->nid];
         } else {
             $directory = $store[$this->nid];
         }
     }
     if ($directory && strstr($directory, 'directory://')) {
         list($data, $dirName, $files) = $this->getAjaxFiles($directory);
         if (count($files)) {
             foreach ($files as $file) {
                 if ($file == '.') {
                     continue;
                 }
                 if ($file == '..') {
                     continue;
                 }
                 if (strpos($file, 'icon_') !== false) {
                     continue;
                 }
                 if (strpos($file, 'resized_') !== false) {
                     continue;
                 }
                 if (strpos($file, 'cropped_') !== false) {
                     continue;
                 }
                 if (strpos($file, '.var') !== false) {
                     continue;
                 }
                 $fileSize = filesize($dirName . $file);
             }
         }
     } else {
         $fileSize = SPRequest::file($this->nid, 'size');
     }
     $del = SPRequest::bool($this->nid . '_delete', false, $request);
     $dexs = strlen($data);
     if ($this->required && !$dexs) {
         $files = $this->getRaw();
         if (!count($files)) {
             throw new SPException(SPLang::e('FIELD_REQUIRED_ERR', $this->name));
         }
     }
     if ($fileSize > $this->maxSize) {
         throw new SPException(SPLang::e('FIELD_IMG_TOO_LARGE', $this->name, $fileSize, $this->maxSize));
     }
     /* check if there was an adminField */
     if ($this->adminField && ($dexs || $del)) {
         if (!Sobi::Can('entry.adm_fields.edit')) {
             throw new SPException(SPLang::e('FIELD_NOT_AUTH', $this->name));
         }
     }
     /* check if it was free */
     if (!$this->isFree && $this->fee && $dexs) {
         SPFactory::payment()->add($this->fee, $this->name, $entry->get('id'), $this->fid);
     }
     /* check if it was editLimit */
     if ($this->editLimit == 0 && !Sobi::Can('entry.adm_fields.edit') && $dexs) {
         throw new SPException(SPLang::e('FIELD_NOT_AUTH_EXP', $this->name));
     }
     /* check if it was editable */
     if (!$this->editable && !Sobi::Can('entry.adm_fields.edit') && $dexs && $entry->get('version') > 1) {
         throw new SPException(SPLang::e('FIELD_NOT_AUTH_NOT_ED', $this->name));
     }
     return true;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:84,代码来源:image.php

示例15: verify

 /**
  * @param SPEntry $entry
  * @param string $request
  * @throws SPException
  * @return string
  * @throw SPException
  */
 private function verify($entry, $request)
 {
     $data = SPRequest::arr($this->nid, array(), $request);
     if (!$data) {
         $dataString = SPRequest::string($this->nid, null, false, $request);
         if (strstr($dataString, '://')) {
             $data = SPFactory::config()->structuralData($dataString);
         } else {
             $dataString = SPRequest::int($this->nid, 0, $request);
             if ($dataString) {
                 $data = array($dataString);
             }
         }
     } else {
         if (count($data) > $this->catsMaxLimit && count($data) > 1) {
             $data = array_slice($data, 0, $this->catsMaxLimit);
         }
     }
     $dexs = count($data);
     /* check if it was required */
     if ($this->required && !$dexs && $this->method != 'fixed') {
         throw new SPException(SPLang::e('FIELD_REQUIRED_ERR', $this->name));
     }
     /* check if there was an adminField */
     if ($this->adminField && $dexs && $this->method != 'fixed') {
         if (!Sobi::Can('entry.adm_fields.edit')) {
             throw new SPException(SPLang::e('FIELD_NOT_AUTH', $this->name));
         }
     }
     /* check if it was free */
     if (!$this->isFree && $this->fee && $dexs) {
         SPFactory::payment()->add($this->fee, $this->name, $entry->get('id'), $this->fid);
     }
     /* check if it was editLimit */
     if ($this->editLimit == 0 && !Sobi::Can('entry.adm_fields.edit') && $dexs) {
         throw new SPException(SPLang::e('FIELD_NOT_AUTH_EXP', $this->name));
     }
     /* check if it was editable */
     if (!$this->editable && !Sobi::Can('entry.adm_fields.edit') && $dexs && $entry->get('version') > 1) {
         throw new SPException(SPLang::e('FIELD_NOT_AUTH_NOT_ED', $this->name));
     }
     if (!$dexs) {
         $data = array();
     }
     $this->setData($data);
     return $data;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:54,代码来源:category.php


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