Platform for the Best Practices and Local Leadership Programme of the UN-HABITAT and the City of Vienna
Best Practices
Hub Vienna
UN-HABITAT
Programme
Projects of the
City of Vienna
Publications
& Services
Documents
& Databases
Search
& Tools
Search
Sitemap
About this
Website
Overview
Source Code
Bug Database
bestpractices.at/main.php — 8,192 Lines / 377,059 Bytes — Last Update: Tue, 09 Mar 2010 09:56:25 +0100
1 <? 2 3 /* 4 No Copyright 2002-2003 SansSoleil.com 5 This piece of software can be redistributed and/or modified under the terms of 6 the GNU General Public License as published by the Free Software Foundation. 7 */ 8 9 set_time_limit(0); 10 11 define_variables(); 12 13 if ($var['redirect']) 14 redirect(); 15 16 write_logfile('hits'); 17 18 delete_sessions(); 19 20 empty_trash(); 21 22 check_page(); 23 24 if ($var['form']) 25 proceed_form(); 26 27 echo create_html(); 28 29 // ----------------------------------------------------------------------------- 30 31 function redirect() { 32 33 /* 34 * redirect for main.php?redirect=URL 35 */ 36 37 global $var; 38 39 write_logfile('referrals'); 40 echo '<meta http-equiv="refresh" content="0; url=' . $var['redirect'] . '">'; 41 exit; 42 43 } 44 45 // ----------------------------------------------------------------------------- 46 47 function define_variables() { 48 49 /* 50 * defines the following variables: 51 * - system variables: 52 * - $var[...]: general variables (variables.dat) 53 * - $var['preference'][...]: user preferences (preferences.dat) 54 * - $var['header'][...]: user-defined header strings (header.dat) 55 * - $var['overview'][...]: user-defined overview strings (overview.dat) 56 * - $var['category'][...]: user-defined database categories (categories.dat) 57 * - $var['tag'][...]: user-defined formatting tags (tags.dat) 58 * - $var['translation'][$lang][...]: user-defined translations (translations.dat) 59 * - $var['newsletter']: newsletter preferences (newsletter.dat) 60 * - remote variables: 61 * - $var['ip']: ip address 62 * - $var['host']: host name 63 * - $var['method']: request method 64 * - $var['uri']: request uri 65 * - $var['protocol']: server protocol 66 * - $var['referer']: http referer 67 * - $var['agent']: user agent 68 * - get variables: 69 * - $var['page']: page 70 * - $var['lang']: language ('en' or 'de') 71 * - $var['view']: selected item (in select boxes etc.) 72 * - $var['type']: type of selected item (in trash select box) 73 * - $var['sort']: sort order (in select boxes etc.) 74 * - $var['mode']: mode ('' or 'user' or 'admin') 75 * - $var['ssid']: session id 76 * - $var['rqid']: request id 77 * - post variables: 78 * - $var['form']: true if page contains post data 79 * - $var['form_button']: submit button 80 * - $var['form_...']: post data 81 * - menu variables: 82 * - $var['menu'][...]: menu structure 83 * $var['menu'][$level0]([$level1]([$level2]([$level3]))) is an array that has the following elements: 84 * - ['name']: menu name 85 * - ['title'][$lang]: menu title 86 * - ['status']: menu status ('script', 'public' or 'hidden') 87 * - ['color']: menu color (only set if the menu is on level 0 or 2) 88 * - ['count']: number of submenus 89 * hidden menus are not defined if mode is not admin 90 * - additional variables: 91 * - $var['time']: current timestamp 92 * - $var['microtime']: current microtimestamp 93 * - $var['space']: six spaces 94 * - $var['other_language']: other language ('de' if language is 'en', 'en' if language is 'de') 95 */ 96 97 global $var; 98 if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 99 100 // system variables 101 $var = read_file('data/system/variables.dat'); 102 $var['preference'] = read_file('data/system/preferences.dat'); 103 $var['header'] = read_file('data/system/header.dat'); 104 $var['overview'] = read_file('data/system/overview.dat'); 105 $var['category'] = read_file('data/system/categories.dat'); 106 $var['tag'] = read_file('data/system/tags.dat'); 107 $var['translation']['en'] = read_file('data/system/translations.dat'); 108 $var['translation']['de'] = array_flip($var['translation']['en']); 109 $var['newsletter'] = read_file('data/system/newsletter.dat'); 110 111 // remote variables 112 $var['ip'] = $_SERVER['REMOTE_ADDR']; 113 $var['host'] = @gethostbyaddr($var['ip']); 114 $var['method'] = $_SERVER['REQUEST_METHOD']; 115 $var['uri'] = $_SERVER['REQUEST_URI']; 116 $var['protocol'] = $_SERVER['SERVER_PROTOCOL']; 117 $var['referer'] = $_SERVER['HTTP_REFERER']; 118 $var['agent'] = $_SERVER['HTTP_USER_AGENT']; 119 120 // get variables 121 $var['redirect'] = $_GET['redirect']; 122 if ($var['redirect'] && !strstr($var['redirect'], '//')) 123 $var['redirect'] = 'http://' . $var['redirect']; 124 $var['page'] = $_GET['page']; 125 $var['lang'] = $_GET['lang']; 126 $var['view'] = $_GET['view']; 127 $var['type'] = $_GET['type']; 128 $var['sort'] = $_GET['sort']; 129 $var['mode'] = $_GET['mode']; 130 $var['ssid'] = $_GET['ssid']; 131 $var['rqid'] = $_GET['rqid']; 132 133 // post variables 134 while (list($k, $v) = each($_POST)) { 135 if (substr($k, 0, 12) != 'form_button_') 136 $var[$k] = stripslashes($v); 137 else 138 $var['form_button'] = substr($k, 12, -2); 139 } 140 141 // menu-variables 142 $var['menu'] = read_file('data/system/menus.dat'); 143 get_count(); 144 if (!$var['mode']) { 145 for ($i = 0; $i < $var['menu']['count']; $i++) { 146 while ($var['menu'][$i]['status'] == 'hidden') { 147 for ($ii = $i; $ii < $var['menu']['count'] - 1; $ii++) 148 $var['menu'][$ii] = $var['menu'][$ii + 1]; 149 unset($var['menu'][$var['menu']['count'] - 1]); 150 $var['menu']['count']--; 151 } 152 for ($j = 0; $j < $var['menu'][$i]['count']; $j++) { 153 while ($var['menu'][$i][$j]['status'] == 'hidden') { 154 for ($jj = $j; $jj < $var['menu'][$i]['count'] - 1; $jj++) 155 $var['menu'][$i][$jj] = $var['menu'][$i][$jj + 1]; 156 unset($var['menu'][$i][$var['menu'][$i]['count'] - 1]); 157 $var['menu'][$i]['count']--; 158 } 159 for ($k = 0; $k < $var['menu'][$i][$j]['count']; $k++) { 160 while ($var['menu'][$i][$j][$k]['status'] == 'hidden') { 161 for ($kk = $k; $kk < $var['menu'][$i][$j]['count'] - 1; $kk++) 162 $var['menu'][$i][$j][$kk] = $var['menu'][$i][$j][$kk + 1]; 163 unset($var['menu'][$i][$j][$var['menu'][$i][$j]['count'] - 1]); 164 $var['menu'][$i][$j]['count']--; 165 } 166 for ($l = 0; $l < $var['menu'][$i][$j][$k]['count']; $l++) { 167 while ($var['menu'][$i][$j][$k][$l]['status'] == 'hidden') { 168 for ($ll = $l; $ll < $var['menu'][$i][$j][$k]['count'] - 1; $ll++) 169 $var['menu'][$i][$j][$k][$ll] = $var['menu'][$i][$j][$k][$ll + 1]; 170 unset($var['menu'][$i][$j][$k][$var['menu'][$i][$j][$k]['count'] - 1]); 171 $var['menu'][$i][$j][$k]['count']--; 172 } 173 } 174 } 175 } 176 } 177 // get_count(); 178 } 179 180 // additional variables 181 $data = explode(' ', microtime()); 182 $var['time'] = $data[1]; 183 $var['microtime'] = $var['time'] . substr($data[0], 2, 6); 184 $var['space'] = ' '; 185 if ($var['lang'] == 'en') 186 $var['other_language'] = 'de'; 187 else 188 $var['other_language'] = 'en'; 189 if ($var['mode'] == 'user' && valid('session', $var['ssid'])) 190 get_userdata(); 191 else if ($var['mode'] == 'admin' && valid('session', $var['ssid'])) 192 get_admindata(); 193 194 $var['themedir'] = $var['preference']['page_theme']; 195 $var['themetype'] = $var['theme_type'][$var['themedir']]; 196 197 // $var['debug'] = true; 198 if ($_SERVER['SERVER_NAME'] == 'www.bestpractices.at' && !$var['debug']) 199 error_reporting(0); 200 201 } 202 203 // ----------------------------------------------------------------------------- 204 205 function write_logfile($logfile) { 206 207 /* 208 * determines the name of the logs subdirectory 209 * and changes it once per hour, then adds an 210 * entry to one of the following logfiles: 211 * - hits.log (all requests) 212 * - logins.log (admin logins) 213 * - searches.log (internal searches) 214 * - referrals.log (external links) 215 */ 216 217 global $var; 218 219 $d = dir('data/logs'); 220 while ($f = $d->read()) { 221 if (substr($f, 0, 1) != '.') { 222 if ($var['microtime'] - $f > 3600000000) { 223 rename("data/logs/$f", 'data/logs/' . $var['microtime']); 224 $f = $var['microtime']; 225 } 226 $var['subdir'] = $f; 227 break; 228 } 229 } 230 231 $filename = 'data/logs/' . $var['subdir'] . "/$logfile." . date('Y.m', $var['time']) . '.log'; 232 if (!file_exists($filename)) { 233 $f = fopen($filename, 'w'); 234 $flag = true; 235 } 236 else { 237 $f = fopen($filename, 'a'); 238 fputs($f, chr(10)); 239 } 240 if ($logfile == 'hits') 241 fputs($f, $var['host'] . ' - - [' . date('d/M/Y:H:i:s O', $var['time']) . '] "' . $var['method'] . ' ' . $var['uri'] . ' ' . $var['protocol'] . '" 200 0 "' . $var['referer'] . '" "' . $var['agent']. '"'); 242 else if ($logfile == 'logins') 243 fputs($f, $var['host'] . ' - - [' . date('d/M/Y:H:i:s O', $var['time']) . '] "' . $var['current_admin']['username'] . ' ' . $var['current_admin']['e-mail'] . '" "' . $var['agent']. '"'); 244 else if ($logfile == 'searches') 245 fputs($f, $var['host'] . ' - - [' . date('d/M/Y:H:i:s O', $var['time']) . '] ' . $var['view'] . ' ' . $var['form_query'] . ' "' . $var['agent']. '"'); 246 else if ($logfile == 'referrals') 247 fputs($f, $var['host'] . ' - - [' . date('d/M/Y:H:i:s O', $var['time']) . '] "' . $var['referer'] . ' ' . $var['redirect'] . '" "' . $var['agent']. '"'); 248 fclose($f); 249 if ($flag) 250 chmod($filename, 0666); 251 252 /* 253 if (!strstr($var['host'], 'bootlab')) { 254 $temp = file('temp.html'); 255 for ($i = 0; $i < count($temp); $i++) 256 echo $temp[$i]; 257 exit; 258 } 259 */ 260 261 } 262 263 // ----------------------------------------------------------------------------- 264 265 function check_page() { 266 267 /* 268 * checks if page, language and mode are valid 269 */ 270 271 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 272 273 // check for subscription request 274 if ($var['rqid']) 275 check_request(); 276 277 // check for valid page and mode 278 if (!valid('page', $var['page']) && !$var['form']) 279 $var['page'] = $var['menu'][0]['name']; 280 if ($var['mode'] && $var['mode'] != 'user' && $var['mode'] != 'admin') 281 $var['mode'] = ''; 282 283 // get page properties, go down the menu tree if the page is a directory 284 get_this(); 285 $var['pagetype'] = 'page'; 286 $data = explode('/', $var['page']); 287 if (count($data) == 1 && $var['menu'][$var['this_tab']]['count']) { 288 if (!$var['mode'] || $var['menu'][$var['this_tab']]['status'] == 'script') { 289 $var['page'] .= '/' . $var['menu'][$var['this_tab']][0]['name']; 290 get_this(); 291 } 292 else 293 $var['pagetype'] = 'directory'; 294 } 295 $data = explode('/', $var['page']); 296 if (count($data) == 2 && $var['menu'][$var['this_tab']][$var['this_menu']]['count']) { 297 if (!$var['mode'] || $var['menu'][$var['this_tab']][$var['this_menu']]['status'] == 'script') { 298 $var['page'] .= '/' . $var['menu'][$var['this_tab']][$var['this_menu']][0]['name']; 299 get_this(); 300 } 301 else 302 $var['pagetype'] = 'directory'; 303 } 304 $data = explode('/', $var['page']); 305 if (count($data) == 3 && $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count']) { 306 if (!$var['mode'] || $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['status'] == 'script') { 307 $var['page'] .= '/' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][0]['name']; 308 get_this(); 309 } 310 else 311 $var['pagetype'] = 'directory'; 312 } 313 314 // set language 315 if ($var['preference']['default_language'] == 'automatic' && $var['lang'] != 'en' && $var['lang'] != 'de') { 316 if (!strstr('.at .ch .de', substr($var['host'], -3))) 317 $var['lang'] = 'en'; 318 else 319 $var['lang'] = 'de'; 320 } 321 else if ($var['preference']['default_language'] == 'en' && $var['lang'] != 'de') 322 $var['lang'] = 'en'; 323 else if ($var['preference']['default_language'] == 'de' && $var['lang'] != 'en') 324 $var['lang'] = 'de'; 325 326 // don't allow mode=user&ssid=invalid 327 if ($var['mode'] == 'user' && !valid('session', $var['ssid'])) 328 $var['mode'] = ''; 329 330 // don't allow page=admin&mode!=admin or mode=admin&ssid=invalid 331 if ($var['menu'][$var['this_tab']]['name'] == 'admin' && $var['mode'] != 'admin') 332 $var['page'] = 'admin/login'; 333 if ($var['mode'] == 'admin' && !valid('session', $var['ssid'])) { 334 $var['page'] = 'admin/login'; 335 $var['mode'] = ''; 336 } 337 338 // redirect if page, language or mode have changed 339 if ($var['page'] != $_GET['page'] || $var['lang'] != $_GET['lang'] || $var['mode'] != $_GET['mode']) { 340 echo "<script language=javascript>\n"; 341 echo 'document.location.href = "main.php?page=' . $var['page'] . '&lang=' . $var['lang']; 342 if ($var['view']) 343 echo '&view=' . $var['view']; 344 if ($var['sort']) 345 echo '&sort=' . $var['sort']; 346 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 347 echo '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 348 echo "\";\n"; 349 echo "</script>\n"; 350 exit; 351 } 352 353 // touch file to keep session active 354 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 355 touch('data/sessions/' . $var['ssid'] . '.dat'); 356 357 // get current level, status and pagefile 358 if (!isset($var['this_menu'])) { 359 $var['level'] = 0; 360 $var['status'] = $var['menu'][$var['this_tab']]['status']; 361 } 362 else if (!isset($var['this_subtab'])) { 363 $var['level'] = 1; 364 $var['status'] = $var['menu'][$var['this_tab']][$var['this_menu']]['status']; 365 } 366 else if (!isset($var['this_submenu'])) { 367 $var['level'] = 2; 368 $var['status'] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['status']; 369 } 370 else { 371 $var['level'] = 3; 372 $var['status'] = ($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['this_submenu']]['status']); 373 } 374 $var['pagefile'] = str_replace('/', '.', $var['page']) . '.' . $var['lang'] . '.txt'; 375 376 } 377 378 // ----------------------------------------------------------------------------- 379 380 function read_dir($dirname) { 381 382 /* 383 * reads a directory and returns an array 384 * $list[filenumber] has the following default elements: 385 * - ['filename']: file name 386 * - ['name']: name (as it appears in select boxes) 387 * - ['size']: file size 388 * - ['kilobytes']: 'size KB' 389 * $list[filenumber] can have the following additional elements: 390 * - ['category']: category name (if directory is 'bugs') 391 * - ['category_short']: category short name (if directory is 'bugs') 392 * - ['category_number']: category number (if directory is 'bugs') 393 * - ['priority']: priority name (if directory is 'bugs') 394 * - ['priority_short']: priority short name (if directory is 'bugs') 395 * - ['priority_number']: priority number (if directory is 'bugs') 396 * - ['status']: status name (if directory is 'news' or 'bugs') 397 * - ['status_short']: status short name (if directory is 'bugs') 398 * - ['status_number']: status number (if directory is 'bugs') 399 * - ['comments']: number of comments (if directory is 'bugs') 400 * - ['username']: username (if directory is 'accounts') [to be removed later] 401 * - ['logged_in']: 'logged in' or '' (if directory is 'accounts') 402 * - ['category_short']: category short name (if directory is 'addresses') 403 * - ['country_short']: country short name (if directory is 'addresses') 404 * - ['dimensions']: width * height (if directory is 'images') 405 * - ['pixels']: 'width x height' (if directory is 'images') 406 * - ['from']: sender (if directory is 'sent' or 'unsent') 407 * - ['domain']: domain (if directory is 'subscribers') 408 * - ['country']: top-level domain (if directory is 'subscribers') 409 * - ['status']: status (if directory is 'subscribers') 410 * - ['filters_short']: filters (if directory is 'subscribers') 411 * - ['type']: file type (if directory is 'trash') 412 * - ['time']: file timestamp (if directory is not 'bugs') 413 * - ['date']: file date (if directory is not 'bugs') 414 * - ['firsttime']: report timestamp (if directory is 'bugs') 415 * - ['first']: report date (if directory is 'bugs') 416 * - ['lasttime']: last comment timestamp (if directory is 'bugs') 417 * - ['last']: last comment date (if directory is 'bugs') 418 * - ['id']: bug id (if directory is 'bugs') 419 * also returns the following default variables: 420 * - $var['files_total']: number of files 421 * - $var['kilobytes_total']: 'size KB' 422 * also may return the following optional variables: 423 * - $var['subscribed_total']: number of subscribers with status 'subscribed' (if directory is 'subscribers') 424 * - $var['suspended_total']: number of subscribers with status 'suspended' (if directory is 'subscribers') 425 * - $var['unsubscribed_total']: number of subscribers with status 'unsubscribed' (if directory is 'subscribers') 426 */ 427 428 global $var; 429 if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 430 431 if ($dirname == 'data/addresses') { 432 $filedata = read_file('data/system/countries.dat'); 433 while (list($k, $v) = each($filedata)) { 434 $data = explode(' | ', $v); 435 $country_short[$data[0]] = $k; 436 } 437 } 438 else if ($dirname == 'data/newsletter/subscribers') { 439 $var['subscribed_total'] = 0; 440 $var['suspended_total'] = 0; 441 $var['unsubscribed_total'] = 0; 442 } 443 $var['files_total'] = 0; 444 $count = 0; 445 $d = dir($dirname); 446 while ($f = $d->read()) { 447 if (substr($f, 0, 1) != '.') { 448 $list[$count]['filename'] = $f; 449 if ($dirname == 'data/bugs') { 450 $file = file("data/bugs/$f/$f.dat"); 451 for ($i = 0; $i < count($file); $i++) { 452 $data = explode(' = ', chop($file[$i])); 453 if ($i == 0) 454 $list[$count][$data[0]] = $data[1]; 455 else { 456 for ($j = 0; $j < count($var['bug'][$data[0]]); $j++) { 457 if ($var['bug'][$data[0]][$j]['name'] == $data[1]) { 458 $list[$count][$data[0]] = $var['bug'][$data[0]][$j]['title'][$var['lang']]; 459 $list[$count][$data[0] . '_short'] = $var['bug'][$data[0]][$j]['short'][$var['lang']]; 460 $list[$count][$data[0] . '_number'] = $j; 461 } 462 } 463 } 464 } 465 $d_ = dir("data/bugs/$f"); 466 $count_ = 0; 467 while ($f_ = $d_->read()) { 468 if (substr($f_, -4) == '.txt') 469 $count_++; 470 } 471 $list[$count]['comments'] = $count_ - 1; 472 } 473 else if ($dirname == 'data/accounts' || $dirname == 'data/news' || $dirname == 'data/templates' || $dirname == 'data/addresses' || $dirname == 'data/links' || $dirname == 'data/pages' || substr($dirname, 0, 10) == 'data/logs/' || $dirname == 'data/sessions' || $dirname == 'data/newsletter/requests') { 474 $list[$count]['name'] = substr($f, 0, -4); 475 if ($dirname == 'data/accounts') { 476 $file = file("data/accounts/$f"); 477 $data = explode(' = ', chop($file[0])); 478 $list[$count]['username'] = $data[1]; 479 $list[$count]['logged_in'] = ''; 480 $d_ = dir('data/sessions'); 481 while ($f_ = $d_->read()) { 482 if (substr($f_, -4) == '.dat') { 483 $filedata = read_file("data/sessions/$f_"); 484 if ($filedata['username'] == $list[$count]['username']) { 485 $list[$count]['logged_in'] = 'logged in'; 486 break; 487 } 488 } 489 } 490 } 491 else if ($dirname == 'data/news') { 492 $file = file("data/news/$f"); 493 $data = explode(' = ', chop($file[count($file) - 1])); 494 $list[$count]['status'] = $data[1]; 495 } 496 else if ($dirname == 'data/addresses') { 497 $file = file("data/addresses/$f"); 498 $data = explode(' = ', chop($file[0])); 499 $list[$count]['category_short'] = $var['category'][$data[1]]['short'][$var['lang']]; 500 $country = ''; 501 for ($i = 0; $i < count($file); $i++) { 502 $data = explode(' = ', str_replace(chr(10), '', $file[$i])); 503 if ($data[0] == 'country.en') { 504 $country = $data[1]; 505 break; 506 } 507 } 508 if ($country_short[$country]) 509 $list[$count]['country_short'] = $country_short[$country]; 510 else 511 $list[$count]['country_short'] = '??'; 512 } 513 } 514 else if ($dirname == 'data/images' || $dirname == 'data/documents' || $dirname == 'data/system') { 515 $list[$count]['name'] = $f; 516 if ($dirname == 'data/images') { 517 $imagesize = getimagesize("data/images/$f"); 518 $list[$count]['dimensions'] = $imagesize[0] * $imagesize[1]; 519 $list[$count]['pixels'] = str_repeat(' ', 3 - strlen($imagesize[0])) . "$imagesize[0] x " . str_repeat(' ', 3 - strlen($imagesize[1])) . $imagesize[1]; 520 } 521 } 522 else if ($dirname == 'data/newsletter/filters') { 523 $list[$count]['name'] = substr($f, 0, -4); 524 } 525 else if ($dirname == 'data/newsletter/messages/sent' || $dirname == 'data/newsletter/messages/unsent') { 526 $list[$count]['name'] = substr($f, 0, -4); 527 $file = file("$dirname/$f"); 528 $data = explode(' = ', chop($file[0])); 529 $list[$count]['subject'] = $data[1]; 530 $data = explode(' = ', chop($file[1])); 531 $list[$count]['from'] = $data[1]; 532 } 533 else if ($dirname == 'data/newsletter/subscribers') { 534 $list[$count]['name'] = substr($f, 0, -4); 535 $data = explode('@', substr($f, 0, -4)); 536 $list[$count]['domain'] = $data[1]; 537 $data = explode('.', $list[$count]['domain']); 538 $list[$count]['country'] = $data[count($data) - 1]; 539 $file = file("data/newsletter/subscribers/$f"); 540 $data = explode(' = ', chop($file[1])); 541 $data = explode(' ', $data[1]); 542 $list[$count]['status'] = $data[0]; 543 $var[$list[$count]['status'] . '_total']++; 544 $data = explode(' = ', chop($file[2])); 545 $data = explode(' ', $data[1]); 546 for ($i = 0; $i < count($data); $i++) { 547 if ($i > 0) 548 $list[$count]['filters_short'] .= ' '; 549 $list[$count]['filters_short'] .= substr($data[$i], 0, 2); 550 } 551 } 552 else if ($dirname == 'data/trash') { 553 $list[$count]['type'] = substr($f, 0, strpos($f, '.')); 554 if ($list[$count]['type'] == 'page') { 555 if (strstr('0123456789', substr($f, -5, 1))) 556 $flag = true; 557 for ($i = strlen($f) - 5; $i > 4; $i--) { 558 if (substr($f, $i, 1) == '.') { 559 if ($flag) { 560 $list[$count]['name'] = '.' . $list[$count]['name']; 561 $flag = false; 562 } 563 else 564 $list[$count]['name'] = '/' . $list[$count]['name']; 565 } 566 else 567 $list[$count]['name'] = substr($f, $i, 1) . $list[$count]['name']; 568 } 569 } 570 else if ($list[$count]['type'] == 'account' || $list[$count]['type'] == 'message') { 571 $file = file("data/trash/$f"); 572 $data = explode(' = ', chop($file[0])); 573 $list[$count]['name'] = $data[1]; 574 } 575 else if ($list[$count]['type'] == 'template') 576 $list[$count]['name'] = substr($f, strpos($f, '.') + 1, -4); 577 else if ($list[$count]['type'] == 'image' || $list[$count]['type'] == 'document' || $list[$count]['type'] == 'system') 578 $list[$count]['name'] = substr($f, strpos($f, '.') + 1); 579 else if ($list[$count]['type'] == 'link' || $list[$count]['type'] == 'address' || $list[$count]['type'] == 'subscriber') 580 $list[$count]['name'] = substr($f, strpos($f, '.') + 1, -4); 581 } 582 $list[$count]['size'] = filesize("$dirname/$f"); 583 $list[$count]['kilobytes'] = number_format(max(round($list[$count]['size'] / 1024), 1)) . ' KB'; 584 if ($var['lang'] == 'de') 585 $list[$count]['kilobytes'] = str_replace(',', '.', $list[$count]['kilobytes']); 586 $size_total += $list[$count]['size']; 587 if ($dirname != 'data/bugs') { 588 if ($dirname != 'data/newsletter/messages/sent' && $dirname != 'data/newsletter/messages/unsent') 589 $list[$count]['time'] = filemtime("$dirname/$f"); 590 else 591 $list[$count]['time'] = substr($f, 0, -10); 592 if ($var['lang'] == 'en') 593 $list[$count]['date'] = substr($var['weekday'][date('w', $list[$count]['time'])]['en'], 0, 3) . ', ' . substr($var['month'][date('n', $list[$count]['time'])]['en'], 0, 3) . ' ' . date('d, Y, H:i:s', $list[$count]['time']); 594 else 595 $list[$count]['date'] = substr($var['weekday'][date('w', $list[$count]['time'])]['de'], 0, 2) . ', ' . date('d', $list[$count]['time']) . '. ' . substr($var['month'][date('n', $list[$count]['time'])]['de'], 0, 3) . '. ' . date(' Y, H:i:s', $list[$count]['time']); 596 } 597 else { 598 $list[$count]['firsttime'] = substr($f, 0, 10); 599 $d_ = dir("data/bugs/$f"); 600 while ($f_ = $d_->read()) { 601 if (substr($f_, 0, 1) != '.') { 602 if (substr($f_, 0, 10) > $list[$count]['lasttime']) 603 $list[$count]['lasttime'] = substr($f_, 0, 10); 604 } 605 } 606 if ($var['lang'] == 'en') { 607 $list[$count]['first'] = date('m/d/Y', $list[$count]['firsttime']); 608 $list[$count]['last'] = date('m/d/Y', $list[$count]['lasttime']); 609 } 610 else { 611 $list[$count]['first'] = date('d.m.Y', $list[$count]['firsttime']); 612 $list[$count]['last'] = date('d.m.Y', $list[$count]['lasttime']); 613 } 614 } 615 $var['files_total']++; 616 $count++; 617 } 618 } 619 if ($dirname == 'data/bugs') { 620 for ($i = 0; $i < $count; $i++) 621 $sort[$i] = $list[$i]['firsttime']; 622 $i = 1; 623 asort($sort); 624 while (list($k, $v) = each($sort)) { 625 $list[$k]['id'] = $i; 626 $i++; 627 } 628 } 629 $var['kilobytes_total'] = number_format(max(round($size_total / 1024), $count)) . ' KB'; 630 if ($var['lang'] == 'de') 631 $var['kilobytes_total'] = str_replace(',', '.', $var['kilobytes_total']); 632 return $list; 633 634 } 635 636 // ----------------------------------------------------------------------------- 637 638 function read_file($filename) { 639 640 /* 641 * read a file and returns an array, according to the following rules: 642 * - the file has to be a list of 'key = value' pairs 643 * - dots in the key name will return sub-arrays 644 * - if mode is not admin, only the 'login' admin submenu will be returned 645 * - if mode is admin, the 'login' admin submenu will not be returned 646 * - certain keys can be repeated multiple times and will be translated to key.0, key.1, key.2 etc. 647 * (currently 'tab', 'menu', 'subtab', 'submenu', 'database', 'select' and 'sortoption') 648 */ 649 650 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 651 652 $count['tab'] = -1; 653 $file = file($filename); 654 $n = count($file); 655 for ($i = 0; $i < $n; $i++) { 656 if ($filename == 'data/system/menus.dat' && substr($var['page'], 0, 5) == 'admin') { 657 if ($file[$i - 5] == 'menu.name = login' && ($var['mode'] != 'admin' || !valid('session', $var['ssid']))) 658 break; 659 if ($file[$i - 6] == 'tab.name = admin' && $var['mode'] == 'admin' && valid('session', $var['ssid'])) 660 $i += 5; 661 } 662 $file[$i] = trim(chop($file[$i])); 663 if (substr($file[$i], -1) == '=') 664 $file[$i] .= ' '; 665 if ($file[$i] && substr($file[$i], 0, 2) != '//') { 666 $data = explode(' = ', $file[$i]); 667 $key = $data[0]; 668 $value = $data[1]; 669 if (substr($key, 0, 4) == 'tab.') { 670 if (substr($key, -5) == '.name') { 671 $count['tab']++; 672 $count['menu'] = -1; 673 } 674 $key = str_replace('tab.', $count['tab'] . '.', $key); 675 } 676 else if (substr($key, 0, 5) == 'menu.') { 677 if (substr($key, -5) == '.name') { 678 $count['menu']++; 679 $count['subtab'] = -1; 680 } 681 $key = str_replace('menu.', $count['tab'] . '.' . $count['menu'] . '.', $key); 682 } 683 else if (substr($key, 0, 7) == 'subtab.') { 684 if (substr($key, -5) == '.name') { 685 $count['subtab']++; 686 $count['submenu'] = -1; 687 } 688 $key = str_replace('subtab.', $count['tab'] . '.' . $count['menu'] . '.' . $count['subtab'] . '.', $key); 689 } 690 else if (substr($key, 0, 8) == 'submenu.') { 691 if (substr($key, -5) == '.name') 692 $count['submenu']++; 693 $key = str_replace('submenu.', $count['tab'] . '.' . $count['menu'] . '.' . $count['subtab'] . '.' . $count['submenu'] . '.', $key); 694 } 695 else if (substr($key, 0, 9) == 'database.') { 696 $data = explode('.', $key); 697 if (substr($key, -5) == '.name') { 698 if ($data[1] != $name) 699 $count['database'] = -1; 700 $count['database']++; 701 } 702 $name = $data[1]; 703 $key = str_replace("database.$name.", "database.$name." . $count['database'] . '.', $key); 704 } 705 else if (substr($key, 0, 7) == 'select.') { 706 $data = explode('.', $key); 707 if (substr($key, -5) == '.name') { 708 if ($data[1] != $name) 709 $count['select'] = -1; 710 $count['select']++; 711 } 712 $name = $data[1]; 713 $key = str_replace("select.$name.", "select.$name." . $count['select'] . '.', $key); 714 } 715 else if (substr($key, 0, 11) == 'sortoption.') { 716 $data = explode('.', $key); 717 if ($data[1] != $name) 718 $count['sortoption'] = -1; 719 $count['sortoption']++; 720 $name = $data[1]; 721 $key = "$key." . $count['sortoption']; 722 } 723 // echo "$key = $value<br>"; 724 if ($filename != 'data/system/systems.dat' && $filename != 'data/system/clients.dat' && $filename != 'data/system/robots.dat') { 725 $data = explode('.', $key); 726 if (count($data) == 1) 727 $list[$data[0]] = $value; 728 else if (count($data) == 2) 729 $list[$data[0]][$data[1]] = $value; 730 else if (count($data) == 3) 731 $list[$data[0]][$data[1]][$data[2]] = $value; 732 else if (count($data) == 4) 733 $list[$data[0]][$data[1]][$data[2]][$data[3]] = $value; 734 else if (count($data) == 5) 735 $list[$data[0]][$data[1]][$data[2]][$data[3]][$data[4]] = $value; 736 else if (count($data) == 6) 737 $list[$data[0]][$data[1]][$data[2]][$data[3]][$data[4]][$data[5]] = $value; 738 } 739 else 740 $list[$key] = $value; 741 } 742 } 743 return $list; 744 } 745 746 // ----------------------------------------------------------------------------- 747 748 function proceed_form() { 749 750 /* 751 * proceeds post data 752 */ 753 754 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 755 756 // subscribe mailing list 757 if ($var['form_button'] == 'subscribe') 758 save_database(); 759 760 // sort addresses 761 else if (substr($var['form_button'], 0, 12) == 'addresssort_') 762 $var['sort'] = substr($var['form_button'], 12); 763 764 // search 765 else if (substr($var['form_button'], 0, 6) == 'search') { 766 if (substr($var['form_button'], 0, 7) == 'search_') 767 $var['view'] = substr($var['form_button'], 7); 768 else if (substr($var['form_button'], 0, 11) == 'searchsort_') 769 $var['sort'] = substr($var['form_button'], 11); 770 if ($var['form_query']) { 771 if ($var['view'] == 'website') 772 search_website($var['form_query']); 773 if ($var['view'] == 'internet') 774 search_internet($var['form_query']); 775 if ($var['view'] == 'news') 776 search_news($var['form_query']); 777 write_logfile('searches'); 778 } 779 } 780 781 // get help 782 else if ($var['form_button'] == 'help') { 783 if ($var['this_page']['name'] == 'search') { 784 $var['result'] = 'help'; 785 $var['alert'] = $var['help']['search'][$var['lang']]; 786 } 787 } 788 789 // get password 790 else if ($var['form_button'] == 'password') { 791 $var['view'] = 'password'; 792 $var['result'] = 'help'; 793 if ($var['this_page']['name'] == 'subscription') 794 $var['alert'] = $var['help']['user_password'][$var['lang']]; 795 else if ($var['this_page']['name'] == 'login') 796 $var['alert'] = $var['help']['admin_password'][$var['lang']]; 797 } 798 799 // login 800 else if ($var['form_button'] == 'login') { 801 if ($var['this_page']['name'] == 'subscription') { 802 if (valid('login', $var['form_e_mail'] . ':' . $var['form_password'])) { 803 create_session('user'); 804 echo "<script language=javascript>\n"; 805 echo 'document.location.href = "main.php?page=publications/mailing_list/subscription&lang=' . $var['lang'] . '&mode=user&ssid=' . $var['ssid'] . "\";\n"; 806 echo "</script>\n"; 807 exit; 808 } 809 else { 810 $var['result'] = 'error'; 811 $var['alert'] = $var['error']['login'][$var['lang']]; 812 } 813 } 814 else { 815 if (valid('login', $var['form_username'] . ':' . $var['form_password'])) { 816 create_session('admin'); 817 write_logfile('logins'); 818 echo "<script language=javascript>\n"; 819 echo 'document.location.href = "main.php?page=admin&lang=' . $var['lang'] . '&mode=admin&ssid=' . $var['ssid'] . "\";\n"; 820 echo "</script>\n"; 821 exit; 822 } 823 else { 824 $var['result'] = 'error'; 825 $var['alert'] = $var['error']['login'][$var['lang']]; 826 } 827 } 828 } 829 830 // send password to user or message to admins 831 else if ($var['form_button'] == 'send') { 832 if ($var['this_page']['name'] == 'subscription') { 833 $list = read_dir('data/newsletter/subscribers'); 834 for ($i = 0; $i < count($list); $i++) { 835 if ($list[$i]['name'] == $var['form_e_mail']) { 836 $var['to'] = $list[$i]['name']; 837 $filedata = read_file('data/newsletter/subscribers/' . $list[$i]['filename']); 838 $var['message'] = decrypt($filedata['password']); 839 } 840 } 841 if ($var['to']) { 842 send_password(); 843 $var['result'] = 'success'; 844 $var['alert'] = $var['success']['send_password'][$var['lang']]; 845 $var['view'] = ''; 846 } 847 else { 848 $var['result'] = 'error'; 849 $var['alert'] = $var['error']['send_password'][$var['lang']]; 850 } 851 } 852 else if ($var['this_page']['name'] == 'login') { 853 $list = read_dir('data/accounts'); 854 for ($i = 0; $i < count($list); $i++) { 855 $filedata = read_file('data/accounts/' . $list[$i]['filename']); 856 if ($filedata['username'] == $var['form_username_or_e_mail'] || $filedata['e-mail'] == $var['form_username_or_e_mail']) { 857 $var['to'] = $filedata['e-mail']; 858 $var['message'] = $filedata['username'] . '/' . decrypt($filedata['password']); 859 break; 860 } 861 } 862 if ($var['to']) { 863 send_password(); 864 $var['result'] = 'success'; 865 $var['alert'] = $var['success']['send_password'][$var['lang']]; 866 $var['view'] = ''; 867 } 868 else { 869 $var['result'] = 'error'; 870 $var['alert'] = $var['error']['send_password'][$var['lang']]; 871 } 872 } 873 else if ($var['this_page']['name'] == 'mailing_list') { 874 if ($var['form_subject']) { 875 if ($var['form_message']) { 876 send_message(); 877 $var['result'] = 'success'; 878 $var['alert'] = $var['success']['send_message'][$var['lang']]; 879 $var['view'] = ''; 880 } 881 else { 882 $var['result'] = 'error'; 883 $var['alert'] = $var['error']['message'][$var['lang']]; 884 } 885 } 886 else { 887 $var['result'] = 'error'; 888 $var['alert'] = $var['error']['subject'][$var['lang']]; 889 } 890 } 891 else if ($var['this_page']['name'] == 'send') 892 save_database(); 893 } 894 895 // import addresses or links 896 else if ($var['form_button'] == 'import') { 897 save_database(); 898 } 899 900 // export addresses or links 901 else if ($var['form_button'] == 'export') { 902 save_database(); 903 } 904 905 // cancel 906 else if ($var['form_button'] == 'cancel') { 907 if ($var['this_page']['name'] == 'login') { 908 if ($var['view'] != 'password') { 909 echo "<script language=javascript>\n"; 910 echo "document.location.href = \"main.php\";\n"; 911 echo "</script>\n"; 912 exit; 913 } 914 else 915 $var['view'] = ''; 916 } 917 if ($var['this_page']['name'] == 'subscription' && $var['view'] == 'password') 918 $var['view'] = ''; 919 else if ($var['this_page']['name'] == 'search') 920 $var['form_query'] = ''; 921 else if ($var['this_page']['name'] == 'bugs' || $var['this_page']['name'] == 'accounts' || $var['this_page']['name'] == 'templates' || $var['this_page']['name'] == 'images' || $var['this_page']['name'] == 'documents' || $var['this_page']['name'] == 'addresses' || $var['this_page']['name'] == 'links' || $var['this_page']['name'] == 'trash') 922 $var['view'] = ''; 923 else { 924 $var['result'] = 'success'; 925 $var['alert'] = $var['success']['cancel'][$var['lang']]; 926 } 927 } 928 929 // load template 930 else if ($var['form_button'] == 'load') { 931 if ($var['form_template']) { 932 if (file_exists('data/templates/' . $var['form_template'] . '.txt')) 933 copy('data/templates/' . $var['form_template'] . '.txt', 'data/pages/' . $var['pagefile']); 934 else { 935 $var['result'] = 'error'; 936 $var['alert'] = $var['error']['template']['wrong_name'][$var['lang']]; 937 } 938 } 939 else { 940 $var['result'] = 'error'; 941 $var['alert'] = $var['error']['template']['no_name'][$var['lang']]; 942 } 943 } 944 945 // save 946 else if ($var['form_button'] == 'save') { 947 if ($var['status'] != 'script') { 948 if (valid('pagename', $var['form_page'])) { 949 $var['old_filename'] = $var['pagefile']; 950 $data = explode('.', $var['pagefile']); 951 $data[count($data) - 3] = $var['form_page']; 952 $var['new_filename'] = implode('.', $data); 953 if ($var['new_filename'] == $var['old_filename'] || !file_exists('data/pages/' . $var['new_filename'])) { 954 if ($var['form_title']) { 955 save_page(); 956 save_menu(); 957 // $var['result'] = 'success'; 958 // $var['alert'] = $var['success']['save'][$var['lang']]; 959 } 960 else { 961 $var['result'] = 'error'; 962 $var['alert'] = $var['error']['title'][$var['lang']]; 963 } 964 } 965 else { 966 $var['result'] = 'error'; 967 $var['alert'] = $var['error']['page']['exists'][$var['lang']]; 968 } 969 } 970 else { 971 $var['result'] = 'error'; 972 $var['alert'] = $var['error']['page']['name'][$var['lang']]; 973 } 974 } 975 else 976 save_database(); 977 } 978 979 // save and copy to other language 980 else if ($var['form_button'] == 'copy') { 981 if ($var['status'] != 'script') { 982 save_page(); 983 if (!has_content('data/pages/' . substr($var['pagefile'], 0, -7) . '.' . $var['other_language'] . '.txt')) { 984 copy('data/pages/' . $var['pagefile'], 'data/pages/' . substr($var['pagefile'], 0, -7) . '.' . $var['other_language'] . '.txt'); 985 $var['result'] = 'success'; 986 $var['alert'] = $var['success']['copy'][$var['lang']]; 987 } 988 else { 989 $var['result'] = 'error'; 990 $var['alert'] = $var['error']['copy'][$var['lang']]; 991 } 992 } 993 else 994 save_database(); 995 } 996 997 // change menu properties (and more) 998 else if ($var['form_button'] == 'left' || $var['form_button'] == 'right' || substr($var['form_button'], 0, 3) == 'up_' || substr($var['form_button'], 0, 5) == 'down_' || $var['form_button'] == 'add' || $var['form_button'] == 'delete' || $var['form_button'] == 'insert' || substr($var['form_button'], 0, 8) == 'publish_' || substr($var['form_button'], 0, 9) == 'tabcolor_') { 999 if ($var['status'] != 'script') { 1000 save_menu(); 1001 $var['result'] = 'success'; 1002 $var['alert'] = $var['success'][$var['form_button']][$var['lang']]; 1003 } 1004 else 1005 save_database(); 1006 } 1007 1008 // change page layout 1009 else if (substr($var['form_button'], 0, 8) == 'columns_') { 1010 save_layout(); 1011 $var['result'] = 'success'; 1012 $var['alert'] = $var['success']['columns'][$var['lang']]; 1013 } 1014 1015 // change sort order of a select box 1016 else if (substr($var['form_button'], 0, 9) == 'listsort_') { 1017 $var['sort'] = substr($var['form_button'], 9); 1018 // echo 'sort!!!' . $var['sort']; 1019 $var['result'] = 'success'; 1020 $var['alert'] = $var['success'][$var['form_button']][$var['lang']]; 1021 } 1022 1023 // upload images, documents, addresses or links 1024 else if ($var['form_button'] == 'upload') { 1025 save_database(); 1026 if ($var['this_page']['name'] == 'images' || $var['this_page']['name'] == 'documents') { 1027 if ($var['result'] == 'success') 1028 $var['view'] = $HTTP_POST_FILES['form_file']['name']; 1029 else 1030 $var['view'] = 'new_' . $var['microtime']; 1031 } 1032 } 1033 1034 // empty trash 1035 else if ($var['form_button'] == 'empty') { 1036 $f = read_dir('data/trash'); 1037 for ($i = 0; $i < count($f); $i++) 1038 unlink('data/trash/' . $f[$i]['filename']); 1039 $var['result'] = 'success'; 1040 $var['alert'] = $var['success']['empty'][$var['lang']]; 1041 $var['view'] = ''; 1042 } 1043 1044 // undelete from trash 1045 else if ($var['form_button'] == 'undelete') { 1046 if ($var['type'] == 'message') 1047 $directory = 'newsletter/messages/unsent'; 1048 else if ($var['type'] == 'subscriber') 1049 $directory = 'newsletter/subscribers'; 1050 else if ($var['type'] != 'address') 1051 $directory = $var['type'] . 's'; 1052 else 1053 $directory = $var['type'] . 'es'; 1054 if ($var['type'] != 'account' && $var['type'] != 'message') 1055 $filename = $var['type'] . '.' . $var['view']; 1056 else { 1057 $f = read_dir('data/trash'); 1058 for ($i = 0; $i < count($f); $i++) { 1059 if ($f[$i]['type'] = 'account') { 1060 $file = file('data/trash/' . $f[$i]['filename']); 1061 $data = explode(' = ', chop($file[0])); 1062 if ($data[1] == $var['view']) 1063 $filename = $f[$i]['filename']; 1064 } 1065 } 1066 } 1067 if ($var['type'] == 'template') 1068 $extension = '.txt'; 1069 if ($var['type'] == 'address' || $var['type'] == 'link' || $var['type'] == 'subscriber') 1070 $extension = '.dat'; 1071 if ($var['type'] != 'account') 1072 $exists = file_exists("data/$directory/" . substr($filename, strlen($var['type']) + 1) . $extension); 1073 else { 1074 $f = read_dir('data/accounts'); 1075 for ($i = 0; $i < count($f); $i++) { 1076 $file = file('data/accounts/' . $f[$i]['filename']); 1077 $data = explode(' = ', chop($file[0])); 1078 if ($data[1] == $var['view']) 1079 $exists = true; 1080 } 1081 } 1082 if (!$exists) { 1083 rename("data/trash/$filename$extension", "data/$directory/" . substr($filename, strlen($var['type']) + 1) . $extension); 1084 chmod("data/$directory/" . substr($filename, strlen($var['type']) + 1) . $extension, 0666); 1085 $var['result'] = 'success'; 1086 $var['alert'] = $var['success']['undelete'][$var['lang']]; 1087 $var['view'] = ''; 1088 $var['type'] = ''; 1089 } 1090 else { 1091 $var['result'] = 'error'; 1092 $var['alert'] = $var['error']['undelete'][$var['lang']]; 1093 } 1094 } 1095 1096 // admin statistics 1097 else if (substr($var['form_button'], 0, 11) == 'statistics_') 1098 $var['view'] = substr($var['form_button'], 11); 1099 1100 // admin preferences 1101 else if (substr($var['form_button'], 0, 17) == 'default_language_' || substr($var['form_button'], 0, 11) == 'page_theme_' || substr($var['form_button'], 0, 16) == 'page_background_' || substr($var['form_button'], 0, 12) == 'menu_colors_' || substr($var['form_button'], 0, 13) == 'column_width_' || substr($var['form_button'], 0, 14) == 'column_height_' || substr($var['form_button'], 0, 9) == 'box_size_' || substr($var['form_button'], 0, 13) == 'page_preview_' || substr($var['form_button'], 0, 13) == 'links_window_' || substr($var['form_button'], 0, 22) == 'automatic_translation_' || substr($var['form_button'], 0, 13) == 'importexport_' || substr($var['form_button'], 0, 13) == 'session_time_' || substr($var['form_button'], 0, 11) == 'trash_time_') { 1102 $data = explode('_', $var['form_button']); 1103 $v = $data[count($data) - 1]; 1104 array_pop($data); 1105 $k = implode('_', $data); 1106 $var['preference'][$k] = $v; 1107 save_preferences(); 1108 $var['result'] = 'success'; 1109 $var['alert'] = $var['success']['preferences'][$var['lang']]; 1110 } 1111 1112 // edit unsent message 1113 else if ($var['form_button'] == 'edit') { 1114 echo "<script language=javascript>\n"; 1115 echo 'document.location.href = "main.php?page=admin/newsletter/messages/send&lang=' . $var['lang'] . '&view=' . $var['view'] . '&mode=admin&ssid=' . $var['ssid'] . "\";\n"; 1116 echo "</script>\n"; 1117 exit; 1118 } 1119 1120 // anything else 1121 else if ($var['form_button'] != 'preview') { 1122 $var['result'] = 'error'; 1123 $var['alert'] = $var['error']['not_yet'][$var['lang']]; 1124 } 1125 1126 } 1127 1128 // ----------------------------------------------------------------------------- 1129 1130 function create_html() { 1131 1132 /* 1133 * reads the template 'main.html' and adds the following variables: 1134 * - $TITLE: page title 1135 * - $BACKGROUND: page background 1136 * - $HEADER: page header 1137 * - $MENU: menu section 1138 * - $CONTENT: content section 1139 * -
About us
-
Contact
-
Search
-
Sitemap
-
Source Code
-
Report a bug
-
Login
- Last Update: Monday, August 9, 11:25 CET
: page footer 1140 */ 1141 1142 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 1143 1144 $file = file('data/system/main.html'); 1145 for ($i = 0; $i < count($file); $i++) { 1146 $file[$i] = chop($file[$i]); 1147 if (strstr($file[$i], '$TITLE')) 1148 $file[$i] = str_replace('$TITLE', $var['domain'] . ' - ' . menutoline($var['this_page']['title'][$var['lang']]), $file[$i]); 1149 if (strstr($file[$i], '$BACKGROUND')) { 1150 if ($var['preference']['page_background'] == '0') 1151 $file[$i] = str_replace('$BACKGROUND', 'bgcolor=#ffffff', $file[$i]); 1152 else if ($var['preference']['page_background'] == '1' || $var['preference']['page_background'] == '2') 1153 $file[$i] = str_replace('$BACKGROUND', 'bgcolor=#' . $var['color']['background'][$var['menu'][$var['this_tab']]['color']] . ' style=background-image:url(images/' . $var['themedir'] . '/background.' . $var['preference']['page_background'] . '.' . $var['themetype'] . ')', $file[$i]); 1154 else if ($var['preference']['page_background'] == '3') 1155 $file[$i] = str_replace('$BACKGROUND', 'bgcolor=#' . $var['color']['background'][$var['menu'][$var['this_tab']]['color']], $file[$i]); 1156 } 1157 if (strstr($file[$i], '$HEADER')) 1158 $file[$i] = str_replace('$HEADER', create_header(), $file[$i]); 1159 if (strstr($file[$i], '$MENU')) 1160 $file[$i] = str_replace('$MENU', create_menu(), $file[$i]); 1161 if (strstr($file[$i], '$CONTENT')) 1162 $file[$i] = str_replace('$CONTENT', create_content(), $file[$i]); 1163 if (strstr($file[$i], '
About us
-
Contact
-
Search
-
Sitemap
-
Source Code
-
Report a bug
-
Login
- Last Update: Monday, August 9, 11:25 CET
')) 1164 $file[$i] = str_replace('
About us
-
Contact
-
Search
-
Sitemap
-
Source Code
-
Report a bug
-
Login
- Last Update: Monday, August 9, 11:25 CET
', create_footer(), $file[$i]); 1165 $html .= "$file[$i]\n"; 1166 } 1167 return $html; 1168 1169 } 1170 1171 // ----------------------------------------------------------------------------- 1172 1173 function create_header() { 1174 1175 /* 1176 * reads the template 'header.html' and adds the following variables: 1177 * - $DIR: theme directory 1178 * - $TYPE: theme type 1179 * - $TEXT: header text 1180 * - $LANG: header language 1181 */ 1182 1183 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 1184 1185 $html .= "<center>\n"; 1186 $html .= "<table width=768 height=9 border=0 cellpadding=0 cellspacing=0>\n"; 1187 $html .= " <tr>\n"; 1188 $html .= " <td></td>\n"; 1189 $html .= " </tr>\n"; 1190 $html .= "</table>\n"; 1191 if (!$var['mode'] || $var['preference']['admin_header'] == 'show') { 1192 $file = file('data/system/header.html'); 1193 if (count($file) > 1 || chop($file[0])) { 1194 for ($i = 0; $i < count($file); $i++) { 1195 $file[$i] = chop($file[$i]); 1196 if (strstr($file[$i], '$DIR')) 1197 $file[$i] = str_replace('$DIR', $var['themedir'], $file[$i]); 1198 if (strstr($file[$i], '$TYPE')) 1199 $file[$i] = str_replace('$TYPE', $var['themetype'], $file[$i]); 1200 if (strstr($file[$i], '$TEXT')) 1201 $file[$i] = str_replace('$TEXT', $var['header']['text'][$var['lang']], $file[$i]); 1202 if (strstr($file[$i], '$LANG')) 1203 $file[$i] = str_replace('$LANG', $var['lang'], $file[$i]); 1204 $html .= "$file[$i]\n"; 1205 } 1206 } 1207 $html .= "<table width=768 height=9 border=0 cellpadding=0 cellspacing=0>\n"; 1208 $html .= " <tr>\n"; 1209 $html .= " <td></td>\n"; 1210 $html .= " </tr>\n"; 1211 $html .= "</table>\n"; 1212 } 1213 return $html; 1214 1215 } 1216 1217 // ----------------------------------------------------------------------------- 1218 1219 function create_menu() { 1220 1221 /* 1222 * creates the following menus: 1223 * - tabs (upper level tabs) 1224 * - menus (upper level menus) 1225 * - subtabs (lower level tabs) 1226 * - submenus (lower level menus) 1227 */ 1228 1229 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 1230 1231 $html .= create_tabs(); 1232 $html .= create_menus(); 1233 if ($var['menu'][$var['this_tab']][$var['this_menu']]['count']) { 1234 $html .= create_subtabs(); 1235 if ($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count']) 1236 $html .= create_submenus(); 1237 } 1238 $html .= "<table width=100% height=24 border=0 cellpadding=0 cellspacing=0>\n"; 1239 $html .= " <tr>\n"; 1240 $html .= " <td></td>\n"; 1241 $html .= " </tr>\n"; 1242 $html .= "</table>\n"; 1243 return $html; 1244 1245 } 1246 1247 // ----------------------------------------------------------------------------- 1248 1249 function create_tabs() { 1250 1251 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 1252 1253 $html .= "<table width=100% border=0 cellpadding=0 cellspacing=0>\n"; 1254 $html .= " <tr>\n"; 1255 $html .= " <td align=center>\n"; 1256 $html .= " <table border=0 cellpadding=0 cellspacing=0>\n"; 1257 $html .= " <tr>\n"; 1258 if (!$var['mode'] && $var['menu'][$var['this_tab']]['name'] != 'admin') 1259 $tabs = $var['menu']['count'] - 1; 1260 else 1261 $tabs = $var['menu']['count']; 1262 for ($i = -1; $i < $var['menu']['count']; $i++) { 1263 $html .= ' <td width=96 height=36 align=center valign=middle'; 1264 if ($i > -1 && $i < $tabs) { 1265 $html .= ' background=images/' . $var['themedir'] . '/tab.' . $var['menu'][$i]['color'] . '.'; 1266 if ($i == $var['this_tab'] && $var['mode'] == 'admin' && !isset($var['this_menu'])) 1267 $html .= 'on'; 1268 else 1269 $html .= 'off'; 1270 $html .= '.' . $var['themetype']; 1271 } 1272 /* 1273 else if ($i == $tabs) 1274 $html .= ' background=images/' . $var['themedir'] . '/date.' . $var['themetype']; 1275 */ 1276 $html .= '>'; 1277 if ($i == -1 && $var['lang'] == 'en') 1278 $html .= '<img src=images/' . $var['themedir'] . '/language.en.on.' . $var['themetype'] . ' width=18 height=18><img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . ' width=12 height=18>'; 1279 if (($i == $var['this_tab'] && (!$var['mode'] || ($var['mode'] == 'admin' && !isset($var['this_menu'])))) || $i == $tabs) 1280 $html .= '<span'; 1281 else { 1282 $html .= '<a href=main.php?page='; 1283 if ($i == -1) 1284 $html .= $var['page']; 1285 else 1286 $html .= $var['menu'][$i]['name']; 1287 $html .= '&lang='; 1288 if ($i == -1) { 1289 if ($var['lang'] == 'en') 1290 $html .= 'de'; 1291 else if ($var['lang'] == 'de') 1292 $html .= 'en'; 1293 if ($var['view']) 1294 $html .= '&view=' . $var['view']; 1295 if ($var['sort']) 1296 $html .= '&sort=' . $var['sort']; 1297 } 1298 else 1299 $html .= $var['lang']; 1300 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 1301 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 1302 } 1303 $html .= ' class=tab'; 1304 if ($var['menu'][$i]['status'] == 'hidden') 1305 $html .= '_hidden'; 1306 else if ($i == -1 || $i == $tabs) 1307 $html .= '_transparent'; 1308 $html .= ' style=color:#'; 1309 if ($i == $var['this_tab'] && $var['mode'] == 'admin' && !isset($var['this_menu'])) 1310 $html .= $var['color']['menu'][$var['menu'][$i]['color']]['on']; 1311 else if ($i < $tabs) 1312 $html .= $var['color']['menu'][$var['menu'][$i]['color']]['off']; 1313 /* 1314 else 1315 $html .= $var['color']['menu']['gray']['off']; 1316 */ 1317 if ($i == -1) { 1318 if ($var['lang'] == 'en') 1319 $html .= ' title="' . $var['tooltip']['german']['en'] . '"'; 1320 else 1321 $html .= ' title="' . $var['tooltip']['english']['de'] . '"'; 1322 } 1323 $html .= '>'; 1324 if ($i == -1) { 1325 $html .= '<img src=images/' . $var['themedir'] . '/language.'; 1326 if ($var['lang'] == 'en') 1327 $html .= 'de'; 1328 else 1329 $html .= 'en'; 1330 $html .= '.off.' . $var['themetype'] . ' width=18 height=18 border=0>'; 1331 } 1332 else if ($i < $tabs) 1333 $html .= $var['menu'][$i]['title'][$var['lang']]; 1334 else if ($i == $tabs) { 1335 /* 1336 if ($var['lang'] == 'en') 1337 $html .= substr($var['weekday'][date('w', $var['time'])][$var['lang']], 0, 3); 1338 else 1339 $html .= substr($var['weekday'][date('w', $var['time'])][$var['lang']], 0, 2); 1340 $html .= ' ' . date('j H:i', $var['time']); 1341 */ 1342 if ($var['this_page']['name'] == 'search') 1343 $html .= '<img src=images/' . $var['themedir'] . '/button.search.on.' . $var['themetype'] . ' width=18 height=18 border=0>'; 1344 else 1345 $html .= '<a href=main.php?page=tools/search&lang=' . $var['lang'] . ' title="' . $var['tooltip']['search'][$var['lang']] . '"><img src=images/' . $var['themedir'] . '/button.search.off.' . $var['themetype'] . ' width=18 height=18 border=0></a>'; 1346 $html .= '<img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . ' width=12 height=18>'; 1347 if ($var['this_page']['name'] == 'sitemap') 1348 $html .= '<img src=images/' . $var['themedir'] . '/button.sitemap.on.' . $var['themetype'] . ' width=18 height=18 border=0>'; 1349 else 1350 $html .= '<a href=main.php?page=tools/sitemap&lang=' . $var['lang'] . ' title="' . $var['tooltip']['sitemap'][$var['lang']] . '"><img src=images/' . $var['themedir'] . '/button.sitemap.off.' . $var['themetype'] . ' width=18 height=18 border=0></a>'; 1351 } 1352 if (($i == $var['this_tab'] && (!$var['mode'] || ($var['mode'] == 'admin' && !isset($var['this_menu'])))) || $i == $tabs) 1353 $html .= '</span>'; 1354 else 1355 $html .= '</a>'; 1356 if ($i == -1 && $var['lang'] == 'de') 1357 $html .= '<img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . ' width=12 height=18><img src=images/' . $var['themedir'] . '/language.de.on.' . $var['themetype'] . ' width=18 height=18>'; 1358 $html .= "</td>\n"; 1359 } 1360 $html .= " </tr>\n"; 1361 $html .= " </table>\n"; 1362 $html .= " </td>\n"; 1363 $html .= " </tr>\n"; 1364 $html .= "</table>\n"; 1365 return $html; 1366 1367 } 1368 1369 // ----------------------------------------------------------------------------- 1370 1371 function create_menus() { 1372 1373 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 1374 1375 $html .= "<table width=100% border=0 cellpadding=0 cellspacing=0>\n"; 1376 $html .= " <tr>\n"; 1377 $html .= ' <td align=center background=images/' . $var['themedir'] . '/menu.' . $var['menu'][$var['this_tab']]['color'] . '.off.normal.' . $var['themetype'] . ">\n"; 1378 $html .= " <table border=0 cellpadding=0 cellspacing=0>\n"; 1379 $html .= " <tr>\n"; 1380 if ($var['menu'][$var['this_tab']]['count'] % 2 == 0) { 1381 $i_start = $var['menu'][$var['this_tab']]['count'] / 2 - 4; 1382 $i_end = $var['menu'][$var['this_tab']]['count'] / 2 + 3; 1383 } 1384 else { 1385 $i_start = $var['menu'][$var['this_tab']]['count'] / 2 - 3.5; 1386 $i_end = $var['menu'][$var['this_tab']]['count'] / 2 + 2.5; 1387 } 1388 if (($i_end - $i_start + 1) % 2 == 0) 1389 $j = $var['menu']['count'] / 2 - 4.5; 1390 else 1391 $j = $var['menu']['count'] / 2 - 4; 1392 if ($var['this_tab'] == 6 && $var['menu'][$var['this_tab']]['count'] % 2) 1393 $html .= ' <td width=48 height=36 background=images/' . $var['themedir'] . '/menu.' . $var['menu'][$var['this_tab']]['color'] . '.off.normal.' . $var['themetype'] . "></td>\n"; 1394 for ($i = $i_start; $i <= $i_end; $i++) { 1395 $html .= ' <td width=96 height=36 align=center valign=middle background=images/' . $var['themedir'] . '/menu.' . $var['menu'][$var['this_tab']]['color'] . '.'; 1396 if (isset($var['this_menu']) && $i == $var['this_menu']) 1397 $html .= 'on'; 1398 else 1399 $html .= 'off'; 1400 $html .= '.'; 1401 if ($j == $var['this_tab'] - 0.5) 1402 $html .= 'left'; 1403 else if ($j == $var['this_tab']) 1404 $html .= 'center'; 1405 else if ($j == $var['this_tab'] + 0.5) 1406 $html .= 'right'; 1407 else 1408 $html .= 'normal'; 1409 $html .= '.' . $var['themetype'] . '>'; 1410 if (isset($var['this_menu']) && $i == $var['this_menu'] && (!$var['mode'] || ($var['mode'] == 'admin' && !isset($var['this_subtab'])))) 1411 $html .= '<span'; 1412 else { 1413 $html .= '<a href=main.php?page=' . $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$i]['name'] . '&lang=' . $var['lang']; 1414 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 1415 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 1416 } 1417 $html .= ' class=menu'; 1418 if ($var['menu'][$var['this_tab']][$i]['status'] == 'hidden') 1419 $html .= '_hidden'; 1420 $html .= ' style=color:#'; 1421 if (isset($var['this_menu']) && $i == $var['this_menu']) 1422 $html .= $var['color']['menu'][$var['menu'][$var['this_tab']]['color']]['on']; 1423 else 1424 $html .= $var['color']['menu'][$var['menu'][$var['this_tab']]['color']]['off']; 1425 $html .= '>' . $var['menu'][$var['this_tab']][$i]['title'][$var['lang']]; 1426 if (isset($var['this_menu']) && $i == $var['this_menu'] && (!$var['mode'] || ($var['mode'] == 'admin' && !isset($var['this_subtab'])))) 1427 $html .= '</span>'; 1428 else 1429 $html .= '</a>'; 1430 $html .= "</td>\n"; 1431 $j++; 1432 } 1433 if ($var['this_tab'] == 6 && $var['menu'][$var['this_tab']]['count'] % 2) 1434 $html .= ' <td width=48 height=36 background=images/' . $var['themedir'] . '/menu.' . $var['menu'][$var['this_tab']]['color'] . '.off.right.' . $var['themetype'] . "></td>\n"; 1435 $html .= " </tr>\n"; 1436 $html .= " </table>\n"; 1437 $html .= " </td>\n"; 1438 $html .= " </tr>\n"; 1439 $html .= "</table>\n"; 1440 return $html; 1441 1442 } 1443 1444 // ----------------------------------------------------------------------------- 1445 1446 function create_subtabs() { 1447 1448 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 1449 1450 $html .= "<table width=100% height=12 border=0 cellpadding=0 cellspacing=0>\n"; 1451 $html .= " <tr>\n"; 1452 $html .= " <td></td>\n"; 1453 $html .= " </tr>\n"; 1454 $html .= "</table>\n"; 1455 $html .= "<table width=100% border=0 cellpadding=0 cellspacing=0>\n"; 1456 $html .= " <tr>\n"; 1457 $html .= " <td align=center>\n"; 1458 $html .= " <table border=0 cellpadding=0 cellspacing=0>\n"; 1459 $html .= " <tr>\n"; 1460 for ($i = 0; $i < $var['menu'][$var['this_tab']][$var['this_menu']]['count']; $i++) { 1461 $html .= ' <td width=128 height=24 align=center valign=middle background=images/' . $var['themedir'] . '/submenu.'; 1462 $html .= $var['menu'][$var['this_tab']][$var['this_menu']][$i]['color'] . '.'; 1463 if ($i === $var['this_subtab'] && !isset($var['this_submenu'])) 1464 $html .= 'on'; 1465 else 1466 $html .= 'off'; 1467 $html .= '.'; 1468 if ($var['menu'][$var['this_tab']][$var['this_menu']]['count'] == 1) 1469 $html .= 'single'; 1470 else if ($i == 0) 1471 $html .= 'left'; 1472 else if ($i < $var['menu'][$var['this_tab']][$var['this_menu']]['count'] - 1) 1473 $html .= 'center'; 1474 else 1475 $html .= 'right'; 1476 $html .= '.' . $var['themetype'] . '>'; 1477 if ($i === $var['this_subtab'] && (!$var['mode'] || ($var['mode'] == 'admin' && !isset($var['this_submenu'])))) 1478 $html .= '<span'; 1479 else { 1480 $html .= '<a href=main.php?page=' . $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']][$i]['name'] . '&lang=' . $var['lang']; 1481 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 1482 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 1483 } 1484 $html .= ' class=menu'; 1485 if ($var['menu'][$var['this_tab']][$var['this_menu']][$i]['status'] == 'hidden') 1486 $html .= '_hidden'; 1487 $html .= ' style=color:#'; 1488 if ($i === $var['this_subtab'] && !isset($var['this_submenu'])) 1489 $html .= $var['color']['menu'][$var['menu'][$var['this_tab']][$var['this_menu']][$i]['color']]['on']; 1490 else 1491 $html .= $var['color']['menu'][$var['menu'][$var['this_tab']][$var['this_menu']][$i]['color']]['off']; 1492 $html .= '>' . $var['menu'][$var['this_tab']][$var['this_menu']][$i]['title'][$var['lang']]; 1493 if ($i === $var['this_subtab'] && (!$var['mode'] || ($var['mode'] == 'admin' && !isset($var['this_submenu'])))) 1494 $html .= '</span>'; 1495 else 1496 $html .= '</a>'; 1497 $html .= "</td>\n"; 1498 } 1499 $html .= " </tr>\n"; 1500 $html .= " </table>\n"; 1501 $html .= " </td>\n"; 1502 $html .= " </tr>\n"; 1503 $html .= "</table>\n"; 1504 return $html; 1505 1506 } 1507 1508 // ----------------------------------------------------------------------------- 1509 1510 function create_submenus() { 1511 1512 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 1513 1514 $html .= "<table width=100% border=0 cellpadding=0 cellspacing=0>\n"; 1515 $rows = floor(($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] - 1) / 6) + 1; 1516 $j = 0; 1517 for ($row = 0; $row < $rows; $row++) { 1518 $html .= " <tr>\n"; 1519 $html .= " <td align=center>\n"; 1520 $html .= " <table border=0 cellpadding=0 cellspacing=0>\n"; 1521 $html .= " <tr>\n"; 1522 if ($rows == 1) { 1523 $i_start = 0; 1524 $i_end = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] - 1; 1525 } 1526 else if ($rows == 2) { 1527 if ($row == 0) { 1528 $i_start = 0; 1529 $i_end = ceil($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] / 2) - 1; 1530 } 1531 else if ($row == 1) { 1532 $i_start = ceil($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] / 2); 1533 $i_end = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] - 1; 1534 } 1535 } 1536 else if ($rows == 3) { 1537 if ($row == 0) { 1538 $i_start = 0; 1539 $i_end = ceil($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] / 3) - 1; 1540 } 1541 else if ($row == 1) { 1542 $i_start = ceil($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] / 3); 1543 $i_end = ceil($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] * 2 / 3) - 1; 1544 } 1545 else if ($row == 2) { 1546 $i_start = ceil($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] * 2 / 3); 1547 $i_end = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] - 1; 1548 } 1549 } 1550 else if ($rows == 4) { 1551 if ($row == 0) { 1552 $i_start = 0; 1553 $i_end = ceil($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] / 4) - 1; 1554 } 1555 else if ($row == 1) { 1556 $i_start = ceil($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] / 4); 1557 $i_end = ceil($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] / 2) - 1; 1558 if ($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] == 22) 1559 $i_end++; 1560 } 1561 else if ($row == 2) { 1562 $i_start = ceil($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] / 2); 1563 if ($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] == 22) 1564 $i_start++; 1565 $i_end = ceil($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] * 3 / 4) - 1; 1566 } 1567 else if ($row == 3) { 1568 $i_start = ceil($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] * 3 / 4); 1569 $i_end = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] - 1; 1570 } 1571 } 1572 for ($i = $i_start; $i <= $i_end; $i++) { 1573 $html .= ' <td width=128 height=24 align=center valign=middle background=images/' . $var['themedir'] . '/submenu.' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['color'] . '.'; 1574 if ($j === $var['this_submenu']) 1575 $html .= 'on'; 1576 else 1577 $html .= 'off'; 1578 $html .= '.'; 1579 if ($i_start == $i_end) 1580 $html .= 'single'; 1581 else if ($i == $i_start) 1582 $html .= 'left'; 1583 else if ($i < $i_end) 1584 $html .= 'center'; 1585 else 1586 $html .= 'right'; 1587 $html .= '.' . $var['themetype'] . '>'; 1588 if ($j === $var['this_submenu']) 1589 $html .= '<span'; 1590 else { 1591 $html .= '<a href=main.php?page=' . $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$i]['name'] . '&lang=' . $var['lang']; 1592 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 1593 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 1594 } 1595 $html .= ' class=menu'; 1596 if ($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$i]['status'] == 'hidden') 1597 $html .= '_hidden'; 1598 $html .= ' style=color:#'; 1599 if ($j === $var['this_submenu']) 1600 $html .= $var['color']['menu'][$var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['color']]['on']; 1601 else 1602 $html .= $var['color']['menu'][$var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['color']]['off']; 1603 $html .= '>' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$i]['title'][$var['lang']]; 1604 if ($j === $var['this_submenu']) 1605 $html .= '</span>'; 1606 else 1607 $html .= '</a>'; 1608 $html .= "</td>\n"; 1609 $j++; 1610 } 1611 $html .= " </tr>\n"; 1612 $html .= " </table>\n"; 1613 $html .= " </td>\n"; 1614 $html .= " </tr>\n"; 1615 } 1616 $html .= "</table>\n"; 1617 return $html; 1618 1619 } 1620 1621 // ----------------------------------------------------------------------------- 1622 1623 function create_content() { 1624 1625 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 1626 1627 // echo 'status=' . $var['status'] . ' selected page=' . $var['this_page']['name']; 1628 if ($var['status'] == 'script') 1629 $html = script(); 1630 else { 1631 if ($var['mode'] != 'admin') 1632 $html = create_page(); 1633 else if ($var['mode'] == 'admin') { 1634 $var['publish'] = $var['status']; 1635 if ($var['level'] == 0) 1636 $var['tabcolor'] = $var['menu'][$var['this_tab']]['color']; 1637 else if ($var['level'] == 2) 1638 $var['tabcolor'] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['color']; 1639 if ($var['alert']) { 1640 $html .= create_alert(); 1641 $html .= create_space(); 1642 } 1643 $html .= '<form name=form action=main.php?page=' . $var['page'] . '&lang=' . $var['lang'] . '&mode=admin&ssid=' . $var['ssid'] . " method=post>\n"; 1644 $html .= "<input type=hidden name=form value=1>\n"; 1645 1646 if ($var['level'] == 0) { 1647 if ($var['menu']['count'] > 2) 1648 $submit_1 = array('left', 'right'); 1649 if (!contains_max_submenus()) { 1650 if ($var['this_tab'] > 0 && $var['menu'][$var['this_tab'] - 1]['count'] < 8) 1651 $submit_1[count($submit_1)] = 'down_left'; 1652 if ($var['this_tab'] < $var['menu']['count'] - 2 && $var['menu'][$var['this_tab'] + 1]['count'] < 8) 1653 $submit_1[count($submit_1)] = 'down_right'; 1654 } 1655 if ($var['menu']['count'] < 7) 1656 $submit_2 = array('add'); 1657 if ($var['menu']['count'] > 2 && !contains_content()) 1658 $submit_2[count($submit_2)] = 'delete'; 1659 } 1660 1661 else if ($var['level'] == 1) { 1662 if ($var['menu'][$var['this_tab']]['count'] > 1) 1663 $submit_1 = array('left', 'right'); 1664 if ($var['menu']['count'] < 7) { 1665 $submit_1[count($submit_1)] = 'up_left'; 1666 $submit_1[count($submit_1)] = 'up_right'; 1667 } 1668 if (!contains_max_submenus()) { 1669 if ($var['this_menu'] > 0 && $var['menu'][$var['this_tab']][$var['this_menu'] - 1]['count'] < 6 && !has_content($var['menu'][$var['this_tab']]['name'] . '.' . $var['menu'][$var['this_tab']][$var['this_menu'] - 1]['name'] . '.en.txt') && !has_content($var['menu'][$var['this_tab']]['name'] . '.' . $var['menu'][$var['this_tab']][$var['this_menu'] - 1]['name'] . '.de.txt')) 1670 $submit_1[count($submit_1)] = 'down_left'; 1671 if ($var['this_menu'] < $var['menu'][$var['this_tab']]['count'] - 1 && $var['menu'][$var['this_tab']][$var['this_menu'] + 1]['count'] < 6 && !has_content($var['menu'][$var['this_tab']]['name'] . '.' . $var['menu'][$var['this_tab']][$var['this_menu'] + 1]['name'] . '.en.txt') && !has_content($var['menu'][$var['this_tab']]['name'] . '.' . $var['menu'][$var['this_tab']][$var['this_menu'] + 1]['name'] . '.de.txt')) 1672 $submit_1[count($submit_1)] = 'down_right'; 1673 } 1674 if ($var['menu'][$var['this_tab']]['count'] < 8) 1675 $submit_2 = array('add'); 1676 if ($var['menu'][$var['this_tab']]['count'] > 1 && !contains_content()) 1677 $submit_2[count($submit_2)] = 'delete'; 1678 } 1679 1680 else if ($var['level'] == 2) { 1681 if ($var['menu'][$var['this_tab']][$var['this_menu']]['count'] > 1) 1682 $submit_1 = array('left', 'right'); 1683 if ($var['menu'][$var['this_tab']]['count'] < 8) { 1684 $submit_1[count($submit_1)] = 'up_left'; 1685 $submit_1[count($submit_1)] = 'up_right'; 1686 } 1687 if (!contains_max_submenus()) { 1688 if ($var['this_subtab'] > 0 && $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab'] - 1]['count'] < 24 && !has_content($var['menu'][$var['this_tab']]['name'] . '.' . $var['menu'][$var['this_menu']]['name'] . '.' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab'] - 1]['name'] . '.en.txt') && !has_content($var['menu'][$var['this_tab']]['name'] . '.' . $var['menu'][$var['this_menu']]['name'] . '.' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab'] - 1]['name'] . '.de.txt')) 1689 $submit_1[count($submit_1)] = 'down_left'; 1690 if ($var['this_subtab'] < $var['menu'][$var['this_tab']][$var['this_menu']]['count'] - 1 && $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab'] + 1]['count'] < 24) 1691 $submit_1[count($submit_1)] = 'down_right'; 1692 } 1693 if ($var['menu'][$var['this_tab']][$var['this_menu']]['count'] < 6) 1694 $submit_2 = array('add'); 1695 if ($var['menu'][$var['this_tab']][$var['this_menu']]['count'] > 1 && !contains_content()) 1696 $submit_2[count($submit_2)] = 'delete'; 1697 } 1698 1699 else if ($var['level'] == 3) { 1700 if ($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] > 1) 1701 $submit_1 = array('left', 'right'); 1702 if ($var['menu'][$var['this_tab']][$var['this_menu']]['count'] < 6) { 1703 $submit_1[count($submit_1)] = 'up_left'; 1704 $submit_1[count($submit_1)] = 'up_right'; 1705 } 1706 if ($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] < 24) 1707 $submit_2 = array('add'); 1708 if ($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] > 1 && !contains_content()) 1709 $submit_2[count($submit_2)] = 'delete'; 1710 } 1711 1712 if ($var['pagetype'] == 'page' && !has_content($var['pagefile']) && $var['level'] < 3) 1713 $submit_2[count($submit_2)] = 'insert'; 1714 1715 if (isset($submit_1)) { 1716 $html .= create_submit($submit_1); 1717 $html .= create_space(); 1718 } 1719 if (isset($submit_2)) { 1720 $html .= create_submit($submit_2); 1721 $html .= create_space(); 1722 } 1723 1724 if ($var['level'] == 0 && ($var['this_page']['status'] == 'hidden' || $var['menu']['count_public'] > 1)) { 1725 $html .= create_select('publish'); 1726 $html .= create_space(); 1727 } 1728 else if ($var['level'] == 1 && ($var['this_page']['status'] == 'hidden' || $var['menu'][$var['this_tab']]['count_public'] > 1)) { 1729 $html .= create_select('publish'); 1730 $html .= create_space(); 1731 } 1732 else if ($var['level'] == 2 && ($var['this_page']['status'] == 'hidden' || $var['menu'][$var['this_tab']][$var['this_menu']]['count_public'] > 1)) { 1733 $html .= create_select('publish'); 1734 $html .= create_space(); 1735 } 1736 else if ($var['level'] == 3 && ($var['this_page']['status'] == 'hidden' || $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count_public'] > 1)) { 1737 $html .= create_select('publish'); 1738 $html .= create_space(); 1739 } 1740 if ($var['level'] == 0 || $var['level'] == 2) { 1741 $html .= create_select('tabcolor'); 1742 $html .= create_space(); 1743 } 1744 if ($var['pagetype'] == 'page') 1745 $title = $var['label']['page'][$var['lang']]; 1746 else 1747 $title = $var['label']['directory'][$var['lang']]; 1748 if (!$var['form_page'] || $var['form_button'] == 'cancel') 1749 $value = $var['this_page']['name']; 1750 else 1751 $value = $var['form_page']; 1752 $html .= create_input($title, 'page', $value, 'small'); 1753 $html .= create_space(); 1754 if (!$var['form_page'] || $var['form_button'] == 'cancel') 1755 $value = $var['this_page']['title'][$var['lang']]; 1756 else 1757 $value = $var['form_title']; 1758 $html .= create_input($var['label']['title'][$var['lang']] . '*', 'title', $value, 'small'); 1759 $html .= create_space(); 1760 if ($var['pagetype'] == 'page') { 1761 // delete below later 1762 if (!file_exists('data/pages/' . $var['pagefile'])) 1763 copy('data/templates/default.txt', 'data/pages/' . $var['pagefile']); 1764 // delete above later 1765 if (!has_content($var['pagefile'])) { 1766 $html .= create_label($var['label']['template'][$var['lang']], 'large'); 1767 $html .= create_space(); 1768 $html .= create_input($var['label']['name'][$var['lang']], 'template', '', 'small'); 1769 $html .= create_space(); 1770 $html .= create_submit(array('load')); 1771 $html .= create_space(); 1772 } 1773 $html .= create_editor(); 1774 } 1775 else { 1776 $html .= create_submit(array('cancel', 'save')); 1777 $html .= create_space(); 1778 $var['result'] = 'help'; 1779 $var['alert'] = $var['help']['languages'][$var['lang']]; 1780 $html .= create_alert(); 1781 } 1782 $html .= "</form>\n"; 1783 } 1784 } 1785 return $html; 1786 } 1787 1788 // ----------------------------------------------------------------------------- 1789 1790 function create_page() { 1791 1792 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 1793 1794 if ($var['this_page']['name'] != 'templates') { 1795 $dirname = 'pages'; 1796 $filename = $var['pagefile']; 1797 } 1798 else { 1799 $dirname = 'templates'; 1800 $filename = $var['view'] . '.txt'; 1801 } 1802 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 1803 $html .= " <tr>\n"; 1804 if (file_exists("data/$dirname/$filename")) 1805 $html .= parse_text("data/$dirname/$filename", 'html'); 1806 $html .= " </tr>\n"; 1807 $html .= "</table>\n"; 1808 1809 return $html; 1810 1811 } 1812 1813 // ----------------------------------------------------------------------------- 1814 1815 1816 function create_editor() { 1817 1818 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 1819 1820 if ($var['this_page']['name'] != 'templates') 1821 $html .= create_label($var['label']['content'][$var['lang']] . '*', 'large'); 1822 else 1823 $html .= create_label($var['label']['content'][$var['lang']], 'large'); 1824 $html .= create_space(); 1825 if ($var['this_page']['name'] != 'templates') { 1826 $dirname = 'pages'; 1827 $filename = $var['pagefile']; 1828 } 1829 else { 1830 $dirname = 'templates'; 1831 $filename = $var['view'] . '.txt'; 1832 } 1833 $var['columns'] = get_layout("data/$dirname/$filename"); 1834 $html .= create_select('columns'); 1835 $html .= create_space(); 1836 if ($var['preference']['column_width'] == 'show') { 1837 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 1838 $html .= " <tr>\n"; 1839 for ($i = 0; $i < count($var['layout'][$var['columns']]); $i++) { 1840 if ($i > 0) { 1841 if ($i > 1 || $var['rows'] == 1) 1842 $html .= " <td width=36 height=18></td>\n"; 1843 else { 1844 $html .= " <tr>\n"; 1845 $html .= " <td width=18 height=18></td>\n"; 1846 $html .= " </tr>\n"; 1847 } 1848 } 1849 if ($i > 0 || $var['rows'] == 1) 1850 $html .= ' <td width=' . $var['layout'][$var['columns']][$i]['width'] . " height=18>\n"; 1851 else 1852 $html .= ' <td colspan=' . ($var['columns'] * 2 - 3) . ' width=' . $var['layout'][$var['columns']][$i]['width'] . " height=18>\n"; 1853 $html .= " <table border=0 cellpadding=0 cellspacing=0>\n"; 1854 $html .= " <tr>\n"; 1855 $html .= ' <td width=6 height=6 background=images/' . $var['themedir'] . '/alert.help.left.top.' . $var['themetype'] . "></td>\n"; 1856 $html .= ' <td width=6 height=6 background=images/' . $var['themedir'] . '/alert.help.center.top.' . $var['themetype'] . "></td>\n"; 1857 $html .= ' <td height=6 background=images/' . $var['themedir'] . '/alert.help.center.top.' . $var['themetype'] . "></td>\n"; 1858 $html .= ' <td width=6 height=6 background=images/' . $var['themedir'] . '/alert.help.center.top.' . $var['themetype'] . "></td>\n"; 1859 $html .= ' <td width=6 height=6 background=images/' . $var['themedir'] . '/alert.help.right.top.' . $var['themetype'] . "></td>\n"; 1860 $html .= " </tr>\n"; 1861 $html .= " <tr>\n"; 1862 $html .= ' <td width=6 background=images/' . $var['themedir'] . '/alert.help.left.middle.' . $var['themetype'] . "></td>\n"; 1863 $html .= " <td width=6 height=6 bgcolor=#ffffff></td>\n"; 1864 $html .= ' <td width=' . ($var['layout'][$var['columns']][$i]['width'] - 24) . ' align=center valign=middle bgcolor=#ffffff>'; 1865 $html .= '<span class=alert style=color:#' . $var['color']['alert']['help'] . '>← ' . $var['layout'][$var['columns']][$i]['width'] . ' ' . $var['pixels'][$var['lang']] . ' →</span>'; 1866 $html .= "</td>\n"; 1867 $html .= " <td width=6 height=6 bgcolor=#ffffff></td>\n"; 1868 $html .= ' <td width=6 background=images/' . $var['themedir'] . '/alert.help.right.middle.' . $var['themetype'] . "></td>\n"; 1869 $html .= " </tr>\n"; 1870 $html .= " <tr>\n"; 1871 $html .= ' <td width=6 height=6 background=images/' . $var['themedir'] . '/alert.help.left.bottom.' . $var['themetype'] . "></td>\n"; 1872 $html .= ' <td width=6 height=6 background=images/' . $var['themedir'] . '/alert.help.center.bottom.' . $var['themetype'] . "></td>\n"; 1873 $html .= ' <td height=6 background=images/' . $var['themedir'] . '/alert.help.center.bottom.' . $var['themetype'] . "></td>\n"; 1874 $html .= ' <td width=6 height=6 background=images/' . $var['themedir'] . '/alert.help.center.bottom.' . $var['themetype'] . "></td>\n"; 1875 $html .= ' <td width=6 height=6 background=images/' . $var['themedir'] . '/alert.help.right.bottom.' . $var['themetype'] . "></td>\n"; 1876 $html .= " </tr>\n"; 1877 $html .= " </table>\n"; 1878 $html .= " </td>\n"; 1879 } 1880 $html .= " </tr>\n"; 1881 $html .= "</table>\n"; 1882 $html .= create_space(); 1883 } 1884 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 1885 $html .= " <tr>\n"; 1886 $html .= parse_text("data/$dirname/$filename", 'form'); 1887 $html .= " </tr>\n"; 1888 $html .= "</table>\n"; 1889 $html .= create_space(); 1890 if ($var['this_page']['name'] == 'templates' || has_content(substr($var['pagefile'], 0, -7) . '.' . $var['other_language'] . '.txt')) 1891 $html .= create_submit(array('cancel', 'save')); 1892 else 1893 $html .= create_submit(array('cancel', 'save', 'copy')); 1894 if ($var['this_page']['name'] != 'templates') { 1895 $html .= create_space(); 1896 $var['result'] = 'help'; 1897 $var['alert'] = $var['help']['languages'][$var['lang']]; 1898 $html .= create_alert(); 1899 } 1900 if (has_content($filename) && $var['preference']['page_preview'] == 'show') { 1901 $html .= create_space(); 1902 $html .= create_label($var['label']['preview'][$var['lang']], 'large'); 1903 $html .= create_space(); 1904 $html .= create_page(); 1905 } 1906 1907 return $html; 1908 1909 } 1910 1911 // ----------------------------------------------------------------------------- 1912 1913 function script() { 1914 1915 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 1916 1917 // overview (start page) 1918 if ($var['this_page']['name'] == 'overview') { 1919 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 1920 $list = read_dir('data/news'); 1921 if (count($list)) { 1922 for ($i = 0; $i < count($list); $i++) 1923 $sort[$i] = $list[$i]['time']; 1924 arsort($sort); 1925 while (list($k, $v) = each($sort)) { 1926 if ($list[$k]['status'] == 'public') { 1927 if ($flag) { 1928 $html .= " <tr>\n"; 1929 $html .= " <td colspan=7 width=768 height=12></td>\n"; 1930 $html .= " </tr>\n"; 1931 } 1932 else 1933 $flag = true; 1934 $html .= " <tr>\n"; 1935 $html .= " <td colspan=7 width=768 height=33>\n"; 1936 $html .= create_cell('news', $list[$k]['filename']); 1937 $html .= " </td>\n"; 1938 $html .= " </tr>\n"; 1939 } 1940 } 1941 } 1942 // $html .= "</table>\n"; 1943 $html .= create_news(2); 1944 $html .= create_cell('more'); 1945 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 1946 $html .= " <tr>\n"; 1947 $html .= " <td colspan=7 width=768 height=12></td>\n"; 1948 $html .= " </tr>\n"; 1949 $html .= " <tr>\n"; 1950 $html .= " <td rowspan=3 width=183 height=366>\n"; 1951 $html .= create_cell('best practices'); 1952 $html .= " </td>\n"; 1953 $html .= " <td width=12 height=183></td>\n"; 1954 $html .= " <td colspan=3 width=378 height=183>\n"; 1955 $html .= create_cell('about'); 1956 $html .= " </td>\n"; 1957 $html .= " <td width=12 height=183></td>\n"; 1958 $html .= " <td rowspan=3 width=183 height=366>\n"; 1959 $html .= create_cell('newsletter'); 1960 $html .= " </td>\n"; 1961 $html .= " </tr>\n"; 1962 $html .= " <tr>\n"; 1963 $html .= " <td colspan=5 height=12></td>\n"; 1964 $html .= " </tr>\n"; 1965 $html .= " <tr>\n"; 1966 $html .= " <td width=12 height=183></td>\n"; 1967 $html .= " <td width=183 height=183>\n"; 1968 $html .= create_cell('database'); 1969 $html .= " </td>\n"; 1970 $html .= " <td width=12 height=183></td>\n"; 1971 $html .= " <td width=183 height=183>\n"; 1972 $html .= create_cell('award'); 1973 $html .= " </td>\n"; 1974 $html .= " <td width=12 height=183></td>\n"; 1975 $html .= " </tr>\n"; 1976 $html .= " <tr>\n"; 1977 $html .= " <td colspan=7 width=768 height=12></td>\n"; 1978 $html .= " </tr>\n"; 1979 $html .= " <tr>\n"; 1980 $html .= " <td colspan=5 width=573 height=183>\n"; 1981 $html .= create_cell('committee'); 1982 $html .= " </td>\n"; 1983 $html .= " <td width=12 height=183></td>\n"; 1984 $html .= " <td width=183 height=183>\n"; 1985 $html .= create_cell('contact'); 1986 $html .= " </td>\n"; 1987 $html .= " </tr>\n"; 1988 $html .= " <tr>\n"; 1989 $html .= " <td colspan=7 width=768 height=12></td>\n"; 1990 $html .= " </tr>\n"; 1991 /* 1992 $html .= " <tr>\n"; 1993 $html .= " <td colspan=7 width=768 height=33>\n"; 1994 $html .= create_cell('website'); 1995 $html .= " </td>\n"; 1996 $html .= " </tr>\n"; 1997 */ 1998 $html .= "</table>\n"; 1999 } 2000 2001 // subscribe 2002 else if ($var['this_page']['name'] == 'subscribe') { 2003 $html .= open_form(); 2004 if ($var['view']) { 2005 $var['result'] = $var['view']; 2006 $var['alert'] = $var[$var['view']]['request'][$var['lang']]; 2007 $html .= create_alert(); 2008 $html .= create_space(); 2009 } 2010 else if (!$var['alert']) { 2011 $var['result'] = 'help'; 2012 $var['alert'] = $var['help']['subscribe'][$var['lang']]; 2013 $html .= create_alert(); 2014 $html .= create_space(); 2015 } 2016 $html .= create_input($var['label']['e-mail'][$var['lang']], 'e_mail', '', 'small'); 2017 $html .= create_space(); 2018 $html .= create_submit(array('cancel', 'subscribe')); 2019 $html .= "</form>\n"; 2020 } 2021 2022 // subscriber login 2023 else if ($var['this_page']['name'] == 'subscription') { 2024 if ($var['mode'] != 'user') { 2025 if ($var['view'] != 'password') 2026 $var['view'] = ''; 2027 $html .= open_form(); 2028 if ($var['view'] != 'password') { 2029 if (!$var['alert']) { 2030 $var['result'] = 'help'; 2031 $var['alert'] = $var['help']['subscription'][$var['lang']]; 2032 $html .= create_alert(); 2033 $html .= create_space(); 2034 } 2035 $html .= create_input($var['label']['e-mail'][$var['lang']], 'e_mail', $var['form_e_mail'], 'small'); 2036 $html .= create_space(); 2037 $html .= create_input($var['label']['password'][$var['lang']], 'password', '', 'small'); 2038 $html .= create_space(); 2039 $html .= create_submit(array('cancel', 'password', 'login')); 2040 } 2041 else { 2042 $html .= create_input($var['label']['e-mail'][$var['lang']], 'e_mail', '', 'small'); 2043 $html .= create_space(); 2044 $html .= create_submit(array('cancel', 'send')); 2045 } 2046 $html .= "</form>\n"; 2047 } 2048 else { 2049 if (!$var['form']) { 2050 $value_status = $var['current_user']['status']; 2051 $list = read_dir('data/newsletter/filters'); 2052 for ($i = 0; $i < count($list); $i++) { 2053 if (strstr($var['current_user']['filters'], $list[$i]['name'])) 2054 $value_filter[$list[$i]['name']] = 'on'; 2055 else 2056 $value_filter[$list[$i]['name']] = 'off'; 2057 } 2058 } 2059 else 2060 $value_status = $var['form_status']; 2061 $html .= open_form(); 2062 $html .= create_label($var['label']['subscription'][$var['lang']] . ' - ' . $var['current_user']['e-mail'], 'small'); 2063 $html .= create_space(); 2064 $html .= create_input($var['label']['new_password'][$var['lang']], 'password', '', 'small'); 2065 $html .= create_space(); 2066 $html .= create_input($var['label']['repeat'][$var['lang']], 'repeat', '', 'small'); 2067 $html .= create_space(); 2068 $html .= create_input($var['label']['status'][$var['lang']], 'status', $value_status, 'small'); 2069 $html .= create_space(); 2070 $list = read_dir('data/newsletter/filters'); 2071 if ($list) { 2072 $html .= create_label($var['label']['filters'][$var['lang']], 'small'); 2073 $html .= create_space(); 2074 $var['alert'] = ''; 2075 for ($i = 0; $i < count($list); $i++) { 2076 $filedata = read_file('data/newsletter/filters/' . $list[$i]['filename']); 2077 $html .= create_input($filedata['title'][$var['lang']] . str_repeat('*', $i + 1), 'filter_' . $list[$i]['name'], $var['form_filter_' . $list[$i]['name']], 'small'); 2078 $html .= create_space(); 2079 if ($i > 0) 2080 $var['alert'] .= "<br>"; 2081 $var['alert'] .= str_repeat('*', $i + 1) . " 'On' = " . $filedata['description'][$var['lang']]; 2082 } 2083 } 2084 $html .= create_submit(array('cancel', 'save')); 2085 $html .= create_space(); 2086 $var['result'] = 'help'; 2087 $html .= create_alert(); 2088 $html .= "</form>\n"; 2089 } 2090 } 2091 2092 /* 2093 // un habitat news 2094 else if ($var['this_page']['name'] == 'un_habitat_news') { 2095 // $xml = file_get_contents('http://news.google.com/news?q=un+habitat&output=rss'); 2096 $f = fsockopen('news.google.com', 80, $error, $message, 30); 2097 echo "$error:$message<br>"; 2098 fputs($f, 'GET /news?q=un+habitat&output=rss HTTP/1.0\r\n'); 2099 fputs($f, "User Agent: $HTTP_USER_AGENT\r\n"); 2100 fputs($f, "Host: news.google.com\r\n"); 2101 fputs($f, "\r\n"); 2102 while (!feof($f)) 2103 $xml .= fgetc($f); 2104 fclose($f); 2105 var_dump($xml); exit; 2106 $xml = str_replace('<', "\n<", $xml); 2107 $xml = str_replace('>', ">\n", $xml); 2108 $xml = str_replace("\n\n", "\n", $xml); 2109 $xml = substr($xml, 1, -1); 2110 $line = explode("\n", $xml); 2111 for ($i = 1; $i < count($line); $i++) { 2112 if ($line[$i] == '<item>' && !$flag) 2113 $flag = true; 2114 if ($line[$i] == '</item>' && $flag) 2115 $flag = false; 2116 if ($flag) { 2117 if ($line[$i] == '<title>') { 2118 $j = count($news); 2119 $str = explode(' - ', html_entity_decode($line[$i + 1])); 2120 array_pop($str); 2121 $news[$j]['title'] = implode(' - ', $str); 2122 } 2123 else if ($line[$i] == '<link>') 2124 $news[$j]['link'] = $line[$i + 1]; 2125 else if ($line[$i] == '<pubDate>') { 2126 $news[$j]['date'] = $line[$i + 1]; 2127 $news[$j]['time'] = strtotime($news[$j]['date']); 2128 $news[$j]['date'] = date('l, F j, Y, H:i', $news[$j]['time']); 2129 } 2130 else if ($line[$i] == '<description>') { 2131 $str = explode('<font size=-1>', html_entity_decode($line[$i + 1])); 2132 $str_ = explode(' - ', strip_tags($str[1])); 2133 array_pop($str_); 2134 $news[$j]['source'] = implode(' - ', $str_); 2135 $news[$j]['text'] = trim(strip_tags($str[2])); 2136 if (substr($news[$j]['text'], -5) == '. ...') 2137 $news[$j]['text'] = substr($news[$j]['text'], 0, -4); 2138 } 2139 } 2140 } 2141 foreach($news as $k => $v) 2142 $index[$k] = $v['time']; 2143 arsort($index); 2144 foreach($index as $k => $v) { 2145 $html .= '<div class=news>'; 2146 $html .= '<div class=title><a href="' . $news[$k]['link'] . '">' . $news[$k]['title'] . '</a></div>'; 2147 // echo '<div class=source>' . $news[$k]['source'] . ' - ' . $news[$k]['date'] . '</div>'; 2148 $html .= '<div class=text>' . $news[$k]['text'] . '</div><br />'; 2149 $html .= '</div>'; 2150 } 2151 } 2152 */ 2153 2154 // un habitat news 2155 else if ($var['this_page']['name'] == 'un_habitat_news') { 2156 // $html .= create_space(); 2157 $html .= create_news(10); 2158 // $html .= create_space(); 2159 } 2160 2161 // addresses (user view) 2162 else if ($var['this_page']['name'] == 'database_addresses') { 2163 if (!$var['sort']) 2164 $var['sort'] = 'name'; 2165 $f = read_dir('data/addresses'); 2166 $html .= create_label(count($f) . ' ' . $var['label']['addresses'][$var['lang']], 'small'); 2167 $html .= create_space(); 2168 $html .= open_form(); 2169 $var['addresssort'] = $var['sort']; 2170 $html .= create_select('addresssort'); 2171 $html .= create_space(); 2172 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 2173 $html .= " <tr>\n"; 2174 $html .= " <td width=384 valign=top><span class=text_medium>\n"; 2175 get_context('addresses'); 2176 for ($i = 0; $i < count($f); $i++) { 2177 $filedata = read_file('data/addresses/' . $f[$i]['name'] . '.dat'); 2178 if ($var['sort'] == 'name') { 2179 $sort[$i] = replace_umlauts($filedata['organization_1'][$var['lang']]); 2180 $section[$i] = substr($filedata['organization_1'][$var['lang']], 0, 1); 2181 } 2182 else if ($var['sort'] == 'category') { 2183 $sort[$i] = replace_umlauts($var['category'][$filedata['category']]['title'][$var['lang']] . ' | ' . $filedata['organization_1'][$var['lang']]); 2184 $section[$i] = $var['category'][$filedata['category']]['title'][$var['lang']]; 2185 } 2186 else if ($var['sort'] == 'country') { 2187 $sort[$i] = replace_umlauts($filedata['country'][$var['lang']] . ' | ' . $filedata['state'][$var['lang']] . ' | ' . $filedata['city'][$var['lang']] . ' | ' . $filedata['organization_1'][$var['lang']]); 2188 $section[$i] = $filedata['country'][$var['lang']]; 2189 } 2190 } 2191 $last_section = ''; 2192 asort($sort); 2193 while (list($k, $v) = each($sort)) { 2194 if ($section[$k] != $last_section) { 2195 $html .= create_label($section[$k], 'small'); 2196 $html .= create_space(); 2197 $last_section = $section[$k]; 2198 } 2199 $html .= parse_address($f[$k]['name'], $var['lang']); 2200 /* 2201 $address = read_file('data/addresses/' . $f[$k]['name'] . '.dat'); 2202 $html .= '<b>' . $address['organization_1'][$var['lang']]; 2203 if ($address['organization_2'][$var['lang']]) 2204 $html .= ' - ' . $address['organization_2'][$var['lang']]; 2205 $html .= "</b><br>\n"; 2206 $html .= '<span class=text_small>' . $address['city'][$var['lang']]; 2207 if ($address['state'][$var['lang']]) 2208 $html .= ', ' . $address['state'][$var['lang']]; 2209 $html .= ' / ' . $address['country'][$var['lang']] . "</span></br>\n"; 2210 */ 2211 $html .= "<table border=0 cellpadding=0 cellspacing=0><tr><td height=3></td></tr></table>\n"; 2212 $html .= create_context($f[$k]['name']); 2213 $html .= "<br>\n"; 2214 } 2215 $html .= " </td>\n"; 2216 $html .= " </tr>\n"; 2217 $html .= "</table>\n"; 2218 $html .= "</form>\n"; 2219 } 2220 2221 // links (user view) 2222 else if ($var['this_page']['name'] == 'database_links') { 2223 if (!$var['sort']) 2224 $var['sort'] = 'name'; 2225 $f = read_dir('data/links'); 2226 $html .= create_label(count($f) . ' ' . $var['label']['links'][$var['lang']], 'small'); 2227 $html .= create_space(); 2228 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 2229 $html .= " <tr>\n"; 2230 $html .= " <td width=384 valign=top><span class=text_medium>\n"; 2231 get_context('links'); 2232 for ($i = 0; $i < count($f); $i++) { 2233 $filedata = read_file('data/links/' . $f[$i]['name'] . '.dat'); 2234 $sort[$i] = replace_umlauts($filedata['title'][$var['lang']]); 2235 $section[$i] = substr($filedata['title'][$var['lang']], 0, 1); 2236 } 2237 asort($sort); 2238 $last_section = ''; 2239 while (list($k, $v) = each($sort)) { 2240 if ($section[$k] != $last_section) { 2241 $html .= create_label($section[$k], 'small'); 2242 $html .= create_space(); 2243 $last_section = $section[$k]; 2244 } 2245 // $html .= parse_address($f[$k]['name']); 2246 2247 $link = read_file('data/links/' . $f[$k]['name'] . '.dat'); 2248 $html .= '<span class=text_large><b>' . $link['title'][$var['lang']] . "</b></span></br>\n"; 2249 if ($link['description'][$var['lang']]) 2250 $html .= $link['description'][$var['lang']] . "<br>\n"; 2251 $html .= '<a href=main.php?redirect=' . urlencode($link['url']) . ' class=text_link><span class=text_small>' . substr($link['url'], 0, 50) . str_repeat(' ...', strlen($link['url']) > 50) . '</span></a><br>'; 2252 $html .= "<table border=0 cellpadding=0 cellspacing=0><tr><td height=3></td></tr></table>\n"; 2253 $html .= create_context($f[$k]['name']); 2254 $html .= "<br>\n"; 2255 $i++; 2256 } 2257 $html .= " </td>\n"; 2258 $html .= " </tr>\n"; 2259 $html .= "</table>\n"; 2260 } 2261 2262 // documents (user view) 2263 else if ($var['this_page']['name'] == 'database_documents') { 2264 if (!$var['sort']) 2265 $var['sort'] = 'name'; 2266 $f = read_dir('data/documents'); 2267 $html .= create_label(count($f) . ' ' . $var['label']['documents'][$var['lang']], 'small'); 2268 $html .= create_space(); 2269 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 2270 $html .= " <tr>\n"; 2271 $html .= " <td width=384 valign=top><span class=text_medium>\n"; 2272 get_context('documents'); 2273 for ($i = 0; $i < count($f); $i++) 2274 $sort[$i] = strtolower($f[$i]['name']); 2275 asort($sort); 2276 while (list($k, $v) = each($sort)) { 2277 $context = create_context($f[$k]['name']); 2278 if (strstr($context, '<img')) { 2279 $html .= '<span class=text_medium><b>' . $f[$k]['name'] . "</b></span></br>\n"; 2280 $html .= '<span class=text_small><b><a href=http://www.bestpractices.at/data/documents/' . $f[$k]['name'] . ">Download</a></span></br>\n"; 2281 $html .= "<table border=0 cellpadding=0 cellspacing=0><tr><td height=3></td></tr></table>\n"; 2282 $html .= $context; 2283 $html .= "<br>\n"; 2284 } 2285 } 2286 $html .= " </td>\n"; 2287 $html .= " </tr>\n"; 2288 $html .= "</table>\n"; 2289 } 2290 2291 // website info 2292 else if ($var['this_page']['name'] == 'info') { 2293 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 2294 $html .= " <tr>\n"; 2295 $html .= " <td>\n"; 2296 $html .= " <span class=text>\n"; 2297 $html .= parse_text('data/system/info.' . $var['lang'] . '.txt', 'html'); 2298 $html .= " </span>\n"; 2299 $html .= " </td>\n"; 2300 $html .= " </tr>\n"; 2301 $html .= "</table>\n"; 2302 } 2303 2304 // source code 2305 else if ($var['this_page']['name'] == 'source_code') { 2306 $file = file('main.php'); 2307 $html .= create_label(strtolower($var['domain']) . '/main.php — ' . number_format(count($file)) . ' ' . $var['lines'][$var['lang']] . ' / ' . number_format(filesize('main.php')) . ' ' . $var['bytes'][$var['lang']] . ' — ' . $var['update'][$var['lang']] . ': ' . date('r', filemtime('main.php')), 'large'); 2308 $html .= create_space(); 2309 $html .= '<textarea wrap=off readonly class=textarea_mono>'; 2310 for ($i = 0; $i < count($file); $i++) { 2311 if (strstr($file[$i], '// ' . 'BEGIN HIDE')) { 2312 $j = $i + 1; 2313 while(!strstr($file[$j], '// ' . 'END HIDE')) { 2314 $j++; 2315 } 2316 $file[$j] = str_replace('// ' . 'END HIDE', '// ' . ($j - $i + 1) . ' LINES HIDDEN', $file[$j]); 2317 $i = $j; 2318 } 2319 $html .= str_repeat(' ', strlen(count($file)) - strlen($i + 1)) . ($i + 1) . ' ' . htmlspecialchars($file[$i]); 2320 } 2321 $html .= "</textarea>\n"; 2322 } 2323 2324 // bug database 2325 else if ($var['this_page']['name'] == 'bugs') { 2326 if ($var['alert']) { 2327 $html .= create_alert(); 2328 $html .= create_space(); 2329 } 2330 $html .= '<form name=form action=main.php?page=' . $var['page'] . '&lang=' . $var['lang']; 2331 if ($var['view']) 2332 $html .= '&view=' . $var['view']; 2333 if ($var['sort']) 2334 $html .= '&sort=' . $var['sort']; 2335 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 2336 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 2337 $html .= " method=post>\n"; 2338 $html .= "<input type=hidden name=form value=1>\n"; 2339 $html .= create_box('bugs'); 2340 $html .= create_space(); 2341 if (!$var['view']) 2342 $html .= create_submit(array('add')); 2343 else { 2344 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) { 2345 get_bugdata(); 2346 $html .= create_submit(array('add')); 2347 $html .= create_space(); 2348 $html .= create_label($var['label']['bug'][$var['lang']] . ' #' . $var['bugdata']['id'], 'large'); 2349 $html .= create_space(); 2350 $html .= create_input($var['label']['summary'][$var['lang']], 'summary', $var['bugdata']['name'], 'large'); 2351 $html .= create_space(); 2352 for ($i = 0; $i < 3; $i++) { 2353 $html .= create_input($var['bug']['parameter'][$i]['title'][$var['lang']], $var['bug']['parameter'][$i]['name'], $var['bugdata'][$var['bug']['parameter'][$i]['name']], 'large'); 2354 $html .= create_space(); 2355 } 2356 for ($i = 0; $i < $var['bugdata']['comments'] + 1; $i++) { 2357 $html .= create_input($var['label']['date_from_browser'][$var['lang']], 'date_from_browser', $var['bugdata']["date_$i"] . ' - ' . str_replace('@', ' at ', $var['bugdata']["from_$i"]) . ' - ' . $var['bugdata']["browser_$i"], 'large'); 2358 $html .= create_space(); 2359 if ($i == 0) 2360 $title = $var['label']['description'][$var['lang']]; 2361 else 2362 $title = $var['label']['comment'][$var['lang']] . " #$i"; 2363 $html .= create_input($title, 'description', $var['bugdata']["comment_$i"], 'large'); 2364 $html .= create_space(); 2365 } 2366 $html .= create_input($var['label']['your_name'][$var['lang']] . '*', 'name', $var['form_name'], 'large'); 2367 $html .= create_space(); 2368 $html .= create_input($var['label']['your_e-mail'][$var['lang']] . '*', 'e_mail', $var['form_e_mail'], 'large'); 2369 $html .= create_space(); 2370 if ($var['lang'] == 'de') 2371 $note = '*'; 2372 $html .= create_input($var['label']['comment'][$var['lang']] . ' #' . ($var['bugdata']['comments'] + 1) . $note, 'comment', $var['form_comment'], 'large'); 2373 $html .= create_space(); 2374 $html .= create_submit(array('cancel', 'save')); 2375 $html .= create_space(); 2376 $var['result'] = 'help'; 2377 $var['alert'] = $var['help']['bug'][$var['lang']]; 2378 $html .= create_alert(); 2379 } 2380 else { 2381 $html .= create_label($var['label']['new_bug'][$var['lang']], 'large'); 2382 $html .= create_space(); 2383 $html .= create_input($var['label']['your_name'][$var['lang']] . '*', 'name', $var['form_name'], 'large'); 2384 $html .= create_space(); 2385 $html .= create_input($var['label']['your_e-mail'][$var['lang']] . '*', 'e_mail', $var['form_e_mail'], 'large'); 2386 $html .= create_space(); 2387 for ($i = 0; $i < count($var['bug']['parameter']); $i++) { 2388 if ($i < 2) 2389 $values = $var['bug'][$var['bug']['parameter'][$i]['name']]; 2390 else 2391 $values = array(0 => array('name' => $var['bug'][$var['bug']['parameter'][2]['name']][0]['name'], 'title' => $var['bug'][$var['bug']['parameter'][2]['name']][0]['title'])); 2392 $value = $var['form_' . $var['bug']['parameter'][$i]['name']]; 2393 $html .= create_option($var['bug']['parameter'][$i]['title'][$var['lang']], $var['bug']['parameter'][$i]['name'], $values, $value, 'large'); 2394 $html .= create_space(); 2395 } 2396 if ($var['lang'] == 'de') 2397 $note = '*'; 2398 $html .= create_input($var['label']['summary'][$var['lang']] . $note, 'summary', $var['form_summary'], 'large'); 2399 $html .= create_space(); 2400 $html .= create_input($var['label']['description'][$var['lang']] . $note, 'description', $var['form_description'], 'large'); 2401 $html .= create_space(); 2402 $html .= create_submit(array('cancel', 'save')); 2403 $html .= create_space(); 2404 $var['result'] = 'help'; 2405 $var['alert'] = $var['help']['bug'][$var['lang']]; 2406 $html .= create_alert(); 2407 } 2408 } 2409 $html .= "</form>\n"; 2410 } 2411 2412 // search 2413 else if ($var['this_page']['name'] == 'search') { 2414 if (!$var['view']) 2415 $var['view'] = 'website'; 2416 if (!$var['sort'] || $var['view'] == 'internet') 2417 $var['sort'] = 'relevance'; 2418 $html .= open_form(); 2419 $var['search'] = $var['view']; 2420 $html .= create_select('search'); 2421 $html .= create_space(); 2422 if ($var['view'] != 'internet') { 2423 $var['searchsort'] = $var['sort']; 2424 $html .= create_select('searchsort'); 2425 $html .= create_space(); 2426 } 2427 $html .= create_input($var['label']['search'][$var['lang']], 'query', $var['form_query'], 'small'); 2428 $html .= create_space(); 2429 $html .= create_submit(array('cancel', 'help', 'search')); 2430 $html .= "</form>\n"; 2431 if ($var['form_query']) { 2432 if ($var['results']['times']) { 2433 if ($var['preference']['links_window'] == 'new') 2434 $target = ' target=_blank'; 2435 if ($var['view'] == 'website') { 2436 $title .= $var['label']['search_results'][$var['lang']] . ': ' . $var['results']['query'] . ' ' . $var['found'][$var['lang']] . ' '; 2437 if ($var['results']['times']['total'] == 1 || $var['results']['times']['total'] == 2) 2438 $title .= $var['times'][$var['results']['times']['total']][$var['lang']]; 2439 else 2440 $title .= $var['results']['times']['total'] . ' ' . $var['times']['x'][$var['lang']]; 2441 $title .= ' ' . $var['in'][$var['lang']] . ' '; 2442 if ($var['results']['paragraphs']['total'] == 1) 2443 $title .= $var['paragraphs']['1'][$var['lang']]; 2444 else 2445 $title .= $var['results']['paragraphs']['total'] . ' ' . $var['paragraphs']['x'][$var['lang']]; 2446 $title .= ' ' . $var['on'][$var['lang']] . ' '; 2447 if ($var['results']['pages']['total'] == 1) 2448 $title .= $var['pages']['1'][$var['lang']]; 2449 else 2450 $title .= $var['results']['pages']['total'] . ' ' . $var['pages']['x'][$var['lang']]; 2451 $html .= create_label($title, 'large'); 2452 } 2453 else { 2454 $title = $var['label']['search_results'][$var['lang']] . ' (' . $var['results']['times']['total'] . ')'; 2455 $html .= create_label($title, 'small'); 2456 } 2457 $html .= create_space(); 2458 if ($var['view'] == 'website') 2459 $width = 768; 2460 else if ($var['view'] == 'internet') 2461 $width = 384; 2462 else if ($var['view'] == 'news') 2463 $width = 384; 2464 $html .= "<table width=$width border=0 cellpadding=0 cellspacing=0>\n"; 2465 $count = 0; 2466 $sort = str_replace('date', 'time', $var['sort']); 2467 arsort($var['results'][$sort]); 2468 while (list($k_page, $v_page) = each($var['results'][$sort])) { 2469 if ($count > 0) { 2470 $html .= " <tr>\n"; 2471 $html .= " <td width=$width height=18></td>\n"; 2472 $html .= " </tr>\n"; 2473 } 2474 $html .= " <tr>\n"; 2475 $html .= " <td>\n"; 2476 $html .= " <table border=0 cellpadding=0 cellspacing=0>\n"; 2477 $html .= " <tr>\n"; 2478 if ($var['view'] == 'website') { 2479 if (strstr($var['results']['url'][$k_page], '.')) { 2480 $lang = substr($var['results']['url'][$k_page], -2); 2481 $data = explode('.', substr($var['results']['url'][$k_page], 0, -3)); 2482 for ($i = 0; $i < $var['menu']['count']; $i++) { 2483 for ($j = 0; $j < $var['menu'][$i]['count']; $j++) { 2484 if (count($data) == 2 && $var['menu'][$i]['name'] == $data[0] && $var['menu'][$i][$j]['name'] == $data[1]) { 2485 $color = $var['menu'][$i]['color']; 2486 $html .= ' <td width=27 height=18><a href=main.php?page=' . str_replace('.', '/', substr($var['results']['url'][$k_page], 0, -3)) . '&lang=' . substr($var['results']['url'][$k_page], -2); 2487 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 2488 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 2489 $html .= '><img src=images/' . $var['themedir'] . "/icon.page.$color." . $var['themetype'] . ' width=18 height=18 border=0></a><img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . " width=9 height=18></td>\n"; 2490 $html .= ' <td width=6 height=18 background=images/' . $var['themedir'] . "/sitemap.$color.left." . $var['themetype'] . "></td>\n"; 2491 $html .= ' <td height=18 valign=middle background=images/' . $var['themedir'] . "/sitemap.$color.center." . $var['themetype'] . '><a href=main.php?page=' . str_replace('.', '/', substr($var['results']['url'][$k_page], 0, -3)) . '&lang=' . substr($var['results']['url'][$k_page], -2); 2492 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 2493 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 2494 $html .= ' class=sitemap_public style=color:#' . $var['color']['sitemap'][$color] . '>' . menutoline($var['menu'][$i][$j]['title'][$lang]) . "</a></td>\n"; 2495 $html .= ' <td width=6 height=18 background=images/' . $var['themedir'] . "/sitemap.$color.right." . $var['themetype'] . "></td>\n"; 2496 } 2497 else { 2498 for ($k = 0; $k < $var['menu'][$i][$j]['count']; $k++) { 2499 if (count($data) == 3 && $var['menu'][$i]['name'] == $data[0] && $var['menu'][$i][$j]['name'] == $data[1] && $var['menu'][$i][$j][$k]['name'] == $data[2]) { 2500 $color = $var['menu'][$i][$j][$k]['color']; 2501 $html .= ' <td width=27 height=18><a href=main.php?page=' . str_replace('.', '/', substr($var['results']['url'][$k_page], 0, -3)) . '&lang=' . substr($var['results']['url'][$k_page], -2); 2502 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 2503 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 2504 $html .= '><img src=images/' . $var['themedir'] . "/icon.page.$color." . $var['themetype'] . ' width=18 height=18 border=0></a><img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . " width=9 height=18></td>\n"; 2505 $html .= ' <td width=6 height=18 background=images/' . $var['themedir'] . "/sitemap.$color.left." . $var['themetype'] . "></td>\n"; 2506 $html .= ' <td height=18 valign=middle background=images/' . $var['themedir'] . "/sitemap.$color.center." . $var['themetype'] . '><a href=main.php?page=' . str_replace('.', '/', substr($var['results']['url'][$k_page], 0, -3)) . '&lang=' . substr($var['results']['url'][$k_page], -2); 2507 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 2508 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 2509 $html .= ' class=sitemap_public style=color:#' . $var['color']['sitemap'][$color] . '>' . menutoline($var['menu'][$i][$j][$k]['title'][$lang]) . "</a></td>\n"; 2510 $html .= ' <td width=6 height=18 background=images/' . $var['themedir'] . "/sitemap.$color.right." . $var['themetype'] . "></td>\n"; 2511 } 2512 else { 2513 for ($l = 0; $l < $var['menu'][$i][$j][$k]['count']; $l++) { 2514 if ($var['menu'][$i]['name'] == $data[0] && $var['menu'][$i][$j]['name'] == $data[1] && $var['menu'][$i][$j][$k]['name'] == $data[2] && $var['menu'][$i][$j][$k][$l]['name'] == $data[3]) { 2515 $color = $var['menu'][$i][$j][$k]['color']; 2516 $html .= ' <td width=27 height=18><a href=main.php?page=' . str_replace('.', '/', substr($var['results']['url'][$k_page], 0, -3)) . '&lang=' . substr($var['results']['url'][$k_page], -2); 2517 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 2518 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 2519 $html .= '><img src=images/' . $var['themedir'] . "/icon.page.$color." . $var['themetype'] . ' width=18 height=18 border=0></a><img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . " width=9 height=18></td>\n"; 2520 $html .= ' <td width=6 height=18 background=images/' . $var['themedir'] . "/sitemap.$color.left." . $var['themetype'] . "></td>\n"; 2521 $html .= ' <td height=18 valign=middle background=images/' . $var['themedir'] . "/sitemap.$color.center." . $var['themetype'] . "><a href=main.php?page=" . str_replace('.', '/', substr($var['results']['url'][$k_page], 0, -3)) . '&lang=' . substr($var['results']['url'][$k_page], -2); 2522 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 2523 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 2524 $html .= ' class=sitemap_public style=color:#' . $var['color']['sitemap'][$color] . '>' . menutoline($var['menu'][$i][$j][$k][$l]['title'][$lang]) . "</a></td>\n"; 2525 $html .= ' <td width=6 height=18 background=images/' . $var['themedir'] . "/sitemap.$color.right." . $var['themetype'] . "></td>\n"; 2526 } 2527 } 2528 } 2529 } 2530 } 2531 } 2532 } 2533 } 2534 else { 2535 if (file_exists('data/newsletter/messages/sent/' . $var['results']['url'][$k_page] . '.dat')) { 2536 $page = 'publications/mailing_list/archive'; 2537 $filedata = read_file('data/newsletter/messages/sent/' . $var['results']['url'][$k_page] . '.dat'); 2538 } 2539 else { 2540 $page = 'admin/newsletter/messages/unsent'; 2541 $filedata = read_file('data/newsletter/messages/unsent/' . $var['results']['url'][$k_page] . '.dat'); 2542 } 2543 $lang = $var['lang']; 2544 $color = 'gray'; 2545 $html .= " <td width=27 height=18><a href=main.php?page=$page&lang=$lang&view=" . $var['results']['url'][$k_page]; 2546 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 2547 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 2548 $html .= '><img src=images/' . $var['themedir'] . "/icon.message.$color." . $var['themetype'] . ' width=18 height=18 border=0></a><img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . " width=9 height=18></td>\n"; 2549 $html .= ' <td width=6 height=18 background=images/' . $var['themedir'] . "/sitemap.$color.left." . $var['themetype'] . "></td>\n"; 2550 $html .= ' <td height=18 valign=middle background=images/' . $var['themedir'] . "/sitemap.$color.center." . $var['themetype'] . "><a href=main.php?page=$page&lang=$lang&view=" . $var['results']['url'][$k_page]; 2551 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 2552 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 2553 $html .= " class=sitemap_public style=color:$color>" . $filedata['subject'] . "</a></td>\n"; 2554 $html .= ' <td width=6 height=18 background=images/' . $var['themedir'] . "/sitemap.$color.right." . $var['themetype'] . "></td>\n"; 2555 } 2556 $html .= " <td width=9 height=18></td>\n"; 2557 $html .= ' <td height=18><span class=text_small>' . $var['results']['query'] . ' ' . $var['found'][$var['lang']] . ' '; 2558 if ($var['results']['times'][$k_page] == 1 || $var['results']['times'][$k_page] == 2) 2559 $html .= $var['times'][$var['results']['times'][$k_page]][$var['lang']]; 2560 else 2561 $html .= $var['results']['times'][$k_page] . ' ' . $var['times']['x'][$var['lang']]; 2562 $html .= ' ' . $var['in'][$var['lang']] . ' '; 2563 if ($var['results']['paragraphs'][$k_page] == 1) 2564 $html .= $var['paragraphs']['1'][$var['lang']]; 2565 else 2566 $html .= $var['results']['paragraphs'][$k_page] . ' ' . $var['paragraphs']['x'][$var['lang']]; 2567 $html .= "</span></td>\n"; 2568 } 2569 else { 2570 if ($var['view'] == 'internet') 2571 $color = 'blue'; 2572 else if ($var['view'] == 'news') 2573 $color = 'red'; 2574 $html .= ' <td width=27 height=18><a href=main.php?redirect=' . urlencode($var['results']['url'][$k_page]) . "$target><img src=images/" . $var['themedir'] . "/icon.page.$color." . $var['themetype'] . ' width=18 height=18 border=0></a><img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . " width=9 height=18></td>\n"; 2575 $html .= ' <td width=6 height=18 background=images/' . $var['themedir'] . "/sitemap.$color.left." . $var['themetype'] . "></td>\n"; 2576 $html .= ' <td height=18 valign=middle background=images/' . $var['themedir'] . "/sitemap.$color.center." . $var['themetype'] . '><a href=main.php?redirect=' . urlencode($var['results']['url'][$k_page]) . "$target class=sitemap_public style=color:#" . $var['color']['sitemap'][$color] . '>' . $var['results']['title'][$k_page] . "</a></td>\n"; 2577 $html .= ' <td width=6 height=18 background=images/' . $var['themedir'] . "/sitemap.$color.right." . $var['themetype'] . "></td>\n"; 2578 } 2579 $html .= " </tr>\n"; 2580 $html .= " </table>\n"; 2581 $html .= " </td>\n"; 2582 $html .= " </tr>\n"; 2583 $html .= " <tr>\n"; 2584 $html .= " <td>\n"; 2585 $html .= " <table border=0 cellpadding=0 cellspacing=0>\n"; 2586 while (list($k_paragraph, $v_paragraph) = each($var['results']['result'][$k_page])) { 2587 if ($v_paragraph) { 2588 $html .= " <tr>\n"; 2589 $html .= " <td width=27 valign=top class=text_small>⇒</td>\n"; 2590 $html .= ' <td><div class=text_small style=text-align:justify>' . str_replace('<span>', '<span style=color:#ffffff;background-color:#' . $var['color']['sitemap'][$color] . '>', $v_paragraph) . "</div></td>\n"; 2591 $html .= " </tr>\n"; 2592 } 2593 } 2594 $html .= " </table>\n"; 2595 $html .= " </td>\n"; 2596 $html .= " </tr>\n"; 2597 $html .= " <tr>\n"; 2598 if ($var['view'] == 'website') { 2599 if (strstr($var['results']['url'][$k_page], '.')) { 2600 $html .= ' <td><a href=main.php?page=' . str_replace('.', '/', substr($var['results']['url'][$k_page], 0, -3)) . '&lang=' . substr($var['results']['url'][$k_page], -2); 2601 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 2602 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 2603 $html .= ' class=text_small style=font-weight:bold;color:#' . $var['color']['sitemap'][$color] . '>http://' . strtolower($var['domain']) . '/main.php?page=' . str_replace('.', '/', substr($var['results']['url'][$k_page], 0, -3)) . '&lang=' . substr($var['results']['url'][$k_page], -2) . '</a><span class=text_xsmall style=color:#808080> - ' . $var['results']['date'][$k_page] . "</span></td>\n"; 2604 } 2605 else { 2606 $html .= " <td><a href=main.php?page=$page&lang=$lang&view=" . $var['results']['url'][$k_page]; 2607 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 2608 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 2609 $html .= ' class=text_small style=font-weight:bold;color:#' . $var['color']['sitemap'][$color] . '>http://' . strtolower($var['domain']) . "main.php?page=$page&lang=$lang&view=" . $var['results']['url'][$k_page] . '</a><span class=text_xsmall style=color:#808080> - ' . $var['results']['date'][$k_page] . "</span></td>\n"; 2610 } 2611 } 2612 else if ($var['view'] == 'internet') { 2613 $url = $var['results']['url'][$k_page]; 2614 if (strlen($url) > 60) 2615 $url = substr($url, 0, 60) . ' ...'; 2616 $html .= ' <td><a href=main.php?redirect=' . urlencode($var['results']['url'][$k_page]) . "$target class=text_small style=font-weight:bold;color:#" . $var['color']['sitemap'][$color] . ">$url</a></td>\n"; 2617 } 2618 else if ($var['view'] == 'news') 2619 $html .= " <td><a href=main.php?redirect=" . urlencode($var['results']['url'][$k_page]) . "$target class=text_small style=font-weight:bold;color:#" . $var['color']['sitemap'][$color] . '>' . $var['results']['source'][$k_page] . '</a><span class=text_xsmall style=color:#808080> - ' . $var['results']['date'][$k_page] . "</span></td>\n"; 2620 $html .= " </tr>\n"; 2621 $count++; 2622 } 2623 $html .= "</table>\n"; 2624 } 2625 else { 2626 if ($var['view'] == 'website') 2627 $html .= create_label($var['label']['search_results'][$var['lang']] . ': ' . $var['results']['query'] . ' ' . $var['not_found'][$var['lang']], 'large'); 2628 else 2629 $html .= create_label($var['label']['search_results'][$var['lang']] . ': ' . $var['results']['query'] . ' (0)', 'small'); 2630 $html .= create_space(); 2631 } 2632 } 2633 } 2634 2635 // sitemap 2636 else if ($var['this_page']['name'] == 'sitemap') { 2637 $html .= create_label($var['label']['sitemap'][$var['lang']], 'small'); 2638 $html .= create_space(); 2639 $html .= "<table width=384 border=0 cellpadding=0 cellspacing=0>\n"; 2640 $html .= " <span class=text>\n"; 2641 if ($var['mode'] != 'admin') 2642 $n = $var['menu']['count'] - 1; 2643 else 2644 $n = $var['menu']['count']; 2645 for ($i = 0; $i < $n; $i++) { 2646 $html .= " <tr>\n"; 2647 $html .= " <td width=384 height=18>\n"; 2648 $html .= " <table height=18 border=0 cellpadding=0 cellspacing=0>\n"; 2649 $html .= " <tr>\n"; 2650 $html .= " <td width=27 height=18 align=right>"; 2651 if (!$var['mode'] != 'admin') 2652 $html .= '<img src=images/' . $var['themedir'] . '/icon.directory.' . $var['menu'][$i]['color'] . '.' . $var['themetype'] . ' width=18 height=18>'; 2653 else 2654 $html .= '<a href=main.php?page=' . $var['menu'][$i]['name'] . '&lang=' . $var['lang'] . '&mode=admin&ssid=' . $var['ssid'] . '><img src=images/' . $var['themedir'] . '/icon.directory.' . $var['menu'][$i]['color'] . '.' . $var['themetype'] . ' width=18 height=18 border=0></a>'; 2655 $html .= '<img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . " width=9 height=18></td>\n"; 2656 $html .= ' <td width=6 height=18 valign=middle background=images/' . $var['themedir'] . '/sitemap.' . $var['menu'][$i]['color'] . '.left.' . $var['themetype'] . "></td>\n"; 2657 $html .= ' <td height=18 valign=middle background=images/' . $var['themedir'] . '/sitemap.' . $var['menu'][$i]['color'] . '.center.' . $var['themetype'] . '>'; 2658 if ($var['mode'] != 'admin') 2659 $html .= '<span class=sitemap_' . $var['menu'][$i]['status'] . ' style=color:#' . $var['color']['sitemap'][$var['menu'][$i]['color']] . '>' . menutoline($var['menu'][$i]['title'][$var['lang']]) . '</span>'; 2660 else 2661 $html .= '<a href=main.php?page=' . $var['menu'][$i]['name'] . '&lang=' . $var['lang'] . '&mode=admin&ssid=' . $var['ssid'] . ' class=sitemap_' . $var['menu'][$i]['status'] . ' style=color:#' . $var['color']['sitemap'][$var['menu'][$i]['color']] . '>' . menutoline($var['menu'][$i]['title'][$var['lang']]) . '</a>'; 2662 $html .= "</td>\n"; 2663 $html .= ' <td width=6 height=18 valign=middle background=images/' . $var['themedir'] . '/sitemap.' . $var['menu'][$i]['color'] . '.right.' . $var['themetype'] . "></td>\n"; 2664 $html .= " </tr>\n"; 2665 $html .= " <tr>\n"; 2666 $html .= " <td height=18 colspan=4></td>\n"; 2667 $html .= " </tr>\n"; 2668 $html .= " </table>\n"; 2669 $html .= " </td>\n"; 2670 $html .= " </tr>\n"; 2671 for ($j = 0; $j < $var['menu'][$i]['count']; $j++) { 2672 $html .= " <tr>\n"; 2673 $html .= " <td width=384 height=18>\n"; 2674 $html .= " <table height=18 border=0 cellpadding=0 cellspacing=0>\n"; 2675 $html .= " <tr>\n"; 2676 $html .= " <td width=63 height=18 align=right>"; 2677 if ($var['menu'][$i][$j]['count'] && $var['mode'] != 'admin') 2678 $html .= '<img src=images/' . $var['themedir'] . '/icon.directory.' . $var['menu'][$i]['color'] . '.' . $var['themetype'] . ' width=18 height=18>'; 2679 else { 2680 $html .= '<a href=main.php?page=' . $var['menu'][$i]['name'] . '/' . $var['menu'][$i][$j]['name'] . '&lang=' . $var['lang']; 2681 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 2682 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 2683 $html .= '><img src=images/' . $var['themedir'] . '/icon.'; 2684 if ($var['menu'][$i][$j]['count']) 2685 $html .= 'directory'; 2686 else 2687 $html .= 'page'; 2688 $html .= '.' . $var['menu'][$i]['color'] . '.' . $var['themetype'] . ' width=18 height=18 border=0></a>'; 2689 } 2690 $html .= '<img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . " width=9 height=18></td>\n"; 2691 $html .= ' <td width=6 height=18 valign=middle background=images/' . $var['themedir'] . '/sitemap.' . $var["menu"][$i]['color'] . '.left.' . $var['themetype'] . "></td>\n"; 2692 $html .= ' <td height=18 valign=middle background=images/' . $var['themedir'] . '/sitemap.' . $var['menu'][$i]['color'] . '.center.' . $var['themetype'] . '>'; 2693 if ($var['menu'][$i][$j]['count'] && !$var['mode']) 2694 $html .= '<span class=sitemap_' . $var['menu'][$i][$j]['status'] . ' style=color:#' . $var['color']['sitemap'][$var['menu'][$i]['color']] . '>' . menutoline($var['menu'][$i][$j]['title'][$var['lang']]) . '</span>'; 2695 else { 2696 $html .= '<a href=main.php?page=' . $var['menu'][$i]['name'] . '/' . $var['menu'][$i][$j]['name'] . '&lang=' . $var['lang']; 2697 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 2698 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 2699 $html .= ' class=sitemap_' . $var['menu'][$i][$j]['status'] . ' style=color:#' . $var['color']['sitemap'][$var['menu'][$i]['color']] . '>' . menutoline($var['menu'][$i][$j]['title'][$var['lang']]) . '</a>'; 2700 } 2701 $html .= "</td>\n"; 2702 $html .= ' <td width=6 height=18 valign=middle background=images/' . $var['themedir'] . '/sitemap.' . $var['menu'][$i]['color'] . '.right.' . $var['themetype'] . "></td>\n"; 2703 $html .= " </tr>\n"; 2704 $html .= " <tr>\n"; 2705 $html .= " <td height=18 colspan=4></td>\n"; 2706 $html .= " </tr>\n"; 2707 $html .= " </table>\n"; 2708 $html .= " </td>\n"; 2709 $html .= " </tr>\n"; 2710 for ($k = 0; $k < $var['menu'][$i][$j]['count']; $k++) { 2711 $html .= " <tr>\n"; 2712 $html .= " <td width=384 height=18>\n"; 2713 $html .= " <table height=18 border=0 cellpadding=0 cellspacing=0>\n"; 2714 $html .= " <tr>\n"; 2715 $html .= ' <td width=99 height=18 align=right>'; 2716 if ($var['menu'][$i][$j][$k]['count'] && !$var['mode']) 2717 $html .= '<img src=images/' . $var['themedir'] . '/icon.directory.' . $var['menu'][$i][$j][$k]['color'] . '.' . $var['themetype'] . ' width=18 height=18>'; 2718 else { 2719 $html .= '<a href=main.php?page=' . $var['menu'][$i]['name'] . '/' . $var['menu'][$i][$j]['name'] . '/' . $var['menu'][$i][$j][$k]['name'] . '&lang=' . $var['lang']; 2720 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 2721 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 2722 $html .= '><img src=images/' . $var['themedir'] . '/icon.'; 2723 if ($var['menu'][$i][$j][$k]['count']) 2724 $html .= 'directory'; 2725 else 2726 $html .= 'page'; 2727 $html .= '.' . $var['menu'][$i][$j][$k]['color'] . '.' . $var['themetype'] . ' width=18 height=18 border=0></a>'; 2728 } 2729 $html .= '<img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . " width=9 height=18></td>\n"; 2730 $html .= ' <td width=6 height=18 valign=middle background=images/' . $var['themedir'] . '/sitemap.' . $var['menu'][$i][$j][$k]['color'] . '.left.' . $var['themetype'] . "></td>\n"; 2731 $html .= ' <td height=18 valign=middle background=images/' . $var['themedir'] . '/sitemap.' . $var['menu'][$i][$j][$k]['color'] . '.center.' . $var['themetype'] . '>'; 2732 if ($var['menu'][$i][$j][$k]['count'] && !$var['mode']) 2733 $html .= '<span class=sitemap_' . $var['menu'][$i][$j][$k]['status'] . ' style=color:#' . $var['color']['sitemap'][$var['menu'][$i][$j][$k]['color']] . '>' . menutoline($var['menu'][$i][$j][$k]['title'][$var['lang']]) . '</span>'; 2734 else { 2735 $html .= '<a href=main.php?page=' . $var['menu'][$i]['name'] . '/' . $var['menu'][$i][$j]['name'] . '/' . $var['menu'][$i][$j][$k]['name'] . '&lang=' . $var['lang']; 2736 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 2737 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 2738 $html .= ' class=sitemap_' . $var['menu'][$i][$j][$k]['status'] . ' style=color:#' . $var['color']['sitemap'][$var['menu'][$i][$j][$k]['color']] . '>' . menutoline($var['menu'][$i][$j][$k]['title'][$var['lang']]) . '</a>'; 2739 } 2740 $html .= "</td>\n"; 2741 $html .= ' <td width=6 height=18 valign=middle background=images/' . $var['themedir'] . '/sitemap.' . $var['menu'][$i][$j][$k]['color'] . '.right.' . $var['themetype'] . "></td>\n"; 2742 $html .= " </tr>\n"; 2743 $html .= " <tr>\n"; 2744 $html .= " <td height=18 colspan=4></td>\n"; 2745 $html .= " </tr>\n"; 2746 $html .= " </table>\n"; 2747 $html .= " </td>\n"; 2748 $html .= " </tr>\n"; 2749 for ($l = 0; $l < $var['menu'][$i][$j][$k]['count']; $l++) { 2750 $html .= " <tr>\n"; 2751 $html .= " <td width=384 height=18>\n"; 2752 $html .= " <table height=18 border=0 cellpadding=0 cellspacing=0>\n"; 2753 $html .= " <tr>\n"; 2754 $html .= ' <td width=135 height=18 align=right><a href=main.php?page=' . $var['menu'][$i]['name'] . '/' . $var['menu'][$i][$j]['name'] . '/' . $var['menu'][$i][$j][$k]['name'] . '/' . $var['menu'][$i][$j][$k][$l]['name'] . '&lang=' . $var['lang']; 2755 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 2756 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 2757 $html .= '><img src=images/' . $var['themedir'] . '/icon.page.' . $var['menu'][$i][$j][$k]['color'] . '.' . $var['themetype'] . ' width=18 height=18 border=0></a><img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . " width=9 height=18></td>\n"; 2758 $html .= ' <td width=6 height=18 valign=middle background=images/' . $var['themedir'] . '/sitemap.' . $var['menu'][$i][$j][$k]['color'] . '.left.' . $var['themetype'] . "></td>\n"; 2759 $html .= ' <td height=18 valign=middle background=images/' . $var['themedir'] . '/sitemap.' . $var['menu'][$i][$j][$k]['color'] . '.center.' . $var['themetype'] . '><a href=main.php?page=' . $var['menu'][$i]['name'] . '/' . $var['menu'][$i][$j]['name'] . '/' . $var['menu'][$i][$j][$k]['name'] . '/' . $var['menu'][$i][$j][$k][$l]['name'] . '&lang=' . $var['lang']; 2760 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 2761 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 2762 $html .= ' class=sitemap_' . $var['menu'][$i][$j][$k][$l]['status'] . ' style=color:#' . $var['color']['sitemap'][$var['menu'][$i][$j][$k]['color']] . '>' . menutoline($var['menu'][$i][$j][$k][$l]['title'][$var['lang']]) . "</a></td>\n"; 2763 $html .= ' <td width=6 height=18 valign=middle background=images/' . $var['themedir'] . '/sitemap.' . $var['menu'][$i][$j][$k]['color'] . '.right.' . $var['themetype'] . "></td>\n"; 2764 $html .= " </tr>\n"; 2765 $html .= " <tr>\n"; 2766 $html .= " <td height=18 colspan=4></td>\n"; 2767 $html .= " </tr>\n"; 2768 $html .= " </table>\n"; 2769 $html .= " </td>\n"; 2770 $html .= " </tr>\n"; 2771 } 2772 } 2773 } 2774 } 2775 $html .= " </span>\n"; 2776 $html .= " </td>\n"; 2777 $html .= " </tr>\n"; 2778 $html .= "</table>\n"; 2779 } 2780 2781 // admin login 2782 else if ($var['this_page']['name'] == 'login') { 2783 if ($var['view'] != 'password') 2784 $var['view'] = ''; 2785 $html .= open_form(); 2786 if ($var['view'] != 'password') { 2787 $html .= create_input($var['label']['username'][$var['lang']], 'username', $var['form_username'], 'small'); 2788 $html .= create_space(); 2789 $html .= create_input($var['label']['password'][$var['lang']], 'password', '', 'small'); 2790 $html .= create_space(); 2791 $html .= create_submit(array('cancel', 'password', 'login')); 2792 } 2793 else { 2794 $html .= create_input($var['label']['username_or_e-mail'][$var['lang']], 'username_or_e_mail', '', 'small'); 2795 $html .= create_space(); 2796 $html .= create_submit(array('cancel', 'send')); 2797 } 2798 $html .= "</form>\n"; 2799 } 2800 2801 // admin accounts 2802 else if ($var['this_page']['name'] == 'accounts') { 2803 $html .= open_form(); 2804 $html .= create_box('accounts'); 2805 $html .= create_space(); 2806 if (!$var['view']) 2807 $submit = array('add'); 2808 else if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) 2809 $submit = array('add', 'delete'); 2810 if ($submit) { 2811 $html .= create_submit($submit); 2812 $html .= create_space(); 2813 } 2814 if ($var['view']) { 2815 $html .= create_label($var['label']['account'][$var['lang']], 'small'); 2816 $html .= create_space(); 2817 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) { 2818 $filedata = read_file('data/accounts/' . $var['admin_file'][$var['view']] . '.dat'); 2819 $value_username = $filedata['username']; 2820 $value_password = decrypt($filedata['password']); 2821 $value_repeat = decrypt($filedata['password']); 2822 $value_e_mail = $filedata['e-mail']; 2823 } 2824 else { 2825 $value_username = $var['form_username']; 2826 $value_password = $var['form_password']; 2827 $value_repeat = $var['form_repeat']; 2828 $value_e_mail = $var['form_e_mail']; 2829 } 2830 $html .= create_input($var['label']['username'][$var['lang']], 'username', $value_username, 'small'); 2831 $html .= create_space(); 2832 $html .= create_input($var['label']['password'][$var['lang']], 'password', $value_password, 'small'); 2833 $html .= create_space(); 2834 $html .= create_input($var['label']['repeat'][$var['lang']], 'repeat', $value_repeat, 'small'); 2835 $html .= create_space(); 2836 $html .= create_input($var['label']['e-mail'][$var['lang']], 'e_mail', $value_e_mail, 'small'); 2837 $html .= create_space(); 2838 $html .= create_submit(array('cancel', 'save')); 2839 } 2840 $html .= "</form>\n"; 2841 } 2842 2843 // admin mainling list 2844 else if ($var['this_page']['name'] == 'mailing_list') { 2845 $html .= open_form(); 2846 $html .= create_input($var['label']['subject'][$var['lang']], 'subject', '', 'small'); 2847 $html .= create_space(); 2848 $html .= create_input($var['label']['message'][$var['lang']], 'message', '', 'small'); 2849 $html .= create_space(); 2850 $html .= create_submit(array('cancel', 'send')); 2851 $html .= "</form>\n"; 2852 } 2853 2854 // general settings 2855 else if ($var['this_page']['name'] == 'general_settings') { 2856 $html .= open_form(); 2857 $i = 0; 2858 reset($var['preference']); 2859 while (list($k, $v) = each($var['preference'])) { 2860 if ($i > 0) 2861 $html .= create_space(); 2862 if ($k == 'default_language') { 2863 $html .= create_label($var['label']['pages'][$var['lang']], 'large'); 2864 $html .= create_space(); 2865 } 2866 else if ($k == 'admin_header') { 2867 $html .= create_label($var['label']['editor'][$var['lang']], 'large'); 2868 $html .= create_space(); 2869 } 2870 else if ($k == 'importexport_delimiter') { 2871 $html .= create_label($var['label']['importexport'][$var['lang']], 'large'); 2872 $html .= create_space(); 2873 } 2874 else if ($k == 'session_time') { 2875 $html .= create_label($var['label']['time'][$var['lang']], 'large'); 2876 $html .= create_space(); 2877 } 2878 $html .= create_label($var['label'][$k][$var['lang']], 'small'); 2879 $html .= create_space(); 2880 $var[$k] = $var['preference'][$k]; 2881 $html .= create_select($k); 2882 $i++; 2883 } 2884 $html .= "</form>\n"; 2885 } 2886 2887 // user tags 2888 else if ($var['this_page']['name'] == 'user_tags') { 2889 $html .= open_form(); 2890 $html .= create_box('tags'); 2891 $html .= create_space(); 2892 $html .= create_submit(array('add', 'delete')); 2893 if ($var['view']) { 2894 $filedata = read_file('data/system/tags.dat'); 2895 $html .= create_space(); 2896 $html .= create_label($var['label']['tag'][$var['lang']], 'small'); 2897 $html .= create_space(); 2898 $html .= create_input($var['label']['name'][$var['lang']], 'name', $var['view'], 'small'); 2899 $html .= create_space(); 2900 $html .= create_input($var['label']['alias'][$var['lang']], 'alias', $filedata[$var['view']]['alias'], 'small'); 2901 $html .= create_space(); 2902 $html .= create_input($var['label']['html'][$var['lang']], 'html', $filedata[$var['view']]['html'], 'small'); 2903 $html .= create_space(); 2904 $html .= create_input($var['label']['help'][$var['lang']] . '*', 'help', $filedata[$var['view']]['help'][$var['lang']], 'small'); 2905 $html .= create_space(); 2906 $html .= create_submit(array('cancel', 'save', 'copy')); 2907 } 2908 $html .= create_space(); 2909 $var['result'] = 'help'; 2910 $var['alert'] = $var['help']['languages'][$var['lang']]; 2911 $html .= create_alert(); 2912 $html .= "</form>\n"; 2913 } 2914 2915 // system files 2916 else if ($var['this_page']['name'] == 'system_files') { 2917 if (!$var['alert']) { 2918 $var['result'] = 'help'; 2919 $var['alert'] = $var['help']['system_files'][$var['lang']]; 2920 } 2921 $html .= open_form(); 2922 $html .= create_box('system'); 2923 if ($var['view']) { 2924 $html .= create_space(); 2925 $html .= create_label($var['label']['system_file'][$var['lang']], 'small'); 2926 $html .= create_space(); 2927 $html .= create_input($var['label']['name'][$var['lang']], 'name', $var['view'], 'small'); 2928 $html .= create_space(); 2929 $html .= create_label($var['label']['content'][$var['lang']], 'large'); 2930 $html .= create_space(); 2931 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 2932 $html .= " <tr>\n"; 2933 $html .= " <td>\n"; 2934 $html .= ' <textarea name=form_data width=768 height=' . $var['preference']['column_height'] . ' class=textarea_mono>'; 2935 $html .= parse_text('data/system/' . $var['view'], 'form'); 2936 // $html .= "</textarea>\n"; 2937 // $html .= " </td>\n"; 2938 $html .= " </tr>\n"; 2939 $html .= "</table>\n"; 2940 $html .= create_space(); 2941 $html .= create_submit(array('cancel', 'save')); 2942 } 2943 $html .= "</form>\n"; 2944 } 2945 2946 // news database 2947 else if ($var['this_page']['name'] == 'news') { 2948 $html .= open_form(); 2949 $html .= create_box('news'); 2950 $html .= create_space(); 2951 if (!$var['view']) 2952 $html .= create_submit(array('add')); 2953 else { 2954 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) { 2955 $filedata = read_file('data/news/' . $var['view'] . '.dat'); 2956 $value_status = $filedata['status']; 2957 } 2958 else 2959 $value_status = $var['form_status']; 2960 $html .= create_submit(array('add', 'delete')); 2961 $html .= create_space(); 2962 $html .= create_label($var['label']['news'][$var['lang']], 'large'); 2963 $html .= create_space(); 2964 $html .= create_input($var['label']['name'][$var['lang']], 'name', $var['view'], 'large'); 2965 $html .= create_space(); 2966 $html .= create_input($var['label']['text'][$var['lang']] . '*', 'text', $filedata['text'][$var['lang']], 'large'); 2967 $html .= create_space(); 2968 $html .= create_input($var['label']['link'][$var['lang']], 'link', $filedata['link'], 'large'); 2969 $html .= create_space(); 2970 $html .= create_input($var['label']['status'][$var['lang']], 'status', $value_status, 'large'); 2971 $html .= create_space(); 2972 $html .= create_submit(array('cancel', 'save')); 2973 $html .= create_space(); 2974 $var['result'] = 'help'; 2975 $var['alert'] = $var['help']['languages'][$var['lang']]; 2976 $html .= create_alert(); 2977 } 2978 $html .= "</form>\n"; 2979 } 2980 2981 // template database 2982 else if ($var['this_page']['name'] == 'templates') { 2983 $html .= open_form(); 2984 $html .= create_box('templates'); 2985 $html .= create_space(); 2986 if (!$var['view'] || $var['view'] == 'default') 2987 $submit = array('add'); 2988 else 2989 $submit = array('add', 'delete'); 2990 if ($submit) { 2991 $html .= create_submit($submit); 2992 $html .= create_space(); 2993 } 2994 if ($var['view']) { 2995 $html .= create_label($var['label']['template'][$var['lang']], 'small'); 2996 $html .= create_space(); 2997 $html .= create_input($var['label']['name'][$var['lang']], 'page', $var['view'], 'small'); 2998 $html .= create_space(); 2999 $html .= create_editor(); 3000 } 3001 $html .= "</form>\n"; 3002 } 3003 3004 // image database 3005 else if ($var['this_page']['name'] == 'images') { 3006 $html .= open_form(); 3007 $html .= create_box('images'); 3008 $html .= create_space(); 3009 if (!$var['view']) 3010 $submit = array('add'); 3011 else if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) 3012 $submit = array('add', 'delete'); 3013 if ($submit) { 3014 $html .= create_submit($submit); 3015 $html .= create_space(); 3016 } 3017 if ($var['view']) { 3018 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) { 3019 $html .= create_label($var['label']['image'][$var['lang']], 'small'); 3020 $html .= create_space(); 3021 $html .= create_input($var['label']['name'][$var['lang']], 'name', $var['view'], 'small'); 3022 $html .= create_space(); 3023 $html .= create_submit(array('cancel', 'save')); 3024 $html .= create_space(); 3025 $html .= '<img src=data/images/' . $var['view'] . ">\n"; 3026 get_context('images'); 3027 if (count($var['context'][$var['view']])) { 3028 $html .= create_space(); 3029 $html .= create_label($var['label']['context'][$var['lang']], 'small'); 3030 $html .= create_space(); 3031 $html .= create_context($var['view']); 3032 } 3033 $html .= "</form>\n"; 3034 } 3035 else { 3036 $html .= "</form>\n"; 3037 $html .= create_upload(); 3038 } 3039 } 3040 else 3041 $html .= "</form>\n"; 3042 } 3043 3044 // document database 3045 else if ($var['this_page']['name'] == 'documents') { 3046 $html .= open_form(); 3047 $html .= create_box('documents'); 3048 $html .= create_space(); 3049 if (!$var['view']) 3050 $submit = array('add'); 3051 else if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) 3052 $submit = array('add', 'delete'); 3053 if ($submit) { 3054 $html .= create_submit($submit); 3055 $html .= create_space(); 3056 } 3057 if ($var['view']) { 3058 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) { 3059 $html .= create_label($var['label']['document'][$var['lang']], 'small'); 3060 $html .= create_space(); 3061 $html .= create_input($var['label']['name'][$var['lang']], 'name', $var['view'], 'small'); 3062 $html .= create_space(); 3063 $html .= create_submit(array('cancel', 'save')); 3064 get_context('documents'); 3065 if (count($var['context'][$var['view']])) { 3066 $html .= create_space(); 3067 $html .= create_label($var['label']['context'][$var['lang']], 'small'); 3068 $html .= create_space(); 3069 $html .= create_context($var['view']); 3070 } 3071 $html .= "</form>\n"; 3072 } 3073 else { 3074 $html .= "</form>\n"; 3075 $html .= create_upload(); 3076 } 3077 } 3078 else 3079 $html .= "</form>\n"; 3080 } 3081 3082 // address database 3083 else if ($var['this_page']['name'] == 'addresses') { 3084 $html .= open_form(); 3085 $html .= create_box('addresses'); 3086 $html .= create_space(); 3087 if (!$var['view']) 3088 $html .= create_submit(array('import', 'export', 'add')); 3089 else { 3090 if (substr($var['view'], 2, 5) != 'port_' || strlen($var['view']) != 23) { 3091 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) 3092 $html .= create_submit(array('import', 'export', 'add', 'delete')); 3093 else 3094 $html .= create_submit(array('import', 'export')); 3095 $html .= create_space(); 3096 $html .= create_label($var['label']['address'][$var['lang']], 'small'); 3097 $html .= create_space(); 3098 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) 3099 $value = $var['view']; 3100 else 3101 $value = $var['form_name']; 3102 $html .= create_input($var['database']['address'][0]['title'][$var['lang']], $var['database']['address'][0]['name'], $value, 'small'); 3103 $html .= create_space(); 3104 $values = $var['category']; 3105 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) { 3106 $filedata = read_file('data/addresses/' . $var['view'] . '.dat'); 3107 $value = $filedata[$var['database']['address'][1]['name']]; 3108 } 3109 else { 3110 if (!$var['form_' . $var['database']['address'][1]['name']]) 3111 $value = 'other'; 3112 else 3113 $value = $var['form_' . $var['database']['address'][1]['name']]; 3114 } 3115 $html .= create_option($var['database']['address'][1]['title'][$var['lang']], $var['database']['address'][1]['name'], $values, $value, 'small'); 3116 $html .= create_space(); 3117 for ($i = 2; $i < count($var['database']['address']); $i++) { 3118 if ($var['database']['address'][$i]['name'] != 'organization_1' && $var['database']['address'][$i]['name'] != 'organization_2' && $var['database']['address'][$i]['name'] != 'city' && $var['database']['address'][$i]['name'] != 'state' && $var['database']['address'][$i]['name'] != 'country' && $var['database']['address'][$i]['name'] != 'description') { 3119 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) 3120 $value = $filedata[$var['database']['address'][$i]['name']]; 3121 else 3122 $value = $var['form_' . $var['database']['address'][$i]['name']]; 3123 $note = ''; 3124 } 3125 else { 3126 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) 3127 $value = $filedata[$var['database']['address'][$i]['name']][$var['lang']]; 3128 else 3129 $value = $var['form_' . $var['database']['address'][$i]['name']]; 3130 $note = '*'; 3131 } 3132 $html .= create_input($var['database']['address'][$i]['title'][$var['lang']] . $note, $var['database']['address'][$i]['name'], $value, 'small'); 3133 $html .= create_space(); 3134 } 3135 $html .= create_submit(array('cancel', 'save', 'copy')); 3136 get_context('addresses'); 3137 if (count($var['context'][$var['view']])) { 3138 $html .= create_space(); 3139 $html .= create_label($var['label']['context'][$var['lang']], 'small'); 3140 $html .= create_space(); 3141 $html .= create_context($var['view']); 3142 } 3143 $html .= create_space(); 3144 $var['result'] = 'help'; 3145 $var['alert'] = $var['help']['languages'][$var['lang']]; 3146 $html .= create_alert(); 3147 $html .= "</form>\n"; 3148 } 3149 else if (substr($var['view'], 0, 7) == 'import_') { 3150 $html .= create_submit(array('export', 'add')); 3151 $html .= create_space(); 3152 $html .= "</form>\n"; 3153 $html .= create_import(); 3154 } 3155 else if (substr($var['view'], 0, 7) == 'export_') { 3156 $html .= create_submit(array('import', 'add')); 3157 $html .= create_space(); 3158 $html .= "</form>\n"; 3159 $html .= create_export(); 3160 } 3161 } 3162 } 3163 3164 // link database 3165 else if ($var['this_page']['name'] == 'links') { 3166 $html .= open_form(); 3167 $html .= create_box('links'); 3168 $html .= create_space(); 3169 if (!$var['view']) 3170 $html .= create_submit(array('import', 'export', 'add')); 3171 else { 3172 if (substr($var['view'], 2, 5) != 'port_' || strlen($var['view']) != 23) { 3173 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) 3174 $html .= create_submit(array('import', 'export', 'add', 'delete')); 3175 else 3176 $html .= create_submit(array('import', 'export')); 3177 $html .= create_space(); 3178 $html .= create_label($var['label']['link'][$var['lang']], 'small'); 3179 $html .= create_space(); 3180 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) 3181 $value = $var['view']; 3182 else 3183 $value = $var['form_name']; 3184 $html .= create_input($var['database']['link'][0]['title'][$var['lang']], $var['database']['link'][0]['name'], $value, 'small'); 3185 $html .= create_space(); 3186 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) 3187 $filedata = read_file('data/links/' . $var['view'] . '.dat'); 3188 for ($i = 1; $i < count($var['database']['link']); $i++) { 3189 if ($var['database']['link'][$i]['name'] != 'title' && $var['database']['link'][$i]['name'] != 'description') { 3190 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) 3191 $value = $filedata[$var['database']['link'][$i]['name']]; 3192 else 3193 $value = $var['form_' . $var['database']['link'][$i]['name']]; 3194 $note = ''; 3195 } 3196 else { 3197 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) 3198 $value = $filedata[$var['database']['link'][$i]['name']][$var['lang']]; 3199 else 3200 $value = $var['form_' . $var['database']['link'][$i]['name']]; 3201 $note = '*'; 3202 } 3203 $html .= create_input($var['database']['link'][$i]['title'][$var['lang']] . $note, $var['database']['link'][$i]['name'], $value, 'small'); 3204 $html .= create_space(); 3205 } 3206 $html .= create_submit(array('cancel', 'save', 'copy')); 3207 get_context('links'); 3208 if (count($var['context'][$var['view']])) { 3209 $html .= create_space(); 3210 $html .= create_label($var['label']['context'][$var['lang']], 'small'); 3211 $html .= create_space(); 3212 $html .= create_context($var['view']); 3213 } 3214 $html .= create_space(); 3215 $var['result'] = 'help'; 3216 $var['alert'] = $var['help']['languages'][$var['lang']]; 3217 $html .= create_alert(); 3218 $html .= "</form>\n"; 3219 } 3220 else if (substr($var['view'], 0, 7) == 'import_') { 3221 $html .= create_submit(array('export', 'add')); 3222 $html .= create_space(); 3223 $html .= "</form>\n"; 3224 $html .= create_import(); 3225 } 3226 else if (substr($var['view'], 0, 7) == 'export_') { 3227 $html .= create_submit(array('import', 'add')); 3228 $html .= create_space(); 3229 $html .= "</form>\n"; 3230 $html .= create_export(); 3231 } 3232 } 3233 } 3234 3235 // newsletter settings 3236 else if ($var['this_page']['name'] == 'newsletter_settings') { 3237 $html .= open_form(); 3238 $i = 0; 3239 reset($var['newsletter']); 3240 while (list($k, $v) = each($var['newsletter'])) { 3241 if ($k == 'header' || $k == 'footer') 3242 $v = str_replace('\n', chr(13) . chr(10), $v); 3243 $html .= create_input($var['label'][$k][$var['lang']], str_replace('-', '_', $k), $v, 'large'); 3244 $html .= create_space(); 3245 $i++; 3246 } 3247 $html .= create_submit(array('cancel', 'save')); 3248 $html .= "</form>\n"; 3249 } 3250 3251 // newsletter filters 3252 else if ($var['this_page']['name'] == 'filters') { 3253 $html .= open_form(); 3254 $html .= create_box($var['this_page']['name']); 3255 $html .= create_space(); 3256 if (!$var['view']) 3257 $html .= create_submit(array('add')); 3258 else { 3259 $html .= create_submit(array('add', 'delete')); 3260 $html .= create_space(); 3261 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) { 3262 $filedata = read_file('data/newsletter/filters/' . $var['view'] . '.dat'); 3263 $value_name = $var['view']; 3264 $value_title = $filedata['title'][$var['lang']]; 3265 $value_description = $filedata['description'][$var['lang']]; 3266 } 3267 else { 3268 $value_name = $var['form_name']; 3269 $value_title = $var['form_title']; 3270 $value_description = $var['form_description']; 3271 } 3272 $html .= create_label($var['label']['filter'][$var['lang']], 'small'); 3273 $html .= create_space(); 3274 $html .= create_input($var['label']['name'][$var['lang']], 'name', $value_name, 'small'); 3275 $html .= create_space(); 3276 $html .= create_input($var['label']['title'][$var['lang']] . '*', 'title', $value_title, 'small'); 3277 $html .= create_space(); 3278 $html .= create_input($var['label']['description'][$var['lang']] . '*', 'description', $value_description, 'small'); 3279 $html .= create_space(); 3280 $html .= create_submit(array('cancel', 'save', 'copy')); 3281 $html .= create_space(); 3282 $var['result'] = 'help'; 3283 $var['alert'] = $var['help']['languages'][$var['lang']]; 3284 $html .= create_alert(); 3285 } 3286 $html .= "</form>\n"; 3287 } 3288 3289 // send newsletter 3290 else if ($var['this_page']['name'] == 'send') { 3291 $html .= open_form(); 3292 if ($var['view']) { 3293 $filedata = read_file('data/newsletter/messages/unsent/' . $var['view'] . '.dat'); 3294 $var['form_subject'] = $filedata['subject']; 3295 $var['form_from'] = $filedata['from']; 3296 if ($var['lang'] == 'en') 3297 $var['form_date'] = $filedata['date']; 3298 else 3299 $var['form_date'] = substr($filedata['date'], 3, 2) . '.' . substr($filedata['date'], 0, 2) . '.' . substr($filedata['date'], 6); 3300 $var['form_message'] = str_replace('\n', chr(13) . chr(10), $filedata['message']); 3301 } 3302 if (!$var['form_from']) 3303 $var['form_from'] = $var['newsletter']['default-from']; 3304 if (!$var['form_date']) { 3305 if ($var['lang'] == 'en') 3306 $var['form_date'] = date('m/d/Y H:i:s', $var['time']); 3307 else if ($var['lang'] == 'de') 3308 $var['form_date'] = date('d.m.Y H:i:s', $var['time']); 3309 } 3310 $html .= create_label($var['label']['message'][$var['lang']], 'large'); 3311 $html .= create_space(); 3312 $html .= create_input($var['label']['subject'][$var['lang']], 'subject', $var['form_subject'], 'large'); 3313 $html .= create_space(); 3314 $html .= create_input($var['label']['from'][$var['lang']], 'from', $var['form_from'], 'large'); 3315 $html .= create_space(); 3316 $html .= create_input($var['label']['date'][$var['lang']], 'date', $var['form_date'], 'large'); 3317 $html .= create_space(); 3318 $html .= create_input($var['label']['message'][$var['lang']], 'message', $var['form_message'], 'large'); 3319 $html .= create_space(); 3320 $list = read_dir('data/newsletter/filters'); 3321 if ($list) { 3322 $html .= create_label($var['label']['filters'][$var['lang']], 'small'); 3323 $html .= create_space(); 3324 for ($i = 0; $i < count($list); $i++) { 3325 $filedata = read_file('data/newsletter/filters/' . $list[$i]['filename']); 3326 $html .= create_input($filedata['title'][$var['lang']], 'filter_' . $list[$i]['name'], $var['form_filter_' . $list[$i]['name']], 'small'); 3327 $html .= create_space(); 3328 } 3329 } 3330 $html .= create_submit(array('preview', 'save', 'send')); 3331 if ($var['form_button'] == 'preview') { 3332 $html .= create_space(); 3333 $html .= create_label($var['label']['preview'][$var['lang']], 'large'); 3334 $html .= create_space(); 3335 $html .= "<table border=0 cellpadding=18 cellspacing=0>\n"; 3336 $html .= " <tr>\n"; 3337 $html .= " <td class=document>\n"; 3338 $html .= ' <span class=document_text>'; 3339 $html .= '<span style=font-weight:bold>Subject:</span> '; 3340 if ($var['newsletter']['listtag']) 3341 $html .= strtohtml($var['newsletter']['listtag']) . ' '; 3342 $html .= strtohtml($var['form_subject']) . '<br>'; 3343 $html .= '<span style=font-weight:bold>From:</span> ' . strtohtml($var['form_from']) . '<br>'; 3344 $html .= '<span style=font-weight:bold>Date:</span> ' . parse_date($var['form_date']) . '<br>'; 3345 $html .= "</span>\n"; 3346 $html .= " </td>\n"; 3347 $html .= " </tr>\n"; 3348 $html .= "</table>\n"; 3349 $html .= create_space(); 3350 $html .= "<table border=0 cellpadding=18 cellspacing=0>\n"; 3351 $html .= " <tr>\n"; 3352 $html .= " <td class=document>\n"; 3353 $html .= ' <span class=document_mono>'; 3354 if ($var['newsletter']['header']) 3355 $html .= str_replace(' ', ' ', str_replace('\n', '<br>', strtohtml(parse_header($var['newsletter']['header'])))) . '<br><br><br><br>'; 3356 $html .= str_replace(' ', ' ', str_replace(chr(13) . chr(10), '<br>', strtohtml($var['form_message']))); 3357 if ($var['newsletter']['footer']) 3358 $html .= '<br><br><br><br>' . str_replace(' ', ' ', str_replace('\n', '<br>', strtohtml(parse_header($var['newsletter']['footer'])))); 3359 $html .= "</span>\n"; 3360 $html .= " </td>\n"; 3361 $html .= " </tr>\n"; 3362 $html .= "</table>\n"; 3363 } 3364 $html .= "</form>\n"; 3365 } 3366 3367 // newsletter archive 3368 else if ($var['this_page']['name'] == 'archive' || $var['this_page']['name'] == 'sent' || $var['this_page']['name'] == 'unsent') { 3369 $html .= open_form(); 3370 if ($var['this_page']['name'] != 'unsent') 3371 $archive = 'sent'; 3372 else 3373 $archive = 'unsent'; 3374 $html .= create_box($archive); 3375 if ($var['view']) { 3376 $html .= create_space(); 3377 $html .= create_label($var['label']['message'][$var['lang']], 'large'); 3378 $html .= create_space(); 3379 $filedata = read_file("data/newsletter/messages/$archive/" . $var['view'] . '.dat'); 3380 $html .= "<table border=0 cellpadding=18 cellspacing=0>\n"; 3381 $html .= " <tr>\n"; 3382 $html .= " <td class=document>\n"; 3383 $html .= ' <span class=document_text>'; 3384 $html .= '<span style=font-weight:bold>Subject:</span> ' . strtohtml($filedata['subject']) . '<br>'; 3385 $html .= '<span style=font-weight:bold>From:</span> ' . strtohtml($filedata['from']) . '<br>'; 3386 if ($archive == 'sent') 3387 $html .= '<span style=font-weight:bold>Date:</span> ' . $filedata['date'] . '<br>'; 3388 else 3389 $html .= '<span style=font-weight:bold>Date:</span> ' . parse_date($filedata['date']) . '<br>'; 3390 $html .= "</span>\n"; 3391 $html .= " </td>\n"; 3392 $html .= " </tr>\n"; 3393 $html .= "</table>\n"; 3394 $html .= create_space(); 3395 $html .= "<table border=0 cellpadding=18 cellspacing=0>\n"; 3396 $html .= " <tr>\n"; 3397 $html .= " <td class=document>\n"; 3398 $html .= ' <span class=document_mono>'; 3399 $html .= str_replace(' ', ' ', str_replace('\n', '<br>', strtohtml($filedata['message']))); 3400 $html .= "</span>\n"; 3401 $html .= " </td>\n"; 3402 $html .= " </tr>\n"; 3403 $html .= "</table>\n"; 3404 if ($var['this_page']['name'] == 'unsent') { 3405 $html .= create_space(); 3406 $html .= create_submit(array('delete', 'edit')); 3407 } 3408 } 3409 $html .= "</form>\n"; 3410 } 3411 3412 // newsletter subscribers 3413 else if ($var['this_page']['name'] == 'subscribers') { 3414 $html .= open_form(); 3415 $html .= create_box('subscribers'); 3416 $html .= create_space(); 3417 if (!$var['view']) 3418 $html .= create_submit(array('import', 'export', 'add')); 3419 else { 3420 if (substr($var['view'], 2, 5) != 'port_' || strlen($var['view']) != 23) { 3421 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) { 3422 $html .= create_submit(array('import', 'export', 'add', 'delete')); 3423 $filedata = read_file('data/newsletter/subscribers/' . $var['view'] . '.dat'); 3424 $value_e_mail = $var['view']; 3425 $value_status = $filedata['status']; 3426 $list = read_dir('data/newsletter/filters'); 3427 for ($i = 0; $i < count($list); $i++) { 3428 if (strstr($filedata['filters'], $list[$i]['name'])) 3429 $value_filter[$list[$i]['name']] = 'on'; 3430 else 3431 $value_filter[$list[$i]['name']] = 'off'; 3432 } 3433 } 3434 else { 3435 $html .= create_submit(array('import', 'export')); 3436 $value_e_mail = $var['form_e_mail']; 3437 $value_status = $var['form_status']; 3438 } 3439 $html .= create_space(); 3440 $html .= create_label($var['label']['subscriber'][$var['lang']], 'small'); 3441 $html .= create_space(); 3442 $html .= create_input($var['label']['e-mail'][$var['lang']], 'e_mail', $value_e_mail, 'small'); 3443 $html .= create_space(); 3444 $html .= create_input($var['label']['status'][$var['lang']], 'status', $value_status, 'small'); 3445 $html .= create_space(); 3446 $list = read_dir('data/newsletter/filters'); 3447 if ($list) { 3448 $html .= create_label($var['label']['filters'][$var['lang']], 'small'); 3449 $html .= create_space(); 3450 for ($i = 0; $i < count($list); $i++) { 3451 $filedata = read_file('data/newsletter/filters/' . $list[$i]['filename']); 3452 $html .= create_input($filedata['title'][$var['lang']], 'filter_' . $list[$i]['name'], $value_filter[$list[$i]['name']], 'small'); 3453 $html .= create_space(); 3454 } 3455 } 3456 $html .= create_submit(array('cancel', 'save')); 3457 } 3458 else if (substr($var['view'], 0, 7) == 'import_') { 3459 $html .= create_submit(array('export', 'add')); 3460 $html .= create_space(); 3461 $html .= create_import(); 3462 } 3463 else if (substr($var['view'], 0, 7) == 'export_') { 3464 $html .= create_submit(array('import', 'add')); 3465 $html .= create_space(); 3466 $html .= create_export(); 3467 } 3468 $html .= "</form>\n"; 3469 } 3470 } 3471 3472 // trash 3473 else if ($var['this_page']['name'] == 'trash') { 3474 $html .= open_form(); 3475 $html .= create_box('trash'); 3476 if ($var['files_total']) { 3477 $html .= create_space(); 3478 $html .= create_submit(array('empty')); 3479 } 3480 if ($var['view']) { 3481 $html .= create_space(); 3482 $html .= create_label($var['label']['file'][$var['lang']], 'small'); 3483 $html .= create_space(); 3484 $html .= create_input($var['label']['name'][$var['lang']], 'trashfile', $var['view'], 'small'); 3485 $html .= create_space(); 3486 $html .= create_input($var['label']['type'][$var['lang']], 'trashtype', $var['type'], 'small'); 3487 $html .= create_space(); 3488 if ($var['type'] == 'page' || $var['type'] == 'system') 3489 $html .= create_submit(array('delete')); 3490 else 3491 $html .= create_submit(array('cancel', 'undelete', 'delete')); 3492 if ($var['type'] == 'page' || $var['type'] == 'template' || $var['type'] == 'system') { 3493 $html .= create_space(); 3494 $html .= create_label($var['label']['content'][$var['lang']], 'large'); 3495 $html .= create_space(); 3496 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 3497 $html .= " <tr>\n"; 3498 if ($var['type'] == 'page' || $var['type'] == 'template') 3499 $html .= parse_text('data/trash/' . $var['type'] . '.' . str_replace('/', '.', $var['view']) . '.txt', 'form'); 3500 else { 3501 $html .= " <td>\n"; 3502 $html .= ' <textarea readonly width=768 height=' . $var['preference']['column_height'] . ' class=textarea_mono>'; 3503 $html .= parse_text('data/trash/' . $var['type'] . '.' . str_replace('/', '.', $var['view']), 'form'); 3504 $html .= "</textarea>\n"; 3505 $html .= " </td>\n"; 3506 } 3507 $html .= " </tr>\n"; 3508 $html .= "</table>\n"; 3509 } 3510 } 3511 $html .= "</form>\n"; 3512 } 3513 3514 // statistics 3515 else if (strstr('years months weeks weekdays days hours directories pages languages systems clients platforms robots referrals_from queries_from referrals_to queries_for continents regions countries domains hosts' , $var['this_page']['name']) && $var['this_page']['name'] != 'referrals') { 3516 if (!$var['view']) 3517 $var['view'] = 'views'; 3518 $html .= open_form(); 3519 $var['statistics'] = $var['view']; 3520 $html .= create_select('statistics'); 3521 $html .= create_space(); 3522 $html .= "<table cellpadding=18 cellspacing=0 style=\"border:1px solid #808080\">\n"; 3523 $html .= " <tr>\n"; 3524 $html .= " <td bgcolor=#ffffff style=\"border:1px solid #808080\">\n"; 3525 $html .= " <span class=text_mono>\n"; 3526 if ($var['this_page']['name'] == 'years' || $var['this_page']['name'] == 'months') { 3527 $f = read_dir('data/logs/' . $var['subdir']); 3528 for ($i = 0; $i < count($f); $i++) { 3529 if (substr($f[$i]['name'], 0, 4) == 'hits') { 3530 if ($var['this_page']['name'] == 'years') 3531 $key = substr($f[$i]['name'], 5, 4); 3532 else if ($var['this_page']['name'] == 'months') 3533 $key = substr($f[$i]['name'], 10, 2) . '/' . substr($f[$i]['name'], 5, 4); 3534 $file = file('data/logs/' . $var['subdir'] . '/' . $f[$i]['name'] . '.log'); 3535 $var['hits'][$key] += count($file); 3536 if (strlen($key) > $k_max) 3537 $k_max = strlen($key); 3538 if (strlen($var['hits'][$key]) > $v_max) 3539 $v_max = strlen($var['hits'][$key]); 3540 } 3541 } 3542 } 3543 else { 3544 if (strstr('systems platforms', $var['this_page']['name'])) 3545 $var['parser']['systems'] = read_file('data/system/systems.dat'); 3546 if (strstr('clients platforms', $var['this_page']['name'])) 3547 $var['parser']['clients'] = read_file('data/system/clients.dat'); 3548 if (strstr('systems clients platforms robots', $var['this_page']['name'])) 3549 $var['parser']['robots'] = read_file('data/system/robots.dat'); 3550 if (strstr('continents regions countries', $var['this_page']['name'])) 3551 $var['parser']['countries'] = read_file('data/system/countries.dat'); 3552 if ($var['this_page']['name'] == 'domains') 3553 $var['parser']['domains'] = read_file('data/system/domains.dat'); 3554 $file = file('data/logs/' . $var['subdir'] . '/hits.' . date('Y.m', $var['time']) . '.log'); 3555 for ($i = 0; $i < count($file); $i++) { 3556 if (strstr('systems clients platforms robots', $var['this_page']['name'])) 3557 $data = explode('"', chop($file[$i])); 3558 else 3559 $data = explode(' ', chop($file[$i])); 3560 $key = ''; 3561 if ($var['this_page']['name'] == 'weeks') { 3562 $key = date('W', mktime(0, 0, 0, date('n', $var['time']), substr($data[3], 1, 2), date('Y', $var['time']))) . '/' . date('Y', $var['time']); 3563 if (strlen($key) == 6) 3564 $key = "0$key"; 3565 } 3566 else if ($var['this_page']['name'] == 'weekdays') 3567 $key = date('w', mktime(0, 0, 0, date('n', $var['time']), substr($data[3], 1, 2), date('Y', $var['time']))); 3568 else if ($var['this_page']['name'] == 'days') 3569 $key = date('m', $var['time']) . '/' . substr($data[3], 1, 2); 3570 else if ($var['this_page']['name'] == 'hours') 3571 $key = substr($data[3], 13, 2) . ':00'; 3572 else if ($var['this_page']['name'] == 'directories') { 3573 $data = explode('?page=', $data[6]); 3574 $data = explode('&', $data[1]); 3575 $data = explode('/', $data[0]); 3576 $key = $data[0]; 3577 if (!$key) 3578 $key = '[none]'; 3579 } 3580 else if ($var['this_page']['name'] == 'pages') { 3581 $data = explode('?page=', $data[6]); 3582 $data = explode('&', $data[1]); 3583 $key = $data[0]; 3584 if (!$key) 3585 $key = '[none]'; 3586 } 3587 else if ($var['this_page']['name'] == 'languages') { 3588 $data = explode('&lang=', $data[6]); 3589 $data = explode('&', $data[1]); 3590 $key = $data[0]; 3591 if (!$key) 3592 $key = 'en'; 3593 } 3594 else if (strstr('systems clients robots', $var['this_page']['name'])) { 3595 reset($var['parser'][$var['this_page']['name']]); 3596 while (list($k, $v) = each($var['parser'][$var['this_page']['name']])) { 3597 if (strstr($data[count($data) - 2], $k)) { 3598 $key = $v; 3599 break; 3600 } 3601 } 3602 if (!$key) { 3603 if (strstr('systems clients', $var['this_page']['name'])) { 3604 reset($var['parser']['robots']); 3605 while (list($k, $v) = each($var['parser']['robots'])) { 3606 if (strstr($data[count($data) - 2], $k)) { 3607 $key = 'Robot'; 3608 break; 3609 } 3610 } 3611 if (!$key) 3612 $key = '[unknown]'; 3613 } 3614 else 3615 $key = 'Browser'; 3616 } 3617 } 3618 else if ($var['this_page']['name'] == 'platforms') { 3619 $parser = array('systems', 'clients'); 3620 $subkey = array('', ''); 3621 for ($j = 0; $j < 2; $j++) { 3622 reset($var['parser'][$parser[$j]]); 3623 while (list($k, $v) = each($var['parser'][$parser[$j]])) { 3624 if (strstr($data[count($data) - 2], $k)) { 3625 $subkey[$j] = $v; 3626 break; 3627 } 3628 } 3629 if (!$subkey[$j]) { 3630 reset($var['parser']['robots']); 3631 while (list($k, $v) = each($var['parser']['robots'])) { 3632 if (strstr($data[count($data) - 2], $k)) { 3633 $subkey[$j] = 'Robot'; 3634 break; 3635 } 3636 } 3637 if (!$subkey[$j]) 3638 $subkey[$j] = '[unknown]'; 3639 } 3640 } 3641 $key = "$subkey[0] / $subkey[1]"; 3642 } 3643 else if ($var['this_page']['name'] == 'referrals_from') { 3644 $data = explode('//', substr($data[10], 1, -1)); 3645 $data = explode('?', $data[1]); 3646 $key = $data[0]; 3647 if (!$key) 3648 $key = '[none]'; 3649 } 3650 else if ($var['this_page']['name'] == 'queries_from') { 3651 $data = explode('q=', substr($data[10], 1, -1)); 3652 $data = explode('&', $data[1]); 3653 $key = $data[0]; 3654 if (!$key) 3655 $key = '[none]'; 3656 } 3657 else if (strstr('continents regions countries', $var['this_page']['name'])) { 3658 $data = explode('.', $data[0]); 3659 if ($var['parser']['countries'][$data[count($data) - 1]]) { 3660 $data = explode(' | ', $var['parser']['countries'][$data[count($data) - 1]]); 3661 if ($var['this_page']['name'] == 'continents') 3662 $key = $data[2]; 3663 else if ($var['this_page']['name'] == 'regions') 3664 $key = $data[1]; 3665 else if ($var['this_page']['name'] == 'countries') 3666 $key = $data[0]; 3667 } 3668 else 3669 $key = '[unknown]'; 3670 } 3671 else if ($var['this_page']['name'] == 'domains') { 3672 $data = explode('.', $data[0]); 3673 if (!strstr('0123456789', substr($data[count($data) - 1], -1))) { 3674 if (count($data) > 2 && $var['parser']['domains'][$data[count($data) - 3]]) 3675 $key = $data[count($data) - 3] . '.' . $data[count($data) - 2] . '.' . $data[count($data) - 1]; 3676 else if (count($data) > 1) 3677 $key = $data[count($data) - 2] . '.' . $data[count($data) - 1]; 3678 } 3679 if (!$key) 3680 $key = '[unknown]'; 3681 } 3682 else if ($var['this_page']['name'] == 'hosts') 3683 $key = $data[0]; 3684 if ($var['view'] == 'views') 3685 $var['hits'][$key]++; 3686 else { 3687 $data = explode(' ', chop($file[$i])); 3688 if (!$var['visitorflag'][$key][$data[0]]) { 3689 $var['hits'][$key]++; 3690 $var['visitorflag'][$key][$data[0]] = true; 3691 } 3692 } 3693 if (strlen($key) > $k_max) 3694 $k_max = strlen($key); 3695 if (strlen($var['hits'][$key]) > $v_max) 3696 $v_max = strlen($var['hits'][$key]); 3697 } 3698 } 3699 if (strstr('months weeks weekdays days hours', $var['this_page']['name'])) 3700 ksort($var['hits']); 3701 else 3702 arsort($var['hits']); 3703 while (list($k, $v) = each($var['hits'])) { 3704 $percent[$k] = number_format($v / array_sum($var['hits']) * 100, 2); 3705 if (strlen($percent[$k]) > $p_max) 3706 $p_max = strlen($percent[$k]); 3707 } 3708 reset($var['hits']); 3709 while (list($k, $v) = each($var['hits'])) { 3710 if ($var['this_page']['name'] != 'weekdays' || $k != 0) { 3711 if ($var['this_page']['name'] != 'weekdays') 3712 $html .= " $k " . str_repeat('.', $k_max - strlen($k)); 3713 else 3714 $html .= ' ' . $var['weekday'][$k]['en'] . ' ' . str_repeat('.', 9 - strlen($var['weekday'][$k]['en'])); 3715 $html .= str_repeat(' ', $v_max - strlen($v)) . ' ' . $v . ' ' . str_repeat(' ', $p_max - strlen($percent[$k])) . $percent[$k] . '% ' . str_repeat('|', ceil($v / max($var['hits']) * (100 - $k_max - $v_max))) . "<br>\n"; 3716 } 3717 } 3718 if ($var['this_page']['name'] == 'weekdays') { 3719 reset($var['hits']); 3720 while (list($k, $v) = each($var['hits'])) { 3721 $html .= ' ' . $var['weekday'][$k]['en'] . ' ' . str_repeat('.', 9 - strlen($var['weekday'][$k]['en'])) . str_repeat(' ', $v_max - strlen($v)) . ' ' . $v . ' '. str_repeat(' ', $p_max - strlen($percent[$k])) . $percent[$k] . '% ' . str_repeat('|', ceil($v / max($var['hits']) * (100 - $k_max - $v_max))) . "<br>\n"; 3722 break; 3723 } 3724 } 3725 $html .= " </span>\n"; 3726 $html .= " </td>\n"; 3727 $html .= " </tr>\n"; 3728 $html .= "</table>\n"; 3729 $html .= "</form>\n"; 3730 } 3731 3732 // logfiles 3733 else if ($var['this_page']['name'] == 'hits' || $var['this_page']['name'] == 'logins' || $var['this_page']['name'] == 'searches' || $var['this_page']['name'] == 'referrals') { 3734 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 3735 $html .= " <tr>\n"; 3736 $html .= " <td>\n"; 3737 $html .= ' <textarea wrap=off readonly class=textarea_mono>'; 3740 // 3 LINES HIDDEN 3741 $html .= "</textarea>\n"; 3742 $html .= " </td>\n"; 3743 $html .= " </tr>\n"; 3744 $html .= "</table>\n"; 3745 } 3746 3747 // help 3748 else if ($var['this_page']['name'] == 'help') { 3749 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 3750 $html .= " <tr>\n"; 3751 $html .= " <td>\n"; 3752 $html .= " <span class=text>\n"; 3753 $html .= parse_text('data/system/help.' . $var['lang'] . '.txt', 'html'); 3754 $html .= " </span>\n"; 3755 $html .= " </td>\n"; 3756 $html .= " </tr>\n"; 3757 $html .= "</table>\n"; 3758 } 3759 3760 // logout 3761 else if ($var['this_page']['name'] == 'logout') { 3762 unlink('data/sessions/' . $var['ssid'] . '.dat'); 3763 echo "<script language=javascript>\n"; 3764 echo 'document.location.href = "main.php?page=admin/login&lang=' . $var['lang'] . "\";\n"; 3765 echo "</script>\n"; 3766 exit; 3767 } 3768 3769 // anything else 3770 else { 3771 $var['result'] = 'error'; 3772 $var['alert'] = $var['error']['not_yet'][$var['lang']]; 3773 $html .= create_alert(); 3774 } 3775 3776 return $html; 3777 3778 } 3779 3780 // ----------------------------------------------------------------------------- 3781 3782 function open_form() { 3783 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 3784 if ($var['alert']) { 3785 $html .= create_alert(); 3786 $html .= create_space(); 3787 } 3788 $html .= '<form name=form action=main.php?page=' . $var['page'] . '&lang=' . $var['lang']; 3789 if ($var['view'] && $var['this_page']['name'] != 'subscribe') 3790 $html .= '&view=' . $var['view']; 3791 if ($var['type']) 3792 $html .= '&type=' . $var['type']; 3793 if ($var['sort']) 3794 $html .= '&sort=' . $var['sort']; 3795 if ($var['q']) 3796 $html .= '&q=' . $var['q']; 3797 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 3798 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 3799 $html .= " method=post>\n"; 3800 $html .= "<input type=hidden name=form value=1>\n"; 3801 return $html; 3802 } 3803 3804 // ----------------------------------------------------------------------------- 3805 3806 function create_context_old($filename) { 3807 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 3808 3809 for ($i = 0; $i < count($var['context'][$filename]); $i++) { 3810 $html .= " <table border=0 cellpadding=0 cellspacing=0>\n"; 3811 /* 3812 if ($i == 0) { 3813 $html .= " <tr>\n"; 3814 $html .= " <td height=6></td>\n"; 3815 $html .= " </tr>\n"; 3816 } 3817 */ 3818 $html .= " <tr>\n"; 3819 $data = explode('.', substr($var['context'][$filename][$i], 0, -3)); 3820 for ($i_ = 0; $i_ < $var['menu']['count']; $i_++) { 3821 for ($j_ = 0; $j_ < $var['menu'][$i_]['count']; $j_++) { 3822 if (count($data) == 2 && $var['menu'][$i_]['name'] == $data[0] && $var['menu'][$i_][$j_]['name'] == $data[1]) { 3823 $color = $var['menu'][$i_]['color']; 3824 $html .= ' <td width=27 height=18><a href=main.php?page=' . str_replace('.', '/', substr($var['context'][$filename][$i], 0, -3)) . '&lang=' . substr($var['context'][$filename][$i], -2); 3825 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 3826 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 3827 $html .= "><img src=images/icon.page.$color.gif width=18 height=18 border=0></a><img src=images/transparent.gif width=9 height=18></td>\n"; 3828 $html .= " <td width=6 height=18 background=images/sitemap.$color.left.gif></td>\n"; 3829 $html .= " <td height=18 valign=middle background=images/sitemap.$color.center.gif><a href=main.php?page=" . str_replace('.', '/', substr($var['context'][$filename][$i], 0, -3)) . '&lang=' . substr($var['context'][$filename][$i], -2); 3830 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 3831 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 3832 $html .= ' class=sitemap_public style=color:#' . $var['color']['sitemap'][$color] . '>' . menutoline($var['menu'][$i_][$j_]['title'][$var['lang']]) . "</a></td>\n"; 3833 $html .= " <td width=6 height=18 background=images/sitemap.$color.right.gif></td>\n"; 3834 } 3835 else { 3836 for ($k_ = 0; $k_ < $var['menu'][$i_][$j_]['count']; $k_++) { 3837 if (count($data) == 3 && $var['menu'][$i_]['name'] == $data[0] && $var['menu'][$i_][$j_]['name'] == $data[1] && $var['menu'][$i_][$j_][$k_]['name'] == $data[2]) { 3838 $color = $var['menu'][$i_][$j_][$k_]['color']; 3839 $html .= ' <td width=27 height=18><a href=main.php?page=' . str_replace('.', '/', substr($var['context'][$filename][$i], 0, -3)) . '&lang=' . substr($var['context'][$filename][$i], -2); 3840 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 3841 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 3842 $html .= "><img src=images/icon.page.$color.gif width=18 height=18 border=0></a><img src=images/transparent.gif width=9 height=18></td>\n"; 3843 $html .= " <td width=6 height=18 background=images/sitemap.$color.left.gif></td>\n"; 3844 $html .= " <td height=18 valign=middle background=images/sitemap.$color.center.gif><a href=main.php?page=" . str_replace('.', '/', substr($var['context'][$filename][$i], 0, -3)) . '&lang=' . substr($var['context'][$filename][$i], -2); 3845 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 3846 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 3847 $html .= ' class=sitemap_public style=color:#' . $var['color']['sitemap'][$color] . '>' . menutoline($var['menu'][$i_][$j_][$k_]['title'][$var['lang']]) . "</a></td>\n"; 3848 $html .= " <td width=6 height=18 background=images/sitemap.$color.right.gif></td>\n"; 3849 } 3850 else { 3851 for ($l_ = 0; $l_ < $var['menu'][$i_][$j_][$k_]['count']; $l_++) { 3852 if ($var['menu'][$i_]['name'] == $data[0] && $var['menu'][$i_][$j_]['name'] == $data[1] && $var['menu'][$i_][$j_][$k_]['name'] == $data[2] && $var['menu'][$i_][$j_][$k_][$l_]['name'] == $data[3]) { 3853 $color = $var['menu'][$i_][$j_][$k_]['color']; 3854 $html .= ' <td width=27 height=18><a href=main.php?page=' . str_replace('.', '/', substr($var['context'][$filename][$i], 0, -3)) . '&lang=' . substr($var['context'][$filename][$i], -2); 3855 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 3856 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 3857 $html .= "><img src=images/icon.page.$color.gif width=18 height=18 border=0></a><img src=images/transparent.gif width=9 height=18></td>\n"; 3858 $html .= " <td width=6 height=18 background=images/sitemap.$color.left.gif></td>\n"; 3859 $html .= " <td height=18 valign=middle background=images/sitemap.$color.center.gif><a href=main.php?page=" . str_replace('.', '/', substr($var['context'][$filename][$i], 0, -3)) . '&lang=' . substr($var['context'][$filename][$i], -2); 3860 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 3861 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 3862 $html .= ' class=sitemap_public style=color:#' . $var['color']['sitemap'][$color] . '>' . menutoline($var['menu'][$i_][$j_][$k_][$l_]['title'][$var['lang']]) . "</a></td>\n"; 3863 $html .= " <td width=6 height=18 background=images/sitemap.$color.right.gif></td>\n"; 3864 } 3865 } 3866 } 3867 } 3868 } 3869 } 3870 } 3871 $html .= " </tr>\n"; 3872 $html .= " <tr>\n"; 3873 $html .= " <td height=6></td>\n"; 3874 $html .= " </tr>\n"; 3875 $html .= " </table>\n"; 3876 } 3877 return $html; 3878 3879 } 3880 3881 // ----------------------------------------------------------------------------- 3882 3883 function create_context($filename) { 3884 3885 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 3886 3887 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 3888 $html .= " <tr>\n"; 3889 $html .= " <td align=left>\n"; 3890 for ($i = 0; $i < count($var['context'][$filename]); $i++) { 3891 $html .= " <table border=0 cellpadding=0 cellspacing=0>\n"; 3892 /* 3893 if ($i == 0) { 3894 $html .= " <tr>\n"; 3895 $html .= " <td height=6></td>\n"; 3896 $html .= " </tr>\n"; 3897 } 3898 */ 3899 $html .= " <tr>\n"; 3900 $data = explode('.', substr($var['context'][$filename][$i], 0, -3)); 3901 for ($i_ = 0; $i_ < $var['menu']['count']; $i_++) { 3902 for ($j_ = 0; $j_ < $var['menu'][$i_]['count']; $j_++) { 3903 if (count($data) == 2 && $var['menu'][$i_]['name'] == $data[0] && $var['menu'][$i_][$j_]['name'] == $data[1]) { 3904 $color = $var['menu'][$i_]['color']; 3905 $html .= ' <td width=27 height=18><a href=main.php?page=' . str_replace('.', '/', substr($var['context'][$filename][$i], 0, -3)) . '&lang=' . substr($var['context'][$filename][$i], -2); 3906 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 3907 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 3908 $html .= '><img src=images/' . $var['themedir'] . "/icon.page.$color." . $var['themetype'] . ' width=18 height=18 border=0></a><img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . " width=9 height=18></td>\n"; 3909 $html .= ' <td width=6 height=18 background=images/' . $var['themedir'] . "/sitemap.$color.left." . $var['themetype'] . "></td>\n"; 3910 $html .= ' <td height=18 valign=middle background=images/' . $var['themedir'] . "/sitemap.$color.center." . $var['themetype'] . '><a href=main.php?page=' . str_replace('.', '/', substr($var['context'][$filename][$i], 0, -3)) . '&lang=' . substr($var['context'][$filename][$i], -2); 3911 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 3912 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 3913 $html .= ' class=sitemap_public style=color:#' . $var['color']['sitemap'][$color] . '>' . menutoline($var['menu'][$i_][$j_]['title'][$var['lang']]) . "</a></td>\n"; 3914 $html .= ' <td width=6 height=18 background=images/' . $var['themedir'] . "/sitemap.$color.right." . $var['themetype'] . "></td>\n"; 3915 } 3916 else { 3917 for ($k_ = 0; $k_ < $var['menu'][$i_][$j_]['count']; $k_++) { 3918 if (count($data) == 3 && $var['menu'][$i_]['name'] == $data[0] && $var['menu'][$i_][$j_]['name'] == $data[1] && $var['menu'][$i_][$j_][$k_]['name'] == $data[2]) { 3919 $color = $var['menu'][$i_][$j_][$k_]['color']; 3920 $html .= ' <td width=27 height=18><a href=main.php?page=' . str_replace('.', '/', substr($var['context'][$filename][$i], 0, -3)) . '&lang=' . substr($var['context'][$filename][$i], -2); 3921 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 3922 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 3923 $html .= '><img src=images/' . $var['themedir'] . "/icon.page.$color." . $var['themetype'] . ' width=18 height=18 border=0></a><img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . " width=9 height=18></td>\n"; 3924 $html .= ' <td width=6 height=18 background=images/' . $var['themedir'] . "/sitemap.$color.left." . $var['themetype'] . "></td>\n"; 3925 $html .= ' <td height=18 valign=middle background=images/' . $var['themedir'] . "/sitemap.$color.center." . $var['themetype'] . '><a href=main.php?page=' . str_replace('.', '/', substr($var['context'][$filename][$i], 0, -3)) . '&lang=' . substr($var['context'][$filename][$i], -2); 3926 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 3927 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 3928 $html .= ' class=sitemap_public style=color:#' . $var['color']['sitemap'][$color] . '>' . menutoline($var['menu'][$i_][$j_][$k_]['title'][$var['lang']]) . "</a></td>\n"; 3929 $html .= ' <td width=6 height=18 background=images/' . $var['themedir'] . "/sitemap.$color.right." . $var['themetype'] . "></td>\n"; 3930 } 3931 else { 3932 for ($l_ = 0; $l_ < $var['menu'][$i_][$j_][$k_]['count']; $l_++) { 3933 if ($var['menu'][$i_]['name'] == $data[0] && $var['menu'][$i_][$j_]['name'] == $data[1] && $var['menu'][$i_][$j_][$k_]['name'] == $data[2] && $var['menu'][$i_][$j_][$k_][$l_]['name'] == $data[3]) { 3934 $color = $var['menu'][$i_][$j_][$k_]['color']; 3935 $html .= ' <td width=27 height=18><a href=main.php?page=' . str_replace('.', '/', substr($var['context'][$filename][$i], 0, -3)) . '&lang=' . substr($var['context'][$filename][$i], -2); 3936 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 3937 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 3938 $html .= '><img src=images/' . $var['themedir'] . "/icon.page.$color." . $var['themetype'] . ' width=18 height=18 border=0></a><img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . " width=9 height=18></td>\n"; 3939 $html .= ' <td width=6 height=18 background=images/' . $var['themedir'] . "/sitemap.$color.left." . $var['themetype'] . "></td>\n"; 3940 $html .= ' <td height=18 valign=middle background=images/' . $var['themedir'] . "/sitemap.$color.center." . $var['themetype'] . '><a href=main.php?page=' . str_replace('.', '/', substr($var['context'][$filename][$i], 0, -3)) . '&lang=' . substr($var['context'][$filename][$i], -2); 3941 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 3942 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 3943 $html .= ' class=sitemap_public style=color:#' . $var['color']['sitemap'][$color] . '>' . menutoline($var['menu'][$i_][$j_][$k_][$l_]['title'][$var['lang']]) . "</a></td>\n"; 3944 $html .= ' <td width=6 height=18 background=images/' . $var['themedir'] . "/sitemap.$color.right." . $var['themetype'] . "></td>\n"; 3945 } 3946 } 3947 } 3948 } 3949 } 3950 } 3951 } 3952 $html .= " </tr>\n"; 3953 $html .= " <tr>\n"; 3954 $html .= " <td height=6></td>\n"; 3955 $html .= " </tr>\n"; 3956 $html .= " </table>\n"; 3957 } 3958 $html .= " </td>\n"; 3959 $html .= " </tr>\n"; 3960 $html .= "</table>\n"; 3961 3962 return $html; 3963 3964 } 3965 3966 // ----------------------------------------------------------------------------- 3967 3968 function create_alert() { 3969 3970 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 3971 3972 $html .= "<table width=100% border=0 cellpadding=0 cellspacing=0>\n"; 3973 $html .= " <tr>\n"; 3974 $html .= " <td align=center>\n"; 3975 $html .= " <table border=0 cellpadding=0 cellspacing=0>\n"; 3976 $html .= " <tr>\n"; 3977 $html .= ' <td width=6 height=6 background=images/' . $var['themedir'] . '/alert.' . $var['result'] . '.left.top.' . $var['themetype'] . "></td>\n"; 3978 $html .= ' <td width=6 height=6 background=images/' . $var['themedir'] . '/alert.' . $var['result'] . '.center.top.' . $var['themetype'] . "></td>\n"; 3979 $html .= ' <td height=6 background=images/' . $var['themedir'] . '/alert.' . $var['result'] . '.center.top.' . $var['themetype'] . "></td>\n"; 3980 $html .= ' <td width=6 height=6 background=images/' . $var['themedir'] . '/alert.' . $var['result'] . '.center.top.' . $var['themetype'] . "></td>\n"; 3981 $html .= ' <td width=6 height=6 background=images/' . $var['themedir'] . '/alert.' . $var['result'] . '.right.top.' . $var['themetype'] . "></td>\n"; 3982 $html .= " </tr>\n"; 3983 $html .= " <tr>\n"; 3984 $html .= ' <td width=6 background=images/' . $var['themedir'] . '/alert.' . $var['result'] . '.left.middle.' . $var['themetype'] . "></td>\n"; 3985 $html .= " <td width=6 height=6 bgcolor=#ffffff></td>\n"; 3986 $html .= ' <td align=center valign=middle bgcolor=#ffffff>'; 3987 $html .= '<span class=alert style=color:#' . $var['color']['alert'][$var['result']] . '>' . $var['alert'] . '</span>'; 3988 $html .= "</td>\n"; 3989 $html .= " <td width=6 height=6 bgcolor=#ffffff></td>\n"; 3990 $html .= ' <td width=6 background=images/' . $var['themedir'] . '/alert.' . $var['result'] . '.right.middle.' . $var['themetype'] . "></td>\n"; 3991 $html .= " </tr>\n"; 3992 $html .= " <tr>\n"; 3993 $html .= ' <td width=6 height=6 background=images/' . $var['themedir'] . '/alert.' . $var['result'] . '.left.bottom.' . $var['themetype'] . "></td>\n"; 3994 $html .= ' <td width=6 height=6 background=images/' . $var['themedir'] . '/alert.' . $var['result'] . '.center.bottom.' . $var['themetype'] . "></td>\n"; 3995 $html .= ' <td height=6 background=images/' . $var['themedir'] . '/alert.' . $var['result'] . '.center.bottom.' . $var['themetype'] . "></td>\n"; 3996 $html .= ' <td width=6 height=6 background=images/' . $var['themedir'] . '/alert.' . $var['result'] . '.center.bottom.' . $var['themetype'] . "></td>\n"; 3997 $html .= ' <td width=6 height=6 background=images/' . $var['themedir'] . '/alert.' . $var['result'] . '.right.bottom.' . $var['themetype'] . "></td>\n"; 3998 $html .= " </tr>\n"; 3999 $html .= " </table>\n"; 4000 $html .= " </td>\n"; 4001 $html .= " </tr>\n"; 4002 $html .= "</table>\n"; 4003 4004 return $html; 4005 4006 } 4007 4008 // ----------------------------------------------------------------------------- 4009 4010 function create_label($title, $size) { 4011 4012 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 4013 4014 if ($size == 'large') 4015 $width = '768'; 4016 else if ($size == 'small') 4017 $width = '384'; 4018 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 4019 $html .= " <tr>\n"; 4020 $html .= " <td width=$width height=18 align=center valign=middle background=images/" . $var['themedir'] . "/label.$size." . $var['themetype'] . "><span class=input>$title</span></td>\n"; 4021 $html .= " </tr>\n"; 4022 $html .= "</table>\n"; 4023 4024 return $html; 4025 4026 } 4027 4028 // ----------------------------------------------------------------------------- 4029 4030 function create_input($title, $name, $value, $size) { 4031 4032 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 4033 4034 if ($size == 'large') 4035 $width = 622; 4036 else if ($size == 'small') 4037 $width = 238; 4038 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 4039 $html .= " <tr>\n"; 4040 if ($name != 'description' && $name != 'comment' && $name != 'message' && $name != 'header' && $name != 'footer') { 4041 $html .= " <td width=128>\n"; 4042 $html .= " <table border=0 cellpadding=0 cellspacing=0>\n"; 4043 $html .= " <tr>\n"; 4044 $html .= " <td></td>\n"; 4045 $html .= " </tr>\n"; 4046 $html .= " <tr>\n"; 4047 $html .= ' <td width=128 height=18 align=middle valign=middle background=images/' . $var['themedir'] . '/label.input.' . $var['themetype'] . "><span class=input>$title</span></td>\n"; 4048 $html .= " </tr>\n"; 4049 $html .= " <tr>\n"; 4050 $html .= " <td></td>\n"; 4051 $html .= " </tr>\n"; 4052 $html .= " </table>\n"; 4053 $html .= " </td>\n"; 4054 } 4055 else { 4056 if ($name != 'message' || $var['this_page']['name'] != 'send') 4057 $height = 180; 4058 else 4059 $height = 360; 4060 $html .= " <td width=128 height=$height>\n"; 4061 $html .= " <table border=0 cellpadding=0 cellspacing=0>\n"; 4062 $html .= " <tr>\n"; 4063 $html .= ' <td width=128 height=18 align=middle valign=middle background=images/' . $var['themedir'] . '/label.input.' . $var['themetype'] . "><span class=input>$title</span></td>\n"; 4064 $html .= " </tr>\n"; 4065 $html .= " <tr>\n"; 4066 $html .= ' <td width=128 height=' . ($height - 18) . "></td>\n"; 4067 $html .= " </tr>\n"; 4068 $html .= " </table>\n"; 4069 $html .= " </td>\n"; 4070 } 4071 $html .= " <td width=18 height=18></td>\n"; 4072 $html .= " <td width=$width height=18><"; 4073 if (($var['this_page']['name'] != 'news' && $var['this_page']['name'] != 'subscription' && $var['this_page']['name'] != 'send' && $var['this_page']['name'] != 'subscribers') || ($name != 'status' && substr($name, 0, 7) != 'filter_')) { 4074 if ($name != 'description' && $name != 'comment' && $name != 'message' && $name != 'header' && $name != 'footer') { 4075 $html .= 'input '; 4076 if ($name == 'password' || $name == 'repeat') 4077 $html .= 'type=password '; 4078 if ($var['status'] == 'script' && ($var['this_page']['name'] == 'trash' || ($var['this_page']['name'] == 'templates' && $value == 'default') || ($var['status'] == 'script' && $var['this_page']['name'] == 'system_files' && $name == 'name'))) 4079 $html .= 'readonly '; 4080 $html .= "name=form_$name value=\"" . strtoform($value) . '" style='; 4081 if ($name == 'summary' || $name == 'category' || $name == 'priority' || $name == 'status') 4082 $html .= 'font-weight:bold;'; 4083 if ($name == 'category' || $name == 'priority' || $name == 'status') 4084 $html .= 'color:#' . $var['color']['text'][$var['bug'][$name][$var['bugdata'][$name . '_number']]['color']] . ';'; 4085 $html .= "width:$width" . 'px>'; 4086 } 4087 else { 4088 $html .= "textarea name=form_$name class=textarea_"; 4089 if ($name == 'description' || $name == 'comment') 4090 $html .= 'text'; 4091 else 4092 $html .= 'mono'; 4093 $html .= " style=width:$width" . "px;height:$height" . 'px>' . strtohtml($value) . '</textarea>'; 4094 } 4095 } 4096 else { 4097 $html .= "select name=form_$name style=width:$width" . 'px;height:18px;>'; 4098 if ($name == 'status') { 4099 if ($var['this_page']['name'] == 'news') { 4100 $html .= '<option '; 4101 if ($value == 'public') 4102 $html .= 'selected '; 4103 $html .= 'value=public>public</option>'; 4104 $html .= '<option '; 4105 if ($value == 'hidden') 4106 $html .= 'selected '; 4107 $html .= 'value=hidden>hidden</option>'; 4108 } 4109 else { 4110 $html .= '<option '; 4111 if ($value == 'subscribed') 4112 $html .= 'selected '; 4113 $html .= 'value=subscribed>subscribed</option>'; 4114 $html .= '<option '; 4115 if ($value == 'suspended') 4116 $html .= 'selected '; 4117 $html .= 'value=suspended>suspended</option>'; 4118 $html .= '<option '; 4119 if ($value == 'unsubscribed') 4120 $html .= 'selected '; 4121 $html .= 'value=unsubscribed>unsubscribed</option>'; 4122 } 4123 } 4124 else { 4125 $html .= '<option '; 4126 if ($value == 'off') 4127 $html .= 'selected '; 4128 $html .= 'value=off>Off</option>'; 4129 $html .= '<option '; 4130 if ($value == 'on') 4131 $html .= 'selected '; 4132 $html .= 'value=on>On</option>'; 4133 $html .= '</select>'; 4134 } 4135 } 4136 $html .= "</td>\n"; 4137 $html .= " </tr>\n"; 4138 $html .= "</table>\n"; 4139 4140 return $html; 4141 4142 } 4143 4144 // ----------------------------------------------------------------------------- 4145 4146 function create_option($title, $name, $values, $value, $size) { 4147 4148 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 4149 4150 if ($size == 'large') 4151 $width = 622; 4152 else if ($size == 'small') 4153 $width = 238; 4154 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 4155 $html .= " <tr>\n"; 4156 $html .= " <td width=128>\n"; 4157 $html .= " <table border=0 cellpadding=0 cellspacing=0>\n"; 4158 $html .= " <tr>\n"; 4159 $html .= " <td></td>\n"; 4160 $html .= " </tr>\n"; 4161 $html .= " <tr>\n"; 4162 $html .= ' <td width=128 height=18 align=middle valign=middle background=images/' . $var['themedir'] . '/label.input.' . $var['themetype'] . "><span class=input>$title</span></td>\n"; 4163 $html .= " </tr>\n"; 4164 $html .= " <tr>\n"; 4165 $html .= " <td></td>\n"; 4166 $html .= " </tr>\n"; 4167 $html .= " </table>\n"; 4168 $html .= " </td>\n"; 4169 $html .= " <td width=18 height=18></td>\n"; 4170 $html .= " <td width=$width height=18>\n"; 4171 $html .= " <select name=form_$name class=select_text style=width:$width" . "px;height:18px>\n"; 4172 reset($values); 4173 while (list($k, $v) = each($values)) { 4174 if ($var['this_page']['name'] == 'bugs') { 4175 $html .= ' <option value=' . $v['name']. ' style=color:' . $var['color']['text'][$v['color']]; 4176 if ($v['name'] == $value) 4177 $html .= ' selected'; 4178 $html .= '>' . $v['title'][$var['lang']] . "</option>\n"; 4179 } 4180 else { 4181 $html .= " <option value=$k"; 4182 if ($k == $value) 4183 $html .= ' selected'; 4184 $html .= '>' . $v['title'][$var['lang']] . "</option>\n"; 4185 } 4186 } 4187 $html .= " </select>\n"; 4188 $html .= " </td>\n"; 4189 $html .= " </tr>\n"; 4190 $html .= "</table>\n"; 4191 4192 return $html; 4193 4194 } 4195 4196 // ----------------------------------------------------------------------------- 4197 4198 function create_box($name) { 4199 4200 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 4201 4202 if ($name != 'tags') 4203 $dirname = $name; 4204 else 4205 $filename = $name; 4206 4207 if ($dirname == 'filters' || $dirname == 'subscribers') 4208 $var['box'] = read_dir("data/newsletter/$dirname"); 4209 else if ($dirname == 'sent' || $dirname == 'unsent') 4210 $var['box'] = read_dir("data/newsletter/messages/$dirname"); 4211 else if ($dirname) 4212 $var['box'] = read_dir("data/$dirname"); 4213 else { 4214 // after a POST request, $var['box'] contains the current url -- no idea why... 4215 if ($var['box']) 4216 unset($var['box']); 4217 $filedata = read_file("data/system/$filename.dat"); 4218 reset($filedata); 4219 while (list($k, $v) = each($filedata)) { 4220 $var['box'][count($var['box'])] = $filedata[$k]; 4221 $var['box'][count($var['box']) - 1]['name'] = $k; 4222 } 4223 $var['files_total'] = count($var['box']); 4224 } 4225 if ($dirname == 'bugs' || $dirname == 'accounts' || $dirname == 'addresses' || $dirname == 'links' || $dirname == 'filters') 4226 $html .= create_label($var['files_total'] . ' ' . $var['label'][$dirname][$var['lang']], 'large'); 4227 else if ($dirname == 'news' || $dirname == 'templates' || $dirname == 'images' || $dirname == 'documents') 4228 $html .= create_label($var['files_total'] . ' ' . $var['label'][$dirname][$var['lang']] . ' / ' . $var['kilobytes_total'], 'large'); 4229 else if ($dirname == 'sent' || $dirname == 'unsent') 4230 $html .= create_label($var['files_total'] . ' ' . $var['label']['messages'][$var['lang']] . ' / ' . $var['kilobytes_total'], 'large'); 4231 else if ($dirname == 'subscribers') 4232 $html .= create_label($var['files_total'] . ' ' . $var['label']['subscribers'][$var['lang']] . ' - ' . $var['subscribed_total'] . ' ' . $var['label']['subscribed'][$var['lang']] . ' / ' . $var['suspended_total'] . ' ' . $var['label']['suspended'][$var['lang']] . ' / ' . $var['unsubscribed_total'] . ' ' . $var['label']['unsubscribed'][$var['lang']], 'large'); 4233 else if ($dirname == 'trash') 4234 $html .= create_label($var['files_total'] . ' ' . $var['label']['files'][$var['lang']] . ' / ' . $var['kilobytes_total'], 'large'); 4235 else if ($dirname == 'system') 4236 $html .= create_label($var['files_total'] . ' ' . $var['label']['system_files'][$var['lang']] . ' / ' . $var['kilobytes_total'], 'large'); 4237 else if ($filename == 'tags') 4238 $html .= create_label($var['files_total'] . ' ' . $var['label']['tags'][$var['lang']], 'large'); 4239 $html .= create_space(); 4240 if ($var['files_total']) { 4241 if (!$var['sort']) { 4242 if ($dirname == 'sent' || $dirname == 'unsent') 4243 $var['sort'] = 'date'; 4244 else if ($dirname != 'bugs') 4245 $var['sort'] = 'name'; 4246 else 4247 $var['sort'] = 'id'; 4248 } 4249 $var['listsort'] = $var['sort']; 4250 $html .= create_select('listsort'); 4251 $html .= create_space(); 4252 $html .= '<select name=box size=' . $var['preference']['box_size'] . " onChange=document.location=this.options[this.selectedIndex].value class=select_mono>\n"; 4253 if ($var['this_page']['name'] == 'bugs') 4254 $name = 'id'; 4255 else if ($var['this_page']['name'] == 'accounts') 4256 $name = 'username'; 4257 else 4258 $name = 'name'; 4259 for ($i = 0; $i < count($var['box']); $i++) { 4260 if ($var['sort'] == 'name') 4261 $sort[$i] = strtolower($var['box'][$i][$name]); 4262 else if ($var['sort'] == 'domain') 4263 $sort[$i] = $var['box'][$i][$var['sort']] . ' ' . strtolower($var['box'][$i][$name]); 4264 else if ($var['sort'] == 'country') { 4265 if ($var['this_page']['name'] == 'addresses') 4266 $sort[$i] = $var['box'][$i][$var['sort'] . '_short'] . ' ' . strtolower($var['box'][$i][$name]); 4267 else if ($var['this_page']['name'] == 'subscribers') 4268 $sort[$i] = $var['box'][$i][$var['sort']] . ' ' . strtolower($var['box'][$i][$name]); 4269 } 4270 else if ($var['sort'] == 'subject') 4271 $sort[$i] = strtolower($var['box'][$i][$var['sort']]) . ' ' . strtolower($var['box'][$i][$name]); 4272 else if ($var['sort'] == 'from') 4273 $sort[$i] = strtolower($var['box'][$i][$var['sort']]) . ' ' . strtolower($var['box'][$i][$name]); 4274 else if ($var['sort'] == 'category') { 4275 if ($var['this_page']['name'] == 'bugs') 4276 $sort[$i] = $var['box'][$i][$var['sort'] . '_number'] . ' ' . str_repeat('0', 3 - strlen($var['box'][$i][$name])) . strtolower($var['box'][$i][$name]); 4277 else if ($var['this_page']['name'] == 'addresses') 4278 $sort[$i] = $var['box'][$i][$var['sort'] . '_short'] . ' ' . strtolower($var['box'][$i][$name]); 4279 } 4280 else if ($var['sort'] == 'priority') 4281 $sort[$i] = $var['box'][$i][$var['sort'] . '_number'] . ' ' . str_repeat('0', 3 - strlen($var['box'][$i][$name])) . strtolower($var['box'][$i][$name]); 4282 else if ($var['sort'] == 'status') { 4283 if ($var['this_page']['name'] == 'bugs') 4284 $sort[$i] = $var['box'][$i][$var['sort'] . '_number'] . ' ' . str_repeat('0', 3 - strlen($var['box'][$i][$name])) . strtolower($var['box'][$i][$name]); 4285 else if ($var['this_page']['name'] == 'news') 4286 $sort[$i] = $var['box'][$i][$var['sort']]; 4287 else if ($var['this_page']['name'] == 'subscribers') 4288 $sort[$i] = $var['box'][$i][$var['sort']] . ' ' . strtolower($var['box'][$i][$name]); 4289 } 4290 else if ($var['sort'] == 'filters') 4291 $sort[$i] = $var['box'][$i]['filters_short'] . ' ' . strtolower($var['box'][$i][$name]); 4292 else if ($var['sort'] == 'date') 4293 $sort[$i] = $var['box'][$i]['time']; 4294 else if ($var['sort'] == 'first') 4295 $sort[$i] = $var['box'][$i]['firsttime']; 4296 else if ($var['sort'] == 'last') 4297 $sort[$i] = $var['box'][$i]['lasttime']; 4298 else 4299 $sort[$i] = $var['box'][$i][$var['sort']]; 4300 } 4301 if ($var['sort'] == 'id' || $var['sort'] == 'name' || $var['sort'] == 'domain' || $var['sort'] == 'country' || $var['sort'] == 'subject' || $var['sort'] == 'from' || $var['sort'] == 'type' || $var['sort'] == 'category' || $var['sort'] == 'status' || $var['sort'] == 'filters') 4302 asort($sort); 4303 else 4304 arsort($sort); 4305 while (list($k, $v) = each($sort)) { 4306 $html .= ' <option '; 4307 if ($var['this_page']['name'] != 'trash') { 4308 if ($var['box'][$k][$name] == $var['view']) 4309 $html .= 'selected '; 4310 } 4311 else { 4312 if ($var['box'][$k][$name] == $var['view'] && $var['box'][$k]['type'] == $var['type']) 4313 $html .= 'selected '; 4314 } 4315 $html .= 'value=main.php?page=' . $var['page'] . '&lang=' . $var['lang'] . '&view=' . $var['box'][$k][$name]; 4316 if ($var['this_page']['name'] == 'trash') 4317 $html .= '&type=' . $var['box'][$k]['type']; 4318 $html .= '&sort=' . $var['sort']; 4319 if ($var['mode']) 4320 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 4321 if ($var['sort'] == 'category' || $var['sort'] == 'priority' || $var['sort'] == 'status') 4322 $html .= ' style=color:#' . $var['color']['text'][$var['bug'][$var['sort']][$v]['color']]; 4323 $html .= '>'; 4324 if ($dirname == 'bugs') { 4325 $html .= str_repeat(' ', 3 - strlen($var['box'][$k]['id'])) . $var['box'][$k]['id'] . ' | '; 4326 if (strlen($var['box'][$k]['name']) <= 50) 4327 $html .= strtohtml($var['box'][$k]['name']) . str_repeat(' ', 50 - strlen($var['box'][$k]['name'])); 4328 else 4329 $html .= strtohtml(substr($var['box'][$k]['name'], 0, 47)) . '...'; 4330 $html .= ' | ' . $var['box'][$k]['category_short'] . ' | ' . $var['box'][$k]['priority_short'] . ' | ' . $var['box'][$k]['status_short'] . ' | ' . str_repeat(' ', 3 - strlen($var['box'][$k]['comments'])) . $var['box'][$k]['comments']; 4331 } 4332 else if ($dirname == 'accounts') { 4333 if (strlen($var['box'][$k][$name]) <= 64) 4334 $html .= $var['box'][$k][$name] . str_repeat(' ', 64 - strlen($var['box'][$k][$name])); 4335 else 4336 $html .= substr($var['box'][$k][$name], 0, 61) . '...'; 4337 $html .= ' | ' . str_repeat(' ', 9 - strlen($var['box'][$k]['logged_in'])) . $var['box'][$k]['logged_in']; 4338 } 4339 else if ($dirname == 'news') { 4340 if (strlen($var['box'][$k]['name']) <= 67) 4341 $html .= $var['box'][$k]['name'] . str_repeat(' ', 67 - strlen($var['box'][$k]['name'])); 4342 else 4343 $html .= substr($var['box'][$k]['name'], 0, 64) . '...'; 4344 $html .= ' | ' . $var['box'][$k]['status']; 4345 } 4346 else if ($dirname == 'templates' || $var['this_page']['name'] == 'documents' || $var['this_page']['name'] == 'system_files') { 4347 if (strlen($var['box'][$k]['name']) <= 64) 4348 $html .= $var['box'][$k]['name'] . str_repeat(' ', 64 - strlen($var['box'][$k]['name'])); 4349 else 4350 $html .= substr($var['box'][$k]['name'], 0, 61) . '...'; 4351 $html .= ' | ' . str_repeat(' ', 9 - strlen($var['box'][$k]['kilobytes'])) . $var['box'][$k]['kilobytes']; 4352 } 4353 else if ($dirname == 'images') { 4354 if (strlen($var['box'][$k]['name']) <= 52) 4355 $html .= $var['box'][$k]['name'] . str_repeat(' ', 52 - strlen($var['box'][$k]['name'])); 4356 else 4357 $html .= substr($var['box'][$k]['name'], 0, 49) . '...'; 4358 $html .= ' | ' . $var['box'][$k]['pixels'] . ' | ' . str_repeat(' ', 9 - strlen($var['box'][$k]['kilobytes'])) . $var['box'][$k]['kilobytes']; 4359 } 4360 else if ($dirname == 'addresses') { 4361 if (strlen($var['box'][$k][$name]) <= 65) 4362 $html .= $var['box'][$k][$name] . str_repeat(' ', 65 - strlen($var['box'][$k][$name])); 4363 else 4364 $html .= substr($var['box'][$k][$name], 0, 62) . '...'; 4365 $html .= ' | ' . $var['box'][$k]['category_short'] . ' | ' . $var['box'][$k]['country_short']; 4366 } 4367 else if ($dirname == 'links') { 4368 if (strlen($var['box'][$k][$name]) <= 76) 4369 $html .= $var['box'][$k][$name] . str_repeat(' ', 76 - strlen($var['box'][$k][$name])); 4370 else 4371 $html .= substr($var['box'][$k][$name], 0, 73) . '...'; 4372 } 4373 else if ($dirname == 'filters') { 4374 if (strlen($var['box'][$k][$name]) <= 76) 4375 $html .= $var['box'][$k][$name] . str_repeat(' ', 76 - strlen($var['box'][$k][$name])); 4376 else 4377 $html .= substr($var['box'][$k][$name], 0, 73) . '...'; 4378 } 4379 else if ($dirname == 'sent' || $dirname == 'unsent') { 4380 if (strlen($var['box'][$k]['subject']) <= 40) 4381 $html .= strtohtml($var['box'][$k]['subject']) . str_repeat(' ', 40 - strlen($var['box'][$k]['subject'])); 4382 else 4383 $html .= strtohtml(substr($var['box'][$k]['subject'], 0, 37)) . '...'; 4384 $html .= ' | '; 4385 if (strlen($var['box'][$k]['from']) <= 24) 4386 $html .= strtohtml($var['box'][$k]['from']) . str_repeat(' ', 24 - strlen($var['box'][$k]['from'])); 4387 else 4388 $html .= strtohtml(substr($var['box'][$k]['from'], 0, 21)) . '...'; 4389 $html .= ' | ' . str_repeat(' ', 6 - strlen($var['box'][$k]['kilobytes'])) . $var['box'][$k]['kilobytes']; 4390 } 4391 else if ($dirname == 'subscribers') { 4392 if (strlen($var['box'][$k][$name]) <= 47) 4393 $html .= $var['box'][$k][$name] . str_repeat(' ', 47 - strlen($var['box'][$k][$name])); 4394 else 4395 $html .= substr($var['box'][$k][$name], 0, 44) . '...'; 4396 $html .= ' | ' . $var['label'][$var['box'][$k]['status']][$var['lang']] . str_repeat(' ', 12 - strlen($var['label'][$var['box'][$k]['status']][$var['lang']])) . ' | ' . $var['box'][$k]['filters_short'] . str_repeat(' ', 11 - strlen($var['box'][$k]['filters_short'])); 4397 } 4398 else if ($dirname == 'trash') { 4399 if (strlen($var['box'][$k]['name']) <= 51) 4400 $html .= $var['box'][$k]['name'] . str_repeat(' ', 53 - strlen($var['box'][$k]['name'])); 4401 else 4402 $html .= substr($var['box'][$k]['name'], 0, 48) . '...'; 4403 $html .= ' | ' . str_repeat(' ', 10 - strlen($var['box'][$k]['type'])) . $var['box'][$k]['type'] . ' | ' . str_repeat(' ', 9 - strlen($var['box'][$k]['kilobytes'])) . $var['box'][$k]['kilobytes']; 4404 } 4405 else if ($filename == 'tags') 4406 $html .= $var['box'][$k]['name']; 4407 if ($dirname) { 4408 if ($dirname != 'bugs') 4409 $html .= ' | ' . $var['box'][$k]['date']; 4410 else 4411 $html .= ' | ' . $var['box'][$k]['first'] . ' | ' . $var['box'][$k]['last']; 4412 } 4413 $html .= "</option>\n"; 4414 } 4415 $html .= "</select>\n"; 4416 } 4417 4418 return $html; 4419 4420 } 4421 4422 // ----------------------------------------------------------------------------- 4423 4424 function create_select($select) { 4425 4426 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 4427 4428 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 4429 $html .= " <tr>\n"; 4430 for ($i = 0; $i < count($var['select'][$select]); $i++) { 4431 if ($select == 'tabcolor') { 4432 // echo $var['select'][$select][$i]['name'] . '=' . $var['preference']['menu_colors'] . '<br>'; 4433 if ($var['select'][$select][$i]['name'] == 'orange' && $var['preference']['menu_colors'] == 6) 4434 break; 4435 if ($var['select'][$select][$i]['name'] == 'pink' && $var['preference']['menu_colors'] == 13) 4436 $i += 13; 4437 if ($var['select'][$select][$i]['name'] == 'coal' && $var['preference']['menu_colors'] == 13) 4438 break; 4439 } 4440 else if ($select == 'listsort') { 4441 // echo $var['this_page']['name'] . ':' . $var['listsort'][$var['this_page']['name']][0] . '<br>'; 4442 while ($i < count($var['select'][$select]) && !in_array($var['select'][$select][$i]['name'], $var['sortoption'][$var['this_page']['name']])) 4443 $i++; 4444 if ($i == count($var['select'][$select])) 4445 break; 4446 } 4447 $html .= " <td width=6 height=18></td>\n"; 4448 $html .= ' <td width=60 height=18 align=center valign=middle background=images/' . $var['themedir'] . '/label.button.' . $var['select'][$select][$i]['color'] . '.'; 4449 if ($var[$select] == $var['select'][$select][$i]['name']) 4450 $html .= 'on'; 4451 else 4452 $html .= 'off'; 4453 $html .= '.' . $var['themetype'] . '><span class=button style=color:#'; 4454 if ($var[$select] == $var['select'][$select][$i]['name']) 4455 $html .= $var['color']['label'][$var['select'][$select][$i]['color']]['on']; 4456 else 4457 $html .= $var['color']['label'][$var['select'][$select][$i]['color']]['off']; 4458 $html .= '>' . $var['select'][$select][$i]['title'][$var['lang']] . "</span></td>\n"; 4459 $html .= " <td width=6 height=18></td>\n"; 4460 $html .= ' <td width=18 height=18>'; 4461 if ($var[$select] == $var['select'][$select][$i]['name']) 4462 $html .= '<img src=images/' . $var['themedir'] . "/select.$select." . $var['select'][$select][$i]['name'] . '.on.' . $var['themetype'] . ' width=18 height=18>'; 4463 else 4464 $html .= "<input type=image name=form_button_$select" . '_' . $var['select'][$select][$i]['name'] . ' src=images/' . $var['themedir'] . "/select.$select." . $var['select'][$select][$i]['name'] . '.off.' . $var['themetype'] . ' width=18 height=18 class=button>'; 4465 $html .= "</td>\n"; 4466 $html .= " <td width=6 height=18></td>\n"; 4467 if (($select == 'tabcolor' && $i % 7 == 6) || ($select == 'columns' && $i == 6)) { 4468 $html .= " </tr>\n"; 4469 $html .= "</table>\n"; 4470 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 4471 $html .= " <tr>\n"; 4472 $html .= " <td height=9></td>\n"; 4473 $html .= " </tr>\n"; 4474 $html .= "</table>\n"; 4475 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 4476 $html .= " <tr>\n"; 4477 } 4478 } 4479 $html .= " </tr>\n"; 4480 $html .= "</table>\n"; 4481 4482 return $html; 4483 4484 } 4485 4486 // ----------------------------------------------------------------------------- 4487 4488 function create_submit($submit) { 4489 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 4490 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 4491 $html .= " <tr>\n"; 4492 for ($i = 0; $i < count($submit); $i++) { 4493 $html .= " <td width=6 height=18></td>\n"; 4494 $html .= ' <td width=60 height=18 align=center valign=middle background=images/' . $var['themedir'] . '/label.button.' . $var['submit'][$submit[$i]]['color'] . '.off.' . $var['themetype'] . '><span class=button style=color:#' . $var['color']['label'][$var['submit'][$submit[$i]]['color']]['off'] . '>' . $var['submit'][$submit[$i]][$var['lang']] . "</span></td>\n"; 4495 $html .= " <td width=6 height=18></td>\n"; 4496 $html .= " <td width=18 height=18><input type=image name=form_button_$submit[$i] src=images/" . $var['themedir'] . "/submit.$submit[$i]." . $var['themetype'] . " width=18 height=18 class=button></td>\n"; 4497 $html .= " <td width=6 height=18></td>\n"; 4498 } 4499 $html .= " </tr>\n"; 4500 $html .= "</table>\n"; 4501 return $html; 4502 } 4503 4504 // ----------------------------------------------------------------------------- 4505 4506 function create_upload() { 4507 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 4508 $html .= '<form name=upload enctype=multipart/form-data action=main.php?page=' . $var['page'] . '&lang=' . $var['lang'] . '&view=' . $var['view']; 4509 if ($var['sort']) 4510 $html .= '&sort=' . $var['sort']; 4511 $html .= '&mode=admin&ssid=' . $var['ssid'] . " method=post>\n"; 4512 $html .= "<input type=hidden name=form value=1>\n"; 4513 $html .= '<input type=hidden name=MAX_FILE_SIZE value=' . $var['document_max_size'] . ">\n"; 4514 $html .= "<input name=form_file type=file>\n"; 4515 $html .= create_space(); 4516 $html .= create_submit(array('cancel', 'upload')); 4517 $html .= "</form>\n"; 4518 return $html; 4519 } 4520 4521 // ----------------------------------------------------------------------------- 4522 4523 function create_import() { 4524 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 4525 if (!$var['receipt']) 4526 $html .= create_label($var['label']['import'][$var['lang']], 'large'); 4527 else 4528 $html .= create_label($var['label']['results'][$var['lang']], 'large'); 4529 $html .= create_space(); 4530 $html .= '<form name=import action=main.php?page=' . $var['page'] . '&lang=' . $var['lang'] . '&view=' . $var['view']; 4531 if ($var['sort']) 4532 $html .= '&sort=' . $var['sort']; 4533 $html .= '&mode=admin&ssid=' . $var['ssid'] . " method=post>\n"; 4534 $html .= "<input type=hidden name=form value=1>\n"; 4535 $html .= '<textarea name=form_import wrap=off class=textarea_text style=width:768px;height:' . $var['preference']['column_height'] . 'px>'; 4536 if (!$var['receipt']) { 4537 if ($var['this_page']['name'] == 'addresses' || $var['this_page']['name'] == 'links') { 4538 if ($var['this_page']['name'] == 'addresses') 4539 $singular = 'address'; 4540 else 4541 $singular = 'link'; 4542 if ($var['preference']['importexport_filenames'] == 'with') 4543 $start = 0; 4544 else 4545 $start = 1; 4546 for ($i = $start; $i < count($var['database'][$singular]); $i++) { 4547 if ($i > $start) 4548 $html .= $var['delimiter'][$var['preference']['importexport_delimiter']]; 4549 $html .= $var['database'][$singular][$i]['title'][$var['lang']]; 4550 if (strstr('title organization_1 organization_2 city state country description', $var['database'][$singular][$i]['name'])) 4551 $html .= ' [en]' . $var['delimiter'][$var['preference']['importexport_delimiter']] . $var['database'][$singular][$i]['title'][$var['lang']] . ' [de]'; 4552 } 4553 $html .= "\n"; 4554 } 4555 else { 4556 $html .= $var['import_subscribers'][$var['lang']] . "\n"; 4557 } 4558 } 4559 else { 4560 for ($i = 0; $i < count($var['receipt']); $i++) { 4561 if ($i > 0) 4562 $html .= "\n"; 4563 $html .= $var['receipt'][$i]; 4564 } 4565 } 4566 $html .= "</textarea>\n"; 4567 if (!$var['receipt']) { 4568 $html .= create_space(); 4569 $html .= create_submit(array('cancel', 'upload')); 4570 } 4571 // $html .= "</form>\n"; 4572 return $html; 4573 } 4574 4575 // ----------------------------------------------------------------------------- 4576 4577 function create_export() { 4578 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 4579 $html .= create_label($var['label']['export'][$var['lang']], 'large'); 4580 $html .= create_space(); 4581 $html .= '<textarea wrap=off readonly class=textarea_text style=width:768px;height:' . $var['preference']['column_height'] . 'px>'; 4582 if ($var['this_page']['name'] == 'addresses' || $var['this_page']['name'] == 'links') { 4583 if ($var['this_page']['name'] == 'addresses') 4584 $singular = 'address'; 4585 else 4586 $singular = 'link'; 4587 if ($var['preference']['importexport_filenames'] == 'with') 4588 $start = 0; 4589 else 4590 $start = 1; 4591 for ($i = $start; $i < count($var['database'][$singular]); $i++) { 4592 if ($i > $start) 4593 $html .= $var['delimiter'][$var['preference']['importexport_delimiter']]; 4594 $html .= $var['database'][$singular][$i]['title'][$var['lang']]; 4595 if (strstr('title organization_1 organization_2 city state country description', $var['database'][$singular][$i]['name'])) 4596 $html .= ' [en]' . $var['delimiter'][$var['preference']['importexport_delimiter']] . $var['database'][$singular][$i]['title'][$var['lang']] . ' [de]'; 4597 } 4598 for ($i = 0; $i < count($var['box']); $i++) { 4599 if ($var['sort'] == 'name') 4600 $sort[$i] = strtolower($var['box'][$i]['name']); 4601 else if ($var['sort'] == 'category') 4602 $sort[$i] = $var['box'][$i]['category']; 4603 else if ($var['sort'] == 'country') 4604 $sort[$i] = $var['box'][$i]['country']; 4605 else if ($var['sort'] == 'date') 4606 $sort[$i] = $var['box'][$i]['time']; 4607 } 4608 if ($var['sort'] == 'name') 4609 asort($sort); 4610 else 4611 arsort($sort); 4612 while (list($k, $v) = each($sort)) { 4613 $html .= "\n"; 4614 $i = 0; 4615 $filedata = read_file('data/' . $var['this_page']['name'] . '/' . $var['box'][$k]['name'] . '.dat'); 4616 reset($filedata); 4617 while (list($k_, $v_) = each($filedata)) { 4618 if ($i == 0 && $var['preference']['importexport_filenames'] == 'with') 4619 $html .= $var['box'][$k]['name'] . $var['delimiter'][$var['preference']['importexport_delimiter']]; 4620 if ($i > 0) 4621 $html .= $var['delimiter'][$var['preference']['importexport_delimiter']]; 4622 if ($k_ != 'title' && $k_ != 'organization_1' && $k_ != 'organization_2' && $k_ != 'city' && $k_ != 'state' && $k_ != 'country' && $k_ != 'description') 4623 $html .= $filedata[$k_]; 4624 else 4625 $html .= $filedata[$k_]['en'] . $var['delimiter'][$var['preference']['importexport_delimiter']] . $filedata[$k_]['de']; 4626 $i++; 4627 } 4628 } 4629 } 4630 else { 4631 for ($i = 0; $i < count($var['box']); $i++) { 4632 if ($i > 0) 4633 $html .= "\n"; 4634 $html .= $var['box'][$i]['name']; 4635 } 4636 } 4637 $html .= "</textarea>\n"; 4638 return $html; 4639 } 4640 4641 // ----------------------------------------------------------------------------- 4642 4643 function create_cell($cell, $filename = '') { 4644 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 4645 if ($cell == 'news' || $cell == 'more') 4646 $width = 756; 4647 else if ($cell == 'committee') 4648 $width = 561; 4649 else if ($cell == 'about') 4650 $width = 366; 4651 else 4652 $width = 171; 4653 if ($cell == 'news' || $cell == 'more') 4654 $height = 21; 4655 else if ($cell == 'best practices' || $cell == 'newsletter') 4656 $height = 366; 4657 else 4658 $height = 171; 4659 $html .= $var['space'] . "<table border=0 cellpadding=0 cellspacing=0>\n"; 4660 $html .= $var['space'] . " <tr>\n"; 4661 $html .= $var['space'] . ' <td width=6 height=6 background=images/' . $var['themedir'] . '/cell.left.top.' . $var['themetype'] . "></td>\n"; 4662 $html .= $var['space'] . ' <td width=$width height=6 background=images/' . $var['themedir'] . '/cell.center.top.' . $var['themetype'] . "></td>\n"; 4663 $html .= $var['space'] . ' <td width=6 height=6 background=images/' . $var['themedir'] . '/cell.right.top.' . $var['themetype'] . "></td>\n"; 4664 $html .= $var['space'] . " </tr>\n"; 4665 $html .= $var['space'] . " <tr>\n"; 4666 $html .= $var['space'] . ' <td width=6 background=images/' . $var['themedir'] . '/cell.left.middle.' . $var['themetype'] . "></td>\n"; 4667 $html .= $var['space'] . " <td width=$width height=$height align=center valign=middle bgcolor=#ffffff>\n"; 4668 if ($cell != 'news' && $cell != 'more') 4669 $html .= $var['space'] . ' <img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . " width=6 height=6><br>\n"; 4670 if ($cell == 'news') { 4671 $list = read_file("data/news/$filename"); 4672 $html .= $var['space'] . ' <span class=text_small>' . $list['text'][$var['lang']] . ' <a href=main.php?redirect=' . $list['link']; 4673 if (!strstr($list['link'], 'www.bestpractices.at/data/documents/')) 4674 $html .= urlencode('&lang=') . $var['lang']; 4675 $html .= ">>>></a></span>\n"; 4676 } 4677 else if ($cell == 'more') 4678 $html .= $var['space'] . ' <span class=text_small><a href=main.php?page=publications/un_habitat_news&lang=' . $var['lang'] . ' style="color: #000066">' . $var['label']['more_news'][$var['lang']] . " >>></a></span>\n"; 4679 else if ($cell == 'best practices') { 4680 $html .= $var['space'] . ' <span class=text_small>' . $var['overview']['vienna'][$var['lang']] . ' <a href=main.php?page=vienna/overview&lang=' . $var['lang'] . ">>>></a></span><br><br>\n"; 4681 $html .= $var['space'] . ' <a href=main.php?page=vienna/overview&lang=' . $var['lang'] . "><img src=data/images/best_practices_vienna_2004.jpg width=150 height=225 border=0></a><br><br>\n"; 4682 $html .= $var['space'] . ' <span class=text_small>' . $var['overview']['europe'][$var['lang']] . ' <a href=main.php?page=programme/europe&lang=' . $var['lang'] . ">>>></a></span>\n"; 4683 } 4684 else if ($cell == 'about') { 4685 $html .= $var['space'] . ' <span class=text_small>' . $var['overview']['about'][$var['lang']] . ' <a href=main.php?page=hub/about&lang=' . $var['lang'] . ">>>></a></span>\n"; 4686 } 4687 else if ($cell == 'newsletter') { 4688 $count = 1; 4689 while (file_exists('data/images/newsletter.' . str_repeat('0', 2 - strlen($count)) . "$count.jpg")) 4690 $count++; 4691 for ($i = 1; $i < $count; $i++) 4692 $random[str_repeat('0', 2 - strlen($i)) . $i] = mt_rand() / mt_getrandmax(); 4693 asort($random); 4694 $i = 0; 4695 while (list($k, $v) = each($random)) { 4696 $number[$i] = $k; 4697 $i++; 4698 } 4699 $html .= $var['space'] . ' <span class=text_small><b>Best Practices Newsletter</b> <a href=main.php?page=publications/newsletter&lang=' . $var['lang'] . ">>>></a></span><br>\n"; 4700 $html .= $var['space'] . ' <img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . " width=12 height=12><br>\n"; 4701 $html .= $var['space'] . ' <a href=main.php?page=publications/newsletter&lang=' . $var['lang'] . "><img src=data/images/newsletter.$number[0].jpg width=70 height=100 border=0></a>"; 4702 $html .= '<img src=images/' . $var['themedir'] . '/transparent.gif width=6 height=110>'; 4703 $html .= '<a href=main.php?page=publications/newsletter&lang=' . $var['lang'] . "><img src=data/images/newsletter.$number[1].jpg width=72 height=110 border=0></a><br>"; 4704 $html .= '<img src=images/' . $var['themedir'] . '/transparent.gif width=150 height=5><br>'; 4705 $html .= '<a href=main.php?page=publications/newsletter&lang=' . $var['lang'] . "><img src=data/images/newsletter.$number[2].jpg width=72 height=110 border=0></a>"; 4706 $html .= '<img src=images/' . $var['themedir'] . '/transparent.gif width=6 height=110>'; 4707 $html .= '<a href=main.php?page=publications/newsletter&lang=' . $var['lang'] . "><img src=data/images/newsletter.$number[3].jpg width=72 height=110 border=0></a><br><br>"; 4708 $html .= $var['space'] . ' <span class=text_small><b>Best Practices Mailing List</b> <a href=main.php?page=publications/mailing_list&lang=' . $var['lang'] . ">>>></a></span><br><br>\n"; 4709 $html .= $var['space'] . ' <span class=text_small><b>Electronic Newsletter<br>UN-Habitat</b> <a href=main.php?page=programme/un/habitat_newsletter&lang=' . $var['lang'] . ">>>></a></span>\n"; 4710 } 4711 else if ($cell == 'database') { 4712 $html .= $var['space'] . ' <span class=text_small><b>Best Practices Database</b> <a href=main.php?page=programme/un/database&lang=' . $var['lang'] . ">>>></a></span><br><br>\n"; 4713 $html .= $var['space'] . ' <a href=main.php?page=programme/un/database&lang=' . $var['lang'] . "><img src=data/images/logo.best_practices_database.gif width=90 height=90 border=0></a><br><br>\n"; 4714 $html .= $var['space'] . " <span class=text_small>UN-Habitat / Together Foundation</span>\n"; 4715 } 4716 else if ($cell == 'award') { 4717 $html .= $var['space'] . ' <a href=main.php?page=programme/award&lang=' . $var['lang'] . "><img src=data/images/best_practices_award.trophy.gif width=70 height=90 border=0></a><br>\n"; 4718 $html .= $var['space'] . ' <img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . " width=12 height=12><br>\n"; 4719 $html .= $var['space'] . ' <img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . ' width=6 height=6><span class=text_small><b>Dubai International Award</b><br>For Best Practices To Improve<br>the Living Environment <a href=main.php?page=programme/award&lang=' . $var['lang'] . ">>>></a></span>\n"; 4720 } 4721 else if ($cell == 'committee') { 4722 $html .= $var['space'] . ' <img src=data/images/logo.hub-vienna.large.' . $var['lang'] . '.gif width=80 height=64>'; 4723 $html .= '<img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . ' width=12 height=32>'; 4724 $html .= '<img src=data/images/logo.city_of_vienna.large.' . $var['lang'] . '.gif width=200 height=64>'; 4725 $html .= '<img src=images/' . $var['themedir'] . '/transparent.' . $var['themetype'] . ' width=12 height=32>'; 4726 $html .= "<img src=data/images/logo.un-habitat.large.gif width=80 height=64><br><br>\n"; 4727 $html .= $var['space'] . ' <span class=text_small>' . $var['overview']['committee'][$var['lang']] . "</span>\n"; 4728 } 4729 else if ($cell == 'contact') { 4730 $filedata = read_file('data/addresses/best_practices_hub_vienna.dat'); 4731 $html .= $var['space'] . ' <span class=text_small>'; 4732 $html .= '<b>' . str_replace('UN-HABITAT ', 'UN-HABITAT<br>', $filedata['organization_1'][$var['lang']]) . '<br/>' . $filedata['organization_2'][$var['lang']] . '</b><br>'; 4733 $html .= $filedata['street_1'] . '<br>'; 4734 $html .= $filedata['postal_code'] . ' ' . $filedata['city'][$var['lang']] . ' / ' . $filedata['country'][$var['lang']] .'<br>'; 4735 $html .= 'Phone: ' . $filedata['phone_1'] . '<br>'; 4736 $html .= 'Fax: ' . $filedata['fax_1'] . '<br>'; 4737 $html .= '<script language=javascript>document.write("' . str_replace('@', '" + String.fromCharCode(8 * 8) + "', '<a href=mailto:' . $filedata['e_mail_1'] . '>' . $filedata['e_mail_1'] . '</a>') . "\");</script><br>\n"; 4738 $html .= '<script language=javascript>document.write("' . str_replace('@', '" + String.fromCharCode(8 * 8) + "', '<a href=mailto:' . $filedata['e_mail_2'] . '>' . $filedata['e_mail_2'] . '</a>') . "\");</script>\n"; 4739 } 4740 /* 4741 else if ($cell == 'event') 4742 $html .= $var['space'] . ' <span class=text_small>' . $var['overview']['event'][$var['lang']] . ' <a href=main.php?page=vienna/events/2004-09&lang=' . $var['lang'] . ">>>></a></span>\n"; 4743 else if ($cell == 'website') 4744 $html .= $var['space'] . ' <span class=text_small>' . $var['overview']['website'][$var['lang']] . " <a href=main.php?redirect=www.bestpractices.at/data/documents/guide2006en.pdf>>>></a></span>\n"; 4745 */ 4746 $html .= $var['space'] . " </td>\n"; 4747 $html .= $var['space'] . ' <td width=6 height=$height background=images/' . $var['themedir'] . '/cell.right.middle.' . $var['themetype'] . "></td>\n"; 4748 $html .= $var['space'] . " </tr>\n"; 4749 $html .= $var['space'] . " <tr>\n"; 4750 $html .= $var['space'] . ' <td width=6 height=6 background=images/' . $var['themedir'] . '/cell.left.bottom.' . $var['themetype'] . "></td>\n"; 4751 $html .= $var['space'] . ' <td width=$width height=6 background=images/' . $var['themedir'] . '/cell.center.bottom.' . $var['themetype'] . "></td>\n"; 4752 $html .= $var['space'] . ' <td width=6 height=6 background=images/' . $var['themedir'] . '/cell.right.bottom.' . $var['themetype'] . "></td>\n"; 4753 $html .= $var['space'] . " </tr>\n"; 4754 $html .= $var['space'] . "</table>\n"; 4755 return $html; 4756 } 4757 4758 // ----------------------------------------------------------------------------- 4759 4760 function create_news($items) { 4761 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 4762 $news = read_news(); 4763 // var_dump($news); exit; 4764 if (count($news) > $items) 4765 $n = $items; 4766 else if (count($news) % 2) 4767 $n = count($news) - 1; 4768 else 4769 $n = count($news); 4770 $width = 378; 4771 $html .= '<table border=0 cellpadding=0 cellspacing=0>'; 4772 for ($i = 0; $i < $n; $i++) { 4773 if ($i % 2 == 0) { 4774 $html .= '<tr>'; 4775 $html .= '<td width=' . $width . ' height=12></td>'; 4776 $html .= '</tr>'; 4777 $html .= '<tr>'; 4778 } 4779 else 4780 $html .= '<td width=12></td>'; 4781 $html .= '<td colspan=7 width=' . $width . '>'; 4782 $html .= '<table border=0 cellpadding=0 cellspacing=0>'; 4783 $html .= '<tr>'; 4784 $html .= '<td width=6 height=6 background=images/classic/cell.left.top.gif></td>'; 4785 $html .= '<td width=' . ($width - 12) . ' height=6 background=images/classic/cell.center.top.gif></td>'; 4786 $html .= '<td width=6 height=6 background=images/classic/cell.right.top.gif></td>'; 4787 $html .= '</tr>'; 4788 $html .= '<tr>'; 4789 $html .= '<td width=6 background=images/classic/cell.left.middle.gif></td>'; 4790 $html .= '<td width=' . ($width - 12) . ' height=100 align=center valign=middle bgcolor=#ffffff>'; 4791 $html .= '<span class=text_small>'; 4792 $html .= '<span style="font-weight: bold; color: #660000">' . strtr($news[$i]['title'], array(' ...' => ' ...')) . '</span><br/>'; 4793 $html .= '<span style="color: #006600">' . strtr($news[$i]['description'], array(' ...' => ' ...')) . ' '; 4794 $html .= '<a href=main.php?redirect=' . $news[$i]['link'] . ' style="color: #000066">' . $news[$i]['source'] . ' >>></a>'; 4795 $html .= '</td>'; 4796 $html .= '<td width=6 background=images/classic/cell.right.middle.gif></td>'; 4797 $html .= '</tr>'; 4798 $html .= '<tr>'; 4799 $html .= '<td width=6 height=6 background=images/classic/cell.left.bottom.gif></td>'; 4800 $html .= '<td width=' . ($width - 12) . ' height=6 background=images/classic/cell.center.bottom.gif></td>'; 4801 $html .= '<td width=6 height=6 background=images/classic/cell.right.bottom.gif></td>'; 4802 $html .= '</tr>'; 4803 $html .= '</table>'; 4804 $html .= '</td>'; 4805 if ($i % 2 == 1) 4806 $html .= '</tr>'; 4807 } 4808 $html .= '<tr>'; 4809 $html .= '<td width=' . $width . ' height=12></td>'; 4810 $html .= '</tr>'; 4811 $html .= '</table>'; 4812 return $html; 4813 } 4814 4815 // ----------------------------------------------------------------------------- 4816 4817 function create_space() { 4818 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 4819 $html .= "<table border=0 cellpadding=0 cellspacing=0>\n"; 4820 $html .= " <tr>\n"; 4821 $html .= " <td width=768 height=18></td>\n"; 4822 $html .= " </tr>\n"; 4823 $html .= "</table>\n"; 4824 return $html; 4825 } 4826 4827 // ----------------------------------------------------------------------------- 4828 4829 function create_footer() { 4830 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 4831 $html .= "<table width=100% height=24 border=0 cellpadding=0 cellspacing=0>\n"; 4832 $html .= " <tr>\n"; 4833 $html .= " <td></td>\n"; 4834 $html .= " </tr>\n"; 4835 $html .= "</table>\n"; 4836 $html .= "<table width=100% border=0 cellpadding=0 cellspacing=0>\n"; 4837 $html .= " <tr>\n"; 4838 $html .= " <td align=center>\n"; 4839 $html .= " <table border=0 cellpadding=0 cellspacing=0>\n"; 4840 $html .= " <tr>\n"; 4841 $html .= ' <td width=768 height=24 align=center valign=middle background=images/' . $var['themedir'] . '/bar.' . $var['themetype'] . '><span class=footer>'; 4842 $html .= '<a href=main.php?page=' . $var['menu'][0]['name'] . '/about&lang=' . $var['lang']; 4843 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 4844 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 4845 $html .= ' class=footer>' . $var['footer']['about'][$var['lang']] . '</a> - '; 4846 $html .= '<a href=main.php?page=' . $var['menu'][0]['name'] . '/contact&lang=' . $var['lang']; 4847 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 4848 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 4849 $html .= ' class=footer>' . $var['footer']['contact'][$var['lang']] . '</a> - '; 4850 $html .= '<a href=main.php?page=tools/search&lang=' . $var['lang']; 4851 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 4852 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 4853 $html .= ' class=footer>' . $var['footer']['search'][$var['lang']] . '</a> - '; 4854 $html .= '<a href=main.php?page=tools/sitemap&lang=' . $var['lang']; 4855 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 4856 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 4857 $html .= ' class=footer>' . $var['footer']['sitemap'][$var['lang']] . '</a> - '; 4858 $html .= '<a href=main.php?page=tools/about/source_code&lang=' . $var['lang']; 4859 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 4860 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 4861 $html .= ' class=footer>' . $var['footer']['code'][$var['lang']] . '</a> - '; 4862 $html .= '<a href=main.php?page=tools/about/bugs&lang=' . $var['lang'] . '&view=new_' . $var['microtime']; 4863 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 4864 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 4865 $html .= ' class=footer>' . $var['footer']['bug'][$var['lang']] . '</a> - '; 4866 if ($var['mode'] != 'admin') 4867 $html .= '<a href=main.php?page=admin/login&lang=' . $var['lang'] . ' class=footer>' . $var['footer']['login'][$var['lang']] . '</a> - '; 4868 else 4869 $html .= '<a href=main.php?page=' . $var['page'] . '&lang=' . $var['lang'] . ' class=footer>' . $var['footer']['logout'][$var['lang']] . '</a> - '; 4870 $last_update = last_update(); 4871 $html .= $var['footer']['update'][$var['lang']] . ': ' . $var['weekday'][date('w', $last_update)][$var['lang']] . ', '; 4872 if ($var['lang'] == 'en') 4873 $html .= $var['month'][date('n', $last_update)]['en'] . ' '; 4874 $html .= date('j', $last_update); 4875 if ($var['lang'] == 'de') 4876 $html .= '. ' . $var['month'][date('n', $last_update)]['de']; 4877 $html .= ', ' . date('H:i', $last_update) . ' ' . $var['timezone'][$var['lang']]; 4878 $html .= "</span></td>\n"; 4879 $html .= " </tr>\n"; 4880 $html .= " </table>\n"; 4881 $html .= " </td>\n"; 4882 $html .= " </tr>\n"; 4883 $html .= "</table>\n"; 4884 $html .= "<table width=100% height=12 border=0 cellpadding=0 cellspacing=0>\n"; 4885 $html .= " <tr>\n"; 4886 $html .= " <td></td>\n"; 4887 $html .= " </tr>\n"; 4888 $html .= "</table>\n"; 4889 $html .= "</center>\n"; 4890 return $html; 4891 } 4892 4893 // ----------------------------------------------------------------------------- 4894 4895 function parse_text($filename, $mode) { 4896 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 4897 get_layout($filename); 4898 $file = file($filename); 4899 for ($i = 0; $i < count($file); $i++) { 4900 if (strstr($file[$i], '<usertags>')) { 4901 $j = 0; 4902 reset($var['tag']); 4903 while (list($k, $v) = each($var['tag'])) { 4904 if ($j > 0) 4905 $text .= chr(13) . chr(10); 4906 if (!strstr($v['html'], 'text')) 4907 $text .= "<b><t>$k</t></b> " . $v['help'][$var['lang']] . ' [' . $v['html'] . ']<n><goto=note_6>6</goto></n>'; 4908 else { 4909 $text .= "<b><t>$k</t></b><i>text</i><b><t>/$k</t></b> "; 4910 if ($v['alias']) 4911 $text .= '(' . $var['or'][$var['lang']] . ' <b><t>' . $v['alias'] . '</t></b><i>text</i><b><t>/' . $v['alias'] . '</t></b>) '; 4912 $text .= str_replace('text', '<i>text</i>', $v['help'][$var['lang']]) . ' [' . $v['html'] . ']<n><goto=note_2_6>6</goto></n>'; 4913 } 4914 $j++; 4915 } 4916 $file[$i] = str_replace('<usertags>', $text, $file[$i]); 4917 $flag = true; 4918 } 4919 } 4920 if ($flag) { 4921 $file = implode(chr(13) . chr(10), $file); 4922 $file = explode(chr(13) . chr(10), $file); 4923 } 4924 $column = 0; 4925 for ($i = 0; $i < count($file); $i++) { 4926 $line = $file[$i]; 4927 if ($mode == 'html') { 4928 $line = chop($line); 4929 if ($var['preference']['links_window'] == 'new') 4930 $target = ' target=_blank'; 4931 reset($var['tag']); 4932 while (list($k, $v) = each($var['tag'])) { 4933 if (!strstr($v['html'], 'text')) { 4934 $line = str_replace("<$k>", $v['html'], $line); 4935 if ($v['alias']) 4936 $line = str_replace('<' . $v['alias'] . '>', $v['html'], $line); 4937 } 4938 else { 4939 $data = explode('text', $v['html']); 4940 $line = str_replace("<$k>", $data[0], $line); 4941 $line = str_replace("</$k>", $data[1], $line); 4942 if ($v['alias']) { 4943 $line = str_replace('<' . $v['alias'] . '>', $data[0], $line); 4944 $line = str_replace('</' . $v['alias'] . '>', $data[1], $line); 4945 } 4946 } 4947 } 4948 if (strstr($line, '<column>') || strstr($line, '<sublist>') || strstr($line, '</sublist>') || strstr($line, '<link>') || strstr($line, '<address>') || strstr($line, '</right>') || strstr($line, '</center>') || strstr($line, '</justify>') || strstr($line, '<line>')) 4949 $break = ''; 4950 else if (strstr($line, '<list') || $var['list_flag']) 4951 $break = "\n"; 4952 else 4953 $break = "<br>\n"; 4954 if (strstr($line, '<column>')) { 4955 $line = strip_tags($line); 4956 $var['columnwidth'] = $line; 4957 $line = chop(strip_tags($line)); 4958 if ($column == 0) { 4959 if ($var['rows'] == 1) 4960 $line = " <td width=$line align=left valign=top>\n <span class=text_medium>\n"; 4961 else 4962 $line = ' <td colspan=' . ($var['columns'] * 2 - 3) . " width=$line align=left valign=top>\n <span class=text_medium>\n"; 4963 } 4964 else { 4965 if ($column > 1 || $var['rows'] == 1) 4966 $line = " </span>\n </td>\n <td width=36></td>\n <td width=$line align=left valign=top>\n <span class=text_medium>\n"; 4967 else 4968 $line = " </span>\n </td>\n </tr>\n <tr>\n <td colspan=" . ($var['columns'] * 2 - 3) . " height=18></td>\n </tr>\n <tr>\n <td width=$line align=left valign=top>\n <span class=text_medium>\n"; 4969 } 4970 $column++; 4971 } 4972 $line = str_replace('<sublist>', '<table width=100% border=0 cellpadding=0 cellspacing=0><tr><td width=24></td><td>', $line); 4973 $line = str_replace('</sublist>', '</td></tr></table>', $line); 4974 if (strstr($line, '<list')) { 4975 $data = explode('>>', $line); 4976 $data = explode(' ', $data[0] . '>'); 4977 $data_type = explode('=', $data[1]); 4978 $var['list_type'] = $data_type[1]; 4979 $data_format_start = explode('=', $data[2]); 4980 $var['list_format_start'] = $data_format_start[1]; 4981 $data = explode('><', substr($var['list_format_start'], 1, -1)); 4982 for ($j = 0; $j < count($data); $j++) 4983 $data_format_end[$j] = '/' . $data[count($data) - 1 - $j]; 4984 $var['list_format_end'] = '<' . implode('><', $data_format_end) . '>'; 4985 $line = substr($line, 20 + strlen($var['list_type']) + strlen($var['list_format_start'])); 4986 $var['list_flag'] = true; 4987 $var['list_number'] = 0; 4988 } 4989 if ($var['list_flag']) { 4990 $var['list_number']++; 4991 if (substr($var['list_type'], -7) != 'number>' && substr($var['list_type'], -6) != 'roman>' && substr($var['list_type'], -7) != 'letter>') 4992 $line = '<tr><td align=left valign=top>' . $var['list_format_start'] . $var['list_type'] . '<xspace>' . $var['list_format_end'] . '</td><td>' . $var['list_format_start'] . $line . $var['list_format_end'] . '</td></tr>'; 4993 else { 4994 if ($var['list_type'] == '<number>') 4995 $line = '<tr><td align=left valign=top><none>' . $var['list_format_start'] . $var['list_number'] . ')<xspace>' . $var['list_format_end'] . '</none></td><td><none>' . $var['list_format_start'] . $line . $var['list_format_end'] . '<none></td></tr>'; 4996 else if ($var['list_type'] == '<xnumber>') 4997 $line = '<tr><td align=left valign=top><none>' . $var['list_format_start'] . $var['list_number'] . '.)<xspace>' . $var['list_format_end'] . '</none></td><td><none>' . $var['list_format_start'] . $line . $var['list_format_end'] . '<none></td></tr>'; 4998 else if ($var['list_type'] == '<roman>') 4999 $line = '<tr><td align=left valign=top><none>' . $var['list_format_start'] . strtolower(roman($var['list_number'])) . ')<xspace>' . $var['list_format_end'] . '</none></td><td><none>' . $var['list_format_start'] . $line . $var['list_format_end'] . '</none></td></tr>'; 5000 else if ($var['list_type'] == '<xroman>') 5001 $line = '<tr><td align=left valign=top><none>' . $var['list_format_start'] . roman($var['list_number']) . ')<xspace>' . $var['list_format_end'] . '</none></td><td><none>' . $var['list_format_start'] . $line . $var['list_format_end'] . '</none></td></tr>'; 5002 else if ($var['list_type'] == '<letter>') 5003 $line = '<tr><td align=left valign=top><none>' . $var['list_format_start'] . chr(96 + $var['list_number']) . ')<xspace>' . $var['list_format_end'] . '</none></td><td><none>' . $var['list_format_start'] . $line . $var['list_format_end'] . '</none></td></tr>'; 5004 else if ($var['list_type'] == '<xletter>') 5005 $line = '<tr><td align=left valign=top><none>' . $var['list_format_start'] . chr(64 + $var['list_number']) . ')<xspace>' . $var['list_format_end'] . '</none></td><td><none>' . $var['list_format_start'] . $line . $var['list_format_end'] . '</none></td></tr>'; 5006 } 5007 if ($var['list_number'] == 1) 5008 $line = "<table border=0 cellpadding=0 cellspacing=0>$line"; 5009 if (strstr($line, '</list>')) { 5010 $line = str_replace('</list>', '', $line) . '</table>'; 5011 $var['list_flag'] = false; 5012 } 5013 } 5014 $line = str_replace('Š', 'ä', $line); 5015 $line = str_replace('€', 'Ä', $line); 5016 $line = str_replace('š', 'ö', $line); 5017 $line = str_replace('…', 'Ö', $line); 5018 $line = str_replace('Ÿ', 'ü', $line); 5019 $line = str_replace('†', 'Ü', $line); 5020 $line = str_replace('§', 'ß', $line); 5021 $line = str_replace('<xlarge>', '<span class=text_xlarge>', $line); 5022 $line = str_replace('</xlarge>', '</span>', $line); 5023 $line = str_replace('<xl>', '<span class=text_xlarge>', $line); 5024 $line = str_replace('</xl>', '</span>', $line); 5025 $line = str_replace('<large>', '<span class=text_large>', $line); 5026 $line = str_replace('</large>', '</span>', $line); 5027 $line = str_replace('<l>', '<span class=text_large>', $line); 5028 $line = str_replace('</l>', '</span>', $line); 5029 $line = str_replace('<none>', '<span class=text_medium>', $line); 5030 $line = str_replace('</none>', '</span>', $line); 5031 $line = str_replace('<small>', '<span class=text_small>', $line); 5032 $line = str_replace('</small>', '</span>', $line); 5033 $line = str_replace('<s>', '<span class=text_small>', $line); 5034 $line = str_replace('</s>', '</span>', $line); 5035 $line = str_replace('<xsmall>', '<span class=text_xsmall>', $line); 5036 $line = str_replace('</xsmall>', '</span>', $line); 5037 $line = str_replace('<xs>', '<span class=text_xsmall>', $line); 5038 $line = str_replace('</xs>', '</span>', $line); 5039 $line = str_replace('<bold>', '<b>', $line); 5040 $line = str_replace('</bold>', '</b>', $line); 5041 $line = str_replace('<italic>', '<i>', $line); 5042 $line = str_replace('</italic>', '</i>', $line); 5043 $line = str_replace('<underline>', '<u>', $line); 5044 $line = str_replace('</underline>', '</u>', $line); 5045 $line = str_replace('<mono>', '<tt>', $line); 5046 $line = str_replace('</mono>', '</tt>', $line); 5047 $line = str_replace('<m>', '<tt>', $line); 5048 $line = str_replace('</m>', '</tt>', $line); 5049 $line = str_replace('<note>', '<sup>', $line); 5050 $line = str_replace('</note>', '</sup>', $line); 5051 $line = str_replace('<n>', '<sup>', $line); 5052 $line = str_replace('</n>', '</sup>', $line); 5053 $line = str_replace('<tag>', '<', $line); 5054 $line = str_replace('</tag>', '>', $line); 5055 $line = str_replace('<t>', '<', $line); 5056 $line = str_replace('</t>', '>', $line); 5057 $j = 0; 5058 reset($var['color']['text']); 5059 while (list($k, $v) = each($var['color']['text'])) { 5060 if ($j == 27) 5061 break; 5062 $line = str_replace("<$k>", "<span style=color:#$v>", $line); 5063 $line = str_replace("</$k>", '</span>', $line); 5064 $j++; 5065 } 5066 $line = str_replace('<char>', '&', $line); 5067 $line = str_replace('</char>', ';', $line); 5068 $line = str_replace('<c>', '&', $line); 5069 $line = str_replace('</c>', ';', $line); 5070 $line = str_replace('<nobr>', ' ', $line); 5071 $line = str_replace('<space>', ' ', $line); 5072 $line = str_replace('<xspace>', '  ', $line); 5073 $line = str_replace('<dot>', '·', $line); 5074 $line = str_replace('<xdot>', '⋅', $line); 5075 $line = str_replace('<dash>', '–', $line); 5076 $line = str_replace('<xdash>', '—', $line); 5077 $line = str_replace('<arrow>', '→', $line); 5078 $line = str_replace('<xarrow>', '⇒', $line); 5079 $line = str_replace('<right>', '<div align=right>', $line); 5080 $line = str_replace('</right>', '</div>', $line); 5081 $line = str_replace('<center>', '<div align=center>', $line); 5082 $line = str_replace('</center>', '</div>', $line); 5083 $line = str_replace('<justify>', '<div align=justify>', $line); 5084 $line = str_replace('</justify>', '</div>', $line); 5085 $line = str_replace('<line>', '<hr>', $line); 5086 $line = str_replace('<line=', '<a name=', $line); 5087 $line = str_replace('</line>', '</a>', $line); 5088 $line = str_replace('<goto=', '<a style=color:#' . $var['color']['text']['link'] . ' href=#', $line); 5089 $line = str_replace('</goto>', '</a>', $line); 5090 $line = str_replace('<site=', '<a style=color:#' . $var['color']['text']['link'] . "$target href=main.php?redirect=", $line); 5091 $line = str_replace('</site>', '</a>', $line); 5092 $line = str_replace('<mail=', '<a style=color:#' . $var['color']['text']['link'] . ' href=mailto:', $line); 5093 $line = str_replace('</mail>', '</a>', $line); 5094 $line = str_replace('<page=', '<a style=color:#' . $var['color']['text']['link'] . ' href=main.php?page=', $line); 5095 $line = str_replace('</page>', '</a>', $line); 5096 $line = str_replace('<document=', '<a style=color:#' . $var['color']['text']['link'] . ' href=data/documents/', $line); 5097 $line = str_replace('</document>', '</a>', $line); 5098 if (strstr($line, '<link>')) 5099 $line = parse_link($line, $var['lang']); 5100 if (strstr($line, '<address>')) 5101 $line = parse_address($line, $var['lang']); 5102 if (strstr($line, '<image')) 5103 $line = parse_image($line); 5104 if (strstr($line, '<flag>')) 5105 $line = parse_flag($line); 5106 if (strstr($line, '<bestpractices>')) 5107 $line = parse_bestpractices(); 5108 // $line = str_replace('<habitat>', '<img src=images/' . $var['themedir'] . '/logo.habitat.' . $var['themetype'] . ' width=22 height=18 align=top>', $line); 5109 $line = str_replace('target=_blank href=main.php?redirect=http://bestpractices.at', 'href=http://www.bestpractices.at', $line); 5110 $line = str_replace('target=_blank href=main.php?redirect=http://www.bestpractices.at', 'href=http://www.bestpractices.at', $line); 5111 // delete the next two lines later 5112 $line = str_replace('target=_blank href=main.php?redirect=http://bozo.sil.at', 'href=http://bozo.sil.at', $line); 5113 $line = str_replace('target=_blank href=main.php?redirect=http://www.bozo.sil.at', 'href=http://www.bozo.sil.at', $line); 5114 if (strstr($line, 'main.php?redirect=')) { 5115 $data = explode('main.php?redirect=', $line); 5116 for ($j = 1; $j < count($data); $j++) { 5117 for ($k = 0; $k < strlen($data[$j]); $k++) { 5118 if (substr($data[$j], $k, 1) == ' ') { 5119 $limit = ' '; 5120 break; 5121 } 5122 else if (substr($data[$j], $k, 1) == '>') { 5123 $limit = '>'; 5124 break; 5125 } 5126 } 5127 $data_ = explode($limit, $data[$j]); 5128 $data_[0] = urlencode($data_[0]); 5129 $data[$j] = implode($limit, $data_); 5130 } 5131 $line = implode('main.php?redirect=', $data); 5132 } 5133 if (strstr($line, '@')) { 5134 if (substr($line, -1) != chr(10)) 5135 $line_break = ''; 5136 else 5137 $line_break = "\n"; 5138 $line = '<script language=javascript>document.write("' . str_replace('@', '" + String.fromCharCode(8 * 8) + "', str_replace(chr(10), '\n', $line)) . "\");</script>$line_break"; 5139 } 5140 $line = str_replace('<session>', $var['ssid'], $line); 5141 $line = str_replace('$DOMAIN', strtolower($var['domain']), $line); 5142 $line = str_replace('$DIR', $var['themedir'], $line); 5143 $line = str_replace('$TYPE', $var['themetype'], $line); 5144 if (substr($line, 0, 6) != $var['space']) 5145 $line = $var['space'] . $line; 5146 $line .= $break; 5147 } 5148 else if ($mode == 'form') { 5149 if (strstr($line, '<column>') && ($var['status'] != 'script' || ($var['this_page']['name'] != 'system_files' && ($var['this_page']['name'] != 'trash' || $var['type'] != 'system')))) { 5150 $line = chop(strip_tags($line)); 5151 if ($column == 0) { 5152 if ($var['rows'] == 1) 5153 $line = " <td width=$line>\n <textarea name=form_column_0 wrap=soft class=textarea_text style=width:$line" . 'px;height:' . ($var['preference']['column_height'] / $var['rows']) . 'px>'; 5154 else 5155 $line = ' <td colspan=' . ($var['columns'] * 2 - 3) . " width=$line>\n <textarea name=form_column_0 wrap=soft class=textarea_text style=width:$line" . 'px;height:' . ($var['preference']['column_height'] / $var['rows']) . 'px>'; 5156 } 5157 else { 5158 $html = chop($html) . "</textarea>\n"; 5159 if ($column > 1 || $var['rows'] == 1) 5160 $line = " </td>\n <td width=36></td>\n <td width=$line>\n <textarea name=form_column_$column wrap=soft class=textarea_text style=width:$line" . 'px;height:' . $var['preference']['column_height'] . 'px>'; 5161 else 5162 $line = " </td>\n </tr>\n <tr>\n <td colspan=" . ($var['columns'] * 2 - 3) . " height=18></td>\n </tr>\n <tr>\n <td width=$line>\n <textarea name=form_column_$column wrap=soft class=textarea_text style=width:$line" . 'px;height:' . $var['preference']['column_height'] . 'px>'; 5163 } 5164 $column++; 5165 } 5166 else 5167 $line = strtohtml($line); 5168 } 5169 $html .= $line; 5170 } 5171 if ($mode == 'html') 5172 $html .= " </span>\n </td>\n"; 5173 else if ($mode == 'form') 5174 $html .= "</textarea>\n </td>\n"; 5175 return $html; 5176 } 5177 5178 // ----------------------------------------------------------------------------- 5179 5180 function parse_link($line, $lang) { 5181 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 5182 $line = chop(strip_tags($line)); 5183 if (file_exists("data/links/$line.dat")) { 5184 if ($var['preference']['links_window'] == 'new') 5185 $target = ' target=_blank'; 5186 $link = read_file("data/links/$line.dat"); 5187 $line = ''; 5188 if ($link['title'][$lang]) 5189 $line .= $var['space'] . '<b>' . $link['title'][$lang] . "</b><br>\n"; 5190 $line .= $var['space'] . "<div class=text_small>\n"; 5191 $line .= $var['space'] . '<a href=main.php?redirect=' . $link['url'] . "$target style=color:#" . $var['color']['text']['link'] . '>' . $link['url'] . "</a><br>\n"; 5192 if ($link['description'][$lang]) 5193 $line .= $var['space'] . '<span class=small><i>' . $link['description'][$lang] . "</i></span><br>\n"; 5194 $line .= $var['space'] . "</div>\n"; 5195 } 5196 else if (file_exists("data/addresses/$line.dat")) { 5197 if ($var['preference']['links_window'] == 'new') 5198 $target = ' target=_blank'; 5199 $address = read_file("data/addresses/$line.dat"); 5200 $line = ''; 5201 if ($address['organization'][$lang]) 5202 $line .= $var['space'] . '<b>' . $address['organization'][$lang] . "</b><br>\n"; 5203 $line .= $var['space'] . "<div class=text_small>\n"; 5204 $line .= $var['space'] . '<a href=main.php?redirect=' . $address['internet'] . "$target style=color:#" . $var['color']['text']['link'] . '>' . $address['internet'] . "</a><br>\n"; 5205 if ($address['description'][$lang]) 5206 $line .= $var['space'] . '<span class=small><i>' . $address['description'][$lang] . "</i></span><br>\n"; 5207 $line .= $var['space'] . "</div>\n"; 5208 } 5209 else { 5210 $line = $var['space'] . "<b>$line</b><br>\n"; 5211 $line .= $var['space'] . '<span class=text_xsmall style=color:#' . $var['color']['text']['error'] . '>[' . $var['missing_link'][$lang] . "]</span><br>\n"; 5212 } 5213 return $line; 5214 } 5215 5216 // ----------------------------------------------------------------------------- 5217 5218 function parse_address($line, $lang) { 5219 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 5220 $line = chop(strip_tags($line)); 5221 if (file_exists("data/addresses/$line.dat")) { 5222 if ($var['preference']['links_window'] == 'new') 5223 $target = ' target=_blank'; 5224 $address = read_file("data/addresses/$line.dat"); 5225 $line = ''; 5226 if ($address['organization_1'][$lang]) 5227 $line .= $var['space'] . '<b>' . str_replace(' - ', '<br>', $address['organization_1'][$lang]) . "</b><br>\n"; 5228 if ($address['organization_2'][$lang]) 5229 $line .= $var['space'] . '<b>' . str_replace(' - ', '<br>', $address['organization_2'][$lang]) . "</b><br>\n"; 5230 $line .= $var['space'] . "<div class=text_small>\n"; 5231 if ($address['person_1']) 5232 $line .= $var['space'] . '<b>' . $address['person_1'] . "</b><br>\n"; 5233 if ($address['person_2']) 5234 $line .= $var['space'] . '<b>' . $address['person_2'] . "</b><br>\n"; 5235 if ($address['street_1']) 5236 $line .= $var['space'] . $address['street_1'] . "<br>\n"; 5237 if ($address['street_2']) 5238 $line .= $var['space'] . $address['street_2'] . "<br>\n"; 5239 $line .= $var['space']; 5240 if (strstr('Austria Germany Swizerland', $address['country']['en'])) 5241 $line .= $address['postal_code'] . ' '; 5242 $line .= $address['city'][$lang]; 5243 if ($address['state'][$lang]) 5244 $line .= ', ' . $address['state'][$lang]; 5245 if (!strstr('Austria Germany Swizerland', $address['country']['en'])) 5246 $line .= $var['space'] . ' ' . $address['postal_code']; 5247 $line .= ' / ' . $address['country'][$lang] . "<br>\n"; 5248 if ($address['phone_1']) { 5249 $line .= $var['space'] . '<table border=0 cellpadding=0 cellspacing=0><tr><td><span class=text_small><b>' . $var['phone'][$lang] . ':</b> </span></td><td><span class=text_small>' . $address['phone_1']; 5250 if ($address['phone_2']) 5251 $line .= '</td></tr><tr><td></td><td><span class=text_small>' . $address['phone_2']; 5252 $line .= "</span></td></tr></table>\n"; 5253 } 5254 if ($address['fax_1']) { 5255 $line .= $var['space'] . '<table border=0 cellpadding=0 cellspacing=0><tr><td><span class=text_small><b>' . $var['fax'][$lang] . ':</b> </span></td><td><span class=text_small>' . $address['fax_1']; 5256 if ($address['fax_2']) 5257 $line .= '</td></tr><tr><td></td><td><span class=text_small>' . $address['fax_2']; 5258 $line .= "</span></td></tr></table>\n"; 5259 } 5260 if ($address['e_mail_1']) { 5261 $line .= $var['space'] . '<table border=0 cellpadding=0 cellspacing=0><tr><td><span class=text_small><b>' . $var['e_mail'][$lang] . ':</b> </span></td><td><span class=text_small><a href=mailto:' . $address['e_mail_1'] . ' style=color:#' . $var['color']['text']['link'] . '>' . $address['e_mail_1'] . '</a>'; 5262 if ($address['e_mail_2']) 5263 $line .= '</td></tr><tr><td></td><td><span class=text_small><a href=mailto:' . $address['e_mail_2'] . ' style=color:#' . $var['color']['text']['link'] . '>' . $address['e_mail_2'] . '</a>'; 5264 $line .= "</span></td></tr></table>\n"; 5265 } 5266 if ($address['internet_1']) { 5267 $line .= $var['space'] . '<table border=0 cellpadding=0 cellspacing=0><tr><td><span class=text_small><b>' . $var['internet'][$lang] . ':</b> </span></td><td><span class=text_small><a href=main.php?redirect=' . $address['internet_1'] . "$target style=color:#" . $var['color']['text']['link'] . '>' . $address['internet_1'] . '</a>'; 5268 if ($address['internet_2']) 5269 $line .= '</td></tr><tr><td></td><td><span class=text_small><a href=main.php?redirect=' . $address['internet_2'] . "$target style=color:#" . $var['color']['text']['link'] . '>' . $address['internet_2'] . '</a>'; 5270 $line .= "</span></td></tr></table>\n"; 5271 } 5272 if ( $address['description'][$lang] && $var['this_page']['name'] != 'database_addresses') 5273 $line .= $var['space'] . '<i>' . $address['description'][$lang] . "</i><br>\n"; 5274 if (substr($line, -5) == '<br>' . chr(10)) 5275 $line = substr($line, 0, -5) . "\n"; 5276 $line .= $var['space'] . "</div>\n"; 5277 } 5278 else { 5279 $line = $var['space'] . "<b>$line</b><br>\n"; 5280 $line .= $var['space'] . '<span class=text_xsmall style=color:#' . $var['color']['text']['error'] . '>[' . $var['missing_address'][$lang] . "]</span><br>\n"; 5281 } 5282 return $line; 5283 } 5284 5285 // ----------------------------------------------------------------------------- 5286 5287 function parse_image($line) { 5288 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 5289 $data = explode(' ', $line); 5290 if (count($data) > 1) { 5291 for ($i = 1; $i < count($data); $i++) { 5292 if ($i < count($data) - 1) 5293 $data_ = explode('=', $data[$i]); 5294 else { 5295 $data_ = explode('>', $data[$i]); 5296 $data_ = explode('=', $data_[0]); 5297 } 5298 $$data_[0] = $data_[1]; 5299 } 5300 } 5301 $line = chop(strip_tags($line)); 5302 if (file_exists("data/images/$line")) { 5303 $imagesize = getimagesize("data/images/$line"); 5304 if ($width && !$height) 5305 $height = round($imagesize[1] * $width / $imagesize[0]); 5306 if ($height && !$width) 5307 $width = round($imagesize[0] * $height / $imagesize[1]); 5308 if (!$width) 5309 $width = $imagesize[0]; 5310 if (!$height) 5311 $height = $imagesize[1]; 5312 if ($width > $var['columnwidth']) { 5313 $width = $var['columnwidth']; 5314 $height = round($height * $width / $imagesize[0]); 5315 } 5316 $line = $var['space'] . "<img src=data/images/$line alt=$line border=0 width=$width height=$height>"; 5317 } 5318 else 5319 $line = $var['space'] . "<span class=text_xsmall><b>$line</b> <span style=color:#" . $var['color']['text']['error'] . '>[' . $var['missing_image'][$var['lang']] . ']</span></span>'; 5320 return $line; 5321 } 5322 5323 // ----------------------------------------------------------------------------- 5324 5325 function parse_flag($line) { 5326 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 5327 $country = read_file('data/system/countries.dat'); 5328 $data = explode('<flag>', $line); 5329 for ($i = 1; $i < count($data); $i++) { 5330 $data_ = explode('</flag>', $data[$i]); 5331 $data_[0] = strtolower($data_[0]); 5332 if (!file_exists('images/flags/' . $data_[0] . '.gif')) { 5333 $flag = false; 5334 reset($country); 5335 while (list($k, $v) = each($country)) { 5336 if (strtolower(substr($v, 0, strpos($v, ' | '))) == $data_[0] && file_exists("images/flags/$k.gif")) { 5337 $data_[0] = $k; 5338 $flag = true; 5339 break; 5340 } 5341 } 5342 if (!$flag) 5343 $data_[0] == 'int'; 5344 } 5345 $data_[0] = '<img src=images/flags/' . $data_[0] . '.gif width=24 height=16 border=0 align=top>'; 5346 $data[$i] = implode('', $data_); 5347 } 5348 $line = implode('', $data); 5349 return $line; 5350 } 5351 5352 // ----------------------------------------------------------------------------- 5353 5354 function parse_bestpractices() { 5355 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 5356 for ($i = 0; $i < $var['menu'][$var['this_tab']][$var['this_menu'] + 1]['count']; $i++) { 5357 if ($var['menu'][$var['this_tab']][$var['this_menu'] + 1][$i]['status'] == 'public') { 5358 if ($i > 0) 5359 $html .= '<br>'; 5360 $html .= '<span class=text_large style=font-weight:bold;color:#' . $var['color']['text'][$var['menu'][$var['this_tab']][$var['this_menu'] + 1][$i]['color']] . '>' . menutoline($var['menu'][$var['this_tab']][$var['this_menu'] + 1][$i]['title'][$var['lang']]) . '</span><br>'; 5361 $html .= '<span class=text_small>' . $var['bestpractices'][$var['menu'][$var['this_tab']][$var['this_menu'] + 1][$i]['name']][$var['lang']] . "</span></br>\n"; 5362 for ($j = 0; $j < $var['menu'][$var['this_tab']][$var['this_menu'] + 1][$i]['count']; $j++) { 5363 $html .= '<table border=0 cellpadding=0 cellspacing=0><tr><td valign=top>→ </td><td height=18><a href=main.php?page=' . $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu'] + 1]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu'] + 1][$i]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu'] + 1][$i][$j]['name'] . '&lang=' . $var['lang']; 5364 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 5365 $html .= '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 5366 $html .= ' class=text_medium style=font-weight:bold;color:#' . $var['color']['text'][$var['menu'][$var['this_tab']][$var['this_menu'] + 1][$i]['color']] . '>' . menutoline($var['menu'][$var['this_tab']][$var['this_menu'] + 1][$i][$j]['title'][$var['lang']]) . '</a></td></tr></table>'; 5367 } 5368 } 5369 } 5370 return $html; 5371 } 5372 5373 // ----------------------------------------------------------------------------- 5374 5375 function parse_date($string) { 5376 5377 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 5378 5379 $year = substr($string, 6, 4); 5380 if ($var['lang'] == 'en') { 5381 $month = substr($string, 0, 2); 5382 $day = substr($string, 3, 2); 5383 } 5384 else if ($var['lang'] == 'de') { 5385 $month = substr($string, 3, 2); 5386 $day = substr($string, 0, 2); 5387 } 5388 $hour = substr($string, 11, 2); 5389 $minute = substr($string, 14, 2); 5390 $second = substr($string, 17, 2); 5391 5392 return date('r', mktime($hour, $minute, $second, $month, $day, $year)); 5393 5394 } 5395 5396 // ----------------------------------------------------------------------------- 5397 5398 function parse_header($line) { 5399 5400 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 5401 5402 $line = str_replace('$NAME', $var['newsletter']['listname'], $line); 5403 $line = str_replace('$HOME', 'http://' . $var['newsletter']['listhome'], $line); 5404 5405 return $line; 5406 5407 } 5408 5409 // ----------------------------------------------------------------------------- 5410 5411 function get_count() { 5412 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 5413 $var['menu']['count'] = count($var['menu']); 5414 // echo $var['menu']['count'] . '!!!!!'; 5415 for ($i = 0; $i < $var['menu']['count']; $i++) { 5416 if ($var['menu'][$i]['status'] != 'hidden') 5417 $var['menu']['count_public']++; 5418 $var['menu'][$i]['count'] = 0; 5419 for ($j = 0; $j < count($var['menu'][$i]); $j++) { 5420 if (isset($var['menu'][$i][$j])) { 5421 $var['menu'][$i]['count'] = $j + 1; 5422 if ($var['menu'][$i][$j]['status'] != 'hidden') 5423 $var['menu'][$i]['count_public']++; 5424 $var['menu'][$i][$j]['count'] = 0; 5425 for ($k = 0; $k < count($var['menu'][$i][$j]); $k++) { 5426 if (isset($var['menu'][$i][$j][$k])) { 5427 $var['menu'][$i][$j]['count'] = $k + 1; 5428 if ($var['menu'][$i][$j][$k]['status'] != 'hidden') 5429 $var['menu'][$i][$j]['count_public']++; 5430 $var['menu'][$i][$j][$k]['count'] = 0; 5431 for ($l = 0; $l < count($var['menu'][$i][$j][$k]); $l++) { 5432 if (isset($var['menu'][$i][$j][$k][$l])) { 5433 $var['menu'][$i][$j][$k]['count'] = $l + 1; 5434 if ($var['menu'][$i][$j][$k][$l]['status'] != 'hidden') 5435 $var['menu'][$i][$j][$k]['count_public']++; 5436 } 5437 } 5438 } 5439 } 5440 } 5441 } 5442 } 5443 } 5444 5445 // ----------------------------------------------------------------------------- 5446 5447 function get_this() { 5448 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 5449 // echo '!!'.$var['page']; 5450 $data = explode('/', $var['page']); 5451 $var['this_level'] = count($data) - 1; 5452 for ($i = 0; $i < $var['menu']['count']; $i++) { 5453 if ($var['menu'][$i]['name'] == $data[0]) { 5454 $var['this_tab'] = $i; 5455 $var['this_page'] = $var['menu'][$i]; 5456 if (count($data) > 1) { 5457 for ($j = 0; $j < $var['menu'][$i]['count']; $j++) { 5458 if ($var['menu'][$i][$j]['name'] == $data[1]) { 5459 $var['this_menu'] = $j; 5460 $var['this_page'] = $var['menu'][$i][$j]; 5461 if (count($data) > 2) { 5462 for ($k = 0; $k < $var['menu'][$i][$j]['count']; $k++) { 5463 if ($var['menu'][$i][$j][$k]['name'] == $data[2]) { 5464 $var['this_subtab'] = $k; 5465 $var['this_page'] = $var['menu'][$i][$j][$k]; 5466 if (count($data) == 4) { 5467 for ($l = 0; $l < $var['menu'][$i][$j][$k]['count']; $l++) { 5468 if ($var['menu'][$i][$j][$k][$l]['name'] == $data[3]) { 5469 $var['this_submenu'] = $l; 5470 $var['this_page'] = $var['menu'][$i][$j][$k][$l]; 5471 // echo 'selected ' . $var['this_tab'] . $var['this_menu'] . $var['this_subtab'] . $var['this_submenu']; 5472 } 5473 } 5474 } 5475 } 5476 } 5477 } 5478 } 5479 } 5480 } 5481 } 5482 } 5483 } 5484 5485 // ----------------------------------------------------------------------------- 5486 5487 function get_other($page) { 5488 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 5489 // echo '!!'.$var['page']; 5490 $var['other_tab'] = ''; 5491 $var['other_menu'] = ''; 5492 $var['other_subtab'] = ''; 5493 $var['other_submenu'] = ''; 5494 $data = explode('/', $page); 5495 $var['other_level'] = count($data) - 1; 5496 for ($i = 0; $i < $var['menu']['count']; $i++) { 5497 if ($var['menu'][$i]['name'] == $data[0]) { 5498 $var['other_tab'] = $i; 5499 $var['other_page'] = $var['menu'][$i]; 5500 if (count($data) > 1) { 5501 for ($j = 0; $j < $var['menu'][$i]['count']; $j++) { 5502 if ($var['menu'][$i][$j]['name'] == $data[1]) { 5503 $var['other_menu'] = $j; 5504 $var['other_page'] = $var['menu'][$i][$j]; 5505 if (count($data) > 2) { 5506 for ($k = 0; $k < $var['menu'][$i][$j]['count']; $k++) { 5507 if ($var['menu'][$i][$j][$k]['name'] == $data[2]) { 5508 $var['other_subtab'] = $k; 5509 $var['other_page'] = $var['menu'][$i][$j][$k]; 5510 if (count($data) == 4) { 5511 for ($l = 0; $l < $var['menu'][$i][$j][$k]['count']; $l++) { 5512 if ($var['menu'][$i][$j][$k][$l]['name'] == $data[3]) { 5513 $var['other_submenu'] = $l; 5514 $var['other_page'] = $var['menu'][$i][$j][$k][$l]; 5515 // echo $var['other_tab'] . $var['other_menu'] . $var['other_subtab'] . $var['other_submenu']; 5516 } 5517 } 5518 } 5519 } 5520 } 5521 } 5522 } 5523 } 5524 } 5525 } 5526 } 5527 if (($var['other_level'] == 0 && $var['other_tab'] === '') || ($var['other_level'] == 1 && $var['other_menu'] === '') || ($var['other_level'] == 2 && $var['other_subtab'] === '') || ($var['other_level'] == 3 && $var['other_submenu'] === '')) 5528 $var['is_accessible'] = false; 5529 else 5530 $var['is_accessible'] = true; 5531 } 5532 5533 // ----------------------------------------------------------------------------- 5534 5535 function get_layout($filename) { 5536 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 5537 if (file_exists($filename)) { 5538 $var['columns'] = 0; 5539 $file = file($filename); 5540 for ($i = 0; $i < count($file); $i++) { 5541 $file[$i] = chop($file[$i]); 5542 if (strstr($file[$i], '<column>')) { 5543 $width[$var['columns']] = strip_tags($file[$i]); 5544 $var['columns']++; 5545 $width_total += strip_tags($file[$i]); 5546 } 5547 } 5548 if ($width_total <= 768) 5549 $var['rows'] = 1; 5550 else 5551 $var['rows'] = 2; 5552 reset($var['layout']); 5553 while (list($k, $v) = each($var['layout'])) { 5554 $flag = true; 5555 for ($i = 0; $i < count($width); $i++) { 5556 if ($width[$i] != $v[$i]['width']) { 5557 $flag = false; 5558 break; 5559 } 5560 } 5561 if ($flag) 5562 return $k; 5563 } 5564 } 5565 } 5566 5567 // ----------------------------------------------------------------------------- 5568 5569 function get_context($type) { 5570 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 5571 if (isset($var['context'])) 5572 unset($var['context']); 5573 $g = read_dir('data/pages'); 5574 for ($i = 0; $i < count($g); $i++) { 5575 if (substr($g[$i]['name'], -2) == $var['lang']) { 5576 $file = file('data/pages/' . $g[$i]['filename']); 5577 for ($j = 0; $j < count($file); $j++) { 5578 $file[$j] = chop($file[$j]); 5579 if ($type == 'images' && strstr($file[$j], '<image')) 5580 $var['context'][strip_tags($file[$j])][count($var['context'][strip_tags($file[$j])])] = substr($g[$i]['filename'], 0, -4); 5581 else if ($type == 'documents' && strstr($file[$j], '<document')) { 5582 $data = explode('<document=', $file[$j]); 5583 $data = explode('>', $data[1]); 5584 $var['context'][$data[0]][count($var['context'][$data[0]])] = substr($g[$i]['filename'], 0, -4); 5585 } 5586 else if ($type == 'addresses' && strstr($file[$j], '<address>')) 5587 $var['context'][strip_tags($file[$j])][count($var['context'][strip_tags($file[$j])])] = substr($g[$i]['filename'], 0, -4); 5588 else if ($type == 'links' && strstr($file[$j], '<link>')) 5589 $var['context'][strip_tags($file[$j])][count($var['context'][strip_tags($file[$j])])] = substr($g[$i]['filename'], 0, -4); 5590 } 5591 } 5592 } 5593 } 5594 5595 // ----------------------------------------------------------------------------- 5596 5597 function get_userdata() { 5598 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 5599 $filedata = read_file('data/sessions/' . $var['ssid'] . '.dat'); 5600 $var['current_user']['e-mail'] = $filedata['username']; 5601 $filedata = read_file('data/newsletter/subscribers/' . $var['current_user']['e-mail'] . '.dat'); 5602 $var['current_user']['status'] = $filedata['status']; 5603 $var['current_user']['filters'] = $filedata['filters']; 5604 } 5605 5606 // ----------------------------------------------------------------------------- 5607 5608 function get_admindata() { 5609 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 5610 $filedata = read_file('data/sessions/' . $var['ssid'] . '.dat'); 5611 $var['current_admin']['username'] = $filedata['username']; 5612 $f = read_dir('data/accounts'); 5613 for ($i = 0; $i < count($f); $i++) { 5614 $filedata = read_file('data/accounts/' . $f[$i]['name'] . '.dat'); 5615 if ($filedata['username'] == $var['current_admin']['username']) 5616 $var['current_admin']['e-mail'] = $filedata['e-mail']; 5617 $var['admin_file'][$filedata['username']] = $f[$i]['name']; 5618 } 5619 } 5620 5621 // ----------------------------------------------------------------------------- 5622 5623 function get_bugdata() { 5624 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 5625 $f = read_dir('data/bugs'); 5626 sort($f); 5627 $count = 1; 5628 while (list($k, $v) = each($f)) { 5629 if ($count == $var['view']) 5630 $var['bugdata'] = $v; 5631 $count++; 5632 } 5633 // echo $var['bugdata']['filename']; 5634 $count = 0; 5635 $d = dir('data/bugs/' . $var['bugdata']['filename']); 5636 while ($f = $d->read()) { 5637 if (substr($f, 0, 1) != '.') { 5638 if (substr($f, -4) != '.dat') { 5639 $filename[$count] = $f; 5640 $count++; 5641 } 5642 } 5643 } 5644 sort($filename); 5645 $count = 0; 5646 while (list($k, $v) = each($filename)) { 5647 $file = file('data/bugs/' . $var['bugdata']['filename'] . "/$v"); 5648 $time = substr($v, 0, 10); 5649 if ($var['lang'] == 'en') 5650 $var['bugdata']["date_$count"] = substr($var['weekday'][date('w', $time)]['en'], 0, 3) . ', ' . substr($var['month'][date('n', $time)]['en'], 0, 3) . ' ' . date('d, Y, H:i:s', $time) . ' ' . $var['timezone'][$var['lang']]; 5651 else 5652 $var['bugdata']["date_$count"] = substr($var['weekday'][date('w', $time)]['de'], 0, 2) . ', ' . date('d', $time) . '. ' . substr($var['month'][date('n', $time)]['de'], 0, 3) . '. ' . date('Y, H:i:s', $time) . ' ' . $var['timezone'][$var['lang']]; 5653 $data = explode('"', chop($file[0])); 5654 $var['bugdata']["from_$count"] = substr($data[0], 0, -1); 5655 $var['bugdata']["browser_$count"] = $data[1]; 5656 for ($i = 1; $i < count($file); $i++) 5657 $var['bugdata']["comment_$count"] .= $file[$i]; 5658 $count++; 5659 } 5660 } 5661 5662 // ----------------------------------------------------------------------------- 5663 5664 function save_menu() { 5665 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 5666 $temp = $var['menu']; 5667 if ($var['form_button'] == 'save') { 5668 if ($var['level'] == 0) { 5669 $temp[$var['this_tab']]['name'] = $var['form_page']; 5670 $temp[$var['this_tab']]['title'][$var['lang']] = $var['form_title']; 5671 $from = str_replace('/', '.', $var['page']); 5672 $var['page'] = $var['form_page']; 5673 $to = str_replace('/', '.', $var['page']); 5674 rename_pages($from, $to); 5675 } 5676 else if ($var['level'] == 1) { 5677 $temp[$var['this_tab']][$var['this_menu']]['name'] = $var['form_page']; 5678 $temp[$var['this_tab']][$var['this_menu']]['title'][$var['lang']] = $var['form_title']; 5679 $from = str_replace('/', '.', $var['page']); 5680 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['form_page']; 5681 $to = str_replace('/', '.', $var['page']); 5682 rename_pages($from, $to); 5683 } 5684 else if ($var['level'] == 2) { 5685 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']]['name'] = $var['form_page']; 5686 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']]['title'][$var['lang']] = $var['form_title']; 5687 $from = str_replace('/', '.', $var['page']); 5688 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name'] . '/' . $var['form_page']; 5689 $to = str_replace('/', '.', $var['page']); 5690 rename_pages($from, $to); 5691 } 5692 else if ($var['level'] == 3) { 5693 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['this_submenu']]['name'] = $var['form_page']; 5694 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['this_submenu']]['title'][$var['lang']] = $var['form_title']; 5695 $from = str_replace('/', '.', $var['page']); 5696 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['name'] . '/' . $var['form_page']; 5697 $to = str_replace('/', '.', $var['page']); 5698 rename_pages($from, $to); 5699 } 5700 } 5701 else if (substr($var['form_button'], 0, 8) == 'publish_') { 5702 if ($var['level'] == 0) 5703 $temp[$var['this_tab']]['status'] = substr($var['form_button'], 8); 5704 else if ($var['level'] == 1) 5705 $temp[$var['this_tab']][$var['this_menu']]['status'] = substr($var['form_button'], 8); 5706 else if ($var['level'] == 2) 5707 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']]['status'] = substr($var['form_button'], 8); 5708 else if ($var['level'] == 3) 5709 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['this_submenu']]['status'] = substr($var['form_button'], 8); 5710 $var['status'] = substr($var['form_button'], 8); 5711 } 5712 else if (substr($var['form_button'], 0, 9) == 'tabcolor_') { 5713 if ($var['level'] == 0) 5714 $temp[$var['this_tab']]['color'] = substr($var['form_button'], 9); 5715 else if ($var['level'] == 2) 5716 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']]['color'] = substr($var['form_button'], 9); 5717 } 5718 else if ($var['form_button'] == 'left') { 5719 if ($var['level'] == 0) { 5720 if ($var['this_tab'] > 0) { 5721 $temp[$var['this_tab'] - 1] = $var['menu'][$var['this_tab']]; 5722 $temp[$var['this_tab']] = $var['menu'][$var['this_tab'] - 1]; 5723 } 5724 else { 5725 $temp[$temp['count'] - 2] = $var['menu'][0]; 5726 for ($i = 0; $i < $temp['count'] - 2; $i++) 5727 $temp[$i] = $var['menu'][$i + 1]; 5728 } 5729 } 5730 else if ($var['level'] == 1) { 5731 if ($var['this_menu'] > 0) { 5732 $temp[$var['this_tab']][$var['this_menu'] - 1] = $var['menu'][$var['this_tab']][$var['this_menu']]; 5733 $temp[$var['this_tab']][$var['this_menu']] = $var['menu'][$var['this_tab']][$var['this_menu'] - 1]; 5734 } 5735 else { 5736 $temp[$var['this_tab']][$temp[$var['this_tab']]['count'] - 1] = $var['menu'][$var['this_tab']][0]; 5737 for ($i = 0; $i < $temp[$var['this_tab']]['count'] - 1; $i++) 5738 $temp[$var['this_tab']][$i] = $var['menu'][$var['this_tab']][$i + 1]; 5739 } 5740 } 5741 else if ($var['level'] == 2) { 5742 if ($var['this_subtab'] > 0) { 5743 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab'] - 1] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]; 5744 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab'] - 1]; 5745 } 5746 else { 5747 $temp[$var['this_tab']][$var['this_menu']][$temp[$var['this_tab']][$var['this_menu']]['count'] - 1] = $var['menu'][$var['this_tab']][$var['this_menu']][0]; 5748 for ($i = 0; $i < $temp[$var['this_tab']][$var['this_menu']]['count'] - 1; $i++) 5749 $temp[$var['this_tab']][$var['this_menu']][$i] = $var['menu'][$var['this_tab']][$var['this_menu']][$i + 1]; 5750 } 5751 } 5752 else if ($var['level'] == 3) { 5753 if ($var['this_submenu'] > 0) { 5754 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['this_submenu'] - 1] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['this_submenu']]; 5755 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['this_submenu']] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['this_submenu'] - 1]; 5756 } 5757 else { 5758 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][$temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] - 1] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][0]; 5759 for ($i = 0; $i < $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] - 1; $i++) 5760 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][$i] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$i + 1]; 5761 } 5762 } 5763 } 5764 else if ($var['form_button'] == 'right') { 5765 if ($var['level'] == 0) { 5766 if ($var['this_tab'] < $temp['count'] - 2) { 5767 $temp[$var['this_tab'] + 1] = $var['menu'][$var['this_tab']]; 5768 $temp[$var['this_tab']] = $var['menu'][$var['this_tab'] + 1]; 5769 } 5770 else { 5771 $temp[0] = $var['menu'][$var['menu']['count'] - 2]; 5772 for ($i = 1; $i < $temp['count'] - 1; $i++) 5773 $temp[$i] = $var['menu'][$i - 1]; 5774 } 5775 } 5776 else if ($var['level'] == 1) { 5777 if ($var['this_menu'] < $temp[$var['this_tab']]['count'] - 1) { 5778 $temp[$var['this_tab']][$var['this_menu'] + 1] = $var['menu'][$var['this_tab']][$var['this_menu']]; 5779 $temp[$var['this_tab']][$var['this_menu']] = $var['menu'][$var['this_tab']][$var['this_menu'] + 1]; 5780 } 5781 else { 5782 $temp[$var['this_tab']][0] = $var['menu'][$var['this_tab']][$var['menu'][$var['this_tab']]['count'] - 1]; 5783 for ($i = 1; $i < $temp[$var['this_tab']]['count']; $i++) 5784 $temp[$var['this_tab']][$i] = $var['menu'][$var['this_tab']][$i - 1]; 5785 } 5786 } 5787 else if ($var['level'] == 2) { 5788 if ($var['this_subtab'] < $temp[$var['this_tab']][$var['this_menu']]['count'] - 1) { 5789 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab'] + 1] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]; 5790 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab'] + 1]; 5791 } 5792 else { 5793 $temp[$var['this_tab']][$var['this_menu']][0] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['menu'][$var['this_tab']][$var['this_menu']]['count'] - 1]; 5794 for ($i = 1; $i < $temp[$var['this_tab']][$var['this_menu']]['count']; $i++) 5795 $temp[$var['this_tab']][$var['this_menu']][$i] = $var['menu'][$var['this_tab']][$var['this_menu']][$i - 1]; 5796 } 5797 } 5798 else if ($var['level'] == 3) { 5799 if ($var['this_submenu'] < $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] - 1) { 5800 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['this_submenu'] + 1] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['this_submenu']]; 5801 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['this_submenu']] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['this_submenu'] + 1]; 5802 } 5803 else { 5804 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][0] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] - 1]; 5805 for ($i = 1; $i < $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count']; $i++) 5806 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][$i] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$i - 1]; 5807 } 5808 } 5809 } 5810 else if (substr($var['form_button'], 0, 3) == 'up_') { 5811 if ($var['level'] == 1) { 5812 if (substr($var['form_button'], -4) == 'left') { 5813 $temp[$var['this_tab']] = $var['menu'][$var['this_tab']][$var['this_menu']]; 5814 $temp[$var['this_tab']]['color'] = $var['menu'][$var['this_tab']]['color']; 5815 for ($i = 0; $i < $temp[$var['this_tab']]['count']; $i++) 5816 for ($j = 0; $j < $temp[$var['this_tab']][$i]['count']; $j++) { 5817 $temp[$var['this_tab']][$i][$j]['color'] = $var['menu'][$var['this_tab']][$var['this_menu']][$i]['color']; 5818 } 5819 for ($i = $var['this_tab'] + 1; $i < $temp['count'] + 1; $i++) 5820 $temp[$i] = $var['menu'][$i - 1]; 5821 $temp['count']++; 5822 for ($i = $var['this_menu']; $i < $var['menu'][$var['this_tab']]['count'] - 1; $i++) 5823 $temp[$var['this_tab'] + 1][$i] = $var['menu'][$var['this_tab']][$i + 1]; 5824 unset($temp[$var['this_tab'] + 1][$var['menu'][$var['this_tab']['count'] - 1]]); 5825 $temp[$var['this_tab'] + 1]['count']--; 5826 $from = str_replace('/', '.', $var['page']); 5827 $var['page'] = $temp[$var['this_tab']]['name']; 5828 $to = str_replace('/', '.', $var['page']); 5829 } 5830 else if (substr($var['form_button'], -5) == 'right') { 5831 $temp[$var['this_tab'] + 1] = $var['menu'][$var['this_tab']][$var['this_menu']]; 5832 $temp[$var['this_tab'] + 1]['color'] = $var['menu'][$var['this_tab']]['color']; 5833 for ($i = 0; $i < $temp[$var['this_tab'] + 1]['count']; $i++) 5834 for ($j = 0; $j < $temp[$var['this_tab'] + 1][$i]['count']; $j++) { 5835 $temp[$var['this_tab'] + 1][$i][$j]['color'] = $var['menu'][$var['this_tab']][$var['this_menu']][$i]['color']; 5836 } 5837 for ($i = $var['this_tab'] + 2; $i < $temp['count'] + 1; $i++) 5838 $temp[$i] = $var['menu'][$i - 1]; 5839 $temp['count']++; 5840 for ($i = $var['this_menu']; $i < $var['menu'][$var['this_tab']]['count'] - 1; $i++) 5841 $temp[$var['this_tab']][$i] = $var['menu'][$var['this_tab']][$i + 1]; 5842 unset($temp[$var['this_tab']][$var['menu'][$var['this_tab']['count'] - 1]]); 5843 $temp[$var['this_tab']]['count']--; 5844 $from = str_replace('/', '.', $var['page']); 5845 $var['page'] = $temp[$var['this_tab'] + 1]['name']; 5846 $to = str_replace('/', '.', $var['page']); 5847 } 5848 } 5849 else if ($var['level'] == 2) { 5850 if (substr($var['form_button'], -4) == 'left') { 5851 $temp[$var['this_tab']][$var['this_menu']] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]; 5852 for ($i = 0; $i < $temp[$var['this_tab']][$var['this_menu']]['count']; $i++) 5853 $temp[$var['this_tab']][$var['this_menu']][$i]['color'] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['color']; 5854 for ($i = $var['this_menu'] + 1; $i < $temp[$var['this_tab']]['count'] + 1; $i++) 5855 $temp[$var['this_tab']][$i] = $var['menu'][$var['this_tab']][$i - 1]; 5856 $temp[$var['this_tab']]['count']++; 5857 for ($i = $var['this_subtab']; $i < $var['menu'][$var['this_tab']][$var['this_menu']]['count'] - 1; $i++) 5858 $temp[$var['this_tab']][$var['this_menu'] + 1][$i] = $var['menu'][$var['this_tab']][$var['this_menu']][$i + 1]; 5859 unset($temp[$var['this_tab']][$var['this_menu'] + 1][$var['menu'][$var['this_tab']][$var['this_menu']['count'] - 1]]); 5860 $temp[$var['this_tab']][$var['this_menu'] + 1]['count']--; 5861 $from = str_replace('/', '.', $var['page']); 5862 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $temp[$var['this_tab']][$var['this_menu']]['name']; 5863 $to = str_replace('/', '.', $var['page']); 5864 } 5865 else if (substr($var['form_button'], -5) == 'right') { 5866 $temp[$var['this_tab']][$var['this_menu'] + 1] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]; 5867 for ($i = 0; $i < $temp[$var['this_tab']][$var['this_menu'] + 1]['count']; $i++) 5868 $temp[$var['this_tab']][$var['this_menu'] + 1][$i]['color'] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['color']; 5869 for ($i = $var['this_menu'] + 2; $i < $temp[$var['this_tab']]['count'] + 1; $i++) 5870 $temp[$var['this_tab']][$i] = $var['menu'][$var['this_tab']][$i - 1]; 5871 $temp[$var['this_tab']]['count']++; 5872 for ($i = $var['this_subtab']; $i < $var['menu'][$var['this_tab']][$var['this_menu']]['count'] - 1; $i++) 5873 $temp[$var['this_tab']][$var['this_menu']][$i] = $var['menu'][$var['this_tab']][$var['this_menu']][$i + 1]; 5874 unset($temp[$var['this_tab']][$var['this_menu']][$var['menu'][$var['this_tab']][$var['this_menu']['count'] - 1]]); 5875 $temp[$var['this_tab']][$var['this_menu']]['count']--; 5876 $from = str_replace('/', '.', $var['page']); 5877 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $temp[$var['this_tab']][$var['this_menu'] + 1]['name']; 5878 $to = str_replace('/', '.', $var['page']); 5879 } 5880 } 5881 else if ($var['level'] == 3) { 5882 if (substr($var['form_button'], -4) == 'left') { 5883 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['this_submenu']]; 5884 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']]['color'] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['color']; 5885 for ($i = $var['this_subtab'] + 1; $i < $temp[$var['this_tab']][$var['this_menu']]['count'] + 1; $i++) 5886 $temp[$var['this_tab']][$var['this_menu']][$i] = $var['menu'][$var['this_tab']][$var['this_menu']][$i - 1]; 5887 $temp[$var['this_tab']][$var['this_menu']]['count']++; 5888 for ($i = $var['this_submenu']; $i < $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] - 1; $i++) 5889 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab'] + 1][$i] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$i + 1]; 5890 unset($temp[$var['this_tab']][$var['this_menu']][$var['this_subtab'] + 1][$var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']['count'] - 1]]); 5891 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab'] + 1]['count']--; 5892 $from = str_replace('/', '.', $var['page']); 5893 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name'] . '/' . $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']]['name']; 5894 $to = str_replace('/', '.', $var['page']); 5895 } 5896 else if (substr($var['form_button'], -5) == 'right') { 5897 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab'] + 1] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['this_submenu']]; 5898 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab'] + 1]['color'] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['color']; 5899 for ($i = $var['this_subtab'] + 2; $i < $temp[$var['this_tab']][$var['this_menu']]['count'] + 1; $i++) 5900 $temp[$var['this_tab']][$var['this_menu']][$i] = $var['menu'][$var['this_tab']][$var['this_menu']][$i - 1]; 5901 $temp[$var['this_tab']][$var['this_menu']]['count']++; 5902 for ($i = $var['this_submenu']; $i < $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] - 1; $i++) 5903 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][$i] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$i + 1]; 5904 unset($temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']['count'] - 1]]); 5905 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count']--; 5906 $from = str_replace('/', '.', $var['page']); 5907 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name'] . '/' . $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab'] + 1]['name']; 5908 $to = str_replace('/', '.', $var['page']); 5909 } 5910 } 5911 rename_pages($from, $to); 5912 } 5913 else if (substr($var['form_button'], 0, 5) == 'down_') { 5914 if ($var['level'] == 0) { 5915 if (substr($var['form_button'], -4) == 'left') { 5916 $temp[$var['this_tab'] - 1][$temp[$var['this_tab'] - 1]['count']] = $var['menu'][$var['this_tab']]; 5917 for ($i = 0; $i < $temp[$var['this_tab'] - 1][$temp[$var['this_tab'] - 1]['count']]['count']; $i++) 5918 $temp[$var['this_tab'] - 1][$temp[$var['this_tab'] - 1]['count']][$i]['color'] = $var['menu'][$var['this_tab']]['color']; 5919 $temp[$var['this_tab'] - 1]['count']++; 5920 for ($i = $var['this_tab']; $i < $var['menu']['count'] - 1; $i++) 5921 $temp[$i] = $temp[$i + 1]; 5922 unset($temp[$var['menu']['count'] - 1]); 5923 $temp['count']--; 5924 $from = str_replace('/', '.', $var['page']); 5925 $var['page'] = $var['menu'][$var['this_tab'] - 1]['name'] . '/' . $var['menu'][$var['this_tab']]['name']; 5926 $to = str_replace('/', '.', $var['page']); 5927 } 5928 else if (substr($var['form_button'], -5) == 'right') { 5929 $temp[$var['this_tab'] + 1][$temp[$var['this_tab'] + 1]['count']] = $var['menu'][$var['this_tab']]; 5930 for ($i = 0; $i < $temp[$var['this_tab'] + 1][$temp[$var['this_tab'] + 1]['count']]['count']; $i++) 5931 $temp[$var['this_tab'] + 1][$temp[$var['this_tab'] + 1]['count']][$i]['color'] = $var['menu'][$var['this_tab']]['color']; 5932 $temp[$var['this_tab'] + 1]['count']++; 5933 for ($i = $var['this_tab']; $i < $var['menu']['count'] - 1; $i++) 5934 $temp[$i] = $temp[$i + 1]; 5935 unset($temp[$var['menu']['count'] - 1]); 5936 $temp['count']--; 5937 $from = str_replace('/', '.', $var['page']); 5938 $var['page'] = $var['menu'][$var['this_tab'] + 1]['name'] . '/' . $var['menu'][$var['this_tab']]['name']; 5939 $to = str_replace('/', '.', $var['page']); 5940 } 5941 } 5942 else if ($var['level'] == 1) { 5943 if (substr($var['form_button'], -4) == 'left') { 5944 $temp[$var['this_tab']][$var['this_menu'] - 1][$temp[$var['this_tab']][$var['this_menu'] - 1]['count']] = $var['menu'][$var['this_tab']][$var['this_menu']]; 5945 $temp[$var['this_tab']][$var['this_menu'] - 1][$temp[$var['this_tab']][$var['this_menu'] - 1]['count']]['color'] = $var['menu'][$var['this_tab']]['color']; 5946 $temp[$var['this_tab']][$var['this_menu'] - 1]['count']++; 5947 for ($i = $var['this_menu']; $i < $var['menu'][$var['this_tab']]['count'] - 1; $i++) 5948 $temp[$var['this_tab']][$i] = $temp[$var['this_tab']][$i + 1]; 5949 unset($temp[$var['this_tab']][$var['menu'][$var['this_tab']]['count'] - 1]); 5950 $temp[$var['this_tab']]['count']--; 5951 $from = str_replace('/', '.', $var['page']); 5952 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu'] - 1]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name']; 5953 $to = str_replace('/', '.', $var['page']); 5954 } 5955 else if (substr($var['form_button'], -5) == 'right') { 5956 $temp[$var['this_tab']][$var['this_menu'] + 1][$temp[$var['this_tab']][$var['this_menu'] + 1]['count']] = $var['menu'][$var['this_tab']][$var['this_menu']]; 5957 $temp[$var['this_tab']][$var['this_menu'] + 1][$temp[$var['this_tab']][$var['this_menu'] + 1]['count']]['color'] = $var['menu'][$var['this_tab']]['color']; 5958 $temp[$var['this_tab']][$var['this_menu'] + 1]['count']++; 5959 for ($i = $var['this_menu']; $i < $var['menu'][$var['this_tab']]['count'] - 1; $i++) 5960 $temp[$var['this_tab']][$i] = $temp[$var['this_tab']][$i + 1]; 5961 unset($temp[$var['this_tab']][$var['menu'][$var['this_tab']]['count'] - 1]); 5962 $temp[$var['this_tab']]['count']--; 5963 $from = str_replace('/', '.', $var['page']); 5964 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu'] + 1]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name']; 5965 $to = str_replace('/', '.', $var['page']); 5966 } 5967 } 5968 else if ($var['level'] == 2) { 5969 if (substr($var['form_button'], -4) == 'left') { 5970 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab'] - 1][$temp[$var['this_tab']][$var['this_menu']][$var['this_subtab'] - 1]['count']] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]; 5971 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab'] - 1]['count']++; 5972 for ($i = $var['this_subtab']; $i < $var['menu'][$var['this_tab']][$var['this_menu']]['count'] - 1; $i++) 5973 $temp[$var['this_tab']][$var['this_menu']][$i] = $temp[$var['this_tab']][$var['this_menu']][$i + 1]; 5974 unset($temp[$var['this_tab']][$var['this_menu']][$var['menu'][$var['this_tab']][$var['this_menu']]['count'] - 1]); 5975 $temp[$var['this_tab']][$var['this_menu']]['count']--; 5976 $from = str_replace('/', '.', $var['page']); 5977 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab'] - 1]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['name']; 5978 $to = str_replace('/', '.', $var['page']); 5979 } 5980 else if (substr($var['form_button'], -5) == 'right') { 5981 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab'] + 1][$temp[$var['this_tab']][$var['this_menu']][$var['this_subtab'] + 1]['count']] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]; 5982 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab'] + 1]['count']++; 5983 for ($i = $var['this_subtab']; $i < $var['menu'][$var['this_tab']][$var['this_menu']]['count'] - 1; $i++) 5984 $temp[$var['this_tab']][$var['this_menu']][$i] = $temp[$var['this_tab']][$var['this_menu']][$i + 1]; 5985 unset($temp[$var['this_tab']][$var['this_menu']][$var['menu'][$var['this_tab']][$var['this_menu']]['count'] - 1]); 5986 $temp[$var['this_tab']][$var['this_menu']]['count']--; 5987 $from = str_replace('/', '.', $var['page']); 5988 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab'] + 1]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['name']; 5989 $to = str_replace('/', '.', $var['page']); 5990 } 5991 } 5992 rename_pages($from, $to); 5993 } 5994 else if ($var['form_button'] == 'add') { 5995 $data = explode('/', $var['page']); 5996 $data[count($data) - 1] = 'new_' . $var['microtime']; 5997 $filename = implode('.', $data) . '.' . $var['lang'] . '.txt'; 5998 copy('data/templates/default.txt', "data/pages/$filename"); 5999 if ($var['level'] == 0) { 6000 $temp[$var['this_tab'] + 1] = array('name' => 'new_' . $var['microtime'], 'title' => array('en' => 'New', 'de' => 'Neu'), 'status' => 'hidden', 'color' => $var['menu'][$var['this_tab']]['color']); 6001 for ($i = $var['this_tab'] + 2; $i < $temp['count'] + 1; $i++) 6002 $temp[$i] = $var['menu'][$i - 1]; 6003 $temp['count']++; 6004 $temp[$var['this_tab'] + 1][0] = array('name' => 'new_' . $var['microtime'], 'title' => array('en' => 'New', 'de' => 'Neu'), 'status' => 'public', 'color' => $var['menu'][$var['this_tab']]['color']); 6005 $temp[$var['this_tab'] + 1]['count'] = 1; 6006 $var['page'] = $temp[$var['this_tab'] + 1]['name']; 6007 } 6008 else if ($var['level'] == 1) { 6009 $temp[$var['this_tab']][$var['this_menu'] + 1] = array('name' => 'new_' . $var['microtime'], 'title' => array('en' => 'New', 'de' => 'Neu'), 'status' => 'hidden', 'color' => $var['menu'][$var['this_tab']]['color']); 6010 for ($i = $var['this_menu'] + 2; $i < $temp[$var['this_tab']]['count'] + 1; $i++) 6011 $temp[$var['this_tab']][$i] = $var['menu'][$var['this_tab']][$i - 1]; 6012 $temp[$var['this_tab']]['count']++; 6013 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $temp[$var['this_tab']][$var['this_menu'] + 1]['name']; 6014 } 6015 else if ($var['level'] == 2) { 6016 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab'] + 1] = array('name' => 'new_' . $var['microtime'], 'title' => array('en' => 'New', 'de' => 'Neu'), 'status' => 'hidden', 'color' => $var['menu'][$var['this_tab']]['color']); 6017 for ($i = $var['this_subtab'] + 2; $i < $temp[$var['this_tab']][$var['this_menu']]['count'] + 1; $i++) 6018 $temp[$var['this_tab']][$var['this_menu']][$i] = $var['menu'][$var['this_tab']][$var['this_menu']][$i - 1]; 6019 $temp[$var['this_tab']][$var['this_menu']]['count']++; 6020 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name'] . '/' . $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab'] + 1]['name']; 6021 } 6022 else if ($var['level'] == 3) { 6023 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['this_submenu'] + 1] = array('name' => 'new_' . $var['microtime'], 'title' => array('en' => 'New', 'de' => 'Neu'), 'status' => 'hidden'); 6024 for ($i = $var['this_submenu'] + 2; $i < $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] + 1; $i++) 6025 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][$i] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$i - 1]; 6026 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count']++; 6027 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['name'] . '/' . $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['this_submenu'] + 1]['name']; 6028 } 6029 } 6030 else if ($var['form_button'] == 'delete') { 6031 delete_file('data/pages/' . str_replace('/', '.', $var['page']) . '.' . $var['lang'] . '.txt'); 6032 if ($var['level'] == 0) { 6033 for ($i = $var['this_tab']; $i < $var['menu']['count'] - 1; $i++) 6034 $temp[$i] = $var['menu'][$i + 1]; 6035 unset($temp[$temp['count'] - 1]); 6036 $temp['count']--; 6037 if ($var['this_tab'] > 0) 6038 $var['page'] = $var['menu'][$var['this_tab'] - 1]['name']; 6039 else 6040 $var['page'] = $var['menu'][1]['name']; 6041 } 6042 else if ($var['level'] == 1) { 6043 for ($i = $var['this_menu']; $i < $var['menu'][$var['this_tab']]['count'] - 1; $i++) 6044 $temp[$var['this_tab']][$i] = $var['menu'][$var['this_tab']][$i + 1]; 6045 unset($temp[$var['this_tab']][$temp[$var['this_tab']['count'] - 1]]); 6046 $temp[$var['this_tab']]['count']--; 6047 if ($var['this_menu'] > 0) 6048 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu'] - 1]['name']; 6049 else 6050 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][1]['name']; 6051 } 6052 else if ($var['level'] == 2) { 6053 for ($i = $var['this_subtab']; $i < $var['menu'][$var['this_tab']][$var['this_menu']]['count'] - 1; $i++) 6054 $temp[$var['this_tab']][$var['this_menu']][$i] = $var['menu'][$var['this_tab']][$var['this_menu']][$i + 1]; 6055 unset($temp[$var['this_tab']][$var['this_menu']][$temp[$var['this_tab']][$var['this_menu']['count'] - 1]]); 6056 $temp[$var['this_tab']][$var['this_menu']]['count']--; 6057 if ($var['menu'][$var['this_tab']][$var['this_menu']]['count'] > 1) { 6058 if ($var['this_subtab'] > 0) 6059 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab'] - 1]['name']; 6060 else 6061 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']][1]['name']; 6062 } 6063 else { 6064 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name']; 6065 unset($var['this_subtab']); 6066 } 6067 } 6068 else if ($var['level'] == 3) { 6069 for ($i = $var['this_submenu']; $i < $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] - 1; $i++) 6070 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][$i] = $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$i + 1]; 6071 unset($temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][$temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']['count'] - 1]]); 6072 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count']--; 6073 if ($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count'] > 1) { 6074 if ($var['this_submenu'] > 0) 6075 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][$var['this_submenu'] - 1]['name']; 6076 else 6077 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][1]['name']; 6078 } 6079 else { 6080 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['name']; 6081 unset($var['this_submenu']); 6082 } 6083 } 6084 } 6085 else if ($var['form_button'] == 'insert') { 6086 if ($var['level'] == 1) { 6087 $temp[$var['this_tab']][$var['this_menu']][0] = array('name' => 'new_' . $var['microtime'], 'title' => array('en' => 'New', 'de' => 'Neu'), 'status' => 'public', 'color' => $var['menu'][$var['this_tab']]['color']); 6088 $temp[$var['this_tab']][$var['this_menu']]['count']++; 6089 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name'] . '/' . $temp[$var['this_tab']][$var['this_menu']][0]['name']; 6090 } 6091 else if ($var['level'] == 2) { 6092 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][0] = array('name' => 'new_' . $var['microtime'], 'title' => array('en' => 'New', 'de' => 'Neu'), 'status' => 'public', 'color' => $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['color']); 6093 $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']]['count']++; 6094 $var['page'] = $var['menu'][$var['this_tab']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']]['name'] . '/' . $var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']]['name'] . '/' . $temp[$var['this_tab']][$var['this_menu']][$var['this_subtab']][0]['name']; 6095 } 6096 } 6097 $f = fopen('data/system/menus.dat', 'w'); 6098 for ($i = 0; $i < $temp['count']; $i++) { 6099 if ($i > 0) 6100 fputs($f, chr(10) . chr(10)); 6101 fputs($f, 'tab.name = ' . $temp[$i]['name']); 6102 fputs($f, chr(10) . 'tab.title.en = ' . $temp[$i]['title']['en']); 6103 fputs($f, chr(10) . 'tab.title.de = ' . $temp[$i]['title']['de']); 6104 fputs($f, chr(10) . 'tab.status = ' . $temp[$i]['status']); 6105 fputs($f, chr(10) . 'tab.color = ' . $temp[$i]['color']); 6106 if (isset($temp[$i][0])) { 6107 for ($j = 0; $j < $temp[$i]['count']; $j++) { 6108 fputs($f, chr(10) . chr(10) . ' menu.name = ' . $temp[$i][$j]['name']); 6109 fputs($f, chr(10) . ' menu.title.en = ' . $temp[$i][$j]['title']['en']); 6110 fputs($f, chr(10) . ' menu.title.de = ' . $temp[$i][$j]['title']['de']); 6111 fputs($f, chr(10) . ' menu.status = ' . $temp[$i][$j]['status']); 6112 if (isset($temp[$i][$j][0])) { 6113 for ($k = 0; $k < $temp[$i][$j]['count']; $k++) { 6114 fputs($f, chr(10) . chr(10) . ' subtab.name = ' . $temp[$i][$j][$k]['name']); 6115 fputs($f, chr(10) . ' subtab.title.en = ' . $temp[$i][$j][$k]['title']['en']); 6116 fputs($f, chr(10) . ' subtab.title.de = ' . $temp[$i][$j][$k]['title']['de']); 6117 fputs($f, chr(10) . ' subtab.status = ' . $temp[$i][$j][$k]['status']); 6118 fputs($f, chr(10) . ' subtab.color = ' . $temp[$i][$j][$k]['color']); 6119 if (isset($temp[$i][$j][$k][0])) { 6120 for ($l = 0; $l < $temp[$i][$j][$k]['count']; $l++) { 6121 fputs($f, chr(10) . chr(10) . ' submenu.name = ' . $temp[$i][$j][$k][$l]['name']); 6122 fputs($f, chr(10) . ' submenu.title.en = ' . $temp[$i][$j][$k][$l]['title']['en']); 6123 fputs($f, chr(10) . ' submenu.title.de = ' . $temp[$i][$j][$k][$l]['title']['de']); 6124 fputs($f, chr(10) . ' submenu.status = ' . $temp[$i][$j][$k][$l]['status']); 6125 } 6126 } 6127 } 6128 } 6129 } 6130 } 6131 } 6132 fclose($f); 6133 chmod('data/system/menus.dat', 0666); 6134 $var['menu'] = read_file('data/system/menus.dat'); 6135 get_count(); 6136 check_page(); 6137 } 6138 6139 // ----------------------------------------------------------------------------- 6140 6141 function save_page() { 6142 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 6143 if ($var['this_page']['name'] != 'templates') 6144 $dirname = 'pages'; 6145 else 6146 $dirname = 'templates'; 6147 $layout = get_layout("data/$dirname/" . $var['old_filename']); 6148 // echo $dirname . '/' . $var['new_filename'] . ' == ' . $dirname . '/' . $var['old_filename']; exit; 6149 if ($var['new_filename'] != $var['old_filename']) 6150 unlink("data/$dirname/" . $var['old_filename']); 6151 $f = fopen("data/$dirname/" . $var['new_filename'], 'w'); 6152 fputs($f, '<column>' . $var['layout'][$layout][0]['width'] . '</column>' . chr(10) . $var['form_column_0']); 6153 if (substr($layout, 0, 1) > 1) 6154 fputs($f, chr(10) . '<column>' . $var['layout'][$layout][1]['width'] . '</column>' . chr(10) . $var['form_column_1']); 6155 if (substr($layout, 0, 1) > 2) 6156 fputs($f, chr(10) . '<column>' . $var['layout'][$layout][2]['width'] . '</column>' . chr(10) . $var['form_column_2']); 6157 if (substr($layout, 0, 1) == 4) 6158 fputs($f, chr(10) . '<column>' . $var['layout'][$layout][3]['width'] . '</column>' . chr(10) . $var['form_column_3']); 6159 fclose($f); 6160 // chmod("data/$dirname/" . $var['new_filename'], 0666); 6161 } 6162 6163 // ----------------------------------------------------------------------------- 6164 6165 function save_layout() { 6166 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 6167 $data = explode('_', $var['form_button']); 6168 $layout = $data[1]; 6169 $counter = 0; 6170 if ($var['this_page']['name'] != 'templates') { 6171 $dirname = 'pages'; 6172 $filename = $var['pagefile']; 6173 } 6174 else { 6175 $dirname = 'templates'; 6176 $filename = $var['view'] . '.txt'; 6177 } 6178 $file = file("data/$dirname/$filename"); 6179 for ($i = 0; $i < count($file); $i++) { 6180 $file[$i] = chop($file[$i]); 6181 if (strstr($file[$i], '<column>')) { 6182 if ($counter < count($var['layout'][$layout])) 6183 $file[$i] = '<column>' . $var['layout'][$layout][$counter]['width'] . '</column>'; 6184 else 6185 $file[$i] = ''; 6186 $counter++; 6187 } 6188 } 6189 if ($counter < count($var['layout'][$layout])) { 6190 for ($i = $counter; $i < count($var['layout'][$layout]); $i++) 6191 $file[count($file)] = '<column>' . $var['layout'][$layout][$i]['width'] . '</column>'; 6192 } 6193 $f = fopen("data/$dirname/$filename", 'w'); 6194 fputs($f, implode(chr(10), $file)); 6195 fclose($f); 6196 // chmod("data/$dirname/$filename", 0666); 6197 } 6198 6199 // ----------------------------------------------------------------------------- 6200 6201 function save_database() { 6202 6203 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 6204 global $HTTP_USER_AGENT, $HTTP_POST_FILES; 6205 6206 if ($var['form_button'] == 'subscribe') { 6207 if (valid('e-mail', $var['form_e_mail'])) { 6208 if (file_exists('data/newsletter/subscribers/' . $var['form_e_mail'] . '.dat')) 6209 $filedata = read_file('data/newsletter/subscribers/' . $var['form_e_mail'] . '.dat'); 6210 if (!file_exists('data/newsletter/subscribers/' . $var['form_e_mail'] . '.dat') || $filedata['status'] != 'subscribed') { 6211 create_request('subscribe ' . strtolower($var['form_e_mail'])); 6212 send_request(); 6213 $var['result'] = 'success'; 6214 $var['alert'] = $var['success']['confirm'][$var['lang']]; 6215 } 6216 else { 6217 $var['result'] = 'error'; 6218 $var['alert'] = $var['error']['mail_exists'][$var['lang']]; 6219 } 6220 } 6221 else { 6222 $var['result'] = 'error'; 6223 $var['alert'] = $var['error']['e-mail'][$var['lang']]; 6224 } 6225 } 6226 6227 else if ($var['form_button'] == 'add') { 6228 if ($var['this_page']['name'] == 'templates') 6229 copy('data/templates/default.txt', 'data/templates/new_' . $var['microtime'] . '.txt'); 6230 echo "<script language=javascript>\n"; 6231 echo 'document.location.href = "main.php?page=' . $var['page'] . '&lang=' . $var['lang'] . '&view=new_' . $var['microtime']; 6232 if ($var['sort']) 6233 echo '&sort=' . $var['sort']; 6234 if ($var['mode'] == 'user' || $var['mode'] == 'admin') 6235 echo '&mode=' . $var['mode'] . '&ssid=' . $var['ssid']; 6236 echo "\";\n"; 6237 echo "</script>\n"; 6238 exit; 6239 } 6240 6241 else if ($var['form_button'] == 'delete') { 6242 if ($var['this_page']['name'] == 'accounts') 6243 delete_file('data/accounts/' . $var['admin_file'][$var['view']] . '.dat'); 6244 else if ($var['this_page']['name'] == 'user_tags') 6245 delete_entry('data/system/tags.dat', $var['view']); 6246 else if ($var['this_page']['name'] == 'templates') 6247 delete_file('data/templates/' . $var['view'] . '.txt'); 6248 else if ($var['this_page']['name'] == 'addresses' || $var['this_page']['name'] == 'links') 6249 delete_file('data/' . $var['this_page']['name'] . '/' . $var['view'] . '.dat'); 6250 else if ($var['this_page']['name'] == 'filters') 6251 unlink('data/newsletter/filters/' . $var['view'] . '.dat'); 6252 else if ($var['this_page']['name'] == 'unsent') 6253 delete_file('data/newsletter/messages/unsent/' . $var['view'] . '.dat'); 6254 else if ($var['this_page']['name'] == 'subscribers') 6255 delete_file('data/newsletter/subscribers/' . $var['view'] . '.dat'); 6256 else if ($var['this_page']['name'] == 'trash') { 6257 if ($var['type'] == 'page') 6258 $filename = $var['type'] . '.' . str_replace('/', '.', $var['view']); 6259 else if ($var['type'] != 'account') 6260 $filename = $var['type'] . '.' . $var['view']; 6261 else { 6262 $f = read_dir('data/trash'); 6263 for ($i = 0; $i < count($f); $i++) { 6264 if ($f[$i]['type'] = 'account') { 6265 $file = file('data/trash/' . $f[$i]['filename']); 6266 $data = explode(' = ', chop($file[0])); 6267 if ($data[1] == $var['view']) 6268 $filename = $f[$i]['filename']; 6269 } 6270 } 6271 } 6272 if ($var ['type'] == 'page') 6273 $extension = '.txt'; 6274 if ($var['type'] == 'address' || $var['type'] == 'link') 6275 $extension = '.dat'; 6276 unlink("data/trash/$filename$extension"); 6277 } 6278 else 6279 delete_file('data/' . $var['this_page']['name'] . '/' . $var['view']); 6280 $var['view'] = ''; 6281 } 6282 6283 else if ($var['form_button'] == 'import') { 6284 echo "<script language=javascript>\n"; 6285 echo 'document.location.href = "main.php?page=' . $var['page'] . '&lang=' . $var['lang'] . '&view=import_' . $var['microtime']; 6286 if ($var['sort']) 6287 echo '&sort=' . $var['sort']; 6288 echo '&mode=admin&ssid=' . $var['ssid']; 6289 echo "\";\n"; 6290 echo "</script>\n"; 6291 exit; 6292 } 6293 6294 else if ($var['form_button'] == 'export') { 6295 echo "<script language=javascript>\n"; 6296 echo 'document.location.href = "main.php?page=' . $var['page'] . '&lang=' . $var['lang'] . '&view=export_' . $var['microtime']; 6297 if ($var['sort']) 6298 echo '&sort=' . $var['sort']; 6299 echo '&mode=admin&ssid=' . $var['ssid']; 6300 echo "\";\n"; 6301 echo "</script>\n"; 6302 exit; 6303 } 6304 6305 else if ($var['form_button'] == 'save' || $var['form_button'] == 'copy') { 6306 if ($var['this_page']['name'] == 'bugs') { 6307 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) { 6308 if (valid('e-mail', $var['form_e_mail'])) { 6309 if ($var['form_comment']) { 6310 get_bugdata(); 6311 $f = fopen('data/bugs/' . $var['bugdata']['filename'] . '/' . $var['microtime'] . '.txt', 'w'); 6312 if ($var['form_name']) 6313 fputs($f, $var['form_name'] . ' <' . $var['form_e_mail'] . '>'); 6314 else 6315 fputs($f, $var['form_e_mail']); 6316 fputs($f, ' "' . $HTTP_USER_AGENT . '"'); 6317 fputs($f, chr(10) . $var['form_comment']); 6318 fclose($f); 6319 chmod('data/bugs/' . $var['bugdata']['filename'] . '/' . $var['microtime'] . '.txt', 0666); 6320 $var['form_name'] = ''; 6321 $var['form_e_mail'] = ''; 6322 $var['form_comment'] = ''; 6323 } 6324 else { 6325 $var['result'] = 'error'; 6326 $var['alert'] = $var['error']['comment'][$var['lang']]; 6327 } 6328 } 6329 else { 6330 $var['result'] = 'error'; 6331 $var['alert'] = $var['error']['e-mail'][$var['lang']]; 6332 } 6333 } 6334 else { 6335 if (valid('e-mail', $var['form_e_mail'])) { 6336 if ($var['form_summary']) { 6337 if ($var['form_description']) { 6338 umask(0); 6339 mkdir('data/bugs/' . $var['microtime'], 0777); 6340 $f = fopen('data/bugs/' . $var['microtime'] . '/' . $var['microtime'] . '.dat', 'w'); 6341 fputs($f, 'name = ' . $var['form_summary']); 6342 for ($i = 0; $i < count($var['bug']['parameter']); $i++) 6343 fputs($f, chr(10) . $var['bug']['parameter'][$i]['name'] . ' = ' . $var['form_' . $var['bug']['parameter'][$i]['name']]); 6344 fclose($f); 6345 chmod('data/bugs/' . $var['microtime'] . '/' . $var['microtime'] . '.dat', 0666); 6346 $f = fopen('data/bugs/' . $var['microtime'] . '/' . $var['microtime'] . '.txt', 'w'); 6347 if ($var['form_name']) 6348 fputs($f, $var['form_name'] . ' <' . $var['form_e_mail'] . '>'); 6349 else 6350 fputs($f, $var['form_e_mail']); 6351 fputs($f, ' "' . $HTTP_USER_AGENT . '"'); 6352 fputs($f, chr(10) . $var['form_description']); 6353 fclose($f); 6354 chmod('data/bugs/' . $var['microtime'] . '/' . $var['microtime'] . '.txt', 0666); 6355 $count = 0; 6356 $d = dir('data/bugs'); 6357 while ($f = $d->read()) { 6358 if (substr($f, 0, 1) != '.') 6359 $count++; 6360 } 6361 $var['view'] = $count; 6362 } 6363 else { 6364 $var['result'] = 'error'; 6365 $var['alert'] = $var['error']['description'][$var['lang']]; 6366 } 6367 } 6368 else { 6369 $var['result'] = 'error'; 6370 $var['alert'] = $var['error']['summary'][$var['lang']]; 6371 } 6372 } 6373 else { 6374 $var['result'] = 'error'; 6375 $var['alert'] = $var['error']['e-mail'][$var['lang']]; 6376 } 6377 } 6378 } 6379 else if ($var['this_page']['name'] == 'accounts') { 6380 if (valid('username', $var['form_username'])) { 6381 if (valid('password', $var['form_password'])) { 6382 if ($var['form_repeat'] == $var['form_password']) { 6383 if (valid('e-mail', $var['form_e_mail'])) { 6384 if ($var['form_username'] == $var['view'] || !$var['admin_file'][$var['form_username']]) { 6385 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) 6386 $f = fopen('data/accounts/' . $var['admin_file'][$var['view']] . '.dat', 'w'); 6387 else 6388 $f = fopen('data/accounts/' . $var['microtime'] . '.dat', 'w'); 6389 fputs($f, 'username = ' . $var['form_username']); 6390 fputs($f, chr(10) . 'password = ' . encrypt($var['form_password'])); 6391 fputs($f, chr(10) . 'e-mail = ' . $var['form_e_mail']); 6392 fclose($f); 6393 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) 6394 chmod('data/accounts/' . $var['admin_file'][$var['view']] . '.dat', 0666); 6395 else 6396 chmod('data/accounts/' . $var['microtime'] . '.dat', 0666); 6397 get_admindata(); 6398 $var['view'] = $var['form_username']; 6399 $var['result'] = 'success'; 6400 $var['alert'] = $var['success']['save'][$var['lang']]; 6401 } 6402 else { 6403 $var['result'] = 'error'; 6404 $var['alert'] = $var['error']['exists'][$var['lang']]; 6405 } 6406 } 6407 else { 6408 $var['result'] = 'error'; 6409 $var['alert'] = $var['error']['e-mail'][$var['lang']]; 6410 } 6411 } 6412 else { 6413 $var['result'] = 'error'; 6414 $var['alert'] = $var['error']['repeat'][$var['lang']]; 6415 } 6416 } 6417 else { 6418 $var['result'] = 'error'; 6419 $var['alert'] = $var['error']['password'][$var['lang']]; 6420 } 6421 } 6422 else { 6423 $var['result'] = 'error'; 6424 $var['alert'] = $var['error']['username'][$var['lang']]; 6425 } 6426 } 6427 else if ($var['this_page']['name'] == 'user_tags') { 6428 $filedata = read_file('data/system/tags.dat'); 6429 if (!$filedata[$var['form_name']] || $var['form_name'] == $var['view']) { 6430 if (valid('tagname', $var['form_name'])) { 6431 if (!$var['form_alias'] || valid('tagname', $var['form_tag'])) { 6432 if ($var['form_html']) { 6433 $filedata[$var['form_name']]['alias'] = $var['form_alias']; 6434 $filedata[$var['form_name']]['html'] = $var['form_html']; 6435 $filedata[$var['form_name']]['help'][$var['lang']] = $var['form_help']; 6436 $filedata[$var['form_name']]['help'][$var['other_language']] = $filedata[$var['view']]['help'][$var['other_language']]; 6437 if ($filedata[$var['view']] && $var['view'] != $var['form_name']) 6438 unset($filedata[$var['view']]); 6439 ksort($filedata); 6440 save_file('data/system/tags.dat', $filedata); 6441 $var['result'] = 'success'; 6442 $var['alert'] = $var['success']['save'][$var['lang']]; 6443 $var['view'] = $var['form_name']; 6444 } 6445 else { 6446 $var['result'] = 'error'; 6447 $var['alert'] = $var['error']['html'][$var['lang']]; 6448 } 6449 } 6450 else { 6451 $var['result'] = 'error'; 6452 $var['alert'] = $var['error']['aliasname'][$var['lang']]; 6453 } 6454 } 6455 else { 6456 $var['result'] = 'error'; 6457 $var['alert'] = $var['error']['tagname'][$var['lang']]; 6458 } 6459 } 6460 else { 6461 $var['result'] = 'error'; 6462 $var['alert'] = $var['error']['exists'][$var['lang']]; 6463 } 6464 } 6465 else if ($var['this_page']['name'] == 'news') { 6466 if (valid('pagename', $var['form_name'])) { 6467 if ($var['form_text']) { 6468 if (valid('url', $var['form_link'])) { 6469 if ($var['form_name'] == $var['view'] || !file_exists('data/news/' . $var['form_name'] . '.dat')) { 6470 if (file_exists('data/news/' . $var['view'] . '.dat')) { 6471 $filedata = read_file('data/news/' . $var['view'] . '.dat'); 6472 unlink('data/news/' . $var['view'] . '.dat'); 6473 } 6474 $f = fopen('data/news/' . $var['form_name'] . '.dat', 'w'); 6475 if ($var['lang'] == 'en') 6476 fputs($f, 'text.en = ' . $var['form_text'] . "\n"); 6477 else 6478 fputs($f, 'text.en = ' . $filedata['text']['en'] . "\n"); 6479 if ($var['lang'] == 'en') 6480 fputs($f, 'text.de = ' . $filedata['text']['de'] . "\n"); 6481 else 6482 fputs($f, 'text.de = ' . $var['form_text'] . "\n"); 6483 fputs($f, 'link = ' . $var['form_link'] . "\n"); 6484 fputs($f, 'status = ' . $var['form_status']); 6485 fclose($f); 6486 chmod('data/news/' . $var['form_name'] . '.dat', 0666); 6487 if ($var['form_name'] != $var['view']) 6488 rename_data($var['view'], $var['form_name']); 6489 $var['result'] = 'success'; 6490 $var['alert'] = $var['success'][$var['form_button']][$var['lang']]; 6491 $var['view'] = $var['form_name']; 6492 } 6493 else { 6494 $var['result'] = 'error'; 6495 $var['alert'] = $var['error']['exists'][$var['lang']]; 6496 } 6497 } 6498 else { 6499 $var['result'] = 'error'; 6500 $var['alert'] = $var['error']['url'][$var['lang']]; 6501 } 6502 } 6503 else { 6504 $var['result'] = 'error'; 6505 $var['alert'] = $var['error']['text'][$var['lang']]; 6506 } 6507 } 6508 else { 6509 $var['result'] = 'error'; 6510 $var['alert'] = $var['error']['name'][$var['lang']]; 6511 } 6512 } 6513 else if ($var['this_page']['name'] == 'templates') { 6514 if (valid('pagename', $var['form_page'])) { 6515 $var['old_filename'] = $var['view'] . '.txt'; 6516 $var['new_filename'] = $var['form_page'] . '.txt'; 6517 if ($var['new_filename'] == $var['old_filename'] || !file_exists('data/templates/' . $var['new_filename'])) { 6518 save_page(); 6519 $var['result'] = 'success'; 6520 $var['alert'] = $var['success']['save'][$var['lang']]; 6521 $var['view'] = $var['form_page']; 6522 } 6523 else { 6524 $var['result'] = 'error'; 6525 $var['alert'] = $var['error']['exists'][$var['lang']]; 6526 } 6527 } 6528 else { 6529 $var['result'] = 'error'; 6530 $var['alert'] = $var['error']['name'][$var['lang']]; 6531 } 6532 } 6533 else if ($var['this_page']['name'] == 'images' || $var['this_page']['name'] == 'documents') { 6534 if ($var['form_name'] != $var['view']) { 6535 if (valid('filename', $var['form_name'])) { 6536 if (!file_exists('data/' . $var['this_page']['name'] . '/' . $var['form_name'])) { 6537 rename('data/' . $var['this_page']['name'] . '/' . $var['view'], 'data/' . $var['this_page']['name'] . '/' . $var['form_name']); 6538 rename_data($var['view'], $var['form_name']); 6539 $var['result'] = 'success'; 6540 $var['alert'] = $var['success']['save'][$var['lang']]; 6541 $var['view'] = $var['form_name']; 6542 } 6543 else { 6544 $var['result'] = 'error'; 6545 $var['alert'] = $var['error']['exists'][$var['lang']]; 6546 } 6547 } 6548 else { 6549 $var['result'] = 'error'; 6550 $var['alert'] = $var['error']['name'][$var['lang']]; 6551 } 6552 } 6553 } 6554 else if ($var['this_page']['name'] == 'addresses') { 6555 if (valid('pagename', $var['form_name'])) { 6556 if ($var['form_organization_1']) { 6557 if ((!$var['form_e_mail_1'] || valid('e-mail', $var['form_e_mail_1'])) && (!$var['form_e_mail_2'] || valid('e-mail', $var['form_e_mail_2']))) { 6558 if (!$var['form_internet'] || valid('url', $var['form_internet'])) { 6559 if ($var['form_name'] == $var['view'] || !file_exists('data/addresses/' . $var['form_name'] . '.dat')) { 6560 if (file_exists('data/addresses/' . $var['view'] . '.dat')) { 6561 $filedata = read_file('data/addresses/' . $var['view'] . '.dat'); 6562 unlink('data/addresses/' . $var['view'] . '.dat'); 6563 } 6564 $var['form_description'] = str_replace(chr(13) . chr(10), '<br>', $var['form_description']); 6565 $f = fopen('data/addresses/' . $var['form_name'] . '.dat', 'w'); 6566 for ($i = 1; $i < count($var['database']['address']); $i++) { 6567 if ($i > 1) 6568 fputs($f, chr(10)); 6569 if ($var['database']['address'][$i]['name'] != 'organization_1' && $var['database']['address'][$i]['name'] != 'organization_2' && $var['database']['address'][$i]['name'] != 'city' && $var['database']['address'][$i]['name'] != 'state' && $var['database']['address'][$i]['name'] != 'country' && $var['database']['address'][$i]['name'] != 'description') 6570 fputs($f, $var['database']['address'][$i]['name'] . ' = ' . $var['form_' . $var['database']['address'][$i]['name']]); 6571 else { 6572 $data = ''; 6573 if ($var['lang'] == 'en') 6574 $data = $var['form_' . $var['database']['address'][$i]['name']]; 6575 else { 6576 if ($var['preference']['automatic_translation'] == 'active') { 6577 reset($var['translation']['de']); 6578 while (list($k, $v) = each($var['translation']['de'])) { 6579 if ($k == $var['form_' . $var['database']['address'][$i]['name']]) { 6580 $data = $v; 6581 break; 6582 } 6583 } 6584 } 6585 if (!$data) { 6586 if ($var['form_button'] == 'save') 6587 $data = $filedata[$var['database']['address'][$i]['name']]['en']; 6588 else 6589 $data = $var['form_' . $var['database']['address'][$i]['name']]; 6590 } 6591 } 6592 fputs($f, $var['database']['address'][$i]['name'] . ".en = $data"); 6593 fputs($f, chr(10)); 6594 $data = ''; 6595 if ($var['lang'] == 'de') 6596 $data = $var['form_' . $var['database']['address'][$i]['name']]; 6597 else { 6598 if ($var['preference']['automatic_translation'] == 'active') { 6599 reset($var['translation']['en']); 6600 while (list($k, $v) = each($var['translation']['en'])) { 6601 if ($k == $var['form_' . $var['database']['address'][$i]['name']]) { 6602 $data = $v; 6603 break; 6604 } 6605 } 6606 } 6607 if (!$data) { 6608 if ($var['form_button'] == 'save') 6609 $data = $filedata[$var['database']['address'][$i]['name']]['de']; 6610 else 6611 $data = $var['form_' . $var['database']['address'][$i]['name']]; 6612 } 6613 } 6614 fputs($f, $var['database']['address'][$i]['name'] . ".de = $data"); 6615 } 6616 } 6617 fclose($f); 6618 chmod('data/addresses/' . $var['form_name'] . '.dat', 0666); 6619 if ($var['form_name'] != $var['view']) 6620 rename_data($var['view'], $var['form_name']); 6621 $var['result'] = 'success'; 6622 $var['alert'] = $var['success'][$var['form_button']][$var['lang']]; 6623 $var['view'] = $var['form_name']; 6624 } 6625 else { 6626 $var['result'] = 'error'; 6627 $var['alert'] = $var['error']['exists'][$var['lang']]; 6628 } 6629 } 6630 else { 6631 $var['result'] = 'error'; 6632 $var['alert'] = $var['error']['url'][$var['lang']]; 6633 } 6634 } 6635 else { 6636 $var['result'] = 'error'; 6637 $var['alert'] = $var['error']['e-mails'][$var['lang']]; 6638 } 6639 } 6640 else { 6641 $var['result'] = 'error'; 6642 $var['alert'] = $var['error']['organization'][$var['lang']]; 6643 } 6644 } 6645 else { 6646 $var['result'] = 'error'; 6647 $var['alert'] = $var['error']['name'][$var['lang']]; 6648 } 6649 } 6650 else if ($var['this_page']['name'] == 'links') { 6651 if (valid('pagename', $var['form_name'])) { 6652 if ($var['form_title']) { 6653 if (valid('url', $var['form_url'])) { 6654 if ($var['form_name'] == $var['view'] || !file_exists('data/links/' . $var['form_name'] . '.dat')) { 6655 if (file_exists('data/links/' . $var['view'] . '.dat')) { 6656 $filedata = read_file('data/links/' . $var['view'] . '.dat'); 6657 unlink('data/links/' . $var['view'] . '.dat'); 6658 } 6659 $var['form_description'] = str_replace(chr(13) . chr(10), '<br>', $var['form_description']); 6660 $f = fopen('data/links/' . $var['form_name'] . '.dat', 'w'); 6661 for ($i = 1; $i < count($var['database']['link']); $i++) { 6662 if ($i > 1) 6663 fputs($f, chr(10)); 6664 if ($var['database']['link'][$i]['name'] != 'title' && $var['database']['link'][$i]['name'] != 'description') 6665 fputs($f, $var['database']['link'][$i]['name'] . ' = ' . $var['form_' . $var['database']['link'][$i]['name']]); 6666 else { 6667 if ($var['form_button'] == 'save' && $var['lang'] == 'de') 6668 fputs($f, $var['database']['link'][$i]['name'] . '.en = ' . $filedata[$var['database']['link'][$i]['name']]['en']); 6669 else 6670 fputs($f, $var['database']['link'][$i]['name'] . '.en = ' . $var['form_' . $var['database']['link'][$i]['name']]); 6671 fputs($f, chr(10)); 6672 if ($var['form_button'] == 'save' && $var['lang'] == 'en') 6673 fputs($f, $var['database']['link'][$i]['name'] . '.de = ' . $filedata[$var['database']['link'][$i]['name']]['de']); 6674 else 6675 fputs($f, $var['database']['link'][$i]['name'] . '.de = ' . $var['form_' . $var['database']['link'][$i]['name']]); 6676 } 6677 } 6678 fclose($f); 6679 chmod('data/links/' . $var['form_name'] . '.dat', 0666); 6680 if ($var['form_name'] != $var['view']) 6681 rename_data($var['view'], $var['form_name']); 6682 $var['result'] = 'success'; 6683 $var['alert'] = $var['success'][$var['form_button']][$var['lang']]; 6684 $var['view'] = $var['form_name']; 6685 } 6686 else { 6687 $var['result'] = 'error'; 6688 $var['alert'] = $var['error']['exists'][$var['lang']]; 6689 } 6690 } 6691 else { 6692 $var['result'] = 'error'; 6693 $var['alert'] = $var['error']['url'][$var['lang']]; 6694 } 6695 } 6696 else { 6697 $var['result'] = 'error'; 6698 $var['alert'] = $var['error']['title'][$var['lang']]; 6699 } 6700 } 6701 else { 6702 $var['result'] = 'error'; 6703 $var['alert'] = $var['error']['name'][$var['lang']]; 6704 } 6705 } 6706 else if ($var['this_page']['name'] == 'system_files') { 6707 delete_file('data/system/' . $var['view']); 6708 $f = fopen('data/system/' . $var['view'], 'w'); 6709 fputs($f, $var['form_data']); 6710 fclose($f); 6711 } 6712 else if ($var['this_page']['name'] == 'newsletter_settings') { 6713 $f = fopen('data/system/newsletter.dat', 'w'); 6714 fputs($f, 'listname = ' . $var['form_listname']); 6715 fputs($f, chr(10) . 'listhome = ' . $var['form_listhome']); 6716 fputs($f, chr(10) . 'listtag = ' . $var['form_listtag']); 6717 fputs($f, chr(10) . 'header = ' . str_replace(chr(13) . chr(10), '\n', $var['form_header'])); 6718 fputs($f, chr(10) . 'footer = ' . str_replace(chr(13) . chr(10), '\n', $var['form_footer'])); 6719 fputs($f, chr(10) . 'default-from = ' . $var['form_default_from']); 6720 fputs($f, chr(10) . 'list-admin = ' . $var['form_list_admin']); 6721 fputs($f, chr(10) . 'reply-to = ' . $var['form_reply_to']); 6722 fputs($f, chr(10) . 'errors-to = ' . $var['form_errors_to']); 6723 fputs($f, chr(10) . 'notifications-to = ' . $var['form_notifications_to']); 6724 fclose($f); 6725 $var['newsletter'] = read_file('data/system/newsletter.dat'); 6726 } 6727 else if ($var['this_page']['name'] == 'filters') { 6728 if (valid('filtername', $var['form_name'])) { 6729 if ($var['form_title']) { 6730 if ($var['form_description']) { 6731 if ($var['form_name'] == $var['view'] || !file_exists('data/newsletter/filters/' . $var['form_name'] . '.dat')) { 6732 if (file_exists('data/newsletter/filters/' . $var['view'] . '.dat')) { 6733 $filedata = read_file('data/newsletter/filters/' . $var['view'] . '.dat'); 6734 unlink('data/newsletter/filters/' . $var['view'] . '.dat'); 6735 } 6736 $var['form_description'] = str_replace(chr(13) . chr(10), '<br>', $var['form_description']); 6737 $f = fopen('data/newsletter/filters/' . $var['form_name'] . '.dat', 'w'); 6738 if ($var['form_button'] == 'save' && $var['lang'] == 'de') 6739 fputs($f, 'title.en = ' . $filedata['title']['en']); 6740 else 6741 fputs($f, 'title.en = ' . $var['form_title']); 6742 fputs($f, chr(10)); 6743 if ($var['form_button'] == 'save' && $var['lang'] == 'en') 6744 fputs($f, 'title.de = ' . $filedata['title']['de']); 6745 else 6746 fputs($f, 'title.de = ' . $var['form_title']); 6747 fputs($f, chr(10)); 6748 if ($var['form_button'] == 'save' && $var['lang'] == 'de') 6749 fputs($f, 'description.en = ' . $filedata['description']['en']); 6750 else 6751 fputs($f, 'description.en = ' . $var['form_description']); 6752 fputs($f, chr(10)); 6753 if ($var['form_button'] == 'save' && $var['lang'] == 'en') 6754 fputs($f, 'description.de = ' . $filedata['description']['de']); 6755 else 6756 fputs($f, 'description.de = ' . $var['form_description']); 6757 fclose($f); 6758 $var['result'] = 'success'; 6759 $var['alert'] = $var['success'][$var['form_button']][$var['lang']]; 6760 $var['view'] = $var['form_name']; 6761 } 6762 else { 6763 $var['result'] = 'error'; 6764 $var['alert'] = $var['error']['exists'][$var['lang']]; 6765 } 6766 } 6767 else { 6768 $var['result'] = 'error'; 6769 $var['alert'] = $var['error']['description'][$var['lang']]; 6770 } 6771 } 6772 else { 6773 $var['result'] = 'error'; 6774 $var['alert'] = $var['error']['title'][$var['lang']]; 6775 } 6776 } 6777 else { 6778 $var['result'] = 'error'; 6779 $var['alert'] = $var['error']['filtername'][$var['lang']]; 6780 } 6781 } 6782 else if ($var['this_page']['name'] == 'send') { 6783 if ($var['view']) 6784 $filename = $var['view'] . '.dat'; 6785 else 6786 $filename = $var['microtime'] . '.dat'; 6787 $f = fopen("data/newsletter/messages/unsent/$filename", 'w'); 6788 fputs($f, 'subject = ' . $var['form_subject']); 6789 fputs($f, chr(10) . 'from = ' . $var['form_from']); 6790 if ($var['lang'] == 'en') 6791 fputs($f, chr(10) . 'date = ' . $var['form_date']); 6792 else 6793 fputs($f, chr(10) . 'date = ' . substr($var['form_date'], 3, 2) . '/' . substr($var['form_date'], 0, 2) . '/' . substr($var['form_date'], 6)); 6794 fputs($f, chr(10) . 'message = ' . str_replace(chr(13) . chr(10), '\n', $var['form_message'])); 6795 fclose($f); 6796 $var['result'] = 'success'; 6797 $var['alert'] = $var['success']['save_message'][$var['lang']]; 6798 } 6799 else if ($var['this_page']['name'] == 'subscribers') { 6800 if (valid('e-mail', $var['form_e_mail'])) { 6801 if ($var['form_e_mail'] == $var['view'] || !file_exists('data/newsletter/subscribers/' . strtolower($var['form_e_mail'] . '.dat'))) { 6802 if (substr($var['view'], 0, 4) != 'new_' || strlen($var['view']) != 20) { 6803 $filedata = read_file('data/newsletter/subscribers/' . $var['view'] . '.dat'); 6804 $password = $filedata['password']; 6805 } 6806 else { 6807 $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; 6808 for ($i = 0; $i < 8; $i++) 6809 $password .= substr($chars, floor(mt_rand() / mt_getrandmax() * strlen($chars)), 1); 6810 } 6811 $f = fopen('data/newsletter/subscribers/' . strtolower($var['form_e_mail']) . '.dat', 'w'); 6812 fputs($f, 'password = ' . encrypt($password)); 6813 fputs($f, chr(10) . 'status = ' . $var['form_status']); 6814 reset($var); 6815 while (list($k, $v) = each($var)) { 6816 if (substr($k, 0, 12) == 'form_filter_' && $v == 'on') { 6817 if ($filters) 6818 $filters .= ' '; 6819 $filters .= substr($k, 12); 6820 } 6821 } 6822 fputs($f, chr(10) . "filters = $filters"); 6823 fclose($f); 6824 if ($var['form_e_mail'] != $var['view']) 6825 unlink('data/newsletter/subscribers/' . $var['view'] . '.dat'); 6826 $var['view'] = strtolower($var['form_e_mail']); 6827 } 6828 else { 6829 $var['result'] = 'error'; 6830 $var['alert'] = $var['error']['exists'][$var['lang']]; 6831 } 6832 } 6833 else { 6834 $var['result'] = 'error'; 6835 $var['alert'] = $var['error']['e-mail'][$var['lang']]; 6836 } 6837 } 6838 else if ($var['this_page']['name'] == 'subscription') { 6839 if (!$var['form_password'] || valid('password', $var['form_password'])) { 6840 if ($var['form_repeat'] == $var['form_password']) { 6841 $filedata = read_file('data/newsletter/subscribers/' . strtolower($var['current_user']['e-mail']) . '.dat'); 6842 $f = fopen('data/newsletter/subscribers/' . strtolower($var['current_user']['e-mail']) . '.dat', 'w'); 6843 if (!$var['form_password']) 6844 fputs($f, 'password = ' . $filedata['password']); 6845 else 6846 fputs($f, 'password = ' . $var['form_password']); 6847 fputs($f, chr(10) . 'status = ' . $var['form_status']); 6848 reset($var); 6849 while (list($k, $v) = each($var)) { 6850 if (substr($k, 0, 12) == 'form_filter_' && $v == 'on') { 6851 if ($filters) 6852 $filters .= ' '; 6853 $filters .= substr($k, 12); 6854 } 6855 } 6856 fputs($f, chr(10) . "filters = $filters"); 6857 fclose($f); 6858 $var['result'] = 'success'; 6859 $var['alert'] = $var['success']['save'][$var['lang']]; 6860 } 6861 else { 6862 $var['result'] = 'error'; 6863 $var['alert'] = $var['error']['repeat'][$var['lang']]; 6864 } 6865 } 6866 else { 6867 $var['result'] = 'error'; 6868 $var['alert'] = $var['error']['password'][$var['lang']]; 6869 } 6870 } 6871 } 6872 6873 else if ($var['form_button'] == 'upload') { 6874 if ($var['this_page']['name'] == 'images' || $var['this_page']['name'] == 'documents') { 6875 if ($HTTP_POST_FILES['form_file']['name']) { 6876 if (valid('filename', $HTTP_POST_FILES['form_file']['name'])) { 6877 for ($i = 0; $i < count($var[substr($var['this_page']['name'], 0, -1) . '_type']); $i++) { 6878 if ('.' . $var[substr($var['this_page']['name'], 0, -1) . '_type'][$i] == strtolower(substr($HTTP_POST_FILES['form_file']['name'], -1 - strlen($var[substr($var['this_page']['name'], 0, -1) . '_type'][$i])))) 6879 $file_flag = true; 6880 } 6881 if ($file_flag) { 6882 if (!file_exists('data/' . $var['this_page']['name'] . '/' . $HTTP_POST_FILES['form_file']['name'])) { 6883 if ($HTTP_POST_FILES['form_file']['size']) { 6884 move_uploaded_file($HTTP_POST_FILES['form_file']['tmp_name'], 'data/' . $var['this_page']['name'] . '/' . $HTTP_POST_FILES['form_file']['name']); 6885 if (file_exists('data/' . $var['this_page']['name'] . '/' . $HTTP_POST_FILES['form_file']['name'])) { 6886 chmod('data/' . $var['this_page']['name'] . '/' . $HTTP_POST_FILES['form_file']['name'], 0666); 6887 if ($var['this_page']['name'] == 'images') { 6888 $imagesize = getimagesize('data/' . $var['this_page']['name'] . '/' . $HTTP_POST_FILES['form_file']['name']); 6889 if ($imagesize[0] > $var['image_max_width'] || $imagesize[1] > $var['image_max_height']) 6890 unlink('data/' . $var['this_page']['name'] . '/' . $HTTP_POST_FILES['form_file']['name']); 6891 } 6892 if (file_exists('data/' . $var['this_page']['name'] . '/' . $HTTP_POST_FILES['form_file']['name'])) { 6893 $var['result'] = 'success'; 6894 $var['alert'] = $var['success']['upload'][$var['lang']]; 6895 } 6896 else { 6897 $var['result'] = 'error'; 6898 $var['alert'] = $var['error']['upload']['dimensions'][$var['lang']]; 6899 } 6900 } 6901 else { 6902 $var['result'] = 'error'; 6903 $var['alert'] = $var['error']['upload']['failed'][$var['lang']]; 6904 } 6905 } 6906 else { 6907 $var['result'] = 'error'; 6908 $var['alert'] = $var['error']['upload']['size'][$var['lang']]; 6909 } 6910 } 6911 else { 6912 $var['result'] = 'error'; 6913 $var['alert'] = $var['error']['upload']['exists'][$var['lang']]; 6914 } 6915 } 6916 else { 6917 $var['result'] = 'error'; 6918 $var['alert'] = $var['error']['upload']['type'][$var['lang']]; 6919 } 6920 } 6921 else { 6922 $var['result'] = 'error'; 6923 $var['alert'] = $var['error']['upload']['filename'][$var['lang']]; 6924 } 6925 } 6926 else { 6927 $var['result'] = 'error'; 6928 $var['alert'] = $var['error']['upload']['file'][$var['lang']]; 6929 } 6930 } 6931 else if ($var['this_page']['name'] == 'addresses') { 6932 if ($var['form_import']) { 6933 $data = explode(chr(10), $var['form_import']); 6934 for ($i = 1; $i < count($data); $i++) { 6935 $data_ = explode($var['delimiter'][$var['preference']['importexport_delimiter']], $data[$i]); 6936 if (($var['preference']['importexport_filenames'] == 'without' && count($data_) == count($var['database']['address']) + 5) || ($var['preference']['importexport_filenames'] == 'with' && count($data_) == count($var['database']['address']) + 6)) { 6937 if ($var['preference']['importexport_filenames'] == 'with' && valid('filename', $data_[0]) && substr($data_[0], 0, 1) != '.' && $data_[0] == strtolower($data_[0])) { 6938 if (($var['preference']['importexport_filenames'] == 'without' && $data_[1] && $data_[2]) || ($var['preference']['importexport_filenames'] == 'with' && $data_[2] && $data_[3])) { 6939 if ($var['preference']['importexport_filenames'] == 'without') { 6940 $name = strtolower($data_[1]); 6941 reset($var['translate']); 6942 while (list($k, $v) = each($var['translate'])) { 6943 for ($j = 0; $j < strlen($v); $j++) 6944 $name = str_replace(substr($v, $j, 1), strtolower($k), $name); 6945 } 6946 } 6947 else 6948 $name = $data_[0]; 6949 if ($var['preference']['importexport_filenames'] == 'with' || !file_exists("data/addresses/$name.dat")) { 6950 if ($var['preference']['importexport_filenames'] == 'without') 6951 $offset = - 1; 6952 else 6953 $offset = 0; 6954 $f = fopen("data/addresses/$name.dat", 'w'); 6955 for ($j = 1; $j < count($var['database']['address']); $j++) { 6956 if ($j > 1) 6957 fputs($f, chr(10)); 6958 if ($var['database']['address'][$j]['name'] != 'organization_1' && $var['database']['address'][$j]['name'] != 'organization_2' && $var['database']['address'][$j]['name'] != 'city' && $var['database']['address'][$j]['name'] != 'state' && $var['database']['address'][$j]['name'] != 'country' && $var['database']['address'][$j]['name'] != 'description') { 6959 if (substr($var['database']['address'][$j]['name'], 0, 8) == 'internet') 6960 $data_[$j + $offset] = str_replace('http://', '', $data_[$j + $offset]); 6961 fputs($f, $var['database']['address'][$j]['name'] . ' = ' . $data_[$j + $offset]); 6962 } 6963 else { 6964 fputs($f, $var['database']['address'][$j]['name'] . '.en = ' . $data_[$j + $offset] . chr(10) . $var['database']['address'][$j]['name'] . '.de = ' . $data_[$j + $offset + 1]); 6965 $offset++; 6966 } 6967 } 6968 fclose($f); 6969 // chmod("data/addresses/$name.dat", 0666); 6970 $var['receipt'][$i] = $data[$i] . "\n>> " . $var['success']['import'][$var['lang']]; 6971 } 6972 else 6973 $var['receipt'][$i] = $data[$i] . "\n>> " . $var['error']['import']['exists'][$var['lang']]; 6974 } 6975 else 6976 $var['receipt'][$i] = $data[$i] . "\n>> " . $var['error']['import']['organization'][$var['lang']]; 6977 } 6978 else 6979 $var['receipt'][$i] = $data[$i] . "\n>> " . $var['error']['import']['name'][$var['lang']]; 6980 } 6981 else 6982 $var['receipt'][$i] = $data[$i] . "\n>> " . $var['error']['import']['cells'][$var['lang']]; 6983 } 6984 } 6985 else { 6986 $var['result'] = 'error'; 6987 $var['alert'] = $var['error']['import']['data'][$var['lang']]; 6988 } 6989 } 6990 else if ($var['this_page']['name'] == 'links') { 6991 if ($var['form_import']) { 6992 $data = explode(chr(10), $var['form_import']); 6993 for ($i = 0; $i < count($data); $i++) { 6994 $data_ = explode($var['delimiter'][$var['preference']['importexport_delimiter']], $data[$i]); 6995 if (($var['preference']['importexport_filenames'] == 'without' && count($data_) == count($var['database']['link']) + 1) || ($var['preference']['importexport_filenames'] == 'with' && count($data_) == count($var['database']['link']) + 2)) { 6996 if ($var['preference']['importexport_filenames'] == 'with' && valid('filename', $data_[0]) && substr($data_[0], 0, 1) != '.' && $data_[0] == strtolower($data_[0])) { 6997 if (($var['preference']['importexport_filenames'] == 'without' && $data_[0] && $data_[1]) || ($var['preference']['importexport_filenames'] == 'with' && $data_[1] && $data_[2])) { 6998 if ($var['preference']['importexport_filenames'] == 'without') { 6999 $name = strtolower($data_[0]); 7000 reset($var['translate']); 7001 while (list($k, $v) = each($var['translate'])) { 7002 for ($j = 0; $j < strlen($v); $j++) 7003 $name = str_replace(substr($v, $j, 1), strtolower($k), $name); 7004 } 7005 } 7006 else 7007 $name = $data_[0]; 7008 if ($var['preference']['importexport_filenames'] == 'with' || !file_exists("data/addresses/$name.dat")) { 7009 if ($var['preference']['importexport_filenames'] == 'without') 7010 $offset = - 1; 7011 else 7012 $offset = 0; 7013 $f = fopen("data/links/$name.dat", 'w'); 7014 for ($j = 1; $j < count($var['database']['link']); $j++) { 7015 if ($j > 1) 7016 fputs($f, chr(10)); 7017 if ($var['database']['link'][$j]['name'] != 'title' && $var['database']['link'][$j]['name'] != 'description') { 7018 if ($var['database']['link'][$j]['name'] == 'url') 7019 $data_[$j + $offset] = str_replace('http://', '', $data_[$j + $offset]); 7020 fputs($f, $var['database']['link'][$j]['name'] . ' = ' . $data_[$j + $offset]); 7021 } 7022 else { 7023 fputs($f, $var['database']['link'][$j]['name'] . '.en = ' . $data_[$j + $offset] . chr(10) . $var['database']['link'][$j]['name'] . '.de = ' . $data_[$j + $offset + 1]); 7024 $offset++; 7025 } 7026 } 7027 fclose($f); 7028 $var['receipt'][$i] = $data[$i] . "\n>> " . $var['success']['import'][$var['lang']]; 7029 } 7030 else 7031 $var['receipt'][$i] = $data[$i] . "\n>> " . $var['error']['import']['exists'][$var['lang']]; 7032 } 7033 else 7034 $var['receipt'][$i] = $data[$i] . "\n>> " . $var['error']['import']['title'][$var['lang']]; 7035 } 7036 else 7037 $var['receipt'][$i] = $data[$i] . "\n>> " . $var['error']['import']['name'][$var['lang']]; 7038 } 7039 else 7040 $var['receipt'][$i] = $data[$i] . "\n>> " . $var['error']['import']['cells'][$var['lang']]; 7041 } 7042 } 7043 else { 7044 $var['result'] = 'error'; 7045 $var['alert'] = $var['error']['import']['data'][$var['lang']]; 7046 } 7047 } 7048 else if ($var['this_page']['name'] == 'subscribers') { 7049 if ($var['form_import']) { 7050 $data = explode(chr(13) . chr(10), $var['form_import']); 7051 for ($i = 1; $i < count($data); $i++) { 7052 $name = strtolower($data[$i]); 7053 if (valid('e-mail', $name)) { 7054 if (file_exists("data/newsletter/subscribers/$name.dat")) 7055 $filedata = read_file("data/newsletter/subscribers/$name.dat"); 7056 if (!file_exists("data/newsletter/subscribers/$name.dat")) { 7057 $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; 7058 for ($j = 0; $j < 8; $j++) 7059 $password .= substr($chars, floor(mt_rand() / mt_getrandmax() * strlen($chars)), 1); 7060 $f = fopen("data/newsletter/subscribers/$name.dat", 'w'); 7061 fputs($f, 'password = ' . encrypt($password)); 7062 fputs($f, chr(10) . 'status = subscribed'); 7063 fputs($f, chr(10) . 'filters = '); 7064 fclose($f); 7065 $var['receipt'][$i - 1] = "$name\n>> " . $var['success']['import'][$var['lang']]; 7066 } 7067 else { 7068 $filedata = read_file("data/newsletter/subscribers/$name.dat"); 7069 if ($filedata['status'] != 'subscribed') { 7070 $f = fopen("data/newsletter/subscribers/$name.dat", 'w'); 7071 fputs($f, 'password = ' . $filedata['password']); 7072 fputs($f, chr(10) . 'status = subscribed'); 7073 fputs($f, chr(10) . 'filters = ' . $filedata['filters']); 7074 fclose($f); 7075 $var['receipt'][$i - 1] = "$name\n>> " . $var['success']['import'][$var['lang']]; 7076 } 7077 else 7078 $var['receipt'][$i - 1] = "$name\n>> " . $var['error']['import']['mail_exists'][$var['lang']]; 7079 } 7080 } 7081 else 7082 $var['receipt'][$i - 1] = "$name\n>> " . $var['error']['import']['mail_invalid'][$var['lang']]; 7083 } 7084 } 7085 else { 7086 $var['result'] = 'error'; 7087 $var['alert'] = $var['error']['import']['data'][$var['lang']]; 7088 } 7089 7090 } 7091 } 7092 7093 else if ($var['form_button'] == 'send') { 7094 if ($var['form_subject']) { 7095 if (valid('from', $var['form_from'])) { 7096 if (valid('date', $var['form_date'])) { 7097 if ($var['form_message']) { 7098 if ($var['newsletter']['listtag']) 7099 $var['form_subject'] = $var['newsletter']['listtag'] . ' ' . $var['form_subject']; 7100 if ($var['newsletter']['header']) 7101 $var['form_message'] = str_replace('\n', chr(13) . chr(10), parse_header($var['newsletter']['header'])) . str_repeat(chr(13) . chr(10), 4) . $var['form_message']; 7102 if ($var['newsletter']['footer']) 7103 $var['form_message'] .= str_repeat(chr(13) . chr(10), 4) . str_replace('\n', chr(13) . chr(10), parse_header($var['newsletter']['footer'])); 7104 echo "<tt>rolux minordomo<br>\n"; 7105 echo "reading subscribers, please wait...<br>\n"; 7106 flush(); ob_flush(); 7107 $list = read_dir('data/newsletter/subscribers'); 7108 for ($i = 0; $i < count($list); $i++) { 7109 $filedata = read_file('data/newsletter/subscribers/' . $list[$i]['filename']); 7110 if ($filedata['status'] == 'subscribed') { 7111 $filtered = false; 7112 $data = explode(' ', $filedata['filters']); 7113 for ($j = 0; $j < count($data); $j++) { 7114 if ($var["form_filter_$data[$j]"] == 'on') { 7115 $filtered = true; 7116 break; 7117 } 7118 } 7119 if (!$filtered) 7120 $to[count($to)] = $list[$i]['name']; 7121 } 7122 } 7123 if ($to) { 7124 echo 'sending ' . count($to) . " messages, please wait...<br>\n"; 7125 flush(); ob_flush(); 7126 $subject = $var['form_subject']; 7127 $message = $var['form_message']; 7128 $headers = 'From: ' . $var['form_from'] . "\r\n"; 7129 $headers .= 'Date: ' . parse_date($var['form_date']) . "\r\n"; 7130 if ($var['newsletter']['reply-to']) 7131 $headers .= 'Reply-To: ' . $var['newsletter']['reply-to'] . "\r\n"; 7132 if ($var['newsletter']['errors-to']) 7133 $headers .= 'Errors-To: ' . $var['newsletter']['errors-to'] . "\r\n"; 7134 $headers .= 'List-Id: ' . $var['newsletter']['listname'] . ' <newsletter.bestpractices.at>' . "\r\n"; 7135 $headers .= 'List-Archive: <http://' . $var['newsletter']['listhome'] . '/archive>' . "\r\n"; 7136 $headers .= 'List-Subscribe: <http://' . $var['newsletter']['listhome'] . '/subscribe>' . "\r\n"; 7137 $headers .= 'List-Unsubscribe: <http://' . $var['newsletter']['listhome'] . '/subscription>' . "\r\n"; 7138 $headers .= 'List-Help: <mailto:' . $var['newsletter']['list-admin'] . '>' . "\r\n"; 7139 $headers .= 'X-Mailer: Rolux Minordomo'; 7140 $f = fopen('data/logs/' . $var['subdir'] . '/mail.log', 'w'); 7141 sort($to); 7142 for ($i = 0; $i < count($to); $i++) { 7143 /* 7144 // start test 7145 $str = explode('@', $to[$i]); 7146 if (mt_rand() / mt_getrandmax() < 0.5) 7147 $str[1] = 'nospam.' . $str[1]; 7148 else 7149 $str[1] = $str[1] . '.example.com'; 7150 $to[$i] = implode('@', $str); 7151 // end test 7152 */ 7153 // if ($i > 1310) { 7154 echo ($i + 1) . '/' . count($to) . ": $to[$i]... "; 7155 if (mail($to[$i], $subject, $message, $headers)) 7156 echo 'succeeded'; 7157 else 7158 echo 'failed'; 7159 echo "<br>\n"; 7160 flush(); ob_flush(); 7161 fputs($f, $to[$i] . chr(10)); 7162 // } 7163 } 7164 fclose($f); 7165 } 7166 $f = fopen('data/newsletter/messages/sent/' . $var['microtime'] . '.dat', 'w'); 7167 fputs($f, 'subject = ' . str_replace($var['newsletter']['listtag'] . ' ', '', $subject)); 7168 fputs($f, chr(10) . 'from = ' . $var['form_from']); 7169 fputs($f, chr(10) . 'date = ' . parse_date($var['form_date'])); 7170 fputs($f, chr(10) . 'message = ' . str_replace(chr(13) . chr(10), '\n', $var['form_message'])); 7171 fclose($f); 7172 echo 'done, click <a href=main.php?page=admin/newsletter/messages/sent&view=' . $var['microtime'] . '&mode=admin&ssid=' . $var['ssid'] . ">here</a> to proceed</tt><br>\n"; 7173 exit; 7174 } 7175 else { 7176 $var['result'] = 'error'; 7177 $var['alert'] = $var['error']['message'][$var['lang']]; 7178 } 7179 } 7180 else { 7181 $var['result'] = 'error'; 7182 $var['alert'] = $var['error']['date'][$var['lang']]; 7183 } 7184 } 7185 else { 7186 $var['result'] = 'error'; 7187 $var['alert'] = $var['error']['from'][$var['lang']]; 7188 } 7189 } 7190 else { 7191 $var['result'] = 'error'; 7192 $var['alert'] = $var['error']['subject'][$var['lang']]; 7193 } 7194 } 7195 7196 } 7197 7198 // ----------------------------------------------------------------------------- 7199 7200 function save_preferences() { 7201 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7202 $f = fopen('data/system/preferences.dat', 'w'); 7203 $i = 0; 7204 reset($var['preference']); 7205 while (list($k, $v) = each($var['preference'])) { 7206 if ($i > 0) 7207 fputs($f, chr(10)); 7208 fputs($f, "$k = $v"); 7209 $i++; 7210 } 7211 fclose($f); 7212 } 7213 7214 // ----------------------------------------------------------------------------- 7215 7216 function save_file($filename, $array) { 7217 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7218 $f = fopen($filename, 'w'); 7219 $i = 0; 7220 $j = 0; 7221 reset($array); 7222 while (list($k1, $v1) = each($array)) { 7223 if ($j > 0) 7224 fputs($f, chr(10)); 7225 if (!is_array($v1)) { 7226 if ($i > 0) 7227 fputs($f, chr(10)); 7228 fputs($f, "$k1 = $v1"); 7229 $i++; 7230 } 7231 else { 7232 while (list($k2, $v2) = each($v1)) { 7233 if (!is_array($v2)) { 7234 if ($i > 0) 7235 fputs($f, chr(10)); 7236 fputs($f, "$k1.$k2 = $v2"); 7237 $i++; 7238 } 7239 else { 7240 while (list($k3, $v3) = each($v2)) { 7241 if (!is_array($v3)) { 7242 if ($i > 0) 7243 fputs($f, chr(10)); 7244 fputs($f, "$k1.$k2.$k3 = $v3"); 7245 $i++; 7246 } 7247 else { 7248 while (list($k4, $v4) = each($v3)) { 7249 if ($i > 0) 7250 fputs($f, chr(10)); 7251 fputs($f, "$k1.$k2.$k3.$k4 = $v4"); 7252 $i++; 7253 } 7254 } 7255 } 7256 } 7257 } 7258 } 7259 $j++; 7260 } 7261 fclose($f); 7262 } 7263 7264 // ----------------------------------------------------------------------------- 7265 7266 function rename_pages($from, $to) { 7267 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7268 $f = read_dir('data/pages'); 7269 for ($i = 0; $i < count($f); $i++) { 7270 if (substr($f[$i]['filename'], 0, strlen($from)) == $from) 7271 rename('data/pages/'. $f[$i]['filename'], "data/pages/$to" . substr($f[$i]['filename'], strlen($from))); 7272 } 7273 } 7274 7275 // ----------------------------------------------------------------------------- 7276 7277 function rename_data($from, $to) { 7278 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7279 if ($var['this_page']['name'] == 'images') { 7280 $from_string = "$from</image>"; 7281 $to_string = "$to</image>"; 7282 } 7283 else if ($var['this_page']['name'] == 'documents') { 7284 $from_string = "<document=$from>"; 7285 $to_string = "<document=$to>"; 7286 } 7287 else if ($var['this_page']['name'] == 'addresses') { 7288 $from_string = "<address>$from</address>"; 7289 $to_string = "<address>$to</address>"; 7290 } 7291 else if ($var['this_page']['name'] == 'links') { 7292 $from_string = "<link>$from</link>"; 7293 $to_string = "<link>$to</link>"; 7294 } 7295 $f = read_dir('data/pages'); 7296 for ($i = 0; $i < count($f); $i++) { 7297 $f_ = fopen('data/pages/' . $f[$i]['filename'], 'r'); 7298 $from_page = fread($f_, $f[$i]['size']); 7299 fclose($f_); 7300 if (strstr($from_page, $from_string)) { 7301 $to_page = str_replace($from_string, $to_string, $from_page); 7302 $f_ = fopen('data/pages/' . $f[$i]['filename'], 'w'); 7303 fputs($f_, $to_page); 7304 fclose($f_); 7305 } 7306 } 7307 } 7308 7309 // ----------------------------------------------------------------------------- 7310 7311 function create_session($group) { 7312 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7313 $var['ssid'] = $var['microtime']; 7314 $f = fopen('data/sessions/' . $var['ssid'] . '.dat', 'w'); 7315 fputs($f, 'host = ' . $var['host']); 7316 fputs($f, chr(10) . "group = $group"); 7317 if ($group == 'user') 7318 fputs($f, chr(10) . 'username = ' . $var['form_e_mail']); 7319 else if ($group == 'admin') 7320 fputs($f, chr(10) . 'username = ' . $var['form_username']); 7321 fclose($f); 7322 chmod('data/sessions/' . $var['ssid'] . '.dat', 0666); 7323 get_admindata(); 7324 } 7325 7326 // ----------------------------------------------------------------------------- 7327 7328 function delete_sessions() { 7329 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7330 $f = read_dir('data/sessions'); 7331 for ($i = 0; $i < count($f); $i++) { 7332 if ($f[$i]['time'] < $var['time'] - $var['preference']['session_time'] * 60) 7333 unlink('data/sessions/' . $f[$i]['name']. '.dat'); 7334 } 7335 delete_requests(); 7336 } 7337 7338 // ----------------------------------------------------------------------------- 7339 7340 function create_request($string) { 7341 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7342 $f = fopen('data/newsletter/requests/' . $var['microtime'] . '.dat', 'w'); 7343 fputs($f, $string); 7344 fclose($f); 7345 } 7346 7347 // ----------------------------------------------------------------------------- 7348 7349 function delete_requests() { 7350 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7351 $list = read_dir('data/newsletter/requests'); 7352 for ($i = 0; $i < count($f); $i++) { 7353 if ($list[$i]['time'] < $var['time'] - $var['preference']['session_time'] * 60) 7354 unlink('data/newsletter/requests/' . $list[$i]['filename']); 7355 } 7356 } 7357 7358 // ----------------------------------------------------------------------------- 7359 7360 function empty_trash() { 7361 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7362 $f = read_dir('data/trash'); 7363 for ($i = 0; $i < count($f); $i++) { 7364 if ($f[$i]['time'] < $var['time'] - $var['preference']['trash_time'] * 86400) 7365 unlink('data/trash/' . $f[$i]['filename']); 7366 } 7367 } 7368 7369 // ----------------------------------------------------------------------------- 7370 7371 function send_message() { 7372 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7373 $subject = '[' . $var['domain'] . '] ' . $var['form_subject']; 7374 $message = $var['form_message'] . "\n\n--\n" . $var['domain'] . "\nhttp://" . strtolower($var['domain']) . '/main.php?page=admin'; 7375 $headers = 'From: ' . $var['current_admin']['e-mail'] . "\nCC: "; 7376 $f = read_dir('data/accounts'); 7377 for ($i = 0; $i < count($f); $i++) { 7378 if ($i > 0) 7379 $headers .= ', '; 7380 $filedata = read_file('data/accounts/' . $f[$i]['name'] . '.dat'); 7381 $headers .= $filedata['e-mail']; 7382 } 7383 mail('', $subject, $message, $headers); 7384 } 7385 7386 // ----------------------------------------------------------------------------- 7387 7388 function send_password() { 7389 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7390 if ($var['this_page']['name'] != 'login') 7391 $text = $var['password'][$var['lang']]; 7392 else 7393 $text = $var['username_password'][$var['lang']]; 7394 $to = $var['to']; 7395 $subject = '[' . $var['domain'] . "] $text"; 7396 $message = "$text: " . $var['message'] . "\n\n--\n" . $var['domain'] . "\nhttp://" . strtolower($var['domain']); 7397 if ($var['this_page']['name'] == 'login') 7398 $message .= '/main.php?page=admin'; 7399 $headers = 'From: robot@' . strtolower($var['domain']); 7400 mail($to, $subject, $message, $headers); 7401 } 7402 7403 // ----------------------------------------------------------------------------- 7404 7405 function send_request() { 7406 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7407 $to = $var['form_e_mail']; 7408 $subject = '[' . $var['domain'] . '] ' . $var['confirm_subject'][$var['lang']]; 7409 $message = $var['confirm_message'][$var['lang']] . "\n\n" . 'http://www.bestpractices.at/main.php?lang=' . $var['lang'] . '&rqid=' . $var['microtime'] . "\n\n" . $var['confirm_disclaimer'][$var['lang']] . "\n\n--\n" . $var['domain'] . "\nhttp://" . strtolower($var['domain']); 7410 $headers = 'From: robot@' . strtolower($var['domain']); 7411 mail($to, $subject, $message, $headers); 7412 } 7413 7414 // ----------------------------------------------------------------------------- 7415 7416 function check_request() { 7417 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7418 if (file_exists('data/newsletter/requests/' . $var['rqid'] . '.dat')) { 7419 $file = file('data/newsletter/requests/' . $var['rqid'] . '.dat'); 7420 $data = explode(' ', chop($file[0])); 7421 if (file_exists('data/newsletter/subscribers/' . $data[1] . '.dat')) { 7422 $filedata = read_file('data/newsletter/subscribers/' . $data[1] . '.dat'); 7423 $password = $filedata['password']; 7424 $filters = $filedata['filters']; 7425 } 7426 else { 7427 $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; 7428 for ($i = 0; $i < 8; $i++) 7429 $password .= substr($chars, floor(mt_rand() / mt_getrandmax() * strlen($chars)), 1); 7430 } 7431 $f = fopen('data/newsletter/subscribers/' . $data[1] . '.dat', 'w'); 7432 fputs($f, 'password = ' . encrypt($password)); 7433 fputs($f, chr(10) . 'status = subscribed'); 7434 fputs($f, chr(10) . "filters = $filters"); 7435 fclose($f); 7436 $var['to'] = $data[1]; 7437 $var['message'] = $password; 7438 send_password(); 7439 unlink('data/newsletter/requests/' . $var['rqid'] . '.dat'); 7440 echo "<script language=javascript>\n"; 7441 echo 'document.location.href = "main.php?page=publications/mailing_list/subscribe&lang=' . $var['lang'] . "&view=success\";\n"; 7442 echo "</script>\n"; 7443 } 7444 else { 7445 echo "<script language=javascript>\n"; 7446 echo 'document.location.href = "main.php?page=publications/mailing_list/subscribe&lang=' . $var['lang'] . "&view=error\";\n"; 7447 echo "</script>\n"; 7448 } 7449 exit; 7450 } 7451 7452 // ----------------------------------------------------------------------------- 7453 7454 function last_update() { 7455 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7456 $dir = array('pages', 'images', 'documents', 'addresses', 'links'); 7457 for ($i = 0; $i < count($dir); $i++) { 7458 $f = read_dir("data/$dir[$i]"); 7459 for ($j = 0; $j < count($f); $j++) { 7460 if ($f[$j]['time'] > $last_update) 7461 $last_update = $f[$j]['time']; 7462 } 7463 } 7464 return $last_update; 7465 } 7466 7467 // ----------------------------------------------------------------------------- 7468 7469 function valid($format, $string) { 7470 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7471 if ($format == 'username' || $format == 'password' || $format == 'filename' || $format == 'pagename' || $format == 'tagname') { 7472 if (!$string) return false; 7473 for ($i = 0; $i < strlen($string); $i++) 7474 if (!strstr($var['chars'][$format], substr($string, $i, 1))) return false; 7475 } 7476 else if ($format == 'filtername') { 7477 if (strlen($string) < 2 || strlen($string) > 3) return false; 7478 for ($i = 0; $i < strlen($string); $i++) 7479 if (!strstr($var['chars'][$format], substr($string, $i, 1))) return false; 7480 } 7481 else if ($format == 'url') { 7482 } 7483 else if ($format == 'e-mail') { 7484 if (!strstr($string, '@')) return false; // check if mail contains '@' 7485 $data = explode('@', $string); 7486 if (count($data) != 2) return false; // check if mail contains only one '@' 7487 $data[0] = explode('.', $data[0]); 7488 for ($i = 0; $i < count($data[0]); $i++) { 7489 if (strlen($data[0][$i]) == 0) return false; // check if user does not start or end with '.' and does not contain '..' 7490 for ($j = 0; $j < strlen($data[0][$i]); $j++) 7491 if (!strstr($var['chars']['e-mail'], substr($data[0][$i], $j, 1))) return false; // check if user does not contain forbidden characters 7492 } 7493 if (!strstr($data[1], '.')) return false; // check if domain contains '.' 7494 $data[1] = explode('.', $data[1]); 7495 for ($i = 0; $i < count($data[1]); $i++) { 7496 if (strlen($data[1][$i]) == 0) return false; // check if domain does not start or end with '.' and does not contain '..' 7497 if ($i == count($data[1]) - 1 && strlen($data[1][$i]) < 2) return false; // check if top level domain contains two or more characters 7498 for ($j = 0; $j < strlen($data[1][$i]); $j++) { 7499 if (!strstr($var['chars']['e-mail'], substr($data[1][$i], $j, 1))) return false; // check if domain does not contain forbidden characters 7500 if (($j == 0 || $j == strlen($data[1][$i]) - 1) && !strstr(substr($var['chars']['e-mail'], 0, 62), substr($data[1][$i], $j, 1))) return false; // check if domain parts do not start or end with a special character 7501 if ($i == count($data[1]) - 1 && !strstr(substr($var['chars']['e-mail'], 0, 52), substr($data[1][$i], $j, 1))) return false; // check if top level domain only contains letters 7502 } 7503 } 7504 } 7505 else if ($format == 'from') { 7506 if (!strstr($string, ' ')) { 7507 if (!valid('e-mail', $string)) return false; 7508 } 7509 else { 7510 $data = explode(' ', $string); 7511 if (substr($data[count($data) - 1], 0, 1) != '<' || substr($data[count($data) - 1], -1) != '>') return false; 7512 if (!valid('e-mail', substr($data[count($data) - 1], 1, -1))) return false; 7513 } 7514 } 7515 else if ($format == 'date') { 7516 if (strlen($string) != 19) return false; 7517 if (substr($string, 10, 1) != ' ') return false; 7518 if (!strstr('/.', substr($string, 2, 1)) || !strstr('/.', substr($string, 5, 1))) return false; 7519 if (substr($string, 13, 1) != ':' || substr($string, 16, 1) != ':') return false; 7520 $year = substr($string, 6, 4); 7521 if ($var['lang'] == 'en') { 7522 $month = substr($string, 0, 2); 7523 $day = substr($string, 3, 2); 7524 } 7525 else if ($var['lang'] == 'de') { 7526 $month = substr($string, 3, 2); 7527 $day = substr($string, 0, 2); 7528 } 7529 $hour = substr($string, 11, 2); 7530 $minute = substr($string, 14, 2); 7531 $second = substr($string, 17, 2); 7532 if ($year != floor($year) || $year < 1970) return false; 7533 if ($month != floor($month) || $month < 1 || $month > 12) return false; 7534 if ($day != floor($day) || $day < 1 || $day > date('t', mktime(0, 0, 0, $month, 1, $year))) return false; 7535 if ($hour != floor($hour) || $hour < 0 || $hour > 23) return false; 7536 if ($minute != floor($minute) || $minute < 0 || $minute > 59) return false; 7537 if ($second != floor($second) || $second < 0 || $second > 59) return false; 7538 } 7539 else if ($format == 'page') { 7540 if (!$string) return false; 7541 $data = explode('/', $string); 7542 $flag = false; 7543 for ($i = 0; $i < $var['menu']['count']; $i++) { 7544 if ($var['menu'][$i]['name'] == $data[0]) { 7545 $flag = true; 7546 break; 7547 } 7548 } 7549 if (!$flag) return false; 7550 if (count($data) > 1) { 7551 $flag = false; 7552 for ($j = 0; $j < $var['menu'][$i]['count']; $j++) { 7553 if ($var['menu'][$i][$j]['name'] == $data[1]) { 7554 $flag = true; 7555 break; 7556 } 7557 } 7558 if (!$flag) return false; 7559 if (count($data) > 2) { 7560 $flag = false; 7561 for ($k = 0; $k < $var['menu'][$i][$j]['count']; $k++) { 7562 if ($var['menu'][$i][$j][$k]['name'] == $data[2]) { 7563 $flag = true; 7564 break; 7565 } 7566 } 7567 if (!$flag) return false; 7568 if (count($data) == 4) { 7569 $flag = false; 7570 for ($l = 0; $l < $var['menu'][$i][$j][$k]['count']; $l++) { 7571 if ($var['menu'][$i][$j][$k][$l]['name'] == $data[3]) { 7572 $flag = true; 7573 break; 7574 } 7575 } 7576 if (!$flag) return false; 7577 } 7578 } 7579 } 7580 } 7581 else if ($format == 'login') { 7582 $data = explode(':', $string); 7583 $username = $data[0]; 7584 $password = $data[1]; 7585 if ($var['this_page']['name'] == 'subscription') { 7586 if (!file_exists("data/newsletter/subscribers/$username.dat")) return false; 7587 $filedata = read_file("data/newsletter/subscribers/$username.dat"); 7588 if (decrypt($filedata['password']) != $password) return false; 7589 } 7590 else if ($var['this_page']['name'] == 'login') { 7591 $flag = false; 7592 $f = read_dir('data/accounts'); 7593 for ($i = 0; $i < count($f); $i++) { 7594 $filedata = read_file('data/accounts/' . $f[$i]['name'] . '.dat'); 7595 if ($filedata['username'] == $username && decrypt($filedata['password']) == $password) { 7596 $flag = true; 7597 break; 7598 } 7599 } 7600 if (!$flag) return false; 7601 } 7602 } 7603 else if ($format == 'session') { 7604 if (!$string) return false; 7605 for ($i = 0; $i < strlen($string); $i++) 7606 if (!strstr($var['chars']['session'], substr($string, $i, 1))) return false; 7607 if (!file_exists("data/sessions/$string.dat")) return false; 7608 $filedata = read_file("data/sessions/$string.dat"); 7609 // if ($filedata['host'] != $var['host']) return false; // disabled for tinavienna 7610 } 7611 return true; 7612 } 7613 7614 // ----------------------------------------------------------------------------- 7615 7616 function has_content($filename) { 7617 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7618 if ($var['this_page']['name'] != 'templates') 7619 $dirname = 'pages'; 7620 else 7621 $dirname = 'templates'; 7622 if (file_exists("data/$dirname/$filename")) { 7623 $file = file("data/$dirname/$filename"); 7624 for ($i = 0; $i < count($file); $i++) { 7625 $file[$i] = chop($file[$i]); 7626 if ($file[$i] && !strstr($file[$i], '<column>')) 7627 return true; 7628 } 7629 } 7630 return false; 7631 } 7632 7633 // ----------------------------------------------------------------------------- 7634 7635 function is_accessible($filename) { 7636 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7637 get_other(str_replace('.', '/', substr($filename, 0, -7))); 7638 return $var['is_accessible']; 7639 /* 7640 echo "$filename=" . $var['other_page']['status'] . ' (' . $var['other_menu'] . '=' . $var['menu'][$var['other_tab']][$var['other_menu']]['status'] . ')<br>'; 7641 if ($var['other_level'] == 1 && ($var['menu'][$var['other_tab']]['status'] == 'hidden' || $var['other_page']['status'] == 'hidden')) 7642 return false; 7643 else if ($var['other_level'] == 2 && ($var['menu'][$var['other_tab']]['status'] == 'hidden' || $var['menu'][$var['other_tab']][$var['other_menu']]['status'] == 'hidden' || $var['other_page']['status'] == 'hidden')) 7644 return false; 7645 else if ($var['other_level'] == 3 && ($var['menu'][$var['other_tab']]['status'] == 'hidden' || $var['menu'][$var['other_tab']][$var['other_menu']]['status'] == 'hidden' || $var['menu'][$var['other_tab']][$var['other_menu']][$var['other_subtab']]['status'] == 'hidden' || $var['other_page']['status'] == 'hidden')) 7646 return false; 7647 return true; 7648 */ 7649 } 7650 7651 // ----------------------------------------------------------------------------- 7652 7653 function contains_content() { 7654 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7655 $string = str_replace('/', '.', $var['page']); 7656 $f = read_dir('data/pages'); 7657 for ($i = 0; $i < count($f); $i++) { 7658 if (substr($f[$i]['filename'], 0, strlen($string)) == $string && has_content($f[$i]['filename'])) 7659 return true; 7660 } 7661 return false; 7662 } 7663 7664 // ----------------------------------------------------------------------------- 7665 7666 function contains_max_submenus() { 7667 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7668 if ($var['level'] == 0) { 7669 for ($i = 0; $i < $var['menu'][$var['this_tab']]['count']; $i++) { 7670 for ($j = 0; $j < $var['menu'][$var['this_tab']][$i]['count']; $j++) { 7671 if (isset($var['menu'][$var['this_tab']][$i][$j][0])) 7672 return true; 7673 } 7674 } 7675 } 7676 else if ($var['level'] == 1) { 7677 for ($i = 0; $i < $var['menu'][$var['this_tab']][$var['this_menu']]['count']; $i++) { 7678 if (isset($var['menu'][$var['this_tab']][$var['this_menu']][$i][0])) 7679 return true; 7680 } 7681 } 7682 else if ($var['level'] == 2) { 7683 if (isset($var['menu'][$var['this_tab']][$var['this_menu']][$var['this_subtab']][0])) 7684 return true; 7685 } 7686 else if ($var['level'] == 3) 7687 return true; 7688 return false; 7689 } 7690 7691 // ----------------------------------------------------------------------------- 7692 7693 function menutoline($string) { 7694 $string = str_replace('<br>', ' ', $string); 7695 for ($i = 0; $i < strlen($string); $i++) { 7696 if (substr($string, $i, 1) != ' ' && substr($string, $i + 1, 2) == '- ' && substr($string, $i + 3, 4) != 'und ') 7697 $string = substr($string, 0, $i + 1) . substr($string, $i + 3); 7698 } 7699 return $string; 7700 } 7701 7702 // ----------------------------------------------------------------------------- 7703 7704 function replace_umlauts($string) { 7705 $string = str_replace('Ä', 'Ae', $string); 7706 $string = str_replace('ä', 'ae', $string); 7707 $string = str_replace('Ö', 'Oe', $string); 7708 $string = str_replace('ö', 'oe', $string); 7709 $string = str_replace('Ü', 'Ue', $string); 7710 $string = str_replace('ü', 'ue', $string); 7711 $string = str_replace('ß', 'ss', $string); 7712 return $string; 7713 } 7714 7715 // ----------------------------------------------------------------------------- 7716 7717 function strtohtml($string) { 7718 $string = str_replace('&', '&', $string); 7719 $string = str_replace('<', '<', $string); 7720 $string = str_replace('>', '>', $string); 7721 return $string; 7722 } 7723 7724 // ----------------------------------------------------------------------------- 7725 7726 function strtoform($string) { 7727 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7728 $string = str_replace('&', '&', $string); 7729 // if (!strstr($var['agent'], 'MSIE')) 7730 $string = str_replace("'", ''', $string); 7731 $string = str_replace('"', '"', $string); 7732 $string = str_replace('<', '<', $string); 7733 $string = str_replace('>', '>', $string); 7734 return $string; 7735 } 7736 7737 // ----------------------------------------------------------------------------- 7738 7739 function roman($number) { 7740 if ($number == 1) return 'I'; 7741 else if ($number == 2) return 'II'; 7742 else if ($number == 3) return 'III'; 7743 else if ($number == 4) return 'IV'; 7744 else if ($number == 5) return 'V'; 7745 else if ($number == 6) return 'VI'; 7746 else if ($number == 7) return 'VII'; 7747 else if ($number == 8) return 'VIII'; 7748 else if ($number == 9) return 'IX'; 7749 else if ($number == 10) return 'X'; 7750 } 7751 7752 // ----------------------------------------------------------------------------- 7753 7754 function search_website($query) { 7755 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7756 for ($i = 0; $i < strlen($query); $i++) { 7757 if (substr($query, $i, 1) == '"') 7758 $quote++; 7759 if ($quote % 2 && substr($query, $i, 1) == ' ') 7760 $query = substr($query, 0, $i) . '_' . substr($query, $i + 1); 7761 } 7762 $subquery = explode(' ', $query); 7763 for ($i = 0; $i < count($subquery); $i++) { 7764 if (substr($subquery[$i], 0, 1) == '"') { 7765 $subquery[$i] = substr(str_replace('_', ' ', $subquery[$i]), 1, -1); 7766 $querytype[$i] = 'phrase'; 7767 } 7768 else 7769 $querytype[$i] = 'word'; 7770 } 7771 $var['results']['query'] = '<i>' . implode('</i> ' . $var['or'][$var['lang']] . ' <i>', $subquery) . '</i>'; 7772 $f_ = read_dir('data/pages'); 7773 for ($i = 0; $i < count($f_); $i++) { 7774 $f[$i] = $f_[$i]; 7775 $f[$i]['filedir'] = 'pages'; 7776 } 7777 $f_ = read_dir('data/newsletter/messages/sent'); 7778 for ($i = 0; $i < count($f_); $i++) { 7779 $f[count($f)] = $f_[$i]; 7780 $f[count($f) - 1]['filedir'] = 'newsletter/messages/sent'; 7781 } 7782 if ($var['mode'] == 'admin') { 7783 $f_ = read_dir('data/newsletter/messages/unsent'); 7784 for ($i = 0; $i < count($f_); $i++) { 7785 $f[count($f)] = $f_[$i]; 7786 $f[count($f) - 1]['filedir'] = 'newsletter/messages/unsent'; 7787 } 7788 } 7789 for ($i = 0; $i < count($f); $i++) { 7790 if ($var['mode'] == 'admin' || $f[$i]['filedir'] != 'pages' || is_accessible($f[$i]['filename'])) { 7791 // echo $f[$i]['name'] . '<br>'; 7792 if ($f[$i]['filedir'] == 'pages') 7793 $file = file('data/pages/' . $f[$i]['filename']); 7794 else { 7795 $filedata = read_file('data/' . $f[$i]['filedir'] . '/' . $f[$i]['filename']); 7796 $file[0] = $filedata['subject']; 7797 $file[1] = $filedata['from']; 7798 $file[2] = $filedata['date']; 7799 $data = explode('\n', $filedata['message']); 7800 for ($j = 0; $j < count($data); $j++) 7801 $file[$j + 3] = $data[$j]; 7802 } 7803 for ($j = 0; $j < count($file); $j++) { 7804 $file[$j] = chop($file[$j]); 7805 if (strstr($file[$j], '<address>') || strstr($file[$j], '<link>')) { 7806 if (strstr($file[$j], '<address>')) 7807 $line = parse_address($file[$j], substr($f[$i]['name'], -2)); 7808 else if (strstr($file[$j], '<link>')) 7809 $line = parse_link($file[$j], substr($f[$i]['name'], -2)); 7810 $line = str_replace('<br>', ' — ', $line); 7811 $line = str_replace('</table>', ' — ', $line); 7812 $line = substr(chop(strip_tags($line)), 0, -8); 7813 } 7814 else 7815 $line = strip_tags($file[$j]); 7816 for ($k = 0; $k < count($subquery); $k++) { 7817 if ($querytype[$k] == 'phrase') { 7818 for ($l = 0; $l < strlen($line); $l++) { 7819 if (strtolower(substr($line, $l, strlen($subquery[$k]))) == strtolower($subquery[$k])) { 7820 if (!$found_page[$i]) { 7821 $var['results']['pages']['total']++; 7822 $var['results']['url'][$var['results']['pages']['total'] - 1] = $f[$i]['name']; 7823 $found_page[$i] = true; 7824 } 7825 if (!$found_paragraph[$i][$j]) { 7826 $var['results']['relevance'][$var['results']['pages']['total'] - 1]++; 7827 $var['results']['paragraphs'][$var['results']['pages']['total'] - 1]++; 7828 $var['results']['paragraphs']['total']++; 7829 $var['results']['result'][$var['results']['pages']['total'] - 1][$var['results']['paragraphs'][$var['results']['pages']['total'] - 1] - 1] = $line; 7830 $found_paragraph[$i][$j] = true; 7831 } 7832 $var['results']['result'][$var['results']['pages']['total'] - 1][$var['results']['paragraphs'][$var['results']['pages']['total'] - 1] - 1] = str_replace(substr($line, $l, strlen($subquery[$k])), '<span>' . substr($line, $l, strlen($subquery[$k])) . '</span>', $var['results']['result'][$var['results']['pages']['total'] - 1][$var['results']['paragraphs'][$var['results']['pages']['total'] - 1] - 1]); 7833 $var['results']['relevance'][$var['results']['pages']['total'] - 1] += 1000; 7834 $var['results']['times'][$var['results']['pages']['total'] - 1]++; 7835 $var['results']['times']['total']++; 7836 } 7837 } 7838 } 7839 else if ($querytype[$k] == 'word') { 7840 $line_modified = $line; 7841 // echo $var['search']['space'] . '!'; 7842 for ($l = 0; $l < strlen($var['search']['space']); $l++) 7843 $line_modified = str_replace(substr($var['search']['space'], $l, 1), ' ', $line_modified); 7844 while (strstr($line_modified, ' ')) 7845 $line_modified = str_replace(' ', ' ', $line_modified); 7846 $word = explode(' ', $line_modified); 7847 for ($l = 0; $l < count($word); $l++) { 7848 if (strtolower($word[$l]) == strtolower($subquery[$k])) { 7849 if (!$found_page[$i]) { 7850 $var['results']['pages']['total']++; 7851 $var['results']['url'][$var['results']['pages']['total'] - 1] = $f[$i]['name']; 7852 $found_page[$i] = true; 7853 } 7854 if (!$found_paragraph[$i][$j]) { 7855 $var['results']['relevance'][$var['results']['pages']['total'] - 1]++; 7856 $var['results']['paragraphs'][$var['results']['pages']['total'] - 1]++; 7857 $var['results']['paragraphs']['total']++; 7858 $var['results']['result'][$var['results']['pages']['total'] - 1][$var['results']['paragraphs'][$var['results']['pages']['total'] - 1] - 1] = $line; 7859 $found_paragraph[$i][$j] = true; 7860 } 7861 $var['results']['relevance'][$var['results']['pages']['total'] - 1] += 1000; 7862 $var['results']['times'][$var['results']['pages']['total'] - 1]++; 7863 $var['results']['times']['total']++; 7864 $var['results']['result'][$var['results']['pages']['total'] - 1][$var['results']['paragraphs'][$var['results']['pages']['total'] - 1] - 1] = str_replace($word[$l], "<span>$word[$l]</span>", $var['results']['result'][$var['results']['pages']['total'] - 1][$var['results']['paragraphs'][$var['results']['pages']['total'] - 1] - 1]); 7865 } 7866 } 7867 } 7868 } 7869 } 7870 } 7871 if ($var['results']['result'][$var['results']['pages']['total'] - 1]) { 7872 $var['results']['time'][$var['results']['pages']['total'] - 1] = $f[$i]['time']; 7873 $var['results']['date'][$var['results']['pages']['total'] - 1] = $f[$i]['date'] . ' ' . $var['timezone'][$var['lang']]; 7874 } 7875 } 7876 } 7877 7878 // ----------------------------------------------------------------------------- 7879 7880 function search_internet($query) { 7881 $var['debug'] = true; 7882 global $HTTP_USER_AGENT, $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7883 echo '!!!'; error_reporting(E_ALL); 7884 $f = fsockopen('google.com', 80, $error, $message, 30); 7885 echo "$error:$message<br>"; 7886 fputs($f, 'GET /search?q=' . urlencode($query) . "&num=100 HTTP/1.0\r\n"); 7887 fputs($f, "User Agent: $HTTP_USER_AGENT\r\n"); 7888 fputs($f, "Host: www.google.com\r\n"); 7889 fputs($f, "\r\n"); 7890 while (!feof($f)) 7891 $google .= fgetc($f); 7892 fclose($f); 7893 echo htmlentities($google); 7894 exit; 7895 if (!strstr($google, 'did not match any documents')) { 7896 $data = explode('<div>', $google); 7897 $item = explode('<p class=g>', $data[1]); 7898 for ($i = 1; $i < count($item); $i++) { 7899 if (strstr($item[$i], 'repeat the search with the omitted results included')) 7900 break; 7901 $line = explode('<br>', $item[$i]); 7902 $data = explode('<a href=', $line[0]); 7903 $data = explode('>', $data[1]); 7904 $var['results']['url'][$i] = $data[0]; 7905 $data = explode('<a href=', $line[0]); 7906 $data = explode(' - [ ', $data[1]); 7907 $var['results']['title'][$i] = strip_tags('<' . $data[0]); 7908 for ($j = 1; $j < count($line); $j++) { 7909 if (strstr($line[$j], '<font color=#008000>')) 7910 break; 7911 else if (!strstr($line[$j], '<font color=#6f6f6f>') && !strstr($line[$j], '<span class=f>') && !strstr($line[$j], '<a class=fl')) { 7912 if ($var['results']['result'][$i][0]) 7913 $var['results']['result'][$i][0] .= ' '; 7914 $var['results']['result'][$i][0] .= str_replace('<font size=-1>', '', $line[$j]); 7915 } 7916 } 7917 $var['results']['result'][$i][0] = str_replace('<b>...</b>', '...', $var['results']['result'][$i][0]); 7918 $var['results']['result'][$i][0] = str_replace('</b> <b>', ' ', $var['results']['result'][$i][0]); 7919 $var['results']['result'][$i][0] = str_replace('<b>', '<span>', $var['results']['result'][$i][0]); 7920 $var['results']['result'][$i][0] = str_replace('</b>', '</span>', $var['results']['result'][$i][0]); 7921 $var['results']['relevance'][$i] = 100 - $i; 7922 $var['results']['times']['total']++; 7923 // echo '<tt><font color=#000080>' . htmlentities($item[$i]) . '</font></tt><br><br>'; 7924 // echo '<tt><font color=#008000>' . $var['results']['url'][$i] . ' | ' . $var['results']['title'][$i] . ' | ' . htmlentities($var['results']['result'][$i][0]) . '</tt></font><br><br>'; 7925 } 7926 } 7927 } 7928 7929 // ----------------------------------------------------------------------------- 7930 7931 function search_news($query) { 7932 global $HTTP_USER_AGENT, $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7933 $f = fsockopen('news.google.com', 80, $error, $message, 30); 7934 if ($var['sort'] == 'relevance') 7935 fputs($f, 'GET /news?q=' . urlencode($query) . "&num=100 HTTP/1.0\r\n"); 7936 else if ($var['sort'] == 'date') 7937 fputs($f, 'GET /news?q=' . urlencode($query) . "&num=100&scoring=d HTTP/1.0\r\n"); 7938 fputs($f, "User Agent: $HTTP_USER_AGENT\r\n"); 7939 fputs($f, "Host: news.google.com\r\n"); 7940 fputs($f, "\r\n"); 7941 while (!feof($f)) 7942 $google .= fgetc($f); 7943 fclose($f); 7944 if (!strstr($google, 'did not match any documents')) { 7945 $data = explode('<div>', $google); 7946 $item = explode('<p>', $data[1]); 7947 for ($i = 0; $i < count($item) - 2; $i++) { 7948 if (strstr($item[$i], 'repeat the search with the omitted results included')) 7949 break; 7950 $line = explode('<br>', $item[$i]); 7951 $var['results']['url'][$i] = substr($line[0], strpos($line[0], '<a href=') + 8, strpos($line[0], '>') - 8); 7952 $var['results']['title'][$i] = substr($line[0], strpos($line[0], '>') + 1, strpos($line[0], '</a>')); 7953 $var['results']['source'][$i] = substr($line[1], strpos($line[1], '<font size=-1><font color=green>') + 32, strpos($line[1], ' - ') - 32); 7954 $var['results']['date'][$i] = substr($line[1], strpos($line[1], ' - ') + 13, strpos($line[1], '</font>')); 7955 $var['results']['result'][$i][0] = substr($line[2], strpos($line[2], '<font size=-1>') + 14) . ' ' . substr($line[3], 0, strpos($line[3], '</font>')); 7956 $var['results']['result'][$i][0] = str_replace('<b>...</b>', '...', $var['results']['result'][$i][0]); 7957 $var['results']['result'][$i][0] = str_replace('</b> <b>', ' ', $var['results']['result'][$i][0]); 7958 $var['results']['result'][$i][0] = str_replace('<b>', '<span>', $var['results']['result'][$i][0]); 7959 $var['results']['result'][$i][0] = str_replace('</b>', '</span>', $var['results']['result'][$i][0]); 7960 $var['results']['relevance'][$i] = 100 - $i; 7961 $data = explode(' ', $var['results']['date'][$i]); 7962 if (substr($data[1], 0, 6) == 'minute') 7963 $var['results']['time'][$i] = $var['time'] - $data[0] * 60; 7964 else if (substr($data[1], 0, 4) == 'hour') 7965 $var['results']['time'][$i] = $var['time'] - $data[0] * 3600; 7966 else { 7967 $day = $data[0]; 7968 for ($j = 1; $j <= 12; $j++) { 7969 if (substr($var['month'][$j]['en'], 0, 3) == $data[1]) { 7970 $month = $j; 7971 break; 7972 } 7973 } 7974 $year = $data[2]; 7975 $var['results']['time'][$i] = mktime(0, 0, 0, $month, $day, $year); 7976 } 7977 $var['results']['times']['total']++; 7978 // echo '<tt><font color:#808080>' . htmlentities($item[$i]) . '</font></tt><br>'; 7979 // echo $var['results']['url'][$i] . ' | ' . $var['results']['title'][$i] . ' | ' . $var['results']['source'][$i] . ' | ' . $var['results']['date'][$i] . ' | ' . $var['results']['result'][$i] . '<br><br>'; 7980 } 7981 } 7982 } 7983 7984 // ----------------------------------------------------------------------------- 7985 7986 function delete_file($file) { 7987 7988 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 7989 7990 // echo $file; 7991 $data = explode('/', $file); 7992 if ($data[1] == 'addresses') 7993 $data[2] = "address.$data[2]"; 7994 else if ($data[1] == 'system') 7995 $data[2] = "system.$data[2]"; 7996 else if ($data[3] == 'unsent') { 7997 $data[2] = "message.$data[4]"; 7998 unset($data[3]); 7999 unset($data[4]); 8000 } 8001 else if ($data[2] == 'subscribers') { 8002 $data[2] = "subscriber.$data[3]"; 8003 unset($data[3]); 8004 } 8005 else 8006 $data[2] = substr($data[1], 0, -1) . ".$data[2]"; 8007 $data[1] = 'trash'; 8008 $file_ = implode('/', $data); 8009 if (file_exists($file_)) { 8010 $i = 1; 8011 $data = explode('.', $file_); 8012 $data[count($data) - 1] = "copy$i." . $data[count($data) - 1]; 8013 $file_ = implode('.', $data); 8014 while (file_exists($file_)) { 8015 $i++; 8016 $data = explode('.', $file_); 8017 $data[count($data) - 2] = "copy$i"; 8018 $file_ = implode('.', $data); 8019 } 8020 } 8021 // echo "$file --- $file_"; 8022 rename($file, $file_); 8023 // chmod($file_, 0666); 8024 } 8025 8026 // ----------------------------------------------------------------------------- 8027 8028 function delete_entry($filename, $entry) { 8029 8030 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 8031 8032 $filedata = read_file($filename); 8033 unset($filedata[$entry]); 8034 save_file($filename, $filedata); 8035 8036 } 8037 8038 // ----------------------------------------------------------------------------- 8039 8040 function encrypt($string) { 8053 // 13 LINES HIDDEN 8054 } 8055 8056 // ----------------------------------------------------------------------------- 8057 8058 function decrypt($string) { 8068 // 10 LINES HIDDEN 8069 } 8070 8071 // ----------------------------------------------------------------------------- 8072 8073 function read_news() { 8074 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 8075 if (file_exists('data/system/news.' . $var['lang'] . '.dat')) { 8076 $line = explode("\n", file_get_contents('data/system/news.' . $var['lang'] . '.dat')); 8077 for ($i = 0; $i < count($line); $i++) { 8078 $string = explode(' | ', $line[$i]); 8079 $id = $string[6]; 8080 if ($id) { 8081 $news[$id]['title'] = $string[0]; 8082 $news[$id]['description'] = $string[1]; 8083 $news[$id]['source'] = $string[2]; 8084 $news[$id]['link'] = $string[3]; 8085 $news[$id]['date'] = $string[4]; 8086 $news[$id]['time'] = $string[5]; 8087 $index[$id] = $news[$i]['time']; 8088 } 8089 } 8090 } 8091 $new_news = get_news(); 8092 foreach ($new_news as $key => $value) { 8093 $news[$key] = $value; 8094 // echo $news[$key]["title"] . $news[$key]["time"] . "<br/>"; 8095 } 8096 write_news($news); 8097 foreach ($news as $key => $value) 8098 $index[$key] = $value['time'] + mt_rand() / mt_getrandmax() * 1000000; 8099 arsort($index); 8100 foreach ($index as $key => $value) 8101 $sorted_news[count($sorted_news)] = $news[$key]; 8102 $news = $sorted_news; 8103 return $news; 8104 } 8105 8106 // ----------------------------------------------------------------------------- 8107 8108 function write_news($news) { 8109 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 8110 // echo "<br/>"; 8111 foreach ($news as $key => $value) { 8112 $index[$key] = $value['time']; 8113 // echo $news[$key]["title"] . $news[$key]["time"] . "<br/>"; 8114 } 8115 $f = fopen('data/system/news.' . $var['lang'] . '.dat', 'w'); 8116 $i = 0; 8117 $n = min(count($news), 100); 8118 arsort($index); 8119 foreach ($index as $key => $value) { 8120 //echo $news[$key]["title"]; 8121 if ($news[$key]['description']) { 8122 if ($i) 8123 fwrite($f, "\n"); 8124 fwrite($f, $news[$key]['title']); 8125 fwrite($f, ' | ' . $news[$key]['description']); 8126 fwrite($f, ' | ' . $news[$key]['source']); 8127 fwrite($f, ' | ' . $news[$key]['link']); 8128 fwrite($f, ' | ' . $news[$key]['date']); 8129 fwrite($f, ' | ' . $news[$key]['time']); 8130 fwrite($f, ' | ' . $key); 8131 $i++; 8132 if ($i == $n) 8133 break; 8134 } 8135 } 8136 fclose($f); 8137 } 8138 8139 // ----------------------------------------------------------------------------- 8140 8141 function get_news() { 8142 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 8143 $xml = file_get_contents('data/system/news.' . $var['lang'] . '.xml'); 8144 // $xml = mb_convert_encoding($xml, 'ISO-8859-1', 'auto'); 8145 $xml = iconv('UTF-8', 'ISO-8859-1//TRANSLIT', $xml); 8146 $string = explode('<item>', $xml); 8147 for ($i = 1; $i < count($string); $i++) { 8148 $string_ = explode('<title>', $string[$i]); 8149 $string_ = explode('</title>', $string_[1]); 8150 $string_[0] = strip_tags(html_entity_decode($string_[0])); 8151 $string_ = explode(' - ', $string_[0]); 8152 $source = array_pop($string_); 8153 $title = implode(' - ', $string_); 8154 if ($title == strtoupper($title)) 8155 $title = strtr(ucwords(strtolower($title)), array('Un-Habitat' => 'UN-HABITAT', 'Un Habitat' => 'UN HABITAT')); 8156 $string_ = explode('<description>', $string[$i]); 8157 $string_ = explode('</description>', $string_[1]); 8158 $string_ = explode('<br>', html_entity_decode($string_[0])); 8159 $description = trim(strip_tags($string_[3])); 8160 $string_ = explode('<link>', $string[$i]); 8161 $string_ = explode('</link>', $string_[1]); 8162 $string_[0] = html_entity_decode($string_[0]); 8163 $string_ = explode('&url=', $string_[0]); 8164 $string_ = explode('&cid=', $string_[1]); 8165 $link = $string_[0]; 8166 $string_ = explode('<pubDate>', $string[$i]); 8167 $string_ = explode('</pubDate>', $string_[1]); 8168 $date = $string_[0]; 8169 $time = strtotime($date); 8170 $id = md5($title); 8171 if ($id) { 8172 $news[$id] = array( 8173 'title' => $title, 8174 'description' => $description, 8175 'source' => $source, 8176 'link' => $link, 8177 'date' => $date, 8178 'time' => $time 8179 ); 8180 } 8181 } 8182 return $news; 8183 } 8184 8185 // ----------------------------------------------------------------------------- 8186 8187 function mail_($to, $subject, $message, $headers) { 8188 global $var; if($var['debug']) trigger_error(date('H:i:s', substr(microtime(), 11)) . substr(microtime(), 1, 7), E_USER_NOTICE); 8189 return true; 8190 } 8191 8192 ?>
About us
-
Contact
-
Search
-
Sitemap
-
Source Code
-
Report a bug
-
Login
- Last Update: Monday, August 9, 11:25 CET