当前位置: 首页>>代码示例>>PHP>>正文


PHP clear_messages函数代码示例

本文整理汇总了PHP中clear_messages函数的典型用法代码示例。如果您正苦于以下问题:PHP clear_messages函数的具体用法?PHP clear_messages怎么用?PHP clear_messages使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了clear_messages函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkAuthentication

 public static function checkAuthentication($sessionid)
 {
     try {
         if ($sessionid !== null) {
             self::$data = API::User()->checkAuthentication($sessionid);
         }
         if ($sessionid === null || empty(self::$data)) {
             self::setDefault();
             self::$data = API::User()->login(array('user' => ZBX_GUEST_USER, 'password' => '', 'userData' => true));
             if (empty(self::$data)) {
                 clear_messages(1);
                 throw new Exception();
             }
             $sessionid = self::$data['sessionid'];
         }
         if (self::$data['gui_access'] == GROUP_GUI_ACCESS_DISABLED) {
             error(_('GUI access disabled.'));
             throw new Exception();
         }
         zbx_setcookie('zbx_sessionid', $sessionid, self::$data['autologin'] ? time() + SEC_PER_DAY * 31 : 0);
         return true;
     } catch (Exception $e) {
         self::setDefault();
         return false;
     }
 }
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:26,代码来源:class.cwebuser.php

示例2: checkAuthentication

 public static function checkAuthentication($sessionId)
 {
     try {
         if ($sessionId !== null) {
             self::$data = API::User()->checkAuthentication(array($sessionId));
         }
         if ($sessionId === null || empty(self::$data)) {
             self::setDefault();
             self::$data = API::User()->login(array('user' => ZBX_GUEST_USER, 'password' => '', 'userData' => true));
             if (empty(self::$data)) {
                 clear_messages(1);
                 throw new Exception();
             }
             $sessionId = self::$data['sessionid'];
         }
         if (self::$data['gui_access'] == GROUP_GUI_ACCESS_DISABLED) {
             throw new Exception();
         }
         self::setSessionCookie($sessionId);
         return $sessionId;
     } catch (Exception $e) {
         self::setDefault();
         return false;
     }
 }
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:25,代码来源:CWebUser.php

示例3: printmessages

function printmessages()
{
    //Print error messages
    initialise_messages();
    $messages = $_SESSION['messages'];
    // move from session to local
    $log_to_file = false;
    // true will start writing to a file
    if (!empty($messages)) {
        //if messages exist
        //first part of message
        if (!empty($messages['success'])) {
            //if success messages exist.
            foreach ($messages['success'] as $value) {
                if ($log_to_file) {
                    log_to_file("Success", $value);
                }
                echo '<div class="alert alert-success alert-dismissible" role="alert">
						<button type="button" class="close" data-dismiss="alert" aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
						<strong>Success!</strong> ' . $value . '</div>';
            }
        }
        if (!empty($messages['alerts'])) {
            //if alert messages exist.
            foreach ($messages['alert'] as $value) {
                if ($log_to_file) {
                    log_to_file("Alert", $value);
                }
                echo '<div class="alert alert-warning alert-dismissible" role="alert">
						<button type="button" class="close" data-dismiss="alert" aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
						<strong>Alert!</strong> ' . $value . '</div>';
            }
        }
        if (!empty($messages['errors'])) {
            //if error messages exist.
            foreach ($messages['errors'] as $value) {
                if ($log_to_file) {
                    log_to_file("Error", $value);
                }
                echo '<div class="alert alert-danger alert-dismissible" role="alert">
						<button type="button" class="close" data-dismiss="alert" aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
						<strong>Warning!</strong> ' . $value . '</div>';
            }
        }
        //end of message
        clear_messages();
        //clear message and start again.
    }
}
开发者ID:eveclarke91,项目名称:FourthYearProject,代码行数:55,代码来源:messagemanager.php

示例4: get_shareability_menus

function get_shareability_menus($settings)
{
    $links = array();
    if ($settings->provisioned) {
        $links[base_url() . 'shareability/account/index'] = array('icon' => 'cogs', 'label' => 'App settings');
        $links[base_url() . 'shareability/useapp/index'] = array('icon' => 'mobile-phone', 'label' => 'Use your App');
        $links[base_url() . 'shareability/features/index'] = array('icon' => 'table', 'label' => 'Edit features');
    } else {
        if (!$settings->submitted) {
            $links[base_url() . 'shareability/account/index'] = array('icon' => 'cogs', 'label' => 'App settings');
        } else {
            if ($settings->submitted) {
                clear_messages();
                add_message('It can take up to 10 days since the date of purchase for your App to be ready. We appreciate your patience.', 'warning');
                redirect('shareability/account/index');
            }
        }
    }
    if ($settings->submitted) {
        $links[base_url() . 'shareability/account/payment_history'] = array('icon' => 'time', 'label' => 'Payment history');
    }
    return $links;
}
开发者ID:nicolasconnault,项目名称:streamliner,代码行数:23,代码来源:shareability_menu_helper.php

