本文整理汇总了PHP中Result::show_cli方法的典型用法代码示例。如果您正苦于以下问题:PHP Result::show_cli方法的具体用法?PHP Result::show_cli怎么用?PHP Result::show_cli使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Result
的用法示例。
在下文中一共展示了Result::show_cli方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: implode
$content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'><a href='" . $Scan->settings->siteURL . "" . create_link("subnets", $section->id, $subnet->id) . "'>" . $Subnets->transform_to_dotted($subnet->subnet) . "/" . $subnet->mask . " - " . $subnet->description . "</a></td>";
$content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'><a href='" . $Scan->settings->siteURL . "" . create_link("subnets", $section->id) . "'>{$section->name} {$section->description}</a></td>";
$content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'>{$ago}</td>";
$content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'>{$oldStatus}</td>";
$content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'>{$newStatus}</td>";
$content[] = "</tr>";
//plain content
$content_plain[] = "\t * " . $Subnets->transform_to_dotted($change['ip_addr']) . " (" . $Subnets->transform_to_dotted($subnet->subnet) . "/" . $subnet->mask . ")\r\n \t " . strip_tags($oldStatus) . " => " . strip_tags($newStatus);
}
$content[] = "</table>";
# set content
$content = $phpipam_mail->generate_message(implode("\r\n", $content));
$content_plain = implode("\r\n", $content_plain);
# try to send
try {
$phpipam_mail->Php_mailer->setFrom($mail_settings->mAdminMail, $mail_settings->mAdminName);
//add all admins to CC
foreach ($recepients as $admin) {
$phpipam_mail->Php_mailer->addAddress($admin['email'], $admin['name']);
}
$phpipam_mail->Php_mailer->Subject = $subject;
$phpipam_mail->Php_mailer->msgHTML($content);
$phpipam_mail->Php_mailer->AltBody = $content_plain;
//send
$phpipam_mail->Php_mailer->send();
} catch (phpmailerException $e) {
$Result->show_cli("Mailer Error: " . $e->errorMessage(), true);
} catch (Exception $e) {
$Result->show_cli("Mailer Error: " . $e->errorMessage(), true);
}
}
示例2: dirname
* either provide it by first argument or via readline
*
*/
# include required scripts
require dirname(__FILE__) . '/../functions.php';
# set debugging
$debugging = false;
$fail = false;
# initialize objects
$Database = new Database_PDO();
$Admin = new Admin($Database, false);
$User = new User($Database, true);
$Result = new Result();
// script can only be run from cli
if (php_sapi_name() != "cli") {
$Result->show_cli("This script can only be run from cli", true);
}
// check if argv[1] provided, if not check readline support and wait for user pass
if (isset($argv[1])) {
$password = $argv[1];
} else {
// get available extensions
$available_extensions = get_loaded_extensions();
// not in array
if (!in_array("readline", $available_extensions)) {
$Result->show_cli("readline php extension is required.\nOr provide password as first argument", true);
} else {
// read password
$line = readline("Enter password: ");
readline_add_history($line);
// save
示例3: dirname
# verbose response - prints results, cron will email it to you!
# include required scripts
require dirname(__FILE__) . '/../functions.php';
require dirname(__FILE__) . '/../../functions/classes/class.Thread.php';
# initialize objects
$Database = new Database_PDO();
$Admin = new Admin($Database, false);
$Subnets = new Subnets($Database);
$DNS = new DNS($Database);
$Result = new Result();
// set to 1 in case of errors
ini_set('display_errors', 0);
error_reporting(E_ERROR);
# cli required
if ($resolve_config['clionly'] && !defined('STDIN')) {
$Result->show_cli("cli only\n", true);
} elseif (!$resolve_config['clionly'] && !defined('STDIN')) {
$User = new User($Database);
# verify that user is logged in
$User->check_user_session();
}
#
# If id is provided via STDIN resolve hosts for 1 subnet only,
# otherwise check all
#
# check all subnets
if (sizeof($resolve_config['subnets']) == 0) {
# get ony ip's with empty DNS
if ($resolve_config['emptyonly'] == 1) {
$query = 'select `id`,`ip_addr`,`dns_name`,`subnetId` from `ipaddresses` where `dns_name` like "" order by `ip_addr` ASC;';
} else {
示例4: dirname
$resolve_config['verbose'] = true;
# verbose response - prints results, cron will email it to you!
# include required scripts
require dirname(__FILE__) . '/../functions.php';
# initialize objects
$Database = new Database_PDO();
$Admin = new Admin($Database, false);
$Subnets = new Subnets($Database);
$DNS = new DNS($Database);
$Result = new Result();
// set to 1 in case of errors
ini_set('display_errors', 0);
error_reporting(E_ERROR);
# cli required
if (php_sapi_name() != "cli") {
$Result->show_cli("cli only\n", true);
}
# set subnet
if (isset($argv[1])) {
$req_subnets = explode(",", $argv[1]);
foreach ($req_subnets as $s) {
if (!is_numeric($s)) {
$Result->show_cli("Invalid subnetId provided - {$s}\n", true);
} else {
$resolve_config['subnets'][] = $s;
}
}
}
#
# If id is provided via STDIN resolve hosts for 1 subnet only,
# otherwise check all