示例#1
0
</div>';
        break;
        /** EDIT USER */
    /** EDIT USER */
    case 'edit':
        if (!ab_to(array('users' => 'edit'))) {
            die;
        }
        $csrf = \site\utils::str_random(10);
        echo '<div class="title">

<h2>' . $LANG['users_edit_title'] . '</h2>

<div style="float:right; margin: 0 2px 0 0;">';
        if (isset($_GET['id']) && ($user_exists = \query\main::user_exists($_GET['id']))) {
            $info = \query\main::user_infos($_GET['id']);
            echo '<div class="options">

<a href="#" class="btn">' . $LANG['options'] . '</a>
<ul>';
            if (ab_to(array('users' => 'delete'))) {
                echo '<li><a href="?route=users.php&amp;action=delete&amp;id=' . $_GET['id'] . '&amp;token=' . $csrf . '" data-delete-msg="' . $LANG['delete_msg'] . '">' . $LANG['delete'] . '</a></li>';
            }
            if ($info->is_confirmed) {
                echo '<li><a href="?route=users.php&amp;action=list&amp;type=unverify&amp;id=' . $_GET['id'] . '&amp;token=' . $csrf . '">' . $LANG['unverify'] . '</a></li>';
            } else {
                echo '<li><a href="?route=users.php&amp;action=list&amp;type=verify&amp;id=' . $_GET['id'] . '&amp;token=' . $csrf . '">' . $LANG['verify'] . '</a></li>';
            }
            if (ab_to(array('mail' => 'send'))) {
                echo '<li><a href="?route=users.php&amp;action=sendmail&amp;email=' . $info->email . '">' . $LANG['send_email'] . '</a></li>';
示例#2
0
 public static function delete_user_avatar($id)
 {
     global $db;
     if (!ab_to(array('users' => 'edit'))) {
         return false;
     }
     $id = (array) $id;
     $stmt = $db->stmt_init();
     foreach ($id as $ID) {
         if (\query\main::user_exists($ID)) {
             $user = \query\main::user_infos($ID);
             $stmt->prepare("UPDATE " . DB_TABLE_PREFIX . "users SET avatar = '' WHERE id = ?");
             $stmt->bind_param("i", $ID);
             $stmt->execute();
             if (!empty($user->avatar)) {
                 @unlink(DIR . '/' . $user->avatar);
             }
         }
     }
     @$stmt->close();
     return true;
 }