Example #1
0
 public function exec()
 {
     if ($this->ci->ion_auth->logged_in()) {
         $user = $this->ci->ion_auth->user()->row();
         setUser('username', $user->username);
         setUser('id', $user->id);
         setUser('email', $user->email);
         setUser('admin', $this->ci->ion_auth->is_admin());
         setUser('logged', true);
         $groupUser = $this->ci->ion_auth->get_users_groups(getUser('id'))->result();
         $group = array();
         foreach ($groupUser as $tmp) {
             $group[] = $tmp->id;
         }
         setUser('groups', $group);
     } else {
         setUser('logged', false);
     }
     if ($this->ci->uri->segment(1) != "auth") {
         if (!$this->ci->acl->isAllow()) {
             $this->ci->session->set_flashdata('message', "Vous n'avez pas acces à cette page");
             redirect("auth/login/redirect");
         }
     }
 }
Example #2
0
 function cheak($code, $password, $id)
 {
     // cheak user by code
     $ud = new userdao();
     $un = $ud->selectbyid($id);
     $user = new user();
     if (count($un) == 1) {
         $user = (object) $un[0];
         $u = setUser($user);
         if ($u->getCode() == $code) {
             $u->setPassword($password);
             $u->setUpdatedate(time());
             $res = $ud->update($u);
             if ($res > 0) {
                 remsg(1, "success");
             } else {
                 remsg(0, "1验证失败!");
             }
         } else {
             remsg(0, "2验证失败!");
         }
     } else {
         remsg(0, "3验证失败!");
     }
 }
Example #3
0
function registerUser($row, $pw)
{
    $email = $row[3];
    list($default_location_id, $company_id) = getDefaultLocationAndCompanyFromEmail($email);
    $sql = "update user_registration set status=0 where id=" . $row[0];
    $result = query($sql);
    $pw_secured = md5('abc123' . $pw);
    $lang = $_COOKIE['language'];
    $sql = "insert into users (id, name, is_active, email, password, company_id, default_location_id, group_id, language) values (nextval('users_id_seq'::regclass), '" . $row[1] . "', true, '" . $row[3] . "', '{$pw_secured}', {$company_id}, {$default_location_id}, 1, '{$lang}')";
    $result = query($sql);
    $sql = "SELECT Currval('users_id_seq') LIMIT 1";
    $result = query($sql);
    if ($row_id = pg_fetch_row($result)) {
        $userid = $row_id[0];
    }
    $sql = "insert into user_number (id, user_id, number, is_default, is_active) values (nextval('user_numbers_id_seq'), {$userid}, '" . $row[2] . "', TRUE, TRUE)";
    $result = query($sql);
    sendRoutes($row[2], $row[3], $pw);
    sendVCARD($row[2]);
    setUser($userid);
}
Example #4
0
 public function UserListeningToAudio()
 {
     $em = $this->getDoctrine()->getManager();
     $ulta = new UserListenToAudio();
     $ulta = setUser('1');
     $ulta = setAudio('2');
     $ulta = setStopTime('429');
     $em->persist($ulta);
     $em->flush();
 }
	$result = $dbr->query( "select user_id from user where user_name = '$userName'" );
	if ( $row = $dbr->fetchObject( $result ) ) {
		return $row->user_id;
	}
	else {
		return - 1;
	}
}

$userId = getUserId( 'Root' );
if ( $userId == - 1 ) {
	echo "root user undefined\n";
	die;
}

setUser( $userId );
$datasets = getDatasets();

