Changeset 877:e012da998f83
- Timestamp:
- 08/16/12 14:13:27 (13 years ago)
- Branch:
- sexy
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/post.php
r873 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'); … … 90 89 $post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); 91 90 $post_format = $post->post_format; 92 $post_password = $post->post_password;93 91 $post_url = $post->post_url; 94 92 $post_lang = $post->post_lang; … … 149 147 $post_selected = !empty($_POST['post_selected']); 150 148 $post_lang = $_POST['post_lang']; 151 $post_password = !empty($_POST['post_password']) ? $_POST['post_password'] : null;152 149 153 150 $post_notes = $_POST['post_notes']; … … 171 168 $cur->post_dt = $post_dt ? date('Y-m-d H:i:00',strtotime($post_dt)) : ''; 172 169 $cur->post_format = $post_format; 173 $cur->post_password = $post_password;174 170 $cur->post_lang = $post_lang; 175 171 $cur->post_title = $post_title; … … 389 385 '</label></p>'. 390 386 391 '<p><label for="post_password">'.__('Entry password:').392 form::field('post_password',10,32,html::escapeHTML($post_password),'maximal').393 '</label></p>'.394 395 387 '<div class="lockable">'. 396 388 '<p><label for="post_url">'.__('Basename:'). -
inc/admin/lib.pager.php
r873 r877 90 90 } 91 91 92 $protected = '';93 if ($item->post_password) {94 $protected = sprintf($img,__('protected'),'locker.png');95 }96 97 92 $selected = ''; 98 93 if ($item->post_selected) { … … 111 106 '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$item->post_dt).'</td>'. 112 107 '<td class="nowrap">'.$item->user_id.'</td>'. 113 '<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.'</td>'.108 '<td class="nowrap status">'.$img_status.' '.$selected.'</td>'. 114 109 '</tr>'; 115 110 … … 180 175 } 181 176 182 $protected = '';183 if ($item->post_password) {184 $protected = sprintf($img,__('protected'),'locker.png');185 }186 187 177 $selected = ''; 188 178 if ($item->post_selected) { … … 200 190 '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$item->post_dt).'</td>'. 201 191 '<td class="nowrap">'.$item->user_id.'</td>'. 202 '<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.'</td>'.192 '<td class="nowrap status">'.$img_status.' '.$selected.'</td>'. 203 193 '</tr>'; 204 194 -
inc/core/class.dc.blog.php
r875 r877 227 227 $strReq = 228 228 'SELECT P.post_id, P.blog_id, P.user_id, post_dt, '. 229 'post_tz, post_creadt, post_upddt, post_format, post_password,'.229 'post_tz, post_creadt, post_upddt, post_format, '. 230 230 'post_url, post_lang, post_title, '.$content_req. 231 231 'post_type, post_meta, post_status, post_selected, post_position, '. … … 246 246 247 247 if (!$this->core->auth->check('contentadmin',$this->id)) { 248 $strReq .= 'AND ((post_status = 1 '; 249 250 if ($this->without_password) { 251 $strReq .= 'AND post_password IS NULL '; 252 } 253 $strReq .= ') '; 248 $strReq .= 'AND ((post_status = 1) '; 254 249 255 250 if ($this->core->auth->userID()) { … … 436 431 437 432 if (!$this->core->auth->check('contentadmin',$this->id)) { 438 $strReq .= 'AND ((post_status = 1 '; 439 440 if ($this->without_password) { 441 $strReq .= 'AND post_password IS NULL '; 442 } 443 $strReq .= ') '; 433 $strReq .= 'AND ((post_status = 1) '; 444 434 445 435 if ($this->core->auth->userID()) { … … 518 508 519 509 if (!$this->core->auth->check('contentadmin',$this->id)) { 520 $strReq .= 'AND ((post_status = 1 '; 521 522 if ($this->without_password) { 523 $strReq .= 'AND post_password IS NULL '; 524 } 525 $strReq .= ') '; 510 $strReq .= 'AND ((post_status = 1) '; 526 511 527 512 if ($this->core->auth->userID()) { … … 905 890 } 906 891 907 if ($cur->post_password === '') {908 $cur->post_password = null;909 }910 911 892 if ($cur->post_dt == '') { 912 893 $offset = dt::getTimeOffset($this->core->auth->getInfo('user_tz')); -
inc/core/class.dc.meta.php
r873 r877 317 317 318 318 if (!$this->core->auth->check('contentadmin',$this->core->blog->id)) { 319 $strReq .= 'AND ((post_status = 1 '; 320 321 if ($this->core->blog->without_password) { 322 $strReq .= 'AND post_password IS NULL '; 323 } 324 $strReq .= ') '; 319 $strReq .= 'AND ((post_status = 1) '; 325 320 326 321 if ($this->core->auth->userID()) { -
inc/core/class.dc.xmlrpc.php
r873 r877 305 305 } 306 306 307 if (isset($struct['wp_password'])) {308 $cur->post_password = $struct['wp_password'];309 }310 311 307 $cur->post_type = 'post'; 312 308 if (!empty($struct['post_type'])) { … … 398 394 if (isset($struct['wp_slug'])) { 399 395 $cur->post_url = $struct['wp_slug']; 400 }401 402 if (isset($struct['wp_password'])) {403 $cur->post_password = $struct['wp_password'];404 396 } 405 397 … … 728 720 "text_more" => '', 729 721 "wp_slug" => $post->post_url, 730 "wp_password" => $post->post_password,731 722 "wp_author" => $post->getAuthorCN(), 732 723 "wp_page_parent_id" => 0, -
inc/dbschema/db-schema.php
r852 r877 91 91 ->post_creadt ('timestamp', 0, false, 'now()') 92 92 ->post_upddt ('timestamp', 0, false, 'now()') 93 ->post_password ('varchar', 32, true, null)94 93 ->post_type ('varchar', 32, false, "'post'") 95 94 ->post_format ('varchar', 32, false, "'xhtml'") -
inc/public/lib.urlhandlers.php
r876 r877 315 315 { 316 316 $post_id = $_ctx->posts->post_id; 317 $post_password = $_ctx->posts->post_password;318 319 # Password protected entry320 if ($post_password != '' && !$_ctx->preview)321 {322 # Get passwords cookie323 if (isset($_COOKIE['dc_passwd'])) {324 $pwd_cookie = unserialize($_COOKIE['dc_passwd']);325 } else {326 $pwd_cookie = array();327 }328 329 # Check for match330 if ((!empty($_POST['password']) && $_POST['password'] == $post_password)331 || (isset($pwd_cookie[$post_id]) && $pwd_cookie[$post_id] == $post_password))332 {333 $pwd_cookie[$post_id] = $post_password;334 setcookie('dc_passwd',serialize($pwd_cookie),0,'/');335 }336 else337 {338 self::serveDocument('password-form.html','text/html',false);339 return;340 }341 }342 343 317 # The entry 344 318 self::serveDocument('post.html'); -
plugins/importExport/inc/flat/class.flat.import.php
r841 r877 440 440 } 441 441 442 $post_password = $post->post_password ? (string) $post->post_password : null;443 444 442 $this->cur_post->post_id = (integer) $post->post_id; 445 443 $this->cur_post->blog_id = (string) $post->blog_id; … … 449 447 $this->cur_post->post_creadt = (string) $post->post_creadt; 450 448 $this->cur_post->post_upddt = (string) $post->post_upddt; 451 $this->cur_post->post_password = $post_password;452 449 $this->cur_post->post_type = (string) $post->post_type; 453 450 $this->cur_post->post_format = (string) $post->post_format; -
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.