コード例 #1
0
 // there should be no error output because of safe mode
 @set_time_limit(120);
 $gDb->startTransaction();
 // create new organization
 $newOrganization = new Organization($gDb, $_POST['orgaShortName']);
 $newOrganization->setValue('org_longname', $_POST['orgaLongName']);
 $newOrganization->setValue('org_shortname', $_POST['orgaShortName']);
 $newOrganization->setValue('org_homepage', $_SERVER['HTTP_HOST']);
 $newOrganization->save();
 // write all preferences from preferences.php in table adm_preferences
 require_once '../../installation/db_scripts/preferences.php';
 // set some specific preferences whose values came from user input of the installation wizard
 $orga_preferences['email_administrator'] = $_POST['orgaEmail'];
 $orga_preferences['system_language'] = $gPreferences['system_language'];
 // create all necessary data for this organization
 $newOrganization->setPreferences($orga_preferences, false);
 $newOrganization->createBasicData($gCurrentUser->getValue('usr_id'));
 // if installation of second organization than show organization select at login
 if ($gCurrentOrganization->countAllRecords() === 2) {
     $sql = 'UPDATE ' . TBL_PREFERENCES . ' SET prf_value = 1
          WHERE prf_name = \'system_organization_select\' ';
     $gDb->query($sql);
 }
 $gDb->endTransaction();
 // create html page object
 $page = new HtmlPage($gL10n->get('INS_SETUP_WAS_SUCCESSFUL'));
 $page->addHtml('<p class="lead">' . $gL10n->get('ORG_ORGANIZATION_SUCCESSFULL_ADDED', $_POST['orgaLongName']) . '</p>');
 // show form
 $form = new HtmlForm('add_new_organization_form', $g_root_path . '/adm_program/modules/preferences/preferences.php', $page);
 $form->addSubmitButton('btn_foward', $gL10n->get('SYS_NEXT'), array('icon' => THEME_PATH . '/icons/forward.png'));
 // add form to html page and show page
コード例 #2
0
ファイル: update.php プロジェクト: martinbrylski/admidio
 @set_time_limit(300);
 $mainVersion = substr($installedDbVersion, 0, 1);
 $subVersion = substr($installedDbVersion, 2, 1);
 $microVersion = substr($installedDbVersion, 4, 1);
 $microVersion = (int) $microVersion + 1;
 $flagNextVersion = true;
 // erst einmal die evtl. neuen Orga-Einstellungen in DB schreiben
 require_once 'db_scripts/preferences.php';
 // calculate the best cost value for your server performance
 $benchmarkResults = PasswordHashing::costBenchmark();
 $orga_preferences['system_hashing_cost'] = $benchmarkResults['cost'];
 $sql = 'SELECT * FROM ' . TBL_ORGANIZATIONS;
 $orgaStatement = $gDb->query($sql);
 while ($row_orga = $orgaStatement->fetch()) {
     $gCurrentOrganization->setValue('org_id', $row_orga['org_id']);
     $gCurrentOrganization->setPreferences($orga_preferences, false);
 }
 if ($gDbType === 'mysql') {
     // disable foreign key checks for mysql, so tables can easily deleted
     $sql = 'SET foreign_key_checks = 0 ';
     $gDb->query($sql);
 }
 // before version 3 we had an other update mechanism which will be handled here
 if ($mainVersion < 3) {
     // nun in einer Schleife die Update-Scripte fuer alle Versionen zwischen der Alten und Neuen einspielen
     while ($flagNextVersion) {
         $flagNextVersion = false;
         if ($mainVersion < 3) {
             // until version 3 Admidio had sql and php files where the update statements where stored
             // these files must be executed
             // in der Schleife wird geschaut ob es Scripte fuer eine Microversion (3.Versionsstelle) gibt