コード例 #1
0
 public function __construct($weblog_id)
 {
     $sql = "SELECT blg_id, blg_uid, blg_name, blg_title, blg_description, blg_portrait, blg_theme, blg_license, blg_license_show, blg_mode, blg_entries, blg_comments, blg_comment_permission, blg_links, blg_builds, blg_dirty, blg_ing, blg_created, blg_lastupdated, blg_lastbuilt, blg_expire, usr_id, usr_nick, usr_gender, usr_portrait, usr_created, usr_brief FROM babel_weblog, babel_user WHERE blg_uid = usr_id AND blg_id = {$weblog_id}";
     $rs = mysql_query($sql);
     if (mysql_num_rows($rs) == 1) {
         $this->weblog = true;
         $_weblog = mysql_fetch_array($rs);
         $this->blg_id = intval($_weblog['blg_id']);
         $this->blg_uid = intval($_weblog['blg_uid']);
         $this->blg_name = $_weblog['blg_name'];
         $this->blg_title = $_weblog['blg_title'];
         $this->blg_title_plain = make_plaintext($_weblog['blg_title']);
         $this->blg_description = $_weblog['blg_description'];
         $this->blg_portrait = $_weblog['blg_portrait'];
         $this->blg_theme = $_weblog['blg_theme'];
         $this->blg_license = $_weblog['blg_license'];
         if ($this->blg_license == '') {
             $this->blg_license = Weblog::vxGetDefaultLicense();
         }
         $this->blg_license_show = intval($_weblog['blg_license_show']);
         $this->blg_mode = intval($_weblog['blg_mode']);
         $this->blg_entries = intval($_weblog['blg_entries']);
         $this->blg_comments = intval($_weblog['blg_comments']);
         $this->blg_comment_permission = intval($_weblog['blg_comment_permission']);
         if ($_weblog['blg_links'] != '') {
             $this->blg_links = unserialize($_weblog['blg_links']);
         } else {
             $this->blg_links = array();
         }
         $this->blg_builds = intval($_weblog['blg_builds']);
         $this->blg_dirty = intval($_weblog['blg_dirty']);
         $this->blg_ing = intval($_weblog['blg_ing']);
         $this->blg_created = intval($_weblog['blg_created']);
         $this->blg_lastupdated = intval($_weblog['blg_lastupdated']);
         $this->blg_lastbuilt = intval($_weblog['blg_lastbuilt']);
         $this->blg_expire = intval($_weblog['blg_expire']);
         $this->usr_id = $_weblog['usr_id'];
         $this->usr_nick = $_weblog['usr_nick'];
         $this->usr_brief = $_weblog['usr_brief'];
         $this->usr_gender = $_weblog['usr_gender'];
         $this->usr_portrait = $_weblog['usr_portrait'];
         $this->usr_created = intval($_weblog['usr_created']);
         mysql_free_result($rs);
         unset($_weblog);
     } else {
         $this->weblog = false;
     }
 }
コード例 #2
0
 public function vxBlogConfigCheck($user_money, $weblog_id)
 {
     $rt = array();
     $rt['weblog_id'] = $weblog_id;
     $rt['errors'] = 0;
     $rt['out_of_money'] = 0;
     /* blg_title (max: 50) */
     $rt['blg_title_value'] = '';
     $rt['blg_title_maxlength'] = 50;
     $rt['blg_title_error'] = 0;
     $rt['blg_title_error_msg'] = array(1 => '你没有写博客的标题', 2 => '你输入的博客的标题过长');
     if (isset($_POST['blg_title'])) {
         $rt['blg_title_value'] = fetch_single($_POST['blg_title']);
         if ($rt['blg_title_value'] == '') {
             $rt['errors']++;
             $rt['blg_title_error'] = 1;
         } else {
             if (mb_strlen($rt['blg_title_value'], 'UTF-8') > $rt['blg_title_maxlength']) {
                 $rt['errors']++;
                 $rt['blg_title_error'] = 2;
             }
         }
     } else {
         $rt['errors']++;
         $rt['blg_title_error'] = 1;
     }
     /* blg_description (null) (text) */
     $rt['blg_description_value'] = '';
     $rt['blg_description_maxlength'] = 2000;
     $rt['blg_description_error'] = 0;
     $rt['blg_description_error_msg'] = array(2 => '你输入的博客的简介过长');
     if (isset($_POST['blg_description'])) {
         $rt['blg_description_value'] = fetch_multi($_POST['blg_description']);
         if (mb_strlen($rt['blg_description_value'], 'UTF-8') > $rt['blg_description_maxlength']) {
             $rt['errors']++;
             $rt['blg_description_error'] = 2;
         }
     }
     /* blg_mode */
     $_modes = Weblog::vxGetEditorModes();
     $mode_default = Weblog::vxGetDefaultEditorMode();
     $rt['blg_mode_value'] = $mode_default;
     if (isset($_POST['blg_mode'])) {
         $rt['blg_mode_value'] = intval($_POST['blg_mode']);
         if (!in_array($rt['blg_mode_value'], array_keys($_modes))) {
             $rt['blg_mode_value'] = $mode_default;
         }
     }
     /* blg_comment_permission */
     $_comment_permissions = Weblog::vxGetCommentPermissions();
     $comment_permission_default = Weblog::vxGetDefaultCommentPermission();
     $rt['blg_comment_permission_value'] = $comment_permission_default;
     if (isset($_POST['blg_comment_permission'])) {
         $rt['blg_comment_permission_value'] = intval($_POST['blg_comment_permission']);
         if (!in_array($rt['blg_comment_permission_value'], array_keys($_comment_permissions))) {
             $rt['blg_comment_permission_value'] = $comment_permission_default;
         }
     }
     /* blg_license */
     $_licenses = Weblog::vxGetLicenses();
     $license_default = Weblog::vxGetDefaultLicense();
     $rt['blg_license_value'] = $license_default;
     if (isset($_POST['blg_license'])) {
         $rt['blg_license_value'] = fetch_single($_POST['blg_license']);
         if (!array_key_exists($rt['blg_license_value'], $_licenses)) {
             $rt['blg_license_value'] = $license_default;
         }
     }
     /* blg_ing */
     $rt['blg_ing_value'] = 0;
     if (isset($_POST['blg_ing'])) {
         $rt['blg_ing_value'] = intval($_POST['blg_ing']);
         if ($rt['blg_ing_value'] != 0 && $rt['blg_ing_value'] != 1) {
             $rt['blg_ing_value'] = 0;
         }
     }
     /* blg_license_show */
     $rt['blg_license_show_value'] = 0;
     if (isset($_POST['blg_license_show'])) {
         $rt['blg_license_show_value'] = intval($_POST['blg_license_show']);
         if ($rt['blg_license_show_value'] != 0 && $rt['blg_license_show_value'] != 1) {
             $rt['blg_license_show_value'] = 0;
         }
     }
     return $rt;
 }