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


PHP SPLoader::path方法代码示例

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


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

示例1: saveToken

 public function saveToken($token)
 {
     $arrdef = SPFactory::Instance('types.array');
     $def = $arrdef->fromXML($this->definition, 'repository');
     $ndef = array();
     $u = false;
     $rid = null;
     foreach ($def['repository'] as $k => $v) {
         if ($u) {
             $ndef['token'] = $token;
         }
         if ($k == 'id') {
             $rid = $v;
         }
         if ($k == 'url') {
             $u = true;
         }
         $ndef[$k] = $v;
     }
     $path = SPLoader::path("etc.repos.{$rid}.repository", 'front', true, 'xml');
     $file = SPFactory::Instance('base.fs.file', $path);
     $xdef = SPFactory::Instance('types.array');
     $file->content($xdef->toXML($ndef, 'repository'));
     $file->save();
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:25,代码来源:repository.php

示例2: __construct

 public function __construct()
 {
     $ident = SPRequest::cmd('session') ? SPRequest::cmd('ProgressMsg' . SPRequest::cmd('session'), null, 'cookie') : SPRequest::cmd('ProgressMsg', null, 'cookie');
     $this->file = SPLoader::path('tmp.' . $ident, 'front', false, 'tmp');
     if (SPFs::exists($this->file)) {
         $content = json_decode(SPFs::read($this->file), true);
         $this->message = $content['message'];
         $this->type = $content['type'];
         $this->progress = $content['progress'];
         $this->interval = $content['interval'];
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:12,代码来源:progress.php

示例3: validate

 public function validate()
 {
     $type = $this->type == 'SobiProApp' ? 'application' : $this->type;
     $schemaDef = SPLoader::path('lib.services.installers.schemas.' . $type, 'front', false, 'xsd');
     if (!SPFs::exists($schemaDef) || time() - filemtime($schemaDef) > 60 * 60 * 24 * 7) {
         $connection = SPFactory::Instance('services.remote');
         $def = "https://xml.sigsiu.net/SobiPro/{$type}.xsd";
         $connection->setOptions(array('url' => $def, 'connecttimeout' => 10, 'header' => false, 'returntransfer' => true, 'ssl_verifypeer' => false, 'ssl_verifyhost' => 2));
         $schema =& SPFactory::Instance('base.fs.file', SPLoader::path('lib.services.installers.schemas.' . $type, 'front', false, 'xsd'));
         $file = $connection->exec();
         if (!strlen($file)) {
             throw new SPException(SPLang::e('CANNOT_ACCESS_SCHEMA_DEF', $def));
         }
         $schema->content($file);
         $schema->save();
         $schemaDef = $schema->filename();
     }
     if (!$this->definition->schemaValidate($schemaDef)) {
         throw new SPException(SPLang::e('CANNOT_VALIDATE_SCHEMA_DEF_AT', str_replace(SOBI_ROOT . DS, null, $this->xmlFile), $def));
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:21,代码来源:installer.php

示例4: screen

 private function screen()
 {
     $view =& SPFactory::View('view', true);
     $view->setTemplate('config.help');
     if (SPLoader::path('etc.repos.sobipro_core.repository', 'front', true, 'xml')) {
         $repository = SPFactory::Instance('services.installers.repository');
         $repository->loadDefinition(SPLoader::path("etc.repos.sobipro_core.repository", 'front', true, 'xml'));
         try {
             $repository->connect();
         } catch (SPException $x) {
             $view->assign(SPLang::e('REPO_ERR', $x->getMessage()), 'message');
         }
         try {
             $response = $repository->help($repository->get('token'), SPRequest::cmd('mid'));
             $view->assign($response, 'message');
         } catch (SPException $x) {
             $view->assign(SPLang::e('REPO_ERR', $x->getMessage()), 'message');
         }
     } else {
         $view->assign(Sobi::Txt('MSG.HELP_ADD_CORE_REPO'), 'message');
     }
     $view->display();
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:23,代码来源:help.php

示例5: getNews

 private function getNews()
 {
     $out = array();
     $path = SPLoader::path('etc.news', 'front', false, 'xml');
     if (SPFs::exists($path) && time() - filemtime($path) < 60 * 60 * 12) {
         $content = SPFs::read(SPLoader::path('etc.news', 'front', false, 'xml'));
     } else {
         try {
             $connection = SPFactory::Instance('services.remote');
             $news = 'http://rss.sigsiu.net';
             $connection->setOptions(array('url' => $news, 'connecttimeout' => 10, 'header' => false, 'returntransfer' => true));
             $file = SPFactory::Instance('base.fs.file', $path);
             $content = $connection->exec();
             $cinf = $connection->info();
             if (isset($cinf['http_code']) && $cinf['http_code'] != 200) {
                 return Sobi::Error('about', sprintf('CANNOT_GET_NEWS', $news, $cinf['http_code']), SPC::WARNING, 0, __LINE__, __FILE__);
             }
             $file->content($content);
             $file->save();
         } catch (SPException $x) {
             return Sobi::Error('about', SPLang::e('CANNOT_LOAD_NEWS', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
         }
     }
     try {
         if (strlen($content)) {
             $news = new DOMXPath(DOMDocument::loadXML($content));
             $atom = false;
             if ($atom) {
                 //Atom
                 $news->registerNamespace('atom', 'http://www.w3.org/2005/Atom');
                 $out['title'] = $news->query('/atom:feed/atom:title')->item(0)->nodeValue;
                 $items = $news->query('/atom:feed/atom:entry[*]');
                 $c = 5;
                 $open = false;
                 foreach ($items as $item) {
                     $date = $item->getElementsByTagName('updated')->item(0)->nodeValue;
                     if (!$open && time() - strtotime($date) < 60 * 60 * 24) {
                         $open = true;
                     }
                     $feed = array('url' => $item->getElementsByTagName('link')->item(0)->nodeValue, 'title' => $item->getElementsByTagName('title')->item(0)->nodeValue, 'content' => $item->getElementsByTagName('content')->item(0)->nodeValue);
                     if (!$c--) {
                         break;
                     }
                     $out['feeds'][] = $feed;
                 }
             } else {
                 //RSS
                 $out['title'] = $news->query('/rss/channel/title')->item(0)->nodeValue;
                 $items = $news->query('/rss/channel/item[*]');
                 $c = 5;
                 $open = false;
                 foreach ($items as $item) {
                     $date = $item->getElementsByTagName('pubDate')->item(0)->nodeValue;
                     if (!$open && time() - strtotime($date) < 60 * 60 * 24) {
                         $open = true;
                     }
                     $feed = array('url' => $item->getElementsByTagName('link')->item(0)->nodeValue, 'title' => $item->getElementsByTagName('title')->item(0)->nodeValue, 'content' => $item->getElementsByTagName('description')->item(0)->nodeValue, 'image' => $item->getElementsByTagName('enclosure')->item(0)->attributes->getNamedItem('url')->nodeValue);
                     if (!$c--) {
                         break;
                     }
                     $out['feeds'][] = $feed;
                 }
             }
         }
         if ($open) {
             SPFactory::header()->addJsCode('SobiPro.jQuery( document ).ready( function () { SobiPro.jQuery( \'#SobiProNews\' ).trigger(\'click\'); } );');
         }
     } catch (DOMException $x) {
         return Sobi::Error('about', SPLang::e('CANNOT_LOAD_NEWS', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
     }
     return $out;
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:72,代码来源:front.php

示例6: listTemplates

 protected function listTemplates($tpl = null, $cmsOv = true)
 {
     SPFactory::header()->addJsFile('dtree')->addCssFile('dtree', true);
     SPLoader::loadClass('base.fs.directory_iterator');
     $ls = Sobi::Cfg('live_site') . 'media/sobipro/tree';
     $nodes = null;
     $count = 0;
     $tpl = Sobi::FixPath($tpl ? $tpl : SPLoader::dirPath('usr.templates'));
     if (Sobi::Section()) {
         $realName = Sobi::Txt('TP.INFO');
         $iTask = Sobi::Url(array('task' => 'template.info', 'template' => basename($tpl), 'sid' => Sobi::Section()));
         $nodes .= "spTpl.add( -123, 0,'{$realName}','{$iTask}', '', '', '{$ls}/info.png' );\n";
         if (file_exists("{$tpl}/config.xml")) {
             $realName = Sobi::Txt('TP.SETTINGS');
             $iTask = Sobi::Url(array('task' => 'template.settings', 'template' => basename($tpl), 'sid' => Sobi::Section()));
             $nodes .= "spTpl.add( -120, 0,'{$realName}','{$iTask}', '', '', '{$ls}/settings.png' );\n";
         }
     }
     $this->travelTpl(new SPDirectoryIterator($tpl), $nodes, 0, $count);
     if ($cmsOv) {
         $cms = SPFactory::CmsHelper()->templatesPath();
         if (is_array($cms) && isset($cms['name']) && isset($cms['data']) && is_array($cms['data']) && count($cms['data'])) {
             $count++;
             if (isset($cms['icon'])) {
                 $nodes .= "spTpl.add( {$count}, 0, '{$cms['name']}', '', '', '', '{$cms['icon']}', '{$cms['icon']}' );\n";
             } else {
                 $nodes .= "spTpl.add( {$count}, 0, '{$cms['name']}' );\n";
             }
             $current = $count;
             foreach ($cms['data'] as $name => $path) {
                 $count++;
                 $nodes .= "spTpl.add( {$count}, {$current},'{$name}' );\n";
                 $this->travelTpl(new SPDirectoryIterator($path), $nodes, $count, $count, true);
             }
         }
     }
     if (Sobi::Section()) {
         $file = SPLoader::path('usr.templates.' . Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE) . '.template', 'front', true, 'xml');
         $def = new DOMDocument();
         $def->load($file);
         $xdef = new DOMXPath($def);
         $t = $xdef->query('/template/name')->item(0)->nodeValue;
     } else {
         $t = Sobi::Txt('GB.TEMPLATES');
     }
     SPFactory::header()->addJsCode("\n\t\t\ticons = {\n\t\t\t\t\t\troot : '{$ls}/base.gif',\n\t\t\t\t\t\tfolder : '{$ls}/folder.gif',\n\t\t\t\t\t\tfolderOpen : '{$ls}/folderopen.gif',\n\t\t\t\t\t\tnode : '{$ls}/page.gif',\n\t\t\t\t\t\tempty : '{$ls}/empty.gif',\n\t\t\t\t\t\tline : '{$ls}/line.gif',\n\t\t\t\t\t\tjoin : '{$ls}/join.gif',\n\t\t\t\t\t\tjoinBottom : '{$ls}/joinbottom.gif',\n\t\t\t\t\t\tplus : '{$ls}/plus.gif',\n\t\t\t\t\t\tplusBottom : '{$ls}/plusbottom.gif',\n\t\t\t\t\t\tminus : '{$ls}/minus.gif',\n\t\t\t\t\t\tminusBottom\t: '{$ls}/minusbottom.gif',\n\t\t\t\t\t\tnlPlus : '{$ls}/nolines_plus.gif',\n\t\t\t\t\t\tnlMinus : '{$ls}/nolines_minus.gif'\n\t\t\t};\n\t\t\tvar spTpl = new dTree( 'spTpl', icons );\t\n\n\t\t\tSobiPro.jQuery( document ).ready( function ()\n\t\t\t{\n\t\t\t\tspTpl.add(0, -1, '{$t}' );\n\n\t\t\t\t{$nodes} \n\n\t\t\t\ttry { document.getElementById( 'spTpl' ).innerHTML = spTpl } catch( e ) {}\n\t\t\t} );\n\t\t");
     /** for some reason jQuery is not able to add the tree  */
     return "<div id=\"spTpl\"></div>";
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:49,代码来源:config.php

示例7: templatePath

 protected function templatePath($tpl)
 {
     $file = explode('.', $tpl);
     if (strstr($file[0], 'cms:')) {
         $file[0] = str_replace('cms:', null, $file[0]);
         $file = SPFactory::mainframe()->path(implode('.', $file));
         $template = SPLoader::path($file, 'root', false, null);
     } else {
         $template = SOBI_PATH . '/usr/templates/' . str_replace('.', '/', $tpl);
     }
     return $template;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:12,代码来源:menu.php

示例8: storeView

 /**
  */
 public function storeView($head)
 {
     if (!Sobi::Cfg('cache.xml_enabled') || $this->_cachedView || Sobi::My('id') && Sobi::Cfg('cache.xml_no_reg')) {
         return false;
     }
     if ($this->view['xml']) {
         $xml = $this->view['xml'];
         $template = Sobi::Reg('cache_view_template');
         if (!$template) {
             $template = $this->view['template'];
             $template = str_replace(SPLoader::translateDirPath(Sobi::Cfg('section.template'), 'templates'), null, $template);
         }
         $root = $xml->documentElement;
         $root->removeChild($root->getElementsByTagName('visitor')->item(0));
         if ($root->getElementsByTagName('messages')->length) {
             $root->removeChild($root->getElementsByTagName('messages')->item(0));
         }
         /** @var $header DOMDocument */
         $header = SPFactory::Instance('types.array')->toXML($head, 'header', true);
         $root->appendChild($xml->importNode($header->documentElement, true));
         if ($this->view['data'] && count($this->view['data'])) {
             $data = SPFactory::Instance('types.array')->toXML($this->view['data'], 'cache-data', true);
             $root->appendChild($xml->importNode($data->documentElement, true));
         }
         $request = $this->viewRequest();
         $request['template'] = $template;
         $configFiles = SPFactory::registry()->get('template_config');
         $request['configFile'] = str_replace('"', "'", json_encode($configFiles));
         $request['cid'] = 'NULL';
         $request['created'] = 'FUNCTION:NOW()';
         $fileName = md5(serialize($request));
         $request['fileName'] = $fileName;
         $filePath = SPLoader::path('var.xml.' . $fileName, 'front', false, 'xml');
         $content = $xml->saveXML();
         $content = str_replace('&nbsp;', '&#160;', $content);
         $content = preg_replace('/[^\\x{0009}\\x{000a}\\x{000d}\\x{0020}-\\x{D7FF}\\x{E000}-\\x{FFFD}]+/u', null, $content);
         $matches = array();
         preg_match_all('/<(category|entry|subcategory)[^>]*id="(\\d{1,})"/', $content, $matches);
         try {
             $cid = SPFactory::db()->insert('spdb_view_cache', $request, false, true)->insertid();
             $relations = array(SPRequest::sid() => array('cid' => $cid, 'sid' => SPRequest::sid()));
             if (isset($matches[2])) {
                 $ids = array_unique($matches[2]);
                 foreach ($ids as $sid) {
                     $relations[$sid] = array('cid' => $cid, 'sid' => $sid);
                 }
             }
             SPFactory::db()->insertArray('spdb_view_cache_relation', $relations);
             SPFs::write($filePath, $content);
         } catch (SPException $x) {
             Sobi::Error('XML-Cache', $x->getMessage());
         }
     }
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:56,代码来源:cache.php

示例9: displayForm

 /**
  *
  */
 public function displayForm()
 {
     Sobi::Trigger('Display', $this->name(), array(&$this));
     $action = $this->key('action');
     echo '<div class="SobiPro" id="SobiPro">' . "\n";
     if ($this->get('_compatibility')) {
         echo SPFactory::AdmToolbar()->render();
         echo $this->legacyMessages();
     }
     echo $action ? "\n<form action=\"{$action}\" method=\"post\" name=\"adminForm\" id=\"SPAdminForm\" enctype=\"multipart/form-data\" accept-charset=\"utf-8\" >\n" : null;
     foreach ($this->_templates as $tpl) {
         $template = SPLoader::path($tpl, 'adm.template');
         if (!$template) {
             $tpl = SPLoader::translatePath($tpl, 'adm.template', false);
             Sobi::Error($this->name(), SPLang::e('CANNOT_LOAD_TEMPLATE_AT', $tpl), SPC::ERROR, 500, __LINE__, __FILE__);
         } else {
             include $template;
         }
     }
     if (count($this->_hidden)) {
         $this->_hidden[SPFactory::mainframe()->token()] = 1;
         $prefix = null;
         if (!$this->get('_compatibility')) {
             $prefix = 'SP_';
         }
         foreach ($this->_hidden as $name => $value) {
             echo "\n<input type=\"hidden\" name=\"{$name}\" id=\"{$prefix}{$name}\" value=\"{$value}\"/>";
         }
     }
     echo $action ? "\n</form>\n" : null;
     echo '</div>';
     Sobi::Trigger('AfterDisplay', $this->name());
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:36,代码来源:field.php

示例10: dir

 private function dir($file)
 {
     $file = explode('.', $file);
     if (strstr($file[0], 'cms:')) {
         $file[0] = str_replace('cms:', null, $file[0]);
         $file = SPFactory::mainframe()->path(implode('.', $file));
         $file = SPLoader::dirPath($file, 'root', true);
     } else {
         $file = SPLoader::dirPath('usr.templates.' . implode('.', $file), 'front', true);
     }
     if (!$file) {
         $file = SPLoader::path('usr.templates.' . implode('.', $file), 'front', false);
         Sobi::Error($this->name(), SPLang::e('FILE_NOT_FOUND', $file), SPC::WARNING, 404, __LINE__, __FILE__);
     }
     return $file;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:16,代码来源:template.php

示例11: store

 private function store($key, $value, $msg = null)
 {
     // let's try to create kinda mutex here
     $file = SPLoader::path('tmp.info', 'front', false, 'txt');
     while (SPFs::exists($file)) {
         usleep(100000);
     }
     $c = date(DATE_RFC822);
     SPFs::write($file, $c);
     $store = Sobi::GetUserData('requirements', array());
     $store[$key] = array('value' => $value, 'message' => $msg);
     Sobi::SetUserData('requirements', $store);
     SPFs::delete($file);
     //		$msg = $msg ? $msg[ 'org' ][ 'label' ] : null;
     //		$file = SPLoader::path( 'tmp.info', 'front', false, 'txt' );
     //		$cont = null;
     //		if ( SPFs::exists( $file ) ) {
     //			$cont = SPFs::read( $file );
     //		}
     //		$txt = "{$cont}\n{$key}={$msg};{$value}";
     //		SPFs::write( $file, $txt );
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:22,代码来源:requirements.php

示例12: display

 /**
  *
  */
 public function display()
 {
     $tpl = SPLoader::path($this->_template . '_override', 'adm.template');
     if (!$tpl) {
         $tpl = SPLoader::path($this->_template, 'adm.template');
     }
     if (!$tpl) {
         $tpl = SPLoader::translatePath($this->_template, 'adm.template', false);
         Sobi::Error($this->name(), SPLang::e('TEMPLATE_DOES_NOT_EXISTS', $tpl), SPC::ERROR, 500, __LINE__, __FILE__);
         exit;
     }
     Sobi::Trigger('Display', $this->name(), array(&$this));
     $action = $this->key('action');
     echo "\n<!-- SobiPro output -->\n";
     echo '<div class="SobiPro" id="SobiPro">' . "\n";
     if ($this->_legacy) {
         echo SPFactory::AdmToolbar()->render();
         echo $this->legacyMessages();
         echo '<div class="row-fluid">' . "\n";
     }
     echo $action ? "\n<form action=\"{$action}\" method=\"post\" name=\"adminForm\" id=\"SPAdminForm\" enctype=\"multipart/form-data\" accept-charset=\"utf-8\" >\n" : null;
     $prefix = null;
     if (!$this->_legacy) {
         $prefix = 'SP_';
     }
     include $tpl;
     if (count($this->_hidden)) {
         $this->_hidden[SPFactory::mainframe()->token()] = 1;
         $this->_hidden['spsid'] = microtime(true) + Sobi::My('id') * mt_rand(5, 15) / mt_rand(5, 15);
         foreach ($this->_hidden as $name => $value) {
             echo "\n<input type=\"hidden\" name=\"{$name}\" id=\"{$prefix}{$name}\" value=\"{$value}\"/>";
         }
     }
     echo $action ? "\n</form>\n" : null;
     if ($this->_legacy) {
         echo '</div>' . "\n";
     }
     echo '</div>' . "\n";
     echo "\n<!-- SobiPro output end -->\n";
     Sobi::Trigger('AfterDisplay', $this->name());
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:44,代码来源:view.php

示例13: debOut

 /**
  * Creates debug output
  * @param mixed $str - string/object/array to parse
  * @param bool $hide - embed within a HTML comment
  * @param bool $return - return or output directly
  * @param bool $store - store within a file
  * @return mixed
  */
 public static function debOut($str = null, $hide = false, $return = false, $store = false)
 {
     $return = $store ? 1 : $return;
     if (!$str) {
         $str = 'Empty';
     }
     if ($hide) {
         echo "\n\n<!-- Sobi Pro Debug: ";
     } elseif (!$return) {
         echo "<h4>";
     }
     if (is_object($str)) {
         try {
             $str = @var_export($str);
             $str = trim(highlight_string($str, true));
         } catch (Exception $x) {
             $str = $x->getMessage();
         }
     } elseif (is_array($str)) {
         $str = @print_r($str, true);
         $str = highlight_string($str, true);
     }
     if (!$return) {
         echo $str;
     }
     if ($hide) {
         echo "  -->\n\n";
     } elseif (!$return) {
         echo "</h4>";
     }
     if ($store) {
         file_put_contents(SPLoader::path('var.log.debug', 'front', false, 'html'), '<br/>[' . date(DATE_RFC822) . "]<br/>{$str}<br/>", SPC::FS_APP);
     } elseif ($return) {
         return $str;
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:44,代码来源:config.php

示例14: save


//.........这里部分代码省略.........
     /* check if we have stored last edit in cache */
     $tsId = SPRequest::string('editentry', null, false, 'cookie');
     if (!$tsId) {
         $tsId = SPRequest::cmd('ssid');
     }
     $request = $this->getCache($tsId);
     $this->_model->init(SPRequest::sid($request));
     $tplPackage = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
     $this->tplCfg($tplPackage);
     $customClass = null;
     if (isset($this->_tCfg['general']['functions']) && $this->_tCfg['general']['functions']) {
         $customClass = SPLoader::loadClass('/' . str_replace('.php', null, $this->_tCfg['general']['functions']), false, 'templates');
         if (method_exists($customClass, 'BeforeStoreEntry')) {
             $customClass::BeforeStoreEntry($this->_model, $this->store['post']);
             SPFactory::registry()->set('requestcache_stored', $this->store);
             SPFactory::registry()->set('requestcache', $this->store['post']);
         }
     }
     $preState = array('approved' => $this->_model->get('approved'), 'state' => $this->_model->get('state'), 'new' => !$this->_model->get('id'));
     SPFactory::registry()->set('object_previous_state', $preState);
     $this->_model->getRequest($this->_type, $request);
     Sobi::Trigger($this->name(), __FUNCTION__, array(&$this->_model));
     if ($this->_model->get('id') && $this->_model->get('id') == SPRequest::sid()) {
         $new = false;
         if (Sobi::My('id') && Sobi::My('id') == $this->_model->get('owner')) {
             $this->authorise('edit', 'own');
         } else {
             $this->authorise('edit', '*');
         }
     } else {
         $this->authorise('add', 'own');
     }
     $this->_model->save($request);
     /* if there is something pay */
     $pCount = SPFactory::payment()->count($this->_model->get('id'));
     if ($pCount && !Sobi::Can('entry.payment.free')) {
         //			$this->paymentView( $tsid );
         if ($customClass && method_exists($customClass, 'BeforeStoreEntryPayment')) {
             $customClass::BeforeStoreEntryPayment($this->_model->get('id'));
         }
         SPFactory::payment()->store($this->_model->get('id'));
     }
     /* delete cache files on after */
     $file = str_replace('.', '-', $tsId);
     if (SPLoader::dirPath('tmp.edit.' . $file)) {
         SPFs::delete(SPLoader::dirPath('tmp.edit.' . $file));
     } else {
         SPFactory::cache()->deleteVar('request_cache_' . $tsId);
     }
     SPLoader::loadClass('env.cookie');
     SPCookie::delete('editentry');
     $sid = $this->_model->get('id');
     $pid = SPRequest::int('pid') ? SPRequest::int('pid') : Sobi::Section();
     if ($new) {
         if ($this->_model->get('state') || Sobi::Can('entry.see_unpublished.own')) {
             $msg = $this->_model->get('state') ? Sobi::Txt('EN.ENTRY_SAVED') : Sobi::Txt('EN.ENTRY_SAVED_NP');
             $url = Sobi::Url(array('sid' => $sid, 'pid' => $pid));
         } else {
             // determine if there is a custom redirect
             if (Sobi::Cfg('redirects.entry_save_enabled') && !($pCount && !Sobi::Can('entry.payment.free'))) {
                 $redirect = Sobi::Cfg('redirects.entry_save_url', null);
                 if (!preg_match('/http[s]?:\\/\\/.*/', $redirect) && $redirect != 'index.php') {
                     $redirect = Sobi::Url($redirect);
                 }
                 $this->response($redirect, Sobi::Txt(Sobi::Cfg('redirects.entry_save_msg', 'EN.ENTRY_SAVED_NP')), true, Sobi::Cfg('redirects.entry_save_msgtype', SPC::SUCCESS_MSG));
             } else {
                 $msg = Sobi::Txt('EN.ENTRY_SAVED_NP');
                 $url = Sobi::Url(array('sid' => $pid));
             }
         }
     } elseif ($this->_model->get('approved') || Sobi::Can('entry.see_unapproved.own')) {
         $url = Sobi::Url(array('sid' => $sid, 'pid' => $pid));
         $msg = $this->_model->get('approved') ? Sobi::Txt('EN.ENTRY_SAVED') : Sobi::Txt('EN.ENTRY_SAVED_NA');
     } else {
         if ($this->_model->get('approved')) {
             $msg = Sobi::Txt('EN.ENTRY_SAVED');
         } else {
             $msg = Sobi::Txt('EN.ENTRY_SAVED_NA');
         }
         $url = Sobi::Url(array('sid' => $sid, 'pid' => $pid));
     }
     if ($pCount && !Sobi::Can('entry.payment.free')) {
         $ident = md5(microtime() . $tsId . $sid . time());
         $data = array('data' => SPFactory::payment()->summary($sid), 'ident' => $ident);
         $url = Sobi::Url(array('sid' => $sid, 'task' => 'entry.payment'), false, false);
         if (Sobi::Cfg('cache.l3_enabled', true)) {
             SPFactory::cache()->addObj($data, 'payment', $sid, Sobi::Section(), true);
         } else {
             SPFs::write(SPLoader::path('tmp.edit.' . $ident . '.payment', 'front', false, 'var'), SPConfig::serialize($data));
             $url = Sobi::Url(array('sid' => $sid, 'task' => 'entry.payment', 'tsid' => $ident), false, false);
         }
         SPLoader::loadClass('env.cookie');
         SPCookie::set('payment_' . $sid, $ident, SPCookie::days(1));
     }
     if ($customClass && method_exists($customClass, 'AfterStoreEntry')) {
         $customClass::AfterStoreEntry($this->_model);
     }
     $this->logChanges('save', SPRequest::string('history-note'));
     $this->response($url, $msg, true, SPC::SUCCESS_MSG);
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:101,代码来源:entry.php

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


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