示例5: stage6

 function stage6()
 {
     $this->setConfig('ZBX_CONFIG_FILE_CORRECT', true);
     $config = new CConfigFile(Z::getInstance()->getRootDir() . CConfigFile::CONFIG_FILE_PATH);
     $config->config = array('DB' => array('TYPE' => $this->getConfig('DB_TYPE'), 'SERVER' => $this->getConfig('DB_SERVER'), 'PORT' => $this->getConfig('DB_PORT'), 'DATABASE' => $this->getConfig('DB_DATABASE'), 'USER' => $this->getConfig('DB_USER'), 'PASSWORD' => $this->getConfig('DB_PASSWORD'), 'SCHEMA' => $this->getConfig('DB_SCHEMA')), 'ZBX_SERVER' => $this->getConfig('ZBX_SERVER'), 'ZBX_SERVER_PORT' => $this->getConfig('ZBX_SERVER_PORT'), 'ZBX_SERVER_NAME' => $this->getConfig('ZBX_SERVER_NAME'));
     $config->save();
     try {
         $error = false;
         $config->load();
         if ($config->config['DB']['TYPE'] != $this->getConfig('DB_TYPE')) {
             $error = true;
         } elseif ($config->config['DB']['SERVER'] != $this->getConfig('DB_SERVER')) {
             $error = true;
         } elseif ($config->config['DB']['PORT'] != $this->getConfig('DB_PORT')) {
             $error = true;
         } elseif ($config->config['DB']['DATABASE'] != $this->getConfig('DB_DATABASE')) {
             $error = true;
         } elseif ($config->config['DB']['USER'] != $this->getConfig('DB_USER')) {
             $error = true;
         } elseif ($config->config['DB']['PASSWORD'] != $this->getConfig('DB_PASSWORD')) {
             $error = true;
         } elseif ($this->getConfig('DB_TYPE') == ZBX_DB_DB2 && $config->config['DB']['SCHEMA'] != $this->getConfig('DB_SCHEMA')) {
             $error = true;
         } elseif ($config->config['ZBX_SERVER'] != $this->getConfig('ZBX_SERVER')) {
             $error = true;
         } elseif ($config->config['ZBX_SERVER_PORT'] != $this->getConfig('ZBX_SERVER_PORT')) {
             $error = true;
         } elseif ($config->config['ZBX_SERVER_NAME'] != $this->getConfig('ZBX_SERVER_NAME')) {
             $error = true;
         }
         $error_text = 'Unable to overwrite the existing configuration file. ';
     } catch (ConfigFileException $e) {
         $error = true;
         $error_text = 'Unable to create the configuration file. ';
     }
     clear_messages();
     if ($error) {
         $this->setConfig('ZBX_CONFIG_FILE_CORRECT', false);
     }
     $this->DISABLE_NEXT_BUTTON = !$this->getConfig('ZBX_CONFIG_FILE_CORRECT', false);
     $this->HIDE_CANCEL_BUTTON = !$this->DISABLE_NEXT_BUTTON;
     $table = array('Configuration file', BR(), '"' . Z::getInstance()->getRootDir() . CConfigFile::CONFIG_FILE_PATH . '"', BR(), 'created: ', $this->getConfig('ZBX_CONFIG_FILE_CORRECT', false) ? new CSpan(_('OK'), 'ok') : new CSpan(_('Fail'), 'fail'));
     return array($table, BR(), BR(), $this->DISABLE_NEXT_BUTTON ? array(new CSubmit('retry', _('Retry')), BR(), BR()) : null, !$this->getConfig('ZBX_CONFIG_FILE_CORRECT', false) ? array($error_text, BR(), 'Please install it manually, or fix permissions on the conf directory.', BR(), BR(), 'Press the "Download configuration file" button, download the configuration file ', 'and save it as ', BR(), '"' . Z::getInstance()->getRootDir() . CConfigFile::CONFIG_FILE_PATH . '"', BR(), BR(), new CSubmit('save_config', 'Download configuration file'), BR(), BR()) : array('Congratulations on successful installation of Zabbix frontend.', BR(), BR()), 'When done, press the ' . ($this->DISABLE_NEXT_BUTTON ? '"Retry"' : '"Finish"') . ' button');
 }
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:44,代码来源:setup.inc.php

