本文整理汇总了PHP中G::getIpAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP G::getIpAddress方法的具体用法?PHP G::getIpAddress怎么用?PHP G::getIpAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类G
的用法示例。
在下文中一共展示了G::getIpAddress方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: auditLog
/**
*/
public static function auditLog($actionToLog, $valueToLog = "")
{
$workspace = defined('SYS_SYS') ? SYS_SYS : 'Wokspace Undefined';
$oServerConf =& serverConf::getSingleton();
$sflagAudit = $oServerConf->getAuditLogProperty('AL_OPTION', $workspace);
$ipClient = G::getIpAddress();
/*----------------------------------********---------------------------------*/
$licensedFeatures = PMLicensedFeatures::getSingleton();
if ($sflagAudit && $licensedFeatures->verifyfeature('vtSeHNhT0JnSmo1bTluUVlTYUxUbUFSVStEeXVqc1pEUG5EeXc0MGd2Q3ErYz0=')) {
$username = isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '' ? $_SESSION['USER_LOGGED'] : 'Unknow User';
$fullname = isset($_SESSION['USR_FULLNAME']) && $_SESSION['USR_FULLNAME'] != '' ? $_SESSION['USR_FULLNAME'] : '-';
G::log("|" . $workspace . "|" . $ipClient . "|" . $username . "|" . $fullname . "|" . $actionToLog . "|" . $valueToLog, PATH_DATA, "audit.log");
}
/*----------------------------------********---------------------------------*/
}
示例2: export
/**
* Export PM tables
*
* @author : Erik Amaru Ortiz <aortiz.erik@gmail.com>
*/
public function export($httpData)
{
require_once 'classes/model/AdditionalTables.php';
$at = new AdditionalTables();
$tablesToExport = G::json_decode(stripslashes($httpData->rows));
try {
G::LoadCLass('net');
$net = new NET(G::getIpAddress());
G::LoadClass("system");
$META = " \n-----== ProcessMaker Open Source Private Tables ==-----\n" . " @Ver: 1.0 Oct-2009\n" . " @Processmaker version: " . System::getVersion() . "\n" . " -------------------------------------------------------\n" . " @Export Date: " . date("l jS \\of F Y h:i:s A") . "\n" . " @Server address: " . getenv('SERVER_NAME') . " (" . getenv('SERVER_ADDR') . ")\n" . " @Client address: " . $net->hostname . "\n" . " @Workspace: " . SYS_SYS . "\n" . " @Export trace back:\n\n";
$EXPORT_TRACEBACK = array();
$c = 0;
foreach ($tablesToExport as $table) {
$tableRecord = $at->load($table->ADD_TAB_UID);
$tableData = $at->getAllData($table->ADD_TAB_UID, null, null, false);
$table->ADD_TAB_NAME = $tableRecord['ADD_TAB_NAME'];
$rows = $tableData['rows'];
$count = $tableData['count'];
array_push($EXPORT_TRACEBACK, array('uid' => $table->ADD_TAB_UID, 'name' => $table->ADD_TAB_NAME, 'num_regs' => $tableData['count'], 'schema' => $table->_SCHEMA ? 'yes' : 'no', 'data' => $table->_DATA ? 'yes' : 'no'));
}
$sTrace = "TABLE UID TABLE NAME\tREGS\tSCHEMA\tDATA\n";
foreach ($EXPORT_TRACEBACK as $row) {
$sTrace .= "{$row['uid']}\t{$row['name']}\t\t{$row['num_regs']}\t{$row['schema']}\t{$row['data']}\n";
}
$META .= $sTrace;
///////////////EXPORT PROCESS
$PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP;
$filenameOnly = strtolower('SYS-' . SYS_SYS . "_" . date("Y-m-d") . '_' . date("Hi") . ".pmt");
$filename = $PUBLIC_ROOT_PATH . $filenameOnly;
$fp = fopen($filename, "wb");
$bytesSaved = 0;
$bufferType = '@META';
$fsData = sprintf("%09d", strlen($META));
$fsbufferType = sprintf("%09d", strlen($bufferType));
$bytesSaved += fwrite($fp, $fsbufferType);
//writing the size of $oData
$bytesSaved += fwrite($fp, $bufferType);
//writing the $oData
$bytesSaved += fwrite($fp, $fsData);
//writing the size of $oData
$bytesSaved += fwrite($fp, $META);
//writing the $oData
foreach ($tablesToExport as $table) {
if ($table->_SCHEMA) {
$oAdditionalTables = new AdditionalTables();
$aData = $oAdditionalTables->load($table->ADD_TAB_UID, true);
$bufferType = '@SCHEMA';
$SDATA = serialize($aData);
$fsUid = sprintf("%09d", strlen($table->ADD_TAB_UID));
$fsData = sprintf("%09d", strlen($SDATA));
$fsbufferType = sprintf("%09d", strlen($bufferType));
$bytesSaved += fwrite($fp, $fsbufferType);
//writing the size of $oData
$bytesSaved += fwrite($fp, $bufferType);
//writing the $oData
$bytesSaved += fwrite($fp, $fsUid);
//writing the size of xml file
$bytesSaved += fwrite($fp, $table->ADD_TAB_UID);
//writing the xmlfile
$bytesSaved += fwrite($fp, $fsData);
//writing the size of xml file
$bytesSaved += fwrite($fp, $SDATA);
//writing the xmlfile
}
if ($table->_DATA) {
//export data
$oAdditionalTables = new additionalTables();
$tableData = $oAdditionalTables->getAllData($table->ADD_TAB_UID, null, null, false);
$SDATA = serialize($tableData['rows']);
$bufferType = '@DATA';
$fsbufferType = sprintf("%09d", strlen($bufferType));
$fsTableName = sprintf("%09d", strlen($table->ADD_TAB_NAME));
$fsData = sprintf("%09d", strlen($SDATA));
$bytesSaved += fwrite($fp, $fsbufferType);
//writing type size
$bytesSaved += fwrite($fp, $bufferType);
//writing type
$bytesSaved += fwrite($fp, $fsTableName);
//writing the size of xml file
$bytesSaved += fwrite($fp, $table->ADD_TAB_NAME);
//writing the xmlfile
$bytesSaved += fwrite($fp, $fsData);
//writing the size of xml file
$bytesSaved += fwrite($fp, $SDATA);
//writing the xmlfile
}
}
fclose($fp);
$filenameLink = "pmTables/streamExported?f={$filenameOnly}";
$size = round($bytesSaved / 1024, 2) . " Kb";
$meta = "<pre>" . $META . "</pre>";
$filename = $filenameOnly;
$link = $filenameLink;
$result->success = true;
$result->filename = $filenameOnly;
//.........这里部分代码省略.........
示例3: log
/**
* Log
*
* @param string $action Action
* @param string $value Value
*
* return void
*/
private function log($action, $value = "")
{
try {
$workspace = defined("SYS_SYS") ? SYS_SYS : "Wokspace Undefined";
$ipClient = \G::getIpAddress();
$username = "timereventcron";
$fullname = "timereventcron";
\G::log("|" . $workspace . "|" . $ipClient . "|" . $username . "|" . $fullname . "|" . $action . "|" . $value, PATH_DATA, "timerevent.log");
} catch (\Exception $e) {
throw $e;
}
}
示例4: LoginLog
if ($frm['USER_LANG'] != '') {
$lang = $frm['USER_LANG'];
}
} else {
if (defined('SYS_LANG')) {
$lang = SYS_LANG;
} else {
$lang = 'en';
}
}
/**log in table Login**/
require_once 'classes/model/LoginLog.php';
$weblog = new LoginLog();
$aLog['LOG_UID'] = G::generateUniqueID();
$aLog['LOG_STATUS'] = 'ACTIVE';
$aLog['LOG_IP'] = G::getIpAddress();
$aLog['LOG_SID'] = session_id();
$aLog['LOG_INIT_DATE'] = date('Y-m-d H:i:s');
//$aLog['LOG_END_DATE'] = '0000-00-00 00:00:00';
$aLog['LOG_CLIENT_HOSTNAME'] = $_SERVER['HTTP_HOST'];
$aLog['USR_UID'] = $_SESSION['USER_LOGGED'];
$weblog->create($aLog);
/**end log**/
//************** background processes, here we are putting some back office routines **********
$heartBeatNWIDate = $oServerConf->getHeartbeatProperty('HB_NEXT_GWI_DATE', 'HEART_BEAT_CONF');
if (is_null($heartBeatNWIDate)) {
$heartBeatNWIDate = time();
}
if (time() >= $heartBeatNWIDate) {
$oServerConf->setWsInfo(SYS_SYS, $oServerConf->getWorkspaceInfo(SYS_SYS));
$oServerConf->setHeartbeatProperty('HB_NEXT_GWI_DATE', strtotime('+1 day'), 'HEART_BEAT_CONF');
示例5: customErrorLog
function customErrorLog($type, $msg, $file, $line)
{
global $HTTP_X_FORWARDED_FOR, $REMOTE_ADDR, $HTTP_USER_AGENT, $REQUEST_URI;
$ip_addr = G::getIpAddress();
if (defined('APPLICATION_CODE')) {
$name = APPLICATION_CODE;
} else {
$name = "php";
}
if ($file != '') {
$msg .= " in {$file}:{$line} ";
}
$date = date('Y-m-d H:i:s');
$REQUEST_URI = getenv('REQUEST_URI');
$HTTP_USER_AGENT = getenv('HTTP_USER_AGENT');
error_log("[{$date}] [{$ip_addr}] [{$name}] {$type}: {$msg} [{$HTTP_USER_AGENT}] URI: {$REQUEST_URI}", 0);
}