本文整理汇总了PHP中Doo类的典型用法代码示例。如果您正苦于以下问题:PHP Doo类的具体用法?PHP Doo怎么用?PHP Doo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Doo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
if (isset($_GET['lang'])) {
if (in_array($_GET['lang'], $this->langs)) {
setcookie('lang', $_GET['lang'], time() + 3600 * 240, '/');
Doo::conf()->lang = $_GET['lang'];
} else {
setcookie('lang', 'en');
Doo::conf()->lang = 'en';
}
} else {
if (!isset($_COOKIE['lang'])) {
// if user doesn't specify any language, check his/her browser language
// check if the visitor language is supported
// $this->language(true) to return the country code such as en-US zh-CN zh-TW
if (in_array($this->language(), $this->langs)) {
setcookie('lang', $this->language(), time() + 3600 * 240, '/');
Doo::conf()->lang = $this->language();
} else {
setcookie('lang', 'en', time() + 3600 * 240, '/');
Doo::conf()->lang = 'en';
}
} else {
Doo::conf()->lang = $_COOKIE['lang'];
}
}
}
示例2: flexi
public function flexi()
{
Doo::loadClass('SDPAPI');
Doo::loadClass('User');
$this->sdapi = new SDPAPI();
$this->dbuser = new User();
$xml = new SimpleXMLElement($HTTP_RAW_POST_DATA);
$type = $xml->sms['type'];
$sender = $xml->sms->source->address->number;
$receiver = $xml->sms->destination->address->number;
$incoming = html_entity_decode($xml->sms->ud);
//body message
$generater_voucher = md5($sender + time());
$generator_voucher = substr($generater_voucher, strlen($generater_voucher) - 5, 5);
$dataIn = array('sender' => $sender, 'receiver' => $receiver, 'incoming' => $incoming, 'type' => $type);
$this->dbuser->set_flexi_log('in', json_encode($dataIn));
switch (strtolower($incoming)) {
case 'free':
$sid = 'SDPCHG000';
$desc = 'Registrasi';
$pass = md5($sender);
$password = substr($pass, strlen($pass) - 5, 5);
$msg = "Login anda {$sender} dan password {$password}, anda dapat mengganti password melalui website useetv.com";
break;
case 'svodtest':
case 'ppv':
$sid = 'SDPCHG035';
if ($incoming == 'ppvtest') {
$sid = 'SDPCHG000';
}
$desc = 'Pembelian paket ppv';
$msg = "Kode voucher anda adalah {$generator_voucher} berlaku 2 hari setelah diaktifkan";
break;
case 'svodtest':
case 'svod':
$sid = 'SDPCHG100';
if ($incoming == 'svodtest') {
$sid = 'SDPCHG000';
}
$desc = 'Pembelian paket svod';
$msg = "Kode voucher anda adalah {$generator_voucher} berlaku 30 hari setelah diaktifkan";
break;
case 'promotest':
case 'promo':
$sid = 'SDPCHG035';
if ($incoming == 'promotest') {
$sid = 'SDPCHG000';
}
$desc = 'Pembelian paket promo';
$msg = "Kode voucher anda adalah {$generator_voucher} berlaku 30 hari setelah diaktifkan";
break;
default:
$sid = 'SDPCHG000';
break;
}
$dataOut = array('sender' => $sender, 'receiver' => $receiver, 'incoming' => $incoming, 'type' => $type, 'sid' => $sid, 'desc' => $desc, 'msg' => $msg);
$this->sdapi->sendsms($sender, $sid, $msg, $desc);
$this->dbuser->set_flexi_log('out', json_encode($dataOut));
//var_dump($xml);
}
示例3: prepareSidebar
/**
* Prepare sidebar data, random tags and archive list
*/
private function prepareSidebar()
{
//if tags cache exist, skip retrieving from DB, expires every 5 minutes
$cacheTagOK = Doo::cache('front')->testPart('sidebarTag', 300);
if (!$cacheTagOK) {
echo '<h2>Cache expired. Get Tags from DB!</h2>';
//get random 10 tags
Doo::loadModel('Tag');
$tags = new Tag();
$this->data['randomTags'] = $tags->limit(10, null, null, array('custom' => 'ORDER BY RAND()'));
} else {
$this->data['randomTags'] = array();
}
//if archive cache exist, skip retrieving from DB, archive expires when Post added, updated, deleted
$cacheArchiveOK = Doo::cache('front')->testPart('sidebarArchive', 31536000);
if (!$cacheArchiveOK) {
echo '<h2>Cache expired. Get Archives from DB!</h2>';
//you can pass data to constructor to set the Model properties
Doo::loadModel('Post');
$p = new Post(array('status' => 1));
$this->data['archives'] = $p->getArchiveSummary();
} else {
$this->data['archives'] = array();
}
}
示例4: mod
public function mod()
{
$configKey = 'settingConfig';
// $cachePath = Doo::conf()->CACHE_PATH;
// Doo::conf()->CACHE_PATH = Doo::conf()->SITE_PATH.'protect/confCache/';
array_push($this->_includeJsFileList, 'js/ueditor/ueditor.config.js');
array_push($this->_includeJsFileList, 'js/ueditor/ueditor.all.min.js');
array_push($this->_includeJsFileList, 'js/ueditor/lang/zh-cn/zh-cn.js');
array_push($this->_includeJsFileList, 'js/ueditor/ueditor.use.js');
$shopNameList = DBproxy::getProcedure('Manage')->setDimension(2)->getShopName();
$shopNameOpt = '<select class="m-wrap" name="shopname" id="city-element">';
foreach ($shopNameList as $key => $value) {
$selected = $this->getUrlVar('shopname') == $value['cityid'] . ',' . $value['shopname'] ? 'selected=selected' : '';
$shopNameOpt .= '<option ' . $selected . ' value="' . $value['cityid'] . ',' . $value['shopname'] . '">' . $value['cityNshopname'] . '</option>';
}
$shopNameOpt .= '</select>';
if ($this->isAjax() && $_POST) {
$v = Doo::loadHelper('DooValidator', true);
$success = true;
$errors = array();
DOO::cache('php')->set($configKey, json_encode($_POST), 3600 * 24 * 365 * 100);
// 处理返回路径
if ($success) {
$errors = ConfigController::$dataTableUrl;
}
$this->ajaxFormResult($success, $errors);
} else {
$infoCache = DOO::cache('php')->get($configKey);
$info = json_decode($infoCache, true);
// echo Doo::conf()->CACHE_PATH = $cachePath;
Doo::loadClassAt('html/DooFormExt', 'default');
$form = new DooFormExt(array('method' => 'post', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-horizontal'), 'elements' => array('errors' => array('display', array('div' => false, 'label' => false, 'content' => '<div id="js-form-errors" class=""></div><div style="clear:both"></div>')), 'peiSwitch' => array('select', array('label' => L('菜品调剂发送开关:'), 'attributes' => array('class' => "m-wrap"), 'multioptions' => array(0 => '关', 1 => '开'), 'value' => isset($info['peiSwitch']) ? $info['peiSwitch'] : '0')), 'waimaiSum' => array('text', array('label' => '外卖起送份数', 'attributes' => array('class' => "m-wrap"), 'value' => isset($info['waimaiSum']) ? $info['waimaiSum'] : '1')), 'aboutTxt' => array('display', array('label' => '关于我们', 'attributes' => array('class' => "m-wrap"), 'content' => '<script id="about" type="text/plain" style="width:1024px;height:500px;">' . $info['editorValue'] . '</script>')), 'saveAndSee' => array('button', array('div' => false, 'left' => ' ', 'label' => '保存&查看<i class="icon-arrow-right"></i>', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'cancelAndReturn' => array('display', array('div' => false, 'left' => ' ', 'right' => '</div>', 'content' => '<a class="btn" href="' . ConfigController::$dataTableUrl . '"><i class="icon-arrow-left"></i>取消&返回</a>')))));
$this->contentlayoutRender($form->render());
}
}
示例5: user
public function user()
{
$_DCOOKIE = array();
$prelength = strlen($this->cookiepre);
foreach ($_COOKIE as $key => $val) {
if (substr($key, 0, $prelength) == $this->cookiepre) {
$_DCOOKIE[substr($key, $prelength)] = Lua::clean($val);
}
}
unset($prelength);
$discuz_auth_key = md5($this->authkey . $_SERVER['HTTP_USER_AGENT']);
list($discuz_pw, $discuz_secques, $discuz_uid) = isset($_DCOOKIE['auth']) ? Lua::clean(explode("\t", $this->authcode($_DCOOKIE['auth'], 'DECODE', $discuz_auth_key)), 1) : array('', '', 0);
$discuz_uid = intval($discuz_uid);
Doo::db()->reconnect('dz7');
$query = "select m.uid,m.username,m.password,m.gender as sex,mf.avatar as icon from cdb_members m left join cdb_memberfields mf on mf.uid=m.uid where m.uid='{$discuz_uid}'";
$query = str_replace('cdb_', $this->tablepre, $query);
$user = Lua::get_one($query);
Doo::db()->reconnect('dev');
if ($user && $discuz_pw == $user['password']) {
unset($user['password']);
$user['hash'] = substr(md5(substr(TIMESTAMP, 0, -7) . iconv('utf-8', 'gbk', $user['username']) . $discuz_uid . $discuz_pw . $discuz_auth_key), 8, 8);
return $user;
}
return array();
}
示例6: user
public function user()
{
$_DCOOKIE = array();
$this->cookiepre = $this->cookiepre . substr(md5($this->cookiepath . '|' . $this->cookiedomain), 0, 4) . '_';
$prelength = strlen($this->cookiepre);
foreach ($_COOKIE as $key => $val) {
if (substr($key, 0, $prelength) == $this->cookiepre) {
$_DCOOKIE[substr($key, $prelength)] = Lua::clean($val);
}
}
unset($prelength);
if (isset($_DCOOKIE['auth'])) {
$authkey = md5($this->authkey . $_SERVER['HTTP_USER_AGENT']);
$auth = Lua::clean(explode("\t", $this->authcode($_DCOOKIE['auth'], 'DECODE', $authkey)));
list($discuz_pw, $discuz_uid) = empty($auth) || count($auth) < 2 ? array('', '') : $auth;
if ($discuz_uid) {
Doo::db()->reconnect('X15');
$query = "select u.uid,u.username,u.password,p.gender from pre_common_member u left join pre_common_member_profile p on p.uid=u.uid where u.uid='{$discuz_uid}'";
$query = str_replace('pre_', $this->tablepre, $query);
$user = Lua::get_one($query);
Doo::db()->reconnect('dev');
if (!empty($user) && $user['password'] == $discuz_pw) {
unset($user['password']);
return $user;
}
}
}
return array();
}
示例7: _fetchTableDefinition
protected function _fetchTableDefinition($table)
{
$fullTableDefinition = Doo::db()->fetchAll('DESCRIBE ' . $table);
$tableDefinition = array();
foreach ($fullTableDefinition as $columnDefinition) {
$fieldName = $columnDefinition['Field'];
$type = strtolower($columnDefinition['Type']);
$size = null;
if (strpos($type, '(') !== false) {
$size = substr($type, strpos($type, '(') + 1, -1);
$type = substr($type, 0, strpos($type, '('));
if ($type != 'char' && $type != 'varchar') {
$size = null;
}
}
$require = $columnDefinition['Null'] == 'YES' ? false : true;
$default = $columnDefinition['Default'];
$primary = $columnDefinition['Key'] == 'PRI' ? true : false;
$autoInc = strpos($columnDefinition['Extra'], 'auto_increment') === false ? false : true;
if ($type == 'boolean' || $type == 'tinyint' && $size == 1) {
$type = DooManageDb::COL_TYPE_BOOL;
} elseif ($type == 'integer') {
$type = DooManageDb::COL_TYPE_INT;
} elseif ($type == 'double') {
$type = DooManageDb::COL_TYPE_FLOAT;
} elseif ($type == 'longtext') {
$type = DooManageDb::COL_TYPE_CLOB;
} elseif ($type == 'datetime') {
$type = DooManageDb::COL_TYPE_TIMESTAMP;
}
$tableDefinition[$fieldName] = array('autoinc' => $autoInc, 'default' => $default, 'primary' => $primary, 'require' => $require, 'scope' => null, 'size' => $size, 'type' => $type);
}
return $tableDefinition;
}
示例8: get_by_id
public function get_by_id()
{
if (intval($this->id) <= 0) {
return null;
}
return Doo::db()->find($this, array('limit' => 1));
}
示例9: get_token
function get_token()
{
Doo::loadClass('Tsel');
$tsel = new Tsel();
if (isset($_GET['debug'])) {
if ($_GET['debug'] == "token") {
echo $this->token_url;
}
}
$token = @file_get_contents($this->token_url);
$out = array('result' => false, 'token' => $token, 'msg' => 'token failed');
if ($token != '-1') {
$out = array('result' => true, 'token' => $token, 'msg' => 'success');
$param = array('ip_addr' => $_GET['ip_addr'], 'clip_code' => $_GET['clip_code'], 'content_code' => $_GET['content_code'], 'programid' => $this->programid, 'vod_id' => $_GET['vod_id'], 'content_id' => $_GET['content_id'], 'zte' => $_GET['zte'], 'fp' => $_GET['fp']);
$data = array('token' => $token, 'param' => json_encode($param));
$tsel->set_token($data);
}
if (isset($_GET['zte'])) {
if ($_GET['zte'] == "1") {
echo $token;
}
} else {
echo json_encode($out);
}
exit;
}
示例10: remove_agg_tmp_tables
function remove_agg_tmp_tables()
{
require 'instrumentation.php';
require 'simple-dal.php';
$schema_id = $this->params['schema_id'];
// shards
$shards = Doo::db()->find('Shards', array('where' => "schema_id = {$schema_id}"));
$drop_count = 0;
foreach ($shards as $s) {
$server = get_object_vars($s);
$server['user'] = $s->username;
$conn = SimpleDAL::factory($server);
$conn->my_select_db($server['db']);
//get tables
$stmt = $conn->my_query("SHOW TABLES");
while ($row = $conn->my_fetch_assoc($stmt)) {
$table = $row['Tables_in_' . $server['db']];
if (preg_match('/(aggregation_tmp_|agg_tmp_)/', $table)) {
$conn->my_query("DROP TABLE " . $table);
$drop_count++;
}
}
$conn->my_close();
}
$this->res->message = "Dropped {$drop_count} Tables";
$this->res->success = true;
}
示例11: example
public function example()
{
$data['header'] = 'header';
$data['nav'] = 'nav';
$data['baseurl'] = Doo::conf()->APP_URL;
$this->view()->render(Doo::conf()->lang . '/example', $data);
}
示例12: beforeRun
public function beforeRun($resource, $action)
{
$this->dir = ADMIN_ROOT . '/moban/';
$this->img = '/' . ADMIN_ROOT . '/static/';
$session = Doo::session('Lua');
$auth = $session->get('auth');
if (empty($auth)) {
$sets = Doo::cache('php')->get('loginset');
if ($sets && $sets['cardit'] == 1) {
$xxxx = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J');
$nums = range(1, 9);
shuffle($xxxx);
shuffle($nums);
$aaaa = $xxxx[0] . $nums[0];
$bbbb = $xxxx[1] . $nums[1];
$session->cardcode = $aaaa . '@' . $bbbb;
}
include Lua::display('login', $this->dir);
exit;
}
$auth = empty($auth) ? array(0, '') : Lua::clean(explode("\t", Lua::authcode($auth, 'DECODE')), 1);
$user = Lua::get_one("select * from lua_admin where uid='" . intval($auth[0]) . "' and password='" . $auth[1] . "' and gid='1'");
if (empty($user) || $user && $this->clientIP() != $user['loginip']) {
$session->auth = '';
Lua::admin_msg('操作提示', '请先登录', '/' . ADMIN_ROOT);
}
$rs = $this->acl()->process($user['perm'], $resource, $action);
if ($rs) {
return $rs;
}
$this->user = $user;
$this->page = Lua::get_post('p') ? intval(Lua::get_post('p')) : 1;
// 图片识别码, 借鉴自 supesite
define('FILE_HASH', substr(md5($user['uid'] . '/' . time() . Lua::random(6)), 8, 16));
}
示例13: user
public function user()
{
$winduser = $this->GetCookie('winduser');
if ($winduser) {
list($winduid, $windpwd, ) = explode("\t", $this->StrCode($winduser, 'DECODE'));
}
if (isset($winduid) && is_numeric($winduid) && strlen($windpwd) >= 16) {
Doo::db()->reconnect('pw8');
$query = "SELECT m.uid,m.username,m.password,m.icon,m.gender as sex,md.onlineip FROM pw_members m LEFT JOIN pw_memberdata md ON m.uid=md.uid WHERE m.uid='{$winduid}'";
$query = str_replace('pw_', $this->tablepre, $query);
$user = Lua::get_one($query);
$onlineip = $this->clientIP();
if (strpos($user['onlineip'], $onlineip) === false) {
$iparray = explode(".", $onlineip);
if (strpos($user['onlineip'], $iparray[0] . '.' . $iparray[1]) === false) {
return array();
}
} else {
if (empty($user)) {
return array();
} else {
if ($this->PwdCode($user['password']) != $windpwd) {
unset($user);
return array();
} else {
unset($user['password']);
return $user;
}
}
}
Doo::db()->reconnect('dev');
}
}
示例14: show_news_by_title
public function show_news_by_title()
{
$data['title'] = 'NewsController->show_news_by_title';
$data['content'] = 'News title is ' . str_replace('%20', ' ', $this->params['title']);
$data['baseurl'] = Doo::conf()->APP_URL;
$data['printr'] = $this->params;
$this->view()->render('template', $data);
}
示例15: deleteComment
function deleteComment()
{
$data['baseurl'] = Doo::conf()->APP_URL;
$data['title'] = 'Blog - delete comment';
$data['content'] = 'You can access this~';
$data['printr'] = 'You are the admin <input type="button" value="Delete this comment" />';
$this->render('template', $data);
}