本文整理汇总了PHP中getConfigVar函数的典型用法代码示例。如果您正苦于以下问题:PHP getConfigVar函数的具体用法?PHP getConfigVar怎么用?PHP getConfigVar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getConfigVar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreateReservationFromWeekdaytoWeekend
public function testCreateReservationFromWeekdaytoWeekend(){
$this->setSessionUserAdmin();
$startDate = '2011-11-18'; # A Friday
$length = 1;
$endDate = '2011-11-21'; # The Next Monday
$actualLength = 3;
$equipId = 1;
$userComment = "test user comment";
$adminComment = "test admin comment";
$modStatus = RES_STATUS_PENDING;
createReservation(getSessionVariable('user_id'), $equipId, $startDate, $length, $userComment, $adminComment, $modStatus);
$actualReservation = mysql_fetch_assoc(doQuery("select * from ".getConfigVar('db_prefix')."_reservations ORDER BY res_id DESC LIMIT 1"));
$this->assertEquals(getSessionVariable('user_id'), $actualReservation['user_id'], "User IDs not equal");
$this->assertEquals($equipId, $actualReservation['equip_id'], "Equip IDs not equal");
$this->assertEquals($startDate, $actualReservation['start_date'], "Start dates not equal");
$this->assertEquals($actualLength, $actualReservation['length'], "Lengths not equal");
$this->assertEquals($endDate, $actualReservation['end_date'], "End dates not equal");
$this->assertEquals($userComment, $actualReservation['user_comment'], "User comments not equal");
$this->assertEquals($adminComment, $actualReservation['admin_comment'], "Admin comments not equal");
$this->assertEquals($modStatus, $actualReservation['mod_status'], "Statuses not equal");
}
示例2: getModulePath
function getModulePath($module)
{
static $arrModulePath = array();
if (!isFrameworkInstalled()) {
return AUIEO_FRAMEWORK_PATH . "modules/";
}
if (!isApplicationInstalled()) {
if (file_exists("modules/{$module}")) {
return "modules/";
} else {
return AUIEO_FRAMEWORK_PATH . "modules/";
}
}
if (isset($arrModulePath[$module])) {
return $arrModulePath[$module];
}
$modulePath = getConfigVar("MODULE_PATH");
if (!is_null($modulePath)) {
if (file_exists("{$modulePath}{$module}")) {
$arrModulePath[$module] = "{$modulePath}";
return $arrModulePath[$module];
}
}
if (file_exists("modules/{$module}")) {
$arrModulePath[$module] = "modules/";
return $arrModulePath[$module];
}
if (file_exists(AUIEO_FRAMEWORK_PATH . "modules/{$module}")) {
$arrModulePath[$module] = AUIEO_FRAMEWORK_PATH . "modules/";
return $arrModulePath[$module];
}
return null;
}
示例3: db_error_logger
function db_error_logger($errno, $errstr, $errfile = "", $errline = "", $errorcontext = array()){
$errno = makeStringSafe($errno);
$errstr = makeStringSafe($errstr);
$errfile = makeStringSafe($errfile);
$errline = makeStringSafe($errline);
if($errno < E_STRICT){
doQuery("INSERT INTO ".getDBPrefix()."_error_log set user_id = '".getSessionVariable("user_id")."', error_number = '".$errno."',
message = '".$errstr."', file = '".$errfile."', line_number = '".$errline."', context = '".serialize($errorcontext)."',
time = '".getCurrentMySQLDateTime()."'");
$errorrow = mysql_fetch_assoc(doQuery("SELECT error_id FROM ".getDBPrefix()."_error_log ORDER BY error_id DESC LIMIT 1"));
if(getConfigVar('error_output') == ERROR_OUTPUT_DBID || getConfigVar('error_output') == ERROR_OUTPUT_BOTH){
echo "<h4 style=\"color: #FF0000;\">An error occured! If you would like to report this error, please report that your 'ERROR_ID' is '".$errorrow['error_id']."'.</h4>";
}
}
return !(getConfigVar("error_output") == ERROR_OUTPUT_PHP || getConfigVar("error_output") == ERROR_OUTPUT_BOTH);
}
示例4: setUpBeforeClass
public static function setUpBeforeClass()
{
// make sure DETECT_URLS is set to yes
self::$detect_urls_var = getConfigVar('DETECT_URLS');
if (self::$detect_urls_var != 'yes') {
setConfigVar('DETECT_URLS', 'yes');
}
}
示例5: sendWarningNotice
function sendWarningNotice($userid, $reason, $type)
{
$subject = "Reservation System Warning";
$message = "You have been given a(n) " . getWarningType($type) . ". The reason given was: " . $reason;
$headers = 'From: ' . getConfigVar('smtp_email') . "\r\n" . 'Reply-To: ' . getConfigVar('smtp_email') . "\r\n" . 'X-Mailer: PHP/' . phpversion();
$user = mysql_fetch_assoc(getUserByID($userid));
//sendMail(getConfigVar('smtp_email'), $user['email'], $subject, $message);
mail($row['email'], $subject, $message);
}
示例6: initMySQL
function initMySQL()
{
global $link;
$link = mysql_connect(getConfigVar('mysql_server'), getConfigVar('mysql_user'), getConfigVar('mysql_password'));
if (!$link) {
die('<script language="Javascript"> alert("Q' . $numqs . ': Could not connect: ' . mysql_error($link) . '")</script>');
}
$db_selected = mysql_select_db(getConfigVar('mysql_database'), $link);
if (!$db_selected) {
die('<script language="Javascript"> alert("Q' . $numqs . ': Couldn\'t use ' . getConfigVar('mysql_database') . ': ' . mysql_error($link) . '")</script>');
}
}
示例7: testSetSessionVariableShouldSetValue
public function testSetSessionVariableShouldSetValue()
{
$variableName = "varTestSet";
$expectedValue = "TestValue";
setSessionVariable($variableName, $expectedValue);
$this->assertTrue(isset($_SESSION[getConfigVar('location').'-'.$variableName]),
"setSessionVariable(variable_name, value) did not set session variable.");
$this->assertEquals($expectedValue, $_SESSION[getConfigVar('location').'-'.$variableName],
"setSessionVariable(variable_name, value) improperly set value.");
}
示例8: getEquipmentTypesDropDownSelected
function getEquipmentTypesDropDownSelected($name, $size, $selectedvalue)
{
$types = getConfigVar("equipment_types");
$options = "";
foreach ($types as $type) {
if ($selectedvalue == $type) {
$options = $options . "<option value=\"" . $type . "\" selected=\"selected\">" . $type . "</option>";
} else {
$options = $options . "<option value=\"" . $type . "\">" . $type . "</option>";
}
}
$dropdown = "<select name=\"" . $name . "\" size=\"" . $size . "\">" . $options . "</select>";
return $dropdown;
}
示例9: dispatch
public function dispatch()
{
$msgheader = array(self::NOT_AUTHENTICATED => 'Not authenticated', self::MISCONFIGURED => 'Configuration error', self::INTERNAL => 'Internal error', self::DB_WRITE_FAILED => 'Database write failed');
$msgbody = array(self::NOT_AUTHENTICATED => '<h2>This system requires authentication. You should use a username and a password.</h2>', self::MISCONFIGURED => '<h2>Configuration error</h2><br>' . $this->message, self::INTERNAL => '<h2>Internal error</h2><br>' . $this->message, self::DB_WRITE_FAILED => '<h2>Database write failed</h2><br>' . $this->message);
switch ($this->code) {
case self::NOT_AUTHENTICATED:
header('WWW-Authenticate: Basic realm="' . getConfigVar('enterprise') . ' RackTables access"');
header("HTTP/1.1 401 Unauthorized");
case self::MISCONFIGURED:
case self::INTERNAL:
case self::DB_WRITE_FAILED:
$this->genHTMLPage($msgheader[$this->code], $msgbody[$this->code]);
break;
default:
throw new RackTablesError('Dispatching error, unknown code ' . $this->code, RackTablesError::INTERNAL);
}
}
示例10: setUpBeforeClass
public static function setUpBeforeClass()
{
// make sure AUTOPORTS_CONFIG is empty
self::$autoports_config_var = getConfigVar('AUTOPORTS_CONFIG');
if (self::$autoports_config_var != '') {
setConfigVar('AUTOPORTS_CONFIG', '');
}
// find a port type that is incompatible with 1000Base-T
$result = usePreparedSelectBlade('SELECT type1 FROM PortCompat WHERE type1 != 24 AND type2 != 24 LIMIT 1');
self::$portc_type = $result->fetchColumn();
// add sample data
// - set port a & b's type to 1000Base-T
// - set port c's type to the incompatible one
self::$object_id = commitAddObject('unit test object', NULL, 4, NULL);
self::$porta = commitAddPort(self::$object_id, 'test porta', '1-24', NULL, NULL);
self::$portb = commitAddPort(self::$object_id, 'test portb', '1-24', NULL, NULL);
self::$portc = commitAddPort(self::$object_id, 'test portc', self::$portc_type, NULL, NULL);
}
示例11: snmpgeneric_snmpconfig
//.........这里部分代码省略.........
if (isset($snmpstrarray[$key])) {
switch ($key) {
case 6:
case 8:
$snmpvalues[$value] = base64_decode($snmpstrarray[$key]);
break;
default:
$snmpvalues[$value] = $snmpstrarray[$key];
}
}
}
unset($snmpvalues['SNMP']);
$snmpconfig = $snmpvalues;
} else {
$snmpconfig = array();
}
$snmpconfig += $_POST;
if (!isset($snmpconfig['host'])) {
$snmpconfig['host'] = -1;
/* try to find first FQDN or IP */
foreach ($endpoints as $value) {
if (preg_match('/^[^ .]+(\\.[^ .]+)+\\.?/', $value)) {
$snmpconfig['host'] = $value;
break;
}
}
unset($value);
}
// sg_var_dump_html($endpoints);
if (!isset($snmpconfig['version'])) {
$snmpconfig['version'] = mySNMP::SNMP_VERSION;
}
if (!isset($snmpconfig['community'])) {
$snmpconfig['community'] = getConfigVar('DEFAULT_SNMP_COMMUNITY');
}
if (empty($snmpconfig['community'])) {
$snmpconfig['community'] = mySNMP::SNMP_COMMUNITY;
}
if (!isset($snmpconfig['sec_level'])) {
$snmpconfig['sec_level'] = NULL;
}
if (!isset($snmpconfig['auth_protocol'])) {
$snmpconfig['auth_protocol'] = NULL;
}
if (!isset($snmpconfig['auth_passphrase'])) {
$snmpconfig['auth_passphrase'] = NULL;
}
if (!isset($snmpconfig['priv_protocol'])) {
$snmpconfig['priv_protocol'] = NULL;
}
if (!isset($snmpconfig['priv_passphrase'])) {
$snmpconfig['priv_passphrase'] = NULL;
}
if (!isset($snmpconfig['asnewobject'])) {
$snmpconfig['asnewobject'] = NULL;
}
if (!isset($snmpconfig['object_type_id'])) {
$snmpconfig['object_type_id'] = '8';
}
if (!isset($snmpconfig['object_name'])) {
$snmpconfig['object_name'] = NULL;
}
if (!isset($snmpconfig['object_label'])) {
$snmpconfig['object_label'] = NULL;
}
if (!isset($snmpconfig['object_asset_no'])) {
示例12: is_closedMode
/**
* Determine the site is in maintenance mode or not.
*
*/
function is_closedMode()
{
$disabledAction = array('PostController/actionCreate', 'SiteController/actionIndex', 'UserController/actionCreate');
if (getConfigVar('site_close') == 1 && !isset($_SESSION['admin']) && in_array((isset($_GET['controller']) ? $_GET['controller'] : 'SiteController') . '/' . (isset($_GET['action']) ? $_GET['action'] : 'actionIndex'), $disabledAction)) {
show_message(getConfigVar('close_reason'));
}
}
示例13: getConfiguredQuickLinks
function getConfiguredQuickLinks()
{
$ret = array();
foreach (explode(',', getConfigVar('QUICK_LINK_PAGES')) as $page_code) {
if (!empty($page_code)) {
$title = getPageName($page_code);
if (!empty($title)) {
$ret[] = array('href' => makeHref(array('page' => $page_code)), 'title' => $title);
}
}
}
return $ret;
}
示例14: renderNewVSForm
function renderNewVSForm()
{
startPortlet('Add new virtual service');
printOpFormIntro('add');
$default_port = getConfigVar('DEFAULT_SLB_VS_PORT');
global $vs_proto;
if ($default_port == 0) {
$default_port = '';
}
echo "<table border=0 cellpadding=5 cellspacing=0 align=center>\n";
echo "<tr><th class=tdright>VIP:</th><td class=tdleft><input type=text name=vip></td>";
echo "<tr><th class=tdright>Port:</th><td class=tdleft>";
echo "<input type=text name=vport size=5 value='{$default_port}'></td></tr>";
echo "<tr><th class=tdright>Proto:</th><td class=tdleft>";
printSelect($vs_proto, array('name' => 'proto'), array_shift(array_keys($vs_proto)));
echo "</td></tr>";
echo "<tr><th class=tdright>Name:</th><td class=tdleft><input type=text name=name></td><td>";
echo "<tr><th class=tdright>Tags:</th><td class=tdleft>";
printTagsPicker();
echo "</td></tr>";
echo "<tr><th class=tdrigh>VS configuration:</th><td class=tdleft><textarea name=vsconfig rows=10 cols=80></textarea></td></tr>";
echo "<tr><th class=tdrigh>RS configuration:</th><td class=tdleft><textarea name=rsconfig rows=10 cols=80></textarea></td></tr>";
echo "<tr><td colspan=2>";
printImageHREF('CREATE', 'create virtual service', TRUE);
echo "</td></tr>";
echo '</table></form>';
finishPortlet();
}
示例15: sendMail
function sendMail($sender, $rec, $subj, $bod){
if(getConfigVar("send_mail")){
require_once "Mail.php";
$from = "<$sender>";
$to = "<$rec>";
$subject = $subj;
$body = $bod;
$host = getConfigVar('smtp_server');
$port = getConfigVar('smtp_port');
$username = getConfigVar('smtp_user');
$password = getConfigVar('smtp_password');
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
#echo("<p>Message successfully sent!</p>");
}
}
}