Пример #1
0
 public function vxBlogConfig($Weblog)
 {
     $_modes = Weblog::vxGetEditorModes();
     $_comment_permissions = Weblog::vxGetCommentPermissions();
     $_licenses = Weblog::vxGetLicenses();
     _v_m_s();
     echo '<link type="text/css" rel="stylesheet" href="/css/themes/' . BABEL_THEME . '/css_weblog.css" />';
     _v_b_l_s();
     _v_ico_map();
     echo ' <a href="/">' . Vocabulary::site_name . '</a> &gt; ' . $this->User->usr_nick_plain . ' &gt; <a href="/blog/admin.vx">博客网志</a> &gt; <a href="/blog/' . Weblog::DEFAULT_ACTION . '/' . $Weblog->blg_id . '.vx">' . make_plaintext($Weblog->blg_title) . '</a> &gt; 设置 <span class="tip_i"><small>alpha</small></span>';
     _v_d_e();
     _v_b_l_s();
     _v_ico_silk('cog_edit');
     echo ' 设置博客网站';
     _v_hr();
     echo '<table cellpadding="5" cellspacing="0" border="0" class="form">';
     echo '<form action="/blog/config/save/' . $Weblog->blg_id . '.vx" method="post" id="form_blog_config">';
     echo '<tr><td width="100" align="right">访问地址</td><td width="400" align="left"><a href="http://' . BABEL_WEBLOG_SITE . '/' . $Weblog->blg_name . '" target="_blank">http://' . BABEL_WEBLOG_SITE . '/' . $Weblog->blg_name . '</a> <img src="/img/ext.png" align="absmiddle" /></td></tr>';
     echo '<tr><td width="100" align="right">标题</td><td width="400" align="left"><input onfocus="brightBox(this);" onblur="dimBox(this);" type="text" class="sll" name="blg_title" value="' . make_single_return($Weblog->blg_title, 0) . '" /></td></tr>';
     echo '<tr><td width="100" align="right" valign="top">简介</td><td width="400" align="left"><textarea onfocus="brightBox(this);" onblur="dimBox(this);" rows="10" class="ml" name="blg_description">' . make_multi_return($Weblog->blg_description, 0) . '</textarea></td></tr>';
     echo '<tr><td width="100" align="right">新文章格式</td><td width="400" align="left">';
     echo '<select name="blg_mode">';
     foreach ($_modes as $key => $mode) {
         if ($Weblog->blg_mode == $key) {
             echo '<option value="' . $key . '" selected="selected">' . $mode . '</option>';
         } else {
             echo '<option value="' . $key . '">' . $mode . '</option>';
         }
     }
     echo '</select>';
     echo '</td></tr>';
     echo '<tr><td width="100" align="right" valign="top">默认评论许可</td><td width="400" align="left">';
     echo '<select name="blg_comment_permission">';
     foreach ($_comment_permissions as $key => $comment_permission) {
         if ($Weblog->blg_comment_permission == $key) {
             echo '<option value="' . $key . '" selected="selected">' . $comment_permission . '</option>';
         } else {
             echo '<option value="' . $key . '">' . $comment_permission . '</option>';
         }
     }
     echo '</select>';
     echo '</td>';
     echo '</tr>';
     echo '<tr><td width="100" align="right" valign="top">授权协议</td><td width="400" align="left">';
     echo '<select name="blg_license">';
     foreach ($_licenses as $name => $license) {
         if ($Weblog->blg_license == $name) {
             echo '<option value="' . $name . '" selected="selected">' . $license . '</option>';
         } else {
             echo '<option value="' . $name . '">' . $license . '</option>';
         }
     }
     echo '</select>';
     echo ' ';
     echo '<a href="http://creativecommons.org/about/licenses/meet-the-licenses" target="_blank">';
     _v_ico_silk('information');
     echo '</a>';
     echo '</td>';
     echo '</tr>';
     echo '<tr>';
     echo '<td width="100" align="right" valign="top"></td>';
     echo '<td width="400" align="left"><span class="text">';
     if ($Weblog->blg_license_show == 1) {
         echo '<input type="radio" checked="checked" name="blg_license_show" value="1" /> 显示';
         echo '&nbsp;&nbsp;<input type="radio" name="blg_license_show" value="0" /> 不显示';
     } else {
         echo '<input type="radio" name="blg_license_show" value="1" /> 显示';
         echo '&nbsp;&nbsp;<input type="radio" checked="checked" name="blg_license_show" value="0" /> 不显示';
     }
     echo '</span></td>';
     echo '</tr>';
     echo '<tr>';
     echo '<td width="100" align="right" valign="top"><a href="/ing/' . $this->User->usr_nick_url . '" class="regular">ING</a> 集成</td>';
     echo '<td width="400" align="left"><span class="text">';
     if ($Weblog->blg_ing == 1) {
         echo '<input type="radio" checked="checked" name="blg_ing" value="1" /> 启用';
         echo '&nbsp;&nbsp;<input type="radio" name="blg_ing" value="0" /> 关闭';
     } else {
         echo '<input type="radio" name="blg_ing" value="1" /> 启用';
         echo '&nbsp;&nbsp;<input type="radio" checked="checked" name="blg_ing" value="0" /> 关闭';
     }
     echo '</span></td>';
     echo '</tr>';
     echo '<tr><td width="500" colspan="3" valign="middle" align="right">';
     _v_btn_f('更新设置', 'form_blog_config');
     echo '</td></tr>';
     echo '</form>';
     echo '</table>';
     _v_hr();
     _v_ico_silk('information');
     echo ' 更新设置后将需要重新构建';
     _v_d_e();
     _v_d_e();
 }
Пример #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;
 }