Source for file index.php

Documentation is available at index.php

  1. <?php
  2. /**
  3. * Install instructions
  4. @package Mambo
  5. @author Mambo Foundation Inc see README.php
  6. @copyright Mambo Foundation Inc.
  7. *  See COPYRIGHT.php for copyright notices and details.
  8. @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see
  9. *  LICENSE.php
  10. *  Mambo is free software; you can redistribute it and/or
  11. *  modify it under the terms of the GNU General Public License
  12. *  as published by the Free Software Foundation; version 2 of the
  13. *  License.
  14. */ 
  15. if (!defined('_VALID_MOS')) define'_VALID_MOS');
  16.  
  17. if (file_exists'../configuration.php' && filesize'../configuration.php' 10{
  18.     header"Location: ../index.php" );
  19.     exit();
  20. }
  21. require_once'../includes/version.php' );
  22.  
  23. $_VERSION new version();
  24.  
  25. $version $_VERSION->PRODUCT .' '$_VERSION->RELEASE .'.'$_VERSION->DEV_LEVEL .' '
  26. $_VERSION->DEV_STATUS
  27. .' [ '.$_VERSION->CODENAME .' ] '$_VERSION->RELDATE .' '
  28. $_VERSION->RELTIME .' '$_VERSION->RELTZ;
  29.  
  30. /** Include common.php */
  31. include_once'common.php' );
  32.  
  33. list($tmp_lang,$directionsgetLanguages();
  34. $lang trimmosGetParam$_POST'lang''' ) );
  35. $charset="utf-8";
  36. $text_direction="ltr";
  37. if($lang==''{
  38.     $lang="en";
  39. }else
  40. {
  41.     $str_charset explode(" ",$tmp_lang[$lang]);
  42.     $charset $str_charset[1];
  43.     $text_direction $directions[$lang];
  44.         
  45. }
  46. $filename "langconfig.php";
  47. if(is_writable($filename)) {
  48.     $handle fopen($filename,'w+');
  49.     $content "<?php\n";
  50.     $content.="defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );\n";
  51.     $content .= "\$lang = \"$lang\";\n";
  52.     $content .= "\$charset = \"$charset\";\n";
  53.     $content .= "\$text_direction = \"$text_direction\";\n";
  54.     $content .= "\$gettext =& phpgettext();\n";
  55.     $content .= "\$gettext->debug       = '0';\n";
  56.     $content .= "\$gettext->has_gettext = '0';\n";
  57.     $content .= "\$gettext->setlocale(\$lang);\n";
  58.     $content .= "\$gettext->bindtextdomain(\$lang, 'language/');\n";
  59.     $content .= "\$gettext->textdomain(\$lang);\n";
  60.     $content .= "?>";
  61.     fwrite($handle,$content);
  62.     fclose($handle);
  63. }
  64. include_once'langconfig.php' );
  65. function getLanguages({
  66.         $langfiles glob("language/*.xml");
  67.         $langs array();
  68.         
  69.         foreach($langfiles as $xml{
  70.             if(is_readable($xml)) {
  71.                 $source file_get_contents($xml);
  72.                 $encoding "UTF-8";
  73.                 if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m'$source$m)) {
  74.                     $encoding strtoupper($m[1]);
  75.                 }
  76.                 $parser xml_parser_create("UTF-8");
  77.                 xml_parser_set_option($parserXML_OPTION_TARGET_ENCODING"UTF-8");
  78.                 xml_parser_set_option($parserXML_OPTION_CASE_FOLDING0);
  79.                 xml_parser_set_option($parserXML_OPTION_SKIP_WHITE1);
  80.                 if (!xml_parse_into_struct($parser,$source,$values)) {
  81.                     die(sprintf("XML error: %s at ".$xml." in line %d",
  82.                     xml_error_string(xml_get_error_code($parser)),
  83.                     xml_get_current_line_number($parser)));
  84.                 }
  85.                 xml_parser_free($parser);
  86.                 $flag true;
  87.                 $title "English";
  88.                 foreach($values as $key=>$val{
  89.                     $tag strtolower($val['tag']);
  90.                     if($flag{    
  91.                         if($tag=="locale"{
  92.                             $title $val['attributes']['title'];
  93.                             $text_direction $val['attributes']['text_direction'];
  94.                             $flag false;
  95.                         }
  96.                     }
  97.                 }
  98.                 $name str_replace("language/","",$xml);
  99.                 $name str_replace(".xml","",$name);
  100.                 $langs[$name$title." ".strtolower($encoding);
  101.                 $directions[$name]=$text_direction;
  102.             }
  103.         }
  104.         return Array($langs,$directions);
  105. }
  106.  
  107. function get_php_setting($val{
  108.     $r =  (ini_get($val== '1' 0);
  109.     return $r T_('ON'T_('OFF');
  110. }
  111.  
  112. function writableCell$folder {
  113.     echo '<tr>';
  114.     echo '<td class="item">' $folder '/</td>';
  115.     echo '<td align="left">';
  116.     echo is_writable"../$folder'<b><span class="green">'.T_('Writeable').'</span></b>' '<b><span class="red">'.T_('Unwriteable').'</span></b>' '</td>';
  117.     echo '</tr>';
  118. }
  119.  
  120. echo "<?xml version=\"1.0\" encoding=\"".$charset."\"?".">";
  121. ?>
  122. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  123. <html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $text_direction;?>">
  124. <head>
  125. <title><?php echo T_('Mambo - Web Installer'?></title>
  126. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset?>" />
  127. <link rel="shortcut icon" href="../images/favicon.ico" />
  128. <link rel="stylesheet" href="install<?php if($text_direction=='rtl'echo '_'.$text_direction ?>.css" type="text/css" />
  129. <script type="text/javascript">
  130. <!--
  131. var checkobj
  132. function agreesubmit(el){
  133.     checkobj=el
  134.     if (document.all||document.getElementById){
  135.         for (i=0;i<checkobj.form.length;i++){  //hunt down submit button
  136.         var tempobj=checkobj.form.elements[i]
  137.         if(tempobj.type.toLowerCase()=="submit")
  138.         tempobj.disabled=!checkobj.checked
  139.         }
  140.     }
  141. }
  142.  
  143. function defaultagree(el){
  144.     if (!document.all&&!document.getElementById){
  145.         if (window.checkobj&&checkobj.checked)
  146.         return true
  147.         else{
  148.             alert("<?php echo T_('Please read/accept license to continue installation')?>")
  149.             return false
  150.         }
  151.     }
  152. }
  153. //-->
  154. </script>
  155. </head>
  156. <body>
  157.  
  158. <div id="wrapper">
  159. <div id="header">
  160. <div id="mambo"><img src="header_install.png" alt="<?php echo T_('Mambo Installation'?>" /></div>
  161. </div>
  162. </div>
  163.  
  164. <div id="ctr" align="center">
  165. <div class="install">
  166. <div id="stepbar">
  167. <div class="step-on"><?php echo T_('pre-installation check'?></div>
  168. <div class="step-off"><?php echo T_('license'?></div>
  169. <div class="step-off"><?php echo T_('step 1'?></div>
  170. <div class="step-off"><?php echo T_('step 2'?></div>
  171. <div class="step-off"><?php echo T_('step 3'?></div>
  172. <div class="step-off"><?php echo T_('step 4'?></div>
  173. <div class="far-right">
  174. <input name="Button2" type="submit" class="button" value="<?php echo T_('Next'?> >>" onclick="window.location='install.php';" />
  175. </div>
  176. </div>
  177.  
  178. <div id="right">
  179.  
  180. <div id="step"><?php echo T_('pre-installation check'?></div>
  181. <div id="steposi"></div>
  182.  
  183. <div class="clr"></div>
  184. <h1><?php echo T_('Pre-installation check for:'?><!-- <br/> --> <?php echo $version?></h1>
  185.     <form action="index.php" method="post" name="Langue">
  186.                 <h1><?php echo T_('Mambo installation language'?>:</h1>
  187.                 <div class="install-text"> <?php echo T_('The installer automatically detects your browser language preferences. However, you can select one of the available languages.'?>
  188.                     <div class="ctr"></div>
  189.                 </div>
  190.  
  191.                 <div class="install-form">
  192.                     <div class="form-block">
  193.                         <table class="content">
  194.                             <tr>
  195.                                 <td class="item"> <?php echo T_('Installation language'?> </td>
  196.                                 <td align="left">
  197.                                     <?php
  198.                                     echo '<select size="1" name="lang" onchange="this.form.submit();">';
  199.                                     foreach $tmp_lang as $key=>$lang_found ){
  200.                                         if$key == $lang ){
  201.                                             echo '<option value ="'.$key.'" selected="selected">'.ucfirst($lang_found)."</option>\n";
  202.                                         }else{
  203.                                             echo '<option value ="'.$key.'">'.ucfirst($lang_found)."</option>\n";
  204.                                         }
  205.                                     }
  206.                                     echo '</select>';
  207.                                     ?>
  208.                                 </td>
  209.                             </tr>
  210.                         </table>
  211.                     </div>
  212.                 </div>
  213.                 <div class="install-form">
  214.                     <div class="form-block">
  215.                         <table class="content">
  216.                             <tr>
  217.                                 <td><strong><?php echo T_('Language check'?></strong></td>
  218.                             <tr>
  219.                                 <td><?php echo T_('Installation language'?></td>
  220.                                 <td>
  221.                                     <font color="green"><strong><?php echo ucfirst$tmp_lang[$lang)?></strong></font>
  222.                                 </td>
  223.                             </tr>
  224.                             <tr>
  225.                                 <td>ISO</td>
  226.                                 <td>
  227.                                     <font color="green"><strong><?php echo $charset?></strong></font>
  228.                                 </td>
  229.                             </tr>
  230.                         </table>
  231.                     </div>
  232.                 </div>
  233.             </form>
  234. <div class="clr"></div>
  235. <div class="install-text">
  236. <?php echo T_('If any of these items are highlighted in red then please take actions to correct them. Failure to do so could lead to your Mambo installation not functioning correctly.'?>
  237. <div class="ctr"></div>
  238. </div>
  239.  
  240. <div class="install-form">
  241. <div class="form-block">
  242.  
  243. <table class="content">
  244. <tr>
  245.     <td class="item">
  246.     <?php echo T_('PHP version'?> >= 4.3.0
  247.     </td>
  248.     <td align="left">
  249.     <?php echo phpversion('4.3' '<b><span class="red">'.T_('No').'</span></b>' '<b><span class="green">'.T_('Yes').'</span></b>';?>
  250.     </td>
  251. </tr>
  252. <tr>
  253.     <td>
  254.     &nbsp; - <?php echo T_('zlib compression support'?>
  255.     </td>
  256.     <td align="left">
  257.     <?php echo extension_loaded('zlib''<b><span class="green">'.T_('Available').'</span></b>' '<b><span class="red">'.T_('Unavailable').'</span></b>';?>
  258.     </td>
  259. </tr>
  260. <tr>
  261.     <td>
  262.     &nbsp; - <?php echo T_('XML support'?>
  263.     </td>
  264.     <td align="left">
  265.     <?php echo extension_loaded('xml''<b><span class="green">'.T_('Available').'</span></b>' '<b><span class="red">'.T_('Unavailable').'</span></b>';?>
  266.     </td>
  267. </tr>
  268. <tr>
  269.     <td>
  270.     &nbsp; - <?php echo T_('MySQL support'?>
  271.     </td>
  272.     <td align="left">
  273.     <?php echo function_exists'mysql_connect' '<b><span class="green">'.T_('Available').'</span></b>' '<b><span class="red">'.T_('Unavailable').'</span></b>';?>
  274.     </td>
  275. </tr>
  276. <tr>
  277.     <td>
  278.     &nbsp; - <span class="red"><?php echo T_('Note:'?></span>
  279.     </td>
  280.     <td align="left">
  281.     <?php echo T_('MySQL Strict Mode is not support'?>
  282.     </td>
  283. </tr>
  284. <tr>
  285.     <td valign="top" class="item">
  286.     configuration.php
  287.     </td>
  288.     <td align="left">
  289.     <?php
  290.     if (@file_exists('../configuration.php'&&  @is_writable'../configuration.php' )){
  291.         echo '<b><span class="green">'.T_('Writeable').'</span></b>';
  292.     else if (is_writable'..' )) {
  293.         echo '<b><span class="green">'.T_('Writeable').'</span></b>';
  294.     else {
  295.         echo '<b><span class="red">'.T_('Unwriteable').'</span></b><br /><span class="small">'.T_('You can still continue the install as the configuration will be displayed at the end, just copy & paste this and upload.').'</span>';
  296.     ?>
  297.     </td>
  298. </tr>
  299. <tr>
  300.     <td class="item">
  301.     <?php echo T_('Session save path'?>
  302.     </td>
  303.     <td align="left">
  304.     <b><?php echo (($sp=ini_get('session.save_path'))?$sp:'Not set')?></b>,
  305.     <?php echo is_writable$sp '<b><span class="green">'.T_('Writeable').'</span></b>' '<b><span class="red">'.T_('Unwriteable').'</span></b>';?>
  306.     </td>
  307. </tr>
  308. </table>
  309. </div>
  310. </div>
  311. <div class="clr"></div>
  312.  
  313. <h1><?php echo T_('Recommended settings:'?></h1>
  314. <div class="install-text">
  315. <?php echo T_('These settings are recommended for PHP in order to ensure full compatibility with Mambo. However, Mambo will still operate if your settings do not quite match the recommended.'?>
  316.  
  317. <br />
  318.  
  319.  
  320. <div class="ctr"></div>
  321. </div>
  322.  
  323. <div class="install-form">
  324. <div class="form-block">
  325.  
  326. <table class="content">
  327. <tr>
  328.     <td class="toggle">
  329.     <?php echo T_('Directive'?>
  330.     </td>
  331.     <td class="toggle">
  332.     <?php echo T_('Recommended'?>
  333.     </td>
  334.     <td class="toggle">
  335.     <?php echo T_('Actual'?>
  336.     </td>
  337. </tr>
  338. <?php
  339. $php_recommended_settings array(array ('Safe Mode','safe_mode',T_('OFF')),
  340. array ('Display Errors','display_errors',T_('ON')),
  341. array ('File Uploads','file_uploads',T_('ON')),
  342. array ('Magic Quotes GPC','magic_quotes_gpc',T_('ON')),
  343. array ('Magic Quotes Runtime','magic_quotes_runtime',T_('OFF')),
  344. array ('Register Globals','register_globals',T_('OFF')),
  345. array ('Output Buffering','output_buffering',T_('OFF')),
  346. array ('Session auto start','session.auto_start',T_('OFF')),
  347. );
  348.  
  349. foreach ($php_recommended_settings as $phprec{
  350. ?>
  351. <tr>
  352.     <td class="item"><?php echo $phprec[0]?>:</td>
  353.     <td class="toggle"><?php echo $phprec[2]?>:</td>
  354.     <td>
  355.     <?php
  356.     if get_php_setting($phprec[1]== $phprec[2{
  357.     ?>
  358.         <span class="green"><b>
  359.     <?php
  360.     else {
  361.     ?>
  362.         <span class="red"><b>
  363.     <?php
  364.     }
  365.     echo get_php_setting($phprec[1]);
  366.     ?>
  367.     </b></span>
  368.     <td>
  369. </tr>
  370. <?php
  371. }
  372. ?>
  373. </table>
  374. </div>
  375. </div>
  376. <div class="clr"></div>
  377. <h1><?php echo T_('Directory and File Permissions:'?></h1>
  378. <div class="install-text">
  379. <?php echo T_('In order for Mambo to function correctly it needs to be able to access or write to certain files or directories. If you see "Unwriteable" you need to change the permissions on the file or directory to allow Mambo to write to it.'?>
  380. <div class="clr">&nbsp;&nbsp;</div>
  381. <div class="ctr"></div>
  382. </div>
  383.  
  384. <div class="install-form">
  385. <div class="form-block">
  386.  
  387. <table class="content">
  388. <?php
  389. writableCell'administrator/backups' );
  390. writableCell'administrator/components' );
  391. writableCell'administrator/modules' );
  392. writableCell'administrator/templates' );
  393. writableCell'cache' );
  394. writableCell'components' );
  395. writableCell'images' );
  396. writableCell'images/banners' );
  397. writableCell'images/stories' );
  398. ?>
  399. <tr>
  400.     <td valign="top" class="item">
  401.     installation/langconfig.php
  402.     </td>
  403.     <td align="left">
  404.     <?php
  405.     if (@file_exists('../installation/langconfig.php'&&  @is_writable'../installation/langconfig.php' )){
  406.         echo '<b><span class="green">'.T_('Writeable').'</span></b>';
  407.     else if (is_writable'..' )) {
  408.         echo '<b><span class="green">'.T_('Writeable').'</span></b>';
  409.     else {
  410.         echo '<b><span class="red">'.T_('Unwriteable').'</span></b>';
  411.     ?>
  412.     </td>
  413. </tr>
  414. <?php
  415. writableCell'language' );
  416. writableCell'mambots' );
  417. writableCell'mambots/content' );
  418. writableCell'mambots/editors' );
  419. writableCell'mambots/editors-xtd' );
  420. writableCell'mambots/search' );
  421. writableCell'media' );
  422. writableCell'modules' );
  423. writableCell'templates' );
  424. writableCell'uploadfiles' );
  425. ?>
  426. </table>
  427. </div>
  428. <div class="clr"></div>
  429. </div>
  430. <div class="clr"></div>
  431. </div>
  432. <div class="clr"></div>
  433. </div>
  434. </div>
  435. <div class="ctr">
  436. <?php echo T_('<a href="http://www.mambo-foundation.org" target="_blank">Mambo </a> is Free Software released under the <a href="http://www.gnu.org/copyleft/gpl.html" target="_blank">GNU/GPL License</a>.'?>
  437. </div>
  438. </body>
  439. </html>

Documentation generated on Mon, 05 May 2008 16:20:28 +0400 by phpDocumentor 1.4.0