| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | * (c) 2007 Prominate Solutions Ltd. |
|---|
| 4 | * http://www.prominate.com |
|---|
| 5 | * |
|---|
| 6 | * THIS FILE IS PRE-ALPHA AND NOT FULLY TESTED |
|---|
| 7 | * THIS FILE IS TO BE RELEASED AS GPL / LGPL |
|---|
| 8 | */ |
|---|
| 9 | |
|---|
| 10 | // Make sure we're in the system |
|---|
| 11 | if( !defined(IN_SYS) || IN_SYS !== TRUE ) { |
|---|
| 12 | die("Hacking attempt"); |
|---|
| 13 | } |
|---|
| 14 | |
|---|
| 15 | // If file was included properly check session |
|---|
| 16 | $sess->monitorSession($_SESSION); |
|---|
| 17 | ?> |
|---|
| 18 | <h2>Post management</h2> |
|---|
| 19 | |
|---|
| 20 | <script type="text/javascript" src="./cn-js/functions.js"></script> |
|---|
| 21 | |
|---|
| 22 | <h3>Add new post <small>[ <a href="#" onclick="expandNewPostbox();">expand</a> | <a href="#" onclick="collapseNewPostbox();">collapse</a> ]</small></h3> |
|---|
| 23 | <div id="newPostBox" style=" visibility: hidden; height: 0px; "> |
|---|
| 24 | <form name="addPost" action="?page=post02" method="post"> |
|---|
| 25 | Publish on the following domain(s):<br /> |
|---|
| 26 | <?php |
|---|
| 27 | $result = $sql->query("SELECT id, domain FROM websites"); |
|---|
| 28 | |
|---|
| 29 | $domain = array(); |
|---|
| 30 | |
|---|
| 31 | while( $data = $sql->fetch_assoc($result) ) { |
|---|
| 32 | $domain[$data['id']] = $data['domain']; |
|---|
| 33 | echo "<input type=\"checkbox\" name=\"domainId[]\" id=\"".$data['domain']."\" value=\"".$data['id']."\"> <label for=\"".$data['domain']."\">".$data['domain']."</label>\n "; |
|---|
| 34 | } |
|---|
| 35 | ?> |
|---|
| 36 | <br /><br /> |
|---|
| 37 | Title: <input type="text" name="title" maxlength="255" style=" width: 255px; " /><br /> |
|---|
| 38 | <br /> |
|---|
| 39 | Message:<br /> |
|---|
| 40 | <?php |
|---|
| 41 | include("./cn-fckeditor/fckeditor.php"); |
|---|
| 42 | $fcke = new FCKeditor('content'); |
|---|
| 43 | $fcke->BasePath = "./cn-fckeditor/"; |
|---|
| 44 | $fcke->Height = "400px"; |
|---|
| 45 | $fcke->Create(); |
|---|
| 46 | ?> |
|---|
| 47 | <br /> |
|---|
| 48 | <input type="submit" name="addPost" value="Save Post" /> |
|---|
| 49 | </form> |
|---|
| 50 | </div> |
|---|
| 51 | |
|---|
| 52 | <h3>Edit / delete existing posts</h3> |
|---|
| 53 | |
|---|
| 54 | <table width="800" cellpadding="0" cellspacing="1" style=" border: 2px solid #999999; padding: 5px; "> |
|---|
| 55 | <tr> |
|---|
| 56 | <td class="rowBg1" width="40%" style=" text-align: center; ">Title</td> |
|---|
| 57 | <td class="rowBg1" width="40%" style=" text-align: center; ">Published on</td> |
|---|
| 58 | <td class="rowBg1" style=" text-align: center; " width="20%">Options</td> |
|---|
| 59 | </tr> |
|---|
| 60 | <?php |
|---|
| 61 | $result = $sql->query("SELECT id, domainId, title FROM posts"); |
|---|
| 62 | |
|---|
| 63 | $i = 1; |
|---|
| 64 | while( $data = $sql->fetch_assoc($result) ) { |
|---|
| 65 | $ids = explode(" ", $data['domainId']); |
|---|
| 66 | $domains = ""; |
|---|
| 67 | foreach( $ids as $value ) { |
|---|
| 68 | $domains .= $domain[$value]." "; |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | if( $i == 2 ) : $i = 1; else : $i++; endif; |
|---|
| 72 | ?> |
|---|
| 73 | <tr> |
|---|
| 74 | <td class="rowBg<?php echo $i; ?>"><?php echo $data['title']; ?></td> |
|---|
| 75 | <td class="rowBg<?php echo $i; ?>" style=" text-align: center; "><?php echo $domains; ?></td> |
|---|
| 76 | <td class="rowBg<?php echo $i; ?>" style=" text-align: center; "><a href="?page=post03&id=<?php echo $data['id']; ?>">Edit</a> | <a href="?page=post04&id=<?php echo $data['id']; ?>">Delete</a></td> |
|---|
| 77 | </tr> |
|---|
| 78 | <? |
|---|
| 79 | } |
|---|
| 80 | ?> |
|---|
| 81 | </table> |
|---|