Update of /cvsroot/php-blog/serendipity/include/admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10304/include/admin
Modified Files:
comments.inc.php entries.inc.php images.inc.php
installer.inc.php overview.inc.php plugins.inc.php
templates.inc.php upgrader.inc.php users.inc.php
Log Message:
- Merged author and admin suites
- New separated layout for Administration Suite
- Fixed lots of layout quirks, make the admin look more unified
- Fixed some invalid HTML (unclosed/excess tags)
- Remove some unneeded session_start() functions in included admin files
- Allow $plugin->get_config() to return the default value as defined in introspect_config_item, when only given one argument
- Fixed bug in upgrader, not allowing multiple upgrade functions for a single version
- Killed serendipity_printLogin() and moved it to serendipity_admin.php
- Pretty up the iframe stuff
- Added aliases to some adminModules
Index: templates.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/templates.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- templates.inc.php 19 Nov 2004 11:05:32 -0000 1.2
+++ templates.inc.php 27 Nov 2004 22:14:15 -0000 1.3
@@ -17,7 +17,9 @@
<div>
<form method="post" action="<?php echo $serendipity['serendipityHTTPPath']; ?>serendipity_admin.php?serendipity[adminModule]=templates&serendipity[adminAction]=save">
<?php
+ $i = 0;
foreach (serendipity_fetchTemplates() as $theme) {
+ $i++;
$info = serendipity_fetchTemplateInfo($theme);
if (file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $theme . '/preview.png')) {
$preview = '<img src="templates/' . $theme . '/preview.png" width="100" style="border: 1px #000000 solid" />';
@@ -31,29 +33,30 @@
$is_active = '';
}
+ $class = (($i % 2) ? 'even' : 'uneven');
+
$jsLine = " onmousedown=\"document.getElementById('serendipity_theme_radio_". $theme ."').checked = true;\"";
- $jsLine .= " onmouseout=\"document.getElementById('serendipity_theme_". $theme ."').className='';\"";
- $jsLine .= " onmouseover=\"document.getElementById('serendipity_theme_". $theme ."').className='serendipity_admin_list_item_uneven'; style.cursor = 'pointer';\"";
+# $jsLine .= " onmouseout=\"document.getElementById('serendipity_theme_". $theme ."').className='';\"";
+ $jsLine .= " onmouseover=\"style.cursor = 'pointer';\"";
?>
+<div class="serendipity_admin_list_item serendipity_admin_list_item_<?php echo $class ?>">
<table width="100%" id="serendipity_theme_<?php echo $theme; ?>">
<tr>
- <td colspan="3" <?php echo $jsLine ?>><strong><?php echo $info['name']; ?></strong></td>
+ <td colspan="2" <?php echo $jsLine ?>><strong><?php echo $info['name']; ?></strong></td>
+ <td valign="middle" align="center" width="70" <?php echo $jsLine ?> rowspan="2">
+ <div><input type="radio" name="serendipity[theme]" value="<?php echo $theme; ?>" id="serendipity_theme_radio_<?php echo $theme; ?>" <?php echo $is_active; ?> /></div>
+ </td>
</tr>
<tr>
<td width="100" <?php echo $jsLine ?> style="padding-left: 10px"><?php echo $preview; ?></td>
-
<td valign="top" <?php echo $jsLine ?>>
<?php echo AUTHOR; ?> : <?php echo $info['author'];?><br />
<?php echo LAST_UPDATED; ?>: <?php echo $info['date']; ?>
</td>
-
- <td valign="middle" align="center" width="70" <?php echo $jsLine ?>>
- <div><input type="radio" name="serendipity[theme]" value="<?php echo $theme; ?>" id="serendipity_theme_radio_<?php echo $theme; ?>" <?php echo $is_active; ?> /></div>
- </td>
</tr>
</table>
- <br />
+</div>
<?php
}
?>
Index: users.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/users.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- users.inc.php 19 Nov 2004 11:05:32 -0000 1.2
+++ users.inc.php 27 Nov 2004 22:14:15 -0000 1.3
@@ -3,7 +3,6 @@
if (IN_serendipity !== true) {
die ('Don\'t hack!');
}
-session_start();
if ($serendipity['serendipityUserlevel'] < USERLEVEL_CHIEF) {
return;
Index: upgrader.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/upgrader.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- upgrader.inc.php 19 Nov 2004 11:05:32 -0000 1.2
+++ upgrader.inc.php 27 Nov 2004 22:14:15 -0000 1.3
@@ -59,32 +59,50 @@
);
/* Functions which needs to be run if installed version is equal or lower */
-$tasks = array('0.5.1' => array('function' => 'serendipity_syncThumbs',
- 'title' => 'Image Sync',
- 'desc' => 'Version 0.5.1 introduces image sync with the database'. "\n" .
- 'With your permission I would like to perform the image sync'),
+$tasks = array(array('version' => '0.5.1',
+ 'function' => 'serendipity_syncThumbs',
+ 'title' => 'Image Sync',
+ 'desc' => 'Version 0.5.1 introduces image sync with the database'. "\n" .
+ 'With your permission I would like to perform the image sync'),
- '0.6.5' => array('function' => 'serendipity_rebuildCategoryTree',
- 'title' => 'Nested subcategories, post to multiple categories',
- 'desc' => 'This update will update the categories table of your database and update the relations from entries to categories.'. "\n" .
- 'This is a possibly dangerous task to perform, so <strong style="color: red">make sure you have a backup of your database!</strong>'),
+ array('version' => '0.6.5',
+ 'function' => 'serendipity_rebuildCategoryTree',
+ 'title' => 'Nested subcategories, post to multiple categories',
+ 'desc' => 'This update will update the categories table of your database and update the relations from entries to categories.'. "\n" .
+ 'This is a possibly dangerous task to perform, so <strong style="color: red">make sure you have a backup of your database!</strong>'),
- '0.6.8' => array('function' => 'serendipity_installFiles',
- 'title' => 'Update of .htaccess file',
- 'desc' => 'Changes were made to the .htaccess file, you need to regenerate it'),
+ array('version' => '0.6.8',
+ 'function' => 'serendipity_installFiles',
+ 'title' => 'Update of .htaccess file',
+ 'desc' => 'Changes were made to the .htaccess file, you need to regenerate it'),
- '0.6.10' => array('functon' => 'serendipity_installFiles',
- 'title' => 'Update of .htaccess file',
- 'desc' => 'Changes were made to the .htaccess file, you need to regenerate it'),
+ array('version' => '0.6.10',
+ 'functon' => 'serendipity_installFiles',
+ 'title' => 'Update of .htaccess file',
+ 'desc' => 'Changes were made to the .htaccess file, you need to regenerate it'),
- '0.6.12' => array('function' => 'serendipity_installFiles',
- 'title' => 'Update of .htaccess file',
- 'desc' => 'Changes were made to the .htaccess file, you need to regenerate it'),
+ array('version' => '0.6.12',
+ 'function' => 'serendipity_installFiles',
+ 'title' => 'Update of .htaccess file',
+ 'desc' => 'Changes were made to the .htaccess file, you need to regenerate it'),
+
+ array('version' => '0.8-alpha3',
+ 'function' => 'serendipity_removeFiles',
+ 'title' => 'Removal of obsolete files',
+ 'arguments' => $obsolete_files,
+ 'desc' => 'The directory structure has been reworked. The following files will be moved to a folder called "backup". If you made manual changes to those files, be sure to read the file docs/CHANGED_FILES to re-implement your changes.<br /><div style="font-size: x-small; margin: 15px">' . implode(', ', $obsolete_files) . '</div>'),
+
+ array('version' => '0.8-alpha4',
+ 'function' => 'serendipity_removeFiles',
+ 'title' => 'Removal of serendipity_entries.php',
+ 'arguments' => array('serendipity_entries.php'),
+ 'desc' => 'In order to implement the new administration, we have to remove the leftovers'),
+
+ array('version' => '0.8-alpha4',
+ 'function' => 'serendipity_installFiles',
+ 'title' => 'Update of .htaccess file',
+ 'desc' => 'In order to implement the new administration, changes were made to the .htaccess file, you need to regenerate it'),
- '0.8-alpha3' => array('function' => 'serendipity_removeFiles',
- 'title' => 'Removal of obsolete files',
- 'arguments' => $obsolete_files,
- 'desc' => 'The directory structure has been reworked. The following files will be moved to a folder called "backup". If you made manual changes to those files, be sure to read the file docs/CHANGED_FILES to re-implement your changes.<br /><div style="font-size: x-small; margin: 15px">' . implode(', ', $obsolete_files) . '</div>')
);
/* Fetch SQL files which needs to be run */
@@ -133,14 +151,15 @@
/* Call functions */
$errors = array();
- foreach ($tasks as $version => $task) {
- if (version_compare(serendipity_version($serendipity['versionInstalled']), $version, '<') ) {
+ foreach ($tasks as $task) {
+ if (version_compare(serendipity_version($serendipity['versionInstalled']), $task['version'], '<') ) {
if (is_callable($task['function'])) {
echo 'Calling ' . $task['function'] . '...<br />';
- if (empty($task['arguments']) || !is_array($task['arguments'])) {
- $task['arguments'] = array();
+ if (empty($task['arguments'])) {
+ call_user_func($task['function']);
+ } else {
+ call_user_func($task['function'], $task['arguments']);
}
- call_user_func($task['function'], $task['arguments']);
} else {
$errors[] = 'Unable to call '. $task['function'];
}
@@ -149,7 +168,7 @@
if (sizeof($errors)) {
echo DIAGNOSTIC_ERROR . '<br /><br />';
- echo '<span class="serendipity_msg_important">- ' . implode('<br />', $errors) . '</span><br /><br />';
+ echo '<span class="serendipityAdminMsgError">- ' . implode('<br />', $errors) . '</span><br /><br />';
}
}
@@ -203,9 +222,9 @@
<?php
$taskCount = 0;
- foreach ( $tasks as $version => $task ) {
- if (version_compare(serendipity_version($serendipity['versionInstalled']), $version, '<')) {
- echo '<div><strong>'. $version .' - '. $task['title'] .'</strong></div>';
+ foreach ( $tasks as $task ) {
+ if (version_compare(serendipity_version($serendipity['versionInstalled']), $task['version'], '<')) {
+ echo '<div><strong>'. $task['version'] .' - '. $task['title'] .'</strong></div>';
echo '<div style="padding-left: 5px">'. nl2br($task['desc']) .'</div><br />';
$taskCount++;
}
Index: plugins.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/plugins.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- plugins.inc.php 19 Nov 2004 11:05:32 -0000 1.2
+++ plugins.inc.php 27 Nov 2004 22:14:15 -0000 1.3
@@ -3,15 +3,14 @@
if (IN_serendipity !== true) {
die ('Don\'t hack!');
}
-session_start();
-
-include_once S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php';
-include_once S9Y_INCLUDE_PATH . 'include/plugin_internal.inc.php';
if ($serendipity['serendipityUserlevel'] < USERLEVEL_CHIEF) {
return;
}
+include_once S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php';
+include_once S9Y_INCLUDE_PATH . 'include/plugin_internal.inc.php';
+
function serendipity_pluginListSort($x, $y) {
return strnatcasecmp($x['name'] . ' - ' . $x['desc'], $y['name'] . ' - ' . $y['desc']);
}
@@ -455,7 +454,7 @@
<input type="submit" name="SAVECONF" value="<?php echo SAVE; ?>" />
<?php
if (isset($_POST['SAVECONF'])) {
- echo '<span class="serendipity_msg_notice">' . DONE . ': '. $statusMsg .'</span>';
+ echo '<span class="serendipityAdminMsgSuccess">' . DONE . ': '. $statusMsg .'</span>';
}
?>
</div>
Index: overview.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/overview.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- overview.inc.php 19 Nov 2004 11:05:32 -0000 1.2
+++ overview.inc.php 27 Nov 2004 22:14:15 -0000 1.3
@@ -12,8 +12,10 @@
if (IN_serendipity !== true) {
die ("Don't hack!");
}
+?>
-echo WELCOME_BACK . ' ' . $_SESSION['serendipityUser'] . '.';
-echo '<br /><br />'. RUNNING . $serendipity['version'];
+<?php echo WELCOME_BACK . ' ' . $_SESSION['serendipityUser'] . '.'; ?>
+
+<?php
/* vim: set sts=4 ts=4 expandtab : */
?>
Index: comments.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/comments.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- comments.inc.php 23 Nov 2004 19:54:02 -0000 1.4
+++ comments.inc.php 27 Nov 2004 22:14:15 -0000 1.5
@@ -139,13 +139,13 @@
}
if ( $page != 1 && $page <= $pages ) {
- $linkPrevious = '<input type="button" name="serendipity[previouspage]" value="<<<" onclick="location.href=\'serendipity_entries.php?serendipity[adminModule]=comments&serendipity[page]='. ($page-1) . $searchString . '\'" />';
+ $linkPrevious = '<input type="button" name="serendipity[previouspage]" value="<<<" onclick="location.href=\'serendipity_admin.php?serendipity[adminModule]=comments&serendipity[page]='. ($page-1) . $searchString . '\'" />';
} else {
$linkPrevious = '<input type="button" name="serendipity[previouspage]" value="<<<" disabled="disabled" />';
}
if ( $page != $pages ) {
- $linkNext = '<input type="button" name="serendipity[nextpage]" value=">>>" onclick="location.href=\'serendipity_entries.php?serendipity[adminModule]=comments&serendipity[page]='. ($page+1) . $searchString . '\'" />';
+ $linkNext = '<input type="button" name="serendipity[nextpage]" value=">>>" onclick="location.href=\'serendipity_admin.php?serendipity[adminModule]=comments&serendipity[page]='. ($page+1) . $searchString . '\'" />';
} else {
$linkNext = '<input type="button" name="serendipity[nextpage]" value=">>>" disabled="disabled" />';
}
@@ -237,7 +237,7 @@
?>
<form action="" method="POST" name="formMultiDelete" id="formMultiDelete">
<input type="hidden" name="serendipity[formAction]" value="multiDelete" />
-<table width="100%" cellspacing="5" cellpadding="0" border="0" class="serendipity_admin_list">
+<table width="100%" cellpadding="3" border="0" cellspacing="0">
<tr>
<td align="center">
<table width="100%" cellspacing="5" cellpadding="0" border="0">
@@ -282,8 +282,8 @@
</td>
</tr>
<tr>
- <td class="serendipity_admin_list_item <?php echo $class ?>" style="padding: 3px" id="comment_<?php echo $rs['id'] ?>">
- <table width="100%" cellspacing="0" cellpadding="2" border="0">
+ <td class="serendipity_admin_list_item <?php echo $class ?>" id="comment_<?php echo $rs['id'] ?>">
+ <table width="100%" cellspacing="0" cellpadding="3" border="0">
<tr>
<td rowspan="2" width="20" align="center"><input type="checkbox" name="serendipity[delete][<?php echo $rs['id'] ?>]" value="<?php echo $rs['entry_id'] ?>" onclick="highlightComment('comment_<?php echo $rs['id'] ?>', this.checked)" tabindex="<?php echo $i ?>" /></td>
<td width="250"><strong><?php echo AUTHOR ?></strong>: <?php echo htmlspecialchars($rs['author']) ?></td>
@@ -315,7 +315,7 @@
</tr>
<?php } ?>
<tr>
- <td><input type="button" name="toggle" value="<?php echo INVERT_SELECTIONS ?>" onclick="invertSelection()" /> <input type="submit" name="toggle" value="<?php echo DELETE_SELECTED_COMMENTS ?>" onclick="return confirm('<?php echo COMMENTS_DELETE_CONFIRM ?>')" tabindex="<?php echo ($i+1) ?> /></td>
+ <td><input type="button" name="toggle" value="<?php echo INVERT_SELECTIONS ?>" onclick="invertSelection()" /> <input type="submit" name="toggle" value="<?php echo DELETE_SELECTED_COMMENTS ?>" onclick="return confirm('<?php echo COMMENTS_DELETE_CONFIRM ?>')" tabindex="<?php echo ($i+1) ?>" /></td>
</tr>
<tr>
<td align="center">
Index: images.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/images.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- images.inc.php 19 Nov 2004 11:05:32 -0000 1.2
+++ images.inc.php 27 Nov 2004 22:14:15 -0000 1.3
@@ -44,7 +44,7 @@
return;
}
- $abortLoc = $serendipity['serendipityHTTPPath'] . 'serendipity_entries.php?serendipity[adminModule]=images';
+ $abortLoc = $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php?serendipity[adminModule]=images';
$newLoc = $abortLoc . '&serendipity[adminAction]=DoDelete&serendipity[fid]=' . $serendipity['GET']['fid'];
printf(ABOUT_TO_DELETE_FILE, $file['name'] .'.'. $file['extension']);
Index: installer.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/installer.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- installer.inc.php 20 Nov 2004 12:21:40 -0000 1.3
+++ installer.inc.php 27 Nov 2004 22:14:15 -0000 1.4
@@ -32,7 +32,7 @@
if (is_array($res)) {
echo DIAGNOSTIC_ERROR . '<br /><br />';
- echo '<span class="serendipity_msg_important">- ' . implode('<br />', $res) . '</span><br /><br />';
+ echo '<span class="serendipityAdminMsgError">- ' . implode('<br />', $res) . '</span><br /><br />';
serendipity_printConfigTemplate(serendipity_parseTemplate(S9Y_CONFIG_TEMPLATE), $_POST, false, true);
die();
}
@@ -46,14 +46,14 @@
if ($res !== false) {
echo ' ' . DATABASE_DONE . '<br />';
} else {
- echo '<span class="serendipity_msg_important">- ' . DATABASE_ALREADY_INSTALLED . '</span><br />';
+ echo '<span class="serendipityAdminMsgError">- ' . DATABASE_ALREADY_INSTALLED . '</span><br />';
}
/* Next are the files, .htaccess */
printf(ATTEMPT_WRITE_FILE, $serendipity_core . '.htaccess');
$res = serendipity_installFiles($serendipity_core);
if (is_array($res)) {
- echo '<span class="serendipity_msg_important">- ' . implode('<br />', $res) . '</span><br /><br />';
+ echo '<span class="serendipityAdminMsgError">- ' . implode('<br />', $res) . '</span><br /><br />';
die();
} else {
echo DONE . '<br />';
@@ -95,7 +95,7 @@
$res = serendipity_updateConfiguration();
if (is_array($res)) {
echo DIAGNOSTIC_ERROR;
- echo '<span class="serendipity_msg_important">- ' . implode('<br />', $res) . '</span><br /><br />';
+ echo '<span class="serendipityAdminMsgError">- ' . implode('<br />', $res) . '</span><br /><br />';
} else {
/* If we have new rewrite rules, then install them */
if (isset($_POST['rewrite']) && $serendipity['serendipityUserlevel'] >= USERLEVEL_ADMIN && $oldRewrite != $_POST['rewrite']) {
@@ -121,7 +121,7 @@
/* Do check for required PHP version */
if (version_compare(PHP_VERSION, VERSION_REQUIRED) == -1) {
- echo '<br /><span class="serendipity_msg_important">WARNING!<br />You are using PHP version ' . PHP_VERSION . '! Serendipity requires version ' . VERSION_REQUIRED . '</span>';
+ echo '<br /><span class="serendipityAdminMsgError">WARNING!<br />You are using PHP version ' . PHP_VERSION . '! Serendipity requires version ' . VERSION_REQUIRED . '</span>';
}
$from = false;
}
Index: entries.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/entries.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- entries.inc.php 26 Nov 2004 14:40:14 -0000 1.5
+++ entries.inc.php 27 Nov 2004 22:14:15 -0000 1.6
@@ -167,7 +167,6 @@
</td>
</tr>
</table>
- <table class="serendipity_admin_list" cellpadding="5" width="100%">
<?php
// Print the entries
$rows = 0;
@@ -181,9 +180,8 @@
}
?>
- <tr>
- <td class="serendipity_admin_list_item serendipity_admin_list_item_<?php echo ($rows % 2 ? 'even' : 'uneven'); ?>">
- <table width="100%">
+ <div class="serendipity_admin_list_item serendipity_admin_list_item_<?php echo ($rows % 2 ? 'even' : 'uneven'); ?>">
+ <table width="100%" cellspacing="0" cellpadding="3">
<tr>
<td>
<strong><?php if ($entry['isdraft'] == 'true') echo DRAFT . ': '; ?><a href="?serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=edit&serendipity[id]=<?php echo $entry['id']; ?>" title="#<?php echo $entry['id']; ?>"><?php echo serendipity_truncateString($entry['title'],50) ?></a></strong>
@@ -213,31 +211,28 @@
</td>
</tr>
</table>
- </td>
- </tr>
+ </div>
<?php
} // end entries output
?>
- <tr>
- <td class="serendipity_admin_list_item serendipity_admin_list_item_<?php echo (($rows+1) % 2 ? 'even' : 'uneven'); ?>">
- <br />
- <?php echo EDIT_ENTRY . ': #<input type="text" size="3" name="serendipity[id]" /> <input type="submit" name="serendipity[editSubmit]" value="' . GO . '" />'; ?>
- </td>
- </tr>
+ <div class="serendipity_admin_list_item serendipity_admin_list_item_<?php echo (($rows+1) % 2 ? 'even' : 'uneven'); ?>">
+ <table width="100%" cellspacing="0" cellpadding="3">
+ <tr>
+ <td>
+ <?php echo EDIT_ENTRY . ': #<input type="text" size="3" name="serendipity[id]" /> <input type="submit" name="serendipity[editSubmit]" value="' . GO . '" />'; ?>
+ </td>
+ </tr>
+ </table>
+ </div>
<?php
} else {
// We've got nothing
?>
- <tr>
- <td align="center">
- - <?php echo NO_ENTRIES_TO_PRINT ?> -
- </td>
- </tr>
+ <div align="center">- <?php echo NO_ENTRIES_TO_PRINT ?> -</div>
<?php
}
?>
- </table>
</div>
</form>
<?php
@@ -295,9 +290,9 @@
$serendipity['POST']['preview'] = 'true';
$res = serendipity_updertEntry($entry);
if (is_string($res)) {
- echo '<div class="serendipity_msg_error">' . QUICKSAVE . ': <b>' . $res . '</b></div><br />';
+ echo '<div class="serendipityAdminMsgError">' . QUICKSAVE . ': <b>' . $res . '</b></div><br />';
} else {
- echo '<div class="serendipity_msg_notice">' . QUICKSAVE . ': ' . ENTRY_SAVED . '</div><br />';
+ echo '<div class="serendipityAdminMsgSuccess">' . QUICKSAVE . ': ' . ENTRY_SAVED . '</div><br />';
}
}
|