<?php

include './resources/init.php';
if (isset($_POST['type'])) {
    if ($_POST['type'] == "logout") {
        fAuthorization::destroyUserInfo();
    } else {
        if ($_POST['type'] == "login") {
            try {
                $user = new User($_POST['username']);
            } catch (fException $e) {
                fURL::redirect(URL_ROOT . "authentication.php");
            }
            if (sha1($_POST['password']) == $user->getPassword()) {
                fAuthorization::setUserAuthLevel($user->getLevel());
                fAuthorization::setUserToken($_POST['username']);
                fURL::redirect(fAuthorization::getRequestedUrl(true, URL_ROOT . "inventory.php"));
            } else {
                fURL::redirect(URL_ROOT . "authentication.php");
            }
        }
    }
} else {
    if (isset($_GET['type']) == "logout") {
        fAuthorization::destroyUserInfo();
    }
}
$tmpl->place('header');
$tmpl->place('menu');
?>
<div class="span-24 last">
Example #2
0
<?php

$this->breadcrumbs = array('Users' => array('index'), 'Manage');
$this->menu = array(array('label' => 'List User', 'url' => array('index')), array('label' => 'Create User', 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\$('.search-form').toggle();\nreturn false;\n});\n\$('.search-form form').submit(function(){\n\$.fn.yiiGridView.update('user-grid', {\ndata: \$(this).serialize()\n});\nreturn false;\n});\n");
?>

<div class="page-header">
	<h3>Kelola User</h3>
</div>
<div class="well well-large">
	<?php 
$this->widget('booster.widgets.TbButton', array('label' => '', 'context' => 'info', 'size' => 'small', 'url' => array('create'), 'icon' => 'plus-sign', 'buttonType' => 'link'));
?>

	<?php 
$this->widget('booster.widgets.TbButton', array('label' => '', 'context' => 'info', 'size' => 'small', 'icon' => 'search', 'htmlOptions' => array('class' => 'search-button')));
?>
	<div class="search-form" style="display:none">
		<?php 
$this->renderPartial('_search', array('model' => $model));
?>
	</div><!-- search-form -->


	<?php 
