diff --git a/include/admin/installer.inc.php b/include/admin/installer.inc.php index 0bda035c..81631657 100644 --- a/include/admin/installer.inc.php +++ b/include/admin/installer.inc.php @@ -1,6 +1,4 @@ '. $s .''; } if ( $result === S9Y_I_WARNING ) { + $data['i_warning'] = true; return ''. $s .' [?]'; } if ( $result === S9Y_I_ERROR ) { $errorCount++; + $data['i_error'] = true; return ''. $s .' [!]'; } } @@ -56,7 +61,7 @@ if (!empty($serendipity['POST']['getstep']) && is_numeric($serendipity['POST'][' } /* From configuration to install */ -if ( sizeof($_POST) > 1 && $serendipity['GET']['step'] == 3 ) { +if ( sizeof($_POST) > 1 && (int)$serendipity['GET']['step'] == 3 ) { /* One problem, if the user chose to do an easy install, not all config vars has been transfered Therefore we fetch all config vars with their default values, and merge them with our POST data */ @@ -70,9 +75,7 @@ if ( sizeof($_POST) > 1 && $serendipity['GET']['step'] == 3 ) { } if ( is_array($errors = serendipity_checkInstallation()) ) { - foreach ( $errors as $error ) { - echo '
'. $error .'
'; - } + $data['errors'] = $errors; $from = $_POST; /* Back to configuration, user did something wrong */ @@ -83,451 +86,266 @@ if ( sizeof($_POST) > 1 && $serendipity['GET']['step'] == 3 ) { } } +$data['s9yGETstep'] = $serendipity['GET']['step']; + if ( (int)$serendipity['GET']['step'] == 0 ) { -?> -. -
. -
. -
-
-
- -

+ $data['getstepint0'] = true; + $data['print_ERRORS_ARE_DISPLAYED_IN'] = sprintf(ERRORS_ARE_DISPLAYED_IN, serendipity_installerResultDiagnose(S9Y_I_ERROR, RED), serendipity_installerResultDiagnose(S9Y_I_WARNING, YELLOW), serendipity_installerResultDiagnose(S9Y_I_SUCCESS, GREEN)); + $data['s9yversion'] = $serendipity['version']; - - -
- - - - - - - - - - $sum) { -?> - - - - $sum) { + $data['installerResultDiagnose_CHECKSUMS'][] = serendipity_installerResultDiagnose(S9Y_I_WARNING, sprintf(CHECKSUM_FAILED, $file)); + } + } + } else { + $data['installerResultDiagnose_CHECKSUMS'][] = serendipity_installerResultDiagnose(S9Y_I_WARNING, CHECKSUMS_NOT_FOUND); } -} else { ?> - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PHP version >= 5.2.6=') ) { - echo serendipity_installerResultDiagnose(S9Y_I_SUCCESS, YES .', '. phpversion()); - } else { - echo serendipity_installerResultDiagnose(S9Y_I_ERROR, NO); - } - ?>
Database extensions
Session extension
PCRE extension
GDlib extension
OpenSSL extension
mbstring extension
iconv extension
zlib extension
Imagemagick binary
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + $data['php_uname'] = php_uname('s') .' '. php_uname('r') .', '. php_uname('m'); + $data['php_sapi_name'] = php_sapi_name(); -
 
safe_mode
register_globals
magic_quotes_gpc
magic_quotes_runtime
session.use_trans_sid
allow_url_fopen
file_uploads
post_max_size10M= (10*1024*1024) ) { - echo serendipity_installerResultDiagnose(S9Y_I_SUCCESS, ini_get('post_max_size')); - } else { - echo serendipity_installerResultDiagnose(S9Y_I_WARNING, ini_get('post_max_size')); - } - ?>
upload_max_filesize10M= (10*1024*1024) ) { - echo serendipity_installerResultDiagnose(S9Y_I_SUCCESS, ini_get('upload_max_filesize')); - } else { - echo serendipity_installerResultDiagnose(S9Y_I_WARNING, ini_get('upload_max_filesize')); - } - ?>
memory_limit= ((PHP_INT_SIZE == 4 ? 8 : 16)*1024*1024) ) { - echo serendipity_installerResultDiagnose(S9Y_I_SUCCESS, ini_get('memory_limit')); - } else { - echo serendipity_installerResultDiagnose(S9Y_I_WARNING, ini_get('memory_limit')); - } - ?>
+ if ( version_compare(phpversion(), '5.2.6', '>=') ) { + $data['installerResultDiagnose_VERSION'] = serendipity_installerResultDiagnose(S9Y_I_SUCCESS, YES .', '. phpversion()); + } else { + $data['installerResultDiagnose_VERSION'] = serendipity_installerResultDiagnose(S9Y_I_ERROR, NO); + } -
- - - - - - - - - - - - - - - - - - - - + if ( sizeof(($_res = serendipity_probeInstallation('dbType'))) == 0 ) { + $data['installerResultDiagnose_DBTYPE'] = serendipity_installerResultDiagnose(S9Y_I_ERROR, NONE); + } else { + $data['installerResultDiagnose_DBTYPE'] = serendipity_installerResultDiagnose(S9Y_I_SUCCESS, implode(', ', $_res)); + } - - - - - - - - - - - - -
= (10*1024*1024) ) { + $data['installerResultDiagnose_SPMS'] = serendipity_installerResultDiagnose(S9Y_I_SUCCESS, ini_get('post_max_size')); + } else { + $data['installerResultDiagnose_SPMS'] = serendipity_installerResultDiagnose(S9Y_I_WARNING, ini_get('post_max_size')); + } + + if ( serendipity_ini_bytesize(ini_get('upload_max_filesize')) >= (10*1024*1024) ) { + $data['installerResultDiagnose_SUMF'] = serendipity_installerResultDiagnose(S9Y_I_SUCCESS, ini_get('upload_max_filesize')); + } else { + $data['installerResultDiagnose_SUMF'] = serendipity_installerResultDiagnose(S9Y_I_WARNING, ini_get('upload_max_filesize')); + } + + if ( serendipity_ini_bytesize(ini_get('memory_limit')) >= ((PHP_INT_SIZE == 4 ? 8 : 16)*1024*1024) ) { + $data['installerResultDiagnose_SML'] = serendipity_installerResultDiagnose(S9Y_I_SUCCESS, ini_get('memory_limit')); + } else { + $data['installerResultDiagnose_SML'] = serendipity_installerResultDiagnose(S9Y_I_WARNING, ini_get('memory_limit')); + } + + $basewritable = False; + if ( is_writable($basedir) ) { + $data['installerResultDiagnose_WRITABLE'][] = serendipity_installerResultDiagnose(S9Y_I_SUCCESS, WRITABLE); + $basewritable = True; + } else { + #Figure out if we already have all we need + #PATH_SMARTY_COMPILE/ + #uploads/ + #archives/ + #.htaccess + #serendipity_config_local.inc.php + # For completeness we could test to make sure the directories + # really are directories, but that's probably overkill + foreach (array('archives/', PATH_SMARTY_COMPILE . '/', 'uploads/', '.htaccess', 'serendipity_config_local.inc.php') as $path) { + if (!is_writeable($basedir . $path)) { + $data['installerResultDiagnose_WRITABLE'][] = serendipity_installerResultDiagnose(S9Y_I_ERROR, NOT_WRITABLE); + $showWritableNote = true; + break; } - ?>
Execute Imagemagick binary
+ } + } - -
- + if (function_exists('is_executable')) { + $data['is_imb_executable'] = true; + if ($binary = serendipity_query_default('convert', false)) { + if (is_executable($binary)) { + $data['installerResultDiagnose_IMB'] = serendipity_installerResultDiagnose(S9Y_I_SUCCESS, YES); + } else { + $data['installerResultDiagnose_IMB'] = serendipity_installerResultDiagnose(S9Y_I_WARNING, NO); + } + } else { + $data['installerResultDiagnose_IMB'] = serendipity_installerResultDiagnose(S9Y_I_WARNING, NOT_FOUND); + } + } -
- 0 ) { ?> -
-

- - : -

-

- -
-
+ $data['showWritableNote'] = $showWritableNote; + $data['errorCount'] = $errorCount; - -
- - - -
-
+ $data['ob_serendipity_printConfigTemplate'] = ob_get_contents(); + ob_end_clean(); - -
- - - -
-
+ $data['ob_serendipity_printConfigTemplate'] = ob_get_contents(); + ob_end_clean(); - -'. THEY_DO .', '. WONT_INSTALL_DB_AGAIN; - echo '
'; - echo '
'; + // void } else { - echo ' '. THEY_DONT .''; - echo '
'; + serendipity_installDatabase(); + $data['install_DB'] = true; - echo CREATE_DATABASE; - serendipity_installDatabase(); - echo ' ' . DONE . '
'; - - echo sprintf(CREATING_PRIMARY_AUTHOR, htmlspecialchars($_POST['user'])) .'...'; $authorid = serendipity_addAuthor($_POST['user'], $_POST['pass'], $_POST['realname'], $_POST['email'], USERLEVEL_ADMIN, 1); $mail_comments = (serendipity_db_bool($_POST['want_mail']) ? 1 : 0); serendipity_set_user_var('mail_comments', $mail_comments, $authorid); @@ -536,38 +354,34 @@ if ( (int)$serendipity['GET']['step'] == 0 ) { serendipity_addDefaultGroup('USERLEVEL_EDITOR_DESC', USERLEVEL_EDITOR); serendipity_addDefaultGroup('USERLEVEL_CHIEF_DESC', USERLEVEL_CHIEF); serendipity_addDefaultGroup('USERLEVEL_ADMIN_DESC', USERLEVEL_ADMIN); + $data['add_authors'] = true; - echo ' ' . DONE . '
'; - - echo SETTING_DEFAULT_TEMPLATE .'... '; serendipity_set_config_var('template', $serendipity['defaultTemplate']); - echo ' ' . DONE . '
'; + $data['set_template_vars'] = true; - echo INSTALLING_DEFAULT_PLUGINS .'... '; include_once S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php'; serendipity_plugin_api::register_default_plugins(); - echo ' ' . DONE . '
'; - + $data['register_default_plugins'] = true; } - echo sprintf(ATTEMPT_WRITE_FILE, '.htaccess') . '... '; $errors = serendipity_installFiles($basedir); - if ( $errors === true ) { - echo ' ' . DONE . '
'; - } else { - echo ' ' . FAILED . '
'; - foreach ( $errors as $error ) { - echo '
' . $error .'
'; - } - } + $data['errors_sif'] = $errors; if ( serendipity_updateConfiguration() ) { - echo '
' . SERENDIPITY_INSTALLED .'
'; - echo '
'. VISIT_BLOG_HERE .'
'; - echo '
'. THANK_YOU_FOR_CHOOSING .'
'; - } else { - echo '
'. ERROR_DETECTED_IN_INSTALL .'
'; - } + $data['s9y_installed'] = true; + } } +if (!is_object($serendipity['smarty'])) { + serendipity_smarty_init(); +} + +$serendipity['smarty']->assign($data); + +$tfile = dirname(__FILE__) . "/tpl/installer.inc.tpl"; + +$content = $serendipity['smarty']->fetch('file:'. $tfile); // short notation with Smarty3 in S9y 1.7 and up + +echo $content; + /* vim: set sts=4 ts=4 expandtab : */ diff --git a/include/admin/tpl/installer.inc.tpl b/include/admin/tpl/installer.inc.tpl new file mode 100644 index 00000000..dd7c644d --- /dev/null +++ b/include/admin/tpl/installer.inc.tpl @@ -0,0 +1,302 @@ +{** please return correct markup for these serendipity_installerResultDiagnose notices in the upper PHP file + {if $i_success} + return ''. $s .''; + {/if} + {if $i_warning} + return ''. $s .' [?]'; + {/if} + {if $i_error} + return ''. $s .' [!]'; + {/if} +**} +{* From configuration to install *} +{if ( sizeof($smarty.post) > 1 && $s9yGETstep == 3 )} + + {if is_array($errors)} + {foreach $errors AS $error} +
{$error}
+ {/foreach} + {/if} + +{/if} + +{if $getstepint0} + +{$CONST.WELCOME_TO_INSTALLATION}. +
{$CONST.FIRST_WE_TAKE_A_LOOK}. +
{$print_ERRORS_ARE_DISPLAYED_IN}. +
+
+
- {$CONST.PRE_INSTALLATION_REPORT|sprintf:$s9yversion} -

+ +
+ + + + + {foreach $installerResultDiagnose_CHECKSUMS AS $cksum} + + + + {/foreach} +
{$CONST.INTEGRITY}
{$cksum}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{$CONST.PHP_INSTALLATION}
{$CONST.OPERATING_SYSTEM}{$php_uname}
{$CONST.WEBSERVER_SAPI}{$php_sapi_name}
PHP version >= 5.2.6{$installerResultDiagnose_VERSION}
Database extensions{$installerResultDiagnose_DBTYPE}
Session extension{$installerResultDiagnose_SESSION}
PCRE extension{$installerResultDiagnose_PCRE}
GDlib extension{$installerResultDiagnose_GD}
OpenSSL extension{$installerResultDiagnose_OPENSSL}
mbstring extension{$installerResultDiagnose_MBSTR}
iconv extension{$installerResultDiagnose_ICONV}
zlib extension{$installerResultDiagnose_ZLIB}
Imagemagick binary {$installerResultDiagnose_IM}
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{$CONST.PHPINI_CONFIGURATION}
 {$CONST.RECOMMENDED}{$CONST.ACTUAL}
safe_modeOFF{$installerResultDiagnose_SSM}
register_globalsOFF{$installerResultDiagnose_SRG}
magic_quotes_gpcOFF{$installerResultDiagnose_SMQG}
magic_quotes_runtimeOFF{$installerResultDiagnose_SMQR}
session.use_trans_sidOFF{$installerResultDiagnose_SSUTS}
allow_url_fopenON{$installerResultDiagnose_SAUF}
file_uploadsON{$installerResultDiagnose_SFU}
post_max_size10M{$installerResultDiagnose_SPMS}
upload_max_filesize10M{$installerResultDiagnose_SUMF}
memory_limit{($CONST.PHP_INT_SIZE == 4) ? '8M' : '16M'}{$installerResultDiagnose_SML}
+
+ + + + + + + + + + + + + + + + + + + + + + {if $is_dir_uploads} + + + + + {/if} + + {if $is_imb_executable} + + + + + {/if} +
{$CONST.PERMISSIONS}
{$basedir} + {foreach $installerResultDiagnose_WRITABLE AS $fwrite} + {$fwrite} + {/foreach} +
{$basedir}{$CONST.PATH_SMARTY_COMPILE} + {foreach $installerResultDiagnose_COMPILE AS $compile} + {$compile} + {/foreach} +
{$basedir}archives/ + {foreach $installerResultDiagnose_ARCHIVES AS $archives} + {$archives} + {/foreach} +
{$basedir}plugins/ + {foreach $installerResultDiagnose_PLUGINS AS $plugins} + {$plugins} + {/foreach} +
{$basedir}uploads/ + {foreach $installerResultDiagnose_UPLOADS AS $uploads} + {$uploads} + {/foreach} +
Execute Imagemagick binary + {foreach $installerResultDiagnose_IMB AS $im_binary} + {$im_binary} + {/foreach} +
+ + {if $showWritableNote} +
{$CONST.PROBLEM_PERMISSIONS_HOWTO|sprintf:'chmod 1777'}
+ {/if} + +
+ {if $errorCount > 0} +
{$CONST.PROBLEM_DIAGNOSTIC}
+

{$CONST.RECHECK_INSTALLATION}

+ {else} + {$CONST.SELECT_INSTALLATION_TYPE}: +

{$CONST.SIMPLE_INSTALLATION} - {$CONST.EXPERT_INSTALLATION}

+ {/if} +
+ +
+ +{elseif $s9yGETstep == '2a'} +
+ + + {if $ob_serendipity_printConfigTemplate}{$ob_serendipity_printConfigTemplate}{/if} +
+
+ +{elseif $s9yGETstep == '2b'} +
+ + + {if $ob_serendipity_printConfigTemplate}{$ob_serendipity_printConfigTemplate}{/if} +
+
+ +{elseif $getstepint3} + +{$CONST.CHECK_DATABASE_EXISTS}… +{if is_array($authors_query)} + {$CONST.THEY_DO}, {$CONST.WONT_INSTALL_DB_AGAIN} +
+
+{else} + {$CONST.THEY_DONT} +
+ + {$CONST.CREATE_DATABASE} + {if $install_DB} + {$CONST.DONE}
+ {/if} + + {$CONST.CREATING_PRIMARY_AUTHOR|sprintf:$marty.post.user|escape}$hellip; + {if $add_authors} + {$CONST.DONE}
+ {/if} + + {$CONST.SETTING_DEFAULT_TEMPLATE}… + {if $set_template_vars} + {$CONST.DONE}
+ {/if} + + {$CONST.INSTALLING_DEFAULT_PLUGINS}… + {if $register_default_plugins} + {$CONST.DONE}
+ {/if} + +{/if} + +{$CONST.ATTEMPT_WRITE_FILE|sprintf:'.htaccess'}… +{if $errors_sif === true} + {$CONST.DONE}
+{else} + {$CONST.FAILED}
+ {foreach $errors_sif AS $error_f} +
{$error_f}
+ {/foreach} +{/if} + +{if $s9y_installed} +
{$CONST.SERENDIPITY_INSTALLED}
+
{$CONST.VISIT_BLOG_HERE}
+
{$CONST.THANK_YOU_FOR_CHOOSING}
+{else} +
{$CONST.ERROR_DETECTED_IN_INSTALL}
+{/if} + +{/if}{* getstepint3 end *} diff --git a/include/admin/tpl/upgrader.inc.tpl b/include/admin/tpl/upgrader.inc.tpl index 462e64f8..470f54b5 100644 --- a/include/admin/tpl/upgrader.inc.tpl +++ b/include/admin/tpl/upgrader.inc.tpl @@ -1,3 +1,14 @@ +{** please return correct markup for these serendipity_upgraderResultDiagnose notices in the upper PHP file + {if $u_success} + return ''. $s .''; + {/if} + {if $u_warning} + return ''. $s .''; + {/if} + {if $u_error} + return ''. $s .''; + {/if} +**} {if $task_function} {'Calling %s ...
'|sprintf:(is_array($task['function']) ? $task['function'][0] . '::'. $task['function'][1] : $task['function'])}