本文整理汇总了PHP中array_search_bool函数的典型用法代码示例。如果您正苦于以下问题:PHP array_search_bool函数的具体用法?PHP array_search_bool怎么用?PHP array_search_bool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了array_search_bool函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($var)
{
if (array_search_bool($var, array('used', 'available', 'kblock'))) {
return getGBOrMB($this->{$var});
}
return $this->{$var};
}
示例2: get_deny_list
function get_deny_list($total)
{
$lxgpath = "__path_home_root/lxguard";
$rmt = lfile_get_unserialize("{$lxgpath}/config.info");
$wht = lfile_get_unserialize("{$lxgpath}/whitelist.info");
$wht = $wht->data;
$disablehit = null;
if ($rmt) {
$disablehit = $rmt->data['disablehit'];
}
if (!($disablehit > 0)) {
$disablehit = 20;
}
$deny = null;
foreach ($total as $k => $v) {
if (array_search_bool($k, $wht)) {
dprint("{$k} found in whitelist... not blocking..\n");
continue;
}
if ($v > $disablehit) {
$deny[$k] = $v;
}
}
return $deny;
}
示例3: updateform
function updateform($subaction, $param)
{
global $gbl, $sgbl, $login, $ghtml;
$sq = new Sqlite(null, 'web');
$list = $sq->getRowsWhere("syncserver = '{$this->syncserver}'", array('nname'));
$dlist = get_namelist_from_arraylist($list, 'nname');
if (!$login->isAdmin()) {
$sq = new Sqlite(null, 'domain');
$nlist = $sq->getRowsWhere("parent_clname = '{$login->getClName()}'", array('nname'));
$ndlist = get_namelist_from_arraylist($nlist);
foreach ($dlist as $k => $v) {
if (!array_search_bool($v, $ndlist)) {
unset($dlist[$k]);
}
}
}
if ($dlist) {
$dlist = add_disabled($dlist);
$vlist['domain'] = array('s', $dlist);
} else {
$vlist['domain'] = array('M', "No Domain");
$vlist['__v_button'] = array();
}
return $vlist;
}
示例4: isSelect
function isSelect()
{
if (if_demo()) {
if (array_search_bool($this->nname, array('wholesale', 'reseller', 'customer'))) {
return false;
}
}
return true;
}
示例5: commandline_main
function commandline_main()
{
global $gbl, $sgbl, $login, $ghtml;
global $argv;
initProgram('admin');
$must = array('action');
$p = parse_opt($argv);
$pk = array_keys($p);
foreach ($must as $m) {
if (!array_search_bool($m, $pk)) {
print "Need action, class and name\n";
exit;
}
}
$func = "__cmd_desc_{$p['action']}";
try {
$list = $func($p);
if ($list) {
if (isset($p['output-type'])) {
if ($p['output-type'] === 'json') {
$out = json_encode($list);
print $out;
} else {
if ($p['output-type'] === 'serialize') {
$out = serialize($list);
print $out;
}
}
} else {
foreach ($list as $l) {
print "{$l}\n";
}
}
} else {
print "{$p['action']} succesfully executed\n";
}
exit(0);
} catch (exception $e) {
print $e->__full_message;
print "\n";
exit(8);
}
}
示例6: display
function display($var)
{
if ($var === 'blocked') {
$wht = $this->getParentO()->getList('lxguardwhitelist');
$wht = get_namelist_from_objectlist($wht, "ipaddress");
if (array_search_bool($this->ipaddress, $wht)) {
return "whitelisted";
}
$ds = $this->getParentO()->disablehit;
if (!$ds) {
$ds = 20;
}
if ($this->failcount >= $ds) {
return "blocked";
}
return null;
}
return $this->{$var};
}
示例7: xp_panel
//.........这里部分代码省略.........
?>
/expand.gif)'\"><td style=\"width:180px;vertical-align: center; \"><font style='font-weight:bold'> " + this.label + "</font></td><td class=" + menuclass + " id=\"" + this.id + "\"" + "onclick=\"toggle(this)\">");
document.write(" <img id=" + this.id + "_image src=" + image + "></td></tr>");
document.write("</table>");
document.write("<div style=\"display: " + disp + "; visibility: " + visib + ";\"" + " class=\"menuItems\" id=\"" + this.id + "_child" + "\">");
document.write("<table border=0 style='background:white' border=0 cellspacing=1 cellpadding=0 width=100%>");
for (iCntr = 0; iCntr < this.smcount; iCntr++) {
this.submenu[iCntr].render();
}
document.write("</table></div>");
}
function toggle(pobjSrc)
{
var strCls = pobjSrc.className;
var strId = pobjSrc.id;
var objTmp, child;
if (pobjSrc.id != _currMenu) {
objTmp = document.getElementById(_currMenu);
}
child = document.getElementById(strId + "_child");
ichild = document.getElementById(strId + "_image");
if (child.style.visibility == "hidden") {
pobjSrc.className = "menuHeaderExpanded";
child.style.visibility = "visible";
child.style.display = "block";
ichild.src = "<?php
echo $skinget;
?>
/minus.gif";
} else {
pobjSrc.className = "menuHeaderCollapsed";
child.style.visibility = "hidden";
child.style.display = "none";
ichild.src = "<?php
echo $skinget;
?>
/plus.gif";
}
_currMenu = pobjSrc.id;
}
</script>
<script language="javascript">
var objTmp;
<?php
if (!$login->getSpecialObject('sp_specialplay')->isOn('disable_quickaction')) {
$class = $login->getQuickClass();
if ($class) {
print "xpreso = createMenu('Quick Actions', '', true);";
$rdesc = print_quick_action($class);
print "createSubMenu(xpreso, '{$rdesc}', '', '', '', '', '');\n";
}
}
$url = $this->getFullUrl("a=list&c=ndskshortcut");
print "xxpFav = createMenu('<font color=#003360>Favorites<a href=\"{$url}\" target=mainframe> [edit] </a>', '', true);";
$rdesc = print_favorites();
print "createSubMenu(xxpFav, '{$rdesc}', '', '', '', '', '');\n";
if ($login->isLte('reseller')) {
print "xxpDescr = createMenu('<font color=#003360>Usage', '', true);";
$rdesc = null;
foreach ((array) $qlist as $or) {
if (!cse($or->vv, "usage") && !cse($or->vv, "_num")) {
continue;
}
if (cse($or->vv, "last_usage")) {
continue;
}
if (is_unlimited($or->resourcepriv)) {
$limit = "∞";
} else {
$limit = $or->display('resourcepriv');
}
$array = array("traffic_usage", "totaldisk_usage", "client_num", "maindomain_num", "vps_num");
if (!array_search_bool($or->vv, $array)) {
continue;
}
$rdesc .= "<tr align=left style=\"border-width:1 ;background:url({$skinget}/a.gif)\" > <td > <img width=15 height=15 src=/img/image/collage/button/state_v_{$or->display('state')}.gif> {$or->shortdescr} </td> <td nowrap> {$or->display('resourceused')} </td> <td align=left> {$limit} </td> </tr>";
}
print "createSubMenu(xxpDescr, '{$rdesc}', '', '', '', '', '');\n";
}
$forumurl = "http://forum.lxcenter.org";
if (!$login->isAdmin() && isset($login->getObject('general')->generalmisc_b->forumurl)) {
$forumurl = $login->getObject('general')->generalmisc_b->forumurl;
}
?>
setTheme("XPClassic.css", null, null);
initialize(<?php
echo $sgbl->__var_lpanelwidth - 20;
?>
);
</script>
<?php
}
示例8: backup_main
function backup_main()
{
global $argc, $argv;
global $gbl, $login, $ghtml;
$gbl->__restore_flag = true;
if ($argc === 1) {
print "Usage: {$argv['0']} --restore/--list --accounts='domain-<domain1.com>,client-<client1>,domain-<domain2.com>' <backup-file> [--switchserverlist='oldserver1:newserver1,oldserver2:newserver2']\n Use --accounts=all to restore everything.\n";
exit;
}
initProgram("admin");
$object = $login;
$opt = parse_opt($argv);
if (isset($opt['class']) && isset($opt['name'])) {
$object = new $opt['class'](null, null, $opt['name']);
$object->get();
if ($object->dbaction === 'add') {
log_error("{$opt['class']} doesnt exist");
print "{$opt['class']} doesnt exist\n";
exit;
}
}
$class = $opt['class'];
$name = $opt['name'];
if (lx_core_lock("{$class}-{$name}.restore")) {
print "Another Restore for the same class is happening..\n";
exit;
}
$backup = $object->getObject('lxbackup');
if (isset($opt['switchserverlist'])) {
$sq = new Sqlite(null, "pserver");
$serverlist = $sq->getTable();
$serverlist = get_namelist_from_arraylist($serverlist);
$server = $opt['switchserverlist'];
$list = explode(",", $server);
foreach ($list as $l) {
if (!$l) {
continue;
}
$q = explode(":", $l);
$rlist[$q[0]] = $q[1];
if (!array_search_bool($q[1], $serverlist)) {
print "The server {$q[1]} doesn't exist in the server system here\n";
exit;
}
}
$param['switchserverlist'] = $rlist;
dprint("\n");
} else {
$param['switchserverlist'] = null;
}
/*
if (!testAllServersWithMessage()) {
$backup->restorestage = "Failed due to: could not connect to slave servers";
clearLxbackup($backup);
exit;
}
*/
$file = $opt['final'];
//$param = get_variable($opt);
if (isset($opt['list'])) {
$gbl->__var_list_flag = true;
$param['_accountselect'] = null;
} else {
if (isset($opt['restore'])) {
$gbl->__var_list_flag = false;
if (!isset($opt['accounts'])) {
print "Restore option needs accounts that are to be restored. --accounts='domain-domain.com,client:clientname'... Use --list to find out all the domain/clients in the backup archive.\n";
clearLxbackup($backup);
exit;
}
$account = $opt['accounts'];
//$account = str_replace(":", "_s_vv_p_", $account);
$account = str_replace(":", "-", $account);
$accountlist = explode(",", $account);
$param['_accountselect'] = $accountlist;
} else {
print "Usage: {$argv['0']} <--list/--restore --accounts=> <filename>\n";
clearLxbackup($backup);
exit;
}
}
if (isset($opt['priority']) && $opt['priority'] === 'low') {
sleep(20);
}
dprintr($param);
//dprint($file);
try {
$backup->doUpdateRestore($file, $param);
$backup->restorestage = 'done';
} catch (exception $e) {
log_error("Restore Failed. Reason: {$e->__full_message} \n");
print "Restore Failed. Reason: {$e->__full_message} \n";
$mess = $e->__full_message;
mail($object->contactemail, "Restore Failed..", "Restore Failed for {$object->nname} with the Message {$mess}");
$backup->restorestage = "Restore failed due to {$mess}";
}
clearLxbackup($backup);
}
示例9: is_image
static function is_image($path)
{
$ext = self::getExtension($path);
$list = array("GIF", "JPG", "PNG", "SWF", "SWC", "PSD", "TIFF", "BMP", "IFF", "JP2", "JPX", "JB2", "JPC", "XBM");
$ext = strtoupper($ext);
if (array_search_bool($ext, $list)) {
return true;
}
return false;
}
示例10: printSelectObjectTable
//.........这里部分代码省略.........
<?php
}
$count = 0;
$rowcount = 0;
?>
<td width=10 background=<?php
echo $imgtablerowhead;
?>
> <form name="formselectall<?php
echo $unique_name;
?>
" value=hello> <input type=checkbox name="selectall<?php
echo $unique_name;
?>
" value=on <?php
if ($sellist) {
echo "checked disabled";
}
?>
onclick="javascript:calljselectall<?php
echo $unique_name;
?>
()"></form> </td>
<?php
print "</tr> ";
print_time('loop');
$n = 1;
foreach ((array) $obj_list as $okey => $obj) {
$checked = '';
// Fix This.
if ($sellist) {
$checked = "checked disabled";
if (!array_search_bool($obj->nname, $sellist)) {
continue;
}
}
$imgpointer = get_general_image_path() . "/button/pointer.gif";
$imgblank = get_general_image_path() . "/button/blank.gif";
?>
<script> loadImage('<?php
echo $imgpointer;
?>
') </script>
<script> loadImage('<?php
echo $imgblank;
?>
') </script>
<tr id=tr<?php
echo $unique_name . $rowcount;
?>
class=tablerow<?php
echo $count;
?>
onmouseover=" swapImage('imgpoint<?php
echo $rowcount;
?>
','','<?php
echo $imgpointer;
?>
',1);" onmouseout="swapImgRestore();">
<td id=td<?php
echo $unique_name . $rowcount;
?>
示例11: initProgram
<?php
include_once "htmllib/lib/include.php";
initProgram('admin');
$plist = parse_opt($argv);
$class = $argv[1];
if (!isset($argv[2])) {
$driverapp = $gbl->getSyncClass(null, 'localhost', $class);
print "Driver for {$class} is {$driverapp}\n";
exit;
}
$pgm = $argv[2];
$server = $login->getFromList('pserver', 'localhost');
$os = $server->ostype;
include "../file/driver/{$os}.inc";
$dr = $server->getObject('driver');
if (!array_search_bool($pgm, $driver[$class])) {
$str = implode(" ", $driver[$class]);
print "The driver name isn't correct: Available drivers for {$class}: {$str}\n";
exit;
}
$v = "pg_{$class}";
$dr->driver_b->{$v} = $pgm;
$dr->setUpdateSubaction();
$dr->write();
print "Successfully changed Driver for {$class} to {$pgm}\n";
示例12: add
static function add($parent, $class, $param)
{
$ticketconfig = $parent->getObject('ticketconfig');
$cmlist = explode(',', $param['text_sent_to_cmlist']);
$cl = $parent->getChildListFilter('L');
foreach ($cl as &$c) {
$c = $parent->getChildNameFromDes($c);
$child = $parent->getList($c);
foreach ((array) $child as $q) {
if (!array_search_bool('--all-children--', $cmlist)) {
if (array_search_bool(self::getNameRep($q), $cmlist)) {
$list[$q->getClName()] = $q;
}
} else {
$list[$q->getClName()] = $q;
}
}
}
$param['text_sent_to_cmlist'] = implode(',', array_keys($list));
$param['text_sent_to_cmlist'] = "," . $param['text_sent_to_cmlist'] . ",";
$param['ddate'] = time();
$param['nname'] = getIncrementedValueFromTable("smessage", "nname");
$param['made_by'] = $parent->getClName();
$param['text_readby_cmlist'] = ",,";
$param['name_made_by'] = $parent->nname;
if (isOn($param['send_mail_f'])) {
self::send_mail_to($list, $param);
}
return $param;
}
示例13: setFileType
function setFileType()
{
global $gbl, $sgbl, $login, $ghtml;
$this->base = basename($this->nname);
$this->fullpath = $this->getFullPath();
$sel_append = NULL;
if (isset($gbl->c_session->ssession_vars["frm_clip_action"]) && $gbl->c_session->ssession_vars['frm_clip_root'] == $this->root && $gbl->c_session->ssession_vars['frm_clip_server'] === $this->syncserver) {
$selaction = $gbl->c_session->ssession_vars["frm_clip_action"];
$sellist = $gbl->c_session->ssession_vars["frm_clip_list"];
if (array_search_bool($this->nname, $sellist)) {
$sel_append = "_" . $selaction;
}
}
if ($this->base === "..") {
$this->ttype = "back";
return;
}
if ($this->base === ".trash") {
$this->ttype = "trash";
$this->protect = "na";
return;
}
if ($this->isInsideTrash()) {
$this->protect = "na";
}
/*
if ($this->is_link()) {
$this->ttype = "link";
return;
}
*/
$this->ttype = "{$this->ttype}{$sel_append}";
if ($this->is_dir()) {
if ($this->getParentO()->is__table('web')) {
if (strpos(dirname($this->nname), '/') === false || dirname($this->nname) === '/') {
if ($this->base != "www") {
$this->protect = "na";
}
}
if (!isset($this->protect)) {
try {
$protname = $this->getParentO()->nname . "_" . coreFfile::getRealPath($this->nname);
$prot = $this->getParentO()->getFromList("dirprotect", $protname);
if ($prot->status != 'nonexistant') {
$this->protect = "on";
} else {
$this->protect = 'off';
}
} catch (exception $e) {
$this->protect = "off";
}
}
}
return;
}
$this->protect = "na";
}
示例14: checkDnsTemplateConsistency
function checkDnsTemplateConsistency($web, $mmail, $dnstemplate)
{
$list = getIpAddressList($web->__masterserver, $web->syncserver);
if (!array_search_bool($dnstemplate->ipaddress, $list)) {
throw new lxexception('dns_template_inconsistency', 'dnstemplate_f');
}
}
示例15: createSSlConf
static function createSSlConf($iplist, $domainiplist)
{
global $gbl, $sgbl, $login, $ghtml;
$string = null;
$alliplist = os_get_allips();
foreach ($iplist as $ip) {
if (!array_search_bool($ip['ipaddr'], $alliplist)) {
continue;
}
// issue related to delete 'exclusive ip/domain'
if (isset($domainiplist[$ip['ipaddr']])) {
$v = $domainiplist[$ip['ipaddr']];
if ($v !== '' && $v !== '--Disabled--') {
continue;
}
}
$ssl_cert = null;
$ssl_cert = sslcert::getSslCertnameFromIP($ip['nname']);
$certificatef = "{$sgbl->__path_ssl_root}/{$ssl_cert}.crt";
$keyfile = "{$sgbl->__path_ssl_root}/{$ssl_cert}.key";
$pemfile = "{$sgbl->__path_ssl_root}/{$ssl_cert}.pem";
$cafile = "{$sgbl->__path_ssl_root}/{$ssl_cert}.ca";
sslcert::checkAndThrow(lfile_get_contents($certificatef), lfile_get_contents($keyfile), $ssl_cert);
if (!lxfile_exists($pemfile)) {
$c = lfile_get_contents($certificatef);
$k = lfile_get_contents($keyfile);
lfile_put_contents($pemfile, "{$c}\n{$k}");
}
$string .= "\$SERVER[\"socket\"] == \"{$ip['ipaddr']}:443\" {\n\n";
$string .= "\tssl.engine = \"enable\"\n";
$string .= "\tssl.pemfile = \"{$pemfile}\"\n";
$string .= "\tssl.ca-file = \"{$cafile}\"\n\n";
$string .= "}\n\n";
}
// issue #725, #760 - ssl.conf must be the first file in listing
// so change name from ssl.conf to __ssl.conf
system("rm -rf /home/lighttpd/conf/defaults/ssl.conf");
$sslfile = "/home/lighttpd/conf/defaults/__ssl.conf";
lfile_put_contents($sslfile, $string);
}