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


PHP Doo::db方法代码示例

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


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

示例1: 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();
 }
开发者ID:lianren,项目名称:doophp.cms,代码行数:29,代码来源:discuzX1.5.php

示例2: programa

 public function programa()
 {
     Doo::loadModel('CtEventos');
     $this->data['eventos'] = Doo::db()->find('CtEventos', array('asc' => 'hora'));
     $this->data['slug'] = 'programa';
     $this->renderc('eventos', $this->data);
 }
开发者ID:ENGINETEC,项目名称:esquire,代码行数:7,代码来源:MainController.php

示例3: _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;
 }
开发者ID:mindaugas-valinskis,项目名称:doophp,代码行数:34,代码来源:DooManageMySqlDb.php

示例4: 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');
     }
 }
开发者ID:lianren,项目名称:doophp.cms,代码行数:33,代码来源:phpwind8.5.php

示例5: 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;
 }
开发者ID:garv347,项目名称:swanhart-tools,代码行数:27,代码来源:UtilRESTController.php

示例6: get_by_id

 public function get_by_id()
 {
     if (intval($this->id) <= 0) {
         return null;
     }
     return Doo::db()->find($this, array('limit' => 1));
 }
开发者ID:mindaugas-valinskis,项目名称:doophp,代码行数:7,代码来源:Food.php

示例7: 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();
 }
开发者ID:lianren,项目名称:doophp.cms,代码行数:25,代码来源:discuz7.0.php

示例8: test

 public function test()
 {
     $this->load()->model('Food');
     $food = new Food();
     echo '<pre>';
     //print_r( $food->getById(14) );
     //print_r( $food->getById(14, array('limit'=>1)) );
     //print_r( $food->limit(10) );
     //print_r( $food->limit(10,'id,name') );
     //print_r( $food->limit(10,'name','id') );
     //print_r( $food->limit(10,'name,id','location') );
     //print_r( Food::_limit(10) );
     //print_r( $food->getOne() );
     //print_r( Food::_getOne() );
     //$food->location = 'Asia';
     //$food->food_type_id = 10;
     print_r($food->count());
     print_r(Food::_count());
     print_r(Food::_count($food));
     //Doo::cache('php')->set('foodtotal', Food::_count($food));
     //echo '<h1>'. Doo::cache('php')->get('foodtotal') .'</h1>';
     print_r(Food::getById__first(6));
     //$food->id = 14;
     //print_r( $food->getOne() );
     // print_r( $food->find() );
     //print_r( Food::_find($food) );
     //print_r( $food->getById_location__first(6, 'Malaysia') );
     //print_r( $food->getById_location(6, 'Malaysia', array('limit'=>1)) );
     //print_r( $food->relateFoodType($food, array('limit'=>'first')) );
     //print_r( $food->relateFoodType($food) );
     //print_r( $food->relateFoodType__first($food) );
     //print_r( Food::getById__location__first(6, 'Malaysia') );
     //print_r( Food::getById__location(6, 'Malaysia') );
     //print_r( Food::getById__first(6) );
     //print_r( Food::getByLocation('Malaysia') );
     //print_r( Food::relateFoodType__first($food) );
     //print_r( Food::relateFoodType() );
     //print_r( Food::relateFoodType_first() );
     //print_r( Food::_relate('', 'FoodType') );
     //
     //$f = new Food;
     //print_r( $f->relate('FoodType') );
     //print_r( $f->relate('FoodType', array('limit'=>'first')) );
     # if update/delete/insert cache auto purged on the Model.
     //$food->id = 6;
     //$food->name = 'Wan Tan Mee';
     //$food->update();
     //print_r($food->find());
     //$food->purgeCache();  #to delete cache manually
     //Food::_purgeCache();  #to delete cache manually
     # If no SQL is displayed, it means that the data are read from cache.
     # And of course your Model have to extend DooSmartModel
     print_r(Doo::db()->showSQL());
 }
开发者ID:mindaugas-valinskis,项目名称:doophp,代码行数:54,代码来源:MainController.php

