{ $create_butt="<a id=\"admin_sql\" class=\"rnr-button\" onmouseover=\"this.focus();\" name=\"admin_sql\" href=\"#\">"."Custom SQL"."</a>"; $xt->assign("admin_sql", $create_butt); } else $xt->assign("admin_sql",false); if(count($arr_tables_db) || count($arr_tables_project) || count($arr_tables_custom)) { $create_butt="<a id=\"report_createbtn\" class=\"rnr-button\" onmouseover=\"this.focus();\" name=\"report_createbtn\" wtype=\"report\" href=\"#\">"."Create Report"."</a>"; $create_butt.="<a id=\"chart_createbtn\" class=\"rnr-button\" onmouseover=\"this.focus();\" name=\"chart_createbtn\" wtype=\"chart\" href=\"#\">"."Create chart"."</a>"; $xt->assign("create_report_chart", $create_butt); } else { if($wr_is_standalone && !isWRAdmin()) $xt->assign("create_report_chart", "<b>"."You do not have permissions to create reports and charts. Contact administrator in this regard."."</b>"); } if($_SESSION["UserID"]=="Guest" && $wr_is_standalone) $xt->assign("create_report_chart", "<b>"."You do not have permissions to create reports and charts. Contact administrator in this regard."."</b>"); $xt->assign("wr_pagestylepath", $wr_pagestylepath); $xt->assign("shared_reports", $shared_reports); $xt->assign("private_reports", $private_reports); $xt->assign("shared_charts", $shared_charts); $xt->assign("private_charts", $private_charts); $templatefile = GetTemplateName("", "webreport");
$selected=""; if ( !empty( $_SESSION['webreports']['tables'] ) ) if ( in_array( $tbl, $_SESSION['webreports']['tables'] ) ) $selected = "selected"; $b_includes .= "$('<option ".$selected."></option>').attr('value', '".jsreplace($tbl)."').html('".jsreplace(getCaptionTable($tbl)). (getCaptionTable($tbl)!=$tbl ? ' ('.jsreplace($tbl).')' : '' )."').appendTo($('#tables'));"."\r\n"; } $b_includes .= ' } else { $("#li_custom").addClass("selected").addClass("ui-state-selected").addClass("ui-state-active"); $("#add_new_query").show(); $("#tl").html("'."Select SQL query which you will use to create the report:".'"); li_selected="custom";'; if(isWRAdmin() && ($_SESSION['webreports']['tmp_active']=="x" || @$_SESSION['webreports']['settings']['title']=="")) $b_includes .= '$("#add_new_query").show();'; else $b_includes .= '$("#add_new_query").hide();'; $b_includes .= ' NEXT_PAGE_URL = "'.GetTableLink("webreport3").'"; PREV_PAGE_URL = "'.GetTableLink("webreport").'";'; $b_includes .= '$("td[id=row1], td[id=row2]").hide();'."\r\n"; foreach ($arr_tables_custom as $tbl) { if(!$tbl["isStorProc"]) { $selected=""; if ( !empty( $_SESSION['webreports']['tables'] ) ) if ( in_array( $tbl["sqlname"], $_SESSION['webreports']['tables'] ) )
set_magic_quotes_runtime(0); include("include/reportfunctions.php"); //$conn=db_connect(); include('include/xtempl.php'); $xt = new Xtempl(); $gSettings = null; $res_head = ""; $res_body = ""; $res_error = ""; if((!is_wr_custom() || !isWRAdmin() || !postvalue("sql")) && postvalue("sql")!="add") { $type = (postvalue('type') == "webcharts") ? "webcharts" : "webreports"; $b_includes="<script>"; $b_includes.=' $(document).ready(function(){ $("#sql_button").hide(); '; $b_includes.=' $("#sql_name").hide(); $("#check_button").hide(); $("#sql_textarea").attr("readonly","readonly"); }); '; $b_includes.="</script>"; $xt->assign("b_includes", $b_includes);
ini_set("display_errors", "1"); ini_set("display_startup_errors", "1"); include "include/dbcommon.php"; header("Expires: Thu, 01 Jan 1970 00:00:01 GMT"); include "include/reportfunctions.php"; if (postvalue("name") == "password") { if (DecodeUTF8(postvalue("password")) == $WRAdminPagePassword) { $_SESSION["WRAdmin"] = true; echo "OK"; } else { unset($_SESSION["WRAdmin"]); echo "ERROR"; } exit; } if (!isWRAdmin()) { $_SESSION["MyURL"] = $_SERVER["SCRIPT_NAME"] . "?" . $_SERVER["QUERY_STRING"]; header("Location: " . GetTableLink("webreport", "", "message=expired")); return; } // #9875 It's expected that webreport_sql, webreport_admin tables belong to the same db connection $_connection = $cman->getForWebReports(); if (postvalue("name") == "deletesql") { if (postvalue("idsql")) { $_connection->exec("delete from " . $_connection->addTableWrappers("webreport_sql") . " where " . $_connection->addFieldWrappers("id") . "=" . postvalue("idsql")); } echo "OK"; exit; } if (postvalue("name") == "sqledit") { $errstr = "";
foreach ($arr_tables_project as $tbl) { $selected=""; if ( !empty( $root['tables'] ) ) if ( in_array( $tbl, $root['tables'] ) ) $selected = "selected"; $b_includes .= "$('<option ".$selected."></option>').attr('value', '".jsreplace($tbl)."').html('".jsreplace(getCaptionTable($tbl)). (getCaptionTable($tbl)!=$tbl ? ' ('.jsreplace($tbl).')' : '' )."').appendTo($('#tables'));"."\r\n"; } $b_includes .= ' } else {'; if(isWRAdmin() && ($_SESSION['webcharts']['tmp_active']=="x" || $root['settings']['title']=="")) $b_includes .= '$("#add_new_query").show();'; else $b_includes .= '$("#add_new_query").hide();'; $b_includes .= ' li_selected="custom"; $("#li_custom").addClass("selected").addClass("ui-state-selected").addClass("ui-state-active");; $("#tl").html("'."Select SQL query which you will use to create the chart:".'"); NEXT_PAGE_URL = "'.GetTableLink("webchart3").'"; PREV_PAGE_URL = "'.GetTableLink("webreport").'";'; $b_includes .= ' $("td[id=row1], td[id=row2]").hide();'."\r\n"; foreach ($arr_tables_custom as $tbl) { $selected=""; if ( !empty( $root['tables'] ) )