$dbr = wfGetDB( DB_SLAVE );
foreach ( $datasets as $dataset ) {
	foreach ( $datasets as $otherdataset ) {
		if ( $dataset != $otherdataset ) {
			echo "mapping between $otherdataset and $dataset\n";
			setDefaultDC( $otherdataset );
			startNewTransaction( $userId, wfGetIP(), 'Add collection ', $dataset );
			bootstrapCollection( $dataset, '85', 'MAPP' );
		}
	}
}
?>
Example #6
0
function trackPage($page, $passedQuiz)
{
    // Track current page
    $pageArray = explode("___", $page);
    if ($_SESSION['userID']) {
        $userLogin = $_SESSION['userID'];
        $userFullName = $_SESSION['userFullName'];
        if ($pageArray[0]) {
            if ($pageArray[1] == "results") {
                setUser('assessment' . $pageArray[0], $passedQuiz, $userLogin, $userFullName);
                setUser('currentAssessment', false, $userLogin, $userFullName);
            } else {
                if ($pageArray[1]) {
                    setUser('currentSection', $pageArray[1], $userLogin, $userFullName);
                    setUser('currentPage', $pageArray[0], $userLogin, $userFullName);
                } else {
                    setUser('currentSection', $pageArray[1], $userLogin, $userFullName);
                    setUser('currentPage', '', $userLogin, $userFullName);
                }
            }
        }
    }
}
Example #7
0
printHeader();
?>
	<section class="text">

