public static function getDB($key = 'default')
 {
     self::clearErr();
     if (empty($key)) {
         $this->code = 1023;
         $this->msg = lang::getLang('learn', 'param_error');
     }
     $config = cfg_db::$default;
     if (isset($dbResMap[$key])) {
         if (self::$dbResMap[$key]->selectDB($config['db'])) {
             return self::$dbResMap[$key];
         }
         if (self::$dbResMap[$key]->selectDB($config['db'])) {
             return self::$dbResMap[$key];
         }
         $dbResMap[$key]->closeDB();
         unset($dbResMap[$key]);
         return false;
     }
     $db = new db($config['host'], $config['port'], $config['db'], $config['user'], $config['password']);
     if ($db->errCode > 0) {
         self::$code = 1024;
         self::$msg = "todo";
         return false;
     }
     self::$dbResMap[$key] = $db;
     return self::$dbResMap[$key];
 }
Beispiel #2
0
 public final function check_app_params()
 {
     if (!in_array($this->projectId, array_keys(self::$projects))) {
         $this->setError(1101, lang::getLang('param_error'));
         return false;
     }
     if ($this->version) {
         $this->setError(1102, "参数错误");
         return false;
     }
     if ($this->vn) {
         $this->setError(1103, "签名错误");
         return false;
     }
     if ($this->client) {
         $this->setError(1104, "签名错误");
         return false;
     }
     if ($this->token) {
         $this->setError(1105, "签名错误");
         return false;
     }
     if (!$this->init_verifySign()) {
         $this->setError(1106, "签名错误");
         return false;
     }
     self::$code = 200;
     self::$msg = "正常";
     return true;
 }
Beispiel #3
0
 /**
  * 加栽语言文件
  */
 public static function language($files)
 {
     $lang = lang::getLang();
     if (is_array($files)) {
         foreach ($files as $file) {
             self::loadfile($lang . "/" . $file, "language");
         }
         return true;
     }
     return self::loadfile($lang . "/" . $files, "language");
 }
Beispiel #4
0
 public static function includeAllLangFiles()
 {
     foreach (self::getAll() as $name) {
         $file = dir::addon($name, 'lang/' . lang::getLang() . '.json');
         if (file_exists($file)) {
             lang::loadLang($file);
         }
         $defaultFile = dir::addon($name, 'lang/' . lang::getDefaultLang() . '.json');
         if (file_exists($defaultFile)) {
             lang::loadLang($defaultFile, true);
         }
     }
 }
Beispiel #5
0
<?php

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
include '..' . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'dir.php';
new dir();
include_once dir::classes('autoload.php');
autoload::register();
autoload::addDir(dir::classes('utils'));
autoload::addDir('lib' . DIRECTORY_SEPARATOR . 'classes');
include dir::functions('html_stuff.php');
include dir::functions('url_stuff.php');
new dyn();
lang::setDefault();
lang::setLang(dyn::get('lang'));
lang::loadLang('lib' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . lang::getLang() . '.json');
$page = type::super('page', 'string', 'licence');
ob_start();
include "layout/index.php";
$out = ob_get_contents();
ob_get_clean();
echo $out;