• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getAllSettings函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: create_link

/**
 * create links function
 *
 *	if rewrite is enabled in settings use rewrite, otherwise ugly links
 *
 *	levels: page=$1&section=$2&subnetId=$3&sPage=$4&ipaddrid=$5
 */
function create_link($l1 = null, $l2 = null, $l3 = null, $l4 = null, $l5 = null, $install = false)
{
    # get settings
    global $settings;
    if (!isset($settings) && !$install) {
        $settings = getAllSettings();
    }
    # set rewrite
    if ($settings['prettyLinks'] == "Yes") {
        if (!is_null($l5)) {
            $link = "{$l1}/{$l2}/{$l3}/{$l4}/{$l5}/";
        } elseif (!is_null($l4)) {
            $link = "{$l1}/{$l2}/{$l3}/{$l4}/";
        } elseif (!is_null($l3)) {
            $link = "{$l1}/{$l2}/{$l3}/";
        } elseif (!is_null($l2)) {
            $link = "{$l1}/{$l2}/";
        } elseif (!is_null($l1)) {
            $link = "{$l1}/";
        } else {
            $link = "";
        }
        # prepend base
        $link = BASE . $link;
    } else {
        if (!is_null($l5)) {
            $link = "?page={$l1}&section={$l2}&subnetId={$l3}&sPage={$l4}&ipaddrid={$l5}";
        } elseif (!is_null($l4)) {
            $link = "?page={$l1}&section={$l2}&subnetId={$l3}&sPage={$l4}";
        } elseif (!is_null($l3)) {
            $link = "?page={$l1}&section={$l2}&subnetId={$l3}";
        } elseif (!is_null($l2)) {
            $link = "?page={$l1}&section={$l2}";
        } elseif (!is_null($l1)) {
            $link = "?page={$l1}";
        } else {
            $link = "";
        }
    }
    # result
    return $link;
}
开发者ID:martinsv,项目名称:phpipam,代码行数:49,代码来源:functions-common.php


示例2: php_sapi_name

<?php

/* Script to check status of IP addresses provided in $argv in decimal, returns alive and dead */
//it can only be run from cmd!
$sapi_type = php_sapi_name();
if ($sapi_type != "cli") {
    die;
}
// include required scripts
require_once dirname(__FILE__) . '/../functions.php';
require_once dirname(__FILE__) . '/../scripts/Thread.php';
require_once dirname(__FILE__) . '/config-scan.php';
# get settings
$settings = getAllSettings();
// no error reporting!
ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT);
// test to see if threading is available
if (!Thread::available()) {
    $res['errors'] = "Threading is required for scanning subnets. Please recompile PHP with pcntl extension";
    $res = json_encode($res);
    print_r($res);
    die;
}
$count = 1;
// number of pings
$timeout = 1;
// timeout in seconds
// set result arrays
$alive = array();
// alive hosts
开发者ID:kinhvan017,项目名称:phpipam,代码行数:31,代码来源:scanIPAddressesScript.php


示例3: write_custom_filter

/**
 *	save filtered fields
 */
function write_custom_filter($table, $out)
{
    $settings = getAllSettings();
    if (strlen($settings['hiddenCustomFields']) > 0) {
        $filterField = json_decode($settings['hiddenCustomFields'], true);
    } else {
        $filterField = array();
    }
    # set
    if (is_null($out)) {
        unset($filterField[$table]);
    } else {
        $filterField[$table] = $out;
    }
    # encode
    $filterField = json_encode($filterField);
    # write
    global $database;
    $query = "update `settings` set `hiddenCustomFields`='{$filterField}';";
    try {
        $database->executeQuery($query);
    } catch (Exception $e) {
        $error = $e->getMessage();
        print "<div class='alert alert-danger'>" . _('Error') . ": {$error}</div>";
        return false;
    }
    return true;
}
开发者ID:kinhvan017,项目名称:phpipam,代码行数:31,代码来源:functions-admin.php


示例4: checkADLogin

/**
 * Check user against AD
 */
function checkADLogin($username, $password)
{
    /* get All settings */
    $settings = getAllSettings();
    //include login script
    include dirname(__FILE__) . "/adLDAP/src/adLDAP.php";
    //open connection
    try {
        //get settings for connection
        $ad = getADSettings();
        //AD
        $adldap = new adLDAP(array('base_dn' => $ad['base_dn'], 'account_suffix' => $ad['account_suffix'], 'domain_controllers' => $ad['domain_controllers'], 'use_ssl' => $ad['use_ssl'], 'use_tls' => $ad['use_tls'], 'ad_port' => $ad['ad_port']));
        // set OpenLDAP flag
        if ($settings['domainAuth'] == "2") {
            $adldap->setUseOpenLDAP(true);
        }
    } catch (adLDAPException $e) {
        die('<div class="alert alert-error">' . $e . '</div>');
    }
    //user authentication
    $authUser = $adldap->authenticate($username, $password);
    if ($authUser == true) {
        global $db;
        $database = new database($db['host'], $db['user'], $db['pass'], $db['name']);
        $query = "SELECT id FROM users WHERE username = '{$username}';";
        $user_id = $database->getRow($query);
        if (count($user_id) == 0) {
            $real_name = str_replace('.', ' ', $username);
            $real_name = ucwords($real_name);
            $email = $username . "@enovance.com";
            $query = "INSERT INTO users (username, role, real_name, email, domainUser, lang) VALUES ('{$username}', 'Administrator', '{$real_name}', '{$email}', 1, 1);";
            $database->executeQuery($query);
            $user_id = $database->insert_id;
            if (count($user_id) > 0) {
                updateLogTable('Created user ' . $username . ' successfully', "", 0);
            }
        }
        $database->close();
        if (count($user_id) > 0) {
            updateLogTable('User ' . $username . ' authenticated against AD.', "", 0);
            return 'ok';
        } else {
            updateLogTable('Failed to create user .' . $username, "", 2);
            return "Failed to creater user {$username}";
        }
    } else {
        updateLogTable('User ' . $username . ' failed to authenticate against AD.', "", 2);
        $err = $adldap->getLastError();
        return 'Failed to authenticate user via AD!';
    }
}
开发者ID:krys1976,项目名称:phpipam-1,代码行数:54,代码来源:functions-install.php


示例5: checkAdmin

	<?php 
/**
 *	Mail settings
 **************************/