<?php 
if (isset($_REQUEST["login"])) {
    if ($_SESSION["database"]->checkUser($_REQUEST["username"], $_REQUEST["password"])) {
        setUser($_REQUEST["username"]);
        /* så sjekker controller.php:
         * Sjekker om bruker er admin i classCustomer-konstruktøren.  
         **/
    }
} else {
    if (isset($_REQUEST["addNewUser"])) {
        $_SESSION['database']->addUserData($_POST['email'], $_POST['password'], $_POST['first'], $_POST['surname'], $_POST['address'], $_POST['postalcode'], $_POST['city'], $_POST['country']);
        setUser($_REQUEST["email"]);
    }
}
if (!isset($_SESSION["user"])) {
    ?>

	<h1>Login</h1>

	<form id="login" action="index.php" method="post">
		<table border="0" cellspacing="5" cellpadding="5">
			<tr>
				<td>Email:</td>
				<td><input type = "text" name = "username" size = 40></td>
			</tr>
			<tr>
				<td>Password:</td>
Example #8
0
$content_tpl->set_block("F_CONTENT", "B_MESSAGE_LOGGED_IN", "H_MESSAGE_LOGGED_IN");
$content_tpl->set_block("F_CONTENT", "B_MESSAGE", "H_MESSAGE");
$content_tpl->set_block("F_CONTENT", "B_WARNING_LOGIN_FAILED", "H_WARNING_LOGIN_FAILED");
$content_tpl->set_block("F_CONTENT", "B_WARNING_USERNAME", "H_WARNING_USERNAME");
$content_tpl->set_block("F_CONTENT", "B_WARNING", "H_WARNING");
$username = dbEscape($_REQUEST['username']);
$users_ref = dbQuery("SELECT * FROM `{$cfg['db_table_prefix']}users` " . "WHERE `username` = '{$username}'");
if ($users_row = dbFetch($users_ref)) {
    $password = crypt($_REQUEST['password'], substr($users_row['password'], 0, 2));
    if ($password == $users_row['password']) {
        // Set cookie
        if (isset($_REQUEST['remember'])) {
            // Expiration in 1 year
            $expire = time() + 3600 * 24 * 365;
        } else {
            // Session cookie expiration
            $expire = null;
        }
        $user_id_md5 = serialize(array($users_row['id'], md5($password)));
        setcookie("user_id", $user_id_md5, $expire, $cfg['path']);
        setUser($user_id_md5);
        $content_tpl->parse("H_MESSAGE_LOGGED_IN", "B_MESSAGE_LOGGED_IN");
        $content_tpl->parse("H_MESSAGE", "B_MESSAGE");
    } else {
        $content_tpl->parse("H_WARNING_LOGIN_FAILED", "B_WARNING_LOGIN_FAILED");
        $content_tpl->parse("H_WARNING", "B_WARNING");
    }
} else {
    $content_tpl->parse("H_WARNING_LOGIN_FAILED", "B_WARNING_LOGIN_FAILED");
    $content_tpl->parse("H_WARNING", "B_WARNING");
}
function bootStrappedDefinedMeanings( $dc ) {
	global
		$definedMeaningMeaningName, $definitionMeaningName,
		$relationMeaningName, $synTransMeaningName,
		$annotationMeaningName, $wgCommandLineMode;

	$wgCommandLineMode = true;

	$dbr = wfGetDB( DB_MASTER );
	
	$dbr->query( "DROP TABLE IF EXISTS `{$dc}_bootstrapped_defined_meanings`;" );

	$dbr->query( "CREATE TABLE `{$dc}_bootstrapped_defined_meanings` (
			`name` VARCHAR(255) NOT NULL ,
			`defined_meaning_id` INT NOT NULL);" );


	$userId = getUserId( 'Root' );
	if ( $userId == - 1 ) {
		echo "root user undefined\n";
		return;
	}

	setUser( $userId );

	setDefaultDC( $dc );
	
	$rdc = wdGetDataSetContext();

	startNewTransaction( $userId, 0, "Script bootstrap class attribute meanings", $dc );

	$languageId = 85;
	$collectionId = bootstrapCollection( "Class attribute levels", $languageId, "LEVL" );
	$meanings = array();
	$meanings[$definedMeaningMeaningName] = bootstrapDefinedMeaning( $definedMeaningMeaningName, $languageId, "The combination of an expression and definition in one language defining a concept." );
	$meanings[$definitionMeaningName] = bootstrapDefinedMeaning( $definitionMeaningName, $languageId, "A paraphrase describing a concept." );
	$meanings[$synTransMeaningName] = bootstrapDefinedMeaning( $synTransMeaningName, $languageId, "A translation or a synonym that is equal or near equal to the concept defined by the defined meaning." );
	$meanings[$relationMeaningName] = bootstrapDefinedMeaning( $relationMeaningName, $languageId, "The association of two defined meanings through a specific relation type." );
	$meanings[$annotationMeaningName] = bootstrapDefinedMeaning( $annotationMeaningName, $languageId, "Characteristic information of a concept." );

	foreach ( $meanings as $internalName => $meaningId ) {
		addDefinedMeaningToCollection( $meaningId, $collectionId, $internalName );
	
		$dbr->query( "INSERT INTO `{$dc}_bootstrapped_defined_meanings` (name, defined_meaning_id) " .
				"VALUES (" . $dbr->addQuotes( $internalName ) . ", " . $meaningId . ")" );
	}

	$timestamp = wfTimestampNow();
	$dbr->query( "INSERT INTO {$dc}_script_log (time, script_name, comment) " .
		    "VALUES (" . $timestamp . "," . $dbr->addQuotes( '23 - Bootstrap class attribute meanings.php' ) .  "," . $dbr->addQuotes( 'create bootstrap class attribute meanings' ) . ")" );
	
}
<?php 
include_once $root . "/templates/stylesheetsIE9.php";
?>
</style>
<?php 
include_once "../templates/headerB.php";
include_once "../templates/bodyA.php";
?>
<h3><?php 
echo getUebersetzung("Einen neuen Benutzer anlegen", $sprache, $link);
?>
</h3>	
<?php 
//passwortprüfung:
if (checkPass($benutzername, $passwort, $unterkunft_id, $link)) {
    setUser($name, $pass, $rechte);
    ?>
<div class="panel panel-default">
  <div class="panel-body">
<a class="btn btn-primary" href="./index.php"><span class="glyphicon glyphicon-menu-left" aria-hidden="true"></span>&nbsp;<?php 
    echo getUebersetzung("zurück", $sprache, $link);
    ?>
</a>
</div>
</div>

<div class="panel panel-default">
  <div class="panel-body">
  	
	<div class="alert alert-success" role="alert">
		  <?php 
Example #11
0
<?php

unsetUser();
// Check user
if (isset($_COOKIE["user_id"])) {
    setUser($_COOKIE["user_id"]);
}
function setUser($user_id_md5)
{
    global $user;
    global $cfg;
    global $season;
    unsetUser($user);
    $user_id_md5 = stripslashes($user_id_md5);
    list($id_user, $md5_password) = unserialize($user_id_md5);
    if ($id_user != "") {
        $users_ref = dbQuery("SELECT * FROM `{$cfg['db_table_prefix']}users` WHERE `id` = {$id_user}");
        if ($users_row = dbFetch($users_ref) and $md5_password == md5($users_row['password'])) {
            $user['uid'] = $users_row['id'];
            $user['username'] = $users_row['username'];
            if (!isset($season)) {
                $season_users_ref = dbQuery("SELECT * FROM `{$cfg['db_table_prefix']}season_users` " . "WHERE `id_user` = {$users_row['id']} AND `id_season` = 0");
            } else {
                $season_users_ref = dbQuery("SELECT * FROM `{$cfg['db_table_prefix']}season_users` " . "WHERE `id_user` = {$users_row['id']} AND (`id_season` = 0 OR `id_season` = {$season['id']})");
            }
            while ($season_users_row = dbFetch($season_users_ref)) {
                if ($season_users_row['usertype_root'] == 1) {
                    $user['usertype_root'] = $season_users_row['usertype_root'];
                }
                if ($season_users_row['usertype_headadmin'] == 1) {
                    $user['usertype_headadmin'] = $season_users_row['usertype_headadmin'];
Example #12
0
$_ShowUserLastTime = FALSE;
// letzte Stempelzeit von heute anzeigen
$_ShowUserAllTime = FALSE;
// alle Stempelzeiten von heute anzeigen
$_ShowUserPic = FALSE;
// Bid des users anzeigen
if (file_exists("./include/Settings/multilogin.xml")) {
    $multilogin = simplexml_load_file("./include/Settings/multilogin.xml");
} else {
    create_mulitsettings();
    $multilogin = simplexml_load_file("./include/Settings/multilogin.xml");
}
setGuest();
// falls eingeloogt, dann User - Einstellungen laden
if (isset($_SESSION['admin'])) {
    setUser();
}
// admin-Pannel? (admin.php), dann Admin - Einstellungen laden
if ($_logcheck->_admins && isset($_SESSION['admin'])) {
    setAdmin();
}
function setGuest()
{
    global $multilogin;
    global $_ShowUsername;
    global $_ShowUserOnline;
    global $_ShowUserLastTime;
    global $_ShowUserAllTime;
    global $_ShowUserPic;
    if ($multilogin->guest->ShowUsername == "true") {
        $_ShowUsername = TRUE;
Example #13
0
/**
 *Starts Orongo! :) 
 * @param String $paramCurrentPage the current page
 */
function startOrongo($paramCurrentPage = 'anonymous')
{
    session_start();
    define("ROOT", dirname(__FILE__));
    define("LIB", ROOT . "/lib");
    define("ADMIN", ROOT . "/orongo-admin");
    define("CONFIG", ROOT . "/config.php");
    define('RANK_ADMIN', 3);
    define('RANK_WRITER', 2);
    define('RANK_USER', 1);
    define('ARTICLE_NOT_EXIST', 2100);
    define('PAGE_NOT_EXIST', 3100);
    define('USER_NOT_EXIST', 4100);
    define('COMMENT_NOT_EXIST', 5100);
    error_reporting(E_ALL);
    if (file_exists("orongo-install.php")) {
        die("If you didn't install OrongoCMS yet, proceed to the <a href='orongo-install.php'>installer</a><br/>If you installed it, please delete orongo-install.php");
    }
    if (!file_exists(CONFIG)) {
        die("config.php (" . CONFIG . ") was missing!");
    }
    require_once CONFIG;
    require LIB . '/function_load.php';
    try {
        load(LIB);
    } catch (Exception $e) {
        die($e->getMessage());
    }
    setDatabase(new Database(CONFIG));
    try {
        setLanguage(new Language(ADMIN . '/lang/' . Settings::getLanguageName()));
    } catch (Exception $e) {
        $msgbox = new MessageBox();
        $msgbox->bindException($e);
        die($msgbox->getImports() . $msgbox->toHTML());
    }
    setCurrentPage($paramCurrentPage);
    $style = null;
    try {
        $style = Settings::getStyle();
    } catch (Exception $e) {
        $msgbox = new MessageBox();
        $msgbox->bindException($e);
        die($msgbox->getImports() . $msgbox->toHTML());
    }
    setMenu(new Menu());
    setStyle($style);
    setDisplay(new Display($style->getStylePath()));
    setUser(handleSessions());
    if (defined('HACK_PLUGINS') && HACK_PLUGINS == true) {
        Plugin::hackKeys();
    }
    try {
        setPlugins(Plugin::getActivatedPlugins('orongo-admin/'));
    } catch (Exception $e) {
        $msgbox = new MessageBox();
        $msgbox->bindException($e);
        getDisplay()->addObject($msgbox);
    }
    //getLanguage()->setTempLanguage(ADMIN . '/lang/en_US');
    OrongoDefaultEventHandlers::init();
}
Example #14
0
                $where1 .= " and isfirst = 'T' ";
                $where2 .= " and isfirst = 'T' ";
                if (hasCondition($sex, $state, $country)) {
                    $where1 = setFirstCondition($where1, $sex, $state, $country);
                }
                if (hasUser($user)) {
                    $where1 = setUser($where1, $user);
                }
                if (setInsertTime1($fromTime, $toTime)) {
                    $where1 = getInsertTime1($where1, $fromTime, $toTime);
                }
                if (hasCondition($dump_sex, $dump_state, $dump_country)) {
                    $where2 = setFirstCondition($where2, $dump_sex, $dump_state, $dump_country);
                }
                if (hasUser($dump_user)) {
                    $where2 = setUser($where2, $dump_user);
                }
                if (setInsertTime1($fromTime, $toTime)) {
                    $where2 = getInsertTime1($where2, $fromTime, $toTime);
                }
            }
        }
    }
} else {
    echo "something wrong happens";
    exit;
}
$sql1 = $sql . $where1;
$sql2 = $sql . $where2;
$sum[0] = countNum($sql1);
$sum[1] = countNum($sql2);
Example #15
0
            if (hasTime($startMonth, $endMonth, $beforeMonth, $afterMonth, $onMonth)) {
                $where = setconfirmedTime($where, $startMonth, $endMonth, $beforeMonth, $afterMonth, $onMonth);
            }
            $where .= " GROUP BY left(confirmtime,7)";
        } else {
            if ($question == "firsttimeuser") {
                $sql = "select insertmonth, COUNT(insertmonth) from action ";
                $where .= " and isfirst = 'T' ";
                if (hasCondition($sex, $state, $country)) {
                    $where = setFirstCondition($where, $sex, $state, $country);
                }
                if (hasTime($startMonth, $endMonth, $beforeMonth, $afterMonth, $onMonth)) {
                    $where = setInsertTime($where, $startMonth, $endMonth, $beforeMonth, $afterMonth, $onMonth);
                }
                if (hasUser($user)) {
                    $where = setUser($where, $user);
                }
                $where .= " GROUP BY insertmonth";
            }
        }
    }
} else {
    echo "something wrong happens";
    exit;
}
$sql = $sql . $where;
//echo $sql;
$result = creatTrend($sql);
print_r(json_encode($result));
function creatTrend($sql)
{