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


PHP SPRequest::raw方法代码示例

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


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

示例1: save

 protected function save()
 {
     if (!SPFactory::mainframe()->checkToken()) {
         Sobi::Error('Token', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
     }
     $id = SPRequest::cmd('filter_id');
     if ($id) {
         $this->validate('field.filter', 'filter');
         $filters = $this->getFilters();
         $name = SPRequest::string('filter_name', 'Filter Name');
         $msg = str_replace(array("\n", "\t", "\r"), null, SPLang::clean(SPRequest::string('filter_message', 'The data entered in the $field field contains not allowed characters')));
         $regex = SPLang::clean(SPRequest::raw('filter_regex', '/^[\\.*]+$/'));
         $regex = str_replace('[:apostrophes:]', '\\"' . "\\'", $regex);
         $regex = base64_encode(str_replace(array("\n", "\t", "\r"), null, $regex));
         $custom = 'custom';
         if (isset($filters[$id]) && !strlen($filters[$id]['options'])) {
             $regex = $filters[$id]['params'];
             $custom = null;
         }
         $filters[$id] = array('params' => $regex, 'key' => $id, 'value' => $name, 'description' => $msg, 'options' => $custom);
         SPFactory::registry()->saveDBSection($filters, 'fields_filter');
         $this->response(Sobi::Url('filter'), Sobi::Txt('FLR.MSG_FILTER_SAVED'), false, 'success');
     } else {
         $this->response(Sobi::Url('filter'), SPLang::e('FILTER_NOT_FOUND'), true, SPC::ERROR_MSG);
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:26,代码来源:filter.php

示例2: 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

示例3: url

 /**
  * Creating URL from a array for the current CMS
  * @param array $var
  * @param bool $js
  * @param bool $sef
  * @param bool $live
  * @param bool $forceItemId
  * @return string
  */
 public static function url($var = null, $js = false, $sef = true, $live = false, $forceItemId = false)
 {
     $url = self::baseUrl;
     if ($var == 'current') {
         return SPRequest::raw('REQUEST_URI', self::baseUrl, 'SERVER');
     }
     // don't remember why :(
     // Nevertheless it is generating & in URL fro ImEx
     //		$sef = Sobi::Cfg( 'disable_sef_globally', false ) ? false : ( defined( 'SOBIPRO_ADM' ) && !( $forceItemId ) ? false : $sef );
     $sef = Sobi::Cfg('disable_sef_globally', false) ? false : $sef;
     Sobi::Trigger('Create', 'Url', array(&$var, $js));
     if (is_array($var) && !empty($var)) {
         if (isset($var['option'])) {
             $url = str_replace('com_sobipro', $var['option'], $url);
             unset($var['option']);
         }
         if (isset($var['sid']) && (!defined('SOBIPRO_ADM') || $forceItemId) || defined('SOBIPRO_ADM') && $sef && $live) {
             if (!isset($var['Itemid']) || !$var['Itemid']) {
                 SPFactory::mainframe()->getItemid($var);
             }
         }
         if (isset($var['title'])) {
             if (Sobi::Cfg('url.title', true)) {
                 $var['title'] = trim(SPLang::urlSafe($var['title']));
                 $var['sid'] = $var['sid'] . ':' . $var['title'];
             }
             unset($var['title']);
         }
         if (isset($var['format']) && $var['format'] == 'raw' && $sef) {
             unset($var['format']);
         }
         foreach ($var as $k => $v) {
             if ($k == 'out') {
                 switch ($v) {
                     case 'html':
                         $var['tmpl'] = 'component';
                         unset($var['out']);
                         break;
                     case 'xml':
                         $var['tmpl'] = 'component';
                         $var['format'] = 'raw';
                     case 'raw':
                         $var['tmpl'] = 'component';
                         $var['format'] = 'raw';
                         break;
                     case 'json':
                         $var['out'] = 'json';
                         $var['format'] = 'raw';
                         $var['tmpl'] = 'component';
                         break;
                 }
             }
         }
         foreach ($var as $k => $v) {
             $url .= "&{$k}={$v}";
         }
     } elseif (is_string($var)) {
         if (strstr($var, 'index.php?')) {
             $url = null;
         } else {
             $url .= '&';
         }
         if (strstr($var, '=')) {
             $var = str_replace('&', '&', $var);
             $var = str_replace('&', '&', $var);
             $url .= $var;
         } else {
             $url .= SOBI_TASK . '=';
             $url .= $var;
         }
     } elseif (is_array($var)) {
     }
     if ($sef && !$live) {
         $url = JRoute::_($url, false);
     } else {
         $url = preg_replace('/&(?![#]?[a-z0-9]+;)/i', '&', $url);
     }
     if ($live) {
         /*
          * SubDir Issues:
          * when using SEF Joomla! router returns also the subdir
          * and JURI::base returns the subdir too
          * So if the URL should be SEF we have to remove the subdirectory once
          * Otherwise it doesn't pass the JRoute::_ method so there is no subdir included
          * */
         if ($sef) {
             $base = JURI::base(true);
             $root = str_replace($base, null, Sobi::Cfg('live_site'));
             $url = explode('/', $url);
             $url = $url[count($url) - 1];
             //                if ( defined( 'SOBIPRO_ADM' ) ) {
//.........这里部分代码省略.........
开发者ID:pelloq1,项目名称:SobiPro,代码行数:101,代码来源:mainframe.php

示例4: __construct

 private function __construct()
 {
     $this->client = $this->parse_user_agent(SPRequest::raw('HTTP_USER_AGENT', null, 'server'));
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:4,代码来源:browser.php

示例5: save

 protected function save($new = false)
 {
     if (!SPFactory::mainframe()->checkToken()) {
         Sobi::Error('Token', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
     }
     $content = SPRequest::raw('file_content', null, 'post');
     $file = $this->file(SPRequest::cmd('fileName'), !$new);
     Sobi::Trigger('Save', $this->name(), array(&$content, &$file));
     if (!$file) {
         throw new SPException(SPLang::e('Missing  file to save %s', SPRequest::cmd('fileName')));
     }
     $File = SPFactory::Instance('base.fs.file', $file);
     $File->content(stripslashes($content));
     try {
         $File->save();
         $u = array('task' => 'template.edit', 'file' => SPRequest::cmd('fileName'));
         if (Sobi::Section()) {
             $u['sid'] = Sobi::Section();
         }
         $this->response(Sobi::Url($u), Sobi::Txt('TP.FILE_SAVED'), $new, 'success');
     } catch (SPException $x) {
         $this->response(Sobi::Back(), $x->getMessage(), false, 'error');
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:24,代码来源:template.php

示例6: verify

 /**
  * @param SPEntry $entry
  * @param SPdb $db
  * @param string $request
  * @throws SPException
  * @return array
  */
 private function verify($entry, &$db, $request)
 {
     $save = array();
     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'])));
                 }
             }
         }
     }
     $data = SPRequest::raw($this->nid . '_url', null, $request);
     $save['protocol'] = $db->escape(SPRequest::word($this->nid . '_protocol', null, $request));
     $dexs = strlen($data);
     $data = $db->escape($data);
     $data = preg_replace('/([a-z]{1,5}\\:\\/\\/)/i', null, $data);
     $save['url'] = $data;
     /* 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('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 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) {
         $rclass = SPLoader::loadClass('services.remote');
         $err = 0;
         $response = 0;
         try {
             $connection = new $rclass();
             $connection->setOptions(array('url' => $save['protocol'] . '://' . $data, 'connecttimeout' => 10, 'header' => false, 'returntransfer' => true));
             $connection->exec();
             $response = $connection->info('response_code');
             $err = $connection->error(false);
             $errTxt = $connection->error();
             $connection->close();
             if ($err) {
                 Sobi::Error($this->name(), SPLang::e('FIELD_URL_CANNOT_VALIDATE', $errTxt), SPC::WARNING, 0, __LINE__, __FILE__);
             }
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('FIELD_URL_CANNOT_VALIDATE', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
         }
         if ($err || $response != 200) {
             $response = $err ? $errTxt : $response;
             Sobi::Error($this->name(), SPLang::e('FIELD_URL_ERR', $save['protocol'] . '://' . $data, $response), SPC::WARNING, 0, __LINE__, __FILE__);
             throw new SPException(SPLang::e('FIELD_URL_ERR', $save['protocol'] . '://' . $data, $response));
         }
     }
     if (!$dexs) {
         $save = null;
     }
     return $save;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:92,代码来源:url.php

示例7: searchForm

 /**
  * Shows the field in the search form
  * @param bool $return return or display directly
  * @return string
  */
 public function searchForm($return = false)
 {
     if ($this->searchMethod == 'general') {
         return false;
     }
     $hidden = null;
     $d = $this->getValues(false);
     $data = array('' => Sobi::Txt('FD.SEARCH_SELECT_LIST', array('name' => $this->name)));
     foreach ($d as $k => $v) {
         $data[$k] = $v;
     }
     $params = array('id' => $this->nid, 'size' => $this->ssize, 'class' => $this->cssClass . ' ' . Sobi::Cfg('search.form_list_def_css', 'SPSearchSelect'));
     //still there for compatibility reason
     if ($this->swidth) {
         $params['style'] = "width: {$this->swidth}px;";
     }
     if ($this->dependency) {
         SPFactory::header()->addJsFile('opt.field_select');
         $request = json_decode(SPLang::clean(SPRequest::raw($this->nid . '_path', null, 'requestcache')), true);
         $params['class'] .= ' ctrl-dependency-field';
         $hidden = $this->travelDependencyPath($request, $params);
         $this->_selected = isset($request[1]) ? $request[1] : null;
         $hiddenValue = str_replace('"', "'", json_encode((object) $request));
         $hidden .= SPHtml_Input::hidden($this->nid . '_path', $hiddenValue, null, array('data' => array('selected' => '', 'section' => Sobi::Section())));
         $params['data'] = array('order' => '1');
     }
     return SPHtml_Input::select($this->nid, $data, $this->_selected, $this->searchMethod == 'mselect', $params) . $hidden;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:33,代码来源:select.php

示例8: verify

 /**
  * @param SPEntry $entry
  * @param string $request
  * @throws SPException
  * @return string
  */
 private function verify($entry, $request)
 {
     $data = SPRequest::raw($this->nid, null, $request);
     $dexs = strlen($data);
     /* check if it was required */
     if ($this->required && !$dexs) {
         throw new SPException(SPLang::e('FIELD_REQUIRED_ERR', $this->name));
     }
     if ($dexs) {
         /* check if there was an adminField */
         if ($this->adminField) {
             if (!Sobi::Can('entry.adm_fields.edit')) {
                 throw new SPException(SPLang::e('FIELD_NOT_AUTH', $this->get('name')));
             }
         }
         /* check if it was free */
         if (!$this->isFree && $this->fee) {
             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')) {
             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') && $entry->get('version') > 1) {
             throw new SPException(SPLang::e('FIELD_NOT_AUTH_NOT_ED', $this->name));
         }
         if ($this->allowHtml) {
             $checkMethod = function_exists('mb_strlen') ? 'mb_strlen' : 'strlen';
             $check = $checkMethod(str_replace(array("\n", "\r", "\t"), null, strip_tags($data)));
             if ($this->maxLength && $check > $this->maxLength) {
                 throw new SPException(SPLang::e('FIELD_TEXTAREA_LIMIT', $this->maxLength, $this->name, $dexs));
             }
         } else {
             if ($this->maxLength && $dexs > $this->maxLength) {
                 throw new SPException(SPLang::e('FIELD_TEXTAREA_LIMIT', $this->maxLength, $this->name, $dexs));
             }
         }
     }
     $data = SPRequest::string($this->nid, null, true, $request);
     $this->setData($data);
     return $data;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:49,代码来源:textarea.php

示例9: search


//.........这里部分代码省略.........
             case 'any':
                 $this->searchWords($this->_request['phrase'] == 'all');
                 break;
         }
         $this->_results = array_unique($this->_results);
     }
     Sobi::Trigger('AfterBasic', 'Search', array(&$this->_results, &$this->_resultsByPriority));
     /* ... now the extended search. Check which data we've received */
     if (count($this->_fields)) {
         $results = null;
         foreach ($this->_fields as $field) {
             if (isset($this->_request[$field->get('nid')]) && $this->_request[$field->get('nid')] != null) {
                 $this->_narrowing = true;
                 $fr = $field->searchData($this->_request[$field->get('nid')], Sobi::Section());
                 $priority = $field->get('priority');
                 if (is_array($fr)) {
                     $this->_resultsByPriority[$priority] = array_merge($this->_resultsByPriority[$priority], $fr);
                 }
                 /* if we didn't got any results before this array contains the results */
                 if (!is_array($results)) {
                     $results = $fr;
                 } else {
                     if (is_array($fr)) {
                         $results = array_intersect($results, $fr);
                     }
                 }
             }
         }
         /** Tue, Oct 21, 2014 10:18:37
          * No result is also a result so no "count"
          * */
         //			if ( is_array( $results ) && count( $results ) ) {
         if (is_array($results)) {
             /* if we had also a string to search we have to get the intersection */
             if ($searchForString) {
                 $this->_results = array_intersect($this->_results, $results);
             } else {
                 $this->_results = $results;
             }
         }
     }
     $this->verify();
     /** @since 1.1 - a method to narrow the search results down */
     if (count($this->_fields)) {
         // If we have any results already - the we are limiting results down
         // if we don't have results but we were already searching then skip - because there is nothing to narrow down
         // if we don't have results but we weren't searching for anything else - then we are narrowing down everything
         if (count($this->_results) || !$this->_narrowing) {
             foreach ($this->_fields as &$field) {
                 $request = isset($this->_request[$field->get('nid')]) ? $this->_request[$field->get('nid')] : null;
                 if ($request) {
                     $field->searchNarrowResults($request, $this->_results, $this->_resultsByPriority);
                 }
             }
         }
     }
     $this->_request['search_for'] = str_replace('%', '*', $this->_request['search_for']);
     if (count($this->_results) > $searchLimit) {
         SPFactory::message()->error(Sobi::Txt('SH.SEARCH_TOO_MANY_RESULTS', count($this->_results), $searchLimit), false);
         $this->_resultsByPriority = array();
         $this->_results = array_slice($this->_results, 0, $searchLimit);
     } else {
         $this->sortPriority();
     }
     Sobi::Trigger('AfterExtended', 'Search', array(&$this->_results, &$this->_resultsByPriority));
     $req = is_array($this->_request) && count($this->_request) ? SPConfig::serialize($this->_request) : null;
     $res = is_array($this->_results) && count($this->_results) ? implode(', ', $this->_results) : null;
     $cre = is_array($this->_categoriesResults) && count($this->_categoriesResults) ? implode(', ', $this->_categoriesResults) : null;
     /* determine the search parameters */
     $attr = array('entriesResults' => array('results' => $res, 'resultsByPriority' => $this->_resultsByPriority), 'catsResults' => $cre, 'uid' => Sobi::My('id'), 'browserData' => SPConfig::serialize(SPBrowser::getInstance()));
     if (strlen($req)) {
         $attr['requestData'] = $req;
     }
     /* finally save */
     try {
         Sobi::Trigger('OnSave', 'Search', array(&$attr, &$ssid));
         $this->_db->update('spdb_search', $attr, array('ssid' => $ssid));
     } catch (SPException $x) {
         Sobi::Error($this->name(), SPLang::e('CANNOT_CREATE_SESSION_DB_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
     }
     $url = array('task' => 'search.results', 'sid' => Sobi::Section());
     // For Peter's Components Anywhere extension and other
     $params = Sobi::Cfg('search.params_to_pass');
     if (count($params)) {
         foreach ($params as $param) {
             $val = SPRequest::raw($param);
             if ($val) {
                 $url[$param] = SPRequest::raw($param);
             }
         }
     }
     /* if we cannot transfer the search id in cookie */
     if (!SPRequest::cmd('ssid', null, 'cookie')) {
         $url['ssid'] = $ssid;
     }
     if (Sobi::Cfg('cache.unique_search_url')) {
         $url['t'] = microtime(true);
     }
     Sobi::Redirect(Sobi::Url($url));
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:101,代码来源:search.php

示例10: validate

 protected function validate($field)
 {
     $type = SPRequest::cmd('field_fieldType');
     $definition = SPLoader::path('field.' . $type, 'adm', true, 'xml');
     if ($definition) {
         $xdef = new DOMXPath(DOMdocument::load($definition));
         $required = $xdef->query('//field[@required="true"]');
         if ($required->length) {
             for ($i = 0; $i < $required->length; $i++) {
                 $node = $required->item($i);
                 $name = $node->attributes->getNamedItem('name')->nodeValue;
                 if (!SPRequest::raw(str_replace('.', '_', $name))) {
                     $this->response(Sobi::Url(array('task' => 'field.edit', 'fid' => $field->get('fid'), 'sid' => SPRequest::sid())), Sobi::Txt('PLEASE_FILL_IN_ALL_REQUIRED_FIELDS'), false, 'error', array('required' => $name));
                 }
             }
         }
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:18,代码来源:field.php

示例11: verify

 /**
  * @param SPEntry $entry
  * @param string $request
  * @throws SPException
  * @return string
  */
 private function verify($entry, $request)
 {
     $data = SPRequest::raw($this->nid, null, $request);
     $dexs = strlen($data);
     /* check if it was required */
     if ($this->required && !$dexs) {
         throw new SPException(SPLang::e('FIELD_REQUIRED_ERR', $this->name));
     }
     /* check if there was a filter */
     if ($this->filter && $dexs) {
         $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']), $data)) {
                 throw new SPException(str_replace('$field', $this->name, SPLang::e($filter['description'])));
             }
         }
     }
     /* check if there was an adminField */
     if ($this->adminField && $dexs) {
         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 should contains unique data */
     if ($this->uniqueData && $dexs) {
         $matches = $this->searchData($data, Sobi::Reg('current_section'));
         if (count($matches) > 1 || count($matches) == 1 && $matches[0] != $entry->get('id')) {
             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));
     }
     if (!$dexs) {
         $data = null;
     }
     $this->setData($data);
     return $data;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:59,代码来源:inbox.php

示例12: validate

 /**
  * @param $xml - path to xml file inside the administrator directory (e.g. field.definitions.filter)
  * @param $type - object type or array with error url
  * */
 protected function validate($xml, $type)
 {
     $definition = SPLoader::path($xml, 'adm', true, 'xml');
     if ($definition) {
         if (is_array($type)) {
             $errorUrl = Sobi::Url($type);
         } else {
             $errorUrl = Sobi::Url(array('task' => $type . '.edit', 'sid' => SPRequest::sid()));
         }
         $xdef = new DOMXPath(DOMdocument::load($definition));
         $required = $xdef->query('//field[@required="true"]');
         if ($required->length) {
             for ($i = 0; $i < $required->length; $i++) {
                 $node = $required->item($i);
                 $name = $node->attributes->getNamedItem('name')->nodeValue;
                 if (!SPRequest::raw(str_replace('.', '_', $name))) {
                     $this->response($errorUrl, Sobi::Txt('PLEASE_FILL_IN_ALL_REQUIRED_FIELDS'), false, SPC::ERROR_MSG, array('required' => $name));
                 }
             }
         }
     }
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:26,代码来源:controller.php


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