Пример #1
0
 /**
  * 获取配置信息
  * // 键为字符串并以'.'分隔,第一部份为配置文件
  *
  * @param string $key 选项的键值
  * @param string $package 包名
  *
  * @return mixed
  */
 public function get($key, $package = null)
 {
     if (empty($key)) {
         return null;
     }
     ///
     if (empty($package)) {
         $package = self::PCK_DEFAULT;
     }
     ///
     $keys = explode('.', $key);
     $name = array_shift($keys);
     if (!isset($this->data[$package][$name])) {
         $file = $this->_getFile($name, $package);
         $this->data[$package][$name] = Load::file($file, APP_DIR);
     }
     ///
     $exists = true;
     $conf = $this->data[$package][$name];
     foreach ($keys as $k) {
         if (is_array($conf) && isset($conf[$k])) {
             $conf = $conf[$k];
         } else {
             $exists = false;
             break;
         }
     }
     ///
     return $exists ? $conf : null;
 }
Пример #2
0
 function execute()
 {
     Load::file('nodatabase.class.php', $this->source_dir);
     File::mkdir(TEMP_DIR . DS . 'nodatabase');
     $noDataBase = new noDataBase();
     $noDataBase->basesDir = TEMP_DIR . DS . 'nodatabase' . DS;
     return $noDataBase;
 }
Пример #3
0
 function execute()
 {
     Load::file('Fenom.php', $this->source_dir);
     Fenom::registerAutoload();
     $templatesDir = APP_DIR . DS . App::getAppName() . DS . APP_TEMPLATES_DIR;
     $fenom = Fenom::factory($templatesDir, TEMP_DIR . DS . $this->name . DS . 'templates_c');
     $fenom->setOptions(array('auto_reload' => true));
     return $fenom;
 }
Пример #4
0
 function execute()
 {
     Load::file('Smarty.class.php', $this->source_dir);
     $smarty = new Smarty();
     $smarty->setCompileDir(File::mkdir(TEMP_DIR . DS . $this->name . DS . 'templates_c') . DS);
     $smarty->setConfigDir(File::mkdir(TEMP_DIR . DS . $this->name . DS . 'configs') . DS);
     $smarty->setCacheDir(File::mkdir(TEMP_DIR . DS . $this->name . DS . 'cache') . DS);
     return $smarty;
 }
Пример #5
0
 public static function generateComponent()
 {
     $com_name = Request::getUrlSegment(0);
     //проверяем наличие такого компонента
     if (!is_dir(SITE_ROOT . '/components/' . $com_name)) {
         Router::set404();
     }
     ob_start();
     //запускаем работу компонента
     if (is_file(SITE_ROOT . '/components/' . $com_name . '/index.php')) {
         Load::file(SITE_ROOT . '/components/' . $com_name . '/index.php');
     } else {
         $section = Request::getUrlSegment(1);
         if (is_file(SITE_ROOT . '/components/' . $com_name . '/' . $section . '/' . $section . '.php')) {
             Load::file(SITE_ROOT . '/components/' . $com_name . '/' . $section . '/' . $section . '.php');
         } else {
             Router::set404();
         }
     }
     return ob_get_clean();
 }
Пример #6
0
 function run()
 {
     $this->before();
     $port = $this->setting['port'];
     Load::file(MAIN_DIR . DS . 'vendor' . DS . 'autoload.php');
     $loop = React\EventLoop\Factory::create();
     $socket = new React\Socket\Server($loop);
     $conns = new \SplObjectStorage();
     $this->connectionList =& $conns;
     $socket->on('connection', function ($conn) use($conns) {
         $this->onConnection($conn);
         $conns->attach($conn);
         $this->console('Attach new connection.');
         $conn->on('data', function ($data) use($conns, $conn) {
             $this->onMessage($conn, $data);
             //                foreach ($conns as $current) {
             //                    if ($conn !== $current) {
             //                        continue;
             //                    }
             //
             //                    $this->onMessage($conn, $data);
             //                }
         });
         $conn->on('end', function () use($conns, $conn) {
             $this->onClose($conn);
             $this->console('Detach connection.');
             $conns->detach($conn);
         });
     });
     $this->console('Socket server listening on port ' . $port);
     $socket->listen($port);
     $loop->addPeriodicTimer($this->setting['timer'], function ($timer) use($conns) {
         $this->onTick($timer);
     });
     $loop->run();
 }
 function execute()
 {
     Load::file('simple_html_dom.php', $this->source_dir);
     return null;
 }
