function getData()
 {
     global $SCMUSER;
     global $SCMLOGS;
     parent::getData();
     if ($this->use_tpl_engine) {
         $this->initTplEngine();
     }
     if (isset($_GET['repo'])) {
         $asked_repo = $_GET['repo'];
     } elseif (isset($_SESSION['repo'])) {
         $asked_repo = $_SESSION['repo'];
     }
     if (isset($asked_repo)) {
         if ($asked_repo == SCMLogs_repository_id()) {
             $_SESSION['repo'] = Null;
             unset($_SESSION['repo']);
         } else {
             SCMLogs_set_repository_by_id($asked_repo);
             $_SESSION['repo'] = SCMLogs_repository_id();
         }
     }
     $param =& $this->param;
     if ($this->is_signed()) {
         $param['is_signed'] = TRUE;
         $SCMUSER = $this->site->username();
         $param['DIS_User'] = $SCMUSER;
         $param['DIS_Title'] = " :: Welcome {$SCMUSER}";
     } else {
         $param['is_signed'] = FALSE;
         $param['DIS_Title'] = " :: Authentification";
         $SCMUSER = NULL;
     }
     include INC_DIR . "users.inc";
     //		if (!isset($SCMUSER) && isset ($_GET['user'])) { $SCMUSER = $_GET['user']; }
     //		if (!isset($SCMUSER) && isset ($_POST['user'])) { $SCMUSER = $_POST['user']; }
     //		if (!isset($SCMUSER) && isset ($_SESSION['user'])) { $SCMUSER = $_SESSION['user']; }
     /// Fill Data
     $repo =& SCMLogs_repository();
     $param['DIS_REPOSITORY'] = $repo->path;
     $param['DIS_REPO_BROWSING'] = SCMLogs_WebBrowsing();
     $html = '';
     if (isset($SCMLOGS['repositories'])) {
         $repos = $SCMLOGS['repositories'];
         if (count($repos) > 1) {
             $html .= '<form action="' . $this_url . '" method="GET"><input type="submit" value="&gt;&gt;" />';
             $html .= '<select name="repo">';
             foreach ($repos as $k_repoid => $v_repo) {
                 $html .= '<option value="' . $v_repo->id . '" ';
                 if ($v_repo->id == SCMLogs_repository_id()) {
                     $html .= ' SELECTED ';
                 }
                 $html .= '>' . $v_repo->id . '</option>';
             }
             $html .= '</select></form>';
         } else {
             $html .= "Repository " . SCMLogs_repository_id();
         }
     }
     $param['DIS_VAR_PAGE_REPO_LIST'] = $html;
 }
 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;
         }
     }
 }
 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;
 }
}
if (isset($_GET['confirm'])) {
    $w_confirm = $_GET['confirm'] == 'yes';
} else {
    $w_confirm = false;
}
if (isset($_POST['action'])) {
    $w_action = $_POST['action'];
}
if (isset($asked_repo)) {
    if ($asked_repo == SCMLogs_repository_id()) {
    } else {
        SCMLogs_set_repository_by_id($asked_repo);
    }
}
$repo =& SCMLogs_repository();
$msg_exists = "<span class=\"valid\">EXISTS</span>";
$msg_missing = "<span class=\"error\">MISSING</span>";
$msg_not_found = "<span class=\"warning\">NOT FOUND</span>";
$last_check_had_error = false;
function adminCheckPath($path, $required = true)
{
    global $msg_exists, $msg_not_found, $msg_missing;
    global $last_check_had_error;
    $last_check_had_error = false;
    $res = "{$path}";
    if (file_exists($path)) {
        $res .= $msg_exists;
    } else {
        if ($required) {
            $res .= $msg_missing;