/** * Print cp error function handler * * For admin */ function kleeja_admin_err($msg, $navigation = true, $title = '', $exit = true, $redirect = false, $rs = 5, $style = 'admin_err') { global $text, $tpl, $SHOW_LIST, $adm_extensions, $adm_extensions_menu; global $STYLE_PATH_ADMIN, $lang, $olang, $SQL, $MINI_MENU; ($hook = kleeja_run_hook('kleeja_admin_err_func')) ? eval($hook) : null; //run hook #Exception for ajax if (isset($_GET['_ajax_'])) { $text = $msg . ($redirect ? "\n" . '<script type="text/javascript"> setTimeout("get_kleeja_link(\'' . str_replace('&', '&', $redirect) . '\');", ' . $rs * 1000 . ');</script>' : ''); echo_ajax(1, $tpl->display($style)); $SQL->close(); exit; } // assign {text} in err template $text = $msg . ($redirect != false ? redirect($redirect, false, false, $rs, true) : ''); $SHOW_LIST = $navigation; //header echo $tpl->display("admin_header"); //show tpl echo $tpl->display($style); //footer echo $tpl->display("admin_footer"); if ($exit) { $SQL->close(); exit; } }
/** * Print admin area errors * * @param string $msg The message of error * @param bool $navigation [optional] Show the side mneu or not * @param string $title [optional] The title of the error * @param bool $exit [optional] halt after showing the error * @param bool|string $redirect [optional] if link given it will redirected to it after $rs seconds * @param int $rs [optional] if $redirected is given and not false, this will be the time in seconds * @param string $style [optional] this is just here to use it inside kleeja_admin_info to use admin_info */ function kleeja_admin_err($msg, $navigation = true, $title = '', $exit = true, $redirect = false, $rs = 5, $style = 'error.php') { global $text, $tpl, $SHOW_LIST, $adm_extensions, $adm_extensions_menu; global $STYLE_PATH_ADMIN, $lang, $plugin, $SQL, $MINI_MENU; ($hook = $plugin->run_hook('kleeja_admin_err_func')) ? eval($hook) : null; //run hook #Exception for ajax if (isset($_GET['_ajax_'])) { $text = $msg . ($redirect ? "\n" . '<script type="text/javascript"> setTimeout("location.href=\'' . str_replace('&', '&', $redirect) . '\';", ' . $rs * 1000 . ');</script>' : ''); echo_ajax(1, $tpl->display($style)); $SQL->close(); exit; } #assign {text} in err template $text = $msg . ($redirect != false ? redirect($redirect, false, false, $rs, true) : ''); $SHOW_LIST = $navigation; #header include get_template_path('header.php'); #show tpl include get_template_path($style); #footer include get_template_path('footer.php'); #show tpl //echo $tpl->display($style); #footer //echo $tpl->display("admin_footer"); #if exit, clean it if ($exit) { garbage_collection(); exit; } }
//run hook //no style defined if (empty($stylee)) { $text = $lang['NO_TPL_SHOOSED']; $stylee = 'admin_info'; } $go_menu_html = ''; if (isset($go_menu)) { foreach ($go_menu as $m => $d) { $go_menu_html .= '<li class="' . ($d['current'] ? 'active' : '') . '" id="c_' . $d['goto'] . '"><a href="' . $d['link'] . '" onclick="javascript:get_kleeja_link(\'' . $d['link'] . '\', \'#content\', {\'current_id\':\'c_' . $d['goto'] . '\', \'current_class\':\'active\'' . ($d['confirm'] ? ', \'confirm\':true' : '') . '}); return false;">' . $d['name'] . '</a></li>'; } } //header if (!isset($_GET['_ajax_'])) { echo $tpl->display("admin_header"); } //body if (!isset($_GET['_ajax_'])) { $is_ajax = 'no'; echo $tpl->display($stylee); } else { $is_ajax = 'yes'; echo_ajax(1, $tpl->display($stylee), $go_menu_html); } //footer if (!isset($_GET['_ajax_'])) { echo $tpl->display("admin_footer"); } //close db $SQL->close(); exit;
/** * Redirect to a link after *given* seconds * * @param string $url The link to redirect to * @param bool $header [optional] Redirct using header:location or html meta * @param bool $exit [optional] Exit after showing redirect code * @param int $sec The time in second before redirecting to the link * @param bool $return [optional] return as a code or just execute it * @return void|string */ function redirect($url, $header = true, $exit = true, $sec = 0, $return = false) { global $SQL, $plugin; ($hook = $plugin->run_hook('redirect_func')) ? eval($hook) : null; //run hook if (!headers_sent() && $header && !$return) { header('Location: ' . str_replace(array('&'), array('&'), $url)); } else { #if ajax, mostly in acp if (isset($_GET['_ajax_'])) { global $lang, $tpl, $text; $text = $lang['WAIT'] . '<script type="text/javascript"> setTimeout("get_kleeja_link(\'' . str_replace(array('&'), array('&'), $url) . '\');", ' . $sec * 1000 . ');</script>'; if ($exit) { echo_ajax(1, $tpl->display('admin_info')); $SQL->close(); exit; } } else { $gre = '<script type="text/javascript"> setTimeout("window.location.href = \'' . str_replace(array('&'), array('&'), $url) . '\'", ' . $sec * 1000 . '); </script>'; $gre .= '<noscript><meta http-equiv="refresh" content="' . $sec . ';url=' . $url . '" /></noscript>'; } if ($return) { return $gre; } echo $gre; } if ($exit) { #at end, close sql connections & etc garbage_collection(); exit; } }