コード例 #1
0
     // add form to html page and show page
     $page->addHtml($form->show(false));
     $page->show();
     break;
 case 3:
     /******************************************************/
     /* Create basic data for new organization in database */
     /******************************************************/
     $_SESSION['add_organization_request'] = strStripSlashesDeep($_POST);
     // form fields are not filled
     if ($_POST['orgaShortName'] === '' || $_POST['orgaLongName'] === '') {
         $gMessage->show($gL10n->get('INS_ORGANIZATION_NAME_NOT_COMPLETELY'));
     }
     // check if orga shortname exists
     $organization = new Organization($gDb, $_POST['orgaShortName']);
     if ($organization->getValue('org_id') > 0) {
         $gMessage->show($gL10n->get('INS_ORGA_SHORTNAME_EXISTS', $_POST['orgaShortName']));
     }
     // set execution time to 2 minutes because we have a lot to do :)
     // 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
コード例 #2
0
ファイル: common.php プロジェクト: sistlind/admidio
    if (array_key_exists($gCookiePraefix . '_DATA', $_COOKIE)) {
        // restore user from auto login session
        $autoLogin = new AutoLogin($gDb, $gSessionId);
        $autoLogin->setValidLogin($gCurrentSession, $_COOKIE[$gCookiePraefix . '_DATA']);
        $userIdAutoLogin = $autoLogin->getValue('atl_usr_id');
        // create object of the organization of config file with their preferences
        if ($autoLogin->getValue('atl_org_id') > 0) {
            $gCurrentOrganization = new Organization($gDb, $autoLogin->getValue('atl_org_id'));
        } else {
            $gCurrentOrganization = new Organization($gDb, $g_organization);
        }
    } else {
        // create object of the organization of config file with their preferences
        $gCurrentOrganization = new Organization($gDb, $g_organization);
    }
    if ($gCurrentOrganization->getValue('org_id') === 0) {
        // organization not found
        exit('<div style="color: #cc0000;">Error: The organization of the config.php could not be found in the database!</div>');
    }
    // add the organization to the session
    $gPreferences = $gCurrentOrganization->getPreferences();
    $gCurrentSession->addObject('gCurrentOrganization', $gCurrentOrganization);
    $gCurrentSession->setValue('ses_org_id', $gCurrentOrganization->getValue('org_id'));
    // create a language data object and assign it to the language object
    $gLanguageData = new LanguageData($gPreferences['system_language']);
    $gL10n->addLanguageData($gLanguageData);
    $gCurrentSession->addObject('gLanguageData', $gLanguageData);
    // delete old entries in session table
    $gCurrentSession->tableCleanup($gPreferences['logout_minutes']);
}
// now if auto login is done, read global user data
コード例 #3
0
ファイル: update.php プロジェクト: martinbrylski/admidio
// connect to database
try {
    $gDb = new Database($gDbType, $g_adm_srv, null, $g_adm_db, $g_adm_usr, $g_adm_pw);
} catch (AdmException $e) {
    showNotice($gL10n->get('SYS_DATABASE_NO_LOGIN', $e->getText()), 'installation.php?mode=3', $gL10n->get('SYS_BACK'), 'layout/back.png');
}
// now check if a valid installation exists.
$sql = 'SELECT org_id FROM ' . TBL_ORGANIZATIONS;
$pdoStatement = $gDb->query($sql, false);
if (!$pdoStatement || $pdoStatement->rowCount() === 0) {
    // no valid installation exists -> show installation wizard
    header('Location: installation.php');
}
// Daten der aktuellen Organisation einlesen
$gCurrentOrganization = new Organization($gDb, $g_organization);
if ($gCurrentOrganization->getValue('org_id') == 0) {
    // Organisation wurde nicht gefunden
    exit('<div style="color: #cc0000;">Error: The organization of the config.php could not be found in the database!</div>');
}
// organisationsspezifische Einstellungen aus adm_preferences auslesen
$gPreferences = $gCurrentOrganization->getPreferences();
// create language and language data object to handle translations
if (!isset($gPreferences['system_language'])) {
    $gPreferences['system_language'] = 'de';
}
$gL10n = new Language();
$gLanguageData = new LanguageData($gPreferences['system_language']);
$gL10n->addLanguageData($gLanguageData);
// config.php exists at wrong place
if (file_exists('../../config.php') && file_exists('../../adm_my_files/config.php')) {
    // try to delete the config file at the old place otherwise show notice to user
コード例 #4
0
ファイル: update.php プロジェクト: bash-t/admidio
    $gDbType = 'mysql';
}
// connect to database
$gDb = Database::createDatabaseObject($gDbType);
$gDbConnection = $gDb->connect($g_adm_srv, $g_adm_usr, $g_adm_pw, $g_adm_db);
// now check if a valid installation exists.
$sql = 'SELECT org_id FROM ' . TBL_ORGANIZATIONS;
$gDb->query($sql, false);
$count = $gDb->num_rows();
if ($count === 0) {
    // no valid installation exists -> show installation wizard
    header('Location: installation.php');
}
// Daten der aktuellen Organisation einlesen
$gCurrentOrganization = new Organization($gDb, $g_organization);
if ($gCurrentOrganization->getValue('org_id') == 0) {
    // Organisation wurde nicht gefunden
    die('<div style="color: #cc0000;">Error: The organization of the config.php could not be found in the database!</div>');
}
// organisationsspezifische Einstellungen aus adm_preferences auslesen
$gPreferences = $gCurrentOrganization->getPreferences();
// create language and language data object to handle translations
if (!isset($gPreferences['system_language'])) {
    $gPreferences['system_language'] = 'de';
}
$gL10n = new Language();
$gLanguageData = new LanguageData($gPreferences['system_language']);
$gL10n->addLanguageData($gLanguageData);
// config.php exists at wrong place
if (file_exists('../../config.php') && file_exists('../../adm_my_files/config.php')) {
    // try to delete the config file at the old place otherwise show notice to user