Changeset 110

Show
Ignore:
Timestamp:
31/05/05 15:37:57 (4 years ago)
Author:
rollercow
Message:

People are *STILL* comting stuff with spaces rather than tabs,

Note you can get trac to automaticly add links to tickets by doing #ticket number.. ie dez commited code which closes #5 a little while ago

A few changes to use strftime() where posible.. It would be nice to use it for printArchive() too, but we cant do am/pm or hours without the leading zeros.. :(

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • admin.lib.php

    r109 r110  
    2929        function admin()  
    3030        { 
     31                setlocale(LC_ALL, 'en_GB'); 
    3132                $this->startSession(); 
    3233                $this->id = $_SESSION['id']; 
     
    446447        } 
    447448 
    448     function printEntries($amount=0, $title=TRUE) 
    449     { 
    450         $limit = ($amount > 0) ? " LIMIT $amount" : ""; 
    451         $result = db_query("SELECT shortsubject,timestamp,subject FROM entries WHERE user_id = '".$this->id."' ORDER BY timestamp DESC $limit;"); 
    452         if(db_num_rows($result)==0){ 
    453             error(5, _("No entries found.")); 
    454         } else { 
    455             if($title){ 
    456                 echo "<div class=\"td\"><h2>"._("Edit Entries")."</h2>\n"; 
    457             } 
    458             echo "<ul>\n"; 
    459             while($row = db_getrow($result)){ 
    460                 echo "<li>".date("r", strtotime($row['timestamp']))." <a href=\"".$this->adminPath."update/".$row['shortsubject']."\">".$row['subject']."</a></li>\n"; 
    461             } 
    462             echo "</ul>\n"; 
    463             if($title) echo "</div>\n"; 
    464         } 
    465     } 
     449<<<<<<< .mine 
     450        function printEntries($amount=0, $title=TRUE) 
     451        { 
     452                $limit = ($amount > 0) ? " LIMIT $amount" : ""; 
     453                $result = db_query("SELECT shortsubject,timestamp,subject FROM entries WHERE user_id = '".$this->id."' ORDER BY timestamp DESC $limit;"); 
     454                if(db_num_rows($result)==0){ 
     455                        error(5, _("No entries found.")); 
     456                } 
     457                else { 
     458                        if($title){ 
     459                                echo "<div class=\"td\"><h2>"._("Edit Entries")."</h2>\n"; 
     460                        } 
     461                        echo "<ul>\n"; 
     462                        while($row = db_getrow($result)){ 
     463                        echo "<li>".strftime('%c', strtotime($row['timestamp']))." <a href=\"".$this->adminPath."update/".$row['shortsubject']."\">".$row['subject']."</a></li>\n"; 
     464                        } 
     465                        echo "</ul>\n"; 
     466                } 
     467                if($title) echo "</div>\n"; 
     468        } 
     469 
     470// STUFF BELOW HERE IS AS YET UNTESTED 
    466471 
    467472/* Some functions to manage posts, users etc. */ 
  • blog.lib.php

    r107 r110  
    119119        } 
    120120 
    121     // print old entries for a given year/month/day 
    122     function printArchive($request) 
    123     { 
    124         if($request[0]){ 
    125                 $year = $request[0]; 
    126         } else { 
    127                 // we should probably print the default archive page here 
     121        // print old entries for a given year/month/day 
     122        function printArchive($request) 
     123        { 
     124                if($request[0]){ 
     125                        $year = $request[0]; 
     126                }  
     127                else { 
     128                        // we should probably print the default archive page here 
    128129                        $allentries = TRUE; 
    129         } 
    130         $month = ($request[1]) ? $request[1] : ""; 
    131         $day = ($request[2]) ? $request[2] : ""; 
    132  
    133         if($month=="" && $day=="") { 
    134                 $enddate = $year+1; 
    135         } elseif($month != "" && $day=="") { 
    136                 $enddate = $year.(sprintf("%02d", $month+1)); 
    137         } else { 
    138                 $enddate = $year.$month.(sprintf("%02d", $day+1)); 
    139         } 
    140         $sql = "SELECT shortsubject,subject,timestamp FROM entries WHERE ".(($allentries)? "" : "timestamp >= $year$month$day AND timestamp < $enddate AND ")."user_id = '".$this->id."' ORDER BY timestamp ASC"; 
    141 //      print "<pre>$sql</pre>"; 
    142         $result = db_query($sql); 
     130                } 
     131                $month = ($request[1]) ? $request[1] : ""; 
     132                $day = ($request[2]) ? $request[2] : ""; 
     133 
     134                if($month=="" && $day=="") { 
     135                        $enddate = $year+1; 
     136                }  
     137                elseif($month != "" && $day=="") { 
     138                        $enddate = $year.(sprintf("%02d", $month+1)); 
     139                }  
     140                else { 
     141                        $enddate = $year.$month.(sprintf("%02d", $day+1)); 
     142                } 
     143                 
     144                $sql = "SELECT shortsubject,subject,timestamp FROM entries WHERE ".(($allentries)? "" : "timestamp >= $year$month$day AND timestamp < $enddate AND ")."user_id = '".$this->id."' ORDER BY timestamp ASC"; 
     145                $result = db_query($sql); 
    143146 
    144147                $curyear = ""; 
     
    146149                $curday = ""; 
    147150                echo "<div class=\"td\">"; 
    148         while($row = db_getrow($result)){ 
    149                 if($curyear!=date("Y", strtotime($row['timestamp']))) { 
    150                         $curyear = date("Y", strtotime($row['timestamp'])); 
    151                         echo "<h1><a href=\"".$this->blogPath."archive/$curyear\">$curyear</a></h1>"; 
    152                 } 
    153                 if($curmonth!=date("F", strtotime($row['timestamp']))) { 
    154                         $curmonth = date("F", strtotime($row['timestamp'])); 
    155                         echo "<h2><a href=\"".$this->blogPath."archive/".date("Y/m", strtotime($row['timestamp']))."\">$curmonth</a></h2>\n"; 
    156                 } 
    157                 if($curday!=date("l jS", strtotime($row['timestamp']))) { 
    158                         $curday = date("l jS", strtotime($row['timestamp'])); 
    159                         echo "<h3><a href=\"".$this->blogPath."archive/".date("Y/m/d", strtotime($row['timestamp']))."\">$curday</a></h3>\n"; 
    160                 } 
    161                 echo date("g:ia", strtotime($row['timestamp']))." - <a href=\"{$this->blogPath}entry/{$row['shortsubject']}\">{$row['subject']}</a><br />\n"; 
    162         } 
    163         echo "</div>"; 
    164     } 
    165  
     151                while($row = db_getrow($result)){ 
     152                        if($curyear!=date("Y", strtotime($row['timestamp']))) { 
     153                                $curyear = date("Y", strtotime($row['timestamp'])); 
     154                                echo "<h1><a href=\"".$this->blogPath."archive/$curyear\">$curyear</a></h1>"; 
     155                        } 
     156                        if($curmonth!=date("F", strtotime($row['timestamp']))) { 
     157                                $curmonth = date("F", strtotime($row['timestamp'])); 
     158                                echo "<h2><a href=\"".$this->blogPath."archive/".date("Y/m", strtotime($row['timestamp']))."\">$curmonth</a></h2>\n"; 
     159                        } 
     160                        if($curday!=date("l jS", strtotime($row['timestamp']))) { 
     161                                $curday = date("l jS", strtotime($row['timestamp'])); 
     162                                echo "<h3><a href=\"".$this->blogPath."archive/".date("Y/m/d", strtotime($row['timestamp']))."\">$curday</a></h3>\n"; 
     163                        } 
     164                        echo date("g:ia", strtotime($row['timestamp']))." - <a href=\"{$this->blogPath}entry/{$row['shortsubject']}\">{$row['subject']}</a><br />\n"; 
     165                } 
     166                echo "</div>"; 
     167        } 
    166168 
    167169        //print one entry and its comments