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;
}
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);
}
function save_tyyp_params()
{
    $args = func_get_arg(0);
    $objekt = $args["objekt"];
    $conf = new CONFIG($objekt->all[ttyyp_params]);
    $conf->put("email", $conf->site->fdat['email']);
    if ($conf->site->fdat['email']) {
        $conf->put("on_saada_email", 1);
    } else {
        $conf->put("on_saada_email", 0);
    }
    return $conf->Export();
}
Example #4
0
 private static function gen_key($str)
 {
     if (self::$config == null) {
         self::$config = CONFIG::get('cache');
     }
     return md5($str . self::$config['seed']);
 }
Example #5
0
 /**
  * 路由函数
  * 
  */
 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] : '', '/')));
 }
Example #6
0
 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;
 }
Example #7
0
 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;
 }
Example #8
0
 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');
         }
     }
 }
Example #9
0
 /**
  * 初始化
  */
 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);
         }
     }
 }
Example #10
0
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;
    }
}
Example #11
0
 function Run()
 {
     global $db;
     $time = microtime(true);
     //TODO:
     /*
     $db->Execute("CREATE TABLE `sys_dns_zones` (
       `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
       `farm_id` int(11) DEFAULT NULL,
       `account_id` int(11) DEFAULT NULL,
       `env_id` int(11) DEFAULT NULL,
       `zone_name` varchar(255) DEFAULT NULL,
       `status` varchar(255) DEFAULT NULL,
       `isonnsserver` tinyint(1) DEFAULT '0',
       `iszoneconfigmodified` tinyint(1) DEFAULT '0',
       PRIMARY KEY (`id`),
       UNIQUE KEY `zones_index3945` (`zone_name`),
       KEY `env_id` (`env_id`)
     ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
     ");
     */
     $db->Execute("ALTER TABLE  `services_chef_runlists` ADD  `chef_environment` VARCHAR( 255 ) NULL");
     $db->Execute("ALTER TABLE  `services_chef_servers` ADD  `v_username` VARCHAR( 255 ) NULL , ADD  `v_auth_key` TEXT NULL");
     $db->Execute("CREATE TABLE `servers_stats` (\r\n\t\t\t\t  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t  `usage` int(11) DEFAULT NULL,\r\n\t\t\t\t  `instance_type` varchar(15) DEFAULT NULL,\r\n\t\t\t\t  `env_id` int(11) DEFAULT NULL,\r\n\t\t\t\t  `month` int(2) DEFAULT NULL,\r\n\t\t\t\t  `year` int(4) DEFAULT NULL,\r\n\t\t\t\t  `farm_id` int(11) DEFAULT NULL,\r\n\t\t\t\t  `cloud_location` varchar(25) DEFAULT NULL,\r\n\t\t\t\t  PRIMARY KEY (`id`),\r\n\t\t\t\t  UNIQUE KEY `main` (`instance_type`,`cloud_location`,`farm_id`,`env_id`,`month`,`year`),\r\n\t\t\t\t  KEY `envid` (`env_id`),\r\n\t\t\t\t  KEY `farm_id` (`farm_id`)\r\n\t\t\t\t) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;\r\n\t\t\t");
     $db->Execute("ALTER TABLE  `script_revisions` ADD  `variables` TEXT NULL");
     $dbVersions = $db->Execute("SELECT * FROM script_revisions WHERE `variables` IS NULL");
     while ($version = $dbVersions->FetchRow()) {
         $data = array();
         foreach ((array) Scalr_UI_Controller_Scripts::getCustomVariables($version["script"]) as $var) {
             if (!in_array($var, array_keys(CONFIG::getScriptingBuiltinVariables()))) {
                 $data[$var] = ucwords(str_replace("_", " ", $var));
             }
         }
         $db->Execute("UPDATE script_revisions SET `variables` = ? WHERE id = ?", array(serialize($data), $version['id']));
     }
     $db->Execute("ALTER TABLE  `scalr`.`servers_stats` ADD INDEX  `year` (  `year` )");
     print "Done.\n";
     $t = round(microtime(true) - $time, 2);
     print "Upgrade process took {$t} seconds\n\n\n";
 }
