- ";
- if($id && $sub_action == "edit")
- {
- $text .= "
-
-
- ";
- } else
- {
- $text .= "
-
- ";
- }
+ $text .= "
+
".LCLAN_96." {SITELINKS=flat:[rendertype number]}
+
+
+
+ ".LCLAN_25.": |
+ ".r_userclass("link_class", $link_class, "off", "public,guest,nobody,member,main,admin,classes")."
+ (".LCLAN_26.")
+ |
+
+
+
+ ".LINKLAN_6.": |
+ ".$frm->selectbox('link_function',$this->linkFunctions,$link_function) ." |
+
+
+
+
+
+
+
+
+
\n";
+
+ if($id && $sub_action == "edit")
+ {
+ $text .= "
+
+
+ ";
+ } else
+ {
+ $text .= "
+
+ ";
+ }
$text .= "
@@ -957,29 +969,52 @@ class links
$link_url = str_replace("&", "&", $link_url); // xhtml compliant links.
- $link_description = $tp->toDB($_POST['link_description']);
- $link_button = $tp->toDB($_POST['link_button']);
- $link_render = intval($_POST['linkrender']);
- $link_open = intval($_POST['linkopentype']);
+ // $link_description = ;
+ // $link_button = ;
+ // $link_render = ;
+// $link_open = ;
$link_class = $tp->toDB($_POST['link_class']);
$message = implode('[!br!]', array($link_name, $link_url, $link_class)); // Probably enough to log
$link_t = $sql->db_Count("links", "(*)");
+
+
+ $insert = array(
+ 'link_parent' => $parent_id,
+ 'link_name' => $link_name,
+ 'link_url' => $link_url,
+ 'link_description' => $tp->toDB($_POST['link_description']),
+ 'link_button' => $tp->toDB($_POST['link_button']),
+ 'link_category' => intval($_POST['linkrender']),
+ 'link_open' => intval($_POST['linkopentype']),
+ 'link_class' => $link_class,
+ 'link_function' => $_POST['link_function'],
+ 'WHERE' => "link_id=".$id
+ );
+
+
+
if($id)
{
- $sql->db_Update("links", "link_parent='{$parent_id}', link_name='{$link_name}', link_url='{$link_url}', link_description='{$link_description}', link_button= '{$link_button}', link_category='{$link_render}', link_open='{$link_open}', link_class='{$link_class}' WHERE link_id='{$id}'");
+ // $sql->db_Update("links", "link_parent='{$parent_id}', link_name='{$link_name}', link_url='{$link_url}', link_description='{$link_description}', link_button= '{$link_button}', link_category='{$link_render}', link_open='{$link_open}', link_class='{$link_class}' WHERE link_id='{$id}'");
+ $status = $sql->db_Update("links", $insert) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
+
//rename all sublinks to eliminate old embedded 'submenu' etc hierarchy.
// this is for upgrade compatibility only. Current hierarchy uses link_parent.
$e107cache->clear("sitelinks");
sitelinks_adminlog('08', $message);
- $emessage->add(LCLAN_3, E_MESSAGE_SUCCESS);
+ $emessage->add(LCLAN_3, $status);
}
else
{ // New link
- $sql->db_Insert("links", "0, '$link_name', '$link_url', '$link_description', '$link_button', ".$link_render.", ".($link_t + 1).", ".$parent_id.", ".$link_open.", ".$link_class,TRUE);
+
+ $insert['link_order'] = $link_t + 1;
+ // $sql->db_Insert("links", "0, '$link_name', '$link_url', '$link_description', '$link_button', ".$link_render.", ".($link_t + 1).", ".$parent_id.", ".$link_open.", ".$link_class,TRUE);
+ $status = $sql->db_Insert("links", $insert) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
+
$e107cache->clear("sitelinks");
sitelinks_adminlog('07', $message);
- $emessage->add(LCLAN_2, E_MESSAGE_SUCCESS);
+ $emessage->add(LCLAN_2, $status);
}
}
diff --git a/e107_admin/sql/core_sql.php b/e107_admin/sql/core_sql.php
index afbca0eff..806a7ab28 100644
--- a/e107_admin/sql/core_sql.php
+++ b/e107_admin/sql/core_sql.php
@@ -9,8 +9,8 @@
* Core SQL
*
* $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $
- * $Revision: 1.40 $
- * $Date: 2009-11-19 12:35:33 $
+ * $Revision: 1.41 $
+ * $Date: 2009-11-20 05:01:30 $
* $Author: e107coders $
*/
@@ -207,6 +207,7 @@ CREATE TABLE links (
link_parent int(10) unsigned NOT NULL default '0',
link_open tinyint(1) unsigned NOT NULL default '0',
link_class varchar(255) NOT NULL default '0',
+ link_function varchar(100) NOT NULL default '',
PRIMARY KEY (link_id)
) TYPE=MyISAM;
diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php
index e0cc9edff..c13b01003 100644
--- a/e107_admin/update_routines.php
+++ b/e107_admin/update_routines.php
@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
-| $Revision: 1.62 $
-| $Date: 2009-11-19 12:35:33 $
+| $Revision: 1.63 $
+| $Date: 2009-11-20 05:01:30 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@@ -263,7 +263,7 @@ function update_706_to_800($type='')
// List of changed DB tables (defined in core_sql.php)
// (primarily those which have changed significantly; for the odd field write some explicit code - it'll run faster)
$changed_tables = array('user', 'dblog','admin_log', 'userclass_classes', 'banlist', 'menus',
- 'plugin', 'news', 'news_category','online', 'page');
+ 'plugin', 'news', 'news_category','online', 'page', 'links');
// List of changed DB tables from core plugins (defined in pluginname_sql.php file)
@@ -328,7 +328,7 @@ function update_706_to_800($type='')
// Check that custompages have been imported from current theme.php file
- if(!varset($pref['sitetheme_custompages']))
+ if(!array_key_exists('sitetheme_custompages',$pref))
{
$th = e107::getSingleton('themeHandler');
$tmp = $th->getThemeInfo($pref['sitetheme']);
diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php
index 7466ad68b..503c5e889 100644
--- a/e107_handlers/e107_class.php
+++ b/e107_handlers/e107_class.php
@@ -9,9 +9,9 @@
* e107 Main
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/e107_class.php,v $
- * $Revision: 1.77 $
- * $Date: 2009-11-19 11:12:08 $
- * $Author: secretr $
+ * $Revision: 1.78 $
+ * $Date: 2009-11-20 05:01:30 $
+ * $Author: e107coders $
*/
if (!defined('e107_INIT')) { exit; }
@@ -899,6 +899,86 @@ class e107
return self::getRegistry('admin/ui/dispatcher');
}
+
+
+ /**
+ * Retrieves config() from addons such as e_url.php, e_cron.php, e_sitelink.php
+ * @param str $addonName eg. e_cron, e_url
+ * @param str $className [optional] (if different from addonName)
+ * @return
+ */
+ public function getAddonConfig($addonName,$className='')
+ {
+ global $pref;
+
+ $new_cron = array();
+
+ $filename = $addonName; // 'e_cron';
+ if(!$className)
+ {
+ $className = str_replace("e_","",$filename);
+ }
+
+ if(vartrue($pref[$filename.'_list']))
+ {
+
+ foreach($pref[$filename.'_list'] as $key=>$val)
+ {
+ $eplug_cron = array();
+ if(is_readable(e_PLUGIN.$key."/".$filename.".php"))
+ {
+ include_once(e_PLUGIN.$key."/".$filename.".php");
+
+ $class_name = $key."_".$className;// cron";
+ $method_name = 'config';
+
+ if($array = self::callMethod($class_name,$method_name))
+ {
+ $new_cron[$key] = $array;
+ }
+
+ }
+ }
+ }
+
+ return $new_cron;
+ }
+
+
+
+
+
+
+ /**
+ * Safe way to call user methods.
+ * @param str $class_name
+ * @param str $method_name
+ * @return
+ */
+ public function callMethod($class_name,$method_name)
+ {
+ $mes = e107::getMessage();
+
+ if(class_exists($class_name))
+ {
+ $obj = new $class_name;
+ if(method_exists($obj,$method_name))
+ {
+ $mes->add("Executing
".$class_name." :: ".$method_name."()", E_MESSAGE_DEBUG);
+ return call_user_func(array($obj,$method_name));
+ }
+ else
+ {
+ $mes->add("Function
".$class_name." :: ".$method_name."() NOT found.", E_MESSAGE_DEBUG);
+ }
+ }
+ return FALSE;
+ }
+
+
+
+
+
/**
* Retrieve core template path
* Example:
echo e107::coreTemplatePath('admin_icons');
diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php
index ceb741a28..588126682 100644
--- a/e107_handlers/form_handler.php
+++ b/e107_handlers/form_handler.php
@@ -9,8 +9,8 @@
* Form Handler
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
- * $Revision: 1.87 $
- * $Date: 2009-11-19 10:07:32 $
+ * $Revision: 1.88 $
+ * $Date: 2009-11-20 05:01:31 $
* $Author: e107coders $
*
*/
@@ -478,7 +478,19 @@ class e_form
$text = '';
foreach ($option_array as $value => $label)
{
- $text .= $this->option($label, $value, $selected == $value, $options)."\n";
+ if(is_array($label))
+ {
+ $text .= $this->optgroup_open($value);
+ foreach($label as $val => $lab)
+ {
+ $text .= $this->option($lab, $val, ($selected == $val), $options)."\n";
+ }
+ $text .= $this->optgroup_close();
+ }
+ else
+ {
+ $text .= $this->option($label, $value, $selected == $value, $options)."\n";
+ }
}
return $text;
diff --git a/e107_handlers/mysql_class.php b/e107_handlers/mysql_class.php
index 86b7ae7f8..deeb0bdc0 100644
--- a/e107_handlers/mysql_class.php
+++ b/e107_handlers/mysql_class.php
@@ -9,8 +9,8 @@
* mySQL Handler
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/mysql_class.php,v $
- * $Revision: 1.63 $
- * $Date: 2009-11-18 01:04:43 $
+ * $Revision: 1.64 $
+ * $Date: 2009-11-20 05:01:31 $
* $Author: e107coders $
*/
@@ -49,7 +49,7 @@ $db_ConnectionID = NULL; // Stores ID for the first DB connection used - which s
*
* @package e107
* @category e107_handlers
- * @version $Revision: 1.63 $
+ * @version $Revision: 1.64 $
* @author $Author: e107coders $
*
*/
@@ -372,6 +372,10 @@ class e_db_mysql {
$this->mySQLcurTable = $table;
if(is_array($arg))
{
+ if(isset($arg['WHERE'])) // use same array for update and insert.
+ {
+ unset($arg['WHERE']);
+ }
if(isset($arg['_REPLACE']))
{
$REPLACE = TRUE;
diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php
index 052ea2b8a..e6f5d50ce 100644
--- a/e107_handlers/plugin_class.php
+++ b/e107_handlers/plugin_class.php
@@ -9,8 +9,8 @@
* Administration - Site Maintenance
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
- * $Revision: 1.116 $
- * $Date: 2009-11-18 01:04:43 $
+ * $Revision: 1.117 $
+ * $Date: 2009-11-20 05:01:31 $
* $Author: e107coders $
*
*/
@@ -46,7 +46,8 @@ class e107plugin
'e_tagwords',
'e_url',
'e_cron',
- 'e_mailout'
+ 'e_mailout',
+ 'e_sitelink'
);
// List of all plugin variables which need to be checked - install required if one or more set and non-empty
diff --git a/e107_handlers/sitelinks_class.php b/e107_handlers/sitelinks_class.php
index bc028f6cb..8e161cc42 100644
--- a/e107_handlers/sitelinks_class.php
+++ b/e107_handlers/sitelinks_class.php
@@ -9,8 +9,8 @@
*
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/sitelinks_class.php,v $
- * $Revision: 1.22 $
- * $Date: 2009-11-18 01:04:43 $
+ * $Revision: 1.23 $
+ * $Date: 2009-11-20 05:01:31 $
* $Author: e107coders $
*/
@@ -24,23 +24,43 @@ class sitelinks
var $eLinkList;
function getlinks($cat=1)
- {
-
- global $sql;
- if ($sql->db_Select('links', '*', "link_category = ".intval($cat)." and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC")){
+ {
+ $sql = e107::getDb('sqlSiteLinks');
+
+ $query = "SELECT * FROM #links WHERE link_category = ".intval($cat)." and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC";
+ if($sql->db_Select_gen($query))
+ {
while ($row = $sql->db_Fetch())
{
// if (substr($row['link_name'], 0, 8) == 'submenu.'){
// $tmp=explode('.', $row['link_name'], 3);
// $this->eLinkList[$tmp[1]][]=$row;
- if (isset($row['link_parent']) && $row['link_parent'] != 0){
+ if (isset($row['link_parent']) && $row['link_parent'] != 0)
+ {
$this->eLinkList['sub_'.$row['link_parent']][]=$row;
- }else{
+
+ }
+ else
+ {
+
$this->eLinkList['head_menu'][] = $row;
+ if(vartrue($row['link_function']))
+ {
+ list($path,$method) = explode("::",$row['link_function']);
+ if(include_once(e_PLUGIN.$path."/e_sitelink.php"))
+ {
+ $class = $path."_sitelinks";
+ $sublinkArray = e107::callMethod($class,$method); //TODO Cache it.
+ if(vartrue($sublinkArray))
+ {
+ $this->eLinkList['sub_'.$row['link_id']] = $sublinkArray;
+ }
+ }
+ }
}
}
}
-
+
}
function get($cat=1, $style='', $css_class = false)
diff --git a/e107_languages/English/admin/lan_links.php b/e107_languages/English/admin/lan_links.php
index a0adbcbba..2e02522c3 100644
--- a/e107_languages/English/admin/lan_links.php
+++ b/e107_languages/English/admin/lan_links.php
@@ -1,15 +1,15 @@
"FAQ Categories",
+ 'function' => "faqCategories",
+ 'description' => "FAQ Category links"
+ );
+
+
+ return $links;
+ }
+
+
+
+ function faqCategories()
+ {
+ $sql = e107::getDb();
+ $sublinks = array();
+
+ $sql->db_Select("faqs_info","*","faq_info_id != '' ORDER BY faq_info_order");
+
+ while($row = $sql->db_Fetch())
+ {
+ $sublinks[] = array(
+ 'link_name' => $row['faq_info_title'],
+ 'link_url' => '{e_PLUGIN}faqs/faqs.php?cat.'.$row['faq_info_id'],
+ 'link_description' => $row['faq_info_about'],
+ 'link_button' => '',
+ 'link_category' => '',
+ 'link_order' => '',
+ 'link_parent' => '',
+ 'link_open' => '',
+ 'link_class' => intval($row['faq_info_class'])
+ );
+ }
+
+ return $sublinks;
+
+ }
+
+}
+
+
+
+?>
\ No newline at end of file
diff --git a/e107_plugins/faqs/faqs.php b/e107_plugins/faqs/faqs.php
index e30764c2e..67aabf711 100644
--- a/e107_plugins/faqs/faqs.php
+++ b/e107_plugins/faqs/faqs.php
@@ -9,8 +9,8 @@
*
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/faqs/faqs.php,v $
- * $Revision: 1.3 $
- * $Date: 2009-11-18 01:05:36 $
+ * $Revision: 1.4 $
+ * $Date: 2009-11-20 05:01:51 $
* $Author: e107coders $
*/
@@ -272,6 +272,7 @@ class faq
$sql->db_Select_gen($qry);
while ($row = $sql->db_Fetch())
{
+
setScVar('faqs_shortcodes', 'row', $row);
if ($row['faq_info_parent'] == '0') //
@@ -372,10 +373,10 @@ class faq
{
global $faqpref,$timing_start,$tp,$cust_footer, $CUSTOMPAGES, $CUSTOMHEADER, $CUSTOMHEADER;
$text_menu .= "
";
diff --git a/e107_plugins/faqs/faqs_shortcodes.php b/e107_plugins/faqs/faqs_shortcodes.php
index 5c1d1d02c..d4a0b65c2 100644
--- a/e107_plugins/faqs/faqs_shortcodes.php
+++ b/e107_plugins/faqs/faqs_shortcodes.php
@@ -10,8 +10,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/faqs/faqs_shortcodes.php,v $
- | $Revision: 1.1 $
- | $Date: 2009-11-09 12:57:34 $
+ | $Revision: 1.2 $
+ | $Date: 2009-11-20 05:01:51 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@@ -65,7 +65,7 @@ class faqs_shortcodes
function sc_faq_category()
{
$tp = e107::getParser();
- return $tp->toHtml($this->row['faq_info_title']);
+ return "
".$tp->toHtml($this->row['faq_info_title'])."";
}
function sc_faq_catlink()
diff --git a/e107_plugins/page/e_sitelink.php b/e107_plugins/page/e_sitelink.php
new file mode 100644
index 000000000..a7b869960
--- /dev/null
+++ b/e107_plugins/page/e_sitelink.php
@@ -0,0 +1,72 @@
+ "All Pages",
+ 'function' => "myfunction",
+ 'description' => ""
+ );
+
+ return $links;
+ }
+
+
+
+ function myfunction()
+ {
+ $sql = e107::getDb();
+ $sublinks = array();
+
+ $sql->db_Select("page","*","page_theme = '' ORDER BY page_title");
+
+ while($row = $sql->db_Fetch())
+ {
+ $sublinks[] = array(
+ 'link_name' => $row['page_title'],
+ 'link_url' => 'page.php?'.$row['page_id'],
+ 'link_description' => '',
+ 'link_button' => '',
+ 'link_category' => '',
+ 'link_order' => '',
+ 'link_parent' => '',
+ 'link_open' => '',
+ 'link_class' => intval($row['page_class'])
+ );
+ }
+
+ return $sublinks;
+
+ }
+
+}
+
+
+
+?>
\ No newline at end of file