| [ PHPXref.com ] | [ Generated: Sun Jul 20 16:22:48 2008 ] | [ 4images 1.7.4 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /************************************************************************** 3 * * 4 * 4images - A Web Based Image Gallery Management System * 5 * ---------------------------------------------------------------- * 6 * * 7 * File: update_1.5_to_1.6.php * 8 * Copyright: (C) 2002 Jan Sorgalla * 9 * Email: jan@4homepages.de * 10 * Web: http://www.4homepages.de * 11 * Scriptversion: 1.7.4 * 12 * * 13 * Never released without support from: Nicky (http://www.nicky.net) * 14 * * 15 ************************************************************************** 16 * * 17 * Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- * 18 * bedingungen (Lizenz.txt) für weitere Informationen. * 19 * --------------------------------------------------------------- * 20 * This script is NOT freeware! Please read the Copyright Notice * 21 * (Licence.txt) for further information. * 22 * * 23 *************************************************************************/ 24 25 error_reporting(E_ERROR | E_WARNING | E_PARSE); 26 set_magic_quotes_runtime(0); 27 define('ROOT_PATH', './'); 28 29 if (isset($HTTP_GET_VARS['action']) || isset($HTTP_POST_VARS['action'])) { 30 $action = (isset($HTTP_GET_VARS['action'])) ? trim($HTTP_GET_VARS['action']) : trim($HTTP_POST_VARS['action']); 31 } 32 else { 33 $action = "intro"; 34 } 35 36 @include(ROOT_PATH.'config.php'); 37 38 if (!defined("4IMAGES_ACTIVE")) { 39 header("Location: install.php"); 40 exit; 41 } 42 if ($action == "finish") { 43 header("Location: index.php"); 44 exit; 45 } 46 47 include (ROOT_PATH.'includes/constants.php'); 48 include (ROOT_PATH.'includes/search_utils.php'); 49 include(ROOT_PATH.'includes/db_'.$db_servertype.'.php'); 50 $site_db = new Db($db_host, $db_user, $db_password, $db_name); 51 52 function next_step($action, $msg) { 53 global $PHP_SELF; 54 ?> 55 <br /> 56 <table width="400" border="0" cellspacing="0" cellpadding="1" align="center"> 57 <tr> 58 <td class="tableseparator"> 59 <table width="100%" border="0" cellspacing="0" cellpadding="3"> 60 <tr> 61 <td class="tablerow2" align="center"> 62 <?php echo "Next step: <a href=\"".$PHP_SELF."?action=".$action."\"><b>".$msg."</b></a>\n"; ?> 63 </td> 64 </tr> 65 </table> 66 </td> 67 </tr> 68 </table> 69 <br /> 70 <?php 71 } 72 73 function next_rebuildsearchindex_step($batchstart, $batchsize) { 74 global $PHP_SELF; 75 $page = $PHP_SELF."?action=buildsearchindex&batchstart=".$batchstart."&batchsize=".$batchsize; 76 ?> 77 <script language="javascript"> 78 myvar = ""; 79 timeout = 15; 80 function dorefresh() { 81 window.status="Redirecting"+myvar; 82 myvar = myvar + " ."; 83 timerID = setTimeout("dorefresh();", 100); 84 if (timeout > 0) { 85 timeout -= 1; 86 } 87 else { 88 clearTimeout(timerID); 89 window.status=""; 90 window.location="<?php echo $page; ?>"; 91 } 92 } 93 dorefresh(); 94 </script> 95 <br /> 96 <table border="0" cellspacing="0" cellpadding="1"> 97 <tr> 98 <td class="tableseparator"> 99 <table width="100%" border="0" cellspacing="0" cellpadding="3"> 100 <tr> 101 <td class="tablerow2" align="center"> <a href="<?php echo $page; ?>"><b>Click here to continue</b></a> </td> 102 </tr> 103 </table> 104 </td> 105 </tr> 106 </table> 107 <br /> 108 <?php 109 } 110 111 ?> 112 <html> 113 <head> 114 <meta content="text/html; charset=windows-1252" http-equiv="Content-Type"> 115 <link rel="stylesheet" href="admin/cpstyle.css"> 116 <title>4images Update 1.5 to 1.6</title> 117 </head> 118 <body leftmargin="20" topmargin="20" marginwidth="20" marginheight="20" bgcolor="#FFFFFF"> 119 <table width="400" border="0" cellspacing="0" cellpadding="1" align="center"> 120 <tr> 121 <td> 122 <p align="center"><span class="headline">4images Update 1.5 to 1.6</span></p><br /><br /> 123 <?php 124 if ($action == "intro") { 125 next_step("updatetables", "Update Database Tables"); 126 } 127 128 if ($action == "updatetables") { 129 $ok = 1; 130 $sql_edit = array(); 131 $sql_edit[] = "ALTER TABLE ".IMAGES_TABLE." ADD INDEX (image_date)"; 132 $sql_edit[] = "ALTER TABLE ".IMAGES_TABLE." ADD INDEX (image_active)"; 133 $sql_edit[] = "ALTER TABLE ".USERS_TABLE." ADD user_allowemails TINYINT(1) DEFAULT '1' NOT NULL AFTER user_showemail"; 134 $sql_edit[] = "UPDATE ".USERS_TABLE." SET user_allowemails = 0 WHERE user_id = -1"; 135 $sql_edit[] = "ALTER TABLE ".USERS_TABLE." ADD INDEX (user_name)"; 136 $sql_edit[] = "UPDATE ".SETTINGS_TABLE." SET setting_name = 'convert_tool_path' WHERE setting_name = 'im_convert_path'"; 137 $sql_edit[] = "INSERT INTO ".SETTINGS_TABLE." (setting_name, setting_value) VALUES ('account_activation', '1')"; 138 $sql_edit[] = "INSERT INTO ".SETTINGS_TABLE." (setting_name, setting_value) VALUES ('auto_thumbnail', '0')"; 139 $sql_edit[] = "INSERT INTO ".SETTINGS_TABLE." (setting_name, setting_value) VALUES ('auto_thumbnail_dimension', '100')"; 140 $sql_edit[] = "INSERT INTO ".SETTINGS_TABLE." (setting_name, setting_value) VALUES ('auto_thumbnail_quality', '75')"; 141 $sql_edit[] = "ALTER TABLE ".GROUPS_TABLE." ADD group_type TINYINT(2) DEFAULT '1' NOT NULL"; 142 143 foreach ($sql_edit as $val) { 144 if (!$site_db->query($val)) { 145 $ok = 0; 146 } 147 } 148 149 $sql_edit = array(); 150 $sql_edit[] = "ALTER TABLE ".GROUP_ACCESS_TABLE." DROP INDEX forum_id"; 151 $sql_edit[] = "ALTER TABLE ".GROUP_ACCESS_TABLE." ADD INDEX (cat_id)"; 152 153 $result = $site_db->query("SHOW KEYS FROM ".GROUP_ACCESS_TABLE); 154 $index = array(); 155 while ($row = $site_db->fetch_array($result)) { 156 $index[$row['Key_name']] = 1; 157 } 158 159 if (isset($index['forum_id'])) { 160 foreach ($sql_edit as $val) { 161 if (!$site_db->query($val)) { 162 $ok = 0; 163 } 164 } 165 } 166 167 $sql_edit = array(); 168 $sql_edit[] = "ALTER TABLE ".LIGHTBOXES_TABLE." DROP PRIMARY KEY"; 169 $sql_edit[] = "ALTER TABLE ".LIGHTBOXES_TABLE." ADD INDEX (lightbox_id)"; 170 171 $result = $site_db->query("SHOW KEYS FROM ".LIGHTBOXES_TABLE); 172 $index = array(); 173 while ($row = $site_db->fetch_array($result)) { 174 $index[$row['Key_name']] = 1; 175 } 176 177 if (isset($index['PRIMARY']) && !isset($index['lightbox_id '])) { 178 foreach ($sql_edit as $val) { 179 if (!$site_db->query($val)) { 180 $ok = 0; 181 } 182 } 183 } 184 185 if ($ok) { 186 echo "Tables updated succesfully!<br />\n"; 187 } 188 else { 189 echo "<span class=\"marktext\">An error occured while updating tables</b></span><br />\n"; 190 } 191 next_step("starteditsearchindex", "Update Search Index Tables"); 192 } 193 194 if ($action == "starteditsearchindex") { 195 echo "<p>Now we have to update the search index tables. For that we have to empty the search index first. Be sure to have backups of your existing data before continuing. "; 196 echo "Later on we will rebuild the search index...</p>"; 197 next_step("emptyindex", "Empty Search Index"); 198 } 199 200 if ($action == "emptyindex") { 201 $site_db->query("DELETE FROM ".WORDMATCH_TABLE); 202 $site_db->query("DELETE FROM ".WORDLIST_TABLE); 203 $site_db->query("ALTER TABLE ".WORDMATCH_TABLE." DROP INDEX word_id, ADD UNIQUE image_word_id (image_id, word_id)"); 204 $site_db->query("ALTER TABLE ".WORDLIST_TABLE." DROP word_common"); 205 echo "<p><b>Index successfully emptied</b><br />"; 206 echo "<b>Now we will rebuild the search index...</b></p>"; 207 next_step("buildsearchindex", "Rebuild Search Index"); 208 } 209 210 if ($action == "buildsearchindex") { 211 if (isset($HTTP_GET_VARS['batchstart']) || isset($HTTP_POST_VARS['batchstart'])) { 212 $batchstart = (isset($HTTP_GET_VARS['batchstart'])) ? intval($HTTP_GET_VARS['batchstart']) : intval($HTTP_POST_VARS['batchstart']); 213 } 214 else { 215 $batchstart = 0; 216 } 217 218 if (isset($HTTP_GET_VARS['batchsize']) || isset($HTTP_POST_VARS['batchsize'])) { 219 $batchsize = (isset($HTTP_GET_VARS['batchsize'])) ? intval($HTTP_GET_VARS['batchsize']) : intval($HTTP_POST_VARS['batchsize']); 220 if (!$batchsize) { 221 $batchsize = 100; 222 } 223 } 224 else { 225 $batchsize = 100; 226 } 227 228 $sql = "SELECT MAX(image_id) as max 229 FROM ".IMAGES_TABLE; 230 $row = $site_db->query_firstrow($sql); 231 $max = (isset($row['max'])) ? $row['max'] : 0; 232 233 $batchend = $batchstart + $batchsize - 1; 234 if ($batchend >= $max) { 235 $batchend = $max; 236 } 237 238 echo "<b>Fulltext Indexing ($batchstart to $batchend):</b><p>"; 239 240 $sql = "SELECT * 241 FROM ".IMAGES_TABLE." 242 WHERE image_id 243 BETWEEN $batchstart AND $batchend"; 244 $result = $site_db->query($sql); 245 246 while ($row = $site_db->fetch_array($result)) { 247 echo "Processing image <b>".$row['image_name']."</b>, ID ".$row['image_id']." ..."; 248 flush(); 249 @set_time_limit(1200); 250 $search_words = array(); 251 foreach ($search_match_fields as $image_column => $match_column) { 252 if (isset($row[$image_column])) { 253 $search_words[$image_column] = $row[$image_column]; 254 } 255 } 256 add_searchwords($row['image_id'], $search_words); 257 echo " <b>OK</b><br />\n"; 258 } 259 if ($batchend < $max) { 260 next_rebuildsearchindex_step($batchend + 1, $batchsize); 261 } 262 else { 263 echo "<p><b>Search index rebuilt!</b><p>\n"; 264 next_step("finish", "Update complete"); 265 } 266 } 267 ?> 268 <br /> 269 </td> 270 </tr> 271 </table> 272 <p align="center">Powered by <b>4images</b> <?php echo SCRIPT_VERSION ?><br /> 273 Copyright © 2002 <a href="http://www.4homepages.de" target="_blank">4homepages.de</a> 274 </p> 275 </body> 276 </html>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |