Example #1
0
 private function tol()
 {
     $format = 'select count(*) as count from analysis where cid=%d  LIMIT 1';
     $sql = sprintf($format, $this->switch);
     $res = parent::FetchOne($sql);
     return $res['count'];
 }
Example #2
0
 public function delete(Doctrine_Connection $conn = null)
 {
     $guid = $this->getGuid();
     parent::delete($conn);
     $delete_log = new DeleteLog();
     $delete_log->setGuid($guid);
     $delete_log->setModelName(get_class($this));
     $delete_log->save();
 }
 function write($outDir)
 {
     if (!$this->isLoaded) {
         $this->load();
     }
     if ($this->errors) {
         throw new \Exception("Site Has Errors");
     }
     $this->siteContainer['log']->notice("Starting writing", array('dir' => $outDir));
     $this->theme->write($outDir);
     $this->siteContainer['log']->notice("Finished writing");
 }
Example #4
0
 /**
  * @name IsUser
  * @package 发送验证码之前,验证手机号码是否存在
  * @return array
  */
 public function IsUser($phone)
 {
     /*查询是否存在此账户*/
     $where = "where login_md5='" . md5($phone) . "'";
     $format = "select user_id from " . DB_PRE . "user_main %s limit 1 ";
     $sql = sprintf($format, $where);
     $res = parent::FetchOne($sql);
     if (is_array($res)) {
         return true;
     } else {
         return false;
     }
 }
Example #5
0
 /**
  *
  * @name u_Login
  * @param $login  email or phone num
  * @param $passwd
  * @param int $type=0  0 email, 1, phone
  * @param $sess_salt
  * @package user login action 使用 密码登录
  * @return  0 ok,  -1 login error, -2 salt error , -3 empty error
  */
 function u_Login($login, $passwd, $type = 0)
 {
     if (empty($login)) {
         return -1;
     }
     if (empty($passwd)) {
         return -2;
     }
     if ($type != 0 && $type != 1) {
         return -4;
     }
     /*查询是否存在此账户,且密码相等*/
     if ($type == 0) {
         $where = "where (email='" . $login . "' or login_md5='" . md5($login) . "') and password='******'";
     } else {
         if ($type == 1) {
             /*并验证验证码*/
             if ($this->u_checkVerify($login, $passwd)) {
                 $where = "where (email='" . $login . "' or login_md5='" . md5($login) . "')";
             } else {
                 return -3;
             }
         } else {
             /*其他全部抛弃*/
             return -4;
         }
     }
     /*查询是否存在此账户*/
     $format = "select user_id,  password, real_name, sex, email, mobile, login_md5 from " . DB_PRE . "user_main %s limit 1 ";
     $sql = sprintf($format, $where);
     $res = parent::FetchOne($sql);
     if (is_array($res)) {
         $ses["uid"] = $res['user_id'];
         $ses['name'] = $res['real_name'];
         $ses['sex'] = $res['sex'];
         $this->SetSessionInfo($ses);
         /**
          * 设置  BaseTheme 的全域名  cookie
          */
         setcookie(WEB_COOKIE_UID, $res['user_id'], time() + 31557600, "/", DOMAIN);
         setcookie(WEB_COOKIE_NAME, $res['real_name'], time() + 31557600, "/", DOMAIN);
         setcookie(WEB_COOKIE_SEX, $res['sex'], time() + 31557600, "/", DOMAIN);
         return 0;
     } else {
         return -1;
     }
 }
Example #6
0
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
Example #7
0
<?php

/**
 * HTW
 *
 * Main Functions
 */
require_once 'classes/sys/autoloader.php';
$tmpl = new BaseTheme();
$tmpl->debug(0)->adminBar(0)->addMenus(array(array('main' => 'Main Menu')))->addShortcodes(array(array('button' => function ($args, $content = '') {
    return '<a href="' . $args['url'] . '" class="button ' . $args['style'] . '">' . $content . '</a>';
}, 'lead' => function ($args, $content = '') {
    return '<p class="lead">' . $content . '</p>';
}, 'grid' => function ($args, $content) {
    return '<div class="grid grid-' . $args['cols'] . '">' . do_shortcode($content) . '</div>';
}, 'grid_item' => function ($args, $content) {
    return '<div class="item">' . do_shortcode($content) . '</div>';
}, 'list_x' => function ($args, $content) {
    ob_start();
    $type = $args['type'];
    echo '<div class="row list-type ', $type, '">';
    Template::loop($type, array('post_type' => $type));
    echo '</div>';
    return ob_get_clean();
})))->render();
 public function save(Doctrine_Connection $conn = null)
 {
     if (!$this->exists()) {
         $this->setCreatedAt(date('Y-m-d H:i:s'));
     }
     $modified = $this->getModified();
     if (!isset($modified['downloads']) && !isset($modified['rating'])) {
         $this->setUpdatedAt(date('Y-m-d H:i:s'));
     }
     parent::save($conn);
 }
Example #9
0
 private function newBlog()
 {
     $sql = "select id,title,`desc`,img,ctime from blog order by ctime desc limit 6;";
     $res = parent::FetchArray($sql);
     return $res;
 }
Example #10
0
 private function click()
 {
     $format = 'select id,title,auth from blog  order by rand() desc LIMIT 3';
     $res = parent::FetchArray($format);
     return $res;
 }
Example #11
0
 private function queryCommendVideo()
 {
     $video = array();
     $sql_top = "SELECT fid , title ,link,flashurl ,titlepic,flashtime,flashsay,addtime FROM  " . DB_PRE . "flash WHERE `is_display` = '1' ORDER BY fid DESC  LIMIT 5  ";
     $video = parent::FetchArray($sql_top);
     return $video;
 }
Example #12
0
 /**
  * 入口文件
  * @see PPL/class/BaseTheme::Show()
  * @param
  */
 public function Show($arg = NULL)
 {
     global $router, $match;
     require_once parent::view();
 }
Example #13
0
 public function search($arg)
 {
     $this->checkRole(__FUNCTION__);
     $this->log->saveLog(parent::acl_getUid(), 4);
 }