Exemple #1
1
 public function Save()
 {
     if ($this->_POST) {
         $ID = _intval($this->_POST['ID'], true);
         $Data['Title'] = trim($this->_POST['Title']);
         $Data['Url'] = trim($this->_POST['Url']);
         $Data['Describe'] = trim($this->_POST['Describe']);
         $Data['DisplayOrder'] = _intval($this->_POST['DisplayOrder'], true);
         $Data['Property'] = _intval($this->_POST['Property'], true) ? 1 : 0;
         $Data['Status'] = _intval($this->_POST['Status'], true) ? 1 : 0;
         $Data['CategoryID'] = _intval($this->_POST['CategoryID'], true);
         if (!$ID) {
             $Data['Created'] = date('Y-m-d H:i:s', $this->timestamp);
             $Data['CreatedUserID'] = $this->UserID;
         } else {
             $Data['Modified'] = date('Y-m-d H:i:s', $this->timestamp);
             $Data['ModifiedUserID'] = $this->UserID;
         }
         $DB = new DB();
         if ($ID) {
             if ($DB->UpdateArray('tbl_links', $Data, array('ID' => $ID))) {
                 $this->__Message('修改友情链接成功!', UrlRewriteSimple('Links', 'Index', true), '继续操作');
             } else {
                 $this->__Message('修改友情链接失败,请再一次尝试!');
             }
         } else {
             if ($DB->insertArray('tbl_links', $Data)) {
                 $this->__Message('添加友情链接成功!', UrlRewriteSimple('Links', 'Index', true), '继续操作');
             } else {
                 $this->__Message('添加友情链接失败,请再一次尝试!');
             }
         }
     }
 }
 public function Update($Data)
 {
     if (!is_array($Data)) {
         return false;
     }
     if (!$Data['Keywords']) {
         return false;
     }
     $Keywords = $Data['Keywords'];
     $DB = new DB();
     $sql = 'SELECT Keywords,ArticleID FROM tbl_keywords WHERE Keywords=\'' . $Keywords . '\'';
     $RS = $DB->GetOne($sql);
     if ($RS) {
         unset($Data['Keywords']);
         if ($Data['ArticleID']) {
             if ($RS['ArticleID']) {
                 $tmpArticleID = explode(',', $RS['ArticleID']);
                 if (!in_array($Data['ArticleID'], $tmpArticleID)) {
                     $tmpArticleID[] = $Data['ArticleID'];
                     $Data['ArticleID'] = implode(',', $tmpArticleID);
                 } else {
                     unset($Data['ArticleID']);
                 }
             } else {
                 $Data['ArticleID'] = $Data['ArticleID'];
             }
         }
         return $DB->UpdateWhere('tbl_keywords', $Data, 'Keywords=\'' . $Keywords . '\'');
     } else {
         $Data['Created'] = date('Y-m-d H:i:s', time());
         return $DB->insertArray('tbl_keywords', $Data);
     }
 }
Exemple #3
0
 function Loginlogs()
 {
     $line['ip'] = GetIP();
     $line['time'] = date("Y-m-d H:i:s");
     $line['AgentID'] = $_SESSION['AgentID'];
     $DB = new DB();
     $DB->insertArray('tbl_loginlogs', $line);
 }
 public function Create($VariableName, $VariableValue, $VariableDescribe, $VariableType)
 {
     $DB = new DB();
     $ArrData = array('VariableName' => $VariableName, 'VariableValue' => $VariableValue, 'VariableDescribe' => $VariableDescribe, 'VariableType' => $VariableType ? 1 : 0);
     $RS = $DB->GetOne('select VariableName from tbl_variables where VariableName=\'' . $VariableName . '\'');
     if ($RS) {
         unset($ArrData['VariableName']);
         $result = $DB->UpdateWhere('tbl_variables', $ArrData, 'VariableName=\'' . $VariableName . '\'');
     } else {
         $result = $DB->insertArray('tbl_variables', $ArrData);
     }
     if ($result) {
         $this->UpdateCache();
     }
     return $result;
 }
Exemple #5
0
 public function InsertArray($Array = array(), $TureOrFalse = false)
 {
     $DB = new DB();
     return $DB->insertArray($this->TableName, $Array, $TureOrFalse);
 }
 function Save($Data, &$ArticleID)
 {
     $DB = new DB();
     if ($ArticleID) {
         return $DB->UpdateWhere('tbl_articles', $Data, 'ArticleID=' . $ArticleID);
     } else {
         return $ArticleID = $DB->insertArray('tbl_articles', $Data, true);
     }
 }
Exemple #7
0
 public function InsertArrayPackages($Array = array(), $TrueOrFalse = false)
 {
     $DB = new DB();
     return $DB->insertArray('tb_model_packages', $Array, $TrueOrFalse);
 }
Exemple #8
0
    public function GetWeatherYujing()
    {
        $Url = trim($this->_POST['Url']);
        if (empty($Url)) {
            $this->__Message('地址不能为空,请返回重新填写后提交!');
        }
        $Html = file_get_contents($Url);
        //$Html = mb_convert_encoding ( $Html, "UTF-8", "GBK" );
        $NeirongString = "/<p id=\"maintext\">(.*)<\\/p>/isU";
        preg_match_all($NeirongString, $Html, $NeirongArray);
        $RiqiString = "/<strong>时间:<\\/strong><span class=\"co_5\">(.*)<\\/span>/isU";
        preg_match_all($RiqiString, $Html, $RiqiArray);
        $XingzuoString = "/<strong>生肖:<\\/strong><span class=\"co_5\">(.*)<\\/span>/isU";
        preg_match_all($XingzuoString, $Html, $XingzuoArray);
        $Data['Title'] = trim($RiqiArray[1][0]) . trim($XingzuoArray[1][0]) . '运势';
        $Data['Title'] = str_replace("肖", "生肖", $Data['Title']);
        $Data['Content'] = '<strong>' . $Data['Title'] . '</strong><br />
	<br />
	' . trim($NeirongArray[1][0]);
        $Data['Content'] = str_replace("<br/>滴天居士http://www.sm500.com/qq1", "", $Data['Content']);
        $Data['Content'] = str_replace("爱情指数&nbsp;&nbsp;", "<strong>爱情指数</strong>&nbsp;&nbsp;", $Data['Content']);
        $Data['Content'] = str_replace("事业指数&nbsp;&nbsp;", "<strong>事业指数</strong>&nbsp;&nbsp;", $Data['Content']);
        $Data['Content'] = str_replace("财运指数&nbsp;&nbsp;", "<strong>财运指数</strong>&nbsp;&nbsp;", $Data['Content']);
        $Data['Content'] = str_replace("幸福开心指数&nbsp;&nbsp;", "<strong>幸福开心指数</strong>&nbsp;&nbsp;", $Data['Content']);
        $Data['CategoryID'] = 1006;
        $Data['UserID'] = 1001;
        $Data['CategoryIDS'] = '0,1006';
        $Data['Updated'] = date("Y-m-d H:i:s");
        $DB = new DB();
        $IsOk = $DB->insertArray('tbl_articles', $Data);
        if ($IsOk) {
            $this->__Message('操作完成!');
        } else {
            $this->__Message('操作错误,请返回重新填写后提交!');
        }
        exit;
    }
Exemple #9
0
 public function NewUserGroup($Data)
 {
     $DB = new DB();
     $r = $DB->insertArray('tbl_usergroups', $Data, true);
     if ($r) {
         $this->GetUserGroup($r, true);
     }
     return $r;
 }