diff --git a/e107_admin/cpage.php b/e107_admin/cpage.php index f96acbd1e..5eeeb1375 100644 --- a/e107_admin/cpage.php +++ b/e107_admin/cpage.php @@ -9,9 +9,9 @@ * Custom Menus/Pages Administration * * $Source: /cvs_backup/e107_0.8/e107_admin/cpage.php,v $ - * $Revision: 1.10 $ - * $Date: 2008-12-29 15:23:06 $ - * $Author: secretr $ + * $Revision: 1.11 $ + * $Date: 2008-12-29 20:50:41 $ + * $Author: lisa_ $ * */ @@ -185,7 +185,7 @@ class page { /* mode: FALSE == page, mode: TRUE == menu */ - global $sql, $tp, $e107, $sub_action, $id, $frm, $e_userclass; + global $sql, $tp, $e107, $sub_action, $id, $frm, $e_userclass, $e_event; $edit = ($sub_action == 'edit'); $caption =(!$mode ? ($edit ? CUSLAN_23 : CUSLAN_24) : ($edit ? CUSLAN_25 : CUSLAN_26)); @@ -319,6 +319,37 @@ class page "; + + //triggerHook + $data = array('method'=>'form', 'table'=>'page', 'id'=>$id, 'plugin'=>'page', 'function'=>'createPage'); + $hooks = $e_event->triggerHook($data); + if(!empty($hooks)) + { + $text .= " + + + +
+ ".LAN_HOOKS." + + + + + + "; + foreach($hooks as $hook) + { + if(!empty($hook)) + { + $text .= " + + + + "; + } + } + } + } $text .= " @@ -345,7 +376,7 @@ class page // $type = FALSE for page, TRUE for menu function submitPage($mode = FALSE, $type=FALSE) { - global $sql, $tp, $e107cache, $admin_log; + global $sql, $tp, $e107cache, $admin_log, $e_event; $page_title = $tp->toDB($_POST['page_title']); $page_text = $tp->toDB($_POST['data']); @@ -359,6 +390,9 @@ class page $e107cache->clear("page_{$mode}"); $e107cache->clear("page-t_{$mode}"); + $data = array('method'=>'update', 'table'=>'page', 'id'=>$mode, 'plugin'=>'page', 'function'=>'submitPage'); + $this->message = $e_event->triggerHook($data); + if($type) { $menu_name = $tp->toDB($_POST['menu_name']); // not to be confused with menu-caption. @@ -395,11 +429,12 @@ class page $menuname = ($type ? $tp->toDB($_POST['menu_name']) : ""); admin_update($sql->db_Insert("page", "0, '{$page_title}', '{$page_text}', '{$pauthor}', '".time()."', '".intval($_POST['page_rating_flag'])."', '".intval($_POST['page_comment_flag'])."', '".$_POST['page_password']."', '".$_POST['page_class']."', '', '".$menuname."'"), 'insert', CUSLAN_27, LAN_CREATED_FAILED, false); + $pid = mysql_insert_id(); $admin_log->log_event('CPAGE_01',$menuname.'[!br!]'.$page_title.'[!br!]'.$pauthor,E_LOG_INFORMATIVE,''); if($type) { - $sql->db_Insert("menus", "0, '$menuname', '0', '0', '0', '', '".mysql_insert_id()."' "); + $sql->db_Insert("menus", "0, '$menuname', '0', '0', '0', '', '".$pid."' "); } if($_POST['page_link']) @@ -412,12 +447,15 @@ class page $e107cache->clear("sitelinks"); } } + + $data = array('method'=>'create', 'table'=>'page', 'id'=>$pid, 'plugin'=>'page', 'function'=>'submitPage'); + $this->message = $e_event->triggerHook($data); } } function delete_page($del_id) { - global $sql, $e107cache, $admin_log; + global $sql, $e107cache, $admin_log, $e_event; admin_update($sql->db_Delete("page", "page_id='{$del_id}' "), 'delete', CUSLAN_28, false, false); $sql->db_Delete("menus", "menu_path='$del_id' "); $admin_log->log_event('CPAGE_03','ID: '.$del_id,E_LOG_INFORMATIVE,''); @@ -426,6 +464,9 @@ class page $sql->db_Delete("links", "link_url='page.php?".$del_id."'"); $e107cache->clear("sitelinks"); } + + $data = array('method'=>'delete', 'table'=>'page', 'id'=>$del_id, 'plugin'=>'page', 'function'=>'delete_page'); + $this->message = $e_event->triggerHook($data); } function optionsPage() diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php index 73abd4354..5ef92956f 100644 --- a/e107_admin/newspost.php +++ b/e107_admin/newspost.php @@ -9,9 +9,9 @@ * News Administration * * $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $ - * $Revision: 1.18 $ - * $Date: 2008-12-07 13:08:41 $ - * $Author: e107steved $ + * $Revision: 1.19 $ + * $Date: 2008-12-29 20:50:41 $ + * $Author: lisa_ $ */ require_once("../class2.php"); @@ -105,6 +105,9 @@ if ($delete == "main" && $del_id) $e107cache->clear("othernews"); $e107cache->clear("othernews2"); + $data = array('method'=>'delete', 'table'=>'news', 'id'=>$del_id, 'plugin'=>'news', 'function'=>'delete'); + $message = $e_event->triggerHook($data); + admin_purge_related("news", $del_id); } } @@ -456,7 +459,7 @@ class newspost { global $cal; // ##### Display creation form - global $sql, $rs, $ns, $pref, $tp, $pst, $e107; + global $sql, $rs, $ns, $pref, $tp, $pst, $e107, $e_event; if ($sub_action == "sn" && !$_POST['preview']) { @@ -839,6 +842,24 @@ class newspost \n"; } + //triggerHook + $data = array('method'=>'form', 'table'=>'news', 'id'=>$id, 'plugin'=>'news', 'function'=>'create_item'); + $hooks = $e_event->triggerHook($data); + if(!empty($hooks)) + { + $text .= ""; + foreach($hooks as $hook) + { + if(!empty($hook)) + { + $text .= " + + + + "; + } + } + } $text .= " + "; + + //triggerHook + $hid = ($action=='ed' ? intval($qs[1]) : ''); + $data = array('method'=>'form', 'table'=>'event', 'id'=>$hid, 'plugin'=>'calendar_menu', 'function'=>'CalendarCreate'); + $hooks = $e_event->triggerHook($data); + if(!empty($hooks)) + { + $text .= ""; + foreach($hooks as $hook) + { + if(!empty($hook)) + { + $text .= " + + + + "; + } + } + } + + $text .= " diff --git a/e107_plugins/links_page/admin_linkspage_config.php b/e107_plugins/links_page/admin_linkspage_config.php index c82df0182..23e04d510 100644 --- a/e107_plugins/links_page/admin_linkspage_config.php +++ b/e107_plugins/links_page/admin_linkspage_config.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/links_page/admin_linkspage_config.php,v $ -| $Revision: 1.2 $ -| $Date: 2008-12-13 16:06:11 $ -| $Author: e107steved $ +| $Revision: 1.3 $ +| $Date: 2008-12-29 20:51:07 $ +| $Author: lisa_ $ +----------------------------------------------------------------------------+ */ @@ -131,8 +131,11 @@ if (isset($delete) && ($delete == 'main') && $del_id) } if ($sql->db_Delete("links_page", "link_id=".$del_id)) { + $msg = LCLAN_ADMIN_10." #".$del_id." ".LCLAN_ADMIN_11; + $data = array('method'=>'delete', 'table'=>'links_page', 'id'=>$del_id, 'plugin'=>'links_page', 'function'=>'delete'); + $msg .= $e_event->triggerHook($data); $admin_log->log_event('LINKS_02','ID: '.$del_id,E_LOG_INFORMATIVE,''); - $lc->show_message(LCLAN_ADMIN_10." #".$del_id." ".LCLAN_ADMIN_11); + $lc->show_message($msg); } } diff --git a/e107_plugins/links_page/e_tagwords.php b/e107_plugins/links_page/e_tagwords.php new file mode 100644 index 000000000..317ecc452 --- /dev/null +++ b/e107_plugins/links_page/e_tagwords.php @@ -0,0 +1,46 @@ +settings = array(); + + $this->settings['plugin'] = "links_page"; + $this->settings['table'] = "links_page"; + $this->settings['db_id'] = "link_id"; + $this->settings['caption'] = "links page"; + } + + function getLink($id) + { + global $tp; + if($this->row=='') + { + $this->row = $this->getRecord($id); + } + $url = e_PLUGIN."links_page/links.php?view.{$this->row['link_id']}"; + return "".$tp->toHTML($this->row['link_name'], TRUE, '').""; + } + + function getRecord($id) + { + global $sql; + + $this->row = ''; + + $qry = "SELECT l.* + FROM #links_page as l + WHERE l.link_id='{$id}' AND l.link_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/links_page/link_class.php b/e107_plugins/links_page/link_class.php index a9677f28e..f3e47289c 100644 --- a/e107_plugins/links_page/link_class.php +++ b/e107_plugins/links_page/link_class.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/links_page/link_class.php,v $ -| $Revision: 1.10 $ -| $Date: 2008-12-13 16:06:11 $ -| $Author: e107steved $ +| $Revision: 1.11 $ +| $Date: 2008-12-29 20:51:07 $ +| $Author: lisa_ $ +----------------------------------------------------------------------------+ */ @@ -606,9 +606,12 @@ class linkclass $edata_ls['link_datestamp'] = $time; $sql->db_UpdateArray("links_page", $edata_ls, " WHERE link_id='".intval($qs[2])."'"); - $admin_log->logArrayAll('LINKS_14',$edata_ls); + $msg = LCLAN_ADMIN_3; + $data = array('method'=>'update', 'table'=>'links_page', 'id'=>$qs[2], 'plugin'=>'links_page', 'function'=>'dbLinkCreate'); + $msg .= $e_event->triggerHook($data); + $admin_log->logArrayAll('LINKS_14',$edata_ls); $e107cache->clear("sitelinks"); - $this->show_message(LCLAN_ADMIN_3); + $this->show_message($msg); //create link } else @@ -616,9 +619,13 @@ class linkclass $edata_ls['link_datestamp'] = time(); $edata_ls['link_order'] = $link_t+1; $sql->db_Insert("links_page", $edata_ls); + $msg = LCLAN_ADMIN_2; + $id = mysql_insert_id(); + $data = array('method'=>'create', 'table'=>'links_page', 'id'=>$id, 'plugin'=>'links_page', 'function'=>'dbLinkCreate'); + $msg .= $e_event->triggerHook($data); $admin_log->logArrayAll('LINKS_13',$edata_ls); $e107cache->clear("sitelinks"); - $this->show_message(LCLAN_ADMIN_2); + $this->show_message($msg); } //delete from tmp table after approval if (is_numeric($qs[2]) && $qs[1] == "sn") @@ -630,7 +637,7 @@ class linkclass function show_link_create() { - global $sql, $rs, $qs, $ns, $fl, $linkspage_pref; + global $sql, $rs, $qs, $ns, $fl, $linkspage_pref, $e_event; $row['link_category'] = ""; $row['link_name'] = ""; @@ -780,7 +787,28 @@ class linkclass - + "; + + //triggerHook + $data = array('method'=>'form', 'table'=>'links_page', 'id'=>$row['link_id'], 'plugin'=>'links_page', 'function'=>'show_link_create'); + $hooks = $e_event->triggerHook($data); + if(!empty($hooks)) + { + $text .= ""; + foreach($hooks as $hook) + { + if(!empty($hook)) + { + $text .= " + + + + "; + } + } + } + + $text .= " + Tagwords is installed
To configure please click on the link in the plugins section of the admin front page
+ + + \ No newline at end of file diff --git a/e107_plugins/tagwords/section/e_tagwords_download.php b/e107_plugins/tagwords/section/e_tagwords_download.php new file mode 100644 index 000000000..c4e66b188 --- /dev/null +++ b/e107_plugins/tagwords/section/e_tagwords_download.php @@ -0,0 +1,46 @@ +settings = array(); + + $this->settings['plugin'] = ""; + $this->settings['table'] = "download"; + $this->settings['db_id'] = "download_id"; + $this->settings['caption'] = "download"; + } + + function getLink($id) + { + global $tp; + if($this->row=='') + { + $this->row = $this->getRecord($id); + } + $url = e_BASE."download.php?view.".$this->row['download_id']; + return "".$tp->toHTML($this->row['download_name'], TRUE, '').""; + } + + function getRecord($id) + { + global $sql; + + $this->row = ''; + + $qry = "SELECT d.* + FROM #download as d + WHERE d.download_id='{$id}' AND d.download_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/tagwords/section/e_tagwords_news.php b/e107_plugins/tagwords/section/e_tagwords_news.php new file mode 100644 index 000000000..dafb62a17 --- /dev/null +++ b/e107_plugins/tagwords/section/e_tagwords_news.php @@ -0,0 +1,48 @@ +settings = array(); + + $this->settings['plugin'] = ""; + $this->settings['table'] = "news"; + $this->settings['db_id'] = "news_id"; + $this->settings['caption'] = "news"; + } + + function getLink($id) + { + global $tp; + if(empty($this->row)) + { + $this->row = $this->getRecord($id); + } + $url = e_BASE."news.php?item.".$this->row['news_id']; + return "".$tp->toHTML($this->row['news_title'], TRUE, '').""; + } + + function getRecord($id) + { + global $sql; + + $this->row = ''; + $qry = "SELECT n.* + FROM #news as n + WHERE n.news_id='{$id}' + AND n.news_start < ".time()." + AND (n.news_end=0 || n.news_end>".time().") + AND n.news_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/tagwords/section/e_tagwords_page.php b/e107_plugins/tagwords/section/e_tagwords_page.php new file mode 100644 index 000000000..3b27a68cb --- /dev/null +++ b/e107_plugins/tagwords/section/e_tagwords_page.php @@ -0,0 +1,46 @@ +settings = array(); + + $this->settings['plugin'] = ""; + $this->settings['table'] = "page"; + $this->settings['db_id'] = "page_id"; + $this->settings['caption'] = "page"; + } + + function getLink($id) + { + global $tp; + if($this->row=='') + { + $this->row = $this->getRecord($id); + } + $url = e_BASE."page.php?".$this->row['page_id']; + return "".$tp->toHTML($this->row['page_title'], TRUE, '').""; + } + + function getRecord($id) + { + global $sql; + + $this->row = ''; + + $qry = "SELECT p.*, u.user_id, u.user_name FROM #page AS p + LEFT JOIN #user AS u ON p.page_author = u.user_id + WHERE p.page_id='{$id}' AND p.page_class IN (".USERCLASS_LIST.") "; + + 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/tagwords/tagwords.php b/e107_plugins/tagwords/tagwords.php new file mode 100644 index 000000000..e3429b40f --- /dev/null +++ b/e107_plugins/tagwords/tagwords.php @@ -0,0 +1,44 @@ +pref['tagwords_class']) && !check_class($tag->pref['tagwords_class']) ) +{ + header("location:".e_BASE); exit; +} + +if(varsettrue($_GET['q'])) +{ + $tag->TagSearchResults(); +} +else +{ + $tag->TagRender(); +} + +require_once(FOOTERF); + +?> \ No newline at end of file diff --git a/e107_plugins/tagwords/tagwords_class.php b/e107_plugins/tagwords/tagwords_class.php new file mode 100644 index 000000000..2efc007b4 --- /dev/null +++ b/e107_plugins/tagwords/tagwords_class.php @@ -0,0 +1,895 @@ +tp = $tp; + + //language + include_lan(e_PLUGIN."tagwords/languages/".e_LANGUAGE.".php"); + + //shortcodes + require_once(e_PLUGIN.'tagwords/tagwords_shortcodes.php'); + $this->shortcodes = $tagwords_shortcodes; + + //template + if (is_readable(THEME."tagwords_template.php")) + { + require_once(THEME."tagwords_template.php"); + } + else + { + require_once(e_PLUGIN."tagwords/tagwords_template.php"); + } + $this->template = $TEMPLATE_TAGWORDS; + + $this->pref = $this->get_prefs(); + + //load plugin and core tagword areas + $this->loadPlugin(); + $this->loadCore(); + + //prepare and assign key'ed tagwords data + $this->mapper(); + } + + /* + * get all plugin classes + */ + function loadPlugin() + { + global $pref; + if(is_array($pref['e_tagwords_list'])) + { + foreach($pref['e_tagwords_list'] as $e_tag) + { + if(is_readable(e_PLUGIN.$e_tag."/e_tagwords.php")) + { + require_once(e_PLUGIN.$e_tag."/e_tagwords.php"); + $name = "e_tagwords_{$e_tag}"; + if(class_exists($name)) + { + if(!is_object($name)) + { + $this->$name = new $name; + } + $this->tagwords[] = $e_tag; + } + } + } + } + } + + /* + * get all core classes + */ + function loadCore() + { + foreach($this->core as $s) + { + require_once(e_PLUGIN."tagwords/section/e_tagwords_{$s}.php"); + $name = "e_tagwords_{$s}"; + if(class_exists($name)) + { + if(!is_object($name)) + { + $this->$name = new $name; + } + $this->tagwords[] = $s; + } + } + } + + /* + * map plugin names to tables names + */ + function mapper() + { + $ret = array(); + foreach($this->tagwords as $area) + { + $ins = "e_tagwords_{$area}"; + $table = $this->$ins->settings['table']; + $ret[$table] = $area; + } + $this->mapper = $ret; + } + + /* + * display the form element to provide tag words + * @param string $tag_type type + * @param string $tag_itemid itemid + * @return array $caption, $text form element + */ + function tagwords_form($tag_type='', $tag_itemid='') + { + $allowed = $this->getAllowedAreas(); + if(count($allowed)==0) + { + return; + } + else + { + if(!in_array($tag_type, $allowed)) + { + return; + } + } + + $this->word = false; + if( $ret = $this->getRecords($tag_type, $tag_itemid) ) + { + $this->word = $this->tp->toForm($ret); + } + $caption = $this->tp->parseTemplate($this->template['caption'], FALSE, $this->shortcodes); + $text = $this->tp->parseTemplate($this->template['form'], FALSE, $this->shortcodes); + return array('caption'=>$caption, 'text'=>$text); + } + + /* + * retrieve all tag_words for the provided item (type+itemid) + * @param string $tag_type type + * @param string $tag_itemid itemid + * @param boolean $returnwordsonly return comma seperated list of tagwords + * @param boolean $link return hyperlink to taglist on words + * @return array $ret array of tagwords + */ + function getRecords($tag_type='', $tag_itemid='', $returnwordsonly=FALSE, $link=TRUE) + { + $sqlgr = new db; + + $qry = " + SELECT tag_word FROM #".$this->table." + WHERE tag_type='".$this->tp->toDB($tag_type)."' + AND tag_itemid='".intval($tag_itemid)."' + ORDER BY tag_word "; + + if($sqlgr->db_Select_gen($qry)) + { + $ret=array(); + while($row=$sqlgr->db_Fetch()) + { + $ret[] = $row['tag_word']; + } + if($returnwordsonly) + { + $arr = array(); + foreach($ret as $word) + { + $word = $this->tp->toHTML($word,TRUE,'no_hook, emotes_off'); + $arr[] = ($link ? trim($this->createTagWordLink($word)) : $word); + } + return implode($this->pref['tagwords_word_seperator'], $arr); + } + //return a \n seperated list of tagwords for the specific item + return implode("\n", $ret); + } + return; + } + + /* + * used on tagword search; get only those records that contain ALL tagwords that is searched on + * @param array $array the array containing all results for each word seperately + * @return array $combined array of combined tagwords + */ + function getUnique($array) + { + //combine all arrays + $combined = array(); + foreach($array as $v) + { + foreach($v as $type=>$arr) + { + foreach($arr as $id) + { + if(!array_key_exists($type,$combined)) + { + $combined[$type] = array(); + } + if(!in_array($id, $combined[$type])) + { + $combined[$type][] = $id; + } + } + } + } + //$combined is combined array of ALL values + foreach($combined as $ntype=>$narr) + { + foreach($narr as $nid) + { + //$array is the array containing all results for each word seperately + foreach($array as $ov) + { + //if an id value is not present in the result $array, remove it from the combined array + if(!in_array($nid, $ov[$ntype])) + { + $key = array_search($nid, $combined[$ntype]); + unset($combined[$ntype][$key]); + } + } + } + } + //finally remove empty areas from the array + foreach($combined as $ntype=>$narr) + { + sort($combined[$ntype]); + if(empty($combined[$ntype])) + { + unset($combined[$ntype]); + } + + } + return $combined; + } + + /* + * create the tag word hyperlink + * @param string $word word + * @param string $class if present and int, adds the 'level' of the word to the css item + * @return string $text hyperlink to tagword + */ + function createTagWordLink($word, $class='') + { + $word = trim($word); + $qry = $this->tp->toDB($word); + $qry = str_replace(' ', '+', $qry); + $word = $this->tp->toHTML($word,TRUE,'no_hook, emotes_off'); + $class = ($class ? "class='tag".intval($class)."'" : ""); + return "".$word." "; + } + + /* + * db entry tagwords + * @param string $tag_type type + * @param string $tag_itemid itemid + * @param string $tag_word word + * @return string $text message + */ + function dbTagWords($tag_type='', $tag_itemid='', $tag_word='') + { + global $sql; + + //prepare data + $tag_type = $this->tp->toDB($tag_type); + $tag_itemid = intval($tag_itemid); + + //get existing word records + $existing_array = $this->getRecords($tag_type, $tag_itemid, FALSE); + $existing = explode("\n", $existing_array); + + //create array of new posted words + $new = explode("\n", $tag_word); + + //delete the differences (delete what has been removed) + $delete_diff = array_diff($existing, $new); + foreach($delete_diff as $word) + { + $word = trim($word); + $word = $this->tp->toDB($word); + $sql->db_Delete($this->table, "tag_type='".$tag_type."' AND tag_itemid='".$tag_itemid."' AND tag_word='".$word."'"); + } + + //insert the differences (insert what has been added) + $insert_diff = array_diff($new, $existing); + foreach($insert_diff as $word) + { + $word = trim($word); + $word = $this->tp->toDB($word); + $sql->db_Insert($this->table, "'0', '".$tag_type."', '".$tag_itemid."', '".$word."' "); + } + return "
".LAN_TAG_3; + } + + /* + * db delete entries + * @param string $tag_type type + * @param string $tag_itemid itemid + */ + function dbDelete($tag_type='', $tag_itemid='') + { + global $sql; + $sql->db_Delete($this->table, "tag_type='".$tag_type."' AND tag_itemid='".$tag_itemid."' "); + } + + /* + * retrieve all tag words (if $_GET['area'], only retrieve tagwords from that area (news, content, ...) ) + * @param string $tagarea tagarea + * @return array $ret array of word=>number + */ + function getAllTagWords($tagarea='') + { + global $sql; + + $tag_type=''; + + $allowed = $this->getAllowedAreas(); + if(count($allowed)>0) + { + $typeqry = " AND tag_type IN ('".implode("','", $this->getAllowedAreas())."') "; + } + + if($tagarea!='menu') + { + //if user is able to manually set a area + if(varsettrue($this->pref['tagwords_view_area'])=='1') + { + foreach($this->tagwords as $area) + { + //limit data to only one area, if so, which area + if(varsettrue($_GET['area'])==$area) + { + $ins = "e_tagwords_{$area}"; + $typeqry = " AND tag_type='".$this->$ins->settings['table']."'"; + break; + } + } + } + } + + //menu additions + $menuqry=''; + if($tagarea=='menu') + { + if($this->pref['tagwords_menu_min']) + { + $menuqry = "ORDER BY number DESC LIMIT 0,".$this->pref['tagwords_menu_min']; + } + } + + $qry = " + SELECT tag_id, tag_itemid, tag_type, tag_word, COUNT(tag_word) as number + FROM #".$this->table." + WHERE tag_word!='' ".$typeqry." + GROUP BY tag_word HAVING COUNT(tag_word)>=".intval($this->pref['tagwords_min'])." ".$menuqry." "; + + if($sql->db_Select_gen($qry)) + { + $ret=array(); + while($row=$sql->db_Fetch()) + { + $word = trim($row['tag_word']); + $word = $this->tp->toHTML($word,TRUE,'no_hook, emotes_off'); + $ret[$word] = $row['number']; + } + return $ret; + } + return; + } + + /* + * Get allowed areas from pref + * @return $array allowed areas + */ + function getAllowedAreas() + { + $this->allowed_areas = array(); + foreach($this->tagwords as $area) + { + if(array_key_exists($area,$this->pref['tagwords_activeareas'])) + { + $ins = "e_tagwords_{$area}"; + $this->allowed_areas[] = $this->$ins->settings['table']; + } + } + return $this->allowed_areas; + } + + /* + * Sort data array of tag words + * @param string $array the array of words + * @param string $tagarea the area (menu,page) + * @return $array sorted array + */ + function TagSort($array, $tagarea='') + { + //MENU + if($tagarea=='menu') + { + if(varsettrue($this->pref['tagwords_menu_default_sort'])==1) + { + //alphabetically + ksort($array, SORT_STRING); + } + else + { + //by size + arsort($array); + } + return $array; + } + + //PAGE + //user can set own sort + if(varsettrue($this->pref['tagwords_view_sort'])==1) + { + $s = varset($_GET['sort'],''); + switch($s) + { + //if user has set sort, and is set to alpha + case 'alpha': + ksort($array, SORT_STRING); + break; + //if user has set sort, and is set to by size + case 'freq': + arsort($array); + break; + default: + if(varsettrue($this->pref['tagwords_default_sort'])==1) + { + //alphabetically + ksort($array, SORT_STRING); + } + else + { + //by size + arsort($array); + } + break; + } + + //user cannot set sort, so use default sort value + } + else + { + if(varsettrue($this->pref['tagwords_default_sort'])==1) + { + //alphabetically + ksort($array, SORT_STRING); + } + else + { + //by size + arsort($array); + } + } + return $array; + } + + /* + * Render Message + * @param string $message message + * @param string $caption caption + * @return string $text (ns,echo,return) + */ + function show_message($message, $caption='', $type='ns') + { + switch($type) + { + case 'echo': + echo "
".$message."
"; + break; + case 'return': + return "
".$message."
"; + break; + case 'ns': + default: + global $ns; + $ns->tablerender($caption, "
".$message."
"); + break; + } + } + + //##### show tagcloud/taglist ------------------------------------------------- + /* + * Show tagcloud/taglist + * @return tablerender tagcloud/taglist + */ + function TagRender() + { + global $ns; + + $type = FALSE; + + //decide whether to show the taglist or the tagcloud + + //user can set own tag style + if(varsettrue($this->pref['tagwords_view_style'])=='1') + { + $t = varset($_GET['type'],''); + switch($t) + { + case 'cloud': + $type='cloud'; + break; + case 'list': + $type='list'; + break; + default: + $type = (varsettrue($this->pref['tagwords_default_style'])=='1' ? 'cloud' : 'list'); + break; + } + } + else + { + //user cannot set tag style, so use default tag style value + $type = (varsettrue($this->pref['tagwords_default_style'])=='1' ? 'cloud' : 'list'); + } + + //show the taglist or tagcloud + if($type=='list') + { + $text = $this->tp->parseTemplate($this->template['cloudlist'], FALSE, $this->shortcodes); + $ns->tablerender(LAN_TAG_17, $text); + } + else + { + $text = $this->tp->parseTemplate($this->template['cloud'], FALSE, $this->shortcodes); + $ns->tablerender(LAN_TAG_16, $text); + } + return; + } + + /* + * retrieve all records based on tag word + * @param string $word word + * @param string $caption caption + * @return array $type=>$id + */ + function getRecordsByTag($word='') + { + global $sql; + $typeqry = ''; + $allowed = $this->getAllowedAreas(); + if(count($allowed)>0) + { + $typeqry = " AND tag_type IN ('".implode("','", $allowed)."') "; + } + if($sql->db_Select_gen("SELECT tag_type, tag_itemid FROM #".$this->table." WHERE tag_word REGEXP('".$this->tp->toDB($word)."') ".$typeqry." ")) + { + $ret = array(); + while($row=$sql->db_Fetch()) + { + $ret[$row['tag_type']][] = $row['tag_itemid']; + } + return $ret; + } + return; + } + + /* + * show list of related content based on the word (=$_GET['q']) + * @param string tablerender + */ + function TagSearchResults() + { + global $sql, $ns, $row; + + //the full search query + every single word in the query will be used to search + $_GET['q'] = str_replace('+', ' ', $_GET['q']); + + $words=array(); + + //add each seperate word to search + $words = explode(" ", trim($_GET['q'])); + if(count($words)>1) + { + //add full query to search + array_unshift($words, $_GET['q']); + } + + $results=array(); + foreach($words as $w) + { + if($w!='') + { + if($t = $this->getRecordsByTag($w)) + { + $results[] = $t; + } + } + } + + //only combine the array if searching on multiple words + //else the array is always the [0] key + if(count($words)==1) + { + $records = $results[0]; + ksort($records, SORT_STRING); + } + elseif(count($words) > 1) + { + $records = $this->getUnique($results); + ksort($records, SORT_STRING); + } + + $this->num = count($records, 1) - count($records); + + $text = $this->tp->parseTemplate($this->template['intro'], FALSE, $this->shortcodes); + + foreach($records as $type=>$ids) + { + if(array_key_exists($type, $this->mapper)) + { + $pluginName = $this->mapper[$type]; + $ins = "e_tagwords_{$pluginName}"; + $this->area = $this->$ins; + + //area (news, content, ...) + $text .= $this->tp->parseTemplate($this->template['area'], FALSE, $this->shortcodes); + + //records for found related tagword + $text .= $this->template['link_start']; + foreach($ids as $id) + { + $this->id = $id; + if(method_exists($this->area, 'getRecord')) + { + $this->area->getRecord($this->id); + $text .= $this->tp->parseTemplate($this->template['link_item'], FALSE, $this->shortcodes); + } + } + $text .= $this->template['link_end']; + } + } + $ns->tablerender(LAN_TAG_1, $text); + + return; + } + + /* + * create a tag cloud + * @return string $text + */ + function TagCloud($mode='') + { + global $sql; + + if($mode=='menu') + { + $t_start = $this->template['menu_cloud_start']; + $t_item = $this->template['menu_cloud_item']; + $t_end = $this->template['menu_cloud_end']; + } + else + { + $t_start = $this->template['cloud_start']; + $t_item = $this->template['cloud_item']; + $t_end = $this->template['cloud_end']; + } + + $tags = $this->getAllTagWords($mode); + $tags = $this->TagSort($tags, $mode); + + if(!is_array($tags)) + { + return $this->show_message(LAN_TAG_18, '', 'return'); + } + + // tags will be displayed between class 1 to class 5 + $min_size = 1; + $max_size = 5; + + // get the largest and smallest array values + $min_qty = min(array_values($tags)); + $max_qty = max(array_values($tags)); + + // find the range of values + $spread = $max_qty - $min_qty; + // we don't want to divide by zero + if(0 == $spread) + { + $spread = 1; + } + + // determine the increment, this is the increase per tag quantity (times used) + $step = ($max_size - $min_size)/($spread); + + $text = $t_start; + // loop through our tag array + foreach ($tags as $key => $value) + { + $class = ceil($min_size + (($value - $min_qty) * $step)); + $this->word = $this->createTagWordLink($key, $class); + $this->number = $value; + $text .= $this->tp->parseTemplate($t_item, FALSE, $this->shortcodes); + } + $text .= $t_end; + return $text; + } + + /* + * create a tag list + * @return string $text tagcloudlist + */ + function TagCloudList() + { + global $sql; + + $tags = $this->getAllTagWords(); + $tags = $this->TagSort($tags); + if(!is_array($tags)) + { + return $this->show_message(LAN_TAG_18, '', 'return'); + } + + $text = $this->template['cloudlist_start']; + foreach ($tags as $key => $value) + { + $this->word = $this->createTagWordLink($key); + $this->number = $value; + $text .= $this->tp->parseTemplate($this->template['cloudlist_item'], FALSE, $this->shortcodes); + } + $text .= $this->template['cloudlist_end']; + return $text; + } + +//##### ADMIN + + /* + * default preferences + */ + function default_prefs() + { + $ret=array(); + $ret['tagwords_min'] = 1; + $ret['tagwords_class'] = 0; + $ret['tagwords_default_sort'] = 1; + $ret['tagwords_default_style'] = 1; + $ret['tagwords_view_sort'] = 1; + $ret['tagwords_view_style'] = 1; + $ret['tagwords_view_area'] = 1; + $ret['tagwords_view_search'] = 1; + $ret['tagwords_view_freq'] = 1; + $ret['tagwords_word_seperator'] = ' / '; + + $ret['tagwords_menu_caption'] = 'LAN_TAG_MENU_2'; + $ret['tagwords_menu_min'] = 5; + $ret['tagwords_menu_default_sort'] = 1; + $ret['tagwords_menu_view_search'] = 1; + $ret['tagwords_menu_view_freq'] = 0; + + //activate core areas by default + $ret['tagwords_activeareas'] = array(); + foreach($this->core as $area) + { + $ret['tagwords_activeareas'][$area] = 1; + } + + return $ret; + } + + /* + * get preferences from db + */ + function get_prefs() + { + global $sql, $eArrayStorage; + + $num_rows = $sql->db_Select_gen("SELECT * FROM #core WHERE e107_name='".$this->table."' "); + if($num_rows == 0) + { + $p = $this->default_prefs(); + $tmp = $eArrayStorage->WriteArray($p); + $sql->db_Insert("core", "'".$this->table."', '{$tmp}' "); + $sql->db_Select_gen("SELECT * FROM #core WHERE e107_name='".$this->table."' "); + } + $row = $sql->db_Fetch(); + $p = $eArrayStorage->ReadArray($row['e107_value']); + + //validation + if(!array_key_exists('tagwords_activeareas', $p)) + { + $p['tagwords_activeareas'] = array(); + } + + return $p; + } + + /* + * Update preferences + */ + function update_prefs() + { + global $sql, $eArrayStorage; + + $num_rows = $sql->db_Select_gen("SELECT * FROM #core WHERE e107_name='".$this->table."' "); + if ($num_rows == 0) + { + $p = $this->default_prefs(); + $tmp = $eArrayStorage->WriteArray($p); + $sql->db_Insert("core", "'".$this->table."', '{$tmp}' "); + } + else + { + $row = $sql->db_Fetch(); + + //assign new preferences + foreach($_POST as $k => $v) + { + if(preg_match("#^tagwords_#",$k)) + { + $tagwords_pref[$k] = $this->tp->toDB($v); + } + } + $this->pref = $tagwords_pref; + + //create new array of preferences + $tmp = $eArrayStorage->WriteArray($tagwords_pref); + + $sql->db_Update("core", "e107_value = '{$tmp}' WHERE e107_name = '".$this->table."' "); + } + return; + } + + /* + * Validate tagword db, removes all non-existing records + * in case a db entry has been deleted but the tagwords were not + */ + function validate() + { + global $sql, $sql2; + + if($sql->db_Select_gen("SELECT * FROM #".$this->table." GROUP BY tag_type, tag_itemid ORDER BY tag_id")) + { + while($row=$sql->db_Fetch()) + { + if(array_key_exists($row['tag_type'], $this->mapper)) + { + $name = "e_tagwords_{$this->mapper[$row['tag_type']]}"; + if(!$sql2->db_Select_gen("SELECT * FROM #".$row['tag_type']." WHERE ".$this->$name->settings['db_id']." = '".$row['tag_itemid']."' ")) + { + $sql2->db_Delete($this->table, "tag_type='".$row['tag_type']."' AND tag_itemid='".$row['tag_itemid']."' "); + } + } + } + } + } + + /* + * Options + * @return string tablerender + */ + function tagwords_options() + { + global $ns; + + $this->validate(); + + $text = $this->tp->parseTemplate($this->template['admin_options'], FALSE, $this->shortcodes); + $ns->tablerender(LAN_TAG_OPT_1, $text); + } + +} //end class + +?> \ No newline at end of file diff --git a/e107_plugins/tagwords/tagwords_css.php b/e107_plugins/tagwords/tagwords_css.php new file mode 100644 index 000000000..2765b3398 --- /dev/null +++ b/e107_plugins/tagwords/tagwords_css.php @@ -0,0 +1,58 @@ + + +.tag1, a.tag1:link, a.tag1:active, a.tag1:visited, a.tag1:hover { + font-size: 100%; + color:#C79810; + text-decoration:none; +} +a.tag1:hover { + text-decoration:underline; +} + +.tag2, a.tag2:link, a.tag2:active, a.tag2:visited, a.tag2:hover { + font-size: 137%; + color:#D15600; + text-decoration:none; +} +a.tag2:hover { + text-decoration:underline; +} + +.tag3, a.tag3:link, a.tag3:active, a.tag3:visited, a.tag3:hover { + font-size: 175%; + color:#6BBA70; + text-decoration:none; +} +a.tag3:hover { + text-decoration:underline; +} + +.tag4, a.tag4:link, a.tag4:active, a.tag4:visited, a.tag4:hover { + font-size: 212%; + color:#73880A; + text-decoration:none; +} +a.tag1:hover { + text-decoration:underline; +} + +.tag5, a.tag5:link, a.tag5:active, a.tag5:visited, a.tag5:hover { + font-size: 250%; + color:#356AA0; + text-decoration:none; +} +a.tag5:hover { + text-decoration:underline; +} diff --git a/e107_plugins/tagwords/tagwords_menu.php b/e107_plugins/tagwords/tagwords_menu.php new file mode 100644 index 000000000..352c8ddec --- /dev/null +++ b/e107_plugins/tagwords/tagwords_menu.php @@ -0,0 +1,34 @@ +pref['tagwords_class']) && !check_class($tag->pref['tagwords_class']) ) +{ + return; +} + +$text = $tp->parseTemplate($tag->template['menu_cloud'], FALSE, $tag->shortcodes); +$caption = ($tag->pref['tagwords_menu_caption'] ? $tag->pref['tagwords_menu_caption'] : LAN_TAG_16); +$ns->tablerender($caption, $text); + +?> \ No newline at end of file diff --git a/e107_plugins/tagwords/tagwords_shortcodes.php b/e107_plugins/tagwords/tagwords_shortcodes.php new file mode 100644 index 000000000..31f568cfa --- /dev/null +++ b/e107_plugins/tagwords/tagwords_shortcodes.php @@ -0,0 +1,348 @@ +e_sc->parse_scbatch(__FILE__); +/* + +SC_BEGIN TAG_SEARCH + global $tp, $tag; + + $value = (isset($_GET['q']) ? $tp->toForm($_GET['q']) : ''); + switch($sc_mode) + { + case 'menu': + if(varsettrue($tag->pref['tagwords_menu_view_search'])!=1) + { + return; + } + $id = 'tagwords_searchform_menu'; + + return " +
+ + + "; + break; + + case 'search': + if(varsettrue($tag->pref['tagwords_view_search'])!=1) + { + return; + } + $id = 'tagwords_searchform'; + return " +
+ + + "; + break; + + default: + if(varsettrue($tag->pref['tagwords_view_search'])!=1) + { + return; + } + return " + + "; + break; + } + +SC_END + +SC_BEGIN TAG_AREA_HEADING + global $tag; + return varsettrue($tag->area->settings['caption']); +SC_END + +SC_BEGIN TAG_LINK + global $tag; + switch($sc_mode) + { + case 'menu': + return "".LAN_TAG_MENU_1.""; + break; + case 'home': + return "".LAN_TAG_7.""; + break; + default: + if(method_exists($tag->area, 'getLink')) + { + return $tag->area->getLink($tag->id); + } + break; + } +SC_END + +SC_BEGIN TAG_CLOUD + global $tag; + switch($sc_mode) + { + case 'menu': + return $tag->TagCloud('menu'); + break; + case 'list': + return $tag->TagCloudList(); + break; + default: + return $tag->TagCloud(); + break; + } +SC_END + +SC_BEGIN TAG_WORD + global $tag, $tp; + switch($sc_mode) + { + case 'result': + return "".$tag->num." ".($tag->num==1 ? LAN_TAG_8 : LAN_TAG_9)." '".$tp->toHTML($_GET['q'],TRUE)."'"; + break; + case 'form': + default: + return $tag->word; + break; + } +SC_END + +SC_BEGIN TAG_NUMBER + global $tag; + switch($sc_mode) + { + case 'list': + return $tag->number; + break; + case 'menu': + if(varsettrue($tag->pref['tagwords_menu_view_freq'])==1) + { + return $tag->number; + } + break; + default: + if(varsettrue($tag->pref['tagwords_view_freq'])==1) + { + return $tag->number; + } + break; + } +SC_END + +SC_BEGIN TAG_SORT + global $tag; + + $sort=FALSE; + if(varsettrue($tag->pref['tagwords_view_sort'])==1) + { + $s = varset($_GET['sort'],''); + switch($s) + { + case 'alpha': + $sel = 'alpha'; + break; + case 'freq': + $sel = 'freq'; + break; + default: + $sel = ''; + break; + } + + $text = " + "; + return $text; + } + return; +SC_END + +SC_BEGIN TAG_TYPE + global $tag; + + $type=FALSE; + if(varsettrue($tag->pref['tagwords_view_style'])==1) + { + $t = varset($_GET['type'],''); + switch($t) + { + case 'cloud': + $sel = 'cloud'; + break; + case 'list': + $sel = 'list'; + break; + default: + $sel = ''; + break; + } + + $text = " + "; + return $text; + } + return; +SC_END + +SC_BEGIN TAG_AREA + global $tag; + if(varsettrue($tag->pref['tagwords_view_area'])==1) + { + $text = " + "; + return $text; + } + return; +SC_END + +SC_BEGIN TAG_BUTTON + return ""; +SC_END + +SC_BEGIN TAG_OPTIONS + global $tp, $tag; + if( varsettrue($tag->pref['tagwords_view_search'])==1 || varsettrue($tag->pref['tagwords_view_sort'])==1 || varsettrue($tag->pref['tagwords_view_style'])==1 || varsettrue($tag->pref['tagwords_view_area'])==1 ) + { + return $tp->parseTemplate($tag->template['options'], FALSE, $tag->shortcodes); + } +SC_END + +//##### ADMIN OPTIONS ------------------------- + +SC_BEGIN TAG_OPT_MIN + global $tag; + $id = ($sc_mode=='menu' ? 'tagwords_menu_min' : 'tagwords_min'); + return ""; +SC_END + +SC_BEGIN TAG_OPT_CLASS + global $tag; + $id = 'tagwords_class'; + return r_userclass($id,$tag->pref[$id],"","admin,public,guest,nobody,member,classes"); +SC_END + +SC_BEGIN TAG_OPT_DEFAULT_SORT + global $tag; + $id = ($sc_mode=='menu' ? 'tagwords_menu_default_sort' : 'tagwords_default_sort'); + return "   + "; +SC_END + +SC_BEGIN TAG_OPT_DEFAULT_STYLE + global $tag; + $id = 'tagwords_default_style'; + return "   + "; +SC_END + +SC_BEGIN TAG_OPT_VIEW_SORT + global $tag; + $id = 'tagwords_view_sort'; + $sel = ($tag->pref[$id] ? "checked='checked'" : ""); + return " + "; +SC_END + +SC_BEGIN TAG_OPT_VIEW_STYLE + global $tag; + $id = 'tagwords_view_style'; + $sel = ($tag->pref[$id] ? "checked='checked'" : ""); + return " + "; +SC_END + +SC_BEGIN TAG_OPT_VIEW_AREA + global $tag; + $id = 'tagwords_view_area'; + $sel = ($tag->pref[$id] ? "checked='checked'" : ""); + return " + "; +SC_END + +SC_BEGIN TAG_OPT_VIEW_SEARCH + global $tag; + $id = ($sc_mode=='menu' ? 'tagwords_menu_view_search' : 'tagwords_view_search'); + $sel = ($tag->pref[$id] ? "checked='checked'" : ""); + return " + "; +SC_END + +SC_BEGIN TAG_OPT_VIEW_FREQ + global $tag; + if($sc_mode=='menu') + { + $id = 'tagwords_menu_view_freq'; + } + else + { + $id = 'tagwords_view_freq'; + } + $sel = ($tag->pref[$id] ? "checked='checked'" : ""); + return " + "; +SC_END + +SC_BEGIN TAG_OPT_CAPTION + global $tp, $tag; + $id = 'tagwords_menu_caption'; + return ""; +SC_END + +SC_BEGIN TAG_OPT_SEPERATOR + global $tp, $tag; + $id = 'tagwords_word_seperator'; + return ""; +SC_END + +SC_BEGIN TAG_OPT_ACTIVEAREAS + global $tag; + $id = 'tagwords_activeareas'; + $text = ""; + foreach($tag->tagwords as $area) + { + $sel = (array_key_exists($area,$tag->pref[$id]) ? "checked='checked'" : ''); + $name = "e_tagwords_{$area}"; + + $text .= " +
"; + + } + return $text; +SC_END + +SC_BEGIN TAG_OPT_BUTTON + return ""; +SC_END + +*/ + +?> \ No newline at end of file diff --git a/e107_plugins/tagwords/tagwords_sql.php b/e107_plugins/tagwords/tagwords_sql.php new file mode 100644 index 000000000..05ac6c63d --- /dev/null +++ b/e107_plugins/tagwords/tagwords_sql.php @@ -0,0 +1,8 @@ +CREATE TABLE tagwords ( + `tag_id` int(10) unsigned NOT NULL auto_increment, + `tag_type` varchar(100) NOT NULL default '', + `tag_itemid` int(10) unsigned NOT NULL default '0', + `tag_word` varchar(255) NOT NULL default '', + PRIMARY KEY (`tag_id`), + KEY `tag_word` (`tag_word`) +) TYPE=MyISAM AUTO_INCREMENT=1; \ No newline at end of file diff --git a/e107_plugins/tagwords/tagwords_template.php b/e107_plugins/tagwords/tagwords_template.php new file mode 100644 index 000000000..477857a66 --- /dev/null +++ b/e107_plugins/tagwords/tagwords_template.php @@ -0,0 +1,216 @@ +(".LAN_TAG_21.")"; +$TEMPLATE_TAGWORDS['form'] = "
"; + +//##### intro in the 'related content' list ------------------------- + +$sc_style['TAG_SEARCH|search']['pre'] = "
"; +$sc_style['TAG_SEARCH|search']['post'] = "
"; + +$sc_style['TAG_LINK|home']['pre'] = ""; +$sc_style['TAG_LINK|home']['post'] = "

"; + +$TEMPLATE_TAGWORDS['intro'] = " +{TAG_LINK|home} +{TAG_SEARCH|search} +
+ {TAG_WORD|result}
+
+
"; + +//##### area heading in the 'related content' list ------------------ + +$TEMPLATE_TAGWORDS['area'] = "

{TAG_AREA_HEADING}

"; + +//##### link to an item present in the 'related content' list ------- + +$TEMPLATE_TAGWORDS['link_start'] = "
    "; +$TEMPLATE_TAGWORDS['link_item'] = "
  • {TAG_LINK}
  • "; +$TEMPLATE_TAGWORDS['link_end'] = "
"; + +//##### options -------------------------------------------------- + +$TEMPLATE_TAGWORDS['options'] = " +
+ {TAG_SEARCH} + +
+
+ {TAG_TYPE} {TAG_SORT} {TAG_AREA} {TAG_BUTTON} +
+"; + +//##### cloud ------------------------------------------------------- + +$sc_style['TAG_NUMBER']['pre'] = "("; +$sc_style['TAG_NUMBER']['post'] = ") "; + +$TEMPLATE_TAGWORDS['cloud_start'] = ""; +$TEMPLATE_TAGWORDS['cloud_item'] = "{TAG_WORD}{TAG_NUMBER}"; +$TEMPLATE_TAGWORDS['cloud_end'] = ""; + +$TEMPLATE_TAGWORDS['cloud'] = " +{TAG_OPTIONS} +
+
+ {TAG_CLOUD} +
+
"; + +//##### cloud list -------------------------------------------------- + +$sc_style['TAG_NUMBER|list']['pre'] = " ("; +$sc_style['TAG_NUMBER|list']['post'] = ")"; + +$TEMPLATE_TAGWORDS['cloudlist_start'] = ""; + +$TEMPLATE_TAGWORDS['cloudlist'] = " +{TAG_OPTIONS} +
+ {TAG_CLOUD|list} +
"; + +//##### menu cloud -------------------------------------------------- + +$sc_style['TAG_NUMBER|menu']['pre'] = "("; +$sc_style['TAG_NUMBER|menu']['post'] = ") "; + +$sc_style['TAG_SEARCH|menu']['pre'] = "
"; +$sc_style['TAG_SEARCH|menu']['post'] = "
"; + +$TEMPLATE_TAGWORDS['menu_cloud_start'] = ""; +$TEMPLATE_TAGWORDS['menu_cloud_item'] = "{TAG_WORD|menu}{TAG_NUMBER|menu}"; +$TEMPLATE_TAGWORDS['menu_cloud_end'] = ""; + +$TEMPLATE_TAGWORDS['menu_cloud'] = " +
+ {TAG_SEARCH|menu} +
+ {TAG_CLOUD|menu} +
+ {TAG_LINK|menu} +
"; + +//##### admin ------------------------------------------------------- + +$TEMPLATE_TAGWORDS['admin_options'] = " +
+
".$hook['caption']."".$hook['text']."
".LAN_HOOKS."
".$hook['caption']."".$hook['text']."
". diff --git a/e107_handlers/news_class.php b/e107_handlers/news_class.php index 5b890196f..39c637af7 100644 --- a/e107_handlers/news_class.php +++ b/e107_handlers/news_class.php @@ -9,9 +9,9 @@ * News handler * * $Source: /cvs_backup/e107_0.8/e107_handlers/news_class.php,v $ - * $Revision: 1.7 $ - * $Date: 2008-12-07 13:08:41 $ - * $Author: e107steved $ + * $Revision: 1.8 $ + * $Date: 2008-12-29 20:50:41 $ + * $Author: lisa_ $ */ if (!defined('e107_INIT')) { exit; } @@ -47,6 +47,8 @@ class news { { $message = "".(!mysql_errno() ? LAN_NEWS_46 : LAN_NEWS_5).""; } + $data = array('method'=>'update', 'table'=>'news', 'id'=>$news['news_id'], 'plugin'=>'news', 'function'=>'submit_item'); + $message .= $e_event->triggerHook($data); } else { // Adding item @@ -56,6 +58,9 @@ class news { $e_event -> trigger('newspost', $news); $message = LAN_NEWS_6; $e107cache -> clear('news.php'); + $id = mysql_insert_id(); + $data = array('method'=>'create', 'table'=>'news', 'id'=>$id, 'plugin'=>'news', 'function'=>'submit_item'); + $message .= $e_event->triggerHook($data); } else { diff --git a/e107_languages/English/English.php b/e107_languages/English/English.php index ab97e2f01..a09ae108c 100644 --- a/e107_languages/English/English.php +++ b/e107_languages/English/English.php @@ -4,9 +4,9 @@ | e107 website system - Language File. | | $Source: /cvs_backup/e107_0.8/e107_languages/English/English.php,v $ -| $Revision: 1.9 $ -| $Date: 2008-12-28 22:37:43 $ -| $Author: e107steved $ +| $Revision: 1.10 $ +| $Date: 2008-12-29 20:50:52 $ +| $Author: lisa_ $ +----------------------------------------------------------------------------+ */ setlocale(LC_ALL, 'en'); @@ -53,5 +53,6 @@ define('LAN_NO', 'No'); define('LAN_OK', 'OK'); define('LAN_CONTINUE', 'Continue'); define('LAN_ENTER', 'Enter'); +define('LAN_HOOKS', 'Hooks'); ?> \ No newline at end of file diff --git a/e107_plugins/calendar_menu/e_tagwords.php b/e107_plugins/calendar_menu/e_tagwords.php new file mode 100644 index 000000000..1e84f692e --- /dev/null +++ b/e107_plugins/calendar_menu/e_tagwords.php @@ -0,0 +1,44 @@ +settings = array(); + + $this->settings['plugin'] = "calendar_menu"; + $this->settings['table'] = "event"; + $this->settings['db_id'] = "event_id"; + $this->settings['caption'] = "calendar"; + } + + function getLink($id) + { + global $tp; + if($this->row=='') + { + $this->row = $this->getRecord($id); + } + $url = e_PLUGIN."calendar_menu/event.php?{$this->row['event_start']}.event.{$this->row['event_id']}"; + return "".$tp->toHTML($this->row['event_title'], TRUE, '').""; + } + + function getRecord($id) + { + global $sql; + + $this->row = ''; + + $qry = "SELECT * FROM #event as e WHERE e.event_id='{$id}'"; + + 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/calendar_menu/event.php b/e107_plugins/calendar_menu/event.php index 89ba3cdd0..c08def688 100644 --- a/e107_plugins/calendar_menu/event.php +++ b/e107_plugins/calendar_menu/event.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/event.php,v $ -| $Revision: 1.6 $ -| $Date: 2008-03-20 20:49:02 $ -| $Author: e107steved $ +| $Revision: 1.7 $ +| $Date: 2008-12-29 20:51:07 $ +| $Author: lisa_ $ | +----------------------------------------------------------------------------+ */ @@ -128,6 +128,11 @@ if ((isset($_POST['ne_insert']) || isset($_POST['ne_update'])) && ($cal_super | { $qry = " 0, '".intval($ev_start)."', '".intval($ev_end)."', '".$ev_allday."', '".$recurring."', '".time()."', '$ev_title', '$ev_location', '$ev_event', '".USERID.".".USERNAME."', '".$ev_email."', '".$ev_category."', '".$ev_thread."', '".intval($rec_m)."', '".intval($rec_y)."' "; $sql->db_Insert("event", $qry); + + $id = mysql_insert_id(); + $data = array('method'=>'create', 'table'=>'event', 'id'=>$id, 'plugin'=>'calendar_menu', 'function'=>'dbCalendarCreate'); + $e_event->triggerHook($data); + $ecal_class->cal_log(1,'db_Insert',$qry, $ev_start); $report_msg = '.m4'; } @@ -137,6 +142,10 @@ if ((isset($_POST['ne_insert']) || isset($_POST['ne_update'])) && ($cal_super | { // Bits specific to updating an existing event $qry = "event_start='".intval($ev_start)."', event_end='".intval($ev_end)."', event_allday='".$ev_allday."', event_recurring='".$recurring."', event_datestamp= '".time()."', event_title= '$ev_title', event_location='$ev_location', event_details='$ev_event', event_contact='".$ev_email."', event_category='".$ev_category."', event_thread='".$ev_thread."', event_rec_m='".intval($rec_m)."', event_rec_y='".intval($rec_y)."' WHERE event_id='".intval($_POST['id'])."' "; $sql->db_Update("event", $qry); + + $data = array('method'=>'update', 'table'=>'event', 'id'=>intval($_POST['id']), 'plugin'=>'calendar_menu', 'function'=>'dbCalendarUpdate'); + $e_event->triggerHook($data); + $ecal_class->cal_log(2,'db_Update',$qry, $ev_start); $qs = preg_replace("/ed./i", "", $_POST['qs']); $report_msg = '.m5'; @@ -278,6 +287,10 @@ if ($cal_super || check_class($pref['eventpost_admin'])) if ($sql->db_Delete("event", $qry)) { $message = EC_LAN_51; //Event Deleted + + $data = array('method'=>'delete', 'table'=>'event', 'id'=>$_POST['existing'], 'plugin'=>'calendar_menu', 'function'=>'dbEventDelete'); + $message .= $e_event->triggerHook($data); + $ecal_class->cal_log(3,'db_Delete',$qry,$ev_start); } else @@ -648,7 +661,29 @@ if ($action == "ne" || $action == "ed") $text .= "
".EC_LAN_59." -
".LAN_HOOKS."
".$hook['caption']."".$hook['text']."
".EC_LAN_105."
".r_userclass("link_class", $row['link_class'], "off", "public,guest,nobody,member,admin,classes")."
".LAN_HOOKS."
".$hook['caption']."".$hook['text']."
"; if (isset($qs[2]) && $qs[2] && $qs[1] == "edit") { diff --git a/e107_plugins/tagwords/admin_tagwords_config.php b/e107_plugins/tagwords/admin_tagwords_config.php new file mode 100644 index 000000000..05bc8ac59 --- /dev/null +++ b/e107_plugins/tagwords/admin_tagwords_config.php @@ -0,0 +1,50 @@ +update_prefs(); + $message = LAN_TAG_ADMIN_1; +} + +if(isset($message)) +{ + $tag->show_message($message, $caption='', $type='ns'); +} + +$tag->tagwords_options(); + +require_once(e_ADMIN."footer.php"); +?> \ No newline at end of file diff --git a/e107_plugins/tagwords/e_event.php b/e107_plugins/tagwords/e_event.php new file mode 100644 index 000000000..f51d9cee6 --- /dev/null +++ b/e107_plugins/tagwords/e_event.php @@ -0,0 +1,92 @@ +tag = new tagwords(); + $tag = $this->tag; + } + + /* + * add form field + * @param array $data + */ + function event_form($data) + { + return $this->tag->tagwords_form($data['table'], intval($data['id'])); + } + + /* + * handle db create + * @param array $data + */ + function event_create($data) + { + if(isset($_POST['tagwords']) && trim($_POST['tagwords'])!='') + { + return $this->tag->dbTagWords($data['table'], intval($data['id']), $_POST['tagwords']); + } + } + + /* + * handle db update + * @param array $data + */ + function event_update($data) + { + if(isset($_POST['tagwords']) && trim($_POST['tagwords'])!='') + { + return $this->tag->dbTagWords($data['table'], intval($data['id']), $_POST['tagwords']); + } + } + + /* + * handle db delete + * @param array $data + */ + function event_delete($data) + { + return $this->tag->dbDelete($data['table'], intval($data['id'])); + } + +} //end class + +?> \ No newline at end of file diff --git a/e107_plugins/tagwords/e_meta.php b/e107_plugins/tagwords/e_meta.php new file mode 100644 index 000000000..7ae72f125 --- /dev/null +++ b/e107_plugins/tagwords/e_meta.php @@ -0,0 +1,29 @@ +\n"; + +?> \ No newline at end of file diff --git a/e107_plugins/tagwords/images/tagwords_16.png b/e107_plugins/tagwords/images/tagwords_16.png new file mode 100644 index 000000000..3f6f3ac41 Binary files /dev/null and b/e107_plugins/tagwords/images/tagwords_16.png differ diff --git a/e107_plugins/tagwords/images/tagwords_32.png b/e107_plugins/tagwords/images/tagwords_32.png new file mode 100644 index 000000000..2cf666524 Binary files /dev/null and b/e107_plugins/tagwords/images/tagwords_32.png differ diff --git a/e107_plugins/tagwords/languages/English.php b/e107_plugins/tagwords/languages/English.php new file mode 100644 index 000000000..4d6f81371 --- /dev/null +++ b/e107_plugins/tagwords/languages/English.php @@ -0,0 +1,66 @@ +To configure please click on the link in the plugins section of the admin front page"); + +define("LAN_TAG_SEARCH_1", "Search For:"); +define("LAN_TAG_SEARCH_2", "Search"); +define("LAN_TAG_SEARCH_3", "View"); + +define("LAN_TAG_1", "TagWords"); +define("LAN_TAG_2", "Tag"); +define("LAN_TAG_3", "TagWords updated"); +define("LAN_TAG_4", "sort "); +define("LAN_TAG_5", "display "); +define("LAN_TAG_6", ""); +define("LAN_TAG_7", "< Back to Tagwords Frontpage"); +define("LAN_TAG_8", "result found for"); +define("LAN_TAG_9", "results found for"); +define("LAN_TAG_10", "alphabetically"); +define("LAN_TAG_11", "by size"); +define("LAN_TAG_12", "taglist"); +define("LAN_TAG_13", "tagcloud"); +define("LAN_TAG_14", "selection : "); +define("LAN_TAG_15", "all areas"); +define("LAN_TAG_16", "TagCloud"); +define("LAN_TAG_17", "TagList"); +define("LAN_TAG_18", "no tagwords found for this selection"); +define("LAN_TAG_19", "choose sort"); +define("LAN_TAG_20", "choose style"); +define("LAN_TAG_21", "each tag on a seperate line"); + +define("LAN_TAG_ADMIN_1", "preferences updated"); + +define("LAN_TAG_OPT_1", "tagwords preferences"); +define("LAN_TAG_OPT_2", "minimum word appearance needed for tagcloud/taglist"); +define("LAN_TAG_OPT_3", "tagcloud/taglist only visible for"); +define("LAN_TAG_OPT_4", "default tag sort"); +define("LAN_TAG_OPT_5", "alphabetically"); +define("LAN_TAG_OPT_6", "by size"); +define("LAN_TAG_OPT_7", "default tag style"); +define("LAN_TAG_OPT_8", "tagcloud"); +define("LAN_TAG_OPT_9", "taglist"); +define("LAN_TAG_OPT_10", "yes"); +define("LAN_TAG_OPT_11", "no"); +define("LAN_TAG_OPT_12", "options tag sort"); +define("LAN_TAG_OPT_13", "options tag type"); +define("LAN_TAG_OPT_14", "options tag area"); +define("LAN_TAG_OPT_15", "maximum amount of words in menu"); +define("LAN_TAG_OPT_16", "tagwords page"); +define("LAN_TAG_OPT_17", "tagwords menu"); +define("LAN_TAG_OPT_18", "menu caption"); +define("LAN_TAG_OPT_19", "options tag search"); +define("LAN_TAG_OPT_20", "frequence behind tagword"); +define("LAN_TAG_OPT_21", "shortcode"); +define("LAN_TAG_OPT_22", "word seperator"); +define("LAN_TAG_OPT_23", "areas"); +define("LAN_TAG_OPT_24", "check active areas"); +define("LAN_TAG_OPT_25", "generic"); +define("LAN_TAG_OPT_26", "display"); + +define("LAN_TAG_MENU_1", "view complete tagwords cloud"); +define("LAN_TAG_MENU_2", "Tagwords"); + +?> \ No newline at end of file diff --git a/e107_plugins/tagwords/plugin.xml b/e107_plugins/tagwords/plugin.xml new file mode 100644 index 000000000..c10cfe6ab --- /dev/null +++ b/e107_plugins/tagwords/plugin.xml @@ -0,0 +1,15 @@ + + + + + A fully featured Tagword system + tagwords + + admin_tagwords_config.php + images/tagwords_32.png + images/tagwords_16.png +
Configure Tagwords
++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
".LAN_TAG_OPT_25."
".LAN_TAG_OPT_2."{TAG_OPT_MIN}
".LAN_TAG_OPT_3."{TAG_OPT_CLASS}
".LAN_TAG_OPT_16."
".LAN_TAG_OPT_4."{TAG_OPT_DEFAULT_SORT}
".LAN_TAG_OPT_7."{TAG_OPT_DEFAULT_STYLE}
".LAN_TAG_OPT_26." + {TAG_OPT_VIEW_SORT}
+ {TAG_OPT_VIEW_STYLE}
+ {TAG_OPT_VIEW_AREA}
+ {TAG_OPT_VIEW_SEARCH}
+ {TAG_OPT_VIEW_FREQ}
+
".LAN_TAG_OPT_17."
".LAN_TAG_OPT_18."{TAG_OPT_CAPTION|menu}
".LAN_TAG_OPT_15."{TAG_OPT_MIN|menu}
".LAN_TAG_OPT_4."{TAG_OPT_DEFAULT_SORT|menu}
".LAN_TAG_OPT_26." + {TAG_OPT_VIEW_SEARCH|menu}
+ {TAG_OPT_VIEW_FREQ|menu}
+
".LAN_TAG_OPT_21."
".LAN_TAG_OPT_22."{TAG_OPT_SEPERATOR}
".LAN_TAG_OPT_23."
".LAN_TAG_OPT_24."{TAG_OPT_ACTIVEAREAS}
{TAG_OPT_BUTTON}
+"; +/* + + ".LAN_TAG_OPT_26." + + {TAG_OPT_VIEW_SORT} ".LAN_TAG_OPT_12."
+ {TAG_OPT_VIEW_STYLE} ".LAN_TAG_OPT_13."
+ {TAG_OPT_VIEW_AREA} ".LAN_TAG_OPT_14."
+ {TAG_OPT_VIEW_SEARCH} ".LAN_TAG_OPT_19."
+ {TAG_OPT_VIEW_FREQ} ".LAN_TAG_OPT_20."
+ + +*/ + +?> \ No newline at end of file