예제 #1
0
파일: Factory.php 프로젝트: ssdphp/ssdphp
 public static function getInstance($adapter = 'Smarty', $config = array())
 {
     if (empty($config)) {
         $appdir = realpath(SsdPHP::getRootPath() . SsdPHP::getAppDir());
         $model = SsdPHP::getModel();
         $templates_c = $appdir . DIRECTORY_SEPARATOR . $model . DIRECTORY_SEPARATOR . "templates_c/";
         $template_dir = $appdir . DIRECTORY_SEPARATOR . $model . DIRECTORY_SEPARATOR . "templates/";
         $templates_config = $appdir . DIRECTORY_SEPARATOR . $model . DIRECTORY_SEPARATOR . "templates_config/";
         $templates_plugins = $appdir . DIRECTORY_SEPARATOR . $model . DIRECTORY_SEPARATOR . "templates_plugins/";
         $config = SConfig::get("View");
         if (!empty($config['Adaptor'])) {
             $adapter = $config['Adaptor'];
         }
         $config = array_merge($config, array('templates_c' => $templates_c, 'template_dir' => $template_dir, 'templates_config' => $templates_config, 'templates_plugins' => $templates_plugins));
     }
     $className = __NAMESPACE__ . "\\Adaptor\\{$adapter}";
     return SFactory::getInstance($className, $config);
 }
예제 #2
0
파일: Language.php 프로젝트: ssdphp/ssdphp
 /**
  * 加载资源包文件
  * @author  xiaohuihui  <*****@*****.**>
  * @param string $srcPath
  * @param string $defaultModel
  * @param string $Lang
  */
 public static function load($srcPath = "", $defaultModel = "", $Lang = "zh")
 {
     if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
         $langstr = $_SERVER['HTTP_ACCEPT_LANGUAGE'] . "";
         switch (strtolower($langstr[0] . $langstr[1])) {
             case 'zh':
                 $Lang = 'zh';
                 break;
             case 'en':
                 $Lang = 'en';
                 break;
             default:
                 $Lang = 'zh';
         }
     }
     if ($srcPath == "") {
         $srcPath = SsdPHP::getRootPath() . "resources/lang/" . $Lang . "/";
     }
     $tmpfile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . md5(realpath($srcPath . $defaultModel));
     if (SsdPHP::isDebug() == false) {
         fileatime($srcPath);
         if (is_file($tmpfile) && filemtime($tmpfile) >= filemtime($srcPath)) {
             self::$LanguageAry = (include $tmpfile);
             return;
         }
     }
     $files = Dir::tree($srcPath, "/.php\$/");
     $Language = array();
     if ($defaultModel != "") {
         $langFile = $srcPath . $defaultModel . ".php";
         if (is_file($langFile)) {
             $Language = (include "{$langFile}");
         }
     } elseif (!empty($files)) {
         foreach ($files as $file) {
             $Language += (include "{$file}");
         }
     }
     //end if
     self::$LanguageAry = $Language;
     self::$LanguagePath = $srcPath;
     file_put_contents($tmpfile, "<?php return " . var_export($Language, true) . ";?>", LOCK_EX);
     return;
 }
예제 #3
0
파일: upload.php 프로젝트: ssdphp/ssdphp
<?php

/*{{{LICENSE
+-----------------------------------------------------------------------+
| SsdPHP Framework                                                   |
+-----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify  |
| it under the terms of the GNU General Public License as published by  |
| the Free Software Foundation. You should have received a copy of the  |
| GNU General Public License along with this program.  If not, see      |
| http://www.gnu.org/licenses/.                                         |
| Copyright (C) 2015-2020. All Rights Reserved.                         |
+-----------------------------------------------------------------------+
| Supports: http://www.SsdPHP.com                                    |
+-----------------------------------------------------------------------+
}}}*/
//视图配置
use SsdPHP\SsdPHP;
return ['Upload' => ['mimes' => array(), 'exts' => array(), 'autoSub' => true, 'subName' => array('date', 'Ymd'), 'rootPath' => SsdPHP::getRootPath() . 'www/product/', 'savePath' => '', 'saveName' => array('md5_file', ''), 'saveExt' => '', 'replace' => true, 'hash' => true, 'callback' => false, 'driver' => '', 'driverConfig' => array()]];
예제 #4
0
파일: File.php 프로젝트: ssdphp/ssdphp
 private function getPath()
 {
     return !empty($this->config['save_path']) ? $this->config['save_path'] : SsdPHP::getRootPath() . 'session_tmp';
 }
예제 #5
0
파일: index.php 프로젝트: ssdphp/ssdphp
if (is_file(__DIR__ . '/../../../../vendor/autoload.php')) {
    $rootpath = __DIR__ . '/../../../../';
    require $rootpath . 'vendor/autoload.php';
} elseif ($autoload = realpath(__DIR__ . "/../vendor/autoload.php")) {
    require $autoload;
}
if (!class_exists('\\SsdPHP\\SsdPHP')) {
    require dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "SsdPHP" . DIRECTORY_SEPARATOR . "SsdPHP.php";
}
use SsdPHP\Core\RegShutdownEvent, SsdPHP\Core\Route, SsdPHP\Core\Error, SsdPHP\Core\Config, SsdPHP\Core\Language, SsdPHP\SsdPHP;
use SsdPHP\Pulgins\Session\Factory as Session;
SsdPHP::setRootPath($rootpath);
if (($r = SsdPHP::Bootstrap(function () {
    date_default_timezone_set('PRC');
    RegShutdownEvent::register();
    SsdPHP::setAppDir("App");
    SsdPHP::setDebug(true);
    Error::$CONSOLE = SsdPHP::isDebug();
    Config::load(SsdPHP::getRootPath() . DIRECTORY_SEPARATOR . 'config');
    Route::set(Config::getField('ROUTE', 'home', array()));
    Language::load();
    Session::Start($config = Config::get('SessionApiUser'));
})->Run()) === false) {
    header('HTTP/1.1 404 Not Found');
    header('Status: 404 Not Found');
    echo "404 error";
} else {
    echo $r;
}
$end = microtime(true);
echo SsdPHP::isDebug() ? "<!--" . "SsdPHP" . "Framwork runtime=" . ($end - $start) . "秒" . "-->" : "";