define('E_INVALID_PARAMETER', 1); TopCodeAdmin(); // DISPLAY GLOBAL SETTINGS MENU /*ContentBlockHead("Global Settings Menu"); display_menu($cat); ContentBlockFoot();*/ ob_start(); // SAVE CHANGES $save_settings = 'yes' == $_POST['save_settings']; if (strlen($cat) > 0) { // Admin password was changed. Try to save it. if (FALSE != $save_settings && 'ap' == $cat) { if ($demo_mode) { echo '<span class="succ">Password can\'t be changed.</span><br />'; } else { $result = save_admin_password($_COOKIE['adminID'], $_POST['pwd_old'], $_POST['pwd_new'], $_POST['pwd_new_confirm']); switch ($result) { case S_OK: // No error. Display message. echo '<span class="succ">Password changed.</span><br />'; break; case E_INVALID_OLD_PASSWORD: echo '<div class="err">Error saving new password: wrong old password!</div><br>'; break; case E_INVALID_PASSWORD_LENGTH: echo '<div class="err">Error saving new password: invalid password length (between 3 and 11 characters).</div><br>'; break; case E_PASSWORD_CONFIRMATION_FAILED: echo '<div class="err">Error saving new passowrd: password not confirmed.</div><br>'; } }
function initialize_panels($mode) { global $g_project; global $g_dropdown_menu; $smarty = new smarty(); $smarty->template_dir = find_best_location_in_include_path("templates"); $smarty->compile_dir = find_best_location_in_include_path("templates_c"); $dummy = ""; $version = "4.0"; $forward_url_params = session_request_item('forward_url_get_parameters', $this->forward_url_get_parameters); $forward_url_params_graph = session_request_item('forward_url_get_parameters_graph', $this->forward_url_get_parameters_graph); $forward_url_params_dbimage = session_request_item('forward_url_get_parameters_dbimage', $this->forward_url_get_parameters_dbimage); $smarty->assign('REPORTICO_VERSION', $version); // Assign user parameters to template if ($this->user_parameters && is_array($this->user_parameters)) { foreach ($this->user_parameters as $k => $v) { $param = preg_replace("/ /", "_", $k); $smarty->assign('USER_' . $param, $v); } } // Smarty needs to include Javascript if AJAX enabled if (!defined('AJAX_ENABLED')) { define('AJAX_ENABLED', true); } $smarty->assign('AJAX_ENABLED', AJAX_ENABLED); // Date format for ui Datepicker global $g_language; $smarty->assign('AJAX_DATEPICKER_LANGUAGE', get_datepicker_language($g_language)); $smarty->assign('AJAX_DATEPICKER_FORMAT', get_datepicker_format(SW_PREP_DATEFORMAT)); $smarty->assign('DB_LOGGEDON', false); $smarty->assign('ADMIN_MENU_URL', false); $smarty->assign('CONFIGURE_MENU_URL', false); $smarty->assign('CREATE_REPORT_URL', false); $smarty->assign('SESSION_ID', reportico_session_name()); // Set smarty variables $smarty->assign('SCRIPT_SELF', $this->url_path_to_calling_script); $smarty->assign('REPORTICO_AJAX_MODE', $this->reportico_ajax_mode); $smarty->assign('REPORTICO_AJAX_CALLED', $this->reportico_ajax_called); if ($this->url_path_to_assets) { $smarty->assign('REPORTICO_URL_DIR', $this->url_path_to_assets); } else { $smarty->assign('REPORTICO_URL_DIR', $this->reportico_url_path); } $smarty->assign('REPORTICO_AJAX_RUNNER', $this->reportico_ajax_script_url); $smarty->assign('PRINTABLE_HTML', false); if (get_request_item("printable_html")) { $smarty->assign('PRINTABLE_HTML', true); } // In frameworks we dont want to load jquery when its intalled once when the module load // so flag this unless specified in new_reportico_window /* $smarty->assign('REPORTICO_STANDALONE_WINDOW', false); $smarty->assign('REPORTICO_AJAX_PRELOADED', $this->reportico_ajax_preloaded); if (get_request_item("new_reportico_window", false)) { $smarty->assign('REPORTICO_AJAX_PRELOADED', false); $smarty->assign('REPORTICO_STANDALONE_WINDOW', true); } */ $smarty->assign('SHOW_LOGOUT', false); $smarty->assign('SHOW_LOGIN', false); $smarty->assign('SHOW_REPORT_MENU', false); $smarty->assign('SHOW_SET_ADMIN_PASSWORD', false); $smarty->assign('SHOW_OUTPUT', false); $smarty->assign('SHOW_DESIGN_BUTTON', false); $smarty->assign('SHOW_ADMIN_BUTTON', true); $smarty->assign('PROJ_PASSWORD_ERROR', ""); $smarty->assign('SHOW_PROJECT_MENU_BUTTON', true); if ($this->access_mode && ($this->access_mode != "DEMO" && $this->access_mode != "FULL" && $this->access_mode != "ALLPROJECTS" && $this->access_mode != "ONEPROJECT")) { $smarty->assign('SHOW_PROJECT_MENU_BUTTON', false); } $smarty->assign('SHOW_EXPAND', false); $smarty->assign('SHOW_CRITERIA', false); $smarty->assign('SHOW_EXPANDED', false); $smarty->assign('SHOW_MODE_MAINTAIN_BOX', false); $smarty->assign('STATUSMSG', ''); $smarty->assign('ERRORMSG', false); $smarty->assign('SET_ADMIN_PASSWORD_INFO', ''); $smarty->assign('SET_ADMIN_PASSWORD_ERROR', ''); $smarty->assign('ADMIN_PASSWORD_ERROR', ''); $smarty->assign('PASSWORD_ERROR', ''); $smarty->assign('DEMO_MODE', false); $smarty->assign('DROPDOWN_MENU_ITEMS', false); // Dont allow admin menu buttons to show in demo mode if ($this->allow_maintain == "DEMO") { $smarty->assign('DEMO_MODE', true); $smarty->assign('SHOW_ADMIN_BUTTON', false); } if (!$this->admin_accessible) { $smarty->assign('SHOW_ADMIN_BUTTON', false); } // Dont show admin button if ($this->access_mode && ($this->access_mode != "DEMO" && $this->access_mode != "FULL" && $this->access_mode != "ALLPROJECTS")) { $smarty->assign('SHOW_ADMIN_BUTTON', false); } $partialajaxpath = find_best_location_in_include_path("partial.php"); $smarty->assign('AJAX_PARTIAL_RUNNER', $this->reportico_url_path . $partialajaxpath); // Use alternative location for js/css/images if specified. // Set stylesheet to the reportico bootstrap if bootstrap styles in place $this->bootstrap_styles = register_session_param("bootstrap_styles", $this->bootstrap_styles); $this->url_path_to_assets = register_session_param("url_path_to_assets", $this->url_path_to_assets); $this->jquery_preloaded = register_session_param("jquery_preloaded", $this->jquery_preloaded); $this->bootstrap_preloaded = register_session_param("bootstrap_preloaded", $this->bootstrap_preloaded); if (!$this->bootstrap_styles) { $csspath = $this->url_path_to_assets . "/css/reportico.css"; if ($this->url_path_to_assets) { $csspath = $this->url_path_to_assets . "/css/reportico.css"; } else { $csspath = $this->reportico_url_path . "/" . find_best_url_in_include_path("/css/reportico.css"); } } else { if ($this->url_path_to_assets) { $csspath = $this->url_path_to_assets . "/css/reportico_bootstrap.css"; } else { $csspath = $this->reportico_url_path . "/" . find_best_url_in_include_path("css/reportico_bootstrap.css"); } } $smarty->assign('STYLESHEET', $csspath); $smarty->assign('STYLESHEETDIR', dirname($csspath)); $smarty->assign('REPORTICO_JQUERY_PRELOADED', $this->jquery_preloaded); $smarty->assign('BOOTSTRAP_STYLES', $this->bootstrap_styles); $smarty->assign('REPORTICO_BOOTSTRAP_PRELOADED', $this->bootstrap_preloaded); $smarty->assign('BOOTSTRAP_STYLE_GO_BUTTON', $this->getBootstrapStyle('button_go')); $smarty->assign('BOOTSTRAP_STYLE_RESET_BUTTON', $this->getBootstrapStyle('button_reset')); $smarty->assign('BOOTSTRAP_STYLE_ADMIN_BUTTON', $this->getBootstrapStyle('button_admin')); $smarty->assign('BOOTSTRAP_STYLE_DROPDOWN', $this->getBootstrapStyle('dropdown')); $smarty->assign('BOOTSTRAP_STYLE_CHECKBOX_BUTTON', $this->getBootstrapStyle('checkbox_button')); $smarty->assign('BOOTSTRAP_STYLE_CHECKBOX', $this->getBootstrapStyle('checkbox')); $smarty->assign('BOOTSTRAP_STYLE_TOOLBAR_BUTTON', $this->getBootstrapStyle('toolbar_button')); $smarty->assign('BOOTSTRAP_STYLE_MENU_TABLE', $this->getBootstrapStyle('menu_table')); $smarty->assign('BOOTSTRAP_STYLE_TEXTFIELD', $this->getBootstrapStyle('textfield')); $smarty->assign('BOOTSTRAP_STYLE_SMALL_BUTTON', $this->getBootstrapStyle('small_button')); // Set charting engine $smarty->assign('REPORTICO_CHARTING_ENGINE', $this->charting_engine_html); // Set on/off template elements foreach ($this->output_template_parameters as $k => $v) { $smarty->assign(strtoupper($k), $v); } if ($this->url_path_to_assets) { $jspath = $this->url_path_to_assets . "/js"; $smarty->assign('JSPATH', $jspath); } else { $jspath = find_best_url_in_include_path("js/reportico.js"); if ($jspath) { $jspath = dirname($jspath); } $smarty->assign('JSPATH', $this->reportico_url_path . $jspath); } $this->panels["MAIN"] = new reportico_panel($this, "MAIN"); $this->panels["MAIN"]->set_smarty($smarty); $this->panels["BODY"] = new reportico_panel($this, "BODY"); $this->panels["TITLE"] = new reportico_panel($this, "TITLE"); $this->panels["TOPMENU"] = new reportico_panel($this, "TOPMENU"); $this->panels["MENUBUTTON"] = new reportico_panel($this, "MENUBUTTON"); $this->panels["LOGIN"] = new reportico_panel($this, "LOGIN"); $this->panels["SET_ADMIN_PASSWORD"] = new reportico_panel($this, "SET_ADMIN_PASSWORD"); $this->panels["LOGOUT"] = new reportico_panel($this, "LOGOUT"); $this->panels["FORM"] = new reportico_panel($this, "FORM"); $this->panels["MENU"] = new reportico_panel($this, "MENU"); $this->panels["ADMIN"] = new reportico_panel($this, "ADMIN"); $this->panels["USERINFO"] = new reportico_panel($this, "USERINFO"); $this->panels["RUNMODE"] = new reportico_panel($this, "RUNMODE"); $this->panels["PREPARE"] = new reportico_panel($this, "PREPARE"); $this->panels["CRITERIA"] = new reportico_panel($this, "CRITERIA"); $this->panels["CRITERIA_FORM"] = new reportico_panel($this, "CRITERIA_FORM"); $this->panels["CRITERIA_EXPAND"] = new reportico_panel($this, "CRITERIA_EXPAND"); $this->panels["MAINTAIN"] = new reportico_panel($this, "MAINTAIN"); $this->panels["REPORT"] = new reportico_panel($this, "REPORT"); $this->panels["DESTINATION"] = new reportico_panel($this, "DESTINATION"); $this->panels["EXECUTE"] = new reportico_panel($this, "EXECUTE"); $this->panels["STATUS"] = new reportico_panel($this, "STATUS"); $this->panels["ERROR"] = new reportico_panel($this, "ERROR"); // Identify which panels are visible by default $this->panels["MAIN"]->set_visibility(true); $this->panels["BODY"]->set_visibility(true); $this->panels["TITLE"]->set_visibility(true); $this->panels["TOPMENU"]->set_visibility(true); $this->panels["STATUS"]->set_visibility(true); $this->panels["ERROR"]->set_visibility(true); // Set up a default panel hierarchy $this->panels["MAIN"]->add_panel($this->panels["BODY"]); $this->panels["BODY"]->add_panel($this->panels["TITLE"]); $this->panels["BODY"]->add_panel($this->panels["TOPMENU"]); $this->panels["BODY"]->add_panel($this->panels["FORM"]); $this->panels["BODY"]->add_panel($this->panels["STATUS"]); $this->panels["BODY"]->add_panel($this->panels["ERROR"]); $this->panels["FORM"]->add_panel($this->panels["CRITERIA"]); $this->panels["FORM"]->add_panel($this->panels["MAINTAIN"]); $this->panels["FORM"]->add_panel($this->panels["REPORT"]); $this->panels["FORM"]->add_panel($this->panels["MENU"]); $this->panels["FORM"]->add_panel($this->panels["ADMIN"]); $this->panels["CRITERIA"]->add_panel($this->panels["CRITERIA_FORM"]); $this->panels["CRITERIA"]->add_panel($this->panels["CRITERIA_EXPAND"]); $this->panels["CRITERIA"]->add_panel($this->panels["DESTINATION"]); $this->panels["BODY"]->add_panel($this->panels["REPORT"]); $this->panels["TOPMENU"]->add_panel($this->panels["LOGIN"]); $this->panels["TOPMENU"]->add_panel($this->panels["SET_ADMIN_PASSWORD"]); $this->panels["TOPMENU"]->add_panel($this->panels["USERINFO"]); $this->panels["TOPMENU"]->add_panel($this->panels["MENUBUTTON"]); $this->panels["TOPMENU"]->add_panel($this->panels["RUNMODE"]); $this->panels["TOPMENU"]->add_panel($this->panels["LOGOUT"]); // Store any menu page URL, in ajax mode links go through the general ajax link, otherwise go through calling script $calling_script = $this->get_action_url(); $this->prepare_url = $calling_script . "?execute_mode=PREPARE&reportico_session_name=" . reportico_session_name(); $this->menu_url = $calling_script . "?execute_mode=MENU&reportico_session_name=" . reportico_session_name(); $this->admin_menu_url = $calling_script . "?project=admin&execute_mode=MENU&reportico_session_name=" . reportico_session_name(); $this->configure_project_url = $calling_script . "?execute_mode=PREPARE&xmlin=configureproject.xml&reportico_session_name=" . reportico_session_name(); $this->delete_project_url = $calling_script . "?execute_mode=PREPARE&xmlin=deleteproject.xml&reportico_session_name=" . reportico_session_name(); $this->create_report_url = $calling_script . "?execute_mode=MAINTAIN&xmlin=&reportico_session_name=" . reportico_session_name(); if ($forward_url_params) { $this->prepare_url .= "&" . $forward_url_params; $this->menu_url .= "&" . $forward_url_params; $this->admin_menu_url .= "&" . $forward_url_params; $this->configure_project_url .= "&" . $forward_url_params; $this->delete_project_url .= "&" . $forward_url_params; $this->create_report_url .= "&" . $forward_url_params; } // ***MENUURL ***if (array_key_exists("menu_url", $_SESSION[reportico_namespace()])) // ***MENUURL ***{ // ***MENUURL ***$this->menu_url = get_reportico_session_param("menu_url"); // ***MENUURL ***} // Generate dropdown menu strip in menu or prepare mode if ($g_dropdown_menu && !$this->dropdown_menu) { $this->dropdown_menu = $g_dropdown_menu; } if ($this->dropdown_menu && ($mode == "MENU" || $mode == "PREPARE")) { $this->generate_dropdown_menu($this->dropdown_menu); $smarty->assign('DROPDOWN_MENU_ITEMS', $this->dropdown_menu); } global $g_menu_title; $smarty->assign('MENU_TITLE', $g_menu_title); if ($mode == "MENU") { // Store the URL of thi smenu so it can be referred to // in later screens // ***MENUURL ***$this->menu_url = $_SERVER["PHP_SELF"]; // ***MENUURL ***set_reportico_session_param("menu_url",$this->menu_url); $this->panels["MENU"]->set_visibility(true); //$this->panels["FORM"]->add_panel($this->panels["MENU"]); } if ($mode == "EXECUTE") { $this->panels["REPORT"]->set_visibility(true); //$this->panels["FORM"]->add_panel($this->panels["REPORT"]); } if ($mode == "MAINTAIN") { $this->panels["MAINTAIN"]->set_visibility(true); //$this->panels["FORM"]->add_panel($this->panels["MAINTAIN"]); } if ($mode == "ADMIN") { $this->panels["ADMIN"]->set_visibility(true); $this->panels["MENU"]->set_visibility(true); //$this->panels["FORM"]->add_panel($this->panels["MAINTAIN"]); } if ($mode == "PREPARE") { $this->panels["CRITERIA"]->set_visibility(true); $this->panels["CRITERIA_FORM"]->set_visibility(true); $this->panels["CRITERIA_EXPAND"]->set_visibility(true); $this->panels["DESTINATION"]->set_visibility(true); //$this->panels["FORM"]->add_panel($this->panels["CRITERIA"]); } // Visibility of Login details depends on whether user has provided login // details and also whether those details are valid, so set user name // and password to use for connection and then attempt to connect $this->panels["MENUBUTTON"]->set_visibility(true); $this->panels["LOGIN"]->set_visibility(false); $this->panels["SET_ADMIN_PASSWORD"]->set_visibility(false); $this->panels["LOGOUT"]->set_visibility(true); $this->panels["USERINFO"]->set_visibility(true); $this->panels["RUNMODE"]->set_visibility(true); // If no admin password then force user to enter one and a language if ($g_project == "admin" && SW_ADMIN_PASSWORD == "PROMPT") { $smarty->assign('LANGUAGES', available_languages()); // New Admin password submitted, attempt to set password and go to MENU option if (array_key_exists("submit_admin_password", $_REQUEST)) { $smarty->assign('SET_ADMIN_PASSWORD_ERROR', save_admin_password($_REQUEST["new_admin_password"], $_REQUEST["new_admin_password2"], $_REQUEST["jump_to_language"])); } $this->panels["SET_ADMIN_PASSWORD"]->set_visibility(true); $smarty->assign('SHOW_SET_ADMIN_PASSWORD', true); $this->panels["LOGOUT"]->set_visibility(false); $this->panels["MENU"]->set_visibility(false); $smarty->assign('SHOW_REPORT_MENU', false); if (!defined('SW_ADMIN_PASSWORD_RESET')) { return; } else { $smarty->assign('SHOW_SET_ADMIN_PASSWORD', false); } } set_reportico_session_param("loggedin", true); if ($this->login_check($smarty)) { // User has supplied details ( user and password ), so assume that login box should // not occur ( user details $this->panels["MENUBUTTON"]->set_visibility(true); $this->panels["LOGIN"]->set_visibility(false); $this->panels["SET_ADMIN_PASSWORD"]->set_visibility(false); $this->panels["LOGOUT"]->set_visibility(true); $this->panels["USERINFO"]->set_visibility(true); $this->panels["FORM"]->set_visibility(true); if ($this->login_type == "DESIGN") { $this->panels["RUNMODE"]->set_visibility(true); } else { $this->panels["RUNMODE"]->set_visibility(false); } $smarty->assign('SHOW_REPORT_MENU', true); // Only show a logout button if a password is in effect if ($this->login_type == "DESIGN" || $this->login_type == "ADMIN" || defined('SW_PROJECT_PASSWORD') && SW_PROJECT_PASSWORD != '') { $smarty->assign('SHOW_LOGOUT', true); } // Dont show logout button in ALLPROJECTS, ONE PROJECT if ($this->access_mode && ($this->access_mode != "DEMO" && $this->access_mode != "FULL" && $this->access_mode != "ALLPROJECTS")) { $smarty->assign('SHOW_LOGOUT', false); } if ($mode == "PREPARE" && ($this->xmlinput == "deleteproject.xml" || $this->xmlinput == "configureproject.xml" || $this->xmlinput == "createtutorials.xml")) { // Dont show database errors if displaying Configure Project prepare page as database connectivity could be wrong // and user will correct it } else { if ($this->datasource->connect() || $mode != "MAINTAIN") { // Store connection session details set_reportico_session_param("database", $this->datasource->database); set_reportico_session_param("hostname", $this->datasource->host_name); set_reportico_session_param("driver", $this->datasource->driver); set_reportico_session_param("server", $this->datasource->server); set_reportico_session_param("protocol", $this->datasource->protocol); } else { //echo "not connected okay<br>"; $this->panels["LOGIN"]->set_visibility(true); $this->panels["SET_ADMIN_PASSWORD"]->set_visibility(false); $this->panels["MENUBUTTON"]->set_visibility(false); $this->panels["LOGOUT"]->set_visibility(false); $this->panels["USERINFO"]->set_visibility(false); $this->panels["RUNMODE"]->set_visibility(true); $this->panels["FORM"]->set_visibility(false); $this->panels["STATUS"]->set_visibility(true); $this->panels["ERROR"]->set_visibility(true); } } //echo "done connecting"; } else { // If not logged in then set first criteria entry to true // So when we do get into criteria it will work set_reportico_session_param("firstTimeIn", true); set_reportico_session_param("loggedin", false); $this->panels["LOGIN"]->set_visibility(true); $this->panels["MENUBUTTON"]->set_visibility(true); $this->panels["LOGOUT"]->set_visibility(false); $this->panels["USERINFO"]->set_visibility(false); $this->panels["RUNMODE"]->set_visibility(false); // Dont allow admin design access if access mode is set and not FULL access if ($g_project == "admin") { if ($this->access_mode && $this->access_mode != "FULL") { $this->panels["LOGIN"]->set_visibility(false); } } // We do want to show the "run project" list in admin mode if not logged in if ($g_project == "admin") { $this->panels["FORM"]->set_visibility(true); } else { $this->panels["FORM"]->set_visibility(false); } } }
$smarty->assign("site_title", "Change Password :: Admin Panel :: " . $gConfig['site_title']); $smarty->assign("page_header_text", "Change Password"); ob_start(); define('E_INVALID_OLD_PASSWORD', 1); define('E_PASSWORD_CONFIRMATION_FAILED', 2); define('E_INVALID_PASSWORD_LENGTH', 3); define('S_OK', 0); define('E_INVALID_PARAMETER', 1); // SAVE CHANGES $save_settings = 'yes' == $_POST['save_settings']; // Admin password was changed. Try to save it. if (FALSE != $save_settings) { if ($demo_mode) { echo '<span class="succ">Password can\'t be changed in this demo.</span><br />'; } else { $result = save_admin_password($_SESSION['adminname'], $_POST['pwd_new'], $_POST['pwd_new_confirm']); switch ($result) { case S_OK: // No error. Display message. echo '<span class="succ">Password changed.</span><br />'; break; case E_INVALID_OLD_PASSWORD: echo '<div class="err">Error saving new password: wrong old password!</div><br>'; break; case E_INVALID_PASSWORD_LENGTH: echo '<div class="err">Error saving new password: invalid password length (between 3 and 11 characters).</div><br>'; break; case E_PASSWORD_CONFIRMATION_FAILED: echo '<div class="err">Error saving new passowrd: password not confirmed.</div><br>'; } }