Example #12
0
 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();
 }
Example #13
0
 public static function ___translate($formname, array $array)
 {
     if (isset($array["@attributes"]["account_access_type"])) {
         self::$ACCOUNT[$formname]["access_type"] = $array["@attributes"]["account_access_type"];
     }
     foreach ($array as $key => $value) {
         if (self::startswith(strtolower($key), "field:")) {
             if (CONFIG::has_attribute($value, "name", true)) {
                 $field = $value["@attributes"]["name"];
                 $label = isset($value["@attributes"]["label"]) ? $value["@attributes"]["label"] : $field;
                 $databasefield = isset($value["@attributes"]["databasefield"]) ? $value["@attributes"]["databasefield"] : null;
                 if (preg_match('/:/', $databasefield)) {
                     $databasefield = explode(":", $databasefield);
                     self::$COLUMN[$formname][$field]["table"] = $databasefield[0];
                     self::$COLUMN[$formname][$field]["column"] = $databasefield[1];
                 }
                 self::$LABEL[$formname][$field] = $label;
                 self::$FIELDS[$formname][$field]["name"] = $field;
                 if (isset($value["required:0"])) {
                     self::$REQUIRED["label"][$formname][$field] = $label;
                     foreach ($value["required:0"] as $req_key => $req_value) {
                         if (self::startswith(strtolower($req_key), "is_email:")) {
                             self::$REQUIRED['is_email'][$formname][$field] = true;
                         }
                         if (self::startswith(strtolower($req_key), "length:")) {
                             if (isset($req_value["@attributes"])) {
                                 if (isset($req_value["@attributes"]["min"])) {
                                     self::$REQUIRED['min_length'][$formname][$field] = $req_value["@attributes"]["min"];
                                 }
                                 if (isset($req_value["@attributes"]["max"])) {
                                     self::$REQUIRED['max_length'][$formname][$field] = $req_value["@attributes"]["max"];
                                 }
                             }
                         }
                         if (self::startswith(strtolower($req_key), "must_have:")) {
                             if (isset($req_value["@attributes"])) {
                                 if (isset($req_value["@attributes"]["uppercase"])) {
                                     self::$REQUIRED['must_have'][$formname][$field]['uppercase'] = $req_value["@attributes"]["uppercase"];
                                 }
                                 if (isset($req_value["@attributes"]["lowercase"])) {
                                     self::$REQUIRED['must_have'][$formname][$field]['lowercase'] = $req_value["@attributes"]["lowercase"];
                                 }
                                 if (isset($req_value["@attributes"]["number"])) {
                                     self::$REQUIRED['must_have'][$formname][$field]['number'] = $req_value["@attributes"]["number"];
                                 }
                                 if (isset($req_value["@attributes"]["space"])) {
                                     self::$REQUIRED['must_have'][$formname][$field]['space'] = $req_value["@attributes"]["space"];
                                 }
                                 if (isset($req_value["@attributes"]["non_alpha_numeric"])) {
                                     self::$REQUIRED['must_have'][$formname][$field]['non_alpha_numeric'] = $req_value["@attributes"]["non_alpha_numeric"];
                                 }
                             }
                         }
                         if (self::startswith(strtolower($req_key), "specialcharacters:")) {
                             if (isset($req_value["@attributes"])) {
                                 if (isset($req_value["@attributes"]["can"])) {
                                     self::$REQUIRED['must_have'][$formname][$field]['special']['can'] = $req_value["@attributes"]["can"];
                                 }
                                 if (isset($req_value["@attributes"]["cant"])) {
                                     self::$REQUIRED['must_have'][$formname][$field]['special']['cant'] = $req_value["@attributes"]["cant"];
                                 }
                                 if (isset($req_value["@attributes"]["must"])) {
                                     self::$REQUIRED['must_have'][$formname][$field]['special']['must'] = $req_value["@attributes"]["must"];
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Example #14
0
 public static function getScriptingBuiltinVariables()
 {
     foreach (self::$SCRIPT_BUILTIN_VARIABLES as $k => $v) {
         self::$SCRIPT_BUILTIN_VARIABLES["event_{$k}"] = $v;
     }
     if (!self::$SCRIPT_BUILTIN_VARIABLES_LOADED) {
         $ReflectEVENT_TYPE = new ReflectionClass("EVENT_TYPE");
         $event_types = $ReflectEVENT_TYPE->getConstants();
         foreach ($event_types as $event_type) {
             if (class_exists("{$event_type}Event")) {
                 $ReflectClass = new ReflectionClass("{$event_type}Event");
                 $retval = $ReflectClass->getMethod("GetScriptingVars")->invoke(null);
                 if (!empty($retval)) {
                     foreach ($retval as $k => $v) {
                         if (!CONFIG::$SCRIPT_BUILTIN_VARIABLES[$k]) {
                             CONFIG::$SCRIPT_BUILTIN_VARIABLES[$k] = array("PropName" => $v, "EventName" => "{$event_type}");
                         } else {
                             if (!is_array(CONFIG::$SCRIPT_BUILTIN_VARIABLES[$k]['EventName'])) {
                                 $events = array(CONFIG::$SCRIPT_BUILTIN_VARIABLES[$k]['EventName']);
                             } else {
                                 $events = CONFIG::$SCRIPT_BUILTIN_VARIABLES[$k]['EventName'];
                             }
                             $events[] = $event_type;
                             CONFIG::$SCRIPT_BUILTIN_VARIABLES[$k] = array("PropName" => $v, "EventName" => $events);
                         }
                     }
                 }
             }
         }
         CONFIG::$SCRIPT_BUILTIN_VARIABLES_LOADED = true;
     }
     return CONFIG::$SCRIPT_BUILTIN_VARIABLES;
 }
Example #15
0
<!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>
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';
    }
}
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)));
}
Example #18
0
<?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');
    }
}
 foreach ($conf->CONF as $k => $v) {
     if ($k == "page_end_html") {
         $curr_objekt->all[$k] = str_replace("XXYYZZ", "\n", $v);
     } else {
         $curr_objekt->all[$k] = $v;
     }
 }
 #printr($conf->CONF);
 if ($curr_objekt->all['sys_alias'] == 'home') {
     if ($site->fdat[save] && $curr_objekt && !$site->fdat[lang_swiched]) {
         verify_form_token();
         $site->debug->print_hash($site->fdat, 0, "FDAT");
         new Log(array('action' => 'update', 'component' => 'Admin', 'message' => "Page '{$parent_pagename} > {$pagename}' was updated"));
         $q = "update config set sisu='" . $site->fdat['timezone'] . "' where nimi='time_zone'";
         new SQL($q);
         $conf = new CONFIG($curr_objekt->all['ttyyp_params']);
         $conf->put('site_name', $site->fdat['site_name']);
         $conf->put('slogan', $site->fdat['slogan']);
         $conf->put('page_end_html', eregi_replace("\n", "XXYYZZ", str_replace("\r\n", "XXYYZZ", $site->fdat['page_end_html'])));
         $sql = $site->db->prepare("UPDATE objekt SET meta_title=?, meta_keywords=?, meta_description=?, ttyyp_params=? WHERE objekt_id=?", $site->fdat['meta_title'], $site->fdat['meta_keywords'], $site->fdat['meta_description'], $conf->Export(), $curr_objekt->objekt_id);
         $sth = new SQL($sql);
         $site->debug->msg($sth->debug->get_msgs());
         clear_cache("ALL");
         $curr_objekt = new Objekt(array(objekt_id => $site->alias(array('key' => 'rub_home_id', 'keel' => $keel_id)), no_cache => 1));
         // is this in editor mode?
         if ($site->fdat['keepThis']) {
             $editor_mode = true;
         } else {
             $editor_mode = false;
         }
         // if in editor mode refresh the original window and close the admin-popup
Example #20
0
<?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'] : '';
}
Example #21
0
?>

</form>

<div class="deleting-post">
<?php 
if (!$post->is_deleted()) {
    ?>
  <br />
  <?php 
    if ($post_parent) {
        ?>
    Votes will be transferred to the following parent post.
    If this is incorrect, reparent this post before deleting it.<br />
  <?php 
        if (CONFIG::can_see_post(User::$current, $post_parent)) {
            ?>
    <ul id="post-list-posts"> <?php 
            echo print_preview($post_parent, array('hide_directlink' => true));
            ?>
 </ul>
  <?php 
        } else {
            ?>
    (parent post hidden due to access restrictions)
  <?php 
        }
        ?>

  <?php 
    } else {
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">
					&nbsp;&nbsp;<?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>&nbsp; &nbsp;
									
									</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 = '&nbsp;&nbsp;<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">
		&nbsp;&nbsp;<?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> &nbsp; &nbsp;

					</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">&nbsp;&nbsp;<?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"));
                        ?>
:&nbsp;</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"));
                        ?>
:&nbsp;</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">&nbsp;&nbsp;<?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">
			&nbsp;&nbsp;<?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 .= '&nbsp;&nbsp;' . $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">
	  &nbsp;&nbsp;<?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">
&nbsp; &nbsp;
<?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");
                    ?>
">&nbsp;</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);
}
            }
            $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;
            }
