<?php /* ** Zabbix ** Copyright (C) 2001-2016 Zabbix SIA ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** 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. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ $pageHeader = (new CPageHeader(_('Warning') . ' [' . _s('refreshed every %1$s sec.', 30) . ']'))->addCssFile('styles/' . CHtml::encode($data['theme']) . '.css')->display(); $buttons = array_key_exists('buttons', $data) ? $data['buttons'] : [(new CButton(null, _('Retry')))->onClick('document.location.reload();')]; echo '<body>'; (new CDiv(new CWarning($data['header'], $data['messages'], $buttons)))->addClass(ZBX_STYLE_ARTICLE)->show(); echo get_js("setTimeout('document.location.reload();', 30000);"); echo '</body>'; echo '</html>';
function a2b_add_script_footer() { global $post; if (!isset($post)) { return; } echo "<!-- start adblock-to-bitcoin -->"; echo get_js(); echo get_bitcoin_address_template(); echo "<!-- end adblock-to-bitcoin -->"; }
public function toString($destroy = true) { $tableId = $this->getId(); if (!$tableId) { $tableId = uniqid('t'); $this->setId($tableId); } $string = parent::toString($destroy); if ($this->addMakeVerticalRotationJs) { $string .= get_js('var makeVerticalRotationForTable = function() {' . "\n" . ' jQuery("#' . $tableId . '").makeVerticalRotation();' . "\n" . '}' . "\n" . "\n" . 'if (!jQuery.isReady) {' . "\n" . ' jQuery(document).ready(makeVerticalRotationForTable);' . "\n" . '}' . "\n" . 'else {' . "\n" . ' makeVerticalRotationForTable();' . "\n" . '}', true); } return $string; }
function error_alert($error) { $errors = array(0 => <<<ERR alert("There has been error while uploading the file, please try again if the problem persists, contact the IT staff."); ERR , 1 => <<<ERR alert("You have chosen a wrong extension!"); ERR , 2 => <<<ERR alert("The file you are trying to upload is too big."); ERR , 3 => <<<ERR alert("There has been error while uploading the file, please try again if the problem persists, contact the IT staff."); ERR ); echo get_js($errors[$error]); }
public function toString($destroy = true) { $tableId = $this->getAttribute('id'); if (!$tableId) { $tableId = uniqid('t'); $this->setAttribute('id', $tableId); } $string = parent::toString($destroy); if ($this->addMakeVerticalRotationJs) { $string .= get_js('var makeVerticalRotationForTable = function() { var table = jQuery("#' . $tableId . '"); table.makeVerticalRotation(); if (IE8) { jQuery(".vertical_rotation_inner", table).css({ filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)" }); } else if (IE9) { jQuery(".vertical_rotation_inner", table).css({ "-ms-transform": "rotate(270deg)" }); } if (!IE9) { jQuery(".vertical_rotation_inner", table).css({ "writing-mode": "tb-rl" }); } } if(!jQuery.isReady) { jQuery(document).ready(makeVerticalRotationForTable); } else { makeVerticalRotationForTable(); }', true); } return $string; }
function insertPagePostJs() { global $ZBX_PAGE_POST_JS; if (!empty($ZBX_PAGE_POST_JS)) { $js = ''; foreach ($ZBX_PAGE_POST_JS as $script) { $js .= $script . "\n"; } if (!empty($js)) { echo get_js($js, true); } } }
function make_discovery_status() { $options = array('filter' => array('status' => DHOST_STATUS_ACTIVE), 'selectDHosts' => array('druleid', 'dhostid', 'status'), 'output' => API_OUTPUT_EXTEND); $drules = API::DRule()->get($options); CArrayHelper::sort($drules, array(array('field' => 'name', 'order' => ZBX_SORT_UP))); foreach ($drules as $drnum => $drule) { $drules[$drnum]['up'] = 0; $drules[$drnum]['down'] = 0; foreach ($drule['dhosts'] as $dhost) { if (DRULE_STATUS_DISABLED == $dhost['status']) { $drules[$drnum]['down']++; } else { $drules[$drnum]['up']++; } } } $header = array(new CCol(_('Discovery rule'), 'center'), new CCol(_x('Up', 'discovery results in dashboard')), new CCol(_x('Down', 'discovery results in dashboard'))); $table = new CTableInfo(); $table->setHeader($header, 'header'); foreach ($drules as $drule) { $table->addRow(array(new CLink($drule['name'], 'discovery.php?druleid=' . $drule['druleid']), new CSpan($drule['up'], 'green'), new CSpan($drule['down'], $drule['down'] > 0 ? 'red' : 'green'))); } $script = new CJsScript(get_js('jQuery("#' . WIDGET_DISCOVERY_STATUS . '_footer").html("' . _s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS)) . '");')); return new CDiv(array($table, $script)); }
/** * Get content of all Java Script code * @return string Java Script code */ public function getPostJS() { if ($this->jsIncludePost) { return get_js(implode("\n", $this->jsIncludePost)); } return ''; }
?> " charset="UTF-8"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/ajax.js'); ?> "></script> <script type="text/javascript" src="<?php echo base_url('assets/plugins/masonry.js'); ?> " ></script> <script> url = "<?php echo base_url(); ?> "; </script> <?php get_js(); ?> <script type="text/javascript" src="<?php echo base_url('assets/js/main.js'); ?> " ></script> </body> </html>
function insertPagePostJs() { global $ZBX_PAGE_POST_JS; if ($ZBX_PAGE_POST_JS) { echo get_js(implode("\n", $ZBX_PAGE_POST_JS), true); } }
public function getRefreshScript() { return new CJsScript(get_js("jQuery('#" . $this->getID() . "_footer').html('" . _s('Updated: %s', zbx_date2str(_('H:i:s'))) . "')")); }
// if the username does not exist, create user if ($num == 0) { // hash the password $passwordHashed = md5($_POST['password-one'] . $salt); // set the charset to UTF-8 $query = <<<SQL SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8' SQL; $dbc->exec($query); $query = <<<SQL INSERT INTO users(username, password, name, mail_address, mail_subscription) VALUES (:username, :password, :name, :mail, :subscription) SQL; // prepare the query $stmt = $dbc->prepare($query); $stmt->execute(array(':username' => $_POST['username'], ':password' => $passwordHashed, ':name' => $_POST['real-name'], ':mail' => $_POST['mail-one'], ':subscription' => isset($_POST['subscription']) ? 1 : 0)); // on success login the user $_POST['password'] = $_POST['password-one']; include "login.php"; // go home header("Location: index.php"); } else { // username already exists echo get_js($errors[0]); } } else { // malformed or illegal input data echo get_js($errors[1]); }
public function edit_role($id = "") { $this->form_validation->set_rules($this->_validation_rules_message()); if ($this->form_validation->run()) { $this->ins_data['role'] = $this->input->post('role'); $this->ins_data['id'] = $this->input->post('id'); $this->load->model('admin/role_model'); $this->role_model->edit_role($this->ins_data); $this->service_message->set_flash_message("record_insert_success"); redirect("admin/role/manage_role"); } $this->load->model('admin/role_model'); $this->result = $this->role_model->get_role_details($id); $this->data['css'] = get_css('user_add'); $this->data['js'] = get_js('user_add'); $this->layout->view("admin/role/edit_role", $this->result); }
function make_discovery_status() { $options = array('filter' => array('status' => DHOST_STATUS_ACTIVE), 'selectDHosts' => array('druleid', 'dhostid', 'status'), 'output' => API_OUTPUT_EXTEND); $drules = API::DRule()->get($options); foreach ($drules as &$drule) { $drule['nodename'] = get_node_name_by_elid($drule['druleid']); } unset($drule); // we need natural sort $sortFields = array(array('field' => 'nodename', 'order' => ZBX_SORT_UP), array('field' => 'name', 'order' => ZBX_SORT_UP)); CArrayHelper::sort($drules, $sortFields); foreach ($drules as $drnum => $drule) { $drules[$drnum]['up'] = 0; $drules[$drnum]['down'] = 0; foreach ($drule['dhosts'] as $dhost) { if (DRULE_STATUS_DISABLED == $dhost['status']) { $drules[$drnum]['down']++; } else { $drules[$drnum]['up']++; } } } $header = array(is_show_all_nodes() ? new CCol(_('Node'), 'center') : null, new CCol(_('Discovery rule'), 'center'), new CCol(_x('Up', 'discovery results in dashboard')), new CCol(_x('Down', 'discovery results in dashboard'))); $table = new CTableInfo(); $table->setHeader($header, 'header'); foreach ($drules as $drule) { $table->addRow(array($drule['nodename'], new CLink($drule['nodename'] . ($drule['nodename'] ? NAME_DELIMITER : '') . $drule['name'], 'discovery.php?druleid=' . $drule['druleid']), new CSpan($drule['up'], 'green'), new CSpan($drule['down'], $drule['down'] > 0 ? 'red' : 'green'))); } $script = new CJSScript(get_js("jQuery('#hat_dscvry_footer').html('" . _s('Updated: %s', zbx_date2str(_('H:i:s'))) . "')")); return new CDiv(array($table, $script)); }
function make_awsstat_summary($preloading = false) { $table = new CTableInfo(); $table->setHeader(array(is_show_all_nodes() ? S_NODE : null, _('Account name'), _('PoweredOn'), _('PoweredOff'), _('Billing/Month'))); $script_itemkey = 'push_message.py[{$HYCLOPS_SERVER},{$HYCLOPS_PORT},ec2,{HOST.HOST}]'; $aws_accounts = get_aws_accounts(); if (empty($aws_accounts)) { return null; } foreach ($aws_accounts as $host) { if (!$preloading) { if (is_script_success($host['hostid'], $script_itemkey)) { $instances = get_instances($host['hostid']); $instances = filter_instances($instances); $r = new CRow(); // Account name $col = new CCol($host['host']); $r->addItem($col); // Poweron (running + pending) $poweron_vms = array_merge($instances["running"], $instances["pending"]); $poweron_count = new CSpan(count($poweron_vms), 'pointer'); if (!empty($poweron_vms)) { $poweron_count->setHint(make_ec2_table('ec2_poweron', $poweron_vms)); } $r->addItem(new CCol($poweron_count)); // Poweroff (stopped + terminated + stopping + shutting-down) $poweroff_vms = $instances["stopped"]; $poweroff_count = new CSpan(count($poweroff_vms), 'pointer'); if (!empty($poweroff_vms)) { $poweroff_count->setHint(make_ec2_table('ec2_poweroff', $poweroff_vms)); } $r->addItem(new CCol($poweroff_count)); // AWS Charges $item = get_item_by_key('get_aws_charges.py[{$KEY},{$SECRET}]', $host["host"]); if (array_key_exists('lastvalue', $item)) { $r->addItem(new CLink($item["lastvalue"], "history.php?action=showgraph&itemid={$item["itemid"]}")); } else { $r->addItem(new CCol(_('No data'))); } $table->addRow($r); zbx_add_post_js('chkbxRange.pageGoName = "vms";'); } else { $r = new CRow(); $r->addItem($host['host']); $r->addItem(new CCol(_('script failed'), "high")); $r->addItem(array("-")); $table->addRow($r); } } else { $r = new CRow(); $r->addItem($host['host']); $r->addItem(new CCol(_('loading...'))); $r->addItem(array("-")); $table->addRow($r); } } $script = new CJSScript(get_js("jQuery('#hat_awsstat_footer').html('" . _s('Updated: %s', zbx_date2str(_('H:i:s'))) . "')")); return new CDiv(array($table, $script)); }
<?php if (is_login()) { ?> <footer class="footer"> <div class="footer-container"> <span>© 2015 Alejandro Cervantes. </span> </div> </footer> <?php } echo get_js('js/jquery-2.1.4.min.js'); echo get_js('js/tinymce/tinymce.min.js'); echo get_js('js/function-admin.js'); ?> <div class="container-images-select"> <span class="cierre-pop">x</span> <div class="side-images boxsizing"> <a href="#" class="bt-cjas active" data-abre='libreria'>Librería de imagenes</a> <a href="#" class="bt-cjas" data-abre='cargaimg'>Cargar imagen</a> <div class="info-imagen"> </div> <span class="btn insertar-imagen hidden" data-id="">Insertar imagen</span> </div> <div class="container-img boxsizing libreria active"> <span class="tit-pop">Librería de imagenes</span>
// end if the old password doesn't match if ($num == 0) { die(get_js("alert(\"Wrong password!\");window.history.back();")); } // store all the new values; $name = $_POST['real-name']; $mail = $_POST['mail-one']; $subscription = isset($_POST['subscription']) ? 1 : 0; $oldPassword = $_POST['old-password']; $password = $_POST['old-password']; // check if the passwords and mails are the same if (!empty($_POST['new-password-one']) && !empty($_POST['new-password-two']) && strcmp($_POST['new-password-one'], $_POST['new-password-two']) == 0) { $password = $_POST['new-password-one']; } // hash the password $password = md5($password . $salt); // update the new user data to the database $query = <<<SQL UPDATE users SET password=:password, name=:name, mail_address=:mail, \tmail_subscription=:subscription WHERE username=:username SQL; $stmt = $dbc->prepare($query); $stmt->execute(array(':password' => $password, ':name' => $name, ':mail' => $mail, ':subscription' => $subscription, ':username' => $_COOKIE['username'])); echo get_js("alert(\"Succesful account information update.\")"); if (strcmp($oldPassword, $password) == 0) { echo "<script>window.history.back();</script>"; } else { header("Location: logout.php"); }