Exemplo n.º 1
0
    public function getPlimusLinkDataByAddress($address)
    {
        $q = 'SELECT link_data
	      FROM ' . $this->dbName . 'pa_plimus_links
              WHERE link_address = "' . $address . '"';
        if (DB::executeQuery($q, 'link')) {
            return DB::fetchOne('link');
        }
    }
Exemplo n.º 2
0
 public function loadPost($id)
 {
     $sql = 'select p.id, p.title, p.body, p.created, p.tags, a.nickname as author, a.id as author_id from posts p, users a where p.id=? and p.author_id=a.id';
     if (!($result = DB::fetchOne($sql, $id))) {
         Log::error(__CLASS__ . ': Could not load post with id ' . $id);
         return false;
     } else {
         return $result;
     }
 }
Exemplo n.º 3
0
 /**
  * count
  * 计算行数
  *
  * @param  string $conditions
  * @param  array $params
  *
  * @throws FDB_Exception
  * @return integer
  */
 public function count($conditions = null, $params = array())
 {
     $sql = 'SELECT COUNT(*) FROM ' . $this->_table;
     try {
         if ($conditions) {
             $sql .= ' WHERE ' . $conditions;
         }
         return $this->_dbh->fetchOne($sql, $params);
     } catch (PDOException $e) {
         throw new FDB_Exception($e);
     }
 }
Exemplo n.º 4
0
    public function authenticate($loginField, $passwdField)
    {
        if (!empty($_POST[$loginField]) && !empty($_POST[$passwdField])) {
            $q = 'SELECT u_passwd
		    FROM ' . $this->_consts->getConst('adminDb') . '.users
		  WHERE u_login = ?
		  LIMIT 1';
            DB::executeQuery($q, 'user_data', array($_POST[$loginField]));
            $row = DB::fetchOne('user_data');
            if (!empty($row)) {
                if (md5($_POST[$passwdField]) == $row) {
                    $this->_storage->setFingerprint();
                    $this->isValid = TRUE;
                }
            }
        }
    }
Exemplo n.º 5
0
 /**
  * 获取当前分类的父级id
  * @param  integer $category 
  * @return integer           
  */
 public function getBid($category)
 {
     $sql = "SELECT id,bid FROM " . self::$table . " WHERE `id`='{$category}'";
     $row = DB::fetchOne($sql);
     $bid = $row['bid'];
     return $bid;
 }
Exemplo n.º 6
0
 public function getLocalizedString($textNick)
 {
     if (!empty($textNick)) {
         $q = 'SELECT ll_text
               FROM lstrings
               LEFT JOIN ' . $this->language . ' ON ll_nick_id = ls_id
               WHERE ls_nick LIKE ?';
         //                  WHERE ls_nick = ? AND ls_site = ?';
         //            DB::executeQuery($q, 'getLocStr', array($textNick, VBox::get('ConstData')->getConst('siteId')));
         DB::executeQuery($q, 'getLocStr', array($textNick));
         $res = DB::fetchOne('getLocStr');
         if ($res) {
             return $res;
         } else {
             return false;
         }
     }
     return false;
 }
Exemplo n.º 7
0
 /**
  * 检测管理员是否存在
  * @param  string $username 
  * @param  string $password 
  * @return integer or null           
  */
 public function checkLogin($username, $password)
 {
     $sql = "SELECT id,username,password FROM " . self::$table . " WHERE `username`='" . $username . "' AND `password`='" . $password . "' LIMIT 1";
     $row = DB::fetchOne($sql);
     return $row;
 }
Exemplo n.º 8
0
 public static function getAddressById($id)
 {
     $q = 'SELECT pg_address
           FROM pages
           WHERE pg_id = ?
           LIMIT 1';
     DB::executeQuery($q, 'faddress', array($id));
     $address = DB::fetchOne('faddress');
     if (!empty($address)) {
         return $address;
     }
     return '/';
 }
Exemplo n.º 9
0
 /**
  * 得到指定的职位信息
  * @param  integer $id 
  * @return integer
  */
 public function getInfoById($id)
 {
     $sql = "SELECT id,work_place,numbers,position_name,content,release_time FROM " . self::$table . " WHERE `id`='{$id}'";
     return DB::fetchOne($sql);
 }
