Changeset 17

Show
Ignore:
Timestamp:
10/19/06 17:50:30 (14 years ago)
Author:
static
Message:

Added date selector for new post filter.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dev/common/admin.php

    r16 r17  
    5353    $config->setPostPassword($_POST['post_password']); 
    5454    $config->setPostMailto($_POST['post_mailto']); 
     55     
     56    if ($_POST['filter_apply'] == "on") 
     57    {            
     58        $config->setConfig('filter_apply', '1'); 
     59        $config->setConfig('filter_date', mktime(0,0,0,$_POST['filter_month'],$_POST['filter_day'],$_POST['filter_year']));         
     60    }else{ 
     61        $config->setConfig('filter_apply', '0'); 
     62        $config->setConfig('filter_date', 0); 
     63    } 
    5564 
    5665    $html .= "Changes saved."; 
     
    120129$html .= "<tr><td width=120><b>Require password for Comments:</b></td><td><input type=checkbox name=comments_pw id=comments_pw"; 
    121130if ($config->getConfig('comments_pw')) 
    122     $html .= " checked=\"checked\""; 
     131        $html .= " checked=\"checked\""; 
    123132$html .= "></td></tr>"; 
     133 
    124134// $html .= "<tr><td width=120><b>Display least active:</b></td><td><input type=checkbox name=least_active id=least_active"; 
    125135// if ( $config->getLeastActive() ) 
     
    133143$html .= "<tr><td width=120><b>Post password:</b></td><td><input type=text name=post_password id=post_password size=20 maxlength=20 value=\"" . $config->getPostPassword() . "\"></td></tr>"; 
    134144$html .= "<tr><td width=120><b>Killmail CC:</b></td><td><input type=text name=post_mailto id=post_mailto size=20 maxlength=80 value=\"" . $config->getPostMailto() . "\"> (e-mail address)</td></tr>"; 
     145$html .= "<tr><td width=120><b>Disallow any killmails before:</b></td><td>" . dateSelector($config->getConfig('filter_apply'),$config->getConfig('filter_date')) . "</td></tr>"; 
    135146$html .= "</table>"; 
    136147 
     
    146157$page->addContext($menubox->generate()); 
    147158$page->generate(); 
     159 
     160function dateSelector($apply,$date){ 
     161        if($date > 0){ 
     162                $date = getdate($date);          
     163        }else{ 
     164                $date = getdate(); 
     165        }        
     166        $html = "<input type=\"text\" name=\"filter_day\" id=\"filter_day\" style=\"width:20px\" value=\"{$date['mday']}\"/>&nbsp;"; 
     167        $html .= "<select name=\"filter_month\" id=\"filter_month\">"; 
     168        for($i=1;$i<=12;$i++){ 
     169                $t = mktime(0,0,0,$i,1,1980);            
     170                $month = date("M",$t);           
     171                if($date['mon'] == $i) $selected = " selected=\"selected\""; else $selected = ""; 
     172                $html .= "<option value=\"$i\"$selected>$month</option>"; 
     173        } 
     174        $html .= "</select>&nbsp;"; 
     175         
     176        $html .= "<select name=\"filter_year\" id=\"filter_year\">"; 
     177        for($i=date("Y")-7;$i<=date("Y");$i++){          
     178                if($date['year'] == $i) $selected = " selected=\"selected\""; else $selected = ""; 
     179                $html .= "<option value=\"$i\"$selected>$i</option>"; 
     180        } 
     181        $html .= "</select>&nbsp;"; 
     182        $html .= "<input type=checkbox name=filter_apply id=filter_apply"; 
     183        if($apply=="1") $html .= " checked=\"checked\""; 
     184        $html .= "/>Apply&nbsp;";        
     185        return $html; 
     186} 
    148187?>