<?php
if (adminaccess('content') || adminaccess('article') || adminaccess('news') || adminaccess('links') || adminaccess('download')) {
if (isset($_REQUEST['contentid']) && intval($_REQUEST['contentid'])>0) $contentinfo=$DB->fetch_array($DB->query(SELECT * FROM .$db_tab['content']. WHERE content_id='.$_REQUEST['contentid'].'));
else $contentinfo['content_id']='new';
if (isset($_REQUEST['step'])) $step=$_REQUEST['step'];
if (isset($_POST['action'])) $ACTION=$_POST['action'];
else $ACTION='view';
if ($ACTION==$_POST['back'] && $step>1) {$step--; header(location: admin.php?path=content/compose.php&step=.$step.&type=.$_POST['type'].&catid=.$_POST['catid'].&contentid=.$contentinfo['content_id'].&PHPKITSID=.session_id()); exit();}
elseif ($ACTION==$_POST['cancel'] || $ACTION==$_POST['back']) {header(location: admin.php?path=content/history.php&PHPKITSID=.session_id()); exit();}
if ($step==4) {
if ($ACTION==$_POST['finish']) {
if (is_array($_POST['content_related']) && $_POST['content_related'][0]!= -1) $content_related='-'.implode('-',$_POST['content_related']).'-';
else unset($content_related);
if (adminaccess('contfree')) $alterstatus=, content_status='.$_POST['cont_status'].';
else unset($alterstatus);
$DB->query(UPDATE .$db_tab['content']. SET content_teaser='.$_POST['cont_teaser'].', content_related='.$content_related.' .$alterstatus. WHERE content_id='.$_POST['contentid'].');
if (intval($_POST['selectcat'])>0) {header(location: admin.php?path=editnavlink.php&selectcat=.$_POST['selectcat'].&contentid=.$_POST['contentid'].&title=.urlencode($contentinfo['content_title']).&PHPKITSID=.session_id()); exit();}
header(location: admin.php?path=content/history.php&PHPKITSID=.session_id()); exit();
}
$contentid=$contentinfo['content_id'];
$cont_title=$contentinfo['content_title'];
$cont_teaser=$contentinfo['content_teaser'];
$cont_related=$contentinfo['content_related'];
if ($contentinfo['content_status']==1) $status1=' checked';
else $status0=' checked';
$navigationinfo=$DB->fetch_array($DB->query(SELECT * FROM .$db_tab['navigation']. WHERE navigation_link LIKE->%contentid=.$contentid.%' OR navigation_title LIKE->%contentid=.$contentid.%' LIMIT 1));
$getcat=$DB->query(SELECT * FROM .$db_tab['navigationcat']. WHERE navigationcat_box='' ORDER BY navigationcat_order ASC);
while ($cat=$DB->fetch_array($getcat)) {
if ($navigationinfo['navigation_cat']==$cat['navigationcat_id']) eval (\$linkinfo= \.templateinclude(content/compose_step4_linkinfo).\;);
$link_cats.='<option value='.$cat['navigationcat_id'].'>'.$cat['navigationcat_title'].'</option>';
}
if ($contentinfo['content_option']==1 || $contentinfo['content_option']==4) {
$getcontentinfo=$DB->query(SELECT content_id, content_title, content_option, content_status FROM .$db_tab['content']. WHERE content_id!='.$contentid.' ORDER by content_title ASC);
while ($contentinfo=$DB->fetch_array($getcontentinfo)) {
unset($selected);
if (strstr($cont_related,'-'.$contentinfo['content_id'].'-')) {
$related_info.='<a target=_blank href=admin.php?path=content/compose.php&contentid='.$contentinfo['content_id'].'>'.$contentinfo['content_title'].'</a><br />';
$selected=' selected';
}
$content_title=$contentinfo['content_title'];
if ($contentinfo['content_option']==1) $content_title.=' ('.$lang['article'].')';
elseif ($contentinfo['content_option']==2) $content_title.=' ('.$lang['news'].')';
elseif ($contentinfo['content_option']==3) $content_title.=' ('.$lang['link'].')';
elseif ($contentinfo['content_option']==4) $content_title.=' ('.$lang['download'].')';
else $content_title.=' ('.$lang['content'].')';
if ($contentinfo['content_status']!=1) $content_title.=' -->.$lang['disabled'];
$related_option.='<option value='.$contentinfo['content_id'].''.$selected.'>'.$content_title.'</option>';
}
eval (\$content_relations= \.templateinclude(content/compose_step4_relations).\;);
}
}
elseif ($step==3) {
if ($ACTION==$_POST['save'] || $ACTION==$_POST['next']) {
if ($_POST['cont_delete']==1) {header(location: admin.php?path=content/delete.php&contentid=.$_POST['contentid'].&PHPKITSID=.session_id()); exit();}
$cont_autor=$_POST['cont_autor'];
$userinfo=$DB->fetch_array($DB->query(SELECT user_id FROM .$db_tab['user']. WHERE user_nick='.$cont_autor.'));
$cont_autorid=$userinfo['user_id'];
$cont_cat=$_POST['catid'];
$cont_type=$_POST['type'];
$cont_title=addslashes($_POST['cont_title']);
$cont_text=addslashes($_POST['content']);
$cont_altdat=addslashes($_POST['cont_altdat']);
$cont_time=mktime($_POST['cont_time_h'],$_POST['cont_time_mm'],0,$_POST['cont_time_m'],$_POST['cont_time_d'],$_POST['cont_time_y']);
$cont_expire=mktime($_POST['cont_expire_h'],$_POST['cont_expire_mm'],0,$_POST['cont_expire_m'],$_POST['cont_expire_d'],$_POST['cont_expire_y']);
if ($cont_time<0 || $_POST['reset_time']==1) $cont_time=time();
if ($cont_expire<0) $cont_expire=0;
if (adminaccess('contfree')) $alterstatus=, content_status='.$_POST['cont_status'].';
else unset($alterstatus);
if ($_POST['cont_themeid']=='new' && trim($_POST['newtheme_title'])!='' && adminaccess('contentcat')) {
$DB->query(INSERT INTO .$db_tab['contenttheme']. (contenttheme_catid, contenttheme_name) VALUES ('.$cont_cat.','.$_POST['newtheme_title'].'));
$cont_themeid=$DB->insert_id();
}
else $cont_themeid=intval($_POST['cont_themeid']);
if ($_POST['contentid']=='new' || $_POST['cont_duplicate']==1) {
$DB->query(INSERT INTO .$db_tab['content']. (content_title) VALUES ('new'));
$contentid=$DB->insert_id();
}
else $contentid=intval($_POST['contentid']);
if ($_POST['reset_counter']==1) $sqlcommand=,content_views=0, content_rating=0, content_rating_total=0;
else unset($sqlcommand);
$DB->query(UPDATE .$db_tab['content']. SET content_time='.$cont_time.',content_expire='.$cont_expire.',content_title='.$cont_title.',content_autor='.$cont_autor.',content_autorid='.$cont_autorid.',content_cat='.$cont_cat.',content_option='.$cont_type.',content_text='.$cont_text.',content_altdat='.$cont_altdat.',content_html='.$_POST['cont_html'].',content_ubb='.$_POST['cont_ubb'].',content_smilies='.$_POST['cont_smilies'].',content_rating_status='.$_POST['cont_rating'].',content_comment_status='.$_POST['cont_comment'].',content_themeid='.$cont_themeid.',content_filesize='.$_POST['cont_filesize'].' .$alterstatus. .$sqlcommand. WHERE content_id='.$contentid.');
if ($ACTION==$_POST['next']) $to=4;
else $to=3;
header(location: admin.php?path=content/compose.php&step=.$to.&contentid=.$contentid.&PHPKITSID=.session_id()); exit();
}
$contentid=$_REQUEST['contentid'];
if ($_REQUEST['catid']!='') $catid=$_REQUEST['catid'];
else $catid=$contentinfo['content_cat'];
if ($_REQUEST['type']!='') $type=$_REQUEST['type'];
else $type=$contentinfo['content_option'];
if ($contentinfo['content_time']>0) $time=$contentinfo['content_time'];
else $time=time();
$content_time_d=date(d,$time);
$content_time_m=date(m,$time);
$content_time_y=date(Y,$time);
$content_time_h=date(H,$time);
$content_time_mm=date(i,$time);
if ($contentinfo!='' && $contentinfo['content_id']!='new') {
$cont_autor=htmlentities($contentinfo['content_autor']);
$cont_title=htmlentities($contentinfo['content_title']);
$content_text=htmlentities($contentinfo['content_text']);
$content_altdat=htmlentities($contentinfo['content_altdat']);
if ($contentinfo['content_html']==1) $option1= checked;
if ($contentinfo['content_ubb']==1) $option2= checked;
if ($contentinfo['content_smilies']==1) $option3= checked;
if ($contentinfo['content_rating_status']==1) $option4= checked;
if ($contentinfo['content_comment_status']==1) $option5= checked;
if ($contentinfo['content_status']==1) $option6= checked;
if ($contentinfo['content_expire']>0) {
$time=$contentinfo['content_expire'];
$content_expire_d=date(d,$time);
$content_expire_m=date(m,$time);
$content_expire_y=date(Y,$time);
$content_expire_h=date(H,$time);
$content_expire_mm=date(i,$time);
}
eval (\$ext_option= \.templateinclude(content/compose_step3_extoption).\;);
}
else {
$cont_autor=$USER['nick'];
$option1= checked;
$option2= checked;
$option3= checked;
$option4= checked;
$option5= checked;
if (adminaccess('contfree')) $option6= checked;
if ($type==3) $content_altdat='[url]http://';[/url]
}
$getthemes=$DB->query(SELECT * FROM .$db_tab['contenttheme']. WHERE contenttheme_catid='.$catid.' ORDER BY contenttheme_name ASC);
while ($theme=$DB->fetch_array($getthemes)) {
$theme_option.='<option value='.$theme['contenttheme_id'].'';
if ($theme['contenttheme_id']==$contentinfo['content_themeid']) $theme_option.=' selected';
$theme_option.='>'.$theme['contenttheme_name'].'</option>';
}
$smilies=new smilies();
$format_smilies=$smilies->getSmilies(1,1);
eval (\$compose_bbcode= \.templateinclude(content/compose_step3_bbcode).\;);
eval (\$content_body= \.templateinclude(content/compose_step3_.$type.).\;);
}
elseif ($step==2) {
if (isset($_POST['content_cat']) && intval($_POST['content_cat'])>0) {header(location: admin.php?path=content/compose.php&step=3&type=.$_POST['content_type'].&catid=.$_POST['content_cat'].&contentid=.$contentinfo['content_id'].&PHPKITSID=.session_id()); exit();}
elseif ($ACTION!='view' && intval($_POST['content_cat'])<=0) {header(location: admin.php?path=content/compose.php&step=2&type=.$_POST['content_type'].&catid=.$_POST['content_cat'].&contentid=.$contentinfo['content_id'].&PHPKITSID=.session_id()); exit();}
unset($cat_option);
if ($_REQUEST['type']!='') $content_type=intval($_REQUEST['type']);
else $content_type=$contentinfo['content_option'];
$selecttype=' contentcat_type'.$content_type.'=1';
$getcat=$DB->query(SELECT contentcat_id, contentcat_name FROM .$db_tab['contentcat']. WHERE .$selecttype. ORDER by contentcat_name ASC);
while ($cat=$DB->fetch_array($getcat)) {
$cat_option.='<option value='.$cat['contentcat_id'].'';
if ($cat['contentcat_id']==$contentinfo['content_cat']) $cat_option.=' selected';
$cat_option.='>'.$cat['contentcat_name'].'</option>';
}
if (!$cat_option) eval (\$step2_info= \.templateinclude(content/compose_step2_info).\;);
}
else {
if (isset($_POST['content_type']) && intval($_POST['content_type'])<6 && intval($_POST['content_type'])>='0') {header(location: admin.php?path=content/compose.php&step=2&type=.$_POST['content_type'].&contentid=.$contentinfo['content_id'].&PHPKISID=.session_id()); exit();}
$step=1;
if ($contentinfo['content_option']==1) $option_type1= selected;
elseif ($contentinfo['content_option']==2) $option_type2= selected;
elseif ($contentinfo['content_option']==3) $option_type3= selected;
elseif ($contentinfo['content_option']==4) $option_type4= selected;
else $option_type0= selected;
}
if ($step==4) eval (\$nav_button= \.templateinclude(content/compose_navigation_finishbutton).\;);
else eval (\$nav_button= \.templateinclude(content/compose_navigation_nextbutton).\;);
eval (\$compose_navigation= \.templateinclude(content/compose_navigation).\;);
eval (\$site_body.= \.templateinclude(content/compose_step.$step.).\;);
}
else {header (location: index.php?PHPKITSID=.session_id()); exit();}
?>