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


PHP common::read_ini_file方法代码示例

本文整理汇总了PHP中common::read_ini_file方法的典型用法代码示例。如果您正苦于以下问题:PHP common::read_ini_file方法的具体用法?PHP common::read_ini_file怎么用?PHP common::read_ini_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common的用法示例。


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

示例1: generatePeersFile

 function generatePeersFile($resellerid)
 {
     global $db, $config;
     if ($config['system']['sipfile'] == '') {
         return;
     }
     $accountcode = '';
     $clid_context = '';
     $query = "SELECT * FROM resellergroup WHERE id = {$resellerid}";
     $reseller = $db->getRow($query);
     $accountcode = $reseller['accountcode'];
     $clid_context = $reseller['clid_context'];
     $configstatus = common::read_ini_file($config['system']['astercc_path'] . '/astercc.conf', $asterccConfig);
     if ($asterccConfig['system']['billingfield'] != 'accountcode') {
         $accountcode = $reseller['accountcode'];
     }
     $query = "SELECT * FROM accountgroup WHERE resellerid = {$resellerid}";
     $group_list = $db->query($query);
     $content = '';
     while ($group_list->fetchInto($group)) {
         if ($group['accountcode'] != '' && $asterccConfig['system']['billingfield'] != 'accountcode') {
             $accountcode = $group['accountcode'];
         }
         $query = "SELECT * FROM clid WHERE groupid = " . $group['id'] . " ORDER BY clid ASC";
         $clid_list = $db->query($query);
         while ($clid_list->fetchInto($row)) {
             if ($asterccConfig['system']['billingfield'] == 'accountcode') {
                 $accountcode = $row['clid'];
             }
             $content .= "[" . $row['clid'] . "]\n";
             foreach ($config['sipbuddy'] as $key => $value) {
                 if ($clid_context != '' && strtolower(trim($key)) == 'context') {
                     $content .= "{$key} = {$clid_context}\n";
                     continue;
                 }
                 if ($key != '' && $value != '') {
                     $content .= "{$key} = {$value}\n";
                 }
             }
             if ($accountcode != "" && $accountcode != "''") {
                 $content .= "accountcode = " . $accountcode . "\n";
             }
             $content .= "secret = " . $row['pin'] . "\n";
             $content .= "callerid = \"" . $row['clid'] . "\" <" . $row['clid'] . ">\n";
             $content .= "accountcode = " . $row['accountcode'] . "\n\n";
         }
     }
     $filename = $config['system']['sipfile'] . "_{$resellerid}.conf";
     $fp = fopen($filename, "w");
     if (!$fp) {
         print "file: {$filename} open failed, please check the file permission";
         exit;
     }
     fwrite($fp, $content);
 }
开发者ID:ljhcj,项目名称:IRISCC,代码行数:55,代码来源:asterevent.class.php

示例2: processAccountData

