1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
|
<?php
if(file_exists("./lib/adressbuch.lock")) die("please delete /acp/lib/adressbuch.lock to unlock installation");
@//error_reporting(7);
@set_time_limit(0);
@set_magic_quotes_runtime(0);
$phpversion = phpversion();
$noerror=0;
/** get function libary **/
require("./lib/functions.php");
require("./lib/admin_functions.php");
if(version_compare($phpversion, "4.1.0")==-1) {
$_REQUEST=array_merge($HTTP_COOKIE_VARS,$HTTP_POST_VARS,$HTTP_GET_VARS);
$_COOKIE=&$HTTP_COOKIE_VARS;
$_SERVER=&$HTTP_SERVER_VARS;
$_FILES=&$HTTP_POST_FILES;
$_GET=&$HTTP_GET_VARS;
$_POST=&$HTTP_POST_VARS;
}
// remove slashes in get post cookie data...
if (get_magic_quotes_gpc()) {
if(is_array($_REQUEST)) $_REQUEST=stripslashes_array($_REQUEST);
if(is_array($_POST)) $_POST=stripslashes_array($_POST);
if(is_array($_GET)) $_GET=stripslashes_array($_GET);
if(is_array($_COOKIE)) $_COOKIE=stripslashes_array($_COOKIE);
}
// Seite ausgeben
function informationPage($content, $title="") {
echo '<?xml version="1.0" encoding="windows-1252"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="de" xml:lang="de">
<head>
<ti[COLOR=red][B]<x>[/B][/COLOR]tle>' . $title . '</title>
<li[COLOR=red][B]<x>[/B][/COLOR]nk rel="stylesheet" href="css/other.css" />
</head>
<body>
<table align="center" width="500">
<tr>
<td align="center"><img src="images/acp-logo.gif" border="0" alt="" /></td>
</tr>
<tr>
<td><br /><br />' . $content . '</td>
</tr>
</table>
</body>
</html>';
}
// start setup
if(isset($_REQUEST['step'])) $step=intval($_REQUEST['step']);
else $step=0;
if(isset($_REQUEST['loop'])) $loop=intval($_REQUEST['loop']);
else $loop=0;
if($loop<0) $loop=0;
// start page
if($step == 0) {
informationPage('<p align="center"><b>Herzlich Willkommen bei der Installation vom <b>Adressbuch 1.0.0</b></b><br /><br />
Bitte wählen Sie eine Installationsart.<br />
<form name="auswahl" method="post" action="setup.php">
<select name="step">
<option value="0">Bitte wählen Sie eine Installationsart:</option>
<option value="1">Neuinstallation</option>
</select> <input type="submit" value="Fortfahren" />
</form></p>');
}
if($step == 1) {
require("./lib/config.inc.php");
require("./lib/class_db_mysql.php");
require("./lib/class_query.php");
$db = new db($sqlhost,$sqluser,$sqlpassword,$sqldb,$phpversion);
$fp = fopen("./adressbuch.sql", "rb");
$query=fread($fp, filesize("./adressbuch.sql"));
fclose($fp);
if($n!=1) $query=str_replace("bb1_","bb".$n."_",$query);
$sql_query = new query($query);
$sql_query->doquery();
informationPage('<p align="center"><b>Neue Datenbankstruktur wurde erfolgreich in die Datenbank geschrieben</b><br /><br />
<a href="setup.php?step=2">Klicken Sie hier, um die Installation fortzusetzen.</a></p>');
}
elseif($step == 2) {
require("./lib/config.inc.php");
require("./lib/class_db_mysql.php");
$db = new db($sqlhost,$sqluser,$sqlpassword,$sqldb,$phpversion);
require("./lib/class_variableimport.php");
$variableimport = new variableimport("./adressbuch.wbb");
if($variableimport->errors()) informationPage('Es sind Fehler beim lesen der Variabelndatei aufgetreten: <br />'.$variableimport->getErrors().'<br />');
else {
$variableimport->import();
if($variableimport->errors()) diewitherror("Ungültige Variablendatei: ".$variableimport->getErrors());
}
informationPage('<p align="center">Neue ACP Optionen wurden erfolgreich erstellt.<br /><br />
<a href="setup.php?step=3">Klicken Sie hier, um das Sprachpaket fürs Adressbuch zu importieren</a></p>');
}
// Sprachvariabeln in Languagepack einfügen
elseif($step == 3) {
require("./lib/config.inc.php");
require("./lib/class_db_mysql.php");
$db = new db($sqlhost,$sqluser,$sqlpassword,$sqldb,$phpversion);
$lngdata = readlngfile("./adressbuch.lng", 1);
$languagepacks = array();
$cats = array();
$result = $db->query("SELECT languagepackid FROM bb".$n."_languagepacks");
while($row=$db->fetch_array($result)) $languagepacks[]=$row['languagepackid'];
if(count($lngdata['cats'])) {
$where="";
foreach($lngdata['cats'] as $cat) {
$db->unbuffered_query("INSERT IGNORE INTO bb".$n."_languagecats (catname) VALUES ('".addslashes($cat)."')");
$where.=",'".addslashes($cat)."'";
}
$cats=array();
$result=$db->query("SELECT catid,catname FROM bb".$n."_languagecats WHERE catname IN(".substr($where,1).")");
while($row=$db->fetch_array($result)) $cats[$row['catname']]=$row['catid'];
}
foreach($languagepacks as $languagepackid) {
if(count($lngdata['items'])) {
$insert_str="";
foreach($lngdata['items'] as $cat=>$itemarray) {
$showorder=1;
foreach($itemarray as $itemname=>$item) {
$insert_str.=",('".$languagepackid."','".$cats[$cat]."', '".addslashes($itemname)."', '".addslashes($item)."', '".$showorder."')";
$showorder++;
}
}
if($insert_str) $db->unbuffered_query("REPLACE INTO bb".$n."_languages (languagepackid,catid,itemname,item,showorder) VALUES ".substr($insert_str,1), 1);
foreach($cats as $catname=>$catid) updateCache($languagepackid, $catid);
}
}
informationPage('<p align="center">Die neuen Sprachvariabeln wurden erfolgreich hinzugefügt.
<br /><br /><a href="setup.php?step=6">Klicken Sie hier, um die Installation fortzusetzen.</a></p>');
}
elseif($step == 4) {
/** search for templates to compile */
if (isset($_REQUEST['tplname'])) $tplname = trim($_REQUEST['tplname']);
else $tplname = "";
if ($tplname && file_exists()) {
$templates = array($tplname);
}
else {
$templates = array();
$handle = opendir("./templates");
while ($file = readdir($handle)) {
if ($file == ".." || $file == "." || substr($file, - 3) != "htm") continue;
$templates[] = substr($file, 0, - 1*strlen(strrchr($file, ".")));
}
closedir($handle);
unset($handle);
sort($templates);
}
flush();
/** compile these templates */
if (count($templates) > $loop * $perloop) {
// informationPage('<p align="center"><b>Cache ACP-Templates</b><br /></p>');
flush(); //
$count = 0;
include_once("./lib/class_templateparser.php");
$tplparser = new TemplateParser();
for ($i = $loop * $perloop; $i < (($loop + 1) * $perloop) && $i < count($templates); $i++) {
$templatename = $templates[$i];
//echo "<font face='Tahoma' size='2'>cache ACP-Template '$templatename' ...</font><br>\n";
flush();
//informationPage('<p align="center">cache ACP-Template '$templatename' ...</p>');
$fp = fopen("./templates/".$templatename.".htm", "rb");
$template = fread($fp, filesize("./templates/".$templatename.".htm"));
fclose($fp);
$template = dos2unix($template);
$template = $tplparser->parse($template);
$fp = fopen("../cache/templates/acp/".$templatename.".php", "w+b");
fwrite($fp, "<?php
/*
templatepackid: acp template
templatename: ".$templatename."
*/
\$this->templates['acp_".$templatename."']=\"".addcslashes($template, "$\"\\")."\";
?".">");
fclose($fp);
@chmod("../cache/templates/acp/".$templatename.".php", 0777);
@touch("../cache/templates/acp/".$templatename.".php", filemtime("./templates/".$templatename.".htm"));
$count++;
if ($count == $perloop) break;
}
// redirect to next loop
$loop++;
informationPage('<p align="center">Die ACP-Templates wurden erfolgreich gecacht.
<br /><br /><a href="setup.php?step=6">Klicken Sie hier, um die Installation fortzusetzen.</a></p>');
//exit();
}
}
// Ende der Installation
elseif($step == 6) {
$fp=@fopen("./lib/adressbuch.lock", "w+b");
fclose($fp);
require("./lib/config.inc.php");
require("./lib/class_db_mysql.php");
require("./lib/class_query.php");
$db = new db($sqlhost,$sqluser,$sqlpassword,$sqldb,$phpversion);
require ("./lib/class_options.php");
$option=new options("lib");
$option->write();
informationPage('<p align="center"><b>Die Installation vom Adressbuch 1.0.0 ist erfolgreich abgeschlossen.</b><br /> Sie sollten die Dateien "<b>setup.php, adressbuch.wbb, adressbuch.lng und adressbuch.sql</b>" jetzt vom Server enfernen.
<br /><br /><br /><a href="acp_tpl.php" target="_self">Klicken Sie hier, um die ACP - Templates zu cachen</a>
<br />oder<br />
<a href="index.php" target="_self">Klicken Sie hier, um in das ACP zu gelangen <b>ohne</b> die ACP Templates zu cachen</a></p>');
}
?> |