$already = 0;
############ 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") {
Example #25
0
    if ($farminfo["status"] != FARM_STATUS::RUNNING) {
        $result = array("success" => false, "msg" => _("Statistics not available for terminated farm"));
    } else {
        if ($farminfo['clientid'] != 0) {
            define("SCALR_SERVER_TZ", date("T"));
            $env = Scalr_Model::init(Scalr_Model::ENVIRONMENT)->loadById($farminfo['env_id']);
            $tz = $env->getPlatformConfigValue(ENVIRONMENT_SETTINGS::TIMEZONE);
            if ($tz) {
                date_default_timezone_set($tz);
            }
        }
        $graph_info = GetGraphicInfo($graph_type);
        $image_path = APPPATH . "/cache/stats/{$farmid}/{$role_name}.{$watchername}.{$graph_type}.gif";
        $farm_rrddb_dir = CONFIG::$RRD_DB_DIR . "/{$farminfo['id']}";
        $rrddbpath = "{$farm_rrddb_dir}/{$role_name}/{$watchername}/db.rrd";
        CONFIG::$RRD_GRAPH_STORAGE_TYPE = RRD_STORAGE_TYPE::LOCAL_FS;
        if (file_exists($rrddbpath)) {
            try {
                GenerateGraph($farmid, $role_name, $rrddbpath, $watchername, $graph_type, $image_path);
                $url = str_replace(array("%fid%", "%rn%", "%wn%"), array($farmid, $role_name, $watchername), CONFIG::$RRD_STATS_URL);
                $url = "{$url}{$graph_type}.gif";
                $result = array("success" => true, "msg" => $url);
            } catch (Exception $e) {
                $result = array("success" => false, "msg" => $e->getMessage());
            }
        } else {
            $result = array("success" => false, "msg" => _("Statistics not available yet"));
        }
    }
}
print json_encode($result);
Example #26
0
 public static function apply()
 {
     Output\OUTPUT::set_static_file();
     if (self::has_attribute(self::get("primary_database")[0], "alias", true)) {
         CONFIG::$primarydatabase = self::get("primary_database")[0]["@attributes"]["alias"];
     }
     foreach (self::get("rewrite_rules") as $value) {
         REQUEST::translate($value);
     }
     foreach (self::get("links") as $value) {
         self::set_table_links($value);
     }
     if (REQUEST::$is_static == true && !empty(Output\OUTPUT::$static_file)) {
         Output\OUTPUT::static_file();
     }
     if (REQUEST::redirect()) {
         header("Location: " . REQUEST::root() . "/" . REQUEST::redirect_uri());
     }
     foreach (self::get("accounttypes") as $value) {
         ACCOUNT::translate($value);
     }
     foreach (self::get("database") as $value) {
         if (self::has_attribute($value, "alias", true)) {
             $alias = $value["@attributes"]["alias"];
             unset($value["@attributes"]["alias"]);
             $config = $value["@attributes"];
             unset($value["@attributes"]);
             if (!isset($config["tablelinks"]) && isset(self::$table_links[$alias])) {
                 $config["tablelinks"] = self::$table_links[$alias];
             }
             Database\DATABASE::register_database($alias, $config);
             foreach (self::get("table") as $subvalue) {
                 if (!self::find_previous_config("table:", $subvalue) && !empty($subvalue)) {
                     if (isset($value["@attributes"]["database_alias"]) && $value["@attributes"]["database_alias"] == $alias) {
                         self::configure_database($subvalue);
                     }
                 }
             }
         }
     }
     foreach (self::get("form") as $value) {
         if (self::has_attribute($value, "name", true)) {
             FORM::translate($value["@attributes"]["name"], $value);
         }
     }
     foreach (self::get("project") as $value) {
         foreach ($value as $subkey => $subvalue) {
             if (self::startswith(strtolower($subkey), "include:") && self::has_attribute($subvalue, "file", true)) {
                 $file = $subvalue["@attributes"]["file"];
                 if (file_exists(self::$projectdir . "/" . $file . ".php")) {
                     include self::$projectdir . "/" . $file . ".php";
                 }
             }
         }
     }
     ACCOUNT::set_database_config();
     REQUEST::init();
     ACCOUNT::access();
     if (ACCOUNT::redirect()) {
         header("Location: " . REQUEST::root() . "/" . REQUEST::redirect_uri());
     }
     REQUEST::access();
 }
