function getData()
 {
     parent::getData();
     $param =& $this->param;
     ob_start();
     include "inc/stats.inc";
     $param['output'] = ob_get_contents();
     ob_end_clean();
 }
 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;
     }
 }
 function getData()
 {
     parent::getData();
     $param =& $this->param;
     include INC_DIR . "show_config_tree.inc";
     $SCMUSER = $this->site->username();
     $user_modules = userModules($SCMUSER);
     ob_start();
     showUserTree($user_modules);
     $param['output_user_tree'] = ob_get_contents();
     ob_end_clean();
     ob_start();
     displayModules($user_modules);
     $param['output_modules'] = ob_get_contents();
     ob_end_clean();
 }
 function getData()
 {
     parent::getData();
     $param =& $this->param;
     include INC_DIR . "show_config_tree.inc";
     if (!isset($optree) && isset($_POST['optree'])) {
         $optree = $_POST['optree'];
     }
     if (!isset($optext) && isset($_POST['optext'])) {
         $optext = $_POST['optext'];
     }
     if (!isset($modules) && isset($_POST['modules'])) {
         $modules = $_POST['modules'];
     }
     $user = $this->site->username();
     $param['DIS_EditMessage'] = "";
     if (isset($optree) or isset($optext)) {
         if (isset($optree) and $optree == 'SaveTree') {
             if (!isset($modules)) {
                 $param['DIS_EditMessage'] .= "Error: modules tree data are not present\n";
             } else {
                 #displayModules ($modules);
                 saveModulesFor($modules, $user);
             }
         }
         if (isset($optext) and $optext == 'SaveText') {
             if (!isset($modules)) {
                 $param['DIS_EditMessage'] .= "Error: modules text data are not present\n";
             } else {
                 saveTextModulesFor($modules, $user);
             }
         }
         $param['DIS_EditMessage'] .= "Changes saved for user [<STRONG> {$user} </STRONG>] ... ";
     }
     $user_modules = userModules($user);
     $all_modules = allModules();
     ob_start();
     showAllModulesWithSelectionTree($all_modules, $user_modules);
     $param['DIS_output_user_tree'] = ob_get_contents();
     ob_end_clean();
     ob_start();
     include INC_DIR . "show_config.inc";
     $param['DIS_output_modules'] = ob_get_contents();
     ob_end_clean();
 }
 function getData()
 {
     global $subapp;
     parent::getData();
     $param =& $this->param;
     $param['is_signed'] = $this->is_signed();
     $param['user'] = $this->site->username();
     //		if ($this->is_signed()) {
     //			if ($is_registring) {
     //				createUserFile ($param['SCMUSER']);
     //				$_SESSION = $param['SCMUSER'];
     //			} elseif ($is_exiting) {
     //				$_SESSION['user'] = Null;
     //				unset ($_SESSION['user']);
     //			}
     //			$param['DIS_Application'] = "login";
     //		} else {
     //			$param['DIS_Application'] = "login";
     //		}
 }
 function getData()
 {
     parent::getData();
     $param =& $this->param;
 }
 function getData()
 {
     parent::getData();
     $param =& $this->param;
     $param['is_signed'] = $this->is_signed();
 }
 function getData()
 {
     parent::getData();
     $param =& $this->param;
     $user = $this->site->username();
     if (empty($user)) {
         $user = "******";
     }
     $error = false;
     //	echo "<pre>"; print_r ($_POST); echo "</pre>";
     if (isset($_GET['key'])) {
         $data_src = 'key';
         $data_key = $_GET['key'];
     } else {
         $data_src = $_POST['datasrc'];
     }
     $data_source_is_dates = $data_src == "dates";
     if ($data_source_is_dates) {
         $start_date = $_POST['startdate'];
         $end_date = $_POST['enddate'];
         $error = !isValidDate($start_date) or !empty($end_date) and !isValidDate($end_date);
     } elseif ($data_src == 'key') {
         $commitsfiles = array($data_key);
     } else {
         @($commitsmonthfiles = $_POST['commitsmonthfiles']);
         if (isset($commitsmonthfiles)) {
             $commitsfiles = array();
             while (list($y, $v_yfiles) = each($commitsmonthfiles)) {
                 while (list($m, $v_mfiles) = each($v_yfiles)) {
                     while (list($d, $v_file) = each($v_mfiles)) {
                         $commitsfiles[] = $v_file;
                     }
                 }
             }
         }
         $error = count($commitsfiles) == 0;
     }
     //	@$commitsfiles = $_POST['commitsfiles'];
     $param['DIS_GET_SelectedYear'] = "";
     if (isset($_POST['selected_years'])) {
         $selected_years = $_POST['selected_years'];
         while (list($k, $y) = each($selected_years)) {
             $param['DIS_GET_SelectedYear'] .= "{$y}:";
         }
     }
     if (!isset($commitsfiles)) {
         $commitsfiles = array();
     }
     // if (isset ($_GET['key'])) { $commitsfiles[] = $_GET['key']; };
     $param['DIS_Application'] = "show";
     $param['DIS_Command'] = "cmd";
     $param['DIS_Result'] = "Result";
     if (!$error) {
         @($operation = $_POST['show']);
         if (!isset($operation)) {
             $operation = 'ShowLogs';
         }
         $param['DIS_Parameters'] = "Login used = {$user} <BR>";
         @($filter = $_POST['filter']);
         if (!isset($filter) or strlen($filter) == 0) {
             $filter = 'profil';
         } else {
             $param['DIS_Parameters'] .= "Filter used = {$filter} <BR>";
             if ($filter == 'text') {
                 @($filter_text = $_POST['textfilters']);
                 $filter_text = cleanedTextModule($filter_text);
                 $filter_file_tempo_name = tempnam($SCMLOGS['tmpdir'], "FILTER_TEMPO_");
                 $filter_file_tempo = fopen($filter_file_tempo_name, "w");
                 fwrite($filter_file_tempo, $filter_text);
                 fclose($filter_file_tempo);
                 $param['DIS_Parameters'] .= "Filter text = {$filter_text} <BR>";
             }
         }
         @($format = $_POST['format']);
         if (!isset($format) or strlen($format) == 0) {
             $format = 'html';
         } else {
             $param['DIS_Parameters'] .= "Formating used = {$format} <BR>";
         }
         @($type = $_POST['type']);
         if (!isset($type) or strlen($type) == 0) {
             $type = 'filtered';
         } else {
             $param['DIS_Parameters'] .= "Output type used = {$type} <BR>";
         }
         @($only_user = $_POST['only_user']);
         if (!isset($only_user) or strlen($only_user) == 0) {
             $only_user = '';
         } else {
             $param['DIS_Parameters'] .= "Only commits from user = {$only_user} <BR>";
         }
         @($only_tag = $_POST['only_tag']);
         if (!isset($only_tag) or strlen($only_tag) == 0) {
             $only_tag = '';
         } else {
             $param['DIS_Parameters'] .= "Only commits about TAG = {$only_tag} <BR>";
         }
         $is_mail_operation = FALSE;
         switch ($operation) {
             case 'EmailLogs':
                 $is_mail_operation = TRUE;
                 $param['DIS_Message'] = "Email {$user} all the logs <BR>(in the selected files)<BR>\n";
                 $processing_fct = "EmailLogsAction";
                 break;
             case 'ShowRawLogs':
                 $param['DIS_Message'] = "Show the RAW logs file (selected files)<BR>\n";
                 $processing_fct = "ShowRawLogsAction";
                 break;
             case 'EmailMyLogs':
                 $is_mail_operation = TRUE;
                 $only_user = $user;
                 $param['DIS_Message'] = "Email {$user} all the logs (in the selected files) \n";
                 $param['DIS_Message'] .= " from <STRONG>{$user}</STRONG><BR>";
                 $processing_fct = "EmailMyLogsAction";
                 break;
             case 'ShowMyLogs':
                 $only_user = $user;
                 $param['DIS_Message'] = "Show {$user} all the logs (in the selected files) \n";
                 $param['DIS_Message'] .= " from <STRONG>{$user}</STRONG><BR>\n";
                 $processing_fct = "ShowMyLogsAction";
                 break;
             case 'EmailOnlyLogsFor':
                 $is_mail_operation = TRUE;
                 $param['DIS_Message'] = "Email {$user} all the logs (in the selected files)\n";
                 $param['DIS_Message'] .= " from user : <STRONG>{$only_user}</STRONG>\n";
                 $param['DIS_Message'] .= " with tag  : <STRONG>{$only_tag}</STRONG><BR>\n";
                 $processing_fct = "EmailOnlyLogsForAction";
                 break;
             case 'ShowOnlyLogsFor':
                 $param['DIS_Message'] = "Show {$user} all the logs (in the selected files)\n";
                 $param['DIS_Message'] .= " from user : <STRONG>{$only_user}</STRONG>\n";
                 $param['DIS_Message'] .= " with tag&nbsp;  : <STRONG>{$only_tag}</STRONG><BR>\n";
                 $processing_fct = "ShowOnlyLogsForAction";
                 break;
             case 'ShowLogs':
             default:
                 $param['DIS_Message'] = "Show {$user} all the logs (in the selected files)<BR>\n";
                 $processing_fct = "ShowLogsAction";
                 break;
         }
         if ($is_mail_operation and $user == 'none') {
             $error = TRUE;
             $param['DIS_Message'] = "Operation not allowed";
             $param['DIS_Result'] = "Email operation is only for authentified users.";
         }
     }
     if (!$error) {
         $file_tempo_name = tempnam($SCMLOGS['tmpdir'], "TEMPO_");
         $file_tempo = fopen($file_tempo_name, "w");
         $param['DIS_Data'] = "";
         $repo = SCMLogs_repository();
         if ($data_source_is_dates) {
             $datesforsvn = "{" . $start_date . "}";
             $param['DIS_Data'] .= "from " . $start_date . " ";
             if (empty($end_date)) {
                 $datesforsvn .= ":HEAD";
                 $param['DIS_Data'] .= " to HEAD";
             } elseif (isValidDate($end_date)) {
                 $datesforsvn .= ":{" . $end_date . "}";
                 $param['DIS_Data'] .= " to " . $end_date . " ";
             } else {
                 $datesforsvn .= ":HEAD";
                 $param['DIS_Data'] .= " to HEAD";
             }
             $datesforsvn = str_replace("/", "-", $datesforsvn);
             $ccmd = $SCMLOGS['svn_bin_path'] . 'svn log --config-dir . -v -r "' . $datesforsvn . '" ' . $repo->svnfile_root();
             ob_start();
             $res = system($ccmd);
             $logs = ob_get_contents();
             fwrite($file_tempo, $logs);
             ob_end_clean();
         } else {
             $logsdir = $repo->logsdir;
             while (list($k, $v_file) = each($commitsfiles)) {
                 $param['DIS_Data'] .= "<li>{$v_file}";
                 if (preg_match("/^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])\$/", $v_file, $matches)) {
                     $v_file = $logsdir . '/' . $matches[1] . '/' . $matches[2] . '/' . $v_file;
                 }
                 if (preg_match("/^(" . SCMLogs_CurrentCommitFile() . ")\$/", $v_file, $matches)) {
                     $v_file = $logsdir . '/' . $v_file;
                 }
                 //$param['DIS_Data'] .= " :: <em>$v_file</em>";
                 $param['DIS_Data'] .= "</li>\n";
                 fwrite($file_tempo, ContentOfFile($v_file));
             }
         }
         fclose($file_tempo);
         if ($processing_fct != '') {
             ob_start();
             $param['DIS_Format'] = $format;
             $param['DIS_Type'] = $type;
             if ($filter == 'text') {
                 $param_filter = $filter_file_tempo_name;
             } else {
                 $param_filter = $filter;
             }
             set_time_limit(150);
             $param['DIS_Command'] = $processing_fct($file_tempo_name, $user, $param_filter, $only_user, $only_tag, $format, $type);
             $param['DIS_Result'] = ob_get_contents();
             ob_end_clean();
         } else {
             $param['DIS_Format'] = '';
             $param['DIS_Command'] = "Not Yet Implemented";
         }
         if (isset($filter_file_tempo_name)) {
             RemoveFile($filter_file_tempo_name);
         }
         RemoveFile($file_tempo_name);
     } else {
         $param['DIS_Format'] = '';
         $param['DIS_Parameters'] = "...";
         $param['DIS_Command'] = "...";
         if (empty($param['DIS_Message'])) {
             $param['DIS_Message'] = "Please select at least one file or valid dates!!!";
         }
         if (empty($param['DIS_Data'])) {
             $param['DIS_Data'] = "no file or valid dates selected";
         }
         if (empty($param['DIS_Result'])) {
             $param['DIS_Result'] = "...";
         }
     }
     $param['only_user'] =& $only_user;
     $param['only_tag'] =& $only_tag;
     $param['commitsfiles'] =& $commitsfiles;
 }
 function getData()
 {
     parent::getData();
     $param =& $this->param;
     require_once INC_DIR . "users.inc";
     if (!isset($op) && isset($_GET['op'])) {
         $op = $_GET['op'];
     }
     if (!isset($op) && isset($_POST['op'])) {
         $op = $_POST['op'];
     }
     if (!isset($op)) {
         $op = '';
     }
     if (!isset($oppref) && isset($_GET['oppref'])) {
         $oppref = $_GET['oppref'];
     }
     if (!isset($oppref) && isset($_POST['oppref'])) {
         $oppref = $_POST['oppref'];
     }
     $user = $this->site->username();
     ob_start();
     loadUserPref($user);
     if (isset($oppref) and $oppref == 'SavePref') {
         if (isset($_POST['email'])) {
             $email = $_POST['email'];
         }
         if (isset($_POST['activate'])) {
             $activate = $_POST['activate'];
         }
         if (isset($_POST['sendemptylogs'])) {
             $sendemptylogs = $_POST['sendemptylogs'];
         }
         if (isset($_POST['sendtype'])) {
             $sendtype = $_POST['sendtype'];
         }
         if (isset($_POST['format'])) {
             $format = $_POST['format'];
         }
         $tmp = "";
         $tmp .= "email=" . $email . "\n";
         if (!isset($activate) or $activate != 'on') {
             $activate = 'off';
         }
         $tmp .= "send_email=" . $activate . "\n";
         if (!isset($sendemptylogs) or $sendemptylogs != 'on') {
             $sendemptylogs = 'off';
         }
         $tmp .= "send_emptylogs=" . $sendemptylogs . "\n";
         if ($sendtype != 'raw') {
             $sendtype = 'filtered';
         }
         $tmp .= "send_type=" . $sendtype . "\n";
         if ($format != 'html') {
             $format = 'text';
         }
         $tmp .= "send_format=" . $format . "\n";
         echo "<div class=info>";
         echo "Pref Saved for {$user}";
         //			echo "<pre style=\"text-align: left; font-size: smaller;\">$tmp</pre>";
         echo "</div>";
         saveUserPref($tmp, $user);
         loadUserPref($user);
         echo "<br/>";
     }
     if (True) {
         echo "<form action='{$PHP_SELF}' name='PREF-FORM' method='POST' >\n";
         echo "<input type='hidden' name='op' value='{$op}' >\n";
         echo "<input type='hidden' name='user' value='{$user}' >\n";
         global $SCMLOGS;
         if ($SCMLOGS['email'] == '') {
             $SCMLOGS['email'] = $user;
         }
         echo "Email address <input type=text name=email value=\"" . $SCMLOGS['email'] . "\" ><br><br>";
         echo "<h3>Sending or not ?</h3>";
         echo "<ul>";
         if ($SCMLOGS['send_email'] == 'on') {
             $is_checked = 'CHECKED';
         } else {
             $is_checked = '';
         }
         echo "<input type=checkbox name=activate {$is_checked} >Email sending <br>";
         if ($SCMLOGS['send_emptylogs'] == 'on') {
             $is_checked = 'CHECKED';
         } else {
             $is_checked = '';
         }
         echo "<input type=checkbox name=sendemptylogs {$is_checked} >Email empty logs <br>";
         echo "</ul>";
         echo "<h3>Output message type:</h3>";
         echo "<ul>";
         if ($SCMLOGS['send_type'] == 'filtered') {
             $is_checked = 'CHECKED';
         } else {
             $is_checked = '';
         }
         echo "<INPUT TYPE=radio NAME=sendtype VALUE=\"separate\" {$is_checked} >Filtered logs <br/>";
         if ($SCMLOGS['send_type'] == 'raw') {
             $is_checked = 'CHECKED';
         } else {
             $is_checked = '';
         }
         echo "<INPUT TYPE=radio NAME=sendtype VALUE=\"raw\" {$is_checked} >Raw logs <br/>";
         echo "</ul>";
         echo "<h3>Commits log message format:</h3>";
         echo "<ul>";
         if ($SCMLOGS['send_format'] == 'html') {
             $is_checked = 'CHECKED';
         } else {
             $is_checked = '';
         }
         echo "<INPUT TYPE=radio NAME=format VALUE=\"html\" {$is_checked} >HTML <br/>";
         if ($SCMLOGS['send_format'] == 'text') {
             $is_checked = 'CHECKED';
         } else {
             $is_checked = '';
         }
         echo "<input type=radio name=format value=\"text\" {$is_checked} >TEXT <br/> ";
         echo "</ul>";
         echo "<input type=submit name=oppref value=\"SavePref\" > ";
         echo "<input type=reset name=oppref value=\"Reset\" > ";
         echo "</FORM>\n";
     }
     $param['output'] = ob_get_contents();
     ob_end_clean();
 }
 function getData()
 {
     parent::getData();
     $param =& $this->param;
     if ($this->is_signed()) {
         $SCMUSER = $this->site->username();
     }
     include INC_DIR . "query.inc";
     @($commitsfiles = $_POST['commitsfiles']);
     if (!isset($commitsfiles)) {
         $commitsfiles = array();
     }
     @($only_user = $_POST['only_user']);
     @($only_tag = $_POST['only_tag']);
     if (isset($_POST['selected_years'])) {
         $selected_years = $_POST['selected_years'];
         if (!is_array($selected_years)) {
             $selected_years = split(':', $selected_years);
         }
     }
     if (isset($_GET['selected_years'])) {
         $selected_years = split(':', $_GET['selected_years']);
     }
     if (!isset($selected_years)) {
         $selected_years = array(strftime("%Y"));
     }
     $param['DIS_GET_SelectedYear'] = "";
     while (list($k, $y) = each($selected_years)) {
         if (strlen($y) > 0) {
             $param['DIS_GET_SelectedYear'] .= "{$y}:";
         }
     }
     $param['selected_years'] =& $selected_years;
     $param['DIS_Application'] = "query";
     // Commit files
     $param['DIS_CurrentCommitFile'] = SCMLogs_CurrentCommitFile();
     $param['DIS_CurrentCommitFileChecked'] = in_array($param['DIS_CurrentCommitFile'], $commitsfiles);
     $param['DIS_OnlyUser'] = $only_user;
     $param['DIS_OnlyTag'] = $only_tag;
     $param['DIS_UserFilter'] = userModulesText($SCMUSER);
     $param['DIS_CommitFiles'] = array();
     // [years => [month => [key=>files]]]
     $repo = SCMLogs_repository();
     $list_years = listOfDir($repo->logsdir);
     reset($list_years);
     krsort($list_years);
     while (list($k_year, $v_year_dir) = each($list_years)) {
         if (eregi("^[0-9]+\$", $k_year)) {
             $TMP_months = array();
             $list_months = listOfDir($v_year_dir);
             arsort($list_months);
             while (list($k_month, $v_month_dir) = each($list_months)) {
                 $list_files = listOfFiles($v_month_dir);
                 if (count($list_files) > 0) {
                     $TMP_files = array();
                     reset($list_files);
                     arsort($list_files);
                     while (list($k_file, $v_filename) = each($list_files)) {
                         if (in_array($k_file, $commitsfiles)) {
                             $TMP_files[$k_file] = True;
                         } else {
                             $TMP_files[$k_file] = False;
                         }
                     }
                     $TMP_months[$k_month] = $TMP_files;
                 }
             }
             $param['DIS_CommitFiles'][$k_year] = $TMP_months;
         }
     }
 }