Changeset 10012
- Timestamp:
- 11/28/08 03:30:32 (1 month ago)
- Files:
-
- branches/0.8/jaws/html/config/JawsConfig.php.sample (modified) (2 diffs)
- branches/0.8/jaws/html/include/Jaws/DB.php (modified) (6 diffs)
- branches/0.8/jaws/html/install/stages/Database.php (modified) (5 diffs)
- branches/0.8/jaws/html/install/stages/Database/templates/display.html (modified) (1 diff)
- branches/0.8/jaws/html/install/stages/WriteConfig.php (modified) (1 diff)
- branches/0.8/jaws/html/install/stages/WriteConfig/templates/JawsConfig.php (modified) (2 diffs)
- branches/0.8/jaws/html/languages/en/Install.php (modified) (1 diff)
- branches/0.8/jaws/html/languages/en/Upgrade.php (modified) (1 diff)
- branches/0.8/jaws/html/languages/fa/Install.php (modified) (1 diff)
- branches/0.8/jaws/html/languages/fa/Upgrade.php (modified) (1 diff)
- branches/0.8/jaws/html/upgrade/stages/Database.php (modified) (5 diffs)
- branches/0.8/jaws/html/upgrade/stages/Database/templates/display.html (modified) (1 diff)
- branches/0.8/jaws/html/upgrade/stages/WriteConfig.php (modified) (1 diff)
- branches/0.8/jaws/html/upgrade/stages/WriteConfig/templates/JawsConfig.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/0.8/jaws/html/config/JawsConfig.php.sample
r7813 r10012 3 3 * JawsConfig.php - Configuration variables 4 4 * 5 * @author Jonathan Hernandez <ion@gluch.org.mx> 6 * @copyright Jaws 2004-2008 5 * @author Jonathan Hernandez <ion@suavizado.com> 6 * @author Ali Fazelzadeh <afz@php.net> 7 * @copyright 2004-2008 Jaws Development Group 7 8 */ 8 9 9 // Path where Jaws is installed 10 10 define('JAWS_DPATH', ''); … … 27 27 $db['password'] = ''; 28 28 $db['isdba'] = 'false'; 29 $db['path'] = ''; 29 30 $db['name'] = ''; 30 31 $db['prefix'] = ''; branches/0.8/jaws/html/include/Jaws/DB.php
r10010 r10012 46 46 * @access private 47 47 */ 48 var $_isDBAdmin; 48 var $_is_dba; 49 50 /** 51 * This DB path 52 * 53 * @var string 54 * @access private 55 */ 56 var $_db_path; 49 57 50 58 var $_dsn; … … 68 76 } 69 77 70 $this->_isDBAdmin = $options['isdba'] == 'true' ? true : false; 71 $this->_driver = strtolower($options['driver']); 72 $this->_prefix = $options['prefix']; 73 $this->_charset = $options['charset']; 78 $this->_db_path = isset($options['path'])? $options['path'] : ''; 79 $this->_is_dba = $options['isdba'] == 'true' ? true : false; 80 $this->_driver = strtolower($options['driver']); 81 $this->_prefix = $options['prefix']; 82 $this->_charset = $options['charset']; 74 83 75 84 $this->connect(); … … 110 119 111 120 if ($this->_dsn['phptype'] == 'sqlite' || $this->_dsn['phptype'] == 'ibase') { 112 $options['database_path'] = JAWS_DATA;121 $options['database_path'] = empty($this->_db_path)? JAWS_DATA : $this->_db_path; 113 122 } 114 123 … … 117 126 } 118 127 119 if ($this->_is DBAdmin) {128 if ($this->_is_dba) { 120 129 $options['DBA_username'] = $this->_dsn['username']; 121 130 $options['DBA_password'] = $this->_dsn['password']; … … 567 576 568 577 if ($this->_dsn['phptype'] == 'sqlite' || $this->_dsn['phptype'] == 'ibase') { 569 $options['database_path'] = JAWS_DATA;578 $options['database_path'] = empty($this->_db_path)? JAWS_DATA : $this->_db_path; 570 579 } 571 580 … … 574 583 } 575 584 576 if ($this->_is DBAdmin) {585 if ($this->_is_dba) { 577 586 $options['DBA_username'] = $this->_dsn['username']; 578 587 $options['DBA_password'] = $this->_dsn['password']; branches/0.8/jaws/html/install/stages/Database.php
r9952 r10012 22 22 'user' => '', 23 23 'isdba' => '', 24 'path' => '', 24 25 'database' => 'jaws', 25 26 'prefix' => '', … … 104 105 $tpl->SetVariable('database', $values['database']); 105 106 $tpl->ParseBlock('Database/database'); 107 } 108 109 if (!isset($data['path'])) { 110 $fields++; 111 $tpl->SetBlock('Database/path'); 112 $tpl->setVariable('lbl_db_path', _t('INSTALL_DB_PATH')); 113 $tpl->setVariable('path_info', _t('INSTALL_DB_PATH_INFO')); 114 $tpl->SetVariable('path', $values['path']); 115 $tpl->ParseBlock('Database/path'); 106 116 } 107 117 … … 194 204 { 195 205 $request =& Jaws_Request::getInstance(); 196 $post = $request->get(array('host', 'user', 'database', 'p ort'), 'post');206 $post = $request->get(array('host', 'user', 'database', 'path', 'port'), 'post'); 197 207 if (isset($_SESSION['install']['data']['Database'])) { 198 208 $post = $_SESSION['install']['data']['Database'] + $post; 209 } 210 211 if (isset($post['path']) && $post['path'] !== '' && !is_dir($post['path'])) { 212 log_install("The database path must be exists"); 213 return new Jaws_Error(_t('INSTALL_DB_RESPONSE_PATH'), 0, JAWS_ERROR_WARNING); 199 214 } 200 215 … … 250 265 } 251 266 267 if (!empty($post['path'])) { 268 if (DIRECTORY_SEPARATOR != '/') { 269 $post['path'] = str_replace('/', '\\', $post['path']); 270 } 271 if (substr($post['path'], -1) != DIRECTORY_SEPARATOR) { 272 $post['path'] .= DIRECTORY_SEPARATOR; 273 } 274 } 275 252 276 $_SESSION['install']['Database'] = array( 253 277 'user' => trim($post['user']), … … 255 279 'isdba' => !empty($post['isdba'])? 'true' : 'false', 256 280 'name' => trim($post['database']), 281 'path' => trim($post['path']), 257 282 'host' => trim($post['host']), 258 283 'port' => trim($post['port']), branches/0.8/jaws/html/install/stages/Database/templates/display.html
r8128 r10012 61 61 </tr> 62 62 <!-- END database --> 63 <!-- BEGIN path --> 64 <tr> 65 <td><label for="path">{lbl_db_path}:</label></td> 66 <td><input type="text" name="path" id="path" value="{path}" size="30" style="direction: ltr;" /></td> 67 </tr> 68 <tr> 69 <td></td> 70 <td class="form_comment">{path_info}</td> 71 </tr> 72 <!-- END path --> 63 73 <!-- BEGIN port --> 64 74 <tr> branches/0.8/jaws/html/install/stages/WriteConfig.php
r7909 r10012 27 27 $tpl->SetVariable('db_pass', $_SESSION['install']['Database']['password']); 28 28 $tpl->SetVariable('db_isdba', $_SESSION['install']['Database']['isdba']); 29 $tpl->SetVariable('db_path', addslashes($_SESSION['install']['Database']['path'])); 29 30 $tpl->SetVariable('db_name', $_SESSION['install']['Database']['name']); 30 31 $tpl->SetVariable('db_prefix', $_SESSION['install']['Database']['prefix']); branches/0.8/jaws/html/install/stages/WriteConfig/templates/JawsConfig.php
r7925 r10012 3 3 * JawsConfig.php - Configuration variables 4 4 * 5 * @author Jonathan Hernandez <ion@suavizado.com> 6 * @copyright Jaws 2004-2008 5 * @author Jonathan Hernandez <ion@suavizado.com> 6 * @author Ali Fazelzadeh <afz@php.net> 7 * @copyright 2004-2008 Jaws Development Group 7 8 */ 8 9 // Path where Jaws is installed … … 26 27 $db['password'] = '{db_pass}'; 27 28 $db['isdba'] = '{db_isdba}'; 29 $db['path'] = '{db_path}'; 28 30 $db['name'] = '{db_name}'; 29 31 $db['prefix'] = '{db_prefix}'; branches/0.8/jaws/html/languages/en/Install.php
r8524 r10012 74 74 define('_EN_INSTALL_DB_IS_ADMIN', "Is DB Admin?"); 75 75 define('_EN_INSTALL_DB_NAME', "Database Name"); 76 define('_EN_INSTALL_DB_PATH', "Database Path"); 77 define('_EN_INSTALL_DB_PATH_INFO', "Only fill this field out if you like change your database path in SQLite, Interbase and Firebird driver."); 76 78 define('_EN_INSTALL_DB_PORT', "Database Port"); 77 79 define('_EN_INSTALL_DB_PORT_INFO', "Only fill this field out if your database is running on an another port then the default is.<br />If you have <strong>no idea</strong> what port the database is running then most likely it's running on the default port and thus we <strong>advice</strong> you to leave this field alone."); 78 80 define('_EN_INSTALL_DB_PREFIX', "Tables Prefix"); 79 81 define('_EN_INSTALL_DB_PREFIX_INFO', "Some text that will be placed in front of table names, so you can run more than one Jaws site from the same database, for example <strong>blog_</strong>"); 82 define('_EN_INSTALL_DB_RESPONSE_PATH', "The database path not exist"); 80 83 define('_EN_INSTALL_DB_RESPONSE_PORT', "The port can only be a numeric value"); 81 84 define('_EN_INSTALL_DB_RESPONSE_INCOMPLETE', "You must fill in all the fields apart from table prefix and port."); branches/0.8/jaws/html/languages/en/Upgrade.php
r9598 r10012 73 73 define('_EN_UPGRADE_DB_IS_ADMIN', "Is DB Admin?"); 74 74 define('_EN_UPGRADE_DB_NAME', "Database Name"); 75 define('_EN_UPGRADE_DB_PATH', "Database Path"); 76 define('_EN_UPGRADE_DB_PATH_INFO', "Only fill this field out if you like change your database path in SQLite, Interbase and Firebird driver."); 75 77 define('_EN_UPGRADE_DB_PORT', "Database Port"); 76 78 define('_EN_UPGRADE_DB_PORT_INFO', "Only fill this field out if your database is running on an another port then the default is.<br />If you have <strong>no idea</strong> what port the database is running then most likely it's running on the default port and thus we <strong>advice</strong> you to leave this field alone."); 77 79 define('_EN_UPGRADE_DB_PREFIX', "Tables Prefix"); 78 80 define('_EN_UPGRADE_DB_PREFIX_INFO', "Some text that will be placed in front of table names, so you can run more than one Jaws site from the same database, for example <strong>blog_</strong>"); 81 define('_EN_UPGRADE_DB_RESPONSE_PATH', "The database path not exist"); 79 82 define('_EN_UPGRADE_DB_RESPONSE_PORT', "The port can only be a numeric value"); 80 83 define('_EN_UPGRADE_DB_RESPONSE_INCOMPLETE', "You must fill in all the fields apart from table prefix and port."); branches/0.8/jaws/html/languages/fa/Install.php
r8524 r10012 65 65 define('_FA_INSTALL_DB_IS_ADMIN', "آیا دسترسی سوپروایزری دارد؟"); 66 66 define('_FA_INSTALL_DB_NAME', "نام دیتابیس"); 67 define('_FA_INSTALL_DB_PATH', "مسیر دیتابیس"); 68 define('_FA_INSTALL_DB_PATH_INFO', "این فیلد در صورتی پر کنید که قصد تغییر مسیر دیتابیس در SQLite، Interbase و یا Firebird را داشته باشید."); 67 69 define('_FA_INSTALL_DB_PORT', "پورت دیتابیس"); 68 70 define('_FA_INSTALL_DB_PORT_INFO', "این فیلد را فقط وقتی پر کنید که دیتابیس شما روی پورتی غیر از حالت پیش فرضش نصب شده باشد. البته به صورت معمول دیتابیس ها روی پورت پیش فرض نصب میشوند، لذا اگر اطلاع کافی در مورد آن ندارید آنرا بصورت خالی نگه دارید."); 69 71 define('_FA_INSTALL_DB_PREFIX', "پیش نام جدول"); 70 72 define('_FA_INSTALL_DB_PREFIX_INFO', "کلمه ای که قبل از نام جداول قرار خواهد گرفت، بوسیله آن می توان بیش از یک جاوز را برروی یک دیتابیس نصب کرد، به عنوان مثال blog_"); 73 define('_FA_INSTALL_DB_RESPONSE_PATH', "مسیر دیتابیس وجود ندارد."); 71 74 define('_FA_INSTALL_DB_RESPONSE_PORT', "پورت تنها می تواند شامل اعداد باشد."); 72 75 define('_FA_INSTALL_DB_RESPONSE_INCOMPLETE', "پر کردن همه فیلدها (بغیر از پیش نام جداول و پورت دیتابیس) اجباری است."); branches/0.8/jaws/html/languages/fa/Upgrade.php
r9598 r10012 64 64 define('_FA_UPGRADE_DB_IS_ADMIN', "آیا دسترسی سوپروایزری دارد؟"); 65 65 define('_FA_UPGRADE_DB_NAME', "نام دیتابیس"); 66 define('_FA_UPGRADE_DB_PATH', "مسیر دیتابیس"); 67 define('_FA_UPGRADE_DB_PATH_INFO', "این فیلد در صورتی پر کنید که قصد تغییر مسیر دیتابیس در SQLite، Interbase و یا Firebird را داشته باشید."); 66 68 define('_FA_UPGRADE_DB_PORT', "پورت دیتابیس"); 67 69 define('_FA_UPGRADE_DB_PORT_INFO', "این فیلد را فقط وقتی پر کنید که دیتابیس شما روی پورتی غیر از حالت پیش فرضش نصب شده باشد. البته به صورت معمول دیتابیس ها روی پورت پیش فرض نصب میشوند، لذا اگر اطلاع کافی در مورد آن ندارید آنرا بصورت خالی نگه دارید."); 68 70 define('_FA_UPGRADE_DB_PREFIX', "پیش نام جدول"); 69 71 define('_FA_UPGRADE_DB_PREFIX_INFO', "کلمه ای که قبل از نام جداول قرار خواهد گرفت، بوسیله آن می توان بیش از یک جاوز را برروی یک دیتابیس نصب کرد، به عنوان مثال blog_"); 72 define('_FA_UPGRADE_DB_RESPONSE_PATH', "مسیر دیتابیس وجود ندارد."); 70 73 define('_FA_UPGRADE_DB_RESPONSE_PORT', "پورت تنها می تواند شامل اعداد باشد."); 71 74 define('_FA_UPGRADE_DB_RESPONSE_INCOMPLETE', "پر کردن همه فیلدها (بغیر از پیش نام جداول و پورت دیتابیس) اجباری است."); branches/0.8/jaws/html/upgrade/stages/Database.php
r7932 r10012 21 21 'user' => '', 22 22 'isdba' => '', 23 'path' => '', 23 24 'database' => 'jaws', 24 25 'prefix' => '', … … 102 103 $tpl->SetVariable('database', $values['database']); 103 104 $tpl->ParseBlock('Database/database'); 105 } 106 107 if (!isset($data['path'])) { 108 $fields++; 109 $tpl->SetBlock('Database/path'); 110 $tpl->setVariable('lbl_db_path', _t('UPGRADE_DB_PATH')); 111 $tpl->setVariable('path_info', _t('UPGRADE_DB_PATH_INFO')); 112 $tpl->SetVariable('path', $values['path']); 113 $tpl->ParseBlock('Database/path'); 104 114 } 105 115 … … 192 202 { 193 203 $request =& Jaws_Request::getInstance(); 194 $post = $request->get(array('host', 'user', 'database', 'p ort'), 'post');204 $post = $request->get(array('host', 'user', 'database', 'path', 'port'), 'post'); 195 205 if (isset($_SESSION['upgrade']['data']['Database'])) { 196 206 $post = $_SESSION['upgrade']['data']['Database'] + $post; 207 } 208 209 if (isset($post['path']) && $post['path'] !== '' && !is_dir($post['path'])) { 210 log_upgrade("The database path must be exists"); 211 return new Jaws_Error(_t('UPGRADE_DB_RESPONSE_PATH'), 0, JAWS_ERROR_WARNING); 197 212 } 198 213 … … 248 263 } 249 264 265 if (!empty($post['path'])) { 266 if (DIRECTORY_SEPARATOR != '/') { 267 $post['path'] = str_replace('/', '\\', $post['path']); 268 } 269 if (substr($post['path'], -1) != DIRECTORY_SEPARATOR) { 270 $post['path'] .= DIRECTORY_SEPARATOR; 271 } 272 } 273 250 274 $_SESSION['upgrade']['Database'] = array( 251 275 'user' => trim($post['user']), … … 253 277 'isdba' => !empty($post['isdba'])? 'true' : 'false', 254 278 'name' => trim($post['database']), 279 'path' => trim($post['path']), 255 280 'host' => trim($post['host']), 256 281 'port' => trim($post['port']), branches/0.8/jaws/html/upgrade/stages/Database/templates/display.html
r8128 r10012 60 60 </tr> 61 61 <!-- END database --> 62 <!-- BEGIN path --> 63 <tr> 64 <td><label for="path">{lbl_db_path}:</label></td> 65 <td><input type="text" name="path" id="path" value="{path}" size="30" style="direction: ltr;" /></td> 66 </tr> 67 <tr> 68 <td></td> 69 <td class="form_comment">{path_info}</td> 70 </tr> 71 <!-- END path --> 62 72 <!-- BEGIN port --> 63 73 <tr> branches/0.8/jaws/html/upgrade/stages/WriteConfig.php
r7948 r10012 32 32 $tpl->SetVariable('db_isdba', $_SESSION['upgrade']['Database']['isdba']); 33 33 $tpl->SetVariable('db_name', $_SESSION['upgrade']['Database']['name']); 34 $tpl->SetVariable('db_path', addslashes($_SESSION['upgrade']['Database']['path'])); 34 35 $tpl->SetVariable('db_prefix', $_SESSION['upgrade']['Database']['prefix']); 35 36 $tpl->SetVariable('db_charset', $_SESSION['upgrade']['Database']['charset']); branches/0.8/jaws/html/upgrade/stages/WriteConfig/templates/JawsConfig.php
r7925 r10012 3 3 * JawsConfig.php - Configuration variables 4 4 * 5 * @author Jonathan Hernandez <ion@suavizado.com> 6 * @copyright Jaws 2004-2008 5 * @author Jonathan Hernandez <ion@suavizado.com> 6 * @author Ali Fazelzadeh <afz@php.net> 7 * @copyright 2004-2008 Jaws Development Group 7 8 */ 8 9 // Path where Jaws is installed … … 26 27 $db['password'] = '{db_pass}'; 27 28 $db['isdba'] = '{db_isdba}'; 29 $db['path'] = '{db_path}'; 28 30 $db['name'] = '{db_name}'; 29 31 $db['prefix'] = '{db_prefix}';
