Example #1
0
/**
 * Function set_project_environment
 *
 * Analyses configuration and current session to identify which project area
 * is to be used. 
 * If a project is specified in the HTTP parameters then that is used, otherwise
 * the current SESSION
 * "reports" project is used
 */
function set_project_environment($initial_project = false, $project_folder = "projects", $admin_project_folder = "projects" )
{
	global $g_project;
	global $g_projpath;
	global $g_language;
	global $g_translations;
	global $g_menu;
	global $g_menu_title;
	global $g_dropdown_menu;
	global $g_report_desc;
	global $g_included_config;
	
	$target_menu = "";
	$project = "";

    $last_project = "";

    if ( isset_reportico_session_param("project") )
        if ( get_reportico_session_param("project") )
            $last_project = get_reportico_session_param("project");

	if ( !$project && array_key_exists("submit_delete_project", $_REQUEST) )
	{
		$project = get_request_item("jump_to_delete_project", "");	
		$_REQUEST["xmlin"] = "deleteproject.xml";
		set_reportico_session_param("project",$project);
	}

	if ( !$project && array_key_exists("submit_configure_project", $_REQUEST) )
	{
		$project = get_request_item("jump_to_configure_project", "");	
		$_REQUEST["xmlin"] = "configureproject.xml";
		set_reportico_session_param("project",$project);
	}

	if ( !$project && array_key_exists("submit_menu_project", $_REQUEST) )
	{
		$project = get_request_item("jump_to_menu_project", "");	
		set_reportico_session_param("project",$project);
	}

	if ( !$project && array_key_exists("submit_design_project", $_REQUEST) )
	{
		$project = get_request_item("jump_to_design_project", "");	
		set_reportico_session_param("project",$project);
	}
    
	if ( $initial_project )
	{
		$project = $initial_project;
		set_reportico_session_param("project",$project);
	}
    

	if ( !$project )
		$project = session_request_item("project", "admin");

	if ( !$target_menu )
		$target_menu = session_request_item("target_menu", "");

	$menu = false;
	$menu_title = "Set Menu Title";

    if ( $project == "admin" )
        $project_folder = $admin_project_folder;

	// Now we now the project include the relevant config.php
	$projpath = $project_folder."/".$project;

	$configfile = $projpath."/config.php";
	$configtemplatefile = $projpath."/adminconfig.template";

	$menufile = $projpath."/menu.php";
	if ( $target_menu != "" )
		$menufile = $projpath."/menu_".$target_menu.".php";

	if ( !is_file($projpath) )
	{
		find_file_to_include($projpath, $projpath);
	}

    set_reportico_session_param("project_path", $projpath); 
    $this->reports_path = $projpath;

	if ( !$projpath )
	{
		find_file_to_include("config.php", $configfile);
        if ( $g_included_config && $g_included_config != $configfile )
            handle_error("Cannot load two different instances on a single page from different projects.", E_USER_ERROR);
        else
        {
            $g_included_config = $configfile;
            include_once($configfile);
        }
		$g_projpath = false;
		$g_project = false;
		$g_menu = false;
		$g_menu_title = "";
		$g_dropdown_menu = false;
		$old_error_handler = set_error_handler("ErrorHandler");
		handle_error("Project Directory $project not found. Check INCLUDE_PATH or project name");
		return;
	}

	$g_projpath = $projpath;
	if ( !is_file($configfile) )
		find_file_to_include($configfile, $configfile);
	if ( !is_file($menufile) )
		find_file_to_include($menufile, $menufile);

	if ( $project == "admin" && !is_file($configfile))
	{
		find_file_to_include($configtemplatefile, $configfile);
	}
	
	if ( $configfile )
	{
		if ( !is_file($configfile) )
        {
			handle_error("Config file $menufile not found in project $project", E_USER_WARNING);
        }

        if ( $g_included_config && $g_included_config != $configfile )
	        handle_error("Cannot load two different instances on a single page from different projects.", E_USER_ERROR);
        else
        {
		    include_once($configfile);
            $g_included_config = $configfile;
        }

		if ( is_file($menufile) )
			include($menufile);
		else
			handle_error("Menu Definition file $menufile not found in project $project", E_USER_WARNING);

	}
	else
	{
		find_file_to_include("config.php", $configfile);
		if ( $configfile )
        {
            if ( $g_included_config && $g_included_config != $configfile )
	            handle_error("Cannot load two different instances on a single page from different projects.", E_USER_ERROR);
            else
            {
		        include_once($configfile);
                $g_included_config = $configfile;
            }
        }
		$g_project = false;
		$g_projpath = false;
		$g_menu = false;
		$g_menu_title = "";
		$g_dropdown_menu = false;
		$old_error_handler = set_error_handler("ErrorHandler");
		handle_error("Configuration Definition file config.php not found in project $project", E_USER_ERROR);
	}

    // Ensure a Database and Output Character Set Encoding is set
    if ( !defined("SW_DB_ENCODING" ) )
        define("SW_DB_ENCODING", "UTF8");
    if ( !defined("SW_OUTPUT_ENCODING" ) )
        define("SW_OUTPUT_ENCODING", "UTF8");

    // Ensure a language is set
    if ( !defined("SW_LANGUAGE" ) )
        define("SW_LANGUAGE", "en_gb");

	$g_project = $project;
	if ( !defined('SW_PROJECT') )
	    define('SW_PROJECT', $g_project);

	$language = "en_gb";
    // Default language to first language in avaible_languages
    $langs = available_languages();
    if ( count($langs) > 0 )
    {
        $language = $langs[0]["value"];
    }

	if ( defined('SW_LANGUAGE') && SW_LANGUAGE && SW_LANGUAGE != "PROMPT" )
	    $language = session_request_item("reportico_language", SW_LANGUAGE);
    else
	    $language = session_request_item("reportico_language", "en_gb");

    // language not found the default to first
    $found = false;
    foreach ( $langs as $k => $v )
    {
        if ( $v["value"] == $language )
        {
            $found = true;
            break;
        }
    }
    if ( !$found && count($langs) > 0 )
        $language = $langs[0]["value"];

    // If project has change then change to default project language
    // Ignore for now as want to use chosen Administrator language if set
    //if ( $last_project && ( $last_project != $project ) )
    //{
        //$language = SW_LANGUAGE;
		//set_reportico_session_param("language",$language);
    //}

	if ( array_key_exists("submit_language", $_REQUEST) )
	{
		$language = $_REQUEST["jump_to_language"];
		set_reportico_session_param("reportico_language",$language);
	}

	$g_language = $language;
	$g_menu = $menu;
	$g_menu_title = $menu_title;
    if ( isset($dropdown_menu ) )
	    $g_dropdown_menu = $dropdown_menu;

    // Include project specific language translations
    load_project_language_pack($project, output_charset_to_php_charset(SW_OUTPUT_ENCODING));

	return $project;
}
 function generate_url_params($target_format, $session_placeholder = false)
 {
     $this->apply_defaults();
     $result = "";
     $url = "";
     $url .= "&graphcolor=" . $this->graphcolor_actual;
     $url .= "&gridposition=" . $this->gridpos_actual;
     $url .= "&xgriddisplay=" . $this->xgriddisplay_actual;
     $url .= "&xgridcolor=" . $this->xgridcolor_actual;
     $url .= "&ygriddisplay=" . $this->ygriddisplay_actual;
     $url .= "&ygridcolor=" . $this->ygridcolor_actual;
     $url .= "&titlefont=" . $this->titlefont_actual;
     $url .= "&titlefontstyle=" . $this->titlefontstyle_actual;
     $url .= "&titlefontsize=" . $this->titlefontsize_actual;
     $url .= "&titlecolor=" . $this->titlecolor_actual;
     $url .= "&xaxiscolor=" . $this->xaxiscolor_actual;
     $url .= "&xaxisfont=" . $this->xaxisfont_actual;
     $url .= "&xaxisfontstyle=" . $this->xaxisfontstyle_actual;
     $url .= "&xaxisfontsize=" . $this->xaxisfontsize_actual;
     $url .= "&xaxisfontcolor=" . $this->xaxisfontcolor_actual;
     $url .= "&yaxiscolor=" . $this->yaxiscolor_actual;
     $url .= "&yaxisfont=" . $this->yaxisfont_actual;
     $url .= "&yaxisfontstyle=" . $this->yaxisfontstyle_actual;
     $url .= "&yaxisfontsize=" . $this->yaxisfontsize_actual;
     $url .= "&yaxisfontcolor=" . $this->yaxisfontcolor_actual;
     $url .= "&xtitlefont=" . $this->xtitlefont_actual;
     $url .= "&xtitlefontstyle=" . $this->xtitlefontstyle_actual;
     $url .= "&xtitlefontsize=" . $this->xtitlefontsize_actual;
     $url .= "&xtitlecolor=" . $this->xtitlecolor_actual;
     $url .= "&xtickint=" . $this->xtickinterval_actual;
     $url .= "&xticklabint=" . $this->xticklabelinterval_actual;
     $url .= "&ytitlefont=" . $this->ytitlefont_actual;
     $url .= "&ytitlefontstyle=" . $this->ytitlefontstyle_actual;
     $url .= "&ytitlefontsize=" . $this->ytitlefontsize_actual;
     $url .= "&ytitlecolor=" . $this->ytitlecolor_actual;
     $url .= "&ytickint=" . $this->ytickinterval_actual;
     $url .= "&yticklabint=" . $this->yticklabelinterval_actual;
     $url .= "&margincolor=" . $this->margincolor_actual;
     $url .= "&marginleft=" . $this->marginleft_actual;
     $url .= "&marginright=" . $this->marginright_actual;
     $url .= "&margintop=" . $this->margintop_actual;
     $url .= "&marginbottom=" . $this->marginbottom_actual;
     $url .= "&xlabels=" . implode(",", $this->xlabels);
     foreach ($this->plot as $k => $v) {
         $str = implode(",", $v["data"]);
         $url .= "&plotname{$k}=" . $v["name"];
         $url .= "&plotdata{$k}={$str}";
         $url .= "&plottype{$k}=" . $v["type"];
         $url .= "&plotlinecolor{$k}=" . $v["linecolor"];
         if ($v["legend"]) {
             $url .= "&plotlegend{$k}=" . $v["legend"];
         }
         if ($v["fillcolor"]) {
             $url .= "&plotfillcolor{$k}=" . $v["fillcolor"];
         }
     }
     if ($session_placeholder) {
         $ses = "graph_" . $session_placeholder;
         set_reportico_session_param($ses, $url);
         $url = "graphid=" . $ses . "&time=" . time();
     }
     $js = "";
     $js .= "<div class=\"reportico-chart-container\"> " . $this->convert_special_chars($this->title_actual);
     $js .= "<div id=\"reportico_chart{$session_placeholder}\" class=\"reportico-chart-placeholder\"></div> </div>\n";
     $js .= "<script>\n";
     $js .= "var placeholder = '#reportico_chart{$session_placeholder}';\n";
     $js .= "var data = [\n";
     $lct = 0;
     foreach ($this->plot as $k => $v) {
         if ($lct > 0) {
             $js .= ",";
         }
         $js .= "{";
         if ($v["legend"]) {
             $js .= " label: " . "\"" . $v["legend"] . "\", ";
         }
         switch ($v["type"]) {
             case 'BAR':
                 $js .= " bars: { show: true, fill: true }, ";
                 break;
             case 'LINE':
             default:
                 //$js .= " lines: { show: true, fill: false }, ";
                 $js .= " bars: { show: true, fill: true }, ";
                 break;
         }
         $js .= " data: [";
         $lct1 = 0;
         foreach ($v["data"] as $v) {
             if ($lct1 > 0) {
                 $js .= ",";
             }
             $js .= "[{$lct1}, {$v}]";
             $lct1++;
         }
         $js .= "] }\n";
         $lct++;
     }
     $js .= "];\n";
     $js .= "var options = {\n                        series: {\n                            bars: {\n                                show: true,\n                                align: \"center\",\n                                barWidth: 0.8,\n                                fill: true,\n                                }\n                            },\n                        margin: [ 100, 100 ],\n                        xaxis: {\n                            axisLabel: '" . $this->xtitle_actual . "',\n                            axisLabelUseCanvas: true,\n                            axisLabelFontSizePixels: 20,\n                            axisLabelFontFamily: 'Arial'\n                        },\n                        yaxis: {\n                            axisLabel: '" . $this->ytitle_actual . "',\n                            axisLabelUseCanvas: true\n                        },\n                        legend: {\n                            labelBoxBorderColor: '#000000',\n                            margin: [ 50, 50 ]\n                        }\n                    };\n";
     $js .= "var plot = reportico_jquery.plot(placeholder, data, options);\n";
     $js .= "</script>\n";
     $result = $js;
     return $result;
 }
