Changeset 190

Show
Ignore:
Timestamp:
06/09/06 16:47:52 (2 years ago)
Author:
rollercow
Message:

few small changes, mostly pointless whitespace stuff

Files:

Legend:

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

    r189 r190  
    704704                } 
    705705        } 
    706  
    707         // prints a form populated with email addresses that can avoid moderation on comments 
     706        //prints a form populated with email addresses that can avoid moderation on comments 
    708707        function printAuthorisedUsers() { 
    709708                echo "<div class=\"entry\">\n"; 
    710709                echo "<a name=\"emails\"></a>\n"; 
    711710                echo "<h2>"._("Known Users")."</h2>\n"; 
     711                //if comment moderation is off tell the user its a bit daft 
    712712                if(!$this->blog->comment_moderation) { 
    713713                        echo "<p>"._("Comment moderation is turned off on your blog - anyone can post comments. To turn comment moderation on, visit the")." <a href=\"".$this->adminPath."settings\">"._("settings page")."</a>.</p>\n"; 
    714                         echo "</div"; 
     714                        echo "</div>"; 
    715715                        return; 
    716716                } 
    717717                echo "<p>"._("Comments posted to your blog with an e-mail address that appears in the list below avoid the moderation queue and appear on your blog immediately.")."</p>\n"; 
    718718                echo "<p>"._("To turn off comment moderation, visit the")." <a href=\"{$this->adminPath}settings\">"._("settings page")."</a>.</p>\n"; 
    719  
    720719                echo "<form name=\"emailform\" id=\"emailform\" action=\"".$this->adminPath."updateauthusers\" method=\"post\">\n"; 
    721720                echo "<select multiple=\"multiple\" name=\"emaillist[]\" size=\"10\">\n"; 
    722  
    723721                $result = db_query("SELECT name,email FROM authorised_emails WHERE user_id=".$this->id." ORDER BY email ASC"); 
    724722                while($r = db_getrow($result)) { 
     
    736734                echo "</div>\n"; 
    737735        } 
    738  
     736//got here, need to check for valid email address and such before hitting the db 
     737        //udates the list of authorised users. 
    739738        function updateAuthorisedUsers($quiet=FALSE) { 
    740739                if(isset($_POST['delete'])) { 
     
    747746                                } 
    748747                                $del = substr($del, 0, -4).")"; 
    749                                        $sql = "DELETE FROM authorised_emails WHERE $del AND user_id={$this->id}"; 
    750                                        $ret = db_query($sql); 
    751                                        if(db_error($ret)) { 
    752                                                error(2, _("Database commit error: ").db_error($ret)); 
    753                                        } else { 
    754                                                echo "<div class=\"updateinfo\">"._("Address(es) deleted")."</div>\n"; 
    755                                        
     748                                $sql = "DELETE FROM authorised_emails WHERE $del AND user_id={$this->id}"; 
     749                                $ret = db_query($sql); 
     750                                if(db_error($ret)) { 
     751                                        error(2, _("Database commit error: ").db_error($ret)); 
     752                                } else { 
     753                                        echo "<div class=\"updateinfo\">"._("Address(es) deleted")."</div>\n"; 
     754                               
    756755                        } 
    757756                } elseif(isset($_POST['addnew'])) { 
     
    772771                                } 
    773772                        } 
    774                          
    775773                } 
    776774                if(!$quiet){ 
     
    779777                } 
    780778        } 
    781          
    782         function printEntries($amount=0, $title=TRUE) 
    783         { 
     779        //prints a list of entries for the admin front page. 
     780        function printEntries($amount=0, $title=TRUE)printEntries { 
    784781                $limit = ($amount > 0) ? " LIMIT $amount" : ""; 
    785782                $result = db_query("SELECT shortsubject,timestamp,subject FROM entries WHERE user_id = '".$this->id."' ORDER BY timestamp DESC $limit;"); 
    786783                if(db_num_rows($result)==0){ 
    787784                        error(5, _("No entries found.")); 
    788                 } 
    789                 else { 
     785                } else { 
    790786                        if($title){ 
    791787                                echo "<div class=\"entry\"><h2>"._("Edit Entries")."</h2>\n"; 
     
    810806                } 
    811807        } 
    812  
     808        //confirm entry deletion 
    813809        function confirmDeleteEntries() { 
    814810                echo "<form action=\"{$this->adminPath}deleteentries/\" method=\"post\">\n"; 
     
    816812                $rownum = 0; 
    817813                foreach ($_REQUEST[entry] as $entry) { 
     814                        $entry = $this->blog->makeCleanString($entry); 
    818815                        echo "<input type=\"hidden\" name=\"entry[".$rownum++."]\" value=\"{$entry}\" />"; 
    819816                        echo "<li>".$entry."</li>\n"; 
     
    823820                echo "</form>\n"; 
    824821        } 
    825  
    826         function deleteEntries() 
    827         { 
     822        //deletes entries 
     823        function deleteEntries() { 
    828824                if (count($_POST['entry'])==0) { 
    829825                        error(4, _("No entries marked for deletion.")); 
    830826                } else { 
     827                        //Need to check the entries exist first 
    831828                        if ($_REQUEST[submit]==_("Yes")) { 
    832829                                $sql = "DELETE FROM entries WHERE ("; 
    833830                                foreach($_POST['entry'] as $id) { 
    834831                                        $sql .= "shortsubject = '".$this->blog->makeCleanString($id)."' OR "; 
    835                                        
     832                               
    836833                                $sql = substr($sql, 0, -4); 
    837834                                $sql .= ") AND user_id = {$this->id};"; 
    838                          
    839835                                db_query($sql); 
    840836                                echo count($_POST['entry'])._(" post(s) deleted"); 
     
    844840                } 
    845841        } 
    846  
     842        //constructs the main page 
    847843        function mainPage() { 
    848844                //Should display blog entries here 
     
    855851                echo "</div>\n"; 
    856852        } 
    857  
    858         function addUser()  
    859         { 
     853        //adds a user 
     854        function addUser() { 
    860855                $username = ''; 
    861856                $password = makePassword(); 
     
    867862                        if (safeuname($_POST['username'])) { 
    868863                                $username = addslashes(trim(strip_tags($_POST['username']))); 
    869                         } 
    870                         else { 
     864                        } else { 
    871865                                $this->inputError = _("Invalid Username Provided"); 
    872866                        } 
     
    900894                //check there is a system user with this name (ie if they are a sucs member) 
    901895                if(!posix_getpwnam($username)) { 
    902                         $this->inputError = _("You need to be a SUCS member to sign up for a blog here!");                       
    903                 } 
    904                 //check the user is a member of the users, staff or socieys groups 
    905                 else { 
     896                        $this->inputError = _("You need to be a SUCS member to sign up for a blog here!"); 
     897                } else { 
     898                        //check the user is a member of the users, staff or socieys groups 
    906899                        $posixInfo = posix_getpwnam($username); 
    907900                        if ($posixInfo[gid] != 100 && $posixInfo[gid] != 106 && $posixInfo[gid] != 113) { 
     
    918911                        if (!db_query($sql)) { 
    919912                                error(2,_("Database Insertion failed - ").db_error(db_query($sql))); 
    920                         }  
    921                         //else mail the password to the user and report sucsess 
    922                         else { 
     913                        } else { 
     914                                //else mail the password to the user and report sucsess 
    923915                                mail( 
    924916                                        "{$username}@sucs.org", 
     
    933925                                $this->printLoginForm(); 
    934926                        } 
    935                 } 
    936                 //return to the form 
    937                 else { 
     927                } else { 
     928                        //return to the form 
    938929                        $this->addUserForm(); 
    939930                } 
    940931        } 
    941  
    942         // ok this should take all the input and post it to addUser, passing in the current user and stuff... i think... 
    943         function addUserForm()  
    944         { 
     932        //this should take all the input and post it to addUser, passing in the current user and stuff... i think... 
     933        function addUserForm() { 
    945934                echo "<div class=\"entry\">\n"; 
    946935                if ($this->inputError != "") { 
     
    968957                echo "<p>\n"; 
    969958                echo "<input name=\"submit\" type=\"submit\" id=\"submit\" tabindex=\"4\" value=\""._("Sign Up")."\" />\n"; 
    970                 echo "</p>\n";          
     959                echo "</p>\n"; 
    971960                echo "</form>\n"; 
    972961                echo "<p>"._("You need to be a member of ")."<a href=\"http://sucs.org/\">SUCS</a>"._(" to register")."<br />"._("The normal ")."<a href=\"http://sucs.org/info/conditions.php\">"._("Terms and Conditions")."</a>"._(" apply")."</p>\n"; 
    973                 echo "</div>\n";        
    974                 echo "</div>\n";        
     962                echo "</div>\n"; 
     963                echo "</div>\n"; 
    975964        } 
    976965}