Changeset 974

Show
Ignore:
Timestamp:
02/25/06 10:08:12 (3 years ago)
Author:
max-horvath
Message:

"2006-02-25 Max Horvath <max.horvath@maxspot.de>

  • fixed undefined variable bugs in statistic classes (use of date_from and
    date_to), variables were processed directly from request, without any
    check
    This fixes ticket #71.
  • clicking on a username in user logs now generates a individual user
    report as it does when clicking on a username on the online users page
  • Changing the value of the \"Is persistent\" checkbox doesn't have to
    saved when JavaScript? is enabled in the browser. Before this change
    you had to save a content. So if you wanted to delete a persistant content
    you first had to uncheck this checkbox, save the content and delete the
    content after saving it. If JavaScript? is enabled in your browser you
    can go straight ahead, uncheck the checkbox and delete the content.
    This fixes ticket #73.
  • when processing global arrays if magic quotes is enabled, WiFiDog will
    check for type variables
    This fixes ticket #84.
  • the RSS feed of nodes now delivers the correct link to the nodes homepage
    This fixes ticket #80.
  • small fix in schema_validate.php which should affect nobody (in schema
    version 9)
    This fixes ticket #79.
  • fixed \"Show all available contents for this hotspot\" link which didn't
    work if WiFiDog wasn't located in the root folder of the webserver
  • the \"Show all available contents for this hotspot\" link won't be shown
    anymore unless all requirements are meet that all content of a hotspot
    would be shown. The requirements are: you need to have at least one
    Content Group tagged artistic and locative content, with at least one
    content group element available for display.
    This fixes ticket #35.
  • adjusting the location of a node via the Google maps geocoding service)
    and clicking the button \"Use these coordinates\" didn't work
    This fixes ticket #81 and #82.
  • the content select box now only shows the content to a user of which is
    is the owner from (same mechanism has already been used on the content
    manager page) or all content if the user is a superadmin
  • wifidog/admin/content_admin.php removed, because the content manager now
    uses the generic object administration interface
  • the creation date of a network can be changed now (this value wasn't
    displayed in the admin interface, even though it was present in the
    database)
  • revamped administration sidebar, cleaner interface for the superadmin,
    for the owner of a node nothing changes
  • added \"server administration\" section to the administration interface
  • Added administration of webservers. For one webserver not much changes.
    The SSL available setting has been moved to this section (and removed
    from config.php). Running WiFiDog on two or more webserver (with one
    database) you now can define the different hostnames of the webserver.
    Of course you can also define, which of those webserver serves SSL. This
    is for example essential for the Google maps feature (different API keys
    for different hostnames)
  • for every network you now can define it's own Google Map initial values
    and map types
  • Hotspots map page now supports different maps for different networks
  • Hotspots map page now supports different map types for different networks
    This fixes ticket #69
  • Hotspots map page now offers full multilingual support (text in the
    JavaScript? file was english only)
  • Hotspots map page now uses a Smarty template to render HTML page"
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wifidog-auth/CHANGELOG

    r963 r974  
     12006-02-25 Max Horváth <max.horvath@maxspot.de> 
     2        * fixed undefined variable bugs in statistic classes (use of date_from and 
     3          date_to), variables were processed directly from request, without any 
     4          check 
     5          This fixes ticket #71. 
     6        * clicking on a username in user logs now generates a individual user 
     7          report as it does when clicking on a username on the online users page 
     8        * Changing the value of the "Is persistent" checkbox doesn't have to 
     9          saved when JavaScript is enabled in the browser. Before this change 
     10          you had to save a content. So if you wanted to delete a persistant content 
     11          you first had to uncheck this checkbox, save the content and delete the 
     12          content after saving it. If JavaScript is enabled in your browser you 
     13          can go straight ahead, uncheck the checkbox and delete the content. 
     14          This fixes ticket #73. 
     15        * when processing global arrays if magic quotes is enabled, WiFiDog will 
     16          check for type variables 
     17          This fixes ticket #84. 
     18        * the RSS feed of nodes now delivers the correct link to the nodes homepage 
     19          This fixes ticket #80. 
     20        * small fix in schema_validate.php which should affect nobody (in schema 
     21          version 9) 
     22          This fixes ticket #79. 
     23        * fixed "Show all available contents for this hotspot" link which didn't 
     24          work if WiFiDog wasn't located in the root folder of the webserver 
     25        * the "Show all available contents for this hotspot" link won't be shown 
     26          anymore unless all requirements are meet that all content of a hotspot 
     27          would be shown. The requirements are: you need to have at least one 
     28          Content Group tagged artistic and locative content, with at least one 
     29          content group element available for display. 
     30          This fixes ticket #35. 
     31        * adjusting the location of a node via the Google maps geocoding service) 
     32          and clicking the button "Use these coordinates" didn't work 
     33          This fixes ticket #81 and #82. 
     34        * the content select box now only shows the content to a user of which is 
     35          is the owner from (same mechanism has already been used on the content 
     36          manager page) or all content if the user is a superadmin 
     37        * wifidog/admin/content_admin.php removed, because the content manager now 
     38          uses the generic object administration interface 
     39        * the creation date of a network can be changed now (this value wasn't 
     40          displayed in the admin interface, even though it was present in the 
     41          database) 
     42        * revamped administration sidebar, cleaner interface for the superadmin, 
     43          for the owner of a node nothing changes 
     44        * added "server administration" section to the administration interface 
     45        * Added administration of webservers. For one webserver not much changes. 
     46          The SSL available setting has been moved to this section (and removed 
     47          from config.php). Running WiFiDog on two or more webserver (with one 
     48          database) you now can define the different hostnames of the webserver. 
     49          Of course you can also define, which of those webserver serves SSL. This 
     50          is for example essential for the Google maps feature (different API keys 
     51          for different hostnames) 
     52        * for every network you now can define it's own Google Map initial values 
     53          and map types 
     54        * Hotspots map page now supports different maps for different networks 
     55        * Hotspots map page now supports different map types for different networks 
     56          This fixes ticket #69 
     57        * Hotspots map page now offers full multilingual support (text in the 
     58          JavaScript file was english only) 
     59        * Hotspots map page now uses a Smarty template to render HTML page 
     60 
    1612006-02-21 Max Horváth <max.horvath@maxspot.de> 
    262        * fixed access restriction for HTMLeditor in templates folder 
  • trunk/wifidog-auth/wifidog/admin/generic_object_admin.php

    r946 r974  
    6262require_once('classes/GenericObject.php'); 
    6363require_once('classes/MainUI.php'); 
     64require_once('classes/User.php'); 
     65require_once('classes/Node.php'); 
    6466require_once('classes/Network.php'); 
    65  
    66 if (!empty ($_REQUEST['debug'])) { 
     67require_once('classes/Server.php'); 
     68 
     69// Init values 
     70$html = ""; 
     71$errmsg = ""; 
     72$common_input = ""; 
     73$displayEditButton = true; 
     74$displayShowAllButton = false; 
     75$supportsPreview = true; 
     76 
     77// Init text values 
     78$createText = sprintf(_("Create %s"), $_REQUEST['object_class']); 
     79$addText = sprintf(_("Add %s"), $_REQUEST['object_class']); 
     80$createLongText = sprintf(_("Create a new %s"), $_REQUEST['object_class']); 
     81$addLongText = sprintf(_("Add a new %s"), $_REQUEST['object_class']); 
     82$listAllText = sprintf(_("Show all %s"), $_REQUEST['object_class']); 
     83$listPersistantText = sprintf(_("Show only persistant %s"), $_REQUEST['object_class']); 
     84$editText = sprintf(_("Edit %s"), $_REQUEST['object_class']); 
     85 
     86$newText = $createText; 
     87$newLongText = $createLongText; 
     88 
     89/* 
     90 * Check for debugging requests 
     91 */ 
     92if (!empty($_REQUEST['debug'])) { 
    6793    echo "<pre>"; 
    6894    print_r($_REQUEST); 
     
    7096} 
    7197 
    72 $html = "<div>"; 
    73 if (empty ($_REQUEST['object_class'])) { 
     98/* 
     99 * Check for the object class to use 
     100 */ 
     101if (empty($_REQUEST['object_class'])) { 
    74102    echo "<div class='errormsg'>"._("Sorry, the 'object_class' parameter must be specified")."</div>\n"; 
    75103    exit; 
     
    78106} 
    79107 
    80 if ($_REQUEST['action'] == 'new') { 
    81     $object = call_user_func(array ($class, 'createNewObject')); 
     108/* 
     109 * Check for action requests 
     110 */ 
     111if (!isset($_REQUEST['action'])) { 
     112    $_REQUEST['action'] = ""; 
     113
     114 
     115if (!isset($_REQUEST['action_delete'])) { 
     116    $_REQUEST['action_delete'] = ""; 
     117
     118 
     119/* 
     120 * Pre-process action requests (load required objects) 
     121 */ 
     122switch ($_REQUEST['action']) { 
     123case "new": 
     124    $object = call_user_func(array($class, 'createNewObject')); 
    82125    $_REQUEST['action'] = 'edit'; 
    83 
    84 else if ($_REQUEST['action'] == 'process_new_ui') { 
    85     $object = call_user_func(array ($class, 'processCreateNewObjectUI')); 
    86         if (!$object) { 
     126    break; 
     127 
     128case "process_new_ui": 
     129    $object = call_user_func(array($class, 'processCreateNewObjectUI')); 
     130 
     131    if (!$object) { 
    87132        echo "<div class='errormsg'>"._("Sorry, the object couldn't be created.  You probably didn't fill the form properly")."</div>\n"; 
    88133        exit; 
    89134    } 
     135 
    90136    $_REQUEST['action'] = 'edit'; 
    91 
    92 else if ($_REQUEST['action'] == 'new_ui') { 
    93     //No need for an object 
    94 
    95  else { 
    96     $object = call_user_func(array ($class, 'getObject'), $_REQUEST['object_id']); 
    97 
    98  
    99 if ($_REQUEST['action'] == 'save') { 
     137    break; 
     138 
     139case "list": 
     140case "new_ui": 
     141    // No need for an object 
     142    break; 
     143 
     144default: 
     145    $object = call_user_func(array($class, 'getObject'), $_REQUEST['object_id']); 
     146    break; 
     147
     148 
     149/* 
     150 * Process action requests (saving, previewing and deleting) 
     151 */ 
     152switch ($_REQUEST['action']) { 
     153case "save": 
    100154    $object->processAdminUI(); 
    101     //$object = call_user_func(array ($class, 'getObject'), $_REQUEST['object_id']); 
    102155    $_REQUEST['action'] = 'edit'; 
    103 
    104  
    105 if ($_REQUEST['action'] == 'delete') { 
    106     $errmsg = ''; 
    107  
    108     if ($object->delete($errmsg) == true) { 
    109         $html .= "<div class='successmsg'>"._("Object successfully deleted")."</div>\n"; 
    110     } else { 
    111         $html .= "<div class='errormsg'>"._("Deletion failed, error was: ")."$errmsg</div>\n"; 
    112         $_REQUEST['action'] = 'edit'; 
    113     } 
    114 
    115 if ($_REQUEST['action'] == 'new_ui') { 
    116  
    117         $html .= "<form action='".GENERIC_OBJECT_ADMIN_ABS_HREF."' method='post'>"; 
    118     $html .= "<input type='hidden' name='object_class' value='".$class."'>\n"; 
    119         $html .= call_user_func(array ($class, 'getCreateNewObjectUI')); 
    120     $html .= "<input type='hidden' name='action' value='process_new_ui'>\n"; 
    121     $html .= "<input type=submit name='new_ui_submit' value='"._("Create")." ".$class."'>\n"; 
    122     $html .= '</form>'; 
    123  
    124  
    125 
    126 else if ($_REQUEST['action'] == 'edit') { 
    127         if (!$object) { 
    128         echo "<div class='errormsg'>"._("Sorry, the 'object_id' parameter must be specified")."</div>\n"; 
    129         exit; 
    130     } 
    131     $common_input = ''; 
    132     if (!empty ($_REQUEST['debug'])) { 
    133         $common_input .= "<input type='hidden' name='debug' value='true'>\n"; 
    134     } 
    135     $common_input .= "<input type='hidden' name='object_id' value='".$object->GetId()."'>\n"; 
    136     $common_input .= "<input type='hidden' name='object_class' value='".get_class($object)."'>\n"; 
    137  
    138     $html .= "<form enctype='multipart/form-data' action='".GENERIC_OBJECT_ADMIN_ABS_HREF."' method='post'>"; 
    139     $html .= $common_input; 
    140     $html .= $object->getAdminUI(); 
    141     $html .= "<input type='hidden' name='action' value='save'>\n"; 
    142     $html .= "<input type=submit name='save_submit' value='"._("Save")." ".get_class($object)."'>\n"; 
    143     $html .= '</form>'; 
    144  
    145     $html .= "<form action='".GENERIC_OBJECT_ADMIN_ABS_HREF."' target='_blank' method='post'>"; 
    146     $html .= $common_input; 
    147     $html .= "<input type='hidden' name='action' value='preview'>\n"; 
    148     $html .= "<input type=submit name='preview_submit' value='"._("Preview")." ".get_class($object)."'>\n"; 
    149     $html .= '</form>'; 
    150  
    151     $html .= "<form action='".GENERIC_OBJECT_ADMIN_ABS_HREF."' method='post'>"; 
    152     $html .= $common_input; 
    153     $html .= "<input type='hidden' name='action' value='delete'>\n"; 
    154     $html .= "<input type=submit name='delete_submit' value='"._("Delete")." ".get_class($object)."'>\n"; 
    155     $html .= '</form>'; 
    156 
    157 else if ($_REQUEST['action'] == 'preview') { 
    158     if (empty ($_REQUEST['node_id'])) { 
     156    break; 
     157 
     158case "preview": 
     159    if (empty($_REQUEST['node_id'])) { 
    159160        $node_id = null; 
    160161        $node = null; 
    161162    } else { 
    162163        $node_id = $_REQUEST['node_id']; 
    163         $node = Node :: getObject($node_id); 
    164         Node :: setCurrentNode($node); 
    165  
    166         $html .= "<h1>"._("Showing preview as it would appear at ").$node->getName()."</h1><p>"; 
    167     } 
    168     $common_input = ''; 
     164        $node = Node::getObject($node_id); 
     165        Node::setCurrentNode($node); 
     166 
     167        $html .= "<h1>"._("Showing preview as it would appear at ") . $node->getName() . "</h1><br><br>"; 
     168    } 
     169 
    169170    if (!empty ($_REQUEST['debug'])) { 
    170         $common_input .= "<input type='hidden' name='debug' value='true'>\n"; 
    171     } 
    172     $common_input .= "<input type='hidden' name='object_id' value='".$object->GetId()."'>\n"; 
    173     $common_input .= "<input type='hidden' name='object_class' value='".get_class($object)."'>\n"; 
    174     $common_input .= "<input type='hidden' name='node_id' value='".$node_id."'>\n"; 
    175  
    176     $html .= "<form action='".GENERIC_OBJECT_ADMIN_ABS_HREF."' target='_top' method='post'>"; 
     171        $common_input .= "<input type='hidden' name='debug' value='true'>"; 
     172    } 
     173 
     174    $common_input .= "<input type='hidden' name='object_id' value='" . $object->GetId() . "'>"; 
     175    $common_input .= "<input type='hidden' name='object_class' value='" . get_class($object) . "'>"; 
     176    $common_input .= "<input type='hidden' name='node_id' value='" . $node_id . "'>"; 
     177 
     178    $html .= "<form action='" . GENERIC_OBJECT_ADMIN_ABS_HREF . "' target='_top' method='post'>"; 
    177179    $html .= $common_input; 
    178180 
    179181    $name = "node_id"; 
    180     $html .= Node :: getSelectNodeUI($name); 
     182    $html .= Node::getSelectNodeUI($name); 
    181183 
    182184    if (method_exists($object, "getUserUI")) { 
     
    184186    } 
    185187 
    186     $html .= "<input type='hidden' name='action' value='preview'>\n"; 
    187     $html .= "<input type='submit' name='preview_submit' value='"._("Preview")." ".get_class($object)."'>\n"; 
     188    $html .= "<input type='hidden' name='action' value='preview'>"; 
     189    $html .= "<input type='submit' name='preview_submit' value='"._("Preview")." ".get_class($object)."'>"; 
    188190    $html .= '</form>'; 
    189191 
     192    $html .= "<form action='" . GENERIC_OBJECT_ADMIN_ABS_HREF . "' method='post'>"; 
     193    $html .= $common_input; 
     194    $html .= "<input type='hidden' name='action' value='edit'>"; 
     195    $html .= "<input type=submit name='edit_submit' value='"._("Edit")." " . get_class($object) . "'>"; 
     196    $html .= '</form>'; 
     197    break; 
     198 
     199case "delete": 
     200    // Gets called only if no JavaScript was enabled in the browser 
     201    if ($object->delete($errmsg) == true) { 
     202        $html .= "<div class='successmsg'>" . _("Object successfully deleted") . "</div>"; 
     203    } else { 
     204        $html .= "<div class='errormsg'>" . _("Deletion failed, error was: ") . "<br />$errmsg</div>"; 
     205        $_REQUEST['action'] = 'edit'; 
     206    } 
     207    break; 
     208 
     209default: 
     210    // Do nothing 
     211    break; 
     212} 
     213 
     214/* 
     215 * Process action requests (deleting with enabled JavaScript) 
     216 */ 
     217switch ($_REQUEST['action_delete']) { 
     218case "delete": 
     219    // First save the object so we can catch any "persistent content" changes 
     220    $object->processAdminUI(); 
     221 
     222    // Renew information about the object 
     223    $object = call_user_func(array($class, 'getObject'), $_REQUEST['object_id']); 
     224 
     225    // Now try to delete the content 
     226    if ($object->delete($errmsg) == true) { 
     227        $html .= "<div class='successmsg'>" . _("Object successfully deleted") . "</div>"; 
     228        $_REQUEST['action'] = ""; 
     229    } else { 
     230        $html .= "<div class='errormsg'>" . _("Deletion failed, error was: ") . "<br />$errmsg</div>"; 
     231        $_REQUEST['action'] = 'edit'; 
     232    } 
     233    break; 
     234 
     235default: 
     236    // Do nothing 
     237    break; 
     238} 
     239 
     240/* 
     241 * Process action requests (new and edit) 
     242 */ 
     243switch ($_REQUEST['action']) { 
     244case "list": 
     245    $createAllowed = false; 
     246 
     247    switch ($_REQUEST['object_class']) { 
     248    case "Content": 
     249        $displayShowAllButton = true; 
     250        $objectSelector = Content::getSelectContentUI('object_id', null, ((isset($_REQUEST['display_content']) && $_REQUEST['display_content'] == "all_content") ? false : true), "content_type", "table"); 
     251        $displayEditButton = false; 
     252        break; 
     253 
     254    case "Node": 
     255        $newLongText = $addLongText; 
     256        $objectSelector = Node::getSelectNodeUI('object_id'); 
     257        break; 
     258 
     259    case "Network": 
     260        $objectSelector = Network::getSelectNetworkUI('object_id'); 
     261        break; 
     262 
     263    case "Server": 
     264        $newLongText = $addLongText; 
     265        $objectSelector = Server::getSelectServerUI('object_id'); 
     266        break; 
     267 
     268    default: 
     269        $objectSelector = ""; 
     270        break; 
     271    } 
     272 
     273    if (User::getCurrentUser()->isSuperAdmin() || (User::getCurrentUser()->isOwner() && $createAllowed)) { 
     274        $html .= "<form action='" . GENERIC_OBJECT_ADMIN_ABS_HREF . "' method='post'>"; 
     275        $html .= "<input type='hidden' name='object_class' value='$class'>"; 
     276        $html .= "<input type='hidden' name='action' value='new_ui'>"; 
     277        $html .= "<input type='submit' name='new_submit' value='$newLongText'>\n"; 
     278        $html .= '</form>'; 
     279    } 
     280 
     281    if ($displayShowAllButton) { 
     282        $html .= "<form action='" . GENERIC_OBJECT_ADMIN_ABS_HREF . "' method='post'>"; 
     283        $html .= "<input type='hidden' name='object_class' value='$class'>"; 
     284        $html .= "<input type='hidden' name='action' value='list'>\n"; 
     285 
     286        if (isset($_REQUEST['display_content']) && $_REQUEST['display_content'] == "all_content") { 
     287            $html .= "<input type='submit' name='list_submit' value='$listPersistantText'>\n"; 
     288        } else { 
     289            $html .= "<input type='hidden' name='display_content' value='all_content'>\n"; 
     290            $html .= "<input type='submit' name='list_submit' value='$listAllText'>\n"; 
     291        } 
     292 
     293        $html .= '</form>'; 
     294    } 
     295 
     296    if ($objectSelector != "") { 
     297        if ($displayEditButton) { 
     298            $html .= "<form action='" . GENERIC_OBJECT_ADMIN_ABS_HREF . "' method='post'>"; 
     299            $html .= "<input type='hidden' name='object_class' value='$class'>"; 
     300            $html .= "<input type='hidden' name='action' value='edit'>"; 
     301            $html .= $objectSelector; 
     302            $html .= "<input type='submit' name='edit_submit' value='$editText'>\n"; 
     303            $html .= '</form>'; 
     304        } else { 
     305            $html .= $objectSelector; 
     306        } 
     307    } 
     308    break; 
     309 
     310case "new_ui": 
     311    switch ($_REQUEST['object_class']) { 
     312    case "Node": 
     313    case "Server": 
     314    case "Content": 
     315        $newText = $addText; 
     316        break; 
     317 
     318    default: 
     319        break; 
     320    } 
     321 
     322    $html .= "<form action='" . GENERIC_OBJECT_ADMIN_ABS_HREF . "' method='post'>"; 
     323    $html .= "<input type='hidden' name='object_class' value='$class'>"; 
     324    $html .= call_user_func(array($class, 'getCreateNewObjectUI')); 
     325    $html .= "<input type='hidden' name='action' value='process_new_ui'>"; 
     326    $html .= "<input type=submit name='new_ui_submit' value='$newText'>"; 
     327    $html .= '</form>'; 
     328    break; 
     329 
     330case "edit": 
     331    switch ($_REQUEST['object_class']) { 
     332    case "Network": 
     333    case "Server": 
     334        $supportsPreview = false; 
     335        break; 
     336 
     337    default: 
     338        break; 
     339    } 
     340 
     341    if (!$object) { 
     342        echo "<div class='errormsg'>" . _("Sorry, the 'object_id' parameter must be specified") . "</div>"; 
     343        exit; 
     344    } 
     345 
     346    if (!empty ($_REQUEST['debug'])) { 
     347        $common_input .= "<input type='hidden' name='debug' value='true'>"; 
     348    } 
     349 
     350    $common_input .= "<input type='hidden' name='object_id' value='" . $object->GetId() . "'>"; 
     351    $common_input .= "<input type='hidden' name='object_class' value='" . get_class($object) . "'>"; 
     352 
     353    $html .= "<form enctype='multipart/form-data' action='" . GENERIC_OBJECT_ADMIN_ABS_HREF . "' method='post'>"; 
     354    $html .= $common_input; 
     355    $html .= $object->getAdminUI(); 
     356    $html .= "<input type='hidden' name='action' value='save'>"; 
     357    $html .= "<input type=submit name='save_submit' value='" . _("Save") . " " . get_class($object) . "'>"; 
     358    $html .= "<script type='text/javascript'>"; 
     359    $html .= "document.write(\"<br />\");"; 
     360    $html .= "document.write(\"<input type='hidden' name='action_delete' value='no' id='form_action_delete' />\");"; 
     361    $html .= "document.write(\"<input type='submit' name='action_delete_submit' onmouseup='document.getElementById(\\\"form_action_delete\\\").value = \\\"delete\\\"' onkeyup='document.getElementById(\\\"form_action_delete\\\").value = \\\"delete\\\"' value='" . _("Delete") . " " . get_class($object) . "' />\");"; 
     362    $html .= "</script>"; 
     363    $html .= '</form>'; 
     364 
     365    if ($supportsPreview) { 
     366        $html .= "<form action='" . GENERIC_OBJECT_ADMIN_ABS_HREF . "' target='_blank' method='post'>"; 
     367        $html .= $common_input; 
     368        $html .= "<input type='hidden' name='action' value='preview'>"; 
     369        $html .= "<input type=submit name='preview_submit' value='" . _("Preview") . " " . get_class($object) . "'>"; 
     370        $html .= '</form>'; 
     371    } 
     372 
     373    // Display delete button (without check for unchecked persitant switch) only if JavaScript has been disabled 
     374    $html .= "<noscript>"; 
    190375    $html .= "<form action='".GENERIC_OBJECT_ADMIN_ABS_HREF."' method='post'>"; 
    191376    $html .= $common_input; 
    192     $html .= "<input type='hidden' name='action' value='edit'>\n"; 
    193     $html .= "<input type=submit name='edit_submit' value='"._("Edit")." ".get_class($object)."'>\n"; 
     377    $html .= "<input type='hidden' name='action' value='delete'>"; 
     378    $html .= "<input type=submit name='delete_submit' value='" . _("Delete") . " " . get_class($object) . "'>"; 
    194379    $html .= '</form>'; 
    195 
    196 $html .= "</div>"; 
    197  
    198 $ui=new MainUI(); 
    199 $ui->setToolSection('ADMIN'); 
     380    $html .= "</noscript>"; 
     381    break; 
     382 
     383default: 
     384    // Do nothing 
     385    break; 
     386
     387 
     388/* 
     389 * Render output 
     390 */ 
     391$ui = new MainUI(); 
    200392$ui->setTitle(_("Generic object editor")); 
    201393$ui->setHtmlHeader("<script type='text/javascript' src='" . BASE_SSL_PATH . "js/interface.js'></script>"); 
    202 $ui->setMainContent($html); 
     394$ui->setToolSection('ADMIN'); 
     395$ui->setMainContent("<div>" . $html . "</div>"); 
    203396$ui->display(); 
    204397 
  • trunk/wifidog-auth/wifidog/admin/hotspot_location_map.php

    r914 r974  
    9191    $script .= "var current_marker = new GMarker(current_marker_point);\n"; 
    9292    $script .= "map.addOverlay(current_marker);\n"; 
    93     $gis_lat_name = "node_".$node->getId()."_gis_latitude"; 
    94     $gis_long_name = "node_".$node->getId()."_gis_longitude"; 
     93    $gis_lat_name = "node_" . md5($node->getId()) ."_gis_latitude"; 
     94    $gis_long_name = "node_" . md5($node->getId()) . "_gis_longitude"; 
    9595    $script .= "function setLocationInOriginalWindow() {\n"; 
    9696    $script .= "  window.opener.document.getElementById(\"$gis_lat_name\").value = current_marker_point.y;\n"; 
  • trunk/wifidog-auth/wifidog/admin/templates/user_log.html

    r760 r974  
    2121{section name=i loop=$users_array} 
    2222<tr> 
    23         <td><a href="stats.php?user_id={$users_array[i].user_id}">{$users_array[i].username}</a></td> 
     23        <td><a href="stats.php?Statistics={$users_array[i].account_origin}&distinguish_users_by=user_id&stats_selected_users={$users_array[i].username}&UserReport=on&user_id={$users_array[i].user_id}&action=generate">{$users_array[i].username}</a></td> 
    2424        <td>{$users_array[i].account_origin}</td> 
    2525    <td>{$users_array[i].reg_date|date_format:"%Y/%m/%d"}</td> 
  • trunk/wifidog-auth/wifidog/classes/AbstractDbPostgres.php

    r915 r974  
    204204         * Executes an SQL for which, we predict to get a unique match, if that's not the case, this function will throw an error message 
    205205         * 
    206          * @param $sql SQL query to run 
    207          * @param $retRow un array des colonnes de la rangée retournée, NULL si aucun résultats. 
    208          * @param $debug Si TRUE, affiche les résultats bruts de la requête 
     206         * @param string $sql    SQL query to run 
     207         * @param array  $retRow un array des colonnes de la rangée retournée, NULL si aucun résultats. 
     208         * @param bool   $debug  Si TRUE, affiche les résultats bruts de la requête 
     209         * @param bool   $silent If set to true, no error message will be shown 
     210         * 
    209211         * @return TRUE si la requete a été effectuée avec succés, FALSE autrement. 
    210212         */ 
    211         function execSqlUniqueRes($sql, & $retRow, $debug = false
     213        function execSqlUniqueRes($sql, & $retRow, $debug = false, $silent = false
    212214        { 
    213215                $retval = true; 
     
    236238                        echo "<p>".sprintf(_("Elapsed time for query execution : %6f second(s)"), $sql_timetaken)."</p>\n"; 
    237239 
    238                 if ($result == false) 
    239                 { 
    240                         echo "<p>execSqlUniqueRes() : "._("An error occured while executing the following SQL query")." :<br/>{$sql}</p>"; 
    241                         echo "<p>"._("Error message")." : <br/>".pg_last_error($connection)."</p>"; 
     240                if ($result == false) { 
     241                    if (!$silent) { 
     242                        echo "<p>execSqlUniqueRes() : "._("An error occured while executing the following SQL query")." :<br/>{$sql}</p>"; 
     243                        echo "<p>"._("Error message")." : <br/>".pg_last_error($connection)."</p>"; 
     244                    } 
     245 
    242246                        $retval = false; 
    243                 } 
    244                 else 
    245                 { 
     247                } else { 
    246248                        $resultSet = pg_fetch_all($result); 
    247249                        $retRow = $resultSet[0]; 
  • trunk/wifidog-auth/wifidog/classes/Content.php

    r938 r974  
    629629    } 
    630630 
    631     /** Get an interface to pick content from all persistent content. 
    632     * @param $user_prefix A identifier provided by the programmer to recognise it's generated html form 
    633       @param $sql_additional_where Addidional where conditions to restrict the candidate objects 
    634     * @return html markup 
    635     */ 
    636     public static function getSelectContentUI($user_prefix, $sql_additional_where = null) 
    637     { 
    638         $html = ''; 
    639         $name = "{$user_prefix}"; 
    640         $html .= _("Select existing Content : ")."\n"; 
     631    /** 
     632     * Get an interface to pick content from all persistent content 
     633     * 
     634     * It either returns a select box or an extended table 
     635     * 
     636     * @param string $user_prefix             An identifier provided by the 
     637     *                                        programmer to recognise it's 
     638     *                                        generated HTML form 
     639     * @param string $sql_additional_where    Addidional where conditions to 
     640     *                                        restrict the candidate objects 
     641     * @param bool   $show_persistant_content Defines if to list persistant 
     642     *                                        content, only 
     643     * @param string $order                   Order of output (default: by 
     644     *                                        creation time) 
     645     * @param string $type_interface          Type of interface: 
     646     *                                          - "select": default, shows a 
     647     *                                            select box 
     648     *                                          - "table": showsa table with 
     649     *                                            extended information 
     650     * 
     651     * @return string HTML markup 
     652     * 
     653     * @static 
     654     * @access public 
     655     */ 
     656    public static function getSelectContentUI($user_prefix, $sql_additional_where = null, $show_persistant_content = true, $order = "creation_timestamp", $type_interface = "select") 
     657    { 
     658        // Define globals 
    641659        global $db; 
    642         $retval = array (); 
    643         $sql = "SELECT * FROM content WHERE is_persistent=TRUE $sql_additional_where ORDER BY creation_timestamp"; 
    644         $db->execSql($sql, $content_rows, false); 
    645         if ($content_rows != null) 
    646         { 
    647             $i = 0; 
    648             foreach ($content_rows as $content_row) 
    649             { 
    650                 $content = Content :: getObject($content_row['content_id']); 
    651                 $tab[$i][0] = $content->getId(); 
    652                 $tab[$i][1] = $content->__toString()." (".get_class($content).")"; 
    653                 $i ++; 
    654             } 
    655             $html .= FormSelectGenerator :: generateFromArray($tab, null, $name, null, false); 
    656  
    657         } 
    658         else 
    659         { 
    660             $html .= "<div class='warningmsg'>"._("Sorry, no content available in the database")."</div>\n"; 
    661         } 
    662         return $html; 
     660 
     661        // Init values 
     662        $_html = ''; 
     663        $_retVal = array(); 
     664        $_contentRows = null; 
     665 
     666        if ($type_interface != "table") { 
     667            $_html .= _("Select existing Content: ")."\n"; 
     668        } 
     669 
     670        $_name = "{$user_prefix}"; 
     671 
     672        if ($show_persistant_content) { 
     673            $_sql = "SELECT * FROM content WHERE is_persistent=TRUE $sql_additional_where ORDER BY $order"; 
     674        } else { 
     675            $_sql = "SELECT * FROM content $sql_additional_where ORDER BY $order"; 
     676        } 
     677 
     678        $db->execSql($_sql, $_contentRows, false); 
     679 
     680        if ($_contentRows != null) { 
     681            $_i = 0; 
     682 
     683            if ($type_interface == "table") { 
     684                $_html .= "<table class='content_admin'>\n"; 
     685                $_html .= "<tr><th>" . _("Title") . "</th><th>" . _("Content type") . "</th><th>" . _("Description") . "</th><th></th></tr>\n"; 
     686            } 
     687 
     688            foreach ($_contentRows as $_contentRow) { 
     689                $_content = Content::getObject($_contentRow['content_id']); 
     690 
     691                if (User::getCurrentUser()->isSuperAdmin() || $_content->isOwner(User::getCurrentUser())) { 
     692                    if ($type_interface != "table") { 
     693                        $_tab[$_i][0] = $_content->getId(); 
     694                        $_tab[$_i][1] = $_content->__toString() . " (" . get_class($_content) . ")"; 
     695                        $_i ++; 
     696                    } else { 
     697                        if (!empty($_contentRow['title'])) { 
     698                            $_title = Content::getObject($_contentRow['title']); 
     699                            $_titleUI = $_title->__toString(); 
     700                        } else { 
     701                            $_titleUI = ""; 
     702                        } 
     703 
     704                        if (!empty($_contentRow['description'])) { 
     705                            $_description = Content::getObject($_contentRow['description']); 
     706                            $_descriptionUI = $_description->__toString(); 
     707                        } else { 
     708                            $_descriptionUI = ""; 
     709                        } 
     710 
     711                        $_href = GENERIC_OBJECT_ADMIN_ABS_HREF . "?object_id={$_contentRow['content_id']}&object_class=Content&action=edit"; 
     712                        $_html .= "<tr><td>$_titleUI</td><td><a href='$_href'>{$_contentRow['content_type']}</a></td><td>$_descriptionUI</td>\n"; 
     713 
     714                        $_href = GENERIC_OBJECT_ADMIN_ABS_HREF . "?object_id={$_contentRow['content_id']}&object_class=Content&action=delete"; 
     715                        $_html .= "<td><a href='$_href'>" . _("Delete") . "</a></td>"; 
     716 
     717                        $_html .= "</tr>\n"; 
     718                    } 
     719                } 
     720            } 
     721 
     722            if ($type_interface != "table") { 
     723                $_html .= FormSelectGenerator::generateFromArray($_tab, null, $_name, null, false); 
     724            } else { 
     725                $_html .= "</table>\n"; 
     726            } 
     727        } else { 
     728            $_html .= "<div class='warningmsg'>" . _("Sorry, no content available in the database") . "</div>\n"; 
     729        } 
     730 
     731        return $_html; 
    663732    } 
    664733 
  • trunk/wifidog-auth/wifidog/classes/Content/File/File.php

    r915 r974  
    406406     * @return bool True if file is local 
    407407     * 
    408      * @access private 
    409      */ 
    410     private function isLocalFile() 
     408     * @access protected 
     409     */ 
     410    protected function isLocalFile() 
    411411    { 
    412412        return is_null($this->files_row['url']); 
  • trunk/wifidog-auth/wifidog/classes/Network.php

    r963 r974  
    5151require_once('classes/User.php'); 
    5252require_once('classes/Node.php'); 
     53require_once('classes/GisPoint.php'); 
    5354require_once('classes/Cache.php'); 
    5455 
     
    6061 * @package    WiFiDogAuthServer 
    6162 * @author     Benoit Gregoire <bock@step.polymtl.ca> 
     63 * @author     Max Horvath <max.horvath@maxspot.de> 
    6264 * @copyright  2005-2006 Benoit Gregoire, Technologies Coeus inc. 
     65 * @copyright  2006 Max Horvath, maxspot GmbH 
    6366 */ 
    6467class Network implements GenericObject 
     
    164167        } 
    165168 
    166         /** Get an interface to pick a network.  If there is only one network available, no interface is actually shown 
    167         * @param $user_prefix A identifier provided by the programmer to recognise it's generated html form 
    168         * @param $pre_selected_network Optional, Network object: The network to be pre- 
    169         * selected in the form object 
    170         * @param $additional_where Additional SQL conditions for the networks to 
    171         * select 
    172         * @return html markup 
    173         */ 
     169        /** 
     170         * Get an interface to pick a network 
     171         * 
     172         * If there is only one network available, no interface is actually shown 
     173         * 
     174     * @param string $user_prefix          A identifier provided by the 
     175     *                                     programmer to recognise it's 
     176     *                                     generated html form 
     177     * @param object $pre_selected_network Network object: The network to be 
     178     *                                     pre-selected in the form object 
     179     * @param string $additional_where     Additional SQL conditions for the 
     180     *                                     networks to select 
     181     * 
     182     * @return string HTML markup 
     183     * 
     184     * @static 
     185     * @access public 
     186     */ 
    174187        public static function getSelectNetworkUI($user_prefix, $pre_selected_network = null, $additional_where = null) 
    175188        { 
     
    247260        { 
    248261                $html = ''; 
    249                 $html .= _("Create new network with id")." \n"; 
     262                $html .= _("Create a new network with ID")." \n"; 
    250263                $name = "new_network_id"; 
    251264                $html .= "<input type='text' size='10' name='{$name}'>\n"; 
     
    351364        /** 
    352365         * Retrieves the network's creation date 
    353          * @return A string 
     366         * 
     367         * @return string Network's creation date 
    354368         */ 
    355369        public function getCreationDate() 
    356370        { 
    357371                return $this->mRow['creation_date']; 
     372        } 
     373 
     374        /** 
     375         * Set the network's creation date 
     376         * 
     377         * @param string $value The new creation date 
     378         * 
     379         * @return bool True on success, false on failure 
     380         * 
     381         * @access public 
     382         */ 
     383        public function setCreationDate($value) 
     384        { 
     385            // Define globals 
     386                global $db; 
     387 
     388            // Init values 
     389                $_retVal = true; 
     390 
     391                if ($value != $this->getCreationDate()) { 
     392                        $value = $db->escapeString($value); 
     393                        $_retVal = $db->execSqlUpdate("UPDATE networks SET creation_date = '{$value}' WHERE network_id = '{$this->getId()}'", false); 
     394                        $this->refresh(); 
     395                } 
     396 
     397                return $_retVal; 
    358398        } 
    359399 
     
    567607                } 
    568608                return $retval; 
     609        } 
     610 
     611        /** 
     612         * Get a GisPoint object 
     613         * 
     614         * @return object GisPoint object 
     615         * 
     616         * @access public 
     617         */ 
     618        public function getGisLocation() 
     619        { 
     620                return new GisPoint($this->mRow['gmaps_initial_latitude'], $this->mRow['gmaps_initial_longitude'], $this->mRow['gmaps_initial_zoom_level']);