Пример #8
0
 public function run($type = '')
 {
     $types = array('index' => array('mod_default' => $this->var['config']['default_module'] ? $this->var['config']['default_module'] : 'topic'), 'admin' => array('mod_exit' => 1, 'tpl_default' => 'admin/'), 'ajax' => array('mod_default' => 'topic', 'tpl_default' => 'ajax/'), 'api' => array('mod_default' => 'test', 'mod_exit' => 1, 'tpl_default' => 'api/'), 'imjiqiren' => array('mod_default' => 'imjiqiren', 'mod_exit' => 1, 'tpl_default' => 'imjiqiren/'), 'sms' => array('mod_default' => 'sms', 'mod_exit' => 1, 'tpl_default' => 'sms/'), 'widget' => array('mod_default' => 'qun', 'mod_exit' => 1, 'tpl_default' => 'widget/'), 'wap' => array('mod_default' => 'topic', 'mod_path' => 'wap/modules/'), 'mobile' => array('mod_default' => 'topic', 'mod_path' => 'mobile/modules/'), 'mobile_ajax' => array('mod_default' => 'topic', 'mod_path' => 'mobile/modules/ajax/'));
     if (!isset($types[$type])) {
         if (empty($type)) {
             $type = 'index';
         } else {
             $types[$type] = array('mod_default' => 'index', 'mod_exit' => 1, 'tpl_default' => $type . '/');
         }
     }
     $types[$type]['modules_path'] = $modules_path = ROOT_PATH . ($types[$type]['mod_path'] ? $types[$type]['mod_path'] : 'modules/' . ('index' == $type ? '' : $type . '/'));
     $this->var['config']['jishigou_run_type'] = $type;
     $this->var['config']['jishigou_run_tpl_default'] = $types[$type]['tpl_default'];
     define('IN_JISHIGOU_' . strtoupper($type), true);
     if ($this->var['config']['upgrade_lock_time'] > 0 && true !== IN_JISHIGOU_UPGRADE && true !== IN_JISHIGOU_ADMIN) {
         if ($this->var['config']['upgrade_lock_time'] + 6000 > TIMESTAMP || is_file(ROOT_PATH . './data/cache/upgrade.lock') && @filemtime(ROOT_PATH . './data/cache/upgrade.lock') + 6000 > TIMESTAMP) {
             die('System upgrade. Please wait...');
         }
     }
     if ($this->var['config']['site_closed'] && true !== IN_JISHIGOU_ADMIN) {
         if ('login' != $this->var['mod'] && ($site_closed_msg = file_get_contents(ROOT_PATH . 'data/cache/site_enable.txt'))) {
             exit($site_closed_msg);
         }
     }
     if ($this->var['config']['ipbanned_enable']) {
         if (false != ($ipbanned = jconf::get('access', 'ipbanned'))) {
             if (preg_match("~^({$ipbanned})~", $this->var['client_ip'])) {
                 exit('Your IP has been banned access and registration.');
             }
             unset($ipbanned);
         }
     }
     if ($this->var['config']['rewrite_enable'] && (true === IN_JISHIGOU_INDEX || true === IN_JISHIGOU_AJAX || true === IN_JISHIGOU_ADMIN)) {
         include ROOT_PATH . 'include/rewrite.php';
     }
     $allow_gzip = 0;
     $un_gzip_mods = array('share' => 1, 'output' => 1, 'download' => 1, 'attachment' => 1, 'attach' => 1);
     if (true === GZIP && true === IN_JISHIGOU_INDEX && !isset($un_gzip_mods[$this->var['mod']]) && substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
         $allow_gzip = 1;
     }
     ob_start($allow_gzip ? 'ob_gzhandler' : null);
     #if NEDU
     if (defined('NEDU_MOYO')) {
         nlogic('load/cooks')->gateway($type);
     }
     #endif
     $this->init();
     if (defined('APP_ROOT')) {
         $this->_init_user(1);
         $c = $this->_g('c', 'index');
         $a = $this->_g('a', 'index');
         $controller = $c . '_controller';
         $action = $a . '_action';
         Load::file('controller');
         if (!@(include_once APP_ROOT . 'controller/' . $c . '.class.php') && !class_exists($controller)) {
             error_404('controller ' . $c . ' is not exists');
         }
         $app_object = new $controller();
         if (method_exists($app_object, $action)) {
             jdefine('APP_ID', $c . '_' . $a);
             $app_object->{$action}();
         } else {
             error_404('action ' . $a . ' is not exists');
         }
     } else {
         if (!@(include_once $modules_path . 'master.mod.php') && !class_exists('MasterObject')) {
             error_404('modules path is invalid');
         }
         if (!(include $modules_path . $this->_init_mod($types[$type]) . '.mod.php') && !class_exists('ModuleObject')) {
             error_404('mod is invalid');
         }
         $ModuleObject = new ModuleObject($this->var['config']);
     }
 }