示例6: form_save

function form_save() {
	if (isset($_POST["save_component_snmp_query"])) {
		$save["id"] = $_POST["id"];
		$save["hash"] = get_hash_data_query($_POST["id"]);
		$save["name"] = form_input_validate($_POST["name"], "name", "", false, 3);
		$save["description"] = form_input_validate($_POST["description"], "description", "", true, 3);
		$save["xml_path"] = form_input_validate($_POST["xml_path"], "xml_path", "", false, 3);
		$save["data_input_id"] = $_POST["data_input_id"];

		if (!is_error_message()) {
			$snmp_query_id = sql_save($save, "snmp_query");

			if ($snmp_query_id) {
				raise_message(1);
			}else{
				raise_message(2);
			}
		}

		if ((is_error_message()) || (empty($_POST["id"]))) {
			header("Location: data_queries.php?action=edit&id=" . (empty($snmp_query_id) ? $_POST["id"] : $snmp_query_id));
		}else{
			header("Location: data_queries.php");
		}
	}elseif (isset($_POST["save_component_snmp_query_item"])) {
		$redirect_back = false;

		$save["id"] = $_POST["id"];
		$save["hash"] = get_hash_data_query($_POST["id"], "data_query_graph");
		$save["snmp_query_id"] = $_POST["snmp_query_id"];
		$save["name"] = form_input_validate($_POST["name"], "name", "", false, 3);
		$save["graph_template_id"] = $_POST["graph_template_id"];

		if (!is_error_message()) {
			$snmp_query_graph_id = sql_save($save, "snmp_query_graph");

			if ($snmp_query_graph_id) {
				raise_message(1);

				/* if the user changed the graph template, go through and delete everything that
				was associated with the old graph template */
				if ($_POST["graph_template_id"] != $_POST["_graph_template_id"]) {
					db_execute("delete from snmp_query_graph_rrd_sv where snmp_query_graph_id=$snmp_query_graph_id");
					db_execute("delete from snmp_query_graph_sv where snmp_query_graph_id=$snmp_query_graph_id");
					$redirect_back = true;
				}

				db_execute("delete from snmp_query_graph_rrd where snmp_query_graph_id=$snmp_query_graph_id");

				while (list($var, $val) = each($_POST)) {
					if (eregi("^dsdt_([0-9]+)_([0-9]+)_check", $var)) {
						$data_template_id = ereg_replace("^dsdt_([0-9]+)_([0-9]+).+", "\\1", $var);
						$data_template_rrd_id = ereg_replace("^dsdt_([0-9]+)_([0-9]+).+", "\\2", $var);

						db_execute ("replace into snmp_query_graph_rrd (snmp_query_graph_id,data_template_id,data_template_rrd_id,snmp_field_name) values($snmp_query_graph_id,$data_template_id,$data_template_rrd_id,'" . $_POST{"dsdt_" . $data_template_id . "_" . $data_template_rrd_id . "_snmp_field_output"} . "')");
					}elseif ((eregi("^svds_([0-9]+)_x", $var, $matches)) && (!empty($_POST{"svds_" . $matches[1] . "_text"})) && (!empty($_POST{"svds_" . $matches[1] . "_field"}))) {
						/* suggested values -- data templates */
						$sequence = get_sequence(0, "sequence", "snmp_query_graph_rrd_sv", "snmp_query_graph_id=" . $_POST["id"]  . " and data_template_id=" . $matches[1] . " and field_name='" . $_POST{"svds_" . $matches[1] . "_field"} . "'");
						$hash = get_hash_data_query(0, "data_query_sv_data_source");
						db_execute("insert into snmp_query_graph_rrd_sv (hash,snmp_query_graph_id,data_template_id,sequence,field_name,text) values ('$hash'," . $_POST["id"] . "," . $matches[1] . ",$sequence,'" . $_POST{"svds_" . $matches[1] . "_field"} . "','" . $_POST{"svds_" . $matches[1] . "_text"} . "')");

						$redirect_back = true;
						clear_messages();
					}elseif ((eregi("^svg_x", $var)) && (!empty($_POST{"svg_text"})) && (!empty($_POST{"svg_field"}))) {
						/* suggested values -- graph templates */
						$sequence = get_sequence(0, "sequence", "snmp_query_graph_sv", "snmp_query_graph_id=" . $_POST["id"] . " and field_name='" . $_POST{"svg_field"} . "'");
						$hash = get_hash_data_query(0, "data_query_sv_graph");
						db_execute("insert into snmp_query_graph_sv (hash,snmp_query_graph_id,sequence,field_name,text) values ('$hash'," . $_POST["id"] . ",$sequence,'" . $_POST{"svg_field"} . "','" . $_POST{"svg_text"} . "')");

						$redirect_back = true;
						clear_messages();
					}
				}
			}else{
				raise_message(2);
			}
		}

		if ((is_error_message()) || (empty($_POST["id"])) || ($redirect_back == true)) {
			header("Location: data_queries.php?action=item_edit&id=" . (empty($snmp_query_graph_id) ? $_POST["id"] : $snmp_query_graph_id) . "&snmp_query_id=" . $_POST["snmp_query_id"]);
		}else{
			header("Location: data_queries.php?action=edit&id=" . $_POST["snmp_query_id"]);
		}
	}
}
开发者ID:songchin,项目名称:Cacti,代码行数:85,代码来源:data_queries.php

