Changeset 3691:3dbfcef11299 for admin/install/index.php
- Timestamp:
- 01/31/18 12:11:05 (8 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/install/index.php
r3639 r3691 12 12 13 13 if (isset($_SERVER['DC_RC_PATH'])) { 14 14 $rc_path = $_SERVER['DC_RC_PATH']; 15 15 } elseif (isset($_SERVER['REDIRECT_DC_RC_PATH'])) { 16 16 $rc_path = $_SERVER['REDIRECT_DC_RC_PATH']; 17 17 } else { 18 $rc_path = dirname(__FILE__).'/../../inc/config.php';19 } 20 21 require dirname(__FILE__) .'/../../inc/prepend.php';22 require dirname(__FILE__) .'/check.php';18 $rc_path = dirname(__FILE__) . '/../../inc/config.php'; 19 } 20 21 require dirname(__FILE__) . '/../../inc/prepend.php'; 22 require dirname(__FILE__) . '/check.php'; 23 23 24 24 $can_install = true; 25 $err = '';25 $err = ''; 26 26 27 27 # Loading locales for detected language 28 28 $dlang = http::getAcceptLanguage(); 29 if ($dlang != 'en') 30 { 31 l10n::init($dlang); 32 l10n::set(dirname(__FILE__).'/../../locales/'.$dlang.'/date'); 33 l10n::set(dirname(__FILE__).'/../../locales/'.$dlang.'/main'); 34 l10n::set(dirname(__FILE__).'/../../locales/'.$dlang.'/plugins'); 29 if ($dlang != 'en') { 30 l10n::init($dlang); 31 l10n::set(dirname(__FILE__) . '/../../locales/' . $dlang . '/date'); 32 l10n::set(dirname(__FILE__) . '/../../locales/' . $dlang . '/main'); 33 l10n::set(dirname(__FILE__) . '/../../locales/' . $dlang . '/plugins'); 35 34 } 36 35 37 36 if (!defined('DC_MASTER_KEY') || DC_MASTER_KEY == '') { 38 39 $err = '<p>'.__('Please set a master key (DC_MASTER_KEY) in configuration file.').'</p>';37 $can_install = false; 38 $err = '<p>' . __('Please set a master key (DC_MASTER_KEY) in configuration file.') . '</p>'; 40 39 } 41 40 42 41 # Check if dotclear is already installed 43 42 $schema = dbSchema::init($core->con); 44 if (in_array($core->prefix .'post',$schema->getTables())) {45 46 $err = '<p>'.__('Dotclear is already installed.').'</p>';43 if (in_array($core->prefix . 'post', $schema->getTables())) { 44 $can_install = false; 45 $err = '<p>' . __('Dotclear is already installed.') . '</p>'; 47 46 } 48 47 49 48 # Check system capabilites 50 if (!dcSystemCheck($core->con, $_e)) {51 52 $err = '<p>'.__('Dotclear cannot be installed.').'</p><ul><li>'.implode('</li><li>',$_e).'</li></ul>';49 if (!dcSystemCheck($core->con, $_e)) { 50 $can_install = false; 51 $err = '<p>' . __('Dotclear cannot be installed.') . '</p><ul><li>' . implode('</li><li>', $_e) . '</li></ul>'; 53 52 } 54 53 55 54 # Get information and perform install 56 $u_email = $u_firstname = $u_name = $u_login = $u_pwd= '';55 $u_email = $u_firstname = $u_name = $u_login = $u_pwd = ''; 57 56 $mail_sent = false; 58 if ($can_install && !empty($_POST)) 59 { 60 $u_email = !empty($_POST['u_email']) ? $_POST['u_email'] : null; 61 $u_firstname = !empty($_POST['u_firstname']) ? $_POST['u_firstname'] : null; 62 $u_name = !empty($_POST['u_name']) ? $_POST['u_name'] : null; 63 $u_login = !empty($_POST['u_login']) ? $_POST['u_login'] : null; 64 $u_pwd = !empty($_POST['u_pwd']) ? $_POST['u_pwd'] : null; 65 $u_pwd2 = !empty($_POST['u_pwd2']) ? $_POST['u_pwd2'] : null; 66 67 try 68 { 69 # Check user information 70 if (empty($u_login)) { 71 throw new Exception(__('No user ID given')); 72 } 73 if (!preg_match('/^[A-Za-z0-9@._-]{2,}$/',$u_login)) { 74 throw new Exception(__('User ID must contain at least 2 characters using letters, numbers or symbols.')); 75 } 76 if ($u_email && !text::isEmail($u_email)) { 77 throw new Exception(__('Invalid email address')); 78 } 79 80 if (empty($u_pwd)) { 81 throw new Exception(__('No password given')); 82 } 83 if ($u_pwd != $u_pwd2) { 84 throw new Exception(__("Passwords don't match")); 85 } 86 if (strlen($u_pwd) < 6) { 87 throw new Exception(__('Password must contain at least 6 characters.')); 88 } 89 90 # Try to guess timezone 91 $default_tz = 'Europe/London'; 92 if (!empty($_POST['u_date']) && function_exists('timezone_open')) 93 { 94 if (preg_match('/\((.+)\)$/',$_POST['u_date'],$_tz)) { 95 $_tz = $_tz[1]; 96 $_tz = @timezone_open($_tz); 97 if ($_tz instanceof DateTimeZone) { 98 $_tz = @timezone_name_get($_tz); 99 100 // check if timezone is valid 101 // date_default_timezone_set throw E_NOTICE and/or E_WARNING if timezone is not valid and return false 102 if (@date_default_timezone_set($_tz)!==false && $_tz) { 103 $default_tz = $_tz; 104 } 105 } 106 unset($_tz); 107 } 108 } 109 110 # Create schema 111 $_s = new dbStruct($core->con,$core->prefix); 112 require dirname(__FILE__).'/../../inc/dbschema/db-schema.php'; 113 114 $si = new dbStruct($core->con,$core->prefix); 115 $changes = $si->synchronize($_s); 116 117 # Create user 118 $cur = $core->con->openCursor($core->prefix.'user'); 119 $cur->user_id = $u_login; 120 $cur->user_super = 1; 121 $cur->user_pwd = $core->auth->crypt($u_pwd); 122 $cur->user_name = (string) $u_name; 123 $cur->user_firstname = (string) $u_firstname; 124 $cur->user_email = (string) $u_email; 125 $cur->user_lang = $dlang; 126 $cur->user_tz = $default_tz; 127 $cur->user_creadt = date('Y-m-d H:i:s'); 128 $cur->user_upddt = date('Y-m-d H:i:s'); 129 $cur->user_options = serialize($core->userDefaults()); 130 $cur->insert(); 131 132 $core->auth->checkUser($u_login); 133 134 $admin_url = preg_replace('%install/index.php$%','',$_SERVER['REQUEST_URI']); 135 $root_url = preg_replace('%/admin/install/index.php$%','',$_SERVER['REQUEST_URI']); 136 137 # Create blog 138 $cur = $core->con->openCursor($core->prefix.'blog'); 139 $cur->blog_id = 'default'; 140 $cur->blog_url = http::getHost().$root_url.'/index.php?'; 141 $cur->blog_name = __('My first blog'); 142 $core->addBlog($cur); 143 $core->blogDefaults($cur->blog_id); 144 145 $blog_settings = new dcSettings($core,'default'); 146 $blog_settings->addNamespace('system'); 147 $blog_settings->system->put('blog_timezone',$default_tz); 148 $blog_settings->system->put('lang',$dlang); 149 $blog_settings->system->put('public_url',$root_url.'/public'); 150 $blog_settings->system->put('themes_url',$root_url.'/themes'); 151 152 # date and time formats 153 $formatDate = __('%A, %B %e %Y'); 154 $date_formats = array('%Y-%m-%d','%m/%d/%Y','%d/%m/%Y','%Y/%m/%d','%d.%m.%Y','%b %e %Y','%e %b %Y','%Y %b %e', 155 '%a, %Y-%m-%d','%a, %m/%d/%Y','%a, %d/%m/%Y','%a, %Y/%m/%d','%B %e, %Y','%e %B, %Y','%Y, %B %e','%e. %B %Y', 156 '%A, %B %e, %Y','%A, %e %B, %Y','%A, %Y, %B %e','%A, %Y, %B %e','%A, %e. %B %Y'); 157 $time_formats = array('%H:%M','%I:%M','%l:%M','%Hh%M','%Ih%M','%lh%M'); 158 if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { 159 $formatDate = preg_replace('#(?<!%)((?:%%)*)%e#','\1%#d',$formatDate); 160 $date_formats = array_map(create_function('$f', 161 'return str_replace(\'%e\',\'%#d\',$f);' 162 ),$date_formats); 163 } 164 $blog_settings->system->put('date_format',$formatDate); 165 $blog_settings->system->put('date_formats',$date_formats,'array','Date formats examples',true,true); 166 $blog_settings->system->put('time_formats',$time_formats,'array','Time formats examples',true,true); 167 168 # Add repository URL for themes and plugins 169 $blog_settings->system->put('store_plugin_url','http://update.dotaddict.org/dc2/plugins.xml','string','Plugins XML feed location',true,true); 170 $blog_settings->system->put('store_theme_url','http://update.dotaddict.org/dc2/themes.xml','string','Themes XML feed location',true,true); 171 172 # CSP directive (admin part) 173 174 // SQlite Clearbricks driver does not allow using single quote at beginning or end of a field value 175 // so we have to use neutral values (localhost and 127.0.0.1) for some CSP directives 176 $csp_prefix = $core->con->driver() == 'sqlite' ? 'localhost ' : ''; // Hack for SQlite Clearbricks driver 177 $csp_suffix = $core->con->driver() == 'sqlite' ? ' 127.0.0.1' : ''; // Hack for SQlite Clearbricks driver 178 179 $blog_settings->system->put('csp_admin_on',true,'boolean','Send CSP header (admin)',true,true); 180 $blog_settings->system->put('csp_admin_report_only',false,'boolean','CSP Report only violations (admin)',true,true); 181 $blog_settings->system->put('csp_admin_default', 182 $csp_prefix."'self'".$csp_suffix,'string','CSP default-src directive',true,true); 183 $blog_settings->system->put('csp_admin_script', 184 $csp_prefix."'self' 'unsafe-inline' 'unsafe-eval'".$csp_suffix,'string','CSP script-src directive',true,true); 185 $blog_settings->system->put('csp_admin_style', 186 $csp_prefix."'self' 'unsafe-inline'".$csp_suffix,'string','CSP style-src directive',true,true); 187 $blog_settings->system->put('csp_admin_img', 188 $csp_prefix."'self' data: http://media.dotaddict.org blob:",'string','CSP img-src directive',true,true); 189 190 # Add Dotclear version 191 $cur = $core->con->openCursor($core->prefix.'version'); 192 $cur->module = 'core'; 193 $cur->version = (string) DC_VERSION; 194 $cur->insert(); 195 196 # Create first post 197 $core->setBlog('default'); 198 199 $cur = $core->con->openCursor($core->prefix.'post'); 200 $cur->user_id = $u_login; 201 $cur->post_format = 'xhtml'; 202 $cur->post_lang = $dlang; 203 $cur->post_title = __('Welcome to Dotclear!'); 204 $cur->post_content = '<p>'.__('This is your first entry. When you\'re ready '. 205 'to blog, log in to edit or delete it.').'</p>'; 206 $cur->post_content_xhtml = $cur->post_content; 207 $cur->post_status = 1; 208 $cur->post_open_comment = 1; 209 $cur->post_open_tb = 0; 210 $post_id = $core->blog->addPost($cur); 211 212 # Add a comment to it 213 $cur = $core->con->openCursor($core->prefix.'comment'); 214 $cur->post_id = $post_id; 215 $cur->comment_tz = $default_tz; 216 $cur->comment_author = __('Dotclear Team'); 217 $cur->comment_email = 'contact@dotclear.net'; 218 $cur->comment_site = 'http://www.dotclear.org/'; 219 $cur->comment_content = __("<p>This is a comment.</p>\n<p>To delete it, log in and ". 220 "view your blog's comments. Then you might remove or edit it.</p>"); 221 $core->blog->addComment($cur); 222 223 # Plugins initialization 224 define('DC_CONTEXT_ADMIN',true); 225 $core->plugins->loadModules(DC_PLUGINS_ROOT); 226 $plugins_install = $core->plugins->installModules(); 227 228 # Add dashboard module options 229 $core->auth->user_prefs->addWorkspace('dashboard'); 230 $core->auth->user_prefs->dashboard->put('doclinks',true,'boolean','',null,true); 231 $core->auth->user_prefs->dashboard->put('dcnews',true,'boolean','',null,true); 232 $core->auth->user_prefs->dashboard->put('quickentry',true,'boolean','',null,true); 233 $core->auth->user_prefs->dashboard->put('nodcupdate',false,'boolean','',null,true); 234 235 # Add accessibility options 236 $core->auth->user_prefs->addWorkspace('accessibility'); 237 $core->auth->user_prefs->accessibility->put('nodragdrop',false,'boolean','',null,true); 238 239 # Add user interface options 240 $core->auth->user_prefs->addWorkspace('interface'); 241 $core->auth->user_prefs->interface->put('enhanceduploader',true,'boolean','',null,true); 242 243 # Add default favorites 244 $core->favs = new dcFavorites($core); 245 $init_favs = array('posts','new_post','newpage','comments','categories','media','blog_theme','widgets','simpleMenu','prefs','help'); 246 $core->favs->setFavoriteIDs($init_favs,true); 247 248 $step = 1; 249 } 250 catch (Exception $e) 251 { 252 $err = $e->getMessage(); 253 } 57 if ($can_install && !empty($_POST)) { 58 $u_email = !empty($_POST['u_email']) ? $_POST['u_email'] : null; 59 $u_firstname = !empty($_POST['u_firstname']) ? $_POST['u_firstname'] : null; 60 $u_name = !empty($_POST['u_name']) ? $_POST['u_name'] : null; 61 $u_login = !empty($_POST['u_login']) ? $_POST['u_login'] : null; 62 $u_pwd = !empty($_POST['u_pwd']) ? $_POST['u_pwd'] : null; 63 $u_pwd2 = !empty($_POST['u_pwd2']) ? $_POST['u_pwd2'] : null; 64 65 try 66 { 67 # Check user information 68 if (empty($u_login)) { 69 throw new Exception(__('No user ID given')); 70 } 71 if (!preg_match('/^[A-Za-z0-9@._-]{2,}$/', $u_login)) { 72 throw new Exception(__('User ID must contain at least 2 characters using letters, numbers or symbols.')); 73 } 74 if ($u_email && !text::isEmail($u_email)) { 75 throw new Exception(__('Invalid email address')); 76 } 77 78 if (empty($u_pwd)) { 79 throw new Exception(__('No password given')); 80 } 81 if ($u_pwd != $u_pwd2) { 82 throw new Exception(__("Passwords don't match")); 83 } 84 if (strlen($u_pwd) < 6) { 85 throw new Exception(__('Password must contain at least 6 characters.')); 86 } 87 88 # Try to guess timezone 89 $default_tz = 'Europe/London'; 90 if (!empty($_POST['u_date']) && function_exists('timezone_open')) { 91 if (preg_match('/\((.+)\)$/', $_POST['u_date'], $_tz)) { 92 $_tz = $_tz[1]; 93 $_tz = @timezone_open($_tz); 94 if ($_tz instanceof DateTimeZone) { 95 $_tz = @timezone_name_get($_tz); 96 97 // check if timezone is valid 98 // date_default_timezone_set throw E_NOTICE and/or E_WARNING if timezone is not valid and return false 99 if (@date_default_timezone_set($_tz) !== false && $_tz) { 100 $default_tz = $_tz; 101 } 102 } 103 unset($_tz); 104 } 105 } 106 107 # Create schema 108 $_s = new dbStruct($core->con, $core->prefix); 109 require dirname(__FILE__) . '/../../inc/dbschema/db-schema.php'; 110 111 $si = new dbStruct($core->con, $core->prefix); 112 $changes = $si->synchronize($_s); 113 114 # Create user 115 $cur = $core->con->openCursor($core->prefix . 'user'); 116 $cur->user_id = $u_login; 117 $cur->user_super = 1; 118 $cur->user_pwd = $core->auth->crypt($u_pwd); 119 $cur->user_name = (string) $u_name; 120 $cur->user_firstname = (string) $u_firstname; 121 $cur->user_email = (string) $u_email; 122 $cur->user_lang = $dlang; 123 $cur->user_tz = $default_tz; 124 $cur->user_creadt = date('Y-m-d H:i:s'); 125 $cur->user_upddt = date('Y-m-d H:i:s'); 126 $cur->user_options = serialize($core->userDefaults()); 127 $cur->insert(); 128 129 $core->auth->checkUser($u_login); 130 131 $admin_url = preg_replace('%install/index.php$%', '', $_SERVER['REQUEST_URI']); 132 $root_url = preg_replace('%/admin/install/index.php$%', '', $_SERVER['REQUEST_URI']); 133 134 # Create blog 135 $cur = $core->con->openCursor($core->prefix . 'blog'); 136 $cur->blog_id = 'default'; 137 $cur->blog_url = http::getHost() . $root_url . '/index.php?'; 138 $cur->blog_name = __('My first blog'); 139 $core->addBlog($cur); 140 $core->blogDefaults($cur->blog_id); 141 142 $blog_settings = new dcSettings($core, 'default'); 143 $blog_settings->addNamespace('system'); 144 $blog_settings->system->put('blog_timezone', $default_tz); 145 $blog_settings->system->put('lang', $dlang); 146 $blog_settings->system->put('public_url', $root_url . '/public'); 147 $blog_settings->system->put('themes_url', $root_url . '/themes'); 148 149 # date and time formats 150 $formatDate = __('%A, %B %e %Y'); 151 $date_formats = array('%Y-%m-%d', '%m/%d/%Y', '%d/%m/%Y', '%Y/%m/%d', '%d.%m.%Y', '%b %e %Y', '%e %b %Y', '%Y %b %e', 152 '%a, %Y-%m-%d', '%a, %m/%d/%Y', '%a, %d/%m/%Y', '%a, %Y/%m/%d', '%B %e, %Y', '%e %B, %Y', '%Y, %B %e', '%e. %B %Y', 153 '%A, %B %e, %Y', '%A, %e %B, %Y', '%A, %Y, %B %e', '%A, %Y, %B %e', '%A, %e. %B %Y'); 154 $time_formats = array('%H:%M', '%I:%M', '%l:%M', '%Hh%M', '%Ih%M', '%lh%M'); 155 if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { 156 $formatDate = preg_replace('#(?<!%)((?:%%)*)%e#', '\1%#d', $formatDate); 157 $date_formats = array_map( 158 function ($f) { 159 return str_replace('%e', '%#d', $f); 160 }, 161 $date_formats); 162 } 163 $blog_settings->system->put('date_format', $formatDate); 164 $blog_settings->system->put('date_formats', $date_formats, 'array', 'Date formats examples', true, true); 165 $blog_settings->system->put('time_formats', $time_formats, 'array', 'Time formats examples', true, true); 166 167 # Add repository URL for themes and plugins 168 $blog_settings->system->put('store_plugin_url', 'http://update.dotaddict.org/dc2/plugins.xml', 'string', 'Plugins XML feed location', true, true); 169 $blog_settings->system->put('store_theme_url', 'http://update.dotaddict.org/dc2/themes.xml', 'string', 'Themes XML feed location', true, true); 170 171 # CSP directive (admin part) 172 173 /* SQlite Clearbricks driver does not allow using single quote at beginning or end of a field value 174 so we have to use neutral values (localhost and 127.0.0.1) for some CSP directives 175 */ 176 $csp_prefix = $core->con->driver() == 'sqlite' ? 'localhost ' : ''; // Hack for SQlite Clearbricks driver 177 $csp_suffix = $core->con->driver() == 'sqlite' ? ' 127.0.0.1' : ''; // Hack for SQlite Clearbricks driver 178 179 $blog_settings->system->put('csp_admin_on', true, 'boolean', 'Send CSP header (admin)', true, true); 180 $blog_settings->system->put('csp_admin_report_only', false, 'boolean', 'CSP Report only violations (admin)', true, true); 181 $blog_settings->system->put('csp_admin_default', 182 $csp_prefix . "'self'" . $csp_suffix, 'string', 'CSP default-src directive', true, true); 183 $blog_settings->system->put('csp_admin_script', 184 $csp_prefix . "'self' 'unsafe-inline' 'unsafe-eval'" . $csp_suffix, 'string', 'CSP script-src directive', true, true); 185 $blog_settings->system->put('csp_admin_style', 186 $csp_prefix . "'self' 'unsafe-inline'" . $csp_suffix, 'string', 'CSP style-src directive', true, true); 187 $blog_settings->system->put('csp_admin_img', 188 $csp_prefix . "'self' data: http://media.dotaddict.org blob:", 'string', 'CSP img-src directive', true, true); 189 190 # Add Dotclear version 191 $cur = $core->con->openCursor($core->prefix . 'version'); 192 $cur->module = 'core'; 193 $cur->version = (string) DC_VERSION; 194 $cur->insert(); 195 196 # Create first post 197 $core->setBlog('default'); 198 199 $cur = $core->con->openCursor($core->prefix . 'post'); 200 $cur->user_id = $u_login; 201 $cur->post_format = 'xhtml'; 202 $cur->post_lang = $dlang; 203 $cur->post_title = __('Welcome to Dotclear!'); 204 $cur->post_content = '<p>' . __('This is your first entry. When you\'re ready ' . 205 'to blog, log in to edit or delete it.') . '</p>'; 206 $cur->post_content_xhtml = $cur->post_content; 207 $cur->post_status = 1; 208 $cur->post_open_comment = 1; 209 $cur->post_open_tb = 0; 210 $post_id = $core->blog->addPost($cur); 211 212 # Add a comment to it 213 $cur = $core->con->openCursor($core->prefix . 'comment'); 214 $cur->post_id = $post_id; 215 $cur->comment_tz = $default_tz; 216 $cur->comment_author = __('Dotclear Team'); 217 $cur->comment_email = 'contact@dotclear.net'; 218 $cur->comment_site = 'http://www.dotclear.org/'; 219 $cur->comment_content = __("<p>This is a comment.</p>\n<p>To delete it, log in and " . 220 "view your blog's comments. Then you might remove or edit it.</p>"); 221 $core->blog->addComment($cur); 222 223 # Plugins initialization 224 define('DC_CONTEXT_ADMIN', true); 225 $core->plugins->loadModules(DC_PLUGINS_ROOT); 226 $plugins_install = $core->plugins->installModules(); 227 228 # Add dashboard module options 229 $core->auth->user_prefs->addWorkspace('dashboard'); 230 $core->auth->user_prefs->dashboard->put('doclinks', true, 'boolean', '', null, true); 231 $core->auth->user_prefs->dashboard->put('dcnews', true, 'boolean', '', null, true); 232 $core->auth->user_prefs->dashboard->put('quickentry', true, 'boolean', '', null, true); 233 $core->auth->user_prefs->dashboard->put('nodcupdate', false, 'boolean', '', null, true); 234 235 # Add accessibility options 236 $core->auth->user_prefs->addWorkspace('accessibility'); 237 $core->auth->user_prefs->accessibility->put('nodragdrop', false, 'boolean', '', null, true); 238 239 # Add user interface options 240 $core->auth->user_prefs->addWorkspace('interface'); 241 $core->auth->user_prefs->interface->put('enhanceduploader', true, 'boolean', '', null, true); 242 243 # Add default favorites 244 $core->favs = new dcFavorites($core); 245 $init_favs = array('posts', 'new_post', 'newpage', 'comments', 'categories', 'media', 'blog_theme', 'widgets', 'simpleMenu', 'prefs', 'help'); 246 $core->favs->setFavoriteIDs($init_favs, true); 247 248 $step = 1; 249 } catch (Exception $e) { 250 $err = $e->getMessage(); 251 } 254 252 } 255 253 256 254 if (!isset($step)) { 257 255 $step = 0; 258 256 } 259 257 header('Content-Type: text/html; charset=UTF-8'); … … 274 272 <title><?php echo __('Dotclear Install'); ?></title> 275 273 276 274 <link rel="stylesheet" href="../style/install.css" type="text/css" media="screen" /> 277 275 278 276 <script type="text/javascript" src="../js/jquery/jquery.js"></script> 279 277 <?php echo dcPage::jsLoad('../js/jquery/jquery.pwstrength.js'); ?> 280 278 <script type="text/javascript"> 281 282 283 284 285 286 287 288 289 290 291 <?php echo "\$('#u_pwd').pwstrength({texts: ['".292 sprintf(__('Password strength: %s'),__('very weak'))."', '".293 sprintf(__('Password strength: %s'),__('weak'))."', '".294 sprintf(__('Password strength: %s'),__('mediocre'))."', '".295 sprintf(__('Password strength: %s'),__('strong'))."', '".296 sprintf(__('Password strength: %s'),__('very strong'))."']});\n"; ?>297 298 299 300 var password_link = $('<a href="#" id="obfus"><?php echo(__('show')); ?></a>').click(function() {301 302 303 304 305 306 279 $(function() { 280 var login_re = new RegExp('[^A-Za-z0-9@._-]+','g'); 281 $('#u_firstname').keyup(function() { 282 var login = this.value.toLowerCase().replace(login_re,'').substring(0,32); 283 $('#u_login').val(login); 284 }); 285 $('#u_login').keyup(function() { 286 $(this).val(this.value.replace(login_re,'')); 287 }); 288 289 <?php echo "\$('#u_pwd').pwstrength({texts: ['" . 290 sprintf(__('Password strength: %s'), __('very weak')) . "', '" . 291 sprintf(__('Password strength: %s'), __('weak')) . "', '" . 292 sprintf(__('Password strength: %s'), __('mediocre')) . "', '" . 293 sprintf(__('Password strength: %s'), __('strong')) . "', '" . 294 sprintf(__('Password strength: %s'), __('very strong')) . "']});\n"; ?> 295 296 $('#u_login').parent().after($('<input type="hidden" name="u_date" value="' + Date().toLocaleString() + '" />')); 297 298 var password_link = $('<a href="#" id="obfus"><?php echo (__('show')); ?></a>').click(function() { 299 $('#password').show(); 300 $(this).remove(); 301 return false; 302 }); 303 $('#password').hide().before(password_link); 304 }); 307 305 </script> 308 306 </head> … … 312 310 <?php 313 311 echo 314 '<h1>' .__('Dotclear installation').'</h1>'.315 '<div id="main">';312 '<h1>' . __('Dotclear installation') . '</h1>' . 313 '<div id="main">'; 316 314 317 315 if (!is_writable(DC_TPL_CACHE)) { 318 echo '<div class="error" role="alert"><p>'.sprintf(__('Cache directory %s is not writable.'),DC_TPL_CACHE).'</p></div>';316 echo '<div class="error" role="alert"><p>' . sprintf(__('Cache directory %s is not writable.'), DC_TPL_CACHE) . '</p></div>'; 319 317 } 320 318 321 319 if ($can_install && !empty($err)) { 322 echo '<div class="error" role="alert"><p><strong>'.__('Errors:').'</strong></p>'.$err.'</div>';320 echo '<div class="error" role="alert"><p><strong>' . __('Errors:') . '</strong></p>' . $err . '</div>'; 323 321 } 324 322 325 323 if (!empty($_GET['wiz'])) { 326 echo '<p class="success" role="alert">'.__('Configuration file has been successfully created.').'</p>'; 327 } 328 329 if ($can_install && $step == 0) 330 { 331 echo 332 '<h2>'.__('User information').'</h2>'. 333 334 '<p>'.__('Please provide the following information needed to create the first user.').'</p>'. 335 336 '<form action="index.php" method="post">'. 337 '<fieldset><legend>'.__('User information').'</legend>'. 338 '<p><label for="u_firstname">'.__('First Name:').'</label> '. 339 form::field('u_firstname',30,255,html::escapeHTML($u_firstname)).'</p>'. 340 '<p><label for="u_name">'.__('Last Name:').'</label> '. 341 form::field('u_name',30,255,html::escapeHTML($u_name)).'</p>'. 342 '<p><label for="u_email">'.__('Email:').'</label> '. 343 form::field('u_email',30,255,html::escapeHTML($u_email)).'</p>'. 344 '</fieldset>'. 345 346 '<fieldset><legend>'.__('Username and password').'</legend>'. 347 '<p><label for="u_login" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Username:').' '. 348 form::field('u_login',30,32,html::escapeHTML($u_login),'','',false,'required placeholder="'.__('Username').'"').'</label></p>'. 349 '<div class="pw-table">'. 350 '<p class="pw-cell">'. 351 '<label for="u_pwd" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('New password:').'</label>'. 352 form::password('u_pwd',30,255,'','','',false,' data-indicator="pwindicator" required placeholder="'.__('Password').'"'). 353 '</p>'. 354 '<div id="pwindicator">'. 355 ' <div class="bar"></div>'. 356 ' <p class="label no-margin"></p>'. 357 '</div>'. 358 '</div>'. 359 '<p><label for="u_pwd2" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Confirm password:').' '. 360 form::password('u_pwd2',30,255,'','','',false,'required placeholder="'.__('Password').'"').'</label></p>'. 361 '</fieldset>'. 362 363 '<p><input type="submit" value="'.__('Save').'" /></p>'. 364 '</form>'; 365 } 366 elseif ($can_install && $step == 1) 367 { 368 # Plugins install messages 369 $plugins_install_result = ''; 370 if (!empty($plugins_install['success'])) 371 { 372 $plugins_install_result .= '<div class="static-msg">'.__('Following plugins have been installed:').'<ul>'; 373 foreach ($plugins_install['success'] as $k => $v) { 374 $plugins_install_result .= '<li>'.$k.'</li>'; 375 } 376 $plugins_install_result .= '</ul></div>'; 377 } 378 if (!empty($plugins_install['failure'])) 379 { 380 $plugins_install_result .= '<div class="error">'.__('Following plugins have not been installed:').'<ul>'; 381 foreach ($plugins_install['failure'] as $k => $v) { 382 $plugins_install_result .= '<li>'.$k.' ('.$v.')</li>'; 383 } 384 $plugins_install_result .= '</ul></div>'; 385 } 386 387 echo 388 '<h2>'.__('All done!').'</h2>'. 389 390 $plugins_install_result. 391 392 '<p class="success" role="alert">'.__('Dotclear has been successfully installed. Here is some useful information you should keep.').'</p>'. 393 394 '<h3>'.__('Your account').'</h3>'. 395 '<ul>'. 396 '<li>'.__('Username:').' <strong>'.html::escapeHTML($u_login).'</strong></li>'. 397 '<li>'.__('Password:').' <strong id="password">'.html::escapeHTML($u_pwd).'</strong></li>'. 398 '</ul>'. 399 400 '<h3>'.__('Your blog').'</h3>'. 401 '<ul>'. 402 '<li>'.__('Blog address:').' <strong>'.html::escapeHTML(http::getHost().$root_url).'/index.php?</strong></li>'. 403 '<li>'.__('Administration interface:').' <strong>'.html::escapeHTML(http::getHost().$admin_url).'</strong></li>'. 404 '</ul>'. 405 406 '<form action="../auth.php" method="post">'. 407 '<p><input type="submit" value="'.__('Manage your blog now').'" />'. 408 form::hidden(array('user_id'),html::escapeHTML($u_login)). 409 form::hidden(array('user_pwd'),html::escapeHTML($u_pwd)). 410 '</p>'. 411 '</form>'; 412 } 413 elseif (!$can_install) 414 { 415 echo '<h2>'.__('Installation can not be completed').'</h2>'. 416 '<div class="error" role="alert"><p><strong>'.__('Errors:').'</strong></p>'.$err.'</div>'. 417 '<p>'.__('For the said reasons, Dotclear can not be installed. '. 418 'Please refer to <a href="http://dotclear.org/documentation/2.0/admin/install">'. 419 'the documentation</a> to learn how to correct the problem.').'</p>'; 324 echo '<p class="success" role="alert">' . __('Configuration file has been successfully created.') . '</p>'; 325 } 326 327 if ($can_install && $step == 0) { 328 echo 329 '<h2>' . __('User information') . '</h2>' . 330 331 '<p>' . __('Please provide the following information needed to create the first user.') . '</p>' . 332 333 '<form action="index.php" method="post">' . 334 '<fieldset><legend>' . __('User information') . '</legend>' . 335 '<p><label for="u_firstname">' . __('First Name:') . '</label> ' . 336 form::field('u_firstname', 30, 255, html::escapeHTML($u_firstname)) . '</p>' . 337 '<p><label for="u_name">' . __('Last Name:') . '</label> ' . 338 form::field('u_name', 30, 255, html::escapeHTML($u_name)) . '</p>' . 339 '<p><label for="u_email">' . __('Email:') . '</label> ' . 340 form::field('u_email', 30, 255, html::escapeHTML($u_email)) . '</p>' . 341 '</fieldset>' . 342 343 '<fieldset><legend>' . __('Username and password') . '</legend>' . 344 '<p><label for="u_login" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Username:') . ' ' . 345 form::field('u_login', 30, 32, html::escapeHTML($u_login), '', '', false, 'required placeholder="' . __('Username') . '"') . '</label></p>' . 346 '<div class="pw-table">' . 347 '<p class="pw-cell">' . 348 '<label for="u_pwd" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('New password:') . '</label>' . 349 form::password('u_pwd', 30, 255, '', '', '', false, ' data-indicator="pwindicator" required placeholder="' . __('Password') . '"') . 350 '</p>' . 351 '<div id="pwindicator">' . 352 ' <div class="bar"></div>' . 353 ' <p class="label no-margin"></p>' . 354 '</div>' . 355 '</div>' . 356 '<p><label for="u_pwd2" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Confirm password:') . ' ' . 357 form::password('u_pwd2', 30, 255, '', '', '', false, 'required placeholder="' . __('Password') . '"') . '</label></p>' . 358 '</fieldset>' . 359 360 '<p><input type="submit" value="' . __('Save') . '" /></p>' . 361 '</form>'; 362 } elseif ($can_install && $step == 1) { 363 # Plugins install messages 364 $plugins_install_result = ''; 365 if (!empty($plugins_install['success'])) { 366 $plugins_install_result .= '<div class="static-msg">' . __('Following plugins have been installed:') . '<ul>'; 367 foreach ($plugins_install['success'] as $k => $v) { 368 $plugins_install_result .= '<li>' . $k . '</li>'; 369 } 370 $plugins_install_result .= '</ul></div>'; 371 } 372 if (!empty($plugins_install['failure'])) { 373 $plugins_install_result .= '<div class="error">' . __('Following plugins have not been installed:') . '<ul>'; 374 foreach ($plugins_install['failure'] as $k => $v) { 375 $plugins_install_result .= '<li>' . $k . ' (' . $v . ')</li>'; 376 } 377 $plugins_install_result .= '</ul></div>'; 378 } 379 380 echo 381 '<h2>' . __('All done!') . '</h2>' . 382 383 $plugins_install_result . 384 385 '<p class="success" role="alert">' . __('Dotclear has been successfully installed. Here is some useful information you should keep.') . '</p>' . 386 387 '<h3>' . __('Your account') . '</h3>' . 388 '<ul>' . 389 '<li>' . __('Username:') . ' <strong>' . html::escapeHTML($u_login) . '</strong></li>' . 390 '<li>' . __('Password:') . ' <strong id="password">' . html::escapeHTML($u_pwd) . '</strong></li>' . 391 '</ul>' . 392 393 '<h3>' . __('Your blog') . '</h3>' . 394 '<ul>' . 395 '<li>' . __('Blog address:') . ' <strong>' . html::escapeHTML(http::getHost() . $root_url) . '/index.php?</strong></li>' . 396 '<li>' . __('Administration interface:') . ' <strong>' . html::escapeHTML(http::getHost() . $admin_url) . '</strong></li>' . 397 '</ul>' . 398 399 '<form action="../auth.php" method="post">' . 400 '<p><input type="submit" value="' . __('Manage your blog now') . '" />' . 401 form::hidden(array('user_id'), html::escapeHTML($u_login)) . 402 form::hidden(array('user_pwd'), html::escapeHTML($u_pwd)) . 403 '</p>' . 404 '</form>'; 405 } elseif (!$can_install) { 406 echo '<h2>' . __('Installation can not be completed') . '</h2>' . 407 '<div class="error" role="alert"><p><strong>' . __('Errors:') . '</strong></p>' . $err . '</div>' . 408 '<p>' . __('For the said reasons, Dotclear can not be installed. ' . 409 'Please refer to <a href="http://dotclear.org/documentation/2.0/admin/install">' . 410 'the documentation</a> to learn how to correct the problem.') . '</p>'; 420 411 } 421 412 ?>
Note: See TracChangeset
for help on using the changeset viewer.