Changeset 86

Show
Ignore:
Timestamp:
29/05/05 23:29:59 (4 years ago)
Author:
dez
Message:

Fleshed out the Blog Settings form, getting it to populate the fields (except password, of course) with the current settings.

Files:

Legend:

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

    r85 r86  
    204204                        //shortsubject is now safe.. 
    205205                        //insert our new entry 
    206                         $sql = db_query("INSERT INTO entries (category, subject, body, user_id, shortsubject)VALUES ({$category},'{$subject}','{$body}','{$this->id}','{$shortsubject}')"); 
     206                        $sql = db_query("INSERT INTO entries (category, subject, body, user_id, shortsubject) VALUES ({$category},'{$subject}','{$body}','{$this->id}','{$shortsubject}')"); 
    207207                        if (!$sql) { 
    208208                                error(2,"Database commit failed - ".db_error()); 
     
    320320        function printSettingsForm() 
    321321        { 
     322                //pull in user's current settings from the database 
     323                $sql = db_query("SELECT name, title, description, css FROM users WHERE username='" . $this->userName . "'"); 
     324                $settings = db_getrow($sql); 
    322325                echo "<div class=\"entry\">\n"; 
    323                 echo "<h2>Blog Settings</h2>\n"; 
     326                echo "<h2>"._("Blog Settings")."</h2>\n"; 
     327                echo "<form action=\"".$this->blogPath."postsettings\" method=\"post\" id=\"settingsform\">\n"; 
     328                echo "<p>\n"; 
     329                echo "<input type=\"text\" name=\"name\" id=\"name\" value=\"" . $settings[name] . "\" size=\"30\" maxlength=\"60\" tabindex=\"1\" />\n"; 
     330                echo "<label for=\"name\">"._("Real name")."</label>\n"; 
     331                echo "</p>\n"; 
     332                echo "<p>\n"; 
     333                echo "<input type=\"text\" name=\"title\" id=\"title\" value=\"" . $settings[title] . "\" size=\"30\" maxlength=\"60\" tabindex=\"2\" />\n"; 
     334                echo "<label for=\"title\">"._("Title")."</label>\n"; 
     335                echo "</p>\n"; 
     336                echo "<p>\n"; 
     337                echo "<input type=\"text\" name=\"description\" id=\"description\" value=\"" . $settings[description] . "\" size=\"30\" maxlength=\"60\" tabindex=\"3\" />\n"; 
     338                echo "<label for=\"description\">"._("Description")."</label>\n"; 
     339                echo "</p>\n"; 
     340                echo "<p>\n"; 
     341                echo "<input type=\"text\" name=\"css\" id=\"css\" value=\"" . $settings[css] . "\" size=\"30\" maxlength=\"255\" tabindex=\"4\" />\n"; 
     342                echo "<label for=\"css\">"._("CSS")."</label>\n"; 
     343                echo "</p>\n"; 
     344                echo "<p>\n"; 
     345                echo "<input type=\"password\" name=\"pass1\" id=\"pass1\" value=\"\" size=\"15\" maxlength=\"16\" tabindex=\"5\" />\n"; 
     346                echo "<label for=\"pass1\">"._("Password")."</label>\n"; 
     347                echo "</p>\n"; 
     348                echo "<p>\n"; 
     349                echo "<input type=\"password\" name=\"pass2\" id=\"pass2\" value=\"\" size=\"15\" maxlength=\"16\" tabindex=\"6\" />\n"; 
     350                echo "<label for=\"pass2\">"._("Again")."</label>\n"; 
     351                echo "</p>\n"; 
     352                echo "<p>\n"; 
     353                echo "<input name=\"submit\" type=\"submit\" id=\"submit\" tabindex=\"4\" value=\"Save Settings\" />\n"; 
     354                echo "</p>\n";           
     355                echo "</form>\n"; 
    324356                echo "</div>\n";         
    325357        } 
  • admin.php

    r85 r86  
    3838                if($_SESSION['userName'] or $_POST['submit']) { 
    3939                        if ($_SESSION['userName']) echo "<div class=\"login\"><h3>"._("Hello")." {$admin->realName} (<a href=\"{$admin->adminPath}logout\">"._("Log out")."</a>)</h3></div>"; 
    40                         switch (array_shift($request)) { 
     40                        switch ($request[0]) { 
    4141                        case "newentry": 
    4242                                $admin->printEntryForm() ;