1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-13 17:09:46 +01:00

content: code improvements and optimization

This commit is contained in:
lia 2007-04-12 21:35:00 +00:00
parent c908006212
commit 51257a71f2
7 changed files with 194 additions and 226 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.10 $
| $Date: 2007-04-12 16:02:06 $
| $Revision: 1.11 $
| $Date: 2007-04-12 21:35:00 $
| $Author: lisa_ $
+---------------------------------------------------------------+
*/
@ -291,7 +291,7 @@ function show_content(){
return;
}
if(!is_object($sql)){ $sql = new db; }
if(!$sql -> db_Select($plugintable, "*", "content_parent = '0' AND content_class REGEXP '".e_CLASS_REGEXP."' ".$datequery." ORDER BY round(content_order)")){
if(!$sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_icon, content_pref", "content_parent = '0' AND content_class REGEXP '".e_CLASS_REGEXP."' ".$datequery." ORDER BY round(content_order)")){
$text .= "<div style='text-align:center;'>".CONTENT_LAN_21."</div>";
}else{
@ -334,7 +334,7 @@ function show_content(){
//if inherit is used in the manager, we need to get the preferences from the core plugin table default preferences
//and use those preferences in the permissions check.
if( varsettrue($content_pref['content_manager_inherit'],'') ){
$sql2 -> db_Select("core", "*", "e107_name='$plugintable' ");
$sql2 -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
$row2 = $sql2 -> db_Fetch();
$content_pref = $eArrayStorage->ReadArray($row2['e107_value']);
}
@ -386,22 +386,17 @@ function show_content_archive(){
$qry = " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
$number = varsettrue($content_pref["content_archive_nextprev_number"], '30');
$order = $aa -> getOrder();
$nextprevquery = (isset($content_pref["content_archive_nextprev"]) && $content_pref["content_archive_nextprev"] ? "LIMIT ".intval($from).",".intval($number) : "");
$nextprevquery = (varsettrue($content_pref["content_archive_nextprev"]) ? "LIMIT ".intval($from).",".intval($number) : "");
$sql1 = new db;
if(isset($content_pref["content_archive_letterindex"]) && $content_pref["content_archive_letterindex"]){
if( varsettrue($content_pref["content_archive_letterindex"]) ){
$distinctfirstletter = $sql -> db_Select($plugintable, " DISTINCT(content_heading) ", "content_refer != 'sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ORDER BY content_heading ASC ");
while($row = $sql -> db_Fetch()){
$head = $tp->toHTML($row['content_heading'], TRUE);
if(ord($head) < 128) {
$head_sub = strtoupper(substr($head,0,1));
}else{
$head_sub = substr($head,0,2);
}
$head_sub = ( ord($head) < 128 ? strtoupper(substr($head,0,1)) : substr($head,0,2) );
$arrletters[] = $head_sub;
}
$arrletters = array_unique($arrletters);
$arrletters = array_values($arrletters);
$arrletters = array_values( array_unique($arrletters) );
sort($arrletters);
if ($distinctfirstletter > 1){
@ -410,41 +405,25 @@ function show_content_archive(){
for($i=0;$i<count($arrletters);$i++){
if(is_numeric($arrletters[$i])){
if($int===TRUE){
if(isset($qs[2]) && is_numeric($qs[2])){
$class = 'nextprev_current';
}else{
$class = 'nextprev_link';
}
$class = (isset($qs[2]) && is_numeric($qs[2]) ? 'nextprev_current' : 'nextprev_link');
$CONTENT_ARCHIVE_TABLE_LETTERS .= "<a class='".$class."' href='".e_SELF."?list.".$mainparent.".0'>0-9</a> ";
}
$int=FALSE;
}else{
if(isset($qs[2]) && strtoupper($qs[2]) == strtoupper($arrletters[$i])){
$class = 'nextprev_current';
}else{
$class = 'nextprev_link';
}
$CONTENT_ARCHIVE_TABLE_LETTERS .= "<a class='".$class."' href='".e_SELF."?list.".$mainparent.".".strtoupper($arrletters[$i])."'>".strtoupper($arrletters[$i])."</a> ";
$lu = strtoupper($arrletters[$i]);
$class = (isset($qs[2]) && strtoupper($qs[2]) == $lu ? 'nextprev_current' : 'nextprev_link');
$CONTENT_ARCHIVE_TABLE_LETTERS .= "<a class='".$class."' href='".e_SELF."?list.".$mainparent.".".$lu."'>".$lu."</a> ";
}
}
if(!isset($qs[2]) || (isset($qs[2]) && strtolower($qs[2])=='all') ){
$class = 'nextprev_current';
}else{
$class = 'nextprev_link';
}
$CONTENT_ARCHIVE_TABLE_LETTERS .= "<a class='".$class."' href='".e_SELF."?list.".$mainparent."'>ALL</a> ";
$CONTENT_ARCHIVE_TABLE_LETTERS .= "</form>";
$class = (!isset($qs[2]) || (isset($qs[2]) && strtolower($qs[2])=='all') ? 'nextprev_current' : 'nextprev_link');
$CONTENT_ARCHIVE_TABLE_LETTERS .= "<a class='".$class."' href='".e_SELF."?list.".$mainparent."'>ALL</a></form>";
}
//check letter
if(isset($qs[2])){
if($qs[2] == 'all'){
$qry .= '';
}elseif(strlen($qs[2]) == 1 && $qs[2] == '0'){
if(strlen($qs[2]) == 1 && $qs[2] == '0'){
$qry .= " AND content_heading NOT REGEXP '^[[:alpha:]]' ";
}elseif(strlen($qs[2]) == 1 && !is_numeric($qs[2]) ){
$qry .= " AND content_heading LIKE '".$tp->toDB($qs[2])."%' ";
}else{
$qry .= '';
}
}
}
@ -452,8 +431,7 @@ function show_content_archive(){
$contenttotal = $sql1 -> db_Count($plugintable, "(*)", "WHERE content_refer !='sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ");
if($from > $contenttotal-1){ header("location:".e_SELF); exit; }
if($item = $sql1 -> db_Select($plugintable, "*", "content_refer !='sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ".$order." ".$nextprevquery )){
if($item = $sql1 -> db_Select($plugintable, "content_id, content_heading, content_author, content_datestamp", "content_refer !='sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ".$order." ".$nextprevquery )){
$CONTENT_NEXTPREV = $aa->ShowNextPrev("archive", $from, $number, $contenttotal, true);
$text = $tp -> parseTemplate($CONTENT_ARCHIVE_TABLE_START, FALSE, $content_shortcodes);
while($row = $sql1 -> db_Fetch()){
@ -482,7 +460,7 @@ function displayPreview($qry, $np=false, $array=false){
}
}
}
if($resultitem = $sql2 -> db_Select($plugintable, "*", $qry )){
if($resultitem = $sql2 -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_summary, content_text, content_icon, content_author, content_datestamp, content_parent, content_refer, content_rate", $qry )){
if($np){
$CONTENT_NEXTPREV = $np;
}
@ -527,7 +505,7 @@ function show_content_recent(){
$validparent = implode(",", array_keys($array));
$order = $aa -> getOrder();
$number = varsettrue($content_pref["content_nextprev_number"], '5');
$nextprevquery = ($content_pref["content_nextprev"] ? "LIMIT ".intval($from).",".intval($number) : "");
$nextprevquery = (varsettrue($content_pref["content_nextprev"]) ? "LIMIT ".intval($from).",".intval($number) : "");
$qry = " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
$contenttotal = $sql2 -> db_Count($plugintable, "(*)", "WHERE content_refer != 'sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' " );
@ -582,7 +560,7 @@ function show_content_cat_all(){
$validparent = implode(",", array_keys($array));
$order = $aa -> getOrder();
$number = varsettrue($content_pref["content_nextprev_number"], '5');
$nextprevquery = (isset($content_pref["content_nextprev"]) && $content_pref["content_nextprev"] ? "LIMIT ".intval($from).",".intval($number) : "");
$nextprevquery = (varsettrue($content_pref["content_nextprev"]) ? "LIMIT ".intval($from).",".intval($number) : "");
$qry = " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
$newarray = array_merge_recursive($array);
@ -595,7 +573,7 @@ function show_content_cat_all(){
$string = "";
foreach($newparent as $key => $value){
$totalitems = $aa -> countCatItems($key);
$sql -> db_Select($plugintable, "*", "content_id = '".$key."' ");
$sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_text, content_icon, content_author, content_datestamp, content_parent, content_comment, content_rate", "content_id = '".$key."' ");
$row = $sql -> db_Fetch();
$date = $tp -> parseTemplate('{CM_DATE|cat}', FALSE, $content_shortcodes);
@ -650,7 +628,7 @@ function show_content_cat($mode=""){
$content_icon_path = $tp -> replaceConstants($content_pref["content_icon_path"]);
$order = $aa -> getOrder();
$number = varsettrue($content_pref["content_nextprev_number"], '5');
$nextprevquery = (isset($content_pref["content_nextprev"]) && $content_pref["content_nextprev"] ? "LIMIT ".intval($from).",".intval($number) : "");
$nextprevquery = (varsettrue($content_pref["content_nextprev"]) ? "LIMIT ".intval($from).",".intval($number) : "");
$capqs = array_reverse($array[intval($qs[1])]);
$caption = $content_pref['content_cat_caption'];
if( varsettrue($content_pref['content_cat_caption_append_name'],'') ){
@ -658,8 +636,8 @@ function show_content_cat($mode=""){
}
// parent article
if(isset($content_pref["content_cat_showparent"]) && $content_pref["content_cat_showparent"]){
if(!$resultparent = $sql -> db_Select($plugintable, "*", $qry )){
if( varsettrue($content_pref["content_cat_showparent"]) ){
if(!$resultparent = $sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_text, content_icon, content_author, content_datestamp, content_comment, content_rate", $qry )){
header("location:".e_SELF."?cat.list.".$mainparent); exit;
}else{
//if 'view' override the items pref to show only limited text adn show full catetgory text instead
@ -710,12 +688,12 @@ function show_content_cat($mode=""){
$b++;
}
}
$subparent = array_keys($subparent);
$validsub = "0.".implode(",0.", $subparent);
$subqry = " content_refer !='sa' AND content_parent REGEXP '".$aa -> CONTENTREGEXP($validsub)."' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ";
$subparent = array_keys($subparent);
$validsub = "0.".implode(",0.", $subparent);
$subqry = " content_refer !='sa' AND content_parent REGEXP '".$aa -> CONTENTREGEXP($validsub)."' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ";
//list subcategories
if(isset($content_pref["content_cat_showparentsub"]) && $content_pref["content_cat_showparentsub"]){
if( varsettrue($content_pref["content_cat_showparentsub"]) ){
$content_cat_listsub_table_string = "";
for($i=0;$i<count($subparent);$i++){
@ -734,7 +712,7 @@ function show_content_cat($mode=""){
unset($text);
//also show content items of subcategories of this category ?
if(isset($content_pref["content_cat_listtype"]) && $content_pref["content_cat_listtype"]){
if( varsettrue($content_pref["content_cat_listtype"]) ){
$validitem = implode(",", $subparent);
$qrycat = " content_parent REGEXP '".$aa -> CONTENTREGEXP($validitem)."' ";
}else{
@ -744,33 +722,33 @@ function show_content_cat($mode=""){
$contenttotal = $sql -> db_Count($plugintable, "(*)", "WHERE ".$qrycat);
$childqry = $qrycat." ".$order." ".$nextprevquery;
$np=false;
if(isset($content_pref["content_nextprev"]) && $content_pref["content_nextprev"]){
if( varsettrue($content_pref["content_nextprev"]) ){
$np = $aa->ShowNextPrev(FALSE, $from, $number, $contenttotal, true);
}
$textchild = displayPreview($childqry, $np, $array);
$captionchild = $content_pref['content_cat_item_caption'];
$crumbpage = $aa->getCrumbPage("cat", $array, $qs[1]);
if(isset($textparent) && $textparent){
if( varsettrue($textparent) ){
$textparent = $crumbpage.$textparent;
}else{
$textchild = $crumbpage.$textchild;
}
if(isset($content_pref["content_cat_menuorder"]) && $content_pref["content_cat_menuorder"] == "1"){
if(isset($content_pref["content_cat_rendertype"]) && $content_pref["content_cat_rendertype"] == "1"){
if(isset($textparent) && $textparent){ $ns -> tablerender($caption, $textparent); }
if(isset($textsubparent) && $textsubparent){ $ns -> tablerender($captionsubparent, $textsubparent); }
if(isset($textchild) && $textchild){ $ns -> tablerender($captionchild, $textchild); }
if( varsettrue($textparent) ){ $ns -> tablerender($caption, $textparent); }
if( varsettrue($textsubparent) ){ $ns -> tablerender($captionsubparent, $textsubparent); }
if( varsettrue($textchild) ){ $ns -> tablerender($captionchild, $textchild); }
}else{
$ns -> tablerender($caption, varsettrue($textparent,'').varsettrue($textsubparent,'').$textchild);
}
}else{
if(isset($content_pref["content_cat_rendertype"]) && $content_pref["content_cat_rendertype"] == "1"){
if(isset($textchild) && $textchild){ $ns -> tablerender($captionchild, $textchild); }
if(isset($textparent) && $textparent){ $ns -> tablerender($caption, $textparent); }
if(isset($textsubparent) && $textsubparent){ $ns -> tablerender($captionsubparent, $textsubparent); }
if( varsettrue($textchild) ){ $ns -> tablerender($captionchild, $textchild); }
if( varsettrue($textparent) ){ $ns -> tablerender($caption, $textparent); }
if( varsettrue($textsubparent) ){ $ns -> tablerender($captionsubparent, $textsubparent); }
}else{
if(isset($textchild) && $textchild){ $ns -> tablerender($captionchild, $textchild); }
if( varsettrue($textchild) ){ $ns -> tablerender($captionchild, $textchild); }
$ns -> tablerender($caption, varsettrue($textparent,'').varsettrue($textsubparent,''));
}
}
@ -779,7 +757,7 @@ function show_content_cat($mode=""){
if($mode == "comment"){
$textparent = $aa->getCrumbPage("cat", $array, $mainparent).$textparent;
if(isset($textparent) && $textparent){ $ns -> tablerender($caption, $textparent); }
if( varsettrue($textparent) ){ $ns -> tablerender($caption, $textparent); }
if($resultitem = $sql -> db_Select($plugintable, "*", $qry )){
$row = $sql -> db_Fetch();
@ -790,7 +768,7 @@ function show_content_cat($mode=""){
echo $cachecheck;
return;
}
if( (isset($content_pref["content_cat_rating_all"]) && $content_pref["content_cat_rating_all"]) || (isset($content_pref["content_cat_rating"]) && $content_pref["content_cat_rating"] && $row['content_rate'])){
if( (varsettrue($content_pref["content_cat_rating_all"])) || (varsettrue($content_pref["content_cat_rating"]) && $row['content_rate'])){
$showrate = TRUE;
}else{
$showrate = FALSE;
@ -832,7 +810,7 @@ function show_content_author_all(){
$array = $aa -> getCategoryTree("", $mainparent, TRUE);
$validparent = implode(",", array_keys($array));
$number = varsettrue($content_pref["content_author_nextprev_number"],'5');
$nextprevquery = (isset($content_pref["content_author_nextprev"]) && $content_pref["content_author_nextprev"] ? "LIMIT ".intval($from).",".intval($number) : "");
$nextprevquery = (varsettrue($content_pref["content_author_nextprev"]) ? "LIMIT ".intval($from).",".intval($number) : "");
$qry = " p.content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
$dateqry = "AND p.content_datestamp < ".time()." AND (p.content_enddate=0 || p.content_enddate>".time().")";
@ -970,7 +948,7 @@ function show_content_author(){
}
$order = $aa -> getOrder();
$number = varsettrue($content_pref["content_nextprev_number"],'10');
$nextprevquery = (isset($content_pref["content_nextprev"]) && $content_pref["content_nextprev"] ? "LIMIT ".intval($from).",".intval($number) : "");
$nextprevquery = (varsettrue($content_pref["content_nextprev"]) ? "LIMIT ".intval($from).",".intval($number) : "");
$qry = " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
$sqla = "";
if(!is_object($sqla)){ $sqla = new db; }
@ -1035,7 +1013,7 @@ function show_content_top(){
$np = ($number ? " LIMIT ".intval($from).", ".intval($number) : "");
$qry1 = "
SELECT p.*, r.*, (r.rate_rating / r.rate_votes) as rate_avg
SELECT p.content_id, p.content_heading, p.content_icon, p.content_author, p.content_rate, (r.rate_rating / r.rate_votes) as rate_avg
FROM #rate AS r
LEFT JOIN #pcontent AS p ON p.content_id = r.rate_itemid
WHERE p.content_refer !='sa' AND ".$qry." ".$datequery1." AND p.content_class REGEXP '".e_CLASS_REGEXP."' AND r.rate_table='pcontent'
@ -1140,7 +1118,7 @@ function show_content_item(){
$row = $sql -> db_Fetch();
//update refer count outside of cache (count visits ^ count unique ips)
if(isset($content_pref["content_log"]) && $content_pref["content_log"]){
if( varsettrue($content_pref["content_log"]) ){
$ip = $e107->getip();
$self = e_SELF;
$refertmp = explode("^", $row['content_refer']);
@ -1181,7 +1159,7 @@ function show_content_item(){
$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 = (isset($content_pref["content_nextprev"]) && $content_pref["content_nextprev"] ? "LIMIT ".intval($from).",".intval($number) : "");
$nextprevquery = (varsettrue($content_pref["content_nextprev"]) ? "LIMIT ".intval($from).",".intval($number) : "");
$CM_AUTHOR = $aa -> prepareAuthor("content", $row['content_author'], $row['content_id']);
$CONTENT_CONTENT_TABLE_TEXT = $row['content_text'];
@ -1202,10 +1180,8 @@ function show_content_item(){
}
$pages = array_values($pages);
if(count($pages) == count($matches[0])){
}elseif(count($pages) > count($matches[0])){
if(count($pages) > count($matches[0])){
$matches[0] = array_pad($matches[0], -count($pages), "[newpage]");
}elseif(count($pages) < count($matches[0])){
}
$CONTENT_CONTENT_TABLE_TEXT = $pages[(!$qs[2] ? 0 : $qs[2]-1)];
@ -1219,9 +1195,9 @@ function show_content_item(){
$arrpagename = explode("[newpage=", $matches[0][$i]);
$pagename[$i] = substr($arrpagename[1],0,-1);
}
if(isset($content_pref["content_content_pagenames_nextprev"]) && $content_pref["content_content_pagenames_nextprev"]){
if( varsettrue($content_pref["content_content_pagenames_nextprev"]) ){
if($idp>1){
if(isset($content_pref["content_content_pagenames_nextprev_prevhead"]) && $content_pref["content_content_pagenames_nextprev_prevhead"]){
if( varsettrue($content_pref["content_content_pagenames_nextprev_prevhead"]) ){
$cap = $content_pref["content_content_pagenames_nextprev_prevhead"];
$cap = str_replace("{PAGETITLE}", $pagename[$idp-2], $cap);
}else{
@ -1232,7 +1208,7 @@ function show_content_item(){
$CONTENT_CONTENT_TABLE_PREV_PAGE = ' ';
}
if($idp<count($pages)){
if(isset($content_pref["content_content_pagenames_nextprev_nexthead"]) && $content_pref["content_content_pagenames_nextprev_nexthead"]){
if( varsettrue($content_pref["content_content_pagenames_nextprev_nexthead"]) ){
$cap = $content_pref["content_content_pagenames_nextprev_nexthead"];
$cap = str_replace("{PAGETITLE}", $pagename[$idp], $cap);
}else{
@ -1255,13 +1231,13 @@ function show_content_item(){
}
if($idp==1){
$CONTENT_CONTENT_TABLE_SUMMARY = (isset($content_pref["content_content_summary"]) && $content_pref["content_content_summary"] && $row['content_summary'] ? $tp -> toHTML($row['content_summary'], TRUE, "SUMMARY") : "");
$CONTENT_CONTENT_TABLE_SUMMARY = ( varsettrue($content_pref["content_content_summary"]) && $row['content_summary'] ? $tp -> toHTML($row['content_summary'], TRUE, "SUMMARY") : "");
$CONTENT_CONTENT_TABLE_SUMMARY = $tp -> replaceConstants($CONTENT_CONTENT_TABLE_SUMMARY);
}else{
$CONTENT_CONTENT_TABLE_SUMMARY = "";
}
//render custom/preset on first page
if(isset($content_pref['content_content_multipage_preset']) && $content_pref['content_content_multipage_preset']){
if( varsettrue($content_pref['content_content_multipage_preset']) ){
if($idp == '1'){
$lastpage = TRUE;
}
@ -1280,7 +1256,7 @@ function show_content_item(){
}
}else{
$CONTENT_CONTENT_TABLE_SUMMARY = (isset($content_pref["content_content_summary"]) && $content_pref["content_content_summary"] && $row['content_summary'] ? $tp -> toHTML($row['content_summary'], TRUE, "SUMMARY") : "");
$CONTENT_CONTENT_TABLE_SUMMARY = ( varsettrue($content_pref["content_content_summary"]) && $row['content_summary'] ? $tp -> toHTML($row['content_summary'], TRUE, "SUMMARY") : "");
$CONTENT_CONTENT_TABLE_SUMMARY = $tp -> replaceConstants($CONTENT_CONTENT_TABLE_SUMMARY);
$lastpage = TRUE;
}
@ -1369,7 +1345,7 @@ function show_content_item(){
//ksort($custom);
foreach($custom as $k => $v){
if($k == "content_custom_presettags"){
if(isset($content_pref["content_content_presettags"]) && $content_pref["content_content_presettags"]){
if( varsettrue($content_pref["content_content_presettags"]) ){
foreach($v as $ck => $cv){
if(is_array($cv)){ //date
if(!($cv['day']=="" && $cv['month']=="" && $cv['year']=="")){
@ -1387,7 +1363,7 @@ function show_content_item(){
}
}
}else{
if(isset($content_pref["content_content_customtags"]) && $content_pref["content_content_customtags"]){
if( varsettrue($content_pref["content_content_customtags"]) ){
$key = substr($k,15);
if( isset($key) && $key != "" && isset($v) && $v!="" ){
$CUSTOM_TAGS = TRUE;
@ -1419,14 +1395,14 @@ function show_content_item(){
}
}
if($lastpage && ($row['content_comment'] || (isset($content_pref["content_content_comment_all"]) && $content_pref["content_content_comment_all"]))){
if($lastpage && ($row['content_comment'] || (varsettrue($content_pref["content_content_comment_all"])) ) ){
$cachecheck = CachePre($cachestr);
if($cachecheck){
echo $cachecheck;
return;
}
if((isset($content_pref["content_content_rating"]) && $content_pref["content_content_rating"] && $row['content_rate']) || (isset($content_pref["content_content_rating_all"]) && $content_pref["content_content_rating_all"]) ){
if( (varsettrue($content_pref["content_content_rating"]) && $row['content_rate']) || varsettrue($content_pref["content_content_rating_all"]) ){
$showrate = TRUE;
}else{
$showrate = FALSE;

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.4 $
| $Date: 2007-03-13 16:51:05 $
| $Revision: 1.5 $
| $Date: 2007-04-12 21:35:00 $
| $Author: lisa_ $
+---------------------------------------------------------------+
*/
@ -184,8 +184,8 @@ if(!e_QUERY){
//if inherit is used in the manager, we need to get the preferences from the core plugin table default preferences
//and use those preferences in the permissions check.
if(isset($content_pref['content_manager_inherit']) && $content_pref['content_manager_inherit']){
$sql -> db_Select("core", "*", "e107_name='$plugintable' ");
if( varsettrue($content_pref['content_manager_inherit']) ){
$sql -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
$row = $sql -> db_Fetch();
$content_pref = $eArrayStorage->ReadArray($row['e107_value']);
}

View File

@ -48,7 +48,7 @@ $qry = " content_refer !='sa' ".$datequery." AND content_class REGEXP '".e_CLA
$rss = array();
$sqlrss = new db;
if($items = $sqlrss -> db_Select('pcontent', "*", $qry )){
if($items = $sqlrss -> db_Select('pcontent', "content_id, content_heading, content_subheading, content_parent, content_author, content_datestamp", $qry )){
$i=0;
while($rowrss = $sqlrss -> db_Fetch()){
//$author = array($author_id, $author_name, $author_email, $content_author);

View File

@ -15,7 +15,7 @@ if(!function_exists('e_userprofile_content')){
//get main parent types
$sqlm = new db;
if($sqlm -> db_Select("pcontent", "*", "content_class REGEXP '".e_CLASS_REGEXP."' AND content_parent = '0' ".$datequery." ".$headingquery." ORDER BY content_heading")){
if($sqlm -> db_Select("pcontent", "content_id, content_heading", "content_class REGEXP '".e_CLASS_REGEXP."' AND content_parent = '0' ".$datequery." ".$headingquery." ORDER BY content_heading")){
while($rowm = $sqlm -> db_Fetch()){
//global var for this main parent
$mainparent = $rowm['content_id'];

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.13 $
| $Date: 2007-04-12 16:02:06 $
| $Revision: 1.14 $
| $Date: 2007-04-12 21:35:00 $
| $Author: lisa_ $
+---------------------------------------------------------------+
*/
@ -393,13 +393,13 @@ class content{
$row = $sql -> db_Fetch();
if (empty($row['content_pref'])) {
//if no prefs present yet, get them from core (default preferences)
$num_rows = $sql -> db_Select("core", "*", "e107_name='$plugintable' ");
$num_rows = $sql -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
//if those are not present, insert the default ones given in this file
if ($num_rows == 0) {
$content_pref = $this -> ContentDefaultPrefs();
$tmp = $eArrayStorage->WriteArray($content_pref);
$sql -> db_Insert("core", "'$plugintable', '{$tmp}' ");
$sql -> db_Select("core", "*", "e107_name='$plugintable' ");
$sql -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
}
$row = $sql -> db_Fetch();
$content_pref = $eArrayStorage->ReadArray($row['e107_value']);
@ -428,7 +428,7 @@ class content{
}else{
//check inheritance, if set, get core prefs (default prefs)
if(isset($content_pref['content_inherit']) && $content_pref['content_inherit']!=''){
$sql -> db_Select("core", "*", "e107_name='$plugintable' ");
$sql -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
$row = $sql -> db_Fetch();
$content_pref = $eArrayStorage->ReadArray($row['e107_value']);
}
@ -436,12 +436,12 @@ class content{
//if not $id; use prefs from default core table
}else{
$num_rows = $sql -> db_Select("core", "*", "e107_name='$plugintable' ");
$num_rows = $sql -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
if ($num_rows == 0) {
$content_pref = $this -> ContentDefaultPrefs();
$tmp = $eArrayStorage->WriteArray($content_pref);
$sql -> db_Insert("core", "'$plugintable', '{$tmp}' ");
$sql -> db_Select("core", "*", "e107_name='$plugintable' ");
$sql -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
}
$row = $sql -> db_Fetch();
$content_pref = $eArrayStorage->ReadArray($row['e107_value']);
@ -457,12 +457,12 @@ class content{
//insert default preferences into core
if($id == "0"){
$num_rows = $sql -> db_Select("core", "*", "e107_name='$plugintable' ");
$num_rows = $sql -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
if ($num_rows == 0) {
$content_pref = $this -> ContentDefaultPrefs();
$tmp = $eArrayStorage->WriteArray($content_pref);
$sql -> db_Insert("core", "'$plugintable', '{$tmp}' ");
$sql -> db_Select("core", "*", "e107_name='$plugintable' ");
$sql -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
}
$row = $sql -> db_Fetch();
$current = $eArrayStorage->ReadArray($row['e107_value']);
@ -580,7 +580,7 @@ class content{
$qrygc .= " AND content_class REGEXP '".e_CLASS_REGEXP."' ";
}
$datequery = " AND content_datestamp < ".time()." AND (content_enddate=0 || content_enddate>".time().") ";
$datequery = " AND content_datestamp < ".time()." AND (content_enddate=0 || content_enddate>".time().") ";
$sqlgetcat = new db;
if($sqlgetcat -> db_Select($plugintable, "content_id, content_heading, content_parent", " ".$qrygc." ".$datequery." " )){
@ -633,7 +633,7 @@ class content{
}
$modepref = ($mode ? "content_{$mode}_nextprev" : "content_nextprev");
if(isset($content_pref[$modepref]) && $content_pref[$modepref]){
if( varsettrue($content_pref[$modepref]) ){
$np_querystring = e_SELF."?[FROM]".(isset($qs[0]) ? ".".$qs[0] : "").(isset($qs[1]) ? ".".$qs[1] : "").(isset($qs[2]) ? ".".$qs[2] : "").(isset($qs[3]) ? ".".$qs[3] : "").(isset($qs[4]) ? ".".$qs[4] : "");
$parms = $total.",".$number.",".$from.",".$np_querystring."";
@ -661,14 +661,14 @@ class content{
function getCrumbPage($mode, $arr, $parent){
global $qs, $ns, $content_pref, $plugintable;
if(isset($content_pref["content_breadcrumb_{$mode}"]) && $content_pref["content_breadcrumb_{$mode}"]){
if( varsettrue($content_pref["content_breadcrumb_{$mode}"]) ){
$crumb = '';
if(array_key_exists($parent, $arr)){
$sep = (isset($content_pref["content_breadcrumb_seperator"]) ? $content_pref["content_breadcrumb_seperator"] : ">");
if($content_pref["content_breadcrumb_base"] && isset($content_pref["content_breadcrumb_base"])){
$sep = varsettrue($content_pref["content_breadcrumb_seperator"], ">");
if( varsettrue($content_pref["content_breadcrumb_base"]) ){
$crumb .= "<a href='".e_BASE."'>".CONTENT_LAN_58."</a> ".$sep." ";
}
if($content_pref["content_breadcrumb_self"] && isset($content_pref["content_breadcrumb_self"])){
if( varsettrue($content_pref["content_breadcrumb_self"]) ){
$crumb .= "<a href='".e_SELF."'>".CONTENT_LAN_59."</a> ".$sep." ";
}
for($i=0;$i<count($arr[$parent]);$i++){
@ -745,7 +745,7 @@ class content{
function getCategoryHeading($id){
global $plugintable, $sql;
$qry = "
SELECT c.*, p.*
SELECT p.content_heading
FROM #pcontent as c
LEFT JOIN #pcontent as p ON p.content_id = c.content_parent
WHERE c.content_id = '".intval($id)."' ";
@ -1076,12 +1076,12 @@ class content{
$icon = ($icon ? $path.$icon : ($blank ? $content_icon_path."blank.gif" : ""));
}
if($icon && file_exists($icon)){
if($icon && is_readable($icon)){
$iconstring = $hrefpre."<img src='".$icon."' alt='' style='".$width." ".$border."' />".$hrefpost;
}else{
$iconstring = "";
if($blank){
if(file_exists($content_icon_path."blank.gif")){
if(is_readable($content_icon_path."blank.gif")){
if($mode == "catsmall"){
$width = ($width ? "width:".$width."px;" : "width:16px;");
}elseif($mode == "catlarge"){
@ -1099,12 +1099,12 @@ class content{
if($mode == ''){return;}
$authorinfo = "";
if( (isset($content_pref["content_{$mode}_authorname"]) && $content_pref["content_{$mode}_authorname"]) || (isset($content_pref["content_{$mode}_authoremail"]) && $content_pref["content_{$mode}_authoremail"]) || (isset($content_pref["content_{$mode}_authoricon"]) && $content_pref["content_{$mode}_authoricon"]) || (isset($content_pref["content_{$mode}_authorprofile"]) && $content_pref["content_{$mode}_authorprofile"]) ){
if( varsettrue($content_pref["content_{$mode}_authorname"]) || varsettrue($content_pref["content_{$mode}_authoremail"]) || varsettrue($content_pref["content_{$mode}_authoricon"]) || varsettrue($content_pref["content_{$mode}_authorprofile"]) ){
$authordetails = $this -> getAuthor($author);
if(isset($content_pref["content_{$mode}_authorname"]) && $content_pref["content_{$mode}_authorname"]){
if( varsettrue($content_pref["content_{$mode}_authorname"]) ){
if(isset($content_pref["content_{$mode}_authoremail"]) && $authordetails[2]){
if($authordetails[0] == "0"){
if(isset($content_pref["content_{$mode}_authoremail_nonmember"]) && $content_pref["content_{$mode}_authoremail_nonmember"] && strpos($authordetails[2], "@") ){
if( varsettrue($content_pref["content_{$mode}_authoremail_nonmember"]) && strpos($authordetails[2], "@") ){
$authorinfo = preg_replace("#([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"\\1\"+\"@\"+\"\\2\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"\\1\"+\"@\"+\"\\2\"; return true;' onmouseout='window.status=\"\";return true;'>".$authordetails[1]."</a>", $authordetails[2]);
}else{
$authorinfo = $authordetails[1];
@ -1115,11 +1115,11 @@ class content{
}else{
$authorinfo = $authordetails[1];
}
if(USER && is_numeric($authordetails[0]) && $authordetails[0] != "0" && isset($content_pref["content_{$mode}_authorprofile"]) && $content_pref["content_{$mode}_authorprofile"]){
if(USER && is_numeric($authordetails[0]) && $authordetails[0] != "0" && varsettrue($content_pref["content_{$mode}_authorprofile"]) ){
$authorinfo .= " <a href='".e_BASE."user.php?id.".$authordetails[0]."' title='".CONTENT_LAN_40."'>".CONTENT_ICON_USER."</a>";
}
}
if(isset($content_pref["content_{$mode}_authoricon"]) && $content_pref["content_{$mode}_authoricon"]){
if( varsettrue($content_pref["content_{$mode}_authoricon"]) ){
$authorinfo .= " <a href='".e_SELF."?author.".$id."' title='".CONTENT_LAN_39."'>".CONTENT_ICON_AUTHORLIST."</a>";
}
}
@ -1195,7 +1195,6 @@ class content{
<div><select id='{$mode}value' name='{$mode}value' class='tbox' $style onchange=\"if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }\">";
if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_links"] && $content_pref["content_menu_links_dropdown"]) ){
//$CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_56, 1, "none").$rs -> form_option("&nbsp;", "0", "none");
$CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_56, 1, "none");
if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewallcat"])){
@ -1287,7 +1286,7 @@ class content{
global $plugintable, $plugindir, $tp, $datequery;
if(!is_object($sqlcreatemenu)){ $sqlcreatemenu = new db; }
if(!$sqlcreatemenu -> db_Select($plugintable, "*", "content_id='".intval($parentid)."' ")){
if(!$sqlcreatemenu -> db_Select($plugintable, "content_heading", "content_id='".intval($parentid)."' ")){
return FALSE;
}else{
$row = $sqlcreatemenu -> db_Fetch();

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.6 $
| $Date: 2007-03-13 16:51:05 $
| $Revision: 1.7 $
| $Date: 2007-04-12 21:35:00 $
| $Author: lisa_ $
+---------------------------------------------------------------+
*/
@ -52,7 +52,7 @@ if(isset($_POST['uploadfile'])){
$new = "";
if($uploaded){
$uporg = $uploaded[0]['name'];
$resize = (isset($content_pref["content_upload_icon_size"]) && $content_pref["content_upload_icon_size"] ? $content_pref["content_upload_icon_size"] : "100");
$resize = varsettrue($content_pref["content_upload_icon_size"],"100");
if($uporg){
$new = $newpid."_".$uporg;
rename($pathtmp.$uporg, $pathtmp.$new);
@ -85,8 +85,8 @@ if(isset($_POST['uploadfile'])){
$new = "";
if($uploaded){
$uporg = $uploaded[0]['name'];
$resize = (isset($content_pref["content_upload_image_size"]) && $content_pref["content_upload_image_size"] ? $content_pref["content_upload_image_size"] : "500");
$resizethumb = (isset($content_pref["content_upload_image_size_thumb"]) && $content_pref["content_upload_image_size_thumb"] ? $content_pref["content_upload_image_size_thumb"] : "100");
$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);
@ -171,11 +171,9 @@ class contentdb{
$mainparent = $aa -> getMainParent(intval($_POST['parent']));
$content_pref = $aa -> getContentPref($mainparent);
$content_pref["content_icon_path_tmp"] = ($content_pref["content_icon_path_tmp"] ? $content_pref["content_icon_path_tmp"] : $content_pref["content_icon_path"]."tmp/");
$content_pref["content_file_path_tmp"] = ($content_pref["content_file_path_tmp"] ? $content_pref["content_file_path_tmp"] : $content_pref["content_file_path"]."tmp/");
$content_pref["content_image_path_tmp"] = ($content_pref["content_image_path_tmp"] ? $content_pref["content_image_path_tmp"] : $content_pref["content_image_path"]."tmp/");
$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"]);
@ -188,7 +186,7 @@ class contentdb{
//move icon to correct folder
if($_POST['content_icon']){
$icon = $tp->toDB($_POST['content_icon']);
if($icon && file_exists($content_tmppath_icon.$icon)){
if($icon && is_readable($content_tmppath_icon.$icon)){
rename($content_tmppath_icon.$icon, $content_icon_path.$icon);
}
}
@ -207,10 +205,10 @@ class contentdb{
$totalattach = "";
for($i=0;$i<$sumf;$i++){
$attach{$i} = $tp->toDB($_POST["content_files{$i}"]);
if($attach{$i} && file_exists($content_tmppath_file.$attach{$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} && file_exists($content_file_path.$attach{$i})){
if($attach{$i} && is_readable($content_file_path.$attach{$i})){
$totalattach .= "[file]".$attach{$i};
}
}
@ -218,13 +216,13 @@ class contentdb{
$totalimages = "";
for($i=0;$i<$sumi;$i++){
$image{$i} = $tp->toDB($_POST["content_images{$i}"]);
if($image{$i} && file_exists($content_tmppath_image.$image{$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} && file_exists($content_tmppath_image."thumb_".$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} && file_exists($content_image_path.$image{$i})){
if($image{$i} && is_readable($content_image_path.$image{$i})){
$totalimages .= "[img]".$image{$i};
}
}
@ -266,7 +264,7 @@ class contentdb{
}
}
//preset additional data tags
if(isset($_POST['content_custom_preset_key']) && $_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){

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.9 $
| $Date: 2007-03-13 16:51:05 $
| $Revision: 1.10 $
| $Date: 2007-04-12 21:35:00 $
| $Author: lisa_ $
+---------------------------------------------------------------+
*/
@ -100,9 +100,9 @@ class contentform{
$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"] = ($content_pref["content_icon_path_tmp"] ? $content_pref["content_icon_path_tmp"] : $content_pref["content_icon_path"]."tmp/");
$content_pref["content_file_path_tmp"] = ($content_pref["content_file_path_tmp"] ? $content_pref["content_file_path_tmp"] : $content_pref["content_file_path"]."tmp/");
$content_pref["content_image_path_tmp"] = ($content_pref["content_image_path_tmp"] ? $content_pref["content_image_path_tmp"] : $content_pref["content_image_path"]."tmp/");
$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"]);
@ -170,9 +170,9 @@ class contentform{
}
//icon
if($_POST['content_icon'] && file_exists($content_tmppath_icon.$_POST['content_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'] && file_exists($content_icon_path.$_POST['content_icon'])){
}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;
@ -186,19 +186,19 @@ class contentform{
$IMAGES = $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_31.$TDPOST.$TDPRE2;
foreach($_POST as $k => $v){
if(strpos($k, "content_files") === 0){
if($v && file_exists($content_tmppath_file.$v)){
if($v && is_readable($content_tmppath_file.$v)){
$ATTACH .= CONTENT_ICON_FILE." ".$v."<br />";
$file = TRUE;
}elseif($v && file_exists($content_file_path.$v)){
}elseif($v && is_readable($content_file_path.$v)){
$ATTACH .= CONTENT_ICON_FILE." ".$v."<br />";
$file = TRUE;
}
}
if(strpos($k, "content_images") === 0){
if($v && file_exists($content_tmppath_image.$v)){
if($v && is_readable($content_tmppath_image.$v)){
$IMAGES .= "<img src='".$content_tmppath_image.$v."' alt='' style='width:100px; border:0;' /> ";
$image = TRUE;
}elseif($v && file_exists($content_image_path.$v)){
}elseif($v && is_readable($content_image_path.$v)){
$IMAGES .= "<img src='".$content_image_path.$v."' alt='' style='width:100px; border:0;' /> ";
$image = TRUE;
}
@ -253,7 +253,7 @@ class contentform{
//if inherit is used in the manager, we need to get the preferences from the core plugin table default preferences
//and use those preferences in the permissions check.
if(isset($manager_pref['content_manager_inherit']) && $manager_pref['content_manager_inherit']){
if( varsettrue($manager_pref['content_manager_inherit']) ){
$sql -> db_Select("core", "*", "e107_name='$plugintable' ");
$row = $sql -> db_Fetch();
$manager_pref = $eArrayStorage->ReadArray($row['e107_value']);
@ -275,7 +275,7 @@ class contentform{
//if inherit is used in the manager, we need to get the preferences from the core plugin table default preferences
//and use those preferences in the permissions check.
if(isset($manager_pref['content_manager_inherit']) && $manager_pref['content_manager_inherit']){
if( varsettrue($manager_pref['content_manager_inherit']) ){
$sql -> db_Select("core", "*", "e107_name='$plugintable' ");
$row = $sql -> db_Fetch();
$manager_pref = $eArrayStorage->ReadArray($row['e107_value']);
@ -316,8 +316,8 @@ class contentform{
//if inherit is used in the manager, we need to get the preferences from the core plugin table default preferences
//and use those preferences in the permissions check.
if(isset($manager_pref['content_manager_inherit']) && $manager_pref['content_manager_inherit']){
$sql -> db_Select("core", "*", "e107_name='$plugintable' ");
if( varsettrue($manager_pref['content_manager_inherit']) ){
$sql -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
$row = $sql -> db_Fetch();
$manager_pref = $eArrayStorage->ReadArray($row['e107_value']);
}
@ -367,9 +367,9 @@ class contentform{
}
//general variables (from the top level category preferences)
$content_pref["content_icon_path_tmp"] = ($content_pref["content_icon_path_tmp"] ? $content_pref["content_icon_path_tmp"] : $content_pref["content_icon_path"]."tmp/");
$content_pref["content_file_path_tmp"] = ($content_pref["content_file_path_tmp"] ? $content_pref["content_file_path_tmp"] : $content_pref["content_file_path"]."tmp/");
$content_pref["content_image_path_tmp"] = ($content_pref["content_image_path_tmp"] ? $content_pref["content_image_path_tmp"] : $content_pref["content_image_path"]."tmp/");
$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"]);
@ -381,47 +381,47 @@ class contentform{
//get preferences for submit page
if($mode == "submit"){
$checksubheading = (isset($manager_pref["content_manager_submit_subheading"]) ? $manager_pref["content_manager_submit_subheading"] : "");
$checksummary = (isset($manager_pref["content_manager_submit_summary"]) ? $manager_pref["content_manager_submit_summary"] : "");
$checkstartdate = (isset($manager_pref["content_manager_submit_startdate"]) ? $manager_pref["content_manager_submit_startdate"] : "");
$checkenddate = (isset($manager_pref["content_manager_submit_enddate"]) ? $manager_pref["content_manager_submit_enddate"] : "");
$checkicon = (isset($manager_pref["content_manager_submit_icon"]) ? $manager_pref["content_manager_submit_icon"] : "");
$checkattach = (isset($manager_pref["content_manager_submit_attach"]) ? $manager_pref["content_manager_submit_attach"] : "");
$checkattachnumber = (isset($manager_pref["content_manager_submit_files_number"]) ? $manager_pref["content_manager_submit_files_number"] : "");
$checkimages = (isset($manager_pref["content_manager_submit_images"]) ? $manager_pref["content_manager_submit_images"] : "");
$checkimagesnumber = (isset($manager_pref["content_manager_submit_images_number"]) ? $manager_pref["content_manager_submit_images_number"] : "");
$checkcomment = (isset($manager_pref["content_manager_submit_comment"]) ? $manager_pref["content_manager_submit_comment"] : "");
$checkrating = (isset($manager_pref["content_manager_submit_rating"]) ? $manager_pref["content_manager_submit_rating"] : "");
$checkscore = (isset($manager_pref["content_manager_submit_score"]) ? $manager_pref["content_manager_submit_score"] : "");
$checkpe = (isset($manager_pref["content_manager_submit_pe"]) ? $manager_pref["content_manager_submit_pe"] : "");
$checkvisibility = (isset($manager_pref["content_manager_submit_visibility"]) ? $manager_pref["content_manager_submit_visibility"] : "");
$checkmeta = (isset($manager_pref["content_manager_submit_meta"]) ? $manager_pref["content_manager_submit_meta"] : "");
$checkcustom = (isset($manager_pref["content_manager_submit_customtags"]) ? $manager_pref["content_manager_submit_customtags"] : "");
$checkcustomnumber = (isset($manager_pref["content_manager_submit_custom_number"]) ? $manager_pref["content_manager_submit_custom_number"] : "");
$checklayout = (isset($manager_pref["content_manager_submit_layout"]) ? $manager_pref["content_manager_submit_layout"] : "");
$checkpreset = (isset($manager_pref["content_manager_submit_presettags"]) ? $manager_pref["content_manager_submit_presettags"] : "");
$checksubheading = varsettrue($manager_pref["content_manager_submit_subheading"], "");
$checksummary = varsettrue($manager_pref["content_manager_submit_summary"], "");
$checkstartdate = varsettrue($manager_pref["content_manager_submit_startdate"], "");
$checkenddate = varsettrue($manager_pref["content_manager_submit_enddate"], "");
$checkicon = varsettrue($manager_pref["content_manager_submit_icon"], "");
$checkattach = varsettrue($manager_pref["content_manager_submit_attach"], "");
$checkattachnumber = varsettrue($manager_pref["content_manager_submit_files_number"], "");
$checkimages = varsettrue($manager_pref["content_manager_submit_images"], "");
$checkimagesnumber = varsettrue($manager_pref["content_manager_submit_images_number"], "");
$checkcomment = varsettrue($manager_pref["content_manager_submit_comment"], "");
$checkrating = varsettrue($manager_pref["content_manager_submit_rating"], "");
$checkscore = varsettrue($manager_pref["content_manager_submit_score"], "");
$checkpe = varsettrue($manager_pref["content_manager_submit_pe"], "");
$checkvisibility = varsettrue($manager_pref["content_manager_submit_visibility"], "");
$checkmeta = varsettrue($manager_pref["content_manager_submit_meta"], "");
$checkcustom = varsettrue($manager_pref["content_manager_submit_customtags"], "");
$checkcustomnumber = varsettrue($manager_pref["content_manager_submit_custom_number"], "");
$checklayout = varsettrue($manager_pref["content_manager_submit_layout"], "");
$checkpreset = varsettrue($manager_pref["content_manager_submit_presettags"], "");
//get preferences for managers page
}elseif($mode=='contentmanager'){
$checksubheading = (isset($manager_pref["content_manager_manager_subheading"]) ? $manager_pref["content_manager_manager_subheading"] : "");
$checksummary = (isset($manager_pref["content_manager_manager_summary"]) ? $manager_pref["content_manager_manager_summary"] : "");
$checkstartdate = (isset($manager_pref["content_manager_manager_startdate"]) ? $manager_pref["content_manager_manager_startdate"] : "");
$checkenddate = (isset($manager_pref["content_manager_manager_enddate"]) ? $manager_pref["content_manager_manager_enddate"] : "");
$checkicon = (isset($manager_pref["content_manager_manager_icon"]) ? $manager_pref["content_manager_manager_icon"] : "");
$checkattach = (isset($manager_pref["content_manager_manager_attach"]) ? $manager_pref["content_manager_manager_attach"] : "");
$checkattachnumber = (isset($manager_pref["content_manager_manager_files_number"]) ? $manager_pref["content_manager_manager_files_number"] : "");
$checkimages = (isset($manager_pref["content_manager_manager_images"]) ? $manager_pref["content_manager_manager_images"] : "");
$checkimagesnumber = (isset($manager_pref["content_manager_manager_images_number"]) ? $manager_pref["content_manager_manager_images_number"] : "");
$checkcomment = (isset($manager_pref["content_manager_manager_comment"]) ? $manager_pref["content_manager_manager_comment"] : "");
$checkrating = (isset($manager_pref["content_manager_manager_rating"]) ? $manager_pref["content_manager_manager_rating"] : "");
$checkscore = (isset($manager_pref["content_manager_manager_score"]) ? $manager_pref["content_manager_manager_score"] : "");
$checkpe = (isset($manager_pref["content_manager_manager_pe"]) ? $manager_pref["content_manager_manager_pe"] : "");
$checkvisibility = (isset($manager_pref["content_manager_manager_visibility"]) ? $manager_pref["content_manager_manager_visibility"] : "");
$checkmeta = (isset($manager_pref["content_manager_manager_meta"]) ? $manager_pref["content_manager_manager_meta"] : "");
$checkcustom = (isset($manager_pref["content_manager_manager_customtags"]) ? $manager_pref["content_manager_manager_customtags"] : "");
$checkcustomnumber = (isset($manager_pref["content_manager_manager_custom_number"]) ? $manager_pref["content_manager_manager_custom_number"] : "");
$checklayout = (isset($manager_pref["content_manager_manager_layout"]) ? $manager_pref["content_manager_manager_layout"] : "");
$checkpreset = (isset($manager_pref["content_manager_manager_presettags"]) ? $manager_pref["content_manager_manager_presettags"] : "");
$checksubheading = varsettrue($manager_pref["content_manager_manager_subheading"], "");
$checksummary = varsettrue($manager_pref["content_manager_manager_summary"], "");
$checkstartdate = varsettrue($manager_pref["content_manager_manager_startdate"], "");
$checkenddate = varsettrue($manager_pref["content_manager_manager_enddate"], "");
$checkicon = varsettrue($manager_pref["content_manager_manager_icon"], "");
$checkattach = varsettrue($manager_pref["content_manager_manager_attach"], "");
$checkattachnumber = varsettrue($manager_pref["content_manager_manager_files_number"], "");
$checkimages = varsettrue($manager_pref["content_manager_manager_images"], "");
$checkimagesnumber = varsettrue($manager_pref["content_manager_manager_images_number"], "");
$checkcomment = varsettrue($manager_pref["content_manager_manager_comment"], "");
$checkrating = varsettrue($manager_pref["content_manager_manager_rating"], "");
$checkscore = varsettrue($manager_pref["content_manager_manager_score"], "");
$checkpe = varsettrue($manager_pref["content_manager_manager_pe"], "");
$checkvisibility = varsettrue($manager_pref["content_manager_manager_visibility"], "");
$checkmeta = varsettrue($manager_pref["content_manager_manager_meta"], "");
$checkcustom = varsettrue($manager_pref["content_manager_manager_customtags"], "");
$checkcustomnumber = varsettrue($manager_pref["content_manager_manager_custom_number"], "");
$checklayout = varsettrue($manager_pref["content_manager_manager_layout"], "");
$checkpreset = varsettrue($manager_pref["content_manager_manager_presettags"], "");
//get preferences for admin area; posted submitted item. (approve submitted)
}elseif($mode == "sa"){
@ -468,25 +468,25 @@ class contentform{
//normal admin content create preferences
}else{
$checksubheading = (isset($content_pref["content_admin_subheading"]) ? $content_pref["content_admin_subheading"] : "");
$checksummary = (isset($content_pref["content_admin_summary"]) ? $content_pref["content_admin_summary"] : "");
$checkstartdate = (isset($content_pref["content_admin_startdate"]) ? $content_pref["content_admin_startdate"] : "");
$checkenddate = (isset($content_pref["content_admin_enddate"]) ? $content_pref["content_admin_enddate"] : "");
$checkicon = (isset($content_pref["content_admin_icon"]) ? $content_pref["content_admin_icon"] : "");
$checkattach = (isset($content_pref["content_admin_attach"]) ? $content_pref["content_admin_attach"] : "");
$checkattachnumber = (isset($content_pref["content_admin_files_number"]) ? $content_pref["content_admin_files_number"] : "");
$checkimages = (isset($content_pref["content_admin_images"]) ? $content_pref["content_admin_images"] : "");
$checkimagesnumber = (isset($content_pref["content_admin_images_number"]) ? $content_pref["content_admin_images_number"] : "");
$checkcomment = (isset($content_pref["content_admin_comment"]) ? $content_pref["content_admin_comment"] : "");
$checkrating = (isset($content_pref["content_admin_rating"]) ? $content_pref["content_admin_rating"] : "");
$checkscore = (isset($content_pref["content_admin_score"]) ? $content_pref["content_admin_score"] : "");
$checkpe = (isset($content_pref["content_admin_pe"]) ? $content_pref["content_admin_pe"] : "");
$checkvisibility = (isset($content_pref["content_admin_visibility"]) ? $content_pref["content_admin_visibility"] : "");
$checkmeta = (isset($content_pref["content_admin_meta"]) ? $content_pref["content_admin_meta"] : "");
$checkcustom = (isset($content_pref["content_admin_customtags"]) ? $content_pref["content_admin_customtags"] : "");
$checkcustomnumber = (isset($content_pref["content_admin_custom_number"]) ? $content_pref["content_admin_custom_number"] : "");
$checklayout = (isset($content_pref["content_admin_layout"]) ? $content_pref["content_admin_layout"] : "");
$checkpreset = (isset($content_pref["content_admin_presettags"]) ? $content_pref["content_admin_presettags"] : "");
$checksubheading = varsettrue($content_pref["content_admin_subheading"], "");
$checksummary = varsettrue($content_pref["content_admin_summary"], "");
$checkstartdate = varsettrue($content_pref["content_admin_startdate"], "");
$checkenddate = varsettrue($content_pref["content_admin_enddate"], "");
$checkicon = varsettrue($content_pref["content_admin_icon"], "");
$checkattach = varsettrue($content_pref["content_admin_attach"], "");
$checkattachnumber = varsettrue($content_pref["content_admin_files_number"], "");
$checkimages = varsettrue($content_pref["content_admin_images"], "");
$checkimagesnumber = varsettrue($content_pref["content_admin_images_number"], "");
$checkcomment = varsettrue($content_pref["content_admin_comment"], "");
$checkrating = varsettrue($content_pref["content_admin_rating"], "");
$checkscore = varsettrue($content_pref["content_admin_score"], "");
$checkpe = varsettrue($content_pref["content_admin_pe"], "");
$checkvisibility = varsettrue($content_pref["content_admin_visibility"], "");
$checkmeta = varsettrue($content_pref["content_admin_meta"], "");
$checkcustom = varsettrue($content_pref["content_admin_customtags"], "");
$checkcustomnumber = varsettrue($content_pref["content_admin_custom_number"], "");
$checklayout = varsettrue($content_pref["content_admin_layout"], "");
$checkpreset = varsettrue($content_pref["content_admin_presettags"], "");
}
//parse author info
@ -723,7 +723,7 @@ class contentform{
//retrieve the custom/preset data tags
if(!(isset($_POST['preview_content']) || isset($message))){
if(isset($row['content_pref']) && $row['content_pref']){
if( varsettrue($row['content_pref']) ){
$custom = $eArrayStorage->ReadArray($row['content_pref']);
}
}
@ -912,7 +912,7 @@ class contentform{
//if inherit is used in the manager, we need to get the preferences from the core plugin table default preferences
//and use those preferences in the permissions check.
if(isset($curpref['content_manager_inherit']) && $curpref['content_manager_inherit']){
if( varsettrue($curpref['content_manager_inherit']) ){
$sql2 -> db_Select("core", "*", "e107_name='$plugintable' ");
$row2 = $sql2 -> db_Fetch();
$curpref = $eArrayStorage->ReadArray($row2['e107_value']);
@ -957,15 +957,10 @@ class contentform{
$distinctfirstletter = $sql -> db_Select($plugintable, " DISTINCT(content_heading) ", "content_refer != 'sa' AND ".$qryfirst." ".$qryuser." ORDER BY content_heading ASC ");
while($row = $sql -> db_Fetch()){
$head = $tp->toHTML($row['content_heading'], TRUE);
if(ord($head) < 128) {
$head_sub = strtoupper(substr($head,0,1));
}else{
$head_sub = substr($head,0,2);
}
$head_sub = ( ord($head) < 128 ? strtoupper(substr($head,0,1)) : substr($head,0,2) );
$arrletters[] = $head_sub;
}
$arrletters = array_unique($arrletters);
$arrletters = array_values($arrletters);
$arrletters = array_values(array_unique($arrletters));
sort($arrletters);
if ($distinctfirstletter == 0){
@ -1046,7 +1041,7 @@ class contentform{
//if inherit is used in the manager, we need to get the preferences from the core plugin table default preferences
//and use those preferences in the permissions check.
if(isset($content_pref['content_manager_inherit']) && $content_pref['content_manager_inherit']){
if( varsettrue($content_pref['content_manager_inherit']) ){
$sql -> db_Select("core", "*", "e107_name='$plugintable' ");
$row = $sql -> db_Fetch();
$content_pref = $eArrayStorage->ReadArray($row['e107_value']);
@ -1114,8 +1109,8 @@ class contentform{
}else{
$row = $sql -> db_Fetch();
$content_pref = $aa -> getContentPref($catarray[$catid][0]);
$delete_heading = str_replace("&#39;", "\'", $row['content_heading']);
$content_pref = $aa -> getContentPref($catarray[$catid][0]);
$delete_heading = str_replace("&#39;", "\'", $row['content_heading']);
$CONTENT_ADMIN_SPACER = ($row['content_parent']==0 ? TRUE : FALSE);
$CONTENT_ADMIN_OPTIONS = "<a href='".e_SELF."?cat.edit.".$catid."'>".CONTENT_ICON_EDIT."</a>
@ -1450,13 +1445,13 @@ class contentform{
$current_year = $smarray['year'];
//check which areas should be visible (dependent on options in admin:create category)
if(isset($content_pref["content_admincat_subheading"]) && $content_pref["content_admincat_subheading"]){
if( varsettrue($content_pref["content_admincat_subheading"]) ){
$show['subheading'] = true;
}else{
$show['subheading'] = false;
$hidden .= $rs -> form_hidden("cat_subheading", $row['content_subheading']);
}
if(isset($content_pref["content_admincat_startdate"]) && $content_pref["content_admincat_startdate"]){
if( varsettrue($content_pref["content_admincat_startdate"]) ){
$show['startdate'] = true;
}else{
$show['startdate'] = false;
@ -1464,7 +1459,7 @@ class contentform{
$hidden .= $rs -> form_hidden("ne_month", $ne_month);
$hidden .= $rs -> form_hidden("ne_year", $ne_year);
}
if(isset($content_pref["content_admincat_enddate"]) && $content_pref["content_admincat_enddate"]){
if( varsettrue($content_pref["content_admincat_enddate"]) ){
$show['enddate'] = true;
}else{
$show['enddate'] = false;
@ -1472,36 +1467,36 @@ class contentform{
$hidden .= $rs -> form_hidden("end_month", $end_month);
$hidden .= $rs -> form_hidden("end_year", $end_year);
}
if(isset($content_pref["content_admincat_uploadicon"]) && $content_pref["content_admincat_uploadicon"]){
if( varsettrue($content_pref["content_admincat_uploadicon"]) ){
$show['uploadicon'] = true;
}else{
$show['uploadicon'] = false;
}
if(isset($content_pref["content_admincat_selecticon"]) && $content_pref["content_admincat_selecticon"]){
if( varsettrue($content_pref["content_admincat_selecticon"]) ){
$show['selecticon'] = true;
}else{
$show['selecticon'] = false;
$hidden .= $rs -> form_hidden("cat_icon", $row['content_icon']);
}
if(isset($content_pref["content_admincat_comment"]) && $content_pref["content_admincat_comment"]){
if( varsettrue($content_pref["content_admincat_comment"]) ){
$show['comment'] = true;
}else{
$show['comment'] = false;
$hidden .= $rs -> form_hidden("cat_comment", $row['content_comment']);
}
if(isset($content_pref["content_admincat_rating"]) && $content_pref["content_admincat_rating"]){
if( varsettrue($content_pref["content_admincat_rating"]) ){
$show['rating'] = true;
}else{
$show['rating'] = false;
$hidden .= $rs -> form_hidden("cat_rate", $row['content_rate']);
}
if(isset($content_pref["content_admincat_pe"]) && $content_pref["content_admincat_pe"]){
if( varsettrue($content_pref["content_admincat_pe"]) ){
$show['pe'] = true;
}else{
$show['pe'] = false;
$hidden .= $rs -> form_hidden("cat_pe", $row['content_pe']);
}
if(isset($content_pref["content_admincat_visibility"]) && $content_pref["content_admincat_visibility"]){
if( varsettrue($content_pref["content_admincat_visibility"]) ){
$show['visibility'] = true;
}else{
$show['visibility'] = false;
@ -1564,7 +1559,7 @@ class contentform{
//if inherit is used in the manager, we need to get the preferences from the core plugin table default preferences
//and use those preferences in the permissions check.
if(isset($content_pref['content_manager_inherit']) && $content_pref['content_manager_inherit']){
if( varsettrue($content_pref['content_manager_inherit']) ){
$sql2 -> db_Select("core", "*", "e107_name='$plugintable' ");
$row2 = $sql2 -> db_Fetch();
$content_pref = $eArrayStorage->ReadArray($row2['e107_value']);
@ -1863,7 +1858,7 @@ class contentform{
$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_3;
$TOPIC_FIELD = "
".$rs -> form_select_open("content_admin_images_number");
$content_pref['content_admin_images_number'] = ($content_pref['content_admin_images_number'] ? $content_pref['content_admin_images_number'] : "10");
$content_pref['content_admin_images_number'] = varset($content_pref['content_admin_images_number'],"10");
for($i=1;$i<16;$i++){
$k=$i*2;
$TOPIC_FIELD .= $rs -> form_option($k, ($content_pref['content_admin_images_number'] == $k ? "1" : "0"), $k);
@ -1875,7 +1870,7 @@ class contentform{
$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_4;
$TOPIC_FIELD = "
".$rs -> form_select_open("content_admin_files_number");
$content_pref['content_admin_files_number'] = ($content_pref['content_admin_files_number'] ? $content_pref['content_admin_files_number'] : "1");
$content_pref['content_admin_files_number'] = varset($content_pref['content_admin_files_number'],"1");
for($i=1;$i<6;$i++){
$TOPIC_FIELD .= $rs -> form_option($i, ($content_pref['content_admin_files_number'] == $i ? "1" : "0"), $i);
}