Changeset 125
- Timestamp:
- 13/09/06 00:18:37 (7 years ago)
- Files:
-
- 9 added
- 9 modified
-
components/bananas.php (modified) (1 diff)
-
components/contents.php (modified) (1 diff)
-
components/news.php (modified) (1 diff)
-
components/static.php (modified) (2 diffs)
-
htdocs/css/sucs.css (modified) (2 diffs)
-
htdocs/index.php (modified) (3 diffs)
-
static/About.txt (modified) (1 diff)
-
templates/debug.tpl (added)
-
templates/front.tpl (added)
-
templates/games.tpl (added)
-
templates/index.tpl (modified) (1 diff)
-
templates/library-search.tpl (added)
-
templates/library.tpl (modified) (2 diffs)
-
templates/pagemap.tpl (added)
-
templates/pagemap_edit.tpl (added)
-
templates/shop.tpl (added)
-
templates/static_delete.tpl (added)
-
templates/static_edit.tpl (added)
Legend:
- Unmodified
- Added
- Removed
-
components/bananas.php
r94 r125 1 1 <?php 2 echo($path);3 2 $banana_index = array_search("Bananas", $pathlist); 4 3 if ((sizeof($pathlist) > $banana_index + 1) && (trim($pathlist[$banana_index + 1]) != "")) { -
components/contents.php
r94 r125 42 42 $smarty->assign('data', $dirlist); 43 43 $smarty->assign('level', 0); 44 $output = $smarty->fetch('contents-loop.tpl'); 45 $smarty->assign("secondary", "<div class=\"cbb\"><h3>In this section</h3>".$output."</div>"); 46 $smarty->assign('title', end($pathlist)); 44 if (!isset($_REQUEST['action'])) { 45 $output = $smarty->fetch('contents-loop.tpl'); 46 $smarty->assign("secondary", "<div class=\"cbb\"><h3>In this section</h3>".$output."</div>"); 47 } 47 48 } 48 49 } -
components/news.php
r93 r125 1 1 <?php 2 2 3 if (isset($_REQUEST['action'])) { 4 $action = $_REQUEST['action']; 5 } else { 6 $action = "view"; 7 } 8 3 9 $smarty->assign("news",$DB->GetArray("SELECT * FROM news ORDER BY date DESC LIMIT 5")); 4 $output = $smarty->fetch($base."templates/news.tpl"); 5 $smarty->assign("title", "News"); 10 11 if ($action == "edit") { 12 $output = $smarty->fetch("news_edit.tpl"); 13 $smarty->assign("title", "Edit News"); 14 } else { 15 $output = $smarty->fetch("news.tpl"); 16 $smarty->assign("title", "News"); 17 } 18 6 19 $smarty->assign("body", $output); 20 7 21 ?> -
components/static.php
r122 r125 1 1 <?php 2 2 // Static page producer module 3 4 // A user must be in the html group in order to edit pages in this component 5 $permission = "html"; 3 6 4 7 // Get the right filename... … … 6 9 if (!file_exists($myfile)) { 7 10 $myfile = $base."static$path.txt"; 8 // ...or serve a 404 error11 // If the file doesn't exist... 9 12 if (!file_exists($myfile)) { 10 header("HTTP/1.1 404 Not Found"); 11 $smarty->assign("body", file_get_contents($base."static/404.txt")); 12 $smarty->assign("pathlist", array("", "Error")); 13 $smarty->assign("title", "File not found"); 14 return; 13 if (isset($session->groups[$permission]) && @$_REQUEST['action']=="create") { 14 // ...and we have permission and have been asked to, create it 15 $body = "foo"; 16 } else { 17 // ...serve a 404 error 18 header("HTTP/1.1 404 Not Found"); 19 $body = file_get_contents($base."static/404.txt"); 20 $smarty->assign("pathlist", array("", "Error")); 21 $title = "File not found"; 22 $smarty->assign("title", $title); 23 $smarty->assign("body", $body); 24 // Give those with permission the chance to create the page 25 if (isset($session->groups[$permission])) $smarty->assign("creatable", TRUE); 26 return; 27 } 15 28 } 16 29 } 17 30 18 // A user must be in the html group in order to edit pages in this component 19 $permission = "html"; 20 21 22 // If we've been asked to save changes and have permission to do so... 23 if (@$_REQUEST['action']=="Save" && $session->groups[$permission]) { 24 file_put_contents($myfile, $_REQUEST['body'], LOCK_EX); 31 // If we've got edit permission... 32 if (isset($session->groups[$permission])) { 33 switch (@$_REQUEST['action']) { 34 case "Save": 35 // ...save the file 36 file_put_contents($myfile, $_REQUEST['body'], LOCK_EX); 37 // probably need some error-handling here... 38 break; 39 case "Delete": 40 $deleted = unlink($myfile); 41 break; 42 } 25 43 } 26 44 27 if (isset($pathlist[2])) 28 $title = $pathlist[2]; 29 elseif (isset($pathlist[1])) 30 $title = $pathlist[1]; 31 else 32 $title = "Static Page Producer"; 45 $title = end($pathlist); 33 46 34 $body = file_get_contents($myfile); 35 $modified = filectime($myfile); 47 if (file_exists($myfile)) { 48 $body = file_get_contents($myfile); 49 $modified = date("r", filectime($myfile)); 50 } 36 51 37 52 $smarty->assign("title", $title); 38 $smarty->assign("modified", date("r", $modified));39 40 53 41 54 // Editing static pages - does the user have permission? 42 55 if (isset($session->groups[$permission])) { 43 56 // display Edit link on page 44 $smarty->assign("editable", true);57 $smarty->assign("editable", TRUE); 45 58 // load the editing template 46 if (@$_REQUEST['action']=="edit") { 59 switch (@$_REQUEST['action']) { 60 case "create": 61 if (!file_exists($myfile)) file_put_contents($myfile, "Page under construction\n", LOCK_EX); 62 case "edit": 47 63 $smarty->assign("editcontent", htmlentities($body)); 48 64 $body = $smarty->fetch('static_edit.tpl'); 49 $smarty->assign("action", $_REQUEST['action']); 65 $smarty->assign("action", "edit"); 66 $modified = NULL; 67 break; 68 case "delete-query": 69 $body = $smarty->fetch('static_delete.tpl').$body; 70 break; 71 case "Delete": 72 if ($deleted) $body = "File deleted"; 73 break; 50 74 } 51 75 } 52 76 53 77 $smarty->assign("body", $body); 54 78 $smarty->assign("modified", @$modified); 55 79 ?> -
htdocs/css/sucs.css
r122 r125 367 367 368 368 /* -------------------------------------------------- 369 Dialog box 370 -------------------------------------------------- */ 371 372 .dialog { 373 text-align: center; 374 margin: auto; 375 width: 20em; 376 } 377 378 /* -------------------------------------------------- 369 379 Tables 370 380 -------------------------------------------------- */ … … 389 399 text-align: right; 390 400 } 401 402 #edit ul { 403 margin: 0; 404 } 405 406 #edit li { 407 display: inline; 408 float: right; 409 padding-left: 1em; 410 } -
htdocs/index.php
r109 r125 1 1 <?php 2 // Display execution time? 3 //$displaytime = TRUE; 2 4 3 5 // start the clock (this is just temporary cause I'm interested in how long all this takes) 4 $time = microtime(); 5 $time = explode(' ', $time); 6 $time = $time[1] + $time[0]; 7 $begintime = $time; 6 if (@$displaytime) { 7 $time = microtime(); 8 $time = explode(' ', $time); 9 $time = $time[1] + $time[0]; 10 $begintime = $time; 11 } 8 12 9 13 /* -------------------------------------------------------- … … 45 49 $compdebug = TRUE; 46 50 47 // Display execution time?48 $displaytime = false;49 51 50 52 /* -------------------------------------------------------- … … 136 138 137 139 // Last chance to stop the clock and still end up with valid HTML 138 $time = microtime(); 139 $time = explode(" ", $time); 140 $time = $time[1] + $time[0]; 141 $endtime = $time; 142 $totaltime = ($endtime - $begintime); 143 if ($displaytime) $smarty->assign("totaltime", $totaltime); 140 if (@$displaytime) { 141 $time = microtime(); 142 $time = explode(" ", $time); 143 $time = $time[1] + $time[0]; 144 $endtime = $time; 145 $totaltime = ($endtime - $begintime); 146 $smarty->assign("totaltime", $totaltime); 147 } 144 148 145 149 $smarty->display("foot".$language['file'].".tpl"); -
static/About.txt
r116 r125 18 18 <li>Mail list hosting</li> 19 19 <li><a href="/Help/Advisory">Programming Advisory service</a></li> 20 <li><a href="/ Services/Library">Reference Library</a> of popular books (including Computer Science recommended course texts)</li>21 <li>24hr access to our own <a href="/ Services/Room">Computer Room</a><br />20 <li><a href="/Knowledge/Library">Reference Library</a> of popular books (including Computer Science recommended course texts)</li> 21 <li>24hr access to our own <a href="/About/Room">Computer Room</a><br /> 22 22 Features include: 23 23 <ul> -
templates/index.tpl
r122 r125 13 13 {$body} 14 14 15 {if $creatable} 16 <p>You can <a href="?action=create">create</a> this page though.</p> 17 {/if} 18 15 19 {if $modified} 16 20 <div id="edit"> 17 21 {if $editable} 18 <a href="?action=edit">Edit</a><br /> 22 <ul> 23 <li><a href="?action=delete-query">Delete</a></li> 24 <li><a href="?action=edit">Edit</a></li> 25 </ul> 26 <div class="clear"></div> 19 27 {/if} 20 28 Page last modified {$modified} -
templates/library.tpl
r105 r125 6 6 <h3>Random Books</h3> 7 7 {foreach name=randoms from=$randoms item=randomitem} 8 <a href="/ Services/Library/{$randomitem.id}"><img src="{$randomitem.image_url}" alt="{$randomitem.title}" height="120" /></a>8 <a href="/Knowledge/Library/{$randomitem.id}"><img src="{$randomitem.image_url}" alt="{$randomitem.title}" height="120" /></a> 9 9 {/foreach} 10 10 … … 27 27 <ul> 28 28 {foreach name=results from=$results item=result} 29 <li><a href="/ Services/Library/{$result.id}">{$result.title}</a>{if $result.onloan} <em>(on loan)</em>{/if} </li>29 <li><a href="/Knowledge/Library/{$result.id}">{$result.title}</a>{if $result.onloan} <em>(on loan)</em>{/if} </li> 30 30 {/foreach} 31 31 </ul>
