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(); }
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; }
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 if ($editor_mode && $site->fdat['op'] == 'saveclose') {
if ($fpc_result === false) { echo '<font color=red>Error: could not create file: ' . $document_folder_path . '/' . $file['fail'] . ', check filesystem permissions.</font>'; exit; } $sql = $site->db->prepare("delete from obj_dokument where objekt_id = ?", $file['objekt_id']); new SQL($sql); $sql = $site->db->prepare("delete from document_parts where objekt_id = ?", $file['objekt_id']); new SQL($sql); $sql = $site->db->prepare("update objekt_objekt set parent_id = ? where objekt_id = ?", $folder_id, $file['objekt_id']); new SQL($sql); $sql = $site->db->prepare("update objekt set tyyp_id = 21 where objekt_id = ?", $file['objekt_id']); new SQL($sql); $sql = $site->db->prepare("insert into obj_file (objekt_id, relative_path, filename, size) values (?, ?, ?, ?)", $file['objekt_id'], '/' . $document_folder_path . '/' . $file['fail'], $file['fail'], $file['size']); new SQL($sql); } $conf->put('folder', $document_folder_path); $sql = $site->db->prepare("UPDATE objekt SET ttyyp_params = ? WHERE objekt_id=?", $conf->Export(), $document['objekt_id']); new SQL($sql); } else { echo '<font color=red>Error: could not create folder: ' . $document_folder_path . ', check filesystem permissions.</font>'; exit; } } } // convert existing event objects to articles // create article profile for events $sql = "insert into object_profiles (name, data, source_table) values ('converted_event', '" . 'a:6:{s:6:"author";a:9:{s:4:"name";s:6:"author";s:4:"type";s:4:"TEXT";s:13:"source_object";s:0:"";s:13:"default_value";s:0:"";s:7:"db_type";s:7:"varchar";s:11:"is_required";i:0;s:9:"is_active";i:1;s:13:"is_predefined";i:1;s:10:"is_general";i:1;}s:3:"aeg";a:9:{s:4:"name";s:3:"aeg";s:4:"type";s:8:"DATETIME";s:13:"source_object";s:0:"";s:13:"default_value";s:0:"";s:7:"db_type";s:8:"datetime";s:11:"is_required";i:0;s:9:"is_active";i:1;s:13:"is_predefined";i:1;s:10:"is_general";i:1;}s:18:"avaldamisaeg_algus";a:9:{s:4:"name";s:18:"avaldamisaeg_algus";s:4:"type";s:8:"DATETIME";s:13:"source_object";s:0:"";s:13:"default_value";s:0:"";s:7:"db_type";s:8:"datetime";s:11:"is_required";i:0;s:9:"is_active";i:1;s:13:"is_predefined";i:1;s:10:"is_general";i:1;}s:17:"avaldamisaeg_lopp";a:9:{s:4:"name";s:17:"avaldamisaeg_lopp";s:4:"type";s:8:"DATETIME";s:13:"source_object";s:0:"";s:13:"default_value";s:0:"";s:7:"db_type";s:8:"datetime";s:11:"is_required";i:0;s:9:"is_active";i:1;s:13:"is_predefined";i:1;s:10:"is_general";i:1;}s:9:"starttime";a:9:{s:4:"name";s:9:"starttime";s:4:"type";s:8:"DATETIME";s:13:"source_object";s:0:"";s:13:"default_value";s:0:"";s:7:"db_type";s:8:"datetime";s:11:"is_required";i:0;s:9:"is_active";i:1;s:13:"is_predefined";i:0;s:10:"is_general";i:0;}s:7:"endtime";a:9:{s:4:"name";s:7:"endtime";s:4:"type";s:8:"DATETIME";s:13:"source_object";s:0:"";s:13:"default_value";s:0:"";s:7:"db_type";s:8:"datetime";s:11:"is_required";i:0;s:9:"is_active";i:1;s:13:"is_predefined";i:0;s:10:"is_general";i:0;}}' . "', 'obj_artikkel')"; $result = new SQL($sql); $events_profile_id = $result->insert_id; // create data columns (existance check?) $sql = "alter table `obj_artikkel` add column `starttime` datetime NULL after `profile_id`, add column `endtime` datetime NULL after `starttime`;";
function save_tyyp_params() { global $site; $args = func_get_arg(0); $objekt = $args["objekt"]; $conf = new CONFIG($objekt->all[ttyyp_params]); $conf->put("cols", $site->fdat[cols]); $conf->put("rows", $site->fdat[rows]); $conf->put('path', $site->fdat['path']); $conf->put('tn_size', $site->fdat['tn_size']); $conf->put('desc', $site->fdat['desc']); $conf->put('pic_size', $site->fdat['pic_size']); // get the folder ID $sql = $site->db->prepare('select objekt_id from obj_folder where relative_path = ?', '/' . $site->fdat['path']); $result = new SQL($sql); $conf->put('folder_id', $result->fetchsingle()); return $conf->Export(); }
function save_tyyp_params() { global $site; $args = func_get_arg(0); $objekt = $args["objekt"]; $conf = new CONFIG($objekt->all[ttyyp_params]); $conf->put("src_file", $site->fdat[src_file] ? $site->fdat[src_file] : $site->fdat[predefined]); $conf->put("predefined", $site->fdat[predefined]); $conf->put("height", $site->fdat[height] ? $site->fdat[height] : "150"); return $conf->Export(); }
global $site; global $class_path; preg_match('/\\/(admin|editor)\\//i', $_SERVER["REQUEST_URI"], $matches); $class_path = $matches[1] == 'editor' ? '../classes/' : './classes/'; include_once $class_path . 'port.inc.php'; $site = new Site(array('on_debug' => 0)); /*--------------------------- Code Begin ------------------------------------------*/ // add default values for $site_title and $site_slogan for all active languages $sql = "select keel_id from keel where on_kasutusel = 1"; $result = new SQL($sql); while ($row = $result->fetch('ASSOC')) { $curr_objekt = new Objekt(array('objekt_id' => $site->alias(array('key' => 'rub_home_id', 'keel' => $row['keel_id'])), 'parent_id' => 0, 'no_cache' => 1)); $conf = new CONFIG($curr_objekt->all['ttyyp_params']); if ($curr_objekt->all['sys_alias'] == 'home') { $conf = new CONFIG($curr_objekt->all['ttyyp_params']); $conf->put('site_name', 'ShowTime'); $conf->put('slogan', 'Saurus CMS out-of-the-box experience'); $sql = $site->db->prepare("UPDATE objekt SET ttyyp_params=? WHERE objekt_id=?", $conf->Export(), $curr_objekt->objekt_id); $sth = new SQL($sql); } } // add timezone support to the CMS. //We start by checking if there is not already a table by the name of 'ext_timezones'. $sql = "SHOW TABLES LIKE 'ext_timezones'"; $result = new SQL($sql); if ($result->rows >= 1) { echo "<br><font color=red>You already have a table called 'ext_timezones' in your database.</font>"; } else { //We create the table. $create_sql = "\nCREATE TABLE ext_timezones (\n id int(10) unsigned NOT NULL auto_increment,\n profile_id int(4) unsigned NOT NULL default '0',\n name varchar(255) default NULL,\n UTC_dif float(7,2) default NULL,\n php_variable varchar(255) default NULL,\n PRIMARY KEY (id)\n) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=latin1\n"; $create_result = new SQL($create_sql);