function smarty_function_sync_folder($params, &$smarty) { global $site, $leht, $class_path; ############## # default values extract($params); //if(!isset($name)) { $name = 'folder'; } //eelista id'd if (isset($id)) { $id = (int) $id; $objekt = new Objekt(array('objekt_id' => $id)); //printr($objekt->all); //kui on album if ($objekt->all['tyyp_id'] == 16) { $conf = new CONFIG($objekt->all['ttyyp_params']); if ($folder_path = $conf->get('path')) { $folder_path = preg_replace('#^/#', '', $folder_path); $folder_path = preg_replace('#/$#', '', $folder_path); $folder_abs_path = $site->absolute_path . $folder_path; $sql = $site->db->prepare('select objekt_id from obj_folder where relative_path = ?', '/' . $folder_path); $result = new SQL($sql); if ($result->rows) { $id = $result->fetchsingle(); include_once $class_path . 'picture.inc.php'; generate_images($folder_abs_path, $conf->get('tn_size'), $conf->get('pic_size')); } else { //no such folder return; } } else { //no image folder set return; } } elseif ($objekt->all['tyyp_id'] != 22) { return; } } elseif (isset($path)) { $path = (string) $path; $path = preg_replace('#^/#', '', $path); $path = preg_replace('#/$#', '', $path); $sql = $site->db->prepare('select objekt_id from obj_folder where relative_path = ?', $path); $result = new SQL($sql); if ($result->rows) { $id = $result->fetchsingle(); } else { //no such folder return; } } include_once $class_path . 'adminpage.inc.php'; synchronise_folder($id); }
/** * 路由函数 * */ private function route() { //加载控制器配置文件 $ctrl_conf = CONFIG::get('controller'); //处理uri信息, tmp[1]为路由字符串 $tmp = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/index/index'; if ($ctrl_conf['CATCH_ALL']) { //如果定义了全局拦截器,则自动导向到配置的路由。系统维护时使用。 $tmp = $ctrl_conf['CATCH_ALL']; } if (isset($_GET['r'])) { $tmp = $_GET['r']; } if (isset($tmp)) { $tmp = explode('/', trim($tmp, '/'), 3); } else { $tmp = ''; } //设置属性mod和action, 没有指定时定义为配置文件中的默认值。 $this->_mod = isset($tmp[0]) && $tmp[0] != '' ? $tmp[0] : $ctrl_conf['DEFAULT_MOD']; $this->_action = isset($tmp[1]) ? $tmp[1] : $ctrl_conf['DEFAULT_ACTION']; //定义需要调用的action类文件 $this->_file_path = PROJECT_ROOT . 'action/' . $this->_mod . '.class.php'; //如果存在更多GET参数,则调用set_args函数 $this->set_args(explode('/', trim(isset($tmp[2]) ? $tmp[2] : '', '/'))); }
private static function gen_key($str) { if (self::$config == null) { self::$config = CONFIG::get('cache'); } return md5($str . self::$config['seed']); }
public static function read() { $filename = CONFIG::get('DATAPATH') . self::$filename; if (!file_exists($filename)) { return null; } $serialized = file_get_contents(CONFIG::get('DATAPATH') . self::$filename); $data = unserialize($serialized); return $data; }
private static function init() { if (self::$instance === null) { self::$config = CONFIG::get('mongo'); try { self::$instance = new Mongo(self::$config['host'] . ':' . self::$config['port']); } catch (Exception $e) { } } return self::$instance; }
/** * This source file is is part of Saurus CMS content management software. * It is licensed under MPL 1.1 (http://www.opensource.org/licenses/mozilla1.1.php). * Copyright (C) 2000-2010 Saurused Ltd (http://www.saurus.info/). * Redistribution of this file must retain the above copyright notice. * * Please note that the original authors never thought this would turn out * such a great piece of software when the work started using Perl in year 2000. * Due to organic growth, you may find parts of the software being * a bit (well maybe more than a bit) old fashioned and here's where you can help. * Good luck and keep your open source minds open! * * @package SaurusCMS * @copyright 2000-2010 Saurused Ltd (http://www.saurus.info/) * @license Mozilla Public License 1.1 (http://www.opensource.org/licenses/mozilla1.1.php) * */ function edit_objekt () { global $site; global $objekt; $conf = new CONFIG($objekt->all[ttyyp_params]); $email = $conf->get("email"); ?> <tr> <td nowrap><?=$site->sys_sona(array(sona => "Email", tyyp=>"kasutaja"))?>:</td> <td width="100%"><input name="email" class="scms_flex_input" value="<?=$email?>"></td> </tr> <? }
public static function init() { $conf = CONFIG::get('i18n'); self::$_dic_path = $conf['dic_path']; self::$_support_list = explode(',', trim($conf['support_list'], ',')); self::$_lang = self::_check_lang(); if (is_file(self::$_dic_path . self::$_lang . '.dic.php')) { self::$_dic = (include self::$_dic_path . self::$_lang . '.dic.php'); } else { if (is_dir(self::$_dic_path)) { //新建字典 copy(FYSCU_ROOT . 'dic/tpl.dic.php', self::$_dic_path . self::$_lang . '.dic.php'); } else { //新建目录 FYTOOL::r_copy(FYSCU_ROOT . 'core/modules/i18n/dic/', self::$_dic_path); copy(FYSCU_ROOT . 'dic/tpl.dic.php', self::$_dic_path . self::$_lang . '.dic.php'); } } }
function check_login_standard() { global $current_user, $current_user_acl, $url_string; try { $cookie = new Cookie(); $cookie->validate(); $userT = new User($db); $current_user = $userT->get_user($cookie->userauth()); $current_user_acl = $current_user->getACL(); session_id($cookie->session_id()); session_start(); } catch (Exception $e) { if (!($e instanceof Exception_Cookie || $e instanceof Exception_User)) { throw $e; } $q = hash2params(array('originating_uri' => $url_string)); header('Location: ' . CONFIG::get('APPURL') . 'app/c/login.php?' . $q); exit; } }
/** * 初始化 */ private static function init() { if (!self::$pdo instanceof PDO) { self::$db_conf = CONFIG::get('db'); foreach (self::$db_conf['conn'] as $k => $v) { if ($v['auto'] == 0) { continue; } try { self::$conn_pool[$k] = new pdo($v['dsn'], $v['user'], $v['password']); self::$conn_pool[$k]->query("set names " . $v['charset']); } catch (Exception $e) { continue; } } if (count(self::$conn_pool) > 0) { self::$pdo = current(self::$conn_pool); } } }
public function action_index() { $is_dev = $_SERVER['REMOTE_ADDR'] == '127.0.0.1' || $_SERVER['REMOTE_ADDR'] == '::1' ? 1 : 0; $config = CONFIG::get('system'); $this->insertJS('jquery'); $this->insertJS('jquery'); $this->insertJS('jquery'); $this->insertJS('application'); $this->insertCSS('site'); $this->render('fyscu', array('is_dev' => $is_dev, 'version' => $config)); // $ct = CACHE::get($this->get_route());//路由信息作为缓存KEY // if(!$ct){ // //如果获取缓存失败,就渲染页面 // $ct = $this->render('fyscu',array('is_dev'=>$is_dev,'version'=>$config),true); // //然后将新渲染的内容存入缓存 // CACHE::set($this->get_route(),$ct); // } // //然后,将内容输出 (如果有缓存 就是直接输出缓存的内容,不用重新渲染) // echo $ct; // //输出用时 // FYTOOL::END_TIME(); }
<?php $prefix = CONFIG::get('ABSPATH') . '/src/controllers'; $controller_init = "{$prefix}/{$controller}/init.php"; if (file_exists($controller_init)) { include $controller_init; } $action_code = "{$prefix}/{$controller}/a_{$action}.php"; if (file_exists($action_code)) { include $action_code; }
$conf->put('folder_id', $folder_id); $conf->put('path', $album_folder_path); $sql = $site->db->prepare("UPDATE objekt SET ttyyp_params = ? WHERE objekt_id=?", $conf->Export(), $album['objekt_id']); new SQL($sql); } else { echo '<font color=red>Error: could not create folder: ' . $album_folder_path . ', check filesystem permissions.</font>'; exit; } } } // export documents from database to public/documents $sql = 'select objekt_id, pealkiri, friendly_url, ttyyp_params from objekt where ttyyp_id = 11'; $result = new SQL($sql); while ($document = $result->fetch('ASSOC')) { $conf = new CONFIG($document['ttyyp_params']); if (!$conf->get('path')) { // v3 db based gallery, export it $document_folder_path = $clean_path = $document['friendly_url'] ? $document['friendly_url'] : create_alias_from_string($document['pealkiri']); $supplement = 2; // unlikely to happen if ($document_folder_path === '') { $document_folder_path = $clean_path = rand(10000, 20000); } while (file_exists($site->absolute_path . 'public/documents/' . $document_folder_path)) { $document_folder_path = create_alias_from_string($clean_path . '-' . $supplement); $supplement++; // guard, also unlikely if ($supplement > 1000) { exit; } }
<?php date_default_timezone_set('Europe/Madrid'); require_once CONFIG::get('ABSPATH') . '/src/shared/i18n.php'; // require_once CONFIG::get('ABSPATH') . '/src/shared/login.php'; global $errors, $display, $url_string; $errors = array(); $display = array(); // mixed functions require_once CONFIG::get('ABSPATH') . '/src/shared/functions.php'; // global exception handler //set_exception_handler( 'global_exception_handler' ); if (!(isset($url_string) && '' != $url_string)) { $url_string = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; }
function print_kast($kast, $is_custom = 0, $archive_link_on = 1) { #Muutujad mis hoiab custom stringid $custom_buttons = ''; $custom_title = ''; $custom_contents = ''; if (get_class($kast) == "Objekt" || is_subclass_of($kast, "Objekt")) { # ---------------------------- # Uudiste kogumik # ---------------------------- if ($kast->all[klass] == "kogumik") { $kast->load_sisu(); if (!$is_custom) { ?> <table width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> " border="0" cellspacing="0" cellpadding="1"> <tr> <td width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> " class="boxhead" height="24"> <?php echo $kast->pealkiri(); $kast->edit_buttons(array(tyyp_idlist => "8,2,6,9,13,17")); ?> </td> </tr> <tr> <td width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> " bgcolor="<?php echo $kast->site->dbstyle("menyy_border", "color") ? $kast->site->dbstyle("menyy_border", "color") : "#CCCCCC"; ?> "> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="<?php echo $kast->site->dbstyle("menyy_taust", "color") ? $kast->site->dbstyle("menyy_taust", "color") : "#FAFAFA"; ?> "> <tr> <td align="right" valign="top"><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="20" height="10"></td> <td><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="<?php echo $kast->site->dbstyle("menyy_laius", "layout") - 42; ?> " height="10"></td> <td><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="20" height="10"></td> </tr> <?php } else { //Custom print out ob_start(); $kast->edit_buttons(array(tyyp_idlist => "8,2,6,9,13,17")); $custom_buttons .= ob_get_contents(); ob_end_clean(); $custom_title .= $kast->pealkiri(); $custom_contents .= "<ul class=\"boxlist\">"; } //if is_custom # rubriigid kus uudised otsida $sql = "SELECT objekt.objekt_id FROM objekt LEFT JOIN objekt_objekt ON objekt_objekt.objekt_id=objekt.objekt_id WHERE objekt_objekt.parent_id=" . $kast->objekt_id . " AND (objekt.kesk = 0 or objekt.kesk = 5 or objekt.kesk = 9) AND objekt.tyyp_id=1"; ####### POOLELI if (!$kast->site->in_editor) { $sql .= " AND objekt.on_avaldatud=1"; } if (!$kast->site->in_editor) { $sql .= " AND !FIND_IN_SET(objekt.objekt_id, '" . join(",", $kast->site->noaccess_hash) . "')"; } $sth = new SQL($sql); while ($rid = $sth->fetchsingle()) { $news_rubrics .= "," . $rid; } $kast->debug->msg($sth->debug->get_msgs()); $kast->debug->msg("Rubriigid: {$news_rubrics}"); $sql = "\r\n\t\t\t\t\t\t\tSELECT objekt.objekt_id, objekt.pealkiri, objekt.aeg, objekt.on_avaldatud, objekt_objekt.parent_id \r\n\t\t\t\t\t\t\tFROM objekt \r\n\t\t\t\t\t\t\tLEFT JOIN objekt_objekt ON objekt_objekt.objekt_id=objekt.objekt_id \r\n\t\t\t\t\t\t\tWHERE find_in_set(objekt_objekt.parent_id,'{$news_rubrics}') AND (objekt.kesk=0 OR objekt.kesk=6) AND (objekt.tyyp_id=2 OR objekt.tyyp_id=15)"; if (!$kast->site->in_editor) { $sql .= " AND objekt.on_avaldatud=1 "; } $sql .= " ORDER BY objekt.aeg DESC, objekt_objekt.sorteering DESC limit 0," . ($kast->all[art_arv] ? $kast->all[art_arv] : 5); $kast->debug->msg($sth->debug->get_msgs()); $sth = new SQL($sql); $kast->debug->msg("Leitud " . $sth->rows . " alamobjekte"); $esimene = 1; while ($ary = $sth->fetch()) { $kast->debug->msg("Objekt leitud: {$ary['objekt_id']}. " . $ary[pealkiri]); $obj = new Objekt(array(ary => $ary)); if (!$is_custom) { if (!$esimene) { # eraldaja ?> <tr valign="top"> <td align="right" valign="top"><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="20" height="10"></td> <td background="<?php echo $kast->site->img_path; ?> /stripe1.gif"><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="1" height="10"></td> <td><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="20" height="10"></td> </tr> <?php } if ($obj->site->in_editor) { ?> <!--tr valign="top"> <td colspan="3" align=left> </td> </tr--> <?php } # if in_editor ?> <tr valign="top"> <td align="right" valign="top"><img src="<?php echo $kast->site->img_path; ?> /nupp1.gif" width="10" height="10" align="texttop"></td> <td><a href="<?php echo $kast->site->self; ?> ?id=<?php echo $obj->objekt_id; ?> " class="navi2_on"><?php echo $obj->pealkiri(); ?> </a><?php echo $kast->all[on_kp_nahtav] ? "<br><font class=txt><font class=date>" . $obj->aeg() . "</font></font>" : ""; $obj->edit_buttons(array(tyyp_idlist => 3, only_edit => 1)); ?> </td> <td><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="20" height="10"></td> </tr> <?php $esimene = 0; } else { //Custom print out if ($obj->site->in_editor) { ob_start(); $obj->edit_buttons(array(tyyp_idlist => 3, only_edit => 1)); $custom_contents .= ob_get_contents(); ob_end_clean(); } if ($kast->all[on_kp_nahtav]) { $cu_date = ' <font class=date>' . $obj->aeg() . ' </font>'; } else { $cu_date = ''; } $custom_contents .= '<li class="list"><a href="' . $kast->site->self . '?id=' . $obj->objekt_id . '" class="navi2_on">' . $obj->pealkiri() . $cu_date . '</a>' . '</li>' . ($obj->site->in_editor ? "<br clear=all>" : ""); } //if is_custom } # while if (!$is_custom) { ?> <tr> <td colspan="3"><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="1" height="10"></td> </tr> </table> </td> </tr> </table> <br> <?php } else { $custom_contents .= "</ul>"; } //if is_custom } else { if ($kast->all[klass] == "rubriik") { # ---------------------------- # Lingide kast # ---------------------------- if (!$is_custom) { ?> <table width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> " border="0" cellspacing="0" cellpadding="1"> <tr> <td width="100%" class="boxhead" height="24"> <?php echo $kast->pealkiri(); $kast->edit_buttons(array(tyyp_idlist => "8,2,6,9,13,17")); ?> </td> </tr> <tr> <td width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> " bgcolor="<?php echo $kast->site->dbstyle("menyy_border", "color") ? $kast->site->dbstyle("menyy_border", "color") : "#CCCCCC"; ?> "> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="<?php echo $kast->site->dbstyle("menyy_taust", "color") ? $kast->site->dbstyle("menyy_taust", "color") : "#FAFAFA"; ?> "> <tr> <td align="right" valign="top"><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="20" height="10"></td> <td><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="<?php echo $kast->site->dbstyle("menyy_laius", "layout") - 52; ?> " height="10" border=0></td> <td><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="20" height="10"></td> </tr> <?php } else { //Custom print out $custom_contents .= '<div class="linkbox">'; ob_start(); $kast->edit_buttons(array(tyyp_idlist => "8,2,6,9,13,17")); $custom_buttons .= ob_get_contents(); ob_end_clean(); $custom_title .= $kast->pealkiri(); } //if is_custom $lingi_alamlist = new Alamlist(array(parent => $kast->objekt_id, klass => "link", asukoht => $kast->all[kesk])); $esimene = 1; while ($viit = $lingi_alamlist->next()) { if (!$is_custom) { if (!$esimene) { # eraldaja ?> <tr valign="top"> <td align="right" valign="top"><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="20" height="10"></td> <td background="<?php echo $kast->site->img_path; ?> /stripe1.gif"><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="1" height="10"></td> <td><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="20" height="10"></td> </tr> <?php } # if !esimene $viit->load_sisu(); if ($viit->site->in_editor) { ?> <!--tr valign="top"> <td colspan="3" align=left> </td> </tr--> <?php } # if in_editor ?> <tr valign="top"> <td align="right" valign="top"><img src="<?php echo $kast->site->img_path; ?> /nupp1.gif" width="10" height="10" align="texttop"></td> <td><a href="<?php echo $viit->all[url]; ?> " target="<?php echo $viit->all[on_uusaken] ? "_blank" : "_self"; ?> " class="navi2_on"><?php echo $viit->pealkiri(); ?> </a><?php $viit->edit_buttons(array(tyyp_idlist => 3)); ?> </td> <td><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="20" height="10"></td> </tr> <?php $esimene = 0; } else { //Custom print out $viit->load_sisu(); if ($viit->site->in_editor) { ob_start(); $viit->edit_buttons(array(tyyp_idlist => 3)); $custom_contents .= ob_get_contents(); ob_end_clean(); } $custom_contents .= '<a href="' . $viit->all[url] . '" target="' . ($viit->all[on_uusaken] ? "_blank" : "_self") . '" class="navi2_on">' . $viit->pealkiri() . '</a><br>'; } //if is_custom } # while next() if (!$is_custom) { if ($lingi_alamlist->size == 0) { ?> <tr> <td colspan="3"> <?php $lingi_alamlist->edit_buttons(array(tyyp_idlist => 3)); ?> </td> </tr> <?php } ?> <tr> <td colspan="3"><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="1" height="10"></td> </tr> </table> </td> </tr> </table> <br> <?php } else { //Custom print out if ($lingi_alamlist->size == 0) { ob_start(); $lingi_alamlist->edit_buttons(array(tyyp_idlist => 3)); $custom_contents .= ob_get_contents(); ob_end_clean(); } $custom_contents .= '</div>'; } //if is_custom } else { if ($kast->all[klass] == "loginkast") { # ---------------------------- # Login kast # ---------------------------- if ($kast->all[on_pealkiri] || $kast->site->in_editor) { if (!$is_custom) { ?> <table width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> " border="0" cellspacing="0" cellpadding="1"> <form action="<?php echo $kast->site->self; ?> " method=post> <tr> <td width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> " class="boxhead" height="24"> <?php echo $kast->site->user->user_id ? $kast->site->sys_sona(array(sona => "tere", tyyp => "kasutaja")) . " " . $kast->site->user->all['username'] : $kast->pealkiri(); $kast->edit_buttons(array(tyyp_idlist => "8,2,6,9,13,17")); ?> </td> </tr> <tr> <td width="100%" bgcolor="<?php echo $kast->site->dbstyle("menyy_border", "color") ? $kast->site->dbstyle("menyy_border", "color") : "#CCCCCC"; ?> "> <table width="100%" border="0" cellspacing="0" cellpadding="11" bgcolor="<?php echo $kast->site->dbstyle("menyy_taust", "color") ? $kast->site->dbstyle("menyy_taust", "color") : "#FAFAFA"; ?> "> <tr> <td width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> "> <?php } else { //Custom print out $custom_contents .= '<div class="loginbox">'; ob_start(); $kast->edit_buttons(array(tyyp_idlist => "8,2,6,9,13,17")); $custom_buttons .= ob_get_contents(); ob_end_clean(); $custom_title .= $kast->site->user->user_id ? $kast->site->sys_sona(array(sona => "tere", tyyp => "kasutaja")) . " " . $kast->site->user->all['username'] : $kast->pealkiri(); } //if is_custom } # pealkiri if ($is_custom) { ob_start(); } //if is_custom ?> <font class=<?php echo $kast->site->agent ? "txt" : "txt1"; ?> > <?php # kasutaja login form # vüi tema andmed ja lingid if ($kast->site->user->user_id) { ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr valign="top"> <td align="right"><img src="<?php echo $kast->site->img_path; ?> /nupp1.gif" width="10" height="10" align="texttop"></td> <td colspan=2><a href="<?php echo $kast->site->self; ?> ?id=<?php echo $kast->objekt_id; ?> &op=register" class="navi2_on"><?php echo $kast->site->sys_sona(array(sona => "Muuda oma andmeid", tyyp => "kasutaja")); ?> </a></td> </tr> <tr valign="top"> <td align="right"><img src="<?php echo $kast->site->img_path; ?> /nupp1.gif" width="10" height="10" align="texttop"></td> <td colspan=2><a href="<?php echo $kast->site->self; ?> ?id=<?php echo $kast->objekt_id; ?> &op=logout&url=<?php echo $kast->site->safeURI; ?> " class="navi2_on"><?php echo $kast->site->sys_sona(array(sona => "Logi valja", tyyp => "kasutaja")); ?> </a></td> </tr> </table> <?php } else { # ---------------- # login kast # ---------------- ?> <form action="<?php echo $kast->site->self; ?> " method=post> <input type=hidden name="op" value="login"> <input type=hidden name="url" value="<?php echo $kast->site->safeURI; ?> "> <input type=hidden name="id" value="<?php echo $kast->objekt_id; ?> "> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="1%"><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="13" height="1"></td> <td><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="1" height="1"></td> <td><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="62" height="1"></td> </tr> <tr> <td colspan=2 align="right"><font class=txt1><?php echo $kast->site->sys_sona(array(sona => "Login", tyyp => "kasutaja")); ?> : </font></td> <td> <input type=text class=searchbox size=3 name=user style="width:60"> </td> </tr> <tr> <td colspan=2 align="right" width="1%"><font class=txt1><?php echo $kast->site->sys_sona(array(sona => "Password", tyyp => "kasutaja")); ?> : </font></td> <td> <input type=password class=searchbox size=3 name=pass style="width:60"> </td> </tr> <tr> <td colspan=3 align=center height="34"> <INPUT class=searchbtn type=submit value="<?php echo $kast->site->sys_sona(array(sona => "nupp login", tyyp => "kasutaja")); ?> "> </td> </tr> <?php if ($kast->site->CONF['allow_forgot_password']) { ?> <tr valign="top"> <td align="right"><img src="<?php echo $kast->site->img_path; ?> /nupp1.gif" width="10" height="10" align="texttop"></td> <td colspan=2><a href="<?php echo $kast->site->self; ?> ?id=<?php echo $kast->objekt_id; ?> &op=remindpass" class="navi2_on"><?php echo $kast->site->sys_sona(array(sona => "Unustasid parooli", tyyp => "kasutaja")); ?> </a></td> </tr> <?php } if ($kast->site->CONF[users_can_register] == 1) { ?> <tr valign="top"> <td align="right"><img src="<?php echo $kast->site->img_path; ?> /nupp1.gif" width="10" height="10" align="texttop"></td> <td colspan=2><a href="<?php echo $kast->site->self; ?> ?id=<?php echo $kast->objekt_id; ?> &op=register" class="navi2_on"><?php echo $kast->site->sys_sona(array(sona => "Registeeru", tyyp => "kasutaja")); ?> </a></td> </tr> <?php } ?> </table> </form> <?php } # $kast->print_text(); ?> </font> <?php if ($is_custom) { $custom_contents .= ob_get_contents(); ob_end_clean(); $custom_contents .= '</div>'; } //if is_custom if ($kast->all[on_pealkiri] || $kast->site->in_editor) { if (!$is_custom) { ?> </td> </tr> </table> </td> </tr> </form> </table> <br> <?php } //if is_custom } else { if (!$is_custom) { echo "<br>"; } //if is_custom } } else { if ($kast->all[klass] == "artikkel") { # ---------------------------- # Artikkel kastis # ---------------------------- if ($kast->all[on_pealkiri] || $kast->site->in_editor) { if (!$is_custom) { ?> <table width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> " border="0" cellspacing="0" cellpadding="1"> <tr> <td width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> " class="boxhead" height="24"> <?php echo $kast->pealkiri(); $kast->edit_buttons(array(tyyp_idlist => "8,2,6,9,13,17")); ?> </td> </tr> <tr> <td width="100%" bgcolor="<?php echo $kast->site->dbstyle("menyy_border", "color") ? $kast->site->dbstyle("menyy_border", "color") : "#CCCCCC"; ?> "> <table width="100%" border="0" cellspacing="0" cellpadding="11" bgcolor="<?php echo $kast->site->dbstyle("menyy_taust", "color") ? $kast->site->dbstyle("menyy_taust", "color") : "#FAFAFA"; ?> "> <tr> <td width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> "> <?php } else { //Custom print out $custom_contents .= '<div class="articlebox">'; ob_start(); $kast->edit_buttons(array(tyyp_idlist => "8,2,6,9,13,17")); $custom_buttons .= ob_get_contents(); ob_end_clean(); $custom_title .= $kast->pealkiri(); } //if is_custom } # pealkiri if (!$is_custom) { ?> <font class=<?php echo $kast->site->agent ? "txt" : "txt1"; ?> > <?php $kast->print_text(); ?> </font> <?php if ($kast->all[on_pealkiri] || $kast->site->in_editor) { ?> </td> </tr> </table> </td> </tr> </table> <br> <?php } else { echo "<br>"; } } else { //Custom print out ob_start(); echo "<font class=" . ($kast->site->agent ? "txt" : "txt1") . ">" . $kast->print_text() . "</font>"; $custom_contents .= ob_get_contents(); ob_end_clean(); $custom_contents .= '</div>'; } //if is_custom ############## GALLUP } else { if ($kast->all[klass] == "gallup") { $kast->load_sisu(); ######### HEADER ##### 1) default html if (!$is_custom) { ?> <table width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> " border="0" cellspacing="0" cellpadding="1"> <tr> <td width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> " class="boxhead" height="24"> <?php echo $kast->site->sys_sona(array(sona => 'Gallup', tyyp => "kujundus")); $kast->edit_buttons(array(tyyp_idlist => "8,2,6,9,13,17")); ?> </td> </tr> <tr> <td width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> " bgcolor="<?php echo $kast->site->dbstyle("menyy_border", "color") ? $kast->site->dbstyle("menyy_border", "color") : "#CCCCCC"; ?> "> <table width="100%" border="0" cellspacing="0" cellpadding="11" bgcolor="<?php echo $kast->site->dbstyle("menyy_taust", "color") ? $kast->site->dbstyle("menyy_taust", "color") : "#FAFAFA"; ?> "> <tr> <td width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> "><font class="<?php echo $kast->site->agent ? "txt" : "txt1"; ?> "><?php echo $kast->pealkiri(); ?> </font> <br> <table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td valign="top" colspan="2"><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="1" height="3"></td> </tr> <?php } else { $custom_contents .= '<div class="gallupbox">'; ob_start(); $kast->edit_buttons(array(tyyp_idlist => "8,2,6,9,13,17")); $custom_buttons .= ob_get_contents(); ob_end_clean(); $custom_title .= ' ' . $kast->site->sys_sona(array(sona => 'Gallup', tyyp => "kujundus")); $custom_contents .= '<font class="' . ($kast->site->agent ? "txt" : "txt1") . '">' . $kast->pealkiri() . '</font><br>'; } //if is_custom ######### / HEADER ######### CHECK voting # 1) IP-based gallup if ($kast->site->CONF[gallup_ip_check] == 1) { $sql = $kast->site->db->prepare("SELECT COUNT(gi_id) FROM gallup_ip WHERE objekt_id=? AND ip LIKE ?", $kast->objekt_id, $_SERVER["REMOTE_ADDR"]); $sth = new SQL($sql); $count = $sth->fetchsingle(); $kast->debug->msg($sth->debug->get_msgs()); } else { if ($kast->site->CONF[gallup_ip_check] == 2 && $kast->site->cookie["gallup"][$kast->objekt_id] == 1) { $count = 1; } else { if ($kast->site->CONF[gallup_ip_check] == 3) { $sql = $kast->site->db->prepare("SELECT COUNT(gi_id) FROM gallup_ip WHERE objekt_id=? AND user_id=?", $kast->objekt_id, $kast->site->user->user_id); $sth = new SQL($sql); # count=1: not logged in users are not allowed to vote: $count = $kast->site->user->user_id ? $sth->fetchsingle() : 1; $kast->debug->msg($sth->debug->get_msgs()); } else { $count = 0; } } } ######### / CHECK voting ######### GET VOTES (SUMS) $sql = $kast->site->db->prepare("SELECT * FROM gallup_vastus WHERE objekt_id=?", $kast->objekt_id); $sth = new SQL($sql); if ($is_custom) { # custom html ob_start(); print '<table width="100%" border="0" cellspacing="0" cellpadding="0">'; } //if is_custom #################### 1. SHOW FORM & radio buttons if (!$count && !$kast->site->fdat[results] && !$kast->site->in_editor) { ?> <SCRIPT LANGUAGE="JavaScript"><!-- //See script on keerulisem kui see peaks olema //kuna muidu see ei tööta IE peal function do_it(vorm) { if (vorm.java_check.value==1) { return true } else { return false } } //--></SCRIPT> <form action="<?php echo $kast->site->self; ?> " method=get> <input type=hidden name="uri" value="<?php echo $kast->site->URI; ?> "> <input type=hidden name="gallup_id" value="<?php echo $kast->objekt_id; ?> "> <input type=hidden name="op" value="vote"> <?php ####### loop over VASTUS (votes sum) while ($vastus = $sth->fetch()) { ?> <tr> <td valign="top" width="15"> <input type=radio id="vastus_<?php echo $vastus[gv_id]; ?> " name=vastus value="<?php echo $vastus[gv_id]; ?> " onclick="javascript:if(this.checked){this.form.java_check.value=1;};"> </td> <td valign="top" class="<?php echo $kast->site->agent ? "txt" : "txt1"; ?> "><label for="vastus_<?php echo $vastus[gv_id]; ?> "><?php echo $vastus[vastus]; ?> </label></td> </tr> <?php } # while vastus ?> <?php ######## submit-button ?> <tr align="right"> <input type="hidden" name="java_check" value="0"> <td valign="top" colspan="2"><input type="submit" name="haaleta" value="<?php echo $kast->site->sys_sona(array(sona => 'haaleta', tyyp => "kujundus")); ?> " onclick="javascript:return do_it(this.form);" class="searchbtn"></td> </tr> </form> </table> <?php $kast->debug->msg($sth->debug->get_msgs()); } else { $sql = $kast->site->db->prepare("SELECT SUM(count) AS kokku, MAX(count) AS maksi FROM gallup_vastus WHERE objekt_id=? ", $kast->objekt_id); $sth_c = new SQL($sql); $stat = $sth_c->fetch(); $kast->debug->msg("kokku = {$stat['kokku']}, maks = {$stat['maksi']}"); $kast->debug->msg($sth_c->debug->get_msgs()); ###### voters vount: ?> <tr> <td valign="top" class="<?php echo $kast->site->agent ? "txt" : "txt1"; ?> "><?php echo $kast->site->sys_sona(array(sona => "vastajaid", tyyp => "kujundus")); ?> : <b><?php echo $stat[kokku]; ?> </b></td> </tr> <tr> <td valign="top"><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="1" height="3"></td> </tr> <?php ###### one colored row while ($vastus = $sth->fetch()) { $percent = $stat[kokku] ? sprintf('%2.0f', 100 * $vastus[count] / $stat[kokku]) : 0; ?> <tr> <td valign="top" class="<?php echo $kast->site->agent ? "txt" : "txt1"; ?> "><?php echo $vastus[vastus]; ?> </td> </tr> <tr> <td valign="top"><b><font class="<?php echo $kast->site->agent ? "txt" : "txt1"; ?> ">- <?php echo $percent; ?> %</font></b> <img src="<?php echo $kast->site->img_path; ?> /gallup_bar<?php echo $stat[maksi] == $vastus[count] && $vastus[count] ? "2" : "1"; ?> .gif" width="<?php echo 110 * ($percent / 100); ?> " height=8 border="1"></td> </tr> <?php } # while vastus ############## archive link # added 12.12.2003 by Dima Bug #744 if ($archive_link_on) { ?> <tr> <td valign="top"><img src="<?php echo $kast->site->img_path; ?> /px.gif" width="1" height="3"></td> </tr> <tr align="right"> <td valign="top"><a href="<?php echo $kast->site->self; ?> ?op=gallup_arhiiv" class="navi2_on"><?php echo $kast->site->sys_sona(array(sona => 'Arhiiv', tyyp => "kujundus")); ?> </a></td> </tr> <?php } ?> </table> <?php } #################### / 2. SHOW RESULTS ##### 1) default html if (!$is_custom) { ?> </td> </tr> </table> </td> </tr> </table> <br> <?php } //if is_custom ##### 2) custom html if ($is_custom) { $custom_contents .= ob_get_contents(); ob_end_clean(); $custom_contents .= '</div>'; } //if is_custom } else { if ($kast->all[klass] == "iframekast") { $kast->load_sisu(); $conf = new CONFIG($kast->all[ttyyp_params]); $src_file = $conf->get("src_file"); $predefined = $conf->get("predefined"); $height = $conf->get("height"); # kui tegemist saidi sisese failiga, panna id juurde if (trim($predefined) != '') { $src_file .= "&id=" . ($kast->site->fdat[id] ? $kast->site->fdat[id] : $kast->site->alias("rub_home_id")); } if (!$is_custom) { ?> <table width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> " border="0" cellspacing="0" cellpadding="2"> <tr> <td class="boxhead" height="24"> <?php echo $kast->pealkiri(); $kast->edit_buttons(array(tyyp_idlist => "8,2,6,9,13,17")); ?> </td> </tr> <tr valign="top"> <td class=box><?php if (strlen(trim($src_file)) > 0) { ?> <iframe name="iifreim" src="<?php echo $src_file; ?> " width="<?php echo $is_custom ? "100%" : $kast->site->dbstyle("menyy_laius", "layout"); ?> " frameborder=0 height="<?php echo $height; ?> " ></iframe><?php } ?> </td> </tr> </table> <br> <?php } else { //Custom print out $custom_contents .= '<div class="iframebox">'; ob_start(); $kast->edit_buttons(array(tyyp_idlist => "8,2,6,9,13,17")); $custom_buttons .= ob_get_contents(); ob_end_clean(); $custom_title .= $kast->pealkiri(); if (strlen(trim($src_file)) > 0) { $custom_contents .= '<iframe name="iifreim" src="' . $src_file . '" width="100%" frameborder=0 height="' . $height . '" ></iframe>'; } $custom_contents .= '</div>'; } //if is_custom } } } } } } ########################################################### } else { if (get_class($kast) == "Alamlist" || is_subclass_of($kast, "Alamlist")) { # ---------------------- # kui parameetrina on alamlist, # siis teeme "uus kast" nupp # ---------------------- if (!($kast->size > 0)) { if (!$is_custom) { ?> <table width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> " border="0" cellspacing="0" cellpadding="1"> <tr> <td width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> " class="boxhead" height="24"> <?php echo $kast->site->sys_sona(array(sona => 'new', tyyp => "editor")); ?> <?php echo $kast->edit_buttons(array(tyyp_idlist => "8,2,6,9,13,17", no_br => 1)); ?> </nobr></td> </tr> <tr> <td width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> " bgcolor="<?php echo $kast->site->dbstyle("menyy_border", "color") ? $kast->site->dbstyle("menyy_border", "color") : "#CCCCCC"; ?> "> <table width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> " border="0" cellspacing="0" cellpadding="11" bgcolor="<?php echo $kast->site->dbstyle("menyy_taust", "color") ? $kast->site->dbstyle("menyy_taust", "color") : "#FAFAFA"; ?> "> <tr> <td width="<?php echo $kast->site->dbstyle("menyy_laius", "layout"); ?> "> </td> </tr> </table> </td> </tr> </table> <br> <?php } else { //Custom print out ob_start(); $kast->edit_buttons(array(tyyp_idlist => "8,2,6,9,13,17", no_br => 1)); $custom_buttons .= ob_get_contents(); ob_end_clean(); $custom_title .= $kast->site->sys_sona(array(sona => 'new', tyyp => "editor")); } //if is_custom } # if ! size > 0 } else { $GLOBALS[site]->debug->msg("print_kast() argument \"kast\" on vale"); } } #print "<br>"; return array('buttons' => $custom_buttons, 'title' => $custom_title, 'contents' => $custom_contents); }
function refresh_gallery_images(&$objekt, $dir) { global $site, $class_path; include_once $class_path . 'picture.inc.php'; // find album objects where the parent folder of the file is used $sql = "select ttyyp_params from objekt where tyyp_id = 16 and ttyyp_params like '%path = " . mysql_real_escape_string($dir) . "\n%' limit 1"; $result = new SQL($sql); while ($ttyyp_params = $result->fetchsingle()) { $conf = new CONFIG($ttyyp_params); $conf->get(''); generate_images($site->absolute_path . $conf->get('path'), $conf->get('tn_size'), $conf->get('pic_size')); } }
<?php //永远定位到 fyscu.init.php的所在目录作为起点目录 define('FYSCU_ROOT', dirname(__FILE__) . '/'); define('START_TIME', microtime(1)); //引入全局工具文件 require FYSCU_ROOT . './core/function/common.func.php'; //注册全局变量 $FY_G = array('var' => array('component' => array())); //引入配置文件定义的功能模块 if (is_array(CONFIG::get('modules'))) { include FYSCU_ROOT . './core/lib/action_base.class.php'; include FYSCU_ROOT . './core/lib/controller.class.php'; foreach (CONFIG::get('modules') as $k => $v) { //根据配置,引入相关的类文件,和相应功能文件 if ($v) { if (in_array($k, $FY_G['var']['component'])) { //do nothing } else { if (is_file(FYSCU_ROOT . './core/component/' . $k . '/' . $k . '.conf.php')) { CONFIG::add($k, include FYSCU_ROOT . './core/component/' . $k . '/' . $k . '.conf.php'); } include FYSCU_ROOT . './core/component/' . $k . '/' . $k . '.class.php'; FYTOOL::FY_set_global('component', $k); } } } } else { FYTOOL::error_ctrl('配置文件[组件配置]出错,请核对。'); } //控制器:URL路由
<?php require_once CONFIG::get('ABSPATH') . '/src/models/person.php'; require_once CONFIG::get('ABSPATH') . '/src/models/storage.php'; $display['page_title'] = 'People'; list($display['page_error'], $errors) = post_errors(); if ($display['page_error']) { d_($display['page_error']); } if ($errors) { d_($errors); } $stored_people = Storage::read() ?? []; if (count($stored_people)) { $display['stored_people'] = array_map(function ($item) { return htmlspecialchars("{$item}"); }, $stored_people); $display['people'] = array_map(function ($item) { return $item->toHash(); }, $stored_people); } else { $display['stored_people'] = []; $display['people'][] = array('firstname' => 'Jeff', 'surname' => 'Stelling'); $display['people'][] = array('firstname' => 'Chris', 'surname' => 'Kamara'); $display['people'][] = array('firstname' => 'Alex', 'surname' => 'Hammond'); $display['people'][] = array('firstname' => 'Jim', 'surname' => 'White'); $display['people'][] = array('firstname' => 'Natalie', 'surname' => 'Sawyer'); } $display['button_OK'] = merge_params($url_string, array('action' => 'save')); render(CONFIG::get('ABSPATH') . '/src/views/templates/people/list.php', CONFIG::get('ABSPATH') . '/src/views/layouts/flat.php');
private function js_compress($content, $sig = 1) { if (!$sig) { return $content; } if (empty(self::$config)) { self::$config = CONFIG::get('fytpl'); } $i = strpos($content, '{js}', 0); $j = strpos($content, '{/js}', $i + 4); $tmp = substr($content, $i + 4, $j - $i - 4); $arr = explode(';', trim($tmp)); $ct = ''; if (!$i) { return $content; } foreach ($arr as $k => $v) { $v = trim($v); if ($sig) { $ct .= file_get_contents(FYSCU_ROOT . self::$config['tpl_path'] . $v) . ' '; } else { $ct .= '<script type="text/javascript" src="/fyscu' . self::$config['tpl_path'] . $v . '"></script>'; } } if ($sig) { $file = self::$config['tpl_path'] . 'c/js_' . uniqid() . '.js'; $name = FYSCU_ROOT . $file; $path = '/fyscu' . $file; file_put_contents($name, $ct); $content = str_replace('{js}' . $tmp . '{/js}', '<script type="text/javascript" src="' . $path . '"></script>', $content); } else { $content = str_replace('{js}' . $tmp . '{/js}', $ct, $content); } return $content; }
<?php require_once dirname(__FILE__, 3) . '/src/config.php'; require_once CONFIG::get('ABSPATH') . '/src/models/person.php'; class PersonTest extends PHPUnit_Framework_TestCase { public function testAPersonObjectIsCreated() { $data = array('this' => 'is', 'a' => 'sample', 'firstname' => 'Donald', 'surname' => 'Duck'); $person = new Person($data); $this->assertEquals($person->toHash(), array('firstname' => 'Donald', 'surname' => 'Duck')); } public function testAPersonIsStrigified() { $data = array('firstname' => 'Donald', 'surname' => 'Duck'); $person = new Person($data); $this->assertEquals("{$person}", 'Donald Duck'); } }
/** * This source file is is part of Saurus CMS content management software. * It is licensed under MPL 1.1 (http://www.opensource.org/licenses/mozilla1.1.php). * Copyright (C) 2000-2010 Saurused Ltd (http://www.saurus.info/). * Redistribution of this file must retain the above copyright notice. * * Please note that the original authors never thought this would turn out * such a great piece of software when the work started using Perl in year 2000. * Due to organic growth, you may find parts of the software being * a bit (well maybe more than a bit) old fashioned and here's where you can help. * Good luck and keep your open source minds open! * * @package SaurusCMS * @copyright 2000-2010 Saurused Ltd (http://www.saurus.info/) * @license Mozilla Public License 1.1 (http://www.opensource.org/licenses/mozilla1.1.php) * */ function edit_tyyp_params() { global $site; $args = func_get_arg(0); $objekt = $args["objekt"]; $conf = new CONFIG($objekt->all[ttyyp_params]); $args[src_file] = $conf->get("src_file"); $args[predefined] = $conf->get("predefined"); $args[height] = $conf->get("height"); # ----------------------- # valmis mall # ----------------------- ?> <tr> <td nowrap><?php echo $site->sys_sona(array(sona => 'Kujundusmall', tyyp => "editor")); ?> :</td> <td width="100%"> <select name="predefined" style="width:99%" onclick="javascript:if(this.value){frmEdit.src_file.value=this.value;frmEdit.src_file.disabled=true;}else{frmEdit.src_file.value='';frmEdit.src_file.disabled=false;}"> <option value=""> <option value="external.php?extop=personal" <?php echo $args[predefined] == 'external.php?extop=personal' ? " selected" : ""; ?> ><?php echo $site->sys_sona(array(sona => 'Personal', tyyp => "system")); ?> <option value="external.php?extop=komand" <?php echo $args[predefined] == 'external.php?extop=komand' ? " selected" : ""; ?> ><?php echo $site->sys_sona(array(sona => 'Business trips', tyyp => "system")); ?> </select> </td> </tr> <?php # ----------------------- # Source file # ----------------------- ?> <tr> <td nowrap><?php echo $site->sys_sona(array(sona => 'Fail', tyyp => "editor")); ?> / URL:</td> <td width="100%"><input name="src_file" value="<?php echo $args[src_file]; ?> " class=scms_flex_input onchange="javascript:frmEdit.predefined.options.selectedIndex=0;"> </td> </tr> <?php # ----------------------- # height # ----------------------- ?> <tr> <td nowrap><?php echo $site->sys_sona(array(sona => 'Kõrgus', tyyp => "editor")); ?> :</td> <td ><input name="height" class="scms_flex_input" style="width:40px" value="<?php echo $args[height]; ?> " size=3 > </td> </tr> <?php }
function smarty_function_init_images($params, &$smarty) { if (!function_exists('search_obj_array')) { function search_obj_array($needle, $field, $array = array()) { if ($array) { foreach ($array as $key => $data) { if ($data->all[$field] == $needle) { return $key; } } } return false; } } global $class_path, $site, $leht; extract($params); if (!isset($name)) { $name = 'images'; } if (!isset($parent)) { $parent = $leht->id; } $album = new Objekt(array('objekt_id' => $parent)); $conf = new CONFIG($album->all['ttyyp_params']); //$alamlist->debug->print_msg(); $files = array(); if ($conf->get('path')) { $path = (string) $conf->get('path'); $path = preg_replace('#^/#', '', $path); $path = preg_replace('#/$#', '', $path); $sql = $site->db->prepare('select objekt_id from obj_folder where relative_path = ?', '/' . $path); $result = new SQL($sql); $folder_id = $result->fetchsingle(); if ($folder_id) { $alamlistSQL = new AlamlistSQL(array('parent' => $folder_id, 'klass' => 'file', 'order' => ' filename ', 'where' => $where)); $alamlistSQL->add_select(" obj_file.filename, obj_file.size, obj_file.kirjeldus "); $alamlistSQL->add_from("LEFT JOIN obj_file ON objekt.objekt_id=obj_file.objekt_id"); $alamlist = new Alamlist(array('alamlistSQL' => $alamlistSQL)); $files = array(); $new_button = $alamlist->get_edit_buttons(array('tyyp_idlist' => '21', 'publish' => 1)); while ($obj = $alamlist->next()) { $obj->buttons = $obj->get_edit_buttons(array('tyyp_idlist' => 21, 'nupud' => array('edit', 'delete', 'new'))); $files[] = $obj; } } $path = $site->absolute_path . $path; include_once $class_path . 'picture.inc.php'; $imgs = get_images($path, $conf->get('path')); } else { //veateade et path pole paika pandud or something ... } $start_from = 0; if ($limit) { $end_at = $limit; } else { $end_at = sizeof($imgs); } if ($start) { $total_pages = ceil(sizeof($imgs) / $limit); $start_from = $start; $end_at = $start_from + $limit; } if ($end_at > sizeof($imgs)) { $end_at = sizeof($imgs); } $j = 0; $images = array(); for ($i = $start_from; $i < $end_at; $i++) { $images[$j]->thumb_path = $site->CONF['wwwroot'] . '/' . $imgs[$i]['thumb']; # relative path $images[$j]->thumb_height = $imgs[$i]['thumb_height']; # in pixels $images[$j]->thumb_width = $imgs[$i]['thumb_width']; $images[$j]->image_path = $site->CONF['wwwroot'] . '/' . $imgs[$i]['image']; $images[$j]->image_height = $imgs[$i]['image_height']; $images[$j]->image_width = $imgs[$i]['image_width']; $images[$j]->actual_image_path = $site->CONF['wwwroot'] . '/' . $imgs[$i]['actual_image']; $images[$j]->actual_image_height = $imgs[$i]['actual_image_height']; $images[$j]->actual_image_width = $imgs[$i]['actual_image_width']; $images[$j]->actual_image_size =& $images[$j]->size; # original $images[$j]->filename = $imgs[$i]['filename']; $key = search_obj_array($imgs[$i]['filename'], 'filename', $files); if ($key !== false) { $images[$j]->id = $files[$key]->all['objekt_id']; $images[$j]->title = $files[$key]->pealkiri; $images[$j]->description = $files[$key]->all['kirjeldus']; $images[$j]->size = $files[$key]->all['size']; # final display $images[$j]->buttons = $files[$key]->buttons; } $j++; } //printr($images); $smarty->assign(array($name => $images, $name . '_newbutton' => $new_button, $name . '_title' => $album->pealkiri, $name . '_first_image' => $images[0]->image_path, $name . '_last_image' => $images[sizeof($images) - 1]->image_path, $name . '_count' => sizeof($images), $name . '_counttotal' => sizeof($imgs))); }
function smarty_function_init_album($params, &$smarty) { global $site, $leht, $template; $content_template =& $leht->content_template; $albums = array(); ############## # default values extract($params); if (!isset($name)) { $name = "album"; } switch ($on_create) { case "publish": $publish = 1; break; case "hide": $publish = 0; break; default: $publish = 0; } $album = new Objekt(array(objekt_id => $id)); $conf = new CONFIG($album->all['ttyyp_params']); $col = $conf->get("cols") > 0 ? $conf->get("cols") : 3; $row = $conf->get("rows") > 0 ? $conf->get("rows") : 3; $args['num'] = $args['col']; $alamlist_count = new Alamlist(array(parent => $album->objekt_id, klass => "pilt", asukoht => 0, on_counter => 1)); $alamlist = new Alamlist(array(parent => $album->objekt_id, klass => "pilt", asukoht => 0, start => $start, limit => $limit)); $new_button = $alamlist->get_edit_buttons(array(tyyp_idlist => "12", publish => $publish)); $edit_button = $album->get_edit_buttons(array(tyyp_idlist => "16", publish => $publish)); $title =& $album->pealkiri; while ($obj = $alamlist->next()) { $obj->load_sisu(); $obj->buttons = $obj->get_edit_buttons(array(tyyp_idlist => "12", publish => $publish)); $obj->get_object_href(); //$obj->href = $site->self.'?id='.$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->id = $obj->objekt_id; $obj->class = translate_en($obj->all[klass]); # translate it to english $obj->thumbnail = "<a href=\"" . $site->self . "?id=" . $obj->objekt_id . "\"><img src=\"" . $site->CONF['wwwroot'] . ($site->admin ? "/editor" : "") . "/image.php?" . $obj->objekt_id . "t\" border=\"0\"></a>"; $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']; $obj->forum_allowed = $obj->all['on_foorum']; #####push array_push($albums, $obj); } ############## # assign to template variables $smarty->assign(array($name => $albums, $name . '_newbutton' => $new_button, $name . '_editbutton' => $edit_button, $name . '_title' => $title, $name . '_col' => $col, $name . '_row' => $row, $name . '_count' => $alamlist_count->rows)); }
function CONFIG($key = '') { return CONFIG::get($key); }
/** * This source file is is part of Saurus CMS content management software. * It is licensed under MPL 1.1 (http://www.opensource.org/licenses/mozilla1.1.php). * Copyright (C) 2000-2010 Saurused Ltd (http://www.saurus.info/). * Redistribution of this file must retain the above copyright notice. * * Please note that the original authors never thought this would turn out * such a great piece of software when the work started using Perl in year 2000. * Due to organic growth, you may find parts of the software being * a bit (well maybe more than a bit) old fashioned and here's where you can help. * Good luck and keep your open source minds open! * * @package SaurusCMS * @copyright 2000-2010 Saurused Ltd (http://www.saurus.info/) * @license Mozilla Public License 1.1 (http://www.opensource.org/licenses/mozilla1.1.php) * */ function edit_objekt() { global $site; global $objekt; global $keel; global $class_path; global $tyyp; // refreshing (fdat['refresh'] = 1) looses object data, I don't know why and because it's done in edit_object.php, I'm not going to fix it, lord knows what it'll screw up if ($site->fdat['refresh'] && $site->fdat['id']) { $obj = new Objekt(array('objekt_id' => $site->fdat['id'])); $objekt->objekt_id = $obj->objekt_id; $objekt->parent_id = $obj->parent_id; } $parent = new Objekt(array('objekt_id' => $objekt->objekt_id ? $objekt->parent_id : $site->fdat['parent_id'])); $pearubriik = $parent->all['sys_alias'] == 'home' ? 1 : 0; // parent path if ($objekt->all['sys_alias'] == '' && $site->fdat['sys_alias'] == '') { // this needs serious rethink and optmisation: there's no need to get the entire tree, parent object's path to top is only needed include_once $class_path . 'rubloetelu.class.php'; $rubs = new RubLoetelu(array('keel' => $keel, 'required_perm' => 'C', 'ignore_perm_for_obj' => $parent->objekt_id)); #$rubs->debug->print_msg(); $topparents = $rubs->get_loetelu(); if (is_array($topparents)) { asort($topparents); } foreach ($topparents as $k => $v) { if ($parent->objekt_id == $k) { $section_name = $v; break; } } } // publishing $publish_start = $objekt->all['avaldamisaeg_algus'] > 0 ? $site->db->MySQL_ee_long($objekt->all['avaldamisaeg_algus']) : ''; /* Don't print out time which is 00:00:00 */ if (preg_match("/(\\d?\\d[\\:\\\\.\\/\\-]\\d?\\d[\\:\\\\.\\/\\-]\\d?\\d?\\d\\d)\\s(\\d?\\d)[\\:\\\\.\\/\\-](\\d?\\d)/", $publish_start, $aa_reg)) { $publish_start = $aa_reg[2] == "00" && $aa_reg[3] == "00" ? $aa_reg[1] : $publish_start; } $publish_end = $objekt->all['avaldamisaeg_lopp'] > 0 ? $site->db->MySQL_ee_long($objekt->all['avaldamisaeg_lopp']) : ''; /* Don't print out time which is 23:59 */ if (preg_match("/(\\d?\\d[\\:\\\\.\\/\\-]\\d?\\d[\\:\\\\.\\/\\-]\\d?\\d?\\d\\d)\\s(\\d?\\d)[\\:\\\\.\\/\\-](\\d?\\d)/", $publish_end, $la_reg)) { $publish_end = $la_reg[2] == "23" && $la_reg[3] == "59" ? $la_reg[1] : $publish_end; } // to get the correct path to parent objects set use_alises on $site->CONF['use_aliases'] = 1; $parent_href = $parent->get_object_href(); if ($site->CONF['alias_trail_format'] == 0 || $parent->all['sys_alias'] == 'home' || $parent->all['sys_alias'] == 'trash' || $parent->all['sys_alias'] == 'system' || $parent->all['sys_alias'] == 'gallup_arhiiv') { $parent_href = preg_replace('#' . preg_quote('/' . ($parent->all['friendly_url'] ? $parent->all['friendly_url'] : $parent->objekt_id), '#') . '/$#', '/', $parent_href); } $parent_href = $site->CONF['hostname'] . $parent_href; // setup for section selection $_SESSION['parent_selection']['callback'] = 'window.opener.updateSection'; $_SESSION['parent_selection']['selectable'] = 1; $_SESSION['parent_selection']['hide_language_selection'] = '1'; $_SESSION['parent_selection']['mem_classes'] = array('rubriik'); //this sucks, really $_SESSION['parent_selection']['db_fields'] = array('select_checkbox', 'objekt_id', 'pealkiri'); $_SESSION['parent_selection']['display_fields'] = array('select_checkbox', 'pealkiri'); // setup folder select $_SESSION['scms_filemanager_settings']['scms_select_album_folder'] = array('select_mode' => 2, 'action_text' => $site->sys_sona(array('sona' => 'use_this_folder_for_album', 'tyyp' => 'editor')), 'action_trigger' => $site->sys_sona(array('sona' => 'use_this_folder_for_album', 'tyyp' => 'editor')), 'callback' => 'window.opener.setFolder'); $conf = new CONFIG($objekt->all['ttyyp_params']); $args['cols'] = $conf->get('cols'); $args['rows'] = $conf->get('rows'); $args['path'] = $conf->get('path'); //$args['path'] = 1; $args['tn_size'] = $conf->get('tn_size'); $args['desc'] = $conf->get('desc'); $args['pic_size'] = $conf->get('pic_size'); $args['folder_id'] = $conf->get('folder_id'); if (!$args['path']) { if ($objekt->all['pealkiri']) { $album_folder_path = $clean_path = create_alias_from_string($objekt->all['pealkiri']); } else { $result = new SQL('select max(objekt_id) + 1 from objekt'); $album_folder_path = $clean_path = $result->fetchsingle(); } $supplement = 2; // unlikely to happen if ($album_folder_path === '') { $album_folder_path = $clean_path = rand(10000, 20000); } while (file_exists($site->absolute_path . '/public/galleries/' . $album_folder_path)) { $album_folder_path = create_alias_from_string($clean_path . '-' . $supplement); $supplement++; // guard, also unlikely if ($supplement > 1000) { exit; } } $album_folder_path = 'public/galleries/' . $album_folder_path; } //printr($album_folder_path); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title><?php echo $site->title; ?> <?php echo $site->cms_version; ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $encoding ? $encoding : $site->encoding; ?> " /> <meta http-equiv="Cache-Control" content="no-cache" /> <link rel="stylesheet" href="<?php echo $site->CONF['wwwroot'] . $site->CONF['styles_path']; ?> /datepicker.css" /> <link rel="stylesheet" href="<?php echo $site->CONF['wwwroot'] . $site->CONF['styles_path']; ?> /album_editor.css" /> <!--[if IE 6]> <style type="text/css"> input.inline_button { padding: 0px 0px 0px 0px; height: 21px; } </style> <![endif]--> <!--[if IE 7]> <style type="text/css"> input.inline_button { padding: 0px 0px 0px 0px; height: 21px; } </style> <![endif]--> <script type="text/javascript" src="<?php echo $site->CONF['wwwroot'] . $site->CONF['js_path']; ?> /yld.js"></script> <script type="text/javascript" src="<?php echo $site->CONF['wwwroot'] . $site->CONF['js_path']; ?> /edit_popup.js"></script> <script type="text/javascript" src="<?php echo $site->CONF['wwwroot'] . $site->CONF['js_path']; ?> /jquery.js"></script> <script type="text/javascript" src="<?php echo $site->CONF['wwwroot'] . $site->CONF['js_path']; ?> /datepicker.js"></script> <script type="text/javascript" src="<?php echo $site->CONF['wwwroot']; ?> /common.js.php"></script> <?php if ($site->CONF['fm_allow_multiple_upload'] && $parent->all['ttyyp_id'] != 39) { ?> <script type="text/javascript" src="<?php echo $site->CONF['wwwroot'] . $site->CONF['js_path']; ?> /swfupload/swfupload.js"></script> <script type="text/javascript" src="<?php echo $site->CONF['wwwroot'] . $site->CONF['js_path']; ?> /swfupload/swfupload.queue.js"></script> <?php } ?> <script type="text/javascript"> var isIE = navigator.appVersion.match(/MSIE/); // assume gecko on false var folder_path = '<?php echo $album_folder_path; ?> '; var ajax_token = <?php echo create_form_token_json('edit-album-ajax'); ?> ; var swfu; window.onload = function () { var title = document.getElementById('pealkiri'); var advanced_panel_state = document.getElementById('advanced_panel_state'); if(advanced_panel_state.value == 1) { togglePanel('advanced'); } this.focus(); title.focus(); resizeWindow(); <?php if ($site->CONF['fm_allow_multiple_upload'] && $parent->all['ttyyp_id'] != 39) { ?> var post_params = {'<?php echo session_name(); ?> ' : '<?php echo session_id(); ?> ', 'op': 'add_image_to_album'}; $.extend(post_params, ajax_token); swfu = new SWFUpload({ flash_url : '<?php echo $site->CONF['wwwroot'] . $site->CONF['js_path']; ?> /swfupload/swfupload.swf', upload_url: '<?php echo $site->CONF['wwwroot']; ?> /admin/ajax_response.php', post_params: post_params, file_size_limit : '<?php echo is_int(ini_get('upload_max_filesize')) ? round(ini_get('upload_max_filesize') / 1024) : ini_get('upload_max_filesize') . 'B'; ?> ', file_types : '*.gif;*.png;*.jpeg;*.jpg', file_types_description : 'Images', file_upload_limit : 0, file_queue_limit : 100, custom_settings : { cancelButtonId : 'cancel_file_upload_button' }, debug: false, // Button settings button_image_url: '<?php echo $site->CONF['wwwroot'] . $site->CONF['styles_path']; ?> /gfx/general/album_upload_button_bg.gif', // Relative to the Flash file button_width: '95', button_height: '21', button_placeholder_id: 'span_upload_button_place_holder', button_text: '<?php echo $site->sys_sona(array('sona' => 'add_images', 'tyyp' => 'editor')); ?> ', button_text_left_padding: 8, button_text_top_padding: 1, button_window_mode : SWFUpload.WINDOW_MODE.TRANSPARENT, // The event handler functions swfupload_loaded_handler: swfuLoaded, file_queued_handler : fileQueued, file_queue_error_handler : fileQueueError, file_dialog_complete_handler : fileDialogComplete, upload_start_handler : uploadStart, upload_progress_handler : uploadProgress, upload_error_handler : uploadError, upload_success_handler : uploadSuccess, upload_complete_handler : uploadComplete //queue_complete_handler : queueComplete // Queue plugin event }); <?php } ?> } function resizeWindow() { if(jQuery.browser.webkit) { window.resizeTo(580, 380); } else { resizeWindowTo($('#size_wrapper').width(), $('#size_wrapper').height()); } } var filemanager_window; var uploadFolderPathSet = false; function chooseFolder() { filemanager_window = openpopup('filemanager.php?setup=scms_select_album_folder', 'filemanager', 980, 600); } function setFolder(data) { filemanager_window.close(); uploadFolderPathSet = true; $('input#path').attr('value', data.folders[0].relative_path.replace(/^\//, '')); $('a#images_folder_path_link').text(data.folders[0].relative_path.replace(/^\//, '')); $('td#images_folder_cf_container_cell').removeClass('hidden'); $('td#images_choose_folder_button_cell').addClass('hidden'); } function clearFolder() { $('input#path').attr('value', ''); $('td#images_folder_cf_container_cell').addClass('hidden'); $('td#images_choose_folder_button_cell').removeClass('hidden'); resizeWindow(); } function chooseSection() { explorer_window = openpopup('explorer.php?objekt_id=home&editor=1&swk_setup=parent_selection&remove_objects=<?php echo $site->fdat['id']; ?> &pre_selected=' + document.getElementById('rubriik').value, 'cms_explorer', '800','600'); } function updateSection(sections) { explorer_window.close(); var section_name = document.getElementById('section_name'); var section_id = document.getElementById('rubriik'); var trail_path= new Array(); for(var j = 0; j < sections[0].trail.length; j++){ trail_path[j] = sections[0].trail[j].pealkiri; } section_name.innerHTML = '<a href="javascript:chooseSection();">' + trail_path.join("->") + '</a>'; section_id.value = sections[0].objekt_id; } function editAlias() { var alias_placeholder = document.getElementById('alias_placeholder'); var alias_value = document.getElementById('alias_value'); alias_placeholder.innerHTML = '<input type="text" id="alias" value="' + alias_value.value + '" onblur="saveAlias();">'; resizeWindow(); var alias = document.getElementById('alias'); alias.focus(); } function saveAlias() { var alias_placeholder = document.getElementById('alias_placeholder'); var alias_value = document.getElementById('alias_value'); var alias = document.getElementById('alias'); if(alias_value.value != alias.value) { $.ajax({ url: 'ajax_response.php?rand=' + Math.random(9999), data: {op: 'generate_alias', string: alias.value, language_id: '<?php echo $keel; ?> '}, type: 'POST', dataType: 'json', timeout: 1000, error: function() { alias_placeholder.innerHTML = '<a href="javascript:void(0);" onclick="editAlias();" id="alias_link">' + (alias_value.value.length > 30 ? alias_value.value.substring(0, 30) + '...' : alias_value.value) + '</a>'; }, success: function(response) { if(response.alias) { alias_value.value = response.alias; alias_placeholder.innerHTML = '<a href="javascript:void(0);" onclick="editAlias();" id="alias_link">' + (alias_value.value.length > 30 ? alias_value.value.substring(0, 30) + '...' : alias_value.value) + '</a>'; } else { alias_value.value = ''; <?php if ($objekt->objekt_id) { ?> alias_placeholder.innerHTML = '<a href="javascript:void(0);" onclick="editAlias();" id="alias_link">' + '<?php echo $objekt->objekt_id; ?> ' + '</a>'; <?php } else { ?> alias_placeholder.innerHTML = '<input type="text" id="alias" value="" onblur="saveAlias();">'; <?php } ?> } resizeWindow(); } }); } else { if(!alias.value) { alias_value.value = ''; <?php if ($objekt->objekt_id) { ?> alias_placeholder.innerHTML = '<a href="javascript:void(0);" onclick="editAlias();" id="alias_link">' + '<?php echo $objekt->objekt_id; ?> ' + '</a>'; <?php } else { ?> alias_placeholder.innerHTML = '<input type="text" id="alias" value="" onblur="saveAlias();">'; <?php } ?> } else { alias_placeholder.innerHTML = '<a href="javascript:void(0);" onclick="editAlias();" id="alias_link">' + (alias_value.value.length > 30 ? alias_value.value.substring(0, 30) + '...' : alias_value.value) + '</a>'; } resizeWindow(); } } function createAlias() { var alias_value = document.getElementById('alias_value'); var title = document.getElementById('pealkiri') if(0 || (!alias_value && title.value)) { $.ajax({ url: 'ajax_response.php?rand=' + Math.random(9999), data: {op: 'generate_alias', string: title.value, language_id: '<?php echo $keel; ?> '}, type: 'POST', dataType: 'json', timeout: 1000, error: function() { }, success: function(response) { var alias_cell = document.getElementById('alias_cell'); alias_cell.className = 'alias'; if(response.alias) { alias_cell.innerHTML = '<input type="hidden" name="friendly_url" id="alias_value" value="' + response.alias + '"><?php echo $parent_href; ?> <span id="alias_placeholder"><a href="javascript:void(0);" onclick="editAlias();" id="alias_link">' + (response.alias.length > 30 ? response.alias.substring(0, 30) + '...' : response.alias) + '</a></span>'; if(swfu && !swfu.uploadFolderPathSent && !uploadFolderPathSet) $('input#path').attr('value', 'public/galleries/' + response.alias); } else { alias_cell.innerHTML = '<input type="hidden" name="friendly_url" id="alias_value" value=""><?php echo $parent_href; ?> <span id="alias_placeholder"><input type="text" id="alias" value="" onblur="saveAlias();"></span>'; } $('a#images_folder_path_link').text($('input#path').attr('value')); $('#alias_row').show(); //var alias_row = document.getElementById('alias_row'); //alias_row.style.display = (isIE ? 'block' : 'table-row'); resizeWindow(); } }); } } function saveForm(op2) { var form = document.getElementById('editForm'); var title = document.getElementById('pealkiri'); if(title.value.length == 0) { alert('<?php echo $site->sys_sona(array('sona' => 'please_fill_in_the_title!', 'tyyp' => 'admin')); ?> '); return; } var alias_value = document.getElementById('alias_value'); var alias = document.getElementById('alias'); if((title.value && !alias_value) || (alias && alias_value && alias.value != alias_value.value)) { $.ajax({ url: 'ajax_response.php?rand=' + Math.random(9999), data: {op: 'generate_alias', string: title.value, language_id: '<?php echo $keel; ?> '}, type: 'POST', dataType: 'json', timeout: 1000, error: function() { var form = document.getElementById('editForm'); form.op2.value = op2; form.submit(); }, success: function(response) { var alias_value = document.getElementById('alias_value'); if(!alias_value && response.alias) { var alias_cell = document.getElementById('alias_cell'); alias_cell.innerHTML = '<input type="hidden" name="friendly_url" id="alias_value" value="' + response.alias + '"><?php echo $parent_href; ?> <span id="alias_placeholder"><a href="javascript:void(0);" onclick="editAlias();" id="alias_link">' + (response.alias.length > 30 ? response.alias.substring(0, 30) + '...' : response.alias) + '</a></span>'; } var form = document.getElementById('editForm'); form.op2.value = op2; form.submit(); } }); } else { form.op2.value = op2; form.submit(); } } <?php if ($site->CONF['fm_allow_multiple_upload'] && $parent->all['ttyyp_id'] != 39) { ?> // SWFupload handler functions function fileQueued(file) { try { } catch (ex) { this.debug(ex); } } function fileQueueError(file, errorCode, message) { try { if (errorCode === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) { alert('<?php echo $site->sys_sona(array('sona' => 'upload_queue_limit', 'tyyp' => 'Files')); ?> ' + ': ' + this.settings.file_queue_limit); return; } if (errorCode === SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT) { alert(file.name + ' ' + '<?php echo $site->sys_sona(array('sona' => 'upload_limit_size', 'tyyp' => 'Files')); ?> ' + ' ' + this.settings.file_size_limit); return; } switch (errorCode) { default: if (file !== null) { alert("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message); } this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message); break; } } catch (ex) { this.debug(ex); } } function fileDialogComplete(numFilesSelected, numFilesQueued) { try { if(numFilesQueued > 0) { $('td#images_folder_cf_container_cell').addClass('hidden'); $('td#images_choose_folder_button_cell').addClass('hidden'); $('table#form_submit_buttons_table').addClass('hidden'); this.setButtonDisabled(true); this.setButtonDimensions(1, 1); $('td#upload_progress_cell').removeClass('hidden'); $('td#upload_progress_text_cell').removeClass('hidden'); $('table#upload_cancel_table').removeClass('hidden'); $('div#upload_progress_grow').width(0); this.numFilesQueued = numFilesQueued; if(!$('input#path').attr('value')) $('input#path').attr('value', folder_path); this.addPostParam('folder_path', $('input#path').attr('value')); this.uploadFolderPathSent = true; this.startUpload(); } } catch (ex) { this.debug(ex); } } function uploadStart(file) { try { $('td#upload_progress_text_cell').html(file.name + ' <span id="percent_placeholder">0</span>%'); this.progressBarWidth = $('div#upload_progress_grow').width(); } catch (ex) { this.debug(ex); } return true; } function uploadProgress(file, bytesLoaded, bytesTotal) { try { var percent = Math.round((bytesLoaded / bytesTotal) * 100); $('div#upload_progress_grow').width(this.progressBarWidth + Math.round(($('div#upload_progress_bar').width() / this.numFilesQueued * percent) / 100)); $('span#percent_placeholder').html(percent); } catch (ex) { this.debug(ex); } } function uploadSuccess(file, serverData) { try { } catch (ex) { this.debug(ex); } } function uploadError(file, errorCode, message) { try { switch (errorCode) { case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED: case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED: // upload canceled break; case SWFUpload.UPLOAD_ERROR.HTTP_ERROR: alert('Error occured while trying to connect.'); break; default: alert("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message); break; } } catch (ex) { this.debug(ex); } } function uploadComplete(file) { $('td#upload_progress_text_cell').empty(); if (this.getStats().files_queued === 0) { // all files are finished $('td#upload_progress_cell').addClass('hidden'); $('td#upload_progress_text_cell').addClass('hidden'); $('table#upload_cancel_table').addClass('hidden'); this.setButtonDisabled(false); this.setButtonDimensions(95, 21); $('a#images_folder_path_link').text($('input#path').attr('value')); $('table#form_submit_buttons_table').removeClass('hidden'); $('td#images_folder_cf_container_cell').removeClass('hidden'); } } function swfuLoaded() { $('input#add_images_button').addClass('hidden'); } <?php } ?> </script> </head> <body> <?php if ($site->fdat['op'] == 'edit') { ?> <iframe src="checkin.php?objekt_id=<?php echo $objekt->objekt_id; ?> " style="width: 0; height: 0; display: none; visibility: hidden;"></iframe> <?php } ?> <form action="edit.php" name="editForm" id="editForm" method="POST" enctype="multipart/form-data"> <?php create_form_token('edit-album'); ?> <input type="hidden" name="tab" value="<?php echo $site->fdat['tab']; ?> " /> <input type="hidden" id="op" name="op" value="<?php echo htmlspecialchars($site->fdat['op']); ?> " /> <input type="hidden" id="op2" name="op2" value="" /> <input type="hidden" id="refresh" name="refresh" value="0" /> <input type="hidden" name="tyyp_id" value="<?php echo $tyyp['tyyp_id']; ?> " /> <input type="hidden" name="tyyp" value="<?php echo $tyyp['klass']; ?> " /> <input type="hidden" name="pearubriik" value="<?php echo $pearubriik; ?> " /> <input type="hidden" name="id" value="<?php echo $site->fdat['id']; ?> " /> <input type="hidden" name="parent_id" value="<?php echo $site->fdat['parent_id']; ?> " /> <input type="hidden" name="previous_id" value="<?php echo $site->fdat['previous_id']; ?> " /> <input type="hidden" name="keel" value="<?php echo $keel; ?> " /> <input type="hidden" name="on_pealkiri" value="1" /> <input type="hidden" name="sorting" value="<?php echo $site->fdat['sorting']; ?> "> <input type="hidden" name="opener_location" value="" /> <input type="hidden" name="publish" value="<?php echo $site->fdat['publish'] || $objekt->all['on_avaldatud'] ? 1 : 0; ?> "> <input name="permanent_parent_id" type="hidden" value="<?php echo $objekt->parent_id; ?> " /> <input name="sys_alias" type="hidden" value="<?php echo $site->fdat['sys_alias'] ? $site->fdat['sys_alias'] : $objekt->all['sys_alias']; ?> " /> <input name="advanced_panel_state" id="advanced_panel_state" type="hidden" value="<?php echo $site->fdat['advanced_panel_state'] ? htmlspecialchars($site->fdat['advanced_panel_state']) : 0; ?> " /> <div id="size_wrapper" class="section_editor"> <div id="main_container"> <?php ########### Tabs ######## ?> <div id="tab_container"> <a href="javascript:void(0);" class="selected"><?php echo $site->sys_sona(array('sona' => 'tyyp_album', 'tyyp' => 'System')); ?> </a> </div> <div id="content_container"> <table cellpadding="0" cellspacing="0" class="form_row"> <tr> <td class="label"><label><?php echo $site->sys_sona(array('sona' => 'Pealkiri', 'tyyp' => 'editor')); ?> :</label></td> <td class="input"><input type="text" class="text" name="pealkiri" id="pealkiri" value="<?php echo htmlspecialchars($objekt->all['pealkiri']); ?> " onblur="createAlias();" /></td> </tr> <?php if (($objekt->objekt_id || isset($objekt->all['friendly_url'])) && !($objekt->all['sys_alias'] == 'home' || $objekt->all['sys_alias'] == 'trash' || $objekt->all['sys_alias'] == 'system' || $objekt->all['sys_alias'] == 'gallup_arhiiv')) { ?> <tr> <td class="label"> </td> <td class="input"><input type="hidden" id="alias_value" name="friendly_url" name="friendly_url" value="<?php echo htmlspecialchars($objekt->all['friendly_url']); ?> " /><?php echo $parent_href; ?> <span id="alias_placeholder"><a href="javascript:void(0);" onclick="editAlias();" id="alias_link"><?php echo $objekt->all['friendly_url'] ? strlen(htmlspecialchars($objekt->all['friendly_url'])) > 30 ? substr(htmlspecialchars($objekt->all['friendly_url']), 0, 30) . '...' : htmlspecialchars($objekt->all['friendly_url']) : $objekt->objekt_id; ?> </a></span></td> </tr> <?php } else { ?> <tr id="alias_row"> <td class="label"> </td> <td class="input" id="alias_cell"></td> </tr> <?php } ?> <?php ########### images folder ######## ?> <?php if ($parent->all['ttyyp_id'] != 39) { ?> <tr id="images_folder"> <td class="label"><?php echo $site->sys_sona(array('sona' => 'Image files directory', 'tyyp' => 'editor')); ?> :</td> <td class="input"> <table cellpadding="0" cellspacing="0" class="container" id="images_folder_cf_container_table"> <tr> <?php ########### images folder ######## ?> <td id="images_folder_cf_container_cell"<?php echo $args['path'] ? '' : ' class="hidden"'; ?> > <table cellpadding="0" cellspacing="0" class="cf_container"> <tr> <th><input type="hidden" name="path" id="path" value="<?php echo $args['path'] ? $args['path'] : ''; ?> "><span id="images_folder_path"><a href="javascript:chooseFolder();" id="images_folder_path_link" title="<?php echo $site->sys_sona(array('sona' => 'choose_a_folder', 'tyyp' => 'editor')); ?> "><?php echo $args['path']; ?> </a></span></th> <td><a href="javascript:chooseFolder();" title="<?php echo $site->sys_sona(array('sona' => 'choose_a_folder', 'tyyp' => 'editor')); ?> ">..</a></td> <td><a href="javascript:clearFolder();">X</a></td> </tr> </table> </td> <?php ########### add images ######## ?> <?php if ($site->CONF['fm_allow_multiple_upload']) { ?> <td id="images_add_button_cell"> <span id="span_upload_button_place_holder"></span> </td> <?php ########### upload progress ######## ?> <td id="upload_progress_cell" class="hidden"><div id="upload_progress_bar"><div id="upload_progress_grow"></div></div></td><!-- / scms_upload_progress --> <td id="upload_progress_text_cell" class="hidden"></td><!-- / scms_upload_text --> <?php } ?> <?php ########### choose_a_folder ######## ?> <td id="images_choose_folder_button_cell"<?php echo $args['path'] ? ' class="hidden"' : ''; ?> > <?php if ($site->CONF['fm_allow_multiple_upload']) { ?> <?php echo $site->sys_sona(array('sona' => 'or', 'tyyp' => 'editor')); } ?> <input type="button" value="<?php echo $site->sys_sona(array('sona' => 'choose_a_folder', 'tyyp' => 'editor')); ?> " class="inline_button" onclick="chooseFolder();" /> </td> </tr> </table> </td> </tr> <?php } ?> <?php ########### description ######## ?> <tr> <td class="label"><?php echo $site->sys_sona(array('sona' => 'Kirjeldus', 'tyyp' => 'editor')); ?> :</td> <td class="input"><textarea name="desc"><?php echo $args['desc'] ? $args['desc'] : ""; ?> </textarea></td> </tr> <?php ########### publishing ######## ?> <tr> <td class="label"><?php echo $site->sys_sona(array('sona' => 'visible_to_visitors', 'tyyp' => 'editor')); ?> :</td> <td><input type="radio" name="publish" id="object_published" value="1"<?php echo $site->fdat['publish'] || $objekt->all['on_avaldatud'] ? ' checked' : ''; echo $objekt->permission && !$objekt->permission['P'] || !$objekt->permission && !$parent->permission['P'] ? ' disabled="disabled"' : NULL; ?> > <label for="object_published"><?php echo $site->sys_sona(array('sona' => 'published', 'tyyp' => 'editor')); ?> </label> <input type="radio" name="publish" id="object_unpublished" value="0"<?php echo $site->fdat['publish'] == 0 && $objekt->all['on_avaldatud'] == 0 ? ' checked' : ''; echo $objekt->permission && !$objekt->permission['P'] || !$objekt->permission && !$parent->permission['P'] ? ' disabled="disabled"' : NULL; ?> > <label for="object_unpublished"><?php echo $site->sys_sona(array('sona' => 'unpublished', 'tyyp' => 'editor')); ?> </label></td> </tr> </table> <br /> <?php ########### advanced ######## ?> <div class="panel_toggler" onclick="togglePanel('advanced');"> <a href="javascript:void(0);"><?php echo $site->sys_sona(array('sona' => 'Advanced', 'tyyp' => 'editor')); ?> <span id="advanced_panel_link_state">»</span></a> </div> <div id="advanced_panel" class="panel"> <?php ########### image sizes ######## ?> <table cellpadding="0" cellspacing="0" class="form_row"> <tr> <td class="label">Image sizes:</td> <td><?php echo $site->sys_sona(array('sona' => 'Image size', 'tyyp' => 'editor')); ?> :</td> <td> <input name="pic_size" class="text_number" value="<?php echo $args['pic_size'] ? $args['pic_size'] : $site->CONF['image_width']; ?> " /> <input name="old_pic_size" type="hidden" value="<?php echo $args['pic_size'] ? $args['pic_size'] : $site->CONF['image_width']; ?> " /> </td> <td>px </td> <td><?php echo $site->sys_sona(array('sona' => 'Thumbnail size', 'tyyp' => 'editor')); ?> :</td> <td> <input name="tn_size" class="text_number" value="<?php echo $args['tn_size'] ? $args['tn_size'] : $site->CONF['thumb_width']; ?> " /> <input name="old_tn_size" type="hidden" value="<?php echo $args['tn_size'] ? $args['tn_size'] : $site->CONF['thumb_width']; ?> " /> </td> <td>px</td> </tr> </table> <?php ########### parent section ######## ?> <?php if ($section_name) { ?> <table cellpadding="0" cellspacing="0" class="form_row"> <tr> <td class="label"><label><?php echo $site->sys_sona(array('sona' => 'Rubriigid', 'tyyp' => 'editor')); ?> :</label></td> <td class="input"> <table cellpadding="0" cellspacing="0" class="cf_container"> <tr> <th><input type="hidden" name="rubriik[]" id="rubriik" value="<?php echo $parent->objekt_id; ?> "><span id="section_name"><a href="javascript:chooseSection();"><?php echo $section_name; ?> </a></span></th> <td><a href="javascript:chooseSection();">..</a></td> </tr> </table> </td> </tr> </table> <?php } ?> <table cellpadding="0" cellspacing="0" class="form_row"> <tr> <td class="label"> </td> <td><label><?php echo $site->sys_sona(array('sona' => 'Avaldatud', 'tyyp' => 'editor')); ?> :</label></td> <td><input type="text" id="publish_start" name="avaldamise_algus" maxlength="16" class="text_date" value="<?php echo $publish_start; ?> " /></td> <td><a href="javascript:init_datepicker('publish_start', 'publish_start', 'publish_end');"><img src="<?php echo $site->CONF['wwwroot'] . $site->CONF['styles_path']; ?> /gfx/calendar/cal.gif" width="16" height="15" title="Choose from calendar" alt="Choose from calendar" /></a></td> <td><label><?php echo $site->sys_sona(array('sona' => 'Kuni', 'tyyp' => 'editor')); ?> :</label></td> <td><input type="text" id="publish_end" name="avaldamise_lopp" maxlength="16" class="text_date" value="<?php echo $publish_end; ?> " /></td> <td><a href="javascript:init_datepicker('publish_end', 'publish_start', 'publish_end');"><img src="<?php echo $site->CONF['wwwroot'] . $site->CONF['styles_path']; ?> /gfx/calendar/cal.gif" width="16" height="15" title="Choose from calendar" alt="Choose from calendar" /></a></td> </tr> </table> <?php ########### position ######## ?> <?php if ($site->CONF['allow_change_position']) { ?> <table cellpadding="0" cellspacing="0" class="form_row"> <tr> <td class="label"><label><?php echo $site->sys_sona(array('sona' => 'Position', 'tyyp' => 'editor')); ?> :</label></td> <td><input type="text" maxlength="5" class="text_position" name="kesk" value="<?php echo $site->fdat['op'] == 'edit' ? $objekt->all['kesk'] : $site->fdat['kesk']; ?> " /></td> </tr> </table> <?php } else { ?> <input type="hidden" name="kesk" value="<?php echo $site->fdat['op'] == 'edit' ? $objekt->all['kesk'] : $site->fdat['kesk']; ?> " /> <?php } ?> </div> </div> </div> <div id="button_container"> <table cellspacing="0" cellpadding="0" id="form_submit_buttons_table"> <tr> <td id="apply_button_cell"> <input type="button" class="button" value="<?php echo $site->sys_sona(array('sona' => 'Apply', 'tyyp' => 'editor')); ?> " onclick="saveForm('save');" /> </td> <td id="save_close_button_cell"> <input type="button" class="button" value=" <?php echo $site->sys_sona(array('sona' => 'save_and_close', 'tyyp' => 'editor')); ?> " onclick="saveForm('saveclose');" /> <input type="button" class="button" value="<?php echo $site->sys_sona(array('sona' => 'Close', 'tyyp' => 'editor')); ?> " onclick="window.close();" /> </td> </tr> </table> <table cellspacing="0" cellpadding="0" class="hidden" id="upload_cancel_table"> <tr> <td id="cancel_button_cell"> <input type="button" class="button" value="<?php echo $site->sys_sona(array('sona' => 'katkesta', 'tyyp' => 'editor')); ?> " onclick="swfu.cancelQueue();" /> </td> </tr> </table> </div> <!-- / button_container --> </div> <!-- / size_wrapper --> </form> </body> </html> <?php }
function add_image_to_album($file, $folder_path) { global $site; $folder_path = trim($folder_path); // only public folders if (strpos($folder_path, 'public/') === 0) { $folder_id = create_folder_from_path($folder_path); if (is_int($folder_id)) { // upload the file $upload_result = upload_to_folder($file, $folder_id); if (is_int($upload_result)) { global $site, $class_path; $folder = new Objekt(array('objekt_id' => $folder_id)); $conf = new CONFIG($folder->all['ttyyp_params']); include_once $class_path . 'picture.inc.php'; generate_images($site->absolute_path . $conf->get('path'), $conf->get('tn_size'), $conf->get('pic_size')); } return $upload_result; } else { // error message return $folder_id; } } else { return 'no_such_folder'; } }
<?php list($display['page_error'], $errors) = post_errors(); $display['page_title'] = 'Home'; render(CONFIG::get('ABSPATH') . '/src/views/templates/index/index.php', CONFIG::get('ABSPATH') . '/src/views/layouts/flat.php');
<!DOCTYPE html> <html lang="en"> <?php require_once CONFIG::get('ABSPATH') . '/src/views/partials/helpers.php'; global $include_css, $include_js, $errors; ?> <head> <title> <?php xe($display['page_title']); ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?php echo web_add_css($include_css); ?> <?php echo web_add_js($include_js); ?> </head> <body> <?php echo $display['page_content']; ?> </body> </html>
############ get all parent object: trail $trail_objs = $leht->parents->list; #oldfor ($y=-1;$y>-10;$y--){ $i = 0; foreach ($trail_objs as $i => $myobj) { # skip the first array element - itself //if($i == 0) { continue; } if (($myobj->all[ttyyp_id] == 40 || $myobj->all[ttyyp_id] > 1000) && !$already) { $already = 1; $par_rubobj = $myobj; # get parent section object ############################ # CONFIGURATION PARAMETERS - reading parameters values of object $leht->debug->msg("PARAMS " . $par_rubobj->all[ttyyp_params]); $conf = new CONFIG($par_rubobj->all[ttyyp_params]); $faq_mode = $conf->get("faq_mode") ? 1 : 0; $conf->debug->print_msg(); if (!$faq_mode) { $leht->debug->msg("set default forum view"); } else { $leht->debug->msg("set forum view to FAQ-mode"); } # / CONFIGURATION PARAMETERS ############################ } } ######################## # if article then check if commenting is allowed for this article; # allow unlimited commenting for all other content objects (Bug #2656) if ($objekt->all[klass] == "artikkel" && $objekt->all['on_foorum'] || $objekt->all[klass] != "artikkel") { ########################
function smarty_function_init_object($params, &$smarty) { global $site, $leht, $template, $class_path; $content_template =& $leht->content_template; ############## # default values extract($params); if (!isset($id)) { $id = $leht->id; } if (!isset($name)) { $name = "object"; } ############### # action-buttons # by default show all if (!isset($buttons)) { $buttons = array("new", "edit", "hide", "move", "delete"); } else { $buttons = split(",", $buttons); } ############## # luua objekt & load sisu $obj = new Objekt(array(objekt_id => $id)); $obj->load_sisu(); ################ # object GENERAL parameters $obj->id = $obj->objekt_id; $obj->class = translate_en($obj->all[klass]); # translate it to english # kui link if ($obj->all[klass] == "link") { $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->title = $obj->pealkiri; $obj->buttons = $obj->get_edit_buttons(array(nupud => $buttons, tyyp_idlist => $obj->all['tyyp_id'], 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->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']; ################ # ALL values, set as attributes foreach ($obj->all as $fieldname => $value) { $obj->{$fieldname} = $value; } ############### # profile values, set as attributes $profile_def = $site->get_profile(array(id => $obj->all['profile_id'])); if ($profile_def[profile_id]) { include_once $class_path . 'profile.class.php'; $obj_profile = new Profile(array("id" => $obj->all['profile_id'])); #### 1. set profile fields as object attributes $obj_profile->set_obj_general_fields(array("obj" => &$obj, "get_object_fields" => $get_object_fields)); ################### # get selectlist values - 1 extra sql per function; sql is fast if (is_array($obj_profile->selectlist)) { $obj_profile->selectlist = array_unique($obj_profile->selectlist); #printr($obj_profile->selectlist); } # go on if object values needs changing: if (sizeof($obj_profile->selectlist) > 0) { #### 2. save array "->asset_names" human readable NAME-s: $obj_profile->get_asset_names(array("selectlist" => $obj_profile->selectlist)); #printr($obj_profile->asset_names); #printr($obj_profile->change_fields); ### 3. save object rest of attributes #print "<br>muuta ID: ".$obj->id; $obj_profile->set_obj_selectlist_fields(array("obj" => &$obj, "change_fields" => $obj_profile->change_fields)); } # if any selectvalue exist & need to change # / get selectlist values ################### } ################ # object CLASS specific parameters ########## ARTICLE if ($obj->class == 'article') { //$obj = init_article(array("id"=>$obj->id), &$smarty); if (!function_exists('smarty_function_init_article')) { require_once $smarty->_get_plugin_filepath('function', 'init_article'); } smarty_function_init_article(array("id" => $obj->id, 'name' => $name), $smarty); return; } elseif ($obj->class == 'document') { if (!function_exists('smarty_function_init_document')) { require_once $smarty->_get_plugin_filepath('function', 'init_document'); } $obj = smarty_function_init_document(array("id" => $obj->id, 'name' => $name), $smarty); return; } elseif ($obj->class == 'image') { if (!function_exists('smarty_function_init_picture')) { require_once $smarty->_get_plugin_filepath('function', 'init_picture'); } $obj = smarty_function_init_picture(array("id" => $obj->id, 'name' => $name), $smarty); return; } elseif ($obj->class == 'section') { $obj->show_toolicons = $obj->all['on_printlink']; $obj->is_mailinglist = $obj->all['on_meilinglist']; $obj->show_subarticles = $obj->all['on_alamartiklid']; $obj->hide_in_menu = $obj->all['on_peida_vmenyy']; $obj->show_date = $obj->all['on_kp_nahtav']; } elseif ($obj->class == 'poll') { $obj->is_open = $obj->all['on_avatud']; $obj->expires = $obj->all['expires'] ? $site->db->MySQL_ee($obj->all['expires']) : ''; $obj->fexpires = $obj->all['expires'] ? $obj->all['expires'] : ''; $obj->is_expired = $obj->all['expires'] && (strtotime($obj->all['expires']) > 0 && strtotime($obj->all['expires']) < time()) ? 1 : 0; #printr(strtotime($obj->all['expires'])); ######### CHECK voting # 1) IP-based gallup if ($site->CONF[gallup_ip_check] == 1) { $sql = $site->db->prepare("SELECT COUNT(gi_id) FROM gallup_ip WHERE objekt_id=? AND ip LIKE ?", $obj->id, $_SERVER["REMOTE_ADDR"]); $sth = new SQL($sql); $count = $sth->fetchsingle(); } else { if ($site->CONF[gallup_ip_check] == 2 && $site->cookie["gallup"][$obj->id] == 1) { $count = 1; } else { if ($site->CONF[gallup_ip_check] == 3) { $sql = $site->db->prepare("SELECT COUNT(gi_id) FROM gallup_ip WHERE objekt_id=? AND user_id=?", $obj->id, $site->user->user_id); $sth = new SQL($sql); # count=1: not logged in users are not allowed to vote: $count = $site->user->user_id ? $sth->fetchsingle() : 1; } else { $count = 0; } } } ######### / CHECK voting ### is_voted: if user is voted this poll or not, 1/0 $obj->is_voted = $count; # not voted ### answers $sql = $site->db->prepare("SELECT * FROM gallup_vastus WHERE objekt_id=?", $obj->id); $sth = new SQL($sql); $site->debug->msg($sth->debug->get_msgs()); $obj->answers = array(); $obj->answers_count = 0; while ($vastus = $sth->fetch()) { unset($tmp); $tmp = new stdClass(); $tmp->id = $vastus[gv_id]; $tmp->answer = $vastus[vastus]; $tmp->title = $vastus[vastus]; $tmp->count = $vastus[count]; $obj->answers[$vastus[gv_id]] = $tmp; $obj->answers_count += $vastus[count]; } ### / answers ### voters (if not anonymous poll) if (!$obj->is_anonymous) { $sql = $site->db->prepare("SELECT gallup_ip.*, users.firstname, users.lastname\r\n\t\t\t\tFROM gallup_ip\r\n\t\t\t\t\tLEFT JOIN users ON users.user_id = gallup_ip.user_id\r\n\t\t\t\tWHERE objekt_id=?", $obj->id); $sth = new SQL($sql); $site->debug->msg($sth->debug->get_msgs()); $obj->voters = array(); while ($vastus = $sth->fetch()) { unset($tmp); $tmp->id = $vastus[gi_id]; $tmp->answer_id = $vastus[gv_id]; $tmp->ip = $vastus[ip]; $tmp->user_id = $vastus[user_id]; $tmp->user_firstname = $vastus[firstname]; $tmp->user_lastname = $vastus[lastname]; $tmp->time = $site->db->MySQL_ee($vastus[vote_time]); $tmp->ftime = $vastus[vote_time]; $obj->voters[$vastus[gi_id]] = $tmp; } } # if not anonymous poll ### / voters } elseif ($obj->class == 'album') { // add album config atributes $conf = new CONFIG($obj->all['ttyyp_params']); $obj->description = $conf->get('desc'); $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" } ########## / ALBUM ############## # assign to template variables $smarty->assign($name, $obj); }
function addlog($filename, $data) { file_put_contents(CONFIG::get('LOGSPATH') . basename2($filename) . '_' . date('Y-m-d') . '.log', "\n" . date(DATE_ISO8601) . ' - ' . var_export($data, true), FILE_APPEND); }