function value_from_POST_GET($param_name, $default_value = NULL) { $result = value_from_POST($param_name); if (!isset($result)) { $result = value_from_GET($param_name, $default_value); } return $result; }
function getData() { parent::getData(); $this->wop = value_from_POST_GET(FMWK_PARAM_OP, 'sign'); if (empty($this->asked_app)) { $this->asked_app = value_from_POST('asked_app', Null); } $op = $this->wop; $siteuser = $this->site->username(); $this->user_signed = isset($siteuser); if ($this->user_signed) { $this->wusername = $siteuser; } else { $this->wusername = value_from_POST('username', Null); $this->wpassword = value_from_POST('password', Null); } switch ($op) { case 'logout': $auth = $this->site->auth; $auth->logoutUser($this->wusername); $this->site->redirectToApp($this->asked_app); exit; break; case 'login': if ($this->user_signed) { $this->message .= "Already authentificated in"; $this->wop = 'info'; } else { $is_ok = FALSE; if (!empty($this->wusername)) { $auth = $this->site->auth; if (isset($auth)) { $is_ok = $auth->loginUser($this->wusername, $this->wpassword); } } if ($is_ok) { require_once INC_DIR . "users.inc"; if (user_exists($auth->signed_username)) { $this->message .= "Welcome"; $this->wop = 'login'; $this->site->redirectToApp($this->asked_app); } else { $this->message .= "Sorry your account is not configured yet.<br/>"; $auth->logoutUser(); $this->wop = 'sign'; } } else { $this->message .= "Invalid login or password"; $this->wop = 'sign'; } } break; default: $this->wop = 'info'; break; } }
<?php $DIS_Application = "Save"; include INC_DIR . "layout_helper.inc"; include LIB_DIR . "date.inc"; require INC_DIR . "reporting_lib.inc"; $username = value_from_POST('username'); $week = value_from_POST('week'); $year = value_from_POST('year'); $op = value_from_POST('op'); if (isset($op)) { // echo "<BR>###".$op."###<BR>"; $has_confirmation = $op == "Confirmation"; if ($has_confirmation) { ob_start(); $report_content = stripslashes($_POST['report_content']); createDirIfNotExists($year); $target_file = userFilename($username, $year, $week); $DIS_SaveMessage = "Saving to {$target_file} <br/>"; postUserReport($username, $year, $week, $report_content); $DIS_SaveMessage .= ob_get_contents(); ob_end_clean(); $week_filename = weekFilename($year, $week); $week_url = weekUrl($year, $week); $DIS_SaveMessage .= "<br><a href='{$week_url}'>{$week_filename}</a><br>\n"; } else { switch ($op) { case "SaveUrl": @($reporturl = $_POST['reporturl']); if (!isset($reporturl) or $reporturl != "http://" or strlen($reporturl) > 0) { $report_content = ContentOfUrl($reporturl);
<?php $DIS_Title = "Weekly Activity Reports"; $DIS_MyReportingUrl = MyReportingUrl(); if (isset($GLOBALS['username'])) { $username = $GLOBALS['username']; } if (isset($username) && strlen($username) > 0) { $reporter = $GLOBALS['reporting']['users'][$username]; $DIS_reporter_name = $reporter->name; $DIS_reporter_team = $reporter->team; } if (!isset($username)) { $username = value_from_POST('username'); } $year = value_from_POST_GET('year'); $week = value_from_POST_GET('week'); // Display $smarty->assign("VAR_REPORTING_URL", $DIS_MyReportingUrl); $smarty->assign("VAR_HEADER_TITLE", $DIS_Title); $smarty->assign("VAR_APPLICATION_TITLE", $DIS_Title); if (isset($DIS_reporter_name)) { $smarty->assign("VAR_REPORTER_NAME", $DIS_reporter_name); } else { $smarty->assign("VAR_REPORTER_NAME", ""); } if (isset($DIS_reporter_team)) { $smarty->assign("VAR_REPORTER_TEAM", $DIS_reporter_team); } else { $smarty->assign("VAR_REPORTER_TEAM", ""); }