- Timestamp:
- 12/10/2008 04:45:22 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 24 edited
-
globals/classes/form.php (modified) (9 diffs)
-
globals/classes/geocalc.php (modified) (2 diffs)
-
globals/classes/mysql.php (modified) (7 diffs)
-
globals/classes/table.php (modified) (4 diffs)
-
globals/functions.php (modified) (9 diffs)
-
globals/vars.php (modified) (1 diff)
-
includes/head.php (modified) (1 diff)
-
includes/main.php (modified) (1 diff)
-
includes/main_center.php (modified) (1 diff)
-
includes/main_footer.php (modified) (1 diff)
-
includes/main_header.php (modified) (1 diff)
-
includes/main_menu.php (modified) (3 diffs)
-
includes/pages/admin/admin_areas.php (modified) (1 diff)
-
includes/pages/admin/admin_regions.php (modified) (1 diff)
-
includes/pages/admin/admin_services.php (modified) (1 diff)
-
includes/pages/gmap/gmap_xml.php (modified) (3 diffs)
-
includes/pages/hostmaster/hostmaster_dnsnameservers.php (modified) (1 diff)
-
includes/pages/hostmaster/hostmaster_dnszone.php (modified) (1 diff)
-
includes/pages/hostmaster/hostmaster_range.php (modified) (1 diff)
-
includes/pages/mynodes/mynodes.php (modified) (3 diffs)
-
includes/pages/nodes/nodes_plot_link.php (modified) (2 diffs)
-
includes/pages/nodes/nodes_view.php (modified) (3 diffs)
-
includes/pages/users/users.php (modified) (3 diffs)
-
templates/basic/config.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/globals/classes/form.php
r6 r187 73 73 $this->data[$i]['Pickup_url'] = makelink(array("page" => "pickup", "subpage" => $subpage, "object" => $this->info['FORM_NAME'].".elements['".str_replace(".", "__", $data_field).($multi==FALSE?'':"[]")."']")); 74 74 if ($multi == FALSE) { 75 $this->data[$i]['Type_Pickup'] = $values[0];75 $this->data[$i]['Type_Pickup'] = (isset($values[0])?$values[0]:''); 76 76 } else { 77 77 $this->data[$i]['Type_Pickup'] = $values; … … 91 91 for($i=0;$i<count($this->data);$i++) { 92 92 $key = explode("__", $this->data[$i]['fullField']); 93 if ( $key[1] != '') {93 if (isset($key[1])) { 94 94 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]]:""); 96 96 } 97 97 } … … 125 125 for ($i=0;$i<count($this->data);$i++) { 126 126 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); 128 134 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); 130 142 } 131 143 $this->data[$i]['Null'] = 'YES'; … … 136 148 // get the where string for SQL. $extra[_fieldname_]: '=' | 'starts_with' | 'ends_with' | 'contains' | 'exclude' 137 149 function db_data_where($extra="") { 150 $where = ""; 138 151 for ($i=0;$i<count($this->data);$i++) { 139 152 if (isset($this->data[$i])) { … … 143 156 } 144 157 $value = $this->data[$i]['value']; 145 switch ( $extra[$item]) {158 switch (isset($extra[$item])?$extra[$item]:'') { 146 159 case '': 147 160 case '=': … … 183 196 global $db; 184 197 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; 185 238 $ret = TRUE; 186 239 $args = func_get_args(); … … 191 244 for($i=0;$i<count($this->data);$i++) { 192 245 $key = explode("__", $this->data[$i]['fullField']); 193 if ( $key[1] != '') {246 if (isset($key[1])) { 194 247 if ($ckey == '') $ckey = $key[0]; 195 248 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; 199 250 } 200 251 } … … 203 254 while (list($key, $value) = each($pdata)) { 204 255 $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; 243 258 } 244 259 } … … 253 268 } 254 269 $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 } 258 275 } 259 276 } -
trunk/globals/classes/geocalc.php
r90 r187 1 <? 1 <?php 2 2 3 3 // This code was converted to PHP from Visual C++ … … 59 59 60 60 if (($ilat1 == $ilat2) && ($ilon1 == $ilon2)) { 61 return result;61 return $result; 62 62 } 63 63 else if ($ilat1 == $ilat2) { -
trunk/globals/classes/mysql.php
r116 r187 72 72 } 73 73 $i = 0; 74 $res = array(); 74 75 while ($ret = mysql_fetch_assoc($result)) { 75 76 while (list ($key, $value) = each ($ret)) { … … 103 104 } 104 105 } 106 $keys = ""; 107 $values = ""; 105 108 while (list ($key, $value) = each ($data)) { 106 109 $key_t = explode(".", $key); … … 138 141 $nulls['`'.$db_fields[$i]['Field'].'`'] = $db_fields[$i]['Null']; 139 142 } 143 $sets=""; 140 144 while (list ($key, $value) = each ($data)) { 141 145 $key_t = explode(".", $key); … … 153 157 if (isset($not_null_keys)) { 154 158 $this->output_error_fields_required($not_null_keys); 155 if ($addlog ) {159 if ($addlog && isset($aff)) { 156 160 for ($i=0;$i<count($aff);$i++) { 157 161 $this->add_log('EDIT', $table_start, $aff[$i]['id'], serialize($data), $query, $this->get_error()); … … 161 165 } 162 166 $res = $this->query_data($query); 163 if ($addlog ) {167 if ($addlog && isset($aff)) { 164 168 for ($i=0;$i<count($aff);$i++) { 165 169 $this->add_log('EDIT', $table_start, $aff[$i]['id'], serialize($data), $query, (!$res?$this->get_error():'')); … … 175 179 $query = "DELETE FROM $table".($where==""?"":" WHERE $where"); 176 180 $res = $this->query_data($query); 177 if ($addlog ) {181 if ($addlog && isset($aff)) { 178 182 for ($i=0;$i<count($aff);$i++) { 179 183 $this->add_log('DELETE', $table_start, $aff[$i]['id'], '', $query, (!$res?$this->get_error():'')); … … 209 213 function output_error_fields_required($fields_required) { 210 214 global $main, $lang; 215 $fields_required_text = ''; 211 216 foreach ($fields_required as $key => $value) { 212 217 if ($fields_required_text != '') $fields_required_text .= ", "; -
trunk/globals/classes/table.php
r164 r187 32 32 global $db, $vars; 33 33 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; 36 36 $page = $this->info['CURRENT_PAGE']; 37 37 $limit = (($page-1)*$vars['constructor']['max_rows']).', '.$vars['constructor']['max_rows']; … … 49 49 } 50 50 } 51 $isset = FALSE; 51 52 if (isset($data[0])) { 52 53 $isset = TRUE; … … 76 77 if (isset($data[0][$fkey]) || ($isset !== TRUE && !isset($data[0][$fkey]))) $data[0][$fkey] = $f; 77 78 } 79 if (!isset($this->data[0])) { 80 $this->data[0] = array(); 81 } 78 82 $this->data[0] = array_merge($this->data[0], $data[0]); 79 83 unset($data[0]); … … 85 89 for ($i=0;$i<count($form->data);$i++) { 86 90 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']]:''; 88 92 $search[$form->data[$i]['fullField']] = (isset($_POST[$form->data[$i]['fullField']])?$_POST[$form->data[$i]['fullField']]:$sf); 89 93 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); 91 96 } 92 97 } 93 98 } 94 99 $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 } 97 104 } 98 105 } -
trunk/globals/functions.php
r178 r187 49 49 global $page_admin, $main; 50 50 if ($_SERVER['REQUEST_METHOD'] == 'GET') { 51 $ret = $_GET[$key]; 51 $ret = ""; 52 if (isset($_GET[$key])) { 53 $ret = $_GET[$key]; 54 } 52 55 } else { 53 56 parse_str($_POST['query_string'], $output); 54 $ret = $output[$key]; 57 $ret = ""; 58 if (isset($output[$key])) { 59 $ret = $output[$key]; 60 } 55 61 } 56 62 switch ($key) { … … 102 108 } 103 109 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); 107 113 return ($htmlspecialchars?htmlspecialchars('?'.query_str($o)):'?'.query_str($o)); 108 114 } … … 163 169 function reset_smarty() { 164 170 global $smarty, $lang; 165 $smarty->clear_all_assign ;171 $smarty->clear_all_assign(); 166 172 $smarty->assign_by_ref('lang', $lang); 167 173 $smarty->assign('tpl_dir', $smarty->template_dir); … … 289 295 290 296 function generate_account_code() { 297 $ret = 0; 291 298 for ($i=1;$i<=20;$i++) { 292 299 $ret .= rand(0, 9); … … 310 317 $name = strtolower($name); 311 318 $allowchars = 'abcdefghijklmnopqrstuvwxyz0123456789-'; 319 $ret = ''; 312 320 for ($i=0; $i<strlen($name); $i++) { 313 321 $char = substr($name, $i, 1); … … 316 324 if ($ret == '') $ret = 'noname'; 317 325 $i=2; 326 $extension = ''; 318 327 do { 319 328 $cnt = $db->cnt('', 'nodes', "name_ns = '".$ret.$extension."' AND id != '".$node."'"); … … 339 348 global $main, $vars, $lang; 340 349 $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 } 345 363 if ($gmap_key == '') return FALSE; 346 364 347 365 $main->html->head->add_script("text/javascript", "http://".$vars['gmap']['server']."/maps?file=api&v=".$vars['gmap']['api']."&key=".$gmap_key."&hl=".$lang["iso639"]); 348 366 $main->html->head->add_script("text/javascript", $javascript); … … 355 373 356 374 $main->html->body->tags['onload'] = "gmap_onload()"; 357 $main->html->body->tags['onunload'] = "GUnload()"; //added to reduce IE memory leaks375 $main->html->body->tags['onunload'] = "GUnload()"; //added to reduce IE memory leaks 358 376 return TRUE; 359 377 } … … 386 404 } elseif (get('lang') != '') { 387 405 $tl = get('lang'); 388 } elseif ( $_SESSION['lang'] != '') {406 } elseif (isset($_SESSION['lang']) && $_SESSION['lang'] != '') { 389 407 $tl = $_SESSION['lang']; 390 408 } elseif ($language != '') { -
trunk/globals/vars.php
r63 r187 23 23 24 24 'info' => array( 25 'version' => snapshot_version,26 'min_template_version' => snapshot_min_template_version25 'version' => 0, 26 'min_template_version' => 0 27 27 ) 28 28 -
trunk/includes/head.php
r41 r187 25 25 26 26 function add_extra($extra) { 27 if (!isset($this->tpl['extra'])) $this->tpl['extra'] = ""; 27 28 $this->tpl['extra'] .= $extra; 28 29 } -
trunk/includes/main.php
r167 r187 52 52 53 53 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 55 61 // Reload user info from database using SET NAMES (workaround) 56 62 $this->userdata->load_info(); -
trunk/includes/main_center.php
r152 r187 33 33 function security_check() { 34 34 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; 36 36 switch (get('page')) { 37 37 case 'admin': -
trunk/includes/main_footer.php
r143 r187 33 33 $this->tpl['php_time'] = getmicrotime() - $php_start; 34 34 $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) { 36 36 $this->tpl['debug_mysql'] = ROOT_PATH."debug/mysql.php?".get_qs(); 37 37 } -
trunk/includes/main_header.php
r143 r187 23 23 24 24 var $hide=FALSE; 25 25 var $tpl; 26 26 27 function header() { 27 28 } -
trunk/includes/main_menu.php
r156 r187 38 38 $this->tpl['form_login'] = $construct->form($this->form_login(), __FILE__); 39 39 40 $main->html->body->tpl['logged'] = $this->tpl['logged']; 40 41 $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']:""; 42 43 $main->html->body->tpl['link_logged_profile'] = makelink(array("page" => "users", "user" => $main->userdata->user)); 43 44 … … 97 98 $this->tpl['link_register'] = makelink(array("page" => "users", "user" => "add")); 98 99 $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']); 100 101 $this->tpl['stats_nodes_active'] = 101 102 $db->cnt('', … … 163 164 function output_onpost_form_login() { 164 165 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))) { 166 167 if ($main->userdata->info['status'] == 'pending') { 167 168 $main->message->set_fromlang('info', 'activation_required'); -
trunk/includes/pages/admin/admin_areas.php
r156 r187 20 20 */ 21 21 22 if (get('area') != '') include_once( $root_path."includes/pages/admin/admin_areas_area.php");22 if (get('area') != '') include_once(ROOT_PATH."includes/pages/admin/admin_areas_area.php"); 23 23 24 24 class admin_areas { -
trunk/includes/pages/admin/admin_regions.php
r156 r187 20 20 */ 21 21 22 if (get('region') != '') include_once( $root_path."includes/pages/admin/admin_regions_region.php");22 if (get('region') != '') include_once(ROOT_PATH."includes/pages/admin/admin_regions_region.php"); 23 23 24 24 class admin_regions { -
trunk/includes/pages/admin/admin_services.php
r152 r187 20 20 */ 21 21 22 if (get('service') != '') include_once( $root_path."includes/pages/admin/admin_services_service.php");22 if (get('service') != '') include_once(ROOT_PATH."includes/pages/admin/admin_services_service.php"); 23 23 24 24 class admin_services { -
trunk/includes/pages/gmap/gmap_xml.php
r137 r187 30 30 31 31 $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 = ''; 34 35 if (get('node') != '') $having .= ($having!=''?' OR ':'')."id = ".intval(get('node')); 35 36 if (get('show_p2p') == 1) $having .= ($having!=''?' OR ':'').'total_p2p > 0'; … … 51 52 'nodes.id' . 52 53 ($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"; 54 55 $xml .= "<wind>\r"; 55 56 $xml .= "<nodes>\r"; … … 83 84 $xml .= "</nodes>\r"; 84 85 86 $where = ''; 85 87 if (get('show_links_p2p') == 1) $where .= ($where!=''?' OR ':'')."p2p.type = 'p2p'"; 86 88 if (get('show_links_client') == 1) $where .= ($where!=''?' OR ':'')."clients.type = 'client'"; -
trunk/includes/pages/hostmaster/hostmaster_dnsnameservers.php
r26 r187 39 39 function table_nameservers() { 40 40 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']); 42 42 if ($_GET['form_search_nameservers_search'] != '') { 43 43 $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']); 45 45 $_GET['form_search_nameservers_search'] = addslashes(serialize($t)); 46 46 } -
trunk/includes/pages/hostmaster/hostmaster_dnszone.php
r148 r187 37 37 38 38 $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'] = ''; 39 41 foreach( (array) $tmp as $key => $value) { 40 42 $form_zone->info['email_all'] .= $value['email'].', '; -
trunk/includes/pages/hostmaster/hostmaster_range.php
r148 r187 36 36 $form_range->data[1]['value'] = long2ip($form_range->data[1]['value']); 37 37 $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'] = ''; 38 40 foreach( (array) $tmp as $key => $value) { 39 41 $form_range->info['email_all'] .= $value['email'].', '; -
trunk/includes/pages/mynodes/mynodes.php
r152 r187 307 307 unset($p); 308 308 } 309 if ( $table_photosview->data[$p]['view_point'] == $value) {309 if (isset($p) && ($table_photosview->data[$p]['view_point'] == $value)) { 310 310 $table_photosview->data[$p]['photo'] = $vars['folders']['photos'].'photo-'.$table_photosview->data[$p]['id'].'-s.jpg'; 311 311 $t[$i] = $table_photosview->data[$p]; … … 324 324 function output() { 325 325 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(); 327 327 if ($_SERVER['REQUEST_METHOD'] == 'POST' && method_exists($this, 'output_onpost_'.$_POST['form_name'])) return call_user_func(array($this, 'output_onpost_'.$_POST['form_name'])); 328 328 global $construct, $main, $db; … … 539 539 function output_onpost_table_photosview() { 540 540 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 } 548 550 } 549 551 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; 552 554 $db->add("photos", array('node_id' => intval(get('node')), 'type' => 'view', 'view_point' => $value, 'info' => $_POST['info-'.$value])); 553 555 $ins_id = $db->insert_id; -
trunk/includes/pages/nodes/nodes_plot_link.php
r146 r187 59 59 $this->tpl['a_node_elevation'] = $a_node_data['elevation']; 60 60 $this->tpl['b_node_elevation'] = $b_node_data['elevation']; 61 61 62 62 $a_node_total_elevation = $this->tpl['a_node_geo_elevation'] + $this->tpl['a_node_elevation']; 63 63 $b_node_total_elevation = $this->tpl['b_node_geo_elevation'] + $this->tpl['b_node_elevation']; 64 64 65 65 $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 } 68 78 $this->tpl['distance'] = sqrt( pow($this->tpl['distance'] * 1000, 2) + pow( abs($a_node_total_elevation - $b_node_total_elevation), 2 ) ) / 1000; 69 79 $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); 71 81 if ($this->tpl['frequency'] <= 0) $this->tpl['frequency'] = 2450; 72 82 $frequency = $this->tpl['frequency'] * 1000000; … … 74 84 $this->tpl['fsl'] = 20 * log10(4 * pi() * $this->tpl['distance'] * ($frequency / $c)); 75 85 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'])); 77 87 } 78 88 -
trunk/includes/pages/nodes/nodes_view.php
r154 r187 21 21 22 22 include_once(ROOT_PATH.'globals/classes/geocalc.php'); 23 $geocalc = new geocalc(); 23 24 $geocalc = new GeoCalc(); 24 25 25 26 include_once(ROOT_PATH.'globals/classes/srtm.php'); … … 38 39 $a_node_i = $db->get('latitude, longitude, elevation', 'nodes', "id = '".$a_node."'"); 39 40 $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 45 46 46 47 $a_node_el = str_replace(",", ".", $srtm->get_elevation($lat1, $lon1, FALSE)); … … 313 314 314 315 $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'))); 316 317 $this->tpl['link_fullmap'] = makelink(array("page" => "gmap", "node" => get('node'))); 317 318 $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 51 51 } 52 52 53 if ( $main->userdata->privileges['admin'] === TRUE) {53 if (isset($main->userdata->privileges['admin']) && $main->userdata->privileges['admin'] === TRUE) { 54 54 $form_user->db_data('rights.type, users.status'); 55 55 $form_user->data[9]['Type'] = 'enum_multi'; … … 130 130 $form_user = $this->form_user(); 131 131 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); 133 133 if (get('user') == 'add') { 134 134 $a['status'] = 'pending'; 135 135 $a['account_code'] = generate_account_code(); 136 136 } 137 $ret = $form_user->db_set( $a, "users", "id", get('user'));137 $ret = $form_user->db_set((isset($a)?$a:""), "users", "id", get('user')); 138 138 if (get('user') == 'add') { 139 139 $ins_id = $db->insert_id; … … 146 146 $ret = $ret && $form_user->db_set_multi(array('owner' => 'N'), "users_nodes", "user_id", $ins_id); 147 147 $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 } 151 153 } 152 154 } -
trunk/templates/basic/config.php
r63 r187 4 4 5 5 'template' => array( 6 'version' => snapshot_template_version,7 'minor_version' => snapshot_template_minor_version6 'version' => 0, 7 'minor_version' => 0 8 8 ) 9 9
Note: See TracChangeset
for help on using the changeset viewer.
