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']; } } }
public function dataTable() { Doo::loadClassAt('html/DataTable', 'default'); $dt = new DataTable(); function table_button($row, $rowData, $val) { $a = '<a class="btn blue-stripe mini" href="' . MapController::$modUrl . $rowData['id'] . '">' . '编辑</a>'; $a .= ' <a href="' . MapController::$delUrl . $rowData['id'] . '" class="red-stripe btn mini js-datatable-del">删除</a>'; return $a; } function table_status($row, $rowData, $val) { if (trim($rowData['status']) == '0') { $a = '<span class="label label-success">正常可用</span>'; } else { $a = '<span class="label">失效'; } return $a; } // 表头 $header = array('name' => array('name' => '名称'), 'longitude' => array('name' => '经度'), 'latitude' => array('name' => '纬度'), 'status' => array('name' => '可用状态', 'callback' => 'table_status'), 'action' => array('name' => '操作', 'callback' => 'table_button')); $param = array('pagesize' => $this->getCurPage() . ',' . Doo::conf()->pagesize); $res = DBproxy::getProcedure('Manage')->setDimension(2)->getMap($param); // 生产表格 $content = $dt->setTitle('')->setAttr(array('class' => 'table', 'id' => 'js-queryTable'))->setHeader($header)->setData($res['data'])->setTopContent('')->setBottomContent($this->pager($res['total']))->setDefaultValue('unkown')->render(false); $btn = '<a href="' . MapController::$addUrl . '" class="btn green-stripe"><i class="icon-plus"></i>' . L('添加门店') . '</a>'; // 显示模版 $this->contentlayoutRender($btn . $content); }
public function modPassword() { $userInfo = $this->_user->getUserInfo(); //D($userInfo); $uid = $userInfo['uid']; if ($uid == 0 && isset($uid)) { $this->alert('参数错误'); return; } if ($this->isAjax() && $_POST) { $v = Doo::loadHelper('DooValidator', true); $success = true; $errors = array(); $password = $_POST['password']; $password1 = $_POST['password1']; $password2 = $_POST['password2']; $pwd = $this->_user->password($password); //md5(KEY_PASSWORD.$password); if ($userInfo['passwd'] != $pwd) { $success = false; $errors[] = '密码不正确'; } if (!isset($password1)) { $success = false; $errors[] = '新登陆密码不能为空'; } if (!isset($password2)) { $success = false; $errors[] = '再次输入密码不能为空'; } if ($password1 != $password2) { $success = false; $errors[] = '两次输入的密码不一致,请检查'; } // 插入数据库(接口没有验证数据是否重复,需添加者自己注意) if ($success) { $result = $this->_user->update_pwd(1, $uid, $password1); if (isset($result) && $result != 0) { $success = false; $errors[] = '插入数据库出错,不可连续修改两次密码且不可与原密码相同'; } } // 处理返回路径 if ($success) { if (isset($_POST['saveAndReutrn'])) { $errors = Doo::conf()->APP_URL . 'index.php/in'; } } // 处理表单位提交 $this->ajaxFormResult($success, $errors, true, 'loginOut'); } else { //取某用户信息 $row = $this->_user->get_one($uid); //D($row); // 显示生成表单 Doo::loadClassAt('html/DooFormExt', 'default'); $form = new DooFormExt($this->_getPasswordFormConfig(false, $row)); $this->contentlayoutRender($form->render()); } }
public function example() { $data['header'] = 'header'; $data['nav'] = 'nav'; $data['baseurl'] = Doo::conf()->APP_URL; $this->view()->render(Doo::conf()->lang . '/example', $data); }
public static function get($dbName) { if (!isset(self::$_dbList[$dbName])) { Doo::loadClassAt('Mysql', 'default'); self::$_dbList[$dbName] = new Mysql(Doo::conf()->dbconfig[$dbName]); } return self::$_dbList[$dbName]; }
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); }
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); }
public function dbAAA2() { Doo::loadCore('db/DooSqlMagic'); $dbAAA = new DooSqlMagic(); $dbAAA->setDb(Doo::conf()->db_aaa2, Doo::conf()->APP_MODE); $dbAAA->connect(); return $dbAAA; }
/** * 显示信息 * @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; }
function postError() { $this->data['rootUrl'] = Doo::conf()->APP_URL; $this->data['title'] = 'Post Not Found!'; $this->data['content'] = '<p style="color:#ff0000;">The post with ID ' . $this->params['pid'] . ' is not found.</p>'; $this->prepareSidebar(); $this->render('error', $this->data); }
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); }
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); }
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); }
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); }
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); }
/** * 查询额度 * * 查询地址 */ 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; }
public function dbW() { Doo::loadCore('db/DooSqlMagic'); $dbW = new DooSqlMagic(); $dbW->setDb(Doo::conf()->db_write, Doo::conf()->APP_MODE); $dbW->connect(); return $dbW; }
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); }
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); }
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]]; } }
public function __construct($path = '') { if ($path == '') { if (isset(Doo::conf()->CACHE_PATH)) { $this->_directory = Doo::conf()->CACHE_PATH; } else { $this->_directory = Doo::conf()->SITE_PATH . 'protected/cache/'; } } else { $this->_directory = $path; } }
public function __construct($path = '') { if ($path == '') { if (isset(Doo::conf()->CACHE_PATH)) { $this->_directory = Doo::conf()->CACHE_PATH; } else { $this->_directory = Doo::conf()->SITE_PATH . Doo::conf()->PROTECTED_FOLDER . 'cache/'; } } else { $this->_directory = $path; } }
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; } } }
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); }
public function sayhi() { if (isset($this->params[0])) { if (isset($_GET['title'])) { $data['content'] = 'Hi, ' . $_GET['title'] . ' ' . $this->params[0]; } else { $data['content'] = 'Hi, ' . $this->params[0]; } } else { $data['content'] = 'Please tell me your name!'; } $data['title'] = 'HelloController->sayhi'; $data['baseurl'] = Doo::conf()->APP_URL; $data['printr'] = $this->params; $this->view()->render('template', $data); }
private function home() { Doo::loadHelper('DooFile'); $f = new DooFile(); $list = $f->getList($this->plugin_dir, DooFile::LIST_FOLDER); $ps = array(); if ($list) { foreach ($list as $k => $v) { $rs['name'] = $f->readFileContents($v['path'] . '/readme.txt'); $rs['ico'] = '/' . ADMIN_ROOT . '/' . Doo::conf()->PROTECTED_FOLDER . 'plugin/' . $v['name'] . '/ico.png'; $rs['act'] = $v['name']; $ps[$v['name']] = $rs; } } include Lua::display('plugin', $this->dir); }
function eliminarRespuesta() { session_start(); if (Session::siExisteSesion()) { $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : Doo::conf()->APP_URL . 'ionadmin/index'; $referer = strtok($referer, '?'); $this->data['idrespuesta'] = intval($this->params['idrespuesta']); Doo::loadModel('CtRespuesta'); $r = new CtRespuesta(); $r->id_respuesta = $this->data['idrespuesta']; $r->delete(); header('location:' . $referer . '?success=1'); } else { header('location:' . Doo::conf()->APP_URL . 'ionadmin/login?error=1'); } }
function start_local_job_server($id, $port, $schema_id) { //get path $config = Doo::db()->getOne('SchemataConfig', array('where' => "schema_id = {$schema_id} AND var_name = 'gearmand_path'")); $gearmand_path = $config != false ? $config->var_value : ''; if ($gearmand_path === "") { $path = getenv('PATH'); putenv("PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:{$path}"); $which = `which gearmand`; if ($which) { $gearmand_path = trim($which); } } else { if (is_dir($gearmand_path)) { $gearmand_path = rtrim($gearmand_path, "/") . '/gearmand'; } } $log_file = Doo::conf()->SITE_PATH . Doo::conf()->PROTECTED_FOLDER . "log/gearmand.{$id}.log"; $pid_file = Doo::conf()->SITE_PATH . Doo::conf()->PROTECTED_FOLDER . "var/gearmand.{$id}.pid"; if ($gearmand_path === "") { $fh = fopen($log_file, 'a+'); fputs($fh, `date` . " - could not find gearmand in path!\n"); return false; } if (file_exists($pid_file)) { unlink($pid_file); } //send command to shell $cmd = $gearmand_path . " -d -L 127.0.0.1 -p {$port} -l {$log_file} --pid-file={$pid_file}"; $iam = trim(`whoami`); if ($iam === "root") { $cmd .= " -u shard-query"; } //execute command exec($cmd, $output); //wait for pid file creation sleep(2); //check pid file if (!file_exists($pid_file)) { $fh = fopen($log_file, 'a+'); fputs($fh, trim(`date`) . " - gearman could not be started. PID file not found. [{$output}]\n"); return false; } //return pid return file_exists($pid_file) ? file_get_contents($pid_file) : null; }
function smtp($relay_host = "", $smtp_port = 25, $auth = false, $user, $pass) { $this->debug = FALSE; $this->smtp_port = $smtp_port; $this->relay_host = $relay_host; $this->time_out = 30; //is used in fsockopen() # $this->auth = $auth; //auth $this->user = $user; $this->pass = $pass; # $this->host_name = "localhost"; //is used in HELO command $this->log_file = Doo::conf()->LOG_PATH . "/sendmail.log"; $this->sock = FALSE; }
/** * 登录 */ public function in() { if ($this->_user->isLogin()) { $result = $this->_user->logout(); } // 自动登录 // if($this->_user->autoLogin()) { // $this->alert('自动登录成功','success'); // return; // } if ($this->isAjax() && $_POST) { $result = $this->_user->login($_POST['username'], $_POST['password'], $_POST['safecode'], $_POST['lang'], isset($_POST['remember']) ? 1 : 0); $this->ajaxFormResult($result['success'], $result['success'] ? adminAppUrl('home') : $result['errors']); } else { Doo::loadClassAt('html/DooFormExt', 'default'); $form = new DooFormExt(array('method' => 'post', 'renderFormat' => 'array', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-vertical login-form'), 'elements' => array('username' => array('text', array('hide-label' => FALSE, 'placeholder' => '用户名', 'attributes' => array('class' => "m-wrap placeholder-no-fix"))), 'lang' => array('select', array('multioptions' => Doo::conf()->langList, 'hide-label' => FALSE, 'attributes' => array('class' => "m-wrap small"))), 'password' => array('password', array('hide-label' => FALSE, 'placeholder' => '密码', 'attributes' => array('class' => "m-wrap placeholder-no-fix"))), 'remember' => array('checkbox', array('hide-label' => FALSE, 'div' => FALSE, 'attributes' => array('class' => ""))), 'safecode' => array('text', array('div' => FALSE, 'hide-label' => FALSE, 'placeholder' => '验证码', 'attributes' => array('class' => "m-wrap small")))))); $this->renderc($this->_templateDefault . '/login/in', $form->render()); } }