diff --git a/e107_core/shortcodes/batch/signup_shortcodes.php b/e107_core/shortcodes/batch/signup_shortcodes.php
index ca6a9e954..e66a04d1c 100755
--- a/e107_core/shortcodes/batch/signup_shortcodes.php
+++ b/e107_core/shortcodes/batch/signup_shortcodes.php
@@ -15,279 +15,343 @@
// Mods to show extended field categories
if (!defined('e107_INIT')) { exit; }
-include_once(e_HANDLER.'shortcode_handler.php');
-$signup_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
-/*
-SC_BEGIN SIGNUP_COPPA_FORM
-if (strpos(LAN_SIGNUP_77, "stage") !== FALSE)
+
+class signup_shortcodes extends e_shortcode
{
- return "";
-}
-else
-{
- return "
-
-";
-}
-SC_END
-
-SC_BEGIN SIGNUP_FORM_OPEN
-global $rs;
-return $rs->form_open("post", e_SELF, "signupform");
-SC_END
-
-SC_BEGIN SIGNUP_SIGNUP_TEXT
-global $pref, $tp, $SIGNUP_TEXT;
-
-if($pref['signup_text'])
-{
- return $tp->toHTML($pref['signup_text'], TRUE, 'parse_sc,defs');
-}
-elseif($pref['user_reg_veri'])
-{
- return $SIGNUP_TEXT;
-}
-SC_END
-
-
-
-SC_BEGIN SIGNUP_DISPLAYNAME
-global $pref, $rs;
-if (check_class($pref['displayname_class']))
-{
- $dis_name_len = varset($pref['displayname_maxlength'],15);
- return $rs->form_text('username', $dis_name_len+5, ($_POST['username'] ? $_POST['username'] : $username), $dis_name_len);
-}
-SC_END
-
-
-SC_BEGIN SIGNUP_LOGINNAME
-global $rs, $pref;
-if (varsettrue($pref['predefinedLoginName']))
-{
- return LAN_SIGNUP_67;
-}
-$log_name_length = varset($pref['loginname_maxlength'],30);
-return $rs->form_text("loginname", $log_name_length+5, ($_POST['loginname'] ? $_POST['loginname'] : $loginname), $log_name_length);
-SC_END
-
-SC_BEGIN SIGNUP_REALNAME
-global $rs, $pref;
-if ($pref['signup_option_realname'])
-{
- return $rs->form_text("realname", 30, ($_POST['realname'] ? $_POST['realname'] : $realname), 100);
-}
-SC_END
-
-SC_BEGIN SIGNUP_PASSWORD1
-global $rs;
-return $rs->form_password("password1", 30, $password1, 20);
-SC_END
-
-SC_BEGIN SIGNUP_PASSWORD2
-global $rs;
-return $rs->form_password("password2", 30, $password2, 20);
-SC_END
-
-SC_BEGIN SIGNUP_PASSWORD_LEN
-global $pref, $SIGNUP_PASSWORD_LEN;
-if($pref['signup_pass_len'])
-{
- return $SIGNUP_PASSWORD_LEN;
-}
-SC_END
-
-SC_BEGIN SIGNUP_EMAIL
-global $rs;
-return $rs->form_text("email", 30, ($_POST['email'] ? $_POST['email'] : $email), 100);
-SC_END
-
-SC_BEGIN SIGNUP_EMAIL_CONFIRM
-global $rs;
-return $rs->form_text("email_confirm", 30, ($_POST['email_confirm'] ? $_POST['email_confirm'] : $email_confirm), 100);
-SC_END
-
-
-SC_BEGIN SIGNUP_HIDE_EMAIL
-global $rs;
-$default_email_setting = 1; // Gives option of turning into a pref later if wanted
-return $rs->form_radio("hideemail", 1, $default_email_setting==1)." ".LAN_YES." ".$rs->form_radio("hideemail", 0,$default_email_setting==0)." ".LAN_NO;
-SC_END
-
-
-SC_BEGIN SIGNUP_USERCLASS_SUBSCRIBE
-global $pref, $e_userclass, $USERCLASS_SUBSCRIBE_START, $USERCLASS_SUBSCRIBE_END, $signupData;
-$ret = "";
-if($pref['signup_option_class'])
-{
- if (!is_object($e_userclass))
- {
- require_once(e_HANDLER.'userclass_class.php');
- $e_userclass = new user_class;
- }
- $ucList = $e_userclass->get_editable_classes(); // List of classes which this user can edit
- $ret = '';
- if(!$ucList) return;
-
- function show_signup_class($treename, $classnum, $current_value, $nest_level)
- {
- global $USERCLASS_SUBSCRIBE_ROW, $e_userclass, $tp;
- $tmp = explode(',',$current_value);
- $search = array('{USERCLASS_ID}', '{USERCLASS_NAME}', '{USERCLASS_DESCRIPTION}', '{USERCLASS_INDENT}', '{USERCLASS_CHECKED}');
- $replace = array($classnum, $tp->toHTML($e_userclass->uc_get_classname($classnum), FALSE, 'defs'),
- $tp->toHTML($e_userclass->uc_get_classdescription($classnum), FALSE, 'defs'), " style='text-indent:".(1.2*$nest_level)."em'",
- ( in_array($classnum, $tmp) ? " checked='checked'" : ''));
- return str_replace($search, $replace, $USERCLASS_SUBSCRIBE_ROW);
- }
- $ret = $USERCLASS_SUBSCRIBE_START;
- $ret .= $e_userclass->vetted_tree('class',show_signup_class,varset($signupData['user_class'],''),'editable');
- $ret .= $USERCLASS_SUBSCRIBE_END;
- return $ret;
-}
-SC_END
-
-
-SC_BEGIN SIGNUP_EXTENDED_USER_FIELDS
-global $usere, $tp, $SIGNUP_EXTENDED_USER_FIELDS, $EXTENDED_USER_FIELD_REQUIRED, $SIGNUP_EXTENDED_CAT;
-$text = "";
-
-$search = array(
-'{EXTENDED_USER_FIELD_TEXT}',
-'{EXTENDED_USER_FIELD_REQUIRED}',
-'{EXTENDED_USER_FIELD_EDIT}'
-);
-
-
-// What we need is a list of fields, ordered first by parent, and then by display order?
-// category entries are `user_extended_struct_type` = 0
-// 'unallocated' entries are `user_extended_struct_parent` = 0
-
-// Get a list of defined categories
-$catList = $usere->user_extended_get_categories(FALSE);
-// Add in category zero - the 'no category' category
-array_unshift($catList,array('user_extended_struct_parent' => 0, 'user_extended_struct_id' => '0'));
-
-
-
-foreach($catList as $cat)
-{
- $extList = $usere->user_extended_get_fieldList($cat['user_extended_struct_id']);
-
- $done_heading = FALSE;
-
- foreach($extList as $ext)
- {
- if($ext['user_extended_struct_required'] == 1 || $ext['user_extended_struct_required'] == 2)
- {
- if(!$done_heading && ($cat['user_extended_struct_id'] > 0))
- { // Add in a heading
- $catName = $cat['user_extended_struct_text'] ? $cat['user_extended_struct_text'] : $cat['user_extended_struct_name'];
- if(defined($catName)) $catName = constant($catName);
- $text .= str_replace('{EXTENDED_CAT_TEXT}', $tp->toHTML($catName, FALSE, 'emotes_off,defs'), $SIGNUP_EXTENDED_CAT);
- $done_heading = TRUE;
- }
- $replace = array(
- $tp->toHTML(deftrue($ext['user_extended_struct_text'], $ext['user_extended_struct_text']), FALSE, 'emotes_off,defs'),
- ($ext['user_extended_struct_required'] == 1 ? $EXTENDED_USER_FIELD_REQUIRED : ''),
- $usere->user_extended_edit($ext, $_POST['ue']['user_'.$ext['user_extended_struct_name']])
- );
- $text .= str_replace($search, $replace, $SIGNUP_EXTENDED_USER_FIELDS);
- }
- }
-}
-return $text;
-SC_END
-
-SC_BEGIN SIGNUP_SIGNATURE
-global $pref, $SIGNUP_SIGNATURE_START, $SIGNUP_SIGNATURE_END;
-if($pref['signup_option_signature'])
-{
- require_once(e_HANDLER."ren_help.php");
- $SIGNUP_SIGNATURE_START = str_replace("{REN_HELP}", display_help('helpb', 2), $SIGNUP_SIGNATURE_START);
- $SIGNUP_SIGNATURE_END = str_replace("{REN_HELP}", display_help('helpb', 2), $SIGNUP_SIGNATURE_END);
- $sig = ($_POST['signature'] ? $_POST['signature'] : $signature);
- return $SIGNUP_SIGNATURE_START.$sig.$SIGNUP_SIGNATURE_END;
-}
-SC_END
-
-SC_BEGIN SIGNUP_IMAGES
-global $pref;
-if($pref['signup_option_image'])
-{
-
- $text = "
-
-
-
- ";
- $avatarlist[0] = "";
- $handle = opendir(e_IMAGE."avatars/");
- while ($file = readdir($handle))
+
+ function sc_signup_coppa_form()
{
- if ($file != "." && $file != ".." && $file != "CVS" && $file != "index.html")
+ if (strpos(LAN_SIGNUP_77, "stage") !== FALSE)
{
- $avatarlist[] = $file;
+ return "";
+ }
+ else
+ {
+ return "
+
+ ";
}
}
- closedir($handle);
-
- for($c = 1; $c <= (count($avatarlist)-1); $c++)
+
+
+ function sc_signup_form_open()
{
- $text .= "
";
+ global $rs;
+ return $rs->form_open("post", e_SELF, "signupform");
+ }
+
+
+ function sc_signup_signup_text()
+ {
+
+ global $pref, $tp, $SIGNUP_TEXT;
+
+ if($pref['signup_text'])
+ {
+ return $tp->toHTML($pref['signup_text'], TRUE, 'parse_sc,defs');
+ }
+ elseif($pref['user_reg_veri'])
+ {
+ return $SIGNUP_TEXT;
+ }
+ }
+
+
+
+ function sc_signup_displayname()
+ {
+ global $pref, $rs;
+ if (check_class($pref['displayname_class']))
+ {
+ $dis_name_len = varset($pref['displayname_maxlength'],15);
+ return $rs->form_text('username', 30, ($_POST['username'] ? $_POST['username'] : $username), $dis_name_len);
+ }
+ }
+
+
+ function sc_signup_loginname()
+ {
+ global $rs, $pref;
+ if (varsettrue($pref['predefinedLoginName']))
+ {
+ return LAN_SIGNUP_67;
+ }
+ if ($pref['signup_option_loginname'])
+ {
+ $log_name_length = varset($pref['loginname_maxlength'],30);
+ return $rs->form_text("loginname", 30, ($_POST['loginname'] ? $_POST['loginname'] : $loginname), $log_name_length);
+ }
+ }
+
+
+ function sc_signup_realname()
+ {
+ global $rs, $pref;
+ if ($pref['signup_option_realname'])
+ {
+ return $rs->form_text("realname", 30, ($_POST['realname'] ? $_POST['realname'] : $realname), 100);
+ }
+ }
+
+
+ function sc_signup_password1()
+ {
+ $options = array('size'=>30,'class'=>'e-password tbox','required'=>1);
+ $len = vartrue(e107::getPref('signup_pass_len'),6);
+ // $options['pattern'] = '(?=.*\d)(?=.*[a-z])(?=.*[A-Z])\w{'.$len.',}'; // at least one number, one lowercase and uppercase.
+ $options['pattern'] = '\w{'.$len.',}'; // word of minimum length
+
+ return e107::getForm()->password('password1', '', 20, $options);
+ }
+
+
+ function sc_signup_password2()
+ {
+ return e107::getForm()->password('password2', '', 20, array('size'=>30,'class'=>'tbox','required'=>1));
+ }
+
+
+ function sc_signup_password_len()
+ {
+ global $pref, $SIGNUP_PASSWORD_LEN;
+ if($pref['signup_pass_len'])
+ {
+ return $SIGNUP_PASSWORD_LEN;
+ }
+ }
+
+
+ function sc_signup_email()
+ {
+ $options = array('size'=>30,'required'=>1,'class'=>'tbox input-text e-email');
+ $text = e107::getForm()->email('email',($_POST['email'] ? $_POST['email'] : $email),100,$options);
+ $text .= "
";
+ return $text;
+ }
+
+
+ function sc_signup_email_confirm()
+ {
+ $pref = e107::getPref('signup_option_email_confirm');
+ if($pref < 1){ return; }
+
+ $options = array('size'=>30);
+ $options['required'] = ($pref==2) ? 1 : 0;
+ $options['class'] = 'tbox input-text e-email';
+
+ return e107::getForm()->email('email_confirm',($_POST['email_confirm'] ? $_POST['email_confirm'] : $email_confirm),100,$options);
+
+ }
+
+
+ function sc_signup_hide_email()
+ {
+ global $rs,$pref;
+ $default_email_setting = 1; // Gives option of turning into a pref later if wanted
+ if ($pref['signup_option_realname'])
+ {
+ return $rs->form_radio("hideemail", 1, $default_email_setting==1)." ".LAN_YES." ".$rs->form_radio("hideemail", 0,$default_email_setting==0)." ".LAN_NO;
+ }
}
- $text .= "
-
";
- // Intentionally disable uploadable avatar and photos at this stage
- if (false && $pref['avatar_upload'] && FILE_UPLOADS)
+ function sc_signup_userclass_subscribe()
{
- $text .= "".LAN_SIGNUP_25."
- ".LAN_SIGNUP_34."
";
+ global $pref, $e_userclass, $USERCLASS_SUBSCRIBE_START, $USERCLASS_SUBSCRIBE_END, $signupData;
+ $ret = "";
+ if($pref['signup_option_class'])
+ {
+ if (!is_object($e_userclass))
+ {
+ require_once(e_HANDLER.'userclass_class.php');
+ $e_userclass = new user_class;
+ }
+ $ucList = $e_userclass->get_editable_classes(); // List of classes which this user can edit
+ $ret = '';
+ if(!$ucList) return;
+
+/*
+ function show_signup_class($treename, $classnum, $current_value, $nest_level)
+ {
+ global $USERCLASS_SUBSCRIBE_ROW, $e_userclass, $tp;
+ $tmp = explode(',',$current_value);
+ $search = array('{USERCLASS_ID}', '{USERCLASS_NAME}', '{USERCLASS_DESCRIPTION}', '{USERCLASS_INDENT}', '{USERCLASS_CHECKED}');
+ $replace = array($classnum, $tp->toHTML($e_userclass->uc_get_classname($classnum), FALSE, 'defs'),
+ $tp->toHTML($e_userclass->uc_get_classdescription($classnum), FALSE, 'defs'), " style='text-indent:".(1.2*$nest_level)."em'",
+ ( in_array($classnum, $tmp) ? " checked='checked'" : ''));
+ return str_replace($search, $replace, $USERCLASS_SUBSCRIBE_ROW);
+ }*/
+
+ $ret = $USERCLASS_SUBSCRIBE_START;
+ $ret .= $e_userclass->vetted_tree('class',array($this,show_signup_class),varset($signupData['user_class'],''),'editable');
+ $ret .= $USERCLASS_SUBSCRIBE_END;
+ return $ret;
+ }
}
- if (false && $pref['photo_upload'] && FILE_UPLOADS)
+ function show_signup_class($treename, $classnum, $current_value, $nest_level)
{
- $text .= "".LAN_SIGNUP_26."
- ".LAN_SIGNUP_34."
";
- }
- return $text;
+ global $USERCLASS_SUBSCRIBE_ROW, $e_userclass, $tp;
+ $tmp = explode(',',$current_value);
+ $search = array('{USERCLASS_ID}', '{USERCLASS_NAME}', '{USERCLASS_DESCRIPTION}', '{USERCLASS_INDENT}', '{USERCLASS_CHECKED}');
+ $replace = array($classnum, $tp->toHTML($e_userclass->uc_get_classname($classnum), FALSE, 'defs'),
+ $tp->toHTML($e_userclass->uc_get_classdescription($classnum), FALSE, 'defs'), " style='text-indent:".(1.2*$nest_level)."em'",
+ ( in_array($classnum, $tmp) ? " checked='checked'" : ''));
+ return str_replace($search, $replace, $USERCLASS_SUBSCRIBE_ROW);
+ }
+
+
+
+ function sc_signup_extended_user_fields()
+ {
+ global $usere, $tp, $SIGNUP_EXTENDED_USER_FIELDS, $EXTENDED_USER_FIELD_REQUIRED, $SIGNUP_EXTENDED_CAT;
+ $text = "";
+
+ $search = array(
+ '{EXTENDED_USER_FIELD_TEXT}',
+ '{EXTENDED_USER_FIELD_REQUIRED}',
+ '{EXTENDED_USER_FIELD_EDIT}'
+ );
+
+
+ // What we need is a list of fields, ordered first by parent, and then by display order?
+ // category entries are `user_extended_struct_type` = 0
+ // 'unallocated' entries are `user_extended_struct_parent` = 0
+
+ // Get a list of defined categories
+ $catList = $usere->user_extended_get_categories(FALSE);
+ // Add in category zero - the 'no category' category
+ array_unshift($catList,array('user_extended_struct_parent' => 0, 'user_extended_struct_id' => '0'));
+
+
+
+ foreach($catList as $cat)
+ {
+ $extList = $usere->user_extended_get_fieldList($cat['user_extended_struct_id']);
+
+ $done_heading = FALSE;
+
+ foreach($extList as $ext)
+ {
+ if($ext['user_extended_struct_required'] == 1 || $ext['user_extended_struct_required'] == 2)
+ {
+ if(!$done_heading && ($cat['user_extended_struct_id'] > 0))
+ { // Add in a heading
+ $catName = $cat['user_extended_struct_text'] ? $cat['user_extended_struct_text'] : $cat['user_extended_struct_name'];
+ if(defined($catName)) $catName = constant($catName);
+ $text .= str_replace('{EXTENDED_CAT_TEXT}', $tp->toHTML($catName, FALSE, 'emotes_off,defs'), $SIGNUP_EXTENDED_CAT);
+ $done_heading = TRUE;
+ }
+ $replace = array(
+ $tp->toHTML(deftrue($ext['user_extended_struct_text'], $ext['user_extended_struct_text']), FALSE, 'emotes_off,defs'),
+ ($ext['user_extended_struct_required'] == 1 ? $EXTENDED_USER_FIELD_REQUIRED : ''),
+ $usere->user_extended_edit($ext, $_POST['ue']['user_'.$ext['user_extended_struct_name']])
+ );
+ $text .= str_replace($search, $replace, $SIGNUP_EXTENDED_USER_FIELDS);
+ }
+ }
+ }
+ return $text;
+ }
+
+
+ function sc_signup_signature()
+ {
+ global $pref, $SIGNUP_SIGNATURE_START, $SIGNUP_SIGNATURE_END;
+ if($pref['signup_option_signature'])
+ {
+ require_once(e_HANDLER."ren_help.php");
+ $SIGNUP_SIGNATURE_START = str_replace("{REN_HELP}", display_help('helpb', 2), $SIGNUP_SIGNATURE_START);
+ $SIGNUP_SIGNATURE_END = str_replace("{REN_HELP}", display_help('helpb', 2), $SIGNUP_SIGNATURE_END);
+ $sig = ($_POST['signature'] ? $_POST['signature'] : $signature);
+ return $SIGNUP_SIGNATURE_START.$sig.$SIGNUP_SIGNATURE_END;
+ }
+ }
+
+
+ function sc_signup_images()
+ {
+ global $pref;
+ if($pref['signup_option_image'])
+ {
+
+ $text = "
+
+
+
+ ";
+ $avatarlist[0] = "";
+ $handle = opendir(e_IMAGE."avatars/");
+ while ($file = readdir($handle))
+ {
+ if ($file != "." && $file != ".." && $file != "CVS" && $file != "index.html")
+ {
+ $avatarlist[] = $file;
+ }
+ }
+ closedir($handle);
+
+ for($c = 1; $c <= (count($avatarlist)-1); $c++)
+ {
+ $text .= "
";
+ }
+
+ $text .= "
+
";
+
+ // Intentionally disable uploadable avatar and photos at this stage
+ if (false && $pref['avatar_upload'] && FILE_UPLOADS)
+ {
+ $text .= "".LAN_SIGNUP_25."
+ ".LAN_SIGNUP_34."
";
+ }
+
+ if (false && $pref['photo_upload'] && FILE_UPLOADS)
+ {
+ $text .= "".LAN_SIGNUP_26."
+ ".LAN_SIGNUP_34."
";
+ }
+ return $text;
+ }
+ }
+
+
+ function sc_signup_imagecode()
+ {
+ global $signup_imagecode, $rs, $sec_img;
+ if($signup_imagecode)
+ {
+ return $rs->form_hidden("rand_num", $sec_img->random_number). $sec_img->r_image()." ".$rs->form_text("code_verify", 20, "", 20);
+ }
+ }
+
+
+ function sc_signup_form_close()
+ {
+ return "";
+ }
+
+
+ function sc_signup_is_mandatory($parm='')
+ {
+ global $pref;
+ if (isset($parm))
+ {
+ switch ($parm)
+ {
+ case 'email' : if (varset($pref['disable_emailcheck'],FALSE)) return '';
+ }
+ }
+ return " *";
+ }
+
}
-SC_END
-
-
-SC_BEGIN SIGNUP_IMAGECODE
-global $signup_imagecode, $rs, $sec_img;
-if($signup_imagecode)
-{
- return $rs->form_hidden("rand_num", $sec_img->random_number). $sec_img->r_image()." ".$rs->form_text("code_verify", 20, "", 20);
-}
-SC_END
-
-SC_BEGIN SIGNUP_FORM_CLOSE
-return "";
-SC_END
-
-
-SC_BEGIN SIGNUP_IS_MANDATORY
-global $pref;
-if (isset($parm))
-{
- switch ($parm)
- {
- case 'email' : if (varset($pref['disable_emailcheck'],FALSE)) return '';
- }
-}
-return " *";
-SC_END
-
-*/
?>
\ No newline at end of file
diff --git a/e107_files/downloadimages/index.html b/e107_files/downloadimages/index.html
deleted file mode 100644
index e69de29bb..000000000
diff --git a/e107_files/downloads/index.html b/e107_files/downloads/index.html
deleted file mode 100644
index e69de29bb..000000000
diff --git a/e107_files/downloadthumbs/index.html b/e107_files/downloadthumbs/index.html
deleted file mode 100644
index e69de29bb..000000000
diff --git a/e107_files/e_url/core/core/main.php b/e107_files/e_url/core/core/main.php
deleted file mode 100644
index 310a2c86e..000000000
--- a/e107_files/e_url/core/core/main.php
+++ /dev/null
@@ -1,19 +0,0 @@
-
\ No newline at end of file
diff --git a/e107_files/e_url/core/news/apache_mod_rewrite/main.php b/e107_files/e_url/core/news/apache_mod_rewrite/main.php
deleted file mode 100644
index 850a9959d..000000000
--- a/e107_files/e_url/core/news/apache_mod_rewrite/main.php
+++ /dev/null
@@ -1,135 +0,0 @@
- 'Go to News front page'); //TODO - LANs
- session_write_close();
- header('HTTP/1.1 404 Not Found', true);
- header('Location: '.SITEURL.'error.php?404');
- exit;
- }
-
- $parsed = array();
- switch($sefdata['news_rewrite_type'])
- {
- case '2': //Category list
- $parsed = array('list', $sefdata['news_rewrite_source']);
- break;
-
- case '1': //Item view
- $parsed = array('extend', $sefdata['news_rewrite_source']);
- break;
- }
-
- if(count($chinks) > 1)
- {
-
- $parsed = array_merge($parsed, array_slice($chunks, 1));
- }
-
- $_parsed_request[$request_str] = $parsed;
- return $_parsed_request[$request_str];
-}
-
diff --git a/e107_files/e_url/core/news/apache_mod_rewrite/profile.xml b/e107_files/e_url/core/news/apache_mod_rewrite/profile.xml
deleted file mode 100644
index 47a65fc4b..000000000
--- a/e107_files/e_url/core/news/apache_mod_rewrite/profile.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- {LAN_EURL_MODREWR_TITLE}
- {LAN_EURL_MODREWR_DESCR}
-
-
diff --git a/e107_files/e_url/core/news/main.php b/e107_files/e_url/core/news/main.php
deleted file mode 100644
index 23ec68bd0..000000000
--- a/e107_files/e_url/core/news/main.php
+++ /dev/null
@@ -1,59 +0,0 @@
-
\ No newline at end of file
diff --git a/e107_handlers/db_debug_class.php b/e107_handlers/db_debug_class.php
index b4c749a16..34953df11 100644
--- a/e107_handlers/db_debug_class.php
+++ b/e107_handlers/db_debug_class.php
@@ -488,7 +488,12 @@ class e107_db_debug {
$text .= "\$_SERVER['DOCUMENT_ROOT']: '".$_SERVER['DOCUMENT_ROOT']."' ";
$text .= "\$_SERVER['HTTP_HOST']: '".$_SERVER['HTTP_HOST']."' ";
$text .= "Active Theme Layout: '".THEME_LAYOUT."' ";
-
+ $text .= " ";
+ $text .= "e_LANGUAGE: '".e_LANGUAGE."' ";
+ $text .= "e_LAN: '".e_LAN."' ";
+ $text .= "e_LOCALE: '".e_LOCALE."' ";
+ $text .= "SQL Language: '".$sql->mySQLlanguage."' ";
+ $text .= " ";
$text .= "";
$text .= htmlspecialchars(print_r($e107,TRUE));
diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php
index 8a2acd608..780be1a7c 100644
--- a/e107_handlers/theme_handler.php
+++ b/e107_handlers/theme_handler.php
@@ -689,7 +689,7 @@ class themeHandler
//FIXME e-hideme doesn't work when JS is turned off.
// This popup information should be loaded with ajax.
- // $text .= "\n".$this->renderThemeInfo($theme)."
\n";
+ $text .= "\n".$this->renderThemeInfo($theme)."
\n";
$text .= "";
return $text;
diff --git a/e107_plugins/content/admin_content_config.php b/e107_plugins/content/admin_content_config.php
deleted file mode 100644
index 6fc68f7c5..000000000
--- a/e107_plugins/content/admin_content_config.php
+++ /dev/null
@@ -1,565 +0,0 @@
- db_Select($plugintable, "content_id,content_heading,content_parent", "content_id = '$del_id' ");
- list($content_id, $content_heading, $content_parent) = $sql -> db_Fetch();
-
- $checkarray = $aa -> getCategoryTree("", $content_id, TRUE);
- unset($agc); //unset the globalised getCategoryTree array
- $checkvalidparent = implode(",", array_keys($checkarray));
- $checkqry = " content_parent REGEXP '".$aa -> CONTENTREGEXP($checkvalidparent)."' ";
-
- //check if subcats present
- if(count($array) > 1){
- //subcategories found don't delete
- $checkermsg .= CONTENT_ADMIN_CAT_LAN_36." ";
- $checksubcat = TRUE;
- }else{
- $checkermsg .= CONTENT_ADMIN_CAT_LAN_39." ";
- $checksubcat = FALSE;
- }
-
- //check if items present
- if($sql -> db_Count($plugintable, "(*)", "WHERE ".$checkqry." ")){
- //items found, don't delete
- $checkermsg .= CONTENT_ADMIN_CAT_LAN_37." ";
- $checkitems = TRUE;
- }else{
- $checkermsg .= CONTENT_ADMIN_CAT_LAN_38." ";
- $checkitems = FALSE;
- }
-
- if($checksubcat == FALSE && $checkitems == FALSE){
- if($sql -> db_Delete($plugintable, "content_id='$del_id' ")){
- @unlink(e_PLUGIN."content/menus/content_".$content_heading."_menu.php");
- $message = CONTENT_ADMIN_CAT_LAN_23." ";
- }
- }else{
- $message = $checkermsg;
- }
-}
-
-//delete content item
-if(isset($delete) && $delete == 'content'){
- if($sql -> db_Delete($plugintable, "content_id='$del_id' ")){
- $message = CONTENT_ADMIN_ITEM_LAN_3;
- global $e_event;
- $data = array('method'=>'delete', 'table'=>$plugintable, 'id'=>$del_id, 'plugin'=>'content', 'function'=>'delete_content');
- $message .= $e_event->triggerHook($data);
- $e107cache->clear($plugintable);
- }
-}
-
-//delete submitted item
-if(isset($delete) && $delete == 'submitted'){
- if($sql -> db_Delete($plugintable, "content_id='$del_id' ")){
- $e107cache->clear($plugintable);
- $message = CONTENT_ADMIN_SUBMIT_LAN_8;
- }
-}
-
-//update options
-if(isset($_POST['updateoptions'])){
- $content_pref = $aa -> UpdateContentPref($_POST['options_type']);
- $message = CONTENT_ADMIN_CAT_LAN_22." ";
- if($_POST['options_type'] != "0"){
- $message .= $aa -> CreateParentMenu($_POST['options_type']);
- }
- $e107cache->clear($plugintable);
-}
-
-//update the inheritance of options
-if(isset($_POST['updateinherit'])){
- foreach($_POST['id'] as $k=>$v){
- //get current
- $sql -> db_Select($plugintable, "content_pref", "content_id='".intval($k)."' ");
- $row = $sql -> db_Fetch();
- $content_pref = $eArrayStorage->ReadArray($row['content_pref']);
- //assign or remove inherit option
- if(isset($_POST['content_inherit']) && isset($_POST['content_inherit'][$k]) ){
- $content_pref['content_inherit'] = "1";
- }else{
- unset($content_pref['content_inherit']);
- }
- //update
- $tmp = $eArrayStorage->WriteArray($content_pref);
- $sql2 -> db_Update($plugintable, "content_pref='{$tmp}' WHERE content_id='".intval($k)."' ");
- }
- $message = CONTENT_ADMIN_CAT_LAN_22." ";
- $e107cache->clear($plugintable);
-}
-
-//update the inheritance of options
-if(isset($_POST['updatemanagerinherit'])){
- foreach($_POST['id'] as $k=>$v){
- //get current
- $sql -> db_Select($plugintable, "content_pref", "content_id='".intval($k)."' ");
- $row = $sql -> db_Fetch();
- $content_pref = $eArrayStorage->ReadArray($row['content_pref']);
- //assign or remove inherit option
- if(isset($_POST['content_manager_inherit']) && isset($_POST['content_manager_inherit'][$k]) ){
- $content_pref['content_manager_inherit'] = "1";
- }else{
- unset($content_pref['content_manager_inherit']);
- }
- //update
- $tmp = $eArrayStorage->WriteArray($content_pref);
- $sql2 -> db_Update($plugintable, "content_pref='{$tmp}' WHERE content_id='".intval($k)."' ");
- }
- $message = CONTENT_ADMIN_MANAGER_LAN_8." ";
- $e107cache->clear($plugintable);
-}
-
-//update manager classes into preferences
-if(isset($_POST['update_manager'])){
- $content_pref = $aa -> UpdateContentPref($_POST['options_type']);
- $message = CONTENT_ADMIN_CAT_LAN_22." ";
- $e107cache->clear($plugintable);
-}
-
-//pre-upload a new category icon in the create/edit category form
-if(isset($_POST['uploadcaticon'])){
-
- $pref['upload_storagetype'] = "1";
- require_once(e_HANDLER."upload_handler.php");
- $pathiconlarge = $_POST['iconpathlarge'];
- $pathiconsmall = $_POST['iconpathsmall'];
- $uploaded = file_upload($pathiconlarge);
-
- $icon = "";
- if($uploaded) {
- $icon = $uploaded[0]['name'];
- require_once(e_HANDLER."resize_handler.php");
- resize_image($pathiconlarge.$icon, $pathiconlarge.$icon, '48', "nocopy");
- resize_image($pathiconlarge.$icon, $pathiconsmall.$icon, '16', "copy");
- rename($pathiconsmall."thumb_".$icon , $pathiconsmall.$icon);
- }
- $message = ($icon ? CONTENT_ADMIN_CAT_LAN_58 : CONTENT_ADMIN_CAT_LAN_59);
-}
-
-if(isset($_POST['create_category'])){
- if($_POST['cat_heading'] && $_POST['parent1'] != "none"){
- $adb -> dbCategory("create");
- }else{
- $message = CONTENT_ADMIN_ITEM_LAN_0;
- }
-}
-
-if(isset($_POST['update_category'])){
- if($_POST['cat_heading'] && $_POST['parent1'] != "none"){
- $adb -> dbCategory("update");
- }else{
- $message = CONTENT_ADMIN_ITEM_LAN_0;
- }
-}
-
-if(isset($_POST['create_content'])){
- if($_POST['content_text'] && $_POST['content_heading'] && $_POST['content_author_name'] && $_POST['parent1'] != "none"){
- $adb -> dbContent("create", "");
- }else{
- $message = CONTENT_ADMIN_ITEM_LAN_0;
- }
-}
-
-if(isset($_POST['update_content'])){
- if($_POST['content_text'] && $_POST['content_heading'] && $_POST['content_author_name'] && $_POST['content_heading'] && $_POST['parent1'] != "none"){
- $adb -> dbContent("update", "");
- }else{
- $message = CONTENT_ADMIN_ITEM_LAN_0;
- }
-}
-
-if(isset($_POST['update_order'])){
- if(isset($qs[1])){
- if(isset($qs[2])){
- $message = $adb -> dbSetOrder("all", "ci", $_POST['order']);
- }else{
- $message = $adb -> dbSetOrder("all", "ai", $_POST['order']);
- }
- }else{
- $message = $adb -> dbSetOrder("all", "cc", $_POST['order']);
- }
-}
-
-if(isset($message)){
- $ns -> tablerender("", "".$message."
");
-}
-
-// ##### End --------------------------------------------------------------------------------------
-
-if(!e_QUERY){
- //show main categories
- $aform -> show_manage_content("", "", "");
- require_once(e_ADMIN."footer.php");
- exit;
-}else{
- $qs = explode(".", e_QUERY);
-
- //manage content items
- if($qs[0] == "content" && is_numeric($qs[1]) ){
- $aform -> show_manage_content("", "", "");
-
- //edit content item
- }elseif($qs[0] == "content" && $qs[1] == "edit" && is_numeric($qs[2]) ){
- $newqs = array_reverse($qs);
- //item; update redirect
- if($newqs[0] == "cu"){
- $mainparent = $aa -> getMainParent($qs[2]);
- $message = CONTENT_ADMIN_ITEM_LAN_2." ";
- $message .= CONTENT_ADMIN_ITEM_LAN_88." ".CONTENT_ADMIN_ITEM_LAN_90." ";
- $message .= CONTENT_ADMIN_ITEM_LAN_89." ".CONTENT_ADMIN_ITEM_LAN_90." ";
- $message .= CONTENT_ADMIN_ITEM_LAN_91." ".CONTENT_ADMIN_ITEM_LAN_90." ";
- $message .= CONTENT_ADMIN_ITEM_LAN_124." ".CONTENT_ADMIN_ITEM_LAN_90." ";
-
- $ns -> tablerender("", "".$message."
");
- require_once(e_ADMIN."footer.php");
- exit;
- }
- $aform -> show_create_content("admin", $userid="", $username="");
-
- //post submitted content item
- }elseif($qs[0] == "content" && $qs[1] == "sa" && is_numeric($qs[2]) ){
- $newqs = array_reverse($qs);
- //item; submit post / update redirect
- if($newqs[0] == "cu"){
- $mainparent = $aa -> getMainParent($qs[2]);
- $message = CONTENT_ADMIN_ITEM_LAN_117." ";
- $message .= CONTENT_ADMIN_ITEM_LAN_88." ".CONTENT_ADMIN_ITEM_LAN_90." ";
- $message .= CONTENT_ADMIN_ITEM_LAN_89." ".CONTENT_ADMIN_ITEM_LAN_90." ";
- $message .= CONTENT_ADMIN_ITEM_LAN_91." ".CONTENT_ADMIN_ITEM_LAN_90." ";
- $message .= CONTENT_ADMIN_ITEM_LAN_124." ".CONTENT_ADMIN_ITEM_LAN_90." ";
- $ns -> tablerender("", "".$message."
");
- require_once(e_ADMIN."footer.php");
- exit;
- }
- $aform -> show_create_content("sa", $userid="", $username="");
-
- //create content item
- }elseif($qs[0] == "content" && $qs[1] == "create" ){
- $newqs = array_reverse($qs);
- //item; create redirect
- if($newqs[0] == "cc"){
- $mainparent = $aa -> getMainParent($qs[2]);
- $message = CONTENT_ADMIN_ITEM_LAN_1." ";
- $message .= CONTENT_ADMIN_ITEM_LAN_88." ".CONTENT_ADMIN_ITEM_LAN_90." ";
- $message .= CONTENT_ADMIN_ITEM_LAN_89." ".CONTENT_ADMIN_ITEM_LAN_90." ";
- $ns -> tablerender("", "".$message."
");
- require_once(e_ADMIN."footer.php");
- exit;
- }
- $aform -> show_create_content("admin", $userid="", $username="");
-
- //order : view categories
- }elseif($qs[0] == "order" && !isset($qs[1])){
- $aform -> show_order();
-
- //order global items of parent='2'
- }elseif($qs[0] == "order" && is_numeric($qs[1]) && !isset($qs[2]) ){
- $aform -> show_content_order("ai");
-
- //increase order of global items
- }elseif($qs[0] == "order" && is_numeric($qs[1]) && $qs[2] == "inc" && isset($qs[3]) ){
- $message = $adb -> dbSetOrder("inc", "ai", $qs[3]);
- $ns -> tablerender("", "".$message."
");
- $aform -> show_content_order("ai");
-
- //decrease order of global items
- }elseif($qs[0] == "order" && is_numeric($qs[1]) && $qs[2] == "dec" && isset($qs[3]) ){
- $message = $adb -> dbSetOrder("dec", "ai", $qs[3]);
- $ns -> tablerender("", "".$message."
");
- $aform -> show_content_order("ai");
-
- //order items with parent=2 or category='5'
- }elseif($qs[0] == "order" && is_numeric($qs[1]) && is_numeric($qs[2]) && !isset($qs[3]) ){
- $aform -> show_content_order("ci");
-
- //increase order of items in category
- }elseif($qs[0] == "order" && is_numeric($qs[1]) && is_numeric($qs[2]) && $qs[3] == "inc" && isset($qs[4]) ){
- $message = $adb -> dbSetOrder("inc", "ci", $qs[4]);
- $ns -> tablerender("", "".$message."
");
- $aform -> show_content_order("ci");
-
- //decrease order of items in category
- }elseif($qs[0] == "order" && is_numeric($qs[1]) && is_numeric($qs[2]) && $qs[3] == "dec" && isset($qs[4]) ){
- $message = $adb -> dbSetOrder("dec", "ci", $qs[4]);
- $ns -> tablerender("", "".$message."
");
- $aform -> show_content_order("ci");
-
- //increase category order
- }elseif($qs[0] == "order" && $qs[1] == "inc" && isset($qs[2]) ){
- $message = $adb -> dbSetOrder("inc", "cc", $qs[2]);
- $ns -> tablerender("", "".$message."
");
- $aform -> show_order("admin");
-
- //decrease category order
- }elseif($qs[0] == "order" && $qs[1] == "dec" && isset($qs[2]) ){
- $message = $adb -> dbSetOrder("dec", "cc", $qs[2]);
- $ns -> tablerender("", "".$message."
");
- $aform -> show_order("admin");
-
- //show submitted content items
- }elseif($qs[0] == "submitted" && !isset($qs[1]) ){
- $aform -> show_submitted();
-
- //options intro page
- }elseif($qs[0] == "option" && !isset($qs[1]) ){
- $aform -> show_options();
-
- //options for this top level category
- }elseif($qs[0] == "option" && isset($qs[1]) && (is_numeric($qs[1]) || $qs[1] == "default") ){
- $aform -> show_options_cat();
-
- //category content manager : choose category
- }elseif($qs[0] == "manager" && !isset($qs[1]) ){
- if(!getperms("0")){ header("location:".e_SELF); exit; }
- $aform -> manager();
-
- //category content manager : view contentmanager
- }elseif($qs[0] == "manager" && isset($qs[1]) && (is_numeric($qs[1]) || $qs[1]=='default') ){
- if(!getperms("0")){ header("location:".e_SELF); exit; }
- $aform -> manager_category();
-
- //overview all categories
- }elseif($qs[0] == "cat" && !isset($qs[1]) ){
- $aform -> manage_cat();
-
- //create category
- }elseif($qs[0] == "cat" && $qs[1] == "create" ){
- $newqs = array_reverse($qs);
- //category; create redirect
- if($newqs[0] == "pc"){
- $message = CONTENT_ADMIN_CAT_LAN_11." ";
- $message .= " ".CONTENT_ADMIN_CAT_LAN_50." ";
- $message .= "
- ".CONTENT_ADMIN_CAT_LAN_44." ".CONTENT_ADMIN_CAT_LAN_43."
- ".CONTENT_ADMIN_CAT_LAN_42." ".CONTENT_ADMIN_CAT_LAN_43." ";
- $ns -> tablerender("", "".$message."
");
- require_once(e_ADMIN."footer.php");
- exit;
- }
- $aform -> show_create_category();
-
- //edit category
- }elseif($qs[0] == "cat" && $qs[1] == "edit" && is_numeric($qs[2]) ){
- $newqs = array_reverse($qs);
- //category; update redirect
- if($newqs[0] == "pu"){
- $message = CONTENT_ADMIN_CAT_LAN_12."
- ".CONTENT_ADMIN_CAT_LAN_42." ".CONTENT_ADMIN_CAT_LAN_43."
- ".CONTENT_ADMIN_CAT_LAN_53." ".CONTENT_ADMIN_CAT_LAN_43." ";
- $ns -> tablerender("", "".$message."
");
- require_once(e_ADMIN."footer.php");
- exit;
- }
- $aform -> show_create_category();
- }
-}
-// ##### End --------------------------------------------------------------------------------------
-
-
-// ##### Display options --------------------------------------------------------------------------
-function admin_content_config_adminmenu(){
-
- global $sql, $plugintable, $aa;
-
- //toggle to show categories in admin right hand menu; default to false
- $showadmincat = FALSE;
-
- if(e_QUERY){
- $qs = explode(".", e_QUERY);
- }
-
- if(isset($qs[0]) && $qs[0] == "cat" && isset($qs[1]) && $qs[1] == "create"){
- $act = $qs[0].".".$qs[1];
-
- }elseif(isset($qs[0]) && $qs[0] == "content" && isset($qs[1]) && $qs[1] == "create"){
- $act = $qs[0].".".$qs[1];
-
- }else{
- $act = (isset($qs[0]) ? $qs[0] : "");
- }
-
- if($act==""){$act="content";}
-
- $var['content']['text'] = CONTENT_ADMIN_MENU_LAN_0;
- $var['content']['link'] = e_SELF;
-
- $var['content.create']['text'] = CONTENT_ADMIN_MENU_LAN_1;
- $var['content.create']['link'] = e_SELF."?content.create";
-
- $var['cat']['text'] = CONTENT_ADMIN_MENU_LAN_2;
- $var['cat']['link'] = e_SELF."?cat";
-
- $var['cat.create']['text'] = CONTENT_ADMIN_MENU_LAN_3;
- $var['cat.create']['link'] = e_SELF."?cat.create";
-
- $var['order']['text'] = CONTENT_ADMIN_MENU_LAN_15;
- $var['order']['link'] = e_SELF."?order";
-
- $var['option']['text'] = CONTENT_ADMIN_MENU_LAN_6;
- $var['option']['link'] = e_SELF."?option";
-
- if(getperms("0")){
- $var['manager']['text'] = CONTENT_ADMIN_MENU_LAN_17;
- $var['manager']['link'] = e_SELF."?manager";
- }
-
- if($submittedcontents = $sql -> db_Count($plugintable, "(*)", "WHERE content_refer ='sa' ")){
- $var['submitted']['text'] = CONTENT_ADMIN_MENU_LAN_4." (".$submittedcontents.")";
- $var['submitted']['link'] = e_SELF."?submitted";
- }
-
- show_admin_menu(CONTENT_ADMIN_MENU_LAN_6, $act,$var);
-
- if(isset($qs[0]) && $qs[0] == "option" && isset($qs[1])){
- unset($var);
- $var=array();
- $var['creation']['text'] = CONTENT_ADMIN_MENU_LAN_7;
- $var['general']['text'] = CONTENT_ADMIN_MENU_LAN_10;
- $var['menu']['text'] = CONTENT_ADMIN_MENU_LAN_14;
-
- if (!is_object($sql)){ $sql = new db; }
- $category_total = $sql -> db_Select($plugintable, "content_heading", "content_id='".$qs[1]."' ");
- list($content_heading) = $sql -> db_Fetch();
-
- show_admin_menu(CONTENT_ADMIN_MENU_LAN_6.": ".$content_heading."", $act, $var, TRUE);
-
- unset($var);
- $var=array();
- $var['recentpages']['text'] = CONTENT_ADMIN_MENU_LAN_11;
- $var['catpages']['text'] = CONTENT_ADMIN_MENU_LAN_12;
- $var['contentpages']['text'] = CONTENT_ADMIN_MENU_LAN_13;
- $var['authorpage']['text'] = CONTENT_ADMIN_MENU_LAN_18;
- $var['archivepage']['text'] = CONTENT_ADMIN_MENU_LAN_16;
- $var['toppage']['text'] = CONTENT_ADMIN_MENU_LAN_20;
- $var['scorepage']['text'] = CONTENT_ADMIN_MENU_LAN_22;
- show_admin_menu(CONTENT_ADMIN_MENU_LAN_21.": ".$content_heading."", $act, $var, TRUE);
-
- }else{
-
- if($showadmincat){
- if (!is_object($sql2)){ $sql2 = new db; }
- if($category_total = $sql2 -> db_Select($plugintable, "content_id, content_heading", "content_parent='0' ")){
- while($row = $sql2 -> db_Fetch()){
-
- unset($var);
- $var=array();
-
- //get all categories from each main parent
- $array = $aa -> getCategoryTree("", $row['content_id'], FALSE);
- $newarray = array_merge_recursive($array);
-
- $newparent=array();
- for($a=0;$a $value){
- $var['c'.$key]['text'] = $value;
- $var['c'.$key]['link'] = e_SELF."?content.".$key;
- }
- if( isset($qs[0]) && $qs[0] == "content" && isset($qs[1]) && $qs[1] == "create"){
- $act = "";
- }elseif( isset($qs[0]) && $qs[0] == "cat" && isset($qs[1]) && ($qs[1] == "create" || $qs[1] == "edit") ){
- $act = "";
- }elseif( isset($qs[0]) && $qs[0] == "order" ){
- $act = "";
- }elseif( isset($qs[0]) && $qs[0] == "manager" ){
- $act = "";
- }else{
- if(isset($qs[0]) && isset($qs[1]) ){
- $act = "c".$qs[1];
- }else{
- $act = "c";
- }
- }
- show_admin_menu(CONTENT_ADMIN_MENU_LAN_5." : ".$row['content_heading']."", $act, $var);
- }
- }
- }
- }
-}
-// ##### End --------------------------------------------------------------------------------------
-
-require_once(e_ADMIN."footer.php");
-
-function headerjs()
-{
- global $cal;
- return $cal->load_files();
-}
-
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/content.php b/e107_plugins/content/content.php
deleted file mode 100644
index 2fb1200d9..000000000
--- a/e107_plugins/content/content.php
+++ /dev/null
@@ -1,1393 +0,0 @@
-isInstalled('content'))
-{
- header('Location: '.e_BASE.'index.php');
- exit;
-}
-
-$plugindir = e_PLUGIN."content/";
-require_once($plugindir."content_shortcodes.php");
-require_once(e_HANDLER."emailprint_class.php");
-$ep = new emailprint;
-require_once(e_HANDLER."comment_class.php");
-$cobj = new comment;
-require_once(e_HANDLER."rate_class.php");
-$rater = new rater;
-require_once(e_HANDLER."form_handler.php");
-$rs = new form;
-require_once($plugindir."handlers/content_class.php");
-$aa = new content;
-e107_require_once(e_HANDLER.'arraystorage_class.php');
-$eArrayStorage = new ArrayData();
-include_lan(e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content.php");
-
-if(e_QUERY){
- $qs = explode(".", e_QUERY);
-
- if(is_numeric($qs[0])){
- $from = array_shift($qs);
- }else{
- $from = "0";
- }
-}
-
-$aa -> setPageTitle();
-
-require_once(HEADERF);
-
-//post comment
-if(isset($_POST['commentsubmit'])){
- if(!is_object($sql)){ $sql = new db; }
- if(!$sql -> db_Select($plugintable, "content_comment", "content_id='".intval($qs[1])."' ")){
- header("location:".e_BASE."index.php"); exit;
- }else{
- $row = $sql -> db_Fetch();
- if(ANON === TRUE || USER === TRUE){
- //enter_comment($author_name, $comment, $table, $id, $pid, $subject)
- $author = ($_POST['author_name'] ? $_POST['author_name'] : USERNAME);
- $pid = "0";
- $rated = (isset($_POST['rateindex']) ? $_POST['rateindex'] : "");
- $cobj -> enter_comment($author, $_POST['comment'], $plugintable, $qs[1], $pid, $_POST['subject'], $rated);
- if($qs[0] == "content" && is_numeric($qs[1])){
- if(!isset($qs[2])){ $cacheid = 1; }else{ $cacheid = $qs[2]; }
- $e107cache->clear("comment.$plugintable.$qs[1].$cacheid");
- $e107cache->clear("$plugintable.content.$qs[1].$cacheid");
- }
- if($qs[0] == "cat" && is_numeric($qs[1])){
- $e107cache->clear("comment.$plugintable.$qs[1]");
- }
- $main = $aa -> getMainParent( (is_numeric($qs[1]) ? $qs[1] : $qs[2]) );
- $e107cache->clear("$plugintable.recent.$main");
- $e107cache->clear("$plugintable.cat.list.$main");
- $e107cache->clear("$plugintable.cat.$main");
- $e107cache->clear("$plugintable.author.$main");
- $e107cache->clear("$plugintable.top.$main");
- $e107cache->clear("$plugintable.score.$main");
- }
- }
-}
-
-//check active keyword search
-$resultmenu = FALSE;
-$searchfieldname = "searchfield_page";
-$searchfieldmenuname = "searchfieldmenu_menu";
-if(isset($_POST['searchsubmit']) || isset($_POST[$searchfieldname]) || isset($_POST[$searchfieldmenuname])){ //if active keyword search
- if(isset($_POST[$searchfieldname]) && $_POST[$searchfieldname] != "" && $_POST[$searchfieldname] != CONTENT_LAN_18){
- $resultmenu = TRUE;
- $searchkeyword = $_POST[$searchfieldname];
- }
- if(isset($_POST[$searchfieldmenuname]) && $_POST[$searchfieldmenuname] != "" && $_POST[$searchfieldmenuname] != CONTENT_LAN_18){
- $resultmenu = TRUE;
- $searchkeyword = $_POST[$searchfieldmenuname];
- }
- //show search results
- if($resultmenu == TRUE){ show_content_search_result($searchkeyword); }
-}
-
-// ##### REDIRECTION MANAGEMENT -------------------------------------------------------
-//parent overview
-if(!e_QUERY){
- show_content();
-}else{
- //recent of parent='X'
- if( $qs[0] == "recent" && is_numeric($qs[1]) && intval($qs[1])>0 && ( !isset($qs[2]) || substr($qs[2],0,5) == "order" ) ){
- show_content_recent();
-
- //item
- }elseif( $qs[0] == "content" && is_numeric($qs[1]) && intval($qs[1])>0 ){
- show_content_item();
-
- //all categories of parent='X'
- }elseif( $qs[0] == "cat" && $qs[1] == "list" && is_numeric($qs[2]) && intval($qs[2])>0 && !isset($qs[3]) ){
- show_content_cat_all();
-
- //category of parent='X'
- }elseif( $qs[0] == "cat" && is_numeric($qs[1]) && intval($qs[1])>0 && (!isset($qs[2]) || $qs[2] == "view" || $qs[2] == "comment" || substr($qs[2],0,5) == "order") ){
-
- if( isset($qs[2]) && $qs[2] == "comment" ){
- show_content_cat("comment");
- }elseif( isset($qs[2]) && $qs[2] == "view" ){
- show_content_cat('view');
- }else{
- show_content_cat();
- }
-
- //top rated of parent='X'
- }elseif( $qs[0] == "top" && is_numeric($qs[1]) && intval($qs[1])>0 && !isset($qs[2]) ){
- show_content_top();
-
- //top score of parent='X'
- }elseif( $qs[0] == "score" && is_numeric($qs[1]) && intval($qs[1])>0 ){
- // && !isset($qs[2])
- show_content_score();
-
- //authorlist of parent='X'
- }elseif( $qs[0] == "author" && $qs[1] == "list" && is_numeric($qs[2]) && intval($qs[2])>0 && ( !isset($qs[3]) || substr($qs[3],0,5) == "order" ) ){
- show_content_author_all();
-
- //authorlist of content_id='X'
- }elseif( $qs[0] == "author" && is_numeric($qs[1]) && intval($qs[1])>0 && (!isset($qs[2]) || substr($qs[2],0,5) == "order") ){
- show_content_author();
-
- //archive of parent='X'
- }elseif( $qs[0] == "list" && is_numeric($qs[1]) && intval($qs[1])>0 ){
- show_content_archive();
- }else{
- //js_location(e_SELF);
- header("location:".e_SELF);
- }
-}
-// ##### ------------------------------------------------------------------------------
-
-// ##### CONTENT SEARCH MENU ----------------------------
-function show_content_search_menu($mode, $mainparent){
- global $qs, $plugindir, $content_shortcodes, $tp, $ns, $rs, $aa, $plugintable, $gen, $content_pref, $CONTENT_SEARCH_TABLE_SELECT, $CONTENT_SEARCH_TABLE_ORDER, $CONTENT_SEARCH_TABLE_KEYWORD;
-
- if( varsettrue($content_pref["content_navigator_{$mode}"]) || varsettrue($content_pref["content_search_{$mode}"]) || varsettrue($content_pref["content_ordering_{$mode}"]) ){
-
- $template_vars = array("CONTENT_SEARCH_TABLE");
- foreach($template_vars as $t){ global $$t; }
- $aa -> gettemplate($template_vars, 'content_search_template.php');
-
- if( varsettrue($content_pref["content_navigator_{$mode}"]) ){
- $CONTENT_SEARCH_TABLE_SELECT = $aa -> showOptionsSelect("page", $mainparent);
- }
- if( varsettrue($content_pref["content_search_{$mode}"]) ){
- $CONTENT_SEARCH_TABLE_KEYWORD = $aa -> showOptionsSearch("page", $mainparent);
- }
- if( varsettrue($content_pref["content_ordering_{$mode}"]) ){
- $CONTENT_SEARCH_TABLE_ORDER = $aa -> showOptionsOrder("page", $mainparent);
- }
-
- $text = $tp -> parseTemplate($CONTENT_SEARCH_TABLE, FALSE, $content_shortcodes);
-
- if($content_pref["content_searchmenu_rendertype"] == "2"){
- $caption = CONTENT_LAN_77;
- $ns -> tablerender($caption, $text);
- }else{
- echo $text;
- }
- }
- return TRUE;
-}
-
-function show_content_search_result($searchkeyword){
- 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, 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."' ) ";
-
- $sqlsr = "";
- if(!is_object($sqlsr)){ $sqlsr = new db; }
- if(!$sqlsr -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_text, content_author, content_icon, content_datestamp", " ".$qry." ".$datequery." ORDER BY content_heading")){
- $textsr = "".CONTENT_SEARCH_LAN_0."
";
- }else{
-
- $template_vars = array("CONTENT_SEARCHRESULT_TABLE", "CONTENT_SEARCHRESULT_TABLE_START", "CONTENT_SEARCHRESULT_TABLE_END");
- foreach($template_vars as $t){ global $$t; }
- $aa -> gettemplate($template_vars, 'content_searchresult_template.php');
-
- $string = "";
- if(!is_object($gen)){ $gen = new convert; }
- while($row = $sqlsr -> db_Fetch()){
-
- $row['content_heading'] = parsesearch($row['content_heading'], $searchkeyword, "full");
- $row['content_subheading'] = parsesearch($row['content_subheading'], $searchkeyword, "full");
- $row['content_text'] = parsesearch($row['content_text'], $searchkeyword, "");
-
- $string .= $tp -> parseTemplate($CONTENT_SEARCHRESULT_TABLE, FALSE, $content_shortcodes);
- }
- $textsr = $CONTENT_SEARCHRESULT_TABLE_START.$string.$CONTENT_SEARCHRESULT_TABLE_END;
- }
- $ns -> tablerender(CONTENT_LAN_20, $textsr);
- require_once(FOOTERF);
- exit;
-}
-
-function parsesearch($text, $match, $amount){
- $text = strip_tags($text);
- $temp = stristr($text,$match);
- $pos = strlen($text)-strlen($temp);
-
- if($amount == "full"){
- }else{
- if($pos < 140){
- $text = "...".substr($text, 0, 140)."...";
- }else{
- $text = "...".substr($text, ($pos-140), 280)."...";
- }
- }
- $text = preg_replace("/".$match."/i", "$match ", $text);
- return($text);
-}
-
-// ##### CONTENT CACHE PRE ------------------------------
-function CachePre($cachestring=''){
- global $e107cache;
- if($cache = $e107cache->retrieve($cachestring)){
- return $cache;
- }else{
- ob_start();
- }
-}
-// ##### CONTENT CACHE POST ------------------------------
-function CachePost($cachestring=''){
- global $pref, $e107cache;
- if($pref['cachestatus']){
- $cache = ob_get_contents();
- $e107cache->set($cachestring, $cache);
- }
- ob_end_flush(); // dump collected data
-}
-
-// ##### CONTENT TYPE LIST ------------------------------
-function show_content(){
- 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");
- }else{
- require_once(e_PLUGIN."content/templates/content_type_template.php");
- }
-
- $cachestr = "$plugintable.typelist";
- $cachecheck = CachePre($cachestr);
- if($cachecheck){
- echo $cachecheck;
- return;
- }
- if(!is_object($sql)){ $sql = new db; }
- 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 .= "".CONTENT_LAN_21."
";
- }else{
-
- $sql2 = "";
- $content_type_table_string = "";
- $plist = $sql->db_getList();
- foreach($plist as $row)
- {
- if(!is_object($sql2)){ $sql2 = new db; }
-
- $content_pref = $eArrayStorage->ReadArray($row['content_pref']);
- $content_pref = $aa->parseConstants($content_pref);
-
- $array = $aa -> getCategoryTree("", $row['content_id'], TRUE);
- $validparent = implode(",", array_keys($array));
- $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."'" );
- $content_type_table_string .= $tp -> parseTemplate($CONTENT_TYPE_TABLE, FALSE, $content_shortcodes);
- }
-
- //check if user is allowed on the manager page
- $personalmanagercheck = FALSE;
- //get all categories
- $array = $aa -> getCategoryTree("", "", TRUE);
- $catarray = array_keys($array);
- $qry = "";
- foreach($catarray as $catid){
- $qry .= " content_id='".$catid."' || ";
- }
- $qry = substr($qry,0,-3);
- if($sql -> db_Select($plugintable, "content_id, content_heading, content_pref", " ".$qry." ")){
- while($row = $sql -> db_Fetch()){
- if( varsettrue($row['content_pref'],'') ){
- $content_pref = $eArrayStorage->ReadArray($row['content_pref']);
- }
- //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_value", "e107_name='$plugintable' ");
- $row2 = $sql2 -> db_Fetch();
- $content_pref = $eArrayStorage->ReadArray($row2['e107_value']);
- }
- if( (isset($content_pref["content_manager_submit"]) && check_class($content_pref["content_manager_submit"])) ||
- (isset($content_pref["content_manager_approve"]) && check_class($content_pref["content_manager_approve"])) || (isset($content_pref["content_manager_personal"]) && check_class($content_pref["content_manager_personal"])) || (isset($content_pref["content_manager_category"]) && check_class($content_pref["content_manager_category"])) ){
- $personalmanagercheck = TRUE;
- break;
- }
- }
- }
- if($personalmanagercheck == TRUE){
- $content_type_table_string .= $tp -> parseTemplate($CONTENT_TYPE_TABLE_MANAGER, FALSE, $content_shortcodes);
- }
- $text = $CONTENT_TYPE_TABLE_START.$content_type_table_string.$CONTENT_TYPE_TABLE_END;
- }
- $ns -> tablerender(CONTENT_LAN_22, $text);
- $cachecheck = CachePost($cachestr);
-}
-
-// ##### CONTENT ARCHIVE ------------------------------------------
-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, true);
-
- show_content_search_menu("archive", $mainparent); //show navigator/search/order menu
-
- $template_vars = array("CONTENT_ARCHIVE_TABLE", "CONTENT_ARCHIVE_TABLE_START", "CONTENT_ARCHIVE_TABLE_END");
- foreach($template_vars as $t){ global $$t; }
- $aa -> gettemplate($template_vars, 'content_archive_template.php');
-
- $cachestr = "$plugintable.archive.$qs[1]";
- $cachecheck = CachePre($cachestr);
- if($cachecheck){
- echo $cachecheck;
- return;
- }
- $text = "";
- $array = $aa -> getCategoryTree("", $mainparent, TRUE);
- $validparent = implode(",", array_keys($array));
- $qry = " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
- $number = varsettrue($content_pref["content_archive_nextprev_number"], '30');
- $order = $aa -> getOrder('archive');
- $nextprevquery = (varsettrue($content_pref["content_archive_nextprev"]) ? "LIMIT ".intval($from).",".intval($number) : "");
- $sql1 = new db;
-
- 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);
- $head_sub = ( ord($head) < 128 ? strtoupper(substr($head,0,1)) : substr($head,0,2) );
- $arrletters[] = $head_sub;
- }
- $arrletters = array_values( array_unique($arrletters) );
- sort($arrletters);
-
- if ($distinctfirstletter > 1){
- $CONTENT_ARCHIVE_TABLE_LETTERS = "";
- }
- //check letter
- if(isset($qs[2])){
- 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])."%' ";
- }
- }
- }
-
- $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_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()){
- $text .= $tp -> parseTemplate($CONTENT_ARCHIVE_TABLE, FALSE, $content_shortcodes);
- }
- $text .= $tp -> parseTemplate($CONTENT_ARCHIVE_TABLE_END, FALSE, $content_shortcodes);
- }
- $text = $aa->getCrumbPage("archive", $array, $mainparent).$text;
- $ns->tablerender($content_pref['content_archive_caption'], $text);
- $cachecheck = CachePost($cachestr);
-}
-
-//this function renders the preview of a content_item
-//used in recent list, view author list, category items list
-function displayPreview($qry, $np=false, $array=false){
- global $qs, $array, $row, $gen, $rater, $aa, $sql2, $tp, $plugintable, $plugindir, $content_shortcodes, $content_pref, $mainparent, $CM_AUTHOR, $CONTENT_RECENT_TABLE_INFOPRE, $CONTENT_RECENT_TABLE_INFOPOST, $CONTENT_NEXTPREV;
-
- $template_vars = array("CONTENT_RECENT_TABLE", "CONTENT_RECENT_TABLE_START", "CONTENT_RECENT_TABLE_END");
- foreach($template_vars as $t){ global $$t; }
- $aa -> gettemplate($template_vars, 'content_recent_template.php');
-
- 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;
- }
- $text = $tp -> parseTemplate($CONTENT_RECENT_TABLE_START, FALSE, $content_shortcodes);
- while($row = $sql2 -> db_Fetch()){
- $CM_AUTHOR = $aa -> prepareAuthor("list", $row['content_author'], $row['content_id']);
- $rdate = $tp -> parseTemplate('{CM_DATE|recent}', FALSE, $content_shortcodes);
- $rauth = $tp -> parseTemplate('{CM_AUTHOR|recent}', FALSE, $content_shortcodes);
- $rep = $tp -> parseTemplate('{CM_EPICONS|recent}', FALSE, $content_shortcodes);
- $rpar = $tp -> parseTemplate('{CM_PARENT|recent}', FALSE, $content_shortcodes);
- $redi = $tp -> parseTemplate('{CM_EDITICON|recent}', FALSE, $content_shortcodes);
- $CONTENT_RECENT_TABLE_INFOPRE = FALSE;
- $CONTENT_RECENT_TABLE_INFOPOST = FALSE;
- if ($rdate!="" || $rauth!="" || $rep!="" || $rpar!="" || $redi!="" ) {
- $CONTENT_RECENT_TABLE_INFOPRE = TRUE;
- $CONTENT_RECENT_TABLE_INFOPOST = TRUE;
- }
- $text .= $tp -> parseTemplate($CONTENT_RECENT_TABLE, FALSE, $content_shortcodes);
- }
- $text .= $tp -> parseTemplate($CONTENT_RECENT_TABLE_END, FALSE, $content_shortcodes);
- }
- return $text;
-}
-
-// ##### 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_RECENT_TABLE, $array;
-
- $mainparent = $aa -> getMainParent(intval($qs[1]));
- $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);
- if($cachecheck){
- echo $cachecheck;
- return;
- }
- $crumbarray = $aa -> getCategoryTree("", intval($mainparent), TRUE);
- $array = $aa -> getCategoryTree("", intval($qs[1]), TRUE);
- $validparent = implode(",", array_keys($array));
- $order = $aa -> getOrder();
- $number = varsettrue($content_pref["content_nextprev_number"], '5');
- $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."' " );
-
- if($from > $contenttotal-1){ js_location(e_SELF); }
-
- $recentqry = "content_refer !='sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ".$order." ".$nextprevquery;
- $np = $aa->ShowNextPrev("", $from, $number, $contenttotal,true);
- $text = $aa->getCrumbPage("recent", $crumbarray, $mainparent);
- $text .= displayPreview($recentqry, $np, $array);
-
- $caption = $content_pref['content_list_caption'];
- if( varsettrue($content_pref['content_list_caption_append_name'],'') ){
- $caption .= " ".$array[intval($qs[1])][1];
- }
- $ns -> tablerender($caption, $text);
- $cachecheck = CachePost($cachestr);
-}
-
-//function to (multi)sort by key
-function multi_sort($array, $key)
-{
- $cmp_val="((\$a['$key']>\$b['$key'])?1:((\$a['$key']==\$b['$key'])?0:-1))";
- $cmp=create_function('$a, $b', "return $cmp_val;");
- uasort($array, $cmp);
- return $array;
-}
-
-
-// ##### 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, $sql2, $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, true);
-
- show_content_search_menu("catall", $mainparent); //show navigator/search/order menu
-
- $template_vars = array("CONTENT_CAT_TABLE", "CONTENT_CAT_TABLE_START", "CONTENT_CAT_TABLE_END");
- foreach($template_vars as $t){ global $$t; }
- $aa -> gettemplate($template_vars, 'content_cat_template.php');
-
- $cachestr = "$plugintable.cat.list.$qs[2]";
- $cachecheck = CachePre($cachestr);
- if($cachecheck){
- echo $cachecheck;
- return;
- }
- $array = $aa -> getCategoryTree("", $mainparent, TRUE);
-
- $newarray = array_merge_recursive($array);
- for($a=0;$a db_Select($plugintable, "content_id, content_order", " content_id = '".$mainparent."' ");
- $row = $sql2 -> db_Fetch();
- $mainparent_order = $row['content_order'];
-
- //we parse the order string, dependent of the content_pref
- $order = $aa -> getOrder('catall');
-
- //get all records, and tmp store them in the $data array
- $data=array();
- $sql2 -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_text, content_icon, content_author, content_datestamp, content_parent, content_comment, content_rate, content_order", " content_id IN (".$cids.") ".$order." ");
- while($row = $sql2 -> db_Fetch()){
- if($row['content_id']!=$mainparent){
- $row['content_order'] += $mainparent_order;
- }
- $data[] = $row;
- }
-
- //we need to reorder the records, but only if we need to sort by the content_order value
- //in all other sort/order cases, the above query is already correct
- $orderstring = ($content_pref['content_catall_defaultorder'] ? $content_pref['content_catall_defaultorder'] : "orderaheading" );
- if(substr($orderstring,6) == "order"){
- //sort the array on the order field
- $data = multi_sort($data, "content_order");
- }
-
- //finally we can loop through all records
- $string = "";
- foreach($data as $row){
- $totalitems = $aa -> countCatItems($row['content_id']);
- $date = $tp -> parseTemplate('{CM_DATE|cat}', FALSE, $content_shortcodes);
- $auth = $tp -> parseTemplate('{CM_AUTHOR|cat}', FALSE, $content_shortcodes);
- $ep = $tp -> parseTemplate('{CM_EPICONS|cat}', FALSE, $content_shortcodes);
- $com = $tp -> parseTemplate('{CONTENT_CAT_TABLE_COMMENT}', FALSE, $content_shortcodes);
- $CONTENT_CAT_TABLE_INFO_PRE = FALSE;
- $CONTENT_CAT_TABLE_INFO_POST = FALSE;
- if ($date!="" || $auth!="" || $ep!="" || $com!="" ) {
- $CONTENT_CAT_TABLE_INFO_PRE = TRUE;
- $CONTENT_CAT_TABLE_INFO_POST = TRUE;
- }
- $CM_AUTHOR = $aa -> prepareAuthor("catall", $row['content_author'], $row['content_id']);
- $string .= $tp -> parseTemplate($CONTENT_CAT_TABLE, FALSE, $content_shortcodes);
- }
-
- $text = $aa->getCrumbPage("catall", $array, $mainparent);
- $text .= $tp -> parseTemplate($CONTENT_CAT_TABLE_START, FALSE, $content_shortcodes);
- $text .= $string;
- $text .= $tp -> parseTemplate($CONTENT_CAT_TABLE_END, FALSE, $content_shortcodes);
-
- $ns -> tablerender($content_pref['content_catall_caption'], $text);
- $cachecheck = CachePost($cachestr);
-}
-
-function show_content_cat($mode=""){
- global $qs, $plugindir, $content_shortcodes, $ns, $plugintable, $sql, $sql2, $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, true);
-
- $array = $aa -> getCategoryTree("", $mainparent, TRUE);
- $validparent = "0,0.".implode(",0.", array_keys($array));
- $qry = " content_id = '".intval($qs[1])."' AND content_refer !='sa' AND content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ";
-
- show_content_search_menu("cat", $mainparent); //show navigator/search/order menu
-
- $template_vars = array("CONTENT_CAT_LIST_TABLE", "CONTENT_CAT_LISTSUB_TABLE", "CONTENT_CAT_LISTSUB_TABLE_START", "CONTENT_CAT_LISTSUB_TABLE_END");
- foreach($template_vars as $t){ global $$t; }
- $aa -> gettemplate($template_vars, 'content_cat_template.php');
-
- $order = $aa -> getOrder();
- $number = varsettrue($content_pref["content_nextprev_number"], '5');
- $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'],'') ){
- $caption .= " ".$capqs[0];
- }
-
- // parent article
- 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
- if($mode=='view' || $mode=='comment'){
- $content_pref['content_cat_text_char'] = 'all';
- }
- $row = $sql -> db_Fetch();
- $date = $tp -> parseTemplate('{CM_DATE|catlist}', FALSE, $content_shortcodes);
- $auth = $tp -> parseTemplate('{CM_AUTHOR|catlist}', FALSE, $content_shortcodes);
- $ep = $tp -> parseTemplate('{CM_EPICONS|catlist}', FALSE, $content_shortcodes);
- $com = $tp -> parseTemplate('{CONTENT_CAT_LIST_TABLE_COMMENT}', FALSE, $content_shortcodes);
- if ($date!="" || $auth!="" || $ep!="" || $com!="" ) {
- $CONTENT_CAT_LIST_TABLE_INFO_PRE = TRUE;
- $CONTENT_CAT_LIST_TABLE_INFO_POST = TRUE;
- }
- $totalparent = $aa -> countCatItems($row['content_id']);
- $CM_AUTHOR = $aa -> prepareAuthor("cat", $row['content_author'], $row['content_id']);
- $textparent = $tp -> parseTemplate($CONTENT_CAT_LIST_TABLE, FALSE, $content_shortcodes);
- }
- }
-
- $cachestr = "$plugintable.cat.$qs[1]";
- $cachecheck = CachePre($cachestr);
- if($cachecheck){
- echo $cachecheck;
- return;
- }
-
- if(!$mode || $mode == "" || $mode=='view'){
- $check = (isset($qs[1]) && is_numeric($qs[1]) ? intval($qs[1]) : intval($mainparent));
- $array1 = $aa -> getCategoryTree("", $check, TRUE);
- $newarray = array_merge_recursive($array1);
- $levels = 0;
- if(isset($content_pref['content_cat_levels']) && is_numeric($content_pref['content_cat_levels']) && $content_pref['content_cat_levels']>0){
- $levels = intval($content_pref['content_cat_levels']) + 1;
- }
- if($levels>0){
- for($a=0;$a CONTENTREGEXP($validsub)."' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ";
-
- //list subcategories
- if( varsettrue($content_pref["content_cat_showparentsub"]) ){
-
- $cids = implode(",", $subparent );
-
- //we parse the order string, dependent of the content_pref
- $order = $aa -> getOrder('cat');
-
- //finally we can loop through all records
- $content_cat_listsub_table_string = "";
- if($sql2 -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_icon, content_parent, content_order", " content_id IN (".$cids.") AND ".$subqry." ".$order." ")){
- while($row = $sql2 -> db_Fetch()){
- $totalsubcat = $aa -> countCatItems($row['content_id']);
- $content_cat_listsub_table_string .= $tp -> parseTemplate($CONTENT_CAT_LISTSUB_TABLE, FALSE, $content_shortcodes);
- }
- $textsubparent = $CONTENT_CAT_LISTSUB_TABLE_START.$content_cat_listsub_table_string.$CONTENT_CAT_LISTSUB_TABLE_END;
- $captionsubparent = $content_pref['content_cat_sub_caption'];
- }
- }
-
- //list all contents within this category
- unset($text);
-
- //also show content items of subcategories of this category ?
- if( varsettrue($content_pref["content_cat_listtype"]) ){
- $validitem = implode(",", $subparent);
- $qrycat = " content_parent REGEXP '".$aa -> CONTENTREGEXP($validitem)."' ";
- }else{
- $qrycat = " content_parent = '".intval($qs[1])."' ";
- }
- $qrycat = " content_refer !='sa' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' AND ".$qrycat." ";
- $contenttotal = $sql -> db_Count($plugintable, "(*)", "WHERE ".$qrycat);
- $childqry = $qrycat." ".$order." ".$nextprevquery;
- $np=false;
- 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( 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( 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( varsettrue($textchild) ){ $ns -> tablerender($captionchild, $textchild); }
- if( varsettrue($textparent) ){ $ns -> tablerender($caption, $textparent); }
- if( varsettrue($textsubparent) ){ $ns -> tablerender($captionsubparent, $textsubparent); }
- }else{
- $ns -> tablerender($caption, varsettrue($textchild).varsettrue($textparent,'').varsettrue($textsubparent,''));
- }
- }
- }
- $cachecheck = CachePost($cachestr);
-
- if($mode == "comment"){
- $textparent = $aa->getCrumbPage("cat", $array, $mainparent).$textparent;
- if( varsettrue($textparent) ){ $ns -> tablerender($caption, $textparent); }
-
- if($resultitem = $sql -> db_Select($plugintable, "content_heading, content_rate, content_comment", $qry )){
- $row = $sql -> db_Fetch();
- if($row['content_comment']){
- $cachestr = "comment.$plugintable.$qs[1]";
- $cachecheck = CachePre($cachestr);
- if($cachecheck){
- echo $cachecheck;
- return;
- }
- if( (varsettrue($content_pref["content_cat_rating_all"])) || (varsettrue($content_pref["content_cat_rating"]) && $row['content_rate'])){
- $showrate = TRUE;
- }else{
- $showrate = FALSE;
- }
- $cobj->compose_comment($plugintable, "comment", $qs[1], $width, $row['content_heading'], $showrate);
- $cachecheck = CachePost($cachestr);
- }
- }
- }
-}
-
-// ##### AUTHOR LIST --------------------------------------
-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, true);
-
- show_content_search_menu("authorall", $mainparent); //show navigator/search/order menu
-
- $template_vars = array("CONTENT_AUTHOR_TABLE", "CONTENT_AUTHOR_TABLE_START", "CONTENT_AUTHOR_TABLE_END");
- foreach($template_vars as $t){ global $$t; }
- $aa -> gettemplate($template_vars, 'content_author_template.php');
-
- $cachestr = "$plugintable.author.list.$qs[2]";
- $cachecheck = CachePre($cachestr);
- if($cachecheck){
- echo $cachecheck;
- return;
- }
- $array = $aa -> getCategoryTree("", $mainparent, TRUE);
- $validparent = implode(",", array_keys($array));
- $number = varsettrue($content_pref["content_author_nextprev_number"],'5');
- $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().")";
-
- $sql1 = new db; $sql2 = new db;
- $contenttotal = $sql1 -> db_Select($plugintable." AS p", "DISTINCT(p.content_author)", "p.content_refer !='sa' AND ".$qry." ".$datequery." AND p.content_class REGEXP '".e_CLASS_REGEXP."'");
-
- $query = "
- SELECT DISTINCT(p.content_author)
- FROM #$plugintable AS p
- WHERE p.content_refer !='sa' AND ".$qry." ".$dateqry." AND p.content_class REGEXP '".e_CLASS_REGEXP."'
- ORDER BY p.content_author";
-
- $arr = array();
- $arr2 = array();
- if (!$sql1->db_Select_gen($query)){
- $text = CONTENT_LAN_15;
- }else{
- while($row1 = $sql1 -> db_Fetch()){
- //parse db field and retrieve user info -> array($author_id, $author_name, $author_email, $content_author);
- $arr[] = $aa->getAuthor($row1['content_author']);
- }
- //combine unique authors
- for($i=0;$i$value){
- $db='';
- //prepare db field for author comparison
- if(count($arr2[$key])==1){
- $db = " p.content_author='".$arr2[$key][0][3]."' ";
- }else{
- for($k=0;$kdb_Count($plugintable." as p", "(*)", "WHERE ".$db );
-
- $query = "
- SELECT p.content_id, p.content_heading, p.content_datestamp
- FROM #$plugintable AS p
- WHERE (".$db.") AND p.content_refer !='sa' AND ".$qry." ".$dateqry." AND p.content_class REGEXP '".e_CLASS_REGEXP."'
- ORDER BY p.content_datestamp ASC, p.content_author LIMIT 0,1";
-
- //query to retrieve last created item for each author
- if ($sql2->db_Select_gen($query)){
- while($row2 = $sql2 -> db_Fetch()){
- $arr3[] = array($key, $row2['content_id'], $row2['content_heading'], $row2['content_datestamp'], $amount);
- }
- }
- }
- }
-
- function cmp($a, $b)
- {
- $posa = strrpos($a[0], " ");
- if($posa == TRUE){
- $la = substr($a[0], $posa);
- }elseif($posa == FALSE){
- $la = $a[0];
- }
-
- $posb = strrpos($b[0], " ");
- if($posb == TRUE){
- $lb = substr($b[0], $posb);
- }elseif($posb == FALSE){
- $lb = $b[0];
- }
-
- if ($la == $lb) {
- return 0;
- }
- return strcasecmp ($la, $lb);
- }
- //do an alpha ordering on the author (if 'firstname lastname', lastname is the comparison factor)
- usort($arr3, "cmp");
-
- //define amount of records to show
- if( varsettrue($content_pref['content_author_nextprev'],'') ){
- $a = $from;
- $b = $from+$number;
- }else{
- $a = 0;
- $b = count($arr3);
- }
-
- $string = "";
- for($i=$a;$i<$b;$i++){
- if(is_array($arr3[$i])){
- $authordetails[$i][1] = $arr3[$i][0];
- $row['content_id'] = $arr3[$i][1];
- $row['content_heading'] = $arr3[$i][2];
- $row['content_datestamp'] = $arr3[$i][3];
- $totalcontent = $arr3[$i][4];
- $string .= $tp -> parseTemplate($CONTENT_AUTHOR_TABLE, FALSE, $content_shortcodes);
- }
- }
- $CONTENT_NEXTPREV = $aa->ShowNextPrev("author", $from, $number, $contenttotal,true);
- $text = $tp -> parseTemplate($CONTENT_AUTHOR_TABLE_START, FALSE, $content_shortcodes);
- $text .= $string;
- $text .= $tp -> parseTemplate($CONTENT_AUTHOR_TABLE_END, FALSE, $content_shortcodes);
- }
- $text = $aa->getCrumbPage("authorall", $array, $mainparent).$text;
- $ns -> tablerender($content_pref['content_author_index_caption'], $text);
- $cachecheck = CachePost($cachestr);
-}
-
-
-function show_content_author(){
- 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, true);
-
- show_content_search_menu("author", $mainparent); //show navigator/search/order menu
-
- $cachestr = "$plugintable.author.$qs[1]";
- $cachecheck = CachePre($cachestr);
- if($cachecheck){
- echo $cachecheck;
- return;
- }
- $array = $aa -> getCategoryTree("", $mainparent, TRUE);
- if(array_key_exists($qs[1], $array)){
- $validparent = "0,0.".implode(",0.", array_keys($array));
- }else{
- $validparent = implode(",", array_keys($array));
- }
- $order = $aa -> getOrder();
- $number = varsettrue($content_pref["content_nextprev_number"],'10');
- $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; }
- if(!$author = $sqla -> db_Select($plugintable, "content_author", "content_refer !='sa' AND ".$qry." ".$datequery." AND content_id = '".intval($qs[1])."' AND content_class REGEXP '".e_CLASS_REGEXP."' ")){
- header("location:".e_SELF."?author.list.".$mainparent); exit;
- }else{
- list($content_author) = $sqla -> db_Fetch();
- $sqlb = new db;
- $authordetails = $aa -> getAuthor($content_author);
- $query = " content_author = '".$authordetails[3]."' || content_author REGEXP '\\\^".$authordetails[1]."' ".(is_numeric($content_author) && $authordetails[3]!=$authordetails[0] ? " || content_author = '".$authordetails[0]."' " : "")." ";
- $validparent = implode(",", array_keys($array));
- $qry = " content_refer !='sa' AND content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' AND (".$query.") ";
- $contenttotal = $sqlb -> db_Count($plugintable, "(*)", "WHERE ".$qry." ");
- $authorqry = $qry." ".$order." ".$nextprevquery;
-
- $text = $aa->getCrumbPage("author", $array, $mainparent);
-
- $np = $aa->ShowNextPrev("", $from, $number, $contenttotal, true);
- $text .= displayPreview($authorqry, $np, $array);
-
- $caption = $content_pref['content_author_caption'];
- if( varsettrue($content_pref['content_author_caption_append_name'],'') ){
- $caption .= " ".$authordetails[1];
- }
- $ns -> tablerender($caption, $text);
- }
- $cachecheck = CachePost($cachestr);
-}
-
-// ##### TOP RATED LIST -----------------------------------
-function show_content_top(){
- 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, true);
-
- show_content_search_menu("top", $mainparent); //show navigator/search/order menu
-
- $template_vars = array("CONTENT_TOP_TABLE", "CONTENT_TOP_TABLE_START", "CONTENT_TOP_TABLE_END");
- foreach($template_vars as $t){ global $$t; }
- $aa -> gettemplate($template_vars, 'content_top_template.php');
-
- $cachestr = "$plugintable.top.$qs[1]";
- $cachecheck = CachePre($cachestr);
- if($cachecheck){
- echo $cachecheck;
- return;
- }
- $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().") ";
- $qry = " p.content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
- $number = varsettrue($content_pref["content_nextprev_number"]);
- $np = ($number ? " LIMIT ".intval($from).", ".intval($number) : "");
-
- $qry1 = "
- 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'
- ORDER BY rate_avg DESC ";
- $qry2 = $qry1." ".$np;
-
- if(!is_object($sql)){ $sql = new db; }
- $total = $sql -> db_Select_gen($qry1);
- if(!$sql->db_Select_gen($qry2)){
- $text = CONTENT_LAN_37;
- }else{
- $CONTENT_NEXTPREV = $aa->ShowNextPrev("", $from, $number, $total, true);
- $text = $tp -> parseTemplate($CONTENT_TOP_TABLE_START, FALSE, $content_shortcodes);
- while($row = $sql -> db_Fetch()){
- $CM_AUTHOR = $aa -> prepareAuthor("top", $row['content_author'], $row['content_id']);
- $text .= $tp -> parseTemplate($CONTENT_TOP_TABLE, FALSE, $content_shortcodes);
- }
- $text .= $tp -> parseTemplate($CONTENT_TOP_TABLE_END, FALSE, $content_shortcodes);
- }
- $text = $aa->getCrumbPage("top", $array, $mainparent).$text;
- $caption = $content_pref['content_top_caption'];
- if( varsettrue($content_pref['content_top_caption_append_name'],'') ){
- $caption .= " ".$array[intval($qs[1])][1];
- }
- $ns -> tablerender($caption, $text);
- $cachecheck = CachePost($cachestr);
- unset($qry, $qry1, $qry2, $array, $validparent, $datequery);
-}
-
-
-// ##### TOP SCORE LIST -----------------------------------
-function show_content_score(){
- 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, 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");
- foreach($template_vars as $t){ global $$t; }
- $aa -> gettemplate($template_vars, 'content_score_template.php');
-
- $cachestr = "$plugintable.score.$qs[1]";
- $cachecheck = CachePre($cachestr);
- if($cachecheck){
- echo $cachecheck;
- return;
- }
- $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."' ";
- $number = varsettrue($content_pref["content_nextprev_number"],'5');
-
- if(!is_object($sql)){ $sql = new db; }
- $contenttotal = $sql -> db_Count($plugintable, "(*)", "WHERE ".$qry." ");
- if(!$sql -> db_Select($plugintable, "content_id, content_heading, content_author, content_icon, content_score", " ".$qry." ORDER BY content_score DESC LIMIT ".$from.",".$number." ")){
- $text = CONTENT_LAN_88;
- }else{
- $CONTENT_NEXTPREV = $aa->ShowNextPrev("", $from, $number, $contenttotal, true);
- $text = $tp -> parseTemplate($CONTENT_SCORE_TABLE_START, FALSE, $content_shortcodes);
- while($row = $sql -> db_Fetch()){
- $CM_AUTHOR = $aa -> prepareAuthor("score", $row['content_author'], $row['content_id']);
- $text .= $tp -> parseTemplate($CONTENT_SCORE_TABLE, FALSE, $content_shortcodes);
- }
- $text .= $tp -> parseTemplate($CONTENT_SCORE_TABLE_END, FALSE, $content_shortcodes);
- }
- $text = $aa->getCrumbPage("score", $array, $mainparent).$text;
- $caption = $content_pref['content_score_caption'];
- if( varsettrue($content_pref['content_score_caption_append_name'],'') ){
- $caption .= " ".$array[intval($qs[1])][1];
- }
- $ns -> tablerender($caption, $text);
- $cachecheck = CachePost($cachestr);
-}
-
-// ##### CONTENT ITEM ------------------------------------------
-function show_content_item()
-{
- 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;
- global $comment_edit_query;
-
- $mainparent = $aa -> getMainParent(intval($qs[1]));
- $content_pref = $aa -> getContentPref($mainparent, true);
- $comment_edit_query = 'comment.pcontent.'.$qs[1];
-
- show_content_search_menu("item", $mainparent); //show navigator/search/order menu
- $array = $aa -> getCategoryTree("", $mainparent, TRUE);
- $validparent = implode(",", array_keys($array));
- $qry = "content_id='".intval($qs[1])."' AND content_refer !='sa' AND content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ";
-
- if(!$resultitem = $sql -> db_Select($plugintable, "*", $qry)){
- header("location:".e_SELF."?recent.".$mainparent); exit;
- }else{
- $row = $sql -> db_Fetch();
-
- //update refer count outside of cache (count visits ^ count unique ips)
- if( varsettrue($content_pref["content_log"]) ){
- $ip = e107::getIPHandler()->getIP(FALSE);
- $self = e_SELF;
- $refertmp = explode("^", $row['content_refer']);
- if(strpos($self, "admin") === FALSE){
- if(strpos($refertmp[1], $ip) === FALSE){
- $referiplist = ($refertmp[1] ? $refertmp[1]."-".$ip : $ip );
- $contentrefernew = ($refertmp[0]+1)."^".$referiplist;
- }else{
- $contentrefernew = ($refertmp[0]+1)."^".$refertmp[1];
- }
- if (!is_object($sql)){ $sql = new db; }
- $sql -> db_Update($plugintable, "content_refer='".$contentrefernew."' WHERE content_id='".intval($qs[1])."' ");
-
- $e107cache->clear("$plugintable.content.$qs[1]");
- $e107cache->clear("$plugintable.recent.$mainparent");
- $e107cache->clear("$plugintable.cat.list.$mainparent");
- $e107cache->clear("$plugintable.cat.$mainparent");
- $e107cache->clear("$plugintable.author.$mainparent");
- $e107cache->clear("$plugintable.top.$mainparent");
- }
- }
-
- if(!isset($qs[2]) || ($qs[2] = intval($qs[2])) <= 0)
- {
- $cacheid = 1;
- $qs[2] = 1; // Force first page
- }
- else
- {
- $cacheid = $qs[2];
- }
- $cachestr = "$plugintable.content.$qs[1].$cacheid";
- $cachecheck = CachePre($cachestr);
- if($cachecheck)
- {
- echo $cachecheck;
- //return;
- }
- else
- {
- $number = varsettrue($content_pref["content_nextprev_number"],'5');
- $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'];
-
- $CONTENT_CONTENT_TABLE_PREV_PAGE = FALSE;
- $CONTENT_CONTENT_TABLE_NEXT_PAGE = FALSE;
- $lastpage = FALSE; //boolean whether or not the current page is the last page
- if(preg_match_all("/\[newpage.*?]/si", $row['content_text'], $matches))
- {
- //remove html bbcode (since we're splitting the text, the html bbcode would not be parsed)
- $row['content_text'] = preg_replace("/\\[html\](.*?)\[\/html\]/si", '\1', $row['content_text']);
- //split newpage
- $pages = preg_split("/\[newpage.*?]/si", $row['content_text'], -1, PREG_SPLIT_NO_EMPTY);
- $pages = array_values($pages);
-
- //remove empty values
- if(trim($pages[0]) == ""){
- unset($pages[0]);
- }
- $pages = array_values($pages);
-
- if(count($pages) > count($matches[0])){
- $matches[0] = array_pad($matches[0], -count($pages), "[newpage]");
- }
-
- $CONTENT_CONTENT_TABLE_TEXT = $pages[(!$qs[2] ? 0 : $qs[2]-1)];
- $options = "";
- for ($i=0; $i < count($pages); $i++) {
- if (!isset($qs[2]))
- {
- $idp = 1;
- }
- else
- {
- $idp = $qs[2];
- }
- if($idp == $i+1){ $pre = CONTENT_LAN_92; }else{ $pre = ""; }
- if($matches[0][$i] == "[newpage]"){
- $pagename[$i] = CONTENT_LAN_78;
- }else{
- $arrpagename = explode("[newpage=", $matches[0][$i]);
- $pagename[$i] = substr($arrpagename[1],0,-1);
- }
- if( varsettrue($content_pref["content_content_pagenames_nextprev"]) ){
- if($idp>1){
- 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{
- $cap = CONTENT_LAN_90;
- }
- $CONTENT_CONTENT_TABLE_PREV_PAGE = "".$cap." ";
- }else{
- $CONTENT_CONTENT_TABLE_PREV_PAGE = ' ';
- }
- if($idp".$cap."";
- }else{
- $CONTENT_CONTENT_TABLE_NEXT_PAGE = ' ';
- }
- }
-
- //0:normal links, 1:selectbox
- //$content_pref["content_content_pagenames_rendertype"] = "1";
- if(isset($content_pref["content_content_pagenames_rendertype"]) && $content_pref["content_content_pagenames_rendertype"] == "1"){
- $page = CONTENT_LAN_79." ".($i+1)." ".$pre." ".$pagename[$i];
- $url = e_SELF."?".$qs[0].".".$qs[1].".".($i+1);
- $options .= $rs -> form_option($page, ($idp == ($i+1) ? "1" : "0"), $url , "");
- }else{
- $options .= CONTENT_LAN_79." ".($i+1)." ".$pre." : ".$pagename[$i]." ";
- }
-
- if($idp==1){
- $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( varsettrue($content_pref['content_content_multipage_preset']) ){
- if($idp == '1'){
- $lastpage = TRUE;
- }
- //render custom/preset on last page
- }else{
- if($idp == count($pages)){
- $lastpage = TRUE;
- }
- }
- }
- if($content_pref["content_content_pagenames_rendertype"] == "1"){
- $selectjs = "onchange=\"if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }\"";
- $CONTENT_CONTENT_TABLE_PAGENAMES = $rs -> form_select_open("pagenames", $selectjs).$rs -> form_option(CONTENT_LAN_89, "1", "none" , "").$options.$rs -> form_select_close();
- }else{
- $CONTENT_CONTENT_TABLE_PAGENAMES = $options;
- }
-
- }else{
- $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;
- }
-
- $CONTENT_CONTENT_TABLE_TEXT = $tp -> replaceConstants($CONTENT_CONTENT_TABLE_TEXT);
- $CONTENT_CONTENT_TABLE_TEXT = $tp -> toHTML($CONTENT_CONTENT_TABLE_TEXT, TRUE, "BODY");
-
- $custom = $eArrayStorage->ReadArray($row['content_pref']);
-
- $date = $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_DATE}', FALSE, $content_shortcodes);
- $auth = $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_AUTHORDETAILS}', FALSE, $content_shortcodes);
- $ep = $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_EPICONS}', FALSE, $content_shortcodes);
- $edit = $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_EDITICON}', FALSE, $content_shortcodes);
- $par = $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_PARENT}', FALSE, $content_shortcodes);
- $com = $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_COMMENT}', FALSE, $content_shortcodes);
- $score = $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_SCORE}', FALSE, $content_shortcodes);
- $ref = $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_REFER}', FALSE, $content_shortcodes);
- $ico = $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_ICON}', FALSE, $content_shortcodes);
- $sub = $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_SUBHEADING}', FALSE, $content_shortcodes);
- $rat = $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_RATING}', FALSE, $content_shortcodes);
- $fil = $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_FILE}', FALSE, $content_shortcodes);
-
- $CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA = FALSE;
- $CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA = FALSE;
- $CONTENT_CONTENT_TABLE_INFO_PRE = FALSE;
- $CONTENT_CONTENT_TABLE_INFO_POST = FALSE;
-
- //if any of these exist, pre/post activate the container table
- if ($ico!="" || $date!="" || $auth!="" || $ep!="" || $edit!="" || $par!="" || $com!="" || $score!="" || $ref!="" || $sub!="" || $rat!="" || $fil!="") {
- $CONTENT_CONTENT_TABLE_INFO_PRE = TRUE;
- $CONTENT_CONTENT_TABLE_INFO_POST = TRUE;
- $CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA = TRUE;
- $CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA = TRUE;
- }
-
- if(!isset($CONTENT_CONTENT_TABLE)){
- //if no theme has been set, use default theme
- if(!$content_pref["content_theme"]){
-
- //if custom layout is set
- if($row['content_layout']){
- //if custom layout file exists
- if(is_readable($plugindir."templates/default/".$row['content_layout'])){
- require_once($plugindir."templates/default/".$row['content_layout']);
- }else{
- require_once($plugindir."templates/default/content_content_template.php");
- }
- }else{
- require_once($plugindir."templates/default/content_content_template.php");
- }
- }else{
- //if custom layout is set
- if($row['content_layout']){
- //if custom layout file exists
- if(is_readable($tp->replaceConstants($content_pref["content_theme"]).$row['content_layout'])){
- require_once($tp->replaceConstants($content_pref["content_theme"]).$row['content_layout']);
- }else{
- //if default layout from the set theme exists
- if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_content_template.php")){
- require_once($tp->replaceConstants($content_pref["content_theme"])."content_content_template.php");
- //else use default theme, default layout
- }else{
- require_once($plugindir."templates/default/content_content_template.php");
- }
- }
- //if no custom layout is set
- }else{
- //if default layout from the set theme exists
- if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_content_template.php")){
- require_once($tp->replaceConstants($content_pref["content_theme"])."content_content_template.php");
- //else use default theme, default layout
- }else{
- require_once($plugindir."templates/default/content_content_template.php");
- }
- }
- }
- }
-
- $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);
-
- $CONTENT_CONTENT_TABLE_CUSTOM_TAGS = "";
- $CUSTOM_TAGS = FALSE;
- if($lastpage === TRUE && !empty($custom)){
- $CONTENT_CONTENT_TABLE_CUSTOM_PRE = "";
- $CONTENT_CONTENT_TABLE_CUSTOM_TAGS = "";
- //ksort($custom);
- foreach($custom as $k => $v){
- if($k == "content_custom_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']=="")){
- $vv = $cv['day']." ".$months[($cv['month']-1)]." ".$cv['year'];
- }
- }else{
- $vv = $cv;
- }
- if( isset($ck) && $ck != "" && isset($vv) && $vv!="" ){
- $CUSTOM_TAGS = TRUE;
- $CONTENT_CONTENT_TABLE_CUSTOM_KEY = $tp->toHTML($ck, true);
- $CONTENT_CONTENT_TABLE_CUSTOM_VALUE = $tp->toHTML($vv, true);
- $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_CONTENT_TABLE_CUSTOM);
- }
- }
- }
- }else{
- if( varsettrue($content_pref["content_content_customtags"]) ){
- $key = substr($k,15);
- if( isset($key) && $key != "" && isset($v) && $v!="" ){
- $CUSTOM_TAGS = TRUE;
- $CONTENT_CONTENT_TABLE_CUSTOM_KEY = $tp->toHTML($key, true);
- $CONTENT_CONTENT_TABLE_CUSTOM_VALUE = $tp->toHTML($v, true);
- $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_CONTENT_TABLE_CUSTOM);
- }
- }
- }
- }
- if($CUSTOM_TAGS === TRUE){
- $CONTENT_CONTENT_TABLE_CUSTOM_TAGS = $CONTENT_CONTENT_TABLE_CUSTOM_START.$CONTENT_CONTENT_TABLE_CUSTOM_TAGS.$CONTENT_CONTENT_TABLE_CUSTOM_END;
- }
- }
- $text = $aa->getCrumbPage("item", $array, $row['content_parent']);
- $text .= $tp -> parseTemplate($CONTENT_CONTENT_TABLE, FALSE, $content_shortcodes);
- $ns -> tablerender($row['content_heading'], $text);
- $cachecheck = CachePost($cachestr);
- }
-
- //recheck some thing when caching is enabled
- $pages = preg_split("/\[newpage.*?]/si", $row['content_text'], -1, PREG_SPLIT_NO_EMPTY);
- $pages = array_values($pages);
- $cachestr = "comment.$plugintable.$qs[1].$cacheid";
- if(count($pages) == 0){
- $lastpage = TRUE;
- }else{
- if($cacheid == count($pages)){
- $lastpage = TRUE;
- }
- }
-
- if($lastpage && ($row['content_comment'] || (varsettrue($content_pref["content_content_comment_all"])) ) ){
- $cachecheck = CachePre($cachestr);
- if($cachecheck){
- echo $cachecheck;
- return;
- }
-
- if( (varsettrue($content_pref["content_content_rating"]) && $row['content_rate']) || varsettrue($content_pref["content_content_rating_all"]) ){
- $showrate = TRUE;
- }else{
- $showrate = FALSE;
- }
- $width = 0;
- $cobj->compose_comment($plugintable, "comment", $qs[1], $width, $row['content_heading'], $showrate);
- $cachecheck = CachePost($cachestr);
- }
- } //close sql
-}
-
-require_once(FOOTERF);
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/content_manager.php b/e107_plugins/content/content_manager.php
deleted file mode 100644
index b1672b44a..000000000
--- a/e107_plugins/content/content_manager.php
+++ /dev/null
@@ -1,258 +0,0 @@
- setPageTitle();
-
-
-// ##### DB ---------------------------------------------------------------------------------------
-
-require_once(HEADERF);
-
-//db : content create
-if(isset($_POST['create_content'])){
- //content submit
- if(isset($qs[1]) && $qs[1] == "submit"){
- if($_POST['content_text'] && $_POST['content_heading'] && $_POST['parent'] != "none" && $_POST['content_author_name'] != "" && $_POST['content_author_email'] != ""){
- $adb -> dbContent("create", "submit");
- }else{
- $message = CONTENT_ADMIN_SUBMIT_LAN_4;
- }
- //content create (manager)
- }elseif(isset($qs[1]) && $qs[1] == "create"){
- if($_POST['content_text'] && $_POST['content_heading'] && $_POST['parent'] != "none"){
- $adb -> dbContent("create", "contentmanager");
- }else{
- $message = CONTENT_ADMIN_ITEM_LAN_0;
- }
- }
-}
-
-//db : content update
-if(isset($_POST['update_content'])){
- if($_POST['content_text'] && $_POST['content_heading'] && $_POST['parent'] != "none"){
- $adb -> dbContent("update", "contentmanager");
- }else{
- $message = CONTENT_ADMIN_ITEM_LAN_0;
- }
-}
-
-//db : content delete
-if(isset($_POST['delete'])){
- $tmp = array_pop(array_flip($_POST['delete']));
- list($delete, $del_id) = explode("_", $tmp);
-}
-if($delete == 'content' && is_numeric($del_id)){
- if($sql -> db_Delete($plugintable, "content_id='$del_id' ")){
- $message = CONTENT_ADMIN_ITEM_LAN_3;
- $e107cache->clear("content");
- }
-}
-
-//render message
-if(isset($message)){
- $ns -> tablerender("", "".$message."
");
-}
-
-//db : returned messages
-
- //content item submitted (with direct posting)
- if(isset($qs[0]) && $qs[0] == "s"){
- $message = CONTENT_ADMIN_SUBMIT_LAN_2." ".CONTENT_ADMIN_SUBMIT_LAN_5;
- $ns -> tablerender("", "".$message."
");
- require_once(FOOTERF);
- exit;
-
- //content item submitted and reviewed in due course (without direct posting)
- }elseif(isset($qs[0]) && $qs[0] == "d"){
- $message = CONTENT_ADMIN_SUBMIT_LAN_3." ".CONTENT_ADMIN_SUBMIT_LAN_5;
- $ns -> tablerender("", "".$message."
");
- require_once(FOOTERF);
- exit;
-
- //content item created (personal/category manager)
- }elseif(isset($qs[0]) && $qs[0] == "c"){
- $message = CONTENT_ADMIN_ITEM_LAN_1." ".CONTENT_ADMIN_ITEM_LAN_55;
- $ns -> tablerender("", "".$message."
");
- require_once(FOOTERF);
- exit;
-
- //content item updated (personal/category manager)
- }elseif(isset($qs[0]) && $qs[0] == "u"){
- $message = CONTENT_ADMIN_ITEM_LAN_2." ".CONTENT_ADMIN_ITEM_LAN_55;
- $ns -> tablerender("", "".$message."
");
- require_once(FOOTERF);
- exit;
- }
-
-if(!e_QUERY){
- //show content manager/submit options
- if(USER){
- $aform -> show_contentmanager("edit", USERID, USERNAME);
- require_once(FOOTERF);
- exit;
- }else{
- header("location:".$plugindir."content.php"); exit;
- }
-}else{
-
- //validate permissions
- if(isset($qs[1]) && ($qs[1]=='edit' || $qs[1]=='sa') ){
- //on the edit page, the query id holds the content item's id number
- //we need to get the category (parent) of the content item first
- //this is both on the 'edit' page as well as on the 'post submitted' page.
- if(!$sql -> db_Select($plugintable, "content_id, content_parent", "content_id='".intval($qs[2])."' ")){
- //not a valid item, so redirect
- header("location: ".e_SELF); exit;
- }else{
- $row = $sql -> db_Fetch();
- //parent can be '0' (top level) or '0.X (subcategory)
- if(strpos($row['content_parent'], ".")){
- $id = substr($row['content_parent'],2);
- }else{
- $id = $row['content_parent'];
- }
- }
-
- }else{
- //on other pages in the manager either $qs[2] or $qs[1] holds the category id number
- if(isset($qs[2]) && is_numeric($qs[2]) ){
- $id = intval($qs[2]);
- }elseif(isset($qs[1]) && is_numeric($qs[1]) ){
- $id = intval($qs[1]);
- }
- }
- if(!isset($id)){
- header("location: ".e_SELF); exit;
- }
-
- //get preferences for this category
- $content_pref = $aa->getContentPref($id);
-
- //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']) ){
- $sql -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
- $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;
- if( (isset($content_pref["content_manager_approve"]) && check_class($content_pref["content_manager_approve"])) ||
- (isset($content_pref["content_manager_personal"]) && check_class($content_pref["content_manager_personal"])) ||
- (isset($content_pref["content_manager_category"]) && check_class($content_pref["content_manager_category"])) ||
- (isset($content_pref["content_manager_submit"]) && check_class($content_pref["content_manager_submit"]))
- ){
- $personalmanagercheck = TRUE;
- //user is not allowed here, redirect to content frontpage
- }else{
- header("location:".$plugindir."content.php"); exit;
- }
-
- //show list of items in this category
- if(isset($qs[0]) && $qs[0] == "content" && is_numeric($qs[1])){
- $aform -> show_manage_content("contentmanager", USERID, USERNAME);
-
- //content create (manager)
- }elseif(isset($qs[0]) && $qs[0] == "content" && $qs[1] == "create" && is_numeric($qs[2])){
- $aform -> show_create_content("contentmanager", USERID, USERNAME);
-
- //content create (submit)
- }elseif(isset($qs[0]) && $qs[0]=="content" && $qs[1] == "submit" && is_numeric($qs[2]) && !isset($qs[3])){
- $aform -> show_create_content("submit", USERID, USERNAME);
-
- //content edit
- }elseif(isset($qs[0]) && $qs[0] == "content" && $qs[1] == "edit" && is_numeric($qs[2])){
- $aform -> show_create_content("contentmanager", USERID, USERNAME);
-
- //display list of submitted content items
- }elseif(isset($qs[0]) && $qs[0] == "content" && $qs[1] == "approve" && is_numeric($qs[2])){
- //$aform -> show_submitted("contentmanager", USERID, USERNAME, $qs[2]);
- $aform -> show_submitted($qs[2]);
-
- //approve/post submitted content item
- }elseif(isset($qs[0]) && $qs[0] == "content" && $qs[1] == "sa" && is_numeric($qs[2]) ){
- $newqs = array_reverse($qs);
- //item; submit post / update redirect
- if($newqs[0] == "cu"){
- $mainparent = $aa -> getMainParent($qs[2]);
- $message = CONTENT_ADMIN_ITEM_LAN_117." ";
- $message .= CONTENT_ADMIN_ITEM_LAN_88." ".CONTENT_ADMIN_ITEM_LAN_90." ";
- $message .= CONTENT_ADMIN_ITEM_LAN_89." ".CONTENT_ADMIN_ITEM_LAN_90." ";
- $message .= CONTENT_ADMIN_ITEM_LAN_91." ".CONTENT_ADMIN_ITEM_LAN_90." ";
- $message .= CONTENT_ADMIN_ITEM_LAN_124." ".CONTENT_ADMIN_ITEM_LAN_90." ";
- $ns -> tablerender("", "".$message."
");
- require_once(e_ADMIN."footer.php");
- exit;
- }
- $aform -> show_create_content("sa", USERID, USERNAME);
-
- }else{
- header("location:".e_SELF); exit;
- }
-}
-
-require_once(FOOTERF);
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/content_shortcodes.php b/e107_plugins/content/content_shortcodes.php
deleted file mode 100644
index da2f09216..000000000
--- a/e107_plugins/content/content_shortcodes.php
+++ /dev/null
@@ -1,2184 +0,0 @@
- e_sc -> parse_scbatch(__FILE__);
-/*
-
-SC_BEGIN CONTENTFORM_HOOK
-global $CONTENTFORM_HOOK;
-return $CONTENTFORM_HOOK;
-SC_END
-
-SC_BEGIN CM_AMOUNT
-global $row, $tp, $content_pref;
-if($sc_mode){
-
- if($sc_mode=='author'){
- global $totalcontent;
- if(varsettrue($content_pref["content_author_amount"])){
- return $totalcontent." ".($totalcontent==1 ? CONTENT_LAN_53 : CONTENT_LAN_54);
- }
- }elseif($sc_mode=='cat'){
- global $totalitems;
- if(varsettrue($content_pref["content_catall_amount"])){
- return $totalitems." ".($totalitems == "1" ? CONTENT_LAN_53 : CONTENT_LAN_54);
- }
- }elseif($sc_mode=='catlist'){
- global $totalparent;
- if(varsettrue($content_pref["content_cat_amount"])){
- return $totalparent." ".($totalparent == "1" ? CONTENT_LAN_53 : CONTENT_LAN_54);
- }
- }elseif($sc_mode=='catlistsub'){
- global $totalsubcat;
- if(varsettrue($content_pref["content_catsub_amount"])){
- return $totalsubcat." ".($totalsubcat == "1" ? CONTENT_LAN_53 : CONTENT_LAN_54);
- }
- }elseif($sc_mode=='type'){
- global $contenttotal;
- return $contenttotal." ".($contenttotal == 1 ? CONTENT_LAN_53 : CONTENT_LAN_54);
- }
-}
-SC_END
-
-SC_BEGIN CM_AUTHOR
-global $row, $aa, $tp;
-if($sc_mode){
- if($sc_mode=='top'){
- global $CM_AUTHOR;
- return $CM_AUTHOR;
- }elseif($sc_mode=='score'){
- global $CM_AUTHOR;
- return $CM_AUTHOR;
- }elseif($sc_mode=='archive'){
- global $CM_AUTHOR;
- return $aa -> prepareAuthor("archive", $row['content_author'], $row['content_id']);
- }elseif($sc_mode=='recent'){
- global $CM_AUTHOR;
- return $CM_AUTHOR;
- }elseif($sc_mode=='author'){
- global $authordetails, $i, $row;
- $name = ($authordetails[$i][1] == "" ? "... ".CONTENT_LAN_29." ..." : $authordetails[$i][1]);
- return "".$name." ";
- }elseif($sc_mode=='content'){
- global $CM_AUTHOR;
- return $CM_AUTHOR;
- }elseif($sc_mode=='cat'){
- global $CM_AUTHOR;
- return $CM_AUTHOR;
- }elseif($sc_mode=='catlist'){
- global $CM_AUTHOR;
- return $CM_AUTHOR;
- }elseif($sc_mode=='searchresult'){
- $authordetails = $aa -> getAuthor($row['content_author']);
- $ret = $authordetails[1];
- if(USER){
- if(is_numeric($authordetails[3])){
- $ret .= " ".CONTENT_ICON_USER." ";
- }else{
- $ret .= " ".CONTENT_ICON_USER;
- }
- }else{
- $ret .= " ".CONTENT_ICON_USER;
- }
- $ret .= " ".CONTENT_ICON_AUTHORLIST." ";
- return $ret;
- }
-}
-SC_END
-
-SC_BEGIN CM_COMMENT
-global $row, $tp, $content_pref;
-if($sc_mode){
- if($sc_mode=='cat'){
- global $comment_total, $plugintable;
- if(varsettrue($row['content_comment']) && varsettrue($content_pref["content_catall_comment"])){
- $sqlc = new db;
- $comment_total = $sqlc -> db_Select("comments", "*", "comment_item_id='".$row['content_id']."' AND comment_type='".$plugintable."' AND comment_pid='0' ");
- return "".CONTENT_LAN_57." ".$comment_total." ";
- }
- }elseif($sc_mode=='catlist'){
- global $qs, $comment_total, $sql, $plugintable;
- if(varsettrue($row['content_comment']) && varsettrue($content_pref["content_cat_comment"])){
- $comment_total = $sql -> db_Count("comments", "(*)", "WHERE comment_item_id='".intval($qs[1])."' AND comment_type='".$plugintable."' AND comment_pid='0' ");
- return "".CONTENT_LAN_57." ".$comment_total." ";
- }
- }elseif($sc_mode=='content'){
- global $cobj, $qs, $plugintable;
- if((varsettrue($content_pref["content_content_comment"]) && varsettrue($row['content_comment'])) || varsettrue($content_pref["content_content_comment_all"]) ){
- return $cobj -> count_comments($plugintable, $qs[1]);
- }
- }
-}
-SC_END
-
-SC_BEGIN CM_DATE
-global $row, $tp, $content_pref, $gen;
-if($sc_mode){
- if($sc_mode=='archive'){
- if(varsettrue($content_pref["content_archive_date"])){
- $datestyle = varset($content_pref["content_archive_datestyle"],"%d %b %Y");
- return strftime($datestyle, $row['content_datestamp']);
- }
- }elseif($sc_mode=='recent'){
- if(varsettrue($content_pref["content_list_date"])){
- $datestyle = varset($content_pref["content_list_datestyle"],"%d %b %Y");
- return strftime($datestyle, $row['content_datestamp']);
- }
- }elseif($sc_mode=='content'){
- if(varsettrue($content_pref["content_content_date"])){
- if(!is_object($gen)){ $gen = new convert; }
- $datestamp = preg_replace("# -.*#", "", $gen -> convert_date($row['content_datestamp'], "long"));
- return ($datestamp != "" ? $datestamp : "");
- }
- }elseif($sc_mode=='cat'){
- if(varsettrue($content_pref["content_catall_date"])){
- if(!is_object($gen)){ $gen = new convert; }
- $datestamp = preg_replace("# -.*#", "", $gen -> convert_date($row['content_datestamp'], "long"));
- return ($datestamp != "" ? $datestamp : "");
- }
- }elseif($sc_mode=='catlist'){
- if(varsettrue($content_pref["content_cat_date"])){
- if(!is_object($gen)){ $gen = new convert; }
- $datestamp = preg_replace("# -.*#", "", $gen -> convert_date($row['content_datestamp'], "long"));
- return ($datestamp != "" ? $datestamp : "");
- }
- }elseif($sc_mode=='searchresult'){
- return preg_replace("# -.*#", "", $gen -> convert_date($row['content_datestamp'], "short"));
-
- }
-}
-SC_END
-
-SC_BEGIN CM_EDITICON
-global $content_pref, $row, $plugindir, $tp;
-if($sc_mode){
- if($sc_mode=='content'){
- if(ADMIN && getperms("P") && varsettrue($content_pref["content_content_editicon"])){
- return "".CONTENT_ICON_EDIT." ";
- }
- }elseif($sc_mode=='recent'){
- if(ADMIN && getperms("P") && varsettrue($content_pref["content_list_editicon"])){
- return "".CONTENT_ICON_EDIT." ";
- }
- }
-}
-SC_END
-
-SC_BEGIN CM_EPICONS
-global $content_pref, $row, $tp;
-if($sc_mode){
- $epicons = "";
- if($sc_mode=='content'){
- if((varsettrue($content_pref["content_list_peicon"]) && varsettrue($row['content_pe'])) || varsettrue($content_pref["content_list_peicon_all"]) ){
- $epicons = $tp -> parseTemplate("{EMAIL_ITEM=".CONTENT_LAN_69." ".CONTENT_LAN_71."^plugin:content.".$row['content_id']."}");
- $epicons .= " ".$tp -> parseTemplate("{PRINT_ITEM=".CONTENT_LAN_70." ".CONTENT_LAN_71."^plugin:content.".$row['content_id']."}");
- $epicons .= " ".$tp -> parseTemplate("{PDF=".CONTENT_LAN_76." ".CONTENT_LAN_71."^plugin:content.".$row['content_id']."}");
- return $epicons;
- }
- }elseif($sc_mode=='recent'){
- if(varsettrue($content_pref["content_list_peicon"])){
- if( varsettrue($row['content_pe']) || varsettrue($content_pref["content_list_peicon_all"]) ){
- $epicons = $tp -> parseTemplate("{EMAIL_ITEM=".CONTENT_LAN_69." ".CONTENT_LAN_71."^plugin:content.".$row['content_id']."}");
- $epicons .= " ".$tp -> parseTemplate("{PRINT_ITEM=".CONTENT_LAN_70." ".CONTENT_LAN_71."^plugin:content.".$row['content_id']."}");
- $epicons .= " ".$tp -> parseTemplate("{PDF=".CONTENT_LAN_76." ".CONTENT_LAN_71."^plugin:content.".$row['content_id']."}");
- return $epicons;
- }
- }
- }elseif($sc_mode=='cat'){
- if( varsettrue($row['content_pe']) && varsettrue($content_pref["content_catall_peicon"])){
- $epicons = $tp -> parseTemplate("{EMAIL_ITEM=".CONTENT_LAN_69." ".CONTENT_LAN_72."^plugin:content.".$row['content_id']."}");
- $epicons .= " ".$tp -> parseTemplate("{PRINT_ITEM=".CONTENT_LAN_70." ".CONTENT_LAN_72."^plugin:content.".$row['content_id']."}");
- $epicons .= " ".$tp -> parseTemplate("{PDF=".CONTENT_LAN_76." ".CONTENT_LAN_72."^plugin:content.".$row['content_id']."}");
- return $epicons;
- }
- }elseif($sc_mode=='catlist'){
- if( (varsettrue($content_pref["content_cat_peicon"]) && varsettrue($row['content_pe'])) || varsettrue($content_pref["content_cat_peicon_all"]) ){
- $epicons = $tp -> parseTemplate("{EMAIL_ITEM=".CONTENT_LAN_69." ".CONTENT_LAN_72."^plugin:content.$qs[1]}");
- $epicons .= " ".$tp -> parseTemplate("{PRINT_ITEM=".CONTENT_LAN_70." ".CONTENT_LAN_72."^plugin:content.$qs[1]}");
- $epicons .= " ".$tp -> parseTemplate("{PDF=".CONTENT_LAN_76." ".CONTENT_LAN_72."^plugin:content.$qs[1]}");
- return $epicons;
- }
- }
-}
-SC_END
-
-SC_BEGIN CM_HEADING
-global $row, $tp;
-$row['content_heading'] = $tp -> toHTML($row['content_heading'], TRUE, "");
-if($sc_mode){
- if($sc_mode=='type'){
- $row['content_heading'] = $tp -> toHTML($row['content_heading'], TRUE, "emotes_off, no_make_clickable");
- return "".$row['content_heading']." ";
- }elseif($sc_mode=='top'){
- return "".$row['content_heading']." ";
- }elseif($sc_mode=='score'){
- return "".$row['content_heading']." ";
- }elseif($sc_mode=='archive'){
- return "".$row['content_heading']." ";
- }elseif($sc_mode=='cat'){
- return "".$row['content_heading']." ";
- }elseif($sc_mode=='catlist'){
- return "".$row['content_heading']." ";
- }elseif($sc_mode=='catlistsub'){
- return "".$row['content_heading']." ";
- }elseif($sc_mode=='recent'){
- return "".$row['content_heading']." ";
- }elseif($sc_mode=='content'){
- return $row['content_heading'];
- }elseif($sc_mode=='searchresult'){
- return "".$row['content_heading']." ";
- }elseif($sc_mode=='manager'){
- return "".$row['content_heading']." ";
- }elseif($sc_mode=='manager_link'){
- return "".CONTENT_LAN_67." ";
- }else{
- return "".$row['content_heading']." ";
- }
-}else{
- return "".$row['content_heading']." ";
-}
-SC_END
-
-SC_BEGIN CM_ICON
-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_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_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_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_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_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_pref['content_icon_path'], "content.".$row['content_id'], $width, $content_pref["content_blank_icon"]);
- }
- }elseif($sc_mode=='author'){
- return "".CONTENT_ICON_AUTHORLIST." ";
- }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_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_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_pref['content_icon_path'], "content.".$row['content_id'], $width, $content_pref["content_blank_icon"]);
- }elseif($sc_mode=='manager_link'){
- return "".CONTENT_ICON_CONTENTMANAGER." ";
- }elseif($sc_mode=='manager_new'){
- if( (isset($content_pref["content_manager_personal"]) && check_class($content_pref["content_manager_personal"])) || (isset($content_pref["content_manager_category"]) && check_class($content_pref["content_manager_category"])) || (isset($content_pref["content_manager_submit"]) && check_class($content_pref["content_manager_submit"])) ){
-
- if( (isset($content_pref["content_manager_personal"]) && check_class($content_pref["content_manager_personal"])) || (isset($content_pref["content_manager_category"]) && check_class($content_pref["content_manager_category"])) ){
- return "".CONTENT_MANAGER_LAN_1." ";
- }elseif( isset($content_pref["content_manager_submit"]) && check_class($content_pref["content_manager_submit"]) ){
- return "".CONTENT_MANAGER_LAN_4." ";
- }
- }
- }elseif($sc_mode=='manager_edit'){
- if( (isset($content_pref["content_manager_personal"]) && check_class($content_pref["content_manager_personal"])) || (isset($content_pref["content_manager_category"]) && check_class($content_pref["content_manager_category"])) ){
- return "".CONTENT_MANAGER_LAN_2." ";
- }
- }elseif($sc_mode=='manager_submit'){
- global $plugintable;
- if(isset($content_pref["content_manager_approve"]) && check_class($content_pref["content_manager_approve"])){
- if(!is_object($sqls)){ $sqls = new db; }
- $num = $sqls -> db_Count($plugintable, "(*)", "WHERE content_refer = 'sa' AND content_parent='".intval($row['content_id'])."' ");
- return "".CONTENT_MANAGER_LAN_3." (".$num.") ";
- }
- }
-}
-SC_END
-
-SC_BEGIN CM_PARENT
-global $aa, $array, $row, $content_pref, $tp;
-if($sc_mode){
- if($sc_mode=='content'){
- if(varsettrue($content_pref["content_content_parent"])){
- return $aa -> getCrumbItem($row['content_parent'], $array);
- }
- }elseif($sc_mode=='recent'){
- if(varsettrue($content_pref["content_list_parent"])){
- return $aa -> getCrumbItem($row['content_parent'], $array);
- }
- }
-}
-SC_END
-
-SC_BEGIN CM_RATING
-global $row, $tp, $rater, $content_pref, $plugintable;
-if($sc_mode){
- if($sc_mode=='content'){
- if(($content_pref["content_content_rating"] && $row['content_rate']) || $content_pref["content_content_rating_all"] ){
- return $rater->composerating($plugintable, $row['content_id'], $enter=TRUE, $userid=FALSE);
- }
- }elseif($sc_mode=='recent'){
- if($content_pref["content_list_rating"]){
- if($content_pref["content_list_rating_all"] || $row['content_rate']){
- return $rater->composerating($plugintable, $row['content_id'], $enter=FALSE, $userid=FALSE);
- }
- }
- }elseif($sc_mode=='top'){
- $row['rate_avg'] = round($row['rate_avg'], 1);
- $row['rate_avg'] = (strlen($row['rate_avg'])>1 ? $row['rate_avg'] : $row['rate_avg'].".0");
- $tmp = explode(".", $row['rate_avg']);
- $rating = "";
- $rating .= $row['rate_avg']." ";
- for($c=1; $c<=$tmp[0]; $c++){
- $rating .= " ";
- }
- if($tmp[0] < 10){
- for($c=9; $c>=$tmp[0]; $c--){
- $rating .= " ";
- }
- }
- $rating .= " ";
- return $rating;
-
- }elseif($sc_mode=='cat'){
- if($row['content_rate'] && varsettrue($content_pref["content_catall_rating"])){
- return $rater->composerating($plugintable, $row['content_id'], $enter=TRUE, $userid=FALSE);
- }
- }elseif($sc_mode=='catlist'){
- if( varsettrue($content_pref["content_cat_rating_all"]) || (varsettrue($content_pref["content_cat_rating"]) && $row['content_rate'])){
- return $rater->composerating($plugintable, $row['content_id'], $enter=TRUE, $userid=FALSE);
- }
- }
-}
-SC_END
-
-SC_BEGIN CM_REFER
-global $sql, $row, $tp, $qs, $content_pref, $plugintable;
-if($sc_mode){
- if($sc_mode=='content'){
- if(varsettrue($content_pref["content_content_refer"])){
- $sql -> db_Select($plugintable, "content_refer", "content_id='".intval($qs[1])."' ");
- list($content_refer) = $sql -> db_Fetch();
- $refercounttmp = explode("^", $content_refer);
- return ($refercounttmp[0] ? $refercounttmp[0] : "");
- }
- }elseif($sc_mode=='recent'){
- if($content_pref["content_log"] && $content_pref["content_list_refer"]){
- $refercounttmp = explode("^", $row['content_refer']);
- $refer = ($refercounttmp[0] ? $refercounttmp[0] : "0");
- if($refer > 0){
- return $refer;
- }
- }
- }
-}
-SC_END
-
-SC_BEGIN CM_SCORE
-global $row, $tp;
-if($sc_mode){
- if($sc_mode=='content'){
- $score = $row['content_score'];
- if($score>0){
- $height = "height:8px;";
- $img = "";
- $img .= " ";
- $img .= " ";
- $img .= " ";
- if($score < 100){
- $empty = 100-$score;
- $img .= " ";
- }
- $img .= " ";
- return $img." ".$score;
- }
- }elseif($sc_mode=='score'){
- $score = $row['content_score'];
- $height = "height:8px;";
- $img = "";
- $img .= " ";
- $img .= " ";
- $img .= " ";
- if($score < 100){
- $empty = 100-$score;
- $img .= " ";
- }
- $img .= " ";
- return $score."/100 ".$img;
- }
-}
-SC_END
-
-SC_BEGIN CM_SUBHEADING
-global $tp, $content_pref, $qs, $row;
-if($sc_mode){
- if($sc_mode=='content'){
- return ($content_pref["content_content_subheading"] && $row['content_subheading'] ? $tp -> toHTML($row['content_subheading'], TRUE, "") : "");
- }elseif($sc_mode=='recent'){
- if (varsettrue($content_pref["content_list_subheading"]) && $row['content_subheading'] && $content_pref["content_list_subheading_char"] && $content_pref["content_list_subheading_char"] != "" && $content_pref["content_list_subheading_char"] != "0"){
- if(strlen($row['content_subheading']) > $content_pref["content_list_subheading_char"]) {
- $row['content_subheading'] = substr($row['content_subheading'], 0, $content_pref["content_list_subheading_char"]).$content_pref["content_list_subheading_post"];
- }
- $ret = ($row['content_subheading'] != "" && $row['content_subheading'] != " " ? $row['content_subheading'] : "");
- }else{
- $ret = ($row['content_subheading'] ? $row['content_subheading'] : "");
- }
- return $tp->toHTML($ret, TRUE, "");
- }elseif($sc_mode=='type'){
- return $tp -> toHTML($row['content_subheading'], TRUE, "emotes_off, no_make_clickable");
- }elseif($sc_mode=='cat'){
- if(varsettrue($content_pref["content_catall_subheading"])){
- return $tp -> toHTML($row['content_subheading'], TRUE, "");
- }
- }elseif($sc_mode=='catlist'){
- if(varsettrue($content_pref["content_cat_subheading"])){
- return $tp -> toHTML($row['content_subheading'], TRUE, "");
- }
- }elseif($sc_mode=='catlistsub'){
- if(varsettrue($content_pref["content_catsub_subheading"])){
- return $tp -> toHTML($row['content_subheading'], TRUE, "");
- }
- }elseif($sc_mode=='searchresult'){
- return $tp -> toHTML($row['content_subheading'], TRUE, "");
- }elseif($sc_mode=='manager'){
- return $tp->toHTML($row['content_subheading'], TRUE);
- }
-}
-SC_END
-
-SC_BEGIN CM_SUMMARY
-global $content_pref, $tp, $row, $CONTENT_CONTENT_TABLE_SUMMARY;
-if($sc_mode){
- if($sc_mode=='content'){
- return $CONTENT_CONTENT_TABLE_SUMMARY;
- }elseif($sc_mode=='recent'){
- if (varsettrue($content_pref["content_list_summary"])){
- if($row['content_summary'] && $content_pref["content_list_summary_char"] && $content_pref["content_list_summary_char"] != "" && $content_pref["content_list_summary_char"] != "0"){
- if(strlen($row['content_summary']) > $content_pref["content_list_summary_char"]) {
- $row['content_summary'] = substr($row['content_summary'], 0, $content_pref["content_list_summary_char"]).$content_pref["content_list_summary_post"];
- }
- $ret = ($row['content_summary'] != "" && $row['content_summary'] != " " ? $row['content_summary'] : "");
- }else{
- $ret = ($row['content_summary'] ? $row['content_summary'] : "");
- }
- return $tp->toHTML($ret, TRUE, "");
- }
- }elseif($sc_mode=='catlist'){
- return ($row['content_summary'] ? $tp -> toHTML($row['content_summary'], TRUE, "") : "");
- }
-}
-SC_END
-
-SC_BEGIN CM_TEXT
-global $content_pref, $row, $tp, $CONTENT_CONTENT_TABLE_TEXT;
-if($sc_mode){
- if($sc_mode=='content'){
- return $CONTENT_CONTENT_TABLE_TEXT;
- }elseif($sc_mode=='recent'){
- if(varsettrue($content_pref["content_list_text"]) && $content_pref["content_list_text_char"] > 0){
- $rowtext = preg_replace("/\[newpage.*?]/si", " ", $row['content_text']);
- $rowtext = $tp->toHTML($rowtext, TRUE, "nobreak");
- $rowtext = strip_tags($rowtext);
- $words = explode(" ", $rowtext);
- $ret = implode(" ", array_slice($words, 0, $content_pref["content_list_text_char"]));
- if($ret){
- if($content_pref["content_list_text_link"]){
- $ret .= " ".$content_pref["content_list_text_post"]." ";
- }else{
- $ret .= " ".$content_pref["content_list_text_post"];
- }
- }
- return $ret;
- }
- }elseif($sc_mode=='cat'){
- if($row['content_text'] && varsettrue($content_pref["content_catall_text"]) && ($content_pref["content_catall_text_char"] > 0 || $content_pref["content_catall_text_char"] == 'all')){
- if($content_pref["content_catall_text_char"] == 'all'){
- $ret = $row['content_text'];
- }else{
- $rowtext = preg_replace("/\[newpage.*?]/si", " ", $row['content_text']);
- $rowtext = $tp->toHTML($rowtext, TRUE, "nobreak");
- $rowtext = strip_tags($rowtext);
- $words = explode(" ", $rowtext);
- $ret = implode(" ", array_slice($words, 0, $content_pref["content_catall_text_char"]));
- if($content_pref["content_catall_text_link"]){
- $ret .= " ".$content_pref["content_catall_text_post"]." ";
- }else{
- $ret .= " ".$content_pref["content_catall_text_post"];
- }
- }
- return $ret;
- }
- }elseif($sc_mode=='catlist'){
- if($row['content_text'] && varsettrue($content_pref["content_cat_text"]) && ($content_pref["content_cat_text_char"] > 0 || $content_pref["content_cat_text_char"] == 'all')){
- if($content_pref["content_cat_text_char"] == 'all'){
- $CONTENT_CAT_LIST_TABLE_TEXT = $tp->toHTML($row['content_text'], TRUE, "constants");
- }else{
- $rowtext = preg_replace("/\[newpage.*?]/si", " ", $row['content_text']);
- $rowtext = $tp->toHTML($rowtext, TRUE, "nobreak, constants");
- $rowtext = strip_tags($rowtext);
- $words = explode(" ", $rowtext);
- $CONTENT_CAT_LIST_TABLE_TEXT = implode(" ", array_slice($words, 0, $content_pref["content_cat_text_char"]));
- if($content_pref["content_cat_text_link"]){
- $CONTENT_CAT_LIST_TABLE_TEXT .= " ".$content_pref["content_cat_text_post"]." ";
- }else{
- $CONTENT_CAT_LIST_TABLE_TEXT .= " ".$content_pref["content_cat_text_post"];
- }
- }
- return $CONTENT_CAT_LIST_TABLE_TEXT;
- }
- }elseif($sc_mode=='searchresult'){
- return $tp -> toHTML($row['content_text'], TRUE, "");
-
- }
-}
-SC_END
-
-SC_BEGIN CM_FILE
-global $row, $tp;
-if($sc_mode){
- if($sc_mode=='content'){
- global $row, $content_pref;
- if($content_pref["content_content_attach"]){
- $filestmp = explode("[file]", $row['content_file']);
- foreach($filestmp as $key => $value) {
- if($value == "") {
- unset($filestmp[$key]);
- }
- }
- $files = array_values($filestmp);
- $content_files_popup_name = str_replace("'", "", $row['content_heading']);
- $file = "";
- $filesexisting = "0";
- for($i=0;$i".CONTENT_ICON_FILE." ";
- }else{
- $file .= " ";
- }
- }
- return ($filesexisting == "0" ? "" : CONTENT_LAN_41." ".($filesexisting == 1 ? CONTENT_LAN_42 : CONTENT_LAN_43)." ".$file." ");
- }
- }elseif($sc_mode=='print'){
- }elseif($sc_mode=='pdf'){
- }
-}
-SC_END
-
-SC_BEGIN CM_IMAGES
-global $row, $tp;
-if($sc_mode){
- if($sc_mode=='content'){
- 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']);
- foreach($imagestmp as $key => $value) {
- if($value == "") {
- unset($imagestmp[$key]);
- }
- }
- $images = array_values($imagestmp);
- $content_image_popup_name = $row['content_heading'];
- $ret = "";
- require_once(e_HANDLER."popup_handler.php");
- $pp = new popup;
- $gen = new convert;
- $datestamp = preg_replace("# -.*#", "", $gen -> convert_date($row['content_datestamp'], "long"));
- for($i=0;$i toHTML($row['content_subheading'], TRUE);
- $popupname = $tp -> toHTML($content_image_popup_name, TRUE);
- $author = $tp -> toHTML($authordetails[1], TRUE);
- $oTitle = $popupname." ".($i+1);
- $oText = $popupname." ".($i+1)." ".$subheading." ".$author." (".$datestamp.")";
- $ret .= $pp -> popup($oSrc, $oSrcThumb, $oIconWidth, $oMaxWidth, $oTitle, $oText);
- }
- return $ret;
- }
-
- }elseif($sc_mode=='print'){
- global $row, $tp, $content_pref;
- if($content_pref["content_content_images"]){
- $imagestmp = explode("[img]", $row['content_image']);
- foreach($imagestmp as $key => $value) {
- if($value == "") {
- unset($imagestmp[$key]);
- }
- }
- $images = array_values($imagestmp);
- $ret = "";
- for($i=0;$i ";
- }
- }
- return $ret;
- }
-
- }elseif($sc_mode=='pdf'){
- global $row, $tp, $content_pref;
- if($content_pref["content_content_images"]){
- $imagestmp = explode("[img]", $row['content_image']);
- foreach($imagestmp as $key => $value) {
- if($value == "") {
- unset($imagestmp[$key]);
- }
- }
- $images = array_values($imagestmp);
- $ret = "";
- for($i=0;$i ";
- }
- }
- return $ret;
- }
- }
-}
-SC_END
-
-// ############################################################################
-// ##### SHORTCODES THAT STILL NEED TO BE CONVERTED TO THE NEW STANDARD! ------
-// ############################################################################
-
-SC_BEGIN CONTENT_NEXTPREV
-global $CONTENT_NEXTPREV;
-return $CONTENT_NEXTPREV;
-SC_END
-
-// CONTENT_TYPE_TABLE ------------------------------------------------
-
-SC_BEGIN CONTENT_TYPE_TABLE_LINK
-global $row, $tp;
-$text = "
-[".CONTENT_TYPE_LAN_0." ]
-[".CONTENT_TYPE_LAN_1." ]
-[".CONTENT_TYPE_LAN_2." ]
-[".CONTENT_TYPE_LAN_3." ]
-[".CONTENT_TYPE_LAN_4." ]
-[".CONTENT_TYPE_LAN_5." ]";
-return $text;
-SC_END
-
-// CONTENT_AUTHOR_TABLE ------------------------------------------------
-
-SC_BEGIN CONTENT_AUTHOR_TABLE_LASTITEM
-global $gen, $row, $content_pref;
-if($content_pref["content_author_lastitem"]){
- if(!is_object($gen)){ $gen = new convert; }
- $date = $gen -> convert_date($row['content_datestamp'], "short");
- return $date." : ".$row['content_heading']." ";
-}
-SC_END
-
-// CONTENT_ARCHIVE_TABLE ------------------------------------------------
-
-SC_BEGIN CONTENT_ARCHIVE_TABLE_LETTERS
-global $content_pref, $CONTENT_ARCHIVE_TABLE_LETTERS;
-if($content_pref["content_archive_letterindex"]){
- return $CONTENT_ARCHIVE_TABLE_LETTERS;
-}
-SC_END
-
-// CONTENT_RECENT_TABLE ------------------------------------------------
-SC_BEGIN CONTENT_RECENT_TABLE_INFOPRE
-global $CONTENT_RECENT_TABLE_INFOPRE;
-if($CONTENT_RECENT_TABLE_INFOPRE === TRUE){
- $CONTENT_RECENT_TABLE_INFOPRE = " ";
- return $CONTENT_RECENT_TABLE_INFOPRE;
-}
-SC_END
-SC_BEGIN CONTENT_RECENT_TABLE_INFOPOST
-global $CONTENT_RECENT_TABLE_INFOPOST;
-if($CONTENT_RECENT_TABLE_INFOPOST === TRUE){
- $CONTENT_RECENT_TABLE_INFOPOST = " ";
- return $CONTENT_RECENT_TABLE_INFOPOST;
-}
-SC_END
-
-// CONTENT_CAT_TABLE ------------------------------------------------
-SC_BEGIN CONTENT_CAT_TABLE_INFO_PRE
-global $CONTENT_CAT_TABLE_INFO_PRE;
-if($CONTENT_CAT_TABLE_INFO_PRE === TRUE){
- $CONTENT_CAT_TABLE_INFO_PRE = " ";
- return $CONTENT_CAT_TABLE_INFO_PRE;
-}
-SC_END
-SC_BEGIN CONTENT_CAT_TABLE_INFO_POST
-global $CONTENT_CAT_TABLE_INFO_POST;
-if($CONTENT_CAT_TABLE_INFO_POST === TRUE){
- $CONTENT_CAT_TABLE_INFO_POST = " ";
- return $CONTENT_CAT_TABLE_INFO_POST;
-}
-SC_END
-
-// CONTENT_CAT_LIST_TABLE ------------------------------------------------
-SC_BEGIN CONTENT_CAT_LIST_TABLE_INFO_PRE
-global $CONTENT_CAT_LIST_TABLE_INFO_PRE;
-if($CONTENT_CAT_LIST_TABLE_INFO_PRE === TRUE){
- $CONTENT_CAT_LIST_TABLE_INFO_PRE = " ";
- return $CONTENT_CAT_LIST_TABLE_INFO_PRE;
-}
-SC_END
-SC_BEGIN CONTENT_CAT_LIST_TABLE_INFO_POST
-global $CONTENT_CAT_LIST_TABLE_INFO_POST;
-if($CONTENT_CAT_LIST_TABLE_INFO_POST === TRUE){
- $CONTENT_CAT_LIST_TABLE_INFO_POST = " ";
- return $CONTENT_CAT_LIST_TABLE_INFO_POST;
-}
-SC_END
-
-// CONTENT_CONTENT_TABLE ------------------------------------------------
-SC_BEGIN CONTENT_CONTENT_TABLE_INFO_PRE
-global $CONTENT_CONTENT_TABLE_INFO_PRE;
-if($CONTENT_CONTENT_TABLE_INFO_PRE === TRUE){
- $CONTENT_CONTENT_TABLE_INFO_PRE = " ";
- return $CONTENT_CONTENT_TABLE_INFO_PRE;
-}
-SC_END
-SC_BEGIN CONTENT_CONTENT_TABLE_INFO_POST
-global $CONTENT_CONTENT_TABLE_INFO_POST;
-if($CONTENT_CONTENT_TABLE_INFO_POST === TRUE){
- $CONTENT_CONTENT_TABLE_INFO_POST = " ";
- return $CONTENT_CONTENT_TABLE_INFO_POST;
-}
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA
-global $CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA;
-if($CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA === TRUE){
- $CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA = " ";
- return $CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA;
-}
-SC_END
-SC_BEGIN CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA
-global $CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA;
-if($CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA === TRUE){
- $CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA = " ";
- return $CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA;
-}
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_CUSTOM_TAGS
-global $CONTENT_CONTENT_TABLE_CUSTOM_TAGS;
-return $CONTENT_CONTENT_TABLE_CUSTOM_TAGS;
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_PAGENAMES
-global $CONTENT_CONTENT_TABLE_PAGENAMES;
-return $CONTENT_CONTENT_TABLE_PAGENAMES;
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_NEXT_PAGE
-global $CONTENT_CONTENT_TABLE_NEXT_PAGE;
-return $CONTENT_CONTENT_TABLE_NEXT_PAGE;
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_PREV_PAGE
-global $CONTENT_CONTENT_TABLE_PREV_PAGE;
-return $CONTENT_CONTENT_TABLE_PREV_PAGE;
-SC_END
-
-// CONTENT_SEARCH_TABLE ------------------------------------------------
-SC_BEGIN CONTENT_SEARCH_TABLE_SELECT
-global $CONTENT_SEARCH_TABLE_SELECT;
-return $CONTENT_SEARCH_TABLE_SELECT;
-SC_END
-
-SC_BEGIN CONTENT_SEARCH_TABLE_ORDER
-global $CONTENT_SEARCH_TABLE_ORDER;
-return $CONTENT_SEARCH_TABLE_ORDER;
-SC_END
-
-SC_BEGIN CONTENT_SEARCH_TABLE_KEYWORD
-global $CONTENT_SEARCH_TABLE_KEYWORD;
-return $CONTENT_SEARCH_TABLE_KEYWORD;
-SC_END
-
-// ############################################################################
-// ##### SHORTCODES USED IN THE MENU ------------------------------------------
-// ############################################################################
-
-//##### SEARCH SELECT ORDER --------------------------------------------------
-
-SC_BEGIN CM_MENU_SEARCH
-global $content_pref, $aa, $menutypeid;
-if($content_pref["content_menu_search"]){
- return $aa -> showOptionsSearch("menu", $menutypeid);
-}
-SC_END
-
-SC_BEGIN CM_MENU_SELECT
-global $content_pref, $aa, $menutypeid;
-if( ($content_pref["content_menu_links"] && $content_pref["content_menu_links_dropdown"]) || ($content_pref["content_menu_cat"] && $content_pref["content_menu_cat_dropdown"]) ){
- return $aa -> showOptionsSelect("menu", $menutypeid);
-}
-SC_END
-
-SC_BEGIN CM_MENU_ORDER
-global $content_pref, $aa, $menutypeid;
-if($content_pref["content_menu_sort"]){
- return $aa -> showOptionsOrder("menu", $menutypeid);
-}
-SC_END
-
-//##### LINKS --------------------------------------------------
-
-SC_BEGIN CM_MENU_LINKCAPTION
-global $content_pref;
-if($content_pref["content_menu_links"] && !$content_pref["content_menu_links_dropdown"]){
- return ($content_pref["content_menu_links_caption"] != "" ? $content_pref["content_menu_links_caption"] : CONTENT_MENU_LAN_4)." ";
-}
-SC_END
-
-SC_BEGIN CM_MENU_LINKS_ICON
-global $content_pref, $bullet;
-//TODO review bullet + use switch
- //define icon
- if($content_pref["content_menu_links_icon"] == "0")
- {
- $ret = "";
- }
- elseif($content_pref["content_menu_links_icon"] == "1")
- {
- $ret = $bullet;
- }
- elseif($content_pref["content_menu_links_icon"] == "2")
- {
- $ret = "·";
- }
- elseif($content_pref["content_menu_links_icon"] == "3")
- {
- $ret = "º";
- }
- elseif($content_pref["content_menu_links_icon"] == "4")
- {
- $ret = "»";
- }
- return $ret;
-SC_END
-
-SC_BEGIN CM_MENU_LINKS_VIEWALLCAT
-global $content_pref, $plugindir, $menutypeid, $icon;
-if($content_pref["content_menu_links"] && !$content_pref["content_menu_links_dropdown"]){
- if($content_pref["content_menu_viewallcat"]){
- return $icon." ".CONTENT_LAN_6." ";
- }
-}
-SC_END
-
-SC_BEGIN CM_MENU_LINKS_VIEWALLAUTHOR
-global $content_pref, $plugindir, $menutypeid, $icon;
-if($content_pref["content_menu_links"] && !$content_pref["content_menu_links_dropdown"]){
- if($content_pref["content_menu_viewallauthor"]){
- return $icon." ".CONTENT_LAN_7." ";
- }
-}
-SC_END
-
-SC_BEGIN CM_MENU_LINKS_VIEWALLITEM
-global $content_pref, $plugindir, $menutypeid, $icon;
-if($content_pref["content_menu_links"] && !$content_pref["content_menu_links_dropdown"]){
- if($content_pref["content_menu_viewallitems"]){
- return $icon." ".CONTENT_LAN_83." ";
- }
-}
-SC_END
-
-SC_BEGIN CM_MENU_LINKS_VIEWTOPRATED
-global $content_pref, $plugindir, $menutypeid, $icon;
-if($content_pref["content_menu_links"] && !$content_pref["content_menu_links_dropdown"]){
- if($content_pref["content_menu_viewtoprated"]){
- return $icon." ".CONTENT_LAN_8." ";
- }
-}
-SC_END
-
-SC_BEGIN CM_MENU_LINKS_VIEWTOPSCORE
-global $content_pref, $plugindir, $menutypeid, $icon;
-if($content_pref["content_menu_links"] && !$content_pref["content_menu_links_dropdown"]){
- if($content_pref["content_menu_viewtopscore"]){
- return $icon." ".CONTENT_LAN_12." ";
- }
-}
-SC_END
-
-SC_BEGIN CM_MENU_LINKS_VIEWRECENT
-global $content_pref, $plugindir, $menutypeid, $icon;
-if($content_pref["content_menu_links"] && !$content_pref["content_menu_links_dropdown"]){
- if($content_pref["content_menu_viewrecent"]){
- return $icon." ".CONTENT_LAN_61." ";
- }
-}
-SC_END
-
-SC_BEGIN CM_MENU_LINKS_VIEWSUBMIT
-global $content_pref, $plugindir, $menutypeid, $icon;
-if($content_pref["content_menu_links"] && !$content_pref["content_menu_links_dropdown"]){
- if( $content_pref["content_menu_viewsubmit"] && $content_pref["content_submit"] && check_class($content_pref["content_submit_class"]) ){
- return $icon." ".CONTENT_LAN_75." ";
- }
-}
-SC_END
-
-//##### CATEGORY LIST --------------------------------------------------
-
-SC_BEGIN CM_MENU_CATEGORY_CAPTION
-global $content_pref;
-return ($content_pref["content_menu_cat_caption"] != "" ? $content_pref["content_menu_cat_caption"] : CONTENT_MENU_LAN_3);
-SC_END
-
-SC_BEGIN CM_MENU_CATEGORY_ICON
-//TODO legacy bullet + use switch
-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;
- }elseif($content_pref["content_menu_cat_icon"] == "2"){ $ret = "·";
- }elseif($content_pref["content_menu_cat_icon"] == "3"){ $ret = "º";
- }elseif($content_pref["content_menu_cat_icon"] == "4"){ $ret = "»";
- }elseif($content_pref["content_menu_cat_icon"] == "5"){
- if($row['content_icon'] != "" && is_readable($content_pref['content_cat_icon_path_small'].$row['content_icon']) ){
- $ret = " ";
- }else{
- //default category icon
- if($content_pref["content_menu_cat_icon_default"] == "0"){ $ret = "";
- }elseif($content_pref["content_menu_cat_icon_default"] == "1"){ $ret = $bullet;
- }elseif($content_pref["content_menu_cat_icon_default"] == "2"){ $ret = "·";
- }elseif($content_pref["content_menu_cat_icon_default"] == "3"){ $ret = "º";
- }elseif($content_pref["content_menu_cat_icon_default"] == "4"){ $ret = "»";
- }
- }
- }
- return $ret;
-SC_END
-
-SC_BEGIN CM_MENU_CATEGORY_HEADING
-global $row;
-return "".$row['content_heading']." ";
-SC_END
-
-SC_BEGIN CM_MENU_CATEGORY_COUNT
-global $row, $aa;
-return $aa -> countCatItems($row['content_id']);
-SC_END
-
-//##### RECENT --------------------------------------------------
-
-SC_BEGIN CM_MENU_RECENT_CAPTION
-global $content_pref;
-return ($content_pref["content_menu_recent_caption"] != "" ? $content_pref["content_menu_recent_caption"] : CONTENT_MENU_LAN_2);
-SC_END
-
-SC_BEGIN CM_MENU_RECENT_ICON
-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 = "·";
- }elseif($content_pref["content_menu_recent_icon"] == "3"){ $ret = "º";
- }elseif($content_pref["content_menu_recent_icon"] == "4"){ $ret = "»";
- }elseif($content_pref["content_menu_recent_icon"] == "5"){
-
- if($content_pref["content_menu_recent_icon_width"]){
- $recenticonwidth = " width:".$content_pref["content_menu_recent_icon_width"]."px; ";
- }else{
- $recenticonwidth = " width:50px; ";
- }
- if($row['content_icon'] != "" && is_readable($content_pref['content_icon_path'].$row['content_icon'])){
- $ret = " ";
- }
- }
- return "".$ret." ";
-SC_END
-
-SC_BEGIN CM_MENU_RECENT_DATE
-global $content_pref, $row;
- if($content_pref["content_menu_recent_date"]){
- $datestyle = ($content_pref["content_archive_datestyle"] ? $content_pref["content_archive_datestyle"] : "%d %b %Y");
- return strftime($datestyle, $row['content_datestamp']);
- }
-SC_END
-
-SC_BEGIN CM_MENU_RECENT_AUTHOR
-global $content_pref, $row, $aa;
- if($content_pref["content_menu_recent_author"]){
- $authordetails = $aa -> getAuthor($row['content_author']);
- return $authordetails[1];
- }
-SC_END
-
-SC_BEGIN CM_MENU_RECENT_SUBHEADING
-global $content_pref, $row;
- if($content_pref["content_menu_recent_subheading"] && $row['content_subheading']){
- if($content_pref["content_menu_recent_subheading_char"] && $content_pref["content_menu_recent_subheading_char"] != "" && $content_pref["content_menu_recent_subheading_char"] != "0"){
- if(strlen($row['content_subheading']) > $content_pref["content_menu_recent_subheading_char"]) {
- $row['content_subheading'] = substr($row['content_subheading'], 0, $content_pref["content_menu_recent_subheading_char"]).$content_pref["content_menu_recent_subheading_post"];
- }
- }
- return $row['content_subheading'];
- }
-SC_END
-
-SC_BEGIN CM_MENU_RECENT_HEADING
-global $row;
-return "".$row['content_heading']." ";
-SC_END
-
-SC_BEGIN CMT_CATEGORY
-global $CMT_CATEGORY;
-return $CMT_CATEGORY;
-SC_END
-
-SC_BEGIN CMT_RECENT
-global $CMT_RECENT;
-return $CMT_RECENT;
-SC_END
-
-// ############################################################################
-// ##### SHORTCODES USED IN THE ADMIN PAGES -----------------------------------
-// ############################################################################
-
-SC_BEGIN CONTENT_ID
-global $row;
-return $row['content_id'];
-SC_END
-
-SC_BEGIN CONTENT_CAT_ICON
-global $row, $content_pref, $tp;
-$caticon = $content_pref['content_cat_icon_path_small'].$row['content_icon'];
-return ($row['content_icon'] ? " " : " ");
-SC_END
-
-SC_BEGIN CONTENT_ICON
-global $CONTENT_ICON;
-return $CONTENT_ICON;
-SC_END
-
-SC_BEGIN CONTENT_AUTHOR
-global $row, $aa;
-$authordetails = $aa -> getAuthor($row['content_author']);
-return ($authordetails[0] != "0" ? "".CONTENT_ICON_USER." " : "")." ".$authordetails[1];
-SC_END
-
-SC_BEGIN CONTENT_HEADING
-global $row, $tp;
-return $tp->toHTML($row['content_heading'], TRUE, "");
-SC_END
-
-SC_BEGIN CONTENT_SUBHEADING
-global $row, $tp;
-return $tp->toHTML($row['content_subheading'], TRUE, "");
-SC_END
-
-SC_BEGIN CONTENT_LINK_ITEM
-global $row, $plugindir;
-return "".CONTENT_ICON_LINK." ";
-SC_END
-
-SC_BEGIN CONTENT_LINK_CATEGORY
-global $row, $plugindir;
-return "".CONTENT_ICON_LINK." ";
-SC_END
-
-SC_BEGIN CONTENT_LINK_OPTION
-global $row;
-return "".CONTENT_ICON_OPTIONS." ";
-SC_END
-
-SC_BEGIN CONTENT_INHERIT
-global $row, $content_pref;
-return " ";
-SC_END
-
-SC_BEGIN CONTENT_LINK_MANAGER
-global $row;
-return "".CONTENT_ICON_CONTENTMANAGER_SMALL." ";
-SC_END
-
-SC_BEGIN CONTENT_MANAGER_PRE
-global $row, $catarray, $catid;
-$pre = '';
-if($row['content_parent'] != "0"){
- for($b=0;$b<(count($catarray[$catid])/2)-1;$b++){
- $pre .= "_";
- }
-}
-return $pre;
-SC_END
-
-SC_BEGIN CONTENT_ADMIN_HTML_CLASS
-global $row;
-if($row['content_parent'] == "0"){
- //top level
- $class = "forumheader";
-}else{
- //sub level
- $class = "forumheader3";
-}
-return $class;
-SC_END
-
-SC_BEGIN CONTENT_MANAGER_INHERIT
-global $row, $content_pref;
-return " ";
-SC_END
-
-SC_BEGIN CONTENT_ADMIN_MANAGER_SUBMIT
-global $row, $content_pref;
-return r_userclass("content_manager_submit", $content_pref["content_manager_submit"], 'off', "public,guest,nobody,member,admin,classes");
-SC_END
-
-SC_BEGIN CONTENT_ADMIN_MANAGER_APPROVE
-global $row, $content_pref;
-return r_userclass("content_manager_approve", $content_pref["content_manager_approve"], 'off', "public,guest,nobody,member,admin,classes");
-SC_END
-
-SC_BEGIN CONTENT_ADMIN_MANAGER_PERSONAL
-global $row, $content_pref;
-return r_userclass("content_manager_personal", $content_pref["content_manager_personal"], 'off', "nobody,member,admin,classes");
-SC_END
-
-SC_BEGIN CONTENT_ADMIN_MANAGER_CATEGORY
-global $row, $content_pref;
-return r_userclass("content_manager_category", $content_pref["content_manager_category"], 'off', "nobody,member,admin,classes");
-SC_END
-
-SC_BEGIN CONTENT_ADMIN_MANAGER_OPTIONS
-global $CONTENT_ADMIN_MANAGER_OPTIONS;
-return $CONTENT_ADMIN_MANAGER_OPTIONS;
-SC_END
-
-SC_BEGIN CONTENT_ORDER
-global $row;
-return $row['content_order'];
-SC_END
-
-SC_BEGIN CONTENT_ADMIN_CATEGORY
-global $CONTENT_ADMIN_CATEGORY;
-return $CONTENT_ADMIN_CATEGORY;
-SC_END
-
-SC_BEGIN CONTENT_ADMIN_OPTIONS
-global $CONTENT_ADMIN_OPTIONS;
-return $CONTENT_ADMIN_OPTIONS;
-SC_END
-
-SC_BEGIN CONTENT_ADMIN_BUTTON
-global $CONTENT_ADMIN_BUTTON;
-return $CONTENT_ADMIN_BUTTON;
-SC_END
-
-SC_BEGIN CONTENT_ADMIN_SPACER
-global $CONTENT_ADMIN_SPACER;
-return ($parm==true || $CONTENT_ADMIN_SPACER ? " " : "");
-SC_END
-
-SC_BEGIN CONTENT_ADMIN_FORM_TARGET
-global $CONTENT_ADMIN_FORM_TARGET;
-return $CONTENT_ADMIN_FORM_TARGET;
-SC_END
-
-SC_BEGIN CONTENT_ADMIN_ORDER_SELECT
-global $CONTENT_ADMIN_ORDER_SELECT;
-return $CONTENT_ADMIN_ORDER_SELECT;
-SC_END
-
-SC_BEGIN CONTENT_ADMIN_ORDER_UPDOWN
-global $CONTENT_ADMIN_ORDER_UPDOWN;
-return $CONTENT_ADMIN_ORDER_UPDOWN;
-SC_END
-
-SC_BEGIN CONTENT_ADMIN_ORDER_AMOUNT
-global $CONTENT_ADMIN_ORDER_AMOUNT;
-return $CONTENT_ADMIN_ORDER_AMOUNT;
-SC_END
-
-SC_BEGIN CONTENT_ADMIN_ORDER_CAT
-global $CONTENT_ADMIN_ORDER_CAT;
-return $CONTENT_ADMIN_ORDER_CAT;
-SC_END
-
-SC_BEGIN CONTENT_ADMIN_ORDER_CATALL
-global $CONTENT_ADMIN_ORDER_CATALL;
-return $CONTENT_ADMIN_ORDER_CATALL;
-SC_END
-
-SC_BEGIN CONTENT_ADMIN_LETTERINDEX
-global $CONTENT_ADMIN_LETTERINDEX;
-return $CONTENT_ADMIN_LETTERINDEX;
-SC_END
-
-//##### CONTENT CATEGORY CREATE FORM -------------------------
-
-SC_BEGIN CATFORM_CATEGORY
-global $CATFORM_CATEGORY;
-return $CATFORM_CATEGORY;
-SC_END
-
-SC_BEGIN CATFORM_HEADING
-global $row, $rs;
-return $rs -> form_text("cat_heading", 90, $row['content_heading'], 250);
-SC_END
-
-SC_BEGIN CATFORM_SUBHEADING
-global $row, $rs, $show;
-if($show['subheading']===true){
- return $rs -> form_text("cat_subheading", 90, $row['content_subheading'], 250);
-}
-SC_END
-
-SC_BEGIN CATFORM_TEXT
-global $row, $rs, $show, $pref;
-require_once(e_HANDLER."ren_help.php");
-$insertjs = (!$pref['wysiwyg'] ? "onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'" : "");
-$text = $rs -> form_textarea("cat_text", 80, 20, $row['content_text'], $insertjs)." ";
-if (!$pref['wysiwyg']) { $text .= $rs -> form_text("helpb", 90, '', '', "helpbox")." ". display_help("helpb"); }
-return $text;
-SC_END
-
-SC_BEGIN CATFORM_DATESTART
-global $row, $rs, $show, $months, $ne_day, $ne_month, $ne_year, $current_year;
-if($show['startdate']===true){
- $text = "
- ".$rs -> form_select_open("ne_day")."
- ".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_12, 0, "none");
- for($count=1; $count<=31; $count++){
- $text .= $rs -> form_option($count, ($ne_day == $count ? "1" : "0"), $count);
- }
- $text .= $rs -> form_select_close()."
- ".$rs -> form_select_open("ne_month")."
- ".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_13, 0, "none");
- for($count=1; $count<=12; $count++){
- $text .= $rs -> form_option($months[($count-1)], ($ne_month == $count ? "1" : "0"), $count);
- }
- $text .= $rs -> form_select_close()."
- ".$rs -> form_select_open("ne_year")."
- ".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_14, 0, "none");
- for($count=($current_year-5); $count<=$current_year; $count++){
- $text .= $rs -> form_option($count, ($ne_year == $count ? "1" : "0"), $count);
- }
- $text .= $rs -> form_select_close();
- return $text;
-}
-SC_END
-
-SC_BEGIN CATFORM_DATEEND
-global $row, $rs, $show, $months, $end_day, $end_month, $end_year, $current_year;
-if($show['enddate']===true){
- $text = "
- ".$rs -> form_select_open("end_day")."
- ".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_12, 1, "none");
- for($count=1; $count<=31; $count++){
- $text .= $rs -> form_option($count, ($end_day == $count ? "1" : "0"), $count);
- }
- $text .= $rs -> form_select_close()."
- ".$rs -> form_select_open("end_month")."
- ".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_13, 1, "none");
- for($count=1; $count<=12; $count++){
- $text .= $rs -> form_option($months[($count-1)], ($end_month == $count ? "1" : "0"), $count);
- }
- $text .= $rs -> form_select_close()."
- ".$rs -> form_select_open("end_year")."
- ".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_14, 1, "none");
- for($count=($current_year-5); $count<=$current_year; $count++){
- $text .= $rs -> form_option($count, ($end_year == $count ? "1" : "0"), $count);
- }
- $text .= $rs -> form_select_close();
- return $text;
-}
-SC_END
-
-SC_BEGIN CATFORM_UPLOAD
-global $row, $show, $content_pref;
-if($show['uploadicon']===true){
- $text='';
- if(!FILE_UPLOADS){
- $text = "".CONTENT_ADMIN_ITEM_LAN_21." ";
- }else{
- if(!is_writable($content_pref['content_cat_icon_path_large'])){
- $text = "".CONTENT_ADMIN_ITEM_LAN_22." ".$content_pref['content_cat_icon_path_large']." ".CONTENT_ADMIN_ITEM_LAN_23." ";
- }
- $text .= CONTENT_ADMIN_CAT_LAN_62."
-
-
-
- ";
- }
- return $text;
-}
-SC_END
-
-SC_BEGIN CATFORM_ICON
-global $row, $rs, $show, $fl, $content_pref;
-if($show['selecticon']===true){
- $rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*');
- $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')\"")."
- ";
- foreach($iconlist as $icon){
- $text .= "
";
- }
- $text .= "
";
- return $text;
-}
-SC_END
-
-SC_BEGIN CATFORM_COMMENT
-global $row, $rs, $show;
-if($show['comment']===true){
- return $rs -> form_radio("cat_comment", "1", ($row['content_comment'] ? "1" : "0"), "", "").CONTENT_ADMIN_ITEM_LAN_85." ".$rs -> form_radio("cat_comment", "0", ($row['content_comment'] ? "0" : "1"), "", "").CONTENT_ADMIN_ITEM_LAN_86;
-}
-SC_END
-
-SC_BEGIN CATFORM_RATING
-global $row, $rs, $show;
-if($show['rating']===true){
- return $rs -> form_radio("cat_rate", "1", ($row['content_rate'] ? "1" : "0"), "", "").CONTENT_ADMIN_ITEM_LAN_85." ".$rs -> form_radio("cat_rate", "0", ($row['content_rate'] ? "0" : "1"), "", "").CONTENT_ADMIN_ITEM_LAN_86;
-}
-SC_END
-
-SC_BEGIN CATFORM_PEICON
-global $row, $rs, $show;
-if($show['pe']===true){
- return $rs -> form_radio("cat_pe", "1", ($row['content_pe'] ? "1" : "0"), "", "").CONTENT_ADMIN_ITEM_LAN_85." ".$rs -> form_radio("cat_pe", "0", ($row['content_pe'] ? "0" : "1"), "", "").CONTENT_ADMIN_ITEM_LAN_86;
-}
-SC_END
-
-SC_BEGIN CATFORM_VISIBILITY
-global $row, $show;
-if($show['visibility']===true){
- return r_userclass("cat_class",$row['content_class'], "CLASSES");
-}
-SC_END
-
-//##### CONTENT CREATE FORM -------------------------
-
-SC_BEGIN CONTENTFORM_CATEGORYSELECT
-global $CONTENTFORM_CATEGORYSELECT;
-return $CONTENTFORM_CATEGORYSELECT;
-SC_END
-
-SC_BEGIN CONTENTFORM_CATEGORY
-global $CONTENTFORM_CATEGORY;
-return $CONTENTFORM_CATEGORY;
-SC_END
-
-SC_BEGIN CONTENTFORM_HEADING
-global $row, $rs;
-return $rs -> form_text("content_heading", 74, $row['content_heading'], 250);
-SC_END
-
-SC_BEGIN CONTENTFORM_SUBHEADING
-global $row, $rs, $show;
-if($show['subheading']===true){
- return $rs -> form_text("content_subheading", 74, $row['content_subheading'], 250);
-}
-SC_END
-
-SC_BEGIN CONTENTFORM_SUMMARY
-global $row, $rs, $show;
-if($show['summary']===true){
- return $rs -> form_textarea("content_summary", 74, 5, $row['content_summary']);
-}
-SC_END
-
-SC_BEGIN CONTENTFORM_TEXT
-global $row, $rs, $tp, $show, $pref;
-if(e_WYSIWYG){
- $row['content_text'] = $tp->replaceConstants($row['content_text'], true);
-}
-require_once(e_HANDLER."ren_help.php");
-$insertjs = (!e_WYSIWYG) ? "onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'": "";
-$text = $rs -> form_textarea("content_text", 74, 20, $row['content_text'], $insertjs)." ";
-if (!$pref['wysiwyg']) { $text .= $rs -> form_text("helpb", 90, '', '', "helpbox")." ".display_help("helpb"); }
-return $text;
-SC_END
-
-SC_BEGIN CONTENTFORM_AUTHOR
-global $row, $rs, $show, $content_author_name_value, $content_author_name_js, $content_author_email_value, $content_author_email_js, $content_author_id;
-$text = "
-
-".CONTENT_ADMIN_ITEM_LAN_14." ".$rs -> form_text("content_author_name", 70, $content_author_name_value, 100, "tbox", "", "", $content_author_name_js )."
-".CONTENT_ADMIN_ITEM_LAN_15." ".$rs -> form_text("content_author_email", 70, $content_author_email_value, 100, "tbox", "", "", $content_author_email_js )."
-".$rs -> form_hidden("content_author_id", $content_author_id)."
-
";
-return $text;
-SC_END
-
-SC_BEGIN CONTENTFORM_DATESTART
-global $row, $rs, $show, $startdate, $cal, $content_pref;
-if($show['startdate']===true)
-{
- unset($cal_options);
- unset($cal_attrib);
- $cal_options['firstDay'] = 1; // pierwszy dzien tygodnia -> first day of the week
- $cal_options['showsTime'] = varset($content_pref['content_allow_display_times'], false); //pokazac czas -> show time
- $cal_options['showOthers'] = false;
- $cal_options['weekNumbers'] = true;
- $cal_options['ifFormat'] = "%Y-%m-%d %H:%M";//opcje strftime() -> option strftime()
- $cal_attrib['class'] = "tbox";
- $cal_attrib['name'] = 'startdate';
- $cal_attrib['value'] = $startdate;
- $cal_attrib['size'] = 25;
- $text = $cal->make_input_field($cal_options, $cal_attrib);
- return $text;
-}
-SC_END
-
-SC_BEGIN CONTENTFORM_DATEEND
-global $row, $rs, $show, $enddate, $cal, $content_pref;
-if($show['enddate']===true)
-{
- unset($cal_options);
- unset($cal_attrib);
- $cal_options['firstDay'] = 1; // pierwszy dzien tygodnia -> first day of the week
- $cal_options['showsTime'] = varset($content_pref['content_allow_display_times'], false); //pokazac czas -> show time
- $cal_options['showOthers'] = false;
- $cal_options['weekNumbers'] = true;
- $cal_options['ifFormat'] = "%Y-%m-%d %H:%M";//opcje strftime() -> option strftime()
- $cal_attrib['class'] = "tbox";
- $cal_attrib['name'] = 'enddate';
- $cal_attrib['value'] = $enddate;
- $cal_attrib['size'] = 25;
- $text = $cal->make_input_field($cal_options, $cal_attrib);
- return $text;
-}
-SC_END
-
-SC_BEGIN CONTENTFORM_UPLOAD
-global $row, $rs, $show, $content_pref;
-if($show['upload']===true){
- $text = "";
- if(!FILE_UPLOADS){
- $text .= "".CONTENT_ADMIN_ITEM_LAN_21." ";
- }else{
- if($show['icon']===true){
- if(!is_writable($content_pref['content_icon_path_tmp'])){
- $text .= "".CONTENT_ADMIN_ITEM_LAN_22." ".$content_pref['content_icon_path_tmp']." ".CONTENT_ADMIN_ITEM_LAN_23." ";
- }
- }
- if($show['attach']===true){
- if(!is_writable($content_pref['content_file_path_tmp'])){
- $text .= "".CONTENT_ADMIN_ITEM_LAN_22." ".$content_pref['content_file_path_tmp']." ".CONTENT_ADMIN_ITEM_LAN_23." ";
- }
- }
- if($show['images']===true){
- if(!is_writable($content_pref['content_image_path_tmp'])){
- $text .= "".CONTENT_ADMIN_ITEM_LAN_22." ".$content_pref['content_image_path_tmp']." ".CONTENT_ADMIN_ITEM_LAN_23." ";
- }
- }
- $text .= "
-
- ".$rs -> form_select_open("uploadtype")."
- ".($show['icon'] ? $rs -> form_option(CONTENT_ADMIN_ITEM_LAN_114, "0", "1") : '')."
- ".($show['attach'] ? $rs -> form_option(CONTENT_ADMIN_ITEM_LAN_115, "0", "2") : '')."
- ".($show['images'] ? $rs -> form_option(CONTENT_ADMIN_ITEM_LAN_116, "0", "3") : '')."
- ".$rs -> form_select_close()."
- ".($show['icon'] ? " " : '')."
- ".($show['attach'] ? " " : '')."
- ".($show['images'] ? " " : '')."
- ";
- }
- $text .= " ";
- return $text;
-}
-SC_END
-
-SC_BEGIN CONTENTFORM_ICON
-global $row, $rs, $show, $iconlist;
-if($show['icon']===true){
- $text = $rs -> form_text("content_icon", 60, $row['content_icon'], 100)."
- ".$rs -> form_button("button", '', CONTENT_ADMIN_ITEM_LAN_105, "onclick=\"expandit('divicon')\"")."
- ";
- if(empty($iconlist)){
- $text .= CONTENT_ADMIN_ITEM_LAN_121;
- }else{
- foreach($iconlist as $icon){
- if(file_exists($icon['path']."thumb_".$icon['fname'])){
- $img = "
";
- }else{
- $img = "
";
- }
- $text .= "
".$img." ";
- }
- }
- $text .= "
";
- return $text;
-}
-SC_END
-
-SC_BEGIN CONTENTFORM_ATTACH
-global $row, $rs, $show, $checkattachnumber, $filelist;
-if($show['attach']===true){
-
- $filetmp = explode("[file]", $row['content_file']);
- foreach($filetmp as $key => $value) {
- if($value == "") {
- unset($filetmp[$key]);
- }
- }
- $attachments = array_values($filetmp);
- for($i=0;$i<$checkattachnumber;$i++){
- $k=$i+1;
- $num = (strlen($k) == 1 ? "0".$k : $k);
- $attachments[$i] = ($attachments[$i] ? $attachments[$i] : "");
-
- //choose file
- $text .= "
-
- ".$num." ".$rs -> form_text("content_files".$i."", 60, $attachments[$i], 100)."
- ".$rs -> form_button("button", '', CONTENT_ADMIN_ITEM_LAN_105, "onclick=\"expandit('divfile".$i."')\"")."
-
";
- if(empty($filelist)){
- $text .= CONTENT_ADMIN_ITEM_LAN_122;
- }else{
- foreach($filelist as $file){
- $text .= CONTENT_ICON_FILE."
".$file['fname']." ";
- }
- }
- $text .= "
";
- }
- return $text;
-}
-SC_END
-
-SC_BEGIN CONTENTFORM_IMAGES
-global $row, $rs, $show, $checkimagesnumber, $imagelist;
-if($show['images']===true){
- $imagestmp = explode("[img]", $row['content_image']);
- foreach($imagestmp as $key => $value) {
- if($value == "") {
- unset($imagestmp[$key]);
- }
- }
- $imagesarray = array_values($imagestmp);
- for($i=0;$i<$checkimagesnumber;$i++){
- $k=$i+1;
- $num = (strlen($k) == 1 ? "0".$k : $k);
- $imagesarray[$i] = ($imagesarray[$i] ? $imagesarray[$i] : "");
-
- //choose image
- $text .= "
-
- ".$num." ".$rs -> form_text("content_images".$i."", 60, $imagesarray[$i], 100)."
- ".$rs -> form_button("button", '', CONTENT_ADMIN_ITEM_LAN_105, "onclick=\"expandit('divimage".$i."')\"")."
-
";
- if(empty($imagelist)){
- $text .= CONTENT_ADMIN_ITEM_LAN_123;
- }else{
- foreach($imagelist as $image){
- if(file_exists($image['path']."thumb_".$image['fname'])){
- $img = "
";
- }else{
- $img = "
";
- }
- $text .= "
".$img." ";
- }
- }
- $text .= "
";
- }
- return $text;
-}
-SC_END
-
-SC_BEGIN CONTENTFORM_COMMENT
-global $row, $rs, $show;
-if($show['comment']===true){
- return $rs -> form_radio("content_comment", "1", ($row['content_comment'] ? "1" : "0"), "", "").CONTENT_ADMIN_ITEM_LAN_85." ".$rs -> form_radio("content_comment", "0", ($row['content_comment'] ? "0" : "1"), "", "").CONTENT_ADMIN_ITEM_LAN_86;
-}
-SC_END
-
-SC_BEGIN CONTENTFORM_RATING
-global $row, $rs, $show;
-if($show['rating']===true){
- return $rs -> form_radio("content_rate", "1", ($row['content_rate'] ? "1" : "0"), "", "").CONTENT_ADMIN_ITEM_LAN_85." ".$rs -> form_radio("content_rate", "0", ($row['content_rate'] ? "0" : "1"), "", "").CONTENT_ADMIN_ITEM_LAN_86;
-}
-SC_END
-
-SC_BEGIN CONTENTFORM_PEICON
-global $row, $rs, $show;
-if($show['pe']===true){
- return $rs -> form_radio("content_pe", "1", ($row['content_pe'] ? "1" : "0"), "", "").CONTENT_ADMIN_ITEM_LAN_85." ".$rs -> form_radio("content_pe", "0", ($row['content_pe'] ? "0" : "1"), "", "").CONTENT_ADMIN_ITEM_LAN_86;
-}
-SC_END
-
-SC_BEGIN CONTENTFORM_VISIBILITY
-global $row, $show;
-if($show['visibility']===true){
- return r_userclass("content_class",$row['content_class'], "CLASSES");
-}
-SC_END
-
-SC_BEGIN CONTENTFORM_SCORE
-global $row, $rs, $show;
-if($show['score']===true){
- $text = $rs -> form_select_open("content_score")."
- ".$rs -> form_option(CONTENT_ADMIN_ITEM_LAN_41, 0, "none");
- for($a=1; $a<=100; $a++){
- $text .= $rs -> form_option($a, ($row['content_score'] == $a ? "1" : "0"), $a);
- }
- $text .= $rs -> form_select_close();
- return $text;
-}
-SC_END
-
-SC_BEGIN CONTENTFORM_META
-global $row, $rs, $show;
-if($show['meta']===true){
- return $rs -> form_text("content_meta", 74, $row['content_meta'], 250);
-}
-SC_END
-
-SC_BEGIN CONTENTFORM_LAYOUT
-global $row, $rs, $show, $tp, $fl, $content_pref;
-if($show['layout']===true){
-
- if(!isset($content_pref["content_theme"])){
- $dir = $plugindir."templates/default";
- }else{
- if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_content_template.php")){
- $dir = $tp->replaceConstants($content_pref["content_theme"]);
- }else{
- $dir = $plugindir."templates/default";
- }
- }
- //get_files($path, $fmask = '', $omit='standard', $recurse_level = 0, $current_level = 0, $dirs_only = FALSE)
- $rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*', '.bak');
- $templatelist = $fl->get_files($dir,"content_content",$rejectlist);
-
- //template
- $check = "";
- if(isset($row['content_layout']) && $row['content_layout'] != ""){
- $check = $row['content_layout'];
- }else{
- if(isset($content_pref["content_layout"])){
- $check = $content_pref["content_layout"];
- }
- }
-
- $text = $rs -> form_select_open("content_layout")."
- ".$rs -> form_option(CONTENT_ADMIN_ITEM_LAN_94, 0, "none");
- foreach($templatelist as $template){
- $templatename = substr($template['fname'], 25, -4);
- $templatename = ($template['fname'] == "content_content_template.php" ? "default" : $templatename);
- $text .= $rs -> form_option($templatename, ($check == $template['fname'] ? "1" : "0"), $template['fname']);
- }
- $text .= $rs -> form_select_close();
- return $text;
-}
-SC_END
-
-SC_BEGIN CONTENTFORM_CUSTOM
-global $CONTENTFORM_CUSTOM;
-return $CONTENTFORM_CUSTOM;
-SC_END
-
-SC_BEGIN CONTENTFORM_CUSTOM_KEY
-global $CONTENTFORM_CUSTOM_KEY;
-return $CONTENTFORM_CUSTOM_KEY;
-SC_END
-
-SC_BEGIN CONTENTFORM_CUSTOM_VALUE
-global $CONTENTFORM_CUSTOM_VALUE;
-return $CONTENTFORM_CUSTOM_VALUE;
-SC_END
-
-SC_BEGIN CONTENTFORM_PRESET
-global $CONTENTFORM_PRESET;
-return $CONTENTFORM_PRESET;
-SC_END
-
-SC_BEGIN CONTENTFORM_PRESET_KEY
-global $CONTENTFORM_PRESET_KEY;
-return $CONTENTFORM_PRESET_KEY;
-SC_END
-
-SC_BEGIN CONTENTFORM_PRESET_VALUE
-global $CONTENTFORM_PRESET_VALUE;
-return $CONTENTFORM_PRESET_VALUE;
-SC_END
-
-// ############################################################################
-// ##### DEPRECATED SHORTCODES ! WILL BE REMOVED AFTER THE NEXT RELEASE -------
-// ############################################################################
-
-SC_BEGIN CONTENT_CONTENTMANAGER_ICONNEW
-global $tp;
-return $tp -> parseTemplate("{CM_ICON|manager_new}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENTMANAGER_ICONEDIT
-global $tp;
-return $tp -> parseTemplate("{CM_ICON|manager_edit}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENTMANAGER_ICONSUBM
-global $tp;
-return $tp -> parseTemplate("{CM_ICON|manager_submit}");
-SC_END
-
-SC_BEGIN CONTENT_TYPE_TABLE_MANAGER_ICON
-global $tp;
-return $tp -> parseTemplate("{CM_ICON|manager_link}");
-SC_END
-
-SC_BEGIN CONTENT_TYPE_TABLE_MANAGER_HEADING
-global $tp;
-return $tp -> parseTemplate("{CM_HEADING|manager_link}");
-SC_END
-
-SC_BEGIN CONTENT_TYPE_TABLE_TOTAL
-global $tp;
-return $tp -> parseTemplate("{CM_AMOUNT|type}");
-SC_END
-
-SC_BEGIN CONTENT_TYPE_TABLE_HEADING
-global $tp;
-return $tp -> parseTemplate("{CM_HEADING|type}");
-SC_END
-
-SC_BEGIN CONTENT_TYPE_TABLE_SUBHEADING
-global $tp;
-return $tp -> parseTemplate("{CM_SUBHEADING|type}");
-SC_END
-
-SC_BEGIN CONTENT_TYPE_TABLE_ICON
-global $tp;
-return $tp -> parseTemplate("{CM_ICON|type}");
-SC_END
-
-SC_BEGIN CONTENT_TOP_TABLE_HEADING
-global $tp;
-return $tp -> parseTemplate("{CM_HEADING|top}");
-SC_END
-
-SC_BEGIN CONTENT_TOP_TABLE_ICON
-global $tp;
-return $tp -> parseTemplate("{CM_ICON|top}");
-SC_END
-
-SC_BEGIN CONTENT_TOP_TABLE_AUTHOR
-global $tp;
-return $tp -> parseTemplate("{CM_AUTHOR|top}");
-SC_END
-
-SC_BEGIN CONTENT_TOP_TABLE_RATING
-global $tp;
-return $tp -> parseTemplate("{CM_RATING|top}");
-SC_END
-
-SC_BEGIN CONTENT_SCORE_TABLE_HEADING
-global $tp;
-return $tp -> parseTemplate("{CM_HEADING|score}");
-SC_END
-
-SC_BEGIN CONTENT_SCORE_TABLE_ICON
-global $tp;
-return $tp -> parseTemplate("{CM_ICON|score}");
-SC_END
-
-SC_BEGIN CONTENT_SCORE_TABLE_AUTHOR
-global $tp;
-return $tp -> parseTemplate("{CM_AUTHOR|score}");
-SC_END
-
-SC_BEGIN CONTENT_SCORE_TABLE_SCORE
-global $tp;
-return $tp -> parseTemplate("{CM_SCORE|score}");
-SC_END
-
-SC_BEGIN CONTENT_AUTHOR_TABLE_TOTAL
-global $tp;
-return $tp -> parseTemplate("{CM_AMOUNT|author}");
-SC_END
-
-SC_BEGIN CONTENT_AUTHOR_TABLE_NAME
-global $tp;
-return $tp -> parseTemplate("{CM_AUTHOR|author}");
-SC_END
-
-SC_BEGIN CONTENT_AUTHOR_TABLE_ICON
-global $tp;
-return $tp -> parseTemplate("{CM_ICON|author}");
-SC_END
-
-SC_BEGIN CONTENT_RECENT_TABLE_ICON
-global $tp;
-return $tp -> parseTemplate("{CM_ICON|recent}");
-SC_END
-
-SC_BEGIN CONTENT_RECENT_TABLE_HEADING
-global $tp;
-return $tp -> parseTemplate("{CM_HEADING|recent}");
-SC_END
-
-SC_BEGIN CONTENT_RECENT_TABLE_SUBHEADING
-global $tp;
-return $tp -> parseTemplate("{CM_SUBHEADING|recent}");
-SC_END
-
-SC_BEGIN CONTENT_RECENT_TABLE_SUMMARY
-global $tp;
-return $tp -> parseTemplate("{CM_SUMMARY|recent}");
-SC_END
-
-SC_BEGIN CONTENT_RECENT_TABLE_TEXT
-global $tp;
-return $tp -> parseTemplate("{CM_TEXT|recent}");
-SC_END
-
-SC_BEGIN CONTENT_RECENT_TABLE_DATE
-global $tp;
-return $tp -> parseTemplate("{CM_DATE|recent}");
-SC_END
-
-SC_BEGIN CONTENT_RECENT_TABLE_EPICONS
-global $tp;
-return $tp -> parseTemplate("{CM_EPICONS|recent}");
-SC_END
-
-SC_BEGIN CONTENT_RECENT_TABLE_AUTHORDETAILS
-global $tp;
-return $tp -> parseTemplate("{CM_AUTHOR|recent}");
-SC_END
-
-SC_BEGIN CONTENT_RECENT_TABLE_EDITICON
-global $tp;
-return $tp -> parseTemplate("{CM_EDITICON|recent}");
-SC_END
-
-SC_BEGIN CONTENT_RECENT_TABLE_REFER
-global $tp;
-return $tp -> parseTemplate("{CM_REFER|recent}");
-SC_END
-
-SC_BEGIN CONTENT_RECENT_TABLE_RATING
-global $tp;
-return $tp -> parseTemplate("{CM_RATING|recent}");
-SC_END
-
-SC_BEGIN CONTENT_RECENT_TABLE_PARENT
-global $tp;
-return $tp -> parseTemplate("{CM_PARENT|recent}");
-SC_END
-
-SC_BEGIN CONTENT_ARCHIVE_TABLE_HEADING
-global $tp;
-return $tp -> parseTemplate("{CM_HEADING|archive}");
-SC_END
-
-SC_BEGIN CONTENT_ARCHIVE_TABLE_DATE
-global $tp;
-return $tp -> parseTemplate("{CM_DATE|archive}");
-SC_END
-
-SC_BEGIN CONTENT_ARCHIVE_TABLE_AUTHOR
-global $tp;
-return $tp -> parseTemplate("{CM_AUTHOR|archive}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_FILE
-global $tp;
-return $tp -> parseTemplate("{CM_FILE|content}");
-SC_END
-
-SC_BEGIN CONTENT_PRINT_IMAGES
-global $tp;
-return $tp -> parseTemplate("{CM_IMAGES|print}");
-SC_END
-
-SC_BEGIN CONTENT_PDF_IMAGES
-global $tp;
-return $tp -> parseTemplate("{CM_IMAGES|pdf}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_IMAGES
-global $tp;
-return $tp -> parseTemplate("{CM_IMAGES|content}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_COMMENT
-global $tp;
-return $tp -> parseTemplate("{CM_COMMENT|content}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_PARENT
-global $tp;
-return $tp -> parseTemplate("{CM_PARENT|content}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_ICON
-global $tp;
-return $tp -> parseTemplate("{CM_ICON|content}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_HEADING
-global $tp;
-return $tp -> parseTemplate("{CM_HEADING|content}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_REFER
-global $tp;
-return $tp -> parseTemplate("{CM_REFER|content}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_SUBHEADING
-global $tp;
-return $tp -> parseTemplate("{CM_SUBHEADING|content}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_DATE
-global $tp;
-return $tp -> parseTemplate("{CM_DATE|content}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_AUTHORDETAILS
-global $tp;
-return $tp -> parseTemplate("{CM_AUTHOR|content}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_EPICONS
-global $tp;
-return $tp -> parseTemplate("{CM_EPICONS|content}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_EDITICON
-global $tp;
-return $tp -> parseTemplate("{CM_EDITICON|content}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_RATING
-global $tp;
-return $tp -> parseTemplate("{CM_RATING|content}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_SCORE
-global $tp;
-return $tp -> parseTemplate("{CM_SCORE|content}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_SUMMARY
-global $tp;
-return $tp -> parseTemplate("{CM_SUMMARY|content}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENT_TABLE_TEXT
-global $tp;
-return $tp -> parseTemplate("{CM_TEXT|content}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_TABLE_ICON
-global $tp;
-return $tp -> parseTemplate("{CM_ICON|cat}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_TABLE_HEADING
-global $tp;
-return $tp -> parseTemplate("{CM_HEADING|cat}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_TABLE_SUBHEADING
-global $tp;
-return $tp -> parseTemplate("{CM_SUBHEADING|cat}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_TABLE_DATE
-global $tp;
-return $tp -> parseTemplate("{CM_DATE|cat}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_TABLE_EPICONS
-global $tp;
-return $tp -> parseTemplate("{CM_EPICONS|cat}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_TABLE_TEXT
-global $tp;
-return $tp -> parseTemplate("{CM_TEXT|cat}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_TABLE_RATING
-global $tp;
-return $tp -> parseTemplate("{CM_RATING|cat}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_LISTSUB_TABLE_ICON
-global $tp;
-return $tp -> parseTemplate("{CM_ICON|catlistsub}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_LISTSUB_TABLE_HEADING
-global $tp;
-return $tp -> parseTemplate("{CM_HEADING|catlistsub}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_LISTSUB_TABLE_SUBHEADING
-global $tp;
-return $tp -> parseTemplate("{CM_SUBHEADING|catlistsub}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_LIST_TABLE_ICON
-global $tp;
-return $tp -> parseTemplate("{CM_ICON|catlist}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_LIST_TABLE_HEADING
-global $tp;
-return $tp -> parseTemplate("{CM_HEADING|catlist}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_LIST_TABLE_SUMMARY
-global $tp;
-return $tp -> parseTemplate("{CM_SUMMARY|catlist}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_LIST_TABLE_TEXT
-global $tp;
-return $tp -> parseTemplate("{CM_TEXT|catlist}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_LIST_TABLE_SUBHEADING
-global $tp;
-return $tp -> parseTemplate("{CM_SUBHEADING|catlist}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_LIST_TABLE_DATE
-global $tp;
-return $tp -> parseTemplate("{CM_DATE|catlist}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_LIST_TABLE_EPICONS
-global $tp;
-return $tp -> parseTemplate("{CM_EPICONS|catlist}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_LIST_TABLE_RATING
-global $tp;
-return $tp -> parseTemplate("{CM_RATING|catlist}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_LIST_TABLE_AUTHORDETAILS
-global $tp;
-return $tp -> parseTemplate("{CM_AUTHOR|catlist}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_TABLE_AUTHORDETAILS
-global $tp;
-return $tp -> parseTemplate("{CM_AUTHOR|cat}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_TABLE_AMOUNT
-global $tp;
-return $tp -> parseTemplate("{CM_AMOUNT|cat}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_LISTSUB_TABLE_AMOUNT
-global $tp;
-return $tp -> parseTemplate("{CM_AMOUNT|catlistsub}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_LIST_TABLE_AMOUNT
-global $tp;
-return $tp -> parseTemplate("{CM_AMOUNT|catlist}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_TABLE_COMMENT
-global $tp;
-return $tp -> parseTemplate("{CM_COMMENT|cat}");
-SC_END
-
-SC_BEGIN CONTENT_CAT_LIST_TABLE_COMMENT
-global $tp;
-return $tp -> parseTemplate("{CM_COMMENT|catlist}");
-SC_END
-
-SC_BEGIN CONTENT_SEARCHRESULT_TABLE_ICON
-global $tp;
-return $tp -> parseTemplate("{CM_ICON|searchresult}");
-SC_END
-
-SC_BEGIN CONTENT_SEARCHRESULT_TABLE_HEADING
-global $tp;
-return $tp -> parseTemplate("{CM_HEADING|searchresult}");
-SC_END
-
-SC_BEGIN CONTENT_SEARCHRESULT_TABLE_SUBHEADING
-global $tp;
-return $tp -> parseTemplate("{CM_SUBHEADING|searchresult}");
-SC_END
-
-SC_BEGIN CONTENT_SEARCHRESULT_TABLE_DATE
-global $tp;
-return $tp -> parseTemplate("{CM_DATE|searchresult}");
-SC_END
-
-SC_BEGIN CONTENT_SEARCHRESULT_TABLE_TEXT
-global $tp;
-return $tp -> parseTemplate("{CM_TEXT|searchresult}");
-SC_END
-
-SC_BEGIN CONTENT_SEARCHRESULT_TABLE_AUTHORDETAILS
-global $tp;
-return $tp -> parseTemplate("{CM_AUTHOR|searchresult}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENTMANAGER_CATEGORY
-global $tp;
-return $tp -> parseTemplate("{CM_HEADING|manager}");
-SC_END
-
-SC_BEGIN CONTENT_CONTENTMANAGER_CATEGORY_SUBHEADING
-global $tp;
-return $tp -> parseTemplate("{CM_SUBHEADING|manager}");
-SC_END
-
-*/
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/content_sql.php b/e107_plugins/content/content_sql.php
deleted file mode 100644
index 09ee7586e..000000000
--- a/e107_plugins/content/content_sql.php
+++ /dev/null
@@ -1,59 +0,0 @@
-
-# Table structure for table `content`
-#
-
-CREATE TABLE pcontent (
- content_id int(10) unsigned NOT NULL auto_increment,
- content_heading varchar(255) NOT NULL default '',
- content_subheading varchar(255) NOT NULL default '',
- content_summary text NOT NULL,
- content_text longtext NOT NULL,
- content_author varchar(255) NOT NULL default '',
- content_icon varchar(255) NOT NULL default '',
- content_file text NOT NULL,
- content_image text NOT NULL,
- content_parent varchar(50) NOT NULL default '',
- content_comment tinyint(1) unsigned NOT NULL default '0',
- content_rate tinyint(1) unsigned NOT NULL default '0',
- content_pe tinyint(1) unsigned NOT NULL default '0',
- content_refer text NOT NULL,
- content_datestamp int(10) unsigned NOT NULL default '0',
- content_enddate int(10) unsigned NOT NULL default '0',
- content_class varchar(255) NOT NULL default '',
- content_pref text NOT NULL,
- content_order varchar(10) NOT NULL default '0',
- content_score tinyint(3) unsigned NOT NULL default '0',
- content_meta text NOT NULL,
- content_layout varchar(255) NOT NULL default '',
- PRIMARY KEY (content_id),
- KEY content_parent (content_parent)
-) ENGINE=MyISAM;
-# --------------------------------------------------------
-
diff --git a/e107_plugins/content/e_comment.php b/e107_plugins/content/e_comment.php
deleted file mode 100644
index 0e84a55b5..000000000
--- a/e107_plugins/content/e_comment.php
+++ /dev/null
@@ -1,31 +0,0 @@
-".time().") AND c.content_class REGEXP '".e_CLASS_REGEXP."' ";
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/e_emailprint.php b/e107_plugins/content/e_emailprint.php
deleted file mode 100644
index bdd054dda..000000000
--- a/e107_plugins/content/e_emailprint.php
+++ /dev/null
@@ -1,169 +0,0 @@
- db_Select($plugintable, "content_id, content_heading, content_subheading, content_text, content_author, content_image, content_parent, content_datestamp, content_class", "content_id='".intval($id)."' ");
- $row = $sql -> db_Fetch();
-
- if(!check_class($row['content_class'])){
- header("location:".e_PLUGIN."content/content.php"); exit;
- }
- $row['content_heading'] = $tp -> toHTML($row['content_heading']);
- $row['content_subheading'] = $tp -> toHTML($row['content_subheading']);
- $row['content_text'] = $tp -> replaceConstants($row['content_text']);
- $row['content_text'] = preg_replace("/\{EMAILPRINT\}|\[newpage(?:\=.*?){0,1}\]/", "", $tp -> toHTML($row['content_text'], TRUE));
- $authordetails = $aa -> getAuthor($row['content_author']);
- $row['content_datestamp'] = $con -> convert_date($row['content_datestamp'], "long");
-
- $mainparent = $aa -> getMainParent($id);
- $content_pref = $aa -> getContentPref($mainparent, true);
- $img = $tp -> parseTemplate('{CM_IMAGES|print}', FALSE, $content_shortcodes);
-
- $text = "
- ".$row['content_heading']."
-
- ".$row['content_subheading']."
-
- ".$authordetails[1].", ".$row['content_datestamp']."
-
- ".$img."
- ".$row['content_text']."
-
- ".CONTENT_EMAILPRINT_LAN_1." ".SITENAME."
-
- ( ".SITEURLBASE.e_PLUGIN_ABS."content/content.php?content.".$row['content_id']." )
- ";
-
- require_once(e_HANDLER.'bbcode_handler.php');
- $e_bb = new e_bbcode;
- $text = $e_bb->parseBBCodes($text, '');
-
- return $text;
-}
-
-function email_item($id)
-{
- $plugintable = "pcontent";
- if(!is_object($sql)){ $sql = new db; }
- if($sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_text, content_author, content_parent, content_datestamp, content_class", "content_id='".intval($id)."' ")){
- while($row = $sql -> db_Fetch()){
- $tmp = explode(".",$row['content_parent']);
- if(!check_class($row['content_class'])){
- header("location:".e_PLUGIN."content/content.php"); exit;
- }
- $message = SITEURL.e_PLUGIN."content/content.php?content.".$id."\n\n".$row['content_heading']."\n".$row['content_subheading']."\n";
- }
- return $message;
- }
-}
-
-
-function print_item_pdf($id)
-{
- global $tp, $pref, $content_shortcodes;
- global $CONTENT_PRINT_IMAGES, $row, $content_image_path, $content_pref, $mainparent, $eArrayStorage;
-
- //in this section you decide what to needs to be output to the pdf file
- $con = new convert;
-
- require_once(e_PLUGIN."content/content_shortcodes.php");
-
- require_once(e_PLUGIN."content/handlers/content_class.php");
- $aa = new content;
-
- if(!is_object($sql)){ $sql = new db; }
- $sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_text, content_image, content_author, content_parent, content_datestamp, content_class, content_pref", "content_id='".intval($id)."' ");
- $row = $sql -> db_Fetch();
-
- if(!check_class($row['content_class'])){
- header("location:".e_PLUGIN."content/content.php"); exit;
- }
- $authordetails = $aa -> getAuthor($row['content_author']);
- $row['content_datestamp'] = $con -> convert_date($row['content_datestamp'], "long");
-
- $mainparent = $aa -> getMainParent(intval($id));
- $content_pref = $aa -> getContentPref($mainparent, true);
- $img = $tp -> parseTemplate('{CM_IMAGES|pdf}', FALSE, $content_shortcodes);
-
- //add custom and preset tags if present
- $custom = $eArrayStorage->ReadArray($row['content_pref']);
- $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);
-
- $CONTENT_CONTENT_TABLE_CUSTOM_TAGS = "";
- if(!empty($custom)){
- foreach($custom as $k => $v){
- if($k == "content_custom_presettags"){
- if(isset($content_pref["content_content_presettags"]) && $content_pref["content_content_presettags"]){
- foreach($v as $ck => $cv){
- if(is_array($cv)){ //date
- if(!($cv['day']=="" && $cv['month']=="" && $cv['year']=="")){
- $vv = $cv['day']." ".$months[($cv['month']-1)]." ".$cv['year'];
- }
- }else{
- $vv = $cv;
- }
- if( isset($ck) && $ck != "" && isset($vv) && $vv!="" ){
- $CUSTOM_TAGS = TRUE;
- $CONTENT_CONTENT_TABLE_CUSTOM_KEY = $tp->toHTML($ck, true);
- $CONTENT_CONTENT_TABLE_CUSTOM_VALUE = $tp->toHTML($vv, true);
- $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= $CONTENT_CONTENT_TABLE_CUSTOM_KEY." : ".$CONTENT_CONTENT_TABLE_CUSTOM_VALUE." ";
- }
- }
- }
- }else{
- if(isset($content_pref["content_content_customtags"]) && $content_pref["content_content_customtags"]){
- $key = substr($k,15);
- if( isset($key) && $key != "" && isset($v) && $v!="" ){
- $CUSTOM_TAGS = TRUE;
- $CONTENT_CONTENT_TABLE_CUSTOM_KEY = $tp->toHTML($key, true);
- $CONTENT_CONTENT_TABLE_CUSTOM_VALUE = $tp->toHTML($v, true);
- $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= $CONTENT_CONTENT_TABLE_CUSTOM_KEY." : ".$CONTENT_CONTENT_TABLE_CUSTOM_VALUE." ";
- }
- }
- }
- }
- }
-
- $text = "
- ".$row['content_heading']."
- ".$row['content_subheading']."
- ".$authordetails[1].", ".$row['content_datestamp']."
-
- ".$row['content_text']."
- ".($CONTENT_CONTENT_TABLE_CUSTOM_TAGS ? $CONTENT_CONTENT_TABLE_CUSTOM_TAGS : "")."
- ".$img."
- ";
-
- //the following defines are processed in the document properties of the pdf file
-
- //Do NOT add parser function to the variables, leave them as raw data !
- //as the pdf methods will handle this !
- $text = $text; //define text
- $creator = SITENAME; //define creator
- $author = $authordetails[1]; //define author
- $title = $row['content_heading']; //define title
- $subject = $row['content_subheading']; //define subject
- $keywords = ""; //define keywords
-
- //define url to use in the header of the pdf file
- $url = SITEURLBASE.e_PLUGIN_ABS."content/content.php?content.".$row['content_id'];
-
- //always return an array with the following data:
- return array($text, $creator, $author, $title, $subject, $keywords, $url);
-}
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/e_frontpage.php b/e107_plugins/content/e_frontpage.php
deleted file mode 100644
index dddb7e321..000000000
--- a/e107_plugins/content/e_frontpage.php
+++ /dev/null
@@ -1,20 +0,0 @@
- db_Select("pcontent", "content_id, content_heading", "LEFT(content_parent,1)='0'")) {
- while ($row = $sql2 -> db_Fetch()) {
- $front_page['content_'.$row['content_id']]['title'] = CONT_FP_1.': '.$row['content_heading'];
- $front_page['content_'.$row['content_id']]['page'][] = array('page' => $PLUGINS_DIRECTORY.'content/content.php?recent.'.$row['content_id'], 'title' => $row['content_heading'].' '.CONT_FP_2);
- if ($sql -> db_Select("pcontent", "content_id, content_heading", "content_parent = '".$row['content_id']."' ORDER BY content_heading")){
- while ($row2 = $sql -> db_Fetch()) {
- $front_page['content_'.$row['content_id']]['page'][] = array('page' => $PLUGINS_DIRECTORY.'content/content.php?content.'.$row2['content_id'], 'title' => $row2['content_heading']);
- }
- }
- }
-}
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/e_help.php b/e107_plugins/content/e_help.php
deleted file mode 100644
index fe907ab44..000000000
--- a/e107_plugins/content/e_help.php
+++ /dev/null
@@ -1,100 +0,0 @@
-".CONTENT_ADMIN_HELP_OPTION_DIV_1."
- ".CONTENT_ADMIN_HELP_OPTION_DIV_3."
-
- ".CONTENT_ADMIN_HELP_OPTION_DIV_7."
- ".CONTENT_ADMIN_HELP_OPTION_DIV_8."
- ".CONTENT_ADMIN_HELP_OPTION_DIV_9."
- ".CONTENT_ADMIN_HELP_OPTION_DIV_10."
- ".CONTENT_ADMIN_HELP_OPTION_DIV_11."
- ".CONTENT_ADMIN_HELP_OPTION_DIV_12."
- ".CONTENT_ADMIN_HELP_OPTION_DIV_13."
";
-
-
- //##### MANAGER --------------------------------------------------
- //content manager : choose category
- }elseif($qs[0] == "manager" && !isset($qs[1]) ){
- $text = CONTENT_ADMIN_HELP_MANAGER_1;
-
- //content manager : view contentmanager
- }elseif($qs[0] == "manager" && isset($qs[1]) && (is_numeric($qs[1]) || $qs[1]=='default') ){
- $text = CONTENT_ADMIN_HELP_MANAGER_2;
-
- //##### CATEGORY --------------------------------------------------
- //overview all categories
- }elseif($qs[0] == "cat" && !isset($qs[1]) ){
- $text = CONTENT_ADMIN_HELP_CAT_1;
-
- //create category
- }elseif($qs[0] == "cat" && $qs[1] == "create" ){
- $text = CONTENT_ADMIN_HELP_CAT_2;
-
- //edit category
- }elseif($qs[0] == "cat" && $qs[1] == "edit" && is_numeric($qs[2]) ){
- $text = CONTENT_ADMIN_HELP_CAT_3;
- }
-}
-$ns -> tablerender(CONTENT_ADMIN_HELP_1, $text);
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/e_latest.php b/e107_plugins/content/e_latest.php
deleted file mode 100644
index 100983a96..000000000
--- a/e107_plugins/content/e_latest.php
+++ /dev/null
@@ -1,21 +0,0 @@
- db_Count($plugintable, '(*)', "WHERE content_refer='sa' ");
-$text .= "
-";
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/e_list.php b/e107_plugins/content/e_list.php
deleted file mode 100644
index 1b14b1d7b..000000000
--- a/e107_plugins/content/e_list.php
+++ /dev/null
@@ -1,125 +0,0 @@
-db_Select_gen("SELECT * FROM plugin WHERE plugin_path = 'content' AND plugin_installflag = '1' "))
-{
- return;
-}
-
-require_once(e_PLUGIN."content/handlers/content_class.php");
-$aa = new content;
-
-$datequery = " AND content_datestamp < ".time()." AND (content_enddate=0 || content_enddate>".time().") ";
-
-global $contentmode;
-//contentmode : content_144 (content_ + idvalue)
-$headingquery = ($contentmode ? " AND content_id = '".substr($contentmode,8)."' " : '');
-
-//get main parent types
-$sqlm = new db;
-if(!$mainparents = $sqlm->db_Select_gen("SELECT content_id, content_heading FROM #pcontent WHERE content_class REGEXP '".e_CLASS_REGEXP."' AND content_parent = '0' ".$datequery." ".$headingquery." ORDER BY content_heading"))
-{
- $LIST_DATA = CONTENT_E_LIST_LAN_1;
-}
-else
-{
- while($rowm = $sqlm->db_Fetch())
- {
- $ICON = "";
- $HEADING = "";
- $AUTHOR = "";
- $CATEGORY = "";
- $DATE = "";
- $INFO = "";
- $LIST_CAPTION = $rowm['content_heading'];
-
- //global var for this main parent
- $mainparent = $rowm['content_id'];
-
- //get path variables
- $content_recent_pref = $aa->getContentPref($mainparent, true);
-
- //prepare query string
- $array = $aa->getCategoryTree("", $mainparent, TRUE);
- $validparent = implode(",", array_keys($array));
- $qry = "content_refer !='sa' AND content_parent REGEXP '".$aa->CONTENTREGEXP($validparent)."' AND content_class REGEXP '".e_CLASS_REGEXP."' ";
-
- //check so only the preferences from the correct content_type (article, content, review etc) are used and rendered
- if(substr($contentmode,8) == $rowm['content_id'])
- {
- if($mode == "new_page" || $mode == "new_menu" )
- {
- $lvisit = $this->getlvisit();
- $qry = $qry." AND content_datestamp>".$lvisit;
- }
- else
- {
- $qry = $qry." ".$datequery;
- }
- $qry .= " ORDER BY content_datestamp DESC LIMIT 0,".intval($arr[7]);
-
- //get recent content for each main parent
- $sqli = new db;
- if(!$resultitem = $sqli->db_Select_gen("SELECT content_id, content_heading, content_parent, content_datestamp, content_icon, content_author FROM #pcontent WHERE ".$qry))
- {
- $LIST_DATA = LIST_LAN_1." ".$rowm['content_heading'];
- }
- else
- {
- $LIST_DISPLAYSTYLE = ($arr[2] ? "" : "none");
- while($rowi = $sqli->db_Fetch())
- {
- $rowheading = $this->parse_heading($rowi['content_heading'], $mode);
- $HEADING = "".$rowheading." ";
- //category
- if($arr[4])
- {
- $crumb = "";
- if(array_key_exists($rowi['content_parent'], $array))
- {
- $newarr = $array[$rowi['content_parent']];
- $newarr = array_reverse($newarr);
- $CATEGORY = "".$newarr[0]." ";
- }
- }
-
- $DATE = ($arr[5] ? $this->getListDate($rowi['content_datestamp'], $mode) : "");
-
- $image_link_append = "";
- if($rowi['content_icon'] && file_exists($content_recent_pref["content_icon_path"].$rowi['content_icon']))
- {
- $ICON = $image_link_append." ";
- }
- else
- {
- $ICON = "";
- }
-
- //get author details
- if($arr[3])
- {
- $authordetails = $aa->getAuthor($rowi['content_author']);
- if(USER && is_numeric($authordetails[0]) && $authordetails[0] != "0")
- {
- $AUTHOR = "".$authordetails[1]." ";
- }
- else
- {
- $AUTHOR = $authordetails[1];
- }
- }
- else
- {
- $AUTHOR = "";
- }
- $INFO = "";
-
- $LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO );
- }
- }
- }
- }
-}
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/e_meta.php b/e107_plugins/content/e_meta.php
deleted file mode 100644
index be4145f8d..000000000
--- a/e107_plugins/content/e_meta.php
+++ /dev/null
@@ -1,53 +0,0 @@
-\n";
-
-if(e_QUERY){
- $qs = explode(".", e_QUERY);
-
- if(is_numeric($qs[0])){
- $from = array_shift($qs);
- }else{
- $from = "0";
- }
-}
-if(isset($qs[0]) && $qs[0] == "content" && isset($qs[1]) && is_numeric($qs[1]) ){
- $add_meta_keywords = '';
- //meta keywords from content item
- if($sql -> db_Select('pcontent', "content_meta", "content_id='".intval($qs[1])."'")){
- list($row['content_meta']) = $sql -> db_Fetch();
- $exmeta = $row['content_meta'];
- if($exmeta != ""){
- $exmeta = str_replace(", ", ",", $exmeta);
- $exmeta = str_replace(" ", ",", $exmeta);
- $exmeta = str_replace(",", ", ", $exmeta);
- $add_meta_keywords = $exmeta;
- }
- }
- if($add_meta_keywords){
- define("META_MERGE", TRUE);
- define("META_KEYWORDS", " ".$add_meta_keywords);
- }
-}
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/e_notify.php b/e107_plugins/content/e_notify.php
deleted file mode 100644
index 909a319c3..000000000
--- a/e107_plugins/content/e_notify.php
+++ /dev/null
@@ -1,32 +0,0 @@
- CONTENT_NOTIFY_LAN_2);
-
-if (!function_exists('notify_content')) {
- function notify_content($data) {
- global $nt;
- foreach ($data as $key => $value) {
- $message .= $key.': '.$value.' ';
- }
- $nt -> send('content', CONTENT_NOTIFY_LAN_3, $message);
- }
-}
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/e_rss.php b/e107_plugins/content/e_rss.php
deleted file mode 100644
index b6201dac9..000000000
--- a/e107_plugins/content/e_rss.php
+++ /dev/null
@@ -1,74 +0,0 @@
-$v){
- $eplug_rss_feed[] = $v;
-}
-
-function get_rss(){
- global $aa;
-
- require_once(e_PLUGIN."content/handlers/content_class.php");
- $aa = new content;
- $rss = array();
- $array = $aa -> getCategoryTree('', '', FALSE);
- foreach($array as $k=>$v){
- $name = '';
- for($i=0;$i ";
- $i++;
- }
- $name = substr($name,0,-3);
- $feed['name'] = $name;
- $feed['url'] = 'content'; //the identifier for the rss feed url
- $feed['topic_id'] = $k; //the topic_id, empty on default (to select a certain category)
- $feed['path'] = 'content'; //this is the plugin path location
- $feed['text'] = 'this is the rss feed for content category : '.$name;
- $feed['class'] = '0';
- $feed['limit'] = '9';
- $rss[] = $feed;
- }
- return $rss;
-}
-//##### ------------------------------------------------------------------------------------
-
-
-//##### create rss data, return as array $eplug_rss_data -----------------------------------
-$mainparent = $aa -> getMainParent($this->topicid);
-$content_pref = $aa -> getContentPref($mainparent);
-$array = $aa -> getCategoryTree("", $mainparent, TRUE);
-$datequery = " AND content_datestamp < ".time()." AND (content_enddate=0 || content_enddate>".time().") ";
-$qry = " content_refer !='sa' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' AND content_parent = '".$this->topicid."' ORDER BY content_datestamp DESC LIMIT 0,".$this -> limit;
-
-$rss = array();
-$sqlrss = new db;
-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);
- $author = $aa -> getAuthor($rowrss['content_author']);
- $rss[$i]['author'] = $author[1];
- $rss[$i]['author_email'] = $author[2];
- $rss[$i]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."content/content.php?content.".$rowrss['content_id'];
- $rss[$i]['linkid'] = $rowrss['content_id'];
- $rss[$i]['title'] = $rowrss['content_heading'];
- $rss[$i]['description'] = $rowrss['content_subheading'];
- $rss[$i]['category_name'] = $array[$rowrss['content_parent']][count($array[$rowrss['content_parent']])-1];
- $rss[$i]['category_link'] = $e107->base_path.$PLUGINS_DIRECTORY."content/content.php?cat.".$rowrss['content_parent'];
- $rss[$i]['datestamp'] = $rowrss['content_datestamp'];
- $rss[$i]['enc_url'] = "";
- $rss[$i]['enc_leng'] = "";
- $rss[$i]['enc_type'] = "";
- $i++;
- }
-}
-$eplug_rss_data[] = $rss;
-//##### ------------------------------------------------------------------------------------
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/e_search.php b/e107_plugins/content/e_search.php
deleted file mode 100644
index 46788d1b6..000000000
--- a/e107_plugins/content/e_search.php
+++ /dev/null
@@ -1,8 +0,0 @@
- e_PLUGIN.'content/search/search_parser.php', 'qtype' => CONT_SCH_LAN_1, 'refpage' => 'content.php', 'advanced' => e_PLUGIN.'content/search/search_advanced.php');
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/e_status.php b/e107_plugins/content/e_status.php
deleted file mode 100644
index 66a1a5848..000000000
--- a/e107_plugins/content/e_status.php
+++ /dev/null
@@ -1,20 +0,0 @@
- db_Count("pcontent", "(*)", "WHERE LEFT(content_parent,1) != '0' AND content_refer != 'sa'");
-if($total == 0){
-$text .= " ".CONTENT_STATUS_LAN_1." ".$total."
";
-}else{
-$text .= "";
-}
-$maincat = $sql -> db_Select("pcontent", "content_id, content_heading", "LEFT(content_parent,1) = '0' ORDER BY content_heading");
-$text .= "";
-while($row = $sql -> db_Fetch()){
- $count = $sql2 -> db_Count("pcontent", "(*)", "WHERE content_parent = '".$row['content_id']."' AND content_refer != 'sa' ");
- $text .= "
".$row['content_heading'].": ".$count."
";
-}
-$text .= "
";
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/e_tagwords.php b/e107_plugins/content/e_tagwords.php
deleted file mode 100644
index 89c3ad16a..000000000
--- a/e107_plugins/content/e_tagwords.php
+++ /dev/null
@@ -1,48 +0,0 @@
-settings = array();
-
- $this->settings['plugin'] = "content";
- $this->settings['table'] = "pcontent";
- $this->settings['db_id'] = "content_id";
- $this->settings['caption'] = "content";
- }
-
- function getLink($id)
- {
- global $tp;
- if($this->row=='')
- {
- $this->row = $this->getRecord($id);
- }
- $url = e_PLUGIN."content/content.php?content.{$this->row['content_id']}";
- return "".$tp->toHTML($this->row['content_heading'], TRUE, '')." ";
- }
-
- function getRecord($id)
- {
- global $sql;
-
- $this->row = '';
-
- $qry = "SELECT c.*
- FROM #pcontent as c
- WHERE c.content_id='{$id}' AND c.content_refer !='sa'
- AND c.content_datestamp < ".time()." AND (c.content_enddate=0 || c.content_enddate>".time().")
- AND c.content_class REGEXP '".e_CLASS_REGEXP."' ";
-
- if($sql->db_Select_gen($qry))
- {
- $this->row=$sql->db_Fetch();
- }
- return $this->row;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/e_userprofile.php b/e107_plugins/content/e_userprofile.php
deleted file mode 100644
index 4aeea6427..000000000
--- a/e107_plugins/content/e_userprofile.php
+++ /dev/null
@@ -1,89 +0,0 @@
- 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'];
- $maincaption = $rowm['content_heading'];
-
- $text = '';
-
- //prepare query paramaters
- $array = $aa -> getCategoryTree("", $mainparent, TRUE);
- $validparent = implode(",", array_keys($array));
- $qry = " p.content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
- $datequery = " AND p.content_datestamp < ".time()." AND (p.content_enddate=0 || p.content_enddate>".time().") ";
- $content_pref = $aa -> getContentPref($mainparent);
- $content_icon_path = $tp -> replaceConstants($content_pref["content_icon_path"]);
- $l = strlen($userid)+1;
- $userquery = " AND (p.content_author = '".$userid."' || LEFT(p.content_author, ".$l.") = '".$userid."^' OR SUBSTRING_INDEX(p.content_author, '^', 1) = '".$userid."' ) ";
-
- $qry = "
- SELECT p.content_id, p.content_heading, p.content_subheading, p.content_icon, p.content_datestamp
- FROM #pcontent AS p
- WHERE LEFT(p.content_parent,1) != '0'
- AND ".$qry." ".$datequery."
- AND p.content_class REGEXP '".e_CLASS_REGEXP."'
- ".$userquery."
- ORDER BY p.content_heading ";
- $qry1 = $qry." LIMIT 0,3";
-
- $found=false;
- $sqlc = new db;
- $total = $sqlc -> db_Select_gen($qry);
- if($sqlc -> db_Select_gen($qry1)){
-
- while($rowc = $sqlc -> db_Fetch()){
-
- $icon='';
- if($rowc['content_icon'] && is_readable($content_icon_path.$rowc['content_icon'])){
- $icon = " ";
- }else{
- $icon = " ";
- }
-
- $date = strftime("%d %b %Y", $rowc['content_datestamp']);
- $subheading = ($row['content_subheading'] ? $row['content_subheading']." " : '');
-
- $text .= "
- ";
-
- $id = $rowc['content_id'];
- $found=true;
- }
- $lan0 = str_replace('{caption}',$maincaption, CONTENT_USERPROFILE_LAN_1);
- $text .= "";
- }
- if($found){
- $caption[] = str_replace(array('{caption}','{total}'),array($maincaption, $total), CONTENT_USERPROFILE_LAN_2);
- $data[] = $text;
- }
- }
- return array('caption'=>$caption, 'text'=>$data);
- }
- }
-}
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/handlers/content_class.php b/e107_plugins/content/handlers/content_class.php
deleted file mode 100644
index 0cdb3549c..000000000
--- a/e107_plugins/content/handlers/content_class.php
+++ /dev/null
@@ -1,1552 +0,0 @@
-".time().") ";
-
-require_once($plugindir."handlers/content_defines.php");
-
-if(!is_object($sql)){ $sql = new db; }
-
-class content{
-
- function ContentDefaultPrefs(){
- global $tp;
-
- //ADMIN CREATE FORM
- $cp['content_admin_subheading'] = '1'; //should subheading be available
- $cp['content_admin_summary'] = '1'; //should summary be available
- $cp['content_admin_startdate'] = '1'; //should start date be available
- $cp['content_admin_enddate'] = '1'; //should end date be available
- $cp['content_admin_icon'] = ''; //should icon be available to add when creating an item
- $cp['content_admin_attach'] = ''; //should file be available to add when creating an item
- $cp['content_admin_images'] = ''; //should image be available to add when creating an item
- $cp['content_admin_comment'] = '1'; //should comment be available to add when creating an item
- $cp['content_admin_rating'] = '1'; //should rating be available to add when creating an item
- $cp['content_admin_score'] = '1'; //should score be available to add when creating an item
- $cp['content_admin_pe'] = '1'; //should printemailicons be available to add when creating an item
- $cp['content_admin_visibility'] = '1'; //should visibility be available to add when creating an item
- $cp['content_admin_meta'] = ''; //should metatags be available to add when creating an item
- $cp['content_admin_custom_number'] = ''; //how many customtags should be available to add when creating an item
- $cp['content_admin_images_number'] = '2'; //how many images should be available to add when creating an item
- $cp['content_admin_files_number'] = '1'; //how many files should be available to add when creating an item
- $cp['content_admin_layout'] = ''; //should the option for choosing a layout template be shown
- $cp['content_admin_customtags'] = ''; //should options for adding additional data be shown
- $cp['content_admin_presettags'] = ''; //should preset data tags be shown
- $cp['content_admin_loadicons'] = 0; //load all icons, or only the 'tmp' icons, when assigning an icon
- $cp['content_admin_loadattach'] = 0; //load all attachments, or only the 'tmp' attachments, when assigning an attachment
-
- //ADMIN CREATE CATEGORY FORM
- $cp['content_admincat_subheading'] = '1'; //should subheading be available
- $cp['content_admincat_startdate'] = '1'; //should startdate be available
- $cp['content_admincat_enddate'] = '1'; //should enddate be available
- $cp['content_admincat_uploadicon'] = '1'; //should uploadicon be available
- $cp['content_admincat_selecticon'] = '1'; //should selecticon be available
- $cp['content_admincat_comment'] = '1'; //should comment be available
- $cp['content_admincat_rating'] = '1'; //should rating be available
- $cp['content_admincat_pe'] = '1'; //should print email icons be available
- $cp['content_admincat_visibility'] = '1'; //should visibility be available
-
- //PATH THEME CSS
- $cp['content_cat_icon_path_large'] = '{e_PLUGIN}content/images/cat/48/'; //default path to large categry icons
- $cp['content_cat_icon_path_small'] = '{e_PLUGIN}content/images/cat/16/'; //default path to small category icons
-
- $cp['content_icon_path'] = '{e_PLUGIN}content/images/icon/'; //default path to item icons
- $cp['content_icon_path_tmp'] = '{e_PLUGIN}content/images/icon/tmp/'; //default tmp path to item icons
-
- $cp['content_image_path'] = '{e_PLUGIN}content/images/image/'; //default path to item images
- $cp['content_image_path_tmp'] = '{e_PLUGIN}content/images/image/tmp/'; //default tmp path to item images
-
- $cp['content_file_path'] = '{e_PLUGIN}content/images/file/'; //default path to item file attachments
- $cp['content_file_path_tmp'] = '{e_PLUGIN}content/images/file/tmp/'; //default tmp path to item file attachments
-
- $cp['content_theme'] = '{e_PLUGIN}content/templates/default/'; //choose theme for main parent
- $cp['content_layout'] = 'content_content_template.php'; //choose default layout scheme
-
- //GENERAL
- $cp['content_log'] = ''; //activate log
- $cp['content_blank_icon'] = ''; //use blank icon if no icon present
- $cp['content_blank_caticon'] = ''; //use blank caticon if no caticon present
- $cp['content_breadcrumb_catall'] = ''; //show breadcrumb on all categories page
- $cp['content_breadcrumb_cat'] = ''; //show breadcrumb on single category page
- $cp['content_breadcrumb_authorall'] = ''; //show breadcrumb on all author page
- $cp['content_breadcrumb_author'] = ''; //show breadcrumb on single author page
- $cp['content_breadcrumb_recent'] = ''; //show breadcrumb on recent page
- $cp['content_breadcrumb_item'] = ''; //show breadcrumb on content item page
- $cp['content_breadcrumb_top'] = ''; //show breadcrumb on top rated page
- $cp['content_breadcrumb_archive'] = ''; //show breadcrumb on archive page
- $cp['content_breadcrumb_seperator'] = '>'; //seperator character between breadcrumb
- $cp['content_breadcrumb_rendertype'] = '2'; //how to render the breadcrumb
- $cp['content_navigator_catall'] = ''; //show navigator on all categories page
- $cp['content_navigator_cat'] = ''; //show navigator on single category page
- $cp['content_navigator_authorall'] = ''; //show navigator on all author page
- $cp['content_navigator_author'] = ''; //show navigator on single author page
- $cp['content_navigator_recent'] = ''; //show navigator on recent page
- $cp['content_navigator_item'] = ''; //show navigator on content item page
- $cp['content_navigator_top'] = ''; //show navigator on top rated page
- $cp['content_navigator_archive'] = ''; //show navigator on archive page
- $cp['content_search_catall'] = ''; //show search keyword on all categories page
- $cp['content_search_cat'] = ''; //show search keyword on single category page
- $cp['content_search_authorall'] = ''; //show search keyword on all author page
- $cp['content_search_author'] = ''; //show search keyword on single author page
- $cp['content_search_recent'] = ''; //show search keyword on recent page
- $cp['content_search_item'] = ''; //show search keyword on content item page
- $cp['content_search_top'] = ''; //show search keyword on top rated page
- $cp['content_search_archive'] = ''; //show search keyword on archive page
- $cp['content_ordering_catall'] = ''; //show ordering on all categories page
- $cp['content_ordering_cat'] = ''; //show ordering on single category page
- $cp['content_ordering_authorall'] = ''; //show ordering on all author page
- $cp['content_ordering_author'] = ''; //show ordering on single author page
- $cp['content_ordering_recent'] = ''; //show ordering on recent page
- $cp['content_ordering_item'] = ''; //show ordering on content item page
- $cp['content_ordering_top'] = ''; //show ordering on top rated page
- $cp['content_ordering_archive'] = ''; //show ordering on archive page
- $cp['content_searchmenu_rendertype'] = '1'; //rendertype for searchmenu (1=echo, 2=in separate menu)
- $cp['content_nextprev'] = '1'; //use nextprev buttons
- $cp['content_nextprev_number'] = '10'; //how many items on a page
- $cp['content_defaultorder'] = 'orderddate'; //default sort and order method
- $cp['content_allow_display_times'] = '0'; // Option to display times with start/end dates
- //upload icon/image size handling
- $cp['content_upload_image_size'] = '500'; //resize size of uploaded image
- $cp['content_upload_image_size_thumb'] = '100'; //resize size of created thumb on uploaded image
- $cp['content_upload_icon_size'] = '100'; //resize size of uploaded icon
-
- //CONTENT ITEM PREVIEW
- $cp['content_list_icon'] = '1'; //show icon
- $cp['content_list_subheading'] = '1'; //show subheading
- $cp['content_list_summary'] = '1'; //show summary
- $cp['content_list_text'] = ''; //show (part of) text
- $cp['content_list_date'] = ''; //show date
- $cp['content_list_authorname'] = ''; //show authorname
- $cp['content_list_authorprofile'] = ''; //show link to author profile
- $cp['content_list_authoremail'] = ''; //show authoremail
- $cp['content_list_authoricon'] = ''; //show link to author list
- $cp['content_list_rating'] = '1'; //show rating system
- $cp['content_list_peicon'] = '1'; //show printemailicons
- $cp['content_list_parent'] = ''; //show parent cat
- $cp['content_list_refer'] = ''; //show refer count
- $cp['content_list_subheading_char'] = '100'; //how many subheading characters
- $cp['content_list_subheading_post'] = '[...]'; //use a postfix for too long subheadings
- $cp['content_list_summary_char'] = '100'; //how many summary characters
- $cp['content_list_summary_post'] = '[...]'; //use a postfix for too long summary
- $cp['content_list_text_char'] = '60'; //how many text words
- $cp['content_list_text_post'] = CONTENT_LAN_16; //use a postfix for too long text
- $cp['content_list_text_link'] = '1'; //show link to content item on postfix
- $cp['content_list_authoremail_nonmember'] = ''; //show email non member author
- $cp['content_list_peicon_all'] = ''; //override printemail icons
- $cp['content_list_rating_all'] = ''; //override rating system
- $cp['content_list_editicon'] = ''; //show link to admin edit item
- $cp['content_list_datestyle'] = '%d %b %Y'; //choose datestyle for given date
- $cp['content_list_caption'] = CONTENT_LAN_23; //caption for recent list
- $cp['content_list_caption_append_name'] = '1'; //append category heading to caption
-
- //CATEGORY PAGES
- //sections of content category in 'view all categories page'
- $cp['content_catall_icon'] = '1'; //show icon
- $cp['content_catall_subheading'] = '1'; //show subheading
- $cp['content_catall_text'] = ''; //show text
- $cp['content_catall_date'] = ''; //show date
- $cp['content_catall_rating'] = '1'; //show rating
- $cp['content_catall_authorname'] = ''; //show author name
- $cp['content_catall_authoremail'] = ''; //show author email
- $cp['content_catall_authorprofile'] = ''; //show link to author profile
- $cp['content_catall_authoricon'] = ''; //show link to author list
- $cp['content_catall_peicon'] = '1'; //show pe icons
- $cp['content_catall_comment'] = '1'; //show amount of comments
- $cp['content_catall_amount'] = ''; //show amount of items
- $cp['content_catall_text_char'] = '65'; //define amount of words of text to display
- $cp['content_catall_text_post'] = CONTENT_LAN_16; //define postfix is text is too long
- $cp['content_catall_text_link'] = '1'; //define if link to category should be added on postfix
- $cp['content_catall_caption'] = CONTENT_LAN_25; //caption for all categories page
- $cp['content_catall_defaultorder'] = 'orderaheading'; //default order for categories on the all categories page
- //sections of content category in 'view category' page
- $cp['content_cat_icon'] = '1'; //show icon
- $cp['content_cat_subheading'] = '1'; //show subheading
- $cp['content_cat_text'] = ''; //show text
- $cp['content_cat_date'] = ''; //show date
- $cp['content_cat_authorname'] = ''; //show author name
- $cp['content_cat_authoremail'] = ''; //show author email
- $cp['content_cat_authorprofile'] = ''; //show link to author profile
- $cp['content_cat_authoricon'] = ''; //show link to author list
- $cp['content_cat_rating'] = '1'; //show rating
- $cp['content_cat_peicon'] = '1'; //show pe icons
- $cp['content_cat_comment'] = '1'; //show amount of comments
- $cp['content_cat_amount'] = '1'; //show amount of items
- $cp['content_cat_caption'] = CONTENT_LAN_26; //caption for single category page
- $cp['content_cat_caption_append_name'] = '1'; //append category heading to caption
- $cp['content_cat_sub_caption'] = CONTENT_LAN_28; //caption for subcategories
- $cp['content_cat_item_caption'] = CONTENT_LAN_31; //caption for items in category
- $cp['content_cat_defaultorder'] = 'orderaheading'; //default order for the subcategories on the single category page
-
- //sections of subcategories in 'view category page'
- $cp['content_catsub_icon'] = '1'; //show icon
- $cp['content_catsub_subheading'] = '1'; //show subheading
- $cp['content_catsub_amount'] = '1'; //show amount of items
- $cp['content_cat_showparent'] = '1'; //show parent item in category page
- $cp['content_cat_showparentsub'] = '1'; //show subcategories in category page
- $cp['content_cat_listtype'] = ''; //also show items from subategories
- $cp['content_cat_menuorder'] = '1'; //order of parent and child items
- $cp['content_cat_rendertype'] = '2'; //render method of the menus
- $cp['content_cat_text_char'] = '65'; //define amount of words of text to display
- $cp['content_cat_text_post'] = CONTENT_LAN_16; //define postfix is text is too long
- $cp['content_cat_text_link'] = '1'; //define if link to category should be added on postfix
- $cp['content_cat_authoremail_nonmember'] = ''; //define if the email of a non-member will be displayed
- $cp['content_cat_peicon_all'] = ''; //override printemail icons
- $cp['content_cat_rating_all'] = ''; //override rating system
-
- //CONTENT PAGE
- $cp['content_content_icon'] = ''; //show icon
- $cp['content_content_subheading'] = '1'; //show subheading
- $cp['content_content_summary'] = '1'; //show summary
- $cp['content_content_date'] = '1'; //show date
- $cp['content_content_authorname'] = '1'; //show authorname
- $cp['content_content_authorprofile'] = ''; //show link to author profile
- $cp['content_content_authoremail'] = ''; //show suthoremail
- $cp['content_content_authoricon'] = ''; //show link to author list
- $cp['content_content_parent'] = ''; //show parent category
- $cp['content_content_rating'] = '1'; //show rating system
- $cp['content_content_peicon'] = '1'; //show printemailicons
- $cp['content_content_refer'] = ''; //show refer count
- $cp['content_content_comment'] = '1'; //show amount of comments
- $cp['content_content_authoremail_nonmember'] = ''; //show email non member
- $cp['content_content_peicon_all'] = ''; //override printemail icons
- $cp['content_content_rating_all'] = ''; //override rating system
- $cp['content_content_comment_all'] = ''; //override comment system
- $cp['content_content_editicon'] = ''; //show link in content page to admin edit item
- $cp['content_content_customtags'] = ''; //should additional data be shown
- $cp['content_content_presettags'] = ''; //should preset data tags be shown
- $cp['content_content_attach'] = ''; //show attachments
- $cp['content_content_images'] = ''; //show images
- $cp['content_content_pagenames_rendertype'] = ''; //rendertype for articleindex on multipage content items
- $cp['content_content_multipage_preset'] = ''; //render custom/preset in multipage item first/last page
- $cp['content_content_pagenames_nextprev_prevhead'] = '< {PAGETITLE}'; //link to next page in multipage item
- $cp['content_content_pagenames_nextprev_nexthead'] = '{PAGETITLE} >'; //link to prev page in multipage item
-
- //AUTHOR PAGE
- $cp['content_author_lastitem'] = ''; //show last item reference
- $cp['content_author_amount'] = '1'; //show amount of items from this author
- $cp['content_author_nextprev'] = '1'; //use next prev buttons
- $cp['content_author_nextprev_number'] = '20'; //amount of items per page
- $cp['content_author_index_caption'] = CONTENT_LAN_32; //caption for author index page
- $cp['content_author_caption'] = CONTENT_LAN_32; //caption for single author page
- $cp['content_author_caption_append_name'] = '1'; //append author name to caption
-
- //ARCHIVE PAGE
- $cp['content_archive_nextprev'] = '1'; //archive : choose to show next/prev links
- $cp['content_archive_nextprev_number'] = '30'; //archive : choose amount to use in next/prev
- $cp['content_archive_letterindex'] = '1'; //archive : letter index
- $cp['content_archive_datestyle'] = '%d %b %Y'; //archive : choose datestyle for given date
- $cp['content_archive_date'] = '1'; //archive : section: show date
- $cp['content_archive_authorname'] = ''; //archive : section: show authorname
- $cp['content_archive_authorprofile'] = ''; //archive : section: show link to author profile
- $cp['content_archive_authoricon'] = ''; //archive : section: show link to author list
- $cp['content_archive_authoremail'] = ''; //archive : section: show author email
- $cp['content_archive_authoremail_nonmember'] = ''; //archive : show link to email of non-member author
- $cp['content_archive_caption'] = CONTENT_LAN_84; //caption for archive page
- $cp['content_archive_defaultorder'] = 'orderaheading'; //default order for content items on the archive page
-
- //TOP RATED PAGE
- $cp['content_top_icon'] = ''; //top : section: show icon
- $cp['content_top_authorname'] = ''; //top : section: show authorname
- $cp['content_top_authorprofile'] = ''; //top : section: show link to author profile
- $cp['content_top_authoricon'] = ''; //top : section: show link to author list
- $cp['content_top_authoremail'] = ''; //top : section: show author email
- $cp['content_top_authoremail_nonmember'] = ''; //top : show link to email of non-member author
- $cp['content_top_icon_width'] = ''; //use this size for icon
- $cp['content_top_caption'] = CONTENT_LAN_38; //caption for top rated page
- $cp['content_top_caption_append_name'] = '1'; //append category heading to caption
-
- //TOP SCORE PAGE
- $cp['content_score_icon'] = ''; //score : section: show icon
- $cp['content_score_authorname'] = ''; //score : section: show authorname
- $cp['content_score_authorprofile'] = ''; //score : section: show link to author profile
- $cp['content_score_authoricon'] = ''; //score : section: show link to author list
- $cp['content_score_authoremail'] = ''; //score : section: show author email
- $cp['content_score_authoremail_nonmember'] = ''; //score : show link to email of non-member author
- $cp['content_score_icon_width'] = ''; //use this size for icon
- $cp['content_score_caption'] = CONTENT_LAN_87; //caption for top score page
- $cp['content_score_caption_append_name'] = '1'; //append category heading to caption
-
- //MENU OPTIONS
- $cp['content_menu_caption'] = CONTENT_MENU_LAN_0; //caption of menu
- $cp['content_menu_search'] = ''; //show search keyword
- $cp['content_menu_sort'] = ''; //show sorting methods
- $cp['content_menu_visibilitycheck'] = ''; //show menu only on content pages of this top level category?
- $cp['content_menu_links'] = '1'; //show content links
- $cp['content_menu_links_dropdown'] = ''; //rendertype of content links (in dropdown or as normal links)
- $cp['content_menu_links_icon'] = ''; //define icon for content links (only with normallinks)
- $cp['content_menu_links_caption'] = CONTENT_MENU_LAN_4; //define caption for link list (only is normallinks is selected)
- $cp['content_menu_viewallcat'] = '1'; //menu: view link to all categories
- $cp['content_menu_viewallauthor'] = '1'; //menu: view link to all authors
- $cp['content_menu_viewallitems'] = '1'; //menu: view link to all items (archive)
- $cp['content_menu_viewtoprated'] = ''; //menu: view link to top rated items
- $cp['content_menu_viewtopscore'] = ''; //menu: view link to top score items
- $cp['content_menu_viewrecent'] = '1'; //menu: view link to recent items
- $cp['content_menu_viewsubmit'] = '1'; //view link to submit content item (only if it is allowed)
- $cp['content_menu_viewicon'] = ''; //choose icon to display for links
- $cp['content_menu_cat'] = '1'; //view categories
- $cp['content_menu_cat_main'] = '1'; //show main parent in the category list
- $cp['content_menu_cat_number'] = '1'; //show number of items in category
- $cp['content_menu_cat_icon'] = ''; //choose icon to display for categories
- $cp['content_menu_cat_icon_default'] = ''; //choose default icon is no icon present (only if category_icon is selected)
- $cp['content_menu_cat_caption'] = CONTENT_MENU_LAN_3; //define caption for category list
- $cp['content_menu_cat_dropdown'] = ''; //rendertype of categories (in dropdown or as normal links)
- $cp['content_menu_recent'] = '1'; //view recent list
- $cp['content_menu_recent_caption'] = CONTENT_MENU_LAN_2; //caption of recent list
- $cp['content_menu_recent_number'] = '5'; //number of recent items to show
- $cp['content_menu_recent_date'] = ''; //show date in recent list
- $cp['content_menu_recent_datestyle'] = '%d %b %Y'; //choose datestyle for given date
- $cp['content_menu_recent_author'] = ''; //show author in recent list
- $cp['content_menu_recent_subheading'] = ''; //show subheading in recent list
- $cp['content_menu_recent_subheading_char'] = '80'; //number of characters of subheading to show
- $cp['content_menu_recent_subheading_post'] = '[...]'; //postfix for too long subheadings
- $cp['content_menu_recent_icon'] = ''; //choose icon to display for recent items
- $cp['content_menu_recent_icon_width'] = '50'; //specify width of icon (only if content_icon is set)
-
- $cp['content_inherit'] = ''; //inherit options from default preferences
-
- //CONTENT MANAGER
- $cp['content_manager_submit'] = '255'; //class for managers who can submit items in a category
- $cp['content_manager_approve'] = '255'; //class for managers who can approve submitted items
- $cp['content_manager_personal'] = '255'; //class for managers who can manage personal items
- $cp['content_manager_category'] = '255'; //class for managers who can manage all items in a category
- $cp['content_manager_inherit'] = ''; //inherit options from default (manager) preferences
-
- //manager : submit options
- $cp['content_manager_submit_directpost'] =''; //should submission be direclty posted as an item, or have them validated by admins
- $cp['content_manager_submit_subheading'] = ''; //should subheading be available
- $cp['content_manager_submit_summary'] = ''; //should summary be available
- $cp['content_manager_submit_startdate'] = ''; //should startdate be available
- $cp['content_manager_submit_enddate'] = ''; //should enddate be available
- $cp['content_manager_submit_icon'] = ''; //should icon be available to add when submitting an item
- $cp['content_manager_submit_attach'] = ''; //should file be available to add when submitting an item
- $cp['content_manager_submit_images'] = ''; //should image be available to add when submitting an item
- $cp['content_manager_submit_comment'] = ''; //should comment be available to add when submitting an item
- $cp['content_manager_submit_rating'] = ''; //should rating be available to add when submitting an item
- $cp['content_manager_submit_score'] = ''; //should score be available to add when submitting an item
- $cp['content_manager_submit_pe'] = ''; //should printemailicons be available to add when submitting an item
- $cp['content_manager_submit_visibility'] = ''; //should visibility be available to add when submitting an item
- $cp['content_manager_submit_meta'] = ''; //should metatags be available to add when submitting an item
- $cp['content_manager_submit_layout'] = ''; //should the option for choosing a layout template be shown
- $cp['content_manager_submit_customtags'] = ''; //should options for adding additional data be shown
- $cp['content_manager_submit_presettags'] = ''; //should preset data tags be shown
- $cp['content_manager_submit_custom_number'] = ''; //how many customtags should be available to add when submitting an item
- $cp['content_manager_submit_images_number'] = ''; //how many images should be available to add when submitting an item
- $cp['content_manager_submit_files_number'] = ''; //how many files should be available to add when submitting an item
-
- //manager : manager options
- $cp['content_manager_manager_subheading'] = '';
- $cp['content_manager_manager_summary'] = '';
- $cp['content_manager_manager_startdate'] = '';
- $cp['content_manager_manager_enddate'] = '';
- $cp['content_manager_manager_icon'] = '';
- $cp['content_manager_manager_attach'] = '';
- $cp['content_manager_manager_images'] = '';
- $cp['content_manager_manager_comment'] = '';
- $cp['content_manager_manager_rating'] = '';
- $cp['content_manager_manager_score'] = '';
- $cp['content_manager_manager_pe'] = '';
- $cp['content_manager_manager_visibility'] = '';
- $cp['content_manager_manager_meta'] = '';
- $cp['content_manager_manager_layout'] = '';
- $cp['content_manager_manager_customtags'] = '';
- $cp['content_manager_manager_presettags'] = '';
- $cp['content_manager_manager_custom_number'] = '';
- $cp['content_manager_manager_images_number'] = '2';
- $cp['content_manager_manager_files_number'] = '1';
-
- foreach($cp as $k => $v){
- if( !empty($v) ){
- $content_pref[$k] = $tp->toDB($v);
- }
- }
- return $content_pref;
- }
-
- function getContentPref($id="", $parsepaths=false) {
- global $sql, $plugintable, $qs, $tp, $eArrayStorage;
-
- $plugintable = "pcontent";
-
- //if $id; use prefs from content table
- if($id && $id!="0"){
- $id = intval($id);
- $num_rows = $sql -> db_Select($plugintable, "content_pref", "content_id='$id' ");
- $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_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_value", "e107_name='$plugintable' ");
- }
- $row = $sql -> db_Fetch();
- $content_pref = $eArrayStorage->ReadArray($row['e107_value']);
-
- //create array of custom preset tags
- foreach($content_pref['content_custom_preset_key'] as $ck => $cv){
- if(!empty($cv)){
- $string[] = $cv;
- }
- }
- if($string){
- $content_pref['content_custom_preset_key'] = $string;
- }else{
- unset($content_pref['content_custom_preset_key']);
- }
-
- //finally we can store the new default prefs into the db
- $tmp1 = $eArrayStorage->WriteArray($content_pref);
- $sql -> db_Update($plugintable, "content_pref='{$tmp1}' WHERE content_id='$id' ");
- $sql -> db_Select($plugintable, "content_pref", "content_id='$id' ");
- $row = $sql -> db_Fetch();
- }
- $content_pref = $eArrayStorage->ReadArray($row['content_pref']);
-
- if(e_PAGE == "admin_content_config.php" && isset($qs[0]) && ($qs[0] == 'option' || $qs[0] == 'manager') ){
- }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_value", "e107_name='$plugintable' ");
- $row = $sql -> db_Fetch();
- $content_pref = $eArrayStorage->ReadArray($row['e107_value']);
- }
- }
-
- //if not $id; use prefs from default core table
- }else{
- $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_value", "e107_name='$plugintable' ");
- }
- $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;
- }
-
- //admin
- function UpdateContentPref($id){
- global $qs, $plugintable, $sql, $tp, $eArrayStorage;
-
- if(!is_object($sql)){ $sql = new db; }
-
- //insert default preferences into core
- if($id == "0"){
- $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_value", "e107_name='$plugintable' ");
- }
- $row = $sql -> db_Fetch();
- $current = $eArrayStorage->ReadArray($row['e107_value']);
-
- //if we are updating options
- if(isset($qs[0]) && $qs[0] == 'option' ){
- //only retain the manager prefs from the existing set from getting overwritten
- foreach($current as $k => $v){
- if( strpos($k, "content_manager_") === 0 ){
- $content_pref[$k] = $tp->toDB($v);
- }
- }
-
- //prepare custom tags: use the posted values
- $cp = $_POST['content_custom_preset_key'];
-
- //if we are updating manager
- }elseif(isset($qs[0]) && $qs[0] == 'manager'){
- //if this is a top level category we need to retain all existing options
- if($currentparent=='0'){
- $content_pref = $current;
- }
-
- //prepare custom tags: use the existing content_pref values
- $cp = $content_pref['content_custom_preset_key'];
- }
-
- //prepare custom tags: use the posted value
- $cp = $_POST['content_custom_preset_key'];
-
- //insert category preferences into plugintable
- }else{
- //first get the existing prefs and parent
- $sql -> db_Select($plugintable, "content_pref, content_parent", "content_id='".intval($id)."' ");
- $row = $sql -> db_Fetch();
- $current = $eArrayStorage->ReadArray($row['content_pref']);
- $currentparent = $row['content_parent'];
-
- //if we are updating options
- if(isset($qs[0]) && $qs[0] == 'option' ){
- //only use the manager prefs from the existing set
- foreach($current as $k => $v){
- if( strpos($k, "content_manager_") === 0 ){
- $content_pref[$k] = $tp->toDB($v);
- }
- }
-
- //prepare custom tags: use the posted values
- $cp = $_POST['content_custom_preset_key'];
-
- //if we are updating manager
- }elseif(isset($qs[0]) && $qs[0] == 'manager'){
- //if this is a top level category we need to keep all existing options
- if($currentparent=='0'){
- $content_pref = $current;
- }
-
- //prepare custom tags: use the existing content_pref values
- $cp = $content_pref['content_custom_preset_key'];
- }
- }
-
- //parse custom tags and covert them in $_POST values ($cp is derived above)
- $string = array();
- foreach($cp as $ck => $cv){
- if(!empty($cv)){
- $string[] = $cv;
- }
- }
- if(is_array($string) && !empty($string[0])){
- $_POST['content_custom_preset_key'] = $string;
- }
-
- //convert all $_POST to $content_pref for storage, and renew the existing stored prefs
- foreach($_POST as $k => $v){
- if(strpos($k, "content_") === 0){
- $content_pref[$k] = $tp->toDB($v);
- }
- }
-
- //create new array of preferences
- $tmp = $eArrayStorage->WriteArray($content_pref);
-
- //update core table
- if($id == "0"){
- $sql -> db_Update("core", "e107_value = '{$tmp}' WHERE e107_name = '$plugintable' ");
- //update plugin table
- }else{
- $sql -> db_Update($plugintable, "content_pref='{$tmp}' WHERE content_id='".intval($id)."' ");
- }
-
- return $content_pref;
- }
-
- function CONTENTREGEXP($var){
- return "(^|,)(".str_replace(",", "|", $var).")(,|$)";
- }
-
- //function to check and require the template file
- //$var: array of all variables that need to be global'ed
- //$var[0]: holds the primary var to check isset on (if the template var exists ($MYTEMPLATE))
- //$file: the actual filename (template.php)
- function gettemplate($var, $file=''){
- global $content_pref, $tp;
-
- if(is_array($var)){
- $check = $$var[0];
- foreach($var as $t){
- global $$t;
- }
- }else{
- $check = $var;
- global $var;
- }
-
- if(!isset($check)){
- if(!$content_pref["content_theme"]){
- require_once(e_PLUGIN."content/templates/default/".$file);
- }else{
- if( is_readable($tp->replaceConstants($content_pref["content_theme"]).$file) ){
- require_once($tp->replaceConstants($content_pref["content_theme"]).$file);
- }else{
- require_once(e_PLUGIN."content/templates/default/".$file);
- }
- }
- }
- }
-
- function getCategoryTree($id, $parent, $classcheck=TRUE, $cache=true){
- //id : content_parent of an item
- global $plugintable, $datequery, $agc;
-
- if($cache){
- $cachestring = md5("cm_gct_".$id."_".$parent."_".$classcheck);
- if($ret = getcachedvars("content_getcategorytree_{$cachestring}"))
- {
- return $ret;
- }
- }
-
- if($parent){
- $agc = "";
- $qrygc = " content_id = '".intval($parent)."' ";
- }else{
- $qrygc = " content_parent = '0' ";
- }
- if($id){
- $qrygc = " content_parent = '0.".intval($id)."' ";
- }
-
- if($classcheck == TRUE){
- $qrygc .= " AND content_class REGEXP '".e_CLASS_REGEXP."' ";
- }
-
- $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." " )){
- while($row = $sqlgetcat -> db_Fetch()){
- if($agc){
- if($row['content_parent'] != "0"){
- if(array_key_exists(substr($row['content_parent'],2), $agc)){
- if(is_array($agc[substr($row['content_parent'],2)])){
- $agc[$row['content_id']] = array_merge_recursive($agc[substr($row['content_parent'],2)], array($row['content_id'], $row['content_heading']));
- }else{
- $agc[$row['content_id']] = array($agc[substr($row['content_parent'],2)], array($row['content_id'], $row['content_heading']));
- }
-
- }else{
- $agc[$row['content_id']] = array($row['content_id'], $row['content_heading']);
- }
- }else{
- $agc[$row['content_id']] = array($row['content_id'], $row['content_heading']);
- }
- }else{
- $agc[$row['content_id']] = array($row['content_id'], $row['content_heading']);
- }
- $this -> getCategoryTree($row['content_id'], "", $classcheck, false);
- }
- }
-
- if($cache){
- cachevars("content_getcategorytree_{$cachestring}", $agc);
- }
-
- return $agc;
- }
-
- function getCrumbItem($id, $arr){
- //$id : content_parent of item
- //$arr : array of all categories
- $crumb = "";
- if(is_array($arr)){
- if(array_key_exists($id, $arr)){
- for($i=0;$i".$arr[$id][$i+1]." > ";
- $i++;
- }
- $crumb = substr($crumb,0,-3);
- }
- }
- return $crumb;
- }
-
- function ShowNextPrev($mode='', $from='0', $number, $total, $return=false){
- global $content_pref, $qs, $tp, $plugindir, $content_shortcodes, $CONTENT_NEXTPREV;
-
- if($total<=$number){
- return;
- }
-
- $modepref = ($mode ? "content_{$mode}_nextprev" : "content_nextprev");
- 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."";
-
- $CONTENT_NEXTPREV = $tp->parseTemplate("{NEXTPREV={$parms}}");
-
- if($return){
- return $CONTENT_NEXTPREV;
- }else{
- if(!isset($CONTENT_NP_TABLE)){
- if(!$content_pref["content_theme"]){
- require_once($plugindir."templates/default/content_np_template.php");
- }else{
- if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_np_template.php")){
- require_once($tp->replaceConstants($content_pref["content_theme"])."content_np_template.php");
- }else{
- require_once($plugindir."templates/default/content_np_template.php");
- }
- }
- }
- echo $tp -> parseTemplate($CONTENT_NP_TABLE, FALSE, $content_shortcodes);
- }
- }
- }
-
- function getCrumbPage($mode, $arr, $parent){
- global $qs, $ns, $content_pref, $plugintable;
-
- if( varsettrue($content_pref["content_breadcrumb_{$mode}"]) ){
- $crumb = '';
- if(array_key_exists($parent, $arr)){
- $sep = varsettrue($content_pref["content_breadcrumb_seperator"], ">");
- if( varsettrue($content_pref["content_breadcrumb_base"]) ){
- $crumb .= "".CONTENT_LAN_58." ".$sep." ";
- }
- if( varsettrue($content_pref["content_breadcrumb_self"]) ){
- $crumb .= "".CONTENT_LAN_59." ".$sep." ";
- }
- for($i=0;$i".$arr[$parent][$i+1]."";
- break;
- }else{
- $crumb .= "".$arr[$parent][$i+1]." ".$sep." ";
- $i++;
- }
- }
- }
- if($qs[0] == "recent"){
- $crumb .= " ".$sep." ".CONTENT_LAN_60." ";
- }
- if($qs[0] == "author"){
- $crumb .= " ".$sep." ".CONTENT_LAN_85." ";
- if(is_numeric($qs[1])){
- global $sql;
- $sql->db_Select($plugintable, "content_author","content_id='".intval($qs[1])."'");
- $row=$sql->db_Fetch();
- $au = $this->getAuthor($row['content_author']);
- $crumb .= " ".$sep." ".$au[1]." ";
- }
- }
- if($qs[0] == "list"){
- $crumb .= " ".$sep." ".CONTENT_LAN_13." ";
- }
- if($qs[0] == "top"){
- $crumb .= " ".$sep." ".CONTENT_LAN_8." ";
- }
- if($qs[0] == "score"){
- $crumb .= " ".$sep." ".CONTENT_LAN_12." ";
- }
- if($qs[0] == "content"){
- global $row;
- $crumb .= " ".$sep." ".$row['content_heading'];
- }
-
- $crumb = "".trim($crumb)."
";
- if(isset($content_pref["content_breadcrumb_rendertype"]) && $content_pref["content_breadcrumb_rendertype"] == "1"){
- echo $crumb;
- return "";
- }elseif(isset($content_pref["content_breadcrumb_rendertype"]) && $content_pref["content_breadcrumb_rendertype"] == "2"){
- $ns -> tablerender(CONTENT_LAN_24, $crumb);
- return "";
- }else{
- return $crumb;
- }
- }else{
- return "";
- }
- }
-
- function countCatItems($id){
- global $sqlcountitemsincat, $plugintable, $datequery;
- //$id : category content_id
-
- $cachestring = md5($id."_".$datequery."_".e_CLASS_REGEXP);
- if($ret = getcachedvars("content_countcatitems_{$cachestring}"))
- {
- return $ret;
- }
-
- if(!is_object($sqlcountitemsincat)){ $sqlcountitemsincat = new db; }
- $n = $sqlcountitemsincat -> db_Count($plugintable, "(*)", "WHERE content_class REGEXP '".e_CLASS_REGEXP."' AND content_parent='".intval($id)."' AND content_refer != 'sa' ".$datequery." ");
-
- cachevars("content_countcatitems_{$cachestring}", $n);
-
- return $n;
- }
-
- function getCategoryHeading($id){
- global $plugintable, $sql;
- $qry = "
- 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)."' ";
- $sql -> db_Select_gen($qry);
- $row2 = $sql -> db_Fetch();
- return $row2['content_heading'];
- }
- function getPageHeading($id){
- global $plugintable, $sql;
- $sql -> db_Select($plugintable, "content_heading", "content_id='".intval($id)."' ");
- $row2 = $sql -> db_Fetch();
- return $row2['content_heading'];
- }
- function setPageTitle(){
- global $plugintable, $sql, $qs;
-
- //content page
- if(e_PAGE == "content.php"){
- //main parent overview
- if(!e_QUERY){
- $page = CONTENT_PAGETITLE_LAN_0;
- }else{
- $sql -> db_Select($plugintable, "content_heading", "content_id = '".intval($qs[1])."' ");
- $row = $sql -> db_Fetch();
-
- $page = CONTENT_PAGETITLE_LAN_0;
-
- //recent of parent='2'
- if($qs[0] == "recent" && is_numeric($qs[1]) && !isset($qs[2])){
- $page .= " / ".$row['content_heading']." / ".CONTENT_PAGETITLE_LAN_2;
-
- //item
- }elseif($qs[0] == "content" && isset($qs[1]) && is_numeric($qs[1]) ){
- $page .= " / ".$this -> getCategoryHeading($qs[1])." / ".$this -> getPageHeading($qs[1]);
-
- //all categories of parent='2'
- }elseif($qs[0] == "cat" && $qs[1] == "list" && is_numeric($qs[2])){
- $page .= " / ".$this -> getPageHeading($qs[2])." / ".CONTENT_PAGETITLE_LAN_13;
-
- //category of parent='2' and content_id='5'
- }elseif($qs[0] == "cat" && is_numeric($qs[1]) && (!isset($qs[2]) || isset($qs[2]) && $qs[2]=='view') ){
- $page .= " / ".CONTENT_PAGETITLE_LAN_3." / ".$row['content_heading'];
-
- //top rated of parent='2'
- }elseif($qs[0] == "top" && is_numeric($qs[1]) && !isset($qs[2])){
- $page .= " / ".$this -> getPageHeading($qs[1])." / ".CONTENT_PAGETITLE_LAN_4;
-
- //top score of parent='2'
- }elseif($qs[0] == "score" && is_numeric($qs[1]) && !isset($qs[2])){
- $page .= " / ".$this -> getPageHeading($qs[1])." / ".CONTENT_PAGETITLE_LAN_15;
-
- //authorlist of parent='2'
- }elseif($qs[0] == "author" && $qs[1] == "list" && is_numeric($qs[2])){
- $page .= " / ".$this -> getPageHeading($qs[2])." / ".CONTENT_PAGETITLE_LAN_14;
-
- //authorlist of parent='2' and content_id='5'
- }elseif($qs[0] == "author" && is_numeric($qs[1]) && !isset($qs[2])){
- $sql -> db_Select($plugintable, "content_author", "content_id='".intval($qs[1])."' ");
- $row2 = $sql -> db_Fetch();
- $authordetails = $this -> getAuthor($row2['content_author']);
- $page .= " / ".CONTENT_PAGETITLE_LAN_5." / ".$authordetails[1];
-
- //archive of parent='2'
- }elseif($qs[0] == "list" && is_numeric($qs[1]) && !isset($qs[2])){
- $page .= " / ".CONTENT_PAGETITLE_LAN_6;
- }
- }
-
- }elseif(e_PAGE == "content_manager.php"){
- //manager page : view categories
- if(!e_QUERY){
- $page = CONTENT_PAGETITLE_LAN_0." / ".CONTENT_PAGETITLE_LAN_9;
- }else{
- $page = CONTENT_PAGETITLE_LAN_0." / ".CONTENT_PAGETITLE_LAN_9;
-
- //manager page : list items
- if($qs[0] == "content" && is_numeric($qs[1]) ){
- $page .= " / ".CONTENT_PAGETITLE_LAN_10;
-
- //manager page : edit item
- }elseif($qs[0] == "content" && $qs[1] == "edit" && is_numeric($qs[2]) ){
- $page .= " / ".CONTENT_PAGETITLE_LAN_11;
-
- //manager page : create new item (manager)
- }elseif($qs[0] == "content" && $qs[1] == "create" && is_numeric($qs[2]) ){
- $page .= " / ".CONTENT_PAGETITLE_LAN_12;
-
- //manager page : create new item (submit)
- }elseif($qs[0] == "content" && $qs[1] == "submit" && is_numeric($qs[2]) ){
- $page .= " / ".CONTENT_PAGETITLE_LAN_8;
-
- //manager page : approve submitted items (list items)
- }elseif($qs[0] == "content" && $qs[1] == "approve" && is_numeric($qs[2]) ){
- $page .= " / ".CONTENT_PAGETITLE_LAN_16;
-
- //manager page : post submitted item (edit item)
- }elseif($qs[0] == "content" && $qs[1] == "sa" && is_numeric($qs[2]) ){
- $page .= " / ".CONTENT_PAGETITLE_LAN_17;
- }
- }
- }
- define("e_PAGETITLE", $page);
- }
-
- function getAuthor($content_author) {
- global $sql, $plugintable, $datequery;
-
- $cachestring = md5($content_author);
- if($ret = getcachedvars("content_getauthor_{$cachestring}"))
- {
- return $ret;
- }
-
- if(is_numeric($content_author)){
- if(!$sql -> db_Select("user", "user_id, user_name, user_email", "user_id=$content_author")){
- $author_id = "0";
- $author_name = "";
- $author_email = "";
- }else{
- list($author_id, $author_name, $author_email) = $sql -> db_Fetch();
- }
- $getauthor = array($author_id, $author_name, $author_email, $content_author);
- }else{
- $tmp = explode("^", $content_author);
- if(isset($tmp[0]) && is_numeric($tmp[0]) ){
- $author_id = $tmp[0];
- $author_name = (isset($tmp[1]) ? $tmp[1] : "");
- $author_email = (isset($tmp[2]) ? $tmp[2] : "");
- }else{
- $author_id = "0";
- $author_name = $tmp[0];
- $author_email = (isset($tmp[1]) ? $tmp[1] : "");
- }
- $getauthor = array($author_id, $author_name, $author_email, $content_author);
- }
- cachevars("content_getauthor_{$cachestring}", $getauthor);
- return $getauthor;
- }
-
- function getMainParent($id, $cache=true){
- global $sql, $plugintable;
-
- if($cache){
- $cachestring = md5("cm_gmp_".$id);
- if($ret = getcachedvars("content_getmainparent_{$cachestring}"))
- {
- return $ret;
- }
- }
-
- $category_total = $sql -> db_Select($plugintable, "content_id, content_parent", "content_id='".intval($id)."' ");
- $row = $sql -> db_Fetch();
- if($row['content_parent'] == 0){
- $mainparent = $row['content_id'];
- }else{
- if(strpos($row['content_parent'], ".")){
- $newid = substr($row['content_parent'],2);
- }else{
- $newid = $row['content_parent'];
- }
- $mainparent = $this -> getMainParent( $newid, false );
- }
- $val = ($mainparent ? $mainparent : "0");
-
- if($cache){
- cachevars("content_getmainparent_{$cachestring}", $val);
- }
-
- return $val;
- }
-
- //$mode : managecontent, createcontent, category
- function ShowOption($currentparent="", $mode=''){
- global $qs, $sql, $rs, $plugintable, $tp, $content_pref, $stylespacer;
-
- if( ($mode=='managecontent' || $mode=='createcontent') && $currentparent == "submit"){
- $mainparent = $this -> getMainParent( intval($qs[2]) );
- $catarray = $this -> getCategoryTree("", intval($mainparent), FALSE);
- }else{
- $catarray = $this -> getCategoryTree("", "", FALSE);
- }
- $array = array_keys($catarray);
-
- $string = "";
- foreach($array as $catid){
- $category_total = $sql -> db_Select($plugintable, "content_id, content_heading, content_parent", "content_id='".intval($catid)."' ");
- $row = $sql -> db_Fetch();
-
- $pre = "";
- //sub level
- if($row['content_parent'] != "0"){
- for($b=0;$b<(count($catarray[$catid])/2)-1;$b++){
- $pre .= " ";
- }
- }
- if($row['content_parent'] == 0){
- $name = $row['content_heading'];
- $js = "style='font-weight:bold;'";
- }else{
- $js = "";
- $name = $pre.$row['content_heading'];
- }
-
- if($mode=='managecontent'){
- $checkid = ($currentparent ? $currentparent : "");
- if($qs[0] == 'content' && ($qs[1]=='create' || $qs[1]=='submit') ){
- $value = e_SELF."?content.".$qs[1].".".$catid;
- }else{
- $value = e_SELF."?content.".$catid;
- }
- }elseif($mode=='createcontent'){
- if($qs[1] == "create" || $qs[1] == "submit"){
- $checkid = (isset($qs[2]) && is_numeric($qs[2]) ? $qs[2] : "");
- $value = $catid;
- }else{
- $checkid = ($currentparent ? $currentparent : "");
- $value = $qs[2].".".$catid;
- }
- }elseif($mode=='category'){
- if($qs[1] == "create"){
- $checkid = (isset($qs[2]) && is_numeric($qs[2]) ? $qs[2] : "");
- $value = e_SELF."?cat.create.".$catid;
- }elseif($qs[1] == "edit"){
- $checkid = ($currentparent ? $currentparent : "");
- $value = e_SELF."?cat.edit.".$qs[2].".".$catid;
- }
- }
- $sel = ($catid == $checkid ? "1" : "0");
- $string .= $rs -> form_option($name, $sel, $value, $js);
- }
-
- if($mode=='managecontent'){
- $selectjs = " onchange=\" if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; } \"";
- $text = $rs -> form_select_open("parent1", $selectjs);
- $text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_28, "0", "none");
- $text .= $string;
- $text .= $rs -> form_select_close();
-
- }elseif($mode=='createcontent'){
- $redirecturl = e_SELF."?content.".$qs[1].".";
- $selectjs = " onchange=\" if(this.options[this.selectedIndex].value != 'none'){ return document.location='".$redirecturl."'+this.options[this.selectedIndex].value; } \"";
- $text = $rs -> form_select_open("parent1", $selectjs);
- $text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_28, "0", "none");
- $text .= $string;
- $text .= $rs -> form_select_close();
-
- }elseif($mode=='category'){
- $selectjs = " onchange=\" if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; } \"";
- $text = $rs -> form_select_open("parent1", $selectjs);
- if($qs[1] == "create"){
- $text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_29." ", (isset($qs[2]) ? "0" : "1"), e_SELF."?cat.create", "style='font-weight:bold;'");
- }else{
- $text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_29." ", (isset($qs[2]) ? "0" : "1"), e_SELF."?cat.edit.".$qs[2].".0", "style='font-weight:bold;'");
- }
- $text .= $string;
- $text .= $rs -> form_select_close();
- }
- return $text;
- }
-
- function getOrder($mode=''){
- global $qs, $content_pref;
-
- if(isset($qs[0]) && substr($qs[0],0,5) == "order"){
- $orderstring = $qs[0];
- }elseif(isset($qs[1]) && substr($qs[1],0,5) == "order"){
- $orderstring = $qs[1];
- }elseif(isset($qs[2]) && substr($qs[2],0,5) == "order"){
- $orderstring = $qs[2];
- }elseif(isset($qs[3]) && substr($qs[3],0,5) == "order"){
- $orderstring = $qs[3];
- }else{
- if(isset($mode) && $mode=='catall'){
- $orderstring = ($content_pref["content_catall_defaultorder"] ? $content_pref["content_catall_defaultorder"] : "orderaheading" );
- }elseif(isset($mode) && $mode=='cat'){
- $orderstring = ($content_pref['content_cat_defaultorder'] ? $content_pref['content_cat_defaultorder'] : "orderaheading" );
- }elseif(isset($mode) && $mode=='archive'){
- $orderstring = ($content_pref['content_archive_defaultorder'] ? $content_pref['content_archive_defaultorder'] : "orderaheading" );
- }else{
- $orderstring = ($content_pref["content_defaultorder"] ? $content_pref["content_defaultorder"] : "orderddate" );
- }
- }
-
- if(substr($orderstring,6) == "heading"){
- $orderby = "content_heading";
- $orderby2 = "";
- }elseif(substr($orderstring,6) == "date"){
- $orderby = "content_datestamp";
- $orderby2 = ", content_heading ASC";
- }elseif(substr($orderstring,6) == "parent"){
- $orderby = "content_parent";
- $orderby2 = ", content_heading ASC";
- }elseif(substr($orderstring,6) == "refer"){
- $orderby = "content_refer";
- $orderby2 = ", content_heading ASC";
- }elseif(substr($orderstring,6) == "author"){
-
- }elseif(substr($orderstring,6) == "order"){
- if(isset($mode) && $mode=='catall'){
- $orderby = "content_order+0";
- }elseif(isset($mode) && $mode=='cat'){
- $orderby = "content_order+0";
- }else{
- if($qs[0] == "cat"){
- $orderby = "SUBSTRING_INDEX(content_order, '.', 1)+0";
- }elseif($qs[0] != "cat"){
- $orderby = "SUBSTRING_INDEX(content_order, '.', -1)+0";
- }
- }
- $orderby2 = ", content_heading ASC";
- }else{
- $orderstring = "orderddate";
- $orderby = "content_datestamp";
- $orderby2 = ", content_heading ASC";
- }
- $order = " ORDER BY ".$orderby." ".(substr($orderstring,5,1) == "a" ? "ASC" : "DESC")." ".$orderby2." ";
- return $order;
- }
-
- function getIcon($mode, $icon, $path="", $linkid="", $width="", $blank=""){
- global $content_pref;
-
- $blank = (!$blank ? "0" : $blank);
- $border = "border:0;";
- $hrefpre = ($linkid ? "" : "");
- $hrefpost = ($linkid ? " " : "");
-
- if($mode == "item"){
- $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_pref['content_icon_path']."blank.gif" : ""));
-
- }elseif($mode == "catsmall"){
- $path = (!$path ? $content_pref['content_cat_icon_path_small'] : $path);
- $icon = ($icon ? $path.$icon : "");
-
- }elseif($mode == "catlarge"){
- $path = (!$path ? $content_pref['content_cat_icon_path_large'] : $path);
- $icon = ($icon ? $path.$icon : "");
- }else{
- $path = (!$path ? $content_pref['content_icon_path'] : $path);
- $hrefpre = "";
- $hrefpost = "";
- $width = "";
- $icon = ($icon ? $path.$icon : ($blank ? $content_pref['content_icon_path']."blank.gif" : ""));
- }
-
- if($icon && is_readable($icon)){
- $iconstring = $hrefpre." ".$hrefpost;
- }else{
- $iconstring = "";
- if($blank){
- 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." ".$hrefpost;
- }
- }
- }
- return $iconstring;
- }
-
- function prepareAuthor($mode, $author, $id){
- global $aa, $content_pref;
- if($mode == ''){return;}
-
- $authorinfo = "";
- 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( varsettrue($content_pref["content_{$mode}_authorname"]) ){
- if(isset($content_pref["content_{$mode}_authoremail"]) && $authordetails[2]){
- if($authordetails[0] == "0"){
- if( varsettrue($content_pref["content_{$mode}_authoremail_nonmember"]) && strpos($authordetails[2], "@") ){
- $authorinfo = preg_replace("#([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "".$authordetails[1]." ", $authordetails[2]);
- }else{
- $authorinfo = $authordetails[1];
- }
- }else{
- $authorinfo = preg_replace("#([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "".$authordetails[1]." ", $authordetails[2]);
- }
- }else{
- $authorinfo = $authordetails[1];
- }
- if(USER && is_numeric($authordetails[0]) && $authordetails[0] != "0" && varsettrue($content_pref["content_{$mode}_authorprofile"]) ){
- $authorinfo .= " ".CONTENT_ICON_USER." ";
- }
- }
- if( varsettrue($content_pref["content_{$mode}_authoricon"]) ){
- $authorinfo .= " ".CONTENT_ICON_AUTHORLIST." ";
- }
- }
- return $authorinfo;
- }
-
- //search by keyword
- function showOptionsSearch($mode, $searchtypeid=""){
- global $plugindir, $plugintable, $qs, $rs;
-
- if(!is_object($rs)){
- require_once(e_HANDLER."form_handler.php");
- $rs = new form;
- }
- if(!isset($searchtypeid)){
- $searchtypeid = (is_numeric($qs[1]) ? $qs[1] : $qs[2]);
- }
- if($mode == "menu"){
- $CONTENT_SEARCH_TABLE_KEYWORD = $rs -> form_open("post", $plugindir."content.php?recent.$searchtypeid", "contentsearchmenu_{$mode}", "", "enctype='multipart/form-data'")."
".$rs -> form_close();
- }else{
- $searchfieldname = "searchfield_{$mode}";
- $CONTENT_SEARCH_TABLE_KEYWORD = $rs -> form_open("post", $plugindir."content.php?recent.$searchtypeid", "contentsearch_{$mode}", "", "enctype='multipart/form-data'")."
-
-
- ".$rs -> form_close();
- }
- return $CONTENT_SEARCH_TABLE_KEYWORD;
- }
-
- //redirection links in dropdown
- function showOptionsSelect($mode, $searchtypeid=""){
- global $plugindir, $plugintable, $rs, $qs, $content_pref;
-
- if(!is_object($rs)){
- require_once(e_HANDLER."form_handler.php");
- $rs = new form;
- }
- if(!isset($searchtypeid)){
- $searchtypeid = (is_numeric($qs[1]) ? $qs[1] : $qs[2]);
- }
- $catarray = "";
- $mainparent = $this -> getMainParent( $searchtypeid );
- $content_pref = $this -> getContentPref($mainparent, true);
- $parent = $this -> getCategoryTree("", $mainparent, TRUE);
- $parent = array_merge_recursive($parent);
- for($a=0;$a form_option($emptystring, "0", "none");
- }
- foreach($newparent as $key => $value){
- $n = "";
- if($mode == "page" || ($mode == "menu" && isset($content_pref["content_menu_cat_number"])) ){
- $n = $this -> countCatItems($key);
- $n = " (".$n." ".($n == "1" ? CONTENT_LAN_53 : CONTENT_LAN_54).")";
- }
- if( ($content_pref["content_menu_cat_main"] && $key == $mainparent) || $key != $mainparent ){
- $value = (strlen($value) > 25 ? substr($value,0,25)."..." : $value);
- $catarray .= $rs -> form_option($value.$n, 0, $plugindir."content.php?cat.".$key);
- }
- }
-
- if($mode == "page" || ($mode == "menu" && ($content_pref["content_menu_links"] && $content_pref["content_menu_links_dropdown"]) || ($content_pref["content_menu_cat"] && $content_pref["content_menu_cat_dropdown"]) ) ){
- if($mode == "menu"){ $style = "style='width:100%;' "; }else{ $style = ""; }
- $CONTENT_SEARCH_TABLE_SELECT = "
- ".$rs -> form_open("post", $plugindir."content.php".(e_QUERY ? "?".e_QUERY : ""), "contentredirect".$mode, "", "enctype='multipart/form-data'")."
- ";
-
- 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");
-
- if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewallcat"])){
- $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_6, 0, $plugindir."content.php?cat.list.".$mainparent);
- }
- if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewallauthor"])){
- $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_7, 0, $plugindir."content.php?author.list.".$mainparent);
- }
- if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewallitems"])){
- $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_83, 0, $plugindir."content.php?list.".$mainparent);
- }
- if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewtoprated"])){
- $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_8, 0, $plugindir."content.php?top.".$mainparent);
- }
- if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewtopscore"])){
- $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_12, 0, $plugindir."content.php?score.".$mainparent);
- }
- if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewrecent"])){
- $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_61, 0, $plugindir."content.php?recent.".$mainparent);
- }
- if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewsubmit"])){
- $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_75, 0, $plugindir."content_manager.php");
- }
- }
- if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_cat"] && $content_pref["content_menu_cat_dropdown"])){
- if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_links"] && $content_pref["content_menu_links_dropdown"]) ){
- $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(" ", "0", "none");
- }
- $CONTENT_SEARCH_TABLE_SELECT .= $catarray;
- }
- $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_select_close()."
".$rs -> form_close();
- }
- return $CONTENT_SEARCH_TABLE_SELECT;
- }
-
- //ordering in dropdown
- function showOptionsOrder($mode, $ordertypeid=""){
- global $plugindir, $rs, $qs;
-
- if(!is_object($rs)){
- require_once(e_HANDLER."form_handler.php");
- $rs = new form;
- }
- if(!isset($ordertypeid)){
- $ordertypeid = (is_numeric($qs[1]) ? $qs[1] : $qs[2]);
- }
-
- $text = "";
- if(strpos(e_SELF, 'content.php') !== FALSE){
- if(e_QUERY){
- $check = "";
- for($i=0;$i form_open("post", $baseurl."?$qs[0].$ordertypeid", "contentsearchorder{$mode}", "", "enctype='multipart/form-data'");
- $text .= "";
- $text .= $rs -> form_option(CONTENT_ORDER_LAN_0, 1, "none");
-
- if($qs[0] == "author" && $qs[1] == "list"){
- $text .= $rs -> form_option(CONTENT_ORDER_LAN_11, ($check == "orderaauthor" ? "1" : "0"), $baseurl."?".$qry.".orderaauthor" );
- $text .= $rs -> form_option(CONTENT_ORDER_LAN_12, ($check == "orderdauthor" ? "1" : "0"), $baseurl."?".$qry.".orderdauthor" );
- }else{
- $text .= $rs -> form_option(CONTENT_ORDER_LAN_1, ($check == "orderaheading" ? "1" : "0"), $baseurl."?".$qry.".orderaheading" );
- $text .= $rs -> form_option(CONTENT_ORDER_LAN_2, ($check == "orderdheading" ? "1" : "0"), $baseurl."?".$qry.".orderdheading" );
- $text .= $rs -> form_option(CONTENT_ORDER_LAN_3, ($check == "orderadate" ? "1" : "0"), $baseurl."?".$qry.".orderadate" );
- $text .= $rs -> form_option(CONTENT_ORDER_LAN_4, ($check == "orderddate" ? "1" : "0"), $baseurl."?".$qry.".orderddate" );
- $text .= $rs -> form_option(CONTENT_ORDER_LAN_5, ($check == "orderarefer" ? "1" : "0"), $baseurl."?".$qry.".orderarefer" );
- $text .= $rs -> form_option(CONTENT_ORDER_LAN_6, ($check == "orderdrefer" ? "1" : "0"), $baseurl."?".$qry.".orderdrefer" );
- $text .= $rs -> form_option(CONTENT_ORDER_LAN_7, ($check == "orderaparent" ? "1" : "0"), $baseurl."?".$qry.".orderaparent" );
- $text .= $rs -> form_option(CONTENT_ORDER_LAN_8, ($check == "orderdparent" ? "1" : "0"), $baseurl."?".$qry.".orderdparent" );
- $text .= $rs -> form_option(CONTENT_ORDER_LAN_9, ($check == "orderaorder" ? "1" : "0"), $baseurl."?".$qry.".orderaorder" );
- $text .= $rs -> form_option(CONTENT_ORDER_LAN_10, ($check == "orderdorder" ? "1" : "0"), $baseurl."?".$qry.".orderdorder" );
- }
- $text .= $rs -> form_select_close();
- $text .= "
";
- $text .= $rs -> form_close();
- }
- }
- return $text;
- }
-
- //function to create the php menu file
- function CreateParentMenu($parentid){
- global $plugintable, $plugindir, $tp, $datequery;
-
- if(!is_object($sqlcreatemenu)){ $sqlcreatemenu = new db; }
- if(!$sqlcreatemenu -> db_Select($plugintable, "content_heading", "content_id='".intval($parentid)."' ")){
- return FALSE;
- }else{
- $row = $sqlcreatemenu -> db_Fetch();
- }
-
- $content_path_menu = $plugindir."menus/";
- if(!is_writable($content_path_menu)){
- echo "".CONTENT_ADMIN_ITEM_LAN_22." ".$content_path_menu." ".CONTENT_ADMIN_ITEM_LAN_23." ";
- return FALSE;
- }
-
- $menufile = "content_".$row['content_heading'];
- $menuname = $row['content_heading'];
-
- $data = chr(60)."?php\n". chr(47)."*\n+---------------------------------------------------------------+\n| e107 website system\n| ".e_PLUGIN."content/menus/".$menufile."_menu.php\n|\n| ©Copyright (C) 2008-2009 e107 Inc (e107.org)\n| http://e107.org\n| jalist@e107.org\n|\n| Released under the terms and conditions of the\n| GNU General Public License (http://gnu.org).\n+---------------------------------------------------------------+\n\nThis file has been generated by ".e_PLUGIN."content/handlers/content_class.php.\n\n*". chr(47)."\n";
- $data .= "\n";
- $data .= "unset(\$text);\n";
- $data .= "\$text = \"\";\n";
- $data .= "\$menutypeid = \"$parentid\";\n";
- $data .= "\$menuname = \"$menuname\";\n";
- $data .= "\n";
- $data .= "\$plugindir = e_PLUGIN.'content/';\n";
- $data .= "\$plugintable = \"pcontent\"; //name of the table used in this plugin (never remove this, as it's being used throughout the plugin !!)\n";
- $data .= "\$datequery = \" AND content_datestamp < \".time().\" AND (content_enddate=0 || content_enddate>\".time().\") \";\n";
- $data .= "\n";
- $data .= "global \$tp;\n";
- $data .= "require_once(e_PLUGIN.'content/content_shortcodes.php');\n";
- $data .= "require_once(e_PLUGIN.'content/handlers/content_class.php');\n";
- $data .= "\$aa = new content;\n";
- $data .= "require_once(e_HANDLER.'form_handler.php');\n";
- $data .= "\$rs = new form;\n";
- $data .= "\$gen = new convert;\n";
- $data .= "global \$tp;\n";
- $data .= "\n";
- $data .= "include_lan(e_PLUGIN.'content/languages/'.e_LANGUAGE.'/lan_content.php');\n";
- $data .= '
- $bullet = \'\';
- if(defined(\'BULLET\'))
- {
- $bullet = \' \';
- }
- elseif(file_exists(THEME.\'images/bullet2.gif\'))
- {
- $bullet = \' \';
- }
- ';
-
- $data .= "\$content_pref = \$aa -> getContentPref(\$menutypeid, true);\n";
- $data .= "\n";
- $data .= "// load the template --------------------------------------------------\n";
- $data .= "if(!isset(\$CONTENT_MENU)){\n";
- $data .= " if(!\$content_pref[\"content_theme\"]){\n";
- $data .= " require_once(\$plugindir.\"templates/default/content_menu_template.php\");\n";
- $data .= " }else{\n";
- $data .= " if(is_readable(\$tp->replaceConstants(\$content_pref[\"content_theme\"]).\"content_menu_template.php\")){\n";
- $data .= " require_once(\$tp->replaceConstants(\$content_pref[\"content_theme\"]).\"content_menu_template.php\");\n";
- $data .= " }else{\n";
- $data .= " require_once(\$plugindir.\"templates/default/content_menu_template.php\");\n";
- $data .= " }\n";
- $data .= " }\n";
- $data .= "}\n";
- $data .= "\n";
- $data .= "//get category array\n";
- $data .= "\$array = \$aa -> getCategoryTree(\"\", intval(\$menutypeid), TRUE);\n";
- $data .= "\n";
- $data .= "// menu visibility --------------------------------------------------\n";
- $data .= "if(isset(\$content_pref[\"content_menu_visibilitycheck\"]) && \$content_pref[\"content_menu_visibilitycheck\"]){\n";
- $data .= " \$check='';\n";
- $data .= " //if url contains plugin/content\n";
- $data .= " if(strpos(e_SELF, e_PLUGIN_ABS.\"content/\")!==FALSE){\n";
- $data .= " //if current page is content.php\n";
- $data .= " if(e_PAGE == 'content.php'){\n";
- $data .= " if(e_QUERY){\n";
- $data .= " \$qs=explode(\".\",e_QUERY);\n";
- $data .= " if(isset(\$qs[0]) && in_array(\$qs[0], array('recent','cat','top','score','author','list','content')) ){\n";
- $data .= " if(isset(\$qs[1]) && is_numeric(\$qs[1])){\n";
- $data .= " \$check = intval(\$qs[1]);\n";
- $data .= " }elseif(isset(\$qs[1]) && \$qs[1]=='list'){\n";
- $data .= " if(isset(\$qs[2]) && is_numeric(\$qs[2])){\n";
- $data .= " \$check = intval(\$qs[2]);\n";
- $data .= " }\n";
- $data .= " }\n";
- $data .= " //content item\n";
- $data .= " if(isset(\$qs[0]) && \$qs[0]=='content' && is_numeric(\$qs[1])){\n";
- $data .= " if(\$sql -> db_Select('pcontent', \"content_parent\", \" content_id='\".intval(\$check).\"' \")){\n";
- $data .= " \$row = \$sql -> db_Fetch();\n";
- $data .= " \$check = \$row['content_parent'];\n";
- $data .= " }\n";
- $data .= " }\n";
- $data .= " }\n";
- $data .= " }\n";
- $data .= " }\n";
- $data .= " }\n";
- $data .= " if(is_numeric(\$check) && in_array(\$check, array_keys(\$array)) ){\n";
- $data .= " //continue\n";
- $data .= " }else{\n";
- $data .= " //do not show menu, so return empty\n";
- $data .= " return;\n";
- $data .= " }\n";
- $data .= "}\n";
- $data .= "// end menu visibility --------------------------------------------------\n";
- $data .= "\n";
- $data .= "global \$icon, \$bullet, \$row, \$CMT_CATEGORY, \$CMT_RECENT;\n";
- $data .= "\$icon = \$tp->parseTemplate(\"{CM_MENU_LINKS_ICON}\",TRUE,\$content_shortcodes);\n";
- $data .= "\n";
- $data .= "//##### CATEGORY LIST --------------------------------------------------\n";
- $data .= "\$CMT_CATEGORY = '';\n";
- $data .= "if(!\$content_pref[\"content_menu_cat_dropdown\"]){\n";
- $data .= " if(\$content_pref[\"content_menu_cat\"]){\n";
- $data .= " \$newparent = \"\";\n";
- $data .= " \$checkid = \"\";\n";
- $data .= " \$newarray = array_merge_recursive(\$array);\n";
- $data .= " for(\$a=0;\$a CONTENTREGEXP(\$validparent).\"' \";\n";
- $data .= "\n";
- $data .= " if(\$resultitem = \$sql -> db_Select(\$plugintable, \"content_id, content_heading, content_subheading, content_author, content_icon, content_datestamp\", \"content_refer !='sa' AND \".\$qry.\" \".\$datequery.\" AND content_class REGEXP '\".e_CLASS_REGEXP.\"' ORDER BY content_datestamp DESC LIMIT 0,\".\$content_pref[\"content_menu_recent_number\"] )){\n";
- $data .= "\n";
- $data .= " \$CMT_RECENT .= \$tp->parseTemplate(\$CONTENT_MENU_RECENT_START,TRUE,\$content_shortcodes);\n";
- $data .= " while(\$row = \$sql -> db_Fetch()){\n";
- $data .= " \$CMT_RECENT .= \$tp->parseTemplate(\$CONTENT_MENU_RECENT_TABLE,TRUE,\$content_shortcodes);\n";
- $data .= " }\n";
- $data .= " \$CMT_RECENT .= \$tp->parseTemplate(\$CONTENT_MENU_RECENT_END,TRUE,\$content_shortcodes);\n";
- $data .= " }\n";
- $data .= "}\n";
- $data .= "\n";
- $data .= "//##### PARSE THE MENU --------------------------------------------------\n";
- $data .= "\$text = \$tp->parseTemplate(\$CONTENT_MENU,TRUE,\$content_shortcodes);\n";
- $data .= "\n";
- $data .= "if(!isset(\$text)){ \$text = CONTENT_MENU_LAN_1; }\n";
- $data .= "\$caption = (\$content_pref[\"content_menu_caption\"] != \"\" ? \$content_pref[\"content_menu_caption\"] : CONTENT_MENU_LAN_0.\" \".\$menuname);\n";
- $data .= "\$ns -> tablerender(\$caption, \$text, '$menufile');\n";
- $data .= "\n";
- $data .= "?".chr(62);
-
- if(file_exists($plugindir."menus/".$menufile."_menu.php")){
- $message = "";
- }else{
- $fp = @fopen($plugindir."menus/".$menufile."_menu.php", "w");
- if (!@fwrite($fp, $data)) {
- $message = CONTENT_ADMIN_CAT_LAN_51;
- } else {
- fclose($fp);
- $message = CONTENT_ADMIN_CAT_LAN_50;
- }
- }
- return $message;
- }
-} //close class
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/handlers/content_convert_class.php b/e107_plugins/content/handlers/content_convert_class.php
deleted file mode 100644
index 73fb02aaf..000000000
--- a/e107_plugins/content/handlers/content_convert_class.php
+++ /dev/null
@@ -1,908 +0,0 @@
-".time().") ";
-
-include_lan(e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content.php");
-include_lan(e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content_admin.php");
-
-require_once($plugindir."handlers/content_class.php");
-$aa = new content;
-
-class content_convert{
-
-
- //update content_author
- function upgrade_1_2(){
- global $sql;
-
- $text = "";
- $field1 = $sql->db_Field("pcontent",19);
- $field2 = $sql->db_Field("pcontent",20);
- $field3 = $sql->db_Field("pcontent",21);
- if($field1 != "content_score" && $field2 != "content_meta" && $field3 != "content_layout"){
- mysql_query("ALTER TABLE ".MPREFIX."pcontent ADD content_score TINYINT ( 3 ) UNSIGNED NOT NULL DEFAULT '0';");
- mysql_query("ALTER TABLE ".MPREFIX."pcontent ADD content_meta TEXT NOT NULL;");
- mysql_query("ALTER TABLE ".MPREFIX."pcontent ADD content_layout VARCHAR ( 255 ) NOT NULL DEFAULT '';");
- $text = CONTENT_ADMIN_CONVERSION_LAN_64." ";
- }
- return $text;
- }
-
- //update content_author
- function upgrade_1_21(){
- global $sql;
- $sql = new db; $sql1 = new db;
- $upgrade = FALSE;
- if($sql -> db_Select("pcontent", "content_id, content_author", "content_author != '' ")){
- while($row = $sql -> db_Fetch()){
- if(is_numeric($row['content_author'])){
- }else{
- $tmp = explode("^", $row['content_author']);
- if($tmp[0] == "0"){
- $upgrade = TRUE;
- $newauthor = $tmp[1].($tmp[2] ? "^".$tmp[2] : "");
- $sql1 -> db_Update("pcontent", " content_author = '".$newauthor."' WHERE content_id='".$row['content_id']."' ");
- }
- }
- }
- }
- if($upgrade){
- return CONTENT_ADMIN_CONVERSION_LAN_65." ";
- }else{
- return FALSE;
- }
- }
-
- //update preferences storage method
- function upgrade_1_22(){
- global $sql, $sql2, $eArrayStorage, $tp, $aa;
-
- $upgrade = TRUE;
-
- $sqlc = new db;
- $sqld = new db;
-
- //convert preferences for core default preferences
- if($sqlc -> db_Select("core", "*", "e107_name='pcontent' ")){
- $row = $sqlc -> db_Fetch();
-
- $tmp = $eArrayStorage->ReadArray($row['e107_value']);
-
- //replace the id value for the content_pref
- $content_pref = array();
- foreach($tmp as $k=>$v){
- if(substr($k,-2) == "_0"){
- $k = str_replace("_0", "", $k);
- }
- if(strpos($k, "content_") === 0){
- $content_pref[$k] = $tp->toDB($v);
- }
- }
- if(!isset($content_pref['content_admin_subheading'])){
- //add new options to the preferences
- $content_pref = $this->upgrade_1_22_prefs($content_pref);
-
- $tmp1 = $eArrayStorage->WriteArray($content_pref);
- $sqld -> db_Update("core", "e107_value = '{$tmp1}' WHERE e107_name = 'pcontent' ");
- }else{
- $upgrade=FALSE;
- }
- }
-
- //convert preferences for all main parents
- if($sqlc -> db_Select("pcontent", "content_id, content_heading, content_pref", "LEFT(content_parent, 1) = '0' ")){
- while($row=$sqlc->db_Fetch()){
-
- $id = $row['content_id'];
- $tmp = $eArrayStorage->ReadArray($row['content_pref']);
-
- //replace the id value for the content_pref
- $l = strlen($id);
- $content_pref = array();
- foreach($tmp as $k=>$v){
- if(substr($k,-($l+1)) == "_".$id){
- $k = str_replace("_".$id, "", $k);
- }
- if(strpos($k, "content_") === 0){
- $content_pref[$k] = $tp->toDB($v);
- }
- }
- //add new options to the preferences
- if(!isset($content_pref['content_admin_subheading'])){
- $content_pref = $this->upgrade_1_22_prefs($content_pref);
-
- $tmp1 = $eArrayStorage->WriteArray($content_pref);
- $sqld -> db_Update("pcontent", "content_pref='{$tmp1}' WHERE content_id='$id' ");
- }else{
- $upgrade=FALSE;
- }
-
- //update menus
- $plugintable = "pcontent";
- $plugindir = e_PLUGIN."content/";
- if(!is_object($aa)){
- require_once($plugindir."handlers/content_class.php");
- $aa = new content;
- }
- if($row['content_parent']==0){
- //remove menu
- @unlink(e_PLUGIN."content/menus/content_".$row['content_heading']."_menu.php");
- //create menu
- $aa -> CreateParentMenu($id);
- }
- }
- }
-
- if($upgrade===TRUE){
- return CONTENT_ADMIN_CONVERSION_LAN_66." ";
- }
- }
-
- //add new preferences that come with this upgrade
- function upgrade_1_22_prefs($content_pref){
-
- //create : item page
- $content_pref['content_admin_subheading'] = '1';
- $content_pref['content_admin_summary'] = '1';
- $content_pref['content_admin_startdate'] = '1';
- $content_pref['content_admin_enddate'] = '1';
-
- //create : category page
- $content_pref['content_admincat_subheading'] = '1';
- $content_pref['content_admincat_comment'] = '1';
- $content_pref['content_admincat_rating'] = '1';
- $content_pref['content_admincat_pe'] = '1';
- $content_pref['content_admincat_visibility'] = '1';
- $content_pref['content_admincat_startdate'] = '1';
- $content_pref['content_admincat_enddate'] = '1';
- $content_pref['content_admincat_uploadicon'] = '1';
- $content_pref['content_admincat_selecticon'] = '1';
-
- //create : submit page
- $content_pref['content_submit_subheading'] = '1';
- $content_pref['content_submit_summary'] = '1';
- $content_pref['content_submit_startdate'] = '1';
- $content_pref['content_submit_enddate'] = '1';
-
- //content manager
- $content_pref['content_manager_approve'] = '255';
- $content_pref['content_manager_personal'] = '255';
- $content_pref['content_manager_category'] = '255';
-
- return $content_pref;
- }
-
-
- //update preferences storage method
- function upgrade_1_23(){
- global $sql, $sql2, $eArrayStorage, $tp, $aa;
-
- $upgrade = TRUE;
-
- $sqlc = new db;
- $sqld = new db;
- //add new preferences in core
- if($sqlc -> db_Select("core", "*", "e107_name='pcontent' ")){
- $row = $sqlc -> db_Fetch();
-
- $content_pref = $eArrayStorage->ReadArray($row['e107_value']);
-
- //add new options to the preferences
- if(!isset($content_pref['content_admin_subheading'])){
- $content_pref = $this->upgrade_1_23_prefs($content_pref);
-
- $tmp1 = $eArrayStorage->WriteArray($content_pref);
- $sqld -> db_Update("core", "e107_value = '{$tmp1}' WHERE e107_name = 'pcontent' ");
- }else{
- $upgrade=FALSE;
- }
- }
-
- //add new preferences for each main parent
- if($sqlc -> db_Select("pcontent", "content_id, content_heading, content_pref", "content_parent = '0' ")){
- while($row=$sqlc->db_Fetch()){
-
- $id = $row['content_id'];
- $content_pref = $eArrayStorage->ReadArray($row['content_pref']);
-
- if(!isset($content_pref['content_admin_subheading'])){
- //add new options to the preferences
- $content_pref = $this->upgrade_1_23_prefs($content_pref);
-
- $tmp1 = $eArrayStorage->WriteArray($content_pref);
- $sqld -> db_Update("pcontent", "content_pref='{$tmp1}' WHERE content_id='$id' ");
- }else{
- $upgrade=FALSE;
- }
- }
- }
- if($upgrade===TRUE){
- return CONTENT_ADMIN_CONVERSION_LAN_67." ";
- }
- }
- //add new preferences that come with this upgrade
- function upgrade_1_23_prefs($content_pref){
-
- $content_pref['content_list_caption'] = CONTENT_LAN_23; //caption for recent list
- $content_pref['content_list_caption_append_name'] = '1'; //append category heading to caption
- $content_pref['content_catall_caption'] = CONTENT_LAN_25; //caption for all categories page
- $content_pref['content_cat_caption'] = CONTENT_LAN_26; //caption for single category page
- $content_pref['content_cat_caption_append_name'] = '1'; //append category heading to caption
- $content_pref['content_cat_sub_caption'] = CONTENT_LAN_28; //caption for subcategories
- $content_pref['content_cat_item_caption'] = CONTENT_LAN_31; //caption for items in category
- $content_pref['content_author_index_caption'] = CONTENT_LAN_32; //caption for author index page
- $content_pref['content_author_caption'] = CONTENT_LAN_32; //caption for single author page
- $content_pref['content_author_caption_append_name'] = '1'; //append author name to caption
- $content_pref['content_archive_caption'] = CONTENT_LAN_84; //caption for archive page
- $content_pref['content_top_icon_width'] = ''; //use this size for icon
- $content_pref['content_top_caption'] = CONTENT_LAN_38; //caption for top rated page
- $content_pref['content_top_caption_append_name'] = '1'; //append category heading to caption
- $content_pref['content_score_icon_width'] = ''; //use this size for icon
- $content_pref['content_score_caption'] = CONTENT_LAN_87; //caption for top score page
- $content_pref['content_score_caption_append_name'] = '1'; //append category heading to caption
-
- return $content_pref;
- }
-
- //update custom theme
- function upgrade_1_24(){
- global $sql, $sql2, $eArrayStorage, $tp, $aa;
-
- $upgrade = TRUE;
-
- $sqlc = new db;
- $sqld = new db;
- //add new preferences in core
- if($sqlc -> db_Select("core", "*", "e107_name='pcontent' ")){
- $row = $sqlc -> db_Fetch();
-
- $content_pref = $eArrayStorage->ReadArray($row['e107_value']);
-
- //update theme
- if(strpos($content_pref['content_theme'], "{e_")!==FALSE){
- }else{
- $content_pref['content_theme'] = "{e_PLUGIN}content/templates/".$content_pref['content_theme']."/";
- }
-
- $tmp1 = $eArrayStorage->WriteArray($content_pref);
- $sqld -> db_Update("core", "e107_value = '{$tmp1}' WHERE e107_name = 'pcontent' ");
- }
-
- //add new preferences for each main parent
- if($sqlc -> db_Select("pcontent", "content_id, content_heading, content_pref", "content_parent = '0' ")){
- while($row=$sqlc->db_Fetch()){
-
- $id = $row['content_id'];
- $content_pref = $eArrayStorage->ReadArray($row['content_pref']);
-
- //update theme
- if(strpos($content_pref['content_theme'], "{e_")!==FALSE){
- }else{
- $content_pref['content_theme'] = "{e_PLUGIN}content/templates/".$content_pref['content_theme']."/";
- }
-
- $tmp1 = $eArrayStorage->WriteArray($content_pref);
- $sqld -> db_Update("pcontent", "content_pref='{$tmp1}' WHERE content_id='$id' ");
- }
- }
- return CONTENT_ADMIN_CONVERSION_LAN_68." ";
- }
-
- //convert rows
- function upgrade_1_1(){
- global $sql, $sql2, $tp, $plugintable, $eArrayStorage;
- $plugintable = "pcontent";
-
- $count = "0";
- $sql = new db;
- $thiscount = $sql -> db_Select("pcontent", "*", "ORDER BY content_id ", "mode=no_where" );
- if($thiscount > 0){
- while($row = $sql -> db_Fetch()){
-
- //main parent
- if($row['content_parent'] == "0"){
- $newparent = "0";
-
- //subcat
- }elseif(substr($row['content_parent'],0,2) == "0."){
- $newparent = "0".strrchr($row['content_parent'], ".");
-
- //item
- }elseif( strpos($row['content_parent'], ".") && substr($row['content_parent'],0,1) != "0"){
- $newparent = substr(strrchr($row['content_parent'], "."),1);
- }
-
- $sql2 -> db_Update("pcontent", " content_parent = '".$newparent."', content_pref='' WHERE content_id='".$row['content_id']."' ");
- }
- }
- return CONTENT_ADMIN_CONVERSION_LAN_58." ".CONTENT_ADMIN_CONVERSION_LAN_46." ";
- }
-
-
-
-
- function show_main_intro(){
- global $sql, $ns, $rs, $type, $type_id, $action, $sub_action, $id, $plugintable;
- $plugintable = "pcontent";
-
- if(!is_object($sql)){ $sql = new db; }
- $newcontent = $sql -> db_Count($plugintable, "(*)", "");
- if($newcontent > 0){
- return false;
- }else{
-
- $text .= "
-
-
- ".$rs -> form_open("post", e_SELF, "dataform")."
-
";
-
- $oldcontent = $sql -> db_Count("content", "(*)", "");
- if($oldcontent > 0){
- $text .= " ";
-
- $text .= " ";
- $text .= "".CONTENT_ADMIN_MAIN_LAN_18." ";
- $text .= " ";
- $text .= "
-
-
-
- ";
-
- $text .= " ";
- $text .= "".CONTENT_ADMIN_MAIN_LAN_22." ";
- $text .= " ";
- $text .= "
-
-
-
- ";
-
- $text .= " ";
- $text .= "".CONTENT_ADMIN_MAIN_LAN_20." ";
- $text .= " ";
- $text .= "
-
-
-
- ";
-
- }else{
- $text .= "".CONTENT_ADMIN_MAIN_LAN_8." ".CONTENT_ADMIN_MAIN_LAN_9." ".CONTENT_ADMIN_MAIN_LAN_24." ";
- $text .= " ";
- $text .= "
-
-
-
- ";
- }
-
- $text .= "
".$rs -> form_close()."
-
-
";
-
- $ns -> tablerender(CONTENT_ADMIN_MAIN_LAN_7, $text);
- return true;
- }
- }
-
- //function to insert default preferences for a main parent
- function insert_default_prefs($id){
- global $sql, $aa, $plugintable, $eArrayStorage;
- $plugintable = "pcontent";
- $plugindir = e_PLUGIN."content/";
- unset($content_pref, $tmp);
-
- if(!is_object($aa)){
- require_once($plugindir."handlers/content_class.php");
- $aa = new content;
- }
-
- $content_pref = $aa -> ContentDefaultPrefs($id);
- $tmp = $eArrayStorage->WriteArray($content_pref);
-
- $sql -> db_Update($plugintable, "content_pref='$tmp' WHERE content_id='$id' ");
- }
-
-
- //function to convert comments
- function convert_comments(){
- global $plugintable;
- $plugintable = "pcontent";
-
- if(!is_object($sqlcc)){ $sqlcc = new db; }
- $numc = $sqlcc -> db_Count("comments", "(*)", "WHERE comment_type = '1' ");
- if($numc > 0){
- $sqlcc -> db_Update("comments", "comment_type = '".$plugintable."' WHERE comment_type = '1' ");
- }
- }
-
-
- //function to convert rating
- function convert_rating(){
- global $plugintable;
- $plugintable = "pcontent";
-
- if(!is_object($sqlcr)){ $sqlcr = new db; }
- $numr = $sqlcr -> db_Count("rate", "(*)", "WHERE (rate_table = 'article' || rate_table = 'review' || rate_table = 'content') ");
- if($numr > 0){
- $sqlcr -> db_Update("rate", "rate_table = '".$plugintable."' WHERE (rate_table = 'article' || rate_table = 'review' || rate_table = 'content') ");
- }
- }
-
-
- //create main parent
- function create_mainparent($name, $tot, $order){
- global $sql, $aa, $plugintable, $tp;
- $plugintable = "pcontent";
-
- $sql = new db;
- $sql -> db_Select("content", "MAX(content_id) as maxcid", "", "mode=no_where");
- list($maxcid) = $sql -> db_Fetch();
- $newid = $maxcid + $order;
-
- // ##### STAGE 4 : INSERT MAIN PARENT FOR ARTICLE ---------------------------------------------
- $checkinsert = FALSE;
- if($tot > 0){
- //if(!is_object($sql)){ $sql = new db; }
- $sql = new db;
- if(!$sql -> db_Select($plugintable, "content_heading", "content_heading = '".$name."' AND content_parent = '0' ")){
- $name = $tp -> toDB($name);
-
- $sql -> db_Insert($plugintable, "'".$newid."', '".$name."', '', '', '', '1', '', '', '', '0', '0', '0', '0', '', '".time()."', '0', '0', '', '".$order."', '0', '', '' ");
-
- //check if row is present in the db (is it a valid insert)
- //if(!is_object($sql2)){ $sql2 = new db; }
- $sql2 = new db;
- if(!$sql2 -> db_Select($plugintable, "content_id", "content_heading = '".$name."' ")){
- $message = CONTENT_ADMIN_CONVERSION_LAN_45;
- }else{
- $message = $name." ".CONTENT_ADMIN_CONVERSION_LAN_7." ";
- $checkinsert = TRUE;
-
- //select main parent id
- $sql3 = new db;
- //if(!is_object($sql3)){ $sql3 = new db; }
- $sql3 -> db_Select($plugintable, "content_id", "content_heading = '".$name."' AND content_parent = '0' ");
- list($main_id) = $sql3 -> db_Fetch();
-
- //insert default preferences
- $this -> insert_default_prefs($main_id);
-
- //create menu
- $aa -> CreateParentMenu($main_id);
-
- $message .= $name." ".CONTENT_ADMIN_CONVERSION_LAN_8." ";
- }
- }else{
- $message = CONTENT_ADMIN_CONVERSION_LAN_9." ".$name." ".CONTENT_ADMIN_CONVERSION_LAN_10." : ".CONTENT_ADMIN_CONVERSION_LAN_53." ";
- }
- }else{
- $message = CONTENT_ADMIN_CONVERSION_LAN_9." ".$name." ".CONTENT_ADMIN_CONVERSION_LAN_10." ";
- }
- $create_mainparent = array($checkinsert, $message);
- return $create_mainparent;
- }
-
-
- //analayse unknown rows
- function analyse_unknown(){
- global $sql;
-
- if(!is_object($sql)){ $sql = new db; }
- $totaloldrowsunknown = $sql -> db_Select("content", "*", " NOT ( (content_parent = '1' AND content_type = '1') || (content_parent = '0' AND content_type = '1') || (content_parent = '0' AND content_type = '6') || (content_parent = '0' AND content_type = '10') || (content_type = '3' || content_type = '16') || (content_type = '0' || content_type = '15') ) ");
-
- while($row = $sql -> db_Fetch()){
- $unknown_bug[] = $row['content_id']." ".$row['content_heading'];
- $unknown_bug_id[] = $row['content_id'];
- $unknown_bug_type[] = "parent=".$row['content_parent']." - type=".$row['content_type'];
- }
- $analyse_unknown = array($unknown_bug, $unknown_bug_id);
- return $analyse_unknown;
- }
-
-
- //convert categories
- function convert_category($name, $query, $ordernr){
- global $sql, $plugintable, $tp;
- $plugintable = "pcontent";
-
- // ##### STAGE 7 : INSERT CATEGORY ----------------------------------------------------
- if(!is_object($sql)){ $sql = new db; }
- if(!$sql -> db_Select("content", "*", " ".$query." ORDER BY content_id " )){
- $cat_present = false;
- }else{
- $count = $ordernr;
- $cat_present = true;
- while($row = $sql -> db_Fetch()){
-
- //select main parent id
- if(!is_object($sql2)){ $sql2 = new db; }
- $sql2 -> db_Select($plugintable, "content_id", "content_heading = '".$name."' AND content_parent = '0' ");
- list($main_id) = $sql2 -> db_Fetch();
-
- //summary can contain link to image in e107_images/link_icons/".$summary." THIS STILL NEEDS TO BE CHECKED
- $newcontent_heading = $tp -> toDB($row['content_heading']);
- $newcontent_subheading = ($row['content_subheading'] ? $tp -> toDB($row['content_subheading']) : "");
- $newcontent_summary = ($row['content_summary'] ? $tp -> toDB($row['content_summary']) : "");
- $newcontent_text = $tp -> toDB($row['content_content']);
- $newcontent_author = (is_numeric($row['content_author']) ? $row['content_author'] : "0^".$row['content_author']);
- $newcontent_icon = "";
- $newcontent_attach = "";
- $newcontent_images = "";
- $newcontent_parent = "0.".$main_id; //make each category a first level subcat of the main parent
- $newcontent_comment = $row['content_comment'];
- $newcontent_rate = "0";
- $newcontent_pe = $row['content_pe_icon'];
- $newcontent_refer = "";
- $newcontent_starttime = $row['content_datestamp'];
- $newcontent_endtime = "0";
- $newcontent_class = $row['content_class'];
- $newcontent_pref = "";
- $newcontent_score = "0";
- $newcontent_meta = "";
- $newcontent_layout = "";
-
- if(!is_object($sql3)){ $sql3 = new db; }
- $sql3 -> db_Insert($plugintable, "'".$row['content_id']."', '".$newcontent_heading."', '".$newcontent_subheading."', '".$newcontent_summary."', '".$newcontent_text."', '".$newcontent_author."', '".$newcontent_icon."', '".$newcontent_attach."', '".$newcontent_images."', '".$newcontent_parent."', '".$newcontent_comment."', '".$newcontent_rate."', '".$newcontent_pe."', '".$newcontent_refer."', '".$newcontent_starttime."', '".$newcontent_endtime."', '".$newcontent_class."', '".$newcontent_pref."', '".$count."', '".$newcontent_score."', '".$newcontent_meta."', '".$newcontent_layout."' ");
-
- if(!$sql3 -> db_Select($plugintable, "content_id, content_heading", "content_heading = '".$newcontent_heading."' ")){
- $bug_cat_insert[] = $row['content_id']." ".$row['content_heading'];
- }else{
- $valid_cat_insert[] = $row['content_id']." ".$row['content_heading'];
- $count = $count + 1;
- }
- }
- }
- $convert_category = array($cat_present, $valid_cat_insert, $bug_cat_insert, $count);
- return $convert_category;
- }
-
-
- //convert rows
- function convert_row($name, $query, $startorder){
- global $sql, $tp, $plugintable, $eArrayStorage;
- $plugintable = "pcontent";
-
- // ##### STAGE 8 : INSERT ROW -------------------------------------------------------------
- if(!is_object($sql)){ $sql = new db; }
- if(!$thiscount = $sql -> db_Select("content", "*", " ".$query." ORDER BY content_id " )){
- $check_present = false;
- }else{
- $count = $startorder;
- $check_present = true;
- while($row = $sql -> db_Fetch()){
-
- $oldcontentid = $row['content_id'];
-
- //select main parent id
- if(!is_object($sql2)){ $sql2 = new db; }
- $sql2 -> db_Select($plugintable, "content_id", "content_heading = '".$name."' AND content_parent = '0' ");
- list($main_id) = $sql2 -> db_Fetch();
-
- //item is in main cat
- if($row['content_parent'] == "0"){
- $newcontent_parent = $main_id;
-
- //item is in sub cat
- }else{
- //select old review cat heading
- if(!is_object($sql3)){ $sql3 = new db; }
- if(!$sql3 -> db_Select("content", "content_id, content_heading", "content_id = '".$row['content_parent']."' ")){
- $bug_oldcat[] = $row['content_id']." ".$row['content_heading'];
- $newcontent_parent = $main_id;
- }else{
- list($old_cat_id, $old_cat_heading) = $sql3 -> db_Fetch();
-
- //select new cat id from the cat with the old_cat_heading
- if(!is_object($sql4)){ $sql4 = new db; }
- if(!$sql4 -> db_Select($plugintable, "content_id", "content_heading = '".$old_cat_heading."' AND content_parent = '0.".$main_id."' ")){
- $bug_newcat[] = $row['content_id']." ".$row['content_heading'];
- $newcontent_parent = $main_id;
- }else{
- list($new_cat_id) = $sql4 -> db_Fetch();
- $newcontent_parent = $new_cat_id;
- }
- }
- }
-
- if (strstr($row['content_content'], "{EMAILPRINT}")) {
- $row['content_content'] = str_replace("{EMAILPRINT}", "", $row['content_content']);
- }
-
- $newcontent_heading = $tp -> toDB($row['content_heading']);
- $newcontent_subheading = ($row['content_subheading'] ? $tp -> toDB($row['content_subheading']) : "");
- //summary can contain link to image in e107_images/link_icons/".$summary." THIS STILL NEEDS TO BE CHECKED
- $newcontent_summary = ($row['content_summary'] ? $tp -> toDB($row['content_summary']) : "");
- $newcontent_text = $tp -> toDB($row['content_content']);
- //$newcontent_author = (is_numeric($row['content_author']) ? $row['content_author'] : "0^".$row['content_author']);
- $newcontent_author = $row['content_author'];
- $newcontent_icon = "";
- $newcontent_attach = "";
- $newcontent_images = "";
- $newcontent_comment = $row['content_comment'];
- $newcontent_rate = "0";
- $newcontent_pe = $row['content_pe_icon'];
- $newcontent_refer = ($row['content_type'] == "15" || $row['content_type'] == "16" ? "sa" : "");
- $newcontent_starttime = $row['content_datestamp'];
- $newcontent_endtime = "0";
- $newcontent_class = $row['content_class'];
- $newcontent_pref = "";
- $newcontent_score = ($row['content_review_score'] && $row['content_review_score'] != "none" ? $row['content_review_score'] : "0");
- $newcontent_meta = "";
- $newcontent_layout = "";
-
- if(!is_object($sql5)){ $sql5 = new db; }
- $sql5 -> db_Insert($plugintable, "'".$row['content_id']."', '".$newcontent_heading."', '".$newcontent_subheading."', '".$newcontent_summary."', '".$newcontent_text."', '".$newcontent_author."', '".$newcontent_icon."', '".$newcontent_attach."', '".$newcontent_images."', '".$newcontent_parent."', '".$newcontent_comment."', '".$newcontent_rate."', '".$newcontent_pe."', '".$newcontent_refer."', '".$newcontent_starttime."', '".$newcontent_endtime."', '".$newcontent_class."', '".$newcontent_pref."', '1.".$count."', '".$newcontent_score."', '".$newcontent_meta."', '".$newcontent_layout."' ");
-
- if(!is_object($sql6)){ $sql6 = new db; }
- if(!$sql6 -> db_Select($plugintable, "content_id, content_heading", "content_heading = '".$newcontent_heading."' ")){
- $bug_insert[] = $row['content_id']." ".$row['content_heading'];
- }else{
- $valid_insert[] = $row['content_id']." ".$row['content_heading'];
- $count = $count + 1;
- }
- }
- }
- $convert_row = array($check_present, $count, $valid_insert, $bug_insert, $bug_oldcat, $bug_newcat);
- return $convert_row;
- }
-
-
- //show output of the category conversion
- function results_conversion_category($name, $array, $oldrows){
-
- //no pages present
- if($array[0] === false){
- if( !(count($array[1]) > 0 || count($array[2]) > 0) ){
- $text .= " ";
- }
-
- //pages present
- }else{
-
- //valid inserts
- if(count($array[1]) > 0 ){
- $text .= "
-
-
-
- ";
- }
-
- //bug inserts
- if(count($array[2]) > 0 ){
- $text .= "
-
-
-
- ";
- }
- $text .= "
-
-
-
- ";
- }
- return $text;
- }
-
-
- //show output of the item conversion
- function results_conversion_row($name, $array, $oldrows){
-
- //no rows present
- if($array[0] === false){
- $text .= " ";
-
- //rows present
- }else{
-
- //valid insert
- if(count($array[2]) > 0 ){
- $text .= "
-
-
-
- ";
- }
- //bugs : old category
- if(count($array[4]) > 0 ){
- $text .= "
-
-
-
- ";
- }
- //bugs : new category
- if(count($array[5]) > 0 ){
- $text .= "
-
-
-
- ";
- }
- //bugs : insertion failed
- if(count($array[3]) > 0 ){
- $text .= "
-
-
-
- ";
- }
-
- //analyses
- $text .= "
-
-
-
- ";
- }
-
-
- return $text;
- }
-
-
- //show output of the mainparent conversion
- function results_conversion_mainparent($content, $review, $article){
- $text = "".CONTENT_ADMIN_CONVERSION_LAN_50." ";
- $text .= "
-
-
-
-
-
-
-
-
-
-
-
- ";
-
-
-
- return $text;
- }
-
-}
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/handlers/content_db_class.php b/e107_plugins/content/handlers/content_db_class.php
deleted file mode 100644
index 3e7cc2419..000000000
--- a/e107_plugins/content/handlers/content_db_class.php
+++ /dev/null
@@ -1,556 +0,0 @@
-".time().") ";
-
-//icon, file, image upload
-if(isset($_POST['uploadfile']))
-{
- if($_POST['uploadtype'])
- {
- $pref['upload_storagetype'] = "1";
- require_once(e_HANDLER."upload_handler.php");
- $mainparent = $aa -> getMainParent(intval($_POST['parent1']));
- $content_pref = $aa -> getContentPref($mainparent);
-
- if($_POST['content_id']){
- $newpid = $_POST['content_id'];
- }else{
- $sql -> db_select("pcontent", "MAX(content_id) as aid", "content_id!='0' ");
- list($aid) = $sql -> db_Fetch();
- $newpid = $aid+1;
- }
- }
-
- //icon
- if($_POST['uploadtype'] == "1")
- {
- $pref['upload_storagetype'] = "1";
- $pathtmp = $_POST['tmppathicon'];
- $uploaded = file_upload($pathtmp);
- $new = "";
- if($uploaded){
- $uporg = $uploaded[0]['name'];
- $resize = varsettrue($content_pref["content_upload_icon_size"],"100");
- if($uporg){
- $new = $newpid."_".$uporg;
- rename($pathtmp.$uporg, $pathtmp.$new);
- require_once(e_HANDLER."resize_handler.php");
- resize_image($pathtmp.$new, $pathtmp.$new, $resize, "nocopy");
- }
- }
- $message = ($new ? CONTENT_ADMIN_ITEM_LAN_106 : CONTENT_ADMIN_ITEM_LAN_107);
-
- //file
- }
- elseif($_POST['uploadtype'] == "2")
- {
- $pref['upload_storagetype'] = "1";
- $pathtmp = $_POST['tmppathfile'];
- $uploaded = file_upload($pathtmp);
- $new = "";
- if($uploaded){
- $uporg = $uploaded[0]['name'];
- if($uporg){
- $new = $newpid."_".$uporg;
- rename($pathtmp.$uporg, $pathtmp.$new);
- }
- }
- $message = ($new ? CONTENT_ADMIN_ITEM_LAN_108 : CONTENT_ADMIN_ITEM_LAN_109);
-
- //image
- }
- elseif($_POST['uploadtype'] == "3")
- {
- $pref['upload_storagetype'] = "1";
- $pathtmp = $_POST['tmppathimage'];
- $uploaded = file_upload($pathtmp);
- $new = "";
- if($uploaded){
- $uporg = $uploaded[0]['name'];
- $resize = varsettrue($content_pref["content_upload_image_size"],"500");
- $resizethumb = varsettrue($content_pref["content_upload_image_size_thumb"],"100");
- if($uporg){
- $new = $newpid."_".$uporg;
- rename($pathtmp.$uporg, $pathtmp.$new);
- require_once(e_HANDLER."resize_handler.php");
- resize_image($pathtmp.$new, $pathtmp.$new, $resizethumb, "copy");
- resize_image($pathtmp.$new, $pathtmp.$new, $resize, "nocopy");
- }
- }
- $message = ($new ? CONTENT_ADMIN_ITEM_LAN_110 : CONTENT_ADMIN_ITEM_LAN_111);
- }
-}
-
-class contentdb{
-
- //function dbContent: create/update a content item
- //$mode : create or update
- //$type : none(=admin), submit, contentmanager
- function dbContent($mode, $type){
- global $pref, $qs, $sql, $ns, $rs, $aa, $tp, $plugintable, $e107cache, $eArrayStorage, $e_event;
-
- $_POST['content_heading'] = $tp -> toDB(trim($_POST['content_heading']));
- $_POST['content_subheading'] = $tp -> toDB($_POST['content_subheading']);
- $_POST['content_summary'] = $tp -> toDB($_POST['content_summary']);
-
- if(e_WYSIWYG)
- {
- $_POST['content_text'] = $tp->createConstants($_POST['content_text']); // convert e107_images/ to {e_IMAGE} etc.
- }
- //the problem with tiny_mce is it's storing e_HTTP with an image path, while it should only use the {e_xxx} variables
- //this small check resolves this, and stores the paths correctly
- if(strstr($_POST['content_text'],e_HTTP."{e_")){
- $_POST['content_text'] = str_replace(e_HTTP."{e_", "{e_", $_POST['content_text']);
- }
- $_POST['content_text'] = $tp -> toDB($_POST['content_text']);
- $_POST['content_class'] = ($_POST['content_class'] ? intval($_POST['content_class']) : "0");
- $_POST['content_meta'] = $tp -> toDB($_POST['content_meta']);
-
- //content create
- if( isset($qs[0]) && $qs[0]=='content' && isset($qs[1]) && ($qs[1]=='create' || $qs[1]=='submit') && isset($qs[2]) && is_numeric($qs[2]) )
- {
- $parent = intval($_POST['parent1']);
-
- //content edit
- }elseif( isset($qs[0]) && $qs[0]=='content' && isset($qs[1]) && ($qs[1]=='edit' || $qs[1]=='sa') && isset($qs[2]) && is_numeric($qs[2]) ){
- if( isset($_POST['parent1']) && strpos($_POST['parent1'], ".") ){
- $tmp = explode(".", $_POST['parent1']);
- $parent = $tmp[1];
- }else{
- $parent = $_POST['parent1'];
- }
- }
- $_POST['parent'] = $parent;
-
- if(USER)
- {
- if($_POST['content_author_id'])
- {
- if(!($_POST['content_author_id'] == USERID && $_POST['content_author_name'] == USERNAME && $_POST['content_author_email'] == USEREMAIL) )
- {
- $author = $_POST['content_author_id'];
-
- if ($_POST['content_author_name'] != CONTENT_ADMIN_ITEM_LAN_14)
- {
- $author .= "^".$_POST['content_author_name'];
- }
- if ($_POST['content_author_email'] != CONTENT_ADMIN_ITEM_LAN_15)
- {
- $author .= "^".$_POST['content_author_email'];
- }
- }
- else
- {
- $author = $_POST['content_author_id'];
- }
- }
- else
- {
- $author = $_POST['content_author_name'];
- if($_POST['content_author_email'] != "" && $_POST['content_author_email'] != CONTENT_ADMIN_ITEM_LAN_15)
- {
- $author .= "^".$_POST['content_author_email'];
- }
- }
- }
- else
- { // Non-user posting content
- if ($type != 'submit')
- { // Naughty!
- header("location:".$plugindir."content.php"); // but be kind
- exit;
- }
- $author = $_POST['content_author_name'];
- if($_POST['content_author_email'] != "" && $_POST['content_author_email'] != CONTENT_ADMIN_ITEM_LAN_15)
- {
- $author .= "^".$_POST['content_author_email'];
- }
- }
-
- $mainparent = $aa -> getMainParent(intval($_POST['parent']));
- $content_pref = $aa -> getContentPref($mainparent, true);
-
- //move icon to correct folder
- if($_POST['content_icon']){
- $icon = $tp->toDB($_POST['content_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);
- }
- }
-
- $sumf = 0;
- $sumi = 0;
- foreach($_POST as $k => $v){
- if(strpos($k, "content_files") === 0){
- $sumf = $sumf+1;
- }
- if(strpos($k, "content_images") === 0){
- $sumi = $sumi+1;
- }
- }
- //move attachments to correct folder
- $totalattach = "";
- for($i=0;$i<$sumf;$i++){
- $attach{$i} = $tp->toDB($_POST["content_files{$i}"]);
- if($attach{$i} && is_readable($content_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_pref['content_file_path'].$attach{$i})){
- $totalattach .= "[file]".$attach{$i};
- }
- }
- //move images to correct folder
- $totalimages = "";
- for($i=0;$i<$sumi;$i++){
- $image{$i} = $tp->toDB($_POST["content_images{$i}"]);
- if($image{$i} && is_readable($content_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_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_pref['content_image_path'].$image{$i})){
- $totalimages .= "[img]".$image{$i};
- }
- }
-
- $zam = array("-", ":", " ");
- if($_POST['update_datestamp'])
- {
- $starttime = time();
- }
- else
- {
- if(isset($_POST['startdate']) && $_POST['startdate'] != "0" && $_POST['startdate'] != "")
- {
- $newstarttime = str_replace($zam, "*", $_POST['startdate']);
- $newstarttime = explode("*", $newstarttime);
- $newstarttime = mktime($newstarttime[3], $newstarttime[4], 0, $newstarttime[1], $newstarttime[2], $newstarttime[0]);
- }
- else
- {
- $newstarttime = time();
- }
- if(isset($_POST['content_datestamp']) && $_POST['content_datestamp'] != "" && $_POST['content_datestamp'] != "0")
- {
- if($newstarttime != $starttime)
- {
- $starttime = $newstarttime;
- }
- else
- {
- $starttime = intval($_POST['content_datestamp']);
- }
- }
- else
- {
- $starttime = time();
- }
- }
-
- if(isset($_POST['enddate']) && $_POST['enddate'] != "0" && $_POST['enddate'] != "")
- {
- $endtime = str_replace($zam, "*", $_POST['enddate']);
- $endtime = explode("*", $endtime);
- $endtime = mktime($endtime[3], $endtime[4], 0, $endtime[1], $endtime[2], $endtime[0]);
- }
- else
- {
- $endtime = "0";
- }
-
- //custom additional data tags
- for($i=0;$i<$content_pref["content_admin_custom_number"];$i++){
- if(isset($_POST["content_custom_key_{$i}"]) && isset($_POST["content_custom_value_{$i}"]) && $_POST["content_custom_value_{$i}"] != ""){
- $keystring = $tp->toDB($_POST["content_custom_key_{$i}"]);
- $custom["content_custom_{$keystring}"] = $tp->toDB($_POST["content_custom_value_{$i}"]);
- }
- }
- //preset additional data tags
- if( varsettrue($_POST['content_custom_preset_key']) ){
- $custom['content_custom_presettags'] = $tp->toDB($_POST['content_custom_preset_key']);
- }
- $contentprefvalue = ($custom ? $eArrayStorage->WriteArray($custom) : '');
-
- $_POST['content_layout'] = (!$_POST['content_layout'] || $_POST['content_layout'] == "content_content_template.php" ? "" : $tp->toDB($_POST['content_layout']));
-
- //content_order : not added in the sql
- //content_refer : only added in sql if posting submitted item
- //$refer = (isset($_POST['content_refer']) && $_POST['content_refer']=='sa' ? ", content_refer='' " : "");
-
- if($mode == "create"){
- if($type == "submit"){
- $refer = ($content_pref["content_manager_submit_directpost"] ? "" : "sa");
- }elseif($type == "contentmanager"){
- $refer = ($content_pref["content_manager_manager_directpost"] ? "" : "sa");
- }else{
- $refer = "";
- }
- $sql -> db_Insert($plugintable, "'0', '".$_POST['content_heading']."', '".$_POST['content_subheading']."', '".$_POST['content_summary']."', '".$_POST['content_text']."', '".$tp->toDB($author)."', '".$icon."', '".$totalattach."', '".$totalimages."', '".$_POST['parent']."', '".intval($_POST['content_comment'])."', '".intval($_POST['content_rate'])."', '".intval($_POST['content_pe'])."', '".$refer."', '".$starttime."', '".$endtime."', '".$_POST['content_class']."', '".$contentprefvalue."', '0', '".intval($_POST['content_score'])."', '".$_POST['content_meta']."', '".$_POST['content_layout']."' ");
- $id = mysql_insert_id();
- $e107cache->clear("$plugintable");
-
- //trigger event for notify
- $edata_cs = array("content_heading" => $_POST['content_heading'], "content_subheading" => $_POST['content_subheading'], "content_author" => $_POST['content_author_name']);
- $e_event->trigger("content", $edata_cs);
-
- $data = array('method'=>'create', 'table'=>$plugintable, 'id'=>$id, 'plugin'=>'content', 'function'=>'dbContent');
- $message = $e_event->triggerHook($data);
-
- if(!$type || $type == "admin"){
- js_location(e_SELF."?".e_QUERY.".cc");
- }elseif($type == "contentmanager"){
- js_location(e_SELF."?c");
- }elseif($type == "submit"){
- if($content_pref["content_manager_submit_directpost"]){
- js_location(e_SELF."?s");
- }else{
- js_location(e_SELF."?d");
- }
- }
- }
-
- if($mode == "update"){
- $refer = (isset($_POST['content_refer']) && $_POST['content_refer']=='sa' ? ", content_refer='' " : '');
-
- $sql -> db_Update($plugintable, "content_heading = '".$_POST['content_heading']."', content_subheading = '".$_POST['content_subheading']."', content_summary = '".$_POST['content_summary']."', content_text = '".$_POST['content_text']."', content_author = '".$tp->toDB($author)."', content_icon = '".$icon."', content_file = '".$totalattach."', content_image = '".$totalimages."', content_parent = '".$_POST['parent']."', content_comment = '".intval($_POST['content_comment'])."', content_rate = '".intval($_POST['content_rate'])."', content_pe = '".intval($_POST['content_pe'])."' ".$refer.", content_datestamp = '".$starttime."', content_enddate = '".$endtime."', content_class = '".$_POST['content_class']."', content_pref = '".$contentprefvalue."', content_score='".intval($_POST['content_score'])."', content_meta='".$_POST['content_meta']."', content_layout='".$_POST['content_layout']."' WHERE content_id = '".intval($_POST['content_id'])."' ");
-
- $e107cache->clear("$plugintable");
- $e107cache->clear("comment.$plugintable.{$_POST['content_id']}");
-
- $data = array('method'=>'update', 'table'=>$plugintable, 'id'=>$_POST['content_id'], 'plugin'=>'content', 'function'=>'dbContent');
- $message = $e_event->triggerHook($data);
-
- if(!$type || $type == "admin"){
- js_location(e_SELF."?".e_QUERY.".cu");
- }elseif($type == "contentmanager"){
- js_location(e_SELF."?u");
- }
- }
- }
-
- //function dbCategoryUpdate($mode){
- function dbCategory($mode){
- global $pref, $sql, $ns, $rs, $qs, $aa, $tp, $plugintable, $e107cache;
-
- $_POST['cat_heading'] = $tp -> toDB($_POST['cat_heading']);
- $_POST['cat_subheading'] = $tp -> toDB($_POST['cat_subheading']);
- if(e_WYSIWYG){
- $_POST['cat_text'] = $tp->createConstants($_POST['cat_text']); // convert e107_images/ to {e_IMAGE} etc.
- }
- $_POST['cat_text'] = $tp -> toDB($_POST['cat_text']);
- $_POST['cat_class'] = ($_POST['cat_class'] ? intval($_POST['cat_class']) : "0");
-
- //category create
- if( isset($qs[0]) && $qs[0]=='cat' && isset($qs[1]) && $qs[1]=='create' ){
- if( isset($qs[2]) && is_numeric($qs[2]) ){
- $parent = "0.".intval($qs[2]);
- }else{
- $parent = 0;
- }
-
- //category edit
- }elseif( isset($qs[0]) && $qs[0]=='cat' && isset($qs[1]) && $qs[1]=='edit' ){
- if( isset($qs[2]) && is_numeric($qs[2]) ){
-
- if( isset($qs[3]) && is_numeric($qs[3]) ){
- if(intval($qs[3]) == 0){
- $parent = 0;
- }elseif( $qs[2] == $qs[3] ){
- $parent = 0;
- }else{
- $parent = "0.".intval($qs[3]);
- }
- }else{
- if($qs[2]==$_POST['cat_id']){
- $parent = intval($_POST['parent_id']);
- $parent = ($parent!=0 ? "0.".$parent : 0);
- }else{
- }
- }
- }else{
- $parent = 0;
- }
- }
- $_POST['parent'] = $parent;
-
- if( isset($_POST['ne_day']) && $_POST['ne_day']!='' && $_POST['ne_day']!='0' && $_POST['ne_day'] != "none"
- && isset($_POST['ne_month']) && $_POST['ne_month']!='' && $_POST['ne_month']!='0' && $_POST['ne_month'] != "none"
- && isset($_POST['ne_year']) && $_POST['ne_year']!='' && $_POST['ne_year']!='0' && $_POST['ne_year'] != "none" ){
- $starttime = mktime( 0, 0, 0, intval($_POST['ne_month']), intval($_POST['ne_day']), intval($_POST['ne_year']));
- }else{
- $starttime = time();
- }
-
- if( isset($_POST['end_day']) && $_POST['end_day']!='' && $_POST['end_day']!='0' && $_POST['end_day'] != "none"
- && isset($_POST['end_month']) && $_POST['end_month']!='' && $_POST['end_month']!='0' && $_POST['end_month'] != "none"
- && isset($_POST['end_year']) && $_POST['end_year']!='' && $_POST['end_year']!='0' && $_POST['end_year'] != "none" ){
- $endtime = mktime( 0, 0, 0, intval($_POST['end_month']), intval($_POST['end_day']), intval($_POST['end_year']));
- }else{
- $endtime = "0";
- }
-
- if($mode == "create"){
- $sql -> db_Insert($plugintable, "'0', '".$_POST['cat_heading']."', '".$_POST['cat_subheading']."', '', '".$_POST['cat_text']."', '".ADMINID."', '".$tp->toDB($_POST["cat_icon"])."', '', '', '".$_POST['parent']."', '".intval($_POST['cat_comment'])."', '".intval($_POST['cat_rate'])."', '".intval($_POST['cat_pe'])."', '', '".$starttime."', '".$endtime."', '".$_POST['cat_class']."', '', '0', '0', '', '' ");
-
- // check and insert default pref values if new top level category + create menu file
- if($_POST['parent'] == "0"){
- $iid = mysql_insert_id();
- $content_pref = $aa -> getContentPref($iid);
- $aa -> CreateParentMenu($iid);
- }
- $e107cache->clear("$plugintable");
- js_location(e_SELF."?".e_QUERY.".pc");
-
- }elseif($mode == "update"){
- $sql -> db_Update($plugintable, "content_heading = '".$_POST['cat_heading']."', content_subheading = '".$_POST['cat_subheading']."', content_summary = '', content_text = '".$_POST['cat_text']."', content_author = '".ADMINID."', content_icon = '".$tp->toDB($_POST["cat_icon"])."', content_image = '', content_parent = '".$_POST['parent']."', content_comment = '".intval($_POST['cat_comment'])."', content_rate = '".intval($_POST['cat_rate'])."', content_pe = '".intval($_POST['cat_pe'])."', content_refer = '0', content_datestamp = '".$starttime."', content_enddate = '".$endtime."', content_class = '".intval($_POST['cat_class'])."' WHERE content_id = '".intval($_POST['cat_id'])."' ");
-
- // check and insert default pref values if new top level category + create menu file
- if($_POST['parent'] == "0"){
- @unlink(e_PLUGIN."content/menus/content_".$_POST['menuheading']."_menu.php");
- $content_pref = $aa -> getContentPref($_POST['cat_id']);
- $aa -> CreateParentMenu($_POST['cat_id']);
- }
- $e107cache->clear("$plugintable");
- js_location(e_SELF."?".e_QUERY.".pu");
- }
- }
-
- function dbDelete($mode, $cat, $del_id){
- global $plugintable, $sql, $_POST, $e107cache;
-
- if($mode == "admin"){
- if($cat == "cat"){
- if($sql -> db_Delete($plugintable, "content_id='".intval($del_id)."' ")){
- $e107cache->clear("$plugintable");
- $message = CONTENT_ADMIN_CAT_LAN_23;
- return $message;
- }
- }elseif($cat == "content"){
- if($sql -> db_Delete($plugintable, "content_id='".intval($del_id)."' ")){
- $e107cache->clear("$plugintable");
- $message = CONTENT_ADMIN_ITEM_LAN_3;
- return $message;
- }
- }
- }else{
- return FALSE;
- }
- }
-
- function dbSetOrder($mode, $type, $order){
- global $plugintable, $sql, $aa, $qs, $_POST, $e107cache;
- //$mode : all, inc, dec
- //$type : cc (category order), ai (global all items), ci (items in category)
- //$order : posted values or id-currentorder
-
- if($mode == "all"){
- foreach ($order as $cid){
- //each order value in the db has two numbers (a-b) where a = category item order, and b = global item order
- //146.3.cat : category order
- //35.3.ci.1-0 : category item order
- //35.3.ai.1-0 : global item order
-
- $tmp = explode(".", $cid);
- $old = explode("-", $tmp[3]);
- $old[0] = ($old[0] == "" ? "0" : $old[0]);
- $old[1] = ($old[1] == "" ? "0" : $old[1]);
-
- $tmp[0] = intval($tmp[0]);
- $tmp[1] = intval($tmp[1]);
- $old[0] = intval($old[0]);
- $old[1] = intval($old[1]);
-
- if($tmp[2] == "cat"){
- $sql->db_Update($plugintable, "content_order='".$tmp[1]."' WHERE content_id='".$tmp[0]."' " );
-
- }elseif($tmp[2] == "ci"){
- $sql->db_Update($plugintable, "content_order='".$tmp[1].".".$old[1]."' WHERE content_id='".$tmp[0]."' " );
-
- }elseif($tmp[2] == "ai"){
- $sql->db_Update($plugintable, "content_order='".$old[0].".".$tmp[1]."' WHERE content_id='".$tmp[0]."' " );
- }
- $message = CONTENT_ADMIN_ORDER_LAN_2;
- }
-
- }elseif($mode == "inc"){
-
- $tmp = explode("-", $order);
- $tmp[0] = intval($tmp[0]);
- $tmp[1] = intval($tmp[1]);
- $tmp[2] = intval($tmp[2]);
-
- if($type == "cc"){
- $mainparent = $aa -> getMainParent($tmp[0]);
- $array = $aa -> getCategoryTree("", $mainparent, TRUE);
- $validparent = implode(",", array_keys($array));
- $qry = " content_id REGEXP '".$aa -> CONTENTREGEXP($validparent)."' AND content_order='".($tmp[1]-1)."' ";
- $sql->db_Update($plugintable, "content_order=content_order+1 WHERE ".$qry." " );
- $sql->db_Update($plugintable, "content_order=content_order-1 WHERE content_id='".$tmp[0]."' " );
-
- }elseif($type == "ci"){
- $sql->db_Update($plugintable, "content_order='".$tmp[1].".".$tmp[2]."' WHERE content_parent = '".intval($qs[2])."' AND SUBSTRING_INDEX(content_order, '.', 1) = '".($tmp[1]-1)."' " );
- $sql->db_Update($plugintable, "content_order='".($tmp[1]-1).".".$tmp[2]."' WHERE content_id='".$tmp[0]."' " );
-
- }elseif($type == "ai"){
- $array = $aa -> getCategoryTree("", intval($qs[1]), TRUE);
- $validparent = implode(",", array_keys($array));
- $qry = " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' AND SUBSTRING_INDEX(content_order, '.', -1) = '".($tmp[2]-1)."' ";
- $sql->db_Update($plugintable, " content_order=content_order+0.1 WHERE ".$qry." " );
- $sql->db_Update($plugintable, "content_order='".$tmp[1].".".($tmp[2]-1)."' WHERE content_id='".$tmp[0]."' " );
-
- }
- $message = CONTENT_ADMIN_ORDER_LAN_0;
-
- }elseif($mode == "dec"){
-
- $tmp = explode("-", $order);
- $tmp[0] = intval($tmp[0]);
- $tmp[1] = intval($tmp[1]);
- $tmp[2] = intval($tmp[2]);
- if($type == "cc"){
- $mainparent = $aa -> getMainParent($tmp[0]);
- $array = $aa -> getCategoryTree("", $mainparent, TRUE);
- $validparent = implode(",", array_keys($array));
- $qry = " content_id REGEXP '".$aa -> CONTENTREGEXP($validparent)."' AND content_order='".($tmp[1]+1)."' ";
- $sql->db_Update($plugintable, "content_order=content_order-1 WHERE ".$qry." " );
- $sql->db_Update($plugintable, "content_order=content_order+1 WHERE content_id='".$tmp[0]."' " );
-
- }elseif($type == "ci"){
- $sql->db_Update($plugintable, "content_order='".$tmp[1].".".$tmp[2]."' WHERE content_parent = '".intval($qs[2])."' AND SUBSTRING_INDEX(content_order, '.', 1) = '".($tmp[1]+1)."' " );
- $sql->db_Update($plugintable, "content_order='".($tmp[1]+1).".".$tmp[2]."' WHERE content_id='".$tmp[0]."' " );
-
- }elseif($type == "ai"){
- $array = $aa -> getCategoryTree("", intval($qs[1]), TRUE);
- $validparent = implode(",", array_keys($array));
- $qry = " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' AND SUBSTRING_INDEX(content_order, '.', -1) = '".($tmp[2]+1)."' ";
- $sql->db_Update($plugintable, "content_order=content_order-0.1 WHERE ".$qry." " );
- $sql->db_Update($plugintable, "content_order='".$tmp[1].".".($tmp[2]+1)."' WHERE content_id='".$tmp[0]."' " );
- }
- $message = CONTENT_ADMIN_ORDER_LAN_1;
- }
- $e107cache->clear("$plugintable");
- return $message;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/handlers/content_defines.php b/e107_plugins/content/handlers/content_defines.php
deleted file mode 100644
index c28e3b378..000000000
--- a/e107_plugins/content/handlers/content_defines.php
+++ /dev/null
@@ -1,32 +0,0 @@
-"); }
-if (!defined('CONTENT_ICON_LINK')) { define("CONTENT_ICON_LINK", " "); }
-if (!defined('CONTENT_ICON_DELETE')) { define("CONTENT_ICON_DELETE", " "); }
-if (!defined('CONTENT_ICON_DELETE_BASE')) { define("CONTENT_ICON_DELETE_BASE", $imagedir."delete_16.png"); }
-if (!defined('CONTENT_ICON_OPTIONS')) { define("CONTENT_ICON_OPTIONS", " "); }
-if (!defined('CONTENT_ICON_USER')) { define("CONTENT_ICON_USER", " "); }
-if (!defined('CONTENT_ICON_FILE')) { define("CONTENT_ICON_FILE", " "); }
-if (!defined('CONTENT_ICON_NEW')) { define("CONTENT_ICON_NEW", " "); }
-if (!defined('CONTENT_ICON_SUBMIT')) { define("CONTENT_ICON_SUBMIT", " "); }
-if (!defined('CONTENT_ICON_SUBMIT_SMALL')) { define("CONTENT_ICON_SUBMIT_SMALL", " "); }
-if (!defined('CONTENT_ICON_AUTHORLIST')) { define("CONTENT_ICON_AUTHORLIST", " "); }
-if (!defined('CONTENT_ICON_WARNING')) { define("CONTENT_ICON_WARNING", " "); }
-if (!defined('CONTENT_ICON_OK')) { define("CONTENT_ICON_OK", " "); }
-if (!defined('CONTENT_ICON_ERROR')) { define("CONTENT_ICON_ERROR", " "); }
-if (!defined('CONTENT_ICON_ORDERCAT')) { define("CONTENT_ICON_ORDERCAT", " "); }
-if (!defined('CONTENT_ICON_ORDERALL')) { define("CONTENT_ICON_ORDERALL", " "); }
-if (!defined('CONTENT_ICON_CONTENTMANAGER')) { define("CONTENT_ICON_CONTENTMANAGER", " "); }
-if (!defined('CONTENT_ICON_CONTENTMANAGER_SMALL')) { define("CONTENT_ICON_CONTENTMANAGER_SMALL", " "); }
-if (!defined('CONTENT_ICON_ORDER_UP')) { define("CONTENT_ICON_ORDER_UP", " "); }
-if (!defined('CONTENT_ICON_ORDER_DOWN')) { define("CONTENT_ICON_ORDER_DOWN", " "); }
-if (!defined('CONTENT_ICON_DETAILS')) { define("CONTENT_ICON_DETAILS", " "); }
-
-?>
\ No newline at end of file
diff --git a/e107_plugins/content/handlers/content_form_class.php b/e107_plugins/content/handlers/content_form_class.php
deleted file mode 100644
index 57ecba7de..000000000
--- a/e107_plugins/content/handlers/content_form_class.php
+++ /dev/null
@@ -1,3203 +0,0 @@
-".time().") ";
-
-$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 (!defined('ADMIN_WIDTH')) { define("ADMIN_WIDTH", "width:98%;"); }
-
-$stylespacer = "style='border:0; height:20px;'";
-
-//only used in admin pages, for normal rows (+ in content_manager.php creation form)
-$TOPIC_ROW_NOEXPAND = "
-
-
-
- ";
-//only used in admin pages, for expanding rows (+ in content_manager.php creation form)
-$TOPIC_ROW = "
-
-
-
- ";
-
-//only used in admin pages, for a spacer row
-//$TOPIC_ROW_SPACER = " ";
-$TOPIC_ROW_SPACER = "";
-
-
-
-class contentform{
-
- function ContentItemPreview(){
- global $ns, $sql, $aa, $qs, $tp, $mainparent, $months;
-
- $TRPRE = "";
- $TRPOST = " ";
- $TDPRE1 = "";
- $CONTENT_CONTENT_PREVIEW = "
-
- {CONTENT_CONTENT_PREVIEW_CATEGORY}
- {CONTENT_CONTENT_PREVIEW_HEADING}
- {CONTENT_CONTENT_PREVIEW_SUBHEADING}
- {CONTENT_CONTENT_PREVIEW_SUMMARY}
- {CONTENT_CONTENT_PREVIEW_TEXT}
- {CONTENT_CONTENT_PREVIEW_AUTHORNAME}
- {CONTENT_CONTENT_PREVIEW_AUTHOREMAIL}
- {CONTENT_CONTENT_PREVIEW_STARTDATE}
- {CONTENT_CONTENT_PREVIEW_ENDDATE}
- {CONTENT_CONTENT_PREVIEW_COMMENT}
- {CONTENT_CONTENT_PREVIEW_RATE}
- {CONTENT_CONTENT_PREVIEW_PE}
- {CONTENT_CONTENT_PREVIEW_CLASS}
- {CONTENT_CONTENT_PREVIEW_SCORE}
- {CONTENT_CONTENT_PREVIEW_META}
- {CONTENT_CONTENT_PREVIEW_LAYOUT}
- {CONTENT_CONTENT_PREVIEW_CUSTOM}
-
- {CONTENT_CONTENT_PREVIEW_PARENT}
- {CONTENT_CONTENT_PREVIEW_ICON}
- {CONTENT_CONTENT_PREVIEW_ATTACH}
- {CONTENT_CONTENT_PREVIEW_IMAGES}
- {CONTENT_CONTENT_PREVIEW_PAGENAMES}
-
\n";
-
- $tmp = explode(".",$_POST['parent1']);
- $_POST['parent1'] = ($tmp[1] ? $tmp[1] : $tmp[0]);
- $mainparent = $aa -> getMainParent( $_POST['parent1'] );
-
- $content_pref = $aa -> getContentPref($mainparent, true);
-
- if($sql -> db_Select("pcontent", "content_heading", " content_id='".$_POST['parent1']."' ")){
- $row = $sql -> db_Fetch();
- $PARENT = $row['content_heading'];
- }
- $content_heading = $tp -> post_toHTML($_POST['content_heading']);
- $content_subheading = $tp -> post_toHTML($_POST['content_subheading']);
- $content_summary = $tp -> post_toHTML($_POST['content_summary']);
- $content_text = $_POST['content_text'];
- if(e_WYSIWYG){
- $content_text = $tp->createConstants($content_text); // convert e107_images/ to {e_IMAGE} etc.
- }
-
- //the problem with tiny_mce is it's storing e_HTTP with an image path, while it should only use the {e_xxx} variables
- //this small check resolves this, and stores the paths correctly
- if(strstr($content_text,e_HTTP."{e_")){
- $content_text = str_replace(e_HTTP."{e_", "{e_", $content_text);
- }
- $content_text = $tp->post_toHTML($content_text,TRUE);
-
- $CONTENT_CONTENT_PREVIEW_CATEGORY = ($_POST['parent1'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_57.$TDPOST.$TDPRE2.$PARENT.$TDPOST.$TRPOST : "");
- $CONTENT_CONTENT_PREVIEW_HEADING = ($content_heading ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_11.$TDPOST.$TDPRE2.$content_heading.$TDPOST.$TRPOST : "");
- $CONTENT_CONTENT_PREVIEW_SUBHEADING = ($content_subheading ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_16.$TDPOST.$TDPRE2.$content_subheading.$TDPOST.$TRPOST : "");
- $CONTENT_CONTENT_PREVIEW_SUMMARY = ($content_summary ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_17.$TDPOST.$TDPRE2.$content_summary.$TDPOST.$TRPOST : "");
- $CONTENT_CONTENT_PREVIEW_TEXT = ($content_text ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_18.$TDPOST.$TDPRE2.$content_text.$TDPOST.$TRPOST : "");
- $CONTENT_CONTENT_PREVIEW_AUTHORNAME = ($_POST['content_author_name'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_10." ".CONTENT_ADMIN_ITEM_LAN_14.$TDPOST.$TDPRE2.$_POST['content_author_name'].$TDPOST.$TRPOST : "");
- $CONTENT_CONTENT_PREVIEW_AUTHOREMAIL = ($_POST['content_author_email'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_10." ".CONTENT_ADMIN_ITEM_LAN_15.$TDPOST.$TDPRE2.$_POST['content_author_email'].$TDPOST.$TRPOST : "");
- $CONTENT_CONTENT_PREVIEW_COMMENT = ($_POST['content_comment'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_36.$TDPOST.$TDPRE2.CONTENT_ADMIN_ITEM_LAN_85.$TDPOST.$TRPOST : '');
- $CONTENT_CONTENT_PREVIEW_RATE = ($_POST['content_rate'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_37.$TDPOST.$TDPRE2.CONTENT_ADMIN_ITEM_LAN_85.$TDPOST.$TRPOST : '');
- $CONTENT_CONTENT_PREVIEW_PE = ($_POST['content_pe'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_38.$TDPOST.$TDPRE2.CONTENT_ADMIN_ITEM_LAN_85.$TDPOST.$TRPOST : '');
- $CONTENT_CONTENT_PREVIEW_CLASS = ($_POST['content_class'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_39.$TDPOST.$TDPRE2.r_userclass_name($_POST['content_class']).$TDPOST.$TRPOST : '');
- $CONTENT_CONTENT_PREVIEW_SCORE = ($_POST['content_score'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_40.$TDPOST.$TDPRE2.($_POST['content_score']!="none" ? $_POST['content_score']."/100" : CONTENT_ADMIN_ITEM_LAN_118." ".CONTENT_ADMIN_ITEM_LAN_40." ".CONTENT_ADMIN_ITEM_LAN_119).$TDPOST.$TRPOST : "");
- $CONTENT_CONTENT_PREVIEW_META = ($_POST['content_meta'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_53.$TDPOST.$TDPRE2.($_POST['content_meta']!="" ? $_POST['content_meta'] : CONTENT_ADMIN_ITEM_LAN_118." ".CONTENT_ADMIN_ITEM_LAN_53." ".CONTENT_ADMIN_ITEM_LAN_119).$TDPOST.$TRPOST : "");
- $CONTENT_CONTENT_PREVIEW_LAYOUT = ($_POST['content_layout'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_92.$TDPOST.$TDPRE2.($_POST['content_layout'] == "none" || $_POST['content_layout'] =="content_content_template.php" ? CONTENT_ADMIN_ITEM_LAN_120 : substr($_POST['content_layout'],25 ,-4)).$TDPOST.$TRPOST : "");
-
- //start date
- if(isset($_POST['startdate']) && $_POST['startdate'] != "0" && $_POST['startdate'] != "")
- {
- $CONTENT_CONTENT_PREVIEW_STARTDATE = $TRPRE.$TDPRE1.CONTENT_ADMIN_DATE_LAN_15.$TDPOST.$TDPRE2.$_POST['startdate'].$TDPOST.$TRPOST;
- }
- else
- {
- $CONTENT_CONTENT_PREVIEW_STARTDATE='';
- }
- //end date
- if(isset($_POST['enddate']) && $_POST['enddate'] != "0" && $_POST['enddate'] != "")
- {
- $CONTENT_CONTENT_PREVIEW_ENDDATE = $TRPRE.$TDPRE1.CONTENT_ADMIN_DATE_LAN_16.$TDPOST.$TDPRE2.$_POST['enddate'].$TDPOST.$TRPOST;
- }
- else
- {
- $CONTENT_CONTENT_PREVIEW_ENDDATE='';
- }
- $CONTENT_CONTENT_PREVIEW_CUSTOM = "";
-
- //custom tags
- for($i=0;$i<$content_pref["content_admin_custom_number"];$i++){
- if($_POST["content_custom_key_{$i}"] != "" && $_POST["content_custom_value_{$i}"] != ""){
- $CONTENT_CONTENT_PREVIEW_CUSTOM .= $TRPRE.$TDPRE1.$_POST["content_custom_key_{$i}"].$TDPOST.$TDPRE2.$_POST["content_custom_value_{$i}"].$TDPOST.$TRPOST;
- }
- }
- //custom preset tags
- foreach($_POST['content_custom_preset_key'] as $k => $v){
- if($k != "" && $v != ""){
- $CONTENT_CONTENT_PREVIEW_CUSTOM .= $TRPRE.$TDPRE1.$k.$TDPOST.$TDPRE2.$v.$TDPOST.$TRPOST;
- }
- }
-
- //icon
- if($_POST['content_icon'] && is_readable($content_pref['content_icon_path_tmp'].$_POST['content_icon'])){
- $ICON = " ";
- }elseif($_POST['content_icon'] && is_readable($content_pref['content_icon_path'].$_POST['content_icon'])){
- $ICON = " ";
- }else{
- $ICON='';
- }
- $CONTENT_CONTENT_PREVIEW_ICON = ($ICON ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_114.$TDPOST.$TDPRE2.$ICON.$TDPOST.$TRPOST : '');
-
- //images and attachments
- $file = FALSE;
- $image = FALSE;
- $ATTACH = '';
- $IMAGES = '';
- foreach($_POST as $k => $v){
- if(strpos($k, "content_files") === 0){
- if($v && is_readable($content_pref['content_file_path_tmp'].$v)){
- $ATTACH .= CONTENT_ICON_FILE." ".$v." ";
- $file = TRUE;
- }elseif($v && is_readable($content_pref['content_file_path'].$v)){
- $ATTACH .= CONTENT_ICON_FILE." ".$v." ";
- $file = TRUE;
- }
- }
- if(strpos($k, "content_images") === 0){
- if($v && is_readable($content_pref['content_image_path_tmp'].$v)){
- $IMAGES .= " ";
- $image = TRUE;
- }elseif($v && is_readable($content_pref['content_image_path'].$v)){
- $IMAGES .= " ";
- $image = TRUE;
- }
- }
- }
- if($file !== TRUE){
- $CONTENT_CONTENT_PREVIEW_ATTACH='';
- }else{
- $CONTENT_CONTENT_PREVIEW_ATTACH = $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_24.$TDPOST.$TDPRE2.$ATTACH.$TDPOST.$TRPOST;
- }
- if($image !== TRUE){
- $CONTENT_CONTENT_PREVIEW_IMAGES='';
- }else{
- $CONTENT_CONTENT_PREVIEW_IMAGES = $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_31.$TDPOST.$TDPRE2.$IMAGES.$TDPOST.$TRPOST;
- }
-
- $caption = CONTENT_ADMIN_ITEM_LAN_46." ".$_POST['content_heading'];
- $preview = preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_CONTENT_PREVIEW);
- $ns -> tablerender($caption, $preview);
- }
-
- function show_create_content($mode, $userid="", $username=""){
- global $qs, $sql, $ns, $rs, $aa, $fl, $tp, $content_shortcodes, $content_pref, $plugintable, $plugindir, $pref, $eArrayStorage;
- global $message, $row, $show;
- global $content_author_name_value, $content_author_name_js, $content_author_email_value, $content_author_email_js, $content_author_id;
-// global $months, $ne_day, $ne_month, $ne_year, $current_year, $end_day, $end_month, $end_year;
- global $startdate, $enddate;
- global $content_tmppath_icon, $content_tmppath_file, $content_tmppath_image, $iconlist, $checkattachnumber, $filelist, $checkimagesnumber, $imagelist;
- global $CONTENTFORM_CATEGORY, $CONTENTFORM_CUSTOM, $CONTENTFORM_CUSTOM_KEY, $CONTENTFORM_CUSTOM_VALUE, $CONTENT_ADMIN_CONTENT_CREATE_CUSTOMSTART, $CONTENT_ADMIN_CONTENT_CREATE_CUSTOMTABLE, $CONTENT_ADMIN_CONTENT_CREATE_CUSTOMEND, $CONTENTFORM_PRESET, $CONTENT_ADMIN_CONTENT_CREATE, $CONTENT_ADMIN_BUTTON, $e_event;
- global $cal;
-
- $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);
-
- //admin
- if(e_PAGE=='admin_content_config.php'){
-
- //first show the 'choose category' option selectbox (as preferences need to be loaded from the selected category)
- if( $qs[1] == "create" && !isset($qs[2]) ){
- global $CONTENT_ADMIN_CONTENT_CATSELECT, $CONTENTFORM_CATEGORYSELECT;
- $CONTENTFORM_CATEGORYSELECT = $aa -> ShowOption('',"managecontent");
- $text = $tp -> parseTemplate($CONTENT_ADMIN_CONTENT_CATSELECT, FALSE, $content_shortcodes);
- $ns -> tablerender(CONTENT_ADMIN_MAIN_LAN_2, $text);
- return;
- }
-
- //we need to retrieve preferences from the top level category from this item/category as well
- $mainparent = $aa -> getMainParent( (isset($qs[3]) && is_numeric($qs[3]) ? $qs[3] : intval($qs[2])) );
- $content_pref = $aa -> getContentPref($mainparent);
-
- //top level category chosen, so continue to display create form
-
- }else{
-
- if(e_PAGE=='content_manager.php'){
-
- //##### submit (content.submit.X) (X = category id)
- if(isset($qs[0]) && $qs[0]=='content' && isset($qs[1]) && $qs[1]=='submit' && isset($qs[2]) && is_numeric($qs[2])){
-
- //we need to retrieve preferences from this category, and check if user is allowed here
- $manager_pref = $aa -> getContentPref( intval($qs[2]) );
-
- //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($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']);
- }
-
- //user is allowed
- if( isset($manager_pref["content_manager_submit"]) && check_class($manager_pref["content_manager_submit"]) ){
- //user is not allowed
- }else{
- header("location: ".e_SELF); exit;
- }
- }
-
- //##### manager create (content.create.X)
- if(isset($qs[0]) && $qs[0]=='content' && isset($qs[1]) && $qs[1]=='create' && isset($qs[2]) && is_numeric($qs[2])){
-
- //we need to retrieve preferences from this category, and check if user is allowed here
- $manager_pref = $aa -> getContentPref( intval($qs[2]) );
-
- //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($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']);
- }
-
- //user is allowed
- if( (isset($manager_pref["content_manager_personal"]) && check_class($manager_pref["content_manager_personal"])) ||
- (isset($manager_pref["content_manager_category"]) && check_class($manager_pref["content_manager_category"])) ){
- //user is not allowed
- }else{
- header("location: ".e_SELF); exit;
- }
- }
-
- //##### manager edit (content.edit.X)
- if(isset($qs[0]) && $qs[0]=='content' && isset($qs[1]) && ($qs[1]=='edit' || $qs[1]=='sa') && isset($qs[2]) && is_numeric($qs[2])){
-
- //we need to get the category (parent) of the content item first
- if(!$sql -> db_Select($plugintable, "content_id, content_parent", "content_id='".intval($qs[2])."' ")){
- //not a valid item, so redirect
- //header("location: ".e_SELF); exit;
- }else{
- $row = $sql -> db_Fetch();
- //parent can be '0' (top level) or '0.X (subcategory)
- if(strpos($row['content_parent'], ".")){
- $ipar = substr($row['content_parent'],2);
- }else{
- $ipar = $row['content_parent'];
- }
- }
-
- //we need to retrieve preferences from the category this item belongs to, and check if user is allowed here
- if(!isset($ipar) && !is_numeric($ipar)){
- //not a valid category, so redirect
- //header("location: ".e_SELF); exit;
- }else{
- $manager_pref = $aa -> getContentPref( intval($ipar) );
-
- //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($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']);
- }
-
- }
-
- if($qs[1]=='edit'){
- //user is allowed
- if( (isset($manager_pref["content_manager_personal"]) && check_class($manager_pref["content_manager_personal"])) ||
- (isset($manager_pref["content_manager_category"]) && check_class($manager_pref["content_manager_category"])) ){
-
- //assign author query to make sure this item to edit is from this user
- $userquery = '';
- //if personal manager, we need to assign the author query
- if( isset($manager_pref["content_manager_personal"]) && check_class($manager_pref["content_manager_personal"]) ){
- if(isset($userid) && isset($username) ){
- $userid = intval($userid);
- $l = strlen($userid)+1;
- $userquery = " AND (content_author = '".$userid."' || LEFT(content_author, ".$l.") = '".$userid."^' OR SUBSTRING_INDEX(content_author, '^', 1) = '".$userid."' || content_author REGEXP '\\\^".$username."' ) ";
- }
- }
- //if category manager, no author query is needed
- if( isset($manager_pref["content_manager_category"]) && check_class($manager_pref["content_manager_category"]) ){
- $userquery = "";
- }
-
- //user is not allowed
- }else{
- header("location: ".e_SELF); exit;
- }
- }elseif($qs[1]=='sa'){
- //user is allowed
- if( (isset($manager_pref["content_manager_approve"]) && check_class($manager_pref["content_manager_approve"])) ){
-
- //user is not allowed
- }else{
- header("location: ".e_SELF); exit;
- }
- }
- }
-
- //we need to retrieve preferences from the top level category from this item/category as well
- $mainparent = $aa -> getMainParent( intval($qs[2]) );
- $content_pref = $aa -> getContentPref($mainparent);
- }
-
- }
- $content_pref = $aa -> parseConstants($content_pref);
-
- //get preferences for submit page
- if($mode == "submit"){
- $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 = 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"){
-
- //show all preferences from the manager-submit options.
- //if manager-submit prefs are not set, check if admin create prefs are set and use those (from the top level category prefs)
- $checksubheading = (isset($manager_pref["content_manager_submit_subheading"]) ? $manager_pref["content_manager_submit_subheading"] : (isset($content_pref["content_admin_subheading"]) ? $content_pref["content_admin_subheading"] : ""));
-
- $checksummary = (isset($manager_pref["content_manager_submit_summary"]) ? $manager_pref["content_manager_submit_summary"] : (isset($content_pref["content_admin_summary"]) ? $content_pref["content_admin_summary"] : ""));
-
- $checkstartdate = (isset($manager_pref["content_manager_submit_startdate"]) ? $manager_pref["content_manager_submit_startdate"] : (isset($content_pref["content_admin_startdate"]) ? $content_pref["content_admin_startdate"] : ""));
-
- $checkenddate = (isset($manager_pref["content_manager_submit_enddate"]) ? $manager_pref["content_manager_submit_enddate"] : (isset($content_pref["content_admin_enddate"]) ? $content_pref["content_admin_enddate"] : ""));
-
- $checkicon = (isset($manager_pref["content_manager_submit_icon"]) ? $manager_pref["content_manager_submit_icon"] : (isset($content_pref["content_admin_icon"]) ? $content_pref["content_admin_icon"] : ""));
-
- $checkattach = (isset($manager_pref["content_manager_submit_attach"]) ? $manager_pref["content_manager_submit_attach"] : (isset($content_pref["content_admin_attach"]) ? $content_pref["content_admin_attach"] : ""));
-
- $checkattachnumber = (isset($manager_pref["content_manager_submit_files_number"]) ? $manager_pref["content_manager_submit_files_number"] : (isset($content_pref["content_admin_files_number"]) ? $content_pref["content_admin_files_number"] : ""));
-
- $checkimages = (isset($manager_pref["content_manager_submit_images"]) ? $manager_pref["content_manager_submit_images"] : (isset($content_pref["content_admin_images"]) ? $content_pref["content_admin_images"] : ""));
-
- $checkimagesnumber = (isset($manager_pref["content_manager_submit_images_number"]) ? $manager_pref["content_manager_submit_images_number"] : (isset($content_pref["content_admin_images_number"]) ? $content_pref["content_admin_images_number"] : ""));
-
- $checkcomment = (isset($manager_pref["content_manager_submit_comment"]) ? $manager_pref["content_manager_submit_comment"] : (isset($content_pref["content_admin_comment"]) ? $content_pref["content_admin_comment"] : ""));
-
- $checkrating = (isset($manager_pref["content_manager_submit_rating"]) ? $manager_pref["content_manager_submit_rating"] : (isset($content_pref["content_admin_rating"]) ? $content_pref["content_admin_rating"] : ""));
-
- $checkscore = (isset($manager_pref["content_manager_submit_score"]) ? $manager_pref["content_manager_submit_score"] : (isset($content_pref["content_admin_score"]) ? $content_pref["content_admin_score"] : ""));
-
- $checkpe = (isset($manager_pref["content_manager_submit_pe"]) ? $manager_pref["content_manager_submit_pe"] : (isset($content_pref["content_admin_pe"]) ? $content_pref["content_admin_pe"] : ""));
-
- $checkvisibility = (isset($manager_pref["content_manager_submit_visibility"]) ? $manager_pref["content_manager_submit_visibility"] : (isset($content_pref["content_admin_visibility"]) ? $content_pref["content_admin_visibility"] : ""));
-
- $checkmeta = (isset($manager_pref["content_manager_submit_meta"]) ? $manager_pref["content_manager_submit_meta"] : (isset($content_pref["content_admin_meta"]) ? $content_pref["content_admin_meta"] : ""));
-
- $checkcustom = (isset($manager_pref["content_manager_submit_customtags"]) ? $manager_pref["content_manager_submit_customtags"] : (isset($content_pref["content_admin_customtags"]) ? $content_pref["content_admin_customtags"] : ""));
-
- $checkcustomnumber = (isset($manager_pref["content_manager_submit_custom_number"]) && $manager_pref["content_manager_submit_custom_number"] != "0" ? $content_pref["content_manager_submit_custom_number"] : (isset($content_pref["content_admin_custom_number"]) ? $content_pref["content_admin_custom_number"] : ""));
-
- $checklayout = (isset($manager_pref["content_manager_submit_layout"]) ? $manager_pref["content_manager_submit_layout"] : (isset($content_pref["content_admin_layout"]) ? $content_pref["content_admin_layout"] : ""));
-
- $checkpreset = (isset($manager_pref["content_manager_submit_presettags"]) ? $manager_pref["content_manager_submit_presettags"] : (isset($content_pref["content_admin_presettags"]) ? $content_pref["content_admin_presettags"] : ""));
-
- //normal admin content create preferences
- }else{
- $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
- $authordetails = $aa -> getAuthor(USERID);
-
- //retrieve record if we are editing the item
- if( ($qs[1] == "edit" || $qs[1] == "sa") && is_numeric($qs[2]) && !isset($_POST['preview_content']) && !isset($message)){
- if(!$sql -> db_Select($plugintable, "*", "content_id='".intval($qs[2])."' ".$userquery." ")){
- if($mode == "contentmanager"){
- header("location:".$plugindir."content_manager.php"); exit;
- }else{
- header("location:".e_SELF."?content"); exit;
- }
- }else{
- $row = $sql -> db_Fetch();
-
- $row['content_heading'] = $tp -> toForm($row['content_heading']);
- $row['content_subheading'] = $tp -> toForm($row['content_subheading']);
- $row['content_summary'] = $tp -> toForm($row['content_summary']);
- $row['content_text'] = $tp -> toForm($row['content_text']);
- $row['content_meta'] = $tp -> toForm($row['content_meta']);
- $authordetails = $aa -> getAuthor($row['content_author']);
- }
- }
-
- //show preview
- if(isset($_POST['preview_content'])){
- $this -> ContentItemPreview();
- }
- //re-prepare the posted fields for the form (after preview)
- if( isset($_POST['preview_content']) || isset($message) ){
-
- $row['content_parent'] = $_POST['parent1'];
- $row['content_heading'] = $tp -> post_toForm($_POST['content_heading']);
- $row['content_subheading'] = $tp -> post_toForm($_POST['content_subheading']);
- $row['content_summary'] = $tp -> post_toForm($_POST['content_summary']);
- $row['content_text'] = $tp -> post_toForm($_POST['content_text']);
- $authordetails[0] = $_POST['content_author_id'];
- $authordetails[1] = $_POST['content_author_name'];
- $authordetails[2] = $_POST['content_author_email'];
-
- $startdate = $_POST['startdate'];
- $enddate = $_POST['enddate'];
-
- $row['content_comment'] = $_POST['content_comment'];
- $row['content_rate'] = $_POST['content_rate'];
- $row['content_pe'] = $_POST['content_pe'];
- $row['content_class'] = $_POST['content_class'];
- $row['content_refer'] = $_POST['content_refer'];
- $row['content_datestamp'] = $_POST['content_datestamp'];
- $row['content_score'] = $_POST['content_score'];
- $row['content_meta'] = $_POST['content_meta'];
- $row['content_layout'] = $_POST['content_layout'];
- $row['content_icon'] = $_POST['content_icon'];
-
- //images and attachments
- foreach($_POST as $k => $v){
- if(strpos($k, "content_files") === 0){
- $row['content_file'] .= "[file]".$v;
- }
- if(strpos($k, "content_images") === 0){
- $row['content_image'] .= "[img]".$v;
- }
- }
- //custom tags
- for($i=0;$i<$content_pref["content_admin_custom_number"];$i++){
- $keystring = $tp -> post_toForm($_POST["content_custom_key_{$i}"]);
- $custom["content_custom_{$keystring}"] = $tp -> post_toForm($_POST["content_custom_value_{$i}"]);
- }
- //preset tags
- foreach($_POST['content_custom_preset_key'] as $k => $v){
- $k = $tp -> post_toForm($k);
- $custom['content_custom_presettags'][$k] = $tp -> post_toForm($v);
- }
- }
-
- //prepare date variables
- if(isset($row['content_datestamp']) && $row['content_datestamp'] != "0" && $row['content_datestamp'] != "")
- {
- $startdate = strftime("%Y-%m-%d %H:%M", $row['content_datestamp']);
- }
- else
- {
- $startdate = isset($startdate) ? $startdate : 0;
- }
- if(isset($row['content_enddate']) && $row['content_enddate'] != "0" && $row['content_enddate'] != "")
- {
- $enddate = strftime("%Y-%m-%d %H:%M", $row['content_datestamp']);
- }
- else
- {
- $enddate = isset($enddate) ? $enddate : 0;
- }
-// $smarray = getdate();
-// $current_year = $smarray['year'];
-
- //check which areas should be visible (dependent on options in admin:create category)
- $hidden = '';
-
- if($checksubheading){
- $show['subheading'] = true;
- }else{
- $show['subheading'] = false;
- $hidden .= $rs -> form_hidden("content_subheading", $row['content_subheading']);
- }
- if($checksummary){
- $show['summary'] = true;
- }else{
- $show['summary'] = false;
- $hidden .= $rs -> form_hidden("content_summary", $row['content_summary']);
- }
- if($checkstartdate){
- $show['startdate'] = true;
- }
- else
- {
- $show['startdate'] = false;
- $hidden .= $rs -> form_hidden("startdate", $startdate);
- }
- if($checkenddate)
- {
- $show['enddate'] = true;
- }
- else
- {
- $show['enddate'] = false;
- $hidden .= $rs -> form_hidden("enddate", $enddate);
- }
- if( $checkicon || $checkattach || $checkimages ){
- //prepare file lists
-// $rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*', 'thumb_*');
- $rejectlist = '~^thumb_|$th_';
- $show['upload'] = true;
- }else{
- $show['upload'] = false;
- }
- if($checkicon){
- $list1 = $fl->get_files($content_pref['content_icon_path_tmp'],$rejectlist);
- if(varsettrue($content_pref['content_admin_loadicons'])){
- $list2 = $fl->get_files($content_pref['content_icon_path'],$rejectlist);
- }
- $iconlist = ($list2) ? array_merge($list1, $list2) : $list1;
- $show['icon'] = true;
- }else{
- $show['icon'] = false;
- $hidden .= $rs -> form_hidden("content_icon", $row['content_icon']);
- }
- if($checkattach){
- $list1 = $fl->get_files($content_pref['content_file_path_tmp'],$rejectlist);
- if(varsettrue($content_pref['content_admin_loadattach'])){
- $list2 = $fl->get_files($content_pref['content_file_path'],$rejectlist);
- }
- $filelist = ($list2) ? array_merge($list1, $list2) : $list1;
- $show['attach'] = true;
- }else{
- $show['attach'] = false;
- $hidden .= $rs -> form_hidden("content_file", $row['content_file']);
- }
- if($checkimages){
- $imagelist = $fl->get_files($content_pref['content_image_path_tmp'],$rejectlist);
- $show['images'] = true;
- }else{
- $show['images'] = false;
- $hidden .= $rs -> form_hidden("content_image", $row['content_image']);
- }
- if($checkcomment){
- $show['comment'] = true;
- }else{
- $show['comment'] = false;
- $hidden .= $rs -> form_hidden("content_comment", $row['content_comment']);
- }
- if($checkrating){
- $show['rating'] = true;
- }else{
- $show['rating'] = false;
- $hidden .= $rs -> form_hidden("content_rate", $row['content_rate']);
- }
- if($checkpe){
- $show['pe'] = true;
- }else{
- $show['pe'] = false;
- $hidden .= $rs -> form_hidden("content_pe", $row['content_pe']);
- }
- if($checkvisibility){
- $show['visibility'] = true;
- }else{
- $show['visibility'] = false;
- $hidden .= $rs -> form_hidden("content_class", $row['content_class']);
- }
- if($checkscore){
- $show['score'] = true;
- }else{
- $show['score'] = false;
- $hidden .= $rs -> form_hidden("content_score", $row['content_score']);
- }
- if($checkmeta){
- $show['meta'] = true;
- }else{
- $show['meta'] = false;
- $hidden .= $rs -> form_hidden("content_meta", $row['content_meta']);
- }
- if($checklayout){
- $show['layout'] = true;
- }else{
- $show['layout'] = false;
- $hidden .= $rs -> form_hidden("content_layout", $row['content_layout']);
- }
-
- //category field (we only need to show the 'category selector' dropdownbox on the admin create page)
- $CONTENTFORM_CATEGORY = '';
- if($mode == "contentmanager")
- {
- if($qs[1] == "edit"){
- $hidden .= $rs -> form_hidden("parent1", $row['content_parent']);
- }
- else
- {
- $hidden .= $rs -> form_hidden("parent1", intval($qs[2]));
- }
- }else{
- if($mode == "submit")
- {
- $hidden .= $rs -> form_hidden("parent1", intval($qs[2]));
- }
- elseif($mode=='sa' && e_PAGE=='content_manager.php')
- {
- $hidden .= $rs -> form_hidden("parent1", $row['content_parent']);
- }
- else
- {
- $parent = (isset($qs[3]) && is_numeric($qs[3]) ? $qs[3] : (isset($row['content_parent']) ? $row['content_parent'] : "") );
- $CONTENTFORM_CATEGORY = $aa -> ShowOption($parent, "createcontent");
- }
- }
-
- //author
- $content_author_id = (isset($authordetails[0]) && $authordetails[0] != "" ? $authordetails[0] : USERID);
- $content_author_name = (isset($authordetails[1]) && $authordetails[1] != "" ? $authordetails[1] : USERNAME);
- $content_author_email = (isset($authordetails[2]) ? $authordetails[2] : USEREMAIL);
-
- $content_author_name_value = ($content_author_name ? $content_author_name : CONTENT_ADMIN_ITEM_LAN_14);
- $content_author_name_js = ($content_author_name ? "" : "onfocus=\"if(document.getElementById('dataform').content_author_name.value=='".CONTENT_ADMIN_ITEM_LAN_14."'){document.getElementById('dataform').content_author_name.value='';}\"");
- $content_author_email_value = ($content_author_email ? $content_author_email : CONTENT_ADMIN_ITEM_LAN_15);
- $content_author_email_js = ($content_author_email ? "" : "onfocus=\"if(document.getElementById('dataform').content_author_email.value=='".CONTENT_ADMIN_ITEM_LAN_15."'){document.getElementById('dataform').content_author_email.value='';}\"");
-
- //retrieve the custom/preset data tags
- if(!(isset($_POST['preview_content']) || isset($message)))
- {
- if( varsettrue($row['content_pref']) )
- {
- $custom = $eArrayStorage->ReadArray($row['content_pref']);
- }
- }
-
- //custom data
- $existing_custom = "0";
- $TOPIC_CHECK_VALID = FALSE;
- $CONTENTFORM_CUSTOM = '';
- $ctext = '';
- $chidden = '';
- if($checkcustom && $checkcustomnumber){
- $ctext .= $tp -> parseTemplate($CONTENT_ADMIN_CONTENT_CREATE_CUSTOMSTART, FALSE, $content_shortcodes);
- }
-
- if(!empty($custom)){
- foreach($custom as $k => $v){
- if(substr($k,0,15) == "content_custom_" && substr($k,0,22) != "content_custom_preset_" && $k != "content_custom_presettags"){
- $key = substr($k,15);
-
- $key = $tp -> post_toForm($key);
- $v = $tp -> post_toForm($v);
-
- if($checkcustom && $checkcustomnumber){
- $CONTENTFORM_CUSTOM_KEY = $rs -> form_text("content_custom_key_".$existing_custom."", 20, $key, 100);
- $CONTENTFORM_CUSTOM_VALUE = $rs -> form_text("content_custom_value_".$existing_custom."", 70, $v, 250);
- $ctext .= $tp -> parseTemplate($CONTENT_ADMIN_CONTENT_CREATE_CUSTOMTABLE, FALSE, $content_shortcodes);
- }else{
- $chidden .= "
- ".$rs -> form_hidden("content_custom_key_".$existing_custom, $key)."
- ".$rs -> form_hidden("content_custom_value_".$existing_custom, $v);
- $TOPIC_CHECK_VALID = TRUE;
- }
- $existing_custom = $existing_custom + 1;
- }
- }
- }
- if($checkcustom && $checkcustomnumber){
- $TOPIC_CHECK_VALID = TRUE;
- for($i=$existing_custom;$i<$checkcustomnumber;$i++){
- $CONTENTFORM_CUSTOM_KEY = $rs -> form_text("content_custom_key_".$i."", 20, "", 100);
- $CONTENTFORM_CUSTOM_VALUE = $rs -> form_text("content_custom_value_".$i."", 70, "", 250);
- $ctext .= $tp -> parseTemplate($CONTENT_ADMIN_CONTENT_CREATE_CUSTOMTABLE, FALSE, $content_shortcodes);
- }
- $ctext .= $tp -> parseTemplate($CONTENT_ADMIN_CONTENT_CREATE_CUSTOMEND, FALSE, $content_shortcodes);
- }
- if($TOPIC_CHECK_VALID){
- $CONTENTFORM_CUSTOM = $ctext;
- }
- $hidden .= ($chidden ? $chidden : '');
-
- //preset custom data fields
- $CONTENTFORM_PRESET = '';
- for($i=0;$i parseCustomPresetTag($content_pref["content_custom_preset_key"][$i], $custom['content_custom_presettags']);
- }else{
- $tmp = explode("^", $content_pref["content_custom_preset_key"][$i]);
- if(is_array($custom['content_custom_presettags'][$tmp[0]])){
- $tmp[0] = $tp -> post_toForm($tmp[0]);
- $hidden .= $rs -> form_hidden("content_custom_preset_key[$tmp[0]][day]", $custom['content_custom_presettags'][$tmp[0]][day]);
- $hidden .= $rs -> form_hidden("content_custom_preset_key[$tmp[0]][month]", $custom['content_custom_presettags'][$tmp[0]][month]);
- $hidden .= $rs -> form_hidden("content_custom_preset_key[$tmp[0]][year]", $custom['content_custom_presettags'][$tmp[0]][year]);
- }else{
- $tmp[0] = $tp -> post_toForm($tmp[0]);
- $hidden .= $rs -> form_hidden("content_custom_preset_key[$tmp[0]]", $custom['content_custom_presettags'][$tmp[0]]);
- }
- }
- }
- }
-
- global $CONTENTFORM_HOOK, $CONTENT_ADMIN_CONTENT_CREATE_HOOKSTART, $CONTENT_ADMIN_CONTENT_CREATE_HOOKITEM;
- $data = array('method'=>'form', 'table'=>$plugintable, 'id'=>$row['content_id'], 'plugin'=>'content', 'function'=>'create_item');
- $hooks = $e_event->triggerHook($data);
- $CONTENTFORM_HOOK='';
- if(!empty($hooks))
- {
- $CONTENTFORM_HOOK .= $CONTENT_ADMIN_CONTENT_CREATE_HOOKSTART;
- foreach($hooks as $hook)
- {
- if(!empty($hook))
- {
- $HOOKCAPTION = $hook['caption'];
- $HOOKTEXT = $hook['text'];
- $CONTENTFORM_HOOK .= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_ADMIN_CONTENT_CREATE_HOOKITEM);
- }
- }
- }
-
- $button = ($hidden ? $hidden : "");
- if($qs[1] == "edit" || $qs[1] == "sa" ){
- if($qs[1] == "sa"){
- $button .= $rs -> form_hidden("content_refer", $row['content_refer']);
- }
- $button .= $rs -> form_hidden("content_datestamp", $row['content_datestamp']);
- $button .= $rs -> form_button("submit", "preview_content", (isset($_POST['preview_content']) ? CONTENT_ADMIN_MAIN_LAN_27 : CONTENT_ADMIN_MAIN_LAN_26));
- $button .= $rs -> form_button("submit", "update_content", ($qs[1] == "sa" ? CONTENT_ADMIN_ITEM_LAN_43 : CONTENT_ADMIN_ITEM_LAN_45));
- $button .= $rs -> form_hidden("content_id", $qs[2]);
- $button .= $rs -> form_checkbox("update_datestamp", 1, 0)." ".CONTENT_ADMIN_ITEM_LAN_42;
- }else{
- $button .= $rs -> form_button("submit", "preview_content", (isset($_POST['preview_content']) ? CONTENT_ADMIN_MAIN_LAN_27 : CONTENT_ADMIN_MAIN_LAN_26));
- $button .= $rs -> form_button("submit", "create_content", CONTENT_ADMIN_ITEM_LAN_44);
- }
- $CONTENT_ADMIN_BUTTON = $button;
-
- $text = $tp -> parseTemplate($CONTENT_ADMIN_CONTENT_CREATE, FALSE, $content_shortcodes);
-
- $caption = ($qs[1] == "edit" ? CONTENT_ADMIN_ITEM_LAN_45 : CONTENT_ADMIN_ITEM_LAN_44);
- $ns -> tablerender($caption, $text);
- }
-
-
- function parseCustomPresetTag($tag, $values){
- global $rs, $months, $tp, $content_shortcodes, $CONTENT_ADMIN_CONTENT_CREATE_PRESET, $CONTENTFORM_PRESET_KEY, $CONTENTFORM_PRESET_VALUE;
-
- $tmp = explode("^", $tag);
-
- $str = "";
- if($tmp[1] == "text"){
- $str = $rs -> form_text("content_custom_preset_key[{$tmp[0]}]", $tmp[2], $tp -> post_toForm($values[$tmp[0]]), $tmp[3], "tbox", "", "", "");
-
- }elseif($tmp[1] == "area"){
- $str = $rs -> form_textarea("content_custom_preset_key[{$tmp[0]}]", $tmp[2], $tmp[3], $tp -> post_toForm($values[$tmp[0]]), "", "", "", "", "");
-
- }elseif($tmp[1] == "select"){
- $str = $rs -> form_select_open("content_custom_preset_key[{$tmp[0]}]", "");
- $str .= $rs -> form_option($tmp[2], ($values[$tmp[0]] == $tmp[2] ? "1" : "0"), "", "");
- for($i=3;$i post_toForm($tmp[$i]);
- $str .= $rs -> form_option($tmp[$i], ($values[$tmp[0]] == $tmp[$i] ? "1" : "0"), $tmp[$i], "");
- }
- $str .= $rs -> form_select_close();
-
- }elseif($tmp[1] == "date"){
- $str = $rs -> form_select_open("content_custom_preset_key[{$tmp[0]}][day]", "")."
- ".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_12, "0", "");
- for($i=1;$i<=31;$i++){
- $str .= $rs -> form_option($i, ($values[$tmp[0]]['day'] == $i ? "1" : "0"), $i, "");
- }
- $str .= $rs -> form_select_close();
-
- $str .= $rs -> form_select_open("content_custom_preset_key[{$tmp[0]}][month]", "")."
- ".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_13, "0", "");
- for($i=1;$i<=12;$i++){
- $str .= $rs -> form_option($months[($i-1)], ($values[$tmp[0]]['month'] == $i ? "1" : "0"), $i, "");
- }
- $str .= $rs -> form_select_close();
-
- $str .= $rs -> form_select_open("content_custom_preset_key[{$tmp[0]}][year]", "")."
- ".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_14, "0", "");
- for($i=$tmp[2];$i<=$tmp[3];$i++){
- $str .= $rs -> form_option($i, ($values[$tmp[0]]['year'] == $i ? "1" : "0"), $i, "");
- }
- $str .= $rs -> form_select_close();
-
- }elseif($tmp[1] == "radio"){
- for($i=2;$i form_radio("content_custom_preset_key[{$tmp[0]}]", $tmp[$i], ($values[$tmp[0]] == $tmp[$i] ? "1" : "0"), "", "")." ".$tmp[$i];
- $i++;
- }
-
- }elseif($tmp[1] == "checkbox"){
- $str = $rs -> form_checkbox("content_custom_preset_key[{$tmp[0]}]", $tp -> post_toForm($tmp[2]), ($values[$tmp[0]] == $tmp[2] ? "1" : "0"), "", "");
- }
-
- $CONTENTFORM_PRESET_KEY = $tmp[0];
- $CONTENTFORM_PRESET_VALUE = $str;
-
- $text = $tp -> parseTemplate($CONTENT_ADMIN_CONTENT_CREATE_PRESET, FALSE, $content_shortcodes);
- return $text;
- }
-
-
-
- function show_manage_content($mode, $userid="", $username=""){
- global $qs, $sql, $sql2, $ns, $rs, $aa, $plugintable, $plugindir, $tp, $content_shortcodes, $eArrayStorage;
-
- if($mode != "contentmanager"){
- //category parent
- global $CONTENT_ADMIN_CONTENT_CATSELECT, $CONTENTFORM_CATEGORYSELECT;
- $CONTENTFORM_CATEGORYSELECT = $aa -> ShowOption( (is_numeric($qs[1]) ? $qs[1] : ""), "managecontent" );
- $text = $tp -> parseTemplate($CONTENT_ADMIN_CONTENT_CATSELECT, FALSE, $content_shortcodes);
- $ns -> tablerender(CONTENT_ADMIN_MAIN_LAN_2, $text);
- }
-
- if(!isset($qs[1])){
- return;
- }
-
- $mainparent = $aa -> getMainParent($qs[1]);
- $content_pref = $aa -> getContentPref($mainparent, true);
-
- if($mode == "contentmanager"){
- $personalmanagercheck = FALSE;
- if($sql -> db_Select($plugintable, "content_id, content_heading, content_pref", " content_id='".intval($qs[1])."' ")){
- $rowpcm = $sql -> db_Fetch();
- $curpref = $eArrayStorage->ReadArray($rowpcm['content_pref']);
-
- //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($curpref['content_manager_inherit']) ){
- $sql2 -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
- $row2 = $sql2 -> db_Fetch();
- $curpref = $eArrayStorage->ReadArray($row2['e107_value']);
- }
-
- //only show personal items
- if( isset($curpref["content_manager_personal"]) && check_class($curpref["content_manager_personal"]) ){
- $l = strlen($userid)+1;
- $qryuser = " AND (content_author = '".$userid."' || LEFT(content_author, ".$l.") = '".$userid."^' OR SUBSTRING_INDEX(content_author, '^', 1) = '".$userid."' || content_author REGEXP '\\\^".$username."' ) ";
- $personalmanagercheck = TRUE;
- }
- //show all items in this category
- if(isset($curpref["content_manager_category"]) && check_class($curpref["content_manager_category"]) ){
- $qryuser = '';
- $personalmanagercheck = TRUE;
- }
- }
- if($personalmanagercheck == TRUE){
- $formtarget = $plugindir."content_manager.php?content.".intval($qs[1]);
- $qrycat = " content_parent = '".intval($qs[1])."' ";
- $qryfirst = " content_parent = '".intval($qs[1])."' ";
- $qryletter = "";
-
- }else{
- header("location:".$plugindir."content_manager.php"); exit;
- }
- }else{
- $array = $aa -> getCategoryTree("", intval($qs[1]), TRUE);
- $validparent = implode(",", array_keys($array));
- $qrycat = " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
- $qryuser = "";
- if( !(isset($qs[2]) && is_numeric($qs[2])) ){
- $formtarget = e_SELF."?content.".intval($qs[1]);
- $qryfirst = " ".$qrycat." ";
- $qryletter = "";
- }
- }
-
- $text = "";
- // -------- SHOW FIRST LETTERS FIRSTNAMES ------------------------------------
- if(!is_object($sql)){ $sql = new db; }
- $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);
- $head_sub = ( ord($head) < 128 ? strtoupper(substr($head,0,1)) : substr($head,0,2) );
- $arrletters[] = $head_sub;
- }
- $arrletters = array_values(array_unique($arrletters));
- sort($arrletters);
-
- if ($distinctfirstletter == 0){
- $text .= "".CONTENT_ADMIN_ITEM_LAN_4."
";
- $ns -> tablerender(CONTENT_ADMIN_ITEM_LAN_5, $text);
- return;
-
- }elseif ($distinctfirstletter != 1){
- global $tp, $content_shortcodes, $CONTENT_ADMIN_CONTENT_LIST_LETTER, $CONTENT_ADMIN_LETTERINDEX, $CONTENT_ADMIN_FORM_TARGET;
- $CONTENT_ADMIN_LETTERINDEX = "";
- for($i=0;$i ";
- }
- }
- $CONTENT_ADMIN_LETTERINDEX .= " ";
- $CONTENT_ADMIN_FORM_TARGET = $formtarget;
-
- $text .= $tp -> parseTemplate($CONTENT_ADMIN_CONTENT_LIST_LETTER, FALSE, $content_shortcodes);
- }
- // ---------------------------------------------------------------------------
-
- // -------- CHECK FOR FIRST LETTER SUBMISSION --------------------------------
- $letter=(isset($_POST['letter']) ? $_POST['letter'] : "");
- if ($letter != "" && $letter != "all" ) { $qryletter .= " AND content_heading LIKE '".$tp->toDB($letter)."%' "; }else{ $qryletter .= ""; }
-
- $qryitem = " ".$qrycat." AND content_refer != 'sa' ".$qryletter." ".$qryuser." ORDER BY content_datestamp DESC";
- // ---------------------------------------------------------------------------
-
- if(!is_object($sql2)){ $sql2 = new db; }
- if(!$content_total = $sql2 -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_author, content_icon", $qryitem)){
- $text .= "".CONTENT_ADMIN_ITEM_LAN_4."
";
- }else{
- global $tp, $content_shortcodes, $row, $CONTENT_ADMIN_CONTENT_LIST_START, $CONTENT_ADMIN_CONTENT_LIST_TABLE, $CONTENT_ADMIN_CONTENT_LIST_END, $CONTENT_ICON, $CONTENT_ADMIN_OPTIONS;
-
- if($content_total < 50 || (isset($letter) && $letter!='') ){
- $text .= $tp -> parseTemplate($CONTENT_ADMIN_CONTENT_LIST_START, FALSE, $content_shortcodes);
- while($row = $sql2 -> db_Fetch()){
- $delete_heading = str_replace("'", "\'", $row['content_heading']);
- $deleteicon = CONTENT_ICON_DELETE;
- $cid = $row['content_id'];
-
- $CONTENT_ICON = ($row['content_icon'] && is_readable($content_pref['content_icon_path'].$row['content_icon']) ? " " : " ");
-
- $CONTENT_ADMIN_OPTIONS = "".CONTENT_ICON_EDIT."
- toJS(CONTENT_ADMIN_JS_LAN_1."\\n\\n[".CONTENT_ADMIN_JS_LAN_6." ".$cid." : ".$delete_heading."]")."')\"/>";
-
- $text .= $tp -> parseTemplate($CONTENT_ADMIN_CONTENT_LIST_TABLE, FALSE, $content_shortcodes);
- }
- $text .= $tp -> parseTemplate($CONTENT_ADMIN_CONTENT_LIST_END, FALSE, $content_shortcodes);
- } else {
- $text .= "".CONTENT_ADMIN_ITEM_LAN_7."
";
- }
- }
- $ns -> tablerender(CONTENT_ADMIN_ITEM_LAN_5, $text);
- }
-
-
-
- function show_submitted($cat=''){
- global $qs, $rs, $ns, $aa, $plugintable, $tp, $content_shortcodes, $eArrayStorage, $row, $CONTENT_ADMIN_SUBMITTED_START, $CONTENT_ADMIN_SUBMITTED_TABLE, $CONTENT_ADMIN_SUBMITTED_END, $CONTENT_ICON, $CONTENT_ADMIN_OPTIONS, $CONTENT_ADMIN_CATEGORY;
-
- if(!is_object($sql)){ $sql = new db; }
-
- $catqry = '';
- //if cat is not set, we are coming from admin, so continue
- //if cat is set, cat holds the category id, and we need to do some validation
- if($cat && is_numeric($cat)){
-
- //we need to check if the user is allowed to approve submitted content items within this category
- //so first we need to get the preferences from the category
- if(!$sql -> db_Select($plugintable, "content_pref", "content_id = '".intval($cat)."' ")){
- //not a valid category, so redirect
- header("location:".e_SELF); exit;
- }else{
- $row = $sql -> db_Fetch();
- $content_pref = $eArrayStorage->ReadArray($row['content_pref']);
-
- //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']) ){
- $sql -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
- $row = $sql -> db_Fetch();
- $content_pref = $eArrayStorage->ReadArray($row['e107_value']);
- }
-
- //check permission to approve submitted content items
- if( isset($content_pref["content_manager_approve"]) && check_class($content_pref["content_manager_approve"]) ){
- //user is allowed, so assign cat query
- $catqry = " AND content_parent='".intval($cat)."' ";
- }else{
- //user is not allowed, so redirect
- header("location:".e_SELF); exit;
- }
- }
- }
-
- if(!$content_total = $sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_author, content_icon, content_parent", "content_refer = 'sa' ".$catqry." ")){
- $text .= "".CONTENT_ADMIN_ITEM_LAN_50."
";
- }else{
- $array = $aa -> getCategoryTree("", "", FALSE);
-
- $text = $tp -> parseTemplate($CONTENT_ADMIN_SUBMITTED_START, FALSE, $content_shortcodes);
- while($row = $sql -> db_Fetch()){
-
- $CONTENT_ICON=FALSE;
- $CONTENT_ADMIN_CATEGORY=FALSE;
- 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, true);
- $CONTENT_ICON = ($row['content_icon'] ? " " : " ");
- }
- $delete_heading = str_replace("'", "\'", $row['content_heading']);
- $delid = $row['content_id'];
-
- $CONTENT_ADMIN_OPTIONS = "
- ".CONTENT_ICON_EDIT."
- toJS(CONTENT_ADMIN_JS_LAN_10."\\n\\n[".CONTENT_ADMIN_JS_LAN_6." ".$delid." : ".$delete_heading."]")."')\"/>";
-
- $text .= $tp -> parseTemplate($CONTENT_ADMIN_SUBMITTED_TABLE, FALSE, $content_shortcodes);
- }
- $text .= $tp -> parseTemplate($CONTENT_ADMIN_SUBMITTED_END, FALSE, $content_shortcodes);
- }
- $ns -> tablerender(CONTENT_ADMIN_ITEM_LAN_49, $text);
- }
-
-
- function manage_cat(){
- global $qs, $sql, $ns, $rs, $aa, $plugintable, $plugindir, $tp, $content_shortcodes, $stylespacer, $eArrayStorage, $CONTENT_ADMIN_CATEGORY_START, $CONTENT_ADMIN_CATEGORY_TABLE, $CONTENT_ADMIN_CATEGORY_END, $CONTENT_ADMIN_OPTIONS, $row, $catarray, $catid, $content_pref, $CONTENT_ADMIN_SPACER;
-
- $catarray = $aa -> getCategoryTree("", "", FALSE);
- $array = array_keys($catarray);
-
- if(!is_array($array)){
- $text = "".CONTENT_ADMIN_CAT_LAN_9."
";
- }else{
- $text = $tp -> parseTemplate($CONTENT_ADMIN_CATEGORY_START, FALSE, $content_shortcodes);
-
- if(!is_object($sql)){ $sql = new db; }
- foreach($array as $catid){
- if(!$category_total = $sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_parent, content_icon, content_author", "content_id='".intval($catid)."' ")){
- $text .= "".CONTENT_ADMIN_CAT_LAN_9."
";
- }else{
- $row = $sql -> db_Fetch();
-
- $content_pref = $aa -> getContentPref($catarray[$catid][0], true);
- $delete_heading = str_replace("'", "\'", $row['content_heading']);
-
- $CONTENT_ADMIN_SPACER = ($row['content_parent']==0 ? TRUE : FALSE);
- $CONTENT_ADMIN_OPTIONS = "".CONTENT_ICON_EDIT."
- toJS(CONTENT_ADMIN_JS_LAN_9."\\n\\n".CONTENT_ADMIN_JS_LAN_0."\\n\\n[".CONTENT_ADMIN_JS_LAN_6." ".$catid." : ".$delete_heading."]\\n\\n")."')\"/>";
-
- $text .= $tp -> parseTemplate($CONTENT_ADMIN_CATEGORY_TABLE, FALSE, $content_shortcodes);
- }
- }
- $text .= $tp -> parseTemplate($CONTENT_ADMIN_CATEGORY_END, FALSE, $content_shortcodes);
- }
- $ns -> tablerender(CONTENT_ADMIN_CAT_LAN_10, $text);
- unset($row['content_id'], $row['content_heading'], $row['content_subheading'], $row['content_text'], $row['content_icon']);
- }
-
- function manager(){
- global $qs, $sql, $ns, $rs, $aa, $plugintable, $plugindir, $tp, $content_shortcodes, $content_pref, $stylespacer, $eArrayStorage, $CONTENT_ADMIN_MANAGER_START, $CONTENT_ADMIN_MANAGER_TABLE, $CONTENT_ADMIN_MANAGER_END, $catarray, $catid, $row, $pre, $CONTENT_ADMIN_SPACER;
-
- $catarray = $aa -> getCategoryTree("", "", FALSE);
- $array = array_keys($catarray);
-
- if(!is_array($array)){
- $text = "".CONTENT_ADMIN_CAT_LAN_9."
";
- }else{
- $text = $tp -> parseTemplate($CONTENT_ADMIN_MANAGER_START, FALSE, $content_shortcodes);
-
- if(!is_object($sql)){ $sql = new db; }
- foreach($array as $catid){
- if($category_total = $sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_parent, content_icon, content_author", "content_id='".intval($catid)."' ")){
- $row = $sql -> db_Fetch();
- $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);
- }
- }
- $text .= $tp -> parseTemplate($CONTENT_ADMIN_MANAGER_END, FALSE, $content_shortcodes);
- }
- $ns -> tablerender(CONTENT_ADMIN_CAT_LAN_10, $text);
- unset($row['content_id'], $row['content_heading'], $row['content_subheading'], $row['content_text'], $row['content_icon']);
- }
-
-
- function manager_category(){
- global $plugintable, $qs, $sql, $ns, $rs, $aa, $eArrayStorage, $tp, $content_shortcodes, $CONTENT_ADMIN_MANAGER_CATEGORY, $CONTENT_ADMIN_BUTTON, $CONTENT_ADMIN_MANAGER_OPTIONS, $content_pref;
-
- if( !getperms("0") && ($qs[1]!='default' || !is_numeric($qs[1])) ){ js_location(e_SELF); }
-
- if($qs[1] == "default"){
- $caption = CONTENT_ADMIN_OPT_LAN_0." : ".CONTENT_ADMIN_OPT_LAN_1;
- $content_pref = $aa -> getContentPref('0');
- }elseif(is_numeric($qs[1])){
- if(!is_object($sql)){ $sql = new db; }
- if(!$sql -> db_Select($plugintable, "content_id, content_heading, content_pref", "content_id='".intval($qs[1])."' ")){
- header("location:".e_SELF."?manager"); exit;
- }else{
- $row = $sql -> db_Fetch();
- $caption = CONTENT_ADMIN_CAT_LAN_30." : ".$row['content_heading'];
- $content_pref = $eArrayStorage->ReadArray($row['content_pref']);
- }
- }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);
- $ns -> tablerender($caption, $text);
- }
-
- function manager_category_options($content_pref){
- global $ns, $rs;
-
- //define some variables
- $CONTENT_ADMIN_MANAGER_ROW_TITLE = "{TOPIC_CAPTION} ";
- $CONTENT_ADMIN_MANAGER_ROW_NOEXPAND = "
-
-
-
- ";
-
- $text = "
- ";
-
- $TOPIC_CAPTION = CONTENT_ADMIN_OPT_LAN_MENU_4;
- $text .= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_ADMIN_MANAGER_ROW_TITLE);
-
- //content_manager_submit_directpost_
- $TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_11;
- $TOPIC_FIELD = "
- ".$rs -> form_radio("content_manager_submit_directpost", "1", ($content_pref['content_manager_submit_directpost'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
- ".$rs -> form_radio("content_manager_submit_directpost", "0", ($content_pref['content_manager_submit_directpost'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31;
- $text .= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_ADMIN_MANAGER_ROW_NOEXPAND);
-
- //content_manager_submit_sections
- $TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_1;
- $TOPIC_FIELD = "
- ".$rs -> form_checkbox("content_manager_submit_subheading", 1, (isset($content_pref['content_manager_submit_subheading']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_32."
- ".$rs -> form_checkbox("content_manager_submit_summary", 1, (isset($content_pref['content_manager_submit_summary']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_38."
- ".$rs -> form_checkbox("content_manager_submit_startdate", 1, (isset($content_pref['content_manager_submit_startdate']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_33."
- ".$rs -> form_checkbox("content_manager_submit_enddate", 1, (isset($content_pref['content_manager_submit_enddate']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_34."
- ".$rs -> form_checkbox("content_manager_submit_icon", 1, (isset($content_pref['content_manager_submit_icon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."
- ".$rs -> form_checkbox("content_manager_submit_attach", 1, (isset($content_pref['content_manager_submit_attach']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_2."
- ".$rs -> form_checkbox("content_manager_submit_images", 1, (isset($content_pref['content_manager_submit_images']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_3."
- ".$rs -> form_checkbox("content_manager_submit_comment", 1, (isset($content_pref['content_manager_submit_comment']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_4."
-
- ".$rs -> form_checkbox("content_manager_submit_rating", 1, (isset($content_pref['content_manager_submit_rating']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_5."
- ".$rs -> form_checkbox("content_manager_submit_score", 1, (isset($content_pref['content_manager_submit_score']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_6."
- ".$rs -> form_checkbox("content_manager_submit_pe", 1, (isset($content_pref['content_manager_submit_pe']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_20."
- ".$rs -> form_checkbox("content_manager_submit_visibility", 1, (isset($content_pref['content_manager_submit_visibility']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_7."
- ".$rs -> form_checkbox("content_manager_submit_meta", 1, (isset($content_pref['content_manager_submit_meta']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_8."
- ".$rs -> form_checkbox("content_manager_submit_layout", 1, (isset($content_pref['content_manager_submit_layout']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_9."
- ".$rs -> form_checkbox("content_manager_submit_customtags", 1, (isset($content_pref['content_manager_submit_customtags']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_10."
- ".$rs -> form_checkbox("content_manager_submit_presettags", 1, (isset($content_pref['content_manager_submit_presettags']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_11."
-
";
- $text .= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_ADMIN_MANAGER_ROW_NOEXPAND);
-
- //content_manager_submit_custom_number_
- $TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_5;
- $TOPIC_FIELD = "
- ".$rs -> form_select_open("content_manager_submit_custom_number");
- for($i=0;$i<11;$i++){
- $TOPIC_FIELD .= $rs -> form_option($i, ($content_pref['content_manager_submit_custom_number'] == $i ? "1" : "0"), $i);
- }
- $TOPIC_FIELD .= $rs -> form_select_close();
- $text .= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_ADMIN_MANAGER_ROW_NOEXPAND);
-
- //content_manager_submit_images_number_
- $TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_3;
- $TOPIC_FIELD = "
- ".$rs -> form_select_open("content_manager_submit_images_number");
- for($i=1;$i<16;$i++){
- $k=$i*2;
- $TOPIC_FIELD .= $rs -> form_option($k, ($content_pref['content_manager_submit_images_number'] == $k ? "1" : "0"), $k);
- }
- $TOPIC_FIELD .= $rs -> form_select_close();
- $text .= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_ADMIN_MANAGER_ROW_NOEXPAND);
-
- //content_manager_submit_files_number_
- $TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_4;
- $TOPIC_FIELD = "
- ".$rs -> form_select_open("content_manager_submit_files_number");
- for($i=1;$i<6;$i++){
- $TOPIC_FIELD .= $rs -> form_option($i, ($content_pref['content_manager_submit_files_number'] == $i ? "1" : "0"), $i);
- }
- $TOPIC_FIELD .= $rs -> form_select_close();
- $text .= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_ADMIN_MANAGER_ROW_NOEXPAND);
-
- $text .= "
-
";
-
- $text .= "
-
- ";
-
- $TOPIC_CAPTION = CONTENT_ADMIN_OPT_LAN_MENU_23;
- $text .= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_ADMIN_MANAGER_ROW_TITLE);
-
- //content_manager_manager_sections
- $TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_1;
- $TOPIC_FIELD = "
- ".$rs -> form_checkbox("content_manager_manager_subheading", 1, (isset($content_pref['content_manager_manager_subheading']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_32."
- ".$rs -> form_checkbox("content_manager_manager_summary", 1, (isset($content_pref['content_manager_manager_summary']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_38."
- ".$rs -> form_checkbox("content_manager_manager_startdate", 1, (isset($content_pref['content_manager_manager_startdate']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_33."
- ".$rs -> form_checkbox("content_manager_manager_enddate", 1, (isset($content_pref['content_manager_manager_enddate']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_34."
- ".$rs -> form_checkbox("content_manager_manager_icon", 1, (isset($content_pref['content_manager_manager_icon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."
- ".$rs -> form_checkbox("content_manager_manager_attach", 1, (isset($content_pref['content_manager_manager_attach']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_2."
- ".$rs -> form_checkbox("content_manager_manager_images", 1, (isset($content_pref['content_manager_manager_images']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_3."
- ".$rs -> form_checkbox("content_manager_manager_comment", 1, (isset($content_pref['content_manager_manager_comment']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_4."
-
- ".$rs -> form_checkbox("content_manager_manager_rating", 1, (isset($content_pref['content_manager_manager_rating']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_5."
- ".$rs -> form_checkbox("content_manager_manager_score", 1, (isset($content_pref['content_manager_manager_score']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_6."
- ".$rs -> form_checkbox("content_manager_manager_pe", 1, (isset($content_pref['content_manager_manager_pe']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_20."
- ".$rs -> form_checkbox("content_manager_manager_visibility", 1, (isset($content_pref['content_manager_manager_visibility']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_7."
- ".$rs -> form_checkbox("content_manager_manager_meta", 1, (isset($content_pref['content_manager_manager_meta']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_8."
- ".$rs -> form_checkbox("content_manager_manager_layout", 1, (isset($content_pref['content_manager_manager_layout']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_9."
- ".$rs -> form_checkbox("content_manager_manager_customtags", 1, (isset($content_pref['content_manager_manager_customtags']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_10."
- ".$rs -> form_checkbox("content_manager_manager_presettags", 1, (isset($content_pref['content_manager_manager_presettags']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_11."
-
";
- $text .= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_ADMIN_MANAGER_ROW_NOEXPAND);
-
- //content_manager_manager_custom_number_
- $TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_5;
- $TOPIC_FIELD = "
- ".$rs -> form_select_open("content_manager_manager_custom_number");
- for($i=0;$i<11;$i++){
- $TOPIC_FIELD .= $rs -> form_option($i, ($content_pref['content_manager_manager_custom_number'] == $i ? "1" : "0"), $i);
- }
- $TOPIC_FIELD .= $rs -> form_select_close();
- $text .= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_ADMIN_MANAGER_ROW_NOEXPAND);
-
- //content_manager_manager_images_number_
- $TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_3;
- $TOPIC_FIELD = "
- ".$rs -> form_select_open("content_manager_manager_images_number");
- for($i=1;$i<16;$i++){
- $k=$i*2;
- $TOPIC_FIELD .= $rs -> form_option($k, ($content_pref['content_manager_manager_images_number'] == $k ? "1" : "0"), $k);
- }
- $TOPIC_FIELD .= $rs -> form_select_close();
- $text .= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_ADMIN_MANAGER_ROW_NOEXPAND);
-
- //content_manager_manager_files_number_
- $TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_4;
- $TOPIC_FIELD = "
- ".$rs -> form_select_open("content_manager_manager_files_number");
- for($i=1;$i<6;$i++){
- $TOPIC_FIELD .= $rs -> form_option($i, ($content_pref['content_manager_manager_files_number'] == $i ? "1" : "0"), $i);
- }
- $TOPIC_FIELD .= $rs -> form_select_close();
- $text .= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_ADMIN_MANAGER_ROW_NOEXPAND);
-
- $text .= "
-
";
-
-
- return $text;
- }
-
-
-
-
- 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 $months, $current_year, $ne_day, $ne_month, $ne_year, $end_day, $end_month, $end_year, $content_pref;
-
- $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, 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])."' ")){
- header("location:".e_SELF."?cat"); exit;
- }
- }
- if( $qs[0] == "cat" && $qs[1] == "edit" && isset($qs[2]) && is_numeric($qs[2]) ){
- if(!$sql -> db_Select($plugintable, "*", "content_id='".intval($qs[2])."' ")){
- header("location:".e_SELF."?cat"); exit;
- }else{
- $row = $sql -> db_Fetch();
- if(substr($row['content_parent'],0,1) != "0"){
- header("location:".e_SELF."?cat"); exit;
- }
- $menuheading = $row['content_heading'];
- }
- }
-
- if(isset($_POST['preview_category'])){
- $cat_heading = $tp -> post_toHTML($_POST['cat_heading']);
- $cat_subheading = $tp -> post_toHTML($_POST['cat_subheading']);
- if(e_WYSIWYG){
- $_POST['cat_text'] = $tp->createConstants($_POST['cat_text']); // convert e107_images/ to {e_IMAGE} etc.
- }
- $cat_text = $tp->post_toHTML($_POST['cat_text'],TRUE);
-
- $text = "
-
-
-
-
- ".$cat_heading."
-
-
-
-
-
-
-
-
-
-
-
-
";
-
- $ns -> tablerender($cat_heading, $text);
- }
-
- if( isset($_POST['preview_category']) || isset($message) || isset($_POST['uploadcaticon']) ){
- $row['content_heading'] = $tp -> post_toForm($_POST['cat_heading']);
- $row['content_subheading'] = $tp -> post_toForm($_POST['cat_subheading']);
- if(e_WYSIWYG){
- $_POST['cat_text'] = $tp->toHTML($_POST['cat_text'],$parseBB = TRUE); // parse the bbcodes to we can edit as html.
- $_POST['cat_text'] = $tp->replaceConstants($_POST['cat_text'],TRUE); // eg. replace {e_IMAGE} with e107_images/ and NOT ../e107_images
- }
- $row['content_text'] = $tp -> post_toForm($_POST['cat_text']);
- $ne_day = $_POST['ne_day'];
- $ne_month = $_POST['ne_month'];
- $ne_year = $_POST['ne_year'];
- $end_day = $_POST['end_day'];
- $end_month = $_POST['end_month'];
- $end_year = $_POST['end_year'];
- $row['content_icon'] = $_POST['cat_icon'];
- $row['content_comment'] = $_POST['cat_comment'];
- $row['content_rate'] = $_POST['cat_rate'];
- $row['content_pe'] = $_POST['cat_pe'];
- $row['content_class'] = $_POST['cat_class'];
- }else{
- if(e_WYSIWYG){
- $row['content_text'] = $tp->replaceConstants($row['content_text'],TRUE); // eg. replace {e_IMAGE} with e107_images/ and NOT ../e107_images
- }
- }
-
- //date parsing
- if(isset($row['content_datestamp']) && $row['content_datestamp'] != "0"){
- $startdate = getdate($row['content_datestamp']);
- $ne_day = $startdate['mday'];
- $ne_month = $startdate['mon'];
- $ne_year = $startdate['year'];
- }else{
- $ne_day = (isset($ne_day) ? $ne_day : "");
- $ne_month = (isset($ne_month) ? $ne_month : "");
- $ne_year = (isset($ne_year) ? $ne_year : "");
- }
- if(isset($row['content_enddate']) && $row['content_enddate'] != "0"){
- $enddate = getdate($row['content_enddate']);
- $end_day = $enddate['mday'];
- $end_month = $enddate['mon'];
- $end_year = $enddate['year'];
- }else{
- $end_day = (isset($end_day) ? $end_day : "");
- $end_month = (isset($end_month) ? $end_month : "");
- $end_year = (isset($end_year) ? $end_year : "");
- }
- $smarray = getdate();
- $current_year = $smarray['year'];
-
- //check which areas should be visible (dependent on options in admin:create category)
- if( varsettrue($content_pref["content_admincat_subheading"]) ){
- $show['subheading'] = true;
- }else{
- $show['subheading'] = false;
- $hidden .= $rs -> form_hidden("cat_subheading", $row['content_subheading']);
- }
- if( varsettrue($content_pref["content_admincat_startdate"]) ){
- $show['startdate'] = true;
- }else{
- $show['startdate'] = false;
- $hidden .= $rs -> form_hidden("ne_day", $ne_day);
- $hidden .= $rs -> form_hidden("ne_month", $ne_month);
- $hidden .= $rs -> form_hidden("ne_year", $ne_year);
- }
- if( varsettrue($content_pref["content_admincat_enddate"]) ){
- $show['enddate'] = true;
- }else{
- $show['enddate'] = false;
- $hidden .= $rs -> form_hidden("end_day", $end_day);
- $hidden .= $rs -> form_hidden("end_month", $end_month);
- $hidden .= $rs -> form_hidden("end_year", $end_year);
- }
- if( varsettrue($content_pref["content_admincat_uploadicon"]) ){
- $show['uploadicon'] = true;
- }else{
- $show['uploadicon'] = false;
- }
- if( varsettrue($content_pref["content_admincat_selecticon"]) ){
- $show['selecticon'] = true;
- }else{
- $show['selecticon'] = false;
- $hidden .= $rs -> form_hidden("cat_icon", $row['content_icon']);
- }
- if( varsettrue($content_pref["content_admincat_comment"]) ){
- $show['comment'] = true;
- }else{
- $show['comment'] = false;
- $hidden .= $rs -> form_hidden("cat_comment", $row['content_comment']);
- }
- if( varsettrue($content_pref["content_admincat_rating"]) ){
- $show['rating'] = true;
- }else{
- $show['rating'] = false;
- $hidden .= $rs -> form_hidden("cat_rate", $row['content_rate']);
- }
- if( varsettrue($content_pref["content_admincat_pe"]) ){
- $show['pe'] = true;
- }else{
- $show['pe'] = false;
- $hidden .= $rs -> form_hidden("cat_pe", $row['content_pe']);
- }
- if( varsettrue($content_pref["content_admincat_visibility"]) ){
- $show['visibility'] = true;
- }else{
- $show['visibility'] = false;
- $hidden .= $rs -> form_hidden("cat_class", $row['content_class']);
- }
-
- //category parent
- if($qs[1] == "create"){
- $parent = (isset($qs[3]) && is_numeric($qs[3]) ? $qs[3] : (isset($qs[2]) && is_numeric($qs[2]) ? $qs[2] : "0") );
- }elseif($qs[1] == "edit"){
- if(isset($qs[3]) && is_numeric($qs[3])){
- $parent = $qs[3];
- }else{
- $parent = ( strpos($row['content_parent'], ".") ? substr($row['content_parent'],2) : "");
- }
- }
- $CATFORM_CATEGORY = $aa -> ShowOption($parent, "category");
-
- //submit/preview button
- $button = $hidden;
- if($qs[1] == "edit" && is_numeric($qs[2]) ){
- $button .= $rs -> form_button("submit", "preview_category", (isset($_POST['preview_category']) ? CONTENT_ADMIN_MAIN_LAN_27 : CONTENT_ADMIN_MAIN_LAN_26));
- $button .= $rs -> form_button("submit", "update_category", CONTENT_ADMIN_CAT_LAN_7).$rs -> form_button("submit", "category_clear", CONTENT_ADMIN_CAT_LAN_21).$rs -> form_hidden("parent_id", $parent).$rs -> form_hidden("cat_id", $qs[2]).$rs -> form_hidden("id", $qs[2]).$rs -> form_hidden("menuheading", $menuheading);
- }else{
- $button .= $rs -> form_button("submit", "preview_category", (isset($_POST['preview_category']) ? CONTENT_ADMIN_MAIN_LAN_27 : CONTENT_ADMIN_MAIN_LAN_26));
- $button .= $rs -> form_button("submit", "create_category", CONTENT_ADMIN_CAT_LAN_6);
- }
- $CONTENT_ADMIN_BUTTON = $button;
-
- $text = $tp -> parseTemplate($CONTENT_ADMIN_CAT_CREATE, FALSE, $content_shortcodes);
-
- $caption = ($qs[1] == "edit" && is_numeric($qs[2]) ? CONTENT_ADMIN_CAT_LAN_1 : CONTENT_ADMIN_CAT_LAN_0);
- $ns -> tablerender($caption, $text);
- }
-
-
-
- function show_contentmanager($mode, $userid="", $username=""){
- global $content_shortcodes, $row, $tp, $sql, $sql2, $ns, $rs, $plugintable, $plugindir, $aa, $eArrayStorage;
- global $CONTENT_CONTENTMANAGER_CATEGORY, $CONTENT_CONTENTMANAGER_TABLE, $CONTENT_CONTENTMANAGER_TABLE_START, $CONTENT_CONTENTMANAGER_TABLE_END, $content_pref, $pref;
-
- $personalmanagercheck = FALSE;
-
- if(!isset($CONTENT_CONTENTMANAGER_TABLE)){
- if(is_readable(e_THEME.$pref['sitetheme']."/content/content_manager_template.php")){
- require_once(e_THEME.$pref['sitetheme']."/content/content_manager_template.php");
- }else{
- require_once(e_PLUGIN."content/templates/content_manager_template.php");
- }
- }
- $array = $aa -> getCategoryTree("", "", TRUE);
- $catarray = array_keys($array);
- $content_contentmanager_table_string = "";
- foreach($catarray as $catid){
- if($sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_text, content_pref", " content_id='".intval($catid)."' ")){
- $row = $sql -> db_Fetch();
-
- //get preferences for this category
- $content_pref = $eArrayStorage->ReadArray($row['content_pref']);
-
- //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_value", "e107_name='$plugintable' ");
- $row2 = $sql2 -> db_Fetch();
- $content_pref = $eArrayStorage->ReadArray($row2['e107_value']);
- }
-
- //now we can check the permissions for this user
- if( (isset($content_pref["content_manager_approve"]) && check_class($content_pref["content_manager_approve"])) ||
- (isset($content_pref["content_manager_personal"]) && check_class($content_pref["content_manager_personal"])) ||
- (isset($content_pref["content_manager_category"]) && check_class($content_pref["content_manager_category"])) ||
- (isset($content_pref["content_manager_submit"]) && check_class($content_pref["content_manager_submit"]))
- ){
- $personalmanagercheck = TRUE;
- $content_contentmanager_table_string .= $tp -> parseTemplate($CONTENT_CONTENTMANAGER_TABLE, FALSE, $content_shortcodes);
- }
- }
- }
- if($personalmanagercheck == TRUE){
- $text = $CONTENT_CONTENTMANAGER_TABLE_START.$content_contentmanager_table_string.$CONTENT_CONTENTMANAGER_TABLE_END;
- $ns -> tablerender(CONTENT_ADMIN_ITEM_LAN_56, $text);
- }else{
- header("location:".$plugindir."content.php"); exit;
- }
- }
-
-
-
- function show_order(){
- global $qs, $sql, $sql2, $ns, $rs, $aa, $plugintable, $plugindir, $tp, $content_shortcodes, $content_pref, $CONTENT_ADMIN_ORDER_START, $CONTENT_ADMIN_ORDER_TABLE, $CONTENT_ADMIN_ORDER_END, $CONTENT_ADMIN_ORDER_UPDOWN, $CONTENT_ADMIN_ORDER_SELECT, $stylespacer, $catarray, $catid, $CONTENT_ADMIN_ORDER_AMOUNT, $CONTENT_ADMIN_ORDER_CAT, $CONTENT_ADMIN_ORDER_CATALL, $CONTENT_ADMIN_BUTTON, $row, $CONTENT_ADMIN_SPACER;
-
- $catarray = $aa -> getCategoryTree("", "", FALSE);
- $array = array_keys($catarray);
-
- //number of main parents
- $mp = $sql -> db_Count($plugintable, "(*)", "WHERE content_parent='0' AND content_refer != 'sa' ");
-
- if(!is_array($array)){
- $text = "".CONTENT_ADMIN_CAT_LAN_9."
";
- }else{
-
- $text = $tp -> parseTemplate($CONTENT_ADMIN_ORDER_START, FALSE, $content_shortcodes);
-
- if(!is_object($sql)){ $sql = new db; }
- foreach($array as $catid){
- if(!$category_total = $sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_parent, content_icon, content_author, content_order", "content_id='".intval($catid)."' ")){
- $text .= "".CONTENT_ADMIN_CAT_LAN_9."
";
- }else{
- $row = $sql -> db_Fetch();
-
- $content_pref = $aa -> getContentPref($catarray[$catid][0], true);
-
- //count subcategories for a main parent
- if($row['content_parent'] == 0){
- $ordermax = $mp;
- }else{
- $mainparent = $aa -> getMainParent($row['content_id']);
- $subs = $aa -> getCategoryTree("", $mainparent, FALSE);
- $ordermax = count($subs)-1;
- }
-
- $CONTENT_ADMIN_ORDER_CAT = "";
- $CONTENT_ADMIN_ORDER_CATALL = "";
-
- //count items in category
- if(!is_object($sql2)){ $sql2 = new db; }
- $n = $sql2 -> db_Count($plugintable, "(*)", "WHERE content_parent='".intval($catid)."' AND content_refer != 'sa' ");
- if($n > 1 || $row['content_parent'] == 0){
- $CONTENT_ADMIN_ORDER_CAT = "".CONTENT_ICON_ORDERCAT." ";
- $CONTENT_ADMIN_ORDER_CATALL = ($row['content_parent'] == 0 ? "".CONTENT_ICON_ORDERALL." " : " ");
- }
- $CONTENT_ADMIN_ORDER_AMOUNT = "(".($n == 1 ? $n." ".CONTENT_ADMIN_CAT_LAN_56 : $n." ".CONTENT_ADMIN_CAT_LAN_57).")";
-
- //up arrow
- if($row['content_order'] != 1 && $row['content_order'] != 0){
- $up = "".CONTENT_ICON_ORDER_UP." ";
- }else{
- $up = " ";
- }
- //down arrow
- if($row['content_order'] != $ordermax){
- $down = "".CONTENT_ICON_ORDER_DOWN." ";
- }else{
- $down = " ";
- }
- $CONTENT_ADMIN_ORDER_UPDOWN = $up.$down;
-
- //select box
- $sel = "";
- for($k=1;$k<=$ordermax;$k++){
- $sel .= $rs -> form_option($k, ($row['content_order'] == $k ? "1" : "0"), $catid.".".$k.".cat");
- }
- $sel .= " ";
- $CONTENT_ADMIN_ORDER_SELECT = $sel;
-
- $CONTENT_ADMIN_SPACER = ($row['content_parent']==0 ? TRUE : FALSE);
- $text .= $tp -> parseTemplate($CONTENT_ADMIN_ORDER_TABLE, FALSE, $content_shortcodes);
- }
- }
- $CONTENT_ADMIN_BUTTON = $rs -> form_button("submit", "update_order", CONTENT_ADMIN_ITEM_LAN_61);
- $text .= $tp -> parseTemplate($CONTENT_ADMIN_ORDER_END, FALSE, $content_shortcodes);
- }
- $ns -> tablerender(CONTENT_ADMIN_ITEM_LAN_62, $text);
- }
-
-
-
- function show_content_order($mode){
- global $sql2, $ns, $rs, $qs, $plugintable, $plugindir, $aa, $tp, $content_shortcodes, $CONTENT_ADMIN_ORDER_CONTENT_START, $CONTENT_ADMIN_ORDER_CONTENT_TABLE, $CONTENT_ADMIN_ORDER_CONTENT_END, $CONTENT_ADMIN_FORM_TARGET, $CONTENT_ADMIN_BUTTON, $CONTENT_ADMIN_ORDER_UPDOWN, $CONTENT_ADMIN_ORDER_SELECT, $row;
-
- $allcats = $aa -> getCategoryTree("", "", FALSE);
- if($mode == "ci"){
- $qrystring = "order.".$qs[1].".".$qs[2];
- $formtarget = e_SELF."?order.".$qs[1].".".$qs[2];
- $qry = "content_parent = '".intval($qs[2])."' ";
- $order = "SUBSTRING_INDEX(content_order, '.', 1)+0";
- }elseif($mode == "ai"){
- $qrystring = "order.".$qs[1];
- $formtarget = e_SELF."?order.".$qs[1];
- $array = $aa -> getCategoryTree("", intval($qs[1]), FALSE);
- $validparent = implode(",", array_keys($array));
- $qry = " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
- $order = "SUBSTRING_INDEX(content_order, '.', -1)+0";
- }
- $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 = "".CONTENT_ADMIN_ITEM_LAN_4."
";
- }else{
- $CONTENT_ADMIN_FORM_TARGET = $formtarget;
- $text = $tp -> parseTemplate($CONTENT_ADMIN_ORDER_CONTENT_START, FALSE, $content_shortcodes);
-
- while($row = $sql2 -> db_Fetch()){
- $tmp = explode(".", $row['content_order']);
- if(!$tmp[1]){ $tmp[1] = "0"; }
- $row['content_order'] = $tmp[0]."-".$tmp[1];
-
- $ccheck = ($mode=='ci' ? $tmp[0] : $tmp[1]);
- $cid = $row['content_id'];
- $corder = $row['content_order'];
-
- //up arrow
- if($ccheck != 1 && $ccheck != 0){
- $up = "".CONTENT_ICON_ORDER_UP." ";
- }else{
- $up = " ";
- }
- //down arrow
- if($ccheck != $content_total){
- $down = "".CONTENT_ICON_ORDER_DOWN." ";
- }else{
- $down = " ";
- }
- $CONTENT_ADMIN_ORDER_UPDOWN = $up.$down;
-
- //selectbox order
- $sel = "";
- for($k=1;$k<=$content_total;$k++){
- $sel .= $rs -> form_option($k, ($ccheck == $k ? "1" : "0"), $cid.".".$k.".".$mode.".".$corder);
- }
- $sel .= " ";
- $CONTENT_ADMIN_ORDER_SELECT = $sel;
-
- $text .= $tp -> parseTemplate($CONTENT_ADMIN_ORDER_CONTENT_TABLE, FALSE, $content_shortcodes);
- }
- $CONTENT_ADMIN_BUTTON = $rs -> form_button("submit", "update_order", CONTENT_ADMIN_ITEM_LAN_61);
- $text .= $tp -> parseTemplate($CONTENT_ADMIN_ORDER_CONTENT_END, FALSE, $content_shortcodes);
- }
- $ns -> tablerender(CONTENT_ADMIN_ITEM_LAN_65, $text);
- return;
- }
-
- function show_options(){
- 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, true);
-
- if($category_total = $sql2 -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_icon, content_author", "content_parent='0' ")){
- while($row = $sql2 -> db_Fetch()){
- $content_pref = $aa -> getContentPref($row['content_id'], true);
- $text .= $tp -> parseTemplate($CONTENT_ADMIN_OPTIONS_TABLE, FALSE, $content_shortcodes);
- }
- }
- $text .= $tp -> parseTemplate($CONTENT_ADMIN_OPTIONS_END, FALSE, $content_shortcodes);
- $ns -> tablerender(CONTENT_ADMIN_MENU_LAN_6, $text);
- }
-
-
-
- function show_options_cat(){
- global $qs, $id, $sql, $ns, $rs, $aa, $content_pref, $pref, $plugintable, $plugindir;
- global $fl, $stylespacer, $tp;
-
- if($qs[1] == "default"){
- $id = "0";
- $caption = CONTENT_ADMIN_OPT_LAN_0." : ".CONTENT_ADMIN_OPT_LAN_1;
- }elseif(is_numeric($qs[1])){
- $id = $qs[1];
- $sqlo = new db;
- if(!$sqlo -> db_Select($plugintable, "content_heading", "content_id='".intval($id)."' AND content_parent = '0' ")){
- header("location:".e_SELF."?option"); exit;
- }else{
- while($rowo = $sqlo -> db_Fetch()){
- $caption = CONTENT_ADMIN_OPT_LAN_0." : ".$rowo['content_heading'];
- }
- }
- }else{
- header("location:".e_SELF."?option"); exit;
- }
-
- $content_pref = $aa -> getContentPref($id);
-
- //define some variables
- $TOPIC_TABLE_END = $this->pref_submit()."";
- $TOPIC_TITLE_ROW = "{TOPIC_CAPTION} ";
- $TOPIC_TABLE_START = "";
-
- $TOPIC_ROW_NOEXPAND = "
-
-
-
- ";
-
- $TOPIC_ROW = "
-
-
-
- ";
-
- $TOPIC_ROW_SPACER = " ";
-
- $text = "
- ";
-
- $text .= "
-