Example #1
0
 /**
  * checks from requirements if its compatible or not. Also fills the msg variable
  * @return boolean 
  */
 public static function is_compatible()
 {
     self::$msg = '';
     $compatible = TRUE;
     foreach (install::requirements() as $values) {
         if ($values['mandatory'] == TRUE and $values['result'] == FALSE) {
             $compatible = FALSE;
         }
         if ($values['result'] == FALSE) {
             self::$msg .= $values['message'] . '<br>';
         }
     }
     return $compatible;
 }
Example #2
0
         mkdir($switch_scripts_dir . '', 0777, true);
     }
     //		if (!is_readable($switch_sounds_dir.'/en/us/callie/custom/8000') && $switch_scripts_dir != "/sounds") { mkdir($switch_sounds_dir.'/en/us/callie/custom/8000',0777,true); }
     //		if (!is_readable($switch_sounds_dir.'/en/us/callie/custom/16000') && $switch_scripts_dir != "/sounds") { mkdir($switch_sounds_dir.'/en/us/callie/custom/16000',0777,true); }
     //		if (!is_readable($switch_sounds_dir.'/en/us/callie/custom/32000') && $switch_scripts_dir != "/sounds") { mkdir($switch_sounds_dir.'/en/us/callie/custom/32000',0777,true); }
     //		if (!is_readable($switch_sounds_dir.'/en/us/callie/custom/48000') && $switch_scripts_dir != "/sounds") { mkdir($switch_sounds_dir.'/en/us/callie/custom/48000',0777,true); }
     if (!is_readable($switch_storage_dir . '/fax/') && $switch_scripts_dir != "/storage") {
         mkdir($switch_storage_dir . '/fax', 0777, true);
     }
     if (!is_readable($switch_recordings_dir . '') && $switch_scripts_dir != "/recordings") {
         mkdir($switch_recordings_dir . '', 0777, true);
     }
 }
 //copy the files and directories from resources/install
 require_once "resources/classes/install.php";
 $install = new install();
 $install->domain_uuid = $_SESSION["domain_uuid"];
 $install->domain = $domain_name;
 $install->switch_conf_dir = $switch_conf_dir;
 $install->switch_scripts_dir = $switch_scripts_dir;
 //	$install->switch_sounds_dir = $switch_sounds_dir;
 $install->copy_conf();
 $install->copy();
 //create the dialplan/default.xml for single tenant or dialplan/domain.xml
 if (file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/app/dialplan")) {
     $dialplan = new dialplan();
     $dialplan->domain_uuid = $_SESSION["domain_uuid"];
     $dialplan->domain = $domain_name;
     $dialplan->switch_dialplan_dir = $switch_dialplan_dir;
     $dialplan->restore_advanced_xml();
     //print_r($dialplan->result);
Example #3
0
// ProEthos under the terms of the ProEthos License as published by PAHO, which
// restricts commercial use of the Software.
//
// ProEthos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
// PARTICULAR PURPOSE. See the ProEthos License for more details.
//
// You should have received a copy of the ProEthos License along with the ProEthos
// Software. If not, see
// https://raw.githubusercontent.com/bireme/proethos/master/LICENSE.txt
require "../db.php";
ini_set('display_errors', 255);
ini_set('error_reporting', 255);
require $include . '_class_debug.php';
require "../_class_install.php";
$inst = new install();
$file_db = $inst->config_file();
//require("../customize_error.php");
/* Valida dados */
$err = 0;
if (strlen($dd[1]) == 0) {
    echo 'Database type not selected';
    exit;
}
/* Valida Servidor */
if (strlen($dd[2]) == 0) {
    echo 'Database host not found';
    exit;
}
/* Valida Database name */
if (strlen($dd[3]) == 0) {
Example #4
0
             $translation->xml_write_db_to_file($modul);
             $info .= t("Modulübersetzung wurde in <b>translation.xml (%1)</b> geschrieben<br \\>", $modul);
         }
         $func->information($info, 'index.php?mod=install&action=translation');
     }
     break;
     // Import Translation to DB from mod_translation.xml
 // Import Translation to DB from mod_translation.xml
 case 60:
     if (!$_GET['confirm'] == "yes") {
         $func->question(t('Achtung!!! Alle vorhandenen Übersetzungen werden von den XML-Dateien in die Datenbank geschrieben'), 'index.php?mod=install&action=translation&step=60&confirm=yes', 'index.php?mod=install&action=translation');
     } else {
         $db->qry("TRUNCATE %prefix%translation");
         $db->qry("TRUNCATE %prefix%translation_long");
         include_once "modules/install/class_install.php";
         $install = new install();
         $install->InsertModules();
         $func->confirmation(t('Die Übersetzungen wurden in die Datenbank eingelesen'), 'index.php?mod=install&action=translation');
     }
     break;
     // Search for Old Text and New Entrys
 // Search for Old Text and New Entrys
 case 70:
     $output = '';
     $dsp->NewContent(t('Veraltete Eintraege'), t('Veraltete Eingtraege die aehnlichkeiten mit einem neuen Eintrag aufweisen'));
     // Show switch between Modules/Files
     $dsp->AddFieldSetStart(t('Modul/File Wechseln.'));
     if ($_POST['target_file']) {
         $_SESSION['target_file'] = $_POST['target_file'];
     }
     if ($_SESSION['target_file'] == '') {
Example #5
0
        ?>
		<input type='submit' value='Proceed' />
		<?php 
    }
    ?>
			
	</form>
