本文整理汇总了PHP中Mapbender::session方法的典型用法代码示例。如果您正苦于以下问题:PHP Mapbender::session方法的具体用法?PHP Mapbender::session怎么用?PHP Mapbender::session使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mapbender
的用法示例。
在下文中一共展示了Mapbender::session方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* Loads WFS conf data from the database
*
* @return Object WFS conf data.
* @param $idOrIdArray Object May be an integer or an array of integers representing WFS conf IDs.
*/
public function load($idOrIdArray)
{
// Check parameter and set idArray
if (isset($idOrIdArray)) {
// parameter is a number
if (!is_array($idOrIdArray) && is_numeric($idOrIdArray)) {
$idOrIdArray = array(intval($idOrIdArray));
}
// parameter is an array of numbers
if (is_array($idOrIdArray)) {
$idArray = array();
foreach ($idOrIdArray as $id) {
if (!is_numeric($id)) {
$e = new mb_exception("Wfs_conf: constructor: wrong parameter: " . $id . " is not a number.");
return array();
}
array_push($idArray, intval($id));
}
// If a user ID is given, remove the ones the user has no access to
if (Mapbender::session()->get("mb_user_id")) {
$user = new User(Mapbender::session()->get("mb_user_id"));
$idArray = array_intersect($idArray, $user->getWfsConfByPermission());
}
return $this->getWfsConfFromDb($idArray);
} else {
$e = new mb_exception("Wfs_conf: constructor: parameter must be number or an array of numbers.");
return array();
}
} else {
$e = new mb_exception("Wfs_conf: constructor: parameter is not valid");
return null;
}
}
示例2: insert
/**
* Inserts a new WFS into the database.
*
* @return Boolean
* @param $aWfs Wfs
*/
public static function insert($aWfs)
{
db_begin();
$uuid = new Uuid();
$sql = "INSERT INTO wfs (wfs_version, wfs_name, wfs_title, wfs_abstract, ";
$sql .= "wfs_getcapabilities, wfs_getcapabilities_doc, wfs_upload_url, ";
$sql .= "wfs_describefeaturetype, wfs_getfeature, wfs_transaction, fees, ";
$sql .= "accessconstraints, wfs_owner, wfs_timestamp, uuid) ";
$sql .= "VALUES (\$1, \$2, \$3, \$4, \$5, \$6, \$7, \$8, \$9, \$10, \$11, \$12, \$13, \$14,\$15)";
$v = array($aWfs->getVersion(), $aWfs->name, $aWfs->title, $aWfs->summary, $aWfs->getCapabilities, $aWfs->getCapabilitiesDoc, $aWfs->uploadUrl, $aWfs->describeFeatureType, $aWfs->getFeature, $aWfs->transaction, $aWfs->fees, $aWfs->accessconstraints, Mapbender::session()->get("mb_user_id"), strtotime("now"), $uuid);
$t = array('s', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 'i', 'i', 's');
$res = db_prep_query($sql, $v, $t);
if (!$res) {
$e = new mb_exception("Error while inserting WFS into database.");
return false;
}
// set the WFS id
$aWfs->id = db_insert_id($con, 'wfs', 'wfs_id');
// Insert the feature types
for ($i = 0; $i < count($aWfs->featureTypeArray); $i++) {
$currentFeatureType = $aWfs->featureTypeArray[$i];
if (!WfsToDb::insertFeatureType($currentFeatureType)) {
db_rollback();
return false;
}
}
db_commit();
return true;
}
示例3: getConfiguration
function getConfiguration($key)
{
//check if key param can be found in SESSION,
// otherwise take it from GET
if (Mapbender::session()->exists($key)) {
return Mapbender::session()->get($key);
}
return $_GET[$key];
}
示例4: getWmc
function getWmc($wmcId = null)
{
$user = new User(Mapbender::session()->get("mb_user_id"));
$wmcIdArray = $user->getWmcByOwner();
//getAccessibleWmcs();
if (!is_null($wmcId) && !in_array($wmcId, $wmcIdArray)) {
abort(_mb("You are not allowed to access this WMC."));
}
return $wmcIdArray;
}
示例5: displayCategories
function displayCategories($sql)
{
if (Mapbender::session()->get("mb_lang") === "de") {
$sql = str_replace("category_code_en", "category_code_de", $sql);
}
$str = "";
$res = db_query($sql);
while ($row = db_fetch_assoc($res)) {
$str .= "<option value='" . $row["id"] . "'>" . htmlentities($row["name"], ENT_QUOTES, CHARSET) . "</option>";
}
return $str;
}
示例6: getLayer
function getLayer($layerId = null)
{
$user = new User(Mapbender::session()->get("mb_user_id"));
$wmsIdArray = $user->getOwnedWms();
if (!is_array($wmsIdArray) || count($wmsIdArray) === 0) {
abort(_mb("No metadata sets available."));
}
$wmsId = wms::getWmsIdByLayerId($layerId);
if (is_null($wmsId) || !in_array($wmsId, $wmsIdArray)) {
abort(_mb("You are not allowed to access WMS " . $wmsId));
}
return;
}
示例7: __construct
/**
* Constructor
* @param $userId Integer the ID of the user that is represented by
* this object.
*/
public function __construct()
{
if (func_num_args() === 1) {
$this->id = intval(func_get_arg(0));
} else {
$this->id = Mapbender::session()->get("mb_user_id");
}
try {
$this->load();
} catch (Exception $E) {
new mb_exception($E->getMessage());
}
}
示例8: getFeaturetype
function getFeaturetype($featuretypeId = null)
{
$user = new User(Mapbender::session()->get("mb_user_id"));
$wfsIdArray = $user->getOwnedWfs();
if (!is_array($wfsIdArray) || count($wfsIdArray) === 0) {
abort(_mb("No metadata sets available."));
}
$wfsId = wfs::getWfsIdByFeaturetypeId($featuretypeId);
if (is_null($wfsId) || !in_array($wfsId, $wfsIdArray)) {
abort(_mb("You are not allowed to access this WFS " . $wfsId));
}
return;
}
示例9: getWfsConfData
function getWfsConfData($wfsID)
{
global $con;
// re-check permission
$adm = new administration();
$serviceList = $adm->getWfsByOwner(Mapbender::session()->get("mb_user_id"));
if (in_array($wfsID, $serviceList)) {
$wfsConf = array();
$wfsConf['id'] = array();
$wfsConf['abstract'] = array();
$sql = "SELECT * FROM wfs_conf WHERE fkey_wfs_id = \$1 ORDER BY wfs_conf_abstract";
$v = array($wfsID);
$t = array('i');
$res = db_prep_query($sql, $v, $t);
$cnt = 0;
while ($row = db_fetch_array($res)) {
array_push($wfsConf['id'], $row['wfs_conf_id']);
array_push($wfsConf['abstract'], $row['wfs_conf_abstract']);
$cnt++;
}
if ($cnt == 0) {
return false;
} else {
return $wfsConf;
}
}
// else if($wfsID==="gui_confs"){
// $wfsConf = array();
// $wfsConf['id'] = array();
// $wfsConf['abstract'] = array();
// $wfsConf['id'] = $adm->getWfsConfByPermission(Mapbender::session()->get("mb_user_id"));
// $cnt = 0;
// foreach($wfsConf['id'] as $wfscid){
// $sql = "SELECT wfs_conf_abstract FROM wfs_conf WHERE wfs_conf_id = $1";
// $v = array($wfscid);
// $t = array('i');
// $res = db_prep_query($sql,$v,$t);
// while($row = db_fetch_array($res)){
// array_push($wfsConf['abstract'], $row['wfs_conf_abstract']);
// }
// $cnt++;
// }
// if($cnt == 0){
// return false;
// }
// else{
// return $wfsConf;
// }
// }
}
示例10: log
function log($module, $req, $time_client, $type = "")
{
$this->url = $req;
if ($type == "") {
$type = $this->logtype;
}
if ($type == "file") {
if (is_dir($this->dir)) {
$logfile = $this->dir . "mb_access_" . date("Y_m_d") . ".log";
if (!($h = @fopen($logfile, "a"))) {
#exit;
} else {
for ($i = 0; $i < count($this->url); $i++) {
$content = strtotime("now") . " ";
$content .= "[" . date("d/M/Y:H:i:s O") . "]";
$content .= " " . Mapbender::session()->get("mb_user_ip");
$content .= ' "';
if ($this->log_username == true) {
$content .= Mapbender::session()->get("mb_user_name");
}
$content .= '"';
$content .= " " . Mapbender::session()->get("mb_user_id");
$content .= " " . $module;
$content .= ' "' . $this->url[$i] . '"';
$content .= chr(13) . chr(10);
if (!fwrite($h, $content)) {
#exit;
}
}
fclose($h);
}
}
} else {
if ($type == 'db') {
for ($i = 0; $i < count($this->url); $i++) {
$sql = "INSERT INTO mb_log (";
$sql .= "time_client, time_server, time_readable, mb_session, ";
$sql .= "gui, module, ip, username, userid, request";
$sql .= ") VALUES (\$1, \$2, \$3, \$4, \$5, \$6, \$7, \$8, \$9, \$10)";
$v = array($time_client, strtotime("now"), "[" . date("d/M/Y:H:i:s O") . "]", SID, Mapbender::session()->get("mb_user_gui"), $module, Mapbender::session()->get("mb_user_ip"), Mapbender::session()->get("mb_user_name"), Mapbender::session()->get("mb_user_id"), $this->url[$i]);
$t = array("s", "s", "s", "s", "s", "s", "s", "s", "s", "s");
$res = db_prep_query($sql, $v, $t) or die(db_error());
if (!$res) {
include_once dirname(__FILE__) . "/class_mb_exception.php";
$e = new mb_exception("class_log: Writing table mb_log failed.");
}
}
}
}
}
示例11: select
public function select($id, $applicationId)
{
$sql = "SELECT fkey_gui_id, e_id, e_pos, e_public, e_comment, e_public, " . "gettext(\$1, e_title) as e_title, e_element, e_src, e_attributes, " . "e_left, e_top, e_width, e_height, e_z_index, e_more_styles, " . "e_content, e_closetag, e_js_file, e_mb_mod, e_target, " . "e_requires, e_url FROM gui_element WHERE e_id = \$2 AND " . "fkey_gui_id = \$3 LIMIT 1";
$v = array(Mapbender::session()->get("mb_lang"), $id, $applicationId);
$t = array("s", "s", "s");
$res = db_prep_query($sql, $v, $t);
$row = db_fetch_array($res);
if ($row) {
$this->guiId = $applicationId;
$this->id = $row["e_id"];
$this->pos = $row["e_pos"];
$this->isPublic = $row["e_public"];
$this->comment = $row["e_comment"];
$this->title = $row["e_title"];
$this->element = $row["e_element"];
$this->src = $row["e_src"];
$this->attributes = $row["e_attributes"];
$this->left = $row["e_left"];
$this->top = $row["e_top"];
$this->width = $row["e_width"];
$this->height = $row["e_height"];
$this->zIndex = $row["e_z_index"];
$this->moreStyles = $row["e_more_styles"];
$this->content = $row["e_content"];
$this->closeTag = $row["e_closetag"];
$this->jsFile = $row["e_js_file"];
$this->mbMod = $row["e_mb_mod"];
$this->target = $row["e_target"];
$this->requires = $row["e_requires"];
$this->helpUrl = $row["e_url"];
$sql = "SELECT var_name FROM gui_element_vars WHERE fkey_gui_id = \$1 AND fkey_e_id = \$2;";
$v = array($applicationId, $id);
$t = array("s", "s");
$res = db_prep_query($sql, $v, $t);
while ($row = db_fetch_assoc($res)) {
$name = $row["var_name"];
$this->elementVars[] = new ElementVar($applicationId, $id, $name);
}
return true;
}
return false;
}
示例12: check
function check($serviceType, $serviceId)
{
if (!Mapbender::session()->exists("acceptedTou")) {
$resultObj = array("accepted" => 0, "message" => "No session var acceptedTou exists til now");
return $resultObj;
} else {
$acceptedTou = Mapbender::session()->get("acceptedTou");
$acceptedTou = json_decode($acceptedTou);
//read out service part
$serviceIdArray = $acceptedTou->{$serviceType};
#print_r($serviceIdArray);
if (in_array($serviceId, $serviceIdArray)) {
$resultObj = array("accepted" => 1, "message" => "Session var acceptedTou found - id was set before - don't show tou anymore");
return $resultObj;
} else {
$resultObj = array("accepted" => 0, "message" => "Session var acceptedTou found - id was not set before - show tou before load resource");
return $resultObj;
}
}
}
示例13: ob_start
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
ob_start();
//
// constants
//
require_once dirname(__FILE__) . "/../core/system.php";
//
// initiates the session-handling
//
session_start();
if (defined("SESSION_NAME") && is_string(SESSION_NAME)) {
session_name(SESSION_NAME);
}
//
// Basic Mapbender classes, for session handling etc.
//
require_once dirname(__FILE__) . "/../lib/class_Mapbender.php";
//
// define LC_MESSAGES if unknown (for Windows platforms)
//
if (!defined("LC_MESSAGES")) {
define("LC_MESSAGES", LC_CTYPE);
}
//
// I18n wrapper function, gettext
//
require_once dirname(__FILE__) . "/../core/i18n.php";
require_once dirname(__FILE__) . "/../http/classes/class_locale.php";
$localeObj = new Mb_locale(Mapbender::session()->get("mb_lang"));
示例14: or
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once dirname(__FILE__) . "/../../core/globalSettings.php";
$gui_id = Mapbender::session()->get("mb_user_gui");
$target = $_REQUEST["e_target"];
$e_id_css = $_REQUEST["e_id_css"];
$isLoaded = $_REQUEST["isLoaded"];
$con = db_connect($DBSERVER, $OWNER, $PW);
db_select_db($DB, $con);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset='<?php
echo CHARSET;
?>
'">
<title>mod_wfsGazetteerEditor</title>
<STYLE TYPE="text/css">
示例15: dirname
if(permission == true){
document.form1.del.value = 1;
document.form1.submit();
}
}
}
// -->
</script>
</head>
<body>
<?php
require_once dirname(__FILE__) . "/../classes/class_administration.php";
require_once dirname(__FILE__) . "/../classes/class_gui.php";
$admin = new administration();
$permguis = $admin->getGuisByPermission(Mapbender::session()->get("mb_user_id"), true);
###export
if ($guiList) {
$gui = gui::byName($guiList);
try {
$insert = $gui->toSql();
} catch (Exception $e) {
$insert = $e->message;
}
echo "<textarea rows=40 cols=80>";
echo htmlentities($insert, ENT_QUOTES, CHARSET);
echo "</textarea>";
}
###
if (!$guiList) {
$v = array();