Beispiel #1
0
             break;
         }
     }
 case 'blog_config_save':
     if (!$p->User->vxIsLogin()) {
         if (isset($_GET['weblog_id'])) {
             $weblog_id = intval($_GET['weblog_id']);
             die($p->URL->vxToRedirect($p->URL->vxGetLogin($p->URL->vxGetBlogConfig($weblog_id))));
         } else {
             die($p->URL->vxToRedirect($p->URL->vxGetLogin($p->URL->vxGetBlogAdmin())));
         }
         break;
     } else {
         if (isset($_GET['weblog_id'])) {
             $weblog_id = intval($_GET['weblog_id']);
             if (Weblog::vxMatchWeblogPermission($p->User->usr_id, $weblog_id)) {
                 $rt = $p->Validator->vxBlogConfigCheck($p->User->usr_money, $weblog_id);
                 if ($rt['errors'] == 0) {
                     $p->Validator->vxBlogConfigUpdate($weblog_id, $rt['blg_title_value'], $rt['blg_description_value'], $rt['blg_mode_value'], $rt['blg_comment_permission_value'], $rt['blg_license_value'], $rt['blg_license_show_value'], $rt['blg_ing_value']);
                     die($p->URL->vxToRedirect($p->URL->vxGetBlogAdmin()));
                     break;
                 } else {
                     $p->vxHead($msgSiteTitle = '设置博客网站');
                     $p->vxBodyStart();
                     $p->vxTop();
                     $p->vxContainer('blog_config_save', $rt);
                     break;
                 }
             } else {
                 $_SESSION['babel_message_weblog'] = '你没有权力对这个博客网站进行操作';
                 die($p->URL->vxToRedirect($p->URL->vxGetBlogAdmin()));
 public function vxBlogPortraitSave()
 {
     if ($this->User->vxIsLogin()) {
         if (isset($_GET['weblog_id'])) {
             $weblog_id = intval($_GET['weblog_id']);
             if (Weblog::vxMatchWeblogPermission($this->User->usr_id, $weblog_id)) {
                 if (isset($_FILES['blg_portrait'])) {
                     $ul = $_FILES['blg_portrait'];
                     if (substr($ul['type'], 0, 5) == 'image') {
                         switch ($ul['type']) {
                             case 'image/jpeg':
                             case 'image/jpg':
                             case 'image/pjpeg':
                                 $ext = '.jpg';
                                 break;
                             case 'image/gif':
                                 $ext = '.gif';
                                 break;
                             case 'image/png':
                             case 'image/x-png':
                                 $ext = '.png';
                                 break;
                             default:
                                 header('Content-type: text/html; charset=UTF-8');
                                 echo "<script>alert('你传的不是图片吧?');location.href='" . $this->URL->vxGetBlogPortrait($weblog_id) . "'</script>";
                                 die('REDIRECTING...');
                                 break;
                         }
                         move_uploaded_file($ul["tmp_name"], BABEL_PREFIX . '/tmp/' . $weblog_id . $ext);
                         Image::vxGenBlogPortraits($ext, $weblog_id, $this->db);
                         unlink(BABEL_PREFIX . '/tmp/' . $weblog_id . $ext);
                         $sql = "UPDATE babel_weblog SET blg_portrait = blg_id WHERE blg_id = {$weblog_id} LIMIT 1";
                         mysql_query($sql, $this->db);
                         header('Content-type: text/html; charset=UTF-8');
                         echo "<script>alert('你的博客网站的图标已经成功设置!');location.href='" . $this->URL->vxGetBlogPortrait($weblog_id) . "'</script>";
                     } else {
                         header('Content-type: text/html; charset=UTF-8');
                         echo "<script>alert('你传的不是图片吧?');location.href='" . $this->URL->vxGetBlogPortrait($weblog_id) . "'</script>";
                         die('REDIRECTING...');
                     }
                 } else {
                     header('Location: ' . $this->URL->vxGetBlogPortrait($weblog_id));
                 }
             } else {
                 return js_alert('你没有权力对这个博客网站进行操作', '/blog/admin.vx');
             }
         } else {
             return js_alert('指定的博客网站没有找到', '/blog/admin.vx');
         }
     } else {
         return js_alert('你还没有登录,请登录之后再进行操作', '/blog/admin.vx');
     }
 }