21 $hash_data = @explode(
"-", $_COOKIE[
'xo_install_user'], 2);
22 list(
$uname, $hash_login) = array($hash_data[0], strval( @$hash_data[1] ));
23 if (empty(
$uname) || empty($hash_login)) {
31 $myts = MyTextsanitizer::getInstance();
32 if (is_object(
$GLOBALS[
'xoops']) && method_exists(
$GLOBALS[
'xoops'],
'acceptUser')) {
45 @chmod(XOOPS_ROOT_PATH .
"/mainfile.php", 0444);
47 @chmod(XOOPS_VAR_PATH .
"/data/secure.php", 0444);
57 $value =
$myts->htmlspecialchars($value, ENT_QUOTES);
58 echo
"<label class='xolabel' for='$name'>$label</label>\n";
60 echo
'<div class="xoform-help">' . $help .
"</div>\n";
62 if ( $name ==
"adminname" ) {
63 echo
"<input type='text' name='$name' id='$name' value='$value' maxlength='25' />";
65 echo
"<input type='text' name='$name' id='$name' value='$value' />";
74 $value =
$myts->htmlspecialchars( $value, ENT_QUOTES );
75 echo
"<label class='xolabel' for='{$name}'>{$label}</label>\n";
77 echo
'<div class="xoform-help">' . $help .
"</div>\n";
80 if ($name ==
"adminpass") {
81 echo
"<input type='password' name='{$name}' id='{$name}' value='{$value}' onkeyup='passwordStrength(this.value)' />";
83 echo
"<input type='password' name='{$name}' id='{$name}' value='{$value}' />";
111 $classes = array(-1 =>
'error', 0 =>
'warning', 1 =>
'success');
116 return '<span class="' . $classes[
$status] .
'">' . $str .
'</span>';
121 $setting = strtolower(ini_get($name));
122 $setting = (empty($setting) || $setting ==
'off' || $setting ==
'false') ?
false :
true;
123 if ($setting == $wanted) {
124 return xoDiag(1, $setting ?
'ON' :
'OFF');
126 return xoDiag($severe ? -1 : 0, $setting ?
'ON' :
'OFF');
134 if (!is_dir(
$path)) {
135 if (file_exists(
$path)) {
148 if (version_compare(phpversion(),
'5.2.0',
'>=')) {
149 return xoDiag(1, phpversion());
150 }
else if (version_compare(phpversion(),
'5.1.0',
'>=')) {
151 return xoDiag(0, phpversion());
153 return xoDiag(-1, phpversion());
171 return '<span class="pathmessage"><img src="img/yes.png" alt="Success" />' .
$msg .
'</span>';
184 return '<span class="pathmessage"><img src="img/no.png" alt="Error" /> ' .
$msg .
'</span>';
190 static $charsets = array();
191 if ($charsets)
return $charsets;
193 $charsets[
"utf8"] =
"UTF-8 Unicode";
194 $ut8_available =
false;
195 if (
$result = mysql_query(
"SHOW CHARSET", $link)) {
196 while ($row = mysql_fetch_assoc(
$result)) {
197 $charsets[$row[
"Charset"]] = $row[
"Description"];
198 if ($row[
"Charset"] ==
"utf8") {
199 $ut8_available =
true;
203 if (!$ut8_available) {
204 unset($charsets[
"utf8"]);
212 static $collations = array();
213 if (!empty($collations[$charset])) {
214 return $collations[$charset];
217 if (
$result = mysql_query(
"SHOW COLLATION WHERE CHARSET = '" . mysql_real_escape_string($charset) .
"'", $link)) {
218 while ($row = mysql_fetch_assoc(
$result)) {
219 $collations[$charset][$row[
"Collation"]] = $row[
"Default"] ? 1 : 0;
223 return $collations[$charset];
230 if (empty($charset)) {
233 if (version_compare(mysql_get_server_info($link),
"4.1.0",
"lt")) {
234 $charset = $collation =
"";
236 if (empty($charset) && empty($collation)) {
241 if (!isset($charsets[$charset])) {
243 }
else if (!empty($collation)) {
245 if (!isset($collations[$collation])) {
255 if (version_compare(mysql_get_server_info($link),
"4.1.0",
"lt")) {
258 if (empty($charset) || !$collations =
getDbCollations($link, $charset)) {
265 $value =
$myts->htmlspecialchars($value, ENT_QUOTES);
267 $field =
"<label class='xolabel' for='{$name}'>{$label}</label>\n";
269 $field .=
'<div class="xoform-help">' . $help .
"</div>\n";
271 $field .=
"<select name='{$name}' id='{$name}'\">";
273 $collation_default =
"";
275 foreach ($collations as $key => $isDefault) {
277 $collation_default = $key;
280 $options .=
"<option value='{$key}'" . (($value == $key) ?
" selected='selected'" :
"") .
">{$key}</option>";
282 if ($collation_default) {
283 $field .=
"<option value='{$collation_default}'" . ( ($value == $collation_default || empty($value)) ?
" 'selected'" :
"" ) .
">{$collation_default} (Default)</option>";
286 $field .=
"</select>";
293 $block =
'<div id="' . $name .
'_div">';
303 if (version_compare(mysql_get_server_info($link),
"4.1.0",
"lt")) {
311 if (isset($chars[
"utf8"])) {
312 $charsets[
"utf8"] = $chars[
"utf8"];
313 unset ($chars[
"utf8"]);
316 $charsets = array_merge($charsets, $chars);
321 $value =
$myts->htmlspecialchars($value, ENT_QUOTES);
323 $field =
"<label class='xolabel' for='{$name}'>{$label}</label>\n";
325 $field .=
'<div class="xoform-help">' . $help .
"</div>\n";
327 $field .=
"<select name='{$name}' id='{$name}' onchange=\"setFormFieldCollation('DB_COLLATION_div', this.value)\">";
328 $field .=
"<option value=''>None</option>";
329 foreach ($charsets as $key => $desc) {
330 $field .=
"<option value='{$key}'" . (($value == $key) ?
" selected='selected'" :
"") .
">{$key} - {$desc}</option>";
332 $field .=
"</select>";
342 function xoPutLicenseKey($system_key, $licensefile, $license_file_dist =
'license.dist.php')
344 chmod($licensefile, 0777);
345 $fver = fopen($licensefile,
'w');
346 $fver_buf = file($license_file_dist);
347 foreach ($fver_buf as $line => $value) {
348 if (strpos($value,
'XOOPS_LICENSE_KEY') > 0) {
349 $ret =
'define(\'XOOPS_LICENSE_KEY\', \'' . $system_key .
"');";
356 chmod($licensefile, 0444);
357 return "Written XOOPS " .
XOOPS_LICENSE_CODE .
" License Key: <strong>{$system_key}</strong>";
366 $xoops_serdat = array();
367 srand((((
float)(
'0' . substr(microtime(), strpos(microtime(),
' ') + 1, strlen(microtime()) - strpos(microtime(),
' ') + 1))) * mt_rand(30, 99999)));
368 srand((((
float)(
'0' . substr(microtime(), strpos(microtime(),
' ') + 1, strlen(microtime()) - strpos(microtime(),
' ') + 1))) * mt_rand(30, 99999)));
369 $checksums = array(1 =>
'md5', 2 =>
'sha1');
371 $func = $checksums[
$type];
377 $xoops_serdat[
'version'] = substr($xoops_serdat[
'version'],0, 6);
380 $xoops_serdat[
'licence'] = substr($xoops_serdat[
'licence'],0, 2);
383 $xoops_serdat[
'license_text'] = substr($xoops_serdat[
'license_text'],0, 2);
386 if ($xoops_serdat[
'domain_host'] = $func(
$_SERVER[
'HTTP_HOST'])) {
387 $xoops_serdat[
'domain_host'] = substr($xoops_serdat[
'domain_host'],0, 2);
391 $xoops_serdat[
'file'] = $func(__FILE__);
392 $xoops_serdat[
'basename'] = $func(basename(__FILE__));
393 $xoops_serdat[
'path'] = $func(dirname(__FILE__));
395 foreach (
$_SERVER as $key => $data) {
396 $xoops_serdat[$key] = substr($func(serialize($data)),0, 4);
399 foreach ($xoops_serdat as $key => $data){
402 while (strlen($xoops_key) > 40) {
403 $lpos = rand(18, strlen($xoops_key));
404 $xoops_key = substr($xoops_key, 0, $lpos).substr($xoops_key, $lpos + 1 , strlen($xoops_key) - ($lpos + 1));
419 $strip = floor(strlen($xoops_key) / 6);
420 for (
$i = 0;
$i < strlen($xoops_key);
$i++) {
424 $ret .= substr($xoops_key,
$i, 1) .
'-';
427 if (substr($xoops_key,
$i, 1) !=
'-') {
428 $ret .= substr($xoops_key,
$i, 1);
435 $ret = str_replace(
'--',
'-',
$ret);
436 if (substr(
$ret, 0, 1) ==
'-') {
439 if (substr(
$ret, strlen(
$ret) - 1, 1) ==
'-') {