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


PHP Ibos::Lang方法代码示例

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


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

示例1: handleInitEnvironment

 public function handleInitEnvironment($event)
 {
     Ibos::app()->performance->startClock();
     Ibos::app()->performance->startMemoryUsageMarker();
     define("STATICURL", Ibos::app()->assetManager->getBaseUrl());
     define("IN_MOBILE", EnvUtil::checkInMobile());
     define("IN_DASHBOARD", EnvUtil::checkInDashboard());
     define("TIMESTAMP", time());
     define("IN_APP", EnvUtil::checkInApp());
     $this->setTimezone();
     if (function_exists("ini_get")) {
         $memorylimit = @ini_get("memory_limit");
         if ($memorylimit && ConvertUtil::ConvertBytes($memorylimit) < 33554432 && function_exists("ini_set")) {
             ini_set("memory_limit", "128m");
         }
     }
     $global = array("timestamp" => TIMESTAMP, "version" => VERSION, "clientip" => EnvUtil::getClientIp(), "referer" => "", "charset" => CHARSET, "authkey" => "", "newversion" => 0, "config" => array(), "setting" => array(), "user" => array(), "cookie" => array(), "session" => array(), "lunar" => DateTimeUtil::getlunarCalendar(), "title" => MainUtil::getIncentiveWord(), "staticurl" => STATICURL);
     $global["phpself"] = $this->getScriptUrl();
     $sitePath = substr($global["phpself"], 0, strrpos($global["phpself"], "/"));
     $global["isHTTPS"] = isset($_SERVER["HTTPS"]) && strtolower($_SERVER["HTTPS"]) != "off" ? true : false;
     $global["siteurl"] = StringUtil::ihtmlSpecialChars("http" . ($global["isHTTPS"] ? "s" : "") . "://" . $_SERVER["HTTP_HOST"] . $sitePath . "/");
     $url = parse_url($global["siteurl"]);
     $global["siteroot"] = isset($url["path"]) ? $url["path"] : "";
     $global["siteport"] = empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] == "80" || $_SERVER["SERVER_PORT"] == "443" ? "" : ":" . $_SERVER["SERVER_PORT"];
     $config = @(include PATH_ROOT . "/system/config/config.php");
     if (empty($config)) {
         throw new NotFoundException(Ibos::Lang("Config not found", "error"));
     } else {
         $global["config"] = $config;
     }
     Ibos::app()->setting->copyFrom($global);
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:32,代码来源:InitMainModuleBehavior.php

示例2: filter_input

