Changeset 877:e012da998f83 for plugins/pages
- Timestamp:
- 08/16/12 14:13:27 (13 years ago)
- Branch:
- sexy
- Location:
- plugins/pages
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/pages/_public.php
r727 r877 61 61 { 62 62 $post_id = $_ctx->posts->post_id; 63 $post_password = $_ctx->posts->post_password;64 65 # Password protected entry66 if ($post_password != '' && !$_ctx->preview)67 {68 # Get passwords cookie69 if (isset($_COOKIE['dc_passwd'])) {70 $pwd_cookie = unserialize($_COOKIE['dc_passwd']);71 } else {72 $pwd_cookie = array();73 }74 75 # Check for match76 if ((!empty($_POST['password']) && $_POST['password'] == $post_password)77 || (isset($pwd_cookie[$post_id]) && $pwd_cookie[$post_id] == $post_password))78 {79 $pwd_cookie[$post_id] = $post_password;80 setcookie('dc_passwd',serialize($pwd_cookie),0,'/');81 }82 else83 {84 self::serveDocument('password-form.html','text/html',false);85 return;86 }87 }88 89 $post_comment =90 isset($_POST['c_name']) && isset($_POST['c_mail']) &&91 isset($_POST['c_site']) && isset($_POST['c_content']) &&92 $_ctx->posts->commentsActive();93 94 # Posting a comment95 if ($post_comment)96 {97 # Spam trap98 if (!empty($_POST['f_mail'])) {99 http::head(412,'Precondition Failed');100 header('Content-Type: text/plain');101 echo "So Long, and Thanks For All the Fish";102 # Exits immediately the application to preserve the server.103 exit;104 }105 106 $name = $_POST['c_name'];107 $mail = $_POST['c_mail'];108 $site = $_POST['c_site'];109 $content = $_POST['c_content'];110 $preview = !empty($_POST['preview']);111 112 if ($content != '')113 {114 if ($core->blog->settings->system->wiki_comments) {115 $core->initWikiComment();116 } else {117 $core->initWikiSimpleComment();118 }119 $content = $core->wikiTransform($content);120 $content = $core->HTMLfilter($content);121 }122 123 $_ctx->comment_preview['content'] = $content;124 $_ctx->comment_preview['rawcontent'] = $_POST['c_content'];125 $_ctx->comment_preview['name'] = $name;126 $_ctx->comment_preview['mail'] = $mail;127 $_ctx->comment_preview['site'] = $site;128 129 if ($preview)130 {131 # --BEHAVIOR-- publicBeforeCommentPreview132 $core->callBehavior('publicBeforeCommentPreview',$_ctx->comment_preview);133 134 $_ctx->comment_preview['preview'] = true;135 }136 else137 {138 # Post the comment139 $cur = $core->con->openCursor($core->prefix.'comment');140 $cur->comment_author = $name;141 $cur->comment_site = html::clean($site);142 $cur->comment_email = html::clean($mail);143 $cur->comment_content = $content;144 $cur->post_id = $_ctx->posts->post_id;145 $cur->comment_status = $core->blog->settings->system->comments_pub ? 1 : -1;146 $cur->comment_ip = http::realIP();147 148 $redir = $_ctx->posts->getURL();149 $redir .= $core->blog->settings->system->url_scan == 'query_string' ? '&' : '?';150 151 try152 {153 if (!text::isEmail($cur->comment_email)) {154 throw new Exception(__('You must provide a valid email address.'));155 }156 157 # --BEHAVIOR-- publicBeforeCommentCreate158 $core->callBehavior('publicBeforeCommentCreate',$cur);159 if ($cur->post_id) {160 $comment_id = $core->blog->addComment($cur);161 162 # --BEHAVIOR-- publicAfterCommentCreate163 $core->callBehavior('publicAfterCommentCreate',$cur,$comment_id);164 }165 166 if ($cur->comment_status == 1) {167 $redir_arg = 'pub=1';168 } else {169 $redir_arg = 'pub=0';170 }171 172 header('Location: '.$redir.$redir_arg);173 }174 catch (Exception $e)175 {176 $_ctx->form_error = $e->getMessage();177 $_ctx->form_error;178 }179 }180 }181 182 63 # The entry 183 64 $core->tpl->setPath($core->tpl->getPath(), dirname(__FILE__).'/default-templates'); -
plugins/pages/list.php
r578 r877 79 79 } 80 80 81 $protected = '';82 if ($this->rs->post_password) {83 $protected = sprintf($img,__('protected'),'locker.png');84 }85 86 81 $selected = ''; 87 82 if ($this->rs->post_selected) { … … 109 104 '<td class="nowrap">'.$this->rs->nb_comment.'</td>'. 110 105 '<td class="nowrap">'.$this->rs->nb_trackback.'</td>'. 111 '<td class="nowrap status">'.$img_status.' '.$selected.' '.$ protected.' '.$attach.'</td>'.106 '<td class="nowrap status">'.$img_status.' '.$selected.' '.$attach.'</td>'. 112 107 '</tr>'; 113 108 -
plugins/pages/page.php
r854 r877 18 18 $post_dt = ''; 19 19 $post_format = $core->auth->getOption('post_format'); 20 $post_password = '';21 20 $post_url = ''; 22 21 $post_lang = $core->auth->getInfo('user_lang'); … … 95 94 $post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); 96 95 $post_format = $post->post_format; 97 $post_password = $post->post_password;98 96 $post_url = $post->post_url; 99 97 $post_lang = $post->post_lang; … … 161 159 $post_open_tb = !empty($_POST['post_open_tb']); 162 160 $post_lang = $_POST['post_lang']; 163 $post_password = !empty($_POST['post_password']) ? $_POST['post_password'] : null;164 161 $post_position = (integer) $_POST['post_position']; 165 162 … … 188 185 $cur->post_dt = $post_dt ? date('Y-m-d H:i:00',strtotime($post_dt)) : ''; 189 186 $cur->post_format = $post_format; 190 $cur->post_password = $post_password;191 187 $cur->post_lang = $post_lang; 192 188 $cur->post_title = $post_title; … … 433 429 form::combo('post_lang',$lang_combo,$post_lang).'</label></p>'. 434 430 435 '<p><label for="post_password">'.__('Page password:').436 form::field('post_password',10,32,html::escapeHTML($post_password),'maximal').437 '</label></p>'.438 439 431 '<div class="lockable">'. 440 432 '<p><label for="post_url">'.__('Basename:').
Note: See TracChangeset
for help on using the changeset viewer.