本文整理汇总了PHP中Tools::getSecurePOSTStringValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::getSecurePOSTStringValue方法的具体用法?PHP Tools::getSecurePOSTStringValue怎么用?PHP Tools::getSecurePOSTStringValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools
的用法示例。
在下文中一共展示了Tools::getSecurePOSTStringValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
protected function display()
{
// Admins only
if (Tools::isConnectedUser()) {
$session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
if ($session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
$this->smartyHelper->assign('defaultColor', Holidays::$defaultColor);
if (isset($_POST['hol_color'])) {
$formatedDate = Tools::getSecurePOSTStringValue('date');
$timestamp = Tools::date2timestamp($formatedDate);
$hol_desc = Tools::getSecurePOSTStringValue('hol_desc');
$hol_color = Tools::getSecurePOSTStringValue('hol_color');
if (!Holidays::save($timestamp, $hol_desc, $hol_color)) {
$this->smartyHelper->assign('error', T_("Couldn't add the holiday"));
}
} elseif (isset($_POST['hol_id'])) {
$hol_id = Tools::getSecurePOSTIntValue('hol_id');
if (!Holidays::delete($hol_id)) {
$this->smartyHelper->assign('error', T_("Couldn't remove the holiday"));
}
}
$this->smartyHelper->assign('holidays', Holidays::getHolidays());
}
}
}
示例2: display
protected function display()
{
if (Tools::isConnectedUser()) {
// Admins only
$session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
if ($session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
$projectList = $this->getProjectList(false);
if (isset($_POST['projectid']) && array_key_exists($_POST['projectid'], $projectList)) {
$projectid = Tools::getSecurePOSTIntValue('projectid');
$_SESSION['projectid'] = $projectid;
} elseif (isset($_SESSION['projectid']) && array_key_exists($_SESSION['projectid'], $projectList)) {
$projectid = $_SESSION['projectid'];
} else {
$projectIds = array_keys($projectList);
if (count($projectIds) > 0) {
$projectid = $projectIds[0];
} else {
$projectid = 0;
}
}
$this->smartyHelper->assign('projects', SmartyTools::getSmartyArray($projectList, $projectid));
// display current workflow
if (0 != $projectid) {
$clone_projectid = Tools::getSecurePOSTIntValue('clone_projectid', 0);
if ($clone_projectid == $projectid || !array_key_exists($clone_projectid, $projectList)) {
$clone_projectid = 0;
}
$action = Tools::getSecurePOSTStringValue('action', '');
if ("cloneToProject" == $action) {
#echo "Clone $projectid ---> $clone_projectid<br>";
$errMsg = Project::cloneAllProjectConfig($projectid, $clone_projectid);
$this->smartyHelper->assign('msg', 'Clone to project : ' . $errMsg);
} elseif ("cloneFromProject" == $action) {
#echo "Clone $clone_projectid ---> $projectid<br>";
$errMsg = Project::cloneAllProjectConfig($clone_projectid, $projectid);
$this->smartyHelper->assign('msg', 'Clone from project : ' . $errMsg);
}
unset($projectList[$projectid]);
$this->smartyHelper->assign('cloneProjects', SmartyTools::getSmartyArray($projectList, $clone_projectid));
$proj = ProjectCache::getInstance()->getProject($projectid);
$this->smartyHelper->assign('currentProjectId', $projectid);
$this->smartyHelper->assign('defaultProjectId', $clone_projectid);
$this->smartyHelper->assign('currentProjectName', $proj->getName());
$this->smartyHelper->assign('disabled', 0 == $clone_projectid);
$projectsInfo = array();
$projectsInfo[] = $this->getProjectInfo($proj, "tabsProject");
if (0 != $clone_projectid) {
$cproj = ProjectCache::getInstance()->getProject($clone_projectid);
$this->smartyHelper->assign('defaultProjectName', $cproj->getName());
$projectsInfo[] = $this->getProjectInfo($cproj, "tabsCloneProject");
}
$this->smartyHelper->assign('projectsInfo', $projectsInfo);
}
}
}
}
示例3: display
protected function display()
{
if (Tools::isConnectedUser()) {
$session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
// Admins only
if ($session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
$this->smartyHelper->assign('access', true);
$is_modified = Tools::getSecurePOSTStringValue('is_modified', 'false');
// init
// 'is_modified' is used because it's not possible to make a difference
// between an unchecked checkBox and an unset checkbox variable
if ("false" == $is_modified) {
$isBackup = true;
} else {
$isBackup = $_POST['cb_backup'];
}
$filename = Tools::getSecurePOSTStringValue('backup_filename', "codevtt_backup_" . date("Ymd") . ".sql");
$this->smartyHelper->assign('isBackup', $isBackup);
$this->smartyHelper->assign('filename', $filename);
if (isset($_POST['cb_backup'])) {
$result = true;
if ($isBackup) {
$result = SqlWrapper::getInstance()->sql_dump($filename) && $this->saveConfigFiles();
$this->smartyHelper->assign('backupResult', $result);
}
$this->smartyHelper->assign('stepOneResult', $result);
if ($result) {
$prjList = $this->displayProjectsToRemove();
$this->smartyHelper->assign('projects', $prjList);
}
$this->smartyHelper->assign('stepTwoResult', $result);
if ($result) {
$result = $this->removeCustomFields();
}
$this->smartyHelper->assign('stepThreeResult', $result);
if ($result) {
$result = Tools::execSQLscript2("uninstall.sql");
}
$this->smartyHelper->assign('stepFourResult', $result);
if ($result) {
$result = $this->deleteConfigFiles();
}
$this->smartyHelper->assign('stepFiveResult', $result);
if ($result) {
$result = $this->removeCustomMenuItem('CodevTT');
}
$this->smartyHelper->assign('stepSixResult', $result);
} else {
Config::setQuiet(true);
$this->smartyHelper->assign('codevReportsDir', Constants::$codevOutputDir . DIRECTORY_SEPARATOR . 'reports');
Config::setQuiet(false);
$this->smartyHelper->assign('is_modified', $is_modified);
}
}
}
}
示例4: display
protected function display()
{
$this->smartyHelper->assign('activeGlobalMenuItem', 'Admin');
if (Tools::isConnectedUser()) {
if (!$this->session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
$this->smartyHelper->assign('accessDenied', TRUE);
} else {
$action = filter_input(INPUT_POST, 'action');
if (empty($action)) {
$action = 'display';
}
$pm = PluginManager::getInstance();
// === ACTIONS =====================================================
if ('enablePlugin' == $action) {
$pluginName = Tools::getSecurePOSTStringValue('pluginName');
$pm->enablePlugin($pluginName);
} else {
if ('disablePlugin' == $action) {
$pluginName = Tools::getSecurePOSTStringValue('pluginName');
$pm->disablePlugin($pluginName);
} else {
if ('discoverNewPlugins' == $action) {
try {
Tools::createClassMap();
$pm->discoverNewPlugins();
//$this->smartyHelper->assign('infoMsg', T_('Found xx new plugins !'));
} catch (Exception $e) {
$this->smartyHelper->assign('errorMsg', T_('Could not create classmap: ') . $e->getMessage());
}
}
}
}
// === DISPLAY =====================================================
// set values to display plugin table
$plugins = $pm->getPlugins();
$formattedPlugins = array();
foreach ($plugins as $plugin) {
$className = $plugin['className'];
$formated_domains = array();
foreach ($plugin['domains'] as $domName) {
array_push($formated_domains, T_($domName));
}
//sort($formated_domains);
$formated_categories = array();
foreach ($plugin['categories'] as $catName) {
array_push($formated_categories, T_($catName));
}
//sort($formated_categories);
$formattedPlugins[$className] = array('name' => $plugin['displayedName'], 'status' => $plugin['status'], 'statusName' => pluginManager::getStatusName($plugin['status']), 'domains' => implode(',<br>', $formated_domains), 'categories' => implode(',<br>', $formated_categories), 'version' => $plugin['version'], 'description' => $plugin['description']);
}
$this->smartyHelper->assign('availablePlugins', $formattedPlugins);
}
}
}
示例5: display
protected function display()
{
if (Tools::isConnectedUser()) {
// only teamMembers & observers can access this page
if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid)) {
$this->smartyHelper->assign('accessDenied', TRUE);
return;
}
$year = Tools::getSecurePOSTIntValue('year', date('Y'));
$displayed_teamid = 0;
if (isset($_POST['displayed_teamid'])) {
$displayed_teamid = Tools::getSecurePOSTIntValue('displayed_teamid', 0);
} else {
$displayed_teamid = $this->teamid;
}
// --- Filters
$filtersStr = Tools::getSecurePOSTStringValue('checkedFilters', '');
if (!empty($filtersStr)) {
$filters = Tools::doubleExplode(':', ',', $filtersStr);
} else {
$filters = array('isExternalTasks' => 1, 'isSidetasksInactivity' => 1);
}
$filterInfo = array();
$filterInfo[] = array('filterId' => 'isExternalTasks', 'filterName' => T_('External Tasks'), 'isChecked' => $filters['isExternalTasks']);
$filterInfo[] = array('filterId' => 'isSidetasksInactivity', 'filterName' => T_('Sidetasks Inactivity'), 'isChecked' => $filters['isSidetasksInactivity']);
$this->smartyHelper->assign('filterInfo', $filterInfo);
$this->smartyHelper->assign('checkedFilters', $filtersStr);
// ---
$teams = SmartyTools::getSmartyArray($this->teamList, $displayed_teamid);
#$teams = SmartyTools::getSmartyArray(Team::getTeams(),$displayed_teamid);
$this->smartyHelper->assign('availableTeams', $teams);
$this->smartyHelper->assign('years', SmartyTools::getYears($year, 2));
if ($displayed_teamid == 0 && count($teams) > 0) {
$teamids = array_keys($teams);
$displayed_teamid = $teamids[0];
}
$team = TeamCache::getInstance()->getTeam($displayed_teamid);
$users = $team->getUsers();
$months = array();
for ($i = 1; $i <= 12; $i++) {
$monthTimestamp = mktime(0, 0, 0, $i, 1, $year);
$nbDaysInMonth = date("t", $monthTimestamp);
$endMonthTimestamp = strtotime("last day of this month", $monthTimestamp);
$months[$i] = array("name" => Tools::formatDate("%B %Y", $monthTimestamp), "idcaption" => Tools::formatDate("%B", $monthTimestamp), "days" => $this->getDays($nbDaysInMonth, $i, $year), "users" => $this->getDaysUsers($i, $year, $displayed_teamid, $users, $nbDaysInMonth, $filters), "workdays" => Holidays::getInstance()->getWorkdays($monthTimestamp, $endMonthTimestamp), "filename_csv" => date("Ym", $monthTimestamp) . '_' . str_replace(' ', '_', $team->getName()) . '_holidays.csv');
}
$this->smartyHelper->assign('months', $months);
}
}
示例6: display
protected function display()
{
if (Tools::isConnectedUser()) {
// only teamMembers & observers can access this page
if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid)) {
$this->smartyHelper->assign('accessDenied', TRUE);
} else {
$team = TeamCache::getInstance()->getTeam($this->teamid);
$formatedteamName = str_replace(" ", "_", $team->getName());
// dates
$month = date('m');
$year = date('Y');
// The first day of the current month
$startdate = Tools::getSecurePOSTStringValue("startdate", Tools::formatDate("%Y-%m-%d", mktime(0, 0, 0, $month, 1, $year)));
$this->smartyHelper->assign('startDate', $startdate);
$startTimestamp = Tools::date2timestamp($startdate);
// The current date plus one year
$nbDaysInMonth = date("t", mktime(0, 0, 0, $month, 1, $year));
$enddate = Tools::getSecurePOSTStringValue("enddate", Tools::formatDate("%Y-%m-%d", mktime(23, 59, 59, $month, $nbDaysInMonth, $year)));
$this->smartyHelper->assign('endDate', $enddate);
$endTimestamp = Tools::date2timestamp($enddate);
$endTimestamp += 24 * 60 * 60 - 1;
// + 1 day -1 sec.
if ('computeCsvMonthly' == $_POST['action']) {
$timeTracking = new TimeTracking($startTimestamp, $endTimestamp, $this->teamid);
$myFile = Constants::$codevOutputDir . DIRECTORY_SEPARATOR . 'reports' . DIRECTORY_SEPARATOR . $formatedteamName . "_Mantis_" . date("Ymd") . ".csv";
ExportCsvTools::exportManagedIssuesToCSV($this->teamid, $startTimestamp, $endTimestamp, $myFile);
$this->smartyHelper->assign('managedIssuesToCSV', basename($myFile));
$myFile = Constants::$codevOutputDir . DIRECTORY_SEPARATOR . 'reports' . DIRECTORY_SEPARATOR . $formatedteamName . "_Projects_" . date("Ymd", $timeTracking->getStartTimestamp()) . "-" . date("Ymd", $timeTracking->getEndTimestamp()) . ".csv";
$this->exportProjectMonthlyActivityToCSV($timeTracking, $myFile);
$this->smartyHelper->assign('projectMonthlyActivityToCSV', basename($myFile));
// reduce scope to enhance speed
$reports = array();
for ($i = 1; $i <= 12; $i++) {
$reports[] = basename(ExportCsvTools::exportHolidaystoCSV($i, $year, $this->teamid, $formatedteamName, Constants::$codevOutputDir . DIRECTORY_SEPARATOR . 'reports'));
}
$this->smartyHelper->assign('reports', $reports);
$this->smartyHelper->assign('reportsDir', Constants::$codevOutputDir . DIRECTORY_SEPARATOR . 'reports');
}
}
}
}
示例7: display
protected function display()
{
if (Tools::isConnectedUser()) {
// only teamMembers & observers can access this page
if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid)) {
$this->smartyHelper->assign('accessDenied', TRUE);
} else {
$isManager = $this->session_user->isTeamManager($this->teamid);
$isObserver = $this->session_user->isTeamObserver($this->teamid);
if ($isManager || $isObserver) {
// observers have access to the same info
$this->smartyHelper->assign('isManager', true);
}
// dates
$month = date('m');
$year = date('Y');
$startdate = Tools::getSecurePOSTStringValue("startdate", Tools::formatDate("%Y-%m-%d", mktime(0, 0, 0, $month, 1, $year)));
$this->smartyHelper->assign('startDate', $startdate);
$startTimestamp = Tools::date2timestamp($startdate);
$nbDaysInMonth = date("t", $startTimestamp);
$enddate = Tools::getSecurePOSTStringValue("enddate", Tools::formatDate("%Y-%m-%d", mktime(0, 0, 0, $month, $nbDaysInMonth, $year)));
$this->smartyHelper->assign('endDate', $enddate);
$endTimestamp = Tools::date2timestamp($enddate);
#$isDetailed = Tools::getSecurePOSTStringValue('cb_detailed','');
#$this->smartyHelper->assign('isDetailed', $isDetailed);
if ('computeMonthlyActivityReport' == $_POST['action']) {
$timeTracking = new TimeTracking($startTimestamp, $endTimestamp, $this->teamid);
$tracks = $timeTracking->getTimeTracks();
$this->smartyHelper->assign('monthlyActivityReport', $this->getMonthlyActivityReport($tracks));
// ConsistencyCheck
$consistencyErrors = $this->getConsistencyErrors($timeTracking);
if (count($consistencyErrors) > 0) {
$this->smartyHelper->assign('ccheckErrList', $consistencyErrors);
$this->smartyHelper->assign('ccheckButtonTitle', count($consistencyErrors) . ' ' . T_("Errors"));
$this->smartyHelper->assign('ccheckBoxTitle', count($consistencyErrors) . ' ' . T_("days are incomplete or undefined"));
}
}
}
}
}
示例8: display
protected function display()
{
if (Tools::isConnectedUser()) {
// only teamMembers & observers can access this page
if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid)) {
$this->smartyHelper->assign('accessDenied', TRUE);
} else {
// dates
$weekDates = Tools::week_dates(date('W'), date('Y'));
$startdate = Tools::getSecurePOSTStringValue("startdate", Tools::formatDate("%Y-%m-%d", $weekDates[1]));
$this->smartyHelper->assign('startDate', $startdate);
$enddate = Tools::getSecurePOSTStringValue("enddate", Tools::formatDate("%Y-%m-%d", $weekDates[5]));
$this->smartyHelper->assign('endDate', $enddate);
$isDetailed = Tools::getSecurePOSTIntValue('withJobDetails', 0);
$this->smartyHelper->assign('isJobDetails', $isDetailed);
$isExtTasksPrj = Tools::getSecurePOSTIntValue('withExtTasksPrj', 0);
$this->smartyHelper->assign('isExtTasksPrj', $isExtTasksPrj);
$isSideTasksPrj = Tools::getSecurePOSTIntValue('withSideTasksPrj', 1);
$this->smartyHelper->assign('isSideTasksPrj', $isSideTasksPrj);
if ('computeProjectActivityReport' == $_POST['action']) {
$startTimestamp = Tools::date2timestamp($startdate);
$endTimestamp = Tools::date2timestamp($enddate);
$endTimestamp = mktime(23, 59, 59, date('m', $endTimestamp), date('d', $endTimestamp), date('Y', $endTimestamp));
$timeTracking = new TimeTracking($startTimestamp, $endTimestamp, $this->teamid);
$this->smartyHelper->assign('projectActivityReport', $this->getProjectActivityReport($timeTracking->getProjectTracks(true), $this->teamid, $isDetailed));
// WorkingDaysPerProjectPerUser
$data = $timeTracking->getWorkingDaysPerProjectPerUser($isExtTasksPrj, true, $isSideTasksPrj);
foreach ($data as $smartyKey => $smartyVariable) {
$this->smartyHelper->assign($smartyKey, $smartyVariable);
}
$data = $this->getWorkingDaysPerProjectPerUser($startTimestamp, $endTimestamp, $isExtTasksPrj, $isSideTasksPrj);
foreach ($data as $smartyKey => $smartyVariable) {
$this->smartyHelper->assign($smartyKey, $smartyVariable);
}
}
}
}
}
示例9: display
protected function display()
{
if (Tools::isConnectedUser()) {
// only teamMembers & observers can access this page
if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid)) {
$this->smartyHelper->assign('accessDenied', TRUE);
} else {
$projects[0] = T_('All projects');
$projects += TeamCache::getInstance()->getTeam($this->teamid)->getProjects(false);
$projectid = 0;
if (isset($_POST['projectid']) && array_key_exists($_POST['projectid'], $projects)) {
$projectid = Tools::getSecurePOSTIntValue('projectid');
$_SESSION['projectid'] = $_POST['projectid'];
} else {
if (isset($_SESSION['projectid']) && array_key_exists($_SESSION['projectid'], $projects)) {
$projectid = $_SESSION['projectid'];
}
}
$this->smartyHelper->assign('projects', SmartyTools::getSmartyArray($projects, $projectid));
// The first day of the current week
$weekDates = Tools::week_dates(date('W'), date('Y'));
$startdate = Tools::getSecurePOSTStringValue('startdate', Tools::formatDate("%Y-%m-%d", $weekDates[1]));
$this->smartyHelper->assign('startDate', $startdate);
// The current date plus one year
$enddate = Tools::getSecurePOSTStringValue('enddate', Tools::formatDate("%Y-%m-%d", strtotime('+6 month')));
$this->smartyHelper->assign('endDate', $enddate);
if ('computeGantt' == $_POST['action']) {
$startT = Tools::date2timestamp($startdate);
$endT = Tools::date2timestamp($enddate);
#$endT += 24 * 60 * 60 -1; // + 1 day -1 sec.
// draw graph
$this->smartyHelper->assign('urlGraph', 'teamid=' . $this->teamid . '&projects=' . $projectid . '&startT=' . $startT . '&endT=' . $endT);
}
}
}
}
示例10: display
protected function display()
{
if (Tools::isConnectedUser()) {
$teamList = $this->session_user->getTeamList();
// only teamMembers & observers can access this page
if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid)) {
$this->smartyHelper->assign('accessDenied', TRUE);
} else {
$pageWidth = Tools::getSecurePOSTIntValue('width', Tools::getSecureGETIntValue('width', 0));
$this->smartyHelper->assign('width', $pageWidth);
if (array_key_exists($this->teamid, $teamList)) {
$this->smartyHelper->assign('consistencyErrors', $this->getConsistencyErrors($this->teamid));
$team = TeamCache::getInstance()->getTeam($this->teamid);
$isManager = $this->session_user->isTeamManager($this->teamid);
$isObserver = $this->session_user->isTeamObserver($this->teamid);
$this->smartyHelper->assign('isManager', $isManager || $isObserver);
// display backlog (unassigned tasks)
$unassignedIssues = $team->getUnassignedTasks();
$unassigendSel = new IssueSelection("unassigned from team {$this->teamid}");
$unassigendSel->addIssueList($unassignedIssues);
$this->smartyHelper->assign('unassigned_nbIssues', $unassigendSel->getNbIssues());
$this->smartyHelper->assign('unassigned_MEE', $unassigendSel->mgrEffortEstim);
$this->smartyHelper->assign('unassigned_EE', $unassigendSel->effortEstim + $unassigendSel->effortAdd);
// get planningOptions
$keyvalue = Tools::getSecurePOSTStringValue('planningOptions', '');
if (!empty($keyvalue)) {
$planningOptions = Tools::doubleExplode(':', ',', $keyvalue);
$this->session_user->setPlanningOptions($this->teamid, $planningOptions);
}
$this->smartyHelper->assign('planningOptions', $this->getPlanningOptions());
$today = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
$graphSize = "undefined" != $pageWidth ? $pageWidth - 150 : 800;
$allTasksLists = array();
$workloads = array();
$teamMembers = $team->getUsers();
$nbDaysToDisplay = 0;
foreach ($teamMembers as $user) {
$workload = 0;
// show only developper's & manager's tasks
if (!$user->isTeamDeveloper($this->teamid) && !$user->isTeamManager($this->teamid)) {
if (self::$logger->isDebugEnabled()) {
self::$logger->debug("user " . $user->getId() . " excluded from scheduled users on team {$this->teamid}");
}
continue;
}
if (NULL != $user->getDepartureDate($this->teamid) && $user->getDepartureDate($this->teamid) < $today) {
continue;
}
$scheduledTaskList = ScheduledTask::scheduleUser($user, $today, $this->teamid, TRUE);
foreach ($scheduledTaskList as $scheduledTask) {
$workload += $scheduledTask->getDuration();
}
$nbDaysToDisplay = $nbDaysToDisplay < $workload ? $workload : $nbDaysToDisplay;
$allTasksLists[$user->getName()] = $scheduledTaskList;
$workloads[$user->getName()] = $workload;
}
$dayPixSize = 0 != $nbDaysToDisplay ? $graphSize / $nbDaysToDisplay : 0;
$dayPixSize = round($dayPixSize);
#echo "DEBUG dayPixSize = $dayPixSize<br/>\n";
$this->smartyHelper->assign('planning', $this->getPlanning($nbDaysToDisplay, $dayPixSize, $allTasksLists, $workloads, $this->teamid, $this->session_userid, $isManager));
$this->smartyHelper->assign('colors', array("green" => T_("onTime"), "red" => T_("NOT onTime"), "blue" => T_("no deadLine"), "grey" => T_("monitored")));
$this->smartyHelper->assign('dayPixSize', $dayPixSize - 1);
}
}
}
}
示例11: display
protected function display()
{
if (Tools::isConnectedUser()) {
// only teamMembers & observers can access this page
if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid)) {
$this->smartyHelper->assign('accessDenied', TRUE);
} else {
$team = TeamCache::getInstance()->getTeam($this->teamid);
// if first call to this page
if (!array_key_exists('nextForm', $_POST)) {
$activeMembers = $team->getActiveMembers();
if ($this->session_user->isTeamManager($this->teamid)) {
$this->smartyHelper->assign('users', SmartyTools::getSmartyArray($activeMembers, $this->session_userid));
} else {
// developper & manager can add timeTracks
if (array_key_exists($this->session_userid, $activeMembers)) {
$_POST['userid'] = $this->session_userid;
$_POST['nextForm'] = "addHolidaysForm";
//$_POST['days'] = 'dayid';
}
}
}
$nextForm = Tools::getSecurePOSTStringValue('nextForm', '');
if ($nextForm == "addHolidaysForm") {
$userid = Tools::getSecurePOSTIntValue('userid', $this->session_userid);
$managed_user = UserCache::getInstance()->getUser($userid);
// dates
$startdate = Tools::getSecurePOSTStringValue('startdate', date("Y-m-d"));
$enddate = Tools::getSecurePOSTStringValue('enddate', '');
$defaultBugid = Tools::getSecurePOSTIntValue('bugid', 0);
$action = Tools::getSecurePOSTStringValue('action', '');
$duration = Tools::getSecurePOSTNumberValue('duree', 0);
if ("addHolidays" == $action) {
// TODO add tracks !
$job = Tools::getSecurePOSTStringValue('job');
$duration = Tools::getSecurePOSTNumberValue('duree');
$holydays = Holidays::getInstance();
$keyvalue = Tools::getSecurePOSTStringValue('checkedDays');
$checkedDaysList = Tools::doubleExplode(':', ',', $keyvalue);
$startTimestamp = Tools::date2timestamp($startdate);
$endTimestamp = Tools::date2timestamp($enddate);
// save to DB
$weekday = date('l', strtotime($startdate));
$timestamp = $startTimestamp;
while ($timestamp <= $endTimestamp) {
// check if not a fixed holiday
if (!$holydays->isHoliday($timestamp)) {
// check existing timetracks on $timestamp and adjust duration
$availabletime = $managed_user->getAvailableTime($timestamp);
// not imput more than possible
if ($duration >= $availabletime) {
$imput = $availabletime;
} else {
$imput = $duration;
}
// check if weekday checkbox is checked
if (1 == $checkedDaysList[$weekday]) {
if ($duration > 0) {
if (self::$logger->isDebugEnabled()) {
self::$logger->debug(date("Y-m-d", $timestamp) . " duration {$imput} job {$job}");
}
TimeTrack::create($managed_user->getId(), $defaultBugid, $job, $timestamp, $imput, $this->session_userid);
}
}
}
$timestamp = strtotime("+1 day", $timestamp);
$weekday = date('l', strtotime(date("Y-m-d", $timestamp)));
}
// We redirect to holidays report, so the user can verify his holidays
header('Location:holidays_report.php');
}
$this->smartyHelper->assign('startDate', $startdate);
$this->smartyHelper->assign('endDate', $enddate);
if ($this->session_userid != $managed_user->getId()) {
$this->smartyHelper->assign('otherrealname', $managed_user->getRealname());
}
// Get Team SideTasks Project List
$projList = $team->getProjects(true, false);
foreach ($projList as $pid => $pname) {
// we want only SideTasks projects
try {
if (!$team->isSideTasksProject($pid)) {
unset($projList[$pid]);
}
} catch (Exception $e) {
self::$logger->error("project {$pid}: " . $e->getMessage());
}
}
$extproj_id = Config::getInstance()->getValue(Config::id_externalTasksProject);
$extProj = ProjectCache::getInstance()->getProject($extproj_id);
$projList[$extproj_id] = $extProj->getName();
$defaultProjectid = Tools::getSecurePOSTIntValue('projectid', 0);
if ($defaultBugid != 0 && $action == 'setBugId') {
// find ProjectId to update categories
$issue = IssueCache::getInstance()->getIssue($defaultBugid);
$defaultProjectid = $issue->getProjectId();
}
$this->smartyHelper->assign('projects', SmartyTools::getSmartyArray($projList, $defaultProjectid));
$this->smartyHelper->assign('issues', $this->getIssues($defaultProjectid, $projList, $extproj_id, $defaultBugid));
$this->smartyHelper->assign('jobs', $this->getJobs($defaultProjectid, $projList));
//.........这里部分代码省略.........
示例12: display
protected function display()
{
if (Tools::isConnectedUser()) {
// only teamMembers can access this page
if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid) || $this->session_user->isTeamObserver($this->teamid) || !$this->session_user->isTeamMember($this->teamid)) {
$this->smartyHelper->assign('accessDenied', TRUE);
} else {
$team = TeamCache::getInstance()->getTeam($this->teamid);
$teamMembers = $team->getActiveMembers(NULL, NULL, TRUE);
$managed_userid = Tools::getSecurePOSTIntValue('userid', $this->session_userid);
if ($this->session_user->isTeamManager($this->teamid)) {
// session_user is Manager, let him choose the teamMember he wants to manage
$this->smartyHelper->assign('users', $teamMembers);
$this->smartyHelper->assign('selectedUser', $managed_userid);
$this->smartyHelper->assign("isManager", true);
}
// display AddTrack Page
$year = Tools::getSecurePOSTIntValue('year', date('Y'));
$managed_user = UserCache::getInstance()->getUser($managed_userid);
// Need to be Manager to handle other users
if ($managed_userid != $this->session_userid) {
if (!$this->session_user->isTeamManager($this->teamid) || !array_key_exists($managed_userid, $teamMembers)) {
self::$logger->error(' SECURITY ALERT changeManagedUser: session_user ' . $this->session_userid . " is not allowed to manage user {$managed_userid}");
Tools::sendForbiddenAccess();
}
}
// developper & manager can add timeTracks
$mTeamList = $managed_user->getDevTeamList();
$managedTeamList = $managed_user->getManagedTeamList();
$teamList = $mTeamList + $managedTeamList;
$action = Tools::getSecurePOSTStringValue('action', '');
$weekid = Tools::getSecurePOSTIntValue('weekid', date('W'));
$defaultDate = Tools::getSecurePOSTStringValue('date', date("Y-m-d", time()));
$defaultBugid = Tools::getSecurePOSTIntValue('bugid', 0);
$defaultProjectid = Tools::getSecurePOSTIntValue('projectid', 0);
$job = Tools::getSecurePOSTIntValue('job', 0);
$duration = Tools::getSecurePOSTNumberValue('duree', 0);
if ("addTrack" == $action) {
self::$logger->debug("addTrack: called from form1");
// TODO merge addTrack & addTimetrack actions !
// called by form1 when no backlog has to be set.
// updateBacklogDialogBox must not raise up,
// track must be added, backlog & status must NOT be updated
$timestamp = Tools::date2timestamp($defaultDate);
$defaultBugid = Tools::getSecurePOSTIntValue('bugid');
$job = Tools::getSecurePOSTStringValue('job');
$duration = Tools::getSecurePOSTNumberValue('duree');
// dialogBox is not called, then track must be saved to DB
$trackid = TimeTrack::create($managed_userid, $defaultBugid, $job, $timestamp, $duration, $this->session_userid);
if (self::$logger->isDebugEnabled()) {
self::$logger->debug("Track {$trackid} added : userid={$managed_userid} bugid={$defaultBugid} job={$job} duration={$duration} timestamp={$timestamp}");
}
// Don't show job and duration after add track
$job = 0;
$duration = 0;
$defaultProjectid = Tools::getSecurePOSTIntValue('projectid');
} elseif ("addTimetrack" == $action) {
// updateBacklogDialogbox with 'addTimetrack' action
// add track AND update backlog & status & handlerId
// TODO merge addTrack & addTimetrack actions !
self::$logger->debug("addTimetrack: called from the updateBacklogDialogBox");
// add timetrack (all values mandatory)
$defaultDate = Tools::getSecurePOSTStringValue('trackDate');
$defaultBugid = Tools::getSecurePOSTIntValue('bugid');
$job = Tools::getSecurePOSTIntValue('trackJobid');
$duration = Tools::getSecurePOSTNumberValue('timeToAdd');
$handlerId = Tools::getSecurePOSTNumberValue('handlerid');
// check jobid (bug happens sometime...
if (0 == $job) {
$this->smartyHelper->assign('error', T_("Timetrack not added: Job has not specified."));
self::$logger->error("Add track : FAILED. issue={$defaultBugid}, jobid={$job}, duration={$duration} date={$defaultDate}");
}
// check bug_id (this happens when user uses the 'back' button of the browser ?)
if (0 == $defaultBugid) {
self::$logger->error("Add track : FAILED. issue=0, jobid={$job}, duration={$duration} date={$defaultDate}");
} else {
$timestamp = 0 !== $defaultDate ? Tools::date2timestamp($defaultDate) : 0;
$trackid = TimeTrack::create($managed_userid, $defaultBugid, $job, $timestamp, $duration, $this->session_userid);
if (self::$logger->isDebugEnabled()) {
self::$logger->debug("Track {$trackid} added : userid={$managed_userid} bugid={$defaultBugid} job={$job} duration={$duration} timestamp={$timestamp}");
}
$issue = IssueCache::getInstance()->getIssue($defaultBugid);
// setBacklog
$formattedBacklog = Tools::getSecurePOSTNumberValue('backlog');
$issue->setBacklog($formattedBacklog);
// setStatus
$newStatus = Tools::getSecurePOSTIntValue('statusid');
$issue->setStatus($newStatus);
// set handlerId
if ($handlerId != $issue->getHandlerId()) {
// TODO security check (userid exists/valid ?)
$issue->setHandler($handlerId);
}
$defaultProjectid = $issue->getProjectId();
}
// Don't show job and duration after add track
$job = 0;
$duration = 0;
} elseif ("deleteTrack" == $action) {
$trackid = Tools::getSecurePOSTIntValue('trackid');
//.........这里部分代码省略.........
示例13: display
/**
* Display HTML page
*/
protected function display()
{
if (Tools::isConnectedUser()) {
// only teamMembers & observers can access this page
if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid)) {
$this->smartyHelper->assign('accessDenied', TRUE);
} else {
#$isManager = $this->session_user->isTeamManager($this->teamid);
#$this->smartyHelper->assign('isManager', $isManager);
$tmpTeamList = array($this->teamid => $this->teamList[$this->teamid]);
$projList = $this->session_user->getProjectList($tmpTeamList, true, false);
reset($projList);
$projectid = key($projList);
$odtTemplate = NULL;
$action = Tools::getSecurePOSTStringValue('action', '');
if ('downloadODT' == $action) {
$projectid = Tools::getSecurePOSTIntValue('projectid', NULL);
$formattedCategories = Tools::getSecurePOSTStringValue('categoryList', NULL);
$formattedStatuses = Tools::getSecurePOSTStringValue('statusList', NULL);
$formattedReporters = Tools::getSecurePOSTStringValue('reporterList', NULL);
$formattedHandlers = Tools::getSecurePOSTStringValue('handlerList', NULL);
$odtBasename = Tools::getSecurePOSTStringValue('templateFile', NULL);
$odtTemplate = Constants::$codevRootDir . '/odt_templates/' . $odtBasename;
}
$this->smartyHelper->assign('odtTemplates', $this->getTemplates(NULL, basename($odtTemplate)));
$this->smartyHelper->assign('projects', SmartyTools::getSmartyArray($projList, $projectid));
$selectedCategories = empty($formattedCategories) ? array(0) : explode(',', $formattedCategories);
$this->smartyHelper->assign('categories', $this->getProjectCategories($projectid, $selectedCategories));
$selectedStatusList = empty($formattedStatuses) ? array(0) : explode(',', $formattedStatuses);
$this->smartyHelper->assign('statuses', $this->getProjectStatusList($projectid, $selectedStatusList));
$selectedReporters = empty($formattedReporters) ? array(0) : explode(',', $formattedReporters);
$this->smartyHelper->assign('reporters', $this->getTeamMembers($selectedReporters));
$selectedHandlers = empty($formattedHandlers) ? array(0) : explode(',', $formattedHandlers);
$this->smartyHelper->assign('handlers', $this->getTeamMembers($selectedHandlers));
if ('downloadODT' == $action) {
$iSel = $this->getIssueSelection($projectid, $formattedCategories, $formattedReporters, $formattedHandlers, $formattedStatuses);
#echo implode(',', array_keys($iSel->getIssueList())).'<br>';
$odfFilepath = $this->generateODT($iSel, $projectid, $odtTemplate);
$this->smartyHelper->assign('odtFilename', basename($odfFilepath));
}
}
}
}
示例14: dirname
$originPage = "install_step2.php";
$default_path_mantis = dirname(BASE_PATH) . DIRECTORY_SEPARATOR . "mantis";
// "/var/www/html/mantis";
$hostname = Tools::isWindowsServer() ? php_uname('n') : getHostName();
$default_url_mantis = 'http://' . $hostname . '/mantis';
// 'http://'.$_SERVER['HTTP_HOST'].'/mantis'; // getHostByName(getHostName())
$default_url_codevtt = 'http://' . $hostname . '/codevtt';
// 'http://'.$_SERVER['HTTP_HOST'].'/codevtt'; // getHostByName(getHostName())
$filename_strings = "strings_english.txt";
$filename_custom_strings = "custom_strings_inc.php";
$filename_custom_constants = "custom_constants_inc.php";
$filename_custom_relationships = "custom_relationships_inc.php";
$path_mantis = Tools::getSecurePOSTStringValue('path_mantis', $default_path_mantis);
$url_mantis = Tools::getSecurePOSTStringValue('url_mantis', $default_url_mantis);
$url_codevtt = Tools::getSecurePOSTStringValue('url_codevtt', $default_url_codevtt);
$action = Tools::getSecurePOSTStringValue('action', '');
#displayStepInfo();
#echo "<hr align='left' width='20%'/>\n";
displayForm($originPage, $path_mantis, stripslashes($url_mantis), stripslashes($url_codevtt));
if ("proceedStep2" == $action) {
if (!file_exists($path_mantis)) {
echo "<span class='error_font'>Path to mantis " . $path_mantis . " doesn't exist</span><br/>";
exit;
}
if (!is_writable($path_mantis)) {
echo "<span class='error_font'>Path to mantis " . $path_mantis . " is NOT writable</span><br/>";
exit;
}
// ---- load mantis configuration files to extract the information
$filename_constant_inc = $path_mantis . DIRECTORY_SEPARATOR . "core" . DIRECTORY_SEPARATOR . "constant_inc.php";
if (file_exists($filename_constant_inc)) {
示例15: updateCmdInfo
/**
* @param Command $cmd
*/
private function updateCmdInfo(Command $cmd)
{
// TODO check cmd_teamid in grantedTeams
$cmd_teamid = Tools::getSecurePOSTIntValue('cmd_teamid');
if ($cmd_teamid != $this->teamid) {
// switch team (because you won't find the cmd in current team's contract list)
$_SESSION['teamid'] = $cmd_teamid;
$this->updateTeamSelector();
}
$cmd->setTeamid($cmd_teamid);
$formattedValue = Tools::getSecurePOSTStringValue('cmdName');
// TODO UGLY WORKAROUND: command name cannot contain commas (,) because it is used as field separator in FilterManager
$formattedValue = str_replace(",", ' ', $formattedValue);
$cmd->setName($formattedValue);
$formattedValue = Tools::getSecurePOSTStringValue('cmdReference', '');
$cmd->setReference($formattedValue);
$formattedValue = Tools::getSecurePOSTStringValue('cmdVersion', '');
$cmd->setVersion($formattedValue);
$formattedValue = Tools::getSecurePOSTStringValue('cmdReporter', '');
$cmd->setReporter($formattedValue);
$formattedValue = Tools::getSecurePOSTStringValue('cmdDesc', '');
$cmd->setDesc($formattedValue);
$formattedValue = Tools::getSecurePOSTStringValue('cmdStartDate', '');
if ('' != $formattedValue) {
$cmd->setStartDate(Tools::date2timestamp($formattedValue));
}
$formattedValue = Tools::getSecurePOSTStringValue('cmdDeadline', '');
if ('' != $formattedValue) {
$cmd->setDeadline(Tools::date2timestamp($formattedValue));
}
$cmd->setState(SmartyTools::checkNumericValue($_POST['cmdState'], true));
$cmd->setAverageDailyRate(SmartyTools::checkNumericValue($_POST['cmdAverageDailyRate'], true));
$cmd->setTotalSoldDays(SmartyTools::checkNumericValue($_POST['cmdTotalSoldDays'], true));
}