equal
deleted
inserted
replaced
37 define('contentPath', $sp); |
37 define('contentPath', $sp); |
38 } |
38 } |
39 global $_starttime, $this_page, $sideinfo; |
39 global $_starttime, $this_page, $sideinfo; |
40 $_starttime = microtime(true); |
40 $_starttime = microtime(true); |
41 |
41 |
42 define('ENANO_ROOT', dirname(__FILE__)); |
42 // Determine directory (special case for development servers) |
|
43 if ( strpos(__FILE__, '/repo/') && file_exists('.enanodev') ) |
|
44 { |
|
45 $filename = str_replace('/repo/', '/', __FILE__); |
|
46 } |
|
47 else |
|
48 { |
|
49 $filename = __FILE__; |
|
50 } |
|
51 |
|
52 define('ENANO_ROOT', dirname($filename)); |
43 |
53 |
44 function is_page($p) { return true; } |
54 function is_page($p) { return true; } |
45 require('includes/wikiformat.php'); |
55 require('includes/wikiformat.php'); |
46 require('includes/constants.php'); |
56 require('includes/constants.php'); |
47 require('includes/rijndael.php'); |
57 require('includes/rijndael.php'); |
700 exit; |
710 exit; |
701 } |
711 } |
702 unset($_POST['_cont']); |
712 unset($_POST['_cont']); |
703 require('config.php'); |
713 require('config.php'); |
704 $aes = new AESCrypt(AES_BITS, AES_BLOCKSIZE); |
714 $aes = new AESCrypt(AES_BITS, AES_BLOCKSIZE); |
|
715 if ( isset($crypto_key) ) |
|
716 { |
|
717 $cryptkey = $crypto_key; |
|
718 } |
705 if(!isset($cryptkey) || ( isset($cryptkey) && strlen($cryptkey) != AES_BITS / 4) ) |
719 if(!isset($cryptkey) || ( isset($cryptkey) && strlen($cryptkey) != AES_BITS / 4) ) |
706 { |
720 { |
707 $cryptkey = $aes->gen_readymade_key(); |
721 $cryptkey = $aes->gen_readymade_key(); |
708 $handle = @fopen(ENANO_ROOT.'/config.php', 'w'); |
722 $handle = @fopen(ENANO_ROOT.'/config.php', 'w'); |
709 if(!$handle) |
723 if(!$handle) |
978 |
992 |
979 $cacheonoff = is_writable(ENANO_ROOT.'/cache/') ? '1' : '0'; |
993 $cacheonoff = is_writable(ENANO_ROOT.'/cache/') ? '1' : '0'; |
980 |
994 |
981 echo 'Decrypting administration password...'; |
995 echo 'Decrypting administration password...'; |
982 require('config.php'); |
996 require('config.php'); |
|
997 if ( !isset($cryptkey) ) |
|
998 { |
|
999 echo 'failed!<br />Cannot get the key from config.php'; |
|
1000 break; |
|
1001 } |
983 $aes = new AESCrypt(AES_BITS, AES_BLOCKSIZE); |
1002 $aes = new AESCrypt(AES_BITS, AES_BLOCKSIZE); |
984 $key = $aes->hexToByteArray($cryptkey); |
1003 $key = $aes->hexToByteArray($cryptkey); |
985 $enc = $aes->hexToByteArray($_POST['crypt_data']); |
1004 $enc = $aes->hexToByteArray($_POST['crypt_data']); |
986 $dec = $aes->rijndaelDecrypt($enc, $key, 'ECB'); |
1005 $dec = $aes->rijndaelDecrypt($enc, $key, 'ECB'); |
987 $dec = $aes->byteArrayToString($dec); |
1006 $dec = $aes->byteArrayToString($dec); |