Пример #1
0
 /**
  * Deletes a project including everything else that was assigned to it (e.g. Milestones, tasks, timetracker entries)
  *
  * @param int $id Project ID
  * @return bool
  */
 function del($id)
 {
     global $conn;
     $userid = $_SESSION["userid"];
     $id = (int) $id;
     // Delete assignments of tasks of this project to users
     $task = new task();
     $tasks = $task->getProjectTasks($id);
     if (!empty($tasks)) {
         foreach ($tasks as $tas) {
             $del_taskassign = $conn->query("DELETE FROM tasks_assigned WHERE task = {$tas['ID']}");
         }
     }
     // Delete files and the assignments of these files to the messages they were attached to
     $fil = new datei();
     $files = $fil->getProjectFiles($id, 1000000);
     if (!empty($files)) {
         foreach ($files as $file) {
             $del_files = $fil->loeschen($file[ID]);
         }
     }
     $del_messages = $conn->query("DELETE FROM messages WHERE project = {$id}");
     $del_milestones = $conn->query("DELETE FROM milestones WHERE project = {$id}");
     $del_projectassignments = $conn->query("DELETE FROM projekte_assigned WHERE projekt = {$id}");
     $del_tasklists = $conn->query("DELETE FROM tasklist WHERE project = {$id}");
     $del_tasks = $conn->query("DELETE FROM tasks WHERE project = {$id}");
     $del_timetracker = $conn->query("DELETE FROM timetracker WHERE project = {$id}");
     $del_customer = $conn->query("DELETE FROM customers_assigned WHERE project = {$id}");
     $del_logentries = $conn->query("DELETE FROM log WHERE project = {$id}");
     $del = $conn->query("DELETE FROM projekte WHERE ID = {$id}");
     delete_directory(CL_ROOT . "/files/" . CL_CONFIG . "/{$id}");
     if ($del) {
         $this->mylog->add($userid, 'projekt', 3, $id);
         return true;
     } else {
         return false;
     }
 }
Пример #2
0
<?php