示例9: index

 public function index()
 {
     $thisip = $this->clientIP();
     Lua::adminfail($thisip, 1);
     $username = Lua::post('username');
     $password = Lua::post('password');
     if (empty($username)) {
         Lua::admin_msg('信息提示', '请输入用户名');
     }
     if (empty($password)) {
         Lua::admin_msg('信息提示', '请输入密码');
     }
     $user = Lua::get_one("select * from lua_admin where username='{$username}' and password='" . md5($password) . "' and gid='1'");
     if (empty($user)) {
         Lua::adminfail($thisip);
         Lua::admin_msg('信息提示', '用户名或密码错误');
     }
     $auth = Lua::authcode($user['uid'] . "\t" . $user['password'], 'ENCODE');
     $session = Doo::session('Lua');
     // 口令卡验证
     $sets = Doo::cache('php')->get('loginset');
     if ($sets && $sets['cardit'] == 1) {
         $cardcode = $session->get('cardcode');
         $cardit = intval(Lua::post('cardit'));
         if (empty($cardit)) {
             Lua::admin_msg('信息提示', '请输入口令卡');
         }
         $cardex = explode('@', $cardcode);
         $b1 = $cardex[0][1];
         $b2 = $cardex[1][1];
         $secureid = $user['secureid'];
         $sdb = Lua::get_one("select * from lua_secure where id='{$secureid}' and uid='" . $user['uid'] . "'");
         if (empty($sdb)) {
             Lua::admin_msg('信息提示', '请先绑定口令卡后再登录');
         }
         $securekey = unserialize($sdb['securekey']);
         $x = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J');
         $k1 = array_search($cardex[0][0], $x);
         $k2 = array_search($cardex[1][0], $x);
         $truekey = $securekey[$b1][$k1] . $securekey[$b2][$k2];
         $truekey = intval($truekey);
         if ($truekey != $cardit) {
             Lua::adminfail($thisip);
             Lua::admin_msg('信息提示', '输入的口令卡错误', '/' . ADMIN_ROOT . '/');
         }
     }
     // end
     $session->auth = $auth;
     Doo::db()->query("update lua_admin set logintime='" . time() . "',logs=logs+1,loginip='" . $this->clientIP() . "' where uid='" . $user['uid'] . "'");
     Lua::delete('lua_admin_fails', array('ip' => $thisip));
     Lua::write_log($user, '登录后台', '---', $user['channel']);
     Lua::admin_msg('操作提示', '登录成功', '/' . ADMIN_ROOT);
 }
开发者ID:lianren,项目名称:doophp.cms,代码行数:53,代码来源:__login.php

示例10: renderc

 /**
  * @override solo en caso de poner excepciones
  * @see DooController::render()
  */
 public function renderc($file, $data = null, $enableControllerAccess = false, $includeTagClass = true)
 {
     if (!$data && is_array($file)) {
         $data = $file;
     }
     $data = array_merge(array('list' => array(), 'error' => null, 'action' => null), is_array($data) ? $data : array());
     if (!is_string($file)) {
         $file = $this->params['format'];
     }
     if (Doo::conf()->DEBUG_ENABLED) {
         $data['sql'] = Doo::db()->showSQL();
     }
     parent::renderc($file, $data, $enableControllerAccess, $includeTagClass);
 }
开发者ID:nelsondaza,项目名称:IDMeasure,代码行数:18,代码来源:IDGlobalController.php

示例11: fields

 function fields()
 {
     $res = new response();
     $db = $this->params["db"];
     $table = $this->params["table"];
     //query
     $result = Doo::db()->fetchAll("SHOW COLUMNS IN {$table} IN {$db}");
     foreach ($result as $row) {
         $data[] = array('field' => $row["Field"], 'type' => $row["Type"], 'null' => $row['Null'], 'key' => $row['Key'], 'default' => $row['Default']);
     }
     $res->data = $data;
     $res->success = true;
     echo $res->to_json();
 }
开发者ID:garv347,项目名称:swanhart-tools,代码行数:14,代码来源:SchemaRESTController.php

示例12: getResultadosEncuestas

 function getResultadosEncuestas()
 {
     $r = null;
     if (!empty($this->id_respuesta)) {
         $query = 'SELECT COUNT(id_resultado_encuesta) AS valor, id_respuesta FROM ht_resultado_encuesta WHERE id_respuesta = ' . $this->id_respuesta . ' GROUP BY id_respuesta';
         $result = Doo::db()->query($query);
         $r = $result->fetch();
         if (empty($r)) {
             $r = array();
             $r['id_respuesta'] = $this->id_respuesta;
             $r['valor'] = 0;
         }
     }
     return $r;
 }
开发者ID:ENGINETEC,项目名称:esquire,代码行数:15,代码来源:CtRespuesta.php

示例13: index

 function index()
 {
     session_start();
     if (Session::siExisteSesion()) {
         Doo::loadModel('CtEventos');
         $this->data['eventos'] = Doo::db()->find('CtEventos');
         $this->data['slug'] = 'eventos';
         Doo::loadModel('CtEncuesta');
         $enActivas = new CtEncuesta();
         $enActivas->activa = 1;
         $this->data['encuestas_activas'] = $enActivas->count();
         $this->renderc('admin/evento-ver-todos', $this->data);
     } else {
         header('location:' . Doo::conf()->APP_URL . 'ionadmin/login?error=1');
     }
 }
开发者ID:ENGINETEC,项目名称:esquire,代码行数:16,代码来源:EventosController.php

示例14: start_local_job_server

 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;
 }
开发者ID:garv347,项目名称:swanhart-tools,代码行数:46,代码来源:GearmanJobServerCLIController.php

示例15: live

 function live()
 {
     //callback : required
     if (!isset($_GET['callback']) || !preg_match('/^[a-zA-Z0-9_]+$/', $_GET['callback'])) {
         die('Invalid callback name');
     }
     $callback = $_GET['callback'];
     //query db
     $results = Doo::db()->find('QuotesLive', array('asArray' => true));
     //convert to float to strip trailing zeros
     foreach ($results as $key => $row) {
         $results[$key]['bid'] = (double) $row['bid'];
         $results[$key]['offer'] = (double) $row['offer'];
     }
     //print it
     $this->setContentType('js');
     echo $callback . "(" . json_encode($results) . ");";
 }
开发者ID:Blah2014,项目名称:doo-forex,代码行数:18,代码来源:LiveController.php


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