Beispiel #1
0
define('G_APP_PATH_ROUTES_OVERRIDES', G_APP_PATH_ROUTES . 'overrides/');
define('G_APP_PATH_CLASSES', G_APP_PATH_LIB . 'classes/');
define('G_APP_FILE_FUNCTIONS', G_APP_PATH_LIB . 'functions.php');
define('G_APP_FILE_FUNCTIONS_RENDER', G_APP_PATH_LIB . 'functions.render.php');
define('G_APP_SETTINGS_FILE_ERROR', '<br />There are errors in the <strong>%%FILE%%</strong> file. Change the encodig to "UTF-8 without BOM" using Notepad++ or any similar code editor and remove any character before <span style="color: red;">&lt;?php</span>');
// Include the static app config file
file_exists(G_APP_PATH . 'settings.php') ? require_once G_APP_PATH . 'settings.php' : die("G\\: Can't find app/settings.php");
if (headers_sent()) {
    die(str_replace('%%FILE%%', 'app/settings.php', G_APP_SETTINGS_FILE_ERROR));
}
// Stop on premature headers
if (isset($settings) and $settings['error_reporting'] === false) {
    error_reporting(0);
}
// Set the default timezone
if (isset($settings['default_timezone']) and is_valid_timezone($settings['default_timezone'])) {
    date_default_timezone_set($settings['default_timezone']);
}
// Set the system environment
if (isset($settings['environment'])) {
    define('G_APP_ENV', $settings['environment']);
}
// Set the HTTP definitions
define('G_HTTP_HOST', $_SERVER['HTTP_HOST']);
define('G_HTTP_PROTOCOL', (!empty($_SERVER['HTTPS']) and strtolower($_SERVER['HTTPS']) == 'on' or $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') ? 'https' : 'http');
// Fix some $_SERVER vars
$_SERVER['SCRIPT_FILENAME'] = forward_slash($_SERVER['SCRIPT_FILENAME']);
$_SERVER['SCRIPT_NAME'] = forward_slash($_SERVER['SCRIPT_NAME']);
// Inherit application definitions
if (file_exists(G_APP_PATH . 'app.php')) {
    require_once G_APP_PATH . 'app.php';
Beispiel #2
0
function display_account_form($register_error)
{
    global $Language;
    $request =& HTTPRequest::instance();
    $purifier =& Codendi_HTMLPurifier::instance();
    $page = $request->get('page');
    if ($register_error) {
        print "<p><blink><b><span class=\"feedback\">{$register_error}</span></b></blink>";
    }
    $star = '<span class="highlight"><big>*</big></span>';
    $form_loginname = $request->exist('form_loginname') ? $purifier->purify($request->get('form_loginname')) : '';
    $form_realname = $request->exist('form_realname') ? $purifier->purify($request->get('form_realname')) : '';
    $form_email = $request->exist('form_email') ? $purifier->purify($request->get('form_email')) : '';
    $form_expiry = $request->exist('form_expiry') ? $purifier->purify($request->get('form_expiry')) : '';
    $form_mail_site = !$request->exist('form_mail_site') || $request->get('form_mail_site') == 1;
    $form_restricted = ForgeConfig::areRestrictedUsersAllowed() && (!$request->exist('form_restricted') || $request->get('form_restricted') == 1);
    $form_send_email = $request->get('form_send_email') == 1;
    if ($request->exist('timezone') && is_valid_timezone($request->get('timezone'))) {
        $timezone = $request->get('timezone');
    } else {
        $timezone = false;
    }
    $form_register_purpose = $request->exist('form_register_purpose') ? $purifier->purify($request->get('form_register_purpose')) : '';
    if ($page == "admin_creation") {
        $prefill = new Account_RegisterAdminPrefillValuesPresenter($form_loginname, $form_email, $form_realname, $form_register_purpose, $form_mail_site, $timezone, $form_restricted, $form_send_email);
        $presenter = new Account_RegisterByAdminPresenter($prefill);
        $template = 'register-admin';
    } else {
        $prefill = new Account_RegisterPrefillValuesPresenter($form_loginname, $form_email, $form_realname, $form_register_purpose, $form_mail_site, $timezone);
        $presenter = new Account_RegisterByUserPresenter($prefill);
        $template = 'register-user';
    }
    $renderer = TemplateRendererFactory::build()->getRenderer(ForgeConfig::get('codendi_dir') . '/src/templates/account/');
    $renderer->renderToPage($template, $presenter);
}
Beispiel #3
0
//
require_once 'pre.php';
require_once 'account.php';
require_once 'timezones.php';
require_once 'common/event/EventManager.class.php';
$em =& EventManager::instance();
$em->processEvent('before_change_timezone', array());
$request =& HTTPRequest::instance();
if (!user_isloggedin()) {
    exit_not_logged_in();
}
if ($request->isPost()) {
    if (!$request->existAndNonEmpty('timezone')) {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('account_change_timezone', 'no_update'));
    } else {
        if (!is_valid_timezone($request->get('timezone')) || $request->get('timezone') == 'None') {
            $GLOBALS['Response']->addFeedback('error', $Language->getText('account_change_timezone', 'choose_tz'));
        } else {
            // if we got this far, it must be good
            db_query("UPDATE user SET timezone='" . db_es($request->get('timezone')) . "' WHERE user_id=" . user_getid());
            session_redirect("/account/");
        }
    }
}
$HTML->header(array('title' => $Language->getText('account_change_timezone', 'title')));
?>
<H3><?php 
echo $Language->getText('account_change_timezone', 'title2');
?>
</h3>
<P>
Beispiel #4
0
    }
    echo '<p>', $text, '</p>';
    isset($pv) && $pv == 2 ? $HTML->pv_footer(array()) : $HTML->footer(array('showfeedback' => false));
    exit;
}
// LDAP plugin enabled
$pluginManager = PluginManager::instance();
$ldapPlugin = $pluginManager->getPluginByName('ldap');
if (!$ldapPlugin || !$pluginManager->isPluginAvailable($ldapPlugin)) {
    $GLOBALS['Response']->redirect('/my');
}
$um = UserManager::instance();
$currentUser = $um->getCurrentUser();
$user_id = $currentUser->getId();
if ($request->isPost() && $request->existAndNonEmpty('action')) {
    if (!is_valid_timezone($request->get('timezone'))) {
        welcome_exit_error($Language->getText('plugin_ldap', 'welcome_error_up'), $Language->getText('plugin_ldap', 'welcome_err_notz'));
    }
    $mailSite = 0;
    $vMailSite = new Valid_WhiteList('form_mail_site', array('1'));
    $vMailSite->required();
    if ($request->valid($vMailSite)) {
        $mailSite = 1;
    }
    $mailVa = 0;
    $vMailVa = new Valid_WhiteList('form_mail_va', array('1'));
    $vMailVa->required();
    if ($request->valid($vMailVa)) {
        $mailVa = 1;
    }
    if ($currentUser) {
Beispiel #5
0
function display_account_form($register_error)	{
    global $Language;

    $request =& HTTPRequest::instance();
    $purifier =& Codendi_HTMLPurifier::instance();

    $page = $request->get('page');

    if ($register_error) {
        print "<p><blink><b><span class=\"feedback\">$register_error</span></b></blink>";
    }
    $star = '<span class="highlight"><big>*</big></span>';
    $form_loginname = $request->exist('form_loginname')?$purifier->purify($request->get('form_loginname')):'';
    $form_realname  = $request->exist('form_realname')?$purifier->purify($request->get('form_realname')):'';
    $form_email     = $request->exist('form_email')?$purifier->purify($request->get('form_email')):'';
    $form_expiry     = $request->exist('form_expiry')?$purifier->purify($request->get('form_expiry')):'';
    if($request->exist('timezone') && is_valid_timezone($request->get('timezone'))) {
        $timezone = $request->get('timezone');
    } else {
        $timezone = 'None';
    }

    $form_register_purpose = $request->exist('form_register_purpose')?$purifier->purify($request->get('form_register_purpose')):'';

    ?>
<?php if($page == "admin_creation"){ ?>        
    <form action="/admin/register_admin.php?page=admin_creation" name="new_user" method="post"> 
<?php } else { ?>
    <form action="/account/register.php" method="post">
<?php }?>
<p><?php print $Language->getText('account_register', 'login').'&nbsp;'.$star; ?>:<br>
<input type="text" name="form_loginname" value="<?php echo $form_loginname; ?>">
<?php print $Language->getText('account_register', 'login_directions'); ?>
<?php user_display_choose_password($page); ?>
<P><?php print $Language->getText('account_register', 'realname').'&nbsp;'.$star; ?>:<br>
<INPUT size=40 type="text" name="form_realname" value="<?php echo $form_realname; ?>">
<?php print $Language->getText('account_register', 'realname_directions'); ?>
<P><?php print $Language->getText('account_register', 'email').'&nbsp;'.$star; ?>:<BR>
<INPUT size=40 type="text" name="form_email" value="<?php echo $form_email; ?>"><BR>
<?php print $Language->getText('account_register', 'email_directions'); ?>
<?php if($page == "admin_creation"){ ?>    
    <P><?php print $Language->getText('account_register', 'expiry_date')?>:<BR>
    <?php echo $GLOBALS['HTML']->getDatePicker("form_expiry", "form_expiry", $form_expiry); ?>
    <BR>
    <?php print $Language->getText('account_register', 'expiry_date_directions'); ?>
<?php } ?>
<P><?php print $Language->getText('account_register', 'tz').'&nbsp;'.$star; ?>:<BR>
<?php 
    echo html_get_timezone_popup ('timezone',$timezone); ?>
<P>
<?php
if($request->isPost() && $request->exist('Register') && !($request->get('form_mail_site')==1)){

	echo '<P><INPUT type="checkbox" name="form_mail_site" value="1" >';
	
}else{
	
	echo '<P><INPUT type="checkbox" name="form_mail_site" value="1" checked>';

}	
print $Language->getText('account_register', 'siteupdate');

if($request->isPost() && $request->exist('Register') && ($request->get('form_mail_va')==1)){

	echo '<P><INPUT type="checkbox" name="form_mail_va" value="1" checked>';
	
}else{
	
	echo '<P><INPUT type="checkbox" name="form_mail_va" value="1" >';

}
print $Language->getText('account_register', 'communitymail');

?>

<P>
<?
if ($GLOBALS['sys_user_approval'] == 1 || $page == "admin_creation") {
    print $Language->getText('account_register', 'purpose');
    if($page != "admin_creation") {
        print '&nbsp;'.$star;
        print ":<br>";
        print $Language->getText('account_register', 'purpose_directions');
    } else{
        print ":<br>";
        print $Language->getText('account_register', 'purpose_directions_admin');
    }
    echo '<textarea wrap="virtual" rows="5" cols="70" name="form_register_purpose">'.$form_register_purpose.'</textarea></p>';
} 
?>

<p>
<?php print $Language->getText('account_register', 'mandatory', $star); ?>
</p>
<?php

if($page == "admin_creation" && $GLOBALS['sys_allow_restricted_users'] == 1){

	if($request->isPost() && $request->exist('Register') && !($request->get('form_restricted')==1)){

		echo '<INPUT type="checkbox" name="form_restricted" value="1" >';
		
	}else{
		
		echo '<INPUT type="checkbox" name="form_restricted" value="1" checked>';
	
	}	

	print $Language->getText('account_register', 'restricted_user'); 
}
?>



<P>
<p><input type="submit" name="Register" value="<?php if($page != "admin_creation") print $Language->getText('account_register', 'btn_register'); 
else print $Language->getText('account_register', 'btn_activate');?>">
<?php
if($page == "admin_creation") {
	if($request->isPost() && $request->exist('Register') && ($request->get('form_send_email')==1)){

		echo '<INPUT type="checkbox" name="form_send_email" value="1" checked>';
		
	}else{
		
		echo '<INPUT type="checkbox" name="form_send_email" value="1" >';
	
	}
	print $Language->getText('account_register', 'send_email'); 
} else {
    include $Language->getContent('account/user_legal');
}

?>
</form>
<?
}