</div>
<?php 
} else {
    $dbase = new dbase($dbh);
    $install = new install($dbase, $settings);
    if (!$install->checkdb()) {
        $dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
        $dbase = new dbase($dbh);
        $install = new install($dbase, $settings);
        $install->makedb();
        include 'firstuser.php';
    } else {
        if (!$install->checkfinished()) {
            include 'firstuser.php';
        } else {
            ?>
			<div>Already Installed</div>
		<?php 
        }
    }
}
?>

Example #6
0
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

Modified version of class done by David Marco Martinez
*/
require_once "lib/cls/Web.cls.php";
require_once "cls/install.cls.php";
error_reporting(E_ALL);
// Record the start time of execution
$mtime = microtime(true);
// Start php session BEFORE ANY output
session_start();
// Load conf
//require_once( 'conf/user.conf.php' );
install::setDefines();
require_once 'conf/system.conf.php';
// Build the base of the app
$web = Web::getClass('install');
// Page specific operations and display
if (is_writable(DIR_TPL_COMPILE)) {
    $web->display('install/index');
} else {
    echo "Template dir " . DIR_TPL_COMPILE . " is not writable for webserver. Please change permissions and reload this page.";
}
// Record end time
$ftime = microtime(true);
$total = $ftime - $mtime;
//echo "total: " . $total . 's<br />';
// If end time is shorter than 0.5 segons sleep untill then
if ($total < MIN_TIME) {
Example #7
0
        $CF->unsafeexit("install_error");
    } else {
        // current query is install. let it proceed
        require 'cpgAPIinstall.php';
        $INSTALL = new install();
        $INSTALL->newinstall($CF->getuncheckedvariable("dbserver"), $CF->getuncheckedvariable("dbuser"), $CF->getuncheckedvariable("dbpass"), $CF->getuncheckedvariable("dbname"), $CF->getuncheckedvariable("prefix"), $CF->getuncheckedvariable("adminusername"), $CF->getuncheckedvariable("adminpassword"), $CF->getuncheckedvariable("adminemail"));
    }
}
/* 
 * Uninstall Application -- open currently for debug only
 * @ no paramters
 */
if ($query == 'uninstall') {
    // current query is uninstall. let it proceed
    require 'cpgAPIinstall.php';
    $INSTALL = new install();
    $INSTALL->uninstall();
}
$API_MODE = 0;
/*
 * First check the install, and then do anything else.
 */
$fh = @fopen($DFLT['cfg_d'] . "/" . $DFLT['ins_f'], 'r') or $CF->unsafeexit("init_error");
fclose($fh);
/*
 * Install is OK. Now include the required files and do initialization
 */
$fh = @fopen($DFLT['cfg_d'] . "/" . $DFLT['cfg_f'], 'r') or $API_MODE = 1;
if ($API_MODE == 0) {
    fclose($fh);
    require $DFLT['cfg_d'] . "/" . $DFLT['cfg_f'];
Example #8
0
        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
            <span aria-hidden="true">&times;</span>
        </button>
        <?php 
    echo install::$error_msg;
    ?>
    </div>
<?php 
}
?>