include "./init.php";
// check if user is logged in
if (!isset($_SESSION["userid"])) {
    $template->assign("loginerror", 0);
    $template->display("login.tpl");
    die;
}
$path = "./include/phpseclib";
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
$myfile = new datei();
//read the maximum file size for file uploads from PHP
$POST_MAX_SIZE = ini_get('post_max_size');
$POST_MAX_SIZE = $POST_MAX_SIZE . "B";
$id = getArrayVal($_GET, "id");
$thisfile = getArrayVal($_GET, "file");
$mode = getArrayVal($_GET, "mode");
$action = getArrayVal($_GET, "action");
$name = getArrayVal($_POST, "name");
$desc = getArrayVal($_POST, "desc");
$tags = getArrayVal($_POST, "tags");
$title = getArrayVal($_POST, "title");
$upfolder = getArrayVal($_POST, "upfolder");
$project = array('ID' => $id);
$template->assign("project", $project);
$template->assign("mode", $mode);
$classes = array("overview" => "overview", "msgs" => "msgs", "tasks" => "tasks", "miles" => "miles", "files" => "files_active", "users" => "users", "tracker" => "tracking");
$template->assign("classes", $classes);
if (!chkproject($userid, $id)) {
    $errtxt = $langfile["notyourproject"];
Пример #3
0
    $template->assign("folderid", $thefolder["parent"]);
    $template->assign("langfile", $langfile);
    $template->assign("theAction", "fileview_list");
    SmartyPaginate::assign($template);
    $template->assign("files", $finfiles);
    $template->assign("postmax", $POST_MAX_SIZE);
    $template->display("fileview_list.tpl");
} elseif ($action == "folderview") {
    if (!chkproject($userid, $id)) {
        $errtxt = $langfile["notyourproject"];
        $noperm = $langfile["accessdenied"];
        $template->assign("errortext", "{$errtxt}<br>{$noperm}");
        $template->display("error.tpl");
        die;
    }
    $myfile = new datei();
    $ordner = $myfile->getProjectFolders($id);
    $myproject = new project();
    $template->assign("langfile", $langfile);
    $template->assign("ordner", $ordner);
    $template->display("folderview.tpl");
} elseif ($action == "newcal") {
    $thisd = date("j");
    $thism = date("n");
    $thisy = date("Y");
    $m = getArrayVal($_GET, "m");
    $y = getArrayVal($_GET, "y");
    if (!$m) {
        $m = $thism;
    }
    if (!$y) {
Пример #4
0
    // get project's name
    $myproject = new project();
    $pro = $myproject->getProject($id);
    $members = $myproject->getProjectMembers($id, 10000);
    $projectname = $pro['name'];
    $template->assign("projectname", $projectname);
    // get the page title
    $title = $langfile['messages'];
    $template->assign("title", $title);
    if (!empty($messages)) {
        $mcount = count($messages);
    } else {
        $mcount = 0;
    }
    // get files of the project
    $datei = new datei();
    $thefiles = $datei->getAllProjectFiles($id);
    $milestones = $objmilestone->getAllProjectMilestones($id, 10000);
    $template->assign("milestones", $milestones);
    $template->assign("projectname", $projectname);
    $template->assign("files", $thefiles);
    $template->assign("messages", $messages);
    $template->assign("members", $members);
    $template->assign("messagenum", $mcount);
    $template->display("projectmessages.tpl");
} elseif ($action == "showmessage") {
    // get the message and its replies
    $message = $msg->getMessage($mid);
    $replies = $msg->getReplies($mid);
    $myproject = new project();
    $pro = $myproject->getProject($id);
Пример #5
0
<?php
include("./init.php");
// check if user is logged in
if (!isset($_SESSION["userid"])) {
    $template->assign("loginerror", 0);
    $template->display("login.tpl");
    die();
}
$myfile = new datei();

$POST_MAX_SIZE = ini_get('post_max_size');
$POST_MAX_SIZE = $POST_MAX_SIZE . "B";

$id = getArrayVal($_GET, "id");
$thisfile = getArrayVal($_GET, "file");
$mode = getArrayVal($_GET, "mode");
$action = getArrayVal($_GET, "action");

$name = getArrayVal($_POST, "name");
$desc = getArrayVal($_POST, "desc");
$tags = getArrayVal($_POST, "tags");
$title = getArrayVal($_POST, "title");
$upfolder = getArrayVal($_POST, "upfolder");

$project = array('ID' => $id);
$template->assign("project", $project);

$template->assign("mode", $mode);

$classes = array("overview" => "overview",
    "msgs" => "msgs",
Пример #6
0
 /**
  * Attach a file to a message
  *
  * @param int $fid ID of the file to be attached
  * @param int $mid ID of the message where the file will be attached
  * @param int $id optional param denoting the project ID where the file will be uploaded to (if so)
  * @return bool
  */
 function attachFile($fid, $mid, $id = 0)
 {
     global $conn;
     $fid = (int) $fid;
     $mid = (int) $mid;
     $id = (int) $id;
     $myfile = new datei();
     // If a file ID is given, the given file will be attached
     // If no file ID is given, the file will be uploaded to the project defined by $id and then attached
     if ($fid > 0) {
         $insStmt = $conn->prepare("INSERT INTO files_attached (file,message) VALUES (?,?)");
         $insStmt->execute(array($fid, $mid));
     } else {
         $num = $_POST["numfiles"];
         $chk = 0;
         $insStmt = $conn->prepare("INSERT INTO files_attached (file,message) VALUES (?,?)");
         for ($i = 1; $i <= $num; $i++) {
             $fid = $myfile->upload("userfile{$i}", "files/" . CL_CONFIG . "/{$id}", $id);
             $ins = $insStmt->execute(array($fid, $mid));
         }
     }
     if ($ins) {
         return true;
     } else {
         return false;
     }
 }
Пример #7
0
$template->assign("mainclasses", $mainclasses);

//check if the user is admin
if (!$userpermissions["admin"]["add"])
{
    $errtxt = $langfile["nopermission"];
    $noperm = $langfile["accessdenied"];
    $template->assign("errortext", "$errtxt<br>$noperm");
    $template->display("error.tpl");
}

//basecamp import
if ($action == "basecamp")
{
    // create new file object
    $myfile = new datei();
    // create new importer object
    $importer = new importer();
    // upload the file
    $up = $myfile->upload("importfile", "files/" . CL_CONFIG . "/ics", 0);
    if ($up)
    {
        $importer->importBasecampXmlFile(CL_ROOT . "/files/" . CL_CONFIG .  "/ics/$up");
	}
    //delete the imported file
    unlink(CL_ROOT . "/files/" . CL_CONFIG . "/ics/$up");
	$loc = $url . "admin.php?action=system&mode=imported&msg=$importer->msgCount&peop=$importer->peopleCount&pro=$importer->projectCount&tsk=$importer->taskCount";
	header("Location: $loc");
}

?>
Пример #8
0
 function attachFile($fid, $mid, $id = 0)
 {
     $fid = (int) $fid;
     $mid = (int) $mid;
     $id = (int) $id;
     $myfile = new datei();
     if ($fid > 0) {
         $ins = mysql_query("INSERT INTO files_attached (ID,file,message) VALUES ('',{$fid},{$mid})");
     } else {
         $num = $_POST["numfiles"];
         $chk = 0;
         for ($i = 1; $i <= $num; $i++) {
             $fid = $myfile->upload("userfile{$i}", "files/" . CL_CONFIG . "/{$id}", $id);
             $ins = mysql_query("INSERT INTO files_attached (ID,file,message) VALUES ('',{$fid},{$mid})");
         }
     }
     if ($ins) {
         return true;
     } else {
         return false;
     }
 }
Пример #9
0
        $pass[] = $alphabet[$n];
    }
    return implode($pass);
    //turn the array into a string
}
$filePass = randomPassword();
$path = "./include/phpseclib";
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
$conn->query("CREATE TABLE IF NOT EXISTS `customers_assigned` (\n  `ID` int(10) NOT NULL AUTO_INCREMENT,\n  `customer` int(10) NOT NULL,\n  `project` int(10) NOT NULL,\n  PRIMARY KEY (`ID`),\n  UNIQUE KEY `ID` (`ID`)\n)");
$oldTemplate = $settings["template"];
$template->assign("theme", $oldTemplate);
$conn->query("INSERT INTO `settings` (`ID` ,`settingsKey` ,`settingsValue`) VALUES (NULL , 'theme', '{$oldTemplate}')");
$conn->query("UPDATE `settings` SET `template`='standard'");
$conn->query("INSERT INTO `settings` (`ID`, `settingsKey`, `settingsValue`) VALUES (NULL, 'filePass', '{$filePass}')");
$filesList = $conn->query("SELECT * FROM `files`")->fetchAll();
$fileObj = new datei();
foreach ($filesList as $file) {
    $tmpFile = CL_ROOT . "/" . $file["datei"];
    $fileObj->encryptFile($tmpFile, $filePass);
}
//drop tags field from files
$conn->query("ALTER TABLE `files` DROP `tags`");
// VERSION-INDEPENDENT
// Clear templates cache
$handle = opendir($template->compile_dir);
while (false !== ($file = readdir($handle))) {
    if ($file != "." and $file != "..") {
        unlink(CL_ROOT . "/" . $template->compile_dir . "/" . $file);
    }
}
// Optimize tables