Ejemplo n.º 1
0
 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'];
         }
     }
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 /**
  * 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();
     }
 }
Ejemplo n.º 4
0
 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());
     }
 }
Ejemplo n.º 5
0
 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();
 }
Ejemplo n.º 6
0
 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();
 }
 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;
 }
Ejemplo n.º 8
0
 public function get_by_id()
 {
     if (intval($this->id) <= 0) {
         return null;
     }
     return Doo::db()->find($this, array('limit' => 1));
 }
Ejemplo n.º 9
0
 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;
 }
Ejemplo n.º 10
0
 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;
 }
Ejemplo n.º 11
0
 public function example()
 {
     $data['header'] = 'header';
     $data['nav'] = 'nav';
     $data['baseurl'] = Doo::conf()->APP_URL;
     $this->view()->render(Doo::conf()->lang . '/example', $data);
 }
Ejemplo n.º 12
0
 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='******' 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));
 }
Ejemplo n.º 13
0
 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');
     }
 }
Ejemplo n.º 14
0
 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);
 }
Ejemplo n.º 15
0
 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);
 }
Ejemplo n.º 16
0
 function loginRequire()
 {
     $data['baseurl'] = Doo::conf()->APP_URL;
     $data['title'] = 'Login Required!';
     $data['content'] = 'You cannot access this!';
     $data['printr'] = 'You have to be logined to access this section.';
     $this->render('template', $data);
 }
Ejemplo n.º 17
0
 public function index()
 {
     $data['title'] = 'AdminController->index';
     $data['content'] = 'Thanks for logging in to admin!';
     $data['baseurl'] = Doo::conf()->APP_URL;
     $data['printr'] = $this->params;
     $this->view()->render('template', $data);
 }
Ejemplo n.º 18
0
 /**
  * 查询额度
  *
  *  查询地址
  */
 public function queryBalance()
 {
     // global $chuanglan_config;
     //查询参数
     $postArr = array('account' => Doo::conf()->sms_api_account, 'pswd' => Doo::conf()->sms_api_password);
     $result = $this->curlPost(Doo::conf()->sms_api_balance_query_url, $postArr);
     return $result;
 }
Ejemplo n.º 19
0
 /**
  * 显示信息
  * @param type $backurl
  * @param type $message
  */
 function showMessage($backurl, $message)
 {
     Doo::loadController('DooController');
     $dc = new DooController();
     $data = array('backurl' => $backurl, 'sec' => Doo::conf()->SEC, 'message' => $message, 'rootUrl' => Doo::conf()->APP_URL);
     $dc->renderc('admin/msg', $data);
     exit;
 }
Ejemplo n.º 20
0
 function showVipHome()
 {
     $data['baseurl'] = Doo::conf()->APP_URL;
     $data['title'] = 'VIP Lounge';
     $data['content'] = 'You can access this~';
     $data['printr'] = 'SuperDuber contents! Thanks for being a paid member :)';
     $this->render('template', $data);
 }
Ejemplo n.º 21
0
 public function dbAAA2()
 {
     Doo::loadCore('db/DooSqlMagic');
     $dbAAA = new DooSqlMagic();
     $dbAAA->setDb(Doo::conf()->db_aaa2, Doo::conf()->APP_MODE);
     $dbAAA->connect();
     return $dbAAA;
 }
 public function moo()
 {
     $data['title'] = 'CamelCaseController->moo';
     $data['content'] = 'camel mooing??? Hell no!';
     $data['baseurl'] = Doo::conf()->APP_URL;
     $data['printr'] = $this->params;
     $this->view()->render('template', $data);
 }
Ejemplo n.º 23
0
 function contact()
 {
     $data['baseurl'] = Doo::conf()->APP_URL;
     $data['title'] = 'Contact Us';
     $data['content'] = 'You can access this~';
     $data['printr'] = 'Contact Us form.';
     $this->render('template', $data);
 }
Ejemplo n.º 24
0
 function index()
 {
     $data['title'] = 'ERROR 404 not found <em>means page not found!</em>';
     $data['content'] = 'This is handler by an internal Route as defined in common.conf.php $config[\'ERROR_404_ROUTE\']';
     $data['content'] .= '<p>Your error document needs to be more than 512 bytes in length. If not IE will display its default error page.</p><p>Give some helpful comments other than 404 :(<br/>Also check out the links page for a list of URLs available in this demo.</p>';
     $data['baseurl'] = Doo::conf()->APP_URL;
     $data['printr'] = null;
     $this->view()->render('template', $data);
 }
Ejemplo n.º 25
0
 function borrarRespuestas()
 {
     if (!empty($this->id_pregunta)) {
         Doo::loadModel('CtRespuesta');
         $resp = new CtRespuesta();
         $resp->id_pregunta = $this->id_pregunta;
         $resp->delete();
     }
 }
Ejemplo n.º 26
0
 function index()
 {
     $data['header'] = 'header';
     $data['nav'] = 'nav';
     $data['title'] = 'ERROR 404';
     $data['content'] = 'This is a cool message.';
     $data['baseurl'] = Doo::conf()->APP_URL;
     $this->view()->render($_COOKIE['lang'] . '/template', $data);
 }
Ejemplo n.º 27
0
function t2($arr)
{
    if (Doo::conf()->lang == Doo::conf()->default_lang) {
        return $arr[1];
    }
    include 'lang/' . Doo::conf()->lang . '.lang2.php';
    if (isset($lang[$arr[0]])) {
        return $lang[$arr[0]];
    }
}
Ejemplo n.º 28
0
 public function validate($checkMode = 'all', $requireMode = 'null')
 {
     //You do not need this if you extend DooModel or DooSmartModel
     //MODE: all, all_one, skip
     Doo::loadHelper('DooValidator');
     $v = new DooValidator();
     $v->checkMode = $checkMode;
     $v->requiredMode = $requireMode;
     return $v->validate(get_object_vars($this), $this->getVRules());
 }
Ejemplo n.º 29
0
 public function simple()
 {
     $data['title'] = 'SimpleController->simple';
     if (!empty($this->extension)) {
         $data['content'] = 'Simple test, extension: ' . $this->extension;
     } else {
         $data['content'] = 'Simple extension test';
     }
     $data['baseurl'] = Doo::conf()->APP_URL;
     $data['printr'] = $this->params;
     $this->view()->render('template', $data);
 }
Ejemplo n.º 30
0
 public function __construct($chmod = null)
 {
     if ($chmod !== null) {
         $this->chmod = $chmod;
     } else {
         if (class_exists('Doo')) {
             $this->chmod = Doo::conf()->get('CHMOD_DEFAULT', 0777);
         } else {
             $this->chmod = 0777;
         }
     }
 }