本文整理汇总了PHP中Bs_IniHandler::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Bs_IniHandler::get方法的具体用法?PHP Bs_IniHandler::get怎么用?PHP Bs_IniHandler::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bs_IniHandler
的用法示例。
在下文中一共展示了Bs_IniHandler::get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: progression_quarantine
function progression_quarantine()
{
if (is_file("/usr/share/artica-postfix/ressources/logs/mailarchive-quarantine-progress.ini")) {
$file = "/usr/share/artica-postfix/ressources/logs/mailarchive-quarantine-progress.ini";
} else {
if (is_file("/usr/share/artica-postfix/ressources/mailarchive-quarantine-progress.ini")) {
$file = "/usr/share/artica-postfix/ressources/mailarchive-quarantine-progress.ini";
}
}
if ($file == null) {
$total = 0;
$current = 0;
$pourc = 100;
}
$ini = new Bs_IniHandler($file);
$tot = $ini->get("PROGRESS", "total");
$cur = $ini->get("PROGRESS", "current");
$pid = $ini->get("PROGRESS", "pid");
$quarantine_type = $ini->get("PROGRESS", "quarantine");
if ($tot > 0) {
$pourc = round($cur / $tot, 2);
$pourc = $pourc * 100;
$img = "<img src='img/wait.gif'>";
} else {
$pourc = 100;
}
if ($pourc == 100) {
$img = " ";
}
$color = "#5DD13D";
$html = "<table style='width:100%'>\n\t<tr>\n\t\t<td align='center' colspan=2><strong style='font-size:13px'>«{$quarantine_type}» {$cur}/{$tot} (pid:{$pid}) </td>\n\t</tr>\n\t\t\n\t<tr>\n\t\t<td width=1%><span id='wait'>{$img}</span>\n\t\t</td>\n\t\t<td width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t<td>\n\t\t\t\t<div style='width:100%;background-color:white;padding-left:0px;border:1px solid {$color}'>\n\t\t\t\t\t<div id='progression_postfix'>\n\t\t\t\t\t\t<div style='width:{$pourc}%;text-align:center;color:white;padding-top:3px;padding-bottom:3px;background-color:{$color}'>\n\t\t\t\t\t\t\t<strong style='color:#BCF3D6;font-size:12px;font-weight:bold'>{$pourc}%</strong></center>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\t\t\n\t\t</td>\n\t</tr>\n\t</table>";
return $html;
}
示例2: watchdog
function watchdog()
{
$ini = new Bs_IniHandler("/etc/artica-postfix/smtpnotif.conf");
$PostfixQueueEnabled = $ini->get("SMTP", "PostfixQueueEnabled");
$PostfixQueueMaxMails = $ini->get("SMTP", "PostfixQueueMaxMails");
if ($PostfixQueueEnabled == null) {
$PostfixQueueEnabled = 1;
}
if ($PostfixQueueMaxMails == null) {
$PostfixQueueMaxMails = 20;
}
if ($PostfixQueueEnabled != 1) {
return;
}
$postfix_system = new postfix_system();
$array = $postfix_system->getQueuesNumber();
while (list($num, $val) = each($array)) {
$logs[] = "{$num}={$val} message(s)";
if (intval($val) > $PostfixQueueMaxMails) {
if (is_file("/etc/artica-postfix/croned.1/postfix.{$num}.exceed")) {
if (file_time_min("/etc/artica-postfix/croned.1/postfix.{$num}.exceed") < 30) {
continue;
}
}
@file_put_contents("/etc/artica-postfix/croned.1/postfix.{$num}.exceed", "#");
$subject = "Postfix queue {$num} exceed limit";
$text = "The {$num} storage queue contains {$val} messages\nIt exceed the maximum {$PostfixQueueMaxMails} messages number...";
send_email_events($subject, $text, 'system');
}
}
$logs[] = "{$num}={$val} message(s)";
RTMevents(implode(" ", $logs));
}
示例3: PostfixAutoBlockCompileCheck
function PostfixAutoBlockCompileCheck()
{
$ini = new Bs_IniHandler();
$ini->loadFile("ressources/logs/compile.iptables.progress");
$pourc = $ini->get("PROGRESS", "pourc");
$text = $ini->get("PROGRESS", "text");
$color = "#5DD13D";
$html = "\n<center>\n<div style='width:96%;text-align:center;font-size:12px;font-weight:bold;margin:5px;background-color:white;padding:5px;border:1px solid #CCCCCC'>\n\t<div style='width:95%;text-align:center;font-size:12px;font-weight:bold;margin:5px'>{$text}</div>\n\t<div style='width:100%;border:1px dotted #CCCCCC'>\n\t<div style='width:{$pourc}%;text-align:center;color:white;padding-top:3px;padding-bottom:3px;background-color:{$color};'>\n\t\t<strong style='color:#BCF3D6;font-size:12px;font-weight:bold'>{$pourc}%</strong></center>\n\t</div>\n\t</div>\n</div>\n</center>\n";
$html = RoundedLightWhite($html);
$tpl = new templates();
echo $tpl->_ENGINE_parse_body($html, "postfix.index.php");
}
示例4: NightlyNotifs
function NightlyNotifs()
{
$sock = new sockets();
$ini = new Bs_IniHandler("ressources/index.ini");
$nightly = $ini->get("NEXT", "artica-nightly");
$version = $sock->getFrameWork("cmd.php?uri=artica_version");
$nightlybin = str_replace('.', '', $nightly);
$versionbin = str_replace('.', '', $version);
if ($versionbin == 0) {
return;
}
if ($nightlybin == 0) {
return;
}
if ($nightlybin > $versionbin) {
echo ParagrapheTEXT("32-infos.png", "{NEW_NIGHTLYBUILD}: {$nightly}", '{NEW_NIGHTLYBUILD_TEXT}', "javascript:Loadjs('artica.update.php?js=yes');", null, 330);
}
}
示例5: NightlyNotifs
function NightlyNotifs()
{
if ($GLOBALS["VERBOSE"]) {
echo "<H1>NightlyNotifs()</H1>\n";
}
$sock = new sockets();
$EnableNightlyInFrontEnd = $sock->GET_INFO("EnableNightlyInFrontEnd");
if (!is_numeric($EnableNightlyInFrontEnd)) {
$EnableNightlyInFrontEnd = 1;
}
if ($EnableNightlyInFrontEnd == 0) {
if ($GLOBALS["VERBOSE"]) {
echo "<span style=color:blue>EnableNightlyInFrontEnd={$EnableNightlyInFrontEnd}</span><br>\n";
}
return;
}
if (!is_file("ressources/index.ini")) {
if ($GLOBALS["VERBOSE"]) {
echo "<span style=color:blue>ressources/index.ini no such file</span><br>\n";
}
return;
}
$ini = new Bs_IniHandler("ressources/index.ini");
if (!isset($ini->_params["NEXT"])) {
$sock->getFrameWork("system.php?refresh-index-ini=yes");
$ini = new Bs_IniHandler("ressources/index.ini");
}
$nightly = $ini->get("NEXT", "artica-nightly");
$version = @file_get_contents("VERSION");
$nightlybin = str_replace('.', '', $nightly);
$versionbin = str_replace('.', '', $version);
if ($GLOBALS["VERBOSE"]) {
echo "<span style=color:blue>{$nightlybin} = {$versionbin}</span><br>\n";
}
if ($versionbin == 0) {
return;
}
if ($nightlybin == 0) {
return;
}
if ($nightlybin > $versionbin) {
$tpl = new templates();
$html = "<div style='margin-bottom:15px'>" . Paragraphe("download-info-64.png", "{NEW_NIGHTLYBUILD}: {$nightly}", "{NEW_NIGHTLYBUILD_TEXT}", "javascript:Loadjs('artica.update.php?js=yes')", "go_to_section", 665, 132, 1);
$html = $tpl->_ENGINE_parse_body($html) . "</div>";
echo $html;
return;
}
}
示例6: postfixlogger_progress
function postfixlogger_progress()
{
$user = new usersMenus();
if (is_file("/usr/share/artica-postfix/ressources/logs/postfix-logger.ini")) {
$ini = new Bs_IniHandler("/usr/share/artica-postfix/ressources/logs/postfix-logger.ini");
} else {
$ini = new Bs_IniHandler();
}
$max = $ini->get("PROGRESS", "max");
$current = $ini->get("PROGRESS", "current");
$type = $ini->get("PROGRESS", "type");
$endtime = $ini->get("PROGRESS", "time");
if ($current == null) {
$current = 0;
}
if ($type == null) {
$type = "{scheduled}";
}
if ($endtime == null) {
$endtime = date("H:i:s");
}
if ($max != null) {
$pourc = round($current / $max, 2) * 100;
} else {
$pourc = "0";
}
$queue = $user->POSTFIX_QUEUE["RTM"];
$endtime = str_replace("Y-m-d", "", $endtime);
$color = "#5DD13D";
$html = "\n<table style='width:100%'>\n<tr>\n<td valign='top'>\n<table style='width:100%'>\n\t<tr>\n\t\t<td align='center' colspan=2><strong style='font-size:11px'>«{$type}» {$current}/{$max}/{$queue} ({end}:{$endtime}) </td>\n\t</tr>\n\t\t\n\t<tr>\n\t\t<td width=1%><span id='wait'>{$img}</span>\n\t\t</td>\n\t\t<td width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t<td>\n\t\t\t\t<div style='width:100%;background-color:white;padding-left:0px;border:1px solid {$color}'>\n\t\t\t\t\t<div id='progression_postfix'>\n\t\t\t\t\t\t<div style='width:{$pourc}%;text-align:center;color:white;padding-top:3px;padding-bottom:3px;background-color:{$color}'>\n\t\t\t\t\t\t\t<strong style='color:#BCF3D6;font-size:12px;font-weight:bold'>{$pourc}%</strong></center>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\t\t\n\t\t</td>\n\t</tr>\n\t</table>\n</td>\n<td valign='top' width=1%>\n\t<div style='padding:2px;border:1px solid #CCCCCC'>" . imgtootltip("rouage-32.png", "{parameters}", "Loadjs('RTMMailConfig.php')") . "</div>\n</td>\n<td valign='top' width=1%>\n\t<div style='padding:2px;border:1px solid #CCCCCC'>" . imgtootltip("loupe-32.png", "{detach}", "Loadjs('RTMMail.php')") . "</div>\n</td>\n\n\n\n</tr>\n</table>";
return $html;
}
示例7: ExportStatus
function ExportStatus()
{
if (!is_file("ressources/logs/export.status.conf")) {
return null;
}
$ini = new Bs_IniHandler("ressources/logs/export.status.conf");
echo Status($ini->get('STATUS', 'progress'), $ini->get('STATUS', 'text'));
}
示例8: Status
function Status()
{
$ini = new Bs_IniHandler('ressources/logs/nmap.progress.ini');
$pourc = $ini->get('NMAP', 'pourc');
$text = $ini->get('NMAP', 'text');
if ($pourc == null) {
$pourc = 0;
}
if ($pourc == 0) {
$text = "{sleeping}";
}
if ($pourc == 100) {
$text = "{success}";
}
$color = "#5DD13D";
$tpl = new templates();
$html = "\n<table style='width:100%'>\n<tr>\n<td valign='top'>\n\t<p class=caption>{$text}...</p>\n\t<div style='width:100%;background-color:white;padding-left:0px;border:1px solid {$color}'>\n\t\t<div id='progression_computers'>\n\t\t\t<div style='width:{$pourc}%;text-align:center;color:white;padding-top:3px;padding-bottom:3px;background-color:{$color}'>\n\t\t\t\t<strong style='color:#BCF3D6;font-size:12px;font-weight:bold'>{$pourc}%</strong></center>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</td>\n<td valign=middle width=1%><div style='background-color:white;padding:5px'>" . imgtootltip('loupe-32.png', '{events}', "ViewComputerScanLogs()") . "</div></td>\n</tr>\n</table>\n";
echo $tpl->_ENGINE_parse_body($html);
}
示例9: restore_status
function restore_status()
{
if (!is_file("ressources/logs/exec.dar.find.restore.ini")) {
echo Status(10, "{waiting}...");
return null;
}
$ini = new Bs_IniHandler("ressources/logs/exec.dar.find.restore.ini");
echo Status($ini->get('STATUS', 'progress'), $ini->get('STATUS', 'text'));
}
示例10: PostfixLoadeMailsQueue
function PostfixLoadeMailsQueue()
{
$tpl = new templates();
$tot = $_GET["total"];
if (!isset($_GET["numStart"])) {
$numStart = 0;
}
if (!isset($_GET["tab"])) {
$tab = 0;
} else {
$tab = $_GET["tab"];
}
if ($tab == '') {
$tab = 0;
}
$queue_name = $_GET["PostfixLoadeMailsQueue"];
$ini = new Bs_IniHandler();
if (!is_file('ressources/databases/postfix-queue-cache.conf')) {
return $tpl->_ENGINE_parse_body("{no_cache_created}");
}
$ini->loadFile('ressources/databases/postfix-queue-cache.conf');
$PagesNumber = $ini->get($queue_name, 'PagesNumber');
if ($PagesNumber > 0) {
$tabublation = Tabs($PagesNumber, $queue_name);
}
$filetemp = "ressources/databases/queue.list.{$tab}.{$queue_name}.cache";
if (!is_file($filetemp)) {
return $tpl->_ENGINE_parse_body("<strong>{unable_to_locate}: {$filetemp}</strong>");
}
$datas = explode("\n", file_get_contents($filetemp));
$countRows = count($datas);
$number_pages = round($tot / $countRows);
$html = "\n\t<H4>{queue} {$queue_name} {$PagesNumber} {pages} {$countRows} {lines}</H4>\n\t<div align='right' class=caption>{from_cache_file} {$filetemp}</div>\n\t{$tabublation}\n\t<table style='width:100%'>\n\t<tr class='caption'>\n\t<td><strong>{date}</strong></td>\n\t<td><strong>{operation}</strong></td>\n\t<td><strong>{mail_from}</strong></td>\n\t<td><strong>{mail_to}</strong></td>\n\t<td><strong>{delete}</strong></td>\n\t</tr>\n\t";
while (list($num, $val) = each($datas)) {
$val = str_replace('<sender></sender>', '<sender>unknown</sender>', $val);
if (preg_match('#<file>(.+?)</file><path>(.+?)</path><time>(.+?)</time><named_attr>(.+?)</named_attr><sender>(.+?)</sender><recipient>(.+?)</recipient><subject>(.+?)</subject>#', $val, $regs)) {
$file = $regs[1];
$path = $regs[2];
$time = PostFixTimeToPhp($regs[3]);
$named = $regs[4];
$sender = $regs[5];
$recipient = $regs[6];
$subject = utf8_decode($subject);
$subject = htmlentities('"' . $regs[7] . '"');
$varClick = "OnClick=\"javascript:LoadMailID('{$file}','{$queue_name}','{$tab}')\"";
$tooltips = "<strong>{$file}</strong><br>{$subject}";
$html = $html . "\n\t\t\t<tr " . CellRollOver(null, $tooltips) . " class=caption>\n\t\t\t<td nowrap {$varClick}>{$time}</td>\n\t\t\t<td {$varClick}>{$named}</td>\n\t\t\t<td {$varClick}>{$sender}</td>\n\t\t\t<td {$varClick}>{$recipient}</td>\n\t\t\t<td align='center' width=1%>" . imgtootltip('x.gif', '{delete}', "DeleteMailID('{$queue_name}','{$tab}','{$file}')") . "</td>\n\t\t\t</tr>\n\t\t\t";
$count = $count + 1;
if ($count > 100) {
break;
}
}
}
$tpl = new templates();
$html = $tpl->_ENGINE_parse_body($html);
$html = $html . "</table>";
return $html;
}
示例11: js_right_status
function js_right_status($pourc = 0)
{
$color = "white";
$file = "ressources/logs/exec-right.status.ini";
if ($pourc == 0) {
if (!is_file($file)) {
error_log("unable to stat ressources/logs/exec-right.status.ini");
}
$ini = new Bs_IniHandler("ressources/logs/exec-right.status.ini");
$pourc = $ini->get("status", 'pourc');
$text = $ini->get("status", 'text');
} else {
$text = "Waiting...";
}
if ($pourc < 1) {
$pourc = 5;
}
$color = "#5DD13D";
$html = "\n\t<div style='width:{$pourc}%;text-align:center;color:white;padding-top:3px;padding-bottom:3px;background-color:{$color}'>\n\t\t<strong style='color:#BCF3D6;font-size:12px;font-weight:bold'>{$pourc}% {$text}</strong></center>\n\t</div>\n\t<input type='hidden' id='js-right-id' value='{$pourc}'>\n\t\n";
return $html;
}
示例12: ChangeRoot
function ChangeRoot($instance_id)
{
echo "Loading instance {$instance_id}\n";
$mysqld = new mysqlserver_multi($instance_id);
$username = $mysqld->mysql_admin;
$password = $mysqld->mysql_password;
if ($password == null) {
echo "Password is null, aborting\n";
return;
}
$unix = new unix();
$mysqld_safe = $unix->find_program("mysqld_safe");
$nohup = $unix->find_program("nohup");
$killbin = $unix->find_program("kill");
echo "mysqld_safe:{$mysqld_safe}\n";
$ini = new Bs_IniHandler();
$ini->loadFile("/etc/mysql-multi.cnf");
$array = $ini->_params["mysqld{$instance_id}"];
$datadir = $ini->get("mysqld{$instance_id}", "datadir");
while (list($key, $value) = each($array)) {
$tt[] = "{$key} = {$value}";
}
$newconfig = "[mysqld]\n" . @implode("\n", $tt) . "\n";
@file_put_contents("/etc/mysql-temp-{$instance_id}.cf", $newconfig);
for ($i = 0; $i < 5; $i++) {
$pid = multi_get_pid($instance_id);
if ($pid > 0) {
echo "Stopping mysqld safe pid:{$pid}\n";
unix_system_kill_force($pid);
sleep(1);
} else {
break;
}
}
echo "Stopping instance {$instance_id}\n";
//shell_exec($unix->LOCATE_PHP5_BIN()." /usr/share/artica-postfix/exec.mysql.build.php --multi-stop $instance_id >/dev/null 2>&1");
for ($i = 0; $i < 5; $i++) {
$pid = multi_get_pidNormal($instance_id);
if ($pid > 0) {
echo "Stopping mysqld pid:{$pid}\n";
unix_system_kill_force($pid);
sleep(1);
} else {
break;
}
}
$pid = @file_get_contents("/var/run/mysqld/mysqld{$instance_id}.pid");
if ($unix->process_exists($pid)) {
echo "Stopping instance {$instance_id} failed...\n";
return;
}
echo "Running instance {$instance_id} in safe mode...\n";
if (file_exists("{$datadir}/error.log")) {
@unlink("{$datadir}/error.log");
}
$cmd = "{$nohup} {$mysqld_safe} --defaults-file=/etc/mysql-temp-{$instance_id}.cf --datadir=\"{$datadir}\" --skip-grant-tables --skip-networking --skip-external-locking --log-error=\"{$datadir}/error.log\" --pid-file=/var/run/mysqld/mysqld{$instance_id}.pid >/dev/null 2>&1 &";
if ($GLOBALS["VERBOSE"]) {
echo "{$cmd}\n";
}
shell_exec($cmd);
for ($i = 0; $i < 4; $i++) {
sleep(1);
$pid = @file_get_contents("/var/run/mysqld/mysqld{$instance_id}.pid");
if ($unix->process_exists($pid)) {
sleep(1);
break;
}
}
$pid = @file_get_contents("/var/run/mysqld/mysqld{$instance_id}.pid");
if (!$unix->process_exists($pid)) {
echo "Failed to run mysqld safe\n";
if (file_exists("{$datadir}/error.log")) {
echo @file_get_contents("{$datadir}/error.log");
}
shell_exec($nohup . " " . $unix->LOCATE_PHP5_BIN() . " /usr/share/artica-postfix/exec.mysql.build.php --multi-start {$instance_id} >/dev/null 2>&1 &");
return;
}
$q = new mysql_multi($instance_id);
$ligne = mysql_fetch_array($q->QUERY_SQL("SELECT User from user WHERE User='{$username}' LIMIT 0,1", "mysql"));
if (!$q->ok) {
echo $q->mysql_error . "\n";
}
echo "User:{$username} = {$ligne["User"]}\n";
if ($ligne["User"] != null) {
echo "User: Already exists, update password\n";
$sqlstring = "UPDATE user SET password=PASSWORD(\"{$password}\") WHERE user=\"{$username}\"";
$q->QUERY_SQL($sqlstring, "mysql");
if (!$q->ok) {
echo $q->mysql_error . "\n";
}
$q->QUERY_SQL_NO_BASE("FLUSH PRIVILEGES");
if (!$q->ok) {
echo $q->mysql_error . "\n";
}
} else {
echo "Root: did not exists, Create a new one...\n";
$q->QUERY_SQL_NO_BASE("create user root@localhost");
$q->QUERY_SQL_NO_BASE("GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' with grant option");
$q->QUERY_SQL_NO_BASE("FLUSH PRIVILEGES");
}
//.........这里部分代码省略.........