1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 05:37:32 +02:00

content: added parseConstants function (extending content_pref) and changed respective sanitazion of path variables

This commit is contained in:
lia
2007-04-16 22:11:09 +00:00
parent 6fda99deb2
commit 0ffa8ea9e0
8 changed files with 181 additions and 223 deletions

View File

@@ -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.13 $
| $Date: 2007-04-16 20:41:01 $
| $Revision: 1.14 $
| $Date: 2007-04-16 22:11:08 $
| $Author: lisa_ $
+---------------------------------------------------------------+
*/
@@ -183,20 +183,18 @@ function show_content_search_menu($mode, $mainparent){
}
}
return TRUE;
}
function show_content_search_result($searchkeyword){
global $row, $qs, $content_shortcodes, $ns, $rs, $tp, $plugindir, $plugintable, $gen, $aa, $content_pref, $datequery, $mainparent, $content_icon_path;
global $row, $qs, $content_shortcodes, $ns, $rs, $tp, $plugindir, $plugintable, $gen, $aa, $content_pref, $datequery, $mainparent;
$mainparent = $aa -> getMainParent( (is_numeric($qs[1]) ? $qs[1] : intval($qs[2])) );
$content_pref = $aa -> getContentPref($mainparent);
$content_pref = $aa -> getContentPref($mainparent, true);
$array = $aa -> getCategoryTree("", intval($qs[1]), TRUE);
$validparent = implode(",", array_keys($array));
$qry = " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
$searchkeyword = $tp -> toDB($searchkeyword);
$qry .= " AND (content_heading REGEXP '".$searchkeyword."' OR content_subheading REGEXP '".$searchkeyword."' OR content_summary REGEXP '".$searchkeyword."' OR content_text REGEXP '".$searchkeyword."' ) ";
$content_icon_path = $tp -> replaceConstants($content_pref["content_icon_path"]);
$sqlsr = "";
if(!is_object($sqlsr)){ $sqlsr = new db; }
@@ -263,7 +261,7 @@ function CachePost($cachestring=''){
// ##### CONTENT TYPE LIST ------------------------------
function show_content(){
global $qs, $content_shortcodes, $ns, $plugintable, $sql, $aa, $e107cache, $tp, $pref, $content_pref, $content_cat_icon_path_large, $content_cat_icon_path_small, $datequery, $content_icon_path, $eArrayStorage, $contenttotal, $row;
global $qs, $content_shortcodes, $ns, $plugintable, $sql, $aa, $e107cache, $tp, $pref, $content_pref, $datequery, $eArrayStorage, $contenttotal, $row;
if(is_readable(e_THEME.$pref['sitetheme']."/content/content_type_template.php")){
require_once(e_THEME.$pref['sitetheme']."/content/content_type_template.php");
@@ -290,11 +288,7 @@ function show_content(){
if(!is_object($sql2)){ $sql2 = new db; }
$content_pref = $eArrayStorage->ReadArray($row['content_pref']);
$content_pref["content_cat_icon_path_large"] = varset($content_pref["content_cat_icon_path_large"], "{e_PLUGIN}content/images/cat/48/");
$content_pref["content_cat_icon_path_small"] = varset($content_pref["content_cat_icon_path_small"], "{e_PLUGIN}content/images/cat/16/");
$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_pref = $aa->parseConstants($content_pref);
$array = $aa -> getCategoryTree("", $row['content_id'], TRUE);
$validparent = implode(",", array_keys($array));
@@ -346,7 +340,7 @@ function show_content_archive(){
global $row, $ns, $plugindir, $plugintable, $sql, $aa, $rs, $e107cache, $tp, $pref, $content_pref, $cobj, $qs, $searchkeyword, $nextprevquery, $from, $number, $mainparent, $content_shortcodes, $datequery, $CONTENT_ARCHIVE_TABLE_LETTERS, $CONTENT_SEARCH_TABLE_SELECT, $CONTENT_SEARCH_TABLE_ORDER, $CONTENT_SEARCH_TABLE_KEYWORD, $CONTENT_NEXTPREV;
$mainparent = $aa -> getMainParent(intval($qs[1]));
$content_pref = $aa -> getContentPref($mainparent);
$content_pref = $aa -> getContentPref($mainparent, true);
show_content_search_menu("archive", $mainparent); //show navigator/search/order menu
@@ -460,12 +454,13 @@ function displayPreview($qry, $np=false, $array=false){
// ##### RECENT LIST ------------------------------------
function show_content_recent(){
global $qs, $sql2, $plugindir, $ns, $plugintable, $sql, $aa, $e107cache, $tp, $pref, $content_pref, $cobj, $nextprevquery, $from, $number, $mainparent, $datequery, $content_icon_path, $CONTENT_RECENT_TABLE, $array;
global $qs, $sql2, $plugindir, $ns, $plugintable, $sql, $aa, $e107cache, $tp, $pref, $content_pref, $cobj, $nextprevquery, $from, $number, $mainparent, $datequery, $CONTENT_RECENT_TABLE, $array;
$mainparent = $aa -> getMainParent(intval($qs[1]));
$content_pref = $aa -> getContentPref($mainparent);
$content_pref = $aa -> getContentPref($mainparent, true);
show_content_search_menu("recent", $mainparent); //show navigator/search/order menu
$content_pref = $aa->parseConstants($content_pref);
$cachestr = "$plugintable.recent.$qs[1]";
$cachecheck = CachePre($cachestr);
@@ -473,7 +468,6 @@ function show_content_recent(){
echo $cachecheck;
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));
@@ -501,12 +495,12 @@ function show_content_recent(){
// ##### CATEGORY LIST ------------------------------------
function show_content_cat_all(){
global $qs, $plugindir, $content_shortcodes, $ns, $plugintable, $aa, $e107cache, $tp, $pref, $content_pref, $totalitems, $row, $datestamp, $comment_total, $gen, $authordetails, $rater, $crumb, $sql, $datequery, $amount, $from, $content_cat_icon_path_large, $content_icon_path, $n, $mainparent, $CM_AUTHOR, $CONTENT_CAT_TABLE_INFO_PRE, $CONTENT_CAT_TABLE_INFO_POST, $CONTENT_CAT_LIST_TABLE_INFO_PRE, $CONTENT_CAT_LIST_TABLE_INFO_POST;
global $qs, $plugindir, $content_shortcodes, $ns, $plugintable, $aa, $e107cache, $tp, $pref, $content_pref, $totalitems, $row, $datestamp, $comment_total, $gen, $authordetails, $rater, $crumb, $sql, $datequery, $amount, $from, $n, $mainparent, $CM_AUTHOR, $CONTENT_CAT_TABLE_INFO_PRE, $CONTENT_CAT_TABLE_INFO_POST, $CONTENT_CAT_LIST_TABLE_INFO_PRE, $CONTENT_CAT_LIST_TABLE_INFO_POST;
unset($text);
$mainparent = $aa -> getMainParent(intval($qs[2]));
$content_pref = $aa -> getContentPref($mainparent);
$content_pref = $aa -> getContentPref($mainparent, true);
show_content_search_menu("catall", $mainparent); //show navigator/search/order menu
@@ -520,8 +514,6 @@ function show_content_cat_all(){
echo $cachecheck;
return;
}
$content_cat_icon_path_large = $tp -> replaceConstants($content_pref["content_cat_icon_path_large"]);
$content_icon_path = $tp -> replaceConstants($content_pref["content_icon_path"]);
$array = $aa -> getCategoryTree("", $mainparent, TRUE);
$validparent = implode(",", array_keys($array));
$order = $aa -> getOrder();
@@ -566,10 +558,10 @@ function show_content_cat_all(){
}
function show_content_cat($mode=""){
global $qs, $plugindir, $content_shortcodes, $ns, $plugintable, $sql, $aa, $e107cache, $tp, $pref, $content_pref, $cobj, $datequery, $from, $CONTENT_RECENT_TABLE, $CM_AUTHOR, $CONTENT_CAT_LIST_TABLE_INFO_PRE, $CONTENT_CAT_LIST_TABLE_INFO_POST, $content_cat_icon_path_small, $content_cat_icon_path_large, $content_icon_path, $mainparent, $totalparent, $totalsubcat, $row, $datestamp, $comment_total, $gen, $authordetails, $rater, $crumb, $amount, $array;
global $qs, $plugindir, $content_shortcodes, $ns, $plugintable, $sql, $aa, $e107cache, $tp, $pref, $content_pref, $cobj, $datequery, $from, $CONTENT_RECENT_TABLE, $CM_AUTHOR, $CONTENT_CAT_LIST_TABLE_INFO_PRE, $CONTENT_CAT_LIST_TABLE_INFO_POST, $mainparent, $totalparent, $totalsubcat, $row, $datestamp, $comment_total, $gen, $authordetails, $rater, $crumb, $amount, $array;
$mainparent = $aa -> getMainParent(intval($qs[1]));
$content_pref = $aa -> getContentPref($mainparent);
$content_pref = $aa -> getContentPref($mainparent, true);
$array = $aa -> getCategoryTree("", $mainparent, TRUE);
$validparent = "0,0.".implode(",0.", array_keys($array));
@@ -581,9 +573,6 @@ function show_content_cat($mode=""){
foreach($template_vars as $t){ global $$t; }
$aa -> gettemplate($template_vars, 'content_cat_template.php');
$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"]);
$order = $aa -> getOrder();
$number = varsettrue($content_pref["content_nextprev_number"], '5');
$nextprevquery = (varsettrue($content_pref["content_nextprev"]) ? "LIMIT ".intval($from).",".intval($number) : "");
@@ -743,7 +732,7 @@ function show_content_author_all(){
global $qs, $plugindir, $content_shortcodes, $ns, $plugintable, $from, $sql, $aa, $e107cache, $tp, $pref, $mainparent, $content_pref, $cobj, $datequery, $authordetails, $i, $gen, $totalcontent, $row, $CONTENT_NEXTPREV;
$mainparent = $aa -> getMainParent(intval($qs[2]));
$content_pref = $aa -> getContentPref($mainparent);
$content_pref = $aa -> getContentPref($mainparent, true);
show_content_search_menu("authorall", $mainparent); //show navigator/search/order menu
@@ -876,10 +865,10 @@ function show_content_author_all(){
function show_content_author(){
global $qs, $plugindir, $content_shortcodes, $ns, $plugintable, $sql, $aa, $e107cache, $tp, $pref, $content_pref, $cobj, $nextprevquery, $from, $number, $content_icon_path, $CONTENT_RECENT_TABLE, $datequery, $crumb, $mainparent, $array;
global $qs, $plugindir, $content_shortcodes, $ns, $plugintable, $sql, $aa, $e107cache, $tp, $pref, $content_pref, $cobj, $nextprevquery, $from, $number, $CONTENT_RECENT_TABLE, $datequery, $crumb, $mainparent, $array;
$mainparent = $aa -> getMainParent(intval($qs[1]));
$content_pref = $aa -> getContentPref($mainparent);
$content_pref = $aa -> getContentPref($mainparent, true);
show_content_search_menu("author", $mainparent); //show navigator/search/order menu
@@ -889,7 +878,6 @@ function show_content_author(){
echo $cachecheck;
return;
}
$content_icon_path = $tp -> replaceConstants($content_pref["content_icon_path"]);
$array = $aa -> getCategoryTree("", $mainparent, TRUE);
if(array_key_exists($qs[1], $array)){
$validparent = "0,0.".implode(",0.", array_keys($array));
@@ -930,10 +918,10 @@ function show_content_author(){
// ##### TOP RATED LIST -----------------------------------
function show_content_top(){
global $qs, $plugindir, $content_shortcodes, $ns, $plugintable, $sql, $aa, $e107cache, $tp, $pref, $cobj, $content_icon_path, $from, $datequery, $content_pref, $mainparent, $CM_AUTHOR, $authordetails, $row, $CONTENT_NEXTPREV;
global $qs, $plugindir, $content_shortcodes, $ns, $plugintable, $sql, $aa, $e107cache, $tp, $pref, $cobj, $from, $datequery, $content_pref, $mainparent, $CM_AUTHOR, $authordetails, $row, $CONTENT_NEXTPREV;
$mainparent = $aa -> getMainParent(intval($qs[1]));
$content_pref = $aa -> getContentPref($mainparent);
$content_pref = $aa -> getContentPref($mainparent, true);
show_content_search_menu("top", $mainparent); //show navigator/search/order menu
@@ -947,7 +935,6 @@ function show_content_top(){
echo $cachecheck;
return;
}
$content_icon_path = $tp -> replaceConstants($content_pref["content_icon_path"]);
$array = $aa -> getCategoryTree("", intval($qs[1]), TRUE);
$validparent = implode(",", array_keys($array));
$datequery1 = " AND p.content_datestamp < ".time()." AND (p.content_enddate=0 || p.content_enddate>".time().") ";
@@ -989,10 +976,10 @@ function show_content_top(){
// ##### TOP SCORE LIST -----------------------------------
function show_content_score(){
global $qs, $plugindir, $content_shortcodes, $ns, $plugintable, $sql, $aa, $e107cache, $tp, $pref, $cobj, $content_icon_path, $from, $datequery, $content_pref, $mainparent, $eArrayStorage, $CM_AUTHOR, $authordetails, $row, $thisratearray, $CONTENT_NEXTPREV;
global $qs, $plugindir, $content_shortcodes, $ns, $plugintable, $sql, $aa, $e107cache, $tp, $pref, $cobj, $from, $datequery, $content_pref, $mainparent, $eArrayStorage, $CM_AUTHOR, $authordetails, $row, $thisratearray, $CONTENT_NEXTPREV;
$mainparent = $aa -> getMainParent(intval($qs[1]));
$content_pref = $aa -> getContentPref($mainparent);
$content_pref = $aa -> getContentPref($mainparent, true);
show_content_search_menu("score", $mainparent); //show navigator/search/order menu
$template_vars = array("CONTENT_SCORE_TABLE", "CONTENT_SCORE_TABLE_START", "CONTENT_SCORE_TABLE_END");
@@ -1005,7 +992,6 @@ function show_content_score(){
echo $cachecheck;
return;
}
$content_icon_path = $tp -> replaceConstants($content_pref["content_icon_path"]);
$array = $aa -> getCategoryTree("", intval($qs[1]), TRUE);
$validparent = implode(",", array_keys($array));
$qry = " content_score != '0' AND content_score != '' AND content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ";
@@ -1035,12 +1021,12 @@ function show_content_score(){
// ##### CONTENT ITEM ------------------------------------------
function show_content_item(){
global $pref, $content_pref, $content_icon_path, $content_image_path, $content_file_path, $custom, $plugindir, $plugintable, $array, $content_shortcodes, $datequery, $order, $nextprevquery, $from, $number, $row, $qs, $gen, $sql, $aa, $tp, $rs, $cobj, $e107, $e107cache, $eArrayStorage, $ns, $rater, $ep, $row, $authordetails, $mainparent;
global $pref, $content_pref, $custom, $plugindir, $plugintable, $array, $content_shortcodes, $datequery, $order, $nextprevquery, $from, $number, $row, $qs, $gen, $sql, $aa, $tp, $rs, $cobj, $e107, $e107cache, $eArrayStorage, $ns, $rater, $ep, $row, $authordetails, $mainparent;
global $CONTENT_CONTENT_TABLE_TEXT, $CONTENT_CONTENT_TABLE_PAGENAMES, $CONTENT_CONTENT_TABLE_SUMMARY, $CONTENT_CONTENT_TABLE_CUSTOM_TAGS, $CONTENT_CONTENT_TABLE_PARENT, $CONTENT_CONTENT_TABLE_INFO_PRE, $CONTENT_CONTENT_TABLE_INFO_POST, $CM_AUTHOR, $CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA, $CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA;
global $CONTENT_CONTENT_TABLE_PREV_PAGE, $CONTENT_CONTENT_TABLE_NEXT_PAGE;
$mainparent = $aa -> getMainParent(intval($qs[1]));
$content_pref = $aa -> getContentPref($mainparent);
$content_pref = $aa -> getContentPref($mainparent, true);
show_content_search_menu("item", $mainparent); //show navigator/search/order menu
$array = $aa -> getCategoryTree("", $mainparent, TRUE);
@@ -1083,16 +1069,7 @@ function show_content_item(){
echo $cachecheck;
return;
}
$content_pref["content_cat_icon_path_large"] = varset($content_pref["content_cat_icon_path_large"], "{e_PLUGIN}content/images/cat/48/");
$content_pref["content_cat_icon_path_small"] = varset($content_pref["content_cat_icon_path_small"], "{e_PLUGIN}content/images/cat/16/");
$content_pref["content_icon_path"] = varset($content_pref["content_icon_path"], "{e_PLUGIN}content/images/icon/");
$content_pref["content_image_path"] = varset($content_pref["content_image_path"], "{e_PLUGIN}content/images/image/");
$content_pref["content_file_path"] = varset($content_pref["content_file_path"], "{e_PLUGIN}content/images/file/");
$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"]);
$number = varsettrue($content_pref["content_nextprev_number"],'5');
$nextprevquery = (varsettrue($content_pref["content_nextprev"]) ? "LIMIT ".intval($from).",".intval($number) : "");

View File

@@ -12,8 +12,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/content_manager.php,v $
| $Revision: 1.5 $
| $Date: 2007-04-12 21:35:00 $
| $Revision: 1.6 $
| $Date: 2007-04-16 22:11:09 $
| $Author: lisa_ $
+---------------------------------------------------------------+
*/
@@ -189,6 +189,7 @@ if(!e_QUERY){
$row = $sql -> db_Fetch();
$content_pref = $eArrayStorage->ReadArray($row['e107_value']);
}
$content_pref = $aa->parseConstants($content_pref);
//now we can check the permissions for this user
$personalmanagercheck = FALSE;

View File

@@ -235,51 +235,51 @@ if($sc_mode){
SC_END
SC_BEGIN CM_ICON
global $aa, $row, $content_pref, $content_icon_path, $content_cat_icon_path_small, $content_cat_icon_path_large;
global $aa, $row, $content_pref;
if($sc_mode){
if($sc_mode=='top'){
if(varsettrue($content_pref["content_top_icon"])){
$width = varsettrue($content_pref["content_upload_icon_size"], '100');
$width = varsettrue($content_pref["content_top_icon_width"], $width);
return $aa -> getIcon("item", $row['content_icon'], $content_icon_path, "content.".$row['content_id'], $width, $content_pref["content_blank_icon"]);
return $aa -> getIcon("item", $row['content_icon'], $content_pref['content_icon_path'], "content.".$row['content_id'], $width, $content_pref["content_blank_icon"]);
}
}elseif($sc_mode=='score'){
if(varsettrue($content_pref["content_score_icon"])){
$width = varsettrue($content_pref["content_upload_icon_size"], '100');
$width = varsettrue($content_pref["content_score_icon_width"], $width);
return $aa -> getIcon("item", $row['content_icon'], $content_icon_path, "content.".$row['content_id'], $width, $content_pref["content_blank_icon"]);
return $aa -> getIcon("item", $row['content_icon'], $content_pref['content_icon_path'], "content.".$row['content_id'], $width, $content_pref["content_blank_icon"]);
}
}elseif($sc_mode=='cat'){
if(varsettrue($content_pref["content_catall_icon"])){
$qry = "cat.".$row['content_id'];
return $aa -> getIcon("catlarge", $row['content_icon'], $content_cat_icon_path_large, $qry, "", $content_pref["content_blank_caticon"]);
return $aa -> getIcon("catlarge", $row['content_icon'], $content_pref['content_cat_icon_path_large'], $qry, "", $content_pref["content_blank_caticon"]);
}
}elseif($sc_mode=='catlist'){
if(varsettrue($content_pref["content_cat_icon"])){
return $aa -> getIcon("catlarge", $row['content_icon'], $content_cat_icon_path_large, "", "", $content_pref["content_blank_caticon"]);
return $aa -> getIcon("catlarge", $row['content_icon'], $content_pref['content_cat_icon_path_large'], "", "", $content_pref["content_blank_caticon"]);
}
}elseif($sc_mode=='catlistsub'){
if(varsettrue($content_pref["content_catsub_icon"])){
return $aa -> getIcon("catsmall", $row['content_icon'], $content_cat_icon_path_small, "cat.".$row['content_id'], "", $content_pref["content_blank_caticon"]);
return $aa -> getIcon("catsmall", $row['content_icon'], $content_pref['content_cat_icon_path_small'], "cat.".$row['content_id'], "", $content_pref["content_blank_caticon"]);
}
}elseif($sc_mode=='recent'){
if(varsettrue($content_pref["content_list_icon"])){
$width = varsettrue($content_pref["content_upload_icon_size"], '100');
return $aa -> getIcon("item", $row['content_icon'], $content_icon_path, "content.".$row['content_id'], $width, $content_pref["content_blank_icon"]);
return $aa -> getIcon("item", $row['content_icon'], $content_pref['content_icon_path'], "content.".$row['content_id'], $width, $content_pref["content_blank_icon"]);
}
}elseif($sc_mode=='author'){
return "<a href='".e_SELF."?author.".$row['content_id']."'>".CONTENT_ICON_AUTHORLIST."</a>";
}elseif($sc_mode=='content'){
if(varsettrue($content_pref["content_content_icon"])){
$width = varsettrue($content_pref["content_upload_icon_size"], '100');
return $aa -> getIcon("item", $row['content_icon'], $content_icon_path, "", $width, $content_pref["content_blank_icon"]);
return $aa -> getIcon("item", $row['content_icon'], $content_pref['content_icon_path'], "", $width, $content_pref["content_blank_icon"]);
}
}elseif($sc_mode=='type'){
$qry = "cat.".$row['content_id'];
return $aa -> getIcon("catlarge", $row['content_icon'], $content_cat_icon_path_large, $qry, "", $content_pref["content_blank_caticon"]);
return $aa -> getIcon("catlarge", $row['content_icon'], $content_pref['content_cat_icon_path_large'], $qry, "", $content_pref["content_blank_caticon"]);
}elseif($sc_mode=='searchresult'){
$width = varsettrue($content_pref["content_upload_icon_size"], '100');
return $aa -> getIcon("item", $row['content_icon'], $content_icon_path, "content.".$row['content_id'], $width, $content_pref["content_blank_icon"]);
return $aa -> getIcon("item", $row['content_icon'], $content_pref['content_icon_path'], "content.".$row['content_id'], $width, $content_pref["content_blank_icon"]);
}elseif($sc_mode=='manager_link'){
return "<a href='".e_PLUGIN."content/content_manager.php'>".CONTENT_ICON_CONTENTMANAGER."</a>";
}elseif($sc_mode=='manager_new'){
@@ -548,7 +548,7 @@ SC_BEGIN CM_FILE
global $row, $tp;
if($sc_mode){
if($sc_mode=='content'){
global $row, $content_file_path, $content_pref;
global $row, $content_pref;
if($content_pref["content_content_attach"]){
$filestmp = explode("[file]", $row['content_file']);
foreach($filestmp as $key => $value) {
@@ -561,9 +561,9 @@ if($sc_mode){
$file = "";
$filesexisting = "0";
for($i=0;$i<count($files);$i++){
if(file_exists($content_file_path.$files[$i])){
if(file_exists($content_pref['content_file_path'].$files[$i])){
$filesexisting = $filesexisting+1;
$file .= "<a href='".$content_file_path.$files[$i]."' rel='external'>".CONTENT_ICON_FILE."</a> ";
$file .= "<a href='".$content_pref['content_file_path'].$files[$i]."' rel='external'>".CONTENT_ICON_FILE."</a> ";
}else{
$file .= "&nbsp;";
}
@@ -580,7 +580,7 @@ SC_BEGIN CM_IMAGES
global $row, $tp;
if($sc_mode){
if($sc_mode=='content'){
global $row, $content_image_path, $aa, $tp, $authordetails, $content_pref;
global $row, $aa, $tp, $authordetails, $content_pref;
if($content_pref["content_content_images"]){
$authordetails = $aa -> getAuthor($row['content_author']);
$imagestmp = explode("[img]", $row['content_image']);
@@ -597,8 +597,8 @@ if($sc_mode){
$gen = new convert;
$datestamp = preg_replace("# -.*#", "", $gen -> convert_date($row['content_datestamp'], "long"));
for($i=0;$i<count($images);$i++){
$oSrc = $content_image_path.$images[$i];
$oSrcThumb = $content_image_path."thumb_".$images[$i];
$oSrc = $content_pref['content_image_path'].$images[$i];
$oSrcThumb = $content_pref['content_image_path']."thumb_".$images[$i];
$oIconWidth = varsettrue($content_pref["content_upload_image_size_thumb"], '100');
$oMaxWidth = varsettrue($content_pref["content_upload_image_size"], '500');
$subheading = $tp -> toHTML($row['content_subheading'], TRUE);
@@ -612,7 +612,7 @@ if($sc_mode){
}
}elseif($sc_mode=='print'){
global $row, $content_image_path, $tp, $content_pref;
global $row, $tp, $content_pref;
if($content_pref["content_content_images"]){
$imagestmp = explode("[img]", $row['content_image']);
foreach($imagestmp as $key => $value) {
@@ -623,8 +623,8 @@ if($sc_mode){
$images = array_values($imagestmp);
$ret = "";
for($i=0;$i<count($images);$i++){
$oSrc = $content_image_path.$images[$i];
$oSrcThumb = $content_image_path."thumb_".$images[$i];
$oSrc = $content_pref['content_image_path'].$images[$i];
$oSrcThumb = $content_pref['content_image_path']."thumb_".$images[$i];
$iconwidth = varsettrue($content_pref["content_upload_image_size_thumb"], '100');
if($iconwidth){
$style = "style='width:".$iconwidth."px;'";
@@ -644,7 +644,7 @@ if($sc_mode){
}
}elseif($sc_mode=='pdf'){
global $row, $content_image_path, $tp, $content_pref;
global $row, $tp, $content_pref;
if($content_pref["content_content_images"]){
$imagestmp = explode("[img]", $row['content_image']);
foreach($imagestmp as $key => $value) {
@@ -655,8 +655,8 @@ if($sc_mode){
$images = array_values($imagestmp);
$ret = "";
for($i=0;$i<count($images);$i++){
$oSrc = $content_image_path.$images[$i];
$oSrcThumb = $content_image_path."thumb_".$images[$i];
$oSrc = $content_pref['content_image_path'].$images[$i];
$oSrcThumb = $content_pref['content_image_path']."thumb_".$images[$i];
$iconwidth = varsettrue($content_pref["content_upload_image_size_thumb"], '100');
if($iconwidth){
$style = "style='width:".$iconwidth."px;'";
@@ -956,7 +956,7 @@ return ($content_pref["content_menu_cat_caption"] != "" ? $content_pref["content
SC_END
SC_BEGIN CM_MENU_CATEGORY_ICON
global $content_pref, $row, $content_cat_icon_path_small, $bullet;
global $content_pref, $row, $bullet;
$ret = "";
if($content_pref["content_menu_cat_icon"] == "0"){ $ret = "";
}elseif($content_pref["content_menu_cat_icon"] == "1"){ $ret = $bullet;
@@ -964,8 +964,8 @@ global $content_pref, $row, $content_cat_icon_path_small, $bullet;
}elseif($content_pref["content_menu_cat_icon"] == "3"){ $ret = "&ordm;";
}elseif($content_pref["content_menu_cat_icon"] == "4"){ $ret = "&raquo;";
}elseif($content_pref["content_menu_cat_icon"] == "5"){
if($row['content_icon'] != "" && is_readable($content_cat_icon_path_small.$row['content_icon']) ){
$ret = "<a href='".e_PLUGIN."content/content.php?cat.".$row['content_id']."'><img src='".$content_cat_icon_path_small.$row['content_icon']."' alt='' style='border:0;' /></a>";
if($row['content_icon'] != "" && is_readable($content_pref['content_cat_icon_path_small'].$row['content_icon']) ){
$ret = "<a href='".e_PLUGIN."content/content.php?cat.".$row['content_id']."'><img src='".$content_pref['content_cat_icon_path_small'].$row['content_icon']."' alt='' style='border:0;' /></a>";
}else{
//default category icon
if($content_pref["content_menu_cat_icon_default"] == "0"){ $ret = "";
@@ -997,7 +997,7 @@ return ($content_pref["content_menu_recent_caption"] != "" ? $content_pref["cont
SC_END
SC_BEGIN CM_MENU_RECENT_ICON
global $content_pref, $row, $content_icon_path;
global $content_pref, $row;
if($content_pref["content_menu_recent_icon"] == "0"){ $ret = "";
}elseif($content_pref["content_menu_recent_icon"] == "1"){ $ret = $bullet;
}elseif($content_pref["content_menu_recent_icon"] == "2"){ $ret = "&middot";
@@ -1010,8 +1010,8 @@ global $content_pref, $row, $content_icon_path;
}else{
$recenticonwidth = " width:50px; ";
}
if($row['content_icon'] != "" && is_readable($content_icon_path.$row['content_icon'])){
$ret = "<img src='".$content_icon_path.$row['content_icon']."' alt='' style='".$recenticonwidth." border:0;' />";
if($row['content_icon'] != "" && is_readable($content_pref['content_icon_path'].$row['content_icon'])){
$ret = "<img src='".$content_pref['content_icon_path'].$row['content_icon']."' alt='' style='".$recenticonwidth." border:0;' />";
}
}
return "<a href='".e_PLUGIN."content/content.php?content.".$row['content_id']."'>".$ret."</a>";
@@ -1071,9 +1071,7 @@ SC_END
SC_BEGIN CONTENT_CAT_ICON
global $row, $content_pref, $tp;
$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"]);
$caticon = $content_cat_icon_path_small.$row['content_icon'];
$caticon = $content_pref['content_cat_icon_path_small'].$row['content_icon'];
return ($row['content_icon'] ? "<img src='".$caticon."' alt='' style='vertical-align:middle' />" : "&nbsp;");
SC_END
@@ -1317,19 +1315,19 @@ if($show['enddate']===true){
SC_END
SC_BEGIN CATFORM_UPLOAD
global $row, $show, $content_cat_icon_path_large, $content_cat_icon_path_small;
global $row, $show;
if($show['uploadicon']===true){
$text='';
if(!FILE_UPLOADS){
$text = "<b>".CONTENT_ADMIN_ITEM_LAN_21."</b>";
}else{
if(!is_writable($content_cat_icon_path_large)){
$text = "<b>".CONTENT_ADMIN_ITEM_LAN_22." ".$content_cat_icon_path_large." ".CONTENT_ADMIN_ITEM_LAN_23."</b><br />";
if(!is_writable($content_pref['content_cat_icon_path_large'])){
$text = "<b>".CONTENT_ADMIN_ITEM_LAN_22." ".$content_pref['content_cat_icon_path_large']." ".CONTENT_ADMIN_ITEM_LAN_23."</b><br />";
}
$text .= CONTENT_ADMIN_CAT_LAN_62."
<input class='tbox' type='file' name='file_userfile[]' size='58' />
<input type='hidden' name='iconpathlarge' value='".$content_cat_icon_path_large."' />
<input type='hidden' name='iconpathsmall' value='".$content_cat_icon_path_small."' />
<input type='hidden' name='iconpathlarge' value='".$content_pref['content_cat_icon_path_large']."' />
<input type='hidden' name='iconpathsmall' value='".$content_pref['content_cat_icon_path_small']."' />
<input class='button' type='submit' name='uploadcaticon' value='".CONTENT_ADMIN_CAT_LAN_63."' />";
}
return $text;
@@ -1337,10 +1335,10 @@ if($show['uploadicon']===true){
SC_END
SC_BEGIN CATFORM_ICON
global $row, $rs, $show, $fl, $content_cat_icon_path_large;
global $row, $rs, $show, $fl;
if($show['selecticon']===true){
$rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*');
$iconlist = $fl->get_files($content_cat_icon_path_large,"",$rejectlist);
$iconlist = $fl->get_files($content_pref['content_cat_icon_path_large'],"",$rejectlist);
$text = $rs -> form_text("cat_icon", 60, $row['content_icon'], 100)."
".$rs -> form_button("button", '', CONTENT_ADMIN_CAT_LAN_8, "onclick=\"expandit('divcaticon')\"")."
<div id='divcaticon' style='display:none;'>";

View File

@@ -29,9 +29,7 @@ function print_item($id)
$row['content_datestamp'] = $con -> convert_date($row['content_datestamp'], "long");
$mainparent = $aa -> getMainParent($id);
$content_pref = $aa -> getContentPref($mainparent);
$content_icon_path = $tp -> replaceConstants($content_pref["content_icon_path"]);
$content_image_path = $tp -> replaceConstants($content_pref["content_image_path"]);
$content_pref = $aa -> getContentPref($mainparent, true);
$img = $tp -> parseTemplate('{CM_IMAGES|print}', FALSE, $content_shortcodes);
$text = "
@@ -96,9 +94,7 @@ function print_item_pdf($id){
$row['content_datestamp'] = $con -> convert_date($row['content_datestamp'], "long");
$mainparent = $aa -> getMainParent(intval($id));
$content_pref = $aa -> getContentPref($mainparent);
$content_icon_path = $tp -> replaceConstants($content_pref["content_icon_path"]);
$content_image_path = $tp -> replaceConstants($content_pref["content_image_path"]);
$content_pref = $aa -> getContentPref($mainparent, true);
$img = $tp -> parseTemplate('{CM_IMAGES|pdf}', FALSE, $content_shortcodes);
//add custom and preset tags if present

View File

@@ -37,9 +37,7 @@ if (!defined('e107_INIT')) { exit; }
$mainparent = $rowm['content_id'];
//get path variables
$content_recent_pref = $aa -> getContentPref($mainparent);
$content_recent_pref["content_icon_path"] = ($content_recent_pref["content_icon_path"] ? $content_recent_pref["content_icon_path"] : "{e_PLUGIN}content/images/icon/" );
$content_icon_path = $tp -> replaceConstants($content_recent_pref["content_icon_path"]);
$content_recent_pref = $aa -> getContentPref($mainparent, true);
//prepare query string
$array = $aa -> getCategoryTree("", $mainparent, TRUE);
@@ -81,8 +79,8 @@ if (!defined('e107_INIT')) { exit; }
//$ICON = $this -> getBullet($arr[6], $mode);
$image_link_append = "<a href='".e_PLUGIN."content/content.php?content.".$rowi['content_id']."'>";
if($rowi['content_icon'] && file_exists(e_PLUGIN."content/images/icon/".$rowi['content_icon'])){
$ICON = $image_link_append."<img src='".e_PLUGIN."content/images/icon/".$rowi['content_icon']."' style='width:50px; border:1px solid #000;' alt='' /></a>";
if($rowi['content_icon'] && file_exists($content_recent_pref["content_icon_path"].$rowi['content_icon'])){
$ICON = $image_link_append."<img src='".$content_recent_pref["content_icon_path"].$rowi['content_icon']."' style='width:50px; border:1px solid #000;' alt='' /></a>";
}else{
$ICON = "";
}

View File

@@ -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.17 $
| $Date: 2007-04-16 20:41:01 $
| $Revision: 1.18 $
| $Date: 2007-04-16 22:11:09 $
| $Author: lisa_ $
+---------------------------------------------------------------+
*/
@@ -378,7 +378,7 @@ class content{
return $content_pref;
}
function getContentPref($id="") {
function getContentPref($id="", $parsepaths=false) {
global $sql, $plugintable, $qs, $tp, $eArrayStorage;
$plugintable = "pcontent";
@@ -443,6 +443,36 @@ class content{
$row = $sql -> db_Fetch();
$content_pref = $eArrayStorage->ReadArray($row['e107_value']);
}
if($parsepaths){
$content_pref = $this->parseConstants($content_pref);
}
return $content_pref;
}
function parseConstants($content_pref){
global $tp;
//sanitize the paths (first check if exists, else create default paths
$content_pref['content_cat_icon_path_large'] = varset($content_pref['content_cat_icon_path_large'], "{e_PLUGIN}content/images/cat/48/");
$content_pref['content_cat_icon_path_small'] = varset($content_pref['content_cat_icon_path_small'], "{e_PLUGIN}content/images/cat/16/");
$content_pref['content_icon_path'] = varset($content_pref['content_icon_path'], "{e_PLUGIN}content/images/icon/");
$content_pref['content_icon_path_tmp'] = varset($content_pref['content_icon_path_tmp'], $content_pref['content_icon_path']."tmp/");
$content_pref['content_image_path'] = varset($content_pref['content_image_path'], "{e_PLUGIN}content/images/image/");
$content_pref['content_image_path_tmp'] = varset($content_pref['content_image_path_tmp'], $content_pref['content_image_path']."tmp/");
$content_pref['content_file_path'] = varset($content_pref['content_file_path'], "{e_PLUGIN}content/images/file/");
$content_pref['content_file_path_tmp'] = varset($content_pref['content_file_path_tmp'], $content_pref['content_file_path']."tmp/");
//parse constants from the paths
$content_pref['content_cat_icon_path_large'] = $tp -> replaceConstants($content_pref['content_cat_icon_path_large']);
$content_pref['content_cat_icon_path_small'] = $tp -> replaceConstants($content_pref['content_cat_icon_path_small']);
$content_pref['content_icon_path'] = $tp -> replaceConstants($content_pref['content_icon_path']);
$content_pref['content_image_path'] = $tp -> replaceConstants($content_pref['content_image_path']);
$content_pref['content_file_path'] = $tp -> replaceConstants($content_pref['content_file_path']);
$content_pref['content_icon_path_tmp'] = $tp -> replaceConstants($content_pref['content_icon_path_tmp']);
$content_pref['content_file_path_tmp'] = $tp -> replaceConstants($content_pref['content_file_path_tmp']);
$content_pref['content_image_path_tmp'] = $tp -> replaceConstants($content_pref['content_image_path_tmp']);
return $content_pref;
}
@@ -1090,7 +1120,7 @@ class content{
}
function getIcon($mode, $icon, $path="", $linkid="", $width="", $blank=""){
global $content_cat_icon_path_small, $content_cat_icon_path_large, $content_icon_path, $content_pref;
global $content_pref;
$blank = (!$blank ? "0" : $blank);
$border = "border:0;";
@@ -1098,25 +1128,25 @@ class content{
$hrefpost = ($linkid ? "</a>" : "");
if($mode == "item"){
$path = (!$path ? $content_icon_path : $path);
$path = (!$path ? $content_pref['content_icon_path'] : $path);
$width = ($width ? "width:".$width."px;" : "");
//$border = "border:1px solid #000;";
$border = '';
$icon = ($icon ? $path.$icon : ($blank ? $content_icon_path."blank.gif" : ""));
$icon = ($icon ? $path.$icon : ($blank ? $content_pref['content_icon_path']."blank.gif" : ""));
}elseif($mode == "catsmall"){
$path = (!$path ? $content_cat_icon_path_small : $path);
$path = (!$path ? $content_pref['content_cat_icon_path_small'] : $path);
$icon = ($icon ? $path.$icon : "");
}elseif($mode == "catlarge"){
$path = (!$path ? $content_cat_icon_path_large : $path);
$path = (!$path ? $content_pref['content_cat_icon_path_large'] : $path);
$icon = ($icon ? $path.$icon : "");
}else{
$path = (!$path ? $content_icon_path : $path);
$path = (!$path ? $content_pref['content_icon_path'] : $path);
$hrefpre = "";
$hrefpost = "";
$width = "";
$icon = ($icon ? $path.$icon : ($blank ? $content_icon_path."blank.gif" : ""));
$icon = ($icon ? $path.$icon : ($blank ? $content_pref['content_icon_path']."blank.gif" : ""));
}
if($icon && is_readable($icon)){
@@ -1124,13 +1154,13 @@ class content{
}else{
$iconstring = "";
if($blank){
if(is_readable($content_icon_path."blank.gif")){
if(is_readable($content_pref['content_icon_path']."blank.gif")){
if($mode == "catsmall"){
$width = ($width ? "width:".$width."px;" : "width:16px;");
}elseif($mode == "catlarge"){
$width = ($width ? "width:".$width."px;" : "width:48px;");
}
$iconstring = $hrefpre."<img src='".$content_icon_path."blank.gif' alt='' style='".$width." ".$border."' />".$hrefpost;
$iconstring = $hrefpre."<img src='".$content_pref['content_icon_path']."blank.gif' alt='' style='".$width." ".$border."' />".$hrefpost;
}
}
}
@@ -1205,7 +1235,7 @@ class content{
}
$catarray = "";
$mainparent = $this -> getMainParent( $searchtypeid );
$content_pref = $this -> getContentPref($mainparent);
$content_pref = $this -> getContentPref($mainparent, true);
$parent = $this -> getCategoryTree("", $mainparent, TRUE);
$parent = array_merge_recursive($parent);
for($a=0;$a<count($parent);$a++){
@@ -1367,9 +1397,7 @@ class content{
$data .= "\n";
$data .= "\$bullet = (defined('BULLET') ? \"<img src='\".THEME_ABS.\"images/\".BULLET.\"' alt='' style='border:0;vertical-align: middle;' />\" : \"<img src='\".THEME_ABS.\"images/bullet2.gif' alt='bullet' style='border:0;vertical-align: middle;' />\");\n";
$data .= "\n";
$data .= "\$content_pref = \$aa -> getContentPref(\$menutypeid);\n";
$data .= "\$content_icon_path = \$tp -> replaceConstants(\$content_pref[\"content_icon_path\"]);\n";
$data .= "\$content_cat_icon_path_small = \$tp -> replaceConstants(\$content_pref[\"content_cat_icon_path_small\"]);\n";
$data .= "\$content_pref = \$aa -> getContentPref(\$menutypeid, true);\n";
$data .= "\n";
$data .= "// load the template --------------------------------------------------\n";
$data .= "if(!isset(\$CONTENT_MENU)){\n";

View File

@@ -12,8 +12,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/handlers/content_db_class.php,v $
| $Revision: 1.8 $
| $Date: 2007-04-13 10:05:45 $
| $Revision: 1.9 $
| $Date: 2007-04-16 22:11:09 $
| $Author: lisa_ $
+---------------------------------------------------------------+
*/
@@ -166,24 +166,13 @@ class contentdb{
}
$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"]);
$content_pref = $aa -> getContentPref($mainparent, true);
//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);
if($icon && is_readable($content_pref['content_icon_path_tmp'].$icon)){
rename($content_pref['content_icon_path_tmp'].$icon, $content_pref['content_icon_path'].$icon);
}
}
@@ -201,10 +190,10 @@ class contentdb{
$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_pref['content_file_path_tmp'].$attach{$i})){
rename($content_pref['content_file_path_tmp'].$attach{$i}, $content_pref['content_file_path'].$attach{$i});
}
if($attach{$i} && is_readable($content_file_path.$attach{$i})){
if($attach{$i} && is_readable($content_pref['content_file_path'].$attach{$i})){
$totalattach .= "[file]".$attach{$i};
}
}
@@ -212,13 +201,13 @@ class contentdb{
$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_pref['content_image_path_tmp'].$image{$i})){
rename($content_pref['content_image_path_tmp'].$image{$i}, $content_pref['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_pref['content_image_path_tmp']."thumb_".$image{$i})){
rename($content_pref['content_image_path_tmp']."thumb_".$image{$i}, $content_pref['content_image_path']."thumb_".$image{$i});
}
if($image{$i} && is_readable($content_image_path.$image{$i})){
if($image{$i} && is_readable($content_pref['content_image_path'].$image{$i})){
$totalimages .= "[img]".$image{$i};
}
}
@@ -317,7 +306,7 @@ 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;
global $pref, $sql, $ns, $rs, $qs, $aa, $tp, $plugintable, $e107cache;
$_POST['cat_heading'] = $tp -> toDB($_POST['cat_heading']);
$_POST['cat_subheading'] = $tp -> toDB($_POST['cat_subheading']);

View File

@@ -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.11 $
| $Date: 2007-04-13 10:05:45 $
| $Revision: 1.12 $
| $Date: 2007-04-16 22:11:09 $
| $Author: lisa_ $
+---------------------------------------------------------------+
*/
@@ -94,20 +94,7 @@ class contentform{
$_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"]);
$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_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_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"]);
$content_pref = $aa -> getContentPref($mainparent, true);
if($sql -> db_Select("pcontent", "content_heading", " content_id='".$_POST['parent1']."' ")){
$row = $sql -> db_Fetch();
@@ -175,10 +162,10 @@ class contentform{
}
//icon
if($_POST['content_icon'] && is_readable($content_tmppath_icon.$_POST['content_icon'])){
$ICON = "<img src='".$content_tmppath_icon.$_POST['content_icon']."' alt='' style='width:100px; border:0;' />";
}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;' />";
if($_POST['content_icon'] && is_readable($content_pref['content_icon_path_tmp'].$_POST['content_icon'])){
$ICON = "<img src='".$content_pref['content_icon_path_tmp'].$_POST['content_icon']."' alt='' style='width:100px; border:0;' />";
}elseif($_POST['content_icon'] && is_readable($content_pref['content_icon_path'].$_POST['content_icon'])){
$ICON = "<img src='".$content_pref['content_icon_path'].$_POST['content_icon']."' alt='' style='width:100px; border:0;' />";
}else{
$ICON='';
}
@@ -191,20 +178,20 @@ class contentform{
$IMAGES = '';
foreach($_POST as $k => $v){
if(strpos($k, "content_files") === 0){
if($v && is_readable($content_tmppath_file.$v)){
if($v && is_readable($content_pref['content_file_path_tmp'].$v)){
$ATTACH .= CONTENT_ICON_FILE." ".$v."<br />";
$file = TRUE;
}elseif($v && is_readable($content_file_path.$v)){
}elseif($v && is_readable($content_pref['content_file_path'].$v)){
$ATTACH .= CONTENT_ICON_FILE." ".$v."<br />";
$file = TRUE;
}
}
if(strpos($k, "content_images") === 0){
if($v && is_readable($content_tmppath_image.$v)){
$IMAGES .= "<img src='".$content_tmppath_image.$v."' alt='' style='width:100px; border:0;' /> ";
if($v && is_readable($content_pref['content_image_path_tmp'].$v)){
$IMAGES .= "<img src='".$content_pref['content_image_path_tmp'].$v."' alt='' style='width:100px; border:0;' /> ";
$image = TRUE;
}elseif($v && is_readable($content_image_path.$v)){
$IMAGES .= "<img src='".$content_image_path.$v."' alt='' style='width:100px; border:0;' /> ";
}elseif($v && is_readable($content_pref['content_image_path'].$v)){
$IMAGES .= "<img src='".$content_pref['content_image_path'].$v."' alt='' style='width:100px; border:0;' /> ";
$image = TRUE;
}
}
@@ -372,6 +359,7 @@ class contentform{
}
}
$content_pref = $aa -> parseConstants($content_pref);
//get preferences for submit page
if($mode == "submit"){
@@ -622,30 +610,21 @@ class contentform{
$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);
$iconlist = $fl->get_files($content_pref['content_icon_path_tmp'],"",$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);
$filelist = $fl->get_files($content_pref['content_file_path_tmp'],"",$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);
$imagelist = $fl->get_files($content_pref['content_image_path_tmp'],"",$rejectlist);
$show['images'] = true;
}else{
$show['images'] = false;
@@ -899,12 +878,7 @@ class contentform{
}
$mainparent = $aa -> getMainParent($qs[1]);
$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"]);
$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_pref = $aa -> getContentPref($mainparent, true);
if($mode == "contentmanager"){
$personalmanagercheck = FALSE;
@@ -1005,7 +979,7 @@ class contentform{
$deleteicon = CONTENT_ICON_DELETE;
$cid = $row['content_id'];
$CONTENT_ICON = ($row['content_icon'] && is_readable($content_icon_path.$row['content_icon']) ? "<img src='".$content_icon_path.$row['content_icon']."' alt='' style='width:50px; vertical-align:middle' />" : "&nbsp;");
$CONTENT_ICON = ($row['content_icon'] && is_readable($content_pref['content_icon_path'].$row['content_icon']) ? "<img src='".$content_pref['content_icon_path'].$row['content_icon']."' alt='' style='width:50px; vertical-align:middle' />" : "&nbsp;");
$CONTENT_ADMIN_OPTIONS = "<a href='".e_SELF."?content.edit.".$cid."'>".CONTENT_ICON_EDIT."</a>
<input type='image' title='".CONTENT_ICON_LAN_1."' name='delete[content_{$cid}]' src='".CONTENT_ICON_DELETE_BASE."' onclick=\"return jsconfirm('".$tp->toJS(CONTENT_ADMIN_JS_LAN_1."\\n\\n[".CONTENT_ADMIN_JS_LAN_6." ".$cid." : ".$delete_heading."]")."')\"/>";
@@ -1073,10 +1047,8 @@ class contentform{
if(array_key_exists($row['content_parent'], $array)){
$mainparent = $array[$row['content_parent']][0];
$CONTENT_ADMIN_CATEGORY = $array[$row['content_parent']][1]." [".$array[$row['content_parent']][count($array[$row['content_parent']])-1]."]";
$content_pref = $aa -> getContentPref($mainparent);
$iconpath = ($content_pref["content_icon_path"] ? $content_pref["content_icon_path"] : "{e_PLUGIN}content/images/icon/" );
$icon = $tp -> replaceConstants($iconpath).$row['content_icon'];
$CONTENT_ICON = ($row['content_icon'] ? "<img src='".$icon."' alt='' style='width:50px; vertical-align:middle' />" : "&nbsp;");
$content_pref = $aa -> getContentPref($mainparent, true);
$CONTENT_ICON = ($row['content_icon'] ? "<img src='".$content_pref['content_icon_path'].$row['content_icon']."' alt='' style='width:50px; vertical-align:middle' />" : "&nbsp;");
}
$delete_heading = str_replace("&#39;", "\'", $row['content_heading']);
$delid = $row['content_id'];
@@ -1111,7 +1083,7 @@ class contentform{
}else{
$row = $sql -> db_Fetch();
$content_pref = $aa -> getContentPref($catarray[$catid][0]);
$content_pref = $aa -> getContentPref($catarray[$catid][0], true);
$delete_heading = str_replace("&#39;", "\'", $row['content_heading']);
$CONTENT_ADMIN_SPACER = ($row['content_parent']==0 ? TRUE : FALSE);
@@ -1142,7 +1114,7 @@ class contentform{
foreach($array as $catid){
if($category_total = $sql -> db_Select($plugintable, "*", "content_id='".intval($catid)."' ")){
$row = $sql -> db_Fetch();
$content_pref = $aa -> getContentPref($catid);
$content_pref = $aa -> getContentPref($catid, true);
$CONTENT_ADMIN_SPACER = ($row['content_parent']==0 ? TRUE : FALSE);
$text .= $tp -> parseTemplate($CONTENT_ADMIN_MANAGER_TABLE, FALSE, $content_shortcodes);
}
@@ -1174,6 +1146,7 @@ class contentform{
}else{
header("location:".e_SELF."?option"); exit;
}
$content_pref = $aa -> parseConstants($content_pref);
$CONTENT_ADMIN_BUTTON = $rs -> form_button("submit", "update_manager", LAN_SAVE)." ".$rs -> form_hidden("options_type", intval($qs[1]));
$CONTENT_ADMIN_MANAGER_OPTIONS = $this->manager_category_options($content_pref);
$text = $tp -> parseTemplate($CONTENT_ADMIN_MANAGER_CATEGORY, FALSE, $content_shortcodes);
@@ -1335,16 +1308,14 @@ class contentform{
function show_create_category(){
global $qs, $plugintable, $plugindir, $sql, $ns, $rs, $aa, $fl, $pref, $tp, $content_shortcodes, $row, $message;
global $show, $CONTENT_ADMIN_CAT_CREATE, $CONTENT_ADMIN_FORM_TARGET, $CONTENT_ADMIN_BUTTON, $CATFORM_CATEGORY;
global $content_cat_icon_path_large, $content_cat_icon_path_small, $months, $current_year, $ne_day, $ne_month, $ne_year, $end_day, $end_month, $end_year;
global $months, $current_year, $ne_day, $ne_month, $ne_year, $end_day, $end_month, $end_year;
$months = array(CONTENT_ADMIN_DATE_LAN_0, CONTENT_ADMIN_DATE_LAN_1, CONTENT_ADMIN_DATE_LAN_2, CONTENT_ADMIN_DATE_LAN_3, CONTENT_ADMIN_DATE_LAN_4, CONTENT_ADMIN_DATE_LAN_5, CONTENT_ADMIN_DATE_LAN_6, CONTENT_ADMIN_DATE_LAN_7, CONTENT_ADMIN_DATE_LAN_8, CONTENT_ADMIN_DATE_LAN_9, CONTENT_ADMIN_DATE_LAN_10, CONTENT_ADMIN_DATE_LAN_11);
if(!is_object($sql)){ $sql = new db; }
$array = $aa -> getCategoryTree("", "", FALSE);
$mainparent = $aa -> getMainParent( (isset($qs[3]) && is_numeric($qs[3]) ? $qs[3] : (isset($qs[2]) && is_numeric($qs[2]) ? $qs[2] : "0") ) );
$content_pref = $aa -> getContentPref($mainparent);
$content_cat_icon_path_small = $tp -> replaceConstants($content_pref["content_cat_icon_path_small"]);
$content_cat_icon_path_large = $tp -> replaceConstants($content_pref["content_cat_icon_path_large"]);
$content_pref = $aa -> getContentPref($mainparent, true);
if( $qs[0] == "cat" && $qs[1] == "create" && isset($qs[2]) && is_numeric($qs[2]) ){
if(!$sql -> db_Select($plugintable, "*", "content_id='".intval($qs[2])."' ")){
@@ -1375,7 +1346,7 @@ class contentform{
<div style='text-align:center'>
<table class='fborder' style='".ADMIN_WIDTH."' border='0'>
<tr>
<td class='forumheader3' rowspan='3' style='width:5%; vertical-align:top;'><img src='".$content_cat_icon_path_large.$_POST['cat_icon']."' style='border:0' alt='' /></td>
<td class='forumheader3' rowspan='3' style='width:5%; vertical-align:top;'><img src='".$content_pref['content_cat_icon_path_large'].$_POST['cat_icon']."' style='border:0' alt='' /></td>
<td class='fcaption'>".$cat_heading."</td>
</tr>
<tr><td class='forumheader3'>".$cat_subheading."</td></tr>
@@ -1610,7 +1581,7 @@ class contentform{
}else{
$row = $sql -> db_Fetch();
$content_pref = $aa -> getContentPref($catarray[$catid][0]);
$content_pref = $aa -> getContentPref($catarray[$catid][0], true);
//count subcategories for a main parent
if($row['content_parent'] == 0){
@@ -1684,7 +1655,7 @@ class contentform{
$qry = " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
$order = "SUBSTRING_INDEX(content_order, '.', -1)+0";
}
$content_pref = $aa -> getContentPref(intval($qs[1]));
$content_pref = $aa -> getContentPref(intval($qs[1]), true);
if(!$content_total = $sql2 -> db_Select($plugintable, "content_id, content_heading, content_author, content_parent, content_order", "content_refer != 'sa' AND ".$qry." ORDER BY ".$order." ASC, content_heading DESC ")){
$text = "<div style='text-align:center'>".CONTENT_ADMIN_ITEM_LAN_4."</div>";
@@ -1733,17 +1704,17 @@ class contentform{
}
function show_options(){
global $sql2, $ns, $rs, $aa, $plugintable, $plugindir, $tp, $content_shortcodes, $stylespacer, $pref, $row, $content_pref, $content_cat_icon_path_large, $CONTENT_ADMIN_OPTIONS_START, $CONTENT_ADMIN_OPTIONS_TABLE, $CONTENT_ADMIN_OPTIONS_END;
global $sql2, $ns, $rs, $aa, $plugintable, $plugindir, $tp, $content_shortcodes, $stylespacer, $pref, $row, $content_pref, $CONTENT_ADMIN_OPTIONS_START, $CONTENT_ADMIN_OPTIONS_TABLE, $CONTENT_ADMIN_OPTIONS_END;
include_lan($plugindir."languages/".e_LANGUAGE."/lan_content_options.php");
$text = $tp -> parseTemplate($CONTENT_ADMIN_OPTIONS_START, FALSE, $content_shortcodes);
$content_pref = $aa -> getContentPref(0);
$content_pref = $aa -> getContentPref(0, true);
if($category_total = $sql2 -> db_Select($plugintable, "*", "content_parent='0' ")){
while($row = $sql2 -> db_Fetch()){
$content_pref = $aa -> getContentPref($row['content_id']);
$content_pref = $aa -> getContentPref($row['content_id'], true);
$text .= $tp -> parseTemplate($CONTENT_ADMIN_OPTIONS_TABLE, FALSE, $content_shortcodes);
}
}
@@ -1754,7 +1725,7 @@ class contentform{
function show_options_cat(){
global $qs, $id, $sql, $ns, $rs, $aa, $content_pref, $pref, $content_cat_icon_path_large, $content_cat_icon_path_small, $plugintable, $plugindir;
global $qs, $id, $sql, $ns, $rs, $aa, $content_pref, $pref, $plugintable, $plugindir;
global $fl, $stylespacer, $tp;
if($qs[1] == "default"){