private function addMessages($project_id, $messagesArray)
 {
     $addMessage = new message();
     $userObj = new user();
     foreach ($messagesArray->{'post'} as $message) {
         $insid = 0;
         $title = $message->{'title'};
         $text = $message->{'body'};
         $uid = $message->{'author-id'};
         $user = $this->peopleHash["{$uid}"];
         $userProfile = $userObj->getProfile($user);
         $username = $userProfile["name"];
         $replies = $message->{'comments'};
         $insid = $addMessage->add($project_id, $title, $text, "", $user, $username, 0, 0);
         if ($insid > 0) {
             ++$this->msgCount;
             if (count($replies) > 0) {
                 foreach ($replies->{'comment'} as $reply) {
                     ++$this->msgCount;
                     $replytext = $reply->{"body"};
                     $ruid = $reply->{'author-id'};
                     $ruser = $this->peopleHash["{$ruid}"];
                     $ruserProfile = $userObj->getProfile($ruser);
                     $rusername = $ruserProfile["name"];
                     $addMessage->add($project_id, $replytext, $replytext, "", $ruser, $rusername, $insid, 0);
                 }
             }
         }
     }
 }
Exemple #2
0
     */
    public function getContentType()
    {
        return null;
    }
    public function delete()
    {
        unlink($this->{$myPath});
    }
}
$auth = new Sabre_HTTP_BasicAuth();
$result = $auth->getUserPass();
$aUser = $result[0];
$aPass = $result[1];
$userObj = new user();
$profile = $userObj->getProfile($userObj->getId($aUser));
if (!$profile) {
    $auth->requireLogin();
    echo "Username doesn't exist!\n";
    die;
}
if ($profile["pass"] != sha1(trim($aPass))) {
    $auth->requireLogin();
    echo "Wrong password!\n";
    die;
}
$userObj->login($aUser, $aPass);
/*
if (!$result || $result[0]!=$u || $result[1]!=$p) {

    $auth->requireLogin();
Exemple #3
0
 /**
  * Return a task
  *
  * @param int $id Task ID
  * @return array $task Task details
  */
 function getTask($id)
 {
     global $conn;
     $id = (int) $id;
     // get the task
     $taskStmt = $conn->prepare("SELECT * FROM tasks WHERE ID = ?");
     $taskStmt->execute(array($id));
     $task = $taskStmt->fetch();
     if (!empty($task)) {
         // format datestring according to dateformat option
         if (is_numeric($task['start'])) {
             $startstring = date(CL_DATEFORMAT, $task["start"]);
         } else {
             $startstring = date(CL_DATEFORMAT, strtotime($task["start"]));
         }
         if (is_numeric($task['end'])) {
             $endstring = date(CL_DATEFORMAT, $task["end"]);
         } else {
             $endstring = date(CL_DATEFORMAT, strtotime($task["end"]));
         }
         // get list and projectname of the task
         $details = $this->getTaskDetails($task);
         $list = $details["list"];
         $pname = $details["pname"];
         // get remaining days until due date
         $tage = $this->getDaysLeft($task['end']);
         // Get the user(s) assigned to the task from the db
         $usel = $conn->query("SELECT user FROM tasks_assigned WHERE task = {$task['ID']}");
         $users = array();
         // fetch the assigned user(s)
         while ($usr = $usel->fetch()) {
             // push the assigned users to an array
             array_push($users, $usr[0]);
             $task["user"] = "******";
             $task["user_id"] = $users;
         }
         // If only one user is assigned, get his profile and add him to users, user_id fields
         if (count($users) == 1) {
             $usrobj = new user();
             $usr = $users[0];
             $user = $usrobj->getProfile($usr);
             $task["user"] = $user["name"];
             $task["users"] = array($user);
             $task["user_id"] = $user["ID"];
         } elseif (count($users) > 1) {
             // if there is more than one user push them to the users field. no user or user_id field is present.
             $usrobj = new user();
             $task["users"] = array();
             $task["user"] = "";
             $task["user_id"] = 0;
             foreach ($users as $user) {
                 $usr = $usrobj->getProfile($user);
                 $task["user"] .= $usr["name"] . " ";
                 array_push($task["users"], $usr);
             }
         }
         $task["startstring"] = $startstring;
         $task["endstring"] = $endstring;
         $task["title"] = $task["title"];
         $task["text"] = $task["text"];
         $task["pname"] = $pname;
         $task["list"] = $list;
         $task["daysleft"] = $tage;
         return $task;
     } else {
         return false;
     }
 }
Exemple #4
0
            $loc = $url . $redir;
        } else {
            $loc = $url . "manageuser.php?action=showproject&id={$id}&mode=assigned";
        }
        header("Location: {$loc}");
    }
} elseif ($action == "deassignform") {
    if (!$userpermissions["projects"]["edit"]) {
        $errtxt = $langfile["nopermission"];
        $noperm = $langfile["accessdenied"];
        $template->assign("errortext", "{$errtxt}<br>{$noperm}");
        $template->display("error.tpl");
        die;
    }
    $userobj = new user();
    $user = $userobj->getProfile($usr);
    $proj = $project->getProject($id);
    // Get members of the project
    $members = $project->getProjectMembers($id);
    $title = $langfile["deassignuser"];
    $template->assign("title", $title);
    $template->assign("redir", $redir);
    $template->assign("user", $user);
    $template->assign("project", $proj);
    $template->assign("members", $members);
    $template->display("deassignuserform.tpl");
} elseif ($action == "deassign") {
    if (!$userpermissions["projects"]["edit"]) {
        $errtxt = $langfile["nopermission"];
        $noperm = $langfile["accessdenied"];
        $template->assign("errortext", "{$errtxt}<br>{$noperm}");
Exemple #5
0
 /**
  * Lists all the users in a project
  *
  * @param int $project Eindeutige Projektnummer
  * @param int $lim Maximum auszugebender Mitglieder
  * @return array $members Projektmitglieder
  */
 function getProjectMembers($project, $lim = 10, $paginate = true)
 {
     global $conn;
     $project = (int) $project;
     $lim = (int) $lim;
     $project = (int) $project;
     $lim = (int) $lim;
     $members = array();
     if ($paginate) {
         $num = $conn->query("SELECT COUNT(*) FROM projekte_assigned WHERE projekt = {$project}")->fetch();
         $num = $num[0];
         $lim = (int) $lim;
         SmartyPaginate::connect();
         // set items per page
         SmartyPaginate::setLimit($lim);
         SmartyPaginate::setTotal($num);
         $start = SmartyPaginate::getCurrentIndex();
         $lim = SmartyPaginate::getLimit();
     } else {
         $start = 0;
     }
     $sel1 = $conn->query("SELECT user FROM projekte_assigned WHERE projekt = {$project} LIMIT {$start},{$lim}");
     $usr = new user();
     while ($user = $sel1->fetch()) {
         $theuser = $usr->getProfile($user[0]);
         array_push($members, $theuser);
     }
     if (!empty($members)) {
         return $members;
     } else {
         return false;
     }
 }
Exemple #6
0
 /**
  * Return a file
  *
  * @param string $id File ID
  * @return array $file File details
  */
 function getFile($id)
 {
     global $conn;
     $id = (int) $id;
     // Get the file from the database
     $file = $conn->query("SELECT * FROM files WHERE ID={$id}")->fetch();
     if (!empty($file)) {
         // Determine if there is a MIME-type icon corresponding to the file's MIME-type. If not, set 'none'
         $file['type'] = str_replace("/", "-", $file["type"]);
         // Get settings (needed to add a different MIME-type icon per theme for each file)
         $set = new settings();
         $settings = $set->getSettings();
         // Construct the path to the MIME-type icon
         $myfile = "./templates/" . $settings["template"] . "/theme/" . $settings["theme"] . "/images/files/" . $file['type'] . ".png";
         if (!file_exists($myfile)) {
             $file['type'] = "none";
         }
         // Determine if it is an image or text file or some other kind of file (required for lightbox)
         if (stristr($file['type'], "image")) {
             $file['imgfile'] = 1;
         } elseif (stristr($file['type'], "text")) {
             $file['imgfile'] = 0;
         } else {
             $file['imgfile'] = 0;
         }
         // Strip slashes from title, desc and tags
         $file["title"] = stripslashes($file["title"]);
         $file["desc"] = stripslashes($file["desc"]);
         $file["size"] = filesize(realpath($file["datei"])) / 1024;
         $file["size"] = round($file["size"]);
         $file["addedstr"] = date(CL_DATEFORMAT, $file["added"]);
         // Attach data about the user who uploaded the file
         $userobj = new user();
         $file["userdata"] = $userobj->getProfile($file["user"]);
         return $file;
     } else {
         return false;
     }
 }
        $template->display("error.tpl");
    }
} elseif ($action == "editform") {
    if (!$userpermissions["timetracker"]["edit"]) {
        $template->assign("errortext", "Permission denied.");
        $template->assign("mode", "error");
        $template->display("error.tpl");
        die;
    }
    // create task and user instance
    $task = new task();
    $user = new user();
    // get track to edit
    $track = $tracker->getTrack($tid);
    // get username
    $member = $user->getProfile($track["user"]);
    $track["username"] = $member["name"];
    if ($track["task"] != 0) {
        // get task
        $thetask = $task->getTask($track["task"]);
        if (empty($thetask["title"])) {
            $taskname = substr($thetask["text"], 0, 30);
        } else {
            $taskname = substr($thetask["title"], 0, 30);
        }
        $track["taskname"] = $taskname;
    }
    $template->assign("track", $track);
    $newtasks = $task->getProjectTasks($id);
    $oldtasks = $task->getProjectTasks($id, false);
    if ($newtasks and $oldtasks) {
 /**
  * Return a file
  *
  * @param string $id File ID
  * @return array $file File details
  */
 function getFile($id)
 {
     $id = (int) $id;
     // get the file from MySQL
     $sel = mysql_query("SELECT * FROM files WHERE ID={$id}");
     $file = mysql_fetch_array($sel);
     if (!empty($file)) {
         // determine if there is an mimetype icon corresponding to the files mimetype. If not set 'none'
         $file['type'] = str_replace("/", "-", $file["type"]);
         $set = new settings();
         $settings = $set->getSettings();
         $myfile = "./templates/" . $settings["template"] . "/images/files/" . $file['type'] . ".png";
         if (!file_exists($myfile)) {
             $file['type'] = "none";
         }
         // determine if its an image or textfile or some other file. this is needed for lightboxes
         if (stristr($file['type'], "image")) {
             $file['imgfile'] = 1;
         } elseif (stristr($file['type'], "text")) {
             $file['imgfile'] = 2;
         } else {
             $file['imgfile'] = 0;
         }
         // split the tags string into an array, and also count how many tags the file has
         $tagobj = new tags();
         $thetags = $tagobj->splitTagStr($file["tags"]);
         $file["tagsarr"] = $thetags;
         $file["tagnum"] = count($file["tagsarr"]);
         // strip slashes from titles , desc and tags
         $file["title"] = stripslashes($file["title"]);
         $file["desc"] = stripslashes($file["desc"]);
         $file["tags"] = stripslashes($file["tags"]);
         $file["size"] = filesize(realpath($file["datei"])) / 1024;
         $file["size"] = round($file["size"]);
         $file["addedstr"] = date("d.m.y", $file["added"]);
         $userobj = new user();
         $file["userdata"] = $userobj->getProfile($file["user"]);
         return $file;
     } else {
         return false;
     }
 }
 /**
  * Return a task
  *
  * @param int $id Task ID
  * @return array $task Task details
  */
 function getTask($id)
 {
     $id = (int) $id;
     $sel = mysql_query("SELECT * FROM tasks WHERE ID = {$id}");
     $task = mysql_fetch_array($sel, MYSQL_ASSOC);
     if (!empty($task)) {
         // format datestring according to dateformat option
         if (is_numeric($task['end'])) {
             $endstring = date(CL_DATEFORMAT, $task["end"]);
         } else {
             $endstring = date(CL_DATEFORMAT, strtotime($task["end"]));
         }
         // get list and projectname of the task
         $details = $this->getTaskDetails($task);
         $list = $details["list"];
         $pname = $details["pname"];
         // get remainig days until due date
         $tage = $this->getDaysLeft($task['end']);
         $usel = mysql_query("SELECT user FROM tasks_assigned WHERE task = {$task['ID']}");
         $users = array();
         while ($usr = mysql_fetch_row($usel)) {
             array_push($users, $usr[0]);
             $task["user"] = "******";
             $task["user_id"] = $users;
         }
         if (count($users) == 1) {
             $usrobj = new user();
             $usr = $users[0];
             $user = $usrobj->getProfile($usr);
             $task["user"] = stripslashes($user["name"]);
             $task["users"] = array($user);
             $task["user_id"] = $user["ID"];
         } elseif (count($users) > 1) {
             $usrobj = new user();
             $task["users"] = array();
             $task["user"] = "";
             $task["user_id"] = 0;
             foreach ($users as $user) {
                 $usr = $usrobj->getProfile($user);
                 $task["user"] .= $usr["name"] . " ";
                 array_push($task["users"], $usr);
             }
         }
         $task["endstring"] = $endstring;
         $task["title"] = stripslashes($task["title"]);
         $task["text"] = stripslashes($task["text"]);
         $task["pname"] = stripslashes($pname);
         $task["list"] = $list;
         $task["daysleft"] = $tage;
         return $task;
     } else {
         return false;
     }
 }
Exemple #10
0
<?php 
require_once 'shab.php';
?>
 <div class="container">  
 <?php 
require_once 'class_user.php';
if (isset($_SESSION['valid_user'])) {
    $user_email = $_SESSION['valid_user'];
    $user_id = $_GET['user_id'];
    echo '<h1>Страница пользователя</h1>';
} else {
    echo '<p>Вы не вошли в систему.</p>';
    echo '<a href="index.php">На главную страницу</a>';
}
$us = new user();
$us->getNames($user_id) . '<br/>';
echo 'Профиль пользователя' . '<br/>';
$us->getProfile($user_id) . '<br/>';
echo 'Друзья' . '<br/>';
$us->getFriends($user_id) . '<br/>';
echo '<a href="index.php">На главную страницу</a>';
?>
</div>