Esempio n. 1
0
 public static function getInstance($adapter = 'Local', $config = null)
 {
     if (empty($config)) {
         $config = SConfig::get('Upload');
         if (!empty($config['driver'])) {
             $adapter = $config['driver'];
         }
     }
     /* 获取配置 */
     self::$config = array_merge(self::$config, $config);
     /* 调整配置,把字符串配置参数转换为数组 */
     if (!empty(self::$config['mimes'])) {
         if (is_string(self::$config['mimes'])) {
             self::$config['mimes'] = explode(',', self::$config['mimes']);
         }
         self::$config['mimes'] = array_map('strtolower', self::$config['mimes']);
     }
     if (!empty(self::$config['exts'])) {
         if (is_string(self::$config['exts'])) {
             self::$config['exts'] = explode(',', self::$config['exts']);
         }
         self::$config['exts'] = array_map('strtolower', self::$config['exts']);
     }
     $className = __NAMESPACE__ . "\\Adaptor\\{$adapter}";
     self::$uploader = SFactory::getInstance($className, $config);
     static $Upload;
     if (!is_object($Upload)) {
         $Upload = new Factory();
     }
     return $Upload;
 }
Esempio n. 2
0
 public function Login($account, $pwd)
 {
     if (empty($account) || empty($pwd)) {
         return -1;
     }
     $s = SFactory::getInstance('SsdPHP\\Pulgins\\DataBase\\Factory')->setTable("ip")->selectOne();
     return $s;
 }
Esempio n. 3
0
 public static function getInstance($adapter = 'Email', $config = null)
 {
     if (empty($config)) {
         $config = SConfig::getField($adapter, "Main");
     }
     $className = __NAMESPACE__ . "\\Adaptor\\{$adapter}";
     return SFactory::getInstance($className, $config);
 }
Esempio n. 4
0
 public static function getInstance($adaptor = 'Redis', $config = null)
 {
     if (empty($config)) {
         $config = Config::get('queue');
         if (!empty($config['Adaptor'])) {
         }
     }
     $className = __NAMESPACE__ . "\\Adaptor\\{$adaptor}";
     return SFactory::getInstance($className, $config);
 }
Esempio n. 5
0
 public static function getInstance($adapter = 'Mysql', $config = null)
 {
     if (isset(self::$_instance)) {
         return self::$_instance;
     }
     if (empty($config)) {
         $config = SConfig::getField("Mysql", "Main");
     }
     if (!empty($config[0]['prefix'])) {
         self::$prefix = $config[0]['prefix'];
     }
     $className = __NAMESPACE__ . "\\Adaptor\\{$adapter}";
     self::$_instance = SFactory::getInstance($className, $config);
 }
Esempio n. 6
0
 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);
 }
Esempio n. 7
0
 /**
  * 初始化缓存
  * @param string $adapter 适配器(缓存驱动类)
  * @param string $ConfKey  读取配置最顶层名
  * @return mixed
  */
 public static function getInstance($adapter = 'Redis', $ConfKey = "Redis")
 {
     if (empty($adapter)) {
         $adapter = 'Redis';
     }
     if (empty($ConfKey)) {
         $ConfKey = $adapter;
     }
     $classKey = $adapter . "_" . $ConfKey;
     if (isset(self::$CacheObj[$classKey]) && is_object(self::$CacheObj[$classKey])) {
         return self::$CacheObj[$classKey];
     }
     $class = __CLASS__;
     self::$CacheObj[$classKey] = SFactory::getInstance($class);
     //{{{设置对象缓存属性
     self::$CacheObj[$classKey]->setAdapter($adapter);
     self::$CacheObj[$classKey]->setConfKey($ConfKey);
     self::$CacheObj[$classKey]->setConfig(Config::get($ConfKey));
     //}}}
     return self::$CacheObj[$classKey];
 }
Esempio n. 8
0
 public function addLog($data)
 {
     $system_log = SFactory::getInstance('SsdPHP\\Pulgins\\DataBase\\Factory')->setTable('system_log');
     $system_log->insert($data);
 }
Esempio n. 9
0
 public static function getInstance($adapter = 'Redis', $config = null)
 {
     $className = __NAMESPACE__ . "\\Adaptor\\{$adapter}";
     return SFactory::getInstance($className, $config);
 }