Пример #9
0
<?php

ob_start();
//session_set_cookie_params(172800);
include_once MAIN_DIR . DS . ENGINE_DIR_PREFIX . 'core/defines.php';
include_once CLASS_DIR . DS . 'Load.class.php';
Load::file(array('Temp.class.php', 'File.class.php'), CLASS_DIR);
spl_autoload_register('Load::autoLoadClasses');
register_shutdown_function('Core::shutDown');
//Debug::start();
//$GLOBALS['_SESSION'] = new SessionArray();
Load::getClasses();
Route::init();
App::load(Request::get('app'));
Пример #10
0
 *
 * @copyright Copyright (C) 2005 - 2099 Cenwor Inc.
 * @license http://www.cenwor.com
 * @link http://www.jishigou.net
 * @author 狐狸<*****@*****.**>
 * @version $Id: mysql.class.php 5351 2014-01-03 07:45:01Z wuliyong $
 * @todo 增加SQL安全过滤 2012年2月2日
 * @todo 支持主从数据库的查询更新操作 2012年9月14日
 * @todo 内容整理,清简
 */
if (!defined('IN_JISHIGOU')) {
    exit('invalid request');
}
define("QUERY_SAFE", true);
if (!class_exists('jishigou_database')) {
    Load::file('jishigou/database');
}
class jishigou_mysql extends jishigou_database
{
    var $TableName;
    var $FieldList;
    var $Charset = 'gbk';
    var $Links = array();
    var $CurLink = '';
    var $slave_id = null;
    var $cur_db = '';
    function jishigou_mysql($server_host = '', $server_port = '3306')
    {
        $this->jishigou_database($server_host, $server_port);
    }
    function DoConnect($db_user, $db_pass, $db_name, $db_pconnect = true)
Пример #11
0
<?php

$form_id = Request::getUrlSegment(2, true, Validator::INT);
$form_data = (new Db())->getRow('SELECT * FROM `##feedback_forms` WHERE `id`=?i', $form_id, MYSQLI_ASSOC);
if (!$form_data) {
    Router::set404();
}
$fields = (new Db())->getAll('SELECT * FROM `##feedback_fields` WHERE `form_id`=?i AND `published`=1 ORDER BY `ordering`', $form_data['id'], MYSQLI_ASSOC);
if (Request::getUrlSegment(3, false) === 'submit') {
    Load::file(__DIR__ . '/submit.php', ['form_data' => $form_data, 'fields' => $fields]);
} else {
    //отображаем форму
    Document::addCss(SConfig::SITE_MAIN_URI . 'components/feedback/client/style.css');
    Document::addJs(SConfig::SITE_MAIN_URI . 'components/feedback/client/script.js');
    Document::setTitle($form_data['name']);
    session_start();
    if (isset($_SESSION['feedback_send_status'])) {
        echo '<div class="system-notice ' . $_SESSION['feedback_send_status'][0] . '">' . $_SESSION['feedback_send_status'][1] . '</div>';
        unset($_SESSION['feedback_send_status']);
    }
    session_write_close();
    Load::view(__DIR__ . '/view.php', ['data' => $form_data, 'fields' => $fields, 'params' => Request::getItemParams()]);
}
Пример #12
0
 static function table($name)
 {
     static $S_tables = array();
     if (is_null($S_tables[$name])) {
         if (false === ($class_name = Load::file('table/' . $name))) {
             if ($obj = jclass('table')) {
                 $obj->init($name);
                 return $obj;
             }
             exit('table class ' . $name . ' is not exists');
         }
         $S_tables[$name] = new $class_name();
     }
     return $S_tables[$name];
 }