Example #1
1
function del_users($select)
{
	global $users_filename;
	$users = array();
	$users_content = get_file_content($users_filename);
	if ($users_content !== NULL) $users = unserialize($users_content);
	$users = del_id($users, $select);
	$users_content = serialize($users);
	put_file_content($users_filename, $users_content);
	clean_user();
}
Example #2
0
function get_user_json($user_id = 0)
{
    $user = get_user($user_id);
    if (!$user) {
        return '{}';
    } else {
        $user = clean_user($user);
        return json_encode($user);
    }
}
Example #3
0
 function __construct($params)
 {
     $this->ad = new adLDAP();
     $this->ad->connect();
     //$params is an array returned from the adLDAP class
     $this->username = $params['user'];
     //create variable $user
     $user = $this->username;
     //method to remove @something.xxx if supplied
     function clean_user($user)
     {
         $email_test = strstr($user, '@');
         if ($user == '') {
             die("Empty Login");
         } else {
             if ($email_test == true) {
                 //explode string at @ symbol
                 $user = explode('@', $user);
                 //take first part of array
                 $user = $user[0];
             }
         }
         return $user;
     }
     //run the clean_user function to ensure we have the right format for username
     $this->username = clean_user($params['user']);
     if (@$params['passwd']) {
         $this->auth($params['passwd']);
     }
     $this->rawInfo = $this->ad->user()->info($this->username, array('*'));
     if (@($this->rawInfo['count'] == 1)) {
         $this->exists = true;
         $this->rawInfo = $this->rawInfo[0];
         $this->name = $this->rawInfo['displayname'][0];
         $this->last_name = $this->rawInfo['sn'][0];
         $this->first_name = $this->rawInfo['givenname'][0];
         $this->middle_initial = $this->rawInfo['initials'][0];
         $this->phone = $this->rawInfo['telephonenumber'][0];
         $this->department = $this->rawInfo['departmentnumber'][0];
         $this->title = $this->rawInfo['title'][0];
         $this->email = $this->rawInfo['mail'][0];
         $this->address = $this->rawInfo['physicaldeliveryofficename'][0];
         $this->groups = array_values(array_slice($this->rawInfo['edupersonaffiliation'], 1));
         // removes "count" element
         array_walk($this->groups, function (&$n) {
             $n = strtolower($n);
         });
         $this->memberships = $this->memberships();
     }
 }
Example #4
0
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
//
// This file was modified by contributors of "BOINC Web Tweak" project.
require_once "../inc/db.inc";
set_time_limit(0);
db_init();
function clean_user($user)
{
    if ($user->name != strip_tags($user->name)) {
        $x = strip_tags($user->name);
        echo "ID: {$user->id}\r\nname: {$user->name}\r\nstripped name: {$x}\r\nemail: {$user->email_addr}\r\n-----\r\n";
        $x = boinc_real_escape_string($x);
        $x = trim($x);
        $query = "update user set name='{$x}' where id={$user->id}";
        $retval = mysql_query($query);
        echo $query;
    }
}
$result = mysql_query("select id, name, email_addr from user");
while ($user = mysql_fetch_object($result)) {
    clean_user($user);
}
Example #5
0
/**
 * USERS
 * @param $object
 * @return mixed
 */
function decorate_user($object)
{
    return clean_user($object);
}
Example #6
0
	}
	if ($_GET['what'] == "users") {
		header("Content-Disposition: attachment; filename=\"users@".date("Y-m-d").".txt\"");
		$data_content = get_file_content($users_filename);
	}
	echo $data_content;
	die;
}

if ($_POST['delete']) {
	del_users($_POST['select']);
	header("Location: ".FILE);
}

if ($_GET['clean']) {
	clean_user($_GET['_user']);
	header("Location: ".FILE);
}

if ($styles_enabled) {
	if ($_GET['style'] and file_exists("styles/".$_GET['style'].".css")) $style_filename = $_GET['style'].".css";
		elseif ($_COOKIE['s_style'] and file_exists("styles/".$_COOKIE['s_style'].".css")) $style_filename = $_COOKIE['s_style'].".css";
	$current_style = substr($style_filename, 0, strpos($style_filename, ".css"));
	$current_path = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
	preg_match("/^https?:\/\/[^\/]+([^\?]*\/)[^\?]+\//i", $current_path, $matches);
	setcookie("s_style", $current_style, time()+7776000, $matches[1]);
}

$data = array();
$data_content = get_file_content($data_filename);
if ($data_content !== NULL) $data = unserialize($data_content);