+
+$index['comments'] = "cid,type,sid,date,uid";
+$index['stories'] = "sid,tid,date,uid,frontpage,featured,hits";
+$index['blocks'] = "bid,is_enabled,tid,type";
+$index['events'] = "eid,datestart,dateend,event_type";
+$index['links'] = "lid,category,date";
+$index['pollquestions'] = "qid,date,display,commentcode,statuscode";
+$index['staticpage'] = "sp_id,sp_uid,sp_date,sp_onmenu";
+$index['userindex'] = "uid,noboxes,maxstories";
+$index['group_assignments'] = "ug_main_grp_id,ug_uid";
+
+
+echo COM_siteHeader('menu');
+echo COM_startBlock("Updating indexes ...");
+
+foreach ($index as $table=>$fields) {
+
+ $idx = explode (",", $fields);
+
+ echo "Table: {$_TABLES[$table]}
";
+
+ if ($_DEBUG) {
+ echo "Wanted: ";
+ foreach ($idx as $id) {
+ echo "$id, ";
+ }
+ echo "
";
+ }
+
+ $result = DB_query ("show index from {$_TABLES[$table]}");
+ $nrows = DB_numRows ($result);
+ $exidx = array ();
+ for ($i = 0; $i < $nrows; $i++) {
+ $A = DB_fetchArray ($result);
+ $exidx[] = $A['Column_name'];
+ }
+ $newidx = array_diff ($idx, $exidx);
+
+ if ($_DEBUG) {
+ echo "Existing: ";
+ foreach ($exidx as $ex) {
+ echo "$ex, ";
+ }
+ echo "
";
+ }
+
+ if ($_DEBUG) {
+ echo "Need to add: ";
+ foreach ($newidx as $ne) {
+ echo "$ne, ";
+ }
+ echo "
";
+ }
+
+ if (sizeof ($newidx) > 0) {
+ echo "Adding indexes ...
";
+ foreach ($newidx as $ne) {
+ $idxname = $table . '_' . $ne;
+ echo "Adding index \"$idxname\"";
+ flush ();
+
+ $idxtimer = new timerobject ();
+ $idxtimer->setPercision (4);
+ $idxtimer->startTimer ();
+
+ DB_query("ALTER TABLE {$_TABLES[$table]} ADD INDEX $idxname ($ne)");
+
+ $idxtime = $idxtimer->stopTimer ();
+ $idxtimer->setPercision (4);
+ echo " in $idxtime seconds
";
+ }
+ echo "Done!
";
+ } else {
+ echo "No index to add for table {$_TABLES[$table]}
";
+ }
+
+ echo "
";
+}
+
+echo COM_endBlock();
+echo COM_siteFooter();
+
+?>
diff -ruN 1.3.11sr1/admin/install/check.php 1.4.0sr5-1/admin/install/check.php
--- 1.3.11sr1/admin/install/check.php 1969-12-31 18:00:00.000000000 -0600
+++ 1.4.0sr5-1/admin/install/check.php 2006-08-08 02:39:06.000000000 -0500
@@ -0,0 +1,225 @@
+
+*
+*/
+
+require_once ('../../lib-common.php');
+
+$numTests = 7; // total number of tests to perform
+$successful = 0; // number of successful tests
+$failed = 0; // number of failed tests
+$notTested = 0; // number of tests that were skipped (for disabled features)
+
+echo '' . LB;
+echo '' . LB;
+echo '' . LB;
+echo 'Geeklog installation check' . LB;
+echo '' . LB;
+echo '' . LB;
+echo 'Testing your Geeklog installation ...
' . LB;
+
+echo 'Testing logs directory ' . $_CONF['path_log'] . ' ...
' . LB;
+$errfile = @fopen ($_CONF['path_log'] . 'error.log', 'a');
+if ($errfile) fclose ($errfile);
+$accfile = @fopen ($_CONF['path_log'] . 'access.log', 'a');
+if ($accfile) fclose ($accfile);
+
+if (!$errfile || !$accfile) {
+ echo 'Could not open ';
+ if (!$errfile) {
+ echo 'error.log ';
+ }
+ if (!$errfile && !$accfile) {
+ echo 'and ';
+ }
+ if (!$accfile) {
+ echo 'access.log ';
+ }
+ echo 'for writing.
Please check that you have set the logs directory and the files error.log and access.log in that directory to chmod 775.' . LB;
+ $logPerms = sprintf ("%3o", @fileperms ($_CONF['path_log']) & 0777);
+ $errPerms = sprintf ("%3o", @fileperms ($_CONF['path_log'] . 'error.log') & 0777);
+ $accPerms = sprintf ("%3o", @fileperms ($_CONF['path_log'] . 'access.log') & 0777);
+ echo '
' . LB;
+ echo "| Current permissions for logs: | $logPerms |
" . LB;
+ echo "| Current permissions for error.log: | $errPerms |
" . LB;
+ echo "| Current permissions for access.log: | $accPerms |
" . LB;
+ echo '
' . LB;
+ $failed++;
+} else {
+ echo 'logs directory and the error.log and access.log files are okay.' . LB;
+ $successful++;
+}
+
+echo 'Testing backend directory ' . SYND_getFeedPath() . ' ...
' . LB;
+if ($_CONF['backend'] > 0) {
+ if (!$file = @fopen ($_CONF['rdf_file'], 'w')) {
+ echo 'Could not open the RSS file ' . $_CONF['rdf_file'] . ' for writing.
Please check that you have set both the backend directory and the geeklog.rss file in that directory to chmod 775.' . LB;
+ $endPerms = sprintf ("%3o", @fileperms (SYND_getFeedPath()) & 0777);
+ $rdfPerms = sprintf ("%3o", @fileperms ($_CONF['rdf_file']) & 0777);
+ echo '
' . LB;
+ echo "| Current permissions for backend: | $endPerms |
" . LB;
+ echo "| Current permissions for geeklog.rss: | $rdfPerms |
" . LB;
+ echo '
' . LB;
+ $failed++;
+ } else {
+ fclose ($file);
+ echo 'backend directory and the geeklog.rss file are okay.' . LB;
+ $successful++;
+ }
+} else {
+ echo 'Export of Geeklog headlines is switched off - backend directory not tested.
' . LB;
+ $notTested++;
+}
+
+if ($_CONF['allow_user_photo'] > 0) {
+ echo 'Testing userphotos directory ' . $_CONF['path_images'] . 'userphotos/ ...
' . LB;
+ if (!$file = @fopen ($_CONF['path_images'] . 'userphotos/test.gif', 'w')) {
+ echo 'Could not write to ' . $_CONF['path_images'] . 'userphotos/.
Please make sure this directory exists and is set to chmod 775.
' . LB;
+ echo 'Current permissions for userphotos: ' . sprintf ("%3o", @fileperms ($_CONF['path_images'] . 'userphotos/') & 0777);
+ $failed++;
+ } else {
+ fclose ($file);
+ unlink ($_CONF['path_images'] . 'userphotos/test.gif');
+ echo 'userphotos directory is okay.' . LB;
+ $successful++;
+ }
+} else {
+ echo '
User photos are disabled - userphotos directory not tested.' . LB;
+ $notTested++;
+}
+
+if ($_CONF['maximagesperarticle'] > 0) {
+ echo '
Testing articles directory ' . $_CONF['path_images'] . 'articles/ ...
' . LB;
+ if (!$file = @fopen ($_CONF['path_images'] . 'articles/test.gif', 'w')) {
+ echo 'Could not write to ' . $_CONF['path_images'] . 'articles/.
Please make sure this directory exists and is set to chmod 775.
' . LB;
+ echo 'Current permissions for articles: ' . sprintf ("%3o", @fileperms ($_CONF['path_images'] . 'articles/') & 0777);
+ $failed++;
+ } else {
+ fclose ($file);
+ unlink ($_CONF['path_images'] . 'articles/test.gif');
+ echo 'articles directory is okay.' . LB;
+ $successful++;
+ }
+} else {
+ echo '
Images in articles are disabled - articles directory not tested.' . LB;
+ $notTested++;
+}
+
+echo '
Testing topics directory ' . $_CONF['path_images'] . 'topics/ ...
' . LB;
+if (!$file = @fopen ($_CONF['path_images'] . 'topics/test.gif', 'w')) {
+ echo 'Could not write to ' . $_CONF['path_images'] . 'topics/.
Please make sure this directory exists and is set to chmod 775.
' . LB;
+ echo 'Current permissions for topics: ' . sprintf ("%3o", @fileperms ($_CONF['path_images'] . 'articles/') & 0777);
+ $failed++;
+} else {
+ fclose ($file);
+ unlink ($_CONF['path_images'] . 'topics/test.gif');
+ echo 'topics directory is okay.' . LB;
+ $successful++;
+}
+
+/*
+
+if ($_CONF['pdf_enabled'] != 0) {
+ echo '
Testing pdfs directory ' . $_CONF['path_pdf'] . ' ...
' . LB;
+ if (!$file = @fopen ($_CONF['path_pdf'] . 'test.pdf', 'w')) {
+ echo 'Could not write to ' . $_CONF['path_pdf'] . '.
Please make sure this directory exists and is set to chmod 775.
' . LB;
+ echo 'Current permissions for pdfs: ' . sprintf ("%3o", @fileperms ($_CONF['path_pdf']) & 0777);
+ $failed++;
+ } else {
+ fclose ($file);
+ unlink ($_CONF['path_pdf'] . 'test.pdf');
+ echo 'pdfs directory is okay.' . LB;
+ $successful++;
+ }
+} else {
+ echo '
PDF support is disabled - pdfs directory not tested.' . LB;
+ $notTested++;
+}
+
+*/
+
+if ($_CONF['allow_mysqldump'] == 1) {
+ echo '
Testing backups directory ' . $_CONF['backup_path'] . ' ...
' . LB;
+ if (!$file = @fopen ($_CONF['backup_path'] . 'test.txt', 'w')) {
+ echo 'Could not write to ' . $_CONF['backup_path'] . '.
Please make sure this directory exists and is set to chmod 775.
' . LB;
+ echo 'Current permissions for backups: ' . sprintf ("%3o", @fileperms ($_CONF['backup_path']) & 0777);
+ $failed++;
+ } else {
+ fclose ($file);
+ unlink ($_CONF['backup_path'] . 'test.txt');
+ echo 'backups directory is okay.' . LB;
+ $successful++;
+ }
+} else {
+ echo '
Database backups are disabled - backups directory not tested.' . LB;
+ $notTested++;
+}
+
+echo '
Testing data directory ' . $_CONF['path_data'] . ' ...
' . LB;
+if (!$file = @fopen ($_CONF['path_data'] . 'test.txt', 'w')) {
+ echo 'Could not write to ' . $_CONF['path_data'] . '.
Please make sure this directory exists and is set to chmod 775.
' . LB;
+ echo 'Current permissions for data: ' . sprintf ("%3o", @fileperms ($_CONF['path_data']) & 0777);
+ $failed++;
+} else {
+ fclose ($file);
+ unlink ($_CONF['path_data'] . 'test.txt');
+ echo 'data directory is okay.' . LB;
+ $successful++;
+}
+
+echo "
Results: " . ($numTests - $notTested) . " of $numTests tests performed: $successful successful, ";
+if ($failed > 0) {
+ echo "$failed failed.
" . LB;
+} else {
+ echo "$failed failed." . LB;
+}
+
+if ($failed > 0) {
+ echo 'Test failed!
';
+ echo 'Warning! Your Geeklog site is not set up properly. Please fix the errors listed above!
';
+ echo 'Note: If the above instructions tell you to chmod files and/or directories to 775 but they already are at 775, try chmod 777 instead.
';
+} else {
+ echo 'Test passed
';
+ echo 'Congratulations! Your Geeklog site is set up properly and ready to go.
';
+}
+
+echo '' . LB;
+echo '' . LB;
+
+?>
diff -ruN 1.3.11sr1/admin/install/configinfo.php 1.4.0sr5-1/admin/install/configinfo.php
--- 1.3.11sr1/admin/install/configinfo.php 1969-12-31 18:00:00.000000000 -0600
+++ 1.4.0sr5-1/admin/install/configinfo.php 2006-08-08 02:39:06.000000000 -0500
@@ -0,0 +1,91 @@
+
+*
+*/
+
+if (file_exists ('../../../config.php')) {
+ require_once('../../../config.php');
+} else if (file_exists ('../../lib-common.php')) {
+ require_once('../../lib-common.php');
+} else {
+ die ("Sorry, config.php not found ...");
+}
+
+$highlight_on = '#EFEFEF';
+$highlight_off = '#D9D9D9';
+
+if (isset ($_CONF['site_url']) &&
+ strpos ($_CONF['site_url'], 'example.com') === false) {
+ $docs = $_CONF['site_url'] . '/docs/config.html#desc_';
+} else {
+ $docs = '../../docs/config.html#desc_';
+}
+
+$display = "\nconfig.php\n\n";
+$n = 0;
+$display .= '';
+
+foreach($_CONF as $option => $value) {
+ $display .= '';
+ } else {
+ $display .= ' style="background-color: ' . $highlight_off . '">';
+ }
+ $display .= '| $_CONF[\'' . $option . '\'] | ';
+ if (is_array($value)) {
+ ob_start();
+ print_r($value);
+ $value=nl2br(ob_get_contents());
+ ob_end_clean();
+ } elseif (is_bool ($value)) {
+ $value = ($value === false) ? 'false' : 'true';
+ } elseif (eregi('[a-z]+html', $option)) {
+ $value = htmlentities($value);
+ } elseif (!isset($value)) {
+ $value = ' ';
+ }
+ $display .= '' . $value . ' | ';
+ $display .= '
';
+ $n++;
+}
+$display .= "
\n\n";
+
+echo $display;
diff -ruN 1.3.11sr1/admin/install/info.php 1.4.0sr5-1/admin/install/info.php
--- 1.3.11sr1/admin/install/info.php 1969-12-31 18:00:00.000000000 -0600
+++ 1.4.0sr5-1/admin/install/info.php 2006-08-08 02:39:06.000000000 -0500
@@ -0,0 +1 @@
+
diff -ruN 1.3.11sr1/admin/install/install.php 1.4.0sr5-1/admin/install/install.php
--- 1.3.11sr1/admin/install/install.php 1969-12-31 18:00:00.000000000 -0600
+++ 1.4.0sr5-1/admin/install/install.php 2006-08-08 02:39:06.000000000 -0500
@@ -0,0 +1,951 @@
+ 4) || (($phpv[0] == 4) && ($phpv[1] > 0)) ||
+ (($phpv[0] == 4) && ($phpv[1] == 0) && ($phpv[2] > 4))) {
+ $mysqlv = mysql_get_server_info();
+ }
+
+ if (!empty ($mysqlv)) {
+ preg_match ('/^([0-9]+).([0-9]+).([0-9]+)/', $mysqlv, $match);
+ $mysqlmajorv = $match[1];
+ $mysqlminorv = $match[2];
+ $mysqlrev = $match[3];
+ } else {
+ $mysqlmajorv = 0;
+ $mysqlminorv = 0;
+ $mysqlrev = 0;
+ }
+ mysql_close ();
+
+ return array ($mysqlmajorv, $mysqlminorv, $mysqlrev);
+}
+
+/**
+* Shows welcome page and gets location of /path/to/geeklog/. NOTE: this
+* Doesn't use the template class because we need to know the path to geeklog
+* before we can include it.
+*
+*/
+function INST_welcomePage()
+{
+ global $_DB_dbms;
+
+ $retval = '';
+
+ $retval .= '' . LB;
+ $retval .= '' . LB;
+ $retval .= '' . LB;
+ $retval .= 'Geeklog ' . VERSION . ' Installation' . LB;
+ $retval .= '' . LB;
+ $retval .= '' . LB;
+
+ // check the minimum requirements
+
+ $phpv = php_v ();
+ if (($phpv[0] < 4) || (($phpv[0] == 4) && ($phpv[1] < 1))) {
+ $retval .= 'PHP 4.1.0 required
' . LB;
+ $retval .= 'Sorry, but Geeklog now requires at least PHP 4.1.0 to run. Please upgrade your PHP install or ask your hosting service to do it for you.
' . LB;
+ $retval .= '' . LB . '' . LB;
+
+ return $retval;
+ }
+
+ if ($_DB_dbms == 'mysql') {
+ $myv = mysql_v ();
+ if (($myv[0] < 3) || (($myv[0] == 3) && ($myv[1] < 23)) ||
+ (($myv[0] == 3) && ($myv[1] == 23) && ($myv[2] < 2))) {
+ $retval .= 'MySQL 3.23.2 required
' . LB;
+ $retval .= 'Sorry, but Geeklog now requires at least MySQL 3.23.2 to run. Please upgrade your MySQL install or ask your hosting service to do it for you.
' . LB;
+ $retval .= '