示例#1
0
     serendipity_set_user_var('mail_trackbacks', $mail_comments, $authorid);
     serendipity_set_user_var('right_publish', 1, $authorid);
     serendipity_addDefaultGroup('USERLEVEL_EDITOR_DESC', USERLEVEL_EDITOR);
     serendipity_addDefaultGroup('USERLEVEL_CHIEF_DESC', USERLEVEL_CHIEF);
     serendipity_addDefaultGroup('USERLEVEL_ADMIN_DESC', USERLEVEL_ADMIN);
     echo ' <strong>' . DONE . '</strong><br />';
     echo SETTING_DEFAULT_TEMPLATE . '... ';
     serendipity_set_config_var('template', $serendipity['defaultTemplate']);
     echo ' <strong>' . DONE . '</strong><br />';
     echo INSTALLING_DEFAULT_PLUGINS . '... ';
     include_once S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php';
     serendipity_plugin_api::register_default_plugins();
     echo ' <strong>' . DONE . '</strong><br />';
 }
 echo sprintf(ATTEMPT_WRITE_FILE, '.htaccess') . '... ';
 $errors = serendipity_installFiles($basedir);
 if ($errors === true) {
     echo ' <strong>' . DONE . '</strong><br />';
 } else {
     echo ' <strong>' . FAILED . '</strong><br />';
     foreach ($errors as $error) {
         echo '<div class="serendipityAdminMsgError"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />' . $error . '</div>';
     }
 }
 if (serendipity_updateConfiguration()) {
     echo '<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . SERENDIPITY_INSTALLED . '</div>';
     echo '<div align="center" style="font-size: large"><a href="' . $_POST['serendipityHTTPPath'] . '">' . VISIT_BLOG_HERE . '</a></div>';
     echo '<div align="center">' . THANK_YOU_FOR_CHOOSING . '</div>';
 } else {
     echo '<div class="serendipityAdminMsgError"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />' . ERROR_DETECTED_IN_INSTALL . '</div>';
 }
     } else {
         /* If we have new rewrite rules, then install them */
         $permalinkOld = array($oldConfig['serendipityHTTPPath'], $oldConfig['serendipityPath'], $oldConfig['baseURL'], $oldConfig['indexFile'], $oldConfig['rewrite']);
         $permalinkNew = array($serendipity['serendipityHTTPPath'], $serendipity['serendipityPath'], $serendipity['baseURL'], $serendipity['indexFile'], $serendipity['rewrite']);
         // Compare all old permalink section values against new one. A change in any of those
         // will force to update the .htaccess for rewrite rules.
         $permconf = serendipity_parseTemplate(S9Y_CONFIG_TEMPLATE);
         if (is_array($permconf) && is_array($permconf['permalinks']['items'])) {
             foreach ($permconf['permalinks']['items'] as $permitem) {
                 $permalinkOld[] = $oldConfig[$permitem['var']];
                 $permalinkNew[] = $serendipity[$permitem['var']];
             }
         }
         if (serendipity_checkPermission('siteConfiguration') && serialize($permalinkOld) != serialize($permalinkNew)) {
             printf(ATTEMPT_WRITE_FILE, $serendipity['serendipityPath'] . '.htaccess');
             $res = serendipity_installFiles($serendipity['serendipityPath']);
             if (is_array($res)) {
                 echo implode('<br />', $res);
             } else {
                 echo DONE . '<br />';
             }
             serendipity_buildPermalinks();
         }
         echo '<br /><div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . WRITTEN_N_SAVED . '</div>';
     }
     break;
 default:
     $from =& $serendipity;
     $t = serendipity_parseTemplate(S9Y_CONFIG_TEMPLATE);
     serendipity_printConfigTemplate($t, $from, false, true);
     break;