/* required functions */
require_once '../../functions/functions.php';
/* verify that user is admin */
checkAdmin(false);
/* get settings form post */
$settings = $_POST;
$sitesettings = getAllSettings();
/* set mail parameters */
require_once '../../functions/phpMailer/class.phpmailer.php';
// set mail content
$mail['html'] = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'><html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'></head><body style='margin:0px;padding:0px;background:#f9f9f9;border-collapse:collapse;'>";
$mail['html'] .= "phpIPAM test HTML message";
$mail['html'] .= "</body></html>";
$mail['plain'] = "phpIPAM test text message";
//initialize
$pmail = new PHPMailer(true);
//localhost
$pmail->CharSet = "UTF-8";
//set utf8
$pmail->SMTPDebug = 2;
//debugging
$pmail->Debugoutput = 'html';
//debug type
# localhost
if ($settings['mtype'] == "localhost") {
    // initialize
    try {
开发者ID:btorresgil,项目名称:phpipam,代码行数:31,代码来源:mailSettingsTestMail.php


示例6: checkADLogin

/**
 * Check user against AD
 */
function checkADLogin($username, $password)
{
    /* get All settings */
    $settings = getAllSettings();
    # include login script
    include dirname(__FILE__) . "/adLDAP/src/adLDAP.php";
    # open connection
    try {
        # get settings for connection
        $ad = getADSettings();
        # AD
        $adldap = new adLDAP(array('base_dn' => $ad['base_dn'], 'account_suffix' => $ad['account_suffix'], 'domain_controllers' => $ad['domain_controllers'], 'use_ssl' => $ad['use_ssl'], 'use_tls' => $ad['use_tls'], 'ad_port' => $ad['ad_port']));
        # set OpenLDAP flag
        if ($settings['domainAuth'] == "2") {
            $adldap->setUseOpenLDAP(true);
        }
    } catch (adLDAPException $e) {
        die('<div class="alert alert-danger">' . $e . '</div>');
    }
    # user authentication
    $authUser = $adldap->authenticate($username, $password);
    # result
    if ($authUser == true) {
        return 'ok';
    } else {
        $err = $adldap->getLastError();
        print "<div class='alert alert-danger'>{$err}</div>";
        return 'Failed to authenticate user via AD!';
    }
}
开发者ID:kinhvan017,项目名称:phpipam,代码行数:33,代码来源:functions-install.php


示例7: writeChangelog

/**
 * Write new changelog
 */
function writeChangelog($ctype, $action, $result, $old, $new)
{
    /* set query, open db connection and fetch results */
    global $database;
    # get settings
    $settings = getAllSettings();
    if ($settings['enableChangelog'] == 1) {
        # get user details
        $cuser = getActiveUserDetails();
        # unset unneeded values and format
        if ($ctype == "ip_addr") {
            unset($new['action'], $new['subnet'], $new['type']);
        } elseif ($ctype == "subnet") {
            $new['id'] = $new['subnetId'];
            unset($new['action'], $new['subnetId'], $new['location'], $new['vrfIdOld'], $new['permissions']);
            # if section does not change
            if ($new['sectionId'] == $new['sectionIdNew']) {
                unset($new['sectionIdNew']);
                unset($new['sectionId']);
                unset($old['sectionId']);
            } else {
                $old['sectionIdNew'] = $old['sectionId'];
            }
            //transform subnet
            if (strlen($new['subnet']) > 0) {
                $new['subnet'] = Transform2decimal(substr($new['subnet'], 0, strpos($new['subnet'], "/")));
            }
        } elseif ($ctype == "section") {
            unset($new['action']);
        }
        # calculate diff
        if ($action == "edit") {
            //old - checkboxes
            foreach ($old as $k => $v) {
                if (!isset($new[$k]) && $v == 1) {
                    $new[$k] = 0;
                }
            }
            foreach ($new as $k => $v) {
                //change
                if ($old[$k] != $v && $old[$k] != str_replace("\\'", "'", $v)) {
                    //empty
                    if (strlen(@$old[$k]) == 0) {
                        $old[$k] = "NULL";
                    }
                    if (strlen(@$v) == 0) {
                        $v = "NULL";
                    }
                    //state
                    if ($k == 'state') {
                        $old[$k] = reformatIPStateText($old[$k]);
                        $v = reformatIPStateText($v);
                    } elseif ($k == 'sectionIdNew') {
                        //get old and new device
                        if ($old[$k] != "NULL") {
                            $dev = getSectionDetailsById($old[$k]);
                            $old[$k] = $dev['name'];
                        }
                        if ($v != "NULL") {
                            $dev = getSectionDetailsById($v);
                            $v = $dev['name'];
                        }
                    } elseif ($k == "masterSubnetId") {
                        if ($old[$k] == 0) {
                            $old[$k] = "Root";
                        } else {
                            $dev = getSubnetDetailsById($old[$k]);
                            $old[$k] = transform2long($dev['subnet']) . "/{$dev['mask']} [{$dev['description']}]";
                        }
                        if ($v == 0) {
                            $v = "Root";
                        } else {
                            $dev = getSubnetDetailsById($v);
                            $v = transform2long($dev['subnet']) . "/{$dev['mask']} [{$dev['description']}]";
                        }
                    } elseif ($k == 'switch') {
                        if ($old[$k] == 0) {
                            $old[$k] = "None";
                        } elseif ($old[$k] != "NULL") {
                            $dev = getDeviceDetailsById($old[$k]);
                            $old[$k] = $dev['hostname'];
                        }
                        if ($v == 0) {
                            $v = "None";
                        }
                        if ($v != "NULL") {
                            $dev = getDeviceDetailsById($v);
                            $v = $dev['hostname'];
                        }
                    } elseif ($k == 'vlanId') {
                        //get old and new device
                        if ($old[$k] == 0) {
                            $old[$k] = "None";
                        } elseif ($old[$k] != "NULL") {
                            $dev = getVLANById($old[$k]);
                            $old[$k] = $dev['name'] . " [{$dev['number']}]";
                        }
//.........这里部分代码省略.........
开发者ID:retexica,项目名称:phpipam,代码行数:101,代码来源:functions-network.php


示例8: fetchSubnets

/**
 * Get all subnets in provided sectionId
 */
function fetchSubnets($sectionId, $orderType = "subnet", $orderBy = "asc")
{
    global $db;
    # get variables from config file
    /* check for sorting in settings and override */
    $settings = getAllSettings();
    /* get section details to check for ordering */
    $section = getSectionDetailsById($sectionId);
    // section ordering
    if ($section['subnetOrdering'] != "default" && strlen($section['subnetOrdering']) > 0) {
        $sort = explode(",", $section['subnetOrdering']);
        $orderType = $sort[0];
        $orderBy = $sort[1];
    } elseif (isset($settings['subnetOrdering'])) {
        $sort = explode(",", $settings['subnetOrdering']);
        $orderType = $sort[0];
        $orderBy = $sort[1];
    }
    /* set query, open db connection and fetch results */
    $query = "select * from `subnets` where `sectionId` = '{$sectionId}' ORDER BY `masterSubnetId`,`{$orderType}` {$orderBy};";
    $database = new database($db['host'], $db['user'], $db['pass'], $db['name']);
    /* execute */
    try {
        $subnets = $database->getArray($query);
    } catch (Exception $e) {
        $error = $e->getMessage();
        print "<div class='alert alert-error'>" . _('Error') . ":{$error}</div>";
        return false;
    }
    $database->close();
    /* return subnets array */
    return $subnets;
}
开发者ID:krys1976,项目名称:phpipam-1,代码行数:36,代码来源:functions-network.php


示例9: checkADLogin

/**
 * Check user against AD
 */
function checkADLogin($username, $password)
{
    /* first checked if it is defined in database - username and ad option */
    global $db;
    # get variables from config file
    /*     global $ad; */
    /* check if user exists in local database */
    $database = new database($db['host'], $db['user'], $db['pass'], $db['name']);
    $query = 'select count(*) as count from users where `username` = binary "' . $username . '" and `domainUser` = "1";';
    /* execute */
    try {
        $result = $database->getArray($query);
    } catch (Exception $e) {
        $error = $e->getMessage();
        print "<div class='alert alert-danger'>" . _('Error') . ": {$error}</div>";
        return false;
    }
    /* close database connection */
    $database->close();
    /* get All settings */
    $settings = getAllSettings();
    /* if yes try with AD */
    if ($result[0]['count'] == "1") {
        //include login script
        include dirname(__FILE__) . "/adLDAP/src/adLDAP.php";
        //open connection
        try {
            //get settings for connection
            $ad = getADSettings();
            //AD
            $adldap = new adLDAP(array('base_dn' => $ad['base_dn'], 'account_suffix' => $ad['account_suffix'], 'domain_controllers' => $ad['domain_controllers'], 'use_ssl' => $ad['use_ssl'], 'use_tls' => $ad['use_tls'], 'ad_port' => $ad['ad_port']));
            // set OpenLDAP flag
            if ($settings['domainAuth'] == "2") {
                $adldap->setUseOpenLDAP(true);
            }
        } catch (adLDAPException $e) {
            die('<div class="alert alert-danger">' . $e . '</div>');
        }
        //user authentication
        $authUser = $adldap->authenticate($username, $password);
        if ($authUser == true) {
            updateLogTable('User ' . $username . ' authenticated against AD.', "", 0);
            return 'ok';
        } else {
            updateLogTable('User ' . $username . ' failed to authenticate against AD.', "", 2);
            $err = $adldap->getLastError();
            print "<div class='alert alert-danger'>{$err}</div>";
            return 'Failed to authenticate user via AD!';
        }
    } else {
        return false;
    }
}
开发者ID:btorresgil,项目名称:phpipam,代码行数:56,代码来源:functions-install.php


示例10: getAllSettingsFromEmployee

 function getAllSettingsFromEmployee($reselleremployee)
 {
     return getAllSettings($reselleremployee, 'reselleremployee');
 }
开发者ID:schpill,项目名称:standalone,代码行数:4,代码来源:functions.php


示例11: logger

 } else {
     if ($function == 'getSettings') {
         logger("Getting Settings");
         getAllSettings($rptuser);
         sendResponse($finalResult['SettingsInfo'], 'setting');
     } else {
         if ($function == 'saveSettings') {
             logger("Saving Settings - {$m}, {$d}, {$r}");
             saveSettings($rptuser, $m, $d, $r);
             getAllSettings($rptuser);
             sendResponse($finalResult['SettingsInfo'], 'setting');
         } else {
             if ($function == 'saveWidgetOrder') {
                 logger("Saving Widget Order - {$p1}, {$p2}, {$p3}, {$p4}");
                 saveWidgetOrder($rptuser, $p1, $p2, $p3, $p4);
                 getAllSettings($rptuser);
                 sendResponse($finalResult['SettingsInfo'], 'setting');
             } else {
                 if ($function == 'saveWidgetOptions') {
                     logger("Saving Widget Options: {$wID}, {$layout}, {$type}, {$color}, {$bgnd}");
                     saveWidgetOptions($rptuser, $wID, $layout, $type, $color, $bgnd);
                 } else {
                     if ($function == 'execQuery') {
                         // Get query without html entities
                         foreach ($_REQUEST as $key => $val) {
                             if ($key == 'rquery') {
                                 $rquery = $val;
                                 break;
                             }
                         }
                         $rquery = str_replace("\\\"", "\"", $rquery);
开发者ID:arvindt,项目名称:rgen,代码行数:31,代码来源:db_funcs.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getAllTaxes函数代码示例发布时间:2022-05-15
下一篇:
PHP getAllQuestionsAccountType函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap