Changeset 187 for trunk


Ignore:
Timestamp:
12/10/2008 04:45:22 PM (3 years ago)
Author:
Ernest0x
Message:

PHP 5.x fixes (mostly fixes for warnings and notices)

Location:
trunk
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/globals/classes/form.php

    r6 r187  
    7373                                $this->data[$i]['Pickup_url'] = makelink(array("page" => "pickup", "subpage" => $subpage, "object" => $this->info['FORM_NAME'].".elements['".str_replace(".", "__", $data_field).($multi==FALSE?'':"[]")."']")); 
    7474                                if ($multi == FALSE) { 
    75                                         $this->data[$i]['Type_Pickup'] = $values[0]; 
     75                                        $this->data[$i]['Type_Pickup'] = (isset($values[0])?$values[0]:''); 
    7676                                } else { 
    7777                                        $this->data[$i]['Type_Pickup'] = $values; 
     
    9191                        for($i=0;$i<count($this->data);$i++) { 
    9292                                $key = explode("__", $this->data[$i]['fullField']); 
    93                                 if ($key[1] != '') { 
     93                                if (isset($key[1])) { 
    9494                                        if ($ckey == $key[0]) { 
    95                                                 $this->data[$i]['value'] = $db_data[0][$key[1]]; 
     95                                                $this->data[$i]['value'] = (isset($db_data[0][$key[1]])?$db_data[0][$key[1]]:""); 
    9696                                        } 
    9797                                } 
     
    125125                for ($i=0;$i<count($this->data);$i++) { 
    126126                        if (isset($this->data[$i])) { 
    127                                 $this->data[$i]['value'] = (isset($_POST[$this->data[$i]['fullField']]) ? $_POST[$this->data[$i]['fullField']] : $sc[$this->data[$i]['fullField']]); 
     127                                if (isset($sc[$this->data[$i]['fullField']])) { 
     128                                        $sc_dati_ff = $sc[$this->data[$i]['fullField']]; 
     129                                } 
     130                                else {  
     131                                        $sc_dati_ff = '';  
     132                                } 
     133                                $this->data[$i]['value'] = (isset($_POST[$this->data[$i]['fullField']]) ? $_POST[$this->data[$i]['fullField']] : $sc_dati_ff); 
    128134                                if (isset($this->data[$i]['Compare'])) { 
    129                                         $this->data[$i]['Compare_value'] = (isset($_POST[$this->data[$i]['fullField'].'_compare']) ? $_POST[$this->data[$i]['fullField'].'_compare'] : $sc[$this->data[$i]['fullField'].'_compare']); 
     135                                        if (isset($sc[$this->data[$i]['fullField'].'_compare'])) { 
     136                                            $sc_dati_ff_cmp = $sc[$this->data[$i]['fullField'].'_compare']; 
     137                                        } 
     138                                        else { 
     139                                            $sc_dati_ff_cmp = ''; 
     140                                        } 
     141                                        $this->data[$i]['Compare_value'] = (isset($_POST[$this->data[$i]['fullField'].'_compare']) ? $_POST[$this->data[$i]['fullField'].'_compare'] : $sc_dati_ff_cmp); 
    130142                                } 
    131143                                $this->data[$i]['Null'] = 'YES'; 
     
    136148        // get the where string for SQL. $extra[_fieldname_]: '=' | 'starts_with' | 'ends_with' | 'contains' | 'exclude' 
    137149        function db_data_where($extra="") { 
     150                $where = ""; 
    138151                for ($i=0;$i<count($this->data);$i++) { 
    139152                        if (isset($this->data[$i])) { 
     
    143156                                } 
    144157                                $value = $this->data[$i]['value']; 
    145                                 switch ($extra[$item]) { 
     158                                switch (isset($extra[$item])?$extra[$item]:'') { 
    146159                                        case '': 
    147160                                        case '=': 
     
    183196                global $db; 
    184197                if (!is_array($pdata)) $pdata = array(); 
     198                $ret = TRUE; 
     199                $args = func_get_args(); 
     200                for ($carg=1;$carg<func_num_args() || $carg==1;$carg=$carg+3) { 
     201                        $ckey = isset($args[$carg])?$args[$carg]:''; 
     202                        unset($data); 
     203                        $cpost = $this->correct_datetime_data($_POST); 
     204                        for($i=0;$i<count($this->data);$i++) { 
     205                                $key = explode("__", $this->data[$i]['fullField']); 
     206                                if (isset($key[1])) { 
     207                                        if ($ckey == '') $ckey = $key[0]; 
     208                                        if ($ckey == $key[0]) { 
     209                                                if (isset($cpost[$this->data[$i]['fullField']])) { 
     210                                                    if (!is_array($cpost[$this->data[$i]['fullField']])) { 
     211                                                                $data[$key[1]] = $cpost[$this->data[$i]['fullField']]; 
     212                                                    } 
     213                                                } 
     214                                        } 
     215                                } 
     216                        } 
     217                        reset($pdata); 
     218                        while (list($key, $value) = each($pdata)) { 
     219                                $key = explode(".", $key); 
     220                                if ($ckey == $key[0] || !isset($key[1])) { 
     221                                        $data[(isset($key[1])?$key[1]:$key[0])] = $value; 
     222                                } 
     223                        } 
     224                        $field = isset($args[$carg+1])?$args[$carg+1]:''; 
     225                        $value = isset($args[$carg+2])?$args[$carg+2]:''; 
     226                        if ($field == '' || $value == '' || $value == 'add') { 
     227                                $ret = $ret && $db->add($ckey, $data); 
     228                        } else { 
     229                                $ret = $ret && $db->set($ckey, $data, "$field = '$value'"); 
     230                        } 
     231                } 
     232                return $ret; 
     233        } 
     234         
     235        // pdata: extra data, args: [[table], [key] [value] ...] 
     236        function db_set_multi($pdata=array()) {  
     237                global $db; 
    185238                $ret = TRUE; 
    186239                $args = func_get_args(); 
     
    191244                        for($i=0;$i<count($this->data);$i++) { 
    192245                                $key = explode("__", $this->data[$i]['fullField']); 
    193                                 if ($key[1] != '') { 
     246                                if (isset($key[1])) { 
    194247                                        if ($ckey == '') $ckey = $key[0]; 
    195248                                        if ($ckey == $key[0]) { 
    196                                                 if (!is_array($cpost[$this->data[$i]['fullField']])) { 
    197                                                         $data[$key[1]] = $cpost[$this->data[$i]['fullField']]; 
    198                                                 } 
     249                                                $data[$key[1]] = (isset($cpost[$this->data[$i]['fullField']]))?$cpost[$this->data[$i]['fullField']]:NULL; 
    199250                                        } 
    200251                                } 
     
    203254                        while (list($key, $value) = each($pdata)) { 
    204255                                $key = explode(".", $key); 
    205                                 if ($ckey == $key[0] || $key[1] == '') { 
    206                                         $data[($key[1]==''?$key[0]:$key[1])] = $value; 
    207                                 } 
    208                         } 
    209                         $field = $args[$carg+1]; 
    210                         $value = $args[$carg+2]; 
    211                         if ($field == '' || $value == '' || $value == 'add') { 
    212                                 $ret = $ret && $db->add($ckey, $data); 
    213                         } else { 
    214                                 $ret = $ret && $db->set($ckey, $data, "$field = '$value'"); 
    215                         } 
    216                 } 
    217                 return $ret; 
    218         } 
    219          
    220         // pdata: extra data, args: [[table], [key] [value] ...] 
    221         function db_set_multi($pdata=array()) {  
    222                 global $db; 
    223                 $ret = TRUE; 
    224                 $args = func_get_args(); 
    225                 for ($carg=1;$carg<func_num_args() || $carg==1;$carg=$carg+3) { 
    226                         $ckey = $args[$carg]; 
    227                         unset($data); 
    228                         $cpost = $this->correct_datetime_data($_POST); 
    229                         for($i=0;$i<count($this->data);$i++) { 
    230                                 $key = explode("__", $this->data[$i]['fullField']); 
    231                                 if ($key[1] != '') { 
    232                                         if ($ckey == '') $ckey = $key[0]; 
    233                                         if ($ckey == $key[0]) { 
    234                                                 $data[$key[1]] = $cpost[$this->data[$i]['fullField']]; 
    235                                         } 
    236                                 } 
    237                         } 
    238                         reset($pdata); 
    239                         while (list($key, $value) = each($pdata)) { 
    240                                 $key = explode(".", $key); 
    241                                 if ($ckey == $key[0] || $key[1] == '') { 
    242                                         $data[($key[1]==''?$key[0]:$key[1])] = $value; 
     256                                if ($ckey == $key[0] || !isset($key[1])) { 
     257                                        $data[(!isset($key[1])?$key[0]:$key[1])] = $value; 
    243258                                } 
    244259                        } 
     
    253268                        } 
    254269                        $ret = $ret && $db->del($ckey, $args[$carg+1]." = '".$args[$carg+2]."'"); 
    255                         for ($i=0;$i<count($data_f);$i++) { 
    256                                 $data_f[$i][$args[$carg+1]] = $args[$carg+2]; 
    257                                 $ret = $ret && $db->add($ckey, $data_f[$i]); 
     270                        if (isset($data_f)) { 
     271                                for ($i=0;$i<count($data_f);$i++) { 
     272                                        $data_f[$i][$args[$carg+1]] = $args[$carg+2]; 
     273                                        $ret = $ret && $db->add($ckey, $data_f[$i]); 
     274                                } 
    258275                        } 
    259276                } 
  • trunk/globals/classes/geocalc.php

    r90 r187  
    1 <? 
     1<?php 
    22 
    33// This code was converted to PHP from Visual C++ 
     
    5959 
    6060    if (($ilat1 == $ilat2) && ($ilon1 == $ilon2)) { 
    61       return result; 
     61      return $result; 
    6262    } 
    6363    else if ($ilat1 == $ilat2) { 
  • trunk/globals/classes/mysql.php

    r116 r187  
    7272                } 
    7373                $i = 0; 
     74                $res = array(); 
    7475                while ($ret = mysql_fetch_assoc($result)) { 
    7576                        while (list ($key, $value) = each ($ret)) { 
     
    103104                        } 
    104105                } 
     106                $keys = ""; 
     107                $values = ""; 
    105108                while (list ($key, $value) = each ($data)) { 
    106109                        $key_t = explode(".", $key); 
     
    138141                        $nulls['`'.$db_fields[$i]['Field'].'`'] = $db_fields[$i]['Null']; 
    139142                } 
     143                $sets=""; 
    140144                while (list ($key, $value) = each ($data)) { 
    141145                        $key_t = explode(".", $key); 
     
    153157                if (isset($not_null_keys)) { 
    154158                        $this->output_error_fields_required($not_null_keys); 
    155                         if ($addlog) { 
     159                        if ($addlog && isset($aff)) { 
    156160                                for ($i=0;$i<count($aff);$i++) { 
    157161                                        $this->add_log('EDIT', $table_start, $aff[$i]['id'], serialize($data), $query, $this->get_error()); 
     
    161165                } 
    162166                $res = $this->query_data($query); 
    163                 if ($addlog) { 
     167                if ($addlog && isset($aff)) { 
    164168                        for ($i=0;$i<count($aff);$i++) { 
    165169                                $this->add_log('EDIT', $table_start, $aff[$i]['id'], serialize($data), $query, (!$res?$this->get_error():'')); 
     
    175179                $query = "DELETE FROM $table".($where==""?"":" WHERE $where"); 
    176180                $res = $this->query_data($query); 
    177                 if ($addlog) { 
     181                if ($addlog && isset($aff)) { 
    178182                        for ($i=0;$i<count($aff);$i++) { 
    179183                                $this->add_log('DELETE', $table_start, $aff[$i]['id'], '', $query, (!$res?$this->get_error():'')); 
     
    209213        function output_error_fields_required($fields_required) { 
    210214                global $main, $lang; 
     215                $fields_required_text = ''; 
    211216                foreach ($fields_required as $key => $value) { 
    212217                        if ($fields_required_text != '') $fields_required_text .= ", ";  
  • trunk/globals/classes/table.php

    r164 r187  
    3232                global $db, $vars; 
    3333                if ($limit == '' && $limit !== FALSE) { 
    34                         if ($this->info['CURRENT_PAGE'] == '' && $_SERVER['REQUEST_METHOD'] == 'GET') $this->info['CURRENT_PAGE'] = get($this->info['TABLE_NAME']."_showpage"); 
    35                         if ($this->info['CURRENT_PAGE'] == '') $this->info['CURRENT_PAGE'] = 1; 
     34                        if ((!isset($this->info['CURRENT_PAGE']) || $this->info['CURRENT_PAGE'] == '') && $_SERVER['REQUEST_METHOD'] == 'GET') $this->info['CURRENT_PAGE'] = get($this->info['TABLE_NAME']."_showpage"); 
     35                        if ( !isset($this->info['CURRENT_PAGE']) || $this->info['CURRENT_PAGE'] == '') $this->info['CURRENT_PAGE'] = 1; 
    3636                        $page = $this->info['CURRENT_PAGE']; 
    3737                        $limit = (($page-1)*$vars['constructor']['max_rows']).', '.$vars['constructor']['max_rows']; 
     
    4949                        } 
    5050                } 
     51                $isset = FALSE; 
    5152                if (isset($data[0])) { 
    5253                        $isset = TRUE; 
     
    7677                        if (isset($data[0][$fkey]) || ($isset !== TRUE && !isset($data[0][$fkey]))) $data[0][$fkey] = $f; 
    7778                } 
     79                if (!isset($this->data[0])) { 
     80                        $this->data[0] = array();                
     81                }  
    7882                $this->data[0] = array_merge($this->data[0], $data[0]); 
    7983                unset($data[0]); 
     
    8589                for ($i=0;$i<count($form->data);$i++) { 
    8690                        if (isset($form->data[$i])) { 
    87                                 $sf=$sc[$form->data[$i]['fullField']]; 
     91                                $sf = isset($sc[$form->data[$i]['fullField']])?$sc[$form->data[$i]['fullField']]:''; 
    8892                                $search[$form->data[$i]['fullField']] = (isset($_POST[$form->data[$i]['fullField']])?$_POST[$form->data[$i]['fullField']]:$sf); 
    8993                                if (isset($form->data[$i]['Compare'])) { 
    90                                         $search[$form->data[$i]['fullField'].'_compare'] = (isset($_POST[$form->data[$i]['fullField'].'_compare']) ? $_POST[$form->data[$i]['fullField'].'_compare'] : $sc[$form->data[$i]['fullField'].'_compare']); 
     94                                        $sf_cmp = isset($sc[$form->data[$i]['fullField'].'_compare'])?$sc[$form->data[$i]['fullField'].'_compare']:''; 
     95                                        $search[$form->data[$i]['fullField'].'_compare'] = (isset($_POST[$form->data[$i]['fullField'].'_compare']) ? $_POST[$form->data[$i]['fullField'].'_compare'] : $sf_cmp); 
    9196                                } 
    9297                        } 
    9398                } 
    9499                $search = serialize($search); 
    95                 for ($i=1;$i<=$this->info['TOTAL_PAGES'];$i++) { 
    96                         $this->info['PAGES'][$i] = makelink(array($form->info['FORM_NAME']."_search" => $search, $this->info['TABLE_NAME']."_showpage" => $i), TRUE); 
     100                if (isset($this->info['TOTAL_PAGES'])) { 
     101                        for ($i=1;$i<=$this->info['TOTAL_PAGES'];$i++) { 
     102                                $this->info['PAGES'][$i] = makelink(array($form->info['FORM_NAME']."_search" => $search, $this->info['TABLE_NAME']."_showpage" => $i), TRUE); 
     103                        } 
    97104                } 
    98105        } 
  • trunk/globals/functions.php

    r178 r187  
    4949        global $page_admin, $main; 
    5050        if ($_SERVER['REQUEST_METHOD'] == 'GET') { 
    51                 $ret = $_GET[$key]; 
     51                $ret = ""; 
     52                if (isset($_GET[$key])) { 
     53                    $ret = $_GET[$key]; 
     54                }                
    5255        } else { 
    5356                parse_str($_POST['query_string'], $output); 
    54                 $ret = $output[$key]; 
     57                $ret = ""; 
     58                if (isset($output[$key])) { 
     59                    $ret = $output[$key]; 
     60                } 
    5561        } 
    5662        switch ($key) { 
     
    102108        } 
    103109        if ($cur_gs_vars == TRUE) { 
    104                 $o = array_merge($o, $qs_vars); 
    105         } 
    106         $o = array_merge($o, $extra); 
     110                $o = array_merge($o, (array)$qs_vars); 
     111        } 
     112        $o = array_merge($o, (array)$extra); 
    107113        return ($htmlspecialchars?htmlspecialchars('?'.query_str($o)):'?'.query_str($o)); 
    108114} 
     
    163169function reset_smarty() { 
    164170        global $smarty, $lang; 
    165         $smarty->clear_all_assign; 
     171        $smarty->clear_all_assign(); 
    166172        $smarty->assign_by_ref('lang', $lang); 
    167173        $smarty->assign('tpl_dir', $smarty->template_dir); 
     
    289295 
    290296function generate_account_code() { 
     297        $ret = 0; 
    291298        for ($i=1;$i<=20;$i++) { 
    292299                $ret .= rand(0, 9); 
     
    310317        $name = strtolower($name); 
    311318        $allowchars = 'abcdefghijklmnopqrstuvwxyz0123456789-'; 
     319        $ret = ''; 
    312320        for ($i=0; $i<strlen($name); $i++) { 
    313321                $char = substr($name, $i, 1); 
     
    316324        if ($ret == '') $ret = 'noname'; 
    317325        $i=2; 
     326        $extension = ''; 
    318327        do { 
    319328                $cnt = $db->cnt('', 'nodes', "name_ns = '".$ret.$extension."' AND id != '".$node."'"); 
     
    339348        global $main, $vars, $lang; 
    340349        $dirname = dirname($_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']); 
    341         $gmap_key = $vars['gmap']['keys'][$dirname]; 
    342         if ($gmap_key == '') $gmap_key = $vars['gmap']['keys'][$dirname."/"]; 
    343         if ($gmap_key == '') $gmap_key = $vars['gmap']['keys']["http://".$dirname]; 
    344         if ($gmap_key == '') $gmap_key = $vars['gmap']['keys']["http://".$dirname."/"]; 
     350        $gmap_key = '' ; 
     351        if (isset($vars['gmap']['keys'][$dirname])) { 
     352                $gmap_key = $vars['gmap']['keys'][$dirname]; 
     353        } 
     354        if (isset($vars['gmap']['keys'][$dirname."/"]) && $gmap_key == '') { 
     355                $gmap_key = $vars['gmap']['keys'][$dirname."/"]; 
     356        } 
     357        if (isset($vars['gmap']['keys']["http://".$dirname]) && $gmap_key == '') { 
     358                $gmap_key = $vars['gmap']['keys']["http://".$dirname]; 
     359        } 
     360        if (isset($vars['gmap']['keys']["http://".$dirname."/"]) && $gmap_key == '') { 
     361                $gmap_key = $vars['gmap']['keys']["http://".$dirname."/"]; 
     362        } 
    345363        if ($gmap_key == '') return FALSE; 
    346  
     364         
    347365        $main->html->head->add_script("text/javascript", "http://".$vars['gmap']['server']."/maps?file=api&v=".$vars['gmap']['api']."&key=".$gmap_key."&hl=".$lang["iso639"]); 
    348366        $main->html->head->add_script("text/javascript", $javascript); 
     
    355373         
    356374        $main->html->body->tags['onload'] = "gmap_onload()";     
    357     $main->html->body->tags['onunload'] = "GUnload()"; //added to reduce IE memory leaks 
     375        $main->html->body->tags['onunload'] = "GUnload()"; //added to reduce IE memory leaks 
    358376        return TRUE; 
    359377} 
     
    386404        } elseif (get('lang') != '') { 
    387405                $tl = get('lang'); 
    388         } elseif ($_SESSION['lang'] != '') { 
     406        } elseif (isset($_SESSION['lang']) && $_SESSION['lang'] != '') { 
    389407                $tl = $_SESSION['lang']; 
    390408        } elseif ($language != '') { 
  • trunk/globals/vars.php

    r63 r187  
    2323         
    2424        'info' => array( 
    25                 'version' => snapshot_version, 
    26                 'min_template_version' => snapshot_min_template_version 
     25                'version' => 0, 
     26                'min_template_version' => 0 
    2727                ) 
    2828 
  • trunk/includes/head.php

    r41 r187  
    2525         
    2626        function add_extra($extra) { 
     27                if (!isset($this->tpl['extra'])) $this->tpl['extra'] = ""; 
    2728                $this->tpl['extra'] .= $extra; 
    2829        } 
  • trunk/includes/main.php

    r167 r187  
    5252                 
    5353                if (get('session_lang') != '') $_SESSION['lang'] = get('session_lang'); 
    54                 language_set($this->userdata->info['language']); 
     54                if (isset($this->userdata->info)) { 
     55                    language_set($this->userdata->info['language']); 
     56                } 
     57                else { 
     58                    language_set(); 
     59                } 
     60                 
    5561                // Reload user info from database using SET NAMES (workaround) 
    5662                $this->userdata->load_info(); 
  • trunk/includes/main_center.php

    r152 r187  
    3333        function security_check() { 
    3434                global $main, $db; 
    35                 if ($main->userdata->privileges['admin'] === TRUE) return TRUE; 
     35                if (isset($main->userdata->privileges['admin']) && $main->userdata->privileges['admin'] === TRUE) return TRUE; 
    3636                switch (get('page')) { 
    3737                        case 'admin': 
  • trunk/includes/main_footer.php

    r143 r187  
    3333                $this->tpl['php_time'] = getmicrotime() - $php_start; 
    3434                $this->tpl['mysql_time'] = $db->total_time; 
    35                 if ($main->userdata->privileges['admin'] === TRUE && $vars['debug']['enabled'] == TRUE) { 
     35                if (isset($main->userdata->privileges['admin']) && $main->userdata->privileges['admin'] === TRUE && $vars['debug']['enabled'] == TRUE) { 
    3636                        $this->tpl['debug_mysql'] = ROOT_PATH."debug/mysql.php?".get_qs(); 
    3737                } 
  • trunk/includes/main_header.php

    r143 r187  
    2323         
    2424        var $hide=FALSE; 
    25          
     25        var $tpl; 
     26                 
    2627        function header() { 
    2728        } 
  • trunk/includes/main_menu.php

    r156 r187  
    3838                $this->tpl['form_login'] = $construct->form($this->form_login(), __FILE__); 
    3939                 
     40                $main->html->body->tpl['logged'] = $this->tpl['logged']; 
    4041                $main->html->body->tpl['form_login'] = $this->tpl['form_login']; 
    41                 $main->html->body->tpl['logged_username'] = $main->userdata->info['username']; 
     42                $main->html->body->tpl['logged_username'] = isset($main->userdata->info['username'])?$main->userdata->info['username']:""; 
    4243                $main->html->body->tpl['link_logged_profile'] = makelink(array("page" => "users", "user" => $main->userdata->user)); 
    4344                 
     
    9798                $this->tpl['link_register'] = makelink(array("page" => "users", "user" => "add")); 
    9899                $this->tpl['link_logout'] = makelink(array("page" => "users", "action" => "logout")); 
    99                 parse_str(substr(makelink(array("page" => "search"), FALSE, TRUE, FALSE), 1), &$this->tpl['query_string']); 
     100                parse_str(substr(makelink(array("page" => "search"), FALSE, TRUE, FALSE), 1), $this->tpl['query_string']); 
    100101                $this->tpl['stats_nodes_active'] = 
    101102                                $db->cnt('', 
     
    163164        function output_onpost_form_login() { 
    164165                global $main; 
    165                 if ($main->userdata->login($_POST['users__username'], $_POST['users__password'], ($_POST['save_login']=='Y'?TRUE:FALSE))) { 
     166                if ($main->userdata->login($_POST['users__username'], $_POST['users__password'], ((isset($_POST['save_login']) && $_POST['save_login']=='Y')?TRUE:FALSE))) { 
    166167                        if ($main->userdata->info['status'] == 'pending') { 
    167168                                $main->message->set_fromlang('info', 'activation_required'); 
  • trunk/includes/pages/admin/admin_areas.php

    r156 r187  
    2020 */ 
    2121 
    22 if (get('area') != '') include_once($root_path."includes/pages/admin/admin_areas_area.php"); 
     22if (get('area') != '') include_once(ROOT_PATH."includes/pages/admin/admin_areas_area.php"); 
    2323 
    2424class admin_areas { 
  • trunk/includes/pages/admin/admin_regions.php

    r156 r187  
    2020 */ 
    2121 
    22 if (get('region') != '') include_once($root_path."includes/pages/admin/admin_regions_region.php"); 
     22if (get('region') != '') include_once(ROOT_PATH."includes/pages/admin/admin_regions_region.php"); 
    2323 
    2424class admin_regions { 
  • trunk/includes/pages/admin/admin_services.php

    r152 r187  
    2020 */ 
    2121 
    22 if (get('service') != '') include_once($root_path."includes/pages/admin/admin_services_service.php"); 
     22if (get('service') != '') include_once(ROOT_PATH."includes/pages/admin/admin_services_service.php"); 
    2323 
    2424class admin_services { 
  • trunk/includes/pages/gmap/gmap_xml.php

    r137 r187  
    3030                 
    3131                $node = $db->get('latitude, longitude', 'nodes', "id = ".intval(get('node'))); 
    32                 $node = $node[0]; 
    33                  
     32                $node = isset($node[0])?$node[0]:''; 
     33 
     34                $having = ''; 
    3435                if (get('node') != '') $having .= ($having!=''?' OR ':'')."id = ".intval(get('node')); 
    3536                if (get('show_p2p') == 1) $having .= ($having!=''?' OR ':'').'total_p2p > 0'; 
     
    5152                        'nodes.id' . 
    5253                        ($having!=''?' HAVING '.$having:'')); 
    53                 $xml .= "<?xml version='1.0' encoding='".$lang['charset']."' standalone='yes'?>\r";  
     54                $xml = "<?xml version='1.0' encoding='".$lang['charset']."' standalone='yes'?>\r";  
    5455                $xml .= "<wind>\r"; 
    5556                $xml .= "<nodes>\r"; 
     
    8384                $xml .= "</nodes>\r"; 
    8485                 
     86                $where = ''; 
    8587                if (get('show_links_p2p') == 1) $where .= ($where!=''?' OR ':'')."p2p.type = 'p2p'"; 
    8688                if (get('show_links_client') == 1) $where .= ($where!=''?' OR ':'')."clients.type = 'client'"; 
  • trunk/includes/pages/hostmaster/hostmaster_dnsnameservers.php

    r26 r187  
    3939        function table_nameservers() { 
    4040                global $construct, $db, $vars; 
    41                 if ($_POST['dns_nameservers__ip'] != '') $_POST['dns_nameservers__ip'] = ip2long($_POST['dns_nameservers__ip']); 
     41                if (isset($_POST['dns_nameservers__ip'])) $_POST['dns_nameservers__ip'] = ip2long($_POST['dns_nameservers__ip']); 
    4242                if ($_GET['form_search_nameservers_search'] != '') { 
    4343                        $t = unserialize(stripslashes($_GET['form_search_nameservers_search'])); 
    44                         if ($t['dns_nameservers__ip'] != '') $t['dns_nameservers__ip'] = ip2long($t['dns_nameservers__ip']); 
     44                        if (isset($t['dns_nameservers__ip'])) $t['dns_nameservers__ip'] = ip2long($t['dns_nameservers__ip']); 
    4545                        $_GET['form_search_nameservers_search'] = addslashes(serialize($t)); 
    4646                } 
  • trunk/includes/pages/hostmaster/hostmaster_dnszone.php

    r148 r187  
    3737 
    3838                $tmp = $db->get('users.email, users_nodes.owner', 'users, users_nodes, dns_zones', "users_nodes.user_id = users.id AND users_nodes.node_id = dns_zones.node_id AND dns_zones.id = '".get("zone")."'"); 
     39                if (!isset($form_zone->info['email_all'])) $form_zone->info['email_all'] = ''; 
     40                if (!isset($form_zone->info['email_owner'])) $form_zone->info['email_owner'] = ''; 
    3941                foreach( (array) $tmp as $key => $value) { 
    4042                        $form_zone->info['email_all'] .= $value['email'].', '; 
  • trunk/includes/pages/hostmaster/hostmaster_range.php

    r148 r187  
    3636                $form_range->data[1]['value'] = long2ip($form_range->data[1]['value']); 
    3737                $tmp = $db->get('users.email, users_nodes.owner', 'users, users_nodes, ip_ranges', "users_nodes.user_id = users.id AND users_nodes.node_id = ip_ranges.node_id AND ip_ranges.id = '".get("iprange")."'"); 
     38                if (!isset($form_range->info['email_all'])) $form_range->info['email_all']= ''; 
     39                if (!isset($form_range->info['email_owner'])) $form_range->info['email_owner'] = ''; 
    3840                foreach( (array) $tmp as $key => $value) { 
    3941                        $form_range->info['email_all'] .= $value['email'].', '; 
  • trunk/includes/pages/mynodes/mynodes.php

    r152 r187  
    307307                                unset($p); 
    308308                        } 
    309                         if ($table_photosview->data[$p]['view_point'] == $value) { 
     309                        if (isset($p) && ($table_photosview->data[$p]['view_point'] == $value)) { 
    310310                                $table_photosview->data[$p]['photo'] = $vars['folders']['photos'].'photo-'.$table_photosview->data[$p]['id'].'-s.jpg'; 
    311311                                $t[$i] = $table_photosview->data[$p]; 
     
    324324        function output() { 
    325325                if (get('subpage') != '') return $this->page->output(); 
    326                 if (strstr($_POST['form_name'], 'table_links_ap') !== FALSE) return $this->output_onpost_table_links_ap(); 
     326                if (isset($_POST['form_name']) && (strstr($_POST['form_name'], 'table_links_ap') !== FALSE)) return $this->output_onpost_table_links_ap(); 
    327327                if ($_SERVER['REQUEST_METHOD'] == 'POST' && method_exists($this, 'output_onpost_'.$_POST['form_name'])) return call_user_func(array($this, 'output_onpost_'.$_POST['form_name'])); 
    328328                global $construct, $main, $db; 
     
    539539        function output_onpost_table_photosview() { 
    540540                global $vars, $db, $main; 
    541                 foreach( (array) $_POST['id'] as $key => $value) { 
    542                         $db->del("photos", "id = '".$value."'"); 
    543                         $uploaddir = $vars['folders']['photos']; 
    544                         $filename = 'photo-'.$value.".*"; 
    545                         delfile(ROOT_PATH.$uploaddir.$filename); 
    546                         $filename = 'photo-'.$value."-*.*"; 
    547                         delfile(ROOT_PATH.$uploaddir.$filename); 
     541                if (isset($_POST['id'])) { 
     542                        foreach( (array) $_POST['id'] as $key => $value) { 
     543                                $db->del("photos", "id = '".$value."'"); 
     544                                $uploaddir = $vars['folders']['photos']; 
     545                                $filename = 'photo-'.$value.".*"; 
     546                                delfile(ROOT_PATH.$uploaddir.$filename); 
     547                                $filename = 'photo-'.$value."-*.*"; 
     548                                delfile(ROOT_PATH.$uploaddir.$filename); 
     549                        } 
    548550                } 
    549551                foreach( (array) array('N','NE','E','SE','S','SW','W','NW', 'PANORAMIC') as $value) { 
    550                         if ($_FILES[$value]['tmp_name'] != '') { 
    551                                 if (@!imagecreatefromjpeg($_FILES[$value]['tmp_name'])) continue; 
     552                        if (isset($_FILES[$value]['tmp_name'])) { 
     553                                if (!imagecreatefromjpeg($_FILES[$value]['tmp_name'])) continue; 
    552554                                $db->add("photos", array('node_id' => intval(get('node')), 'type' => 'view', 'view_point' => $value, 'info' => $_POST['info-'.$value])); 
    553555                                $ins_id = $db->insert_id; 
  • trunk/includes/pages/nodes/nodes_plot_link.php

    r146 r187  
    5959                        $this->tpl['a_node_elevation'] = $a_node_data['elevation'];  
    6060                        $this->tpl['b_node_elevation'] = $b_node_data['elevation'];  
    61                          
     61 
    6262                        $a_node_total_elevation = $this->tpl['a_node_geo_elevation'] + $this->tpl['a_node_elevation'];  
    6363                        $b_node_total_elevation = $this->tpl['b_node_geo_elevation'] + $this->tpl['b_node_elevation'];  
    6464                         
    6565                        $this->tpl['distance'] = $geocalc->GCDistance($a_node_data['latitude'], $a_node_data['longitude'], $b_node_data['latitude'], $b_node_data['longitude']); 
    66                         $this->tpl['a_node_tilt'] = rad2deg(atan(($b_node_total_elevation - $a_node_total_elevation) / ($this->tpl['distance'] * 1000))); 
    67                         $this->tpl['b_node_tilt'] = rad2deg(atan(($a_node_total_elevation - $b_node_total_elevation) / ($this->tpl['distance'] * 1000))); 
     66                        if ($this->tpl['distance'] != 0) { 
     67                                $this->tpl['a_node_tilt'] = rad2deg(atan(($b_node_total_elevation - $a_node_total_elevation) / ($this->tpl['distance'] * 1000))); 
     68                                $this->tpl['b_node_tilt'] = rad2deg(atan(($a_node_total_elevation - $b_node_total_elevation) / ($this->tpl['distance'] * 1000))); 
     69                        } 
     70                        else {  // For links between nodes in the same place but with different elevations (e.g. link between rooftop and floor) 
     71                                // FIXME: plotlink function of geoimage class does not plot anything in that (admitedly rare) case, but perhaps it should(?) 
     72                                $sign = 0; 
     73                                $elev = $b_node_total_elevation - $a_node_total_elevation; 
     74                                if ($elev != 0) $sign = ($elev>0)?1:-1; 
     75                                $this->tpl['a_node_tilt'] = ($elev!=0?$sign:0) * 90; 
     76                                $this->tpl['b_node_tilt'] = -($this->tpl['a_node_tilt']); 
     77                        } 
    6878                        $this->tpl['distance'] = sqrt( pow($this->tpl['distance'] * 1000, 2) + pow( abs($a_node_total_elevation - $b_node_total_elevation), 2 ) ) / 1000; 
    6979                        $this->tpl['gearth'] = makelink(array("page" => "gearth", "subpage" => "download", "node" => get('a_node'), "node2" => get('b_node'), "show_p2p" => "1", "show_aps" => "1", "show_clients" => "1", "show_unlinked" => "1", "show_links_p2p" => "1", "show_links_client" => "1")); 
    70                         $this->tpl['frequency'] = (integer)$_POST['frequency']; 
     80                        $this->tpl['frequency'] = (integer)(isset($_POST['frequency'])?$_POST['frequency']:2450); 
    7181                        if ($this->tpl['frequency'] <= 0) $this->tpl['frequency'] = 2450; 
    7282                        $frequency = $this->tpl['frequency'] * 1000000; 
     
    7484                        $this->tpl['fsl'] = 20 * log10(4 * pi() * $this->tpl['distance'] * ($frequency / $c)); 
    7585                         
    76                         $this->tpl['plot_image'] = makelink(array("page" => "nodes", "subpage" => "plot", "a_node" => $this->tpl['a_node'], "b_node" => $this->tpl['b_node'], "frequency" => $_POST['frequency'])); 
     86                        $this->tpl['plot_image'] = makelink(array("page" => "nodes", "subpage" => "plot", "a_node" => $this->tpl['a_node'], "b_node" => $this->tpl['b_node'], "frequency" => $this->tpl['frequency'])); 
    7787                } 
    7888                 
  • trunk/includes/pages/nodes/nodes_view.php

    r154 r187  
    2121 
    2222include_once(ROOT_PATH.'globals/classes/geocalc.php'); 
    23 $geocalc = new geocalc(); 
     23 
     24$geocalc = new GeoCalc(); 
    2425 
    2526include_once(ROOT_PATH.'globals/classes/srtm.php'); 
     
    3839                $a_node_i = $db->get('latitude, longitude, elevation', 'nodes', "id = '".$a_node."'"); 
    3940                $b_node_i = $db->get('latitude, longitude, elevation', 'nodes', "id = '".$b_node."'"); 
    40                  
    41                 $lat1 = $a_node_i[0]['latitude']; 
    42                 $lon1 = $a_node_i[0]['longitude']; 
    43                 $lat2 = $b_node_i[0]['latitude']; 
    44                 $lon2 = $b_node_i[0]['longitude']; 
     41 
     42                $lat1 = isset($a_node_i[0]['latitude'])?$a_node_i[0]['latitude']:1;   // choose something better than '1' here 
     43                $lon1 = isset($a_node_i[0]['longitude'])?$a_node_i[0]['longitude']:1; // the same 
     44                $lat2 = isset($b_node_i[0]['latitude'])?$b_node_i[0]['latitude']:1;   // the same 
     45                $lon2 = isset($b_node_i[0]['longitude'])?$b_node_i[0]['longitude']:1; // the same 
    4546 
    4647                $a_node_el = str_replace(",", ".", $srtm->get_elevation($lat1, $lon1, FALSE)); 
     
    313314                 
    314315                $this->tpl['link_plot_link'] = makelink(array("page" => "nodes", "subpage" => "plot_link", "a_node" => $this->tpl['node']['id'])); 
    315                 if($main->userdata->privileges['admin'] === TRUE || $db->cnt('', "users_nodes", "node_id = ".get('node')." AND user_id = '".$main->userdata->user."'") > 0) $this->tpl['edit_node'] = makelink(array("page" => "mynodes", "node" => get('node'))); 
     316                if((isset($main->userdata->privileges['admin']) && $main->userdata->privileges['admin'] === TRUE) || $db->cnt('', "users_nodes", "node_id = ".get('node')." AND user_id = '".$main->userdata->user."'") > 0) $this->tpl['edit_node'] = makelink(array("page" => "mynodes", "node" => get('node'))); 
    316317                $this->tpl['link_fullmap'] = makelink(array("page" => "gmap", "node" => get('node'))); 
    317318                $this->tpl['link_gearth'] = makelink(array("page" => "gearth", "subpage" => "download", "node" => get('node'), "show_p2p" => "1", "show_aps" => "1", "show_clients" => "1", "show_unlinked" => "1", "show_links_p2p" => "1", "show_links_client" => "1")); 
  • trunk/includes/pages/users/users.php

    r159 r187  
    5151                } 
    5252                 
    53                 if ($main->userdata->privileges['admin'] === TRUE) { 
     53                if (isset($main->userdata->privileges['admin']) && $main->userdata->privileges['admin'] === TRUE) { 
    5454                        $form_user->db_data('rights.type, users.status'); 
    5555                        $form_user->data[9]['Type'] = 'enum_multi'; 
     
    130130                $form_user = $this->form_user(); 
    131131                array_splice($form_user->data, 2, 1); 
    132                 if ($_POST['users__password'] == '') array_splice($form_user->data, 1, 1); 
     132                if (!isset($_POST['users__password'])) array_splice($form_user->data, 1, 1); 
    133133                if (get('user') == 'add') { 
    134134                        $a['status'] = 'pending';        
    135135                        $a['account_code'] = generate_account_code(); 
    136136                } 
    137                 $ret = $form_user->db_set($a, "users", "id", get('user')); 
     137                $ret = $form_user->db_set((isset($a)?$a:""), "users", "id", get('user')); 
    138138                if (get('user') == 'add') { 
    139139                        $ins_id = $db->insert_id; 
     
    146146                        $ret = $ret && $form_user->db_set_multi(array('owner' => 'N'), "users_nodes", "user_id", $ins_id); 
    147147                        $ret = $ret && $db->del('users_nodes', "user_id = '".$ins_id."' AND owner = 'Y'"); 
    148                         foreach((array)$_POST['node_id_owner'] as $value) { 
    149                                 $ret = $ret && $db->del('users_nodes', "node_id = '".$value."' AND owner = 'Y'"); 
    150                                 $ret = $ret && $db->add('users_nodes', array("user_id" => $ins_id, "node_id" => $value, 'owner' => 'Y')); 
     148                        if (isset($_POST['node_id_owner'])) { 
     149                                foreach((array)$_POST['node_id_owner'] as $value) { 
     150                                        $ret = $ret && $db->del('users_nodes', "node_id = '".$value."' AND owner = 'Y'"); 
     151                                        $ret = $ret && $db->add('users_nodes', array("user_id" => $ins_id, "node_id" => $value, 'owner' => 'Y')); 
     152                                } 
    151153                        } 
    152154                } 
  • trunk/templates/basic/config.php

    r63 r187  
    44         
    55        'template' => array( 
    6                 'version' => snapshot_template_version, 
    7                 'minor_version' => snapshot_template_minor_version 
     6                'version' => 0, 
     7                'minor_version' => 0 
    88                ) 
    99 
Note: See TracChangeset for help on using the changeset viewer.