本文整理汇总了PHP中translate_en函数的典型用法代码示例。如果您正苦于以下问题:PHP translate_en函数的具体用法?PHP translate_en怎么用?PHP translate_en使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了translate_en函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_custom_conf_save
function smarty_function_custom_conf_save($params, &$smarty)
{
global $site, $leht;
##############
# default values
extract($params);
if (!isset($id)) {
$id = $leht->id;
}
if (!$id) {
return;
}
$objekt = new Objekt(array(objekt_id => $id, no_cache => 1));
if ($objekt->permission['U']) {
$conf = new CONFIG($objekt->all['ttyyp_params']);
foreach ($params as $param => $value) {
if ($param == 'id') {
continue;
}
$conf->put($param, $value);
}
$sql = $site->db->prepare("\r\n\t\t\tUPDATE objekt SET ttyyp_params = ?\r\n\t\t\tWHERE objekt_id = ?", $conf->Export(), $id);
$sth = new SQL($sql);
} else {
new Log(array('action' => 'update', 'type' => 'WARNING', 'objekt_id' => $objekt->objekt_id, 'message' => sprintf("Access denied: attempt to edit %s '%s' (ID = %s)", ucfirst(translate_en($objekt->all['klass'])), $objekt->pealkiri(), $objekt->objekt_id)));
}
return;
}
示例2: Log
# PERMISSIONS tab : if current user has READ privilege for this adminpage => allow
if( $site->fdat['tab'] == 'permissions'){
# kas useril on selle admin-lehe kohta Read õigus?
if($site->user->allowed_adminpage(array("adminpage_id" => $site->fdat['id'])) ) {
$access = 1;
}
}
####################
# access denied
if (!$access) {
new Log(array(
'action' => 'create',
'type' => 'WARNING',
'objekt_id' => $objekt->objekt_id,
'message' => $objekt ? sprintf("Access denied: attempt to edit %s '%s' (ID = %s)" , ucfirst(translate_en($objekt->all['klass'])), $objekt->pealkiri(), $objekt->objekt_id) : sprintf("Access denied: attempt to create %s under restricted category ID = %s" , ucfirst(translate_en($objekt->all['klass'])), $site->fdat['parent_id']),
));
?>
<center><b><?=$site->sys_sona(array(sona => "access denied", tyyp=>"editor"))?></b>
<?
if($site->user) { $site->user->debug->print_msg(); }
if($site->guest) { $site->guest->debug->print_msg(); }
$site->debug->print_msg();
########### EXIT
exit;
}
# / ACCESS allowed/denied
###########################
###########################
示例3: smarty_function_init_section
//.........这里部分代码省略.........
if (!$parent_id) {
$smarty->assign(array($name => $section, $name . '_newbutton' => '', $name . '_counttotal' => 0, $name . '_rows' => 0, $name . '_count' => 0));
return;
}
###############
# action-buttons
# by default show all
if (!isset($buttons)) {
$buttons = array("new", "edit", "hide", "move", "delete");
} else {
$buttons = split(",", $buttons);
}
if (!isset($classes)) {
$classes = "section";
}
# for language compatibility, replace with search string existing db field name
$order = preg_replace('#\\btitle\\b#i', "pealkiri", $order);
$order = preg_replace('#\\bdate\\b#i', "aeg", $order);
################
# position
# default values for position
if (!isset($position)) {
$position = 0;
}
##############
# alamlist
# change class values for language compability:
$tyyp_idlist = $classes;
$classes = str_replace("section", translate_ee("section"), $classes);
# tyyp_id = 1
$classes = str_replace("link", translate_ee("link"), $classes);
# tyyp_id = 3
# strip out all spaces
$classes = preg_replace("/(\\s)*/", "", $classes);
# for buttons:
$tyyp_idlist = str_replace("section", "1", $tyyp_idlist);
# tyyp_id = 1
$tyyp_idlist = str_replace("link", "3", $tyyp_idlist);
# tyyp_id = 3
$alamlist = new Alamlist(array(parent => $parent_id, klass => $classes ? $classes : "rubriik", asukoht => $position, order => $order, start => $start, limit => $limit));
#$alamlist->debug->print_msg();
# if parameter "limit" is provided then "counttotal" element is needed (shows total rows)
if (isset($limit)) {
$alamlist_count = new Alamlist(array(parent => $parent_id, klass => $classes ? $classes : "rubriik", asukoht => $position, on_counter => 1));
}
##############
# load variables
$new_button = $alamlist->get_edit_buttons(array(tyyp_idlist => $tyyp_idlist ? $tyyp_idlist : "1", publish => $publish));
while ($obj = $alamlist->next()) {
################
# object parameters
$obj->id = $obj->objekt_id;
# kui rubriik:
if ($obj->all[klass] == "rubriik") {
$obj->get_object_href();
} elseif ($obj->all[klass] == 'link') {
# load sisu, et saada vļæ½ļæ½rtused "url" ja "on_uusaken"
$obj->load_sisu();
$objektUrl = $obj->all['url'];
// replace index.php?id=xxx or ?id=xxx style local url with its alias
if (!$site->in_editor && $site->CONF['use_aliases'] && $site->CONF['replace_links_with_alias']) {
$objektUrl = convert_local_link_to_alias($objektUrl);
}
$objektUrl && $obj->all['on_uusaken'] ? $obj->href = $objektUrl . '" target="_blank' : ($obj->href = $objektUrl);
}
$obj->is_selected = $leht->parents->on_parent($obj->objekt_id);
$obj->title .= $obj->pealkiri;
$obj->buttons = $obj->get_edit_buttons(array(nupud => $buttons, tyyp_idlist => $tyyp_idlist ? $tyyp_idlist : "1", publish => $publish));
$obj->last_modified = date('Y', $obj->all['last_modified']) > 1970 ? date('d.m.Y H:i', $obj->all['last_modified']) : '';
## crap data
$obj->flast_modified = $obj->all['last_modified'];
$obj->class = translate_en($obj->all[klass]);
# translate it to english
$obj->created_user_id = $obj->all['created_user_id'];
$obj->created_user_name = $obj->all['created_user_name'];
$obj->changed_user_id = $obj->all['changed_user_id'];
$obj->changed_user_name = $obj->all['changed_user_name'];
$obj->created_time = $site->db->MySQL_ee($obj->all['created_time']);
$obj->fcreated_time = $obj->all['created_time'];
$obj->changed_time = $site->db->MySQL_ee($obj->all['changed_time']);
$obj->fchanged_time = $obj->all['changed_time'];
$obj->last_commented_time = $site->db->MySQL_ee($obj->all['last_commented_time']);
$obj->comment_count = $obj->all['comment_count'];
###############
# push array
# kui objektil featuur "Peida menļæ½ļæ½s" sisselļæ½litatud (NB! erinev tingimus kui avaldatus)
# ja pole admin siis mitte lisada objekti massiivi
if (!$obj->all[is_hided_in_menu] || $site->in_editor) {
array_push($section, $obj);
}
}
$count = sizeof($section);
$counttotal = isset($limit) ? $alamlist_count->rows : $count;
##############
# assign to template variables
## This is how we __should__ have assigned the
## variables !!
##
$smarty->assign(array($name => $section, $name . '_newbutton' => $new_button, $name . '_counttotal' => $counttotal, $name . '_rows' => $counttotal, $name . '_count' => $count));
}
示例4: array
$tmp_sort = array();
$uus_sort = array_merge($tmp_sort, $back_sort);
# echo "Before: ".printr($back_sort)."<hr>";
#echo "After: ".printr($uus_sort)."<hr>";
for ($i = 0; $i < sizeof($objekt_id); $i++) {
$sql = $site->db->prepare("update objekt_objekt set sorteering = ? where objekt_id =? and parent_id = ?", $uus_sort[$i], $objekt_id[$i], $objekt->parent_id);
$sth = new SQL($sql);
$site->debug->msg($sth->debug->get_msgs());
$site->debug->msg("i=" . $i . "; sort=" . $uus_sort[$i] . "; obj=" . $objekt_id[$i] . "; parent=" . $objekt->parent_id);
# 20.03.2003 Evgeny bugfix: kui sorteering=0
if (!$uus_sort[$i]) {
$viga['parent_id'] = $objekt->parent_id;
}
}
}
new Log(array('action' => 'update', 'objekt_id' => $objekt->objekt_id, 'message' => sprintf("%s '%s' (ID = %s) %s", ucfirst(translate_en($objekt->all[klass])), $objekt->pealkiri(), $objekt->objekt_id, "re-sorted")));
if ($viga['parent_id']) {
$site->debug->msg("Wrong sort parameter found! Trying to fix it...");
$sql = $site->db->prepare("SELECT objekt.objekt_id, sorteering FROM objekt \r\n\t\t\tLEFT JOIN objekt_objekt on objekt.objekt_id=objekt_objekt.objekt_id \r\n\t\t\tWHERE kesk=? AND parent_id=? AND sorteering='0'\r\n\t\t\tORDER BY objekt_objekt.sorteering DESC", $args['asukoht'], $viga['parent_id']);
$sth = new SQL($sql);
$site->debug->msg($sth->debug->get_msgs());
$sth2 = new SQL("SELECT MAX(sorteering) FROM objekt_objekt");
$site->debug->msg($sth2->debug->get_msgs());
$max_sort = $sth2->fetchsingle();
$super_sort = $max_sort + $sth->rows;
while ($data = $sth->fetch()) {
$sql3 = $site->db->prepare("UPDATE objekt_objekt SET sorteering=? WHERE objekt_id=? AND sorteering=0", $super_sort, $data['objekt_id']);
$sth3 = new SQL($sql3);
$site->debug->msg($sth3->debug->get_msgs());
$super_sort--;
}
示例5: templates
<td class="r<?php
echo $i % 2 + 1;
?>
" ><?php
echo $myttyyp[templ_fail];
?>
</td>
<?php
if ($type != 'page') {
# dont show op for page templates (bug #1964)
?>
<td class="r<?php
echo $i % 2 + 1;
?>
" ><?php
echo translate_en($myttyyp['op']);
?>
</td>
<?php
}
?>
<td class="r<?php
echo $i % 2 + 1;
?>
" ><?php
echo $myttyyp[on_nahtav] ? "Y" : "N";
?>
</td>
<!-- <td class="r<?php
echo $i % 2 + 1;
?>
示例6: smarty_function_init_objects
//.........这里部分代码省略.........
foreach (split(",", $classes) as $class) {
if (trim($class) != '') {
$transl_class_arr[] = translate_ee($class);
# translate it to estonian
}
}
# echo printr($transl_class_arr);
$classes = join(",", $transl_class_arr);
######## gather tyyp ID values => to array
$tyyp_id_arr = array();
$sql = "SELECT tyyp_id, klass FROM tyyp";
$sth = new SQL($sql);
$site->debug->msg($sth->debug->get_msgs());
while ($tmp = $sth->fetch()) {
# if ID found in classes array, then add it:
if (in_array($tmp['klass'], $transl_class_arr)) {
$tyyp_id_arr[] = $tmp['tyyp_id'];
}
}
# echo printr($tyyp_id_arr);
# tyyp_idlist ID numeric values for buttons:
$tyyp_idlist = join(",", $tyyp_id_arr);
}
# if classes parameter provided
# / classes
##################
##############
# alamlist
$alamlistSQL = new AlamlistSQL(array(parent => $parent_id, klass => $classes, asukoht => $position, order => $order));
if ($select) {
$alamlistSQL->add_select($select);
}
if ($where) {
$alamlistSQL->add_where($where);
}
if ($group) {
$alamlistSQL->add_group($site->db->prepare('group by ' . $group));
}
$alamlist = new Alamlist(array('alamlistSQL' => $alamlistSQL, start => $start, limit => $limit));
$alamlist->debug->print_msg();
# if parameter "limit" is provided then "counttotal" element is needed (shows total rows)
if (isset($limit)) {
$alamlist_count = new Alamlist(array(parent => $parent_id, klass => $classes, asukoht => $position, on_counter => 1));
}
##############
# load variables
$new_button = $alamlist->get_edit_buttons(array(tyyp_idlist => $tyyp_idlist, publish => $publish));
while ($obj = $alamlist->next()) {
################
# object parameters
$obj->id = $obj->objekt_id;
# kui link
if ($obj->all[klass] == "link") {
# load sisu, et saada vļæ½ļæ½rtused "url" ja "on_uusaken"
$obj->load_sisu();
$objektUrl = $obj->all['url'];
// replace index.php?id=xxx or ?id=xxx style local url with its alias
if (!$site->in_editor && $site->CONF['use_aliases'] && $site->CONF['replace_links_with_alias']) {
$objektUrl = convert_local_link_to_alias($objektUrl);
}
$objektUrl && $obj->all['on_uusaken'] ? $obj->href = $objektUrl . '" target="_blank' : ($obj->href = $objektUrl);
} else {
$obj->get_object_href();
}
$obj->is_selected = $leht->parents->on_parent($obj->objekt_id);
$obj->title = $obj->pealkiri;
$obj->buttons = $obj->get_edit_buttons(array(nupud => $buttons, tyyp_idlist => $tyyp_idlist, publish => $publish));
$obj->fdate = $obj->all[aeg];
$obj->last_modified = date('Y', $obj->all['last_modified']) > 1970 ? date('d.m.Y H:i', $obj->all['last_modified']) : '';
## crap data
$obj->flast_modified = $obj->all['last_modified'];
$obj->author = $obj->all[author];
$obj->class = translate_en($obj->all[klass]);
# translate it to english
$obj->details_link = $obj->href;
$obj->details_title = $site->sys_sona(array(sona => "loe edasi", tyyp => "kujundus"));
$obj->printgif = '<a href="' . $obj->href . '&op=print" onClick="avaprintaken(this.href, 600, 400, \'print\'); return false;" target=_blank><img src="' . $site->img_path . '/print_it.gif" border=0 width=19 height=18></a>';
$obj->printlink = $site->self . '?id=' . $obj->objekt_id . '&op=print';
$obj->created_user_id = $obj->all['created_user_id'];
$obj->created_user_name = $obj->all['created_user_name'];
$obj->changed_user_id = $obj->all['changed_user_id'];
$obj->changed_user_name = $obj->all['changed_user_name'];
$obj->created_time = $site->db->MySQL_ee($obj->all['created_time']);
$obj->fcreated_time = $obj->all['created_time'];
$obj->changed_time = $site->db->MySQL_ee($obj->all['changed_time']);
$obj->fchanged_time = $obj->all['changed_time'];
$obj->last_commented_time = $site->db->MySQL_ee($obj->all['last_commented_time']);
$obj->comment_count = $obj->all['comment_count'];
###############
# push array, in case we don't have "peida menuus" turned on (section objects)
if (!$obj->all[is_hided_in_menu] || $site->in_editor) {
array_push($objects_arr, $obj);
}
}
$count = sizeof($objects_arr);
$counttotal = isset($limit) ? $alamlist_count->rows : $count;
##############
# assign to template variables
$smarty->assign(array($name => $objects_arr, $name . '_newbutton' => $new_button, $name . '_counttotal' => $counttotal, $name . '_count' => $count));
}
示例7: Log
# Run mailinglists after each publishing
if ($site->CONF['maillist_sending_after_publishing'] && $site->fdat['op'] == "publish") {
require_once($class_path."auto.inc.php");
auto_maillist(0,0);
}
# ------------------------
# Kustutame chache-ist
# ------------------------
clear_cache("ALL");
if (!$site->on_debug) {
header("Location: ".(empty($_SERVER['HTTPS']) ? 'http://' : 'https://').$site->CONF[hostname].$site->fdat[url]);
}
new Log(array(
'action' => ($on_avaldatud ? 'publish' : 'hide'),
'type' => 'WARNING',
'objekt_id' => $objekt->objekt_id,
'message' => sprintf("%s '%s' (ID = %s) %s" , ucfirst(translate_en($objekt->all[klass])), $objekt->pealkiri(), $objekt->objekt_id, $on_avaldatud ? "published" : "hidden"),
));
} else {
?>
Wrong ID
<?
}
if($site->user) { $site->user->debug->print_msg(); }
if($site->guest) { $site->guest->debug->print_msg(); }
$site->debug->print_msg();
示例8: Leht
function Leht()
{
$args = func_get_arg(0);
$this->BaasObjekt();
$this->id = $args[id];
$fdat = array();
# Get full path to the class folder. added by Dima 19.03.2004
$path_parts = pathinfo($_SERVER["SCRIPT_FILENAME"]);
$class_path = $path_parts["dirname"];
# bugfix #1393, by merle 15.10.2004
# if path ends with "/editor", cut it off
if (substr($path_parts["dirname"], -7) == '/editor') {
$class_path = substr($path_parts["dirname"], 0, -7);
}
# if path ends with "/admin", cut it off
if (substr($path_parts["dirname"], -6) == '/admin') {
$class_path = substr($path_parts["dirname"], 0, -6);
}
$class_path .= "/classes/";
//testing:
//require_once($class_path."auto.inc.php");
//auto_error_notifications(1);
//auto_maillist(0, 0, 0 , 1);
#################################################
# run mailinglist in CONF[maillist_interval] hour
if ($this->site->CONF['next_mailinglist'] < time() && $this->site->CONF['maillist_interval'] && $this->site->CONF['enable_mailing_list']) {
# set next run
$sql = $this->site->db->prepare("\r\n\t\t\t\tupdate config set sisu = ? where nimi='next_mailinglist'", time() + intval($this->site->CONF['maillist_interval']) * 3600);
$sth = new SQL($sql);
$this->site->debug->msg($sth->debug->get_msgs());
require_once $class_path . "auto.inc.php";
auto_maillist(0, 0, 0, 1);
}
########################
# run in every 10 minutes
if ($this->site->CONF['next_10min'] < time()) {
# set next run
$sql = $this->site->db->prepare("update config set sisu = ? where nimi='next_10min'", time() + 600);
$sth = new SQL($sql);
$this->site->debug->msg($sth->debug->get_msgs());
require_once $class_path . "auto.inc.php";
auto_publishing(1);
}
########################
# run in every hour
if ($this->site->CONF['next_hour'] < time()) {
# set next run
$sql = $this->site->db->prepare("update config set sisu = ? where nimi='next_hour'", time() + 3600);
$sth = new SQL($sql);
$this->site->debug->msg($sth->debug->get_msgs());
require_once $class_path . "auto.inc.php";
# delete from cache old content:
if (is_numeric($this->site->CONF['cache_expired'])) {
## delete cache by interval
$cache_expired = time() + $this->site->CONF['cache_expired'] * 60 * 60;
# now + interval in seconds
$sql = $this->site->db->prepare("DELETE FROM cache WHERE aeg < " . $this->site->db->unix2db_datetime($cache_expired) . " AND objekt_id != ?", 0);
$sth = new SQL($sql);
$this->site->debug->msg($sth->debug->get_msgs());
}
// error notifications, only if setting is marked as pageload
if ($this->site->CONF['send_error_notifiations_setting'] == 1) {
auto_error_notifications(1);
}
}
#################################################
# We don't want to dublicate code, so will write it here:
if ($this->site->admin && $this->site->fdat['empty_recycle_bin']) {
$do_empty = 1;
}
#################################################
# run every day
if ($this->site->CONF['next_day'] < time() || $do_empty) {
if (!$do_empty) {
# set next run
$sql = $this->site->db->prepare("update config set sisu = ? where nimi='next_day'", time() + 86400);
$sth = new SQL($sql);
$this->site->debug->msg($sth->debug->get_msgs());
}
#################################################
# empty Recycle Bin
if ($this->site->CONF['trash_expires'] || $do_empty) {
$sql = "SELECT keel_id FROM keel WHERE on_kasutusel = '1'";
$sth503 = new SQL($sql);
$this->site->debug->msg($sth503->debug->get_msgs());
while ($tmp_keel = $sth503->fetch()) {
$trash_id = $this->site->alias(array('key' => 'trash', 'keel' => $tmp_keel['keel_id']));
if ($trash_id) {
# find objects which changed_time + trash.expires.in.days < NOW (Bug #2602)
$sql502 = $this->site->db->prepare("SELECT objekt_objekt.* FROM objekt_objekt LEFT JOIN objekt ON objekt.objekt_id=objekt_objekt.objekt_id WHERE objekt_objekt.parent_id=? AND DATE_ADD(objekt.changed_time,INTERVAL ? DAY) < NOW() ", $trash_id, $this->site->CONF['trash_expires']);
$sth502 = new SQL($sql502);
$this->site->debug->msg($sth502->debug->get_msgs());
while ($ttmp = $sth502->fetch()) {
$this->site->debug->msg('leht.class.php : Trying to remove object ' . $ttmp['objekt_id'] . ' from Recycle Bin...');
$del_objekt = new Objekt(array('objekt_id' => $ttmp['objekt_id'], 'superuser' => 1));
if ($del_objekt->objekt_id && $del_objekt->parent_id == $trash_id) {
$del_objekt->del();
new Log(array('action' => 'delete', 'component' => 'Recycle bin', 'objekt_id' => $del_objekt->objekt_id, 'user_id' => 0, 'message' => sprintf("%s '%s' (ID = %s) %s", ucfirst(translate_en($del_objekt->all['klass'])), $del_objekt->pealkiri(), $del_objekt->objekt_id, " removed from Recycle Bin ")));
} else {
new Log(array('action' => 'delete', 'component' => 'Recycle bin', 'objekt_id' => $del_objekt->objekt_id, 'user_id' => 0, 'type' => 'ERROR', 'message' => "Couldn't remove object ID = '" . $ttmp['objekt_id'] . "' from Recycle Bin (Parent ID of this object ='" . $del_objekt->parent_id . "')"));
//.........这里部分代码省略.........
示例9: smarty_function_init_page
function smarty_function_init_page(&$smarty, $params)
{
global $site, $leht, $template, $class_path;
include_once $class_path . 'extension.class.php';
$content_template = $leht->content_template;
# load all possible data for current object
# load_current_obj_data();
## This is how we __should__ have assigned the
## variables !!
##
$title = $leht->objekt->all['meta_title'] ? $leht->objekt->all['meta_title'] : $leht->meta[title];
$keywords = $leht->objekt->all['meta_keywords'] ? $leht->objekt->all['meta_keywords'] : $leht->meta[keywords];
$description = $leht->objekt->all['meta_description'] ? $leht->objekt->all['meta_description'] : $leht->meta[description];
$c_tpl = is_object($leht->content_template) ? $leht->content_template->ttyyp_id : $site->fdat['c_tpl'];
$curr_objekt = new Objekt(array(objekt_id => $site->alias(array("key" => "rub_home_id", "keel" => $site->keel))));
$conf = new CONFIG($curr_objekt->all["ttyyp_params"]);
foreach ($conf->CONF as $k => $v) {
if ($k != "page_end_html") {
if ($k == "site_name") {
$site_name = $v;
}
if ($k == "slogan") {
$site_slogan = $v;
}
}
}
$sql = $site->db->prepare("SELECT locale, nimi FROM keel WHERE on_kasutusel=1 AND keel_id=?", $site->glossary_id);
$sth = new SQL($sql);
$glossary = $sth->fetch("ASSOC");
// registered user should not be able to use {$in_editor} and {$admin} tags, only those with update permission
if ($site->in_editor && $leht->objekt->permission['U']) {
$in_editor = 1;
} else {
$in_editor = 0;
}
// create template object to be passed as global variable
$template_obj->all = $template->all;
$template_obj->title = $template->all['nimi'];
$template_obj->name = $template->all['nimi'];
$template_obj->id = $template->all['ttyyp_id'];
$template_obj->op = $template->all['op'];
$template_obj->extension = $template->all['extension'];
$smarty->assign(array('id' => $leht->id, 'title' => $title, 'meta_title' => $title, 'meta_keywords' => $keywords, 'meta_description' => $description, 'encoding' => $leht->site->encoding, 'img_path' => $leht->site->CONF[wwwroot] . $leht->site->CONF[img_path], 'adm_img_path' => $leht->site->CONF[wwwroot] . $leht->site->CONF[adm_img_path], 'custom_img_path' => $leht->site->CONF[wwwroot] . $leht->site->CONF[custom_img_path], 'styles_path' => $leht->site->CONF[wwwroot] . $leht->site->CONF['styles_path'], 'js_path' => $leht->site->CONF[wwwroot] . $leht->site->CONF[js_path], 'file_path' => $leht->site->CONF[wwwroot] . $leht->site->CONF[file_path], 'self' => $site->self, 'url' => $site->URI, 'protocol' => $leht->site->CONF[protocol], 'wwwroot' => $leht->site->CONF[wwwroot], 'hostname' => $leht->site->CONF[hostname], 'current_level' => $leht->level, 'op' => $site->fdat[op], 'tpl' => is_object($template) ? $template->ttyyp_id : $site->fdat['tpl'], 'c_tpl' => $c_tpl, 'ext_id' => $site->fdat[ext_id], 'admin' => $in_editor, 'in_editor' => $in_editor, 'user' => $site->user ? 1 : 0, 'userdata' => $site->user, 'current_obj' => $leht->objekt, 'lang' => $site->extension, 'site_extension' => $site->extension, 'locale' => $glossary["locale"], 'glossary' => $glossary["nimi"], 'current_class' => translate_en($leht->objekt->all['klass']), 'content_tpl' => $leht->content_template->all[nimi], 'page_tpl' => $template->all[nimi], 'prod_id' => eregi_replace("[^0-9]", "", $site->fdat[prod_id]), 'form_error' => $site->fdat['form_error'], 'form_data' => $site->fdat['form_data'], 'conf' => $site->CONF, 'template' => $template_obj, 'site_name' => $site_name, 'site_slogan' => $site_slogan));
##Registreeri prefilter
if (!empty($template->all[smarty_prefilter])) {
$smarty->register_prefilter('smarty_prefilter');
} else {
if (!empty($content_template->all[smarty_prefilter])) {
$smarty->register_prefilter('smarty_prefilter');
}
}
##Registreeri postfilter
if (!empty($template->all[smarty_postfilter])) {
$smarty->register_postfilter('smarty_postfilter');
} else {
if (!empty($content_template->all[smarty_postfilter])) {
$smarty->register_postfilter('smarty_postfilter');
}
}
#####################################
# load all EXTENSION CONFIGS as SAPI variable $EXTENSION_NAME, and load filters.
$pre_filters_for_page_templates = $params['on_page_templ'] ? array('page_end_html', 'editor_toolbar', 'context_menu_init', 'flowplayer') : array();
$autoload_filters = array('pre' => $pre_filters_for_page_templates, 'output' => array(), 'post' => array());
foreach (get_extensions() as $extension) {
$EXTENSION =& load_extension_config($extension);
$smarty->assign($extension['name'], $EXTENSION);
# assign to SAPI variable $extension_name
$smarty->assign(strtoupper($extension['name']), $EXTENSION);
# assign to SAPI variable $EXTENSION_NAME
// post, pre, outputfilter loading and registering
if (is_array($EXTENSION['smarty_filters'])) {
foreach ($EXTENSION['smarty_filters'] as $template_id => $filters) {
if ($template_id == 'all' || $params['on_page_templ'] && $template_id == $template->ttyyp_id || !$params['on_page_templ'] && $template_id == $content_template->ttyyp_id) {
foreach (array_keys($autoload_filters) as $filter_type) {
if (is_array($filters[$filter_type])) {
$autoload_filters[$filter_type] = array_unique(array_merge($autoload_filters[$filter_type], $filters[$filter_type]));
}
}
}
}
}
// /post, pre, outputfilter loading and registering
}
$smarty->autoload_filters = $autoload_filters;
# $smarty->autoload_filters['pre'][] = 'foobar';
//printr($smarty->autoload_filters);
# / load all EXTENSION CONFIGS as SAPI variable $EXTENSION_NAME, and load filters.
#####################################
}
示例10: smarty_function_init_albums
function smarty_function_init_albums($params, &$smarty)
{
global $site, $leht, $template, $class_path;
$content_template =& $leht->content_template;
$albumlist = array();
##############
# default values
extract($params);
if (!isset($name)) {
$name = 'albumlist';
}
if (!isset($thumbnail_type)) {
$thumbnail_type = 'first';
}
if (!isset($parent)) {
$parent = $leht->id;
}
switch ($on_create) {
case "publish":
$publish = 1;
break;
case "hide":
$publish = 0;
break;
default:
$publish = 0;
}
# for language compatibility, replace with search string existing db field name
$order = preg_replace('#\\btitle\\b#i', "pealkiri", $order);
$order = preg_replace('#\\bdate\\b#i', "aeg", $order);
$parent_id = trim($parent);
if ($parent_id) {
$alamlist = new Alamlist(array(parent => $parent_id, klass => "album", start => $start, limit => $limit, asukoht => $position, order => $order, where => $where));
# if parameter "limit" is provided then "counttotal" element is needed (shows total rows)
if (isset($limit)) {
$alamlist_count = new Alamlist(array(parent => $parent_id, klass => "album", asukoht => $position, on_counter => 1));
}
##############
# load variables
$new_button = $alamlist->get_edit_buttons(array(tyyp_idlist => "16", publish => $publish));
while ($obj = $alamlist->next()) {
$obj->buttons = $obj->get_edit_buttons(array(tyyp_idlist => "16", publish => $publish));
$obj->id =& $obj->objekt_id;
$obj->get_object_href();
//$obj->href = $site->self.'?id='.$obj->objekt_id;
$obj->class = translate_en($obj->all[klass]);
# translate it to english
$obj->is_selected = $leht->parents->on_parent($obj->objekt_id);
$obj->title = $obj->pealkiri;
$obj->date = $site->db->MySQL_ee_short($obj->all['aeg']);
$obj->datetime = $site->db->MySQL_ee($obj->all['aeg']);
$obj->fdate = substr($obj->all['aeg'], 0, strpos($obj->all['aeg'], ' '));
$obj->fdatetime = $obj->all['aeg'];
$obj->last_modified = date('Y', $obj->all['last_modified']) > 1970 ? date('d.m.Y H:i', $obj->all['last_modified']) : '';
## crap data
$obj->flast_modified = $obj->all['last_modified'];
$obj->details_link = $site->self . '?id=' . $obj->objekt_id;
$obj->details_title = $site->sys_sona(array(sona => "loe edasi", tyyp => "kujundus"));
$obj->created_user_id = $obj->all['created_user_id'];
$obj->created_user_name = $obj->all['created_user_name'];
$obj->changed_user_id = $obj->all['changed_user_id'];
$obj->changed_user_name = $obj->all['changed_user_name'];
$obj->created_time = $site->db->MySQL_ee($obj->all['created_time']);
$obj->fcreated_time = $obj->all['created_time'];
$obj->changed_time = $site->db->MySQL_ee($obj->all['changed_time']);
$obj->fchanged_time = $obj->all['changed_time'];
$obj->last_commented_time = $site->db->MySQL_ee($obj->all['last_commented_time']);
$obj->comment_count = $obj->all['comment_count'];
### custom conf parameters
$conf = new CONFIG($obj->all['ttyyp_params']);
$obj->description = $conf->get('desc');
if ($conf->get('path')) {
include_once $class_path . 'picture.inc.php';
# full relative path to the first/random thumbnail
$obj->thumbnail = $site->CONF['wwwroot'] . '/' . get_images($site->absolute_path . $conf->get('path'), $conf->get('path'), $thumbnail_type);
}
#printr($obj->all['ttyyp_params']);
$obj->thumbnail_size = $conf->get('tn_size');
# in pixels
$obj->image_size = $conf->get('pic_size');
# in pixels
$obj->folder_id = $conf->get('folder_id');
# source folder ID
$obj->folder_path = $conf->get('path');
# source folder path, eg "public/images"
### / custom conf parameters
array_push($albumlist, $obj);
}
}
##############
# assign to template variables
$count = $alamlist->rows;
$counttotal = isset($limit) ? $alamlist_count->rows : $count;
$smarty->assign(array($name => $albumlist, $name . '_newbutton' => $new_button, $name . '_counttotal' => $counttotal, $name . '_rows' => $counttotal, $name . '_count' => $count));
}
示例11: SQL
$sth = new SQL ($sql);
$site->debug->msg($sth->debug->get_msgs());
$site->debug->msg("i=".$i."; sort=".$uus_sort[$i]."; obj=".$objekt_id[$i]."; parent=".$objekt->parent_id);
# 20.03.2003 Evgeny bugfix: kui sorteering=0
if (!$uus_sort[$i]){
$viga['parent_id'] = $objekt->parent_id;
}
}
}
new Log(array(
'action' => 'update',
'objekt_id' => $objekt->objekt_id,
'message' => sprintf("%s '%s' (ID = %s) %s" , ucfirst(translate_en($objekt->all[klass])), $objekt->pealkiri(), $objekt->objekt_id, "re-sorted"),
));
if ($viga['parent_id']){
$site->debug->msg("Wrong sort parameter found! Trying to fix it...");
$sql = $site->db->prepare("SELECT objekt.objekt_id, sorteering FROM objekt
LEFT JOIN objekt_objekt on objekt.objekt_id=objekt_objekt.objekt_id
WHERE kesk=? AND parent_id=? AND sorteering='0'
ORDER BY objekt_objekt.sorteering DESC",
$args['asukoht'], $viga['parent_id']);
$sth = new SQL ($sql);
$site->debug->msg($sth->debug->get_msgs());
示例12: smarty_function_init_article
//.........这里部分代码省略.........
$alamlistSQL = new AlamlistSQL(array(parent => $obj->parent_id, klass => "artikkel", asukoht => 0, order => "objekt_objekt.sorteering ASC"));
$alamlistSQL->add_where("sorteering>'" . $obj->all['sorteering'] . "'");
$alamlist = new Alamlist(array(alamlistSQL => $alamlistSQL, start => 0, limit => 1));
#NEXT ARTICLE
$alamlistSQL2 = new AlamlistSQL(array(parent => $obj->parent_id, klass => "artikkel", asukoht => 0));
$alamlistSQL2->add_where("sorteering<'" . $obj->all['sorteering'] . "'");
$alamlist2 = new Alamlist(array(alamlistSQL => $alamlistSQL2, start => 0, limit => 1));
$prev_art = $alamlist->next();
$next_art = $alamlist2->next();
$obj->id = $obj->objekt_id;
$obj->get_object_href();
$obj->is_selected = $leht->parents->on_parent($obj->objekt_id);
$obj->title = $obj->pealkiri;
$obj->date = $site->db->MySQL_ee_short($obj->all['aeg']);
$obj->datetime = $site->db->MySQL_ee($obj->all['aeg']);
$obj->fdate = substr($obj->all['aeg'], 0, strpos($obj->all['aeg'], ' '));
$obj->fdatetime = $obj->all['aeg'];
$obj->show_headline = $obj->all['on_pealkiri'];
$obj->details_link = $site->self . '?id=' . $obj->objekt_id;
$obj->details_title = $site->sys_sona(array(sona => "loe edasi", tyyp => "kujundus"));
$obj->printgif = '<a href="' . $obj->href . '&op=print" onClick="avaprintaken(this.href, 600, 400, \'print\'); return false;" target=_blank><img src="' . $site->img_path . '/print_it.gif" border=0 width=19 height=18></a>';
$obj->printlink = $site->self . '?id=' . $obj->objekt_id . '&op=print';
# added 08.11.2002:
$obj->comment_link = $site->self . '?id=' . $obj->objekt_id . '#comm';
$obj->comment_title = $site->sys_sona(array(sona => "Kommentaarid", tyyp => "kujundus"));
$obj->add_comment_link = $site->self . '?id=' . $obj->objekt_id . '#cbox';
$obj->add_comment_title = $site->sys_sona(array(sona => "Add", tyyp => "kujundus"));
# existing already by default: $obj->comment_count
$obj->forum_allowed = $obj->all[on_foorum];
$obj->last_commented_time = $site->db->MySQL_ee($obj->all['last_commented_time']);
$obj->comment_count = $obj->all['comment_count'];
# added 21.01.2003:
$obj->author = $obj->all[author];
$obj->class = translate_en($obj->all[klass]);
# translate it to english
$obj->next_id = $next_art->objekt_id;
$obj->prev_id = $prev_art->objekt_id;
$obj->hit_count = $obj->all['count'];
##############
# load sisu
$obj->load_sisu();
if (0 && $context_start) {
$obj->lead = $context_start . $obj->lyhi->get_text() . '</editor:context>';
$obj->body = $context_start . $obj->sisu->get_text() . '</editor:context>';
} else {
$obj->lead = $obj->lyhi->get_text();
$obj->body = $obj->sisu->get_text();
}
if (!$site->in_editor && $site->CONF['use_aliases'] && $site->CONF['replace_links_with_alias']) {
$hostUrl = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $site->wwwroot . '/';
//body urls enclosed with "
preg_match_all('{<a[^>]+href="((' . str_replace('.', '\\.', $hostUrl) . '[^>]*|/[^>]*|index.php|)\\?([^>]*id=([0-9]+)[^>0-9]*))"[^>]*>.+</a>}Ui', $obj->body, $searchResults, PREG_SET_ORDER);
//body urls enclosed with '
preg_match_all("{<a[^>]+href='((" . str_replace('.', '\\.', $hostUrl) . "[^>]*|/[^>]*|index.php|)\\?([^>]*id=([0-9]+)[^>0-9]*))'[^>]*>.+</a>}Ui", $obj->body, $searchResults2, PREG_SET_ORDER);
$searchResults = array_merge($searchResults, $searchResults2);
//non-enclosed body urls
preg_match_all('{<a[^>]+href=((' . str_replace('.', '\\.', $hostUrl) . '[^>]*|/[^>]*|index.php|)\\?([^>]*id=([0-9]+)[^>\\s0-9]*))(\\s+[^>]*|)>.+</a>}Ui', $obj->body, $searchResults2, PREG_SET_ORDER);
$searchResults = array_merge($searchResults, $searchResults2);
//lead urls enclosed with "
preg_match_all('{<a[^>]+href="((' . str_replace('.', '\\.', $hostUrl) . '[^>]*|/[^>]*|index.php|)\\?([^>]*id=([0-9]+)[^>0-9]*))"[^>]*>.+</a>}Ui', $obj->lead, $searchResults2, PREG_SET_ORDER);
$searchResults = array_merge($searchResults, $searchResults2);
//lead urls enclosed with '
preg_match_all("{<a[^>]+href='((" . str_replace('.', '\\.', $hostUrl) . "[^>]*|/[^>]*|index.php|)\\?([^>]*id=([0-9]+)[^>0-9]*))'[^>]*>.+</a>}Ui", $obj->lead, $searchResults2, PREG_SET_ORDER);
$searchResults = array_merge($searchResults, $searchResults2);
//non-enclosed lead urls
preg_match_all('{<a[^>]+href=((' . str_replace('.', '\\.', $hostUrl) . '[^>]*|/[^>]*|index.php|)\\?([^>]*id=([0-9]+)[^>\\s0-9]*))(\\s+[^>]*|)>.+</a>}Ui', $obj->lead, $searchResults2, PREG_SET_ORDER);
示例13: SQL
$on_avaldatud = 0;
}
$sql = $site->db->prepare("update objekt set on_avaldatud=? where objekt_id=?", $on_avaldatud, $objekt->objekt_id);
$sth = new SQL($sql);
$site->debug->msg($sth->debug->get_msgs());
# Run mailinglists after each publishing
if ($site->CONF['maillist_sending_after_publishing'] && $site->fdat['op'] == "publish") {
require_once $class_path . "auto.inc.php";
auto_maillist(0, 0);
}
# ------------------------
# Kustutame chache-ist
# ------------------------
clear_cache("ALL");
if (!$site->on_debug) {
$url = preg_replace("!\r|\n.*!s", "", (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $site->CONF[hostname] . $site->fdat[url]);
header("Location: " . $url);
}
new Log(array('action' => $on_avaldatud ? 'publish' : 'hide', 'type' => 'WARNING', 'objekt_id' => $objekt->objekt_id, 'message' => sprintf("%s '%s' (ID = %s) %s", ucfirst(translate_en($objekt->all[klass])), $objekt->pealkiri(), $objekt->objekt_id, $on_avaldatud ? "published" : "hidden")));
} else {
?>
Wrong ID
<?php
}
if ($site->user) {
$site->user->debug->print_msg();
}
if ($site->guest) {
$site->guest->debug->print_msg();
}
$site->debug->print_msg();
示例14: smarty_function_init_subjects
function smarty_function_init_subjects($params, &$smarty)
{
global $site, $leht, $template;
$content_template =& $leht->content_template;
$subjects = array();
##############
# default values
extract($params);
if (!isset($parent)) {
$parent_id = $leht->id;
} else {
$parent_id = $parent;
}
if (!isset($name)) {
$name = "subject";
}
switch ($on_create) {
case "publish":
$publish = 1;
break;
case "hide":
$publish = 0;
break;
default:
$publish = 0;
}
##################
# find template id by parameter subjectdetail_tpl (= template name)
$sth = new SQL("SELECT ttyyp_id FROM templ_tyyp WHERE nimi = '" . $subjectdetail_tpl . "' AND ttyyp_id >= '1000' LIMIT 1");
$subjectdetail_tpl_id = $sth->fetchsingle();
# if dynamical template not found, use fixed template 1
if (!$subjectdetail_tpl_id) {
$subjectdetail_tpl_id = 1;
# default, templ1.php
}
##############
# alamlist
$alamlist = new Alamlist(array(parent => $parent_id, klass => "teema", start => $start, limit => $limit));
##############
# load variables
$new_button = $alamlist->get_edit_buttons(array(tyyp_idlist => 15, publish => $publish));
while ($obj = $alamlist->next()) {
$obj->id = $obj->objekt_id;
$obj->detail_href = $site->self . '?' . (isset($content_template) ? 'c_tpl' : 'tpl') . '=' . $subjectdetail_tpl_id . '&id=' . $obj->objekt_id;
$obj->title = $obj->pealkiri;
$obj->buttons = $obj->get_edit_buttons(array(tyyp_idlist => 15, publish => $publish));
$alamlist_count = new Alamlist(array(parent => $obj->objekt_id, klass => "kommentaar", asukoht => 0, on_counter => 1));
$obj->message_count = $alamlist_count->rows;
$obj->started = $site->db->MySQL_ee_short($obj->all[aeg]);
$alamlist2 = new Alamlist(array(parent => $obj->objekt_id, klass => "kommentaar", asukoht => 0, start => 0, limit => 1));
$last = $alamlist2->next();
$obj->last_message = $last ? $site->db->MySQL_ee_short($last->all[aeg]) : " ";
$obj->last_modified = date('Y', $obj->all['last_modified']) > 1970 ? date('d.m.Y H:i', $obj->all['last_modified']) : '';
## crap data
$obj->flast_modified = $obj->all['last_modified'];
$obj->class = translate_en($obj->all[klass]);
# translate it to english
$obj->created_user_id = $obj->all['created_user_id'];
$obj->created_user_name = $obj->all['created_user_name'];
$obj->changed_user_id = $obj->all['changed_user_id'];
$obj->changed_user_name = $obj->all['changed_user_name'];
$obj->created_time = $site->db->MySQL_ee($obj->all['created_time']);
$obj->fcreated_time = $obj->all['created_time'];
$obj->changed_time = $site->db->MySQL_ee($obj->all['changed_time']);
$obj->fchanged_time = $obj->all['changed_time'];
$obj->last_commented_time = $site->db->MySQL_ee($obj->all['last_commented_time']);
$obj->comment_count = $obj->all['comment_count'];
array_push($subjects, $obj);
}
$count = sizeof($subjects);
##############
# assign to template variables
$smarty->assign(array($name => $subjects, $name . '_newbutton' => $new_button, $name . '_count' => $count));
}
示例15: smarty_function_init_documents
function smarty_function_init_documents($params, &$smarty)
{
global $site, $leht, $template;
$content_template =& $leht->content_template;
$documents = array();
$parent_ary = array();
##############
# default values
extract($params);
if (!isset($parent)) {
$parent = $leht->id;
}
if (!isset($name)) {
$name = "documents";
}
# for language compatibility, replace with search string existing db field name
$order = preg_replace('#\\btitle\\b#i', "pealkiri", $order);
$order = preg_replace('#\\bdate\\b#i', "aeg", $order);
switch ($on_create) {
case "publish":
$publish = 1;
break;
case "hide":
$publish = 0;
break;
default:
$publish = 0;
}
$parent_id = trim($parent);
if ($parent_id) {
##############
# alamlist
$alamlistSQL = new AlamlistSQL(array(parent => $parent_id, klass => "dokument", asukoht => $position, order => $order, where => $where));
$alamlistSQL->add_select(" obj_dokument.tyyp, obj_dokument.mime_tyyp, obj_dokument.fail, obj_dokument.kirjeldus, obj_dokument.autor, obj_dokument.size, obj_dokument.download_type");
$alamlistSQL->add_from("LEFT JOIN obj_dokument ON objekt.objekt_id=obj_dokument.objekt_id");
$alamlist = new Alamlist(array(alamlistSQL => $alamlistSQL, start => $start, limit => $limit));
# $alamlist->debug->print_msg();
# $alamlist->sql->debug->print_msg();
# if parameter "limit" is provided then "counttotal" element is needed (shows total rows)
if (isset($limit)) {
$alamlist_count = new Alamlist(array(alamlistSQL => $alamlistSQL, on_counter => 1));
}
##############
# load variables
$new_button = $alamlist->get_edit_buttons(array(tyyp_idlist => 7, publish => $publish));
while ($obj = $alamlist->next()) {
$obj->buttons = $obj->get_edit_buttons(array(tyyp_idlist => 7, asukoht => $position, publish => $publish));
$obj->id = $obj->objekt_id;
$obj->href = $site->self . '?id=' . $obj->objekt_id;
$obj->is_selected = $leht->parents->on_parent($obj->objekt_id);
$obj->title = $obj->pealkiri;
$obj->date = $site->db->MySQL_ee_short($obj->all['aeg']);
$obj->datetime = $site->db->MySQL_ee($obj->all['aeg']);
$obj->fdate = substr($obj->all['aeg'], 0, strpos($obj->all['aeg'], ' '));
$obj->fdatetime = $obj->all['aeg'];
$obj->last_modified = date('Y', $obj->all['last_modified']) > 1970 ? date('d.m.Y H:i', $obj->all['last_modified']) : '';
## crap data
$obj->flast_modified = $obj->all['last_modified'];
$obj->file = $obj->filename = $obj->all['fail'];
$obj->description = $obj->all['kirjeldus'];
$obj->size = $obj->all['size'];
$obj->type = $obj->all['tyyp'];
$obj->mime_type = $obj->all['mime_tyyp'];
$obj->size_formated = print_filesize($obj->all['size']);
$obj->author = $obj->all['author'] ? $obj->all['author'] : $obj->all['autor'];
$obj->details_link = $site->self . '?id=' . $obj->objekt_id;
$obj->download_link = $site->wwwroot . '/doc.php?' . $obj->objekt_id;
$obj->class = translate_en($obj->all[klass]);
# translate it to english
$obj->created_user_id = $obj->all['created_user_id'];
$obj->created_user_name = $obj->all['created_user_name'];
$obj->changed_user_id = $obj->all['changed_user_id'];
$obj->changed_user_name = $obj->all['changed_user_name'];
$obj->created_time = $site->db->MySQL_ee($obj->all['created_time']);
$obj->fcreated_time = $obj->all['created_time'];
$obj->changed_time = $site->db->MySQL_ee($obj->all['changed_time']);
$obj->fchanged_time = $obj->all['changed_time'];
$obj->last_commented_time = $site->db->MySQL_ee($obj->all['last_commented_time']);
$obj->comment_count = $obj->all['comment_count'];
array_push($documents, $obj);
}
}
# / loop over all parent id
#######################
##################
# fix objects order, if more than 1 parent_id was given
# because database sort is not enough for this case
if (sizeof($parent_ary) > 1) {
list($order_field, $order_sort) = split(" ", $order);
# exception for dates: for array sort rename db field date:
$order_field = str_replace("aeg", "fdate", $order_field);
# sort objects by required field
if (trim($order_field)) {
$documents = casort($documents, $order_field);
}
# if sortorder is 'desc', then reverse array
if (strtolower(trim($order_sort)) == 'desc') {
$documents = array_reverse($documents);
}
}
//.........这里部分代码省略.........