Ejemplo n.º 1
0
 public function setStartCode()
 {
     $query = 'SELECT TOP 1 MemberCardNo FROM POS_Member WHERE MemberCardNo LIKE \'T%\' ORDER BY Code DESC';
     $res = Processor::execErp($query);
     $member = odbc_fetch_array($res);
     $this->code = getArrayVal($member, 'MemberCardNo');
     return $this;
 }
Ejemplo n.º 2
0
 public static function genQueryNestReplace(array $targetArr, array $replaceArr, $columnName)
 {
     $string = '';
     foreach ($targetArr as $key => $target) {
         $target = '\'' === $target ? $target . '\'' : $target;
         $columnName = 0 === $key ? $columnName : $string;
         $string = 'REPLACE(' . $columnName . ', \'' . $target . '\', \'' . getArrayVal($replaceArr, $key) . '\')';
     }
     return $string;
 }
Ejemplo n.º 3
0
 protected function appendRow(array $data, array $css)
 {
     $this->targetSheet->row($this->getIndex(), $data);
     $this->targetSheet->cells($this->getCellsRange(), function ($cells) use($css) {
         $cells->setBackground(getArrayVal($css, 'backgrounColor'))->setFontColor(getArrayVal($css, 'fontColor'));
     });
     return $this;
 }
Ejemplo n.º 4
0
/**
* Detect if Collabtive runs on HTTP or HTTPS
*/
function detectSSL()
{
    if (getArrayVal($_SERVER, "https") == "on") {
        return true;
    } elseif (getArrayVal($_SERVER, "https") == 1) {
        return true;
    } elseif (getArrayVal($_SERVER, "HTTPS") == 'on') {
        return true;
    } elseif (getArrayVal($_SERVER, "HTTPS") == 1) {
        return true;
    } elseif (getArrayVal($_SERVER, "SERVER_PORT") == 443) {
        return true;
    } else {
        return false;
    }
}
Ejemplo n.º 5
0
    if (!$userpermissions["admin"]["add"]) {
        $errtxt = $langfile["nopermission"];
        $noperm = $langfile["accessdenied"];
        $template->assign("errortext", "{$errtxt}<br>{$noperm}");
        $template->assign("mode", "error");
        $template->display("error.tpl");
        die;
    }
    if ($user->del($id)) {
        $loc = $url . "admin.php?action=users&mode=deleted";
        header("Location: {$loc}");
    }
} elseif ($action == "profile") {
    $thetag = new tags();
    $start = getArrayVal($_GET, "start");
    $end = getArrayVal($_GET, "end");
    $proj = (object) new project();
    if ($userpermissions["admin"]["add"]) {
        $projects = $proj->getMyProjects($id);
        $i = 0;
        if (!empty($projects)) {
            foreach ($projects as $opro) {
                $membs = $proj->getProjectMembers($opro["ID"], 1000);
                $projects[$i]['members'] = $membs;
                $i = $i + 1;
            }
            $template->assign("opros", $projects);
        }
    }
    $tracker = (object) new timetracker();
    $track = array();
Ejemplo n.º 6
0
    // Get milestone info
    $milestone = $milestone->getMilestone($mid);
    $template->assign("projectname", $projectname);
    $template->assign("milestone", $milestone);
    $template->display("editmilestone.tpl");
} elseif ($action == "edit") {
    if (!$userpermissions["milestones"]["edit"]) {
        $errtxt = $langfile["nopermission"];
        $noperm = $langfile["accessdenied"];
        $template->assign("errortext", "<h2>{$errtxt}</h2><br>{$noperm}");
        $template->display("error.tpl");
        die;
    }
    // Get milestone ID and start date from form
    $mid = $_POST['mid'];
    $start = getArrayVal($_POST, "start");
    // Edit the milestone
    if ($milestone->edit($mid, $name, $desc, $start, $end)) {
        $loc = $url . "managemilestone.php?action=showproject&id={$id}&mode=edited";
        header("Location: {$loc}");
    } else {
        $template->assign("editmilestone", 0);
    }
} elseif ($action == "del") {
    if (!$userpermissions["milestones"]["del"]) {
        $errtxt = $langfile["nopermission"];
        $noperm = $langfile["accessdenied"];
        $template->assign("errortext", "<h2>{$errtxt}</h2><br>{$noperm}");
        $template->display("error.tpl");
        die;
    }
Ejemplo n.º 7
0
 function __construct()
 {
     $this->userid = getArrayVal($_SESSION, "userid");
     $this->uname = getArrayVal($_SESSION, "username");
 }
Ejemplo n.º 8
0
        $loc = $url . "admin.php?action=users&mode=roleadded";
        header("Location: $loc");
    }
}
// delete a role
elseif ($action == "delrole")
{
    if ($roleobj->del($id))
    {
        echo "ok";
    }
}
// edit a role
elseif ($action == "editrole")
{
    $rolename = getArrayVal($_POST, "rolename");
    $projectperms = $roleobj->sanitizeArray($projectperms);
    $mileperms = $roleobj->sanitizeArray($mileperms);
    $taskperms = $roleobj->sanitizeArray($taskperms);
    $messageperms = $roleobj->sanitizeArray($messageperms);
    $fileperms = $roleobj->sanitizeArray($fileperms);
    $trackerperms = $roleobj->sanitizeArray($trackerperms);
    $chatperms = $roleobj->sanitizeArray($chatperms);
    $adminperms = $roleobj->sanitizeArray($adminperms);

    if ($roleobj->edit($id, $rolename, $projectperms, $taskperms, $mileperms, $messageperms, $fileperms, $trackerperms, $chatperms, $adminperms))
    {
        $loc = $url . "admin.php?action=users&mode=roleedited";
        header("Location: $loc");
    }
}
Ejemplo n.º 9
0
 /**
  * Log a user in
  *
  * @param string $user User name
  * @param string $pass Password
  * @return bool
  */
 function openIdLogin($url)
 {
     /* here the openid auth should take place */
     try {
         $openid = new LightOpenID($_SERVER['HTTP_HOST']);
         if (!$openid->mode) {
             $openid->identity = $url;
             header('Location: ' . $openid->authUrl());
         } elseif ($openid->mode == 'cancel') {
             return false;
         } else {
             $identity = $openid->data['openid_identity'];
             $sel1 = $conn->query("SELECT ID from openids WHERE identity='{$identity}'");
             if ($row = $sel1->fetch()) {
                 $id = $row['ID'];
             } else {
                 return false;
             }
             // die("SELECT ID,name,locale,lastlogin,gender FROM user WHERE ID=$id");
             $sel1 = $conn->query("SELECT ID,name,locale,lastlogin,gender FROM user WHERE ID={$id}");
             $chk = $sel1->fetch();
             if ($chk["ID"] != "") {
                 $rolesobj = new roles();
                 $now = time();
                 $_SESSION['userid'] = $chk['ID'];
                 $_SESSION['username'] = stripslashes($chk['name']);
                 $_SESSION['lastlogin'] = $now;
                 $_SESSION['userlocale'] = $chk['locale'];
                 $_SESSION['usergender'] = $chk['gender'];
                 $_SESSION["userpermissions"] = $rolesobj->getUserRole($chk["ID"]);
                 $userid = $_SESSION['userid'];
                 $seid = session_id();
                 $staylogged = getArrayVal($_POST, 'staylogged');
                 if ($staylogged == 1) {
                     setcookie("PHPSESSID", "{$seid}", time() + 14 * 24 * 3600);
                 }
                 $upd1 = $conn->prepare("UPDATE user SET lastlogin = ? WHERE ID = ?");
                 $upd1Stmt = $upd1->execute(array($now, $userid));
                 return true;
             } else {
                 return false;
             }
         }
     } catch (ErrorException $e) {
         return false;
     }
 }
