Ejemplo n.º 1
0
function getUserListFromDB()
{
    global $db;
    $q = $db->dq("SELECT * FROM {$db->prefix}users");
    while ($r = $q->fetch_assoc($q)) {
        ?>
		<tr>
			<td valign="left" class="username"><?php 
        echo $r['username'];
        ?>
</td>
			<td valign="left" class="email"><?php 
        echo $r['email'];
        ?>
</td>
			<td valign="left" class="role"><?php 
        echo _e('um_rolename_' . $r['role']);
        ?>
</td>
			<td valign="left" class="notification"><?php 
        echo NotificationListener::hasGlobalNotifications($r['id']) ? _e('um_notification_on') : _e('um_notification_off');
        ?>
</td>
			<td>
				<a href="#" class="edituser" rel="<?php 
        echo $r['id'];
        ?>
"><?php 
        _e('action_edit');
        ?>
</a>
				<?php 
        if ($r['id'] != $_SESSION['userid']) {
            ?>
				&nbsp;|&nbsp;
				<a href="#" class="deleteuser" rel="<?php 
            echo $r['id'];
            ?>
"><?php 
            _e('action_delete');
            ?>
</a>
				<?php 
        }
        ?>
			</td>
		</tr>
		<?php 
    }
}
 public static function enableNotification($type, $value = null, $take_care_of_global = true, $user_id = null)
 {
     $db = DBConnection::instance();
     $current_user_id = empty($user_id) ? (int) $_SESSION['userid'] : $user_id;
     if (!in_array($type, array(NotificationListener::LISTENER_TYPE_GLOBAL, NotificationListener::LISTENER_TYPE_LIST, NotificationListener::LISTENER_TYPE_TASK))) {
         return false;
     }
     if ($type != NotificationListener::LISTENER_TYPE_GLOBAL && empty($value)) {
         return false;
     }
     if ($take_care_of_global && NotificationListener::hasGlobalNotifications($current_user_id)) {
         return true;
     }
     if (empty($value)) {
         $db->dq("DELETE FROM {$db->prefix}notification_listeners WHERE type = '" . $type . "' AND user_id = " . $current_user_id . "");
         $db->dq("INSERT INTO {$db->prefix}notification_listeners (user_id, type) VALUES (?, ?)", array($current_user_id, $type));
     } else {
         $db->dq("DELETE FROM {$db->prefix}notification_listeners WHERE type = '" . $type . "' AND user_id = " . $current_user_id . " AND value={$value}");
         $db->dq("INSERT INTO {$db->prefix}notification_listeners (user_id, type, value) VALUES (?, ?, ?)", array($current_user_id, $type, $value));
     }
 }
Ejemplo n.º 3
0
echo $multiUser ? "true" : "false";
?>
,
			admin: <?php 
echo is_admin() ? "true" : "false";
?>
,
			readOnly: <?php 
echo is_readonly() ? "true" : "false";
?>
,
			<?php 
if (isset($_SESSION['userid'])) {
    ?>
			globalNotifications: <?php 
    echo NotificationListener::hasGlobalNotifications($_SESSION['userid']) ? "true" : "false";
    ?>
,
			userId: <?php 
    echo !empty($_SESSION['userid']) ? $_SESSION['userid'] : 'null';
    ?>
,
			userRole: <?php 
    echo !empty($_SESSION['role']) ? $_SESSION['role'] : 'null';
    ?>
,
			<?php 
}
?>
			isLogged: <?php 
echo $needAuth && is_logged() ? "true" : "false";