/**
*  function to verify user data
*	
*  	@param $aFormValues	(array)			login form data
															$aFormValues['username']
															$aFormValues['password']
															$aFormValues['locate']
*	@return $objResponse
*  @session
															$_SESSION['curuser']['username']
															$_SESSION['curuser']['extension']
															$_SESSION['curuser']['extensions']
															$_SESSION['curuser']['country']
															$_SESSION['curuser']['language']
															$_SESSION['curuser']['channel']
															$_SESSION['curuser']['accountcode']
*/
function processAccountData($aFormValues)
{
    global $db, $config;
    list($_SESSION['curuser']['country'], $_SESSION['curuser']['language']) = split("_", $aFormValues['locate']);
    //get locate parameter
    $locate = new Localization($_SESSION['curuser']['country'], $_SESSION['curuser']['language'], 'login');
    $objResponse = new xajaxResponse();
    $bError = false;
    $loginError = false;
    if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
        if ($_SERVER["HTTP_CLIENT_IP"]) {
            $proxy = $_SERVER["HTTP_CLIENT_IP"];
        } else {
            $proxy = $_SERVER["REMOTE_ADDR"];
        }
    } else {
        if (isset($_SERVER["HTTP_CLIENT_IP"])) {
            $ip = $_SERVER["HTTP_CLIENT_IP"];
        } else {
            $ip = $_SERVER["REMOTE_ADDR"];
        }
    }
    $log = array();
    $log['action'] = 'login';
    $log['ip'] = $ip;
    $log['username'] = $aFormValues['username'];
    $log['usertype'] = 'clid';
    $query = "SELECT * FROM account_log WHERE ip='" . $ip . "' AND action='login' ORDER BY id DESC LIMIT 1";
    $res = $db->query($query);
    if ($res->fetchInto($this_ip_log)) {
        $failedtimes = $this_ip_log['failedtimes'];
    }
    if ($failedtimes >= $config['system']['max_incorrect_login'] && $config['system']['max_incorrect_login'] > 0) {
        $objResponse->addAlert($locate->Translate("login failed,your ip is locked for login"));
        $objResponse->addAssign("loginButton", "value", $locate->Translate("submit"));
        $objResponse->addAssign("loginButton", "disabled", false);
        return $objResponse;
    }
    if (!$bError) {
        $query = "SELECT * from clid where clid ='" . $aFormValues['username'] . "'";
        $res = $db->query($query);
        if ($res->fetchInto($clid)) {
            $log['account_id'] = $clid['id'];
            if ($clid['pin'] == $aFormValues['password']) {
                $log['status'] = 'success';
                $log['failedtimes'] = 0;
                if ($aFormValues['rememberme'] == "forever") {
                    // set cookies for three years
                    setcookie("username", $aFormValues['username'], time() + 94608000);
                    setcookie("password", $aFormValues['password'], time() + 94608000);
                    setcookie("language", $aFormValues['locate'], time() + 94608000);
                } else {
                    // destroy cookies
                    setcookie("username", "", time() - 3600);
                    setcookie("password", "", time() - 3600);
                    setcookie("language", "", time() - 3600);
                    $username = '';
                    $password = '';
                    $language = 'en_US';
                    $checked = false;
                }
                $_SESSION['curuser']['username'] = trim($aFormValues['username']);
                $_SESSION['curuser']['usertype'] = "clid";
                $_SESSION['curuser']['clidid'] = $clid['id'];
                $_SESSION['curuser']['groupid'] = $clid['groupid'];
                list($_SESSION['curuser']['country'], $_SESSION['curuser']['language']) = split("_", $aFormValues['locate']);
                $configstatus = common::read_ini_file($config['system']['astercc_path'] . '/astercc.conf', $asterccConfig);
                if ($configstatus == -2) {
                    $html = "(fail to read " . $config['system']['astercc_path'] . "/astercc.conf)";
                    return $html;
                } else {
                    $billingfield = trim($asterccConfig['system']['billingfield']);
                    if ($billingfield == 'accountcode') {
                        $_SESSION['curuser']['billingfield'] = $billingfield;
                    }
                }
                //$objResponse->addAlert($locate->Translate("login_success"));
                $objResponse->addScript('window.location.href="cdr.php";');
            } else {
                $log['failedtimes'] = $failedtimes + 1;
                $log['status'] = 'failed';
                $log['failedcause'] = 'incorrect password';
                $loginError = true;
//.........这里部分代码省略.........
开发者ID:ljhcj,项目名称:IRISCC,代码行数:101,代码来源:login.server.php

示例3: processAccountData

/**
*  function to verify user data
*	
*  	@param $aFormValues	(array)			login form data
															$aFormValues['username']
															$aFormValues['password']
															$aFormValues['locate']
*	@return $objResponse
*  @session
															$_SESSION['curuser']['username']
															$_SESSION['curuser']['extension']
															$_SESSION['curuser']['extensions']
															$_SESSION['curuser']['country']
															$_SESSION['curuser']['language']
															$_SESSION['curuser']['channel']
															$_SESSION['curuser']['accountcode']
*/
function processAccountData($aFormValues)
{
    global $db, $config;
    list($_SESSION['curuser']['country'], $_SESSION['curuser']['language']) = split("_", $aFormValues['locate']);
    //get locate parameter
    $locate = new Localization($_SESSION['curuser']['country'], $_SESSION['curuser']['language'], 'login');
    $objResponse = new xajaxResponse();
    /* check whether the pear had been installed */
    $pear_exists_result = class_exists('PEAR');
    if (empty($pear_exists_result)) {
        $objResponse->addAlert($locate->Translate("Please install php pear"));
        $objResponse->addAssign("loginButton", "value", $locate->Translate("submit"));
        $objResponse->addAssign("loginButton", "disabled", false);
        return $objResponse;
    }
    if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
        if ($_SERVER["HTTP_CLIENT_IP"]) {
            $proxy = $_SERVER["HTTP_CLIENT_IP"];
        } else {
            $proxy = $_SERVER["REMOTE_ADDR"];
        }
    } else {
        if (isset($_SERVER["HTTP_CLIENT_IP"])) {
            $ip = $_SERVER["HTTP_CLIENT_IP"];
        } else {
            $ip = $_SERVER["REMOTE_ADDR"];
        }
    }
    $query = "SELECT * FROM account_log WHERE ip='" . $ip . "' AND action='login' ORDER BY id DESC LIMIT 1";
    $res = $db->query($query);
    if ($res->fetchInto($this_ip_log)) {
        $failedtimes = $this_ip_log['failedtimes'];
    }
    $log = array();
    $log['action'] = 'login';
    $log['ip'] = $ip;
    $log['username'] = $aFormValues['username'];
    if ($failedtimes >= $config['system']['max_incorrect_login'] && $config['system']['max_incorrect_login'] > 0) {
        $objResponse->addAlert($locate->Translate("login failed,your ip is locked for login"));
        $objResponse->addAssign("loginButton", "value", $locate->Translate("submit"));
        $objResponse->addAssign("loginButton", "disabled", false);
        return $objResponse;
    }
    $bError = false;
    $loginError = false;
    if (!$bError) {
        $query = "SELECT account.*, accountgroup.accountcode,accountgroup.allowcallback as allowcallbackgroup,resellergroup.allowcallback as allowcallbackreseller,accountgroup.limittype FROM account LEFT JOIN accountgroup ON accountgroup.id = account.groupid LEFT JOIN resellergroup ON resellergroup.id = account.resellerid WHERE username='" . $aFormValues['username'] . "'";
        $res = $db->query($query);
        if ($res->fetchInto($list)) {
            $log['account_id'] = $list['id'];
            $log['usertype'] = $list['usertype'];
            if ($list['password'] == $aFormValues['password']) {
                $log['status'] = 'success';
                $log['failedtimes'] = 0;
                if ($aFormValues['rememberme'] == "forever") {
                    // set cookies for three years
                    setcookie("username", $aFormValues['username'], time() + 94608000);
                    setcookie("password", $aFormValues['password'], time() + 94608000);
                    setcookie("language", $aFormValues['locate'], time() + 94608000);
                    setcookie("pagestyle", $aFormValues['pagestyle'], time() + 94608000);
                } else {
                    // destroy cookies
                    setcookie("username", "", time() - 3600);
                    setcookie("password", "", time() - 3600);
                    setcookie("language", "", time() - 3600);
                    setcookie("pagestyle", $aFormValues['pagestyle'], time() + 94608000);
                    $username = '';
                    $password = '';
                    $language = 'en_US';
                    $checked = false;
                }
                $_SESSION = array();
                $_SESSION['curuser']['username'] = trim($aFormValues['username']);
                $_SESSION['curuser']['usertype'] = $list['usertype'];
                $_SESSION['curuser']['ipaddress'] = $_SERVER["REMOTE_ADDR"];
                $_SESSION['curuser']['userid'] = $list['id'];
                $_SESSION['curuser']['groupid'] = $list['groupid'];
                $_SESSION['curuser']['resellerid'] = $list['resellerid'];
                $_SESSION['curuser']['limittype'] = $list['limittype'];
                $configstatus = common::read_ini_file($config['system']['astercc_path'] . '/astercc.conf', $asterccConfig);
                if ($configstatus == -2) {
                    $html = "(fail to read " . $config['system']['astercc_path'] . "/astercc.conf)";
                    return $html;
//.........这里部分代码省略.........
开发者ID:ljhcj,项目名称:IRISCC,代码行数:101,代码来源:manager_login.server.php

示例4: formEdit

    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate, $config;
        $clid =& Customer::getRecordByID($id, 'clid');
        if ($clid['isshow'] == 'yes') {
            $selecty = "selected";
            $selectn = "";
        } else {
            if ($clid['isshow'] == 'no') {
                $selecty = "";
                $selectn = "selected";
            }
        }
        $reselleroptions = '';
        $reseller = astercrm::getAll('resellergroup');
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $reselleroptions .= '<select id="resellerid" name="resellerid" onchange="setGroup();">';
            $reselleroptions .= '<option value="0"></option>';
            while ($reseller->fetchInto($row)) {
                if ($config['synchronize']['display_synchron_server']) {
                    $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']);
                }
                if ($row['id'] == $clid['resellerid']) {
                    $reselleroptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['resellername'] . "</OPTION>";
                } else {
                    $reselleroptions .= "<OPTION value='" . $row['id'] . "' >" . $row['resellername'] . "</OPTION>";
                }
            }
            $reselleroptions .= '</select>';
        } else {
            while ($reseller->fetchInto($row)) {
                if ($row['id'] == $clid['resellerid']) {
                    if ($config['synchronize']['display_synchron_server']) {
                        $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']);
                    }
                    $reselleroptions .= $row['resellername'] . '<input type="hidden" value="' . $row['id'] . '" name="resellerid" id="resellerid">';
                    break;
                }
            }
        }
        $group = astercrm::getAll('accountgroup', 'resellerid', $clid['resellerid']);
        if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') {
            $groupoptions .= '<select id="groupid" name="groupid">';
            $groupoptions .= "<OPTION value='0'></OPTION>";
            while ($group->fetchInto($row)) {
                if ($config['synchronize']['display_synchron_server']) {
                    $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']);
                }
                if ($row['id'] == $clid['groupid']) {
                    $groupoptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['groupname'] . "</OPTION>";
                } else {
                    $groupoptions .= "<OPTION value='" . $row['id'] . "' >" . $row['groupname'] . "</OPTION>";
                }
            }
            $groupoptions .= '</select>';
        } else {
            while ($group->fetchInto($row)) {
                if ($row['id'] == $clid['groupid']) {
                    if ($config['synchronize']['display_synchron_server']) {
                        $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']);
                    }
                    $groupoptions .= $row['groupname'] . '<input type="hidden" value="' . $row['id'] . '" name="groupid" id="groupid">';
                    break;
                }
            }
        }
        if ($clid['status'] == 1) {
            $statusoptions = '
							<option value="1" selected>' . $locate->Translate("Avaiable") . '</option>
							<option value="-1">' . $locate->Translate("Lock") . '</option>
						';
        } else {
            $statusoptions = '
							<option value="1">' . $locate->Translate("Avaiable") . '</option>
							<option value="-1" selected>' . $locate->Translate("Lock") . '</option>
						';
        }
        $configstatus = common::read_ini_file($config['system']['astercc_path'] . '/astercc.conf', $asterccConfig);
        if ($configstatus == -2) {
            $html = "(fail to read " . $config['system']['astercc_path'] . "/astercc.conf)";
            return $html;
        } else {
            $billingfield = trim($asterccConfig['system']['billingfield']);
        }
        if ($_SESSION['curuser']['usertype'] == 'clid') {
            $readonly = "readonly";
        }
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
//.........这里部分代码省略.........
开发者ID:ljhcj,项目名称:IRISCC,代码行数:101,代码来源:clid.grid.inc.php


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