Changeset 747

Show
Ignore:
Timestamp:
09/11/05 02:39:23 (8 years ago)
Author:
fproulx
Message:

2005-09-10 Francois Proulx <francois.proulx@…>

  • Fixed dependency check
Location:
trunk/wifidog-auth
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/ChangeLog

    r745 r747  
     12005-09-10 Francois Proulx <francois.proulx@gmail.com> 
     2        * Fixed dependency check 
     3         
    142005-09-10 Francois Proulx <francois.proulx@gmail.com> 
    25        * Removed many blank lines after php tags 
  • trunk/wifidog-auth/wifidog/admin/graph_common.inc.php

    r745 r747  
    2525require_once BASEPATH.'admin/admin_common.php'; 
    2626 
    27 if (!$_REQUEST["date_from"]) 
    28     $_REQUEST["date_from"] = strftime("%Y-%m-%d 00:00"); 
    29 if (!$_REQUEST["date_to"]) 
    30     $_REQUEST["date_to"] = strftime("%Y-%m-%d 11:59"); 
    31  
    32 $date_constraint = "AND timestamp_in >= '{$_REQUEST['date_from']}' AND timestamp_in <= '{$_REQUEST['date_to']}'"; 
    33  
    34 $node_id = isset($_REQUEST["node_id"]) ? $db->EscapeString($_REQUEST["node_id"]) : null; 
    35 $user_id = isset($_REQUEST["user_id"]) ? $db->EscapeString($_REQUEST["user_id"]) : null; 
    36 $network_id = isset($_REQUEST["network_id"]) ? $db->EscapeString($_REQUEST["network_id"]) : null; 
     27// Make sure the depency is met 
     28if (Dependencies::check("ImageGraph", $errmsg)) { 
     29        if (!$_REQUEST["date_from"]) 
     30            $_REQUEST["date_from"] = strftime("%Y-%m-%d 00:00"); 
     31        if (!$_REQUEST["date_to"]) 
     32            $_REQUEST["date_to"] = strftime("%Y-%m-%d 11:59"); 
     33         
     34        $date_constraint = "AND timestamp_in >= '{$_REQUEST['date_from']}' AND timestamp_in <= '{$_REQUEST['date_to']}'"; 
     35         
     36        $node_id = isset($_REQUEST["node_id"]) ? $db->EscapeString($_REQUEST["node_id"]) : null; 
     37        $user_id = isset($_REQUEST["user_id"]) ? $db->EscapeString($_REQUEST["user_id"]) : null; 
     38        $network_id = isset($_REQUEST["network_id"]) ? $db->EscapeString($_REQUEST["network_id"]) : null; 
     39} 
    3740 
    3841?> 
  • trunk/wifidog-auth/wifidog/classes/Dependencies.php

    r745 r747  
    11<?php 
     2 
     3 
    24/********************************************************************\ 
    35 * This program is free software; you can redistribute it and/or    * 
     
    2527class Dependencies 
    2628{ 
    27     static public function check($component, & $errmsg) { 
    28         $components = array( 
    29             "ImageGraph" => array( 
    30                 "name" => "PEAR::Image_Graph", 
    31                 "file" => "Image/Graph.php" 
    32             ) 
    33         ); 
     29        static public function check($component, & $errmsg) 
     30        { 
     31                $components = array ("ImageGraph" => array ("name" => "PEAR::Image_Graph", "file" => "Image/Graph.php")); 
    3432 
    35         if (isset($components[$component])) { 
    36             $component_info = $components[$component]; 
    37  
    38             if (file_exists($component_info["file"])) { 
    39  
    40                 if (include_once($component_info["file"])) { 
    41                     return true; 
    42                 } else { 
    43                     $errmsg = $component_info["name"] . _(" is not working properly"); 
    44                     return false; 
    45                 } 
    46  
    47             } else { 
    48                 $errmsg = $component_info["name"] . _(" is not installed"); 
    49                 return false; 
    50             } 
    51         } else { 
    52             throw new Exception("Component not found"); 
    53         } 
    54     } 
     33                if (isset ($components[$component])) 
     34                { 
     35                        $component_info = $components[$component]; 
     36                        if (include_once ($component_info["file"])) 
     37                                return true; 
     38                        else 
     39                        { 
     40                                $errmsg = $component_info["name"]._(" is not installed"); 
     41                                return false; 
     42                        } 
     43                } 
     44                else 
     45                        throw new Exception("Component not found"); 
     46        } 
    5547 
    5648} // End class