Example #27
0
//引入全局工具文件
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路由
$controller = new controller();
$controller->dispatcher();
/*
 * 术语:
 * modules   组件
Example #28
0
<?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;
}
Example #29
0
<?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');
Example #30
0
    }
    function json_decode($text, $assoc = true)
    {
        global $json;
        return $json->decode($text);
    }
}
// Smarty init
if (!defined("NO_TEMPLATES")) {
    $Smarty = Core::GetSmartyInstance();
    $Smarty->caching = false;
}
// PHPSmartyMailer init
$Mailer = Core::GetPHPSmartyMailerInstance();
$Mailer->From = CONFIG::$EMAIL_ADDRESS;
$Mailer->FromName = CONFIG::$EMAIL_NAME;
$Mailer->CharSet = "UTF-8";
//TODO: Move all timeouts to config UI.
CONFIG::$HTTP_PROTO = CONFIG::$HTTP_PROTO ? CONFIG::$HTTP_PROTO : "http";
// cache lifetime
CONFIG::$EVENTS_RSS_CACHE_LIFETIME = 300;
// in seconds
CONFIG::$EVENTS_TIMELINE_CACHE_LIFETIME = 300;
// in seconds
CONFIG::$AJAX_PROCESSLIST_CACHE_LIFETIME = 120;
// in seconds
CONFIG::$SYSDNS_SYSTEM = 0;
// Require observer interfaces
require_once APPPATH . '/observers/interface.IDeferredEventObserver.php';
require_once APPPATH . '/observers/interface.IEventObserver.php';
require_once SRCPATH . '/class.Scalr.php';