示例7: DBconnect

/**
 * Creates global database connection.
 *
 * @param string $error returns a message in case of an error
 * @param bool   $debug turns On or Off trace calls when making connections. Suggested debug mode Off during Zabbix setup
 *
 * @return bool
 */
function DBconnect(&$error)
{
    global $DB;
    if (isset($DB['DB'])) {
        $error = _('Cannot create another database connection.');
        return false;
    }
    $result = true;
    $DB['DB'] = null;
    // global db handler
    $DB['TRANSACTIONS'] = 0;
    // level of a nested transation
    $DB['TRANSACTION_NO_FAILED_SQLS'] = true;
    // true - if no statements failed in transaction, false - there are failed statements
    $DB['SELECT_COUNT'] = 0;
    // stats
    $DB['EXECUTE_COUNT'] = 0;
    if (!isset($DB['TYPE'])) {
        $error = 'Unknown database type.';
        $result = false;
    } else {
        $DB['TYPE'] = strtoupper($DB['TYPE']);
        switch ($DB['TYPE']) {
            case ZBX_DB_MYSQL:
                $DB['DB'] = @mysqli_connect($DB['SERVER'], $DB['USER'], $DB['PASSWORD'], $DB['DATABASE'], $DB['PORT']);
                if (!$DB['DB']) {
                    $error = 'Error connecting to database: ' . trim(mysqli_connect_error());
                    $result = false;
                } else {
                    DBexecute('SET NAMES utf8');
                }
                if ($result) {
                    $dbBackend = new MysqlDbBackend();
                }
                break;
            case ZBX_DB_POSTGRESQL:
                $pg_connection_string = (!empty($DB['SERVER']) ? 'host=\'' . pg_connect_escape($DB['SERVER']) . '\' ' : '') . 'dbname=\'' . pg_connect_escape($DB['DATABASE']) . '\' ' . (!empty($DB['USER']) ? 'user=\'' . pg_connect_escape($DB['USER']) . '\' ' : '') . (!empty($DB['PASSWORD']) ? 'password=\'' . pg_connect_escape($DB['PASSWORD']) . '\' ' : '') . (!empty($DB['PORT']) ? 'port=' . pg_connect_escape($DB['PORT']) : '');
                $DB['DB'] = @pg_connect($pg_connection_string);
                if (!$DB['DB']) {
                    $error = 'Error connecting to database.';
                    $result = false;
                } else {
                    $schemaSet = DBexecute('SET search_path = ' . zbx_dbstr($DB['SCHEMA'] ? $DB['SCHEMA'] : 'public'), true);
                    if (!$schemaSet) {
                        clear_messages();
                        $error = pg_last_error();
                        $result = false;
                    } else {
                        if (false !== ($pgsql_version = pg_parameter_status('server_version'))) {
                            if ((int) $pgsql_version >= 9) {
                                // change the output format for values of type bytea from hex (the default) to escape
                                DBexecute('SET bytea_output = escape');
                            }
                        }
                    }
                }
                if ($result) {
                    $dbBackend = new PostgresqlDbBackend();
                }
                break;
            case ZBX_DB_ORACLE:
                $connect = '';
                if (!empty($DB['SERVER'])) {
                    $connect = '//' . $DB['SERVER'];
                    if ($DB['PORT'] != '0') {
                        $connect .= ':' . $DB['PORT'];
                    }
                    if ($DB['DATABASE']) {
                        $connect .= '/' . $DB['DATABASE'];
                    }
                }
                $DB['DB'] = @oci_connect($DB['USER'], $DB['PASSWORD'], $connect);
                if ($DB['DB']) {
                    DBexecute('ALTER SESSION SET NLS_NUMERIC_CHARACTERS=' . zbx_dbstr('. '));
                } else {
                    $ociError = oci_error();
                    $error = 'Error connecting to database: ' . $ociError['message'];
                    $result = false;
                }
                if ($result) {
                    $dbBackend = new OracleDbBackend();
                }
                break;
            case ZBX_DB_DB2:
                $connect = '';
                $connect .= 'DATABASE=' . $DB['DATABASE'] . ';';
                $connect .= 'HOSTNAME=' . $DB['SERVER'] . ';';
                $connect .= 'PORT=' . $DB['PORT'] . ';';
                $connect .= 'PROTOCOL=TCPIP;';
                $connect .= 'UID=' . $DB['USER'] . ';';
                $connect .= 'PWD=' . $DB['PASSWORD'] . ';';
                $DB['DB'] = @db2_connect($connect, $DB['USER'], $DB['PASSWORD']);
//.........这里部分代码省略.........
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:101,代码来源:db.inc.php

示例8: stage6

 function stage6()
 {
     global $ZBX_CONFIGURATION_FILE;
     show_messages();
     /* Write the new contents */
     if ($f = @fopen($ZBX_CONFIGURATION_FILE, 'w')) {
         if (fwrite($f, $this->getNewConfigurationFileContent())) {
             if (fclose($f)) {
                 if ($this->setConfig('ZBX_CONFIG_FILE_CORRECT', $this->CheckConfigurationFile())) {
                     $this->DISABLE_NEXT_BUTTON = false;
                 }
             }
         }
     }
     clear_messages();
     /* don't show errors */
     $table = new CTable(null, 'requirements');
     $table->setAlign('center');
     $table->addRow(array('Configuration file:', $this->getConfig('ZBX_CONFIG_FILE_CORRECT', false) ? new CSpan(S_OK, 'ok') : new CSpan(S_FAIL, 'fail')));
     /*
     $table->addRow(array('Table creation:',  $this->getConfig('ZBX_TABLES_CREATED', false) ? 
     						new CSpan(S_OK,'ok') :
     						new CSpan(S_FAIL,'fail')
     							));
     
     $table->addRow(array('Data loading:',  $this->getConfig('ZBX_DATA_LOADED', false) ? 
     						new CSpan(S_OK,'ok') :
     						new CSpan(S_FAIL,'fail')
     							));
     */
     return array($table, BR(), $this->DISABLE_NEXT_BUTTON ? array(new CButton('retry', S_RETRY), BR(), BR()) : null, !$this->getConfig('ZBX_CONFIG_FILE_CORRECT', false) ? array('Please install configuration file manualy.', BR(), BR(), 'By pressing "Save configuration file" button download configuration file ', 'and place them into the ', BR(), '"' . $ZBX_CONFIGURATION_FILE . '"', BR(), BR(), new CButton('save_config', "Save configuration file"), BR(), BR()) : null, 'Press the ' . ($this->DISABLE_NEXT_BUTTON ? '"Retry"' : '"Next"') . ' button');
 }
开发者ID:rennhak,项目名称:zabbix,代码行数:32,代码来源:setup.inc.php

示例9: redirect

        }
        redirect($url);
        exit;
    } else {
        CWebUser::checkAuthentication(null);
    }
} else {
    // login the user from the session, if the session id is empty - login as a guest
    CWebUser::checkAuthentication(get_cookie('zbx_sessionid'));
}
// the user is not logged in, display the login form
if (!CWebUser::$data['alias'] || CWebUser::$data['alias'] == ZBX_GUEST_USER) {
    switch ($config['authentication_type']) {
        case ZBX_AUTH_HTTP:
            echo _('User name does not match with DB');
            break;
        case ZBX_AUTH_LDAP:
        case ZBX_AUTH_INTERNAL:
            if (isset($_REQUEST['enter'])) {
                $_REQUEST['autologin'] = get_request('autologin', 0);
            }
            if ($messages = clear_messages()) {
                $messages = array_pop($messages);
                $_REQUEST['message'] = $messages['message'];
            }
            $loginForm = new CView('general.login');
            $loginForm->render();
    }
} else {
    redirect(zbx_empty(CWebUser::$data['url']) ? 'dashboard.php' : CWebUser::$data['url']);
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:index.php

示例10: Exception

            if ($sysmap === false) {
                throw new Exception(_('Access denied!') . "\n\r");
            }
            $sysmapUpdate = $json->decode($_REQUEST['sysmap'], true);
            $sysmapUpdate['sysmapid'] = $sysmapid;
            $result = API::Map()->update($sysmapUpdate);
            if ($result !== false) {
                echo 'if (confirm(' . CJs::encodeJson(_('Map is updated! Return?')) . ')) { location.href = "sysmaps.php"; }';
            } else {
                throw new Exception(_('Map update failed.') . "\n\r");
            }
            DBend(true);
        } catch (Exception $e) {
            DBend(false);
            $msg = array($e->getMessage());
            foreach (clear_messages() as $errMsg) {
                $msg[] = $errMsg['type'] . ': ' . $errMsg['message'];
            }
            ob_clean();
            echo 'alert(' . zbx_jsvalue(implode("\n\r", $msg)) . ');';
        }
        @ob_flush();
        exit;
    }
}
if (PAGE_TYPE_HTML != $page['type']) {
    require_once dirname(__FILE__) . '/include/page_footer.php';
    exit;
}
/*
 * Permissions
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:31,代码来源:sysmap.php

示例11: get_icon

    $rightForm->addVar('fullscreen', $_REQUEST['fullscreen']);
    $triggerWidget->addHeader(SPACE, $rightForm);
    $triggerWidget->addPageHeader(_('Interactive map'), get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen'])));
    $triggerWidget->show();
}
$version = trim(file_get_contents('imap/version'));
textdomain("imap");
//проверяем наличие таблиц в БД
$check_links = true;
if (!DBselect('SELECT 1 FROM hosts_links')) {
    $check_links = false;
    clear_messages(1);
}
if (!DBselect('SELECT 1 FROM hosts_links_settings')) {
    $check_links = false;
    clear_messages(1);
}
//проверяем наличие функции json_encode
if (!function_exists('json_encode')) {
    error("No function 'json_encode' in PHP. Look this http://stackoverflow.com/questions/18239405/php-fatal-error-call-to-undefined-function-json-decode");
}
//проверяем доступ к файлам скрипта
$needThisFiles = array('imap/leaflet/leaflet.js', 'imap/leaflet/plugins/leaflet.markercluster.js', 'imap/imap.js');
foreach ($needThisFiles as $file) {
    if (!is_readable($file)) {
        error(_('If you see this message, it means that the script had problems with access to the files. Try to set read permissions for the web-server to a folder imap.'));
        break;
    }
}
?>
开发者ID:pida42,项目名称:Zabbix-Addons,代码行数:30,代码来源:imap.php

示例12: clear_messages

 * either express or implied. See the License for the specific
 * language governing permissions and limitations under the License.
 */
