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


PHP SPLoader::dirPath方法代码示例

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


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

示例1: upload

 protected function upload()
 {
     $ident = SPRequest::cmd('ident', null, 'post');
     $data = SPRequest::file($ident, 'tmp_name');
     $secret = md5(Sobi::Cfg('secret'));
     if ($data) {
         $properties = SPRequest::file($ident);
         $fileName = md5(SPRequest::file($ident, 'name') . time() . $secret);
         $path = SPLoader::dirPath("tmp.files.{$secret}", 'front', false) . '/' . $fileName;
         /** @var $file SPFile */
         $file = SPFactory::Instance('base.fs.file');
         if (!$file->upload($data, $path)) {
             $this->message(array('type' => 'error', 'text' => SPLang::e('CANNOT_UPLOAD_FILE'), 'id' => ''));
         }
         $path = $file->getPathname();
         $type = $this->check($path);
         $properties['tmp_name'] = $path;
         SPFs::write($path . '.var', SPConfig::serialize($properties));
         $response = array('type' => 'success', 'text' => Sobi::Txt('FILE_UPLOADED', $properties['name'], $type), 'id' => 'file://' . $fileName, 'data' => array('name' => $properties['name'], 'type' => $properties['type'], 'size' => $properties['size']));
     } else {
         $response = array('type' => 'error', 'text' => SPLang::e('CANNOT_UPLOAD_FILE_NO_DATA'), 'id' => '');
     }
     //		$field = SPRequest::cmd( 'field', null );
     $this->message($response);
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:25,代码来源:file.php

示例2: install

 public function install()
 {
     $id = $this->xGetString('id');
     $name = $this->xGetString('name');
     if (SPLoader::dirPath('usr.templates.' . $id) && !SPRequest::bool('force')) {
         throw new SPException(SPLang::e('TEMPLATE_INST_DUPLICATE', $name) . ' ' . Sobi::Txt('FORCE_TPL_UPDATE', Sobi::Url(array('task' => 'extensions.install', 'force' => 1, 'root' => basename($this->root) . '/' . basename($this->xmlFile)))));
     }
     $requirements = $this->xGetChilds('requirements/*');
     if ($requirements && $requirements instanceof DOMNodeList) {
         SPFactory::Instance('services.installers.requirements')->check($requirements);
     }
     $language = $this->xGetChilds('language/file');
     $folder = @$this->xGetChilds('language/@folder')->item(0)->nodeValue;
     if ($language && $language instanceof DOMNodeList && $language->length) {
         $langFiles = array();
         foreach ($language as $file) {
             $adm = false;
             if ($file->attributes->getNamedItem('admin')) {
                 $adm = $file->attributes->getNamedItem('admin')->nodeValue == 'true' ? true : false;
             }
             $langFiles[$file->attributes->getNamedItem('lang')->nodeValue][] = array('path' => Sobi::FixPath("{$this->root}/{$folder}/" . trim($file->nodeValue)), 'name' => $file->nodeValue, 'adm' => $adm);
         }
         SPFactory::CmsHelper()->installLang($langFiles, false, true);
     }
     $path = SPLoader::dirPath('usr.templates.' . $id, 'front', false);
     if (SPRequest::bool('force')) {
         /** @var $from SPDirectory */
         $from = SPFactory::Instance('base.fs.directory', $this->root);
         $from->moveFiles($path);
     } else {
         if (!SPFs::move($this->root, $path)) {
             throw new SPException(SPLang::e('CANNOT_MOVE_DIRECTORY', $this->root, $path));
         }
     }
     if (!SPRequest::bool('force')) {
         $section = $this->xGetChilds('install');
         if ($section instanceof DOMNodeList && $section->length) {
             $this->section($id);
         }
     }
     //05 Oct 2015 Kishore
     $exec = $this->xGetString('exec');
     if ($exec && SPFs::exists($path . DS . $exec)) {
         include_once "{$path}/{$exec}";
     }
     /** @var $dir SPDirectory */
     $dir =& SPFactory::Instance('base.fs.directory', $path);
     $zip = array_keys($dir->searchFile('.zip', false));
     if (count($zip)) {
         foreach ($zip as $file) {
             SPFs::delete($file);
         }
     }
     Sobi::Trigger('After', 'InstallTemplate', array($id));
     $dir =& SPFactory::Instance('base.fs.directory', SPLoader::dirPath('tmp.install'));
     $dir->deleteFiles();
     return Sobi::Txt('TP.TEMPLATE_HAS_BEEN_INSTALLED', array('template' => $name));
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:58,代码来源:template.php

示例3: install

 public function install()
 {
     $id = $this->xGetString('id');
     $name = $this->xGetString('name');
     if (SPLoader::dirPath('usr.templates.' . $id) && !SPRequest::bool('force')) {
         throw new SPException(SPLang::e('TEMPLATE_INST_DUPLICATE', $name) . ' ' . Sobi::Txt('FORCE_TPL_UPDATE', Sobi::Url(array('task' => 'extensions.install', 'force' => 1, 'root' => basename($this->root) . '/' . basename($this->xmlFile)))));
     }
     $requirements = $this->xGetChilds('requirements/*');
     if ($requirements && $requirements instanceof DOMNodeList) {
         SPFactory::Instance('services.installers.requirements')->check($requirements);
     }
     $path = SPLoader::dirPath('usr.templates.' . $id, 'front', false);
     if (SPRequest::bool('force')) {
         /** @var $from SPDirectory */
         $from = SPFactory::Instance('base.fs.directory', $this->root);
         $from->moveFiles($path);
     } else {
         if (!SPFs::move($this->root, $path)) {
             throw new SPException(SPLang::e('CANNOT_MOVE_DIRECTORY', $this->root, $path));
         }
     }
     if (!SPRequest::bool('force')) {
         $section = $this->xGetChilds('install');
         if ($section instanceof DOMNodeList && $section->length) {
             $this->section($id);
         }
     }
     $exec = $this->xGetString('exec');
     if ($exec && SPFs::exists($this->root . DS . $exec)) {
         include_once "{$this->root}/{$exec}";
     }
     /** @var $dir SPDirectory */
     $dir =& SPFactory::Instance('base.fs.directory', $path);
     $zip = array_keys($dir->searchFile('.zip', false));
     if (count($zip)) {
         foreach ($zip as $file) {
             SPFs::delete($file);
         }
     }
     Sobi::Trigger('After', 'InstallTemplate', array($id));
     $dir =& SPFactory::Instance('base.fs.directory', SPLoader::dirPath('tmp.install'));
     $dir->deleteFiles();
     return Sobi::Txt('TP.TEMPLATE_HAS_BEEN_INSTALLED', array('template' => $name));
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:44,代码来源:template.php

示例4: install

 private function install($file = null)
 {
     $arch = SPFactory::Instance('base.fs.archive');
     $ajax = strlen(SPRequest::cmd('ident', null, 'post'));
     if (!$file && SPRequest::string('root')) {
         $file = str_replace('.xml', null, SPRequest::string('root'));
         $file = SPLoader::path('tmp.install.' . $file, 'front', true, 'xml');
     }
     if (!$file) {
         $ident = SPRequest::cmd('ident', null, 'post');
         $data = SPRequest::file($ident);
         $name = str_replace(array('.' . SPFs::getExt($data['name']), '.'), null, $data['name']);
         $path = SPLoader::dirPath('tmp.install.' . $name, 'front', false);
         $c = 0;
         while (SPFs::exists($path)) {
             $path = SPLoader::dirPath('tmp.install.' . $name . '_' . ++$c, 'front', false);
         }
         /*
          * temp directory - will be removed later but it needs to be writable for apache and Joomla! fs (FTP mode)
          */
         try {
             if (Sobi::Cfg('ftp_mode')) {
                 SPFs::mkdir($path, 0777);
             } else {
                 SPFs::mkdir($path);
             }
         } catch (SPException $x) {
             return $this->ajaxResponse($ajax, $x->getMessage(), false, SPC::ERROR_MSG);
         }
         $file = $path . '/' . $data['name'];
         try {
             $arch->upload($data['tmp_name'], $file);
         } catch (SPException $x) {
             return $this->ajaxResponse($ajax, $x->getMessage(), false, SPC::ERROR_MSG);
         }
     } elseif (SPRequest::string('root') && $file) {
         $path = dirname($file);
     } else {
         $arch->setFile($file);
         $name = str_replace(array('.' . SPFs::getExt($file), '.'), null, basename($file));
         $path = SPLoader::dirPath('tmp.install.' . $name, 'front', false);
         $c = 0;
         while (SPFs::exists($path)) {
             $path = SPLoader::dirPath('tmp.install.' . $name . '_' . ++$c, 'front', false);
         }
         /*
          * temp directory - will be removed later but it needs to  writable for apache and Joomla! fs (FTP mode)
          */
         try {
             if (Sobi::Cfg('ftp_mode')) {
                 SPFs::mkdir($path, 0777);
             } else {
                 SPFs::mkdir($path);
             }
         } catch (SPException $x) {
             return $this->ajaxResponse($ajax, $x->getMessage(), false, SPC::ERROR_MSG);
         }
     }
     if ($path) {
         if (!SPRequest::string('root')) {
             if (!$arch->extract($path)) {
                 return $this->ajaxResponse($ajax, SPLang::e('CANNOT_EXTRACT_ARCHIVE', basename($file), $path), false, SPC::ERROR_MSG);
             }
         }
         $dir =& SPFactory::Instance('base.fs.directory', $path);
         $xml = array_keys($dir->searchFile('.xml', false, 2));
         if (!count($xml)) {
             return $this->ajaxResponse($ajax, SPLang::e('NO_INSTALL_FILE_IN_PACKAGE'), false, SPC::ERROR_MSG);
         }
         $definition = $this->searchInstallFile($xml);
         if (!$definition) {
             if (SPFactory::CmsHelper()->installerFile($xml)) {
                 try {
                     $message = SPFactory::CmsHelper()->install($xml, $path);
                     return $this->ajaxResponse($ajax, $message['msg'], $ajax, $message['msgtype']);
                 } catch (SPException $x) {
                     return $this->ajaxResponse($ajax, $x->getMessage(), $ajax, SPC::ERROR_MSG);
                 }
             } else {
                 return $this->ajaxResponse($ajax, SPLang::e('NO_INSTALL_FILE_IN_PACKAGE'), false, SPC::ERROR_MSG);
             }
         }
         /** @var $installer SPInstaller */
         $installer =& SPFactory::Instance('services.installers.' . trim(strtolower($definition->documentElement->tagName)), $xml[0], trim($definition->documentElement->tagName));
         try {
             $installer->validate();
             $msg = $installer->install();
             return $this->ajaxResponse($ajax, $msg, true, SPC::SUCCESS_MSG);
         } catch (SPException $x) {
             return $this->ajaxResponse($ajax, $x->getMessage(), false, SPC::ERROR_MSG);
         }
     } else {
         return $this->ajaxResponse($ajax, SPLang::e('NO_FILE_HAS_BEEN_UPLOADED'), false, SPC::ERROR_MSG);
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:95,代码来源:extensions.php

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

示例6: templatesList

 public function templatesList($params = null)
 {
     $cms = SPFactory::CmsHelper()->templatesPath();
     $dir = new SPDirectoryIterator(SPLoader::dirPath('usr.templates'));
     $templates = array();
     foreach ($dir as $file) {
         if ($file->isDir()) {
             if ($file->isDot() || in_array($file->getFilename(), array('common', 'front'))) {
                 continue;
             }
             if (SPFs::exists($file->getPathname() . DS . 'template.xml') && ($tname = $this->templateName($file->getPathname() . DS . 'template.xml'))) {
                 $templates[$file->getFilename()] = $tname;
             } else {
                 $templates[$file->getFilename()] = $file->getFilename();
             }
         }
     }
     if (is_array($cms) && isset($cms['name']) && isset($cms['data']) && is_array($cms['data']) && count($cms['data'])) {
         $templates[$cms['name']] = array();
         foreach ($cms['data'] as $name => $path) {
             $templates[$cms['name']][$name] = array();
             $dir = new SPDirectoryIterator($path);
             foreach ($dir as $file) {
                 if ($file->isDot()) {
                     continue;
                 }
                 $fpath = 'cms:' . str_replace(SOBI_ROOT . DS, null, $file->getPathname());
                 $fpath = str_replace(DS, '.', $fpath);
                 if (SPFs::exists($file->getPathname() . DS . 'template.xml') && ($tname = $this->templateName($file->getPathname() . DS . 'template.xml'))) {
                     $templates[$cms['name']][$name][$fpath] = $tname;
                 } else {
                     $templates[$cms['name']][$name][$fpath] = $file->getFilename();
                 }
             }
         }
     }
     if ($params) {
         $p = array('select', 'spcfg_' . $params[1], $templates, Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE), false, $params[3]);
     } else {
         $p = $templates;
     }
     return $p;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:43,代码来源:config.php

示例7: save

 public function save(&$attr)
 {
     static $lang = null;
     static $defLang = null;
     if (!$lang) {
         $lang = Sobi::Lang();
         $defLang = Sobi::DefLang();
     }
     $file = SPRequest::file('spfieldsopts', 'tmp_name');
     if ($file) {
         $data = parse_ini_file($file, true);
     } elseif (is_string($attr['options'])) {
         $data = parse_ini_string($attr['options'], true);
     } else {
         $data = null;
     }
     $options = $this->parseOptsFile($data);
     if (!count($options) && count($attr['options'])) {
         $p = 0;
         $hold = array();
         foreach ($attr['options'] as $o) {
             if (is_numeric($o['id'])) {
                 $o['id'] = $this->nid . '_' . $o['id'];
             }
             if (isset($o['id'])) {
                 $i = 0;
                 $oid = $o['id'];
                 while (isset($hold[$oid])) {
                     $oid = $o['id'] . '_' . ++$i;
                 }
                 $options[] = array('id' => $oid, 'name' => $o['name'], 'parent' => null, 'position' => ++$p);
                 $hold[$oid] = $oid;
             }
         }
     }
     if (count($options)) {
         unset($attr['options']);
         $optionsArr = array();
         $labelsArr = array();
         $optsIds = array();
         $defLabelsArr = array();
         $duplicates = false;
         foreach ($options as $i => $option) {
             /* check for doubles */
             foreach ($options as $pos => $opt) {
                 if ($i == $pos) {
                     continue;
                 }
                 if ($option['id'] == $opt['id']) {
                     $option['id'] = $option['id'] . '_' . substr((string) microtime(), 2, 8) . rand(1, 100);
                     $duplicates = true;
                 }
             }
             $optionsArr[] = array('fid' => $this->id, 'optValue' => $option['id'], 'optPos' => $option['position'], 'optParent' => $option['parent']);
             $defLabelsArr[] = array('sKey' => $option['id'], 'sValue' => $option['name'], 'language' => $defLang, 'oType' => 'field_option', 'fid' => $this->id);
             $labelsArr[] = array('sKey' => $option['id'], 'sValue' => $option['name'], 'language' => $lang, 'oType' => 'field_option', 'fid' => $this->id);
             $optsIds[] = $option['id'];
         }
         if ($duplicates) {
             SPFactory::message()->warning('FIELD_WARN_DUPLICATE_OPT_ID');
         }
         $db = SPFactory::db();
         /* try to delete the existing labels */
         try {
             $db->delete('spdb_field_option', array('fid' => $this->id));
             $db->delete('spdb_language', array('oType' => 'field_option', 'fid' => $this->id, '!sKey' => $optsIds));
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('CANNOT_STORE_FIELD_OPTIONS_DB_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
         }
         /* insert new values */
         try {
             $db->insertArray('spdb_field_option', $optionsArr);
             $db->insertArray('spdb_language', $labelsArr, true);
             if ($defLang != $lang) {
                 $db->insertArray('spdb_language', $defLabelsArr, false, true);
             }
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('CANNOT_DELETE_SELECTED_OPTIONS', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
         }
     }
     if (!isset($attr['params'])) {
         $attr['params'] = array();
     }
     $myAttr = $this->getAttr();
     $properties = array();
     if (count($myAttr)) {
         foreach ($myAttr as $property) {
             $properties[$property] = isset($attr[$property]) ? $attr[$property] : null;
         }
     }
     $this->sets['field.options'] = SPFactory::Instance('types.array')->toINIString($data);
     /** handle upload of new definition file */
     $XMLFile = SPRequest::file('select-list-dependency', 'tmp_name');
     if ($XMLFile && file_exists($XMLFile)) {
         $XMLFileName = SPRequest::file('select-list-dependency', 'name');
         if (SPFs::getExt($XMLFileName) == 'zip') {
             $arch = SPFactory::Instance('base.fs.archive');
             $name = str_replace('.zip', null, $XMLFileName);
             $path = SPLoader::dirPath('tmp.install.' . $name, 'front', false);
             $c = 0;
//.........这里部分代码省略.........
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:101,代码来源:select.php

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

示例9: listFunctions

 protected function listFunctions()
 {
     /** @var SPDirectory $directory */
     $directory = SPFactory::Instance('base.fs.directory', SPLoader::dirPath('menu', 'adm.templates'));
     $files = $directory->searchFile('.xml', false);
     $functions = array();
     if (count($files)) {
         foreach ($files as $file) {
             $path = $file->getPathInfo();
             $functions[$path['filename']] = $this->functionDetails($file);
         }
     }
     /** Mon, Aug 24, 2015 10:24:24 - put the section ink on the top */
     $section = $functions['section'];
     unset($functions['section']);
     $functions = array_merge(array('section' => $section), $functions);
     $functions = array_merge(array('null' => Sobi::Txt('SOBI_SELECT_FUNCTIONALITY')), $functions);
     SPFactory::View('joomla-menu', true)->assign($functions, 'functions')->functions();
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:19,代码来源:menu.php

示例10: file

 /**
  * @param string $name variable name
  * @param string $property
  * @param string $request request method
  * @return string
  */
 public static function file($name, $property = null, $request = 'files')
 {
     if ($request == 'files') {
         /** check for Ajax uploaded files */
         $check = self::string($name);
         if ($check) {
             $secret = md5(Sobi::Cfg('secret'));
             $fileName = str_replace('file://', null, $check);
             $path = SPLoader::dirPath("tmp.files.{$secret}", 'front', false) . '/' . $fileName;
             if (file_exists("{$path}.var")) {
                 $cfg = SPFs::read("{$path}.var");
                 $data = SPConfig::unserialize($cfg);
                 $_FILES[$name] = $data;
             }
         }
     }
     self::init($name, $request);
     self::$val = isset(self::$request[self::$name]) ? self::$request[self::$name] : null;
     return $property && isset(self::$val[$property]) ? self::$val[$property] : self::$val;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:26,代码来源:request.php

示例11: tplCfg

 /**
  */
 protected function tplCfg($path, $task = null)
 {
     $file = explode('.', $path);
     $files = array();
     if (strstr($file[0], 'cms:')) {
         $file[0] = str_replace('cms:', null, $file[0]);
         $file = SPFactory::mainframe()->path(implode('.', $file));
         $path = SPLoader::dirPath($file, 'root', true);
         $this->_tCfg = SPLoader::loadIniFile("{$path}.config", true, false, false, true);
         $files[] = SPLoader::iniStorage();
     } else {
         $this->_tCfg = SPLoader::loadIniFile("usr.templates.{$path}.config");
         $files[] = SPLoader::iniStorage();
         $path = SPLoader::dirPath('usr.templates.' . $path, 'front', true);
     }
     if (!$task) {
         $task = $this->_task == 'add' || $this->_task == 'submit' ? 'edit' : $this->template;
     }
     if (SPLoader::translatePath("{$path}.{$this->templateType}.{$task}", 'absolute', true, 'ini')) {
         $taskCfg = SPLoader::loadIniFile("{$path}.{$this->templateType}.{$task}", true, false, false, true);
         $files[] = SPLoader::iniStorage();
         foreach ($taskCfg as $section => $keys) {
             if (isset($this->_tCfg[$section])) {
                 $this->_tCfg[$section] = array_merge($this->_tCfg[$section], $keys);
             } else {
                 $this->_tCfg[$section] = $keys;
             }
         }
     }
     if (count($files)) {
         foreach ($files as $i => $file) {
             $files[$i] = array('file' => str_replace(SPLoader::translateDirPath(Sobi::Cfg('section.template'), 'templates'), null, $file), 'checksum' => md5_file($file));
         }
         SPFactory::registry()->set('template_config', $files);
     }
     if (SPLoader::translatePath("{$path}.config", 'absolute', true, 'json')) {
         $config = json_decode(SPFs::read(SPLoader::translatePath("{$path}.config", 'absolute', true, 'json')), true);
         $settings = array();
         foreach ($config as $section => $setting) {
             $settings[str_replace('-', '.', $section)] = $setting;
         }
         if (SPLoader::translatePath("{$path}.{$this->templateType}.{$task}", 'absolute', true, 'json')) {
             $subConfig = json_decode(SPFs::read(SPLoader::translatePath("{$path}.{$this->templateType}.{$task}", 'absolute', true, 'json')), true);
             if (count($subConfig)) {
                 foreach ($subConfig as $section => $subSettings) {
                     foreach ($subSettings as $k => $v) {
                         $settings[str_replace('-', '.', $section)][$k] = $v;
                     }
                 }
             }
         }
         if (isset($settings['general'])) {
             foreach ($settings['general'] as $k => $v) {
                 $this->_tCfg['general'][$k] = $v;
             }
         }
         $task = SPRequest::task() == 'entry.add' ? 'entry.edit' : SPRequest::task();
         if (isset($settings[$task])) {
             foreach ($settings[$task] as $k => $v) {
                 $this->_tCfg['general'][$k] = $v;
             }
         }
     }
     Sobi::Trigger($this->name(), __FUNCTION__, array(&$this->_tCfg));
     SPFactory::registry()->set('current_template', $path);
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:68,代码来源:controller.php

示例12: tplPath

 protected function tplPath()
 {
     if (!$this->_templatePath) {
         $tpl = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
         $file = explode('.', $tpl);
         if (strstr($file[0], 'cms:')) {
             $file[0] = str_replace('cms:', null, $file[0]);
             $file = SPFactory::mainframe()->path(implode('.', $file));
             $this->_templatePath = SPLoader::dirPath($file, 'root', false, null);
         } else {
             $this->_templatePath = SPLoader::dirPath('usr.templates.' . $tpl, 'front', false, null);
         }
     }
     SPFactory::registry()->set('current_template_path', $this->_templatePath);
     return $this->_templatePath;
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:16,代码来源:view.php

示例13: storeImage

 /**
  * Small work-around
  * The imageTYPE function is not very suitable for OO code
  * @return void
  */
 private function storeImage()
 {
     $st = preg_replace('/[^0-9]/', null, microtime(true) * 10000);
     $this->temp = SPLoader::path('tmp.img.' . $st, 'front', false, 'var', false);
     if (!SPLoader::dirPath('tmp.img', 'front', true)) {
         SPFs::mkdir(SPLoader::dirPath('tmp.img', 'front', false));
     }
     switch ($this->type) {
         case IMAGETYPE_GIF:
             imagegif($this->image, $this->temp);
             break;
         case IMAGETYPE_JPEG:
         case IMAGETYPE_JPEG2000:
             imagejpeg($this->image, $this->temp, Sobi::Cfg('image.jpeg_quality', 75));
             break;
         case IMAGETYPE_PNG:
             imagepng($this->image, $this->temp, Sobi::Cfg('image.png_compression', 0));
             break;
     }
     $this->_content = file_get_contents($this->temp);
     if ($this->image) {
         imagedestroy($this->image);
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:29,代码来源:image.php

示例14: save

 /**
  * Save an entry
  *
  * @param bool $apply
  */
 protected function save($apply)
 {
     $new = true;
     if (!$this->_model) {
         $this->setModel(SPLoader::loadModel($this->_type));
     }
     if ($this->_model->get('oType') != 'entry') {
         Sobi::Error('Entry', sprintf('Serious security violation. Trying to save an object which claims to be an entry but it is a %s. Task was %s', $this->_model->get('oType'), SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
         exit;
     }
     /* 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);
//.........这里部分代码省略.........
开发者ID:pelloq1,项目名称:SobiPro,代码行数:101,代码来源:entry.php

示例15: install

 public function install()
 {
     $log = array();
     $type = strlen($this->xGetString('type')) ? $this->xGetString('type') : ($this->xGetString('fieldType') ? 'field' : null);
     $id = $this->xGetString('id');
     if ($this->installed($id, $type)) {
         SPFactory::db()->delete('spdb_plugins', array('pid' => $id, 'type' => $type));
     }
     Sobi::Trigger('Before', 'InstallPlugin', array($id));
     $requirements = $this->xGetChilds('requirements/*');
     if ($requirements && $requirements instanceof DOMNodeList) {
         $reqCheck =& SPFactory::Instance('services.installers.requirements');
         $reqCheck->check($requirements);
     }
     $permissions = $this->xGetChilds('permissions/*');
     if ($permissions && $permissions instanceof DOMNodeList) {
         $permsCtrl =& SPFactory::Instance('ctrl.adm.acl');
         for ($i = 0; $i < $permissions->length; $i++) {
             $perm = explode('.', $permissions->item($i)->nodeValue);
             $permsCtrl->addPermission($perm[0], $perm[1], $perm[2]);
             $log['permissions'][] = $permissions->item($i)->nodeValue;
         }
     }
     $actions = $this->xGetChilds('actions/*');
     if ($actions && $actions instanceof DOMNodeList) {
         $log['actions'] = $this->actions($actions, $id);
     }
     $dir = SPLoader::dirPath('etc.installed.' . $type . 's', 'front', false);
     if (!SPFs::exists($dir)) {
         SPFs::mkdir($dir);
         SPFs::mkdir("{$dir}/{$id}/backup");
     }
     $files = $this->xGetChilds('files');
     $date = str_replace(array(':', ' '), array('-', '_'), SPFactory::config()->date(time()));
     if ($files && $files instanceof DOMNodeList && $files->length) {
         $log['files'] = $this->files($files, $id, "{$dir}/{$id}/backup/{$date}");
         if (count($log['files'])) {
             foreach ($log['files'] as $i => $f) {
                 $log['files'][$i] = str_replace(SOBI_ROOT, null, $f);
             }
         }
     }
     $languages = $this->xGetChilds('language');
     if ($languages->length) {
         $langFiles = array();
         foreach ($languages as $language) {
             $folder = $language->attributes->getNamedItem('folder')->nodeValue;
             foreach ($language->childNodes as $file) {
                 $adm = false;
                 if (strstr($file->nodeName, '#')) {
                     continue;
                 }
                 if ($file->attributes->getNamedItem('admin')) {
                     $adm = $file->attributes->getNamedItem('admin')->nodeValue == 'true' ? true : false;
                 }
                 $langFiles[$file->attributes->getNamedItem('lang')->nodeValue][] = array('path' => Sobi::FixPath("{$this->root}/{$folder}/" . trim($file->nodeValue)), 'name' => $file->nodeValue, 'adm' => $adm);
             }
         }
         $log['files']['created'] = array_merge($log['files']['created'], SPFactory::CmsHelper()->installLang($langFiles, false));
     }
     $sql = $this->xGetString('sql');
     if ($sql && SPFs::exists("{$this->root}/{$sql}")) {
         try {
             $log['sql'] = SPFactory::db()->loadFile("{$this->root}/{$sql}");
         } catch (SPException $x) {
             Sobi::Error('installer', SPLang::e('CANNOT_EXECUTE_QUERIES', $x->getMessage()), SPC::WARNING, 500, __LINE__, __FILE__);
             return false;
         }
     }
     if (!strlen($this->xGetString('type')) && strlen($this->xGetString('fieldType'))) {
         $log['field'] = $this->field();
     }
     $exec = $this->xGetString('exec');
     if ($exec && SPFs::exists("{$this->root}/{$exec}")) {
         include_once "{$this->root}/{$exec}";
     }
     $this->plugin($id, $type);
     $this->log($log);
     $this->definition->formatOutput = true;
     $this->definition->preserveWhiteSpace = false;
     $this->definition->normalizeDocument();
     $path = "{$dir}/{$id}.xml";
     $file = SPFactory::Instance('base.fs.file', $path);
     //		$file->content( $this->definition->saveXML() );
     // why the hell DOM cannot format it right. Try this
     $outXML = $this->definition->saveXML();
     $xml = new DOMDocument();
     $xml->preserveWhiteSpace = false;
     $xml->formatOutput = true;
     $xml->loadXML($outXML);
     $file->content($xml->saveXML());
     $file->save();
     switch ($type) {
         case 'SobiProApp':
             $type = 'plugin';
         default:
         case 'update':
         case 'plugin':
         case 'field':
             $t = Sobi::Txt('EX.' . strtoupper($type) . '_TYPE');
//.........这里部分代码省略.........
开发者ID:pelloq1,项目名称:SobiPro,代码行数:101,代码来源:sobiproapp.php


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