assign("charset",trans("codepage")); /* E: keelevärk */ /* S: c o n t e n t m o d i f y */ if(intval($_POST[edit_id])>>0) { if($_POST[act] == "salvesta") { if($_POST[editor_hide]=="1") { sql("update ".PREFIX."content set editor_hide='1' where id=".$_POST[edit_newid]); } else { sql("update ".PREFIX."content set editor_hide='' where id=".$_POST[edit_newid]); } if(strstr($_POST[edit_sisu],"#skript/")) { $parse = 1; } else { $parse = 0; } sql("update ".PREFIX."content set link='".$_POST[edit_link]."', caption='".$_POST[edit_pealkiri]."', content='".$_POST[edit_sisu]."', module='".$_POST[edit_module]."', template='".$_POST[edit_template]."', id='".$_POST[edit_newid]."', parse=".$parse." where id=".$_POST[edit_id]); unset($parse); red("?".$edit_newid); } if($_POST[act] == "kustuta") { sql("delete from ".PREFIX."content where id=".$_POST[edit_id]); red("."); } } /* E: c o n t e n t m o d i f y */ /* S: k e e l t e l i s t */ $result = sql("select distinct(keel) as keel from ".PREFIX."content"); while($row=arr($result)) { /* keel */ $xtpl->assign("keel",$row[keel]); /* pildid */ if(@file_exists("images/flag_".$row[keel].".gif")) { $xtpl->assign("keel_i",$row[keel]); } else { $xtpl->assign("keel_i","muu"); } /* keele caption - bold */ if($row[keel] == $_SESSION["keel"]) { $xtpl->assign("keel_t","".$row[keel].""); } else { $xtpl->assign("keel_t",$row[keel]); } $xtpl->parse("main.keel_list"); } /* E: k e e l t e l i s t */ /* S: l e h t e d e l i s t */ $result = sql("select * from ".PREFIX."content where keel='".$_SESSION["keel"]."' order by caption asc"); while($row=arr($result)) { $xtpl->assign("item_id",$row[id]); $xtpl->assign("item",$row[caption]); $xtpl->parse("main.page_list"); } /* E: l e h t e d e l i s t */ /* S: c o n t e n t e d i t o r */ if(defined("ID")) { if(intval(ID)>0) { $result = sql("select * from ".PREFIX."content where id = '".ID."' LIMIT 1"); $row = arr($result); $xtpl->assign("edit_id",$row[id]); $xtpl->assign("edit_pealkiri",$row[caption]); $xtpl->assign("edit_sisu",$row[content]); $xtpl->assign("edit_link",$row[link]); $kat=opendir("../modules/"); while($moodulid=readdir($kat)) { $laiend=explode(".", $moodulid); $mod=explode("_", $moodulid); $nimi=explode(".", $mod[1]); if($laiend[1] == "php" and $mod[0] == "mod" and $laiend[2] != "bak") { if($nimi[0]==$row[module]) { $xtpl->assign("edit_module_sel"," SELECTED"); } else { $xtpl->assign("edit_module_sel",""); } $xtpl->assign("edit_module_name",$nimi[0]); $xtpl->parse("main.edit_page.edit_modules"); } } closedir($kat); unset($nimi, $kat, $moodulid); $kat=opendir("../template/"); while($templated=readdir($kat)) { $laiend=explode(".", $templated); $nimi=$laiend[0]; if($laiend[1] == "html" and $laiend[2] != "bak") { $templates[] = $nimi; } } sort($templates); foreach($templates as $nimi) { if($nimi==$row[template]) { $xtpl->assign("edit_template_sel"," SELECTED style=\"color:red\""); } else { $xtpl->assign("edit_template_sel",""); } $xtpl->assign("edit_template_name",$nimi); $xtpl->parse("main.edit_page.edit_templates"); } closedir($kat); unset($nimi, $kat, $moodulid); if($row["editor_hide"]=="1") { $xtpl->assign("editor_hide","CHECKED"); $xtpl->parse("main.edit_page.noeditor"); } else { $xtpl->parse("main.edit_page.editor"); } if($row[module]=="0") { $module = false; } else { if(@file_exists("modules/mod_".$row[module].".php")) { $module = true; } else { $module = false; } } if(!$module) { $xtpl->assign("edit_height","400"); } else { ob_start(); include("modules/mod_".$row[module].".php"); $module_content=ob_get_contents(); ob_end_clean(); $xtpl->assign("module_content",$module_content); $xtpl->assign("edit_height","250"); $xtpl->parse("main.module"); unset($module_content); } $xtpl->parse("main.editor_script"); $xtpl->parse("main.edit_page"); unset($module); } else { if(@file_exists("modules/adm_".ID.".php")) { ob_start(); include("modules/adm_".ID.".php"); $module_content=ob_get_contents(); ob_end_clean(); $xtpl->assign("module_content",$module_content); $xtpl->parse("main.module"); unset($module_content); } } } else { if(@file_exists("modules/txt_intro.php")) { ob_start(); include("modules/txt_intro.php"); $module_content=ob_get_contents(); ob_end_clean(); $xtpl->assign("module_content",$module_content); $xtpl->parse("main.module"); unset($module_content); } } /* E: c o n t e n t e d i t o r */ $xtpl->parse("main"); $xtpl->out("main"); #display debug info :P $xtpl->assign("debug",$debug); $xtpl->parse("debug"); #$xtpl->out("debug"); ?>