mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
content: more code improvements and optimization, preview of content item improved
This commit is contained in:
@@ -12,8 +12,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/content.php,v $
|
||||
| $Revision: 1.11 $
|
||||
| $Date: 2007-04-12 21:35:00 $
|
||||
| $Revision: 1.12 $
|
||||
| $Date: 2007-04-13 10:05:45 $
|
||||
| $Author: lisa_ $
|
||||
+---------------------------------------------------------------+
|
||||
*/
|
||||
@@ -501,6 +501,7 @@ function show_content_recent(){
|
||||
return;
|
||||
}
|
||||
$content_icon_path = $tp -> replaceConstants($content_pref["content_icon_path"]);
|
||||
$crumbarray = $aa -> getCategoryTree("", intval($mainparent), TRUE);
|
||||
$array = $aa -> getCategoryTree("", intval($qs[1]), TRUE);
|
||||
$validparent = implode(",", array_keys($array));
|
||||
$order = $aa -> getOrder();
|
||||
@@ -514,7 +515,7 @@ function show_content_recent(){
|
||||
|
||||
$recentqry = "content_refer !='sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ".$order." ".$nextprevquery;
|
||||
$np = $aa->ShowNextPrev("", $from, $number, $contenttotal,true);
|
||||
$text = $aa->getCrumbPage("recent", $array, $mainparent);
|
||||
$text = $aa->getCrumbPage("recent", $crumbarray, $mainparent);
|
||||
$text .= displayPreview($recentqry, $np, $array);
|
||||
|
||||
$caption = $content_pref['content_list_caption'];
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -12,28 +12,27 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/handlers/content_db_class.php,v $
|
||||
| $Revision: 1.7 $
|
||||
| $Date: 2007-04-12 21:35:00 $
|
||||
| $Revision: 1.8 $
|
||||
| $Date: 2007-04-13 10:05:45 $
|
||||
| $Author: lisa_ $
|
||||
+---------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
$plugindir = e_PLUGIN."content/";
|
||||
$plugintable = "pcontent"; //name of the table used in this plugin (never remove this, as it's being used throughout the plugin !!)
|
||||
$datequery = " AND content_datestamp < ".time()." AND (content_enddate=0 || content_enddate>".time().") ";
|
||||
|
||||
if (!defined('ADMIN_WIDTH')) { define("ADMIN_WIDTH", "width:98%;"); }
|
||||
|
||||
$plugindir = e_PLUGIN."content/";
|
||||
$plugintable = "pcontent";
|
||||
$datequery = " AND content_datestamp < ".time()." AND (content_enddate=0 || content_enddate>".time().") ";
|
||||
|
||||
//icon, file, image upload
|
||||
if(isset($_POST['uploadfile'])){
|
||||
|
||||
if($_POST['uploadtype']){
|
||||
$pref['upload_storagetype'] = "1";
|
||||
require_once(e_HANDLER."upload_handler.php");
|
||||
$mainparent = $aa -> getMainParent(intval($_POST['parent1']));
|
||||
$content_pref = $aa -> getContentPref($mainparent);
|
||||
$mainparent = $aa -> getMainParent(intval($_POST['parent1']));
|
||||
$content_pref = $aa -> getContentPref($mainparent);
|
||||
|
||||
if($_POST['content_id']){
|
||||
$newpid = $_POST['content_id'];
|
||||
@@ -47,12 +46,12 @@ if(isset($_POST['uploadfile'])){
|
||||
//icon
|
||||
if($_POST['uploadtype'] == "1"){
|
||||
$pref['upload_storagetype'] = "1";
|
||||
$pathtmp = $_POST['tmppathicon'];
|
||||
$uploaded = file_upload($pathtmp);
|
||||
$pathtmp = $_POST['tmppathicon'];
|
||||
$uploaded = file_upload($pathtmp);
|
||||
$new = "";
|
||||
if($uploaded){
|
||||
$uporg = $uploaded[0]['name'];
|
||||
$resize = varsettrue($content_pref["content_upload_icon_size"],"100");
|
||||
$uporg = $uploaded[0]['name'];
|
||||
$resize = varsettrue($content_pref["content_upload_icon_size"],"100");
|
||||
if($uporg){
|
||||
$new = $newpid."_".$uporg;
|
||||
rename($pathtmp.$uporg, $pathtmp.$new);
|
||||
@@ -65,11 +64,11 @@ if(isset($_POST['uploadfile'])){
|
||||
//file
|
||||
}elseif($_POST['uploadtype'] == "2"){
|
||||
$pref['upload_storagetype'] = "1";
|
||||
$pathtmp = $_POST['tmppathfile'];
|
||||
$uploaded = file_upload($pathtmp);
|
||||
$pathtmp = $_POST['tmppathfile'];
|
||||
$uploaded = file_upload($pathtmp);
|
||||
$new = "";
|
||||
if($uploaded){
|
||||
$uporg = $uploaded[0]['name'];
|
||||
$uporg = $uploaded[0]['name'];
|
||||
if($uporg){
|
||||
$new = $newpid."_".$uporg;
|
||||
rename($pathtmp.$uporg, $pathtmp.$new);
|
||||
@@ -80,13 +79,13 @@ if(isset($_POST['uploadfile'])){
|
||||
//image
|
||||
}elseif($_POST['uploadtype'] == "3"){
|
||||
$pref['upload_storagetype'] = "1";
|
||||
$pathtmp = $_POST['tmppathimage'];
|
||||
$uploaded = file_upload($pathtmp);
|
||||
$pathtmp = $_POST['tmppathimage'];
|
||||
$uploaded = file_upload($pathtmp);
|
||||
$new = "";
|
||||
if($uploaded){
|
||||
$uporg = $uploaded[0]['name'];
|
||||
$resize = varsettrue($content_pref["content_upload_image_size"],"500");
|
||||
$resizethumb = varsettrue($content_pref["content_upload_image_size_thumb"],"100");
|
||||
$uporg = $uploaded[0]['name'];
|
||||
$resize = varsettrue($content_pref["content_upload_image_size"],"500");
|
||||
$resizethumb = varsettrue($content_pref["content_upload_image_size_thumb"],"100");
|
||||
if($uporg){
|
||||
$new = $newpid."_".$uporg;
|
||||
rename($pathtmp.$uporg, $pathtmp.$new);
|
||||
@@ -101,66 +100,57 @@ if(isset($_POST['uploadfile'])){
|
||||
|
||||
class contentdb{
|
||||
|
||||
//function dbContentUpdate($mode, $type){
|
||||
function dbContent($mode, $type){
|
||||
//$mode : create or update
|
||||
//$type : none(=admin), submit, contentmanager
|
||||
global $pref, $qs, $sql, $ns, $rs, $aa, $tp, $plugintable, $e107cache, $eArrayStorage, $e_event;
|
||||
//function dbContent: create/update a content item
|
||||
//$mode : create or update
|
||||
//$type : none(=admin), submit, contentmanager
|
||||
function dbContent($mode, $type){
|
||||
global $pref, $qs, $sql, $ns, $rs, $aa, $tp, $plugintable, $e107cache, $eArrayStorage, $e_event;
|
||||
|
||||
$_POST['content_heading'] = $tp -> toDB(trim($_POST['content_heading']));
|
||||
$_POST['content_subheading'] = $tp -> toDB($_POST['content_subheading']);
|
||||
$_POST['content_summary'] = $tp -> toDB($_POST['content_summary']);
|
||||
$_POST['content_heading'] = $tp -> toDB(trim($_POST['content_heading']));
|
||||
$_POST['content_subheading'] = $tp -> toDB($_POST['content_subheading']);
|
||||
$_POST['content_summary'] = $tp -> toDB($_POST['content_summary']);
|
||||
if(e_WYSIWYG){
|
||||
$_POST['content_text'] = $tp->createConstants($_POST['content_text']); // convert e107_images/ to {e_IMAGE} etc.
|
||||
}
|
||||
//the problem with tiny_mce is it's storing e_HTTP with an image path, while it should only use the {e_xxx} variables
|
||||
//this small check resolves this, and stores the paths correctly
|
||||
if(strstr($_POST['content_text'],e_HTTP."{e_")){
|
||||
$_POST['content_text'] = str_replace(e_HTTP."{e_", "{e_", $_POST['content_text']);
|
||||
}
|
||||
$_POST['content_text'] = $tp -> toDB($_POST['content_text']);
|
||||
$_POST['content_class'] = ($_POST['content_class'] ? intval($_POST['content_class']) : "0");
|
||||
$_POST['content_meta'] = $tp -> toDB($_POST['content_meta']);
|
||||
|
||||
if(e_WYSIWYG){
|
||||
$_POST['content_text'] = $tp->createConstants($_POST['content_text']); // convert e107_images/ to {e_IMAGE} etc.
|
||||
//content create
|
||||
if( isset($qs[0]) && $qs[0]=='content' && isset($qs[1]) && ($qs[1]=='create' || $qs[1]=='submit') && isset($qs[2]) && is_numeric($qs[2]) ){
|
||||
$parent = intval($_POST['parent1']);
|
||||
|
||||
//content edit
|
||||
}elseif( isset($qs[0]) && $qs[0]=='content' && isset($qs[1]) && ($qs[1]=='edit' || $qs[1]=='sa') && isset($qs[2]) && is_numeric($qs[2]) ){
|
||||
if( isset($_POST['parent1']) && strpos($_POST['parent1'], ".") ){
|
||||
$tmp = explode(".", $_POST['parent1']);
|
||||
$parent = $tmp[1];
|
||||
}else{
|
||||
$parent = $_POST['parent1'];
|
||||
}
|
||||
//the problem with tiny_mce is it's storing e_HTTP with an image path, while it should only use the {e_xxx} variables
|
||||
//this small check resolves this, and stores the paths correctly
|
||||
if(strstr($_POST['content_text'],e_HTTP."{e_")){
|
||||
$_POST['content_text'] = str_replace(e_HTTP."{e_", "{e_", $_POST['content_text']);
|
||||
}
|
||||
|
||||
$_POST['content_text'] = $tp -> toDB($_POST['content_text']);
|
||||
$_POST['content_class'] = ($_POST['content_class'] ? intval($_POST['content_class']) : "0");
|
||||
$_POST['content_meta'] = $tp -> toDB($_POST['content_meta']);
|
||||
}
|
||||
$_POST['parent'] = $parent;
|
||||
|
||||
//content create
|
||||
if( isset($qs[0]) && $qs[0]=='content' && isset($qs[1]) && ($qs[1]=='create' || $qs[1]=='submit') && isset($qs[2]) && is_numeric($qs[2]) ){
|
||||
$parent = intval($_POST['parent1']);
|
||||
|
||||
//content edit
|
||||
}elseif( isset($qs[0]) && $qs[0]=='content' && isset($qs[1]) && ($qs[1]=='edit' || $qs[1]=='sa') && isset($qs[2]) && is_numeric($qs[2]) ){
|
||||
if( isset($_POST['parent1']) && strpos($_POST['parent1'], ".") ){
|
||||
$tmp = explode(".", $_POST['parent1']);
|
||||
$parent = $tmp[1];
|
||||
}else{
|
||||
$parent = $_POST['parent1'];
|
||||
}
|
||||
}
|
||||
$_POST['parent'] = $parent;
|
||||
|
||||
|
||||
if(USER){
|
||||
if($_POST['content_author_id']){
|
||||
if(!($_POST['content_author_id'] == USERID && $_POST['content_author_name'] == USERNAME && $_POST['content_author_email'] == USEREMAIL) ){
|
||||
|
||||
$author = $_POST['content_author_id'];
|
||||
|
||||
if($_POST['content_author_name'] != CONTENT_ADMIN_ITEM_LAN_14){
|
||||
$author .= "^".$_POST['content_author_name'];
|
||||
}
|
||||
if($_POST['content_author_email'] != CONTENT_ADMIN_ITEM_LAN_15){
|
||||
$author .= "^".$_POST['content_author_email'];
|
||||
}
|
||||
|
||||
}else{
|
||||
$author = $_POST['content_author_id'];
|
||||
if(USER){
|
||||
if($_POST['content_author_id']){
|
||||
if(!($_POST['content_author_id'] == USERID && $_POST['content_author_name'] == USERNAME && $_POST['content_author_email'] == USEREMAIL) ){
|
||||
|
||||
$author = $_POST['content_author_id'];
|
||||
|
||||
if($_POST['content_author_name'] != CONTENT_ADMIN_ITEM_LAN_14){
|
||||
$author .= "^".$_POST['content_author_name'];
|
||||
}
|
||||
}else{
|
||||
$author = $_POST['content_author_name'];
|
||||
if($_POST['content_author_email'] != "" && $_POST['content_author_email'] != CONTENT_ADMIN_ITEM_LAN_15){
|
||||
if($_POST['content_author_email'] != CONTENT_ADMIN_ITEM_LAN_15){
|
||||
$author .= "^".$_POST['content_author_email'];
|
||||
}
|
||||
|
||||
}else{
|
||||
$author = $_POST['content_author_id'];
|
||||
}
|
||||
}else{
|
||||
$author = $_POST['content_author_name'];
|
||||
@@ -168,376 +158,366 @@ class contentdb{
|
||||
$author .= "^".$_POST['content_author_email'];
|
||||
}
|
||||
}
|
||||
|
||||
$mainparent = $aa -> getMainParent(intval($_POST['parent']));
|
||||
$content_pref = $aa -> getContentPref($mainparent);
|
||||
$content_pref["content_icon_path_tmp"] = varset($content_pref["content_icon_path_tmp"], $content_pref["content_icon_path"]."tmp/");
|
||||
$content_pref["content_file_path_tmp"] = varset($content_pref["content_file_path_tmp"], $content_pref["content_file_path"]."tmp/");
|
||||
$content_pref["content_image_path_tmp"] = varset($content_pref["content_image_path_tmp"], $content_pref["content_image_path"]."tmp/");
|
||||
$content_cat_icon_path_large = $tp -> replaceConstants($content_pref["content_cat_icon_path_large"]);
|
||||
$content_cat_icon_path_small = $tp -> replaceConstants($content_pref["content_cat_icon_path_small"]);
|
||||
$content_icon_path = $tp -> replaceConstants($content_pref["content_icon_path"]);
|
||||
$content_image_path = $tp -> replaceConstants($content_pref["content_image_path"]);
|
||||
$content_file_path = $tp -> replaceConstants($content_pref["content_file_path"]);
|
||||
$content_tmppath_icon = $tp -> replaceConstants($content_pref["content_icon_path_tmp"]);
|
||||
$content_tmppath_file = $tp -> replaceConstants($content_pref["content_file_path_tmp"]);
|
||||
$content_tmppath_image = $tp -> replaceConstants($content_pref["content_image_path_tmp"]);
|
||||
|
||||
//move icon to correct folder
|
||||
if($_POST['content_icon']){
|
||||
$icon = $tp->toDB($_POST['content_icon']);
|
||||
if($icon && is_readable($content_tmppath_icon.$icon)){
|
||||
rename($content_tmppath_icon.$icon, $content_icon_path.$icon);
|
||||
}
|
||||
}
|
||||
|
||||
$sumf = 0;
|
||||
$sumi = 0;
|
||||
foreach($_POST as $k => $v){
|
||||
if(strpos($k, "content_files") === 0){
|
||||
$sumf = $sumf+1;
|
||||
}
|
||||
if(strpos($k, "content_images") === 0){
|
||||
$sumi = $sumi+1;
|
||||
}
|
||||
}
|
||||
//move attachments to correct folder
|
||||
$totalattach = "";
|
||||
for($i=0;$i<$sumf;$i++){
|
||||
$attach{$i} = $tp->toDB($_POST["content_files{$i}"]);
|
||||
if($attach{$i} && is_readable($content_tmppath_file.$attach{$i})){
|
||||
rename($content_tmppath_file.$attach{$i}, $content_file_path.$attach{$i});
|
||||
}
|
||||
if($attach{$i} && is_readable($content_file_path.$attach{$i})){
|
||||
$totalattach .= "[file]".$attach{$i};
|
||||
}
|
||||
}
|
||||
//move images to correct folder
|
||||
$totalimages = "";
|
||||
for($i=0;$i<$sumi;$i++){
|
||||
$image{$i} = $tp->toDB($_POST["content_images{$i}"]);
|
||||
if($image{$i} && is_readable($content_tmppath_image.$image{$i})){
|
||||
rename($content_tmppath_image.$image{$i}, $content_image_path.$image{$i});
|
||||
}
|
||||
if($image{$i} && is_readable($content_tmppath_image."thumb_".$image{$i})){
|
||||
rename($content_tmppath_image."thumb_".$image{$i}, $content_image_path."thumb_".$image{$i});
|
||||
}
|
||||
if($image{$i} && is_readable($content_image_path.$image{$i})){
|
||||
$totalimages .= "[img]".$image{$i};
|
||||
}
|
||||
}
|
||||
|
||||
if($_POST['update_datestamp']){
|
||||
$starttime = time();
|
||||
}else{
|
||||
if( isset($_POST['ne_day']) && $_POST['ne_day']!='' && $_POST['ne_day']!='0' && $_POST['ne_day'] != "none"
|
||||
&& isset($_POST['ne_month']) && $_POST['ne_month']!='' && $_POST['ne_month']!='0' && $_POST['ne_month'] != "none"
|
||||
&& isset($_POST['ne_year']) && $_POST['ne_year']!='' && $_POST['ne_year']!='0' && $_POST['ne_year'] != "none" ){
|
||||
$newstarttime = mktime( 0, 0, 0, intval($_POST['ne_month']), intval($_POST['ne_day']), intval($_POST['ne_year']));
|
||||
}else{
|
||||
$newstarttime = time();
|
||||
}
|
||||
if(isset($_POST['content_datestamp']) && $_POST['content_datestamp'] != "" && $_POST['content_datestamp'] != "0"){
|
||||
if($newstarttime != $starttime){
|
||||
$starttime = $newstarttime;
|
||||
}else{
|
||||
$starttime = intval($_POST['content_datestamp']);
|
||||
}
|
||||
}else{
|
||||
$starttime = time();
|
||||
}
|
||||
}
|
||||
|
||||
if( isset($_POST['end_day']) && $_POST['end_day']!='' && $_POST['end_day']!='0' && $_POST['end_day'] != "none"
|
||||
&& isset($_POST['end_month']) && $_POST['end_month']!='' && $_POST['end_month']!='0' && $_POST['end_month'] != "none"
|
||||
&& isset($_POST['end_year']) && $_POST['end_year']!='' && $_POST['end_year']!='0' && $_POST['end_year'] != "none" ){
|
||||
$endtime = mktime( 0, 0, 0, intval($_POST['end_month']), intval($_POST['end_day']), intval($_POST['end_year']));
|
||||
}else{
|
||||
$endtime = "0";
|
||||
}
|
||||
|
||||
//custom additional data tags
|
||||
for($i=0;$i<$content_pref["content_admin_custom_number"];$i++){
|
||||
if(isset($_POST["content_custom_key_{$i}"]) && isset($_POST["content_custom_value_{$i}"]) && $_POST["content_custom_value_{$i}"] != ""){
|
||||
$keystring = $tp->toDB($_POST["content_custom_key_{$i}"]);
|
||||
$custom["content_custom_{$keystring}"] = $tp->toDB($_POST["content_custom_value_{$i}"]);
|
||||
}
|
||||
}
|
||||
//preset additional data tags
|
||||
if( varsettrue(($_POST['content_custom_preset_key']) ){
|
||||
$custom['content_custom_presettags'] = $tp->toDB($_POST['content_custom_preset_key']);
|
||||
}
|
||||
if($custom){
|
||||
$contentprefvalue = $eArrayStorage->WriteArray($custom);
|
||||
}else{
|
||||
$contentprefvalue = "";
|
||||
}
|
||||
|
||||
$_POST['content_layout'] = (!$_POST['content_layout'] || $_POST['content_layout'] == "content_content_template.php" ? "" : $tp->toDB($_POST['content_layout']));
|
||||
|
||||
//content_order : not added in the sql
|
||||
//content_refer : only added in sql if posting submitted item
|
||||
//$refer = (isset($_POST['content_refer']) && $_POST['content_refer']=='sa' ? ", content_refer='' " : "");
|
||||
|
||||
if($mode == "create"){
|
||||
if($type == "submit"){
|
||||
$refer = ($content_pref["content_manager_submit_directpost"] ? "" : "sa");
|
||||
}elseif($type == "contentmanager"){
|
||||
$refer = ($content_pref["content_manager_manager_directpost"] ? "" : "sa");
|
||||
}else{
|
||||
$refer = "";
|
||||
}
|
||||
$sql -> db_Insert($plugintable, "'0', '".$_POST['content_heading']."', '".$_POST['content_subheading']."', '".$_POST['content_summary']."', '".$_POST['content_text']."', '".$tp->toDB($author)."', '".$icon."', '".$totalattach."', '".$totalimages."', '".$_POST['parent']."', '".intval($_POST['content_comment'])."', '".intval($_POST['content_rate'])."', '".intval($_POST['content_pe'])."', '".$refer."', '".$starttime."', '".$endtime."', '".$_POST['content_class']."', '".$contentprefvalue."', '0', '".intval($_POST['content_score'])."', '".$_POST['content_meta']."', '".$_POST['content_layout']."' ");
|
||||
|
||||
$e107cache->clear("$plugintable");
|
||||
|
||||
//trigger event for notify
|
||||
$edata_cs = array("content_heading" => $_POST['content_heading'], "content_subheading" => $_POST['content_subheading'], "content_author" => $_POST['content_author_name']);
|
||||
$e_event->trigger("content", $edata_cs);
|
||||
|
||||
if(!$type || $type == "admin"){
|
||||
js_location(e_SELF."?".e_QUERY.".cc");
|
||||
}elseif($type == "contentmanager"){
|
||||
js_location(e_SELF."?c");
|
||||
}elseif($type == "submit"){
|
||||
if($content_pref["content_manager_submit_directpost"]){
|
||||
js_location(e_SELF."?s");
|
||||
}else{
|
||||
js_location(e_SELF."?d");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($mode == "update"){
|
||||
if($type == "submit"){
|
||||
if(isset($_POST['content_refer']) && $_POST['content_refer']=='sa'){
|
||||
$refer = ", content_refer='' ";
|
||||
}else{
|
||||
$refer = "";
|
||||
}
|
||||
}else{
|
||||
if(isset($_POST['content_refer']) && $_POST['content_refer']=='sa'){
|
||||
$refer = ", content_refer='' ";
|
||||
}else{
|
||||
$refer = "";
|
||||
}
|
||||
}
|
||||
$sql -> db_Update($plugintable, "content_heading = '".$_POST['content_heading']."', content_subheading = '".$_POST['content_subheading']."', content_summary = '".$_POST['content_summary']."', content_text = '".$_POST['content_text']."', content_author = '".$tp->toDB($author)."', content_icon = '".$icon."', content_file = '".$totalattach."', content_image = '".$totalimages."', content_parent = '".$_POST['parent']."', content_comment = '".intval($_POST['content_comment'])."', content_rate = '".intval($_POST['content_rate'])."', content_pe = '".intval($_POST['content_pe'])."' ".$refer.", content_datestamp = '".$starttime."', content_enddate = '".$endtime."', content_class = '".$_POST['content_class']."', content_pref = '".$contentprefvalue."', content_score='".intval($_POST['content_score'])."', content_meta='".$_POST['content_meta']."', content_layout='".$_POST['content_layout']."' WHERE content_id = '".intval($_POST['content_id'])."' ");
|
||||
|
||||
$e107cache->clear("$plugintable");
|
||||
$e107cache->clear("comment.$plugintable.{$_POST['content_id']}");
|
||||
if(!$type || $type == "admin"){
|
||||
js_location(e_SELF."?".e_QUERY.".cu");
|
||||
}elseif($type == "contentmanager"){
|
||||
js_location(e_SELF."?u");
|
||||
}
|
||||
}else{
|
||||
$author = $_POST['content_author_name'];
|
||||
if($_POST['content_author_email'] != "" && $_POST['content_author_email'] != CONTENT_ADMIN_ITEM_LAN_15){
|
||||
$author .= "^".$_POST['content_author_email'];
|
||||
}
|
||||
}
|
||||
|
||||
$mainparent = $aa -> getMainParent(intval($_POST['parent']));
|
||||
$content_pref = $aa -> getContentPref($mainparent);
|
||||
$content_pref["content_icon_path_tmp"] = varset($content_pref["content_icon_path_tmp"], $content_pref["content_icon_path"]."tmp/");
|
||||
$content_pref["content_file_path_tmp"] = varset($content_pref["content_file_path_tmp"], $content_pref["content_file_path"]."tmp/");
|
||||
$content_pref["content_image_path_tmp"] = varset($content_pref["content_image_path_tmp"], $content_pref["content_image_path"]."tmp/");
|
||||
$content_cat_icon_path_large = $tp -> replaceConstants($content_pref["content_cat_icon_path_large"]);
|
||||
$content_cat_icon_path_small = $tp -> replaceConstants($content_pref["content_cat_icon_path_small"]);
|
||||
$content_icon_path = $tp -> replaceConstants($content_pref["content_icon_path"]);
|
||||
$content_image_path = $tp -> replaceConstants($content_pref["content_image_path"]);
|
||||
$content_file_path = $tp -> replaceConstants($content_pref["content_file_path"]);
|
||||
$content_tmppath_icon = $tp -> replaceConstants($content_pref["content_icon_path_tmp"]);
|
||||
$content_tmppath_file = $tp -> replaceConstants($content_pref["content_file_path_tmp"]);
|
||||
$content_tmppath_image = $tp -> replaceConstants($content_pref["content_image_path_tmp"]);
|
||||
|
||||
//function dbCategoryUpdate($mode){
|
||||
function dbCategory($mode){
|
||||
global $pref, $sql, $ns, $rs, $qs, $aa, $tp, $plugintable, $e107cache, $content_cat_icon_path_large, $content_cat_icon_path_small;
|
||||
|
||||
$_POST['cat_heading'] = $tp -> toDB($_POST['cat_heading']);
|
||||
$_POST['cat_subheading'] = $tp -> toDB($_POST['cat_subheading']);
|
||||
if(e_WYSIWYG){
|
||||
$_POST['cat_text'] = $tp->createConstants($_POST['cat_text']); // convert e107_images/ to {e_IMAGE} etc.
|
||||
//move icon to correct folder
|
||||
if($_POST['content_icon']){
|
||||
$icon = $tp->toDB($_POST['content_icon']);
|
||||
if($icon && is_readable($content_tmppath_icon.$icon)){
|
||||
rename($content_tmppath_icon.$icon, $content_icon_path.$icon);
|
||||
}
|
||||
$_POST['cat_text'] = $tp -> toDB($_POST['cat_text']);
|
||||
$_POST['cat_class'] = ($_POST['cat_class'] ? intval($_POST['cat_class']) : "0");
|
||||
}
|
||||
|
||||
//category create
|
||||
if( isset($qs[0]) && $qs[0]=='cat' && isset($qs[1]) && $qs[1]=='create' ){
|
||||
if( isset($qs[2]) && is_numeric($qs[2]) ){
|
||||
$parent = "0.".intval($qs[2]);
|
||||
}else{
|
||||
$parent = 0;
|
||||
}
|
||||
|
||||
//category edit
|
||||
}elseif( isset($qs[0]) && $qs[0]=='cat' && isset($qs[1]) && $qs[1]=='edit' ){
|
||||
if( isset($qs[2]) && is_numeric($qs[2]) ){
|
||||
|
||||
if( isset($qs[3]) && is_numeric($qs[3]) ){
|
||||
if(intval($qs[3]) == 0){
|
||||
$parent = 0;
|
||||
}elseif( $qs[2] == $qs[3] ){
|
||||
$parent = 0;
|
||||
}else{
|
||||
$parent = "0.".intval($qs[3]);
|
||||
}
|
||||
}else{
|
||||
if($qs[2]==$_POST['cat_id']){
|
||||
$parent = intval($_POST['parent_id']);
|
||||
$parent = ($parent!=0 ? "0.".$parent : 0);
|
||||
}else{
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$parent = 0;
|
||||
}
|
||||
$sumf = 0;
|
||||
$sumi = 0;
|
||||
foreach($_POST as $k => $v){
|
||||
if(strpos($k, "content_files") === 0){
|
||||
$sumf = $sumf+1;
|
||||
}
|
||||
$_POST['parent'] = $parent;
|
||||
if(strpos($k, "content_images") === 0){
|
||||
$sumi = $sumi+1;
|
||||
}
|
||||
}
|
||||
//move attachments to correct folder
|
||||
$totalattach = "";
|
||||
for($i=0;$i<$sumf;$i++){
|
||||
$attach{$i} = $tp->toDB($_POST["content_files{$i}"]);
|
||||
if($attach{$i} && is_readable($content_tmppath_file.$attach{$i})){
|
||||
rename($content_tmppath_file.$attach{$i}, $content_file_path.$attach{$i});
|
||||
}
|
||||
if($attach{$i} && is_readable($content_file_path.$attach{$i})){
|
||||
$totalattach .= "[file]".$attach{$i};
|
||||
}
|
||||
}
|
||||
//move images to correct folder
|
||||
$totalimages = "";
|
||||
for($i=0;$i<$sumi;$i++){
|
||||
$image{$i} = $tp->toDB($_POST["content_images{$i}"]);
|
||||
if($image{$i} && is_readable($content_tmppath_image.$image{$i})){
|
||||
rename($content_tmppath_image.$image{$i}, $content_image_path.$image{$i});
|
||||
}
|
||||
if($image{$i} && is_readable($content_tmppath_image."thumb_".$image{$i})){
|
||||
rename($content_tmppath_image."thumb_".$image{$i}, $content_image_path."thumb_".$image{$i});
|
||||
}
|
||||
if($image{$i} && is_readable($content_image_path.$image{$i})){
|
||||
$totalimages .= "[img]".$image{$i};
|
||||
}
|
||||
}
|
||||
|
||||
if($_POST['update_datestamp']){
|
||||
$starttime = time();
|
||||
}else{
|
||||
if( isset($_POST['ne_day']) && $_POST['ne_day']!='' && $_POST['ne_day']!='0' && $_POST['ne_day'] != "none"
|
||||
&& isset($_POST['ne_month']) && $_POST['ne_month']!='' && $_POST['ne_month']!='0' && $_POST['ne_month'] != "none"
|
||||
&& isset($_POST['ne_year']) && $_POST['ne_year']!='' && $_POST['ne_year']!='0' && $_POST['ne_year'] != "none" ){
|
||||
$starttime = mktime( 0, 0, 0, intval($_POST['ne_month']), intval($_POST['ne_day']), intval($_POST['ne_year']));
|
||||
&& isset($_POST['ne_month']) && $_POST['ne_month']!='' && $_POST['ne_month']!='0' && $_POST['ne_month'] != "none"
|
||||
&& isset($_POST['ne_year']) && $_POST['ne_year']!='' && $_POST['ne_year']!='0' && $_POST['ne_year'] != "none" ){
|
||||
$newstarttime = mktime( 0, 0, 0, intval($_POST['ne_month']), intval($_POST['ne_day']), intval($_POST['ne_year']));
|
||||
}else{
|
||||
$newstarttime = time();
|
||||
}
|
||||
if(isset($_POST['content_datestamp']) && $_POST['content_datestamp'] != "" && $_POST['content_datestamp'] != "0"){
|
||||
if($newstarttime != $starttime){
|
||||
$starttime = $newstarttime;
|
||||
}else{
|
||||
$starttime = intval($_POST['content_datestamp']);
|
||||
}
|
||||
}else{
|
||||
$starttime = time();
|
||||
}
|
||||
|
||||
if( isset($_POST['end_day']) && $_POST['end_day']!='' && $_POST['end_day']!='0' && $_POST['end_day'] != "none"
|
||||
&& isset($_POST['end_month']) && $_POST['end_month']!='' && $_POST['end_month']!='0' && $_POST['end_month'] != "none"
|
||||
&& isset($_POST['end_year']) && $_POST['end_year']!='' && $_POST['end_year']!='0' && $_POST['end_year'] != "none" ){
|
||||
$endtime = mktime( 0, 0, 0, intval($_POST['end_month']), intval($_POST['end_day']), intval($_POST['end_year']));
|
||||
}else{
|
||||
$endtime = "0";
|
||||
}
|
||||
|
||||
if($mode == "create"){
|
||||
$sql -> db_Insert($plugintable, "'0', '".$_POST['cat_heading']."', '".$_POST['cat_subheading']."', '', '".$_POST['cat_text']."', '".ADMINID."', '".$tp->toDB($_POST["cat_icon"])."', '', '', '".$_POST['parent']."', '".intval($_POST['cat_comment'])."', '".intval($_POST['cat_rate'])."', '".intval($_POST['cat_pe'])."', '', '".$starttime."', '".$endtime."', '".$_POST['cat_class']."', '', '0', '0', '', '' ");
|
||||
|
||||
// check and insert default pref values if new main parent + create menu file
|
||||
if($_POST['parent'] == "0"){
|
||||
$iid = mysql_insert_id();
|
||||
$content_pref = $aa -> getContentPref($iid);
|
||||
$aa -> CreateParentMenu($iid);
|
||||
}
|
||||
$e107cache->clear("$plugintable");
|
||||
js_location(e_SELF."?".e_QUERY.".pc");
|
||||
|
||||
}elseif($mode == "update"){
|
||||
$sql -> db_Update($plugintable, "content_heading = '".$_POST['cat_heading']."', content_subheading = '".$_POST['cat_subheading']."', content_summary = '', content_text = '".$_POST['cat_text']."', content_author = '".ADMINID."', content_icon = '".$tp->toDB($_POST["cat_icon"])."', content_image = '', content_parent = '".$_POST['parent']."', content_comment = '".intval($_POST['cat_comment'])."', content_rate = '".intval($_POST['cat_rate'])."', content_pe = '".intval($_POST['cat_pe'])."', content_refer = '0', content_datestamp = '".$starttime."', content_enddate = '".$endtime."', content_class = '".intval($_POST['cat_class'])."' WHERE content_id = '".intval($_POST['cat_id'])."' ");
|
||||
|
||||
// check and insert default pref values if new main parent + create menu file
|
||||
if($_POST['parent'] == "0"){
|
||||
@unlink(e_PLUGIN."content/menus/content_".$_POST['menuheading']."_menu.php");
|
||||
$content_pref = $aa -> getContentPref($_POST['cat_id']);
|
||||
$aa -> CreateParentMenu($_POST['cat_id']);
|
||||
}
|
||||
$e107cache->clear("$plugintable");
|
||||
js_location(e_SELF."?".e_QUERY.".pu");
|
||||
}
|
||||
}
|
||||
|
||||
function dbDelete($mode, $cat, $del_id){
|
||||
global $plugintable, $sql, $_POST, $e107cache;
|
||||
|
||||
if($mode == "admin"){
|
||||
if($cat == "cat"){
|
||||
if($sql -> db_Delete($plugintable, "content_id='".intval($del_id)."' ")){
|
||||
$e107cache->clear("$plugintable");
|
||||
$message = CONTENT_ADMIN_CAT_LAN_23;
|
||||
return $message;
|
||||
}
|
||||
}elseif($cat == "content"){
|
||||
if($sql -> db_Delete($plugintable, "content_id='".intval($del_id)."' ")){
|
||||
$e107cache->clear("$plugintable");
|
||||
$message = CONTENT_ADMIN_ITEM_LAN_3;
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
return FALSE;
|
||||
}
|
||||
if( isset($_POST['end_day']) && $_POST['end_day']!='' && $_POST['end_day']!='0' && $_POST['end_day'] != "none"
|
||||
&& isset($_POST['end_month']) && $_POST['end_month']!='' && $_POST['end_month']!='0' && $_POST['end_month'] != "none"
|
||||
&& isset($_POST['end_year']) && $_POST['end_year']!='' && $_POST['end_year']!='0' && $_POST['end_year'] != "none" ){
|
||||
$endtime = mktime( 0, 0, 0, intval($_POST['end_month']), intval($_POST['end_day']), intval($_POST['end_year']));
|
||||
}else{
|
||||
$endtime = "0";
|
||||
}
|
||||
|
||||
//custom additional data tags
|
||||
for($i=0;$i<$content_pref["content_admin_custom_number"];$i++){
|
||||
if(isset($_POST["content_custom_key_{$i}"]) && isset($_POST["content_custom_value_{$i}"]) && $_POST["content_custom_value_{$i}"] != ""){
|
||||
$keystring = $tp->toDB($_POST["content_custom_key_{$i}"]);
|
||||
$custom["content_custom_{$keystring}"] = $tp->toDB($_POST["content_custom_value_{$i}"]);
|
||||
}
|
||||
}
|
||||
//preset additional data tags
|
||||
if( varsettrue($_POST['content_custom_preset_key']) ){
|
||||
$custom['content_custom_presettags'] = $tp->toDB($_POST['content_custom_preset_key']);
|
||||
}
|
||||
$contentprefvalue = ($custom ? $eArrayStorage->WriteArray($custom) : '');
|
||||
|
||||
$_POST['content_layout'] = (!$_POST['content_layout'] || $_POST['content_layout'] == "content_content_template.php" ? "" : $tp->toDB($_POST['content_layout']));
|
||||
|
||||
function dbSetOrder($mode, $type, $order){
|
||||
global $plugintable, $sql, $aa, $qs, $_POST, $e107cache;
|
||||
//$mode : all, inc, dec
|
||||
//$type : cc (category order), ai (global all items), ci (items in category)
|
||||
//$order : posted values or id-currentorder
|
||||
//content_order : not added in the sql
|
||||
//content_refer : only added in sql if posting submitted item
|
||||
//$refer = (isset($_POST['content_refer']) && $_POST['content_refer']=='sa' ? ", content_refer='' " : "");
|
||||
|
||||
if($mode == "all"){
|
||||
foreach ($order as $cid){
|
||||
//each order value in the db has two numbers (a-b) where a = category item order, and b = global item order
|
||||
//146.3.cat : category order
|
||||
//35.3.ci.1-0 : category item order
|
||||
//35.3.ai.1-0 : global item order
|
||||
|
||||
$tmp = explode(".", $cid);
|
||||
$old = explode("-", $tmp[3]);
|
||||
$old[0] = ($old[0] == "" ? "0" : $old[0]);
|
||||
$old[1] = ($old[1] == "" ? "0" : $old[1]);
|
||||
|
||||
$tmp[0] = intval($tmp[0]);
|
||||
$tmp[1] = intval($tmp[1]);
|
||||
$old[0] = intval($old[0]);
|
||||
$old[1] = intval($old[1]);
|
||||
if($mode == "create"){
|
||||
if($type == "submit"){
|
||||
$refer = ($content_pref["content_manager_submit_directpost"] ? "" : "sa");
|
||||
}elseif($type == "contentmanager"){
|
||||
$refer = ($content_pref["content_manager_manager_directpost"] ? "" : "sa");
|
||||
}else{
|
||||
$refer = "";
|
||||
}
|
||||
$sql -> db_Insert($plugintable, "'0', '".$_POST['content_heading']."', '".$_POST['content_subheading']."', '".$_POST['content_summary']."', '".$_POST['content_text']."', '".$tp->toDB($author)."', '".$icon."', '".$totalattach."', '".$totalimages."', '".$_POST['parent']."', '".intval($_POST['content_comment'])."', '".intval($_POST['content_rate'])."', '".intval($_POST['content_pe'])."', '".$refer."', '".$starttime."', '".$endtime."', '".$_POST['content_class']."', '".$contentprefvalue."', '0', '".intval($_POST['content_score'])."', '".$_POST['content_meta']."', '".$_POST['content_layout']."' ");
|
||||
|
||||
if($tmp[2] == "cat"){
|
||||
$sql->db_Update($plugintable, "content_order='".$tmp[1]."' WHERE content_id='".$tmp[0]."' " );
|
||||
$e107cache->clear("$plugintable");
|
||||
|
||||
}elseif($tmp[2] == "ci"){
|
||||
$sql->db_Update($plugintable, "content_order='".$tmp[1].".".$old[1]."' WHERE content_id='".$tmp[0]."' " );
|
||||
//trigger event for notify
|
||||
$edata_cs = array("content_heading" => $_POST['content_heading'], "content_subheading" => $_POST['content_subheading'], "content_author" => $_POST['content_author_name']);
|
||||
$e_event->trigger("content", $edata_cs);
|
||||
|
||||
}elseif($tmp[2] == "ai"){
|
||||
$sql->db_Update($plugintable, "content_order='".$old[0].".".$tmp[1]."' WHERE content_id='".$tmp[0]."' " );
|
||||
if(!$type || $type == "admin"){
|
||||
js_location(e_SELF."?".e_QUERY.".cc");
|
||||
}elseif($type == "contentmanager"){
|
||||
js_location(e_SELF."?c");
|
||||
}elseif($type == "submit"){
|
||||
if($content_pref["content_manager_submit_directpost"]){
|
||||
js_location(e_SELF."?s");
|
||||
}else{
|
||||
js_location(e_SELF."?d");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($mode == "update"){
|
||||
$refer = (isset($_POST['content_refer']) && $_POST['content_refer']=='sa' ? ", content_refer='' " : '');
|
||||
|
||||
$sql -> db_Update($plugintable, "content_heading = '".$_POST['content_heading']."', content_subheading = '".$_POST['content_subheading']."', content_summary = '".$_POST['content_summary']."', content_text = '".$_POST['content_text']."', content_author = '".$tp->toDB($author)."', content_icon = '".$icon."', content_file = '".$totalattach."', content_image = '".$totalimages."', content_parent = '".$_POST['parent']."', content_comment = '".intval($_POST['content_comment'])."', content_rate = '".intval($_POST['content_rate'])."', content_pe = '".intval($_POST['content_pe'])."' ".$refer.", content_datestamp = '".$starttime."', content_enddate = '".$endtime."', content_class = '".$_POST['content_class']."', content_pref = '".$contentprefvalue."', content_score='".intval($_POST['content_score'])."', content_meta='".$_POST['content_meta']."', content_layout='".$_POST['content_layout']."' WHERE content_id = '".intval($_POST['content_id'])."' ");
|
||||
|
||||
$e107cache->clear("$plugintable");
|
||||
$e107cache->clear("comment.$plugintable.{$_POST['content_id']}");
|
||||
if(!$type || $type == "admin"){
|
||||
js_location(e_SELF."?".e_QUERY.".cu");
|
||||
}elseif($type == "contentmanager"){
|
||||
js_location(e_SELF."?u");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//function dbCategoryUpdate($mode){
|
||||
function dbCategory($mode){
|
||||
global $pref, $sql, $ns, $rs, $qs, $aa, $tp, $plugintable, $e107cache, $content_cat_icon_path_large, $content_cat_icon_path_small;
|
||||
|
||||
$_POST['cat_heading'] = $tp -> toDB($_POST['cat_heading']);
|
||||
$_POST['cat_subheading'] = $tp -> toDB($_POST['cat_subheading']);
|
||||
if(e_WYSIWYG){
|
||||
$_POST['cat_text'] = $tp->createConstants($_POST['cat_text']); // convert e107_images/ to {e_IMAGE} etc.
|
||||
}
|
||||
$_POST['cat_text'] = $tp -> toDB($_POST['cat_text']);
|
||||
$_POST['cat_class'] = ($_POST['cat_class'] ? intval($_POST['cat_class']) : "0");
|
||||
|
||||
//category create
|
||||
if( isset($qs[0]) && $qs[0]=='cat' && isset($qs[1]) && $qs[1]=='create' ){
|
||||
if( isset($qs[2]) && is_numeric($qs[2]) ){
|
||||
$parent = "0.".intval($qs[2]);
|
||||
}else{
|
||||
$parent = 0;
|
||||
}
|
||||
|
||||
//category edit
|
||||
}elseif( isset($qs[0]) && $qs[0]=='cat' && isset($qs[1]) && $qs[1]=='edit' ){
|
||||
if( isset($qs[2]) && is_numeric($qs[2]) ){
|
||||
|
||||
if( isset($qs[3]) && is_numeric($qs[3]) ){
|
||||
if(intval($qs[3]) == 0){
|
||||
$parent = 0;
|
||||
}elseif( $qs[2] == $qs[3] ){
|
||||
$parent = 0;
|
||||
}else{
|
||||
$parent = "0.".intval($qs[3]);
|
||||
}
|
||||
}else{
|
||||
if($qs[2]==$_POST['cat_id']){
|
||||
$parent = intval($_POST['parent_id']);
|
||||
$parent = ($parent!=0 ? "0.".$parent : 0);
|
||||
}else{
|
||||
}
|
||||
$message = CONTENT_ADMIN_ORDER_LAN_2;
|
||||
}
|
||||
}else{
|
||||
$parent = 0;
|
||||
}
|
||||
}
|
||||
$_POST['parent'] = $parent;
|
||||
|
||||
}elseif($mode == "inc"){
|
||||
if( isset($_POST['ne_day']) && $_POST['ne_day']!='' && $_POST['ne_day']!='0' && $_POST['ne_day'] != "none"
|
||||
&& isset($_POST['ne_month']) && $_POST['ne_month']!='' && $_POST['ne_month']!='0' && $_POST['ne_month'] != "none"
|
||||
&& isset($_POST['ne_year']) && $_POST['ne_year']!='' && $_POST['ne_year']!='0' && $_POST['ne_year'] != "none" ){
|
||||
$starttime = mktime( 0, 0, 0, intval($_POST['ne_month']), intval($_POST['ne_day']), intval($_POST['ne_year']));
|
||||
}else{
|
||||
$starttime = time();
|
||||
}
|
||||
|
||||
$tmp = explode("-", $order);
|
||||
$tmp[0] = intval($tmp[0]);
|
||||
$tmp[1] = intval($tmp[1]);
|
||||
$tmp[2] = intval($tmp[2]);
|
||||
if( isset($_POST['end_day']) && $_POST['end_day']!='' && $_POST['end_day']!='0' && $_POST['end_day'] != "none"
|
||||
&& isset($_POST['end_month']) && $_POST['end_month']!='' && $_POST['end_month']!='0' && $_POST['end_month'] != "none"
|
||||
&& isset($_POST['end_year']) && $_POST['end_year']!='' && $_POST['end_year']!='0' && $_POST['end_year'] != "none" ){
|
||||
$endtime = mktime( 0, 0, 0, intval($_POST['end_month']), intval($_POST['end_day']), intval($_POST['end_year']));
|
||||
}else{
|
||||
$endtime = "0";
|
||||
}
|
||||
|
||||
if($type == "cc"){
|
||||
$mainparent = $aa -> getMainParent($tmp[0]);
|
||||
$array = $aa -> getCategoryTree("", $mainparent, TRUE);
|
||||
$validparent = implode(",", array_keys($array));
|
||||
$qry = " content_id REGEXP '".$aa -> CONTENTREGEXP($validparent)."' AND content_order='".($tmp[1]-1)."' ";
|
||||
$sql->db_Update($plugintable, "content_order=content_order+1 WHERE ".$qry." " );
|
||||
$sql->db_Update($plugintable, "content_order=content_order-1 WHERE content_id='".$tmp[0]."' " );
|
||||
if($mode == "create"){
|
||||
$sql -> db_Insert($plugintable, "'0', '".$_POST['cat_heading']."', '".$_POST['cat_subheading']."', '', '".$_POST['cat_text']."', '".ADMINID."', '".$tp->toDB($_POST["cat_icon"])."', '', '', '".$_POST['parent']."', '".intval($_POST['cat_comment'])."', '".intval($_POST['cat_rate'])."', '".intval($_POST['cat_pe'])."', '', '".$starttime."', '".$endtime."', '".$_POST['cat_class']."', '', '0', '0', '', '' ");
|
||||
|
||||
}elseif($type == "ci"){
|
||||
$sql->db_Update($plugintable, "content_order='".$tmp[1].".".$tmp[2]."' WHERE content_parent = '".intval($qs[2])."' AND SUBSTRING_INDEX(content_order, '.', 1) = '".($tmp[1]-1)."' " );
|
||||
$sql->db_Update($plugintable, "content_order='".($tmp[1]-1).".".$tmp[2]."' WHERE content_id='".$tmp[0]."' " );
|
||||
|
||||
}elseif($type == "ai"){
|
||||
$array = $aa -> getCategoryTree("", intval($qs[1]), TRUE);
|
||||
$validparent = implode(",", array_keys($array));
|
||||
$qry = " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' AND SUBSTRING_INDEX(content_order, '.', -1) = '".($tmp[2]-1)."' ";
|
||||
$sql->db_Update($plugintable, " content_order=content_order+0.1 WHERE ".$qry." " );
|
||||
$sql->db_Update($plugintable, "content_order='".$tmp[1].".".($tmp[2]-1)."' WHERE content_id='".$tmp[0]."' " );
|
||||
|
||||
}
|
||||
$message = CONTENT_ADMIN_ORDER_LAN_0;
|
||||
|
||||
}elseif($mode == "dec"){
|
||||
|
||||
$tmp = explode("-", $order);
|
||||
$tmp[0] = intval($tmp[0]);
|
||||
$tmp[1] = intval($tmp[1]);
|
||||
$tmp[2] = intval($tmp[2]);
|
||||
if($type == "cc"){
|
||||
$mainparent = $aa -> getMainParent($tmp[0]);
|
||||
$array = $aa -> getCategoryTree("", $mainparent, TRUE);
|
||||
$validparent = implode(",", array_keys($array));
|
||||
$qry = " content_id REGEXP '".$aa -> CONTENTREGEXP($validparent)."' AND content_order='".($tmp[1]+1)."' ";
|
||||
$sql->db_Update($plugintable, "content_order=content_order-1 WHERE ".$qry." " );
|
||||
$sql->db_Update($plugintable, "content_order=content_order+1 WHERE content_id='".$tmp[0]."' " );
|
||||
|
||||
}elseif($type == "ci"){
|
||||
$sql->db_Update($plugintable, "content_order='".$tmp[1].".".$tmp[2]."' WHERE content_parent = '".intval($qs[2])."' AND SUBSTRING_INDEX(content_order, '.', 1) = '".($tmp[1]+1)."' " );
|
||||
$sql->db_Update($plugintable, "content_order='".($tmp[1]+1).".".$tmp[2]."' WHERE content_id='".$tmp[0]."' " );
|
||||
|
||||
}elseif($type == "ai"){
|
||||
$array = $aa -> getCategoryTree("", intval($qs[1]), TRUE);
|
||||
$validparent = implode(",", array_keys($array));
|
||||
$qry = " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' AND SUBSTRING_INDEX(content_order, '.', -1) = '".($tmp[2]+1)."' ";
|
||||
$sql->db_Update($plugintable, "content_order=content_order-0.1 WHERE ".$qry." " );
|
||||
$sql->db_Update($plugintable, "content_order='".$tmp[1].".".($tmp[2]+1)."' WHERE content_id='".$tmp[0]."' " );
|
||||
}
|
||||
$message = CONTENT_ADMIN_ORDER_LAN_1;
|
||||
// check and insert default pref values if new top level category + create menu file
|
||||
if($_POST['parent'] == "0"){
|
||||
$iid = mysql_insert_id();
|
||||
$content_pref = $aa -> getContentPref($iid);
|
||||
$aa -> CreateParentMenu($iid);
|
||||
}
|
||||
$e107cache->clear("$plugintable");
|
||||
return $message;
|
||||
js_location(e_SELF."?".e_QUERY.".pc");
|
||||
|
||||
}elseif($mode == "update"){
|
||||
$sql -> db_Update($plugintable, "content_heading = '".$_POST['cat_heading']."', content_subheading = '".$_POST['cat_subheading']."', content_summary = '', content_text = '".$_POST['cat_text']."', content_author = '".ADMINID."', content_icon = '".$tp->toDB($_POST["cat_icon"])."', content_image = '', content_parent = '".$_POST['parent']."', content_comment = '".intval($_POST['cat_comment'])."', content_rate = '".intval($_POST['cat_rate'])."', content_pe = '".intval($_POST['cat_pe'])."', content_refer = '0', content_datestamp = '".$starttime."', content_enddate = '".$endtime."', content_class = '".intval($_POST['cat_class'])."' WHERE content_id = '".intval($_POST['cat_id'])."' ");
|
||||
|
||||
// check and insert default pref values if new top level category + create menu file
|
||||
if($_POST['parent'] == "0"){
|
||||
@unlink(e_PLUGIN."content/menus/content_".$_POST['menuheading']."_menu.php");
|
||||
$content_pref = $aa -> getContentPref($_POST['cat_id']);
|
||||
$aa -> CreateParentMenu($_POST['cat_id']);
|
||||
}
|
||||
$e107cache->clear("$plugintable");
|
||||
js_location(e_SELF."?".e_QUERY.".pu");
|
||||
}
|
||||
}
|
||||
|
||||
function dbDelete($mode, $cat, $del_id){
|
||||
global $plugintable, $sql, $_POST, $e107cache;
|
||||
|
||||
if($mode == "admin"){
|
||||
if($cat == "cat"){
|
||||
if($sql -> db_Delete($plugintable, "content_id='".intval($del_id)."' ")){
|
||||
$e107cache->clear("$plugintable");
|
||||
$message = CONTENT_ADMIN_CAT_LAN_23;
|
||||
return $message;
|
||||
}
|
||||
}elseif($cat == "content"){
|
||||
if($sql -> db_Delete($plugintable, "content_id='".intval($del_id)."' ")){
|
||||
$e107cache->clear("$plugintable");
|
||||
$message = CONTENT_ADMIN_ITEM_LAN_3;
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
function dbSetOrder($mode, $type, $order){
|
||||
global $plugintable, $sql, $aa, $qs, $_POST, $e107cache;
|
||||
//$mode : all, inc, dec
|
||||
//$type : cc (category order), ai (global all items), ci (items in category)
|
||||
//$order : posted values or id-currentorder
|
||||
|
||||
if($mode == "all"){
|
||||
foreach ($order as $cid){
|
||||
//each order value in the db has two numbers (a-b) where a = category item order, and b = global item order
|
||||
//146.3.cat : category order
|
||||
//35.3.ci.1-0 : category item order
|
||||
//35.3.ai.1-0 : global item order
|
||||
|
||||
$tmp = explode(".", $cid);
|
||||
$old = explode("-", $tmp[3]);
|
||||
$old[0] = ($old[0] == "" ? "0" : $old[0]);
|
||||
$old[1] = ($old[1] == "" ? "0" : $old[1]);
|
||||
|
||||
$tmp[0] = intval($tmp[0]);
|
||||
$tmp[1] = intval($tmp[1]);
|
||||
$old[0] = intval($old[0]);
|
||||
$old[1] = intval($old[1]);
|
||||
|
||||
if($tmp[2] == "cat"){
|
||||
$sql->db_Update($plugintable, "content_order='".$tmp[1]."' WHERE content_id='".$tmp[0]."' " );
|
||||
|
||||
}elseif($tmp[2] == "ci"){
|
||||
$sql->db_Update($plugintable, "content_order='".$tmp[1].".".$old[1]."' WHERE content_id='".$tmp[0]."' " );
|
||||
|
||||
}elseif($tmp[2] == "ai"){
|
||||
$sql->db_Update($plugintable, "content_order='".$old[0].".".$tmp[1]."' WHERE content_id='".$tmp[0]."' " );
|
||||
}
|
||||
$message = CONTENT_ADMIN_ORDER_LAN_2;
|
||||
}
|
||||
|
||||
}elseif($mode == "inc"){
|
||||
|
||||
$tmp = explode("-", $order);
|
||||
$tmp[0] = intval($tmp[0]);
|
||||
$tmp[1] = intval($tmp[1]);
|
||||
$tmp[2] = intval($tmp[2]);
|
||||
|
||||
if($type == "cc"){
|
||||
$mainparent = $aa -> getMainParent($tmp[0]);
|
||||
$array = $aa -> getCategoryTree("", $mainparent, TRUE);
|
||||
$validparent = implode(",", array_keys($array));
|
||||
$qry = " content_id REGEXP '".$aa -> CONTENTREGEXP($validparent)."' AND content_order='".($tmp[1]-1)."' ";
|
||||
$sql->db_Update($plugintable, "content_order=content_order+1 WHERE ".$qry." " );
|
||||
$sql->db_Update($plugintable, "content_order=content_order-1 WHERE content_id='".$tmp[0]."' " );
|
||||
|
||||
}elseif($type == "ci"){
|
||||
$sql->db_Update($plugintable, "content_order='".$tmp[1].".".$tmp[2]."' WHERE content_parent = '".intval($qs[2])."' AND SUBSTRING_INDEX(content_order, '.', 1) = '".($tmp[1]-1)."' " );
|
||||
$sql->db_Update($plugintable, "content_order='".($tmp[1]-1).".".$tmp[2]."' WHERE content_id='".$tmp[0]."' " );
|
||||
|
||||
}elseif($type == "ai"){
|
||||
$array = $aa -> getCategoryTree("", intval($qs[1]), TRUE);
|
||||
$validparent = implode(",", array_keys($array));
|
||||
$qry = " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' AND SUBSTRING_INDEX(content_order, '.', -1) = '".($tmp[2]-1)."' ";
|
||||
$sql->db_Update($plugintable, " content_order=content_order+0.1 WHERE ".$qry." " );
|
||||
$sql->db_Update($plugintable, "content_order='".$tmp[1].".".($tmp[2]-1)."' WHERE content_id='".$tmp[0]."' " );
|
||||
|
||||
}
|
||||
$message = CONTENT_ADMIN_ORDER_LAN_0;
|
||||
|
||||
}elseif($mode == "dec"){
|
||||
|
||||
$tmp = explode("-", $order);
|
||||
$tmp[0] = intval($tmp[0]);
|
||||
$tmp[1] = intval($tmp[1]);
|
||||
$tmp[2] = intval($tmp[2]);
|
||||
if($type == "cc"){
|
||||
$mainparent = $aa -> getMainParent($tmp[0]);
|
||||
$array = $aa -> getCategoryTree("", $mainparent, TRUE);
|
||||
$validparent = implode(",", array_keys($array));
|
||||
$qry = " content_id REGEXP '".$aa -> CONTENTREGEXP($validparent)."' AND content_order='".($tmp[1]+1)."' ";
|
||||
$sql->db_Update($plugintable, "content_order=content_order-1 WHERE ".$qry." " );
|
||||
$sql->db_Update($plugintable, "content_order=content_order+1 WHERE content_id='".$tmp[0]."' " );
|
||||
|
||||
}elseif($type == "ci"){
|
||||
$sql->db_Update($plugintable, "content_order='".$tmp[1].".".$tmp[2]."' WHERE content_parent = '".intval($qs[2])."' AND SUBSTRING_INDEX(content_order, '.', 1) = '".($tmp[1]+1)."' " );
|
||||
$sql->db_Update($plugintable, "content_order='".($tmp[1]+1).".".$tmp[2]."' WHERE content_id='".$tmp[0]."' " );
|
||||
|
||||
}elseif($type == "ai"){
|
||||
$array = $aa -> getCategoryTree("", intval($qs[1]), TRUE);
|
||||
$validparent = implode(",", array_keys($array));
|
||||
$qry = " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' AND SUBSTRING_INDEX(content_order, '.', -1) = '".($tmp[2]+1)."' ";
|
||||
$sql->db_Update($plugintable, "content_order=content_order-0.1 WHERE ".$qry." " );
|
||||
$sql->db_Update($plugintable, "content_order='".$tmp[1].".".($tmp[2]+1)."' WHERE content_id='".$tmp[0]."' " );
|
||||
}
|
||||
$message = CONTENT_ADMIN_ORDER_LAN_1;
|
||||
}
|
||||
$e107cache->clear("$plugintable");
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -12,8 +12,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/handlers/content_form_class.php,v $
|
||||
| $Revision: 1.10 $
|
||||
| $Date: 2007-04-12 21:35:00 $
|
||||
| $Revision: 1.11 $
|
||||
| $Date: 2007-04-13 10:05:45 $
|
||||
| $Author: lisa_ $
|
||||
+---------------------------------------------------------------+
|
||||
*/
|
||||
@@ -91,8 +91,9 @@ class contentform{
|
||||
</table>\n";
|
||||
|
||||
$tmp = explode(".",$_POST['parent1']);
|
||||
$_POST['parent1'] = $tmp[1];
|
||||
$_POST['parent1'] = ($tmp[1] ? $tmp[1] : $tmp[0]);
|
||||
$mainparent = $aa -> getMainParent( $_POST['parent1'] );
|
||||
|
||||
$content_pref = $aa -> getContentPref($mainparent);
|
||||
$content_cat_icon_path_large = $tp -> replaceConstants($content_pref["content_cat_icon_path_large"]);
|
||||
$content_cat_icon_path_small = $tp -> replaceConstants($content_pref["content_cat_icon_path_small"]);
|
||||
@@ -134,39 +135,43 @@ class contentform{
|
||||
$CONTENT_CONTENT_PREVIEW_TEXT = ($content_text ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_18.$TDPOST.$TDPRE2.$content_text.$TDPOST.$TRPOST : "");
|
||||
$CONTENT_CONTENT_PREVIEW_AUTHORNAME = ($_POST['content_author_name'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_10." ".CONTENT_ADMIN_ITEM_LAN_14.$TDPOST.$TDPRE2.$_POST['content_author_name'].$TDPOST.$TRPOST : "");
|
||||
$CONTENT_CONTENT_PREVIEW_AUTHOREMAIL = ($_POST['content_author_email'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_10." ".CONTENT_ADMIN_ITEM_LAN_15.$TDPOST.$TDPRE2.$_POST['content_author_email'].$TDPOST.$TRPOST : "");
|
||||
$CONTENT_CONTENT_PREVIEW_COMMENT = $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_36.$TDPOST.$TDPRE2.($_POST['content_comment'] ? CONTENT_ADMIN_ITEM_LAN_85 : CONTENT_ADMIN_ITEM_LAN_86).$TDPOST.$TRPOST;
|
||||
$CONTENT_CONTENT_PREVIEW_RATE = $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_37.$TDPOST.$TDPRE2.($_POST['content_rate'] ? CONTENT_ADMIN_ITEM_LAN_85 : CONTENT_ADMIN_ITEM_LAN_86).$TDPOST.$TRPOST;
|
||||
$CONTENT_CONTENT_PREVIEW_PE = $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_38.$TDPOST.$TDPRE2.($_POST['content_pe'] ? CONTENT_ADMIN_ITEM_LAN_85 : CONTENT_ADMIN_ITEM_LAN_86).$TDPOST.$TRPOST;
|
||||
$CONTENT_CONTENT_PREVIEW_CLASS = $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_39.$TDPOST.$TDPRE2.r_userclass_name($_POST['content_class']).$TDPOST.$TRPOST;
|
||||
$CONTENT_CONTENT_PREVIEW_COMMENT = ($_POST['content_comment'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_36.$TDPOST.$TDPRE2.CONTENT_ADMIN_ITEM_LAN_85.$TDPOST.$TRPOST : '');
|
||||
$CONTENT_CONTENT_PREVIEW_RATE = ($_POST['content_rate'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_37.$TDPOST.$TDPRE2.CONTENT_ADMIN_ITEM_LAN_85.$TDPOST.$TRPOST : '');
|
||||
$CONTENT_CONTENT_PREVIEW_PE = ($_POST['content_pe'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_38.$TDPOST.$TDPRE2.CONTENT_ADMIN_ITEM_LAN_85.$TDPOST.$TRPOST : '');
|
||||
$CONTENT_CONTENT_PREVIEW_CLASS = ($_POST['content_class'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_39.$TDPOST.$TDPRE2.r_userclass_name($_POST['content_class']).$TDPOST.$TRPOST : '');
|
||||
$CONTENT_CONTENT_PREVIEW_SCORE = ($_POST['content_score'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_40.$TDPOST.$TDPRE2.($_POST['content_score']!="none" ? $_POST['content_score']."/100" : CONTENT_ADMIN_ITEM_LAN_118." ".CONTENT_ADMIN_ITEM_LAN_40." ".CONTENT_ADMIN_ITEM_LAN_119).$TDPOST.$TRPOST : "");
|
||||
$CONTENT_CONTENT_PREVIEW_META = ($_POST['content_meta'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_53.$TDPOST.$TDPRE2.($_POST['content_meta']!="" ? $_POST['content_meta'] : CONTENT_ADMIN_ITEM_LAN_118." ".CONTENT_ADMIN_ITEM_LAN_53." ".CONTENT_ADMIN_ITEM_LAN_119).$TDPOST.$TRPOST : "");
|
||||
$CONTENT_CONTENT_PREVIEW_LAYOUT = ($_POST['content_layout'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_92.$TDPOST.$TDPRE2.($_POST['content_layout'] == "none" || $_POST['content_layout'] =="content_content_template.php" ? CONTENT_ADMIN_ITEM_LAN_120 : substr($_POST['content_layout'],25 ,-4)).$TDPOST.$TRPOST : "");
|
||||
|
||||
//start date
|
||||
if($_POST['ne_day'] != "none" && $_POST['ne_month'] != "none" && $_POST['ne_year'] != "none"){
|
||||
$CONTENT_CONTENT_PREVIEW_STARTDATE = $TRPRE.$TDPRE1.CONTENT_ADMIN_DATE_LAN_15.$TDPOST.$TDPRE2.$_POST['ne_day']." ".$months[($_POST['ne_month']-1)]." ".$_POST['ne_year'].$TDPOST.$TRPOST;
|
||||
if( isset($_POST['ne_day']) && $_POST['ne_day']!='' && $_POST['ne_day']!='0' && $_POST['ne_day'] != "none"
|
||||
&& isset($_POST['ne_month']) && $_POST['ne_month']!='' && $_POST['ne_month']!='0' && $_POST['ne_month'] != "none"
|
||||
&& isset($_POST['ne_year']) && $_POST['ne_year']!='' && $_POST['ne_year']!='0' && $_POST['ne_year'] != "none" ){
|
||||
$CONTENT_CONTENT_PREVIEW_STARTDATE = $TRPRE.$TDPRE1.CONTENT_ADMIN_DATE_LAN_15.$TDPOST.$TDPRE2.$_POST['ne_day']." ".$months[($_POST['ne_month']-1)]." ".$_POST['ne_year'].$TDPOST.$TRPOST;
|
||||
}else{
|
||||
$CONTENT_CONTENT_PREVIEW_STARTDATE = $TRPRE.$TDPRE1.CONTENT_ADMIN_DATE_LAN_15.$TDPOST.$TDPRE2.strftime("%d %b %Y", time()).$TDPOST.$TRPOST;
|
||||
$CONTENT_CONTENT_PREVIEW_STARTDATE='';
|
||||
}
|
||||
//end date
|
||||
if($_POST['end_day'] != "none" && $_POST['end_month'] != "none" && $_POST['end_year'] != "none"){
|
||||
$CONTENT_CONTENT_PREVIEW_ENDDATE = $TRPRE.$TDPRE1.CONTENT_ADMIN_DATE_LAN_16.$TDPOST.$TDPRE2.$_POST['end_day']." ".$months[($_POST['end_month']-1)]." ".$_POST['end_year'].$TDPOST.$TRPOST;
|
||||
if( isset($_POST['end_day']) && $_POST['end_day']!='' && $_POST['end_day']!='0' && $_POST['end_day'] != "none"
|
||||
&& isset($_POST['end_month']) && $_POST['end_month']!='' && $_POST['end_month']!='0' && $_POST['end_month'] != "none"
|
||||
&& isset($_POST['end_year']) && $_POST['end_year']!='' && $_POST['end_year']!='0' && $_POST['end_year'] != "none" ){
|
||||
$CONTENT_CONTENT_PREVIEW_ENDDATE = $TRPRE.$TDPRE1.CONTENT_ADMIN_DATE_LAN_16.$TDPOST.$TDPRE2.$_POST['end_day']." ".$months[($_POST['end_month']-1)]." ".$_POST['end_year'].$TDPOST.$TRPOST;
|
||||
}else{
|
||||
$CONTENT_CONTENT_PREVIEW_ENDDATE = $TRPRE.$TDPRE1.CONTENT_ADMIN_DATE_LAN_16.$TDPOST.$TDPRE2.CONTENT_ADMIN_ITEM_LAN_118." ".CONTENT_ADMIN_DATE_LAN_16." ".CONTENT_ADMIN_ITEM_LAN_119.$TDPOST.$TRPOST;
|
||||
$CONTENT_CONTENT_PREVIEW_ENDDATE='';
|
||||
}
|
||||
$CONTENT_CONTENT_PREVIEW_CUSTOM = "";
|
||||
|
||||
//custom tags
|
||||
for($i=0;$i<$content_pref["content_admin_custom_number"];$i++){
|
||||
if($_POST["content_custom_key_{$i}"] != "" && $_POST["content_custom_value_{$i}"] != ""){
|
||||
$CONTENT_CONTENT_PREVIEW_CUSTOM .= $TRPRE.$TDPRE1.$_POST["content_custom_key_{$i}"].$TDPOST.$TDPRE2.$_POST["content_custom_value_{$i}"].$TDPOST.$TRPOST;
|
||||
}
|
||||
if($_POST["content_custom_key_{$i}"] != "" && $_POST["content_custom_value_{$i}"] != ""){
|
||||
$CONTENT_CONTENT_PREVIEW_CUSTOM .= $TRPRE.$TDPRE1.$_POST["content_custom_key_{$i}"].$TDPOST.$TDPRE2.$_POST["content_custom_value_{$i}"].$TDPOST.$TRPOST;
|
||||
}
|
||||
}
|
||||
//custom preset tags
|
||||
foreach($_POST['content_custom_preset_key'] as $k => $v){
|
||||
if($k != "" && $v != ""){
|
||||
$CONTENT_CONTENT_PREVIEW_CUSTOM .= $TRPRE.$TDPRE1.$k.$TDPOST.$TDPRE2.$v.$TDPOST.$TRPOST;
|
||||
}
|
||||
if($k != "" && $v != ""){
|
||||
$CONTENT_CONTENT_PREVIEW_CUSTOM .= $TRPRE.$TDPRE1.$k.$TDPOST.$TDPRE2.$v.$TDPOST.$TRPOST;
|
||||
}
|
||||
}
|
||||
|
||||
//icon
|
||||
@@ -175,15 +180,15 @@ class contentform{
|
||||
}elseif($_POST['content_icon'] && is_readable($content_icon_path.$_POST['content_icon'])){
|
||||
$ICON = "<img src='".$content_icon_path.$_POST['content_icon']."' alt='' style='width:100px; border:0;' />";
|
||||
}else{
|
||||
$ICON = CONTENT_ADMIN_ITEM_LAN_118." ".CONTENT_ADMIN_ITEM_LAN_114." ".CONTENT_ADMIN_ITEM_LAN_119;
|
||||
$ICON='';
|
||||
}
|
||||
$CONTENT_CONTENT_PREVIEW_ICON = $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_114.$TDPOST.$TDPRE2.$ICON.$TDPOST.$TRPOST;
|
||||
$CONTENT_CONTENT_PREVIEW_ICON = ($ICON ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_114.$TDPOST.$TDPRE2.$ICON.$TDPOST.$TRPOST : '');
|
||||
|
||||
//images and attachments
|
||||
$file = FALSE;
|
||||
$image = FALSE;
|
||||
$ATTACH = $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_24.$TDPOST.$TDPRE2;
|
||||
$IMAGES = $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_31.$TDPOST.$TDPRE2;
|
||||
$ATTACH = '';
|
||||
$IMAGES = '';
|
||||
foreach($_POST as $k => $v){
|
||||
if(strpos($k, "content_files") === 0){
|
||||
if($v && is_readable($content_tmppath_file.$v)){
|
||||
@@ -205,13 +210,15 @@ class contentform{
|
||||
}
|
||||
}
|
||||
if($file !== TRUE){
|
||||
$ATTACH .= CONTENT_ADMIN_ITEM_LAN_118." ".CONTENT_ADMIN_ITEM_LAN_24." ".CONTENT_ADMIN_ITEM_LAN_119;
|
||||
$CONTENT_CONTENT_PREVIEW_ATTACH='';
|
||||
}else{
|
||||
$CONTENT_CONTENT_PREVIEW_ATTACH = $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_24.$TDPOST.$TDPRE2.$ATTACH.$TDPOST.$TRPOST;
|
||||
}
|
||||
if($image !== TRUE){
|
||||
$IMAGES .= CONTENT_ADMIN_ITEM_LAN_118." ".CONTENT_ADMIN_ITEM_LAN_31." ".CONTENT_ADMIN_ITEM_LAN_119;
|
||||
$CONTENT_CONTENT_PREVIEW_IMAGES='';
|
||||
}else{
|
||||
$CONTENT_CONTENT_PREVIEW_IMAGES = $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_31.$TDPOST.$TDPRE2.$IMAGES.$TDPOST.$TRPOST;
|
||||
}
|
||||
$CONTENT_CONTENT_PREVIEW_ATTACH = $ATTACH.$TDPOST.$TRPOST;
|
||||
$CONTENT_CONTENT_PREVIEW_IMAGES = $IMAGES.$TDPOST.$TRPOST;
|
||||
|
||||
$caption = CONTENT_ADMIN_ITEM_LAN_46." ".$_POST['content_heading'];
|
||||
$preview = preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_CONTENT_PREVIEW);
|
||||
@@ -366,19 +373,6 @@ class contentform{
|
||||
|
||||
}
|
||||
|
||||
//general variables (from the top level category preferences)
|
||||
$content_pref["content_icon_path_tmp"] = varset($content_pref["content_icon_path_tmp"], $content_pref["content_icon_path"]."tmp/");
|
||||
$content_pref["content_file_path_tmp"] = varset($content_pref["content_file_path_tmp"], $content_pref["content_file_path"]."tmp/");
|
||||
$content_pref["content_image_path_tmp"] = varset($content_pref["content_image_path_tmp"], $content_pref["content_image_path"]."tmp/");
|
||||
$content_cat_icon_path_large = $tp -> replaceConstants($content_pref["content_cat_icon_path_large"]);
|
||||
$content_cat_icon_path_small = $tp -> replaceConstants($content_pref["content_cat_icon_path_small"]);
|
||||
$content_icon_path = $tp -> replaceConstants($content_pref["content_icon_path"]);
|
||||
$content_image_path = $tp -> replaceConstants($content_pref["content_image_path"]);
|
||||
$content_file_path = $tp -> replaceConstants($content_pref["content_file_path"]);
|
||||
$content_tmppath_icon = $tp -> replaceConstants($content_pref["content_icon_path_tmp"]);
|
||||
$content_tmppath_file = $tp -> replaceConstants($content_pref["content_file_path_tmp"]);
|
||||
$content_tmppath_image = $tp -> replaceConstants($content_pref["content_image_path_tmp"]);
|
||||
|
||||
//get preferences for submit page
|
||||
if($mode == "submit"){
|
||||
$checksubheading = varsettrue($manager_pref["content_manager_submit_subheading"], "");
|
||||
@@ -621,23 +615,37 @@ class contentform{
|
||||
$hidden .= $rs -> form_hidden("end_year", $end_year);
|
||||
}
|
||||
if( $checkicon || $checkattach || $checkimages ){
|
||||
//prepare file lists
|
||||
$rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*', 'thumb_*');
|
||||
$show['upload'] = true;
|
||||
}else{
|
||||
$show['upload'] = false;
|
||||
}
|
||||
if($checkicon){
|
||||
$content_pref["content_icon_path_tmp"] = varset($content_pref["content_icon_path_tmp"], $content_pref["content_icon_path"]."tmp/");
|
||||
$content_icon_path = $tp -> replaceConstants($content_pref["content_icon_path"]);
|
||||
$content_tmppath_icon = $tp -> replaceConstants($content_pref["content_icon_path_tmp"]);
|
||||
$iconlist = $fl->get_files($content_tmppath_icon,"",$rejectlist);
|
||||
$show['icon'] = true;
|
||||
}else{
|
||||
$show['icon'] = false;
|
||||
$hidden .= $rs -> form_hidden("content_icon", $row['content_icon']);
|
||||
}
|
||||
if($checkattach){
|
||||
$content_pref["content_file_path_tmp"] = varset($content_pref["content_file_path_tmp"], $content_pref["content_file_path"]."tmp/");
|
||||
$content_file_path = $tp -> replaceConstants($content_pref["content_file_path"]);
|
||||
$content_tmppath_file = $tp -> replaceConstants($content_pref["content_file_path_tmp"]);
|
||||
$filelist = $fl->get_files($content_tmppath_file,"",$rejectlist);
|
||||
$show['attach'] = true;
|
||||
}else{
|
||||
$show['attach'] = false;
|
||||
$hidden .= $rs -> form_hidden("content_file", $row['content_file']);
|
||||
}
|
||||
if($checkimages){
|
||||
$content_pref["content_image_path_tmp"] = varset($content_pref["content_image_path_tmp"], $content_pref["content_image_path"]."tmp/");
|
||||
$content_image_path = $tp -> replaceConstants($content_pref["content_image_path"]);
|
||||
$content_tmppath_image = $tp -> replaceConstants($content_pref["content_image_path_tmp"]);
|
||||
$imagelist = $fl->get_files($content_tmppath_image,"",$rejectlist);
|
||||
$show['images'] = true;
|
||||
}else{
|
||||
$show['images'] = false;
|
||||
@@ -715,12 +723,6 @@ class contentform{
|
||||
$content_author_email_value = ($content_author_email ? $content_author_email : CONTENT_ADMIN_ITEM_LAN_15);
|
||||
$content_author_email_js = ($content_author_email ? "" : "onfocus=\"if(document.getElementById('dataform').content_author_email.value=='".CONTENT_ADMIN_ITEM_LAN_15."'){document.getElementById('dataform').content_author_email.value='';}\"");
|
||||
|
||||
//prepare file lists
|
||||
$rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*', 'thumb_*');
|
||||
$iconlist = $fl->get_files($content_tmppath_icon,"",$rejectlist);
|
||||
$filelist = $fl->get_files($content_tmppath_file,"",$rejectlist);
|
||||
$imagelist = $fl->get_files($content_tmppath_image,"",$rejectlist);
|
||||
|
||||
//retrieve the custom/preset data tags
|
||||
if(!(isset($_POST['preview_content']) || isset($message))){
|
||||
if( varsettrue($row['content_pref']) ){
|
||||
|
Reference in New Issue
Block a user