PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/html/modules/altsys/setup_xoops_trust_path.php

http://xoopscube-modules.googlecode.com/
PHP | 65 lines | 50 code | 10 blank | 5 comment | 15 complexity | c5a2ea0625ff87fd72a129dca161c7ca MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, AGPL-1.0
  1. <?php
  2. $xoopsOption['nocommon'] = 1 ;
  3. define('_LEGACY_PREVENT_LOAD_CORE_',1) ;
  4. include '../../mainfile.php' ;
  5. if( defined( 'XOOPS_TRUST_PATH' ) && XOOPS_TRUST_PATH != '' && file_exists( XOOPS_TRUST_PATH.'/libs/altsys' ) ) {
  6. die( 'No problem with your XOOPS_TRUST_PATH' ) ;
  7. }
  8. // show the hint if password mathes
  9. $hint = '' ;
  10. if( @$_POST['dbpassword'] == XOOPS_DB_PASS ) {
  11. // find XOOPS_TRUST_PATH
  12. $xoops_trust_path = '' ;
  13. $base_dirs = array( XOOPS_ROOT_PATH , dirname(XOOPS_ROOT_PATH) , dirname(dirname(XOOPS_ROOT_PATH )) ) ;
  14. foreach( $base_dirs as $base_dir ) {
  15. $dh = @opendir( $base_dir ) ;
  16. if( ! empty( $dh ) ) {
  17. while( ( $file = readdir( $dh ) ) !== false ) {
  18. if( substr( $file , 0 , 1 ) == '.' ) continue ;
  19. $fullpath = $base_dir . '/' . $file ;
  20. if( ! is_dir( $fullpath ) ) continue ;
  21. if( is_dir( $fullpath.'/libs/altsys' ) ) {
  22. $xoops_trust_path = $fullpath ;
  23. break 2 ;
  24. }
  25. }
  26. }
  27. }
  28. // fall back
  29. if( empty( $xoops_trust_path ) ) {
  30. $xoops_trust_path = dirname(XOOPS_ROOT_PATH).'/xoops_trust_path' ;
  31. }
  32. // create the hint
  33. if( ! defined( 'XOOPS_TRUST_PATH' ) ) {
  34. $hint = "Insert the red line.<br />define('XOOPS_ROOT_PATH', '".htmlspecialchars(XOOPS_ROOT_PATH,ENT_QUOTES)."');<br /><ins style='color:red;'>define('XOOPS_TRUST_PATH', '".htmlspecialchars($xoops_trust_path,ENT_QUOTES)."');</ins>";
  35. } else {
  36. $hint = "<del>define('XOOPS_TRUST_PATH', '');</del><br /><ins style='color:red;'>define('XOOPS_TRUST_PATH', '".htmlspecialchars($xoops_trust_path,ENT_QUOTES)."');</ins>";
  37. }
  38. }
  39. // default form
  40. ?>
  41. <html>
  42. <head>
  43. <title>set up XOOPS_TRUST_PATH</title>
  44. </head>
  45. <body>
  46. <h1>Set up XOOPS_TRUST_PATH</h1>
  47. <p>You missed inserting a line defining XOOPS_TRUST_PATH in mainfile.php</p>
  48. <p>Insert it by yourself, or follow the procedures</p>
  49. <form action="" method="post">
  50. Your MySQL Password:<input type="password" name="dbpassword" size="16" />
  51. <input type="submit" value="next" />
  52. </form>
  53. <?php if($hint) echo 'Edit mainfile.php like this: <blockquote style="border: black solid 1px;">'.$hint.'</blockquote>' ?>
  54. </body>
  55. </html>