public function __construct() { $system = System::getInstance(); $this->input = $system->getInputObject(); $this->log = $system->getLogger(); $this->load = $system->getLoaderObject(); $system->log('INFO', 'Model instantiated'); }
function VerifyData() { $system = System::getInstance(); $config = array(); $_POST['num_chars'] = $system->cleanVars($_POST, 'num_chars', 6, 'int'); foreach (array_keys($this->config) as $key) { $config[$key] = $_POST[$key]; } return $config; }
public function __construct() { $system = System::getInstance(); $system->notifySystem($this); // notify system about existence, so its possible to load models/views in child constructor $this->load = $system->getLoaderObject(); $this->input = $system->getInputObject(); $this->log = $system->getLogger(); $system->log('INFO', 'Controller instantiated'); }
public function VerifyData() { $system = System::getInstance(); $config = array(); $_POST['disabled'] = $system->cleanVars($_POST, 'disabled', false, 'boolean'); $_POST['mode'] = $system->cleanVars($_POST, 'mode', 'image', 'string'); $_POST['name'] = $system->cleanVars($_POST, 'name', 'xoopscaptcha', 'string'); $_POST['skipmember'] = $system->cleanVars($_POST, 'skipmember', false, 'boolean'); $_POST['maxattempts'] = $system->cleanVars($_POST, 'maxattempts', 10, 'int'); foreach (array_keys($this->config) as $key) { $config[$key] = $_POST[$key]; } return $config; }
function VerifyData() { $xoops = Xoops::getInstance(); $default_lang = array_search(ucfirst($xoops->getConfig('language')), $this->getLanguages()); $default_lang = !$default_lang ? 'en' : $default_lang; $system = System::getInstance(); $config = array(); $_POST['private_key'] = $system->cleanVars($_POST, 'private_key', 'Your private key', 'string'); $_POST['public_key'] = $system->cleanVars($_POST, 'public_key', 'Your public key', 'string'); $_POST['theme'] = $system->cleanVars($_POST, 'theme', 'red', 'string'); $_POST['lang'] = $system->cleanVars($_POST, 'lang', $default_lang, 'string'); foreach (array_keys($this->config) as $key) { $config[$key] = $_POST[$key]; } return $config; }
function b_system_main_edit($options) { $xoops = Xoops::getInstance(); $system = System::getInstance(); $system_module = new SystemModule(); $admin_page = new \Xoops\Module\Admin(); // Define Stylesheet $xoops->theme()->addStylesheet('media/xoops/css/icons.css'); $xoops->theme()->addStylesheet('modules/system/css/admin.css'); // Define scripts $xoops->theme()->addScript('media/jquery/plugins/jquery.jeditable.js'); $xoops->theme()->addScript('modules/system/js/module.js'); $admin_page->addTips(SystemLocale::MENU_TIPS); $admin_page->renderTips(); $list = $system_module->getModuleList(); $xoops->tpl()->assign('modules_list', $list); return $xoops->tpl()->fetch('admin:system/system_modules_menu.tpl'); }
public function VerifyData() { $system = System::getInstance(); $config = array(); $_POST['num_chars'] = $system->cleanVars($_POST, 'num_chars', 6, 'int'); $_POST['casesensitive'] = $system->cleanVars($_POST, 'casesensitive', false, 'boolean'); $_POST['fontsize_min'] = $system->cleanVars($_POST, 'fontsize_min', 10, 'int'); $_POST['fontsize_max'] = $system->cleanVars($_POST, 'fontsize_max', 24, 'int'); $_POST['background_type'] = $system->cleanVars($_POST, 'background_type', 0, 'int'); $_POST['background_num'] = $system->cleanVars($_POST, 'background_num', 50, 'int'); $_POST['polygon_point'] = $system->cleanVars($_POST, 'polygon_point', 3, 'int'); $_POST['skip_characters'] = $system->cleanVars($_POST, 'skip_characters', 'o|0|i|l|1', 'string'); $_POST['skip_characters'] = explode('|', $_POST['skip_characters']); foreach (array_keys($this->config) as $key) { $config[$key] = $_POST[$key]; } return $config; }
public function cleanVarsForDB() { $system = System::getInstance(); foreach (parent::getValues() as $k => $v) { if ($k !== 'dohtml') { if ($this->vars[$k]['data_type'] == XOBJ_DTYPE_STIME || $this->vars[$k]['data_type'] == XOBJ_DTYPE_MTIME || $this->vars[$k]['data_type'] == XOBJ_DTYPE_LTIME) { $value = $system->cleanVars($_POST[$k], 'date', date('Y-m-d'), 'date') + $system->cleanVars($_POST[$k], 'time', date('u'), 'int'); $this->setVar($k, isset($_POST[$k]) ? $value : $v); } elseif ($this->vars[$k]['data_type'] == XOBJ_DTYPE_INT) { $value = $system->cleanVars($_POST, $k, $v, 'int'); $this->setVar($k, $value); } elseif ($this->vars[$k]['data_type'] == XOBJ_DTYPE_ARRAY) { $value = $system->cleanVars($_POST, $k, $v, 'array'); $this->setVar($k, $value); } else { $value = $system->cleanVars($_POST, $k, $v, 'string'); $this->setVar($k, $value); } } } }
public function show($error = null) { $system = System::getInstance(); $ui = Ui::getInstance(); $ui->createPage(); // Header $logo = "<img src='../images/integria_logo_header.png' style='border:0px;' alt='Home' >"; $title = "<div style='text-align:center;'>{$logo}</div>"; $hide_logout = $system->getRequest("hide_logout", false); if ($hide_logout) { $left_button = ""; } else { $left_button = $ui->createHeaderButton(array('icon' => 'back', 'pos' => 'left', 'text' => __('Exit'), 'href' => 'index.php?action=logout')); } $ui->createHeader($title, $left_button, null, "logo"); $ui->showFooter(); $ui->beginContent(); //List of buttons // Workunits $options = array('icon' => 'star', 'pos' => 'right', 'text' => __('Workunits'), 'href' => 'index.php?page=workunit'); $ui->contentAddHtml($ui->createButton($options)); // Workorders $options = array('icon' => 'info', 'pos' => 'right', 'text' => __('Workorders'), 'href' => 'index.php?page=workorders&filter_status=0&filter_owner=' . $system->getConfig('id_user')); $ui->contentAddHtml($ui->createButton($options)); // Incidents $options = array('icon' => 'alert', 'pos' => 'right', 'text' => __('Incidents'), 'href' => 'index.php?page=incidents'); $ui->contentAddHtml($ui->createButton($options)); // Calendars $options = array('icon' => 'grid', 'pos' => 'right', 'text' => __('Calendars'), 'href' => 'index.php?page=calendars'); $ui->contentAddHtml($ui->createButton($options)); if (!empty($error)) { $options = array('popup_id' => 'error_popup'); $ui->addWarningPopup($options); $ui->contentAddHtml("<script type=\"text/javascript\">\n\t\t\t\t\t\t\t\t\t\t\$(document).on('pageshow', function() {\n\t\t\t\t\t\t\t\t\t\t\t\$(\"#error_popup\").popup(\"open\");\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t</script>"); } $ui->endContent(); $ui->showPage(); return; }
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ /** * Users Manager * * @copyright XOOPS Project (http://xoops.org) * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @author Maxime Cointin (AKA Kraven30) * @package system * @version $Id$ */ include dirname(dirname(__DIR__)) . '/header.php'; $xoops = Xoops::getInstance(); $system = System::getInstance(); if (!$xoops->isUser() || !$xoops->isModule() || !$xoops->user->isAdmin($xoops->module->mid())) { exit(XoopsLocale::E_NO_ACCESS_PERMISSION); } $xoops->logger()->quiet(); //$xoops->disableErrorReporting(); if (isset($_REQUEST["op"])) { $op = $_REQUEST["op"]; } else { @($op = "default"); } switch ($op) { // Display post case 'display_post': include_once $xoops->path('modules/system/include/functions.php'); $uid = $system->cleanVars($_REQUEST, 'uid', 'int');
private function showNoPermission() { $system = System::getInstance(); audit_db($system->getConfig('id_user'), $REMOTE_ADDR, "ACL Violation", "Trying to access to workorder section"); $error['title_text'] = __('You don\'t have access to this page'); $error['content_text'] = __('Access to this page is restricted to authorized users only, please contact to system administrator if you need assistance. <br><br>Please know that all attempts to access this page are recorded in security logs of Integria System Database'); $home = new Home(); $home->show($error); }
public function ajax($method = false) { $system = System::getInstance(); if (!$this->permission) { return; } else { switch ($method) { case 'load_more_workunits': if ($this->offset == 1 || $this->offset > $this->getNumPages()) { return; } else { $href = $system->getRequest('href', ''); echo $this->getWorkUnitsList($href, false, "", true); } break; } } }
public function ajax($method = false) { $system = System::getInstance(); if (!$this->permission) { return; } else { switch ($method) { case 'getIncidentTypeFields': $id_incident_type = $system->getRequest('id_incident_type'); $id_incident = $system->getRequest('id_incident'); $fields = incidents_get_all_type_field($id_incident_type, $id_incident); $fields_final = array(); foreach ($fields as $f) { $f["data"] = safe_output($f["data"]); array_push($fields_final, $f); } echo json_encode($fields_final); return; } } }
public function ajax ($method = false) { $system = System::getInstance(); if (!$this->permission) { return; } else { switch ($method) { case 'get_calendar': echo $this->getCalendar(); return; } } }
public function defaultFooter() { $system = System::getInstance(); if ($system->getConfig('enteprise') == 1) { $enterprise = "Enterprise Edition"; } else { $enterprise = "OpenSource Edition"; } if (isset($_SERVER['REQUEST_TIME'])) { $time = $_SERVER['REQUEST_TIME']; } else { $time = get_system_time(); } return "<div id='footer' style='font-size: 12px; text-align: center;'>\n" . "Integria IMS {$enterprise} " . "<br />\n" . $system->getConfig('version') . " - Build " . $system->getConfig('build_version') . "<br />\n" . "</div>"; }
/** * Pode ser chamado diretamente por um throw ou quando o PHP dispara um erro (WARNING, PARSE ou FATAL). * No segundo caso um próprio método erro() dessa clase dispara a exceção. * * @param String $message Texto descritivo sobre o que pode ter acontecido na rotina que disparou o erro. * @param int $gravidade Valor inteiro para indicar a gravidade (0 a 3) da exceção. No caso de ser disparada por um * erro do PHP esse campo é um valor constante que indica qual tipo de erro. * @param array $contexto Array com valores do debug_backtrace() (nativo do PHP), pode não ser enviado ou ignorado * com valor false. No caso de erros no PHP tráz informações sobre linha, arquivo e contexto (veja doc * set_error_handler) * @param bool $erro_php É usado apenas pelo método erro() da classe para indicar que não é uma exceção do sistema, * mas sim um erro no PHP. O método erro() está sendo usado como handle dos erros no PHP para que os * usuários não vejam mensagens de erros. * @return void */ public function __construct($message, $gravidade = __CLASS__, $contexto = false, $erro_php = false) { if (!self::$identificador_execucao) { self::$identificador_execucao = str_pad(rand(1, 9999), 4, '0', STR_PAD_LEFT); } $this->message = $message; $this->erro_nome = self::$identificador_execucao . '-' . ++self::$cont_erros . '-' . $gravidade . "-" . date('Y-m-d-H-i-s') . ".json"; $this->erros['level'] = $gravidade; $this->erros['datetime'] = date("H:i:s Y-m-d", time()); $this->erros['mensagem'] = $message; $this->erros['db_error'] = DB::error(); if ($erro_php) { $erro_linha = $contexto['linha']; $erro_arquivo = $contexto['arquivo']; $message = strip_tags($message); /* * Não sei porque diabos esta chave as vezes vem com valores recursivos infinitos que causam erro no * sistema. */ $contexto['contexto']["GLOBALS"] = " "; // muitas vezes o erro do php não traz o debug_backtrace $contexto['Backtrace'] = debug_backtrace(); } else { $erro_linha = self::getLine(); $erro_arquivo = self::getFile(); if (SYS_MODO_DEVEL) { echo "<pre><br /><b>{$gravidade}</b> {$message}\n\nno arquivo {$erro_arquivo} Linha: {$erro_linha}<br /><br /></pre>"; } } $this->id_unico = basename($erro_arquivo, '.php') . '.' . $erro_linha; $this->erros['PHP']['Arquivo'] = $erro_arquivo; $this->erros['PHP']['Linha'] = $erro_linha; $this->erros['PHP']['Codigo'] = $this->id_unico; /* * Caso tenha sido passado um array com o contexto do erro/exceção. */ if ($contexto) { $this->erros['Contexto'] = $contexto; } else { $this->erros['Backtrace'] = debug_backtrace(); } $this->erros["GET"] = $_GET; $this->erros["POST"] = $_POST; $this->erros["REQUEST"] = $_REQUEST; if (isset($_SESSION)) { $this->erros["Sessao"] = $_SESSION; } $this->erros["Cookies"] = $_COOKIE; $this->erros["Arquivos"] = $_FILES; $this->erros["Servidor"] = $_SERVER; $this->erros["APPS"] = (array) System::getInstance(); foreach (SysDebug::getErros() as $err) { $this->erros['user_erros'][] = ['Label' => $err['Label'], 'VAR' => $err['VAR'], 'file' => $err['file'], 'line' => $err['line'], 'stringy' => $err['stringy']]; } $json = utf8_decode(json_encode($this->erros, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)); $tam_file = file_put_contents(PATH_LOG_ERRO . $this->erro_nome, $json); if (SYS_MODO_DEVEL) { echo "<br/>Erro: " . $this->erro_nome; echo "<br/><pre>{$json}</pre>"; } /* * Verifica se o sistema está configurado para enviar um e-mail para o administrador com o json. */ if (ERROS_ENVIAR_EMAIL && !self::$erro_pai_enviado) { $largura_coluna = 20; $msg = '<code><pre>' . SYS_NAME . " Disse:\n" . $message; $msg .= "\n\n" . str_pad('Arquivo: ', $largura_coluna) . $erro_arquivo; $msg .= "\n" . str_pad('Codigo: ', $largura_coluna) . $this->id_unico; $msg .= "\n" . str_pad('Linha: ', $largura_coluna) . $erro_linha; $msg .= "\n" . str_pad('Erro banco: ', $largura_coluna) . DB::error(); $msg .= "\n----------------------------------------------------------------------------------\n"; $msg .= "\n" . str_pad("Horario:", $largura_coluna) . date('H:i:s d/m/Y'); if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) { $msg .= "\n" . str_pad("IP:", $largura_coluna) . $_SERVER['HTTP_X_FORWARDED_FOR']; $msg .= "\n" . str_pad("Proxy:", $largura_coluna) . '<a href="http://www.geoiptool.com/?IP=' . $_SERVER['REMOTE_ADDR'] . '" target="_blank">' . $_SERVER['REMOTE_ADDR'] . '</a>'; } else { $msg .= "\n" . str_pad("IP:", $largura_coluna) . '<a href="http://www.geoiptool.com/?IP=' . $_SERVER['REMOTE_ADDR'] . '" target="_blank">' . $_SERVER['REMOTE_ADDR'] . '</a>'; } $msg .= "\n" . str_pad("Navegador:", $largura_coluna) . $_SERVER['HTTP_USER_AGENT']; $msg .= "\n" . str_pad("URL requisitada:", $largura_coluna) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $msg .= "\n" . str_pad("POST:", $largura_coluna) . count($_POST); $msg .= "\n" . str_pad("GET:", $largura_coluna) . count($_GET); $msg .= "\n" . str_pad("FILES:", $largura_coluna) . count($_FILES); $msg .= "\n" . str_pad("URL raiz:", $largura_coluna) . URL_ROOT; $msg .= "\n\n\n" . str_pad("JSON", $largura_coluna) . $json; if ($tam_file) { $msg .= "\n----------------------------------------------------------------------------------\n"; $msg .= "\n" . str_pad("Arquivo em:", $largura_coluna) . PATH_LOG_ERRO . $this->erro_nome; } else { $msg .= "\n\nNÃO FOI POSSÍVEL ESCREVER O ARQUIVO EM DISCO!"; } $msg .= "</pre></code>"; if (ERROS_ANEXAR) { $anexo_codificado = chunk_split(base64_encode($json)); $mailheaders = "\nMIME-version: 1.0\n"; $mailheaders .= "Content-type: multipart/mixed; "; $mailheaders .= "boundary=\"Message-Boundary\"\n"; $mailheaders .= "Content-transfer-encoding: 7BIT\n"; $mailheaders .= "X-attachments: {$this->erro_nome}"; $body_top = "--Message-Boundary\n"; $body_top .= "Content-type: text/html; charset=utf8\n"; $body_top .= "Content-transfer-encoding: 7BIT\n"; $body_top .= "Content-description: Mail message body\n\n"; $msg = $body_top . $msg; $msg .= "\n\n--Message-Boundary\n"; $msg .= "Content-type: application/json; name=\"{$this->erro_nome}\"\n"; $msg .= "Content-Transfer-Encoding: BASE64\n"; $msg .= "Content-disposition: attachment; filename=\"{$this->erro_nome}\"\n\n"; $msg .= "{$anexo_codificado}\n"; $msg .= "--Message-Boundary--\n"; } $mailheaders .= "\nReferences: <" . $this->id_unico . "@" . parse_url(URL_ROOT, PHP_URL_HOST) . ">\n"; $msg .= "\n\nAtt, " . SYS_NAME . " (" . SIS_EMAIL . ")"; $assunto = "[" . $gravidade . "][" . str_replace("http://", '', URL_ROOT) . '] ' . utf8_decode(substr($this->id_unico, 0, 30)); if (mail(ERROS_EMAIL, $assunto, $msg, "From: " . SYS_NAME . " <" . SIS_EMAIL . ">" . $mailheaders)) { self::$erro_pai_enviado = true; } else { file_put_contents(PATH_LOG_ERRO . "EMAIL_{$this->erro_nome}", "Erro ao enviar e-mail do erro {$this->erro_nome}"); } } }
if ($_GET['action'] == 'getDomination') { System::getInstance()->getDomination(); } else { if ($_GET['action'] == 'getPowerMap') { System::getInstance()->getPowerMap(); } else { if ($_GET['action'] == 'getPlacing') { System::getInstance()->getPlacing(); } else { System::getInstance()->getRating(); } } } } } } } } } } } } } } } } } } else { System::getInstance()->getRating(); } Logger::getInstance()->save();
public function logout() { $this->user = null; $this->logged = false; $this->errorLogin = false; $this->logout_action = true; $system = System::getInstance(); $system->setSession('id_usuario', null); $system->setSession('integria_user', null); }