Ejemplo n.º 10
0
function cleanArray(array $theArray)
{
    $outArray = array();
    foreach ($theArray as $anArrayKey => $anArrayVal) {
        $outArray[$anArrayKey] = getArrayVal($theArray, $anArrayKey);
    }
    return $outArray;
}
Ejemplo n.º 11
0
    $template->assign("templates", $templates);
    $template->display("editsettings.tpl");
} elseif ($action == "editsets") {
    $theme = getArrayVal($_POST, "theme");
    if ($theset->editSettings($name, $subtitle, $locale, $timezone, $dateformat, $templ, $theme, $rssuser, $rsspass)) {
        $handle = opendir($template->compile_dir);
        while (false !== ($file = readdir($handle))) {
            if ($file != "." and $file != "..") {
                unlink(CL_ROOT . "/" . $template->compile_dir . "/" . $file);
            }
        }
        $_SESSION["userlocale"] = $locale;
        $users = $user->getAllUsers(100000);
        foreach ($users as $theuser) {
            // set the new locale for all the users
            $user->edit($theuser["ID"], $theuser["name"], $theuser["realname"], $theuser["email"], $theuser["tel1"], $theuser["tel2"], $theuser["company"], $theuser["zip"], $theuser["gender"], $theuser["url"], $theuser["adress"], $theuser["adress2"], $theuser["state"], $theuser["country"], $theuser["tags"], $locale, "", $theuser["rate"]);
        }
        header("Location: admin.php?action=system&mode=edited");
    }
} elseif ($action == "editmailsets") {
    $status = getArrayVal($_POST, "mailstatus");
    $mailfrom = getArrayVal($_POST, "mailfrommail");
    $mailfromname = getArrayVal($_POST, "mailfromname");
    $method = getArrayVal($_POST, "mailmethod");
    $server = getArrayVal($_POST, "server");
    $mailuser = getArrayVal($_POST, "mailuser");
    $mailpass = getArrayVal($_POST, "mailpass");
    if ($theset->editMailsettings($status, $mailfrom, $mailfromname, $method, $server, $mailuser, $mailpass)) {
        header("Location: admin.php?action=system&mode=edited");
    }
}
Ejemplo n.º 12
0
            $content = '(.+</' . $tag . '(>|\\s[^>]*>)|)';
        }
        $str = preg_replace('#</?' . $tag . '(>|\\s[^>]*>)' . $content . '#is', '', $str);
    }
    return $str;
}
function getArrayVal(array $array, $name)
{
    if (array_key_exists($name, $array)) {
        return strip_only_tags($array[$name], "script");
    }
}
error_reporting(0);
$pic = getArrayVal($_GET, "pic");
$height = getArrayVal($_GET, "height");
$width = getArrayVal($_GET, "width");
include CL_ROOT . "/include/class.hft_image.php";
$imagehw = GetImageSize($pic);
$imagewidth = $imagehw[0];
$imageheight = $imagehw[1];
$myThumb = new hft_image(CL_ROOT . "/" . $pic);
$myThumb->jpeg_quality = 80;
if (!isset($height)) {
    $ratio = $imageheight / $imagewidth;
    $height = $width * $ratio;
    $height = round($height);
}
if (!isset($width)) {
    $ratio = $imagewidth / $imageheight;
    $width = $height * $ratio;
}
Ejemplo n.º 13
0
<?php
require("init.php");

$action = getArrayVal($_GET, "action");

$mainclasses = array("desktop" => "desktop",
    "profil" => "profil",
    "admin" => "admin_active"
    );
