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


PHP core::init方法代码示例

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


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

示例1: init

 function init()
 {
     //echo "router<br />";
     system::$core = parent::init();
     core::$router = $this;
     $this->setPath(CTRL_PATH);
     try {
         $this->delegate();
     } catch (Exception $e) {
         switch ($e->getCode()) {
             case 404:
                 system::redirect("http://" . system::param("siteDomain") . "/search?text=" . urlencode($this->routePath), 5, "Упс! Такого документа на этом сайте нет. Сейчас мы попробуем поискать что-то похожее.");
                 $this->smarty->setCacheID("REDIRECT|404");
                 $this->display();
                 break;
             default:
         }
     }
     $this->handleMails();
     $this->smarty->assign("errors", system::$errors);
 }
开发者ID:ygres,项目名称:sblog,代码行数:21,代码来源:class.router.php

示例2: define

if (file_exists(ROOT . 'manage/include/connect.inc.php')) {
    define('CONF_PATH', ROOT . 'manage/include/');
} elseif (file_exists(SYSTEM_ROOT . 'config/connect.inc.php')) {
    define('CONF_PATH', SYSTEM_ROOT . 'config/');
} else {
    if (strstr($_SERVER['PHP_SELF'], '/manage/')) {
        $root = dirname(dirname($_SERVER['PHP_SELF'])) . '/';
    } else {
        $root = dirname($_SERVER['PHP_SELF']) . '/';
    }
    header('Location: ' . $root . 'install');
    exit;
}
require_once CONF_PATH . 'connect.inc.php';
/* Load Localization System */
if (file_exists(CONF_PATH . 'config.inc.php')) {
    require_once CONF_PATH . 'config.inc.php';
}
require_once SYSTEM_ROOT . 'languages/l10n.php';
$link_language = localization_load();
require_once SYSTEM_ROOT . 'class/locale.php';
class_loader('core');
class_loader('db');
class_loader('Updater');
require_once SYSTEM_ROOT . './function/core.php';
$system = new core();
if (isset($_customct) && $_customct === true) {
    $system->CCT = true;
}
$system->init();
开发者ID:PONBBS,项目名称:WEIPDCRM,代码行数:30,代码来源:common.inc.php

示例3: bbs_assert

<?php

function bbs_assert($comment, $expression)
{
    $add = $expression ? '...	[OK]' : '...	[FAILDED]';
    echo $comment . $add . "\t\r\n";
}
define('DEBUG', 2);
define('TEST_PATH', str_replace('\\', '/', getcwd()) . '/');
define('FRAMEWORK_PATH', TEST_PATH . '../');
$conf = (include TEST_PATH . 'conf.php');
include FRAMEWORK_PATH . 'core.php';
core::init($conf);
echo "Test db_mysql.class.php \r\n\r\n";
$db = new db_pdo_mysql($conf['db']['mysql']);
$db->query("DROP TABLE IF EXISTS `bbs_user`");
$db->query("CREATE TABLE `bbs_user` (\n  `uid` int(11) unsigned NOT NULL auto_increment,\t\t# 用户id\n  `regip` int(11) NOT NULL default '0',\t\t\t\t# 注册ip\n  `regdate` int(11) unsigned NOT NULL default '0',\t\t# 注册日期\n  `username` char(16) NOT NULL default '',\t\t\t# 用户名\n  `password` char(32) NOT NULL default '',\t\t\t# 密码 md5()\n  `salt` char(8) NOT NULL default '',\t\t\t\t# 随机干扰字符,用来混淆密码\n  `email` char(40) NOT NULL default '',\t\t\t\t# EMAIL\n  `groupid` tinyint(3) unsigned NOT NULL default '0',\t\t# 用户组 id\n  `threads` mediumint(8) unsigned NOT NULL default '0',\t\t# 主题数\n  `posts` mediumint(8) unsigned NOT NULL default '0',\t\t# 回帖数\n  `avatar` int(11) unsigned NOT NULL default '0',\t\t# 头像最后更新的时间,0为默认头像\n  KEY username(`username`),\n  PRIMARY KEY (`uid`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;");
$db->truncate('user');
$db->maxid('user-uid', 0);
$db->count('user', 0);
$db->count('user-abc-123', 100);
// 增加一条记录:
$uid = $db->maxid('user-uid', '+1');
bbs_assert("maxid('user-uid', '+1')", $uid == 1);
$r = $db->set("user-uid-{$uid}", array('username' => 'admin1', 'email' => 'xxx1@xxx.com'));
bbs_assert("set()", $r == TRUE);
// 增加一条记录:
$uid = $db->maxid('user-uid', '+1');
bbs_assert("maxid('user-uid', '+1')", $uid == 2);
$r = $db->set("user-uid-{$uid}", array('username' => 'admin2', 'email' => 'xxx2@xxx.com'));
// 增加一条记录:
开发者ID:phpdn,项目名称:xiunophp,代码行数:31,代码来源:test_db_mysql.php