$this->load->view('template/header');
$this->load->view('template/topbar');
?>
<div id="left-menu-bar">
    <table><tr><td class="left-menu-trigger"><a class="left-menu-trigger"><i class="fa-navicon"></i></a></td></tr></table>
</div>
<div id="main-row" class="row">
    <div class="col-md-12 with-left-menu">
        <?php 
if ($this->session->flashdata('message') || $this->session->userdata('message')) {
    $message = $this->session->userdata('message') ? $this->session->userdata('message') : $this->session->flashdata('message');
    $message_type = $this->session->userdata('message_type') ? $this->session->userdata('message_type') : $this->session->flashdata('message_type');
    clear_messages();
    ?>
            <div id="message" class="alert alert-dismissable alert-<?php 
    echo $message_type;
    ?>
" >
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            <?php 
    echo $message;
    ?>
</div>
            <div class="notifications top-left"></div>
        <?php 
} else {
    ?>
            <div class="notifications top-left"></div>
开发者ID:nicolasconnault,项目名称:streamliner,代码行数:31,代码来源:stages.php

示例13: stage6

 function stage6()
 {
     global $ZBX_CONFIGURATION_FILE;
     $this->setConfig('ZBX_CONFIG_FILE_CORRECT', true);
     $config = new CConfigFile($ZBX_CONFIGURATION_FILE);
     $config->config = array('DB' => array('TYPE' => $this->getConfig('DB_TYPE'), 'SERVER' => $this->getConfig('DB_SERVER'), 'PORT' => $this->getConfig('DB_PORT'), 'DATABASE' => $this->getConfig('DB_DATABASE'), 'USER' => $this->getConfig('DB_USER'), 'PASSWORD' => $this->getConfig('DB_PASSWORD'), 'SCHEMA' => $this->getConfig('DB_SCHEMA')), 'ZBX_SERVER' => $this->getConfig('ZBX_SERVER'), 'ZBX_SERVER_PORT' => $this->getConfig('ZBX_SERVER_PORT'), 'ZBX_SERVER_NAME' => $this->getConfig('ZBX_SERVER_NAME'));
     $config->save();
     if ($config->load()) {
         $error = '';
         if ($config->config['DB']['TYPE'] != $this->getConfig('DB_TYPE')) {
             $error = 'Config file DB type is not equal to wizard input.';
         } else {
             if ($config->config['DB']['SERVER'] != $this->getConfig('DB_SERVER')) {
                 $error = 'Config file DB server is not equal to wizard input.';
             } else {
                 if ($config->config['DB']['PORT'] != $this->getConfig('DB_PORT')) {
                     $error = 'Config file DB port is not equal to wizard input.';
                 } else {
                     if ($config->config['DB']['DATABASE'] != $this->getConfig('DB_DATABASE')) {
                         $error = 'Config file DB database is not equal to wizard input.';
                     } else {
                         if ($config->config['DB']['USER'] != $this->getConfig('DB_USER')) {
                             $error = 'Config file DB user is not equal to wizard input.';
                         } else {
                             if ($config->config['DB']['PASSWORD'] != $this->getConfig('DB_PASSWORD')) {
                                 $error = 'Config file DB password is not equal to wizard input.';
                             } else {
                                 if ($this->getConfig('DB_TYPE') == 'IBM_DB2' && $config->config['DB']['SCHEMA'] != $this->getConfig('DB_SCHEMA')) {
                                     $error = 'Config file DB schema is not equal to wizard input.';
                                 } else {
                                     if ($config->config['ZBX_SERVER'] != $this->getConfig('ZBX_SERVER')) {
                                         $error = 'Config file Zabbix server is not equal to wizard input.';
                                     } else {
                                         if ($config->config['ZBX_SERVER_PORT'] != $this->getConfig('ZBX_SERVER_PORT')) {
                                             $error = 'Config file Zabbix server port is not equal to wizard input.';
                                         } else {
                                             if ($config->config['ZBX_SERVER_NAME'] != $this->getConfig('ZBX_SERVER_NAME')) {
                                                 $error = 'Config file Zabbix server name is not equal to wizard input.';
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     } else {
         $error = $config->error;
     }
     clear_messages();
     if (!empty($error)) {
         error($error);
         show_messages();
         $this->setConfig('ZBX_CONFIG_FILE_CORRECT', false);
     }
     $this->DISABLE_NEXT_BUTTON = !$this->getConfig('ZBX_CONFIG_FILE_CORRECT', false);
     $table = new CTable(null, 'requirements');
     $table->setAlign('center');
     $table->addRow(array('Configuration file: ', $this->getConfig('ZBX_CONFIG_FILE_CORRECT', false) ? new CSpan(S_OK, 'ok') : new CSpan(S_FAIL, 'fail')));
     return array($table, BR(), $this->DISABLE_NEXT_BUTTON ? array(new CButton('retry', S_RETRY), BR(), BR()) : null, !$this->getConfig('ZBX_CONFIG_FILE_CORRECT', false) ? array('Please install configuration file manually, or fix permissions on conf directory.', BR(), BR(), 'Press "Save configuration file" button, download configuration file ', 'and save it as ', BR(), '"' . $ZBX_CONFIGURATION_FILE . '"', BR(), BR(), new CButton('save_config', "Save configuration file"), BR(), BR()) : null, 'When done, press the ' . ($this->DISABLE_NEXT_BUTTON ? '"Retry"' : '"Next"') . ' button');
 }
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:63,代码来源:setup.inc.php

示例14: get_status

function get_status()
{
    global $ZBX_SERVER, $ZBX_SERVER_PORT;
    $status = array();
    // server
    $checkport = fsockopen($ZBX_SERVER, $ZBX_SERVER_PORT, $errnum, $errstr, 2);
    if (!$checkport) {
        clear_messages();
        $status['zabbix_server'] = S_NO;
    } else {
        $status['zabbix_server'] = S_YES;
    }
    // triggers
    $sql = 'SELECT COUNT(DISTINCT t.triggerid) as cnt ' . ' FROM triggers t, functions f, items i, hosts h' . ' WHERE t.triggerid=f.triggerid ' . ' AND f.itemid=i.itemid ' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND i.hostid=h.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED;
    $row = DBfetch(DBselect($sql));
    $status['triggers_count'] = $row['cnt'];
    $row = DBfetch(DBselect($sql . ' AND t.status=0'));
    $status['triggers_count_enabled'] = $row['cnt'];
    $row = DBfetch(DBselect($sql . ' AND t.status=1'));
    $status['triggers_count_disabled'] = $row['cnt'];
    $row = DBfetch(DBselect($sql . ' AND t.status=0 AND t.value=0'));
    $status['triggers_count_off'] = $row['cnt'];
    $row = DBfetch(DBselect($sql . ' AND t.status=0 AND t.value=1'));
    $status['triggers_count_on'] = $row['cnt'];
    $row = DBfetch(DBselect($sql . ' AND t.status=0 AND t.value=2'));
    $status['triggers_count_unknown'] = $row['cnt'];
    // items
    $sql = 'SELECT COUNT(DISTINCT i.itemid) as cnt ' . ' FROM items i, hosts h ' . ' WHERE i.hostid=h.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED;
    $row = DBfetch(DBselect($sql));
    $status['items_count'] = $row['cnt'];
    $row = DBfetch(DBselect($sql . ' AND i.status=0'));
    $status['items_count_monitored'] = $row['cnt'];
    $row = DBfetch(DBselect($sql . ' AND i.status=1'));
    $status['items_count_disabled'] = $row['cnt'];
    $row = DBfetch(DBselect($sql . ' AND i.status=3'));
    $status['items_count_not_supported'] = $row['cnt'];
    // hosts
    $sql = 'SELECT COUNT(hostid) as cnt ' . ' FROM hosts ' . ' WHERE status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ',' . HOST_STATUS_TEMPLATE . ' )';
    $row = DBfetch(DBselect($sql));
    $status['hosts_count'] = $row['cnt'];
    $row = DBfetch(DBselect('SELECT COUNT(hostid) as cnt FROM hosts WHERE status=' . HOST_STATUS_MONITORED));
    $status['hosts_count_monitored'] = $row['cnt'];
    $row = DBfetch(DBselect('SELECT COUNT(hostid) as cnt FROM hosts WHERE status=' . HOST_STATUS_NOT_MONITORED));
    $status['hosts_count_not_monitored'] = $row['cnt'];
    $row = DBfetch(DBselect('SELECT COUNT(hostid) as cnt FROM hosts WHERE status=' . HOST_STATUS_TEMPLATE));
    $status['hosts_count_template'] = $row['cnt'];
    // users
    $row = DBfetch(DBselect('SELECT COUNT(userid) as usr_cnt FROM users u WHERE ' . DBin_node('u.userid')));
    $status['users_count'] = $row['usr_cnt'];
    $status['users_online'] = 0;
    $sql = 'SELECT s.userid, s.status, MAX(s.lastaccess) as lastaccess ' . ' FROM sessions s ' . ' WHERE ' . DBin_node('s.userid') . ' AND s.status=' . ZBX_SESSION_ACTIVE . ' GROUP BY s.userid,s.status';
    $db_sessions = DBselect($sql);
    while ($session = DBfetch($db_sessions)) {
        if ($session['lastaccess'] + ZBX_USER_ONLINE_TIME >= time()) {
            $status['users_online']++;
        }
    }
    // Comments: !!! Don't forget sync code with C !!!
    $sql = 'SELECT sum(1.0/i.delay) as qps ' . ' FROM items i,hosts h ' . ' WHERE i.status=' . ITEM_STATUS_ACTIVE . ' AND i.hostid=h.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND i.delay<>0';
    $row = DBfetch(DBselect($sql));
    $status['qps_total'] = round($row['qps'], 2);
    return $status;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:63,代码来源:config.inc.php

示例15: zabbixIsRunning

function zabbixIsRunning()
{
    global $ZBX_SERVER, $ZBX_SERVER_PORT;
    if (empty($ZBX_SERVER) || empty($ZBX_SERVER_PORT)) {
        return false;
    }
    $result = (bool) fsockopen($ZBX_SERVER, $ZBX_SERVER_PORT, $errnum, $errstr, ZBX_SOCKET_TIMEOUT);
    if (!$result) {
        clear_messages();
    }
    return $result;
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:12,代码来源:config.inc.php


注:本文中的clear_messages函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。