Example #3
0
 function generate_url_params($target_format, $session_placeholder = false)
 {
     $this->apply_defaults();
     $result = "";
     $url = "";
     $url .= "title=" . $this->convert_special_chars($this->title_actual);
     $url .= "&xtitle=" . $this->convert_special_chars($this->xtitle_actual);
     $url .= "&ytitle=" . $this->convert_special_chars($this->ytitle_actual);
     if ($target_format == "PDF") {
         $url .= "&width=" . $this->width_pdf_actual;
         $url .= "&height=" . $this->height_pdf_actual;
     } else {
         $url .= "&width=" . $this->width_actual;
         $url .= "&height=" . $this->height_actual;
     }
     $url .= "&graphcolor=" . $this->graphcolor_actual;
     $url .= "&gridposition=" . $this->gridpos_actual;
     $url .= "&xgriddisplay=" . $this->xgriddisplay_actual;
     $url .= "&xgridcolor=" . $this->xgridcolor_actual;
     $url .= "&ygriddisplay=" . $this->ygriddisplay_actual;
     $url .= "&ygridcolor=" . $this->ygridcolor_actual;
     $url .= "&titlefont=" . $this->titlefont_actual;
     $url .= "&titlefontstyle=" . $this->titlefontstyle_actual;
     $url .= "&titlefontsize=" . $this->titlefontsize_actual;
     $url .= "&titlecolor=" . $this->titlecolor_actual;
     $url .= "&xaxiscolor=" . $this->xaxiscolor_actual;
     $url .= "&xaxisfont=" . $this->xaxisfont_actual;
     $url .= "&xaxisfontstyle=" . $this->xaxisfontstyle_actual;
     $url .= "&xaxisfontsize=" . $this->xaxisfontsize_actual;
     $url .= "&xaxisfontcolor=" . $this->xaxisfontcolor_actual;
     $url .= "&yaxiscolor=" . $this->yaxiscolor_actual;
     $url .= "&yaxisfont=" . $this->yaxisfont_actual;
     $url .= "&yaxisfontstyle=" . $this->yaxisfontstyle_actual;
     $url .= "&yaxisfontsize=" . $this->yaxisfontsize_actual;
     $url .= "&yaxisfontcolor=" . $this->yaxisfontcolor_actual;
     $url .= "&xtitlefont=" . $this->xtitlefont_actual;
     $url .= "&xtitlefontstyle=" . $this->xtitlefontstyle_actual;
     $url .= "&xtitlefontsize=" . $this->xtitlefontsize_actual;
     $url .= "&xtitlecolor=" . $this->xtitlecolor_actual;
     $url .= "&xtickint=" . $this->xtickinterval_actual;
     $url .= "&xticklabint=" . $this->xticklabelinterval_actual;
     $url .= "&ytitlefont=" . $this->ytitlefont_actual;
     $url .= "&ytitlefontstyle=" . $this->ytitlefontstyle_actual;
     $url .= "&ytitlefontsize=" . $this->ytitlefontsize_actual;
     $url .= "&ytitlecolor=" . $this->ytitlecolor_actual;
     $url .= "&ytickint=" . $this->ytickinterval_actual;
     $url .= "&yticklabint=" . $this->yticklabelinterval_actual;
     $url .= "&margincolor=" . $this->margincolor_actual;
     $url .= "&marginleft=" . $this->marginleft_actual;
     $url .= "&marginright=" . $this->marginright_actual;
     $url .= "&margintop=" . $this->margintop_actual;
     $url .= "&marginbottom=" . $this->marginbottom_actual;
     $url .= "&xlabels=" . implode(",", $this->xlabels);
     foreach ($this->plot as $k => $v) {
         $str = implode(",", $v["data"]);
         $url .= "&plotname{$k}=" . $v["name"];
         $url .= "&plotdata{$k}={$str}";
         $url .= "&plottype{$k}=" . $v["type"];
         $url .= "&plotlinecolor{$k}=" . $v["linecolor"];
         if ($v["legend"]) {
             $url .= "&plotlegend{$k}=" . $v["legend"];
         }
         if ($v["fillcolor"]) {
             $url .= "&plotfillcolor{$k}=" . $v["fillcolor"];
         }
     }
     if ($session_placeholder) {
         $ses = "graph_" . $session_placeholder;
         set_reportico_session_param($ses, $url);
         $url = "graphid=" . $ses . "&time=" . time();
     }
     // Select the appropriate reporting engine
     $dyngraph = "dyngraph.php";
     if (defined("SW_GRAPH_ENGINE") && SW_GRAPH_ENGINE == "PCHART") {
         $dyngraph = "dyngraph_pchart.php";
     }
     $dr = get_reportico_url_path();
     $dyngraph = $dr . "/" . find_best_url_in_include_path($dyngraph);
     if ($this->reportico->framework_parent) {
         $dyngraph = "";
         if ($this->reportico->reportico_ajax_mode == "2") {
             $dyngraph = preg_replace("/ajax/", "graph", $this->reportico->reportico_ajax_script_url);
         }
     }
     $forward_url_params = session_request_item('forward_url_get_parameters_graph');
     if (!$forward_url_params) {
         $forward_url_params = session_request_item('forward_url_get_parameters', $this->reportico->forward_url_get_parameters);
     }
     if ($forward_url_params) {
         $url .= "&" . $forward_url_params;
     }
     $url .= "&reportico_call_mode=graph_pchart";
     $url .= "&reportico_session_name=" . reportico_session_name();
     $result = '<img class="swRepGraph" src=\'' . $dyngraph . '?' . $url . '\'>';
     return $result;
 }
 function execute($mode = false, $draw = true)
 {
     global $g_system_errors;
     global $g_system_debug;
     global $g_code_area;
     global $g_code_source;
     global $g_debug_mode;
     global $g_language;
     global $g_project;
     global $g_session_namespace;
     global $g_session_namespace_key;
     if ($this->session_namespace) {
         $g_session_namespace = $this->session_namespace;
     }
     if ($g_session_namespace) {
         $g_session_namespace_key = "reportico_" . $g_session_namespace;
     }
     // If a session namespace doesnt exist create one
     if (!isset($_SESSION[$g_session_namespace_key]) || isset($_REQUEST['clear_session']) || $this->clear_reportico_session) {
         initialize_reportico_namespace($g_session_namespace_key);
     }
     // Work out the mode (ADMIN, PREPARE, MENU, EXECUTE, MAINTAIN based on all parameters )
     if (!$mode) {
         $mode = $this->get_execute_mode();
     }
     $old_error_handler = set_error_handler("ErrorHandler");
     set_exception_handler("ExceptionHandler");
     // If new session, we need to use initial project, report etc, otherwise ignore them
     $this->handle_initial_settings();
     // Fetch project config
     set_project_environment($this->initial_project);
     register_session_param("external_user", $this->external_user);
     register_session_param("external_param1", $this->external_param1);
     register_session_param("external_param2", $this->external_param2);
     register_session_param("external_param3", $this->external_param3);
     $this->user_parameters = register_session_param("user_parameters", $this->user_parameters);
     $this->dropdown_menu = register_session_param("dropdown_menu", $this->dropdown_menu);
     $this->static_menu = register_session_param("static_menu", $this->static_menu);
     $this->charting_engine = register_session_param("charting_engine", $this->charting_engine);
     $this->charting_engine_html = register_session_param("charting_engine_html", $this->charting_engine_html);
     $this->output_template_parameters = register_session_param("output_template_parameters", $this->output_template_parameters);
     $this->dynamic_grids = register_session_param("dynamic_grids", $this->dynamic_grids);
     $this->dynamic_grids_sortable = register_session_param("dynamic_grids_sortable", $this->dynamic_grids_sortable);
     $this->dynamic_grids_searchable = register_session_param("dynamic_grids_searchable", $this->dynamic_grids_searchable);
     $this->dynamic_grids_paging = register_session_param("dynamic_grids_paging", $this->dynamic_grids_paging);
     $this->dynamic_grids_page_size = register_session_param("dynamic_grids_page_size", $this->dynamic_grids_page_size);
     // We are in AJAX mode if it is passed throuh
     if (isset($_REQUEST["reportico_ajax_called"])) {
         $this->reportico_ajax_called = $_REQUEST["reportico_ajax_called"];
     }
     //set_reportico_session_param("reportico_ajax_called", $_REQUEST["reportico_ajax_called"] );
     // Store whether in framework
     set_reportico_session_param("framework_parent", $this->framework_parent);
     // Set access mode to decide whether to allow user to access Design Mode, Menus, Criteria or just run a single report
     $this->access_mode = session_item("access_mode", $this->access_mode);
     if ($this->access_mode == "DEMO") {
         $this->allow_maintain = "DEMO";
     }
     $this->reports_path = "projects/" . $g_project;
     // Convert input and out charsets into their PHP versions
     // for later iconv use
     $this->db_charset = db_charset_to_php_charset('UTF-8');
     $this->output_charset = output_charset_to_php_charset('UTF-8');
     // Ensure Smarty Template folder exists and is writeable
     $include_template_dir = "templates_c";
     if (!is_dir("templates_c")) {
         find_file_to_include("templates_c", $include_template_dir, $include_template_dir);
     }
     if (!is_dir($include_template_dir)) {
         echo "Unable to generate output. The <b>{$include_template_dir}</b> folder does not exist within the main reportico area. Please create this folder and ensure it has read, write and execute permissions and then retry.";
         die;
     }
     if (!sw_path_executable($include_template_dir)) {
         echo "Unable to generate output. The <b>{$include_template_dir}</b> folder does not have read, write and execute permissions. Please correct and retry.";
         die;
     }
     $g_debug_mode = get_request_item("debug_mode", "0", $this->first_criteria_selection);
     if (!$mode) {
         $mode = $this->get_execute_mode();
     }
     // If the project is the ADMIN project then the MAin Menu will be the Admin Page
     if ($g_project == "admin" && $mode == "MENU") {
         $mode = "ADMIN";
     }
     // If this is PREPARE mode then we want to identify whether user has entered prepare
     // screen for first time so we know whether to set defaults or not
     switch ($mode) {
         case "PREPARE":
             $this->report_progress("Ready", "READY");
             $this->first_criteria_selection = true;
             // Must find ALternative to THIs for first time in testing!!!
             if (array_key_exists("target_format", $_REQUEST)) {
                 $this->first_criteria_selection = false;
                 set_reportico_session_param("firstTimeIn", false);
             }
             if (!isset_reportico_session_param("firstTimeIn")) {
                 set_reportico_session_param("firstTimeIn", true);
             }
             // Default output to HTML in PREPARE mode first time in
             if (get_reportico_session_param("firstTimeIn") && !isset($_REQUEST["target_format"])) {
                 $this->target_format = "HTML";
                 set_reportico_session_param("target_format", "HTML");
             }
             // Default style to TABLE in PREPARE mode first time in
             //if ( get_reportico_session_param("firstTimeIn") && !isset($_REQUEST["target_style"]))
             //{
             //$this->target_format = "TABLE";
             //set_reportico_session_param("target_style","TABLE");
             //echo "set table ";
             //}
             break;
         case "EXECUTE":
             // If external page has supplied an initial output format then use it
             if ($this->initial_output_format) {
                 $_REQUEST["target_format"] = $this->initial_output_format;
             }
             // If printable HTML requested force output type to HTML
             if (get_request_item("printable_html")) {
                 $_REQUEST["target_format"] = "HTML";
             }
             // Prompt user for report destination if target not already set - default to HTML if not set
             if (!array_key_exists("target_format", $_REQUEST) && $mode == "EXECUTE") {
                 $_REQUEST["target_format"] = "HTML";
             }
             $this->target_format = strtoupper($_REQUEST["target_format"]);
             if (array_key_exists("submit", $_REQUEST)) {
                 $this->first_criteria_selection = false;
             } else {
                 $this->first_criteria_selection = true;
             }
             if (get_reportico_session_param("awaiting_initial_defaults")) {
                 set_reportico_session_param("firstTimeIn", true);
             } else {
                 if (get_reportico_session_param("firstTimeIn") && get_request_item("refreshReport", false)) {
                     set_reportico_session_param("firstTimeIn", true);
                 } else {
                     set_reportico_session_param("firstTimeIn", false);
                 }
             }
             break;
         case "MAINTAIN":
             $this->report_progress("Ready", "READY");
             $this->first_criteria_selection = true;
             set_reportico_session_param("firstTimeIn", true);
             break;
         default:
             //$this->report_progress("Ready", "READY" );
             $this->first_criteria_selection = true;
             set_reportico_session_param("firstTimeIn", true);
             break;
     }
     // If xml file is used to genearate the reportico_query, either by the xmlin session variable
     // or the xmlin request variable then process this before executing
     if ($mode == "EXECUTE") {
         $_REQUEST['execute_mode'] = "{$mode}";
         // If executing report then stored the REQUEST parameters unless this
         // is a refresh of the report in which case we want to keep the ones already there
         $runfromcriteriascreen = get_request_item("user_criteria_entered", false);
         $refreshmode = get_request_item("refreshReport", false);
         if (!get_request_item("printable_html") && ($runfromcriteriascreen || (!isset_reportico_session_param('latestRequest') || !get_reportico_session_param('latestRequest')))) {
             set_reportico_session_param('latestRequest', $_REQUEST);
         } else {
             if (!$runfromcriteriascreen && $refreshmode) {
                 $_REQUEST = get_reportico_session_param('latestRequest');
             }
         }
     } else {
         if ($mode != "MODIFY" && array_key_exists('latestRequest', $_SESSION[reportico_namespace()])) {
             if (get_reportico_session_param('latestRequest')) {
                 $OLD_REQUEST = $_REQUEST;
                 // If a new report is being run dont bother trying to restore previous
                 // run crtieria
                 if (!get_request_item("xmlin")) {
                     $_REQUEST = get_reportico_session_param('latestRequest');
                 }
                 foreach ($OLD_REQUEST as $k => $v) {
                     if ($k == 'partial_template') {
                         $_REQUEST[$k] = $v;
                     }
                     if (preg_match("/^EXPAND_/", $k)) {
                         $_REQUEST[$k] = $v;
                     }
                 }
                 $_REQUEST['execute_mode'] = "{$mode}";
             }
         }
         set_reportico_session_param('latestRequest', "");
     }
     // Derive URL call of the calling script so it can be recalled in form actions when not running in AJAX mode
     if (!$this->url_path_to_calling_script) {
         $this->url_path_to_calling_script = $_SERVER["SCRIPT_NAME"];
     }
     // Work out we are in AJAX mode
     $this->derive_ajax_operation();
     switch ($mode) {
         case "MODIFY":
             require_once "swmodify.php";
             $this->initialize_panels($mode);
             $engine = new reportico_db_engine($this->datasource->ado_connection->_connectionID);
             $status = $engine->perform_project_modifications($g_project);
             if ($status["errstat"] != 0) {
                 header("HTTP/1.0 404 Not Found", true);
             }
             echo json_encode($status);
             die;
         case "ADMIN":
             $txt = "";
             $this->handle_xml_query_input($mode);
             $this->build_admin_screen();
             $text = $this->panels["BODY"]->draw_smarty();
             $this->panels["MAIN"]->smarty->debugging = false;
             $this->panels["MAIN"]->smarty->assign('LANGUAGES', available_languages());
             $this->panels["MAIN"]->smarty->assign('CONTENT', $txt);
             restore_error_handler();
             if ($this->user_template) {
                 $this->panels["MAIN"]->smarty->display($this->user_template . '_admin.tpl');
             } else {
                 $this->panels["MAIN"]->smarty->display('admin.tpl');
             }
             $old_error_handler = set_error_handler("ErrorHandler");
             break;
         case "MENU":
             $this->handle_xml_query_input($mode);
             $this->build_menu();
             load_mode_language_pack("languages", $this->output_charset);
             load_mode_language_pack("menu", $this->output_charset);
             localise_template_strings($this->panels["MAIN"]->smarty);
             $text = $this->panels["BODY"]->draw_smarty();
             $this->panels["MAIN"]->smarty->debugging = false;
             $this->panels["MAIN"]->smarty->assign('CONTENT', $text);
             $this->panels["MAIN"]->smarty->assign('LANGUAGES', available_languages());
             restore_error_handler();
             if ($this->user_template) {
                 $this->panels["MAIN"]->smarty->display($this->user_template . '_menu.tpl');
             } else {
                 $this->panels["MAIN"]->smarty->display('menu.tpl');
             }
             $old_error_handler = set_error_handler("ErrorHandler");
             break;
         case "PREPARE":
             load_mode_language_pack("languages", $this->output_charset);
             $this->initialize_panels($mode);
             $this->handle_xml_query_input($mode);
             $this->set_request_columns();
             global $g_translations;
             global $g_report_desc;
             if ($this->xmlinput == "deleteproject.xml" || $this->xmlinput == "configureproject.xml" || $this->xmlinput == "createtutorials.xml" || $this->xmlinput == "createproject.xml") {
                 // If configuring project then use project language strings from admin project
                 // found in projects/admin/lang.php
                 load_project_language_pack("admin", $this->output_charset);
             }
             load_mode_language_pack("prepare", $this->output_charset);
             localise_template_strings($this->panels["MAIN"]->smarty);
             $text = $this->panels["BODY"]->draw_smarty();
             $this->panels["MAIN"]->smarty->debugging = false;
             $this->panels["MAIN"]->smarty->assign('CONTENT', $text);
             $reportname = preg_replace("/.xml/", "", $this->xmloutfile . '_prepare.tpl');
             restore_error_handler();
             if (preg_match("/{$reportname}/", find_best_location_in_include_path("templates/" . $reportname))) {
                 $this->panels["MAIN"]->smarty->display($reportname);
             } else {
                 if ($this->user_template) {
                     $this->panels["MAIN"]->smarty->display($this->user_template . '_prepare.tpl');
                 } else {
                     $this->panels["MAIN"]->smarty->display('prepare.tpl');
                 }
             }
             $old_error_handler = set_error_handler("ErrorHandler");
             break;
         case "EXECUTE":
             load_mode_language_pack("languages", $this->output_charset);
             $this->initialize_panels($mode);
             $this->handle_xml_query_input($mode);
             // Set Grid display options based on report and session defaults
             if ($this->attributes["gridDisplay"] != ".DEFAULT") {
                 $this->dynamic_grids = $this->attributes["gridDisplay"] == "show";
             }
             if ($this->attributes["gridSortable"] != ".DEFAULT") {
                 $this->dynamic_grids_sortable = $this->attributes["gridSortable"] == "yes";
             }
             if ($this->attributes["gridSearchable"] != ".DEFAULT") {
                 $this->dynamic_grids_searchable = $this->attributes["gridSearchable"] == "yes";
             }
             if ($this->attributes["gridPageable"] != ".DEFAULT") {
                 $this->dynamic_grids_paging = $this->attributes["gridPageable"] == "yes";
             }
             if ($this->attributes["gridPageSize"] != ".DEFAULT" && $this->attributes["gridPageSize"]) {
                 $this->dynamic_grids_page_size = $this->attributes["gridPageSize"];
             }
             $this->panels["MAIN"]->smarty->assign('REPORTICO_DYNAMIC_GRIDS', $this->dynamic_grids);
             $this->panels["MAIN"]->smarty->assign('REPORTICO_DYNAMIC_GRIDS_SORTABLE', $this->dynamic_grids_sortable);
             $this->panels["MAIN"]->smarty->assign('REPORTICO_DYNAMIC_GRIDS_SEARCHABLE', $this->dynamic_grids_searchable);
             $this->panels["MAIN"]->smarty->assign('REPORTICO_DYNAMIC_GRIDS_PAGING', $this->dynamic_grids_paging);
             $this->panels["MAIN"]->smarty->assign('REPORTICO_DYNAMIC_GRIDS_PAGE_SIZE', $this->dynamic_grids_page_size);
             $g_code_area = "Main Query";
             $this->build_query(false, "");
             $g_code_area = false;
             load_mode_language_pack("execute", $this->output_charset);
             localise_template_strings($this->panels["MAIN"]->smarty);
             if ($this->xmlinput == "deleteproject.xml" || $this->xmlinput == "configureproject.xml" || $this->xmlinput == "createtutorials.xml" || $this->xmlinput == "createproject.xml") {
                 // If configuring project then use project language strings from admin project
                 // found in projects/admin/lang.php
                 load_project_language_pack("admin", $this->output_charset);
             }
             if (!get_reportico_session_param("loggedin", false)) {
                 $text = "you are not logged in ";
             } else {
                 $text = $this->execute_query(false);
             }
             if ($this->target_format == "SOAP") {
                 close_reportico_session();
                 return;
             }
             // Situtations where we dont want to swithc results page - no data found, debug mode, not logged in
             if (count($g_system_errors) > 0 || $g_debug_mode || count($g_system_debug) > 0 || !get_reportico_session_param("loggedin")) {
                 // If errors and this is an ajax request return json ajax response for first message
                 $runfromcriteriascreen = get_request_item("user_criteria_entered", false);
                 global $g_no_data;
                 if ($g_no_data && get_request_item("new_reportico_window", false) && !$g_debug_mode && $this->target_format == "HTML" && $runfromcriteriascreen && $this->reportico_ajax_mode && count($g_system_errors) == 1) {
                     header("HTTP/1.0 404 Not Found", true);
                     $response_array = array();
                     $response_array["errno"] = $g_system_errors[0]["errno"];
                     $response_array["errmsg"] = $g_system_errors[0]["errstr"];
                     echo json_encode($response_array);
                     die;
                 }
                 $this->initialize_panels("PREPARE");
                 $this->set_request_columns();
                 $text = $this->panels["BODY"]->draw_smarty();
                 $this->panels["MAIN"]->smarty->debugging = false;
                 $title = sw_translate($this->derive_attribute("ReportTitle", "Unknown"));
                 $this->panels["MAIN"]->smarty->assign('TITLE', $title);
                 $this->panels["MAIN"]->smarty->assign('CONTENT', $text);
                 load_mode_language_pack("languages", $this->output_charset, true);
                 load_mode_language_pack("prepare", $this->output_charset);
                 localise_template_strings($this->panels["MAIN"]->smarty);
                 $reportname = preg_replace("/.xml/", "", $this->xmloutfile . '_prepare.tpl');
                 restore_error_handler();
                 if (preg_match("/{$reportname}/", find_best_location_in_include_path("templates/" . $reportname))) {
                     $this->panels["MAIN"]->smarty->display($reportname);
                 } else {
                     if ($this->user_template) {
                         $this->panels["MAIN"]->smarty->display($this->user_template . '_prepare.tpl');
                     } else {
                         $this->panels["MAIN"]->smarty->display('prepare.tpl');
                     }
                 }
                 $old_error_handler = set_error_handler("ErrorHandler");
             } else {
                 if ($this->target_format != "HTML") {
                     if ($draw) {
                         echo $text;
                     }
                 } else {
                     $title = sw_translate($this->derive_attribute("ReportTitle", "Unknown"));
                     $pagestyle = $this->targets[0]->get_style_tags($this->output_reportbody_styles);
                     $this->panels["MAIN"]->smarty->assign('REPORT_PAGE_STYLE', $pagestyle);
                     $this->panels["MAIN"]->smarty->assign('TITLE', $title);
                     $this->panels["MAIN"]->smarty->assign('CONTENT', $text);
                     $this->panels["MAIN"]->smarty->assign('EMBEDDED_REPORT', $this->embedded_report);
                     // When printing in separate html window make sure we dont treat report as embedded
                     if (get_request_item("new_reportico_window", false)) {
                         $this->panels["MAIN"]->smarty->assign('EMBEDDED_REPORT', false);
                     }
                     if ($this->email_recipients) {
                         $recipients = explode(',', $this->email_recipients);
                         foreach ($recipients as $rec) {
                             load_mode_language_pack("languages", $this->output_charset, true);
                             load_mode_language_pack("execute", $this->output_charset);
                             localise_template_strings($this->panels["MAIN"]->smarty);
                             $mailtext = $this->panels["MAIN"]->smarty->fetch('execute.tpl', NULL, NULL, false);
                             //$boundary = '-----=' . md5( uniqid ( rand() ) );
                             //$message = "Content-Type: text/html; name=\"my attachment\"\n";
                             //$message .= "Content-Transfer-Encoding: base64\n";
                             //$message .= "Content-Transfer-Encoding: quoted-printable\n";
                             //$message .= "Content-Disposition: attachment; filename=\"report.html\"\n\n";
                             $content_encode = chunk_split(base64_encode($mailtext));
                             $message = $mailtext . "\n";
                             //$message .= $boundary . "\n";
                             $headers = "From: \"Report Admin\"<*****@*****.**>\n";
                             $headers .= "MIME-Version: 1.0\n";
                             $headers .= "Content-Transfer-Encoding: base64\n";
                             //$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"";
                             $headers = "Content-Type: text/html\n";
                             mail($rec, "{$title}", $message, $headers);
                         }
                     } else {
                         load_mode_language_pack("languages", $this->output_charset, true);
                         load_mode_language_pack("execute", $this->output_charset);
                         localise_template_strings($this->panels["MAIN"]->smarty);
                         $reportname = preg_replace("/.xml/", "", $this->xmloutfile . '_execute.tpl');
                         restore_error_handler();
                         if (preg_match("/{$reportname}/", find_best_location_in_include_path("templates/" . $reportname))) {
                             $this->panels["MAIN"]->smarty->display($reportname);
                         } else {
                             if ($this->user_template) {
                                 $this->panels["MAIN"]->smarty->display($this->user_template . '_execute.tpl');
                             } else {
                                 $this->panels["MAIN"]->smarty->display('execute.tpl');
                             }
                         }
                         $old_error_handler = set_error_handler("ErrorHandler");
                     }
                 }
             }
             break;
         case "MAINTAIN":
             $this->handle_xml_query_input($mode);
             if ($this->top_level_query) {
                 $this->initialize_panels($mode);
                 load_mode_language_pack("maintain", $this->output_charset);
                 localise_template_strings($this->panels["MAIN"]->smarty);
                 $this->xmlin->handle_user_entry();
                 set_reportico_session_param("xmlintext", $this->xmlintext);
                 $text = $this->panels["BODY"]->draw_smarty();
                 $this->panels["MAIN"]->smarty->assign('CONTENT', $text);
                 $this->panels["MAIN"]->smarty->display('maintain.tpl');
             } else {
                 $this->premaintain_query();
             }
             break;
         case "XMLOUT":
             $this->handle_xml_query_input($mode);
             $this->xmlout = new reportico_xml_writer($this);
             $this->xmlout->prepare_xml_data();
             if (array_key_exists("xmlout", $_REQUEST)) {
                 $this->xmlout->write_file($_REQUEST["xmlout"]);
             } else {
                 $this->xmlout->write();
             }
             break;
         case "XMLSHOW":
             $this->handle_xml_query_input($mode);
             $this->xmlout = new reportico_xml_writer($this);
             $this->xmlout->prepare_xml_data();
             $this->xmlout->write();
             break;
         case "WSDLSHOW":
             $this->handle_xml_query_input($mode);
             $this->xmlout = new reportico_xml_writer($this);
             $this->xmlout->prepare_wsdl_data();
             break;
         case "SOAPSAVE":
             $this->handle_xml_query_input($mode);
             $this->xmlout = new reportico_xml_writer($this);
             $this->xmlout->generate_web_service($this->xmloutfile);
             break;
     }
     $this->handled_initial_settings();
     close_reportico_session();
 }
 function generate_url_params($target_format, $session_placeholder = false)
 {
     $this->apply_defaults();
     $result = "";
     $url = "";
     $url .= "title=" . $this->convert_special_chars($this->title_actual);
     $url .= "&xtitle=" . $this->convert_special_chars($this->xtitle_actual);
     $url .= "&ytitle=" . $this->convert_special_chars($this->ytitle_actual);
     if ($target_format == "PDF") {
         $url .= "&width=" . $this->width_pdf_actual;
         $url .= "&height=" . $this->height_pdf_actual;
     } else {
         $url .= "&width=" . $this->width_actual;
         $url .= "&height=" . $this->height_actual;
     }
     $url .= "&graphcolor=" . $this->graphcolor_actual;
     $url .= "&gridposition=" . $this->gridpos_actual;
     $url .= "&xgriddisplay=" . $this->xgriddisplay_actual;
     $url .= "&xgridcolor=" . $this->xgridcolor_actual;
     $url .= "&ygriddisplay=" . $this->ygriddisplay_actual;
     $url .= "&ygridcolor=" . $this->ygridcolor_actual;
     $url .= "&titlefont=" . $this->titlefont_actual;
     $url .= "&titlefontstyle=" . $this->titlefontstyle_actual;
     $url .= "&titlefontsize=" . $this->titlefontsize_actual;
     $url .= "&titlecolor=" . $this->titlecolor_actual;
     $url .= "&xaxiscolor=" . $this->xaxiscolor_actual;
     $url .= "&xaxisfont=" . $this->xaxisfont_actual;
     $url .= "&xaxisfontstyle=" . $this->xaxisfontstyle_actual;
     $url .= "&xaxisfontsize=" . $this->xaxisfontsize_actual;
     $url .= "&xaxisfontcolor=" . $this->xaxisfontcolor_actual;
     $url .= "&yaxiscolor=" . $this->yaxiscolor_actual;
     $url .= "&yaxisfont=" . $this->yaxisfont_actual;
     $url .= "&yaxisfontstyle=" . $this->yaxisfontstyle_actual;
     $url .= "&yaxisfontsize=" . $this->yaxisfontsize_actual;
     $url .= "&yaxisfontcolor=" . $this->yaxisfontcolor_actual;
     $url .= "&xtitlefont=" . $this->xtitlefont_actual;
     $url .= "&xtitlefontstyle=" . $this->xtitlefontstyle_actual;
     $url .= "&xtitlefontsize=" . $this->xtitlefontsize_actual;
     $url .= "&xtitlecolor=" . $this->xtitlecolor_actual;
     $url .= "&xtickint=" . $this->xtickinterval_actual;
     $url .= "&xticklabint=" . $this->xticklabelinterval_actual;
     $url .= "&ytitlefont=" . $this->ytitlefont_actual;
     $url .= "&ytitlefontstyle=" . $this->ytitlefontstyle_actual;
     $url .= "&ytitlefontsize=" . $this->ytitlefontsize_actual;
     $url .= "&ytitlecolor=" . $this->ytitlecolor_actual;
     $url .= "&ytickint=" . $this->ytickinterval_actual;
     $url .= "&yticklabint=" . $this->yticklabelinterval_actual;
     $url .= "&margincolor=" . $this->margincolor_actual;
     $url .= "&marginleft=" . $this->marginleft_actual;
     $url .= "&marginright=" . $this->marginright_actual;
     $url .= "&margintop=" . $this->margintop_actual;
     $url .= "&marginbottom=" . $this->marginbottom_actual;
     $url .= "&xlabels=" . implode(",", $this->xlabels);
     foreach ($this->plot as $k => $v) {
         $str = implode(",", $v["data"]);
         $url .= "&plotname{$k}=" . $v["name"];
         $url .= "&plotdata{$k}={$str}";
         $url .= "&plottype{$k}=" . $v["type"];
         $url .= "&plotlinecolor{$k}=" . $v["linecolor"];
         if ($v["legend"]) {
             $url .= "&plotlegend{$k}=" . $v["legend"];
         }
         if ($v["fillcolor"]) {
             $url .= "&plotfillcolor{$k}=" . $v["fillcolor"];
         }
     }
     if ($session_placeholder) {
         $ses = "graph_" . $session_placeholder;
         set_reportico_session_param($ses, $url);
         $url = "graphid=" . $ses . "&time=" . time();
     }
     // Select the appropriate reporting engine
     $dyngraph = "dyngraph.php";
     if (defined("SW_GRAPH_ENGINE") && SW_GRAPH_ENGINE == "PCHART") {
         $dyngraph = "dyngraph_pchart.php";
     }
     if (!is_file($dyngraph)) {
         find_file_to_include($dyngraph, $dyngraph);
         $dyngraph = get_relative_path(realpath($dyngraph), dirname($_SERVER["SCRIPT_FILENAME"]));
     }
     $dr = get_reportico_url_path();
     $result = '<img class="swRepGraph" src=\'' . $dr . $dyngraph . '?' . $url . '\'>';
     return $result;
 }
Example #6
0
function register_session_param($param, $value)
{
    if (!isset_reportico_session_param($param)) {
        set_reportico_session_param($param, $value);
    }
    return get_reportico_session_param($param);
}
Example #7
0
 function handle_user_entry()
 {
     // First look for a parameter beginning "submit_". This will identify
     // What the user wanted to do.
     $hide_area = false;
     $show_area = false;
     $maintain_sql = false;
     $xmlsavefile = false;
     $xmldeletefile = false;
     if ($k = $this->get_matching_post_item("/^submit_/")) {
         // Strip off "_submit"
         preg_match("/^submit_(.*)/", $k, $match);
         // Now we should be left with a field element and an action
         // Lets strip the two
         $match1 = preg_split('/_/', $match[0]);
         $fld = $match1[1];
         $action = $match1[2];
         switch ($action) {
             case "ADD":
                 // We have chosen to set a block of data so pass through Request set and see which
                 // fields belong to this set and take appropriate action
                 $this->add_maintain_fields($fld);
                 $show_area = $fld;
                 break;
             case "DELETE":
                 // We have chosen to set a block of data so pass through Request set and see which
                 // fields belong to this set and take appropriate action
                 $this->delete_maintain_fields($fld);
                 $show_area = $fld;
                 break;
             case "MOVEUP":
                 // We have chosen to set a block of data so pass through Request set and see which
                 // fields belong to this set and take appropriate action
                 $this->moveup_maintain_fields($fld);
                 $show_area = $fld;
                 break;
             case "MOVEDOWN":
                 // We have chosen to set a block of data so pass through Request set and see which
                 // fields belong to this set and take appropriate action
                 $this->movedown_maintain_fields($fld);
                 $show_area = $fld;
                 break;
             case "SET":
                 // We have chosen to set a block of data so pass through Request set and see which
                 // fields belong to this set and take appropriate action
                 $this->update_maintain_fields($fld);
                 $show_area = $fld;
                 break;
             case "REPORTLINK":
             case "REPORTLINKITEM":
                 // Link in an item from another report
                 $this->link_in_report_fields("link", $fld, $action);
                 $show_area = $fld;
                 break;
             case "REPORTIMPORT":
             case "REPORTIMPORTITEM":
                 // Link in an item from another report
                 $this->link_in_report_fields("import", $fld, $action);
                 $show_area = $fld;
                 break;
             case "SAVE":
                 $xmlsavefile = $this->query->xmloutfile;
                 if (!$xmlsavefile) {
                     trigger_error(template_xlate("UNABLE_TO_SAVE") . template_xlate("SPECIFYXML"), E_USER_ERROR);
                 }
                 break;
             case "DELETEREPORT":
                 $xmldeletefile = $this->query->xmloutfile;
                 break;
             case "HIDE":
                 $hide_area = $fld;
                 break;
             case "SHOW":
                 $show_area = $fld;
                 break;
             case "SQL":
                 $show_area = $fld;
                 if ($fld == "mainquerqury") {
                     // Main Query SQL Generation.
                     $sql = stripslashes($_REQUEST["mainquerqury_SQL"]);
                     $maintain_sql = $sql;
                     if ($this->query->login_check()) {
                         $p = new reportico_sql_parser($sql);
                         if ($p->parse()) {
                             $p->import_into_query($qr);
                             if ($this->query->datasource->connect()) {
                                 $p->test_query($this->query, $sql);
                             }
                         }
                     }
                 } else {
                     // It's a lookup
                     if (preg_match("/mainquercrit(.*)qury/", $fld, $match1)) {
                         $lookup = (int) $match1[1];
                         $lookup_char = $match1[1];
                         // Access the relevant crtieria item ..
                         $qc = false;
                         $ak = array_keys($this->query->lookup_queries);
                         if (array_key_exists($lookup, $ak)) {
                             $q = $this->query->lookup_queries[$ak[$lookup]]->lookup_query;
                         } else {
                             $q = new reportico();
                         }
                         // Parse the entered SQL
                         $sqlparm = $fld . "_SQL";
                         $sql = $_REQUEST[$sqlparm];
                         $q->maintain_sql = $sql;
                         $q = new reportico();
                         $p = new reportico_sql_parser($sql);
                         if ($p->parse()) {
                             if ($p->test_query($this->query, $sql)) {
                                 $p->import_into_query($q);
                                 $this->query->set_criteria_lookup($ak[$lookup], $q, "WHAT", "NOW");
                             }
                         }
                     }
                 }
                 break;
         }
     }
     // Now work out what the maintainance screen should be showing by analysing
     // whether user pressed a SHOW button a HIDE button or keeps a maintenance item
     // show by presence of a shown value
     if (!$show_area) {
         // User has not pressed SHOW_ button - this would have been picked up in previous submit
         // So look for longest shown item - this will allow us to draw the maintenace screen with
         // the correct item maximised
         foreach ($_REQUEST as $k => $req) {
             if (preg_match("/^shown_(.*)/", $k, $match)) {
                 $containee = "/^" . $hide_area . "/";
                 $container = $match[1];
                 if (!preg_match($containee, $container)) {
                     if (strlen($match[1]) > strlen($show_area)) {
                         $show_area = $match[1];
                     }
                 }
             }
         }
     }
     if (!$show_area) {
         $show_area = "mainquer";
     }
     $xmlout = new reportico_xml_writer($this->query);
     $xmlout->prepare_xml_data();
     // If Save option has been used then write data to the named file and
     // use this file as the defalt input for future queries
     if ($xmlsavefile) {
         if ($this->query->allow_maintain != "SAFE" && $this->query->allow_maintain != "DEMO" && SW_ALLOW_MAINTAIN) {
             $xmlout->write_file($xmlsavefile);
             set_reportico_session_param("xmlin", $xmlsavefile);
             unset_reportico_session_param("xmlintext");
         } else {
             trigger_error(template_xlate("SAFENOSAVE"), E_USER_ERROR);
         }
     }
     // If Delete Report option has been used then remove the file
     // use this file as the defalt input for future queries
     if ($xmldeletefile) {
         if ($this->query->allow_maintain != "SAFE" && $this->query->allow_maintain != "DEMO" && SW_ALLOW_MAINTAIN) {
             $xmlout->remove_file($xmldeletefile);
             set_reportico_session_param("xmlin", false);
             unset_reportico_session_param("xmlintext");
         } else {
             trigger_error(template_xlate("SAFENODEL"), E_USER_ERROR);
         }
     }
     $xml = $xmlout->get_xmldata();
     if ($this->query->top_level_query) {
         $this->query->xmlintext = $xml;
     }
     $this->query->xmlin = new reportico_xml_reader($this->query, false, $xml);
     $this->query->xmlin->show_area = $show_area;
     $this->query->maintain_sql = false;
 }
Example #8
0
 public function login()
 {
     set_reportico_session_param('admin_password', "1");
     global $g_session_namespace_key;
     $_SESSION[$g_session_namespace_key]['admin_password'] = '******';
 }