mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +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'];
|
||||
|
@@ -12,8 +12,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/handlers/content_class.php,v $
|
||||
| $Revision: 1.15 $
|
||||
| $Date: 2007-04-12 23:11:46 $
|
||||
| $Revision: 1.16 $
|
||||
| $Date: 2007-04-13 10:05:45 $
|
||||
| $Author: lisa_ $
|
||||
+---------------------------------------------------------------+
|
||||
*/
|
||||
@@ -22,7 +22,7 @@ if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
global $plugindir, $plugintable, $datequery;
|
||||
$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 !!)
|
||||
$plugintable = "pcontent";
|
||||
$datequery = " AND content_datestamp < ".time()." AND (content_enddate=0 || content_enddate>".time().") ";
|
||||
|
||||
require_once($plugindir."handlers/content_defines.php");
|
||||
@@ -558,10 +558,18 @@ class content{
|
||||
return "(^|,)(".str_replace(",", "|", $var).")(,|$)";
|
||||
}
|
||||
|
||||
function getCategoryTree($id, $parent, $classcheck=TRUE){
|
||||
function getCategoryTree($id, $parent, $classcheck=TRUE, $cache=true){
|
||||
//id : content_parent of an item
|
||||
global $plugintable, $datequery, $agc;
|
||||
|
||||
if($cache){
|
||||
$cachestring = md5("cm_gct_".$id."_".$parent."_".$classcheck);
|
||||
if($ret = getcachedvars("content_getcategorytree_{$cachestring}"))
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
if($parent){
|
||||
$agc = "";
|
||||
$qrygc = " content_id = '".intval($parent)."' ";
|
||||
@@ -599,9 +607,14 @@ class content{
|
||||
}else{
|
||||
$agc[$row['content_id']] = array($row['content_id'], $row['content_heading']);
|
||||
}
|
||||
$this -> getCategoryTree($row['content_id'], "", $classcheck, $level+1);
|
||||
$this -> getCategoryTree($row['content_id'], "", $classcheck, false);
|
||||
}
|
||||
}
|
||||
|
||||
if($cache){
|
||||
cachevars("content_getcategorytree_{$cachestring}", $agc);
|
||||
}
|
||||
|
||||
return $agc;
|
||||
}
|
||||
|
||||
@@ -670,8 +683,10 @@ class content{
|
||||
for($i=0;$i<count($arr[$parent]);$i++){
|
||||
if($i == count($arr[$parent])-2){
|
||||
$crumb .= "<a href='".e_SELF."?cat.".$arr[$parent][$i]."'>".$arr[$parent][$i+1]."</a>";
|
||||
break;
|
||||
}else{
|
||||
$crumb .= "<a href='".e_SELF."?cat.".$arr[$parent][$i]."'>".$arr[$parent][$i+1]."</a> ".$sep." ";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -878,9 +893,17 @@ class content{
|
||||
return $getauthor;
|
||||
}
|
||||
|
||||
function getMainParent($id){
|
||||
function getMainParent($id, $cache=true){
|
||||
global $sql, $plugintable;
|
||||
|
||||
if($cache){
|
||||
$cachestring = md5("cm_gmp_".$id);
|
||||
if($ret = getcachedvars("content_getmainparent_{$cachestring}"))
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
$category_total = $sql -> db_Select($plugintable, "content_id, content_parent", "content_id='".intval($id)."' ");
|
||||
$row = $sql -> db_Fetch();
|
||||
if($row['content_parent'] == 0){
|
||||
@@ -891,9 +914,14 @@ class content{
|
||||
}else{
|
||||
$newid = $row['content_parent'];
|
||||
}
|
||||
$mainparent = $this -> getMainParent( $newid );
|
||||
$mainparent = $this -> getMainParent( $newid, false );
|
||||
}
|
||||
$val = ($mainparent ? $mainparent : "0");
|
||||
|
||||
if($cache){
|
||||
cachevars("content_getmainparent_{$cachestring}", $val);
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
|
@@ -12,20 +12,19 @@
|
||||
| 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; }
|
||||
if (!defined('ADMIN_WIDTH')) { define("ADMIN_WIDTH", "width:98%;"); }
|
||||
|
||||
$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 !!)
|
||||
$plugintable = "pcontent";
|
||||
$datequery = " AND content_datestamp < ".time()." AND (content_enddate=0 || content_enddate>".time().") ";
|
||||
|
||||
if (!defined('ADMIN_WIDTH')) { define("ADMIN_WIDTH", "width:98%;"); }
|
||||
|
||||
//icon, file, image upload
|
||||
if(isset($_POST['uploadfile'])){
|
||||
|
||||
@@ -101,16 +100,15 @@ if(isset($_POST['uploadfile'])){
|
||||
|
||||
class contentdb{
|
||||
|
||||
//function dbContentUpdate($mode, $type){
|
||||
function dbContent($mode, $type){
|
||||
//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']);
|
||||
|
||||
if(e_WYSIWYG){
|
||||
$_POST['content_text'] = $tp->createConstants($_POST['content_text']); // convert e107_images/ to {e_IMAGE} etc.
|
||||
}
|
||||
@@ -119,7 +117,6 @@ class contentdb{
|
||||
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']);
|
||||
@@ -139,7 +136,6 @@ class contentdb{
|
||||
}
|
||||
$_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) ){
|
||||
@@ -264,14 +260,10 @@ class contentdb{
|
||||
}
|
||||
}
|
||||
//preset additional data tags
|
||||
if( varsettrue(($_POST['content_custom_preset_key']) ){
|
||||
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 = "";
|
||||
}
|
||||
$contentprefvalue = ($custom ? $eArrayStorage->WriteArray($custom) : '');
|
||||
|
||||
$_POST['content_layout'] = (!$_POST['content_layout'] || $_POST['content_layout'] == "content_content_template.php" ? "" : $tp->toDB($_POST['content_layout']));
|
||||
|
||||
@@ -309,19 +301,8 @@ class contentdb{
|
||||
}
|
||||
|
||||
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 = "";
|
||||
}
|
||||
}
|
||||
$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");
|
||||
@@ -334,7 +315,6 @@ class contentdb{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//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;
|
||||
@@ -399,7 +379,7 @@ class contentdb{
|
||||
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
|
||||
// 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);
|
||||
@@ -411,7 +391,7 @@ class contentdb{
|
||||
}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
|
||||
// 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']);
|
||||
|
@@ -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,25 +135,29 @@ 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"){
|
||||
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"){
|
||||
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 = "";
|
||||
|
||||
@@ -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