Example #1
0
            $matched = array_first($perms, function ($i, $perm) use($feature) {
                return fnmatch($perm, $feature, FNM_NOESCAPE | FNM_PATHNAME | FNM_CASEFOLD);
            });
            return (bool) ($allBut ^ !!$matched);
        }
    }
    function emailRecipient()
    {
        $self = $this;
        return (string) Event::result('user.recipient', $this, function ($result) use($self) {
            if (strpos($result, $self->email) === false) {
                return 'a string without the actual e-mail address';
            }
        });
    }
    function resetHash($days = null, $hash = null)
    {
        $args = func_num_args();
        if ($args === 0) {
            $date = date('d');
            return md5($this->id . '-' . \Config::get('application.key') . '-' . $date);
        } else {
            $date = date('d', strtotime('+' . $days . ' day'));
            $value = md5($this->id . '-' . \Config::get('application.key') . '-' . $date);
            return $args === 1 ? $value : $value === $hash;
        }
    }
}
User::$table = \Config::get('vanemart::general.table_prefix') . User::$table;
User::$fields = userFields(User::$fields, 'user');
Example #2
0
 public static function save(User $user)
 {
     $fields = $user->fields();
     unset($fields['id']);
     try {
         if (isset($user->id) && !is_null($user->id)) {
             Symphony::Database()->update('tbl_users', $fields, array($user->id), "`id` = %d");
         } else {
             $user->id = Symphony::Database()->insert('tbl_users', $fields);
         }
     } catch (DatabaseException $e) {
         return false;
     }
     return $user->id;
 }