$this->widget('booster.widgets.TbGridView', array('id' => 'user-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'type' => 'striped bordered condensed', 'columns' => array(array('header' => 'No', 'value' => '$this->grid->dataProvider->pagination->currentPage*$this->grid->dataProvider->pagination->pageSize + $row+1'), array('name' => 'username', 'value' => '$data->username'), array('name' => 'level', 'value' => 'User::getLevel($data->level)', 'filter' => User::getLevel()), array('name' => 'status', 'value' => 'Utility::getStatus($data->status)', 'filter' => Utility::getStatus()), array('name' => 'last_login', 'value' => 'date("d-m-Y H:i", strtotime($data->last_login))'), array('header' => 'Options', 'class' => 'booster.widgets.TbButtonColumn', 'buttons' => array('view' => array('label' => 'lihat', 'options' => array('class' => 'view'), 'url' => 'Yii::app()->controller->createUrl("view",array("id"=>$data->primaryKey))'), 'update' => array('label' => 'ubah', 'options' => array('class' => 'edit'), 'url' => 'Yii::app()->controller->createUrl("update",array("id"=>$data->primaryKey))'), 'delete' => array('label' => 'hapus', 'options' => array('class' => 'delete'), 'url' => 'Yii::app()->controller->createUrl("delete",array("id"=>$data->primaryKey))')), 'template' => '{view}&nbsp;{update}&nbsp;{delete}'))));
?>
</div>	
Example #3
0
		<table class='list'>
			<?php 
$temp = new User(file_get_contents("db/Users/" . $_GET['userId'] . ".dat"));
echo "<tr><td class='listLeft'>Name</td><td class='listRight'>" . $temp->getUserId() . "</td></tr>";
if ($temp->isBanned() == 'false') {
    echo "<tr><td class='listLeft'>Banned</td><td class='listRight'>No</td></tr>";
} else {
    echo "<tr><td class='listLeft'>Banned</td><td class='listRight'>Yes</td></tr>";
}
if ($temp->isHideEmail() == false && $_SESSION['loggedIn'] == true) {
    echo "<tr><td class='listLeft'>Email Address</td><td class='listRight'>" . $temp->getEmail() . "</td></tr>";
}
echo "<tr><td class='listLeft'>Join Date</td><td class='listRight'>" . $temp->getJoinDate() . "</td></tr>";
echo "<tr><td class='listLeft'>No Of Posts</td><td class='listRight'>" . $temp->getNoPosts() . "</td></tr>";
echo "<tr><td class='listLeft'>No Of Topics</td><td class='listRight'>" . $temp->getNoTopics() . "</td></tr>";
echo "<tr><td class='listLeft'>Level</td><td class='listRight'>" . $temp->getLevel() . "</td></tr>";
if ($temp->getSig() != "") {
    echo "<tr><td class='listLeft'>Signature</td><td class='listRight'>" . $temp->getSig() . "</td></tr>";
}
if ($temp->getAvatar() != "") {
    echo "<tr><td class='listLeft'>Avatar</td><td class='listRight'><img src='" . $temp->getAvatar() . "' /></td></tr>";
}
?>
		</table>
		
		<?php 
if ($_SESSION['loggedIn'] == true) {
    echo "<div align='center' style='margin-top: 5px;'><a href='pmCompose.php?userId=" . htmlentities($_GET['userId']) . "'>PM User</a></div>";
}
outHtml3();
Example #4
0
<?php 
outHtml2("Edit Your Profile", "index.php");
?>

		<form method="post" action="editExecute.php">
			<table class='list'>
				<?php 
$temp = new User(file_get_contents("db/Users/" . $_GET['userId'] . ".dat"));
echo "<tr><td class='listleftb'>Name</td><td colspan='2' class='listrightb'>" . $temp->getUserId() . "</td></tr>";
echo "<tr><td class='listleftb'>Password</td><td colspan='2' class='listrightb'><input type='password' class='inputBox' name='password' value='" . $temp->getPassword() . "' /></td></tr>";
echo "<tr><td class='listleftb'>Email Address</td><td colspan='2' class='listrightb'><input type='text' class='inputBox' name='email' value='" . $temp->getEmail() . "' /></td></tr>";
echo "<tr><td class='listleftb'>Join Date</td><td colspan='2' class='listrightb'>" . $temp->getJoinDate() . "</td></tr>";
echo "<tr><td class='listleftb'>No Of Posts</td><td colspan='2' class='listrightb'>" . $temp->getNoPosts() . "</td></tr>";
echo "<tr><td class='listleftb'>No Of Topics</td><td colspan='2' class='listrightb'>" . $temp->getNoTopics() . "</td></tr>";
echo "<tr><td class='listleftb'>Level</td><td colspan='2' class='listrightb'>" . $temp->getLevel() . "</td></tr>";
echo "<tr><td class='listleftb'>Signature</td><td colspan='2' class='listrightb'><textarea name='sig'>" . $temp->getSig() . "</textarea></td></tr>";
if ($temp->ishideEmail()) {
    $hideEmail = " checked";
}
echo "<tr><td class='listleftb'>Hide Email</td><td colspan='2' class='listrightb' style='text-align: center;'><input type='checkbox' name='hideEmail' value='yes'" . $hideEmail . " /></td></tr>";
if ($temp->getAvatar() != "") {
    $imgAvatar = "<img src='" . $temp->getAvatar() . "' />";
} else {
    $imgAvatar = "";
}
echo "<tr><td class='listleftb'>Avatar</td><td class='listrightb'><input type='text' style='width: 265px' name='avatar' value='" . $temp->getAvatar() . "' /></td>\r\n\t\t\t\t\t\t<td style='background-color: #e9f3ff; padding: 10px 0px 10px 20px; border-left: 1px solid;'>" . $imgAvatar . "</td></tr>";
?>
			</table>
			
			<?php 
Example #5
0
//
// $user initialisation
//
if (isset($_SESSION["user"])) {
    $user = $_SESSION["user"];
} else {
    $user = new User();
    $_SESSION["user"] = $user;
}
//
// $id_account_current
//
if (isset($_SESSION["id_account_current"]) && !isset($_POST["id_account"])) {
    $id_account_current = $_SESSION["id_account_current"];
} else {
    if ($user->getLevel() == "2") {
        if (isset($_POST["id_account"])) {
            $id_account_current = $_POST["id_account"];
        } else {
            $id_account_current = "1";
        }
    } else {
        $id_account_current = $user->getIdAccount();
    }
    $_SESSION["id_account_current"] = $id_account_current;
}
$cache_enabled = $config->getDefault("crawler.cache.type", "") != "";
ini_set('mongo.native_long', 0);
//$isEnterprise = ($config->get("application.enterprise") == '1');
$db_version = getDBVersion($config);
if (!empty($db_version)) {
Example #6
0
				<td class='listname' style="background: url(images/bar.png) repeat-x; color: white;"><u>Username</u></td>
				<td class='listlevel' style="background: url(images/bar.png) repeat-x; color: white;"><u>Level</u></td>
				<td class='listbanned' style="background: url(images/bar.png) repeat-x; color: white;"><u>Banned</u></td>
			</tr>
		</table>
		
		<form action="userAdminExecute.php" method="post">
			<table class='list'>
				<?php 
$dir = dir("db/Users/");
$count = 0;
while ($filename = $dir->read()) {
    if ($filename != "." && $filename != "..") {
        $temp = new User(file_get_contents("db/Users/" . $filename));
        echo "<tr><td class='listname'>" . $temp->getUserId() . "</td>";
        echo "<td class='listlevel'><input type='text' name='" . $temp->getUserId() . "[]' value='" . $temp->getLevel() . "' /></td>";
        if ($temp->isBanned() == 'false') {
            $checked = "";
        } else {
            $checked = " checked";
        }
        echo "<td class='listlevel'><input type='checkbox' name='" . $temp->getUserId() . "[]' value='yes'" . $checked . " /></td></tr>";
        $count++;
    }
}
$dir->close();
?>
			</table>
		
			<div id="submitDiv">
				<input type="submit" value="Update" />
<?php

include "common.php";
$dir = dir("db/Users/");
while ($filename = $dir->read()) {
    if ($filename != "." && $filename != "..") {
        $filename = substr($filename, 0, strlen($filename) - 4);
        $temp = new User(file_get_contents("db/Users/" . $filename . ".dat"));
        if ($temp->getLevel() != $_POST[$filename][0] || $temp->isBanned() == 'false' && $_POST[$filename][1] == "yes" || $temp->isBanned() != 'false' && $_POST[$filename][1] != "yes") {
            $fileC = file("db/Users/" . $filename . ".dat", FILE_IGNORE_NEW_LINES);
            if ($_POST[$filename][0] == 1 || $_POST[$filename][0] == 2 || $_POST[$filename][0] == 3) {
                $fileC[6] = $_POST[$filename][0];
            }
            if ($_POST[$filename][1] == "yes") {
                $fileC[2] = "true";
            } else {
                $fileC[2] = "false";
            }
            $str = "";
            foreach ($fileC as $line) {
                $str .= $line . "\n";
            }
            file_put_contents("db/Users/" . $filename . ".dat", $str);
        }
    }
}
header("location: userAdmin.php");