<?php 
if (!empty(install::$msg)) {
    ?>
    <?php 
    if (install::is_compatible()) {
        ?>
        <div class="alert alert-info animated fadeInDown">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
            <?php 
        echo __("We have detected some incompatibilities, installation may not work as expected but you can try.");
        ?>
        </div>
    <?php 
    }
    ?>
    <?php 
    foreach (install::$msg as $msg) {
        ?>
Example #9
0
    }
    $modules = install::get_db_modules();
    for ($i = 0; $i < count($modules); $i++) {
        if ($_POST['db_module'] == $modules[$i]['name']) {
            $sql_file = $modules[$i]['sql'];
            break;
        }
    }
    $sql = install::create_data($_POST['binarys'], $sql_file);
    if ($sql < 0) {
        echo '<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">Не удалось создать или заполнить таблицы в БД</head></html>';
        exit;
    }
    $adm = install::create_root($_POST['admin_login'], $_POST['admin_pass']);
    if ($adm < 0) {
        echo '<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">Не удалось создать учетную запись администратора</head></html>';
        exit;
    }
    $dir = install::create_directories();
    if ($dir < 0) {
        echo '<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">Не удалось создать директории необходимые для сайта</head></html>';
        exit;
    }
    $set = install::set_settings($_POST['title'], $_POST['pass_phrase']);
    if ($set < 0) {
        echo '<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">Не удалось внести изменения в настройки сайта, вы можете сделать это позднее в разделе администратора</head></html>';
        //exit;
    }
    install::finish_installation();
    die('<meta http-equiv="Refresh" content="0; URL=http://' . $_SERVER['HTTP_HOST'] . '">');
}
Example #10
0
     $source = '/usr/share/examples/fusionpbx/resources/templates/conf/sip_profiles';
     $destination = '/etc/fusionpbx/resources/templates/conf/sip_profiles';
 }
 if (file_exists('/usr/local/share/fusionpbx/resources/templates/conf')) {
     //bsd
     $source = '/usr/local/share/fusionpbx/resources/templates/conf/sip_profiles';
     $destination = '/usr/local/etc/fusionpbx/resources/templates/conf/sip_profiles';
 }
 //copy the conf sip profiles to the /etc/fusionpbx/resources/templates/conf directory
 if (strlen($source) > 0 && strlen($destination) > 0) {
     if (!file_exists($destination)) {
         if (file_exists($source)) {
             //add the directory structure
             mkdir($destination, 0777, true);
             //copy from source to destination
             $obj = new install();
             $obj->recursive_copy($source, $destination);
         }
     }
 }
 //add the sip profiles to the database
 $sql = "select count(*) as num_rows from v_sip_profiles ";
 $prep_statement = $db->prepare(check_sql($sql));
 if ($prep_statement) {
     $prep_statement->execute();
     $row = $prep_statement->fetch(PDO::FETCH_ASSOC);
     if ($row['num_rows'] == 0) {
         if (file_exists('/usr/share/examples/fusionpbx/resources/templates/conf/sip_profiles')) {
             $sip_profile_dir = '/usr/share/examples/fusionpbx/resources/templates/conf/sip_profiles/*.xml';
         } elseif (file_exists('/usr/local/share/fusionpbx/resources/templates/conf/sip_profiles')) {
             $sip_profile_dir = '/usr/local/share/fusionpbx/resources/templates/conf/sip_profiles/*.xml';
Example #11
0
</div>

<?php 
foreach (install::requirements() as $name => $values) {
    $color = $values['result'] ? 'success' : 'danger';
    ?>
    <div class="pull-left <?php 
    echo $color;
    ?>
" style=" width: 100px; height: 56px; text-align: center;">
        <h4><i class="glyphicon glyphicon-<?php 
    echo $values['result'] ? "ok" : "remove";
    ?>
"></i>
        <div class="clearfix"></div> 
        <?php 
    printf('<span class="label label-%s">%s</span>', $color, $name);
    ?>
 </h4>
    </div>   
<?php 
}
?>

<div class="clearfix"></div><br>

<div class="hidden" id="phpinfo">
    <?php 
echo str_replace('<table', '<table class="table table-striped table-bordered"', install::phpinfo());
?>
</div>
Example #12
0
<?php

require './config-setup.php';
require '../app/laravel/hash.php';
require '../app/laravel/str.php';
$first_name_error = '';
$last_name_error = '';
$email_error = '';
$pass_error = '';
require './install.php';
$install = new install();
$database_check = $install->check_connect();
$requirement_check = $install->check_requirements();
if (!$database_check['error']) {
    if (isset($_POST['email'])) {
        if ($_POST['email'] != '' && $_POST['first_name'] != '' && $_POST['last_name'] != '' && $_POST['password'] != '') {
            $finish = $install->create_tables($_POST);
            if ($finish) {
                header('location: complete.php');
                die;
            }
        } else {
            if ($_POST['email'] == '') {
                $email_error = 'Valid Email Required';
            }
            if ($_POST['first_name'] == '') {
                $first_name_error = 'First Name Required';
            }
            if ($_POST['last_name'] == '') {
                $last_name_error = 'Last Name Required';
            }
Example #13
0
 /**
  * Perform commands to upgrade/downgrade the version of the class from $from_ver to $to_ver
  * 
  * @param string $from_ver
  * @param string $to_ver
  * @return bool TRUE on success, FALSE on nothing to update
  * @throws exception on command error
  */
 function migrate($from_ver, $to_ver)
 {
     if (version_compare($from_ver, $to_ver) > 0) {
         $this->output("Downgrading from {$from_ver} to {$to_ver}");
         // $from_ver is bigger than to_ver - downgrade
         // Start with the from_ver, and execute each command in reverse order untill
         // reaching to_ver, but to execute any of the to_var commands
         // Example: from_ver = 2.1, to_ver = 1.5
         $prev_ver = false;
         foreach (array_reverse($this->log) as $ver => $commands) {
             if ($prev_ver) {
                 // yeald to the caller - we need to save the installed cache on each mirgated version
                 $this->install->installed[$this->class] = $prev_ver;
                 $this->install->saveInstalled();
             }
             if (version_compare($ver, $to_ver, '<=')) {
                 break;
             }
             // Stop at the "to_ver" w/out executing any of the commands
             // Example - break if ver = 1.5, 1.2, 1.1, but not when ver = 1.8
             if (version_compare($ver, $from_ver, '>')) {
                 continue;
             }
             // Skip commands in the version before entering the from_ver span
             // Example - skip if ver = 2.5 or 3.0 or 2.1.1 BUT NOT IF ver is 2.1 or 2.0.1 or 1.6
             $this->output("Undoing version {$ver}");
             foreach (array_reverse($commands) as $cmd) {
                 if (isset($cmd['down'])) {
                     $this->output("Running {$cmd['callback']}");
                     call_user_func_array(array($this, $cmd['callback']), $cmd['down']);
                 }
             }
             $prev_ver = $ver;
         }
         return true;
     } elseif (version_compare($from_ver, $to_ver) < 0) {
         $this->output("Upgrading from {$from_ver} to {$to_ver}");
         // $to_ver is bigger than from_ver - upgrad
         // Start with the from_ver, but skip it (it is already executed) and move on untill
         // reaching the last of the $to_ver commands
         // Example: from_var = 1.5, to_var=1.9
         foreach ($this->log as $ver => $commands) {
             if (version_compare($ver, $to_ver, '>')) {
                 break;
             }
             // The to_ver must be the lastly exeuted command
             // Example - break if ver = 2.0, 1.9.4, 3.1, but not when ver = 1.8 or 1.0 or 1.9
             if (version_compare($ver, $from_ver, '<=')) {
                 continue;
             }
             // Skip commands in the version before entering the from_ver span, incl the from_ver
             // Example - skip if ver = 1.1 or 1.0 or 1.5 BUT NOT IF ver is 1.5.1 or 2.0 or 1.9
             foreach ($commands as $cmd) {
                 if (isset($cmd['up'])) {
                     $this->output("Running {$cmd['callback']}");
                     call_user_func_array(array($this, $cmd['callback']), $cmd['up']);
                 }
             }
             $this->output("Updated to version {$ver}");
             $this->install->installed[$this->class] = $ver;
             $this->install->saveInstalled();
         }
         return true;
     } else {
         // Versions are equal - nothing to upgrade
         return false;
     }
 }
Example #14
0
<?php

require './config-setup.php';
require '../app/laravel/hash.php';
require '../app/laravel/str.php';
$first_name_error = '';
$last_name_error = '';
$email_error = '';
$pass_error = '';
require './install.php';
$install = new install();
$database_check = $install->check_connect();
if (!$database_check['error']) {
    if (isset($_POST['email'])) {
        if ($_POST['email'] != '' && $_POST['first_name'] != '' && $_POST['last_name'] != '' && $_POST['password'] != '') {
            $finish = $install->create_tables($_POST);
            if ($finish) {
                header('location: complete.php');
                die;
            }
        } else {
            if ($_POST['email'] == '') {
                $email_error = 'Valid Email Required';
            }
            if ($_POST['first_name'] == '') {
                $first_name_error = 'First Name Required';
            }
            if ($_POST['last_name'] == '') {
                $last_name_error = 'Last Name Required';
            }
            if ($_POST['password'] == '') {
Example #15
0
        $infoReplace = file_get_contents($source);
        $infoReplace = str_replace($shortCode, $data, $infoReplace);
        file_put_contents($dest, $infoReplace);
    }
    protected function _messageInit()
    {
        $texts = array('', ' ****************************************', '  Autogenerador para datos de inicio.', '  Antes de empezar es necesario tener los siguientes datos de MySQL:', '  * Usuario', '  * Contraseña', '  * Base de datos', '');
        foreach ($texts as $text) {
            echo $this->_color->getColoredString($text, 'cyan', null) . "\n";
        }
        $continue = readline("Continuar (y/n): ");
        while ($continue == '' || !in_array($continue, array('y', 'n'))) {
            if (!in_array($continue, array('y', 'n'))) {
                $continue = readline("Continuar (y/n): ");
            }
        }
        if ($continue == 'n') {
            die;
        }
        echo "\n";
    }
    protected function _messageEnd()
    {
        $texts = array('', '  Todo a terminado.', '  Ahora a jugar con Zend y Klear', ' ****************************************', '');
        foreach ($texts as $text) {
            echo $this->_color->getColoredString($text, 'cyan', null) . "\n";
        }
    }
}
$install = new install();
$install->start();
Example #16
0
</label>
                                                    <input type="text" id="SITE_NAME" name="SITE_NAME" class="form-control" placeholder="<?php 
    echo __("Site Name");
    ?>
" value="<?php 
    echo core::request('SITE_NAME');
    ?>
" required>
                                                </div>
                                                <div class="form-group">
                                                    <label for="TIMEZONE" class="control-label"><?php 
    echo __("Time Zone");
    ?>
</label>
                                                    <?php 
    echo install::get_select_timezones('TIMEZONE', core::request('TIMEZONE', date_default_timezone_get()));
    ?>
                                                </div>
                                                <div class="form-group">
                                                    <label for="ADMIN_EMAIL" class="control-label"><?php 
    echo __("Administrator email");
    ?>
</label>
                                                    <input type="email" id="ADMIN_EMAIL" name="ADMIN_EMAIL" class="form-control" value="<?php 
    echo core::request('ADMIN_EMAIL');
    ?>
" placeholder="*****@*****.**" required>
                                                </div>
                                                <div class="form-group">
                                                    <label for="ADMIN_PWD" class="control-label"><?php 
    echo __("Admin Password");
Example #17
0
 private function install($ctn)
 {
     if (!$ctn['config']['installed']) {
         $tmp = new install();
         $tmp->install($ctn);
         die;
     }
 }
Example #18
0
$field = $form->addTextField('email', '');
$field->fieldName(lang::get('email'));
$field->addValidator('notEmpty', lang::get('validator_not_empty'));
$field->addValidator('email', lang::get('user_wrong_email'));
$field = $form->addTextField('password', '');
$field->addValidator('notEmpty', lang::get('validator_not_empty'));
$field->fieldName(lang::get('password'));
if ($form->isSubmit()) {
    $sql = sql::connect($form->get('db_host'), $form->get('db_user'), $form->get('db_password'), $form->get('db_database'));
    if (is_null($sql)) {
        $DB = ['host' => $form->get('db_host'), 'user' => $form->get('db_user'), 'password' => $form->get('db_password'), 'database' => $form->get('db_database'), 'prefix' => $form->get('db_prefix')];
        dyn::add('DB', $DB, true);
        dyn::add('setup', false, true);
        dyn::save();
        install::newInstall();
        install::insertDemoContent();
        $template = new template(dyn::get('template'));
        if ($template->install() !== true) {
            $form->setSuccessMessage(null);
            $error = true;
        }
        $form->addParam('page', 'finish');
    } else {
        echo message::danger($sql);
    }
}
echo $form->show();
?>
                
                </div>
        
Example #19
0
">
        </a>    
        <div class="tab-content">
            <div class="tab-pane fade in active" id="home">
                <?php 
install::view($view);
?>
            </div>
            <div class="tab-pane fade" id="requirements">
                <?php 
install::view('requirements');
?>
            </div>
            <div class="tab-pane fade" id="about">
                <?php 
install::view('about');
?>
            </div>
        </div>
           
        <hr>

        <footer>
            <p>
            &copy;  <a href="http://open-eshop.com" title="Open Source PHP digital goods">Open eShop</a> 2013 - <?php 
echo date('Y');
?>
            </p>
        </footer>
    </div> 
    
Example #20
0
 /**
  * installs the software
  * @return [type] [description]
  */
 public static function execute()
 {
     $error_msg = '';
     $install = TRUE;
     $TABLE_PREFIX = '';
     ///////////////////////////////////////////////////////
     //check DB connection
     $link = @mysqli_connect(core::request('DB_HOST'), core::request('DB_USER'), core::request('DB_PASS'));
     if (!$link) {
         $error_msg = __('Cannot connect to server') . ' ' . core::request('DB_HOST');
         $install = FALSE;
     }
     if ($link and $install === TRUE) {
         if (core::request('DB_NAME')) {
             //they selected to create the DB
             if (core::request('DB_CREATE')) {
                 @mysqli_query($link, "CREATE DATABASE IF NOT EXISTS `" . core::request('DB_NAME') . "`");
             }
             $dbcheck = @mysqli_select_db($link, core::request('DB_NAME'));
             if (!$dbcheck) {
                 $error_msg .= __('Database name') . ': ' . mysqli_error($link);
                 $install = FALSE;
             }
         } else {
             $error_msg .= '<p>' . __('No database name was given') . '. ' . __('Available databases') . ':</p>';
             $db_list = @mysqli_query($link, 'SHOW DATABASES');
             $error_msg .= '<pre>';
             if (!$db_list) {
                 $error_msg .= __('Invalid query') . ':<br>' . mysqli_error($link);
             } else {
                 while ($row = mysqli_fetch_assoc($db_list)) {
                     $error_msg .= $row['Database'] . '<br>';
                 }
             }
             $error_msg .= '</pre>';
             $install = FALSE;
         }
     }
     //clean prefix
     $TABLE_PREFIX = core::slug(core::request('TABLE_PREFIX'));
     //save DB config/database.php
     if ($install === TRUE) {
         $_POST['TABLE_PREFIX'] = $TABLE_PREFIX;
         $_GET['TABLE_PREFIX'] = $TABLE_PREFIX;
         $search = array('[DB_HOST]', '[DB_USER]', '[DB_PASS]', '[DB_NAME]', '[TABLE_PREFIX]', '[DB_CHARSET]');
         $replace = array(core::request('DB_HOST'), core::request('DB_USER'), core::request('DB_PASS'), core::request('DB_NAME'), $TABLE_PREFIX, core::request('DB_CHARSET'));
         $install = install::replace_file(INSTALLROOT . 'samples/database.php', $search, $replace, APPPATH . 'config/database.php');
         if (!$install === TRUE) {
             $error_msg = __('Problem saving ' . APPPATH . 'config/database.php');
         }
     }
     //install DB
     if ($install === TRUE) {
         //check if has key is posted if not generate
         self::$hash_key = core::request('HASH_KEY') != '' ? core::request('HASH_KEY') : core::generate_password();
         //check if DB was already installed, I use content since is the last table to be created
         $installed = mysqli_num_rows(mysqli_query($link, "SHOW TABLES LIKE '" . $TABLE_PREFIX . "content'")) == 1 ? TRUE : FALSE;
         if ($installed === FALSE) {
             //if was installed do not launch the SQL.
             include INSTALLROOT . 'samples/install.sql' . EXT;
         }
     }
     ///////////////////////////////////////////////////////
     //AUTH config
     if ($install === TRUE) {
         $search = array('[HASH_KEY]', '[COOKIE_SALT]', '[QL_KEY]');
         $replace = array(self::$hash_key, self::$hash_key, self::$hash_key);
         $install = install::replace_file(INSTALLROOT . 'samples/auth.php', $search, $replace, APPPATH . 'config/auth.php');
         if (!$install === TRUE) {
             $error_msg = __('Problem saving ' . APPPATH . 'config/auth.php');
         }
     }
     ///////////////////////////////////////////////////////
     //create robots.txt
     if ($install === TRUE) {
         $search = array('[SITE_URL]', '[SITE_FOLDER]');
         $replace = array(core::request('SITE_URL'), core::request('SITE_FOLDER'));
         $install = install::replace_file(INSTALLROOT . 'samples/robots.txt', $search, $replace, DOCROOT . 'robots.txt');
         if (!$install === TRUE) {
             $error_msg = __('Problem saving ' . DOCROOT . 'robots.txt');
         }
     }
     ///////////////////////////////////////////////////////
     //create htaccess
     if ($install === TRUE) {
         $search = array('[SITE_FOLDER]');
         $replace = array(core::request('SITE_FOLDER'));
         $install = install::replace_file(INSTALLROOT . 'samples/example.htaccess', $search, $replace, DOCROOT . '.htaccess');
         if (!$install === TRUE) {
             $error_msg = __('Problem saving ' . DOCROOT . '.htaccess');
         }
     }
     ///////////////////////////////////////////////////////
     //all good!
     if ($install === TRUE) {
         core::delete(INSTALLROOT . 'install.lock');
         //core::delete(INSTALLROOT);//prevents from performing a new install
     } elseif ($link != FALSE) {
         if ($table_list = mysqli_query($link, "SHOW TABLES LIKE '" . $TABLE_PREFIX . "%'")) {
             while ($row = mysqli_fetch_assoc($table_list)) {
                 mysqli_query($link, "DROP TABLE " . $row[0]);
             }
         }
     }
     self::$error_msg = $error_msg;
     return $install;
 }
Example #21
0
<?php

include_once 'install.php';
include_once '../classes/xml_parser.php';
include_once '../classes/form.php';
include_once '../classes/database.php';
include_once '../classes/category.php';
$xml = new xml_parser("../settings.xml");
$install = new install($xml, new form($xml));
$db = new database();
$form = new form($xml);
$cat = new category($xml, $form);
$install->setup($db);
$install->put_category_autofill_to_db($db, $cat);
Example #22
0
// This file is part of the ProEthos Software.
//
// Copyright 2013, PAHO. All rights reserved. You can redistribute it and/or modify
// ProEthos under the terms of the ProEthos License as published by PAHO, which
// restricts commercial use of the Software.
//
// ProEthos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
// PARTICULAR PURPOSE. See the ProEthos License for more details.
//
// You should have received a copy of the ProEthos License along with the ProEthos
// Software. If not, see
// https://raw.githubusercontent.com/bireme/proethos/master/LICENSE.txt
require "cab_install.php";
require "_class_install.php";
$inst = new install();
/* Header */
echo '<h1>Config at Data Base</h1>';
/* Check if directory exist */
$chk = $inst->check_directory_privileges('../_db');
/* Mostrar erro se $chk for diferente de 1 */
if ($chk != 1) {
    echo '<div class="erro">';
    echo $chk;
    echo '</div>';
    exit;
}
/* Formulario */
require $include . "_class_form.php";
$form = new form();
/* Formulário Campos */
Example #23
0
         $_SESSION["response_source_update"] = $response_source_update;
         foreach ($response_source_update as $response_line) {
             if (substr_count($response_line, "Updating ") > 0 || substr_count($response_line, "Already up-to-date.") > 0) {
                 $update_failed = false;
             }
         }
     }
     if ($update_failed) {
         $_SESSION["message_delay"] = 3500;
         $_SESSION["message_mood"] = 'negative';
         $response_message = $text['message-upgrade_source_failed'];
     } else {
         //update scripts folder, if allowed (default)
         if ($_SESSION['switch']['scripts']['dir'] != '') {
             //copy the files and directories from resources/install
             $install = new install();
             $install->domain_uuid = $domain_uuid;
             $install->switch_scripts_dir = $_SESSION['switch']['scripts']['dir'];
             $install->copy_scripts();
             //set the message
             $response_message = $text['message-upgrade_source_scripts'];
         } else {
             //set the message
             $response_message = $text['message-upgrade_source'];
         }
     }
 }
 // load an array of the database schema and compare it with the active database
 if ($do["schema"] && permission_exists("upgrade_schema")) {
     $response_message = $text['message-upgrade_schema'];
     $upgrade_data_types = check_str($do["data_types"]);