Esempio n. 1
0
 public function vxAddSave()
 {
     _v_m_s();
     _v_b_l_s();
     _v_ico_map();
     echo ' <a href="/">' . Vocabulary::site_name . '</a> &gt; ' . $this->User->usr_nick_plain . ' &gt; ADD &gt; 添加新收藏 <span class="tip_i"><small>alpha</small></span>';
     _v_d_e();
     _v_b_l_s();
     echo '<div style="float: right; padding: 3px 10px 3px 10px; font-size: 12px; background-color: #F0F0F0; -moz-border-radius: 5px; color: #999;">';
     echo '<a href="/add">热门收藏</a> | <a href="/buttons/add">安装浏览器按钮</a>';
     echo ' | <a href="/add/own">我的收藏</a> | 添加新收藏';
     if (BABEL_FEATURE_ADD_SYNC) {
         echo ' | <a href="/sync/add">同步</a>';
     }
     echo '&nbsp;&nbsp;<a href="/feed/add">' . _vo_ico_silk('feed') . '</a>';
     echo '</div>';
     echo '<span class="text_large">';
     _v_ico_silk('add');
     echo ' ADD/New</span>';
     echo ' <span class="tip_i">';
     echo ' 添加新的收藏 ...';
     echo '</span>';
     _v_hr();
     $parameters = Bookmark::vxValidate();
     if ($parameters['errors'] > 0) {
         echo '添加一个新的网址,粗体带有 * 号的部分是必填的。';
         echo '<div style="padding: 20px 0px 10px 40px; font-family: Courier;">';
         echo '<form style="padding: 0px; margin: 0px; display: inline;" id="add_add" action="/babel" method="get">';
         echo '<input type="hidden" value="add_save" name="m" />';
         echo '<table width="550" cellpadding="0" cellspacing="0" border="0">';
         if (array_key_exists('url_value', $parameters)) {
             $value_url = make_single_return($parameters['url_value']);
         } else {
             $value_url = '';
         }
         echo '<tr>';
         echo '<td align="right" width="80" height="30"><strong>URL*</strong>&nbsp;</td>';
         echo '<td align="left" height="30"><input type="text" class="slll" name="url" value="' . $value_url . '" /></td>';
         echo '</tr>';
         if (array_key_exists('title_value', $parameters)) {
             $value_title = make_single_return($parameters['title_value']);
         } else {
             $value_title = '';
         }
         echo '<tr>';
         echo '<td align="right" width="80" height="30"><strong>标题*</strong>&nbsp;</td>';
         echo '<td align="left" height="30"><input type="text" class="slll" name="title" value="' . $value_title . '" /></td>';
         echo '</tr>';
         if (array_key_exists('notes_value', $parameters)) {
             $value_notes = make_single_return($parameters['notes_value']);
         } else {
             $value_notes = '';
         }
         echo '<tr>';
         echo '<td align="right" width="80" height="30">备注&nbsp;</td>';
         echo '<td align="left" height="30"><input type="text" class="slll" name="notes" value="' . $value_notes . '" /></td>';
         echo '</tr>';
         echo '<tr>';
         echo '<td align="right" width="80" height="30"></td>';
         echo '<td align="left" height="30">';
         _v_btn_f('保存', 'add_add');
         echo '</td>';
         echo '</tr>';
         echo '</table>';
         echo '</form>';
         echo '</div>';
     } else {
         $hash = $parameters['url_hash'];
         $url = mysql_real_escape_string($parameters['url_value']);
         $title = mysql_real_escape_string($parameters['title_value']);
         $notes = mysql_real_escape_string($parameters['notes_value']);
         $sql = 'SELECT url_id, url_uid, url_hash FROM babel_add_url WHERE url_uid = ' . $this->User->usr_id . ' AND url_hash = ' . "'" . $hash . "'";
         $rs = mysql_query($sql);
         if (mysql_num_rows($rs) == 1) {
             $updated = time();
             $sql = "UPDATE babel_add_url SET url_url = '{$url}', url_title = '{$title}', notes = '{$notes}' WHERE url_hash = '{$hash}' AND url_uid = {$this->User->usr_id}, url_lastupdated = {$updated}";
             mysql_query($sql);
         } else {
             $inserted = time();
             $sql = "INSERT INTO babel_add_url(url_uid, url_url, url_title, url_notes, url_hash, url_created, url_lastupdated) VALUES({$this->User->usr_id}, '{$url}', '{$title}', '{$notes}', '{$hash}', {$inserted}, {$inserted})";
             mysql_query($sql);
         }
         _v_ico_silk('emoticon_evilgrin');
         echo ' 收藏保存成功!接下来将自动回到你之前正在访问的网站,如果没有跳转,请点击 <a href="' . make_single_return($parameters['url_value']) . '" rel="nofollow" target="_self" class="t">这里</a>';
         echo '<script type="text/javascript">setTimeout("location.href = ' . "'" . $parameters['url_value'] . "'" . '", 31);</script>';
     }
     _v_hr();
     echo '<span class="tip_i">';
     _v_ico_silk('information');
     echo ' 每个加入收藏的书签将消耗 10 个铜币。';
     echo '</span>';
     _v_d_e();
     Widget::vxAddAbout();
     _v_d_e();
 }