Ejemplo n.º 1
0
 private static function _reset()
 {
     self::$_prefs = null;
 }
Ejemplo n.º 2
0
 /**
  * A wrapper to remove a user preference that is module specific.
  * this method only applies to admin users.
  *
  * @param string $pref_name The preference name
  * @param string $value The preference value.
  */
 public function CGRemoveUserPreference($pref_name)
 {
     $key = '__' . $this->GetName() . '_' . $pref_name;
     return cms_userprefs::remove($key, $value);
 }
Ejemplo n.º 3
0
/**
 * Sets the given perference for the given userid with the given value.
 *
 * @since 0.3
 * @param integer The user id
 * @param string  The preference name
 * @param mixed   The preference value (will be stored as a string)
 * @return void
 */
function set_preference($userid, $prefname, $value)
{
    return cms_userprefs::set_for_user($userid, $prefname, $value);
}
Ejemplo n.º 4
0
 public static function set_cwd($path)
 {
     $config = cmsms()->GetConfig();
     if (startswith($path, $config['root_path'])) {
         $path = substr($path, strlen($config['root_path']) + 1);
     }
     $advancedmode = self::check_advanced_mode();
     // validate the path.
     $prefix = $config['root_path'];
     $tmp = self::join_path($prefix, $path);
     $tmp = realpath($tmp);
     if (!is_dir($tmp)) {
         throw new Exception('Cannot set current working directory to an invalid path');
     }
     if (!self::test_invalid_path($tmp)) {
         throw new Exception('Cannot set current working directory to an invalid path');
     }
     $path = str_replace('\\', '/', substr($tmp, strlen($prefix) + 1));
     cms_userprefs::set('filemanager_cwd', $path);
 }
Ejemplo n.º 5
0
$user_id = -1;
if (isset($_GET["user_id"])) {
    $user_id = $_GET["user_id"];
    $user_name = "";
    $userid = get_userid();
    $access = check_permission($userid, 'Remove Users');
    if ($access && $user_id != $cur_userid) {
        $gCms = cmsms();
        $userops = $gCms->GetUserOperations();
        $oneuser = $userops->LoadUserByID($user_id);
        $user_name = $oneuser->username;
        $ownercount = $userops->CountPageOwnershipByID($user_id);
        if ($ownercount > 0) {
            $dodelete = false;
        }
        if ($dodelete) {
            Events::SendEvent('Core', 'DeleteUserPre', array('user' => &$oneuser));
            cms_userprefs::remove_for_user($user_id);
            $oneuser->Delete();
            Events::SendEvent('Core', 'DeleteUserPost', array('user' => &$oneuser));
            // put mention into the admin log
            audit($user_id, 'Admin Username: '******'Deleted');
        }
    }
}
if ($dodelete == true) {
    redirect("listusers.php" . $urlext);
} else {
    redirect("listusers.php" . $urlext . "&message=" . lang('erroruserinuse'));
}
# vim:ts=4 sw=4 noet