本文整理汇总了PHP中Site::alias方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::alias方法的具体用法?PHP Site::alias怎么用?PHP Site::alias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site::alias方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: implode
}
}
$classes = implode(',', $classes);
$languages = array();
$sql = 'select nimi, keel_id, on_default from keel where on_kasutusel = 1 order by nimi;';
$result = new SQL($sql);
while ($row = $result->fetch('ASSOC')) {
$languages[] = $row;
if ($row['on_default']) {
$def_lang_id = $row['keel_id'];
}
}
// selected language, default 0 (estonian)
$language_id = isset($site->fdat['language']) ? (int) $site->fdat['language'] : $def_lang_id;
// trash id
$trash_id = $site->alias(array('key' => 'trash', 'keel' => $language_id));
if (!$trash_id) {
echo "Error! this language doesn't have Recycle bin!";
exit;
}
// sort by, default title
switch ($site->fdat['sort_by']) {
case 'pealkiri':
$sort_by = 'pealkiri';
break;
case 'changed_time':
$sort_by = 'changed_time';
break;
case 'changed_user_name':
$sort_by = 'changed_user_name';
break;
示例2: SQL
$sth2 = new SQL($sql2);
echo "
<tr bgcolor=\"FFFFFF\">
<td>".$sql2.($sth2->error? '<font color=red>Error: '.$sth2->error.'</font>':'')."</td>
</tr>
";
}
}
/*----------------------------------------------------
# OTSI �les k�ik FOLDER objektid, mis on "public" kataloogi alla ja pane neile
# EVERYBODY jaoks PERMISSION CRUPD=11111 - k�ik v�ivad uploadida neisse folderitesse.
-----------------------------------------------------*/
include_once($class_path."alampuu.class.php");
$otsingu_juur = $site->alias('public');
#printr($otsingu_juur);
$puu = new Alampuu(array(
parent_id => $otsingu_juur,
tyyp_idlist => "22" # folder
));
#printr($puu->objektid);
##################
# sql
echo "
<tr>
<td><b>permissions: public/ folders to CRUPD=11111</b><br></td>
</tr>
";
######### loop
示例3: Site
#################################################
# error_reporting
error_reporting(7);
#################################################
# create site and page
$site = new Site(array(on_debug => $debug ? 1 : 0));
######### PHP memory limit
# sets the maximum amount of memory in CONF["php_memory_limit"] Mbytes
# that a script is allowed to allocate
# if general value is smaller
if (intval(ini_get('memory_limit')) < intval($site->CONF["php_memory_limit"])) {
ini_set("memory_limit", $site->CONF["php_memory_limit"] . "M");
}
# Kui keegi sisestas mitte numbriline id:
if ($site->fdat['id'] && !is_numeric($site->fdat['id'])) {
$site->fdat['id'] = $site->alias("404error");
}
if ($site->fdat[rep_id] > 0) {
$sql = $site->db->prepare("\n\t\tSELECT objekt_id FROM objekt WHERE related_objekt_id = ?", $site->fdat[rep_id]);
$sth = new SQL($sql);
$site->debug->msg($sth->debug->get_msgs());
$site->fdat[id] = $sth->rows ? $sth->fetchsingle() : $site->alias("404error");
}
# if not admin tries to query system section (using URL or smth)
# show 404 error page instead
# WHY was it commented out before??
if ($site->fdat[id] == $site->alias("system") && !$site->in_editor) {
$site->fdat[id] = $site->alias("404error");
}
# create page
$leht = new Leht(array(id => $site->fdat[id] ? $site->fdat[id] : $site->alias($site->sys_alias ? $site->sys_alias : 'rub_home_id')));
示例4: Objekt
if ($i === 0) {
$page_encoding = $result['encoding'];
$keel_id = $result['keel_id'];
}
if (isset($site->fdat['flt_keel']) && $site->fdat['flt_keel'] == $result['keel_id']) {
$page_encoding = $result['encoding'];
$keel_id = $result['keel_id'];
}
$i++;
}
$op = $site->fdat[op];
$site->debug->msg("OP = {$op}");
# -------------------------
# otsime Home-rubriigid
# -------------------------
$curr_objekt = new Objekt(array(objekt_id => $site->alias(array('key' => 'rub_home_id', 'keel' => $keel_id)), parent_id => "0", no_cache => 1));
## BUG: juhul kui home objekti ei leidu, on $curr_objekt 404 vea objekt, ja sellele pole ju m�tet metadata-t salvestada. (Bug #1875)
# seep�rast kontrolli �le, et sys_alias oleks �ige e "home":
$conf = new CONFIG($curr_objekt->all['ttyyp_params']);
foreach ($conf->CONF as $k => $v) {
if ($k == "page_end_html") {
$curr_objekt->all[$k] = str_replace("XXYYZZ", "\n", $v);
} else {
$curr_objekt->all[$k] = $v;
}
}
#printr($conf->CONF);
if ($curr_objekt->all['sys_alias'] == 'home') {
if ($site->fdat[save] && $curr_objekt && !$site->fdat[lang_swiched]) {
verify_form_token();
$site->debug->print_hash($site->fdat, 0, "FDAT");
示例5: Site
$url = 'index.php';
#bug #2883
include_once $class_path . "config.class.php";
include_once $class_path . "custom.inc.php";
include_once $class_path . "site.class.php";
include_once $class_path . "objekt.class.php";
include_once $class_path . "user.class.php";
include_once $class_path . "group.class.php";
include_once $class_path . "template.class.php";
include_once $class_path . "objekt_array.class.php";
include_once $class_path . "html.inc.php";
include_once $class_path . "leht.class.php";
include_once $class_path . 'Log.class.php';
$site = new Site(array());
if (($site->CONF['alias_language_format'] == 1 || $site->CONF['alias_language_format'] == 2) && $site->CONF['use_aliases']) {
$leht = new Leht(array(id => $site->alias("rub_home_id")));
$sql1 = $site->db->prepare('SELECT site_url FROM keel WHERE keel_id = ?', $leht->objekt->all['keel']);
$sth1 = new SQL($sql1);
if (!($site_url = $sth1->fetchsingle())) {
$site_url = $_SERVER['SERVER_NAME'];
}
$url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $site_url . $leht->objekt->get_object_href();
}
}
setcookie("logged", "0", time() - 36600);
header("Location: " . $url);
exit;
}
###########################################################################
# K�ivitame see osa ainult �ks kord, kui omistatakse uus session_id
# Kontrollime igaks juhuks, et muutuja "HTTP_HOST" on olemas
示例6: setcookie
$error_data = $site->fdat['nimi'] . '|' . $site->fdat['email'] . '|' . $site->fdat['url'] . '|' . $site->fdat['text'] . '|' . $site->fdat['pealkiri'];
setcookie("addcomment_captcha_error", $error_data);
// or I know: to the session!
$_SESSION['scms_last_comment'] = $site->fdat;
if ($site->fdat['redirect_url']) {
header('Location: ' . urldecode(preg_replace("!\r|\n.*!s", "", $_POST['redirect_url'])) . '&lisa_alert=2');
exit;
} else {
//protocol check ...
header('Location: ' . (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $site->CONF['hostname'] . $site->CONF['wwwroot'] . ($site->in_editor ? '/editor' : '') . '/?' . (($site->fdat['tpl'] || $site->fdat['c_tpl']) && !$site->fdat['inserted_id'] && !$site->fdat['jump_to_parent'] ? 'tpl=' . $site->fdat['tpl'] . '&c_tpl=' . $site->fdat['c_tpl'] . '&' : '') . 'id=' . $site->fdat['id'] . '&lisa_alert=2');
exit;
}
}
$tyyp_id = 14;
$site->debug->print_hash($site->fdat, 1, "FDAT");
$leht = new Leht(array(id => $site->fdat['id'] ? $site->fdat['id'] : $site->alias("rub_home_id")));
$objekt = new Objekt(array(objekt_id => $site->fdat['id'], on_sisu => 1));
if (!$objekt->objekt_id) {
//redirect 404 lehele
header('Location: index.php?id=' . $site->alias(array('key' => '404error')));
exit;
}
$obj_conf = new CONFIG($objekt->all['ttyyp_params']);
if ($site->fdat['output_device'] == 'pda') {
if (strlen($site->fdat['text']) < 2 || strlen($site->fdat['nimi']) < 2) {
myRedirect($site->fdat['redirect_url']);
exit;
}
$name = trim($site->user->all['firstname'] . ' ' . $site->user->all['lastname']);
$nimi = trim($site->fdat['nimi']);
if ($name != $nimi) {
示例7: Objekt
{
$page_encoding = $result['encoding'];
$keel_id = $result['keel_id'];
}
$i++;
}
$op = $site->fdat[op];
$site->debug->msg("OP = $op");
# -------------------------
# otsime Home-rubriigid
# -------------------------
$curr_objekt = new Objekt(array(
objekt_id => $site->alias(array(
'key' => 'rub_home_id',
'keel' => $keel_id
)),
parent_id => "0",
no_cache => 1
));
## BUG: juhul kui home objekti ei leidu, on $curr_objekt 404 vea objekt, ja sellele pole ju mõtet metadata-t salvestada. (Bug #1875)
# seepärast kontrolli üle, et sys_alias oleks õige e "home":
$conf = new CONFIG($curr_objekt->all['ttyyp_params']);
foreach ($conf->CONF as $k=>$v){
if($k=="page_end_html"){
$curr_objekt->all[$k]=str_replace("XXYYZZ","\n",$v);
}else{
$curr_objekt->all[$k]=$v;
}
}
#printr($conf->CONF);
示例8: Objekt
}
######### EXTERNAL TABLE ?
if (substr($profile_def['source_table'], 0, 4) == 'ext_') {
$external_table = $profile_def['source_table'];
}
}
#################
# GET objekt INFO
if ($site->fdat['objekt_id']) {
$objekt = new Objekt(array(objekt_id => $site->fdat['objekt_id']));
}
# get parent for new button
if ($objekt->parent_id) {
$parent_id = $objekt->parent_id;
} else {
$parent_id = $site->alias("system");
}
?>
<html>
<head>
<title><?php
echo $site->title;
?>
<?php
echo $site->cms_version;
?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php
echo $site->encoding;
?>
">
示例9: COUNT
<input type=hidden name=op value="<?=$site->fdat['op']?>">
<input type=hidden name=op2 value="">
<input type=hidden name=profile_name value="<?=$profile_name?>">
<table border="0" cellpadding="0" cellspacing="0" style="width:100%; height:100px">
<tr>
<td valign="top" width="100%" class="scms_confirm_delete_cell" height="100%">
<?
# check if allowed to delete
# 1. if exist any object / user / group/ document with that profile, then don't allow to delete
$data_count = 0;
############ assets
if($profile_def['source_table'] == 'obj_asset'){
$sql = $site->db->prepare("SELECT COUNT(*) FROM obj_asset LEFT JOIN objekt_objekt on obj_asset.objekt_id=objekt_objekt.objekt_id WHERE profile_id=? AND objekt_objekt.parent_id<>?",$site->fdat['pid'],$site->alias("trash"));
$sth = new SQL($sql);
$asset_count = $sth->fetchsingle();
$data_count += $asset_count;
}
############ forms
elseif(substr($profile_def['source_table'],0,5) == 'form_'){
$sql = $site->db->prepare("SELECT COUNT(*) FROM ".$profile_def['source_table']." WHERE profile_id=? ",$site->fdat['pid']);
$sth = new SQL($sql);
$form_count = $sth->fetchsingle();
$data_count += $form_count;
# get other profiles with this source_table
$sql = $site->db->prepare("SELECT COUNT(*) FROM object_profiles WHERE source_table=? AND profile_id<>? ",$profile_def['source_table'], $site->fdat['pid']);
$sth = new SQL($sql);
$other_profiles_count = $sth->fetchsingle();
示例10: isset
$language_id = isset($_SESSION['keel']['keel_id']) ? $_SESSION['keel']['keel_id'] : $site->keel;
} else {
$language_id = (int) $_GET['lang'];
}
if ($_SESSION[$swk_setup]['hide_language_selection'] != 1) {
//we create an array
$languages = array();
$sql = 'select nimi, keel_id from keel where on_kasutusel = 1 order by nimi;';
$result = new SQL($sql);
while ($row = $result->fetch('ASSOC')) {
$languages[] = $row;
}
}
// tree trunk
// can be alias
$trunk_id = $site->alias(array('key' => $_GET['objekt_id'], 'keel' => $language_id));
if (!$trunk_id) {
$trunk_id = (int) $_GET['objekt_id'];
}
if (empty($trunk_id)) {
$trunk = new NodeObject(array('objekt_id' => 0, 'pealkiri' => 'CMS', 'select_checkbox' => 0, 'tyyp_id' => 0, 'klass' => '', 'on_avaldatud' => '', 'parent_id' => '', 'sys_alias' => '', 'friendly_url' => '', 'ttyyp_id' => '', 'page_ttyyp_id' => '', 'kesk' => '', 'aeg' => ''));
$trunk_id = 0;
} else {
$trunk = new Objekt(array('objekt_id' => $trunk_id));
if ($trunk->objekt_id) {
foreach ($fields as $field) {
$trunk_fields[$field] = $trunk->all[$field];
}
$trunk_fields['select_checkbox'] = 0;
$trunk = new NodeObject($trunk_fields);
} else {
示例11: Site
#
global $site;
preg_match('/\\/(admin|editor)\\//i', $_SERVER["REQUEST_URI"], $matches);
if ($matches[1] == "admin" || $matches[1] == "editor") {
$class_path = "../classes/";
} else {
$class_path = "./classes/";
}
include_once $class_path . "port.inc.php";
#Get debug cookie muutuja
$debug = $_COOKIE["debug"] ? 1 : 0;
$hidden_output = 0;
$site = new Site(array(on_debug => $debug, on_admin_keel => 1));
$objekt = new Objekt(array(objekt_id => $site->fdat['id']));
if ($objekt) {
$rub_trash_id = $site->alias(array('key' => 'trash', 'keel' => $objekt->all['keel']));
}
if ($objekt->objekt_id == $rub_trash_id && $rub_trash_id) {
echo "<font face=verdana size=2><b>You can not delete section \"Recycle Bin\" !</b></font>";
exit;
}
####################################
# GET PERMISSIONS
# get object permissions for current user
$site->debug->msg("EDIT: Kustutava objekti " . $objekt->objekt_id . " �igused = " . ($system_admin ? "System admin" : $objekt->permission['mask']));
###########################
# ACCESS allowed/denied
# decide if accessing this page is allowed or not
# DELETE: if current object has DELETE => allow
if ($objekt->permission['D']) {
$access = 1;
示例12: COUNT
<input type=hidden name=profile_name value="<?php
echo $profile_name;
?>
">
<table border="0" cellpadding="0" cellspacing="0" style="width:100%; height:100px">
<tr>
<td valign="top" width="100%" class="scms_confirm_delete_cell" height="100%">
<?php
# check if allowed to delete
# 1. if exist any object / user / group/ document with that profile, then don't allow to delete
$data_count = 0;
############ assets
if ($profile_def['source_table'] == 'obj_asset') {
$sql = $site->db->prepare("SELECT COUNT(*) FROM obj_asset LEFT JOIN objekt_objekt on obj_asset.objekt_id=objekt_objekt.objekt_id WHERE profile_id=? AND objekt_objekt.parent_id<>?", $site->fdat['pid'], $site->alias("trash"));
$sth = new SQL($sql);
$asset_count = $sth->fetchsingle();
$data_count += $asset_count;
} elseif (substr($profile_def['source_table'], 0, 5) == 'form_') {
$sql = $site->db->prepare("SELECT COUNT(*) FROM " . $profile_def['source_table'] . " WHERE profile_id=? ", $site->fdat['pid']);
$sth = new SQL($sql);
$form_count = $sth->fetchsingle();
$data_count += $form_count;
# get other profiles with this source_table
$sql = $site->db->prepare("SELECT COUNT(*) FROM object_profiles WHERE source_table=? AND profile_id<>? ", $profile_def['source_table'], $site->fdat['pid']);
$sth = new SQL($sql);
$other_profiles_count = $sth->fetchsingle();
}
# POOLELI: kontrolilida ka teisi lapsi...
if ($data_count > 0) {
示例13: sections
$koik_meilinglistid[] = $obj['objekt_id'];
}
##################
# get all sections (privilege check is already done in rubloetelu class)
include_once $class_path . "rubloetelu.class.php";
################
# loop over languages
foreach ($keeled as $keel) {
$rubs = new RubLoetelu(array(keel => $keel));
$topparents = $rubs->get_loetelu();
if (is_array($topparents)) {
asort($topparents);
##################
# loop over all sections
foreach ($topparents as $obj_id => $obj_name) {
if ($obj_id != $site->alias("rub_home_id") && in_array($obj_id, $koik_meilinglistid)) {
$obj_name = str_replace("->", " > ", $obj_name);
?>
<tr>
<td><input type=checkbox name="rubriik[]" value="<?php
echo $obj_id;
?>
" <?php
echo $meilinglistid[$obj_id];
?>
></td>
<td> <a href="<?php
echo (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $site->hostname . $site->wwwroot . "/?id=" . $obj_id;
?>
" target="_new"><?php
echo $obj_name;
示例14: SQL
on_debug=>($debug ? 1 : 0),
));
######### PHP memory limit
# sets the maximum amount of memory in CONF["php_memory_limit"] Mbytes
# that a script is allowed to allocate
# if general value is smaller
if ( intval(ini_get('memory_limit')) < intval($site->CONF["php_memory_limit"]) ) {
ini_set ( "memory_limit", $site->CONF["php_memory_limit"]."M" );
}
# Kui keegi sisestas mitte numbriline id:
if ($site->fdat['id'] && !is_numeric($site->fdat['id'])){$site->fdat['id']=$site->alias("404error");}
if ( $site->fdat[rep_id]>0 ) {
$sql = $site->db->prepare("
SELECT objekt_id FROM objekt WHERE related_objekt_id = ?",
$site->fdat[rep_id]
);
$sth = new SQL($sql);
$site->debug->msg($sth->debug->get_msgs());
$site->fdat[id] = $sth->rows ? $sth->fetchsingle() : $site->alias("404error");
}
# if not admin tries to query system section (using URL or smth)
# show 404 error page instead
# WHY was it commented out before??
if ($site->fdat[id] == $site->alias("system") && !$site->in_editor) {
$site->fdat[id] = $site->alias("404error");
示例15: Site
* @copyright 2000-2010 Saurused Ltd (http://www.saurus.info/)
* @license Mozilla Public License 1.1 (http://www.opensource.org/licenses/mozilla1.1.php)
*
*/
global $site;
global $class_path;
preg_match('/\\/(admin|editor)\\//i', $_SERVER["REQUEST_URI"], $matches);
$class_path = $matches[1] == 'editor' ? '../classes/' : './classes/';
include_once $class_path . 'port.inc.php';
$site = new Site(array('on_debug' => 0));
/*--------------------------- Code Begin ------------------------------------------*/
// add default values for $site_title and $site_slogan for all active languages
$sql = "select keel_id from keel where on_kasutusel = 1";
$result = new SQL($sql);
while ($row = $result->fetch('ASSOC')) {
$curr_objekt = new Objekt(array('objekt_id' => $site->alias(array('key' => 'rub_home_id', 'keel' => $row['keel_id'])), 'parent_id' => 0, 'no_cache' => 1));
$conf = new CONFIG($curr_objekt->all['ttyyp_params']);
if ($curr_objekt->all['sys_alias'] == 'home') {
$conf = new CONFIG($curr_objekt->all['ttyyp_params']);
$conf->put('site_name', 'ShowTime');
$conf->put('slogan', 'Saurus CMS out-of-the-box experience');
$sql = $site->db->prepare("UPDATE objekt SET ttyyp_params=? WHERE objekt_id=?", $conf->Export(), $curr_objekt->objekt_id);
$sth = new SQL($sql);
}
}
// add timezone support to the CMS.
//We start by checking if there is not already a table by the name of 'ext_timezones'.
$sql = "SHOW TABLES LIKE 'ext_timezones'";
$result = new SQL($sql);
if ($result->rows >= 1) {
echo "<br><font color=red>You already have a table called 'ext_timezones' in your database.</font>";