Changeset 2566:9bf417837888 for plugins/pages
- Timestamp:
- 11/17/13 20:25:53 (12 years ago)
- Branch:
- 2.6
- Children:
- 2567:6c11245cbf04, 2568:61c67a7d17fa
- Location:
- plugins/pages
- Files:
-
- 10 edited
-
_admin.php (modified) (1 diff)
-
_install.php (modified) (1 diff)
-
_public.php (modified) (17 diffs)
-
_users_actions.js (modified) (3 diffs)
-
_widgets.php (modified) (2 diffs)
-
class.actionpage.php (modified) (3 diffs)
-
class.listpage.php (modified) (7 diffs)
-
default-templates/page.html (modified) (13 diffs)
-
list.js (modified) (6 diffs)
-
list.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
plugins/pages/_admin.php
r2246 r2566 77 77 78 78 require dirname(__FILE__).'/_widgets.php'; 79 ?> -
plugins/pages/_install.php
r2307 r2566 52 52 $core->setVersion('pages',$version); 53 53 return true; 54 ?> -
plugins/pages/_public.php
r1674 r2566 30 30 $_ctx =& $GLOBALS['_ctx']; 31 31 $core =& $GLOBALS['core']; 32 32 33 33 $core->blog->withoutPassword(false); 34 34 35 35 $params = new ArrayObject(array( 36 36 'post_type' => 'page', 37 37 'post_url' => $args)); 38 38 39 39 $core->callBehavior('publicPagesBeforeGetPosts',$params,$args); 40 40 41 41 $_ctx->posts = $core->blog->getPosts($params); 42 42 43 43 $_ctx->comment_preview = new ArrayObject(); 44 44 $_ctx->comment_preview['content'] = ''; … … 49 49 $_ctx->comment_preview['preview'] = false; 50 50 $_ctx->comment_preview['remember'] = false; 51 51 52 52 $core->blog->withoutPassword(true); 53 54 53 54 55 55 if ($_ctx->posts->isEmpty()) 56 56 { … … 62 62 $post_id = $_ctx->posts->post_id; 63 63 $post_password = $_ctx->posts->post_password; 64 64 65 65 # Password protected entry 66 66 if ($post_password != '' && !$_ctx->preview) … … 72 72 $pwd_cookie = array(); 73 73 } 74 74 75 75 # Check for match 76 76 if ((!empty($_POST['password']) && $_POST['password'] == $post_password) … … 86 86 } 87 87 } 88 88 89 89 $post_comment = 90 90 isset($_POST['c_name']) && isset($_POST['c_mail']) && 91 91 isset($_POST['c_site']) && isset($_POST['c_content']) && 92 92 $_ctx->posts->commentsActive(); 93 93 94 94 # Posting a comment 95 95 if ($post_comment) … … 103 103 exit; 104 104 } 105 105 106 106 $name = $_POST['c_name']; 107 107 $mail = $_POST['c_mail']; … … 109 109 $content = $_POST['c_content']; 110 110 $preview = !empty($_POST['preview']); 111 111 112 112 if ($content != '') 113 113 { … … 120 120 $content = $core->HTMLfilter($content); 121 121 } 122 122 123 123 $_ctx->comment_preview['content'] = $content; 124 124 $_ctx->comment_preview['rawcontent'] = $_POST['c_content']; … … 126 126 $_ctx->comment_preview['mail'] = $mail; 127 127 $_ctx->comment_preview['site'] = $site; 128 128 129 129 if ($preview) 130 130 { 131 131 # --BEHAVIOR-- publicBeforeCommentPreview 132 132 $core->callBehavior('publicBeforeCommentPreview',$_ctx->comment_preview); 133 133 134 134 $_ctx->comment_preview['preview'] = true; 135 135 } … … 145 145 $cur->comment_status = $core->blog->settings->system->comments_pub ? 1 : -1; 146 146 $cur->comment_ip = http::realIP(); 147 147 148 148 $redir = $_ctx->posts->getURL(); 149 149 $redir .= $core->blog->settings->system->url_scan == 'query_string' ? '&' : '?'; 150 150 151 151 try 152 152 { … … 154 154 throw new Exception(__('You must provide a valid email address.')); 155 155 } 156 156 157 157 # --BEHAVIOR-- publicBeforeCommentCreate 158 158 $core->callBehavior('publicBeforeCommentCreate',$cur); 159 if ($cur->post_id) { 159 if ($cur->post_id) { 160 160 $comment_id = $core->blog->addComment($cur); 161 161 162 162 # --BEHAVIOR-- publicAfterCommentCreate 163 163 $core->callBehavior('publicAfterCommentCreate',$cur,$comment_id); 164 164 } 165 165 166 166 if ($cur->comment_status == 1) { 167 167 $redir_arg = 'pub=1'; … … 169 169 $redir_arg = 'pub=0'; 170 170 } 171 171 172 172 header('Location: '.$redir.$redir_arg); 173 173 } … … 179 179 } 180 180 } 181 181 182 182 # The entry 183 183 if ($_ctx->posts->trackbacksActive()) { … … 189 189 } 190 190 } 191 191 192 192 public static function pagespreview($args) 193 193 { 194 194 $core = $GLOBALS['core']; 195 195 $_ctx = $GLOBALS['_ctx']; 196 196 197 197 if (!preg_match('#^(.+?)/([0-9a-z]{40})/(.+?)$#',$args,$m)) { 198 198 # The specified Preview URL is malformed. … … 223 223 { 224 224 global $core, $_ctx; 225 225 226 226 if (($w->homeonly == 1 && $core->url->type != 'default') || 227 227 ($w->homeonly == 2 && $core->url->type == 'default')) { 228 228 return; 229 229 } 230 230 231 231 $params['post_type'] = 'page'; 232 232 $params['limit'] = abs((integer) $w->limit); 233 233 $params['no_content'] = true; 234 234 $params['post_selected'] = false; 235 235 236 236 $sort = $w->sortby; 237 237 if (!in_array($sort,array('post_title','post_position','post_dt'))) { 238 238 $sort = 'post_title'; 239 239 } 240 240 241 241 $order = $w->orderby; 242 242 if ($order != 'asc') { … … 244 244 } 245 245 $params['order'] = $sort.' '.$order; 246 246 247 247 $rs = $core->blog->getPosts($params); 248 248 249 249 if ($rs->isEmpty()) { 250 250 return; 251 251 } 252 252 253 253 $res = 254 254 ($w->content_only ? '' : '<div class="pages'.($w->class ? ' '.html::escapeHTML($w->class) : '').'">'). 255 255 ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : ''). 256 256 '<ul>'; 257 257 258 258 while ($rs->fetch()) { 259 259 $class = ''; … … 264 264 html::escapeHTML($rs->post_title).'</a></li>'; 265 265 } 266 266 267 267 $res .= '</ul>'.($w->content_only ? '' : '</div>'); 268 268 269 269 return $res; 270 270 } 271 271 } 272 ?> -
plugins/pages/_users_actions.js
r1802 r2566 1 1 jQuery.fn.updatePagesPermissionsForm = function() { 2 2 return this.each(function() { 3 3 4 4 var perms = {}; 5 5 var re = /^perm\[(.+?)\]\[(.+?)\]$/; 6 6 var e,prop; 7 7 8 8 // Building a nice object of form elements 9 9 for (var i=0; i<this.elements.length; i++) { 10 10 e = this.elements[i]; 11 11 12 12 if (e.name == undefined) { 13 13 continue; … … 22 22 } 23 23 perms[prop[1]][prop[2]] = e; 24 24 25 25 // select related permissions for admin 26 26 if (prop[2] == 'admin') { … … 33 33 } 34 34 } 35 35 36 36 function admin(E,perms,re) { 37 37 P = E.name.match(re); 38 38 39 39 perms[P[1]]['pages'].checked = E.checked; 40 40 perms[P[1]]['pages'].disabled = E.checked; -
plugins/pages/_widgets.php
r2412 r2566 41 41 $w->pages->setting('class',__('CSS class:'),''); 42 42 } 43 43 44 44 public static function initDefaultWidgets($w,$d) 45 45 { … … 47 47 } 48 48 } 49 ?> -
plugins/pages/class.actionpage.php
r2256 r2566 30 30 ); 31 31 $this->endPage(); 32 } 32 } 33 33 public function beginPage($breadcrumb='',$head='') { 34 34 echo '<html><head><title>'.__('Pages').'</title>'. … … 40 40 41 41 } 42 42 43 43 public function endPage() { 44 44 echo '</body></html>'; … … 58 58 return parent::process(); 59 59 } 60 60 61 61 public static function doReorderPages($core, dcPostsActionsPage $ap, $post) { 62 62 foreach($post['order'] as $post_id => $value) { 63 63 if (!$core->auth->check('publish,contentadmin',$core->blog->id)) 64 64 throw new Exception(__('You are not allowed to change this entry status')); 65 65 66 66 $strReq = "WHERE blog_id = '".$core->con->escape($core->blog->id)."' ". 67 67 "AND post_id ".$core->con->in($post_id); 68 68 69 69 #If user can only publish, we need to check the post's owner 70 70 if (!$core->auth->check('contentadmin',$core->blog->id)) 71 71 $strReq .= "AND user_id = '".$core->con->escape($core->auth->userID())."' "; 72 72 73 73 $cur = $core->con->openCursor($core->prefix.'post'); 74 74 75 75 $cur->post_position = (integer) $value-1; 76 76 $cur->post_upddt = date('Y-m-d H:i:s'); 77 77 78 78 $cur->update($strReq); 79 79 $core->blog->triggerBlog(); 80 80 81 81 } 82 82 83 83 dcPage::addSuccessNotice(__('Selected pages have been successfully reordered.')); 84 84 $ap->redirect(false); 85 } 85 } 86 86 } 87 87 88 class DefaultPagesActions 88 class DefaultPagesActions 89 89 { 90 90 public static function adminPagesActionsPage($core, $ap) { -
plugins/pages/class.listpage.php
r2232 r2566 29 29 $entries[(integer)$v]=true; 30 30 } 31 } 31 } 32 32 $html_block = 33 33 '<div class="table-outer">'. … … 40 40 '<th scope="col">'.__('Status').'</th>'. 41 41 '</tr></thead><tbody id="pageslist">%s</tbody></table></div>'; 42 42 43 43 if ($enclose_block) { 44 44 $html_block = sprintf($enclose_block,$html_block); 45 45 } 46 46 47 47 echo $pager->getLinks(); 48 48 49 49 $blocks = explode('%s',$html_block); 50 50 51 51 echo $blocks[0]; 52 52 53 53 $count = 0; 54 54 while ($this->rs->fetch()) … … 57 57 $count ++; 58 58 } 59 59 60 60 echo $blocks[1]; 61 61 62 62 echo $pager->getLinks(); 63 63 } 64 64 } 65 65 66 66 private function postLine($count,$checked) 67 67 { … … 81 81 break; 82 82 } 83 83 84 84 $protected = ''; 85 85 if ($this->rs->post_password) { 86 86 $protected = sprintf($img,__('Protected'),'locker.png'); 87 87 } 88 88 89 89 $selected = ''; 90 90 if ($this->rs->post_selected) { 91 91 $selected = sprintf($img,__('Hidden'),'hidden.png'); 92 92 } 93 93 94 94 $attach = ''; 95 95 $nb_media = $this->rs->countMedia(); … … 98 98 $attach = sprintf($img,sprintf($attach_str,$nb_media),'attach.png'); 99 99 } 100 100 101 101 $res = '<tr class="line'.($this->rs->post_status != 1 ? ' offline' : '').'"'. 102 102 ' id="p'.$this->rs->post_id.'">'; 103 103 104 104 $res .= 105 105 '<td class="nowrap handle minimal">'.form::field(array('order['.$this->rs->post_id.']'),2,3,$count+1,'position','',false,'title="'.sprintf(__('position of %s'),html::escapeHTML($this->rs->post_title)).'"').'</td>'. … … 108 108 '<td class="maximal" scope="row"><a href="'.$this->core->getPostAdminURL($this->rs->post_type,$this->rs->post_id).'">'. 109 109 html::escapeHTML($this->rs->post_title).'</a></td>'. 110 '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).'</td>'. 110 '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).'</td>'. 111 111 '<td class="nowrap">'.$this->rs->user_id.'</td>'. 112 112 '<td class="nowrap count">'.$this->rs->nb_comment.'</td>'. … … 114 114 '<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.' '.$attach.'</td>'. 115 115 '</tr>'; 116 116 117 117 return $res; 118 118 } -
plugins/pages/default-templates/page.html
r1674 r2566 5 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 6 6 <meta name="ROBOTS" content="{{tpl:BlogMetaRobots}}" /> 7 7 8 8 <title>{{tpl:EntryTitle encode_html="1"}} - {{tpl:BlogName encode_html="1"}}</title> 9 9 <meta name="description" lang="{{tpl:EntryLang}}" content="{{tpl:EntryContent full="1" encode_html="1" remove_html="1" cut_string="180"}}" /> … … 11 11 <meta name="author" content="{{tpl:EntryAuthorCommonName encode_html="1"}}" /> 12 12 <meta name="date" scheme="W3CDTF" content="{{tpl:EntryDate iso8601="1"}}" /> 13 13 14 14 <link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" /> 15 15 <meta name="dc.title" content="{{tpl:EntryTitle encode_html="1"}}" /> … … 22 22 <meta name="dc.type" content="text" /> 23 23 <meta name="dc.format" content="text/html" /> 24 24 25 25 <link rel="top" href="{{tpl:BlogURL}}" title="{{tpl:lang Home}}" /> 26 26 <link rel="contents" href="{{tpl:BlogArchiveURL}}" title="{{tpl:lang Archives}}" /> 27 27 <tpl:EntryIf pings_active="1"><link rel="pingback" href="{{tpl:BlogXMLRPCURL}}" /></tpl:EntryIf> 28 28 29 29 <link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="{{tpl:BlogFeedURL type="atom"}}" /> 30 30 31 31 {{tpl:include src="_head.html"}} 32 32 33 33 <script type="text/javascript" src="{{tpl:BlogThemeURL}}/../default/js/post.js"></script> 34 34 <script type="text/javascript"> … … 49 49 <div id="main"> 50 50 <div id="content"> 51 51 52 52 <div id="p{{tpl:EntryID}}" class="post"> 53 53 <h2 class="post-title">{{tpl:EntryTitle encode_html="1"}}</h2> 54 54 55 55 <!-- # --BEHAVIOR-- publicEntryBeforeContent --> 56 56 {{tpl:SysBehavior behavior="publicEntryBeforeContent"}} 57 57 58 58 <tpl:EntryIf extended="1"> 59 59 <div class="post-excerpt">{{tpl:EntryExcerpt}}</div> 60 60 </tpl:EntryIf> 61 61 <div class="post-content">{{tpl:EntryContent}}</div> 62 62 63 63 <p class="page-info">{{tpl:lang Published on}} {{tpl:EntryDate}} 64 64 {{tpl:lang by}} {{tpl:EntryAuthorLink}}</p> 65 65 66 66 <!-- # --BEHAVIOR-- publicEntryAfterContent --> 67 67 {{tpl:SysBehavior behavior="publicEntryAfterContent"}} 68 68 </div> 69 69 70 70 <!-- # Attachments --> 71 71 <tpl:Attachments> … … 77 77 <li class="{{tpl:AttachmentType}}"> 78 78 <tpl:AttachmentIf is_mp3="1"> 79 {{tpl:include src="_mp3_player.html"/}} - 79 {{tpl:include src="_mp3_player.html"/}} - 80 80 </tpl:AttachmentIf> 81 81 <tpl:AttachmentIf is_flv="1"> … … 92 92 </tpl:AttachmentsFooter> 93 93 </tpl:Attachments> 94 94 95 95 <!-- # Comments --> 96 96 <tpl:EntryIf show_comments="1"> … … 105 105 {{tpl:lang On}} {{tpl:CommentDate}}, {{tpl:CommentTime}} 106 106 {{tpl:lang by}} {{tpl:CommentAuthorLink}}</dt> 107 107 108 108 <dd class="{{tpl:CommentIfMe}} {{tpl:CommentIfOdd}} {{tpl:CommentIfFirst}}"> 109 109 <!-- # --BEHAVIOR-- publicCommentBeforeContent --> 110 110 {{tpl:SysBehavior behavior="publicCommentBeforeContent"}} 111 111 112 112 {{tpl:CommentContent}} 113 113 114 114 <!-- # --BEHAVIOR-- publicCommentAfterContent --> 115 115 {{tpl:SysBehavior behavior="publicCommentAfterContent"}} … … 121 121 </tpl:Comments> 122 122 </tpl:EntryIf> 123 124 <tpl:EntryIf comments_active="1"> 123 124 <tpl:EntryIf comments_active="1"> 125 125 <tpl:SysIfFormError> 126 126 <p class="error" id="pr">{{tpl:SysFormError}}</p> 127 127 </tpl:SysIfFormError> 128 128 129 129 <tpl:SysIfCommentPublished> 130 130 <p class="message" id="pr">{{tpl:lang Your comment has been published.}}</p> 131 131 </tpl:SysIfCommentPublished> 132 132 133 133 <tpl:SysIfCommentPending> 134 134 <p class="message" id="pr">{{tpl:lang Your comment has been submitted and 135 135 will be reviewed for publication.}}</p> 136 136 </tpl:SysIfCommentPending> 137 137 138 138 <!-- # Comment form --> 139 139 <form action="{{tpl:EntryURL}}#pr" method="post" id="comment-form"> … … 147 147 </div> 148 148 </tpl:IfCommentPreview> 149 149 150 150 <h3>{{tpl:lang Add a comment}}</h3> 151 151 <fieldset> 152 152 <!-- # --BEHAVIOR-- publicCommentFormBeforeContent --> 153 153 {{tpl:SysBehavior behavior="publicCommentFormBeforeContent"}} 154 154 155 155 <p class="field"><label for="c_name">{{tpl:lang Name or nickname}} :</label> 156 156 <input name="c_name" id="c_name" type="text" size="30" maxlength="255" 157 157 value="{{tpl:CommentPreviewName encode_html="1"}}" /> 158 158 </p> 159 159 160 160 <p class="field"><label for="c_mail">{{tpl:lang Email address}} :</label> 161 161 <input name="c_mail" id="c_mail" type="text" size="30" maxlength="255" 162 162 value="{{tpl:CommentPreviewEmail encode_html="1"}}" /> 163 163 </p> 164 164 165 165 <p class="field"><label for="c_site">{{tpl:lang Website}} ({{tpl:lang optional}}) :</label> 166 166 <input name="c_site" id="c_site" type="text" size="30" maxlength="255" 167 167 value="{{tpl:CommentPreviewSite encode_html="1"}}" /> 168 168 </p> 169 169 170 170 <p style="display:none"><input name="f_mail" type="text" size="30" 171 171 maxlength="255" value="" /></p> 172 172 173 173 <p class="field"><label for="c_content">{{tpl:lang Comment}} :</label> 174 174 <textarea name="c_content" id="c_content" cols="35" 175 175 rows="7">{{tpl:CommentPreviewContent raw="1" encode_html="1"}}</textarea> 176 176 </p> 177 177 178 178 <p class="form-help">{{tpl:CommentHelp}}</p> 179 179 180 180 <!-- # --BEHAVIOR-- publicCommentFormAfterContent --> 181 181 {{tpl:SysBehavior behavior="publicCommentFormAfterContent"}} 182 182 </fieldset> 183 183 184 184 <fieldset> 185 185 <p class="buttons"><input type="submit" class="preview" name="preview" value="{{tpl:lang preview}}" /> … … 188 188 </form> 189 189 </tpl:EntryIf> 190 190 191 191 <!-- # Trackbacks --> 192 192 <tpl:EntryIf show_pings="1"> … … 201 201 {{tpl:lang On}} {{tpl:PingDate}}, {{tpl:PingTime}} 202 202 {{tpl:lang by}} {{tpl:PingBlogName encode_html="1"}}</dt> 203 203 204 204 <dd class="{{tpl:PingIfOdd}} {{tpl:PingIfFirst}}"> 205 205 <!-- # --BEHAVIOR-- publicPingBeforeContent --> 206 206 {{tpl:SysBehavior behavior="publicPingBeforeContent"}} 207 207 208 208 <p><a href="{{tpl:PingAuthorURL}}" 209 209 {{tpl:PingNoFollow}}>{{tpl:PingTitle encode_html="1"}}</a></p> 210 210 {{tpl:PingContent}} 211 211 212 212 <!-- # --BEHAVIOR-- publicPingAfterContent --> 213 213 {{tpl:SysBehavior behavior="publicPingAfterContent"}} … … 219 219 </div> 220 220 </tpl:EntryIf> 221 221 222 222 <tpl:EntryIf pings_active="1"> 223 223 <p id="ping-url">{{tpl:lang Trackback URL}} : {{tpl:EntryPingLink}}</p> 224 224 </tpl:EntryIf> 225 225 226 226 <tpl:EntryIf operator="or" comments_active="1" pings_active="1"> 227 227 <p id="comments-feed"><a class="feed" href="{{tpl:BlogFeedURL type="atom"}}/comments/{{tpl:EntryID}}" … … 235 235 {{tpl:Widgets type="nav"}} 236 236 </div> <!-- End #blognav --> 237 237 238 238 <div id="blogextra"> 239 239 {{tpl:Widgets type="extra"}} -
plugins/pages/list.js
r2531 r2566 3 3 var postId = $(line).attr('id').substr(1); 4 4 var tr = document.getElementById('pe'+postId); 5 5 6 6 if ( !tr && ( action == 'toggle' || action == 'open' ) ) { 7 7 tr = document.createElement('tr'); … … 11 11 td.className = 'expand'; 12 12 tr.appendChild(td); 13 13 14 14 // Get post content 15 15 $.get('services.php',{f:'getPostById', id: postId, post_type: ''},function(data) { 16 16 var rsp = $(data).children('rsp')[0]; 17 17 18 18 if (rsp.attributes[0].value == 'ok') { 19 19 var post = $(rsp).find('post_display_content').text(); 20 20 var post_excerpt = $(rsp).find('post_display_excerpt').text(); 21 21 var res = ''; 22 22 23 23 if (post) { 24 24 if (post_excerpt) { … … 32 32 } 33 33 }); 34 34 35 35 $(line).addClass('expand'); 36 36 line.parentNode.insertBefore(tr,line.nextSibling); … … 62 62 }); 63 63 $('#pageslist td input[type=checkbox]').enableShiftClick(); 64 64 65 65 $("#pageslist tr.line td:not(.expander)").mousedown(function(){ 66 66 $('#pageslist tr.line').each(function() { … … 70 70 $('#pageslist tr:not(.line)').remove(); 71 71 }); 72 72 73 73 $("#pageslist").sortable({ 74 74 cursor:'move', … … 86 86 $("#pageslist tr td input.position").hide(); 87 87 $("#pageslist tr td.handle").addClass('handler'); 88 88 89 89 $("form input[type=submit]").click(function() { 90 90 $("input[type=submit]", $(this).parents("form")).removeAttr("clicked"); 91 91 $(this).attr("clicked", "true"); 92 92 }) 93 93 94 94 $('#form-entries').submit(function() { 95 95 var action = $(this).find('select[name="action"]').val(); -
plugins/pages/list.php
r2442 r2566 89 89 $post_list->display($page,$nb_per_page, 90 90 '<form action="plugin.php" method="post" id="form-entries">'. 91 91 92 92 '%s'. 93 93 94 94 '<div class="two-cols">'. 95 95 '<p class="col checkboxes-helpers"></p>'. 96 96 97 97 '<p class="col right"><label for="action" class="classic">'.__('Selected pages action:').'</label> '. 98 98 form::combo('action',$pages_actions_page->getCombo()).
Note: See TracChangeset
for help on using the changeset viewer.
