337 } |
337 } |
338 |
338 |
339 return true; |
339 return true; |
340 } |
340 } |
341 |
341 |
|
342 function stg_aes_cleanup() |
|
343 { |
|
344 global $db, $session, $paths, $template, $plugins; // Common objects |
|
345 $q = $db->sql_query('DELETE FROM ' . table_prefix . 'config WHERE config_name = \'install_aes_key\' OR config_name = \'site_aes_key\';'); |
|
346 if ( !$q ) |
|
347 $db->_die(); |
|
348 return true; |
|
349 } |
|
350 |
|
351 function _stg_rename_config_revert() |
|
352 { |
|
353 if ( file_exists('./config.php') ) |
|
354 { |
|
355 @rename('./config.php', './config.new.php'); |
|
356 } |
|
357 |
|
358 $handle = @fopen('./config.php.new', 'w'); |
|
359 if ( !$handle ) |
|
360 return false; |
|
361 $contents = '<?php $cryptkey = \'' . _INSTRESUME_AES_KEYBACKUP . '\'; ?>'; |
|
362 fwrite($handle, $contents); |
|
363 fclose($handle); |
|
364 return true; |
|
365 } |
|
366 |
|
367 function stg_build_index() |
|
368 { |
|
369 global $db, $session, $paths, $template, $plugins; // Common objects |
|
370 if ( $paths->rebuild_search_index() ) |
|
371 return true; |
|
372 return false; |
|
373 } |
|
374 |
|
375 function stg_rename_config() |
|
376 { |
|
377 if ( !@rename(ENANO_ROOT . '/config.new.php', ENANO_ROOT . '/config.php') ) |
|
378 { |
|
379 echo '<p>Can\'t rename config.php</p>'; |
|
380 _stg_rename_config_revert(); |
|
381 return false; |
|
382 } |
|
383 |
|
384 if ( filesize(ENANO_ROOT . '/.htaccess.new') > 1 ) |
|
385 { |
|
386 // rename/possibly concatenate .htaccess.new |
|
387 $htaccess_base = ''; |
|
388 if ( file_exists(ENANO_ROOT . '/.htaccess') ) |
|
389 $htaccess_base .= @file_get_contents(ENANO_ROOT . '/.htaccess'); |
|
390 if ( strlen($htaccess_base) > 0 && !preg_match("/\n$/", $htaccess_base) ) |
|
391 $htaccess_base .= "\n\n"; |
|
392 $htaccess_base .= @file_get_contents(ENANO_ROOT . '/.htaccess.new'); |
|
393 if ( file_exists(ENANO_ROOT . '/.htaccess') ) |
|
394 { |
|
395 $hh = @fopen(ENANO_ROOT . '/.htaccess', 'w'); |
|
396 if ( !$hh ) |
|
397 return false; |
|
398 fwrite($hh, $htaccess_base); |
|
399 fclose($hh); |
|
400 @unlink(ENANO_ROOT . '/.htaccess.new'); |
|
401 return true; |
|
402 } |
|
403 else |
|
404 { |
|
405 return @rename(ENANO_ROOT . '/.htaccess.new', ENANO_ROOT . '/.htaccess'); |
|
406 } |
|
407 } |
|
408 else |
|
409 { |
|
410 @unlink(ENANO_ROOT . '/.htaccess.new'); |
|
411 } |
|
412 return true; |
|
413 } |
|
414 |