$hashskey = filter_input(INPUT_GET, "hashskey", FILTER_SANITIZE_STRING);
$hashkey = filter_input(INPUT_GET, "hashkey", FILTER_SANITIZE_STRING);
$returnurl = filter_input(INPUT_GET, "returnurl", FILTER_SANITIZE_STRING);
if (empty($openId) || empty($hashskey) || empty($cid)) {
    exit("参数错误");
}
$uid = UserBinding::model()->fetchUidByValue(StringUtil::filterCleanHtml($openId), "bqq");
if ($uid) {
    $checkCId = strcmp($imCfg["id"], $cid) == 0;
    $properties = array("company_id" => $cid, "company_token" => $imCfg["token"], "app_id" => $imCfg["appid"], "client_ip" => EnvUtil::getClientIp());
    $api = new BQQApi($properties);
    $status = $api->getVerifyStatus(array("open_id" => $openId, "hashskey" => $hashskey));
    if ($status["ret"] == 0) {
        $config = @(include PATH_ROOT . "/system/config/config.php");
        if (empty($config)) {
            throw new Exception(Ibos::Lang("Config not found", "error"));
        } else {
            define("IN_MOBILE", EnvUtil::checkInMobile());
            $global = array("clientip" => EnvUtil::getClientIp(), "config" => $config, "timestamp" => time());
            Ibos::app()->setting->copyFrom($global);
            handleloadsyscache();
            $saltkey = MainUtil::getCookie("saltkey");
            if (empty($saltkey)) {
                $saltkey = StringUtil::random(8);
                MainUtil::setCookie("saltkey", $saltkey, 86400 * 30, 1, 1);
            }
            $curUser = User::model()->fetchByUid($uid);
            $identity = new ICUserIdentity($curUser["username"], $curUser["password"]);
            $identity->setId($uid);
            $identity->setPersistentStates($curUser);
            $ip = Ibos::app()->setting->get("clientip");
开发者ID:AxelPanda,项目名称:ibos,代码行数:31,代码来源:sso.php

示例3: restore

/**
 * 恢复备份的sql文件
 * @param string $id 文件名
 * @return array
 */
function restore($id)
{
    $path = PATH_ROOT;
    if (strstr($path, 'data')) {
        $id = trim(str_replace('data', '', $id), '/');
    }
    $file = urldecode($id);
    $fp = @fopen($file, 'rb');
    if ($fp) {
        $sqlDump = fgets($fp, 256);
        $identify = explode(',', base64_decode(preg_replace("/^# Identify:\\s*(\\w+).*/s", "\\1", $sqlDump)));
        $dumpInfo = array('method' => $identify[3], 'volume' => intval($identify[4]), 'tablepre' => $identify[5], 'dbcharset' => $identify[6]);
        if ($dumpInfo['method'] == 'multivol') {
            $sqlDump .= fread($fp, filesize($file));
        }
        fclose($fp);
    } else {
        if (EnvUtil::getRequest('autorestore', 'G')) {
            return array('success' => 1, 'msg' => Ibos::lang('Database import multivol succeed', 'dashboard.default'));
        } else {
            return array('success' => 0, 'msg' => Ibos::lang('Database import file illegal', 'dashboard.default'));
        }
    }
    $command = Ibos::app()->db->createCommand();
    // 分卷导入
    if ($dumpInfo['method'] == 'multivol') {
        $sqlQuery = StringUtil::splitSql($sqlDump);
        unset($sqlDump);
        $dbCharset = Ibos::app()->db->charset;
        $dbVersion = Ibos::app()->db->getServerVersion();
        foreach ($sqlQuery as $sql) {
            $sql = DatabaseUtil::syncTableStruct(trim($sql), $dbVersion > '4.1', $dbCharset);
            if ($sql != '') {
                $command->setText($sql)->execute();
            }
        }
        $delunzip = EnvUtil::getRequest('delunzip', 'G');
        if ($delunzip) {
            @unlink($file);
        }
        $pattern = "/-({$dumpInfo['volume']})(\\..+)\$/";
        $relacement = "-" . ($dumpInfo['volume'] + 1) . "\\2";
        $nextFile = preg_replace($pattern, $relacement, $file);
        $nextFile = urlencode($nextFile);
        $param = array('op' => 'restore', 'id' => $nextFile, 'autorestore' => 'yes');
        if ($delunzip) {
            $param['delunzip'] = 'yes';
        }
        $msg = Ibos::lang('Database import multivol redirect', 'dashboard.default', array('volume' => $dumpInfo['volume']));
        $url = 'restore.php?' . http_build_query($param);
        if ($dumpInfo['volume'] == 1) {
            return array('type' => 'redirect', 'msg' => $msg, 'url' => $url);
        } elseif (EnvUtil::getRequest('autorestore', 'G')) {
            return array('type' => 'redirect', 'msg' => $msg, 'url' => $url);
        } else {
            return array('success' => 1, 'msg' => Ibos::lang('Database import succeed', 'dashboard.default'));
        }
    } else {
        if ($dumpInfo['method'] == 'shell') {
            // 加载系统生成配置文件
            $config = @(include PATH_ROOT . './system/config/config.php');
            if (empty($config)) {
                throw new NotFoundException(Ibos::Lang('Config not found', 'error'));
            } else {
                $db = $config['db'];
            }
            $query = $command->setText("SHOW VARIABLES LIKE 'basedir'")->queryRow();
            $mysqlBase = $query['Value'];
            $mysqlBin = $mysqlBase == '/' ? '' : addslashes($mysqlBase) . 'bin/';
            shell_exec($mysqlBin . 'mysql -h"' . $db['host'] . ($db['port'] ? is_numeric($db['port']) ? ' -P' . $db['port'] : ' -S"' . $db['port'] . '"' : '') . '" -u"' . $db['username'] . '" -p"' . $db['password'] . '" "' . $db['dbname'] . '" < ' . $file);
            return array('success' => 1, 'msg' => Ibos::lang('Database import succeed', 'dashboard.default'));
        } else {
            return array('success' => 0, 'msg' => Ibos::lang('Database import file illegal', 'dashboard.default'));
        }
    }
}
开发者ID:AxelPanda,项目名称:ibos,代码行数:81,代码来源:restore.php


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