Exemplo n.º 10
0
 /**
  * 得到网站的基本信息
  * @return array or null
  */
 public function fetchInfo()
 {
     $sql = "SELECT web_name,web_extension,content,web_logo FROM " . self::$table . " WHERE `type`='web_base_info' LIMIT 1";
     return DB::fetchOne($sql);
 }
Exemplo n.º 11
0
 /**
  * 得到一条留言业务操作
  * @param  integer $id 
  * @return array or null
  */
 public function getMessageOne($id)
 {
     $sql = "SELECT * FROM " . self::$table . " WHERE `id`='{$id}'";
     return DB::fetchOne($sql);
 }
Exemplo n.º 12
0
 /**
  * 得到某一应聘者的详细信息
  * @param  integer $id 
  * @return array or null  
  */
 public function getPersonelInfoById($id)
 {
     $sql = "SELECT * FROM " . self::$table . " WHERE `id`='{$id}'";
     return DB::fetchOne($sql);
 }
Exemplo n.º 13
0
Error::$pathToFile = LOCAL_PATH . 'logs/sitemap.log';
Error::setFileLogging(TRUE);
DB::initialize('mysql', 'localhost', NULL, 'venginse_admin', 'venginse', 'YqPffTfB');
DB::executeQuery('SET NAMES utf8', 'cp_utf8');
$q = 'SELECT s_hostname, s_dbname, s_path, s_gziped
	FROM sites
      WHERE s_indexed = 1';
DB::executeQuery($q, 'sites');
$rows = DB::fetchResults('sites');
if (!empty($rows)) {
    $tsize = sizeof($rows);
    $Sitemap = new SitemapGenerator('venginse_all');
    for ($i = 0; $i < $tsize; $i++) {
        $q = 'SELECT c_value
		FROM ' . $rows[$i]['s_dbname'] . '.const
	      WHERE c_name = "siteClosed" LIMIT 1';
        DB::executeQuery($q, 'close');
        $row = DB::fetchOne('close');
        if ($row == '0') {
            $Sitemap->setParams($rows[$i]);
            if ($Sitemap->buildSitemap()) {
                $Sitemap->writeSitemap();
                $Sitemap->submitSitemap();
            }
            sleep(100);
        }
    }
    unset($Sitemap);
}
Error::deInitialize();
DB::deInitialize();
Exemplo n.º 14
0
 private function getProductPlatform($productId)
 {
     $db = VBox::get('ConstData')->getConst('langsDb');
     $q = 'SELECT pl.*
           FROM ' . $db . '.products as p
           LEFT JOIN ' . $db . '.platforms as pl on p.p_platform = pl.platform_id
           WHERE p.p_id = ' . $productId;
     DB::executeQuery($q, 'productPlatform');
     $res = DB::fetchOne('productPlatform');
     return $res;
 }
Exemplo n.º 15
0
 /**
  * 调整产品顺序业务层
  * @param  integer $id1 
  * @param  integer $id2 
  * @return  boolean     
  */
 public function adjust_order($id1, $id2)
 {
     $sql1 = "SELECT id,the_order,sort\tFROM " . self::$table . " WHERE `id`='{$id1}'";
     $row1 = DB::fetchOne($sql1);
     $order1 = $row1['the_order'];
     $sql2 = "SELECT id,the_order,sort FROM " . self::$table . " WHERE `id`='{$id2}'";
     $row2 = DB::fetchOne($sql2);
     $order2 = $row2['the_order'];
     $arr1['sort'] = $order2;
     $arr1['the_order'] = $order2;
     $state1 = DB::update(self::$table, $arr1, " `id`='{$id1}'");
     $arr2['sort'] = $order1;
     $arr2['the_order'] = $order1;
     $state2 = DB::update(self::$table, $arr2, " `id`='{$id2}'");
     if ($state1 && $state2) {
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 16
0
 public function count()
 {
     $q = DB::fetchOne($this->as_sql('SELECT count(*) as count'));
     return $q['count'];
 }
Exemplo n.º 17
0
 public function load($value, $keyName = null)
 {
     if (!$this->checkKey($keyName)) {
         $keyName = $this->getPrimKey();
     }
     $data = DB::fetchOne(sprintf('SELECT * FROM `%s` WHERE `%s` = %s', $this->name, $keyName, DB::value($value)));
     $this->setData($data);
     return $this;
 }