More updates to rants and pages.
darkmorford -
3bbe234fe5bb
Not Reviewed
Show More
Add another comment
TODOs: 0 unresolved 0 Resolved
COMMENTS: 0 General 0 Inline
@@ -59,8 +59,6 if( $_POST ) {
59 59
60 60 adminhead('Edit Page');
61 61 adminmenu('manage-pages.php');
62
63
64 62 ?>
65 63
66 64 <script language="javascript" type="text/javascript" src="include/tiny_mce/tiny_mce.js"></script>
@@ -80,7 +78,7 tinyMCE.init({
80 78 theme_advanced_blockformats : "p,h3,h4,h5,h6",
81 79 theme_advanced_resizing : true,
82 80 theme_advanced_styles : "Spoiler=spoiler"
83
81
84 82 });
85 83 </script>
86 84
@@ -118,7 +118,7 if( $_POST ) {
118 118 foreach($_POST['delete_attachment'] as $attachment)
119 119 deleteattachment($attachment);
120 120
121 $existing_attachments = $mtdb->getAll('SELECT ra.id AS id, extension FROM rant_attachment ra JOIN media_t ON ra.media = media_t.id WHERE ra.rant = '.$rant->id.' ORDER BY id');
121 $existing_attachments = $dbConnection->fetchAll('SELECT ra.id AS id, extension FROM rant_attachment ra JOIN media_t ON ra.media = media_t.id WHERE ra.rant = ? ORDER BY id', array($rant->id));
122 122 for($i = 0; $i < count($existing_attachments); $i++) {
123 123 $rant->body = preg_replace('/(href|src)=\"([^\"]*?)\\{'.($i+1).'\\}(.*?)\"/', '\1="'.get_rantattachment_filename($existing_attachments[$i]->id).'"', $rant->body);
124 124 }
@@ -218,7 +218,7 tinyMCE.init({
218 218 <fieldset id="authordiv" class="dbx-box">
219 219 <h3 class="dbx-handle">Author</h3>
220 220 <div class="dbx-content"><select name="rant_author"><?php
221 $contrib = $mtdb->getAll('select id,name from contributor');
221 $contrib = $dbConnection->fetchAll('SELECT id, name FROM contributor');
222 222 foreach( $contrib as $k=>$v ) {
223 223 printf('<option value="%s" %s>%s</option>', htmlentities($v->id, ENT_COMPAT, 'UTF-8'), ( $v->id == $rant->author ? 'selected="selected"' : '' ), htmlentities($v->name) );
224 224 } ?>
@@ -324,7 +324,7 tinyMCE.init({
324 324 <p>Attach files:</p>
325 325 <ol id="rant_attachment_list">
326 326 <?php
327 $attachments = $mtdb->getAll('SELECT ra.id AS id, extension FROM rant_attachment ra JOIN media_t ON ra.media = media_t.id WHERE ra.rant = '.$rant->id.' ORDER BY id');
327 $attachments = $dbConnection->fetchAll('SELECT ra.id AS id, extension FROM rant_attachment ra JOIN media_t ON ra.media = media_t.id WHERE ra.rant = ? ORDER BY id', array($rant->id));
328 328 foreach($attachments as $k=>$v)
329 329 printf('<li><input type="checkbox" name="delete_attachment[]" value="%d" /> <a href="%s/%s/%s">%s</a></li>', $v->id, SITE_HOST, SITE_PATH, get_rantattachment_filename($v->id), get_rantattachment_filename($v->id));
330 330 ?>
@@ -17,10 +17,10 $page = 1;
17 17 if( isset($_GET['page'] )) $page = (int) $_GET['page'];
18 18
19 19 $perpage = 15;
20 $start = ($page-1) * $perpage;
20 $start = ($page - 1) * $perpage;
21 21
22 $total = ceil( $mtdb->getOne("SELECT count(DISTINCT url_name) FROM static_page") / $perpage );
23 $pages = $mtdb->getAll("SELECT url_name, pubdate, status, title, body FROM static_page ORDER BY url_name ASC LIMIT $start,$perpage");
22 $total = ceil( $dbConnection->fetchColumn('SELECT COUNT(url_name) FROM static_page') / $perpage );
23 $pages = $dbConnection->fetchAll('SELECT url_name, pubdate, status, title, body FROM static_page ORDER BY url_name ASC LIMIT ?, ?', array($start, $perpage));
24 24
25 25 pagination( $page, $total );
26 26
@@ -17,10 +17,10 $page = 1;
17 17 if( isset($_GET['page'] )) $page = (int) $_GET['page'];
18 18
19 19 $perpage = 15;
20 $start = ($page-1) * $perpage;
20 $start = ($page - 1) * $perpage;
21 21
22 $total = ceil( $mtdb->getOne("SELECT count(DISTINCT id) FROM rant") / $perpage );
23 $rants = $mtdb->getAll("SELECT r.id,UNIX_TIMESTAMP(r.published) AS published,c.name,r.title,r.body, r.status FROM rant r,contributor c WHERE c.id=r.author GROUP BY id ORDER BY id DESC LIMIT $start,$perpage");
22 $total = ceil( $dbConnection->fetchColumn('SELECT COUNT(id) FROM rant') / $perpage );
23 $rants = $dbConnection->fetchAll('SELECT r.id, UNIX_TIMESTAMP(r.published) AS published, c.name, r.title, t.body, r.status FROM rant r JOIN contributor c ON r.author = c.id ORDER BY r.id DESC LIMIT ?, ?', array($start, $perpage));
24 24
25 25 pagination( $page, $total );
26 26
@@ -11,7 +11,7 auth_redirect(); // Require logged in user to access this page.
11 11 adminhead('Write Rant');
12 12 adminmenu('post-rant.php');
13 13
14 $rant_image_ext = $mtdb->getOne( 'SELECT extension FROM media_t WHERE id=' . (int)$currentuser->imagetype );
14 $rant_image_ext = $dbConnection->fetchColumn('SELECT extension FROM media_t WHERE id = ?', array((int)$currentuser->imagetype));
15 15
16 16 ?>
17 17
@@ -58,10 +58,10 tinyMCE.init({
58 58 <div class="dbx-content"><select name="rant_side">
59 59 <?php
60 60 // What side does this author usually post on?
61 $usual = $mtdb->getOne( 'SELECT side,count(*) c FROM rant WHERE author=' . (int)$currentuser->id . ' GROUP BY side ORDER BY c DESC limit 1' );
61 $usual = $dbConnection->fetchColumn('SELECT side, COUNT(*) AS c FROM rant WHERE author = ? GROUP BY side ORDER BY c DESC LIMIT 1', array((int)$currentuser->id));
62 62
63 $sides = array('left'=>'Left','right'=>'Right');
64 foreach( $sides as $k=>$v ) {
63 $sides = array('left'=>'Left', 'right'=>'Right');
64 foreach( $sides as $k => $v ) {
65 65 printf('<option value="%s" %s>%s</option>', htmlentities($k), ($usual == $k ? 'selected="selected"' : '' ), $v );
66 66 }
67 67 ?>
@@ -71,8 +71,9 tinyMCE.init({
71 71 <fieldset id="authordiv" class="dbx-box">
72 72 <h3 class="dbx-handle">Author</h3>
73 73 <div class="dbx-content"><select name="rant_author"><?php
74 $contrib = $mtdb->getAll('select id,name from contributor');
75 foreach( $contrib as $k=>$v ) {
74 $contrib = $dbConnection->fetchAll('SELECT id, name FROM contributor');
75 foreach( $contrib as $k => $v )
76 {
76 77 printf('<option value="%s" %s>%s</option>', htmlentities($v->id), ( $currentuser->id == $v->id ? 'selected="selected"' : '' ), $v->name );
77 78 } ?>
78 79 </select></div>
Comments 0
You need to be logged in to leave comments. Login now