$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)
    {
Ejemplo n.º 14
0
 /**
  * Log a user in
  *
  * @param string $user User name
  * @param string $pass Password
  * @return bool
  */
 function login($user, $pass)
 {
     global $conn;
     if (!$user) {
         return false;
     }
     $user = $conn->quote($user);
     $pass = sha1($pass);
     $sel1 = $conn->query("SELECT ID,name,locale,lastlogin,gender FROM user WHERE (name = {$user} OR email = {$user}) AND pass = '******'");
     $chk = $sel1->fetch();
     if ($chk["ID"] != "") {
         $rolesobj = new roles();
         $now = time();
         $_SESSION['userid'] = $chk['ID'];
         $_SESSION['username'] = stripslashes($chk['name']);
         $_SESSION['lastlogin'] = $now;
         $_SESSION['userlocale'] = $chk['locale'];
         $_SESSION['usergender'] = $chk['gender'];
         $_SESSION["userpermissions"] = $rolesobj->getUserRole($chk["ID"]);
         $userid = $_SESSION['userid'];
         $seid = session_id();
         $staylogged = getArrayVal($_POST, 'staylogged');
         if ($staylogged == 1) {
             setcookie("PHPSESSID", "{$seid}", time() + 14 * 24 * 3600);
         }
         $upd1 = $conn->query("UPDATE user SET lastlogin = '******' WHERE ID = {$userid}");
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 15
0
    $template->assign("loginerror", 0);
    $template->display("login.tpl");
    die();
}
$liste = (object) new tasklist();
$objmilestone = (object) new milestone();

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

$name = getArrayVal($_POST, "name");
$desc = getArrayVal($_POST, "desc");
$access = getArrayVal($_POST, "email");
$milestone = getArrayVal($_POST, "milestone");

$project = array();
$project['ID'] = $id;
$classes = array("overview" => "overview",
    "msgs" => "msgs",
    "tasks" => "tasks_active",
    "miles" => "miles",
    "files" => "files",
    "users" => "users",
    "tracker" => "tracking"
    );
$template->assign("classes", $classes);
if (!chkproject($userid, $id))
{
    $errtxt = $langfile["notyourproject"];
Ejemplo n.º 16
0
     $noperm = $langfile["accessdenied"];
     $template->assign("errortext", "<h2>{$errtxt}</h2><br>{$noperm}");
     $template->display("error.tpl");
     die;
 }
 $themsg = $msg->add($id, $title, $message, $userid, $username, $mid_post, $milestone);
 if ($themsg) {
     if ($thefiles > 0) {
         // attach existing file
         $msg->attachFile($thefiles, $themsg);
     } elseif ($thefiles == 0 and $numfiles > 0) {
         // if upload files are set, upload and attach
         $msg->attachFile(0, $themsg, $id);
     }
     if ($settings["mailnotify"]) {
         $sendto = getArrayVal($_POST, "sendto");
         $usr = (object) new project();
         $users = $usr->getProjectMembers($id, 10000);
         if ($sendto[0] == "all") {
             $sendto = $users;
             $sendto = reduceArray($sendto);
         } elseif ($sendto[0] == "none") {
             $sendto = array();
         }
         foreach ($users as $user) {
             if (!empty($user["email"])) {
                 $userlang = readLangfile($user['locale']);
                 $subject = $userlang["messagewasaddedsubject"] . ' ("' . $title . '" - ' . $userlang['by'] . ' ' . $username . ')';
                 // added message title and author  to subject
                 $mailcontent = $userlang["hello"] . ",<br /><br/>" . $userlang["messagewasaddedtext"] . "<br /><br />" . "<h3><a href = \"" . $url . "managemessage.php?action=showmessage&id={$id}&mid={$themsg}\">{$title}</a></h3>" . $message;
                 if (is_array($sendto)) {
Ejemplo n.º 17
0
if (!file_exists("./templates_c") or !is_writable("./templates_c")) {
    die("Required folder templates_c does not exist or is not writable. <br>Please create the folder or make it writable in order to proceed.");
}
// check if the settings table / object is present. if yes, assume collabtive is already installed and abort
if (!empty($settings)) {
    die("Collabtive seems to be already installed.<br />If this is an error, please clear your database.");
}
session_start();
session_destroy();
session_unset();
setcookie("PHPSESSID", "");
date_default_timezone_set("Europe/Berlin");
require "./init.php";
error_reporting(0);
$action = getArrayVal($_GET, "action");
$locale = getArrayVal($_GET, "locale");
if (!empty($locale)) {
    $_SESSION['userlocale'] = $locale;
} else {
    $locale = $_SESSION['userlocale'];
}
if (empty($locale)) {
    $locale = "en";
}
$template->assign("locale", $locale);
$template->config_dir = "./language/{$locale}/";
$title = $langfile['installcollabtive'];
$template->assign("title", $title);
$template->template_dir = "./templates/standard/";
$installSettings["template"] = "standard";
$installSettings["theme"] = "standard";
Ejemplo n.º 18
0
                } else {
                    if (strlen($res["title"]) > $strlim) {
                        $res["title"] = substr($res["title"], 0, $strlim);
                    }
                    // style = \"list-style-image: url(templates/standard/img/symbols/$res[icon]);\"
                    echo "<li><img src = \"templates/{$settings['template']}/theme/{$settings['theme']}/images/symbols/{$res['icon']}\" >{$res['title']}</li>";
                }
            }
        }
    } else {
        echo "<li></li>";
    }
    echo "</ul>";
    // echo "<ul><li>$query</li></ul>";
} elseif ($action == "ajaxsearch-p") {
    $query = getArrayVal($_POST, "query");
    $result = $such->dosearch($query, $project);
    if (!empty($result)) {
        echo "<ul>";
        foreach ($result as $res) {
            if (!empty($res)) {
                if ($res["type"] == "file") {
                    if (strlen($res["name"]) > $strlim) {
                        $res["name"] = substr($res["name"], 0, $strlim);
                    }
                    echo "<li><img src = \"templates/{$settings['template']}/images/files/{$res['ftype']}.png\">{$res['name']}</li>";
                } elseif ($res["type"] != "task" and $res["type"] != "message") {
                    if (strlen($res["name"]) > $strlim) {
                        $res["name"] = substr($res["name"], 0, $strlim);
                    }
                    // style = \"list-style-image: url(templates/standard/img/symbols/$res[icon]);\"
Ejemplo n.º 19
0
<?php

require "init.php";
include "./include/class.rss.php";
$rss = new UniversalFeedCreator();
$rss->useCached();
$action = getArrayVal($_GET, "action");
$user = getArrayVal($_GET, "user");
$project = getArrayVal($_GET, "project");
$username = $_SESSION["username"];
error_reporting(0);
if (!empty($settings["rssuser"]) and !empty($settings["rsspass"])) {
    if (!isset($_SERVER['PHP_AUTH_USER'])) {
        header('WWW-Authenticate: Basic realm="Collabtive"');
        header('HTTP/1.0 401 Unauthorized');
        $errtxt = $langfile["nopermission"];
        $noperm = $langfile["accessdenied"];
        $template->assign("errortext", "{$errtxt}<br>{$noperm}");
        $template->display("error.tpl");
        die;
    }
    $authuser = $_SERVER['PHP_AUTH_USER'];
    $authpw = $_SERVER['PHP_AUTH_PW'];
    if ($authuser != $settings["rssuser"] or $authpw != $settings["rsspass"]) {
        unset($_SERVER['PHP_AUTH_USER']);
        unset($_SERVER['PHP_AUTH_PW']);
        $errtxt = $langfile["nopermission"];
        $noperm = $langfile["accessdenied"];
        $template->assign("errortext", "{$errtxt}<br>{$noperm}");
        $template->display("error.tpl");
        die;
Ejemplo n.º 20
0
     $noperm = $langfile["accessdenied"];
     $template->assign("errortext", "{$errtxt}<br>{$noperm}");
     $template->display("error.tpl");
     die;
 }
 if (!chkproject($userid, $id)) {
     $errtxt = $langfile["notyourproject"];
     $noperm = $langfile["accessdenied"];
     $template->assign("errortext", "{$errtxt}<br>{$noperm}");
     $template->display("error.tpl");
     die;
 }
 $start = getArrayVal($_POST, "start");
 $end = getArrayVal($_POST, "end");
 $usr = getArrayVal($_POST, "usr");
 $taski = getArrayVal($_POST, "task");
 //get open project tasks for filtering
 $task = new task();
 $ptasks = $task->getProjectTasks($id, 1);
 $tracker = (object) new timetracker();
 //If the user can not read tt entries from other user, set the user filter to the current user id.
 if (!$usr) {
     if (!$userpermissions["timetracker"]["read"]) {
         $usr = $userid;
     } else {
         $usr = 0;
     }
 }
 if (!empty($start) and !empty($end)) {
     $track = $tracker->getProjectTrack($id, $usr, $taski, $start, $end, 50);
 } else {
Ejemplo n.º 21
0
    die();
}
if ($action == "addform")
{
    if (!$userpermissions["milestones"]["add"])
    {
        $errtxt = $langfile["nopermission"];
        $noperm = $langfile["accessdenied"];
        $template->assign("errortext", "<h2>$errtxt</h2><br>$noperm");
        $template->display("error.tpl");
        die();
    }

    $day = getArrayVal($_GET, "theday");
    $month = getArrayVal($_GET, "themonth");
    $year = getArrayVal($_GET, "theyear");

    $pro = new project();
    $tpro = $pro->getProject($id);

    $title = $langfile['addmilestone'];
    $projectname = $tpro["name"];

    $template->assign("year", $year);
    $template->assign("month", $month);
    $template->assign("day", $day);
    $template->assign("projectname", $projectname);
    $template->assign("title", $title);
    $template->assign("showhtml", "yes");
    $template->display("addmilestone.tpl");
} elseif ($action == "add")
Ejemplo n.º 22
0
}
$customer = (object) new company();
$action = getArrayVal($_GET, "action");
$id = getArrayVal($_GET, "id");
if ($action == "editform") {
    $customer = $customer->getCompany($id);
    $template->assign("customer", $customer);
    $template->display("editcustomer.tpl");
} elseif ($action == "edit") {
    $customerData = array();
    $customerData["id"] = $id;
    $customerData["company"] = getArrayVal($_POST, "company");
    $customerData["contact"] = getArrayVal($_POST, "contact");
    $customerData["email"] = getArrayVal($_POST, "email");
    $customerData["phone"] = getArrayVal($_POST, "tel1");
    $customerData["mobile"] = getArrayVal($_POST, "tel2");
    $customerData["url"] = getArrayVal($_POST, "web");
    $customerData["address"] = getArrayVal($_POST, "address");
    $customerData["zip"] = getArrayVal($_POST, "zip");
    $customerData["city"] = getArrayVal($_POST, "city");
    $customerData["country"] = getArrayVal($_POST, "country");
    $customerData["state"] = getArrayVal($_POST, "state");
    $customerData["desc"] = getArrayVal($_POST, "desc");
    if ($customer->edit($customerData)) {
        header("Location: admin.php?action=customers&mode=edited");
    }
} elseif ($action == "del") {
    if ($customer->del($id)) {
        echo "ok";
    }
}
Ejemplo n.º 23
0
    $template->assign("customers", $companies);
}
// by default the arrays have a level for each project, whcih contains arrays for each message/task . reduce array flattens this to have all messages/tasks of all projects in one structure
if (!empty($messages)) {
    $messages = reduceArray($messages);
}
$etasks = reduceArray($tasks);
// Create sort array for multisort by adding the daysleft value to a sort array
$sort = array();
foreach ($etasks as $etask) {
    array_push($sort, $etask["daysleft"]);
}
// Sort using array_multisort
array_multisort($sort, SORT_NUMERIC, SORT_ASC, $etasks);
// On Admin Login check for updates
$mode = getArrayVal($_GET, "mode");
if ($mode == "login") {
    $chkLim = 0;
    // only check if an admin logs in
    if ($userpermissions["admin"]["add"]) {
        // only check 1/2 of the times an admin logs in, to reduce server load
        $chkLim = mt_rand(1, 2);
        if ($chkLim == 1) {
            $updateChk = getUpdateNotify();
            if (!empty($updateChk)) {
                if ($updateChk->pubDate > CL_PUBDATE) {
                    $template->assign("isUpdated", true);
                    $template->assign("updateNotify", $updateChk);
                }
            }
        }
Ejemplo n.º 24
0
 /**
  * Log a user in
  *
  * @param string $user User name
  * @param string $pass Password
  * @return bool
  */
 function login($user, $pass)
 {
     if (!$user) {
         return false;
     }
     //fixed by for CS 577 Lab 6 using `prepare` statement
     //note conn is defined in class.datenbank.php assuming we have access to that we can do this:
     $stmnt = $conn->prepare("SELECT ID,name,locale,lastlogin,gender FROMuser WHERE (name=? OR email=?) AND pass=?");
     $stmnt->bind_param("sss", $user, $user, sha1($pass));
     $stmnt->execute();
     $stmnt->bind_result($bind_ID, $bind_name, $bind_locale, $bind_lastlogin, $bind_gender);
     $chk = $stmnt->fetch();
     if ($bind_ID != "") {
         $rolesobj = new roles();
         $now = time();
         $_SESSION['userid'] = $bind_ID;
         $_SESSION['username'] = stripslashes($bind_name);
         $_SESSION['lastlogin'] = $now;
         $_SESSION['userlocale'] = $bind_locale;
         $_SESSION['usergender'] = $bind_gender;
         $_SESSION["userpermissions"] = $rolesobj->getUserRole($bind_ID);
         $userid = $_SESSION['userid'];
         $seid = session_id();
         $staylogged = getArrayVal($_POST, 'staylogged');
         if ($staylogged == 1) {
             setcookie("PHPSESSID", "{$seid}", time() + 14 * 24 * 3600);
         }
         $upd1 = mysql_query("UPDATE user SET lastlogin = '******' WHERE ID = {$userid}");
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 25
0
    SmartyPaginate::assign($template);
    $template->display("project.tpl");
} elseif ($action == "cal") {
    if (!chkproject($userid, $id)) {
        $errtxt = $langfile["notyourproject"];
        $noperm = $langfile["accessdenied"];
        $template->assign("errortext", "{$errtxt}<br>{$noperm}");
        $template->assign("mode", "error");
        $template->display("error.tpl");
        die;
    }
    $thisd = date("j");
    $thism = date("n");
    $thisy = date("Y");
    $m = getArrayVal($_GET, "m");
    $y = getArrayVal($_GET, "y");
    if (!$m) {
        $m = $thism;
    }
    if (!$y) {
        $y = $thisy;
    }
    $nm = $m + 1;
    $pm = $m - 1;
    if ($nm > 12) {
        $nm = 1;
        $ny = $y + 1;
    } else {
        $ny = $y;
    }
    if ($pm < 1) {
Ejemplo n.º 26
0
    $template->display("projectfiles.tpl");
} elseif ($action == "addfolder") {
    $name = getArrayVal($_POST, "foldertitle");
    $desc = getArrayVal($_POST, "folderdesc");
    $parent = getArrayVal($_POST, "folderparent");
    $visible = getArrayVal($_POST, "visible");
    if (empty($visible[0])) {
        $visible = "";
    }
    if ($myfile->addFolder($parent, $id, $name, $desc, $visible)) {
        $loc = $url .= "managefile.php?action=showproject&id=$id&mode=folderadded";
        header("Location: $loc");
    }
} elseif ($action == "delfolder") {
    $ajaxreq = $_GET["ajax"];
    $folder = getArrayVal($_GET, "folder");
    if ($myfile->deleteFolder($folder, $id)) {
        if ($ajaxreq = 1) {
            echo "ok";
        } else {
            $loc = $url .= "managefile.php?action=showproject&id=$id&mode=folderdel";
            header("Location: $loc");
        }
    }
} elseif ($action == "movefile") {
    $file = $_GET["file"];
    $file = substr($file, 4, strlen($file)-4);

    $target = $_GET["target"];
    $myfile->moveFile($file, $target);
}
Ejemplo n.º 27
0
        die;
    }
    $file = $_GET["file"];
    $file = substr($file, 4, strlen($file) - 4);
    $target = $_GET["target"];
    $myfile->moveFile($file, $target);
} elseif ($action == "downloadfile") {
    if (!$userpermissions["files"]["view"]) {
        $errtxt = $langfile["nopermission"];
        $noperm = $langfile["accessdenied"];
        $template->assign("errortext", "{$errtxt}<br>{$noperm}");
        $template->display("error.tpl");
        die;
    }
    //get the file ID.
    $fileId = getArrayVal($_GET, "file");
    $thefile = $myfile->getFile($fileId);
    //getFile path and filesize
    $filePath = $thefile["datei"];
    //Send HTTP headers for dowonload
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename="' . basename($filePath) . '"');
    header('Content-Transfer-Encoding: binary');
    header('Connection: Keep-Alive');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    //Try to decrypt the file
    $plaintext = $myfile->decryptFile($filePath, $settings["filePass"]);
    //no plaintext means file was not encrypted or not decrypted. however deliver to unmodified file
Ejemplo n.º 28
0
        $py = $y - 1;
    } else {
        $py = $y;
    }
    $today = date("d");
    $calobj = new calendar();
    $cal = $calobj->getCal($m, $y);
    $weeks = $cal->calendar;
    // print_r($weeks);
    $mstring = strtolower(date('F', mktime(0, 0, 0, $m, 1, $y)));
    $mstring = $langfile[$mstring];
    $template->assign("mstring", $mstring);
    $template->assign("m", $m);
    $template->assign("y", $y);
    $template->assign("thism", $thism);
    $template->assign("thisd", $thisd);
    $template->assign("thisy", $thisy);
    $template->assign("nm", $nm);
    $template->assign("pm", $pm);
    $template->assign("ny", $ny);
    $template->assign("py", $py);
    $template->assign("weeks", $weeks);
    $template->display("calbody.tpl");
} elseif ($action == "chkconn") {
    $dbHost = getArrayVal($_GET, "dbhost");
    $dbUser = getArrayVal($_GET, "dbuser");
    $dbName = getArrayVal($_GET, "dbname");
    $dbPass = getArrayVal($_GET, "dbpass");
    $chk = new PDO("mysql:host={$dbHost};dbname={$dbName};charset=utf8", $dbUser, $dbPass);
    echo $chk;
}
Ejemplo n.º 29
0
<?php
include("init.php");
if (!isset($_SESSION["userid"]))
{
    $template->assign("loginerror", 0);
    $template->display("login.tpl");
    die();
}

$action = getArrayVal($_GET, "action");
$userto = getArrayVal($_GET, "userto");
$userto_id = getArrayVal($_GET, "uid");
$userto_id = (int) $userto_id;
if (!$action)
{

    $now = time();
    $now = $now - 35;
    $cook = "chatstart" . $userto_id;
    $cook2 = "chatwin" . $userto_id;

    setcookie("$cook", "$now");
    setcookie("$cook2", "1");

    $template->assign("userto", $userto);
    $template->assign("userto_id", $userto_id);

    $user = new user();
    $avatar = $user->getAvatar($userto_id);

    $template->assign("avatar", $avatar);
Ejemplo n.º 30
0
 public function updatePosStatistics(array $display, $groupCode)
 {
     if (!array_key_exists($groupCode, $this->posStatistics)) {
         $this->posStatistics[$groupCode]['部門'] = $display['部門'];
         $this->posStatistics[$groupCode] = array_merge($this->posStatistics[$groupCode], $this->initTotalGroup());
     }
     $this->posStatistics[$groupCode]['會員數'] += (int) getArrayVal($display, '會員數', 0);
     $this->posStatistics[$groupCode]['訂單數'] += (int) getArrayVal($display, '訂單數', 0);
     $this->posStatistics[$groupCode]['淨額'] += (int) getArrayVal($display, '淨額', 0);
     $this->posStatistics[$groupCode]['會員均單'] = (int) $this->posStatistics[$groupCode]['淨額'] / $this->posStatistics[$groupCode]['會員數'];
     $this->posStatistics[$groupCode]['訂單均價'] = (int) $this->posStatistics[$groupCode]['淨額'] / $this->posStatistics[$groupCode]['訂單數'];
     $this->posStatistics[$groupCode]['撥打會員數'] += (int) getArrayVal($display, '撥打會員數', 0);
     $this->posStatistics[$groupCode]['撥打通數'] += (int) getArrayVal($display, '撥打通數', 0);
     $this->posStatistics[$groupCode]['撥打秒數'] += (int) getArrayVal($display, '撥打秒數', 0);
     $this->posStatistics[$groupCode]['工作日'] += (int) getArrayVal($display, '工作日', 0);
     return $this;
 }