Changeset 3
- Timestamp:
- 2007-11-20 19:57:18 (5 years ago)
- Files:
-
- trunk/admin/classes/pages/Settings.php (modified) (4 diffs)
- trunk/includes/config/settings.tmpl (modified) (1 diff)
- trunk/includes/input.php (modified) (1 diff)
- trunk/includes/lang/en.php (modified) (1 diff)
- trunk/includes/login.php (modified) (1 diff)
- trunk/includes/session.php (modified) (1 diff)
- trunk/redirectors/logout.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/admin/classes/pages/Settings.php
r1 r3 32 32 public function __construct() { 33 33 global $LANG, $C, $F, $SETTINGS, $LANG; 34 global $commit, $newsqltype, $newsqlhost, $newsqluser, $newsqlpassword, $newdbname, $newdbtableprefix, $newforumname, $newslogan, $newforumlogo, $newsitename, $newsiteurl, $newforumadmin, $newforumadminemail, $newtopicsperpage, $newpostsperpage, $newmaxavatarsize, $newguestemail, $newfloodcontrol, $newfloodcontrol_search, $newmaxuploadsize, $newuploadextensions, $newlanguage, $newurl_rewriting, $newtimezone, $newencoding, $newdefaultstyle, $newexpire, $newdebug, $newhash, $newseveralaccountspermail, $newmaintainancemode ;34 global $commit, $newsqltype, $newsqlhost, $newsqluser, $newsqlpassword, $newdbname, $newdbtableprefix, $newforumname, $newslogan, $newforumlogo, $newsitename, $newsiteurl, $newforumadmin, $newforumadminemail, $newtopicsperpage, $newpostsperpage, $newmaxavatarsize, $newguestemail, $newfloodcontrol, $newfloodcontrol_search, $newmaxuploadsize, $newuploadextensions, $newlanguage, $newurl_rewriting, $newtimezone, $newencoding, $newdefaultstyle, $newexpire, $newdebug, $newhash, $newseveralaccountspermail, $newmaintainancemode, $newfspath, $newwebpath; 35 35 // define location and title parameter 36 36 $this->title = ''; … … 56 56 fwrite($file, "\$SETTINGS['dbname'] = '" . $newdbname . "'; // name of the SQL database\n"); 57 57 fwrite($file, "\$SETTINGS['dbtableprefix'] = '" . $newdbtableprefix . "'; // prefix of all the database tables\n"); 58 fwrite($file, "\$SETTINGS['fspath'] = '" . $newfspath . "'; // full file system path to the forum root\n"); 59 fwrite($file, "\$SETTINGS['webpath'] = '" . $newwebpath . "'; // path to the forum from domain's root\n"); 58 60 fwrite($file, "\$SETTINGS['forumname'] = '" . $newforumname . "'; // displayed in browser's title and used for outgoing e-mail\n"); 59 61 fwrite($file, "\$SETTINGS['slogan'] = '" . $newslogan . "'; // displayed in browser's title\n"); … … 83 85 // close file 84 86 @fclose($file); 87 // write path to the .htaccess files (if present) 88 if (is_file('../.htaccess')) { 89 if ($newurl_rewriting == 1) { 90 $_rewrite = 'On'; 91 } else { 92 $_rewrite = 'Off'; 93 } 94 if ($file = @fopen('../.htaccess', 'w')) { 95 // write settings 96 fwrite($file, "RewriteEngine " . $_rewrite . "\n\nRewriteBase " . $newwebpath . "\n\nRewriteRule ^index\.php$ index.php [L]\nRewriteRule ^([a-z]+)\.php$ index.php?show=$1&%{QUERY_STRING} [L]\n\nOptions -Indexes\n"); 97 @fclose($file); 98 } 99 if ($file = @fopen('../admin/.htaccess', 'w')) { 100 // write settings 101 fwrite($file, "RewriteEngine " . $_rewrite . "\n\nRewriteBase " . $newwebpath . "admin/\n\nRewriteRule ^index\.php$ index.php [L]\nRewriteRule ^([a-z]+)\.php$ index.php?show=$1&%{QUERY_STRING} [L]\n\nOptions -Indexes\n"); 102 @fclose($file); 103 } 104 } 85 105 $div = $this->html->body->addChild('div', $LANG['board_settings_updated']); 86 106 $div->addAttribute('id', 'admin_main'); … … 121 141 $form->addTableRow($LANG['SQL_Database'], 'text', 'newdbname', $SETTINGS['dbname']); 122 142 $form->addTableRow($LANG['SQL_Database_Table_Prefix'], 'text', 'newdbtableprefix', $SETTINGS['dbtableprefix']); 143 $form->addTableRow($LANG['Filesystem_Path'], 'text', 'newfspath', $SETTINGS['fspath']); 144 $form->addTableRow($LANG['Webserver_Path'], 'text', 'newwebpath', $SETTINGS['webpath']); 123 145 $form->addTableRow($LANG['Board_Name'], 'text', 'newforumname', $SETTINGS['forumname']); 124 146 $form->addTableRow($LANG['Board_Slogan'], 'text', 'newslogan', $SETTINGS['slogan']); trunk/includes/config/settings.tmpl
r1 r3 14 14 $SETTINGS['dbname'] = ''; // name of the SQL database 15 15 $SETTINGS['dbtableprefix'] = 'sb_'; // prefix of all the database tables 16 $SETTINGS['fspath'] = ''; // full file system path to the forum root 17 $SETTINGS['webpath'] = ''; // path to the forum from domain's root 16 18 $SETTINGS['forumname'] = 'Spam Board'; // displayed in browser's title and used for outgoing e-mail 17 19 $SETTINGS['slogan'] = 'The Tastiest Forum on Earth!'; // displayed in browser's title trunk/includes/input.php
r1 r3 539 539 } 540 540 541 $newfspath = $_POST['newfspath']; 542 if (preg_match('/^[A-Za-z0-9_\-\/\\:\.]*$/', $newfspath) != 1) { 543 // die($LANG['error_input']); 544 } 545 546 $newwebpath = $_POST['newwebpath']; 547 if (preg_match('/^[A-Za-z0-9_\-\/\.]*$/', $newwebpath) != 1) { 548 // die($LANG['error_input']); 549 } 550 541 551 ?> trunk/includes/lang/en.php
r1 r3 297 297 $LANG['Maintainance_Mode'] = 'Maintainance Mode'; 298 298 $LANG['new_message_subject'] = 'New Private Message at ' . $SETTINGS['forumname']; 299 $LANG['Filesystem_Path'] = 'Filesystem Path'; 300 $LANG['Webserver_Path'] = 'Webserver Path'; 299 301 300 302 /* actual sentences */ trunk/includes/login.php
r1 r3 59 59 // send cookie 60 60 $exp = time() + $SETTINGS['expire'] * 24 * 60 * 60; 61 setcookie('sb_user', $encrypted_cookie . '*' . $row->offset, $exp, substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/') - 11));61 setcookie('sb_user', $encrypted_cookie . '*' . $row->offset, $exp, $SETTINGS['webpath']); 62 62 } 63 63 // delete potential number of failed logins from cookie trunk/includes/session.php
r1 r3 25 25 // ignore well-known bots 26 26 if (stristr($_SERVER['HTTP_USER_AGENT'], 'Googlebot') === FALSE && stristr($_SERVER['HTTP_USER_AGENT'], 'Slurp') === FALSE && stristr($_SERVER['HTTP_USER_AGENT'], 'ia_archiver') === FALSE && stristr($_SERVER['HTTP_USER_AGENT'], 'Harvest') === FALSE && stristr($_SERVER['HTTP_USER_AGENT'], 'crawl') === FALSE && stristr($_SERVER['HTTP_USER_AGENT'], 'bot') === FALSE && stristr($_SERVER['HTTP_USER_AGENT'], 'jeeves') === FALSE && stristr($_SERVER['HTTP_USER_AGENT'], 'spider') === FALSE) { 27 // if included from admin/redirectors subdirectory 28 if (strstr($_SERVER['PHP_SELF'], 'admin/redirectors')) { 29 // save session info in subdirectory instead of system-wide /tmp/ 30 ini_set('session.save_path', substr($_SERVER['SCRIPT_FILENAME'], 0, strrpos($_SERVER['SCRIPT_FILENAME'], '/') - 18) . '/sessions'); 31 // session valid for whole board 32 ini_set('session.cookie_path', substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/') - 17)); 33 // if included from redirectors subdirectory 34 } elseif (strstr($_SERVER['PHP_SELF'], 'redirectors')) { 35 // save session info in subdirectory instead of system-wide /tmp/ 36 ini_set('session.save_path', substr($_SERVER['SCRIPT_FILENAME'], 0, strrpos($_SERVER['SCRIPT_FILENAME'], '/') - 12) . '/sessions'); 37 // session valid for whole board 38 ini_set('session.cookie_path', substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/') - 11)); 39 // if included from admin subdirectory 40 } elseif (strstr($_SERVER['PHP_SELF'], 'admin')) { 41 // save session info in subdirectory instead of system-wide /tmp/ 42 ini_set('session.save_path', substr($_SERVER['SCRIPT_FILENAME'], 0, strrpos($_SERVER['SCRIPT_FILENAME'], '/') - 6) . '/sessions'); 43 // session valid for whole board 44 ini_set('session.cookie_path', substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/') - 5)); 45 } else { 46 // save session info in subdirectory instead of system-wide /tmp/ 47 ini_set('session.save_path', substr($_SERVER['SCRIPT_FILENAME'], 0, strrpos($_SERVER['SCRIPT_FILENAME'], '/')) . '/sessions'); 48 // session valid for whole board 49 ini_set('session.cookie_path', substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/') + 1)); 50 } 27 // save session info in subdirectory instead of system-wide /tmp/ 28 ini_set('session.save_path', $SETTINGS['fspath'] . 'sessions'); 29 // session valid for whole board 30 ini_set('session.cookie_path', $SETTINGS['fspath']); 51 31 // name of the session variable 52 32 ini_set('session.name', 's'); trunk/redirectors/logout.php
r1 r3 57 57 if ($_SESSION['remember'] === 1) { 58 58 // delete cookie 59 @setcookie('sb_user', '', -1, substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/') - 11));59 @setcookie('sb_user', '', -1, $SETTINGS['webpath']); 60 60 } 61 61 $_SESSION['remember'] = 0; … … 64 64 session_start(); 65 65 // update in database 66 $q = $C->prepare('UPDATE ' .$SETTINGS['dbtableprefix'].'online SET onlinememberid=0 WHERE onlinesession=:session');66 $q = $C->prepare('UPDATE ' . $SETTINGS['dbtableprefix'] . 'online SET onlinememberid=0 WHERE onlinesession=:session'); 67 67 $q->bindParam(':session', session_id(), PDO::PARAM_STR, 40); 68 68 $q->execute();