示例4: find_tpl

/**
* 依次寻找模板路径
*/
function find_tpl($type, $gid, $id = null)
{
    $game_tpl_dir = 'game_' . str_pad($gid, 2, '0', STR_PAD_LEFT);
    $curr_tpl_dir = SUB_SITE_ROOT . '/' . core::init('template_path');
    $defa_tpl_dir = SUB_SITE_ROOT . '/' . core::init('template_default_path');
    $tpls = array();
    if ($id !== null) {
        $tpls[] = $curr_tpl_dir . '/' . $game_tpl_dir . '/' . $type . '/' . $id . '.php';
    }
    $tpls[] = $curr_tpl_dir . '/' . $game_tpl_dir . '/' . $type . '/index.php';
    if ($id !== null) {
        $tpls[] = $curr_tpl_dir . '/game_default/' . $type . '/' . $id . '.php';
    }
    $tpls[] = $curr_tpl_dir . '/game_default/' . $type . '/index.php';
    if ($curr_tpl_dir != $defa_tpl_dir) {
        if ($id !== null) {
            $tpls[] = $defa_tpl_dir . '/' . $game_tpl_dir . '/' . $type . '/' . $id . '.php';
        }
        $tpls[] = $defa_tpl_dir . '/' . $game_tpl_dir . '/' . $type . '/index.php';
        if ($id !== null) {
            $tpls[] = $defa_tpl_dir . '/game_default/' . $type . '/' . $id . '.php';
        }
        $tpls[] = $defa_tpl_dir . '/game_default/' . $type . '/index.php';
    }
    foreach ($tpls as $tpl) {
        if (file_exists($tpl)) {
            break;
        }
    }
    if (!file_exists($tpl)) {
        showmsg("模板錯誤:" . $type . ',' . $gid . ',' . $id, -1, 'diemsg');
    }
    return $tpl;
}
开发者ID:antsmallant,项目名称:coreapp,代码行数:37,代码来源:myfunction.php

示例5: define

<?php

define('APP_DIR', realpath(dirname(__FILE__)));
include_once '../core/core.php';
$config = (include_once APP_DIR . '/config/config.php');
core::init($config);
core::run();
开发者ID:Junec,项目名称:admin,代码行数:7,代码来源:index.php

示例6: ini_set

<?php

ini_set('display_errors', 'on');
//activamos la comprobacion errores
error_reporting(E_ALL);
include 'config.php';
require 'sys/helper.php';
//echo $_SERVER['REQUEST_URI'];
session::session_ini();
$id = session::get('id');
//Coder::code($id);
$conf = registry::getInstance();
$conf->welcome = 'Hola';
//__set
$msg = $conf->welcome;
//__get
unset($conf->welcome);
//Coder::codear($msg);
//Coder::codear($conf);
template::load("article");
core::init();
?>

<!--

//crear footer.php en tpl y cargar $contents(body) Template::load("vista"); esta ruta tiene el body
//si queremos cambiar otra vista template $this->tpl = Template::load("vista");
//en pub estaran los css y sacaremos una ruta para sacar dichas css

-->
开发者ID:carlos195,项目名称:template,代码行数:30,代码来源:index.php

示例7: error_reporting

<?php

error_reporting(E_ALL ^ E_NOTICE);
!defined('DS') & define('DS', DIRECTORY_SEPARATOR);
define('IN_SITE', TRUE);
define('SITE_ROOT', dirname(__FILE__));
define('CACHE_PATH', SITE_ROOT . DS . '.' . DS . '_cache' . DS);
//缓存默认存储路径
date_default_timezone_set("PRC");
//define('IN_WAP',1);
//file_put_contents('1.txt',var_export($_SERVER,true));
//echo '<pre>';print_r($_SERVER);exit();
if (!file_exists('configs/config.php')) {
    header("Location:install.php");
    exit;
}
require_once 'core.php';
core::init('configs/config.php');
core::main();
开发者ID:antsmallant,项目名称:coreapp,代码行数:19,代码来源:index.php

示例8: get_instance

 /**
  * Core instance
  *
  * @param mixed  set to `true` for force ::init()
  *
  * @return core
  */
 public static function get_instance($params = array())
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self($params);
     }
     if ($params === true) {
         if (self::$_instance->initialized === self::IS_LOADING) {
             throw new core_exception('Core is loading when ' . __METHOD__);
         }
         if (!self::$_instance->initialized) {
             self::$_instance->init();
             // init0
         }
     }
     return self::$_instance;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:23,代码来源:core.php

示例9: login

 /**
  * 登录函数
  *
  * @param bool $login
  * @return self
  */
 public static final function login($redirect = null)
 {
     $error = array();
     // 数据消毒
     $post = array('username' => isset($_POST['username']) ? $_POST['username'] : '', 'password' => isset($_POST['password']) ? $_POST['password'] : '', 'authcode' => isset($_POST['authcode']) ? $_POST['authcode'] : '', 'redirect' => isset($_POST['redirect']) ? $_POST['redirect'] : '');
     if (get_magic_quotes_gpc()) {
         $post = array_map('stripslashes', $post);
     }
     // 表单处理
     while ($redirect === null && isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST') {
         // 配置处理
         $attribute_array = array('front_class', 'front_table', 'front_fuzzy', 'front_username', 'front_password', 'front_redirect');
         list($front_class, $front_table, $front_fuzzy, $front_username, $front_password, $front_redirect) = self::init($attribute_array);
         list($front_class2, $front_table2, $front_fuzzy2, $front_username2, $front_password2, $front_redirect2) = parent::init($attribute_array);
         $front_class === '' and $front_class = $front_class2;
         $front_table === '' and $front_table = $front_table2;
         $front_fuzzy === '' and $front_fuzzy = $front_fuzzy2;
         $front_username === '' and $front_username = $front_username2;
         $front_password === '' and $front_password = $front_password2;
         $front_redirect === '' and $front_redirect = $front_redirect2;
         // 数据验证
         if ($post['username'] === '') {
             $error['username'] = '用户名不能为空';
         }
         if ($post['password'] === '') {
             $error['password'] = '密码不能为空';
         }
         if ($post['authcode'] === '') {
             $error['authcode'] = '验证码不能为空';
         } elseif (!self::authcode($post['authcode'])) {
             $error['authcode'] = '验证码输入不正确';
         }
         if ($error !== array()) {
             break;
         }
         // 密码加密处理
         //$post ['password'] = md5 ($post ['password']);
         //$front_password = md5 ($front_password);
         if (empty($front_class)) {
             $front_class = get_parent_class();
         }
         if ($front_username) {
             // 配置项验证
             if ($front_fuzzy) {
                 // 同时验证
                 if ($front_username !== $post['username'] || $front_password !== $post['password']) {
                     $error['username'] = $error['password'] = '用户名或密码不正确';
                     break;
                 }
             } else {
                 // 分开验证
                 if ($front_username !== $post['username']) {
                     $error['username'] = '用户名不存在';
                     break;
                 }
                 if ($front_password !== $post['password']) {
                     $error['password'] = '密码不正确';
                     break;
                 }
             }
             $online = new $front_class();
             $online->username = $post['username'];
             $online->password = $post['password'];
         } else {
             // 数据库验证
             if (empty($front_table)) {
                 $front_table = null;
                 $class_table = 'class|table=' . $front_class;
             } else {
                 $class_table = 'class';
             }
             if ($front_fuzzy) {
                 // 同时验证
                 $online = self::selects(null, $front_table, array('username' => $post['username'], 'password' => $post['password']), null, array($class_table => $front_class));
                 if (empty($online)) {
                     $error['username'] = $error['password'] = '用户名或密码不正确';
                     break;
                 }
             } else {
                 // 分开验证
                 $online = self::selects(null, $front_table, array('username' => $post['username']), null, array($class_table => $front_class));
                 if (empty($online)) {
                     $error['username'] = '用户名不存在';
                     break;
                 }
                 if ($online->password !== $post['password']) {
                     $error['password'] = '密码不正确';
                     break;
                 }
             }
         }
         // 页面跳转
         self::online($online);
         if ($post['redirect'] !== '') {
//.........这里部分代码省略.........
开发者ID:antsmallant,项目名称:coreapp,代码行数:101,代码来源:front.php

示例10: login

 /**
  * 登录函数
  *
  * @param bool $login
  * @return self
  */
 public static final function login($redirect = null)
 {
     $error = array();
     //print_r($_SERVER);
     //print_r($_POST);
     // 数据消毒
     $method = 'post';
     if (IN_WAP) {
         //@file_put_contents('wap-'.date('Y-m-d').'-'.$_SERVER['REMOTE_HOST'].'.txt',var_export($_SERVER,true));
         if (strstr($_SERVER['HTTP_VIA'], 'infoX-WISG, Huawei Technologies')) {
             $method = 'get';
             $_POST = $_GET;
         }
     }
     $post = array('username' => isset($_POST['username']) ? $_POST['username'] : '', 'password' => isset($_POST['password']) ? $_POST['password'] : '', 'authcode' => isset($_POST['authcode']) ? $_POST['authcode'] : '', 'redirect' => isset($_POST['redirect']) ? $_POST['redirect'] : '');
     if (get_magic_quotes_gpc()) {
         $post = array_map('stripslashes', $post);
     }
     // 表单处理
     while ($redirect === null && isset($_SERVER['REQUEST_METHOD']) && ($_SERVER['REQUEST_METHOD'] === 'POST' || $method == 'get' && $_SERVER['REQUEST_METHOD'] === 'GET')) {
         // 配置处理
         $attribute_array = array('front_class', 'front_table', 'front_fuzzy', 'front_username', 'front_password', 'front_redirect');
         list($front_class, $front_table, $front_fuzzy, $front_username, $front_password, $front_redirect) = self::init($attribute_array);
         list($front_class2, $front_table2, $front_fuzzy2, $front_username2, $front_password2, $front_redirect2) = parent::init($attribute_array);
         $front_class === '' and $front_class = $front_class2;
         $front_table === '' and $front_table = $front_table2;
         $front_fuzzy === '' and $front_fuzzy = $front_fuzzy2;
         $front_username === '' and $front_username = $front_username2;
         $front_password === '' and $front_password = $front_password2;
         $front_redirect === '' and $front_redirect = $front_redirect2;
         // 数据验证
         if ($post['username'] === '') {
             $error['username'] = '用户名不能为空';
         }
         if ($post['password'] === '') {
             $error['password'] = '密码不能为空';
         }
         if (!IN_WAP) {
             if ($post['authcode'] === '') {
                 $error['authcode'] = '验证码不能为空';
             } elseif (!self::authcode($post['authcode'])) {
                 $error['authcode'] = '验证码输入不正确';
             }
         }
         if ($error !== array()) {
             break;
         }
         // 密码加密处理
         //$post ['password'] = md5 ($post ['password']);
         //$front_password = md5 ($front_password);
         if (empty($front_class)) {
             $front_class = get_parent_class();
         }
         if ($front_username) {
             // 配置项验证
             if ($front_fuzzy) {
                 // 同时验证
                 if ($front_username !== $post['username'] || $front_password !== md5($post['username'] . md5($post['password']))) {
                     $error['username'] = $error['password'] = '用户名或密码不正确';
                     break;
                 }
             } else {
                 // 分开验证
                 if ($front_username !== $post['username']) {
                     $error['username'] = '用户名不存在';
                     break;
                 }
                 if ($front_password !== md5($post['username'] . md5($post['password']))) {
                     $error['password'] = '密码不正确';
                     break;
                 }
             }
             $online = new $front_class();
             $online->username = $post['username'];
             $online->password = md5($post['username'] . md5($post['password']));
         } else {
             // 数据库验证
             if (empty($front_table)) {
                 $front_table = null;
                 $class_table = 'class|table=' . $front_class;
             } else {
                 $class_table = 'class';
             }
             if ($front_fuzzy) {
                 // 同时验证
                 $online = self::selects(null, $front_table, array('username' => $post['username'], 'password' => md5($post['username'] . md5($post['password']))), null, array($class_table => $front_class));
                 if (empty($online)) {
                     $error['username'] = $error['password'] = '用户名或密码不正确';
                     break;
                 }
             } else {
                 // 分开验证
                 $online = self::selects(null, $front_table, array('username' => $post['username']), null, array($class_table => $front_class));
                 if (empty($online)) {
//.........这里部分代码省略.........
开发者ID:antsmallant,项目名称:coreapp,代码行数:101,代码来源:front.php


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