WHERE rol_name = \'' . $gL10n->get('SYS_WEBMASTER') . '\' '; $gDb->query($sql); // convert <br /> to a normal line feed $emailText = preg_replace('/<br[[:space:]]*\\/?[[:space:]]*>/', chr(13) . chr(10), $gL10n->get('SYS_SYSMAIL_REFUSE_REGISTRATION')); // create new system user $systemUser = new TableUsers($gDb); $systemUser->setValue('usr_login_name', $gL10n->get('SYS_SYSTEM')); $systemUser->setValue('usr_valid', '0'); $systemUser->setValue('usr_timestamp_create', DATETIME_NOW); $systemUser->save(false); // no registered user -> UserIdCreate couldn't be filled $sql = 'SELECT usf_id FROM ' . TBL_USER_FIELDS . ' WHERE usf_name_intern = \'LAST_NAME\''; $pdoStatement = $gDb->query($sql); $usfRow = $pdoStatement->fetch(); $sql = 'INSERT INTO ' . TBL_USER_DATA . ' (usd_usf_id, usd_usr_id, usd_value) VALUES (' . $usfRow['usf_id'] . ', ' . $systemUser->getValue('usr_id') . ', \'' . $gL10n->get('SYS_SYSTEM') . '\')'; $gDb->query($sql); $sql = 'UPDATE ' . TBL_MEMBERS . ' SET mem_usr_id_create = ' . $systemUser->getValue('usr_id') . ' , mem_timestamp_create = \'' . DATETIME_NOW . '\''; $gDb->query($sql); $sql = 'UPDATE ' . TBL_MEMBERS . ' SET mem_usr_id_create = ' . $systemUser->getValue('usr_id') . ' , mem_timestamp_create = \'' . DATETIME_NOW . '\''; $gDb->query($sql); // write data for every organization $sql = 'SELECT * FROM ' . TBL_ORGANIZATIONS . ' ORDER BY org_id DESC'; $orgaStatement = $gDb->query($sql); while ($row_orga = $orgaStatement->fetch()) { $sql = 'INSERT INTO ' . TBL_TEXTS . ' (txt_org_id, txt_name, txt_text) VALUES (' . $row_orga['org_id'] . ', \'SYSMAIL_REFUSE_REGISTRATION\', \'' . $emailText . '\')'; $gDb->query($sql); }
* * @copyright 2004-2016 The Admidio Team * @see http://www.admidio.org/ * @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2.0 only * * Parameters: * * aid .. Activation id for confirmation of new password * usr_id .. Id of the user who wants a new password *********************************************************************************************** */ require_once 'common.php'; // Initialize and check the parameters $getActivationId = admFuncVariableIsValid($_GET, 'aid', 'string', array('requireValue' => true)); $getUserId = admFuncVariableIsValid($_GET, 'usr_id', 'int', array('requireValue' => true)); // Systemmails und Passwort zusenden muessen aktiviert sein if ($gPreferences['enable_system_mails'] != 1 || $gPreferences['enable_password_recovery'] != 1) { $gMessage->show($gL10n->get('SYS_MODULE_DISABLED')); } $user = new TableUsers($gDb, $getUserId); if ($user->getValue('usr_activation_code') === $getActivationId) { // activate the new password $user->setPassword($user->getValue('usr_new_password'), false, false); $user->setPassword('', true, false); $user->setValue('usr_activation_code', ''); $user->save(); $gMessage->setForwardUrl($g_root_path . '/adm_program/system/login.php', 2000); $gMessage->show($gL10n->get('SYS_PWACT_PW_SAVED')); } else { $gMessage->show($gL10n->get('SYS_PWACT_CODE_INVALID')); }
$webmaster->setPassword($_SESSION['user_password']); $webmaster->setValue('usr_usr_id_create', $gCurrentUser->getValue('usr_id')); $webmaster->setValue('usr_timestamp_create', DATETIME_NOW); $webmaster->save(false); // no registered user -> UserIdCreate couldn't be filled // write all preferences from preferences.php in table adm_preferences require_once 'db_scripts/preferences.php'; // set some specific preferences whose values came from user input of the installation wizard $orga_preferences['email_administrator'] = $_SESSION['orga_email']; $orga_preferences['system_language'] = $language; // calculate the best cost value for your server performance $benchmarkResults = PasswordHashing::costBenchmark(); $orga_preferences['system_hashing_cost'] = $benchmarkResults['cost']; // create all necessary data for this organization $gCurrentOrganization->setPreferences($orga_preferences, false); $gCurrentOrganization->createBasicData($webmaster->getValue('usr_id')); // create default room for room module in database $sql = 'INSERT INTO ' . TBL_ROOMS . ' (room_name, room_description, room_capacity, room_usr_id_create, room_timestamp_create) VALUES (\'' . $gL10n->get('INS_CONFERENCE_ROOM') . '\', \'' . $gL10n->get('INS_DESCRIPTION_CONFERENCE_ROOM') . '\', 15, ' . $gCurrentUser->getValue('usr_id') . ',\'' . DATETIME_NOW . '\')'; $db->query($sql); // first create a user object "current user" with webmaster rights because webmaster // is allowed to edit firstname and lastname $gCurrentUser = new User($db, $gProfileFields, $webmaster->getValue('usr_id')); $gCurrentUser->setValue('LAST_NAME', $_SESSION['user_last_name']); $gCurrentUser->setValue('FIRST_NAME', $_SESSION['user_first_name']); $gCurrentUser->setValue('EMAIL', $_SESSION['user_email']); $gCurrentUser->save(false); // now create a full user object for system user $systemUser = new User($db, $gProfileFields, $systemUserId); $systemUser->setValue('LAST_NAME', $gL10n->get('SYS_SYSTEM'));
/** * Get the value of a column of the database table if the column has the praefix @b usr_ * otherwise the value of the profile field of the table adm_user_data will be returned. * If the value was manipulated before with @b setValue than the manipulated value is returned. * @param string $columnName The name of the database column whose value should be read or the internal unique profile field name * @param string $format For date or timestamp columns the format should be the date/time format e.g. @b d.m.Y = '02.04.2011'. @n * For text columns the format can be @b database that would return the original database value without any transformations * @return mixed Returns the value of the database column or the value of adm_user_fields * If the value was manipulated before with @b setValue than the manipulated value is returned. * @par Examples * @code // reads data of adm_users column * $loginname = $gCurrentUser->getValue('usr_login_name'); * // reads data of adm_user_fields * $email = $gCurrentUser->getValue('EMAIL'); @endcode */ public function getValue($columnName, $format = '') { global $gPreferences; if (strpos($columnName, 'usr_') === 0) { if ($columnName === 'usr_photo' && $gPreferences['profile_photo_storage'] == 0 && file_exists(SERVER_PATH . '/adm_my_files/user_profile_photos/' . $this->getValue('usr_id') . '.jpg')) { return file_get_contents(SERVER_PATH . '/adm_my_files/user_profile_photos/' . $this->getValue('usr_id') . '.jpg'); } else { return parent::getValue($columnName, $format); } } else { return $this->mProfileFieldsData->getValue($columnName, $format); } }
* Activate new password * * Copyright : (c) 2004 - 2015 The Admidio Team * Homepage : http://www.admidio.org * License : GNU Public License 2 http://www.gnu.org/licenses/gpl-2.0.html * * Parameters: * * aid .. Activation id for confirmation of new password * usr_id .. Id of the user who wants a new password *****************************************************************************/ require_once 'common.php'; // Initialize and check the parameters $getActivationId = admFuncVariableIsValid($_GET, 'aid', 'string', array('requireValue' => true)); $getUserId = admFuncVariableIsValid($_GET, 'usr_id', 'numeric', array('requireValue' => true)); // Systemmails und Passwort zusenden muessen aktiviert sein if ($gPreferences['enable_system_mails'] != 1 || $gPreferences['enable_password_recovery'] != 1) { $gMessage->show($gL10n->get('SYS_MODULE_DISABLED')); } $user = new TableUsers($gDb, $getUserId); if ($user->getValue('usr_activation_code') == $getActivationId) { // activate the new password $user->setValue('usr_password', $user->getValue('usr_new_password')); $user->setValue('usr_new_password', ''); $user->setValue('usr_activation_code', ''); $user->save(); $gMessage->setForwardUrl($g_root_path . '/adm_program/system/login.php', 2000); $gMessage->show($gL10n->get('SYS_PWACT_PW_SAVED')); } else { $gMessage->show($gL10n->get('SYS_PWACT_CODE_INVALID')); }