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


PHP TikiLib::get_ip_address方法代码示例

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


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

示例1: elseif

    } elseif ($db instanceof TikiDb_Pdo) {
        require_once 'lib/tikisession-pdo.php';
    }
} elseif (isset($prefs['session_storage']) && $prefs['session_storage'] == 'memcache' && TikiLib::lib("memcache")->isEnabled()) {
    require_once 'lib/tikisession-memcache.php';
}
if (!isset($prefs['session_cookie_name']) || empty($prefs['session_cookie_name'])) {
    $prefs['session_cookie_name'] = session_name();
}
session_name($prefs['session_cookie_name']);
// Only accept PHP's session ID in URL when the request comes from the tiki server itself
// This is used by features that need to query the server to retrieve tiki's generated html and images (e.g. pdf export)
// It could be , that the server initiates his request with its own ip, so we check also if server == remote
// Note: this is an incomplete implemenation - the session handling does not really work this way. Session data is lost and not regenerated.
// Maybe better to use tokens: see i.e. the example in lib/pdflib.php
if (isset($_GET[session_name()]) && ($tikilib->get_ip_address() == '127.0.0.1' || $_SERVER["SERVER_ADDR"] == $_SERVER["REMOTE_ADDR"])) {
    $_COOKIE[session_name()] = $_GET[session_name()];
    session_id($_GET[session_name()]);
}
//Set tikiroot and tikidomain to blank string if not set.
if (empty($tikiroot)) {
    $tikiroot = "";
}
if (empty($tikidomain)) {
    $tikidomain = "";
}
if ($prefs['cookie_consent_feature'] === 'y' && empty($_COOKIE[$prefs['cookie_consent_name']])) {
    $feature_no_cookie = true;
} else {
    $feature_no_cookie = false;
}
开发者ID:ameoba32,项目名称:tiki,代码行数:31,代码来源:tiki-setup_base.php

示例2: elseif

	} elseif ($api_tiki == 'pdo') {
		require_once ('lib/tikisession-pdo.php');
	}
} elseif ( isset($prefs['session_storage']) && $prefs['session_storage'] == 'memcache' && TikiLib::lib("memcache")->isEnabled() ) {
	require_once ('lib/tikisession-memcache.php');
}

if ( ! isset( $prefs['session_cookie_name'] ) || empty( $prefs['session_cookie_name'] ) ) {
	$prefs['session_cookie_name'] = session_name();
}

session_name($prefs['session_cookie_name']);

// Only accept PHP's session ID in URL when the request comes from the tiki server itself
// This is used by features that need to query the server to retrieve tiki's generated html and images (e.g. pdf export)
if (isset($_GET[session_name()]) && $tikilib->get_ip_address() == '127.0.0.1') {
	$_COOKIE[session_name()] = $_GET[session_name()];
	session_id($_GET[session_name()]);
}

$start_session = true;
if ( isset($prefs['session_silent']) && $prefs['session_silent'] == 'y' && empty($_COOKIE[session_name()]) ) {
	$start_session = false;
}

// If called from the CDN, refuse to execute anything
$cdn_pref = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? $prefs['tiki_cdn_ssl'] : $prefs['tiki_cdn'];
if ( $cdn_pref ) {
	$host = parse_url($cdn_pref, PHP_URL_HOST);
	if (isset($_SERVER['HTTP_HOST']) && $host == $_SERVER['HTTP_HOST'] ) {
		header("HTTP/1.0 404 Not Found");
开发者ID:railfuture,项目名称:tiki-website,代码行数:31,代码来源:tiki-setup_base.php

示例3: copy_item

 public function copy_item($from, $to, $except = null, $only = null, $status = null)
 {
     global $user, $prefs;
     if ($prefs['feature_categories'] == 'y') {
         $categlib = TikiLib::lib('categ');
         $cats = $categlib->get_object_categories('trackeritem', $from);
     }
     if (empty($to)) {
         $is_new = 'y';
         $info_to['trackerId'] = $this->items()->fetchOne('trackerId', array('itemId' => $from));
         $info_to['status'] = empty($status) ? $this->items()->fetchOne('status', array('itemId' => $from)) : $status;
         $info_to['created'] = $info_to['lastModif'] = $this->now;
         $info_to['createdBy'] = $info_to['lastModifBy'] = $user;
         $to = $this->items()->insert($info_to);
     }
     $query = 'select ttif.*, ttf.`type`, ttf.`options` from `tiki_tracker_item_fields` ttif left join `tiki_tracker_fields` ttf on (ttif.`fieldId` = ttf.`fieldId`) where `itemId`=?';
     $result = $this->fetchAll($query, array($from));
     $clean = array();
     $factory = new Tracker_Field_Factory();
     foreach ($result as $res) {
         $typeInfo = $factory->getFieldInfo($res['type']);
         $options = Tracker_Options::fromSerialized($res['options'], $typeInfo);
         $res['options_array'] = $options->buildOptionsArray();
         if ($prefs['feature_categories'] == 'y' && $res['type'] == 'e') {
             //category
             if (!empty($except) && in_array($res['fieldId'], $except) || !empty($only) && !in_array($res['fieldId'], $only)) {
                 // take away the categories from $cats
                 if (ctype_digit($res['options_array'][0]) && $res['options_array'][0] > 0) {
                     $filter = array('identifier' => $res['options_array'][0], 'type' => 'children');
                 } else {
                     $filter = null;
                 }
                 $children = $categlib->getCategories($filter, true, false);
                 $local = array();
                 foreach ($children as $child) {
                     $local[] = $child['categId'];
                 }
                 $cats = array_diff($cats, $local);
             }
         }
         if (!empty($except) && in_array($res['fieldId'], $except) || !empty($only) && !in_array($res['fieldId'], $only) || $res['type'] == 'q') {
             continue;
         }
         if (!empty($is_new) && in_array($res['type'], array('u', 'g', 'I')) && ($res['options_array'][0] == 1 || $res['options_array'][0] == 2)) {
             $res['value'] = $res['type'] == 'u' ? $user : ($res['type'] == 'g' ? $_SESSION['u_info']['group'] : TikiLib::get_ip_address());
         }
         if (in_array($res['type'], array('A', 'N'))) {
             // attachment - image
             continue;
             //not done yet
         }
         //echo "duplic".$res['fieldId'].' '. $res['value'].'<br>';
         if (!in_array($res['fieldId'], $clean)) {
             $this->itemFields()->delete(array('itemId' => $to, 'fieldId' => $res['fieldId']));
             $clean[] = $res['fieldId'];
         }
         $data = array('itemId' => $to, 'fieldId' => $res['fieldId'], 'value' => $res['value']);
         $this->itemFields()->insert($data);
     }
     if (!empty($cats)) {
         $trackerId = $this->items()->fetchOne('trackerId', array('itemId' => $from));
         $this->categorized_item($trackerId, $to, "item {$to}", $cats);
     }
     return $to;
 }
开发者ID:rjsmelo,项目名称:tiki,代码行数:65,代码来源:trackerlib.php


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