Advertisement
Ponchale

Codigo

Mar 7th, 2016
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 79.63 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. // Muestra la version que la institucion se encuentra utilizando
  5.  
  6. include 'version.php';
  7. include 'functions.php';
  8. ?>
  9.  
  10. <!DOCTYPE html>
  11. <html>
  12.   <head>
  13.     <meta charset="utf-8">
  14.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  15.     <title>Instalador Agais</title>
  16.     <!-- Tell the browser to be responsive to screen width -->
  17.     <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  18.     <!-- Bootstrap 3.3.5 -->
  19.     <link rel="stylesheet" href="../themes/Default/bootstrap/bootstrap.min.css">
  20.     <!-- Font Awesome -->
  21.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
  22.     <!-- Ionicons -->
  23.     <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  24.     <!-- Theme style -->
  25.     <link rel="stylesheet" href="../themes/Default/css/AdminLTE.min.css">
  26.     <!-- AdminLTE Skins. Choose a skin from the css/skins
  27.         folder instead of downloading all of them to reduce the load. -->
  28.     <link rel="stylesheet" href="../themes/Default/css/skins/_all-skins.min.css">
  29.    
  30.     <link rel="stylesheet" href="../plugins/select2/select2.min.css">
  31.  
  32.     <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  33.     <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  34.     <!--[if lt IE 9]>
  35.        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  36.        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  37.    <![endif]-->
  38.   </head>
  39.   <!-- ADD THE CLASS layout-boxed TO GET A BOXED LAYOUT -->
  40.   <body class="hold-transition skin-blue layout-boxed sidebar-mini">
  41.     <!-- Site wrapper -->
  42.     <div class="wrapper">
  43.  
  44.       <header class="main-header">
  45.         <!-- Logo -->
  46.         <a href="../../index.php" class="logo">
  47.           <!-- mini logo for sidebar mini 50x50 pixels -->
  48.           <span class="logo-mini"><b>A</b>ga</span>
  49.           <!-- logo for regular state and mobile devices -->
  50.           <span class="logo-lg"><b>Agais</b>LTE</span>
  51.         </a>
  52.         <!-- Header Navbar: style can be found in header.less -->
  53.         <nav class="navbar navbar-static-top" role="navigation">
  54.           <!-- Sidebar toggle button-->
  55.           <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
  56.             <span class="sr-only">Toggle navigation</span>
  57.           </a>
  58.           <div class="navbar-custom-menu">
  59.             <ul class="nav navbar-nav">
  60.              
  61.               <!-- Control Sidebar Toggle Button -->
  62.               <li>
  63.                 <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
  64.               </li>
  65.             </ul>
  66.           </div>
  67.         </nav>
  68.       </header>
  69.       <!-- Left side column. contains the sidebar -->
  70.       <aside class="main-sidebar">
  71.         <!-- sidebar: style can be found in sidebar.less -->
  72.         <section class="sidebar">
  73.           <!-- sidebar menu: : style can be found in sidebar.less -->
  74.           <ul class="sidebar-menu">
  75.             <li class="header">MAIN NAVIGATION</li>
  76.           </ul>
  77.         </section>
  78.         <!-- /.sidebar -->
  79.       </aside>
  80.  
  81.       <!-- =============================================== -->
  82.  
  83.       <!-- Content Wrapper. Contains page content -->
  84.       <div class="content-wrapper">
  85.         <!-- Content Header (Page header) -->
  86.  
  87.         <!-- Main content -->
  88.         <section class="content">
  89.           <div class="box">
  90.             <div class="box-header with-border">
  91.               <h3 class="box-title"><?php print _('Welcome To Gibbon') ?></h3>
  92.               <div class="box-tools pull-right">
  93.                 <button class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse"><i class="fa fa-minus"></i></button>
  94.                 <button class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove"><i class="fa fa-times"></i></button>
  95.               </div>
  96.             </div>
  97.             <div class="box-body">
  98.               <p style='padding-top: 7px'>
  99.                         <?php print _('Created by teachers, Gibbon is the school platform which solves real problems faced by educators every day.') ?><br/>
  100.                         <br/>
  101.                         <?php print _('Free, open source and flexible, Gibbon can morph to meet the needs of a huge range of schools.') ?><br/>
  102.                         <br/>
  103.                         <?php print sprintf(_('For support, please visit %1$sagais.com.co%2$s.'), "<a target='_blank' href='https://gibbonedu.org/support'>", "</a>") ?>
  104.                         </p>
  105.             </div><!-- /.box-body -->
  106.           </div><!-- /.box -->
  107.           <div id='content'>
  108.                         <?php
  109.                             //Get and set database variables (not set until step 1)
  110.                             $databaseServer="" ;
  111.                             if (isset($_POST["databaseServer"])) {
  112.                                 $databaseServer=$_POST["databaseServer"] ;
  113.                             }
  114.                             $databaseName="" ;
  115.                             if (isset($_POST["databaseName"])) {
  116.                                 $databaseName=$_POST["databaseName"] ;
  117.                             }
  118.                             $databaseUsername="" ;
  119.                             if (isset($_POST["databaseUsername"])) {
  120.                                 $databaseUsername=$_POST["databaseUsername"] ;
  121.                             }
  122.                             $databasePassword="" ;
  123.                             if (isset($_POST["databasePassword"])) {
  124.                                 $databasePassword=$_POST["databasePassword"] ;
  125.                             }
  126.                             $demoData="" ;
  127.                             if (isset($_POST["demoData"])) {
  128.                                 $demoData=$_POST["demoData"] ;
  129.                             }
  130.                            
  131.                             //Get and set step
  132.                             $step=0 ;
  133.                             if (isset($_GET["step"])) {
  134.                                 $step=$_GET["step"] ;
  135.                             }
  136.                             print "<h2>" . sprintf(_('Installation - Step %1$s'), ($step+1)) . "</h2>" ;
  137.                            
  138.                             //Set language
  139.                             $code="en_GB" ;
  140.                             if (isset($_POST["code"])) {
  141.                                 $code=$_POST["code"] ;
  142.                             }
  143.                             putenv("LC_ALL=" . $code);
  144.                             setlocale(LC_ALL, $code);
  145.                             bindtextdomain("gibbon", "../i18n");
  146.                             textdomain("gibbon");
  147.                            
  148.                             if ($step==0) { //Choose language
  149.                                 if (file_exists("../config.php")) { //Make sure system is not already installed
  150.                                     print "<div class='error'>" ;
  151.                                         print _("../config.php already exists, which suggests this system is already installed. The installer cannot proceed.") ;
  152.                                     print "</div>" ;
  153.                                 }
  154.                                 else { //No config, so continue installer
  155.                                     if (is_writable("../")==FALSE) { //Ensure that home directory is writable
  156.                                         print "<div class='error'>" ;
  157.                                             print _("The directory containing the Gibbon files is not currently writable, so the installer cannot proceed.") ;
  158.                                         print "</div>" ;
  159.                                     }
  160.                                     else {
  161.                                         print "<div class='success'>" ;
  162.                                             print _("The directory containing the Gibbon files is writable, so the installation may proceed.") ;
  163.                                         print "</div>" ;
  164.                                        
  165.                                         //Set language options
  166.                                         ?>
  167.                                         <form method="post" action="./install.php?step=1">
  168.                                             <table class='smallIntBorder' cellspacing='0' style="width: 100%"> 
  169.                                                 <tr class='break'>
  170.                                                     <td colspan=2>
  171.                                                         <h3><?php print "Language Settings" ?></h3>
  172.                                                     </td>
  173.                                                 </tr>
  174.                                                 <tr>
  175.                                                     <td style='width: 275px'>
  176.                                                         <b><?php print "System Language" ?> *</b><br/>
  177.                                                     </td>
  178.                                                     <td class="right">
  179.                                                         <select name="code" id="code" class="form-control select2" style="width: 302px">
  180.                                                             <option value='en_GB'>English - United Kingdom</option>
  181.                                                             <option value='en_US'>English - United States</option>
  182.                                                             <option value='es_ES'>Español</option>
  183.                                                             <option value='fr_FR'>Français - France</option>
  184.                                                             <option value='it_IT'>Italiano - Italia</option>
  185.                                                             <option value='ro_RO'>Română</option>
  186.                                                             <option value='zh_HK'>體字 - 香港</option>
  187.                                                             <option value='ar_SA'>العربية - المملكة العربية السعودية</option>
  188.                                                         </select>
  189.                                                     </td>
  190.                                                 </tr>
  191.                                                 <tr>
  192.                                                     <td>
  193.                                                         <span style="font-size: 90%"><i>* <?php print _("denotes a required field") ; ?></i></span>
  194.                                                     </td>
  195.                                                    
  196.                                                 </tr>
  197.                                                 <td class="right">
  198.                                                     <br>
  199.                                                         <input type="submit" class="btn btn-block btn-primary" value="<?php print _("Submit") ; ?>">
  200.                                                     </td>
  201.                                             </table>
  202.                                         </form>
  203.                                         <?php
  204.                                     }
  205.                                 }
  206.                             }
  207.                             if ($step==1) { //Set database options
  208.                                 ?>
  209.                                 <form method="post" action="./install.php?step=2">
  210.                                     <table class='smallIntBorder' cellspacing='0' style="width: 100%"> 
  211.                                         <tr class='break'>
  212.                                             <td colspan=2>
  213.                                                 <h3><?php print _('Database Information') ?></h3>
  214.                                             </td>
  215.                                         </tr>
  216.                                         <tr>
  217.                                             <td style='width: 275px'>
  218.                                                 <b><?php print _('Database Type') ?> *</b><br/>
  219.                                                 <span style="font-size: 90%"><i><?php print _('This value cannot be changed.') ?></i></span>
  220.                                             </td>
  221.                                             <td class="right">
  222.                                                 <input readonly name="type" id="type" value="MySQL" type="text" style="width: 300px">
  223.                                             </td>
  224.                                         </tr>
  225.                                         <tr>
  226.                                             <td style='width: 275px'>
  227.                                                 <b><?php print _('Database Server') ?> *</b><br/>
  228.                                                 <span style="font-size: 90%"><i><?php print _('Localhost, IP address or domain.') ?></i></span>
  229.                                             </td>
  230.                                             <td class="right">
  231.                                                 <input name="databaseServer" id="databaseServer" maxlength=255 value="" type="text" style="width: 300px">
  232.                                                 <script type="text/javascript">
  233.                                                     var databaseServer=new LiveValidation('databaseServer');
  234.                                                     databaseServer.add(Validate.Presence);
  235.                                                 </script>
  236.                                             </td>
  237.                                         </tr>
  238.                                         <tr>
  239.                                             <td>
  240.                                                 <b><?php print _('Database Name') ?> *</b><br/>
  241.                                                 <span style="font-size: 90%"><i><?php print _('This database will be created if it does not already exist. Collation should be utf8_general_ci.') ?></i></span>
  242.                                             </td>
  243.                                             <td class="right">
  244.                                                 <input name="databaseName" id="databaseName" maxlength=50 value="" type="text" style="width: 300px">
  245.                                                 <script type="text/javascript">
  246.                                                     var databaseName=new LiveValidation('databaseName');
  247.                                                     databaseName.add(Validate.Presence);
  248.                                                 </script>
  249.                                             </td>
  250.                                         </tr>
  251.                                         <tr>
  252.                                             <td>
  253.                                                 <b><?php print _('Database Username') ?>*</b><br/>
  254.                                             </td>
  255.                                             <td class="right">
  256.                                                 <input name="databaseUsername" id="databaseUsername" maxlength=50 value="" type="text" style="width: 300px">
  257.                                                 <script type="text/javascript">
  258.                                                     var databaseUsername=new LiveValidation('databaseUsername');
  259.                                                     databaseUsername.add(Validate.Presence);
  260.                                                 </script>
  261.                                             </td>
  262.                                         </tr>
  263.                                         <tr>
  264.                                             <td>
  265.                                                 <b><?php print _('Database Password') ?> *</b><br/>
  266.                                             </td>
  267.                                             <td class="right">
  268.                                                 <input name="databasePassword" id="databasePassword" maxlength=255 value="" type="password" style="width: 300px">
  269.                                                 <script type="text/javascript">
  270.                                                     var databasePassword=new LiveValidation('databasePassword');
  271.                                                     databasePassword.add(Validate.Presence);
  272.                                                 </script>
  273.                                             </td>
  274.                                         </tr>
  275.                                        
  276.                                         <tr>
  277.                                             <td>
  278.                                                 <b><?php print _('Install Demo Data?') ?> *</b><br/>
  279.                                             </td>
  280.                                             <td class="right">
  281.                                                 <select name="demoData" id="demoData" style="width: 302px">
  282.                                                     <?php
  283.                                                     print "<option selected value='N'>" . ynExpander('N') . "</option>" ;
  284.                                                     print "<option value='Y'>" . ynExpander('Y') . "</option>" ;
  285.                                                     ?>         
  286.                                                 </select>
  287.                                             </td>
  288.                                         </tr>
  289.                                         <tr>
  290.                                             <td>
  291.                                                 <span style="font-size: 90%"><i>* <?php print _("denotes a required field") ; ?></i></span>
  292.                                             </td>
  293.                                             <td class="right">
  294.                                                 <input type="hidden" name="code" value="<?php print $code ?>">
  295.                                                 <input type="submit" value="<?php print _("Submit") ; ?>">
  296.                                             </td>
  297.                                         </tr>
  298.                                     </table>
  299.                                 </form>
  300.                                 <?php
  301.                             }
  302.                             else if ($step==2) {
  303.                                 //Check for db values
  304.                                 if ($databaseServer=="" OR $databaseName=="" OR $databaseUsername=="" OR $databasePassword=="" OR $demoData=="") {
  305.                                     print "<div class='error'>" ;
  306.                                         print sprintf(_('A database connection could not be established. Please %1$stry again%2$s.'), "<a href='./install.php'>", "</a>") ;
  307.                                     print "</div>" ;
  308.                                 }
  309.                                
  310.                                 //Estabish db connection without database name
  311.                                 $connected1=TRUE ;
  312.                                 try {
  313.                                     @$connection2=new PDO("mysql:host=$databaseServer;charset=utf8", $databaseUsername, $databasePassword);
  314.                                     $connection2->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  315.                                     $connection2->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
  316.                                 }
  317.                                 catch(PDOException $e) {
  318.                                     $connected1=FALSE ;
  319.                                 }
  320.                                
  321.                                 if ($connected1==FALSE) {
  322.                                     print "<div class='error'>" ;
  323.                                         print sprintf(_('A database connection could not be established. Please %1$stry again%2$s.'), "<a href='./install.php'>", "</a>") ;
  324.                                     print "</div>" ;
  325.                                 }
  326.                                 else {
  327.                                     //Create database if needed.
  328.                                     $databaseNameClean="`".str_replace("`","``",$databaseName)."`";
  329.                                    
  330.                                     $connected2=TRUE ;
  331.                                     try {
  332.                                         $data=array();
  333.                                         $sql="CREATE DATABASE IF NOT EXISTS $databaseNameClean DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci" ;
  334.                                         $result=@$connection2->prepare($sql);
  335.                                         $result->execute($data);
  336.                                     }
  337.                                     catch(PDOException $e) {
  338.                                         $connected2=FALSE ;
  339.                                     }
  340.                                
  341.                                     //Use database, to make it active.
  342.                                     try {
  343.                                         $data=array();
  344.                                         $sql="USE $databaseNameClean" ;
  345.                                         $result=$connection2->prepare($sql);
  346.                                         $result->execute($data);
  347.                                     }
  348.                                     catch(PDOException $e) {
  349.                                         $connected2=FALSE ;
  350.                                     }
  351.                                    
  352.                                     if ($connected2==FALSE) {
  353.                                         print "<div class='error'>" ;
  354.                                             print sprintf(_('A database connection could not be established. Please %1$stry again%2$s.'), "<a href='./install.php'>", "</a>") ;
  355.                                         print "</div>" ;
  356.                                     }
  357.                                     else {
  358.                                         print "<div class='success'>" ;
  359.                                             print _("Your database connection was successful, so the installation may proceed.") ;
  360.                                         print "</div>" ;
  361.                                    
  362.                                         //Set up GUID
  363.                                         $charList="abcdefghijkmnopqrstuvwxyz023456789";
  364.                                         $guid="" ;
  365.                                         for ($i=0;$i<36;$i++) {
  366.                                             if ($i==9 OR $i==14 OR $i==19 OR $i==24) {
  367.                                                 $guid.="-" ;
  368.                                             }
  369.                                             else {
  370.                                                 $guid.=substr($charList, rand(1,strlen($charList)),1);
  371.                                             }
  372.                                         }
  373.                                
  374.                                         //Set up config.php
  375.                                         $config="" ;
  376.                                         $config.="<?php\n" ;
  377.                                         $config.="/*\n" ;
  378.                                         $config.="Gibbon, Flexible & Open School System\n" ;
  379.                                         $config.="Copyright (C) 2010, Ross Parker\n" ;
  380.                                         $config.="\n" ;
  381.                                         $config.="This program is free software: you can redistribute it and/or modify\n" ;
  382.                                         $config.="it under the terms of the GNU General Public License as published by\n" ;
  383.                                         $config.="the Free Software Foundation, either version 3 of the License, or\n" ;
  384.                                         $config.="(at your option) any later version.\n" ;
  385.                                         $config.="\n" ;
  386.                                         $config.="This program is distributed in the hope that it will be useful,\n" ;
  387.                                         $config.="but WITHOUT ANY WARRANTY; without even the implied warranty of\n" ;
  388.                                         $config.="MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n" ;
  389.                                         $config.="GNU General Public License for more details.\n" ;
  390.                                         $config.="\n" ;
  391.                                         $config.="You should have received a copy of the GNU General Public License\n" ;
  392.                                         $config.="along with this program.  If not, see <http://www.gnu.org/licenses/>.\n" ;
  393.                                         $config.="*/\n" ;
  394.                                         $config.="\n" ;
  395.                                         $config.="//Sets database connection information\n" ;
  396.                                         $config.="\$databaseServer=\"" . $databaseServer . "\" ;\n" ;
  397.                                         $config.="\$databaseUsername=\"" . $databaseUsername . "\" ;\n" ;
  398.                                         $config.="\$databasePassword='" . $databasePassword . "' ;\n" ;
  399.                                         $config.="\$databaseName=\"" . $databaseName . "\" ;\n" ;
  400.                                         $config.="\n" ;
  401.                                         $config.="//Sets globally unique id, to allow multiple installs on the server server.\n" ;
  402.                                         $config.="\$guid=\"" . $guid . "\" ;\n" ;
  403.                                         $config.="\n" ;
  404.                                         $config.="//Sets system-wide caching factor, used to baalance performance and freshness. Value represents number of page loads between cache refresh. Must be posititve integer. 1 means no caching.\n" ;
  405.                                         $config.="\$caching=10 ;\n" ;
  406.                                         $config.="?>\n" ;
  407.                                
  408.                                         //Write config
  409.                                         $fp = fopen("../config.php","wb");
  410.                                         fwrite($fp,$config);
  411.                                         fclose($fp);
  412.                                
  413.                                         if (file_exists("../config.php")==FALSE) { //Something went wrong, config.php could not be created.
  414.                                             print "<div class='error'>" ;
  415.                                                 print _("../config.php could not be created, and so the installer cannot proceed.") ;
  416.                                             print "</div>" ;
  417.                                         }
  418.                                         else { //Config, exists, let's press on
  419.                                             //Let's populate the database
  420.                                             if (file_exists("../gibbon.sql")==FALSE) {
  421.                                                 print "<div class='error'>" ;
  422.                                                     print _("../gibbon.sql does not exist, and so the installer cannot proceed.") ;
  423.                                                 print "</div>" ;
  424.                                             }
  425.                                             else {
  426.                                                 include "./installerFunctions.php" ;
  427.                                        
  428.                                                 $query=@fread(@fopen("../gibbon.sql", 'r'), @filesize("../gibbon.sql")) or die('Encountered a problem.');
  429.                                                 $query=remove_remarks($query);
  430.                                                 $query=split_sql_file($query, ';');
  431.                                        
  432.                                                 $i=1;
  433.                                                 $partialFail=FALSE ;
  434.                                                 foreach($query as $sql){
  435.                                                     $i++;
  436.                                                     try {
  437.                                                         $connection2->query($sql) ;
  438.                                                     }
  439.                                                     catch(PDOException $e) {
  440.                                                         $partialFail=TRUE ;
  441.                                                     }
  442.                                                 }
  443.                                                
  444.                                        
  445.                                                 if ($partialFail==TRUE) {
  446.                                                     print "<div class='error'>" ;
  447.                                                         print _("Errors occurred in populating the database; empty your database, remove ../config.php and try again.") ;
  448.                                                     print "</div>" ;
  449.                                                 }
  450.                                                 else {
  451.                                                     //Try to install the demo data, report error but don't stop if any issues
  452.                                                     if ($demoData=="Y") {
  453.                                                         if (file_exists("../gibbon_demo.sql")==FALSE) {
  454.                                                             print "<div class='error'>" ;
  455.                                                                 print _("../gibbon_demo.sql does not exist, so we will conintue without demo data.") ;
  456.                                                             print "</div>" ;
  457.                                                         }
  458.                                                         else {
  459.                                                             $query=@fread(@fopen("../gibbon_demo.sql", 'r'), @filesize("../gibbon_demo.sql")) or die('Encountered a problem.');
  460.                                                             $query=remove_remarks($query);
  461.                                                             $query=split_sql_file($query, ';');
  462.                                        
  463.                                                             $i=1;
  464.                                                             $demoFail=FALSE ;
  465.                                                             foreach($query as $sql){
  466.                                                                 $i++;
  467.                                                                 try {
  468.                                                                     $connection2->query($sql) ;
  469.                                                                 }
  470.                                                                 catch(PDOException $e) {
  471.                                                                     print $sql . "<br/>" ;
  472.                                                                     print $e->getMessage() . "<br/><br/>" ;
  473.                                                                     $demoFail=TRUE ;
  474.                                                                 }
  475.                                                             }
  476.                                                        
  477.                                                             if ($demoFail) {
  478.                                                                 print "<div class='error'>" ;
  479.                                                                     print _("There were some issues installing the demo data, but we will conintue anyway.") ;
  480.                                                                 print "</div>" ;
  481.                                                             }
  482.                                                         }
  483.                                                     }
  484.                                                
  485.                                                
  486.                                                     //Set default language
  487.                                                     try {
  488.                                                         $data=array("code"=>$code);
  489.                                                         $sql="UPDATE gibboni18n SET systemDefault='Y' WHERE code=:code" ;
  490.                                                         $result=$connection2->prepare($sql);
  491.                                                         $result->execute($data);
  492.                                                     }
  493.                                                     catch(PDOException $e) { }
  494.                                                     try {
  495.                                                         $data=array("code"=>$code);
  496.                                                         $sql="UPDATE gibboni18n SET systemDefault='N' WHERE NOT code=:code" ;
  497.                                                         $result=$connection2->prepare($sql);
  498.                                                         $result->execute($data);
  499.                                                     }
  500.                                                     catch(PDOException $e) { }
  501.                                        
  502.                                                     //Let's gather some more information
  503.                                                     ?>
  504.                                                     <form method="post" action="./install.php?step=3">
  505.                                                         <table class='smallIntBorder' cellspacing='0' style="width: 100%"> 
  506.                                                             <tr class='break'>
  507.                                                                 <td colspan=2>
  508.                                                                     <h3><?php print _('User Account') ?></h3>
  509.                                                                 </td>
  510.                                                             </tr>
  511.                                                             <tr>
  512.                                                                 <td style='width: 275px'>
  513.                                                                     <b><?php print _('Title') ?></b><br/>
  514.                                                                 </td>
  515.                                                                 <td class="right">
  516.                                                                     <select style="width: 302px" name="title">
  517.                                                                         <option value=""></option>
  518.                                                                         <option value="Ms. "><?php print _('Ms.') ?></option>
  519.                                                                         <option value="Miss "><?php print _('Miss') ?></option>
  520.                                                                         <option value="Mr. "><?php print _('Mr.') ?></option>
  521.                                                                         <option value="Mrs. "><?php print _('Mrs.') ?></option>
  522.                                                                         <option value="Dr. "><?php print _('Dr.') ?></option>
  523.                                                                     </select>
  524.                                                                 </td>
  525.                                                             </tr>
  526.                                                             <tr>
  527.                                                                 <td>
  528.                                                                     <b><?php print _('Surname') ?> *</b><br/>
  529.                                                                     <span style="font-size: 90%"><i><?php print _('Family name as shown in ID documents.') ?></i></span>
  530.                                                                 </td>
  531.                                                                 <td class="right">
  532.                                                                     <input name="surname" id="surname" maxlength=30 value="" type="text" style="width: 300px">
  533.                                                                     <script type="text/javascript">
  534.                                                                         var surname=new LiveValidation('surname');
  535.                                                                         surname.add(Validate.Presence);
  536.                                                                     </script>
  537.                                                                 </td>
  538.                                                             </tr>
  539.                                                             <tr>
  540.                                                                 <td>
  541.                                                                     <b><?php print _('First Name') ?>*</b><br/>
  542.                                                                     <span style="font-size: 90%"><i><?php print _('First name as shown in ID documents.') ?></i></span>
  543.                                                                 </td>
  544.                                                                 <td class="right">
  545.                                                                     <input name="firstName" id="firstName" maxlength=30 value="" type="text" style="width: 300px">
  546.                                                                     <script type="text/javascript">
  547.                                                                         var firstName=new LiveValidation('firstName');
  548.                                                                         firstName.add(Validate.Presence);
  549.                                                                     </script>
  550.                                                                 </td>
  551.                                                             </tr>
  552.                                                             <tr>
  553.                                                                 <td>
  554.                                                                     <b><?php print _('Emagais.com.coail') ?> *</b><br/>
  555.                                                                 </td>
  556.                                                                 <td class="right">
  557.                                                                     <input name="email" id="email" maxlength=50 value="" type="text" style="width: 300px">
  558.                                                                     <script type="text/javascript">
  559.                                                                         var email=new LiveValidation('email');
  560.                                                                         email.add(Validate.Email);
  561.                                                                         email.add(Validate.Presence);
  562.                                                                     </script>
  563.                                                                 </td>
  564.                                                             </tr>
  565.                                                             <tr>
  566.                                                                 <td>
  567.                                                                     <b><?php print _('Receive Support?') ?></b><br/>
  568.                                                                     <span style="font-size: 90%"><i><?php print _('Join our mailing list and recieve a welcome email from the team.') ?></i></span>
  569.                                                                 </td>
  570.                                                                 <td class="right">
  571.                                                                     <input name="support" id="support" value="true" type="checkbox">
  572.                                                                 </td>
  573.                                                             </tr>
  574.                                                             <tr>
  575.                                                                 <td>
  576.                                                                     <b><?php print _('Username') ?> *</b><br/>
  577.                                                                     <span style="font-size: 90%"><i><?php print _('Must be unique. System login name. Cannot be changed.') ?></i></span>
  578.                                                                 </td>
  579.                                                                 <td class="right">
  580.                                                                     <input name="username" id="username" maxlength=20 value="" type="text" style="width: 300px">
  581.                                                                     <?php
  582.                                                                     $idList="" ;
  583.                                                                     try {
  584.                                                                         $dataSelect=array();
  585.                                                                         $sqlSelect="SELECT username FROM gibbonPerson ORDER BY username" ;
  586.                                                                         $resultSelect=$connection2->prepare($sqlSelect);
  587.                                                                         $resultSelect->execute($dataSelect);
  588.                                                                     }
  589.                                                                     catch(PDOException $e) { }
  590.                                                                     while ($rowSelect=$resultSelect->fetch()) {
  591.                                                                         $idList.="'" . $rowSelect["username"]  . "'," ;
  592.                                                                     }
  593.                                                                     ?>
  594.                                                                     <script type="text/javascript">
  595.                                                                         var username=new LiveValidation('username');
  596.                                                                         username.add(Validate.Presence);
  597.                                                                     </script>
  598.                                                                 </td>
  599.                                                             </tr>
  600.                                                             <tr>
  601.                                                                 <td colspan=2>
  602.                                                                     <?php
  603.                                                                     $policy=getPasswordPolicy($connection2) ;
  604.                                                                     if ($policy!=FALSE) {
  605.                                                                         print "<div class='warning'>" ;
  606.                                                                             print $policy ;
  607.                                                                         print "</div>" ;
  608.                                                                     }
  609.                                                                     ?>
  610.                                                                 </td>
  611.                                                             </tr>
  612.                                                             <tr>
  613.                                                                 <td>
  614.                                                                     <b><?php print _('Password') ?> *</b><br/>
  615.                                                                     <span style="font-size: 90%"><i></i></span>
  616.                                                                 </td>
  617.                                                                 <td class="right">
  618.                                                                     <input name="password" id="password" maxlength=30 value="" type="password" style="width: 300px">
  619.                                                                     <script type="text/javascript">
  620.                                                                         var password=new LiveValidation('password');
  621.                                                                         password.add(Validate.Presence);
  622.                                                                         <?php
  623.                                                                         $alpha=getSettingByScope( $connection2, "System", "passwordPolicyAlpha" ) ;
  624.                                                                         if ($alpha=="Y") {
  625.                                                                             print "password.add( Validate.Format, { pattern: /.*(?=.*[a-z])(?=.*[A-Z]).*/, failureMessage: \"" . _('Does not meet password policy.') . "\" } );" ;
  626.                                                                         }
  627.                                                                         $numeric=getSettingByScope( $connection2, "System", "passwordPolicyNumeric" ) ;
  628.                                                                         if ($numeric=="Y") {
  629.                                                                             print "password.add( Validate.Format, { pattern: /.*[0-9]/, failureMessage: \"" . _('Does not meet password policy.') . "\" } );" ;
  630.                                                                         }
  631.                                                                         $punctuation=getSettingByScope( $connection2, "System", "passwordPolicyNonAlphaNumeric" ) ;
  632.                                                                         if ($punctuation=="Y") {
  633.                                                                             print "password.add( Validate.Format, { pattern: /[^a-zA-Z0-9]/, failureMessage: \"" . _('Does not meet password policy.') . "\" } );" ;
  634.                                                                         }
  635.                                                                         $minLength=getSettingByScope( $connection2, "System", "passwordPolicyMinLength" ) ;
  636.                                                                         if (is_numeric($minLength)) {
  637.                                                                             print "password.add( Validate.Length, { minimum: " . $minLength . "} );" ;
  638.                                                                         }
  639.                                                                         ?>
  640.                                                                     </script>
  641.                                                                 </td>
  642.                                                             </tr>
  643.                                                             <tr>
  644.                                                                 <td>
  645.                                                                     <b><?php print _('Confirm Password') ?> *</b><br/>
  646.                                                                     <span style="font-size: 90%"><i></i></span>
  647.                                                                 </td>
  648.                                                                 <td class="right">
  649.                                                                     <input name="passwordConfirm" id="passwordConfirm" maxlength=20 value="" type="password" style="width: 300px">
  650.                                                                     <script type="text/javascript">
  651.                                                                         var passwordConfirm=new LiveValidation('passwordConfirm');
  652.                                                                         passwordConfirm.add(Validate.Presence);
  653.                                                                         passwordConfirm.add(Validate.Confirmation, { match: 'password' } );
  654.                                                                     </script>
  655.                                                                 </td>
  656.                                                             </tr>
  657.                                                        
  658.                                                             <tr class='break'>
  659.                                                                 <td colspan=2>
  660.                                                                     <h3><?php print _('System Settings') ?></h3>
  661.                                                                 </td>
  662.                                                             </tr>
  663.                                                             <tr>
  664.                                                                 <?php
  665.                                                                 try {
  666.                                                                     $data=array();
  667.                                                                     $sql="SELECT * FROM gibbonSetting WHERE scope='System' AND name='absoluteURL'" ;
  668.                                                                     $result=$connection2->prepare($sql);
  669.                                                                     $result->execute($data);
  670.                                                                 }
  671.                                                                 catch(PDOException $e) {
  672.                                                                     print "<div class='error'>" . $e->getMessage() . "</div>" ;
  673.                                                                 }
  674.                                                                 $row=$result->fetch() ;
  675.                                                                 ?>
  676.                                                                 <td style='width: 275px'>
  677.                                                                     <b><?php print _($row["nameDisplay"]) ?> *</b><br/>
  678.                                                                     <span style="font-size: 90%"><i><?php if ($row["description"]!="") { print _($row["description"]) ; } ?></i></span>
  679.                                                                 </td>
  680.                                                                 <td stclass="right">
  681.                                                                     <?php $pageURL = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://"; ?>
  682.                                                                     <input name="<?php print $row["name"] ?>" id="<?php print $row["name"] ?>" maxlength=50 value="<?php print substr(($pageURL.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]),0,-29) ?>" type="text" style="width: 300px">
  683.                                                                     <script type="text/javascript">
  684.                                                                         var <?php print $row["name"] ?>=new LiveValidation('<?php print $row["name"] ?>');
  685.                                                                         <?php print $row["name"] ?>.add(Validate.Presence);
  686.                                                                         <?php print $row["name"] ?>.add( Validate.Format, { pattern: /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/, failureMessage: "Must start with http:// or https://" } );
  687.                                                                     </script>
  688.                                                                 </td>
  689.                                                             </tr>
  690.                                                             <tr>
  691.                                                                 <?php
  692.                                                                 try {
  693.                                                                     $data=array();
  694.                                                                     $sql="SELECT * FROM gibbonSetting WHERE scope='System' AND name='absolutePath'" ;
  695.                                                                     $result=$connection2->prepare($sql);
  696.                                                                     $result->execute($data);
  697.                                                                 }
  698.                                                                 catch(PDOException $e) {
  699.                                                                     print "<div class='error'>" . $e->getMessage() . "</div>" ;
  700.                                                                 }
  701.                                                                 $row=$result->fetch() ;
  702.                                                                 ?>
  703.                                                                 <td>
  704.                                                                     <b><?php print _($row["nameDisplay"]) ?> *</b><br/>
  705.                                                                     <span style="font-size: 90%"><i><?php if ($row["description"]!="") { print _($row["description"]) ; } ?></i></span>
  706.                                                                 </td>
  707.                                                                 <td stclass="right">
  708.                                                                     <input name="<?php print $row["name"] ?>" id="<?php print $row["name"] ?>" maxlength=50 value="<?php print substr(__FILE__,0,-22) ?>" type="text" style="width: 300px">
  709.                                                                     <script type="text/javascript">
  710.                                                                         var <?php print $row["name"] ?>=new LiveValidation('<?php print $row["name"] ?>');
  711.                                                                         <?php print $row["name"] ?>.add(Validate.Presence);
  712.                                                                     </script>
  713.                                                                 </td>
  714.                                                             </tr>
  715.                                                             <tr>
  716.                                                                 <?php
  717.                                                                 try {
  718.                                                                     $data=array();
  719.                                                                     $sql="SELECT * FROM gibbonSetting WHERE scope='System' AND name='systemName'" ;
  720.                                                                     $result=$connection2->prepare($sql);
  721.                                                                     $result->execute($data);
  722.                                                                 }
  723.                                                                 catch(PDOException $e) {
  724.                                                                     print "<div class='error'>" . $e->getMessage() . "</div>" ;
  725.                                                                 }
  726.                                                                 $row=$result->fetch() ;
  727.                                                                 ?>
  728.                                                                 <td>
  729.                                                                     <b><?php print _($row["nameDisplay"]) ?> *</b><br/>
  730.                                                                     <span style="font-size: 90%"><i><?php if ($row["description"]!="") { print _($row["description"]) ; } ?></i></span>
  731.                                                                 </td>
  732.                                                                 <td class="right">
  733.                                                                     <input name="<?php print $row["name"] ?>" id="<?php print $row["name"] ?>" maxlength=50 value="Gibbon" type="text" style="width: 300px">
  734.                                                                     <script type="text/javascript">
  735.                                                                         var <?php print $row["name"] ?>=new LiveValidation('<?php print $row["name"] ?>');
  736.                                                                         <?php print $row["name"] ?>.add(Validate.Presence);
  737.                                                                     </script>
  738.                                                                 </td>
  739.                                                             </tr>
  740.                                                             <tr>
  741.                                                                 <?php
  742.                                                                 try {
  743.                                                                     $data=array();
  744.                                                                     $sql="SELECT * FROM gibbonSetting WHERE scope='System' AND name='installType'" ;
  745.                                                                     $result=$connection2->prepare($sql);
  746.                                                                     $result->execute($data);
  747.                                                                 }
  748.                                                                 catch(PDOException $e) {
  749.                                                                     print "<div class='error'>" . $e->getMessage() . "</div>" ;
  750.                                                                 }
  751.                                                                 $row=$result->fetch() ;
  752.                                                                 ?>
  753.                                                                 <td>
  754.                                                                     <b><?php print _($row["nameDisplay"]) ?> *</b><br/>
  755.                                                                     <span style="font-size: 90%"><i><?php if ($row["description"]!="") { print _($row["description"]) ; } ?></i></span>
  756.                                                                 </td>
  757.                                                                 <td class="right">
  758.                                                                     <select name="<?php print $row["name"] ?>" id="<?php print $row["name"] ?>" style="width: 302px">
  759.                                                                         <?php
  760.                                                                         print "<option selected value='Testing'>Testing</option>" ;
  761.                                                                         print "<option value='Production'>Production</option>" ;
  762.                                                                         print "<option value='Development'>Development</option>" ;
  763.                                                                         ?>         
  764.                                                                     </select>
  765.                                                                 </td>
  766.                                                             </tr>
  767.                                                             <?php
  768.                                                             print "<tr>" ;
  769.                                                                 print "<td colspan=2>" ;
  770.                                                                     print "<div id='status' class='warning'>" ;
  771.                                                                         print "<div style='width: 100%; text-align: center'>" ;
  772.                                                                             print "<img style='margin: 10px 0 5px 0' src='../themes/Default/img/loading.gif' alt='Loading'/><br/>" ;
  773.                                                                             print _("Checking for Cutting Edge Code.") ;
  774.                                                                         print "</div>" ;
  775.                                                                     print "</div>" ;
  776.                                                                 print "</td>" ;
  777.                                                             print "</tr>"
  778.                                                             ?>
  779.                                                             <tr>
  780.                                                                 <?php
  781.                                                                 try {
  782.                                                                     $data=array();
  783.                                                                     $sql="SELECT * FROM gibbonSetting WHERE scope='System' AND name='cuttingEdgeCode'" ;
  784.                                                                     $result=$connection2->prepare($sql);
  785.                                                                     $result->execute($data);
  786.                                                                 }
  787.                                                                 catch(PDOException $e) {
  788.                                                                     print "<div class='error'>" . $e->getMessage() . "</div>" ;
  789.                                                                 }
  790.                                                                 $row=$result->fetch() ;
  791.                                                                 ?>
  792.                                                                 <td>
  793.                                                                     <b><?php print _($row["nameDisplay"]) ?> *</b><br/>
  794.                                                                     <span style="font-size: 90%"><i><?php print _($row["description"]) ?>. <?php print "<b>" . _('Not recommended for non-experts!.') . "<b>" ?></i></span>
  795.                                                                 </td>
  796.                                                                 <td class="right">
  797.                                                                     <select disabled name="<?php print $row["name"] ?>Disabled" id="<?php print $row["name"] ?>" style="width: 302px">
  798.                                                                         <?php
  799.                                                                         print "<option selected value='N'>" . ynExpander('N') . "</option>" ;
  800.                                                                         print "<option value='Y'>" . ynExpander('Y') . "</option>" ;
  801.                                                                         ?>         
  802.                                                                     </select>
  803.                                                                     <input type='hidden' name="<?php print $row["name"] ?>" id="<?php print $row["name"] ?>Hidden" value="N">
  804.                                                                 </td>
  805.                                                             </tr>
  806.                                                             <?php
  807.                                                             //Check and set cutting edge code based on gibbonedu.org services value
  808.                                                             print "<script type=\"text/javascript\">" ;
  809.                                                                 print "$(document).ready(function(){" ;
  810.                                                                     print "$.ajax({" ;
  811.                                                                         print "crossDomain: true, type:\"GET\", contentType: \"application/json; charset=utf-8\",async:false," ;
  812.                                                                         print "url: \"https://gibbonedu.org/services/version/devCheck.php?version=" . $version . "&callback=?\"," ;
  813.                                                                         print "data: \"\",dataType: \"jsonp\", jsonpCallback: 'fnsuccesscallback',jsonpResult: 'jsonpResult'," ;
  814.                                                                         print "success: function(data) {" ;
  815.                                                                             print "$(\"#status\").attr(\"class\",\"success\");" ;
  816.                                                                             print "if (data['status']==='false') {" ;
  817.                                                                                 print "$(\"#status\").html('" . _('Cutting Edge Code check successful.') . "') ;" ;
  818.                                                                             print "}" ;
  819.                                                                             print "else {" ;
  820.                                                                                 print "$(\"#status\").html('" . _('Cutting Edge Code check successful.') . "') ;" ;
  821.                                                                                 print "$(\"#cuttingEdgeCode\").val('Y');" ;
  822.                                                                                 print "$(\"#cuttingEdgeCodeHidden\").val('Y');" ;
  823.                                                                             print "}" ;
  824.                                                                         print "}," ;
  825.                                                                         print "error: function (data, textStatus, errorThrown) {" ;
  826.                                                                             print "$(\"#status\").attr(\"class\",\"error\");" ;
  827.                                                                                 print "$(\"#status\").html('" . _('Cutting Edge Code check failed') . ".') ;" ;
  828.                                                                         print "}" ;
  829.                                                                     print "});" ;
  830.                                                                 print "});" ;
  831.                                                             print "</script>" ;
  832.                                                             ?>
  833.                                                        
  834.                                                             <tr>
  835.                                                                 <?php
  836.                                                                 try {
  837.                                                                     $data=array();
  838.                                                                     $sql="SELECT * FROM gibbonSetting WHERE scope='System' AND name='statsCollection'" ;
  839.                                                                     $result=$connection2->prepare($sql);
  840.                                                                     $result->execute($data);
  841.                                                                 }
  842.                                                                 catch(PDOException $e) {
  843.                                                                     print "<div class='error'>" . $e->getMessage() . "</div>" ;
  844.                                                                 }
  845.                                                                 $row=$result->fetch() ;
  846.                                                                 ?>
  847.                                                                 <td>
  848.                                                                     <b><?php print _($row["nameDisplay"]) ?> *</b><br/>
  849.                                                                     <span style="font-size: 90%"><i><?php if ($row["description"]!="") { print _($row["description"]) ; } ?></i></span>
  850.                                                                 </td>
  851.                                                                 <td class="right">
  852.                                                                     <select name="<?php print $row["name"] ?>" id="<?php print $row["name"] ?>" style="width: 302px">
  853.                                                                         <?php
  854.                                                                         print "<option value='Y'>" . ynExpander('Y') . "</option>" ;
  855.                                                                         print "<option value='N'>" . ynExpander('N') . "</option>" ;
  856.                                                                         ?>         
  857.                                                                     </select>
  858.                                                                 </td>
  859.                                                             </tr>
  860.        
  861.                                                             <tr class='break'>
  862.                                                                 <td colspan=2>
  863.                                                                     <h3><?php print _('Organisation Settings') ?></h3>
  864.                                                                 </td>
  865.                                                             </tr>
  866.                                                             <tr>
  867.                                                                 <?php
  868.                                                                 try {
  869.                                                                     $data=array();
  870.                                                                     $sql="SELECT * FROM gibbonSetting WHERE scope='System' AND name='organisationName'" ;
  871.                                                                     $result=$connection2->prepare($sql);
  872.                                                                     $result->execute($data);
  873.                                                                 }
  874.                                                                 catch(PDOException $e) {
  875.                                                                     print "<div class='error'>" . $e->getMessage() . "</div>" ;
  876.                                                                 }
  877.                                                                 $row=$result->fetch() ;
  878.                                                                 ?>
  879.                                                                 <td>
  880.                                                                     <b><?php print _($row["nameDisplay"]) ?> *</b><br/>
  881.                                                                     <span style="font-size: 90%"><i><?php if ($row["description"]!="") { print _($row["description"]) ; } ?></i></span>
  882.                                                                 </td>
  883.                                                                 <td class="right">
  884.                                                                     <input name="<?php print $row["name"] ?>" id="<?php print $row["name"] ?>" maxlength=50 value="" type="text" style="width: 300px">
  885.                                                                     <script type="text/javascript">
  886.                                                                         var <?php print $row["name"] ?>=new LiveValidation('<?php print $row["name"] ?>');
  887.                                                                         <?php print $row["name"] ?>.add(Validate.Presence);
  888.                                                                     </script>
  889.                                                                 </td>
  890.                                                             </tr>
  891.                                                             <tr>
  892.                                                                 <?php
  893.                                                                 try {
  894.                                                                     $data=array();
  895.                                                                     $sql="SELECT * FROM gibbonSetting WHERE scope='System' AND name='organisationNameShort'" ;
  896.                                                                     $result=$connection2->prepare($sql);
  897.                                                                     $result->execute($data);
  898.                                                                 }
  899.                                                                 catch(PDOException $e) {
  900.                                                                     print "<div class='error'>" . $e->getMessage() . "</div>" ;
  901.                                                                 }
  902.                                                                 $row=$result->fetch() ;
  903.                                                                 ?>
  904.                                                                 <td>
  905.                                                                     <b><?php print _($row["nameDisplay"]) ?> *</b><br/>
  906.                                                                     <span style="font-size: 90%"><i><?php if ($row["description"]!="") { print _($row["description"]) ; } ?></i></span>
  907.                                                                 </td>
  908.                                                                 <td class="right">
  909.                                                                     <input name="<?php print $row["name"] ?>" id="<?php print $row["name"] ?>" maxlength=50 value="" type="text" style="width: 300px">
  910.                                                                     <script type="text/javascript">
  911.                                                                         var <?php print $row["name"] ?>=new LiveValidation('<?php print $row["name"] ?>');
  912.                                                                         <?php print $row["name"] ?>.add(Validate.Presence);
  913.                                                                     </script>
  914.                                                                 </td>
  915.                                                             </tr>
  916.                                                             <tr>
  917.                                                             <?php
  918.                                                             try {
  919.                                                                 $data=array();
  920.                                                                 $sql="SELECT * FROM gibbonSetting WHERE scope='System' AND name='currency'" ;
  921.                                                                 $result=$connection2->prepare($sql);
  922.                                                                 $result->execute($data);
  923.                                                             }
  924.                                                             catch(PDOException $e) {
  925.                                                                 print "<div class='error'>" . $e->getMessage() . "</div>" ;
  926.                                                             }
  927.                                                             $row=$result->fetch() ;
  928.                                                             ?>
  929.                                                             <td>
  930.                                                                 <b><?php print _($row["nameDisplay"]) ?> *</b><br/>
  931.                                                                 <span style="font-size: 90%"><i><?php if ($row["description"]!="") { print _($row["description"]) ; } ?></i></span>
  932.                                                             </td>
  933.                                                             <td class="right">
  934.                                                                 <select name="<?php print $row["name"] ?>" id="<?php print $row["name"] ?>" style="width: 302px">
  935.                                                                     <optgroup label='--<?php print _('PAYPAL SUPPORTED') ?>--'/>
  936.                                                                         <option value='AUD $'>Australian Dollar (A$)</option>
  937.                                                                         <option value='BRL R$'>Brazilian Real</option>
  938.                                                                         <option value='GBP £'>British Pound (£)</option>
  939.                                                                         <option value='CAD $'>Canadian Dollar (C$)</option>
  940.                                                                         <option value='CZK Kč'>Czech Koruna</option>
  941.                                                                         <option value='DKK kr'>Danish Krone</option>
  942.                                                                         <option value='EUR €'>Euro (€)</option>
  943.                                                                         <option value='HKD $'>Hong Kong Dollar ($)</option>
  944.                                                                         <option value='HUF Ft'>Hungarian Forint</option>
  945.                                                                         <option value='ILS ₪'>Israeli New Shekel</option>
  946.                                                                         <option value='JPY ¥'>Japanese Yen (¥)</option>
  947.                                                                         <option value='MYR RM'>Malaysian Ringgit</option>
  948.                                                                         <option value='MXN $'>Mexican Peso</option>
  949.                                                                         <option value='TWD $'>New Taiwan Dollar</option>
  950.                                                                         <option value='NZD $'>New Zealand Dollar ($)</option>
  951.                                                                         <option value='NOK kr'>Norwegian Krone</option>
  952.                                                                         <option value='PHP ₱'>Philippine Peso</option>
  953.                                                                         <option value='PLN zł'>Polish Zloty</option>
  954.                                                                         <option value='SGD $'>Singapore Dollar ($)</option>
  955.                                                                         <option value='CHF'>Swiss Franc</option>
  956.                                                                         <option value='THB ฿'>Thai Baht</option>
  957.                                                                         <option value='TRY'>Turkish Lira</option>
  958.                                                                         <option value='USD $'>U.S. Dollar ($)</option>
  959.                                                                     </optgroup>
  960.                                                                     <optgroup label='--<?php print _('OTHERS') ?>--'/>
  961.                                                                         <option value='BDT ó'>Bangladeshi Taka (ó)</option>
  962.                                                                         <option value='BTC'>Bitcoin</option>
  963.                                                                         <option value='XAF FCFA'>Central African Francs (FCFA)</option>
  964.                                                                         <option value='EGP £'>Egyptian Pound (£)</option>
  965.                                                                         <option value='INR ₹'>Indian Rupee (₹)</option>
  966.                                                                         <option value='IDR Rp'>Indonesian Rupiah (Rp)</option>
  967.                                                                         <option value='KES KSh'>Kenyan Shilling (KSh)</option>
  968.                                                                         <option value='NPR ₨'>Nepalese Rupee (₨)</option>
  969.                                                                         <option value='NGN ₦'>Nigerian Naira (₦)</option>
  970.                                                                         <option value='SAR ﷼‎'>Saudi Riyal (﷼‎)</option>
  971.                                                                         <option value='VND ₫‎'>Vietnamese Dong (₫‎)</option>
  972.                                                                     </optgroup>
  973.                                                                 </select>
  974.                                                             </td>
  975.                                                         </tr>
  976.                                                        
  977.                                                             <tr class='break'>
  978.                                                                 <td colspan=2>
  979.                                                                     <h3><?php print _('gibbonedu.com Value-Added Services') ?></h3>
  980.                                                                 </td>
  981.                                                             </tr>
  982.                                                             <tr>
  983.                                                                 <?php
  984.                                                                 try {
  985.                                                                     $data=array();
  986.                                                                     $sql="SELECT * FROM gibbonSetting WHERE scope='System' AND name='gibboneduComOrganisationName'" ;
  987.                                                                     $result=$connection2->prepare($sql);
  988.                                                                     $result->execute($data);
  989.                                                                 }
  990.                                                                 catch(PDOException $e) {
  991.                                                                     print "<div class='error'>" . $e->getMessage() . "</div>" ;
  992.                                                                 }
  993.                                                                 $row=$result->fetch() ;
  994.                                                                 ?>
  995.                                                                 <td>
  996.                                                                     <b><?php print _($row["nameDisplay"]) ?></b><br/>
  997.                                                                     <span style="font-size: 90%"><i><?php if ($row["description"]!="") { print _($row["description"]) ; } ?></i></span>
  998.                                                                 </td>
  999.                                                                 <td class="right">
  1000.                                                                     <input name="<?php print $row["name"] ?>" id="<?php print $row["name"] ?>" maxlength=255 value="" type="text" style="width: 300px">
  1001.                                                                 </td>
  1002.                                                             </tr>
  1003.                                                             <tr>
  1004.                                                                 <?php
  1005.                                                                 try {
  1006.                                                                     $data=array();
  1007.                                                                     $sql="SELECT * FROM gibbonSetting WHERE scope='System' AND name='gibboneduComOrganisationKey'" ;
  1008.                                                                     $result=$connection2->prepare($sql);
  1009.                                                                     $result->execute($data);
  1010.                                                                 }
  1011.                                                                 catch(PDOException $e) {
  1012.                                                                     print "<div class='error'>" . $e->getMessage() . "</div>" ;
  1013.                                                                 }
  1014.                                                                 $row=$result->fetch() ;
  1015.                                                                 ?>
  1016.                                                                 <td>
  1017.                                                                     <b><?php print _($row["nameDisplay"]) ?></b><br/>
  1018.                                                                     <span style="font-size: 90%"><i><?php if ($row["description"]!="") { print _($row["description"]) ; } ?></i></span>
  1019.                                                                 </td>
  1020.                                                                 <td class="right">
  1021.                                                                     <input name="<?php print $row["name"] ?>" id="<?php print $row["name"] ?>" maxlength=255 value="" type="text" style="width: 300px">
  1022.                                                                 </td>
  1023.                                                             </tr>
  1024.            
  1025.                                                             <tr class='break'>
  1026.                                                                 <td colspan=2>
  1027.                                                                     <h3><?php print _('Miscellaneous') ?></h3>
  1028.                                                                 </td>
  1029.                                                             </tr>
  1030.                                                             <tr>
  1031.                                                                 <?php
  1032.                                                                 try {
  1033.                                                                     $data=array();
  1034.                                                                     $sql="SELECT * FROM gibbonSetting WHERE scope='System' AND name='country'" ;
  1035.                                                                     $result=$connection2->prepare($sql);
  1036.                                                                     $result->execute($data);
  1037.                                                                 }
  1038.                                                                 catch(PDOException $e) {
  1039.                                                                     print "<div class='error'>" . $e->getMessage() . "</div>" ;
  1040.                                                                 }
  1041.                                                                 $row=$result->fetch() ;
  1042.                                                                 ?>
  1043.                                                                 <td>
  1044.                                                                     <b><?php print _($row["nameDisplay"]) ?> *</b><br/>
  1045.                                                                     <span style="font-size: 90%"><i><?php if ($row["description"]!="") { print _($row["description"]) ; } ?></i></span>
  1046.                                                                 </td>
  1047.                                                                 <td class="right">
  1048.                                                                     <select name="<?php print $row["name"] ?>" id="<?php print $row["name"] ?>" style="width: 302px">
  1049.                                                                         <?php
  1050.                                                                         print "<option value='Please select...'>" . _('Please select...') . "</option>" ;
  1051.                                                                         try {
  1052.                                                                             $dataSelect=array();
  1053.                                                                             $sqlSelect="SELECT printable_name FROM gibbonCountry ORDER BY printable_name" ;
  1054.                                                                             $resultSelect=$connection2->prepare($sqlSelect);
  1055.                                                                             $resultSelect->execute($dataSelect);
  1056.                                                                         }
  1057.                                                                         catch(PDOException $e) {
  1058.                                                                             print "<div class='error'>" . $e->getMessage() . "</div>" ;
  1059.                                                                         }
  1060.                                                                         while ($rowSelect=$resultSelect->fetch()) {
  1061.                                                                             print "<option value='" . $rowSelect["printable_name"] . "'>" . _($rowSelect["printable_name"]) . "</option>" ;
  1062.                                                                         }
  1063.                                                                         ?>
  1064.                                                                     </select>
  1065.                                                                     <script type="text/javascript">
  1066.                                                                         var <?php print $row["name"] ?>=new LiveValidation('<?php print $row["name"] ?>');
  1067.                                                                         <?php print $row["name"] ?>.add(Validate.Exclusion, { within: ['Please select...'], failureMessage: "<?php print _('Select something!') ?>"});
  1068.                                                                     </script>
  1069.                                                                 </td>
  1070.                                                             </tr>
  1071.                                                             <tr>
  1072.                                                                 <?php
  1073.                                                                 try {
  1074.                                                                     $data=array();
  1075.                                                                     $sql="SELECT * FROM gibbonSetting WHERE scope='System' AND name='timezone'" ;
  1076.                                                                     $result=$connection2->prepare($sql);
  1077.                                                                     $result->execute($data);
  1078.                                                                 }
  1079.                                                                 catch(PDOException $e) {
  1080.                                                                     print "<div class='error'>" . $e->getMessage() . "</div>" ;
  1081.                                                                 }
  1082.                                                                 $row=$result->fetch() ;
  1083.                                                                 ?>
  1084.                                                                 <td>
  1085.                                                                     <b><?php print _($row["nameDisplay"]) ?> *</b><br/>
  1086.                                                                     <span style="font-size: 90%"><i><?php if ($row["description"]!="") { print _($row["description"]) ; } ?></i></span>
  1087.                                                                 </td>
  1088.                                                                 <td class="right">
  1089.                                                                     <input name="<?php print $row["name"] ?>" id="<?php print $row["name"] ?>" maxlength=50 value="Asia/Hong_Kong" type="text" style="width: 300px">
  1090.                                                                     <script type="text/javascript">
  1091.                                                                         var <?php print $row["name"] ?>=new LiveValidation('<?php print $row["name"] ?>');
  1092.                                                                         <?php print $row["name"] ?>.add(Validate.Presence);
  1093.                                                                     </script>
  1094.                                                                 </td>
  1095.                                                             </tr>
  1096.                                                             <tr>
  1097.                                                                 <?php
  1098.                                                                 try {
  1099.                                                                     $data=array();
  1100.                                                                     $sql="SELECT * FROM gibbonSetting WHERE scope='System' AND name='primaryAssessmentScale'" ;
  1101.                                                                     $result=$connection2->prepare($sql);
  1102.                                                                     $result->execute($data);
  1103.                                                                 }
  1104.                                                                 catch(PDOException $e) {
  1105.                                                                     print "<div class='error'>" . $e->getMessage() . "</div>" ;
  1106.                                                                 }
  1107.                                                                 $row=$result->fetch() ;
  1108.                                                                 ?>
  1109.                                                                 <td>
  1110.                                                                     <b><?php print _($row["nameDisplay"]) ?> *</b><br/>
  1111.                                                                     <span style="font-size: 90%"><i><?php if ($row["description"]!="") { print _($row["description"]) ; } ?></i></span>
  1112.                                                                 </td>
  1113.                                                                 <td class="right">
  1114.                                                                     <select name="<?php print $row["name"] ?>" id="<?php print $row["name"] ?>" style="width: 302px">
  1115.                                                                         <?php
  1116.                                                                         print "<option value='Please select...'>" . _('Please select...') . "</option>" ;
  1117.                                                                         try {
  1118.                                                                             $dataSelect=array();
  1119.                                                                             $sqlSelect="SELECT * FROM gibbonScale WHERE active='Y' ORDER BY name" ;
  1120.                                                                             $resultSelect=$connection2->prepare($sqlSelect);
  1121.                                                                             $resultSelect->execute($dataSelect);
  1122.                                                                         }
  1123.                                                                         catch(PDOException $e) {
  1124.                                                                             print "<div class='error'>" . $e->getMessage() . "</div>" ;
  1125.                                                                         }
  1126.                                                                         while ($rowSelect=$resultSelect->fetch()) {
  1127.                                                                             print "<option value='" . $rowSelect["gibbonScaleID"] . "'>" . _($rowSelect["name"]) . "</option>" ;
  1128.                                                                         }
  1129.                                                                         ?>         
  1130.                                                                     </select>
  1131.                                                                     <script type="text/javascript">
  1132.                                                                         var <?php print $row["name"] ?>=new LiveValidation('<?php print $row["name"] ?>');
  1133.                                                                         <?php print $row["name"] ?>.add(Validate.Exclusion, { within: ['Please select...'], failureMessage: "<?php print _('Select something!') ?>"});
  1134.                                                                     </script>
  1135.                                                                 </td>
  1136.                                                             </tr>
  1137.            
  1138.                                                             <tr>
  1139.                                                                 <td>
  1140.                                                                     <span style="font-size: 90%"><i>* <?php print _("denotes a required field") ; ?></i></span>
  1141.                                                                 </td>
  1142.                                                                 <td class="right">
  1143.                                                                     <input type="hidden" name="code" value="<?php print $code ?>">
  1144.                                                                     <input type="hidden" name="databaseServer" value="<?php print $databaseServer ?>">
  1145.                                                                     <input type="hidden" name="databaseName" value="<?php print $databaseName ?>">
  1146.                                                                     <input type="hidden" name="databaseUsername" value="<?php print $databaseUsername ?>">
  1147.                                                                     <input type="hidden" name="databasePassword" value="<?php print $databasePassword ?>">
  1148.                                                                     <input type="submit" value="<?php print _("Submit") ; ?>">
  1149.                                                                 </td>
  1150.                                                             </tr>
  1151.                                                         </table>
  1152.                                                     </form>
  1153.                                                     <?php
  1154.                                                 }
  1155.                                             }
  1156.                                         }
  1157.                                     }
  1158.                                 }  
  1159.                             }
  1160.                             else if ($step==3) {
  1161.                                 $connected3=TRUE ;
  1162.                                 try {
  1163.                                     $connection2=new PDO("mysql:host=$databaseServer;dbname=$databaseName;charset=utf8", $databaseUsername, $databasePassword);
  1164.                                     $connection2->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  1165.                                     $connection2->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
  1166.                                 }
  1167.                                 catch(PDOException $e) {
  1168.                                     $connected3=FALSE ;
  1169.                                     print "<div class='error'>" ;
  1170.                                         print sprintf(_('A database connection could not be established. Please %1$stry again%2$s.'), "<a href='./install.php'>", "</a>") ;
  1171.                                     print "</div>" ;
  1172.                                 }
  1173.                                
  1174.                                 if ($connected3) {
  1175.                                     //Get user account details
  1176.                                     $title=$_POST["title"] ;    
  1177.                                     $surname=$_POST["surname"] ;
  1178.                                     $firstName=$_POST["firstName"] ;
  1179.                                     $preferredName=$_POST["firstName"] ;
  1180.                                     $username=$_POST["username"] ;
  1181.                                     $password=$_POST["password"] ;
  1182.                                     $passwordConfirm=$_POST["passwordConfirm"] ;
  1183.                                     $email=$_POST["email"] ;
  1184.                                     $support=FALSE ;
  1185.                                     if (isset($_POST["support"])) {
  1186.                                         if ($_POST["support"]=="true") {
  1187.                                             $support=TRUE ;
  1188.                                         }
  1189.                                     }
  1190.                                    
  1191.                                     //Get system settings
  1192.                                     $absoluteURL=$_POST["absoluteURL"] ;    
  1193.                                     $absolutePath=$_POST["absolutePath"] ;  
  1194.                                     $systemName=$_POST["systemName"] ;
  1195.                                     $organisationName=$_POST["organisationName"] ;
  1196.                                     $organisationNameShort=$_POST["organisationNameShort"] ;
  1197.                                     $currency=$_POST["currency"] ;
  1198.                                     $timezone=$_POST["timezone"] ;
  1199.                                     $country=$_POST["country"] ;
  1200.                                     $primaryAssessmentScale=$_POST["primaryAssessmentScale"] ;
  1201.                                     $installType=$_POST["installType"] ;
  1202.                                     $statsCollection=$_POST["statsCollection"] ;
  1203.                                     $cuttingEdgeCode=$_POST["cuttingEdgeCode"] ;
  1204.                                     $gibboneduComOrganisationName=$_POST["gibboneduComOrganisationName"] ;
  1205.                                     $gibboneduComOrganisationKey=$_POST["gibboneduComOrganisationKey"] ;
  1206.                                
  1207.                                     if ($surname=="" OR $firstName=="" OR $preferredName=="" OR $email=="" OR $username=="" OR $password=="" OR $passwordConfirm=="" OR $email=="" OR $absoluteURL=="" OR $absolutePath=="" OR $systemName=="" OR $organisationName=="" OR $organisationNameShort=="" OR $timezone=="" OR $country=="" OR $primaryAssessmentScale=="" OR $installType=="" OR $statsCollection=="" OR $cuttingEdgeCode=="") {
  1208.                                         print "<div class='error'>" ;
  1209.                                             print _("Some required fields have not been set, and so installation cannot proceed.") ;
  1210.                                         print "</div>" ;
  1211.                                     }
  1212.                                     else {
  1213.                                         //Check passwords for match
  1214.                                         if ($password!=$passwordConfirm) {
  1215.                                             print "<div class='error'>" ;
  1216.                                                 print _("Your request failed because your passwords did not match.") ;
  1217.                                             print "</div>" ;
  1218.                                         }
  1219.                                         else {
  1220.                                             $salt=getSalt() ;
  1221.                                             $passwordStrong=hash("sha256", $salt.$password) ;
  1222.                                            
  1223.                                             $userFail=false ;
  1224.                                             //Write to database
  1225.                                             try {
  1226.                                                 $data=array("title"=>$title, "surname"=>$surname, "firstName"=>$firstName, "preferredName"=>$preferredName, "officialName"=>($firstName . " " . $surname), "username"=>$username, "passwordStrong"=>$passwordStrong, "passwordStrongSalt"=>$salt, "status"=>'Full', "canLogin"=>'Y', "passwordForceReset"=>'N', "gibbonRoleIDPrimary"=>"001", "gibbonRoleIDAll"=>"001", "email"=>$email) ;
  1227.                                                 $sql="INSERT INTO gibbonPerson SET gibbonPersonID=1, title=:title, surname=:surname, firstName=:firstName, preferredName=:preferredName, officialName=:officialName, username=:username, password='', passwordStrong=:passwordStrong, passwordStrongSalt=:passwordStrongSalt, status=:status, canLogin=:canLogin, passwordForceReset=:passwordForceReset, gibbonRoleIDPrimary=:gibbonRoleIDPrimary, gibbonRoleIDAll=:gibbonRoleIDAll, email=:email" ;
  1228.                                                 $result=$connection2->prepare($sql);
  1229.                                                 $result->execute($data);
  1230.                                             }
  1231.                                             catch(PDOException $e) {
  1232.                                                 $userFail=true ;
  1233.                                                 print "<div class='error'>" ;
  1234.                                                     print sprintf(_('Errors occurred in populating the database; empty your database, remove ../config.php and %1$stry again%2$s.'), "<a href='./install.php'>", "</a>") ;
  1235.                                                 print "</div>" ;
  1236.                                             }
  1237.                                            
  1238.                                             try {
  1239.                                                 $dataStaff=array("gibbonPersonID"=>1, "type"=>'Teaching') ;
  1240.                                                 $sqlStaff="INSERT INTO gibbonStaff SET gibbonPersonID=1, type='Teaching'" ;
  1241.                                                 $resultStaff=$connection2->prepare($sqlStaff);
  1242.                                                 $resultStaff->execute($dataStaff);
  1243.                                             }
  1244.                                             catch(PDOException $e) { }
  1245.                                            
  1246.                                             if ($userFail==false) {
  1247.                                                 $settingsFail=FALSE ;      
  1248.                                                 try {
  1249.                                                     $data=array("absoluteURL"=>$absoluteURL);
  1250.                                                     $sql="UPDATE gibbonSetting SET value=:absoluteURL WHERE scope='System' AND name='absoluteURL'" ;
  1251.                                                     $result=$connection2->prepare($sql);
  1252.                                                     $result->execute($data);
  1253.                                                 }
  1254.                                                 catch(PDOException $e) {
  1255.                                                     $settingsFail=TRUE ;
  1256.                                                 }
  1257.    
  1258.                                                 try {
  1259.                                                     $data=array("absolutePath"=>$absolutePath);
  1260.                                                     $sql="UPDATE gibbonSetting SET value=:absolutePath WHERE scope='System' AND name='absolutePath'" ;
  1261.                                                     $result=$connection2->prepare($sql);
  1262.                                                     $result->execute($data);
  1263.                                                 }
  1264.                                                 catch(PDOException $e) {
  1265.                                                     $settingsFail=TRUE ;
  1266.                                                 }
  1267.    
  1268.                                                 try {
  1269.                                                     $data=array("systemName"=>$systemName);
  1270.                                                     $sql="UPDATE gibbonSetting SET value=:systemName WHERE scope='System' AND name='systemName'" ;
  1271.                                                     $result=$connection2->prepare($sql);
  1272.                                                     $result->execute($data);
  1273.                                                 }
  1274.                                                 catch(PDOException $e) {
  1275.                                                     $settingsFail=TRUE ;
  1276.                                                 }
  1277.    
  1278.                                                 try {
  1279.                                                     $data=array("organisationName"=>$organisationName);
  1280.                                                     $sql="UPDATE gibbonSetting SET value=:organisationName WHERE scope='System' AND name='organisationName'" ;
  1281.                                                     $result=$connection2->prepare($sql);
  1282.                                                     $result->execute($data);
  1283.                                                 }
  1284.                                                 catch(PDOException $e) {
  1285.                                                     $settingsFail=TRUE ;
  1286.                                                 }
  1287.    
  1288.                                                 try {
  1289.                                                     $data=array("organisationNameShort"=>$organisationNameShort);
  1290.                                                     $sql="UPDATE gibbonSetting SET value=:organisationNameShort WHERE scope='System' AND name='organisationNameShort'" ;
  1291.                                                     $result=$connection2->prepare($sql);
  1292.                                                     $result->execute($data);
  1293.                                                 }
  1294.                                                 catch(PDOException $e) {
  1295.                                                     $settingsFail=TRUE ;
  1296.                                                 }
  1297.                                                
  1298.                                                 try {
  1299.                                                     $data=array("currency"=>$currency);
  1300.                                                     $sql="UPDATE gibbonSetting SET value=:currency WHERE scope='System' AND name='currency'" ;
  1301.                                                     $result=$connection2->prepare($sql);
  1302.                                                     $result->execute($data);
  1303.                                                 }
  1304.                                                 catch(PDOException $e) {
  1305.                                                     $fail=TRUE ;
  1306.                                                 }
  1307.    
  1308.                                                 try {
  1309.                                                     $data=array("organisationAdministrator"=>1);
  1310.                                                     $sql="UPDATE gibbonSetting SET value=:organisationAdministrator WHERE scope='System' AND name='organisationAdministrator'" ;
  1311.                                                     $result=$connection2->prepare($sql);
  1312.                                                     $result->execute($data);
  1313.                                                 }
  1314.                                                 catch(PDOException $e) {
  1315.                                                     $settingsFail=TRUE ;
  1316.                                                 }
  1317.                                                
  1318.                                                 try {
  1319.                                                     $data=array("organisationDBA"=>1);
  1320.                                                     $sql="UPDATE gibbonSetting SET value=:organisationDBA WHERE scope='System' AND name='organisationDBA'" ;
  1321.                                                     $result=$connection2->prepare($sql);
  1322.                                                     $result->execute($data);
  1323.                                                 }
  1324.                                                 catch(PDOException $e) {
  1325.                                                     $settingsFail=TRUE ;
  1326.                                                 }
  1327.                                                
  1328.                                                 try {
  1329.                                                     $data=array("organisationAdmissions"=>1);
  1330.                                                     $sql="UPDATE gibbonSetting SET value=:organisationAdmissions WHERE scope='System' AND name='organisationAdmissions'" ;
  1331.                                                     $result=$connection2->prepare($sql);
  1332.                                                     $result->execute($data);
  1333.                                                 }
  1334.                                                 catch(PDOException $e) {
  1335.                                                     $settingsFail=TRUE ;
  1336.                                                 }
  1337.                                                
  1338.                                                 try {
  1339.                                                     $data=array("country"=>$country);
  1340.                                                     $sql="UPDATE gibbonSetting SET value=:country WHERE scope='System' AND name='country'" ;
  1341.                                                     $result=$connection2->prepare($sql);
  1342.                                                     $result->execute($data);
  1343.                                                 }
  1344.                                                 catch(PDOException $e) {
  1345.                                                     $settingsFail=TRUE ;
  1346.                                                 }
  1347.    
  1348.                                                 try {
  1349.                                                     $data=array("gibboneduComOrganisationName"=>$gibboneduComOrganisationName);
  1350.                                                     $sql="UPDATE gibbonSetting SET value=:gibboneduComOrganisationName WHERE scope='System' AND name='gibboneduComOrganisationName'" ;
  1351.                                                     $result=$connection2->prepare($sql);
  1352.                                                     $result->execute($data);
  1353.                                                 }
  1354.                                                 catch(PDOException $e) {
  1355.                                                     $settingsFail=TRUE ;
  1356.                                                 }
  1357.    
  1358.                                                 try {
  1359.                                                     $data=array("gibboneduComOrganisationKey"=>$gibboneduComOrganisationKey);
  1360.                                                     $sql="UPDATE gibbonSetting SET value=:gibboneduComOrganisationKey WHERE scope='System' AND name='gibboneduComOrganisationKey'" ;
  1361.                                                     $result=$connection2->prepare($sql);
  1362.                                                     $result->execute($data);
  1363.                                                 }
  1364.                                                 catch(PDOException $e) {
  1365.                                                     $settingsFail=TRUE ;
  1366.                                                 }
  1367.    
  1368.                                                 try {
  1369.                                                     $data=array("timezone"=>$timezone);
  1370.                                                     $sql="UPDATE gibbonSetting SET value=:timezone WHERE scope='System' AND name='timezone'" ;
  1371.                                                     $result=$connection2->prepare($sql);
  1372.                                                     $result->execute($data);
  1373.                                                 }
  1374.                                                 catch(PDOException $e) {
  1375.                                                     $settingsFail=TRUE ;
  1376.                                                 }
  1377.    
  1378.                                                 try {
  1379.                                                     $data=array("primaryAssessmentScale"=>$primaryAssessmentScale);
  1380.                                                     $sql="UPDATE gibbonSetting SET value=:primaryAssessmentScale WHERE scope='System' AND name='primaryAssessmentScale'" ;
  1381.                                                     $result=$connection2->prepare($sql);
  1382.                                                     $result->execute($data);
  1383.                                                 }
  1384.                                                 catch(PDOException $e) {
  1385.                                                     $settingsFail=TRUE ;
  1386.                                                 }
  1387.    
  1388.                                                 try {
  1389.                                                     $data=array("installType"=>$installType);
  1390.                                                     $sql="UPDATE gibbonSetting SET value=:installType WHERE scope='System' AND name='installType'" ;
  1391.                                                     $result=$connection2->prepare($sql);
  1392.                                                     $result->execute($data);
  1393.                                                 }
  1394.                                                 catch(PDOException $e) {
  1395.                                                     $settingsFail=TRUE ;
  1396.                                                 }
  1397.    
  1398.                                                 try {
  1399.                                                     $data=array("statsCollection"=>$statsCollection);
  1400.                                                     $sql="UPDATE gibbonSetting SET value=:statsCollection WHERE scope='System' AND name='statsCollection'" ;
  1401.                                                     $result=$connection2->prepare($sql);
  1402.                                                     $result->execute($data);
  1403.                                                 }
  1404.                                                 catch(PDOException $e) {
  1405.                                                     $settingsFail=TRUE ;
  1406.                                                 }
  1407.                                        
  1408.                                                 if ($statsCollection=="Y") {
  1409.                                                     $absolutePathProtocol="" ;
  1410.                                                     $absolutePath="" ;
  1411.                                                     if (substr($absoluteURL,0,7)=="http://") {
  1412.                                                         $absolutePathProtocol="http" ;
  1413.                                                         $absolutePath=substr($absoluteURL,7) ;
  1414.                                                     }
  1415.                                                     else if (substr($absoluteURL,0,8)=="https://") {
  1416.                                                         $absolutePathProtocol="https" ;
  1417.                                                         $absolutePath=substr($absoluteURL,8) ;
  1418.                                                     }
  1419.                                                     print "<iframe style='display: none; height: 10px; width: 10px' src='https://gibbonedu.org/services/tracker/tracker.php?absolutePathProtocol=" . urlencode($absolutePathProtocol) . "&absolutePath=" . urlencode($absolutePath) . "&organisationName=" . urlencode($organisationName) . "&type=" . urlencode($installType) . "&version=" . urlencode($version) . "&country=" . $country . "&usersTotal=1&usersFull=1'></iframe>" ;
  1420.                                                 }
  1421.                                    
  1422.                                                 try {
  1423.                                                     $data=array("cuttingEdgeCode"=>$cuttingEdgeCode);
  1424.                                                     $sql="UPDATE gibbonSetting SET value=:cuttingEdgeCode WHERE scope='System' AND name='cuttingEdgeCode'" ;
  1425.                                                     $result=$connection2->prepare($sql);
  1426.                                                     $result->execute($data);
  1427.                                                 }
  1428.                                                 catch(PDOException $e) {
  1429.                                                     $settingsFail=TRUE ;
  1430.                                                 }
  1431.                                                 if ($cuttingEdgeCode=="Y") {
  1432.                                                     include "../CHANGEDB.php" ;
  1433.                                                     $sqlTokens=explode(";end", $sql[(count($sql))][1]) ;
  1434.                                                     $versionMaxLinesMax=(count($sqlTokens)-1) ;
  1435.                                                     $tokenCount=0 ;
  1436.                                                     try {
  1437.                                                         $data=array("cuttingEdgeCodeLine"=>$versionMaxLinesMax);
  1438.                                                         $sql="UPDATE gibbonSetting SET value=:cuttingEdgeCodeLine WHERE scope='System' AND name='cuttingEdgeCodeLine'" ;
  1439.                                                         $result=$connection2->prepare($sql);
  1440.                                                         $result->execute($data);
  1441.                                                     }
  1442.                                                     catch(PDOException $e) { }
  1443.                                                    
  1444.                                                     foreach ($sqlTokens AS $sqlToken) {
  1445.                                                         if ($tokenCount<=$versionMaxLinesMax) { //Decide whether this has been run or not
  1446.                                                             if (trim($sqlToken)!="") {
  1447.                                                                 try {
  1448.                                                                     $result=$connection2->query($sqlToken);
  1449.                                                                 }
  1450.                                                                 catch(PDOException $e) {
  1451.                                                                     $partialFail=TRUE;
  1452.                                                                 }
  1453.                                                             }
  1454.                                                         }
  1455.                                                         $tokenCount++ ;
  1456.                                                     }
  1457.                                                 }
  1458.                                                
  1459.                                                 //Deal with request to receive welcome email by calling gibbonedu.org iframe
  1460.                                                 if ($support==TRUE) {
  1461.                                                     $absolutePathProtocol="" ;
  1462.                                                     $absolutePath="" ;
  1463.                                                     if (substr($absoluteURL,0,7)=="http://") {
  1464.                                                         $absolutePathProtocol="http" ;
  1465.                                                         $absolutePath=substr($absoluteURL,7) ;
  1466.                                                     }
  1467.                                                     else if (substr($absoluteURL,0,8)=="https://") {
  1468.                                                         $absolutePathProtocol="https" ;
  1469.                                                         $absolutePath=substr($absoluteURL,8) ;
  1470.                                                     }
  1471.                                                     print "<iframe class='support' style='display: none; height: 10px; width: 10px' src='https://gibbonedu.org/services/support/supportRegistration.php?absolutePathProtocol=" . urlencode($absolutePathProtocol) . "&absolutePath=" . urlencode($absolutePath) . "&organisationName=" . urlencode($organisationName) . "&email=" . urlencode($email) . "&title=" . urlencode($title) . "&surname=" . urlencode($surname) . "&preferredName=" . urlencode($preferredName) . "'></iframe>" ;
  1472.                                                 }
  1473.                                                                                            
  1474.                                                 if ($settingsFail==TRUE) {
  1475.                                                     print "<div class='error'>" ;
  1476.                                                         print sprintf(_('Some settings did not save. The system may work, but you may need to remove everything and start again. Try and %1$sgo to your Gibbon homepage%2$s and login as user <u>admin</u> with password <u>gibbon</u>.'), "<a href='$absoluteURL'>", "</a>") ;
  1477.                                                         print "<br/><br/>" ;
  1478.                                                         print sprintf(_('It is also advisable to follow the %1$sPost-Install and Server Config instructions%2$s.'), "<a target='_blank' href='https://gibbonedu.org/support/administrators/installing-gibbon/'>", "</a>") ;
  1479.                                                     print "</div>" ;
  1480.                                                 }
  1481.                                                 else {
  1482.                                                     print "<div class='success'>" ;
  1483.                                                         print sprintf(_('Congratulations, your installation is complete. Feel free to %1$sgo to your Gibbon homepage%2$s and login with the username and password you created.'), "<a href='$absoluteURL'>", "</a>") ;
  1484.                                                         print "<br/><br/>" ;
  1485.                                                         print sprintf(_('It is also advisable to follow the %1$sPost-Install and Server Config instructions%2$s.'), "<a target='_blank' href='https://gibbonedu.org/support/administrators/installing-gibbon/'>", "</a>") ;
  1486.                                                     print "</div>" ;
  1487.                                                 }
  1488.                                             }
  1489.                                         }
  1490.                                     }
  1491.                                 }
  1492.                             }
  1493.                        
  1494.                         ?>
  1495.                     </div>
  1496.         </section><!-- /.content -->
  1497.       </div><!-- /.content-wrapper -->
  1498.  
  1499.       <footer class="main-footer">
  1500.         <div class="pull-right hidden-xs">
  1501.           <b>Version</b> 2.3.0
  1502.         </div>
  1503.         <strong>Copyright &copy; 2014-2015 <a href="http://almsaeedstudio.com">Almsaeed Studio</a>.</strong> All rights reserved.
  1504.       </footer>
  1505.  
  1506.       <!-- Control Sidebar -->
  1507.       <aside class="control-sidebar control-sidebar-dark">
  1508.         <!-- Create the tabs -->
  1509.         <ul class="nav nav-tabs nav-justified control-sidebar-tabs">
  1510.           <li><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
  1511.           <li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
  1512.         </ul>
  1513.         <!-- Tab panes -->
  1514.         <div class="tab-content">
  1515.           <!-- Home tab content -->
  1516.           <div class="tab-pane" id="control-sidebar-home-tab">
  1517.             <h3 class="control-sidebar-heading">Recent Activity</h3>
  1518.             <ul class="control-sidebar-menu">
  1519.               <li>
  1520.                 <a href="javascript::;">
  1521.                   <i class="menu-icon fa fa-birthday-cake bg-red"></i>
  1522.                   <div class="menu-info">
  1523.                     <h4 class="control-sidebar-subheading">Langdon's Birthday</h4>
  1524.                     <p>Will be 23 on April 24th</p>
  1525.                   </div>
  1526.                 </a>
  1527.               </li>
  1528.               <li>
  1529.                 <a href="javascript::;">
  1530.                   <i class="menu-icon fa fa-user bg-yellow"></i>
  1531.                   <div class="menu-info">
  1532.                     <h4 class="control-sidebar-subheading">Frodo Updated His Profile</h4>
  1533.                     <p>New phone +1(800)555-1234</p>
  1534.                   </div>
  1535.                 </a>
  1536.               </li>
  1537.               <li>
  1538.                 <a href="javascript::;">
  1539.                   <i class="menu-icon fa fa-envelope-o bg-light-blue"></i>
  1540.                   <div class="menu-info">
  1541.                     <h4 class="control-sidebar-subheading">Nora Joined Mailing List</h4>
  1542.                     <p>nora@example.com</p>
  1543.                   </div>
  1544.                 </a>
  1545.               </li>
  1546.               <li>
  1547.                 <a href="javascript::;">
  1548.                   <i class="menu-icon fa fa-file-code-o bg-green"></i>
  1549.                   <div class="menu-info">
  1550.                     <h4 class="control-sidebar-subheading">Cron Job 254 Executed</h4>
  1551.                     <p>Execution time 5 seconds</p>
  1552.                   </div>
  1553.                 </a>
  1554.               </li>
  1555.             </ul><!-- /.control-sidebar-menu -->
  1556.  
  1557.             <h3 class="control-sidebar-heading">Tasks Progress</h3>
  1558.             <ul class="control-sidebar-menu">
  1559.               <li>
  1560.                 <a href="javascript::;">
  1561.                   <h4 class="control-sidebar-subheading">
  1562.                     Custom Template Design
  1563.                     <span class="label label-danger pull-right">70%</span>
  1564.                   </h4>
  1565.                   <div class="progress progress-xxs">
  1566.                     <div class="progress-bar progress-bar-danger" style="width: 70%"></div>
  1567.                   </div>
  1568.                 </a>
  1569.               </li>
  1570.               <li>
  1571.                 <a href="javascript::;">
  1572.                   <h4 class="control-sidebar-subheading">
  1573.                     Update Resume
  1574.                     <span class="label label-success pull-right">95%</span>
  1575.                   </h4>
  1576.                   <div class="progress progress-xxs">
  1577.                     <div class="progress-bar progress-bar-success" style="width: 95%"></div>
  1578.                   </div>
  1579.                 </a>
  1580.               </li>
  1581.               <li>
  1582.                 <a href="javascript::;">
  1583.                   <h4 class="control-sidebar-subheading">
  1584.                     Laravel Integration
  1585.                     <span class="label label-warning pull-right">50%</span>
  1586.                   </h4>
  1587.                   <div class="progress progress-xxs">
  1588.                     <div class="progress-bar progress-bar-warning" style="width: 50%"></div>
  1589.                   </div>
  1590.                 </a>
  1591.               </li>
  1592.               <li>
  1593.                 <a href="javascript::;">
  1594.                   <h4 class="control-sidebar-subheading">
  1595.                     Back End Framework
  1596.                     <span class="label label-primary pull-right">68%</span>
  1597.                   </h4>
  1598.                   <div class="progress progress-xxs">
  1599.                     <div class="progress-bar progress-bar-primary" style="width: 68%"></div>
  1600.                   </div>
  1601.                 </a>
  1602.               </li>
  1603.             </ul><!-- /.control-sidebar-menu -->
  1604.  
  1605.           </div><!-- /.tab-pane -->
  1606.           <!-- Stats tab content -->
  1607.           <div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div><!-- /.tab-pane -->
  1608.           <!-- Settings tab content -->
  1609.           <div class="tab-pane" id="control-sidebar-settings-tab">
  1610.             <form method="post">
  1611.               <h3 class="control-sidebar-heading">General Settings</h3>
  1612.               <div class="form-group">
  1613.                 <label class="control-sidebar-subheading">
  1614.                   Report panel usage
  1615.                   <input type="checkbox" class="pull-right" checked>
  1616.                 </label>
  1617.                 <p>
  1618.                   Some information about this general settings option
  1619.                 </p>
  1620.               </div><!-- /.form-group -->
  1621.  
  1622.               <div class="form-group">
  1623.                 <label class="control-sidebar-subheading">
  1624.                   Allow mail redirect
  1625.                   <input type="checkbox" class="pull-right" checked>
  1626.                 </label>
  1627.                 <p>
  1628.                   Other sets of options are available
  1629.                 </p>
  1630.               </div><!-- /.form-group -->
  1631.  
  1632.               <div class="form-group">
  1633.                 <label class="control-sidebar-subheading">
  1634.                   Expose author name in posts
  1635.                   <input type="checkbox" class="pull-right" checked>
  1636.                 </label>
  1637.                 <p>
  1638.                   Allow the user to show his name in blog posts
  1639.                 </p>
  1640.               </div><!-- /.form-group -->
  1641.  
  1642.               <h3 class="control-sidebar-heading">Chat Settings</h3>
  1643.  
  1644.               <div class="form-group">
  1645.                 <label class="control-sidebar-subheading">
  1646.                   Show me as online
  1647.                   <input type="checkbox" class="pull-right" checked>
  1648.                 </label>
  1649.               </div><!-- /.form-group -->
  1650.  
  1651.               <div class="form-group">
  1652.                 <label class="control-sidebar-subheading">
  1653.                   Turn off notifications
  1654.                   <input type="checkbox" class="pull-right">
  1655.                 </label>
  1656.               </div><!-- /.form-group -->
  1657.  
  1658.               <div class="form-group">
  1659.                 <label class="control-sidebar-subheading">
  1660.                   Delete chat history
  1661.                   <a href="javascript::;" class="text-red pull-right"><i class="fa fa-trash-o"></i></a>
  1662.                 </label>
  1663.               </div><!-- /.form-group -->
  1664.             </form>
  1665.           </div><!-- /.tab-pane -->
  1666.         </div>
  1667.       </aside><!-- /.control-sidebar -->
  1668.       <!-- Add the sidebar's background. This div must be placed
  1669.           immediately after the control sidebar -->
  1670.       <div class="control-sidebar-bg"></div>
  1671.      
  1672.      
  1673.     </div><!-- ./wrapper -->
  1674.  
  1675.     <!-- jQuery 2.1.4 -->
  1676.     <script src="../plugins/jQuery/jQuery-2.1.4.min.js"></script>
  1677.     <!-- Bootstrap 3.3.5 -->
  1678.     <script src="../themes/Default/bootstrap/js/bootstrap.min.js"></script>
  1679.     <!-- SlimScroll -->
  1680.     <script src="../plugins/slimScroll/jquery.slimscroll.min.js"></script>
  1681.     <!-- FastClick -->
  1682.     <script src="../plugins/fastclick/fastclick.min.js"></script>
  1683.     <!-- AdminLTE App -->
  1684.     <script src="../themes/Default/js/app.min.js"></script>
  1685.     <!-- AdminLTE for demo purposes -->
  1686.     <script src="../themes/Default/js/demo.js"></script>
  1687.     <script src="../plugins/select2/select2.full.min.js"></script>
  1688.     <script>
  1689.       $(function () {
  1690.         //Initialize Select2 Elements
  1691.         $(".select2").select2();
  1692.  
  1693.         //Datemask dd/mm/yyyy
  1694.         $("#datemask").inputmask("dd/mm/yyyy", {"placeholder": "dd/mm/yyyy"});
  1695.         //Datemask2 mm/dd/yyyy
  1696.         $("#datemask2").inputmask("mm/dd/yyyy", {"placeholder": "mm/dd/yyyy"});
  1697.         //Money Euro
  1698.         $("[data-mask]").inputmask();
  1699.  
  1700.         //Date range picker
  1701.         $('#reservation').daterangepicker();
  1702.         //Date range picker with time picker
  1703.         $('#reservationtime').daterangepicker({timePicker: true, timePickerIncrement: 30, format: 'MM/DD/YYYY h:mm A'});
  1704.         //Date range as a button
  1705.         $('#daterange-btn').daterangepicker(
  1706.             {
  1707.               ranges: {
  1708.                 'Today': [moment(), moment()],
  1709.                 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
  1710.                 'Last 7 Days': [moment().subtract(6, 'days'), moment()],
  1711.                 'Last 30 Days': [moment().subtract(29, 'days'), moment()],
  1712.                 'This Month': [moment().startOf('month'), moment().endOf('month')],
  1713.                 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
  1714.               },
  1715.               startDate: moment().subtract(29, 'days'),
  1716.               endDate: moment()
  1717.             },
  1718.         function (start, end) {
  1719.           $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
  1720.         }
  1721.         );
  1722.  
  1723.         //iCheck for checkbox and radio inputs
  1724.         $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
  1725.           checkboxClass: 'icheckbox_minimal-blue',
  1726.           radioClass: 'iradio_minimal-blue'
  1727.         });
  1728.         //Red color scheme for iCheck
  1729.         $('input[type="checkbox"].minimal-red, input[type="radio"].minimal-red').iCheck({
  1730.           checkboxClass: 'icheckbox_minimal-red',
  1731.           radioClass: 'iradio_minimal-red'
  1732.         });
  1733.         //Flat red color scheme for iCheck
  1734.         $('input[type="checkbox"].flat-red, input[type="radio"].flat-red').iCheck({
  1735.           checkboxClass: 'icheckbox_flat-green',
  1736.           radioClass: 'iradio_flat-green'
  1737.         });
  1738.  
  1739.         //Colorpicker
  1740.         $(".my-colorpicker1").colorpicker();
  1741.         //color picker with addon
  1742.         $(".my-colorpicker2").colorpicker();
  1743.  
  1744.         //Timepicker
  1745.         $(".timepicker").timepicker({
  1746.           showInputs: false
  1747.         });
  1748.       });
  1749.     </script>
  1750.   </body>
  1751. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement