diff --git a/e107_plugins/linkwords/admin_config.php b/e107_plugins/linkwords/admin_config.php index 7e011e75c..a837c99b5 100644 --- a/e107_plugins/linkwords/admin_config.php +++ b/e107_plugins/linkwords/admin_config.php @@ -11,32 +11,53 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/linkwords/admin_config.php,v $ -| $Revision: 1.6 $ -| $Date: 2008-01-11 22:13:43 $ +| $Revision: 1.7 $ +| +| ***** START OF VERSION WHICH ALLOWS TOOLTIPS (also order of forms changed ) +| +| $Date: 2008-12-07 21:55:01 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ require_once("../../class2.php"); -if (!getperms("P")) { +if (!plugInstalled('linkwords')) header("Location: ".e_BASE."index.php"); +if (!getperms("P")) +{ header("location:".e_BASE."index.php"); exit ; } require_once(e_ADMIN."auth.php"); -@include_once(e_PLUGIN."linkwords/languages/".e_LANGUAGE.".php"); -@include_once(e_PLUGIN."linkwords/languages/English.php"); +@include_lan(e_PLUGIN."linkwords/languages/".e_LANGUAGE."_admin_linkwords.php"); $lw_context_areas = array( - 'title' => LWLAN_33, - 'summary' => LWLAN_34, - 'body' => LWLAN_35, - 'description' => LWLAN_36, - 'user_title' => LWLAN_40, - 'user_body' => LWLAN_41 + 'TITLE' => LWLAN_33, + 'SUMMARY' => LWLAN_34, + 'BODY' => LWLAN_35, + 'DESCRIPTION' => LWLAN_36, + 'USER_TITLE' => LWLAN_40, + 'USER_BODY' => LWLAN_41 // Don't do the next three - linkwords are meaningless on them // 'olddefault' => LWLAN_37, // 'linktext' => LWLAN_38, // 'rawtext' => LWLAN_39' ); + +// Yes, I know its a silly order - but that's history! +$lwaction_vals = array(1=>LWLAN_51, 0=>LWLAN_52, 2=>LWLAN_53, 3=>LWLAN_54); + +// Generate dropdown for possible actions on finding a linkword +function lw_act_opts($curval) +{ + global $lwaction_vals; + $ret = ''; + foreach ($lwaction_vals as $opt => $val) + { + $selected = ($curval == $opt ? "selected='selected'" : ""); + $ret .= "\n"; + } + return $ret; +} + $deltest = array_flip($_POST); @@ -47,6 +68,7 @@ if(isset($deltest[LWLAN_17])) if ($sql->db_Count("linkwords", "(*)", "WHERE linkword_id = ".$delete_id)) { $sql->db_Delete("linkwords", "linkword_id=".$delete_id); + $admin_log->log_event('LINKWD_03','ID: '.$delete_id,''); $message = LWLAN_19; } } @@ -57,7 +79,7 @@ if(e_QUERY) if (!isset($lw_qs[0])) $lw_qs[0] = 'words'; if (!isset($lw_qs[1])) $lw_qs[1] = -1; $action = $lw_qs[0]; - $id = $lw_qs[1]; + $id = intval($lw_qs[1]); } if (!isset($action)) $action = 'words'; @@ -65,13 +87,15 @@ if (isset($_POST['saveopts_linkword'])) { // Save options page // Array of context flags $pref['lw_context_visibility'] = array( - 'olddefault' => FALSE, - 'title' => FALSE, - 'summary' => FALSE, - 'body' => FALSE, - 'description' => FALSE, - 'linktext' => FALSE, - 'rawtext' => FALSE + 'OLDDEFAULT' => FALSE, + 'TITLE' => FALSE, + 'USER_TITLE' => FALSE, + 'SUMMARY' => FALSE, + 'BODY' => FALSE, + 'USER_BODY' => FALSE, + 'DESCRIPTION' => FALSE, + 'LINKTEXT' => FALSE, + 'RAWTEXT' => FALSE ); foreach ($_POST['lw_visibility_area'] as $can_see) { @@ -87,40 +111,55 @@ if (isset($_POST['saveopts_linkword'])) $pagelist[$i] = trim($pagelist[$i]); } $pref['lw_page_visibility'] = '2-'.implode("|", $pagelist); // '2' for 'hide on specified pages' + $pref['lw_ajax_enable'] = isset($_POST['lw_ajax_enable']); save_prefs(); + $logString = implode(', ',$pref['lw_context_visibility']).'[!br!]'.$pref['lw_page_visibility'].'[!br!]'.$pref['lw_ajax_enable']; + $admin_log->log_event('LINKWD_04',$logString,''); } -if (isset($_POST['submit_linkword'])) +if (isset($_POST['submit_linkword']) || isset($_POST['update_linkword'])) { if(!$_POST['linkwords_word'] && $_POST['linkwords_url']) - { + { // Key fields empty $message = LWLAN_1; } else { - $word = $tp -> toDB($_POST['linkword_word']); - $link = $tp -> toDB($_POST['linkword_link']); - $active = intval($_POST['linkword_active']); - $sql -> db_Insert("linkwords", "0, {$active}, '{$word}', '{$link}' "); - $message = LWLAN_2; - } -} + $data['linkword_word'] = $tp -> toDB($_POST['linkword_word']); + $data['linkword_link'] = $tp -> toDB($_POST['linkword_link']); + $data['linkword_tooltip'] = $tp -> toDB($_POST['linkword_tooltip']); + $data['linkword_tip_id'] = intval($_POST['linkword_tip_id']); + $data['linkword_active'] = intval($_POST['linkword_active']); + $data['linkword_newwindow'] = isset($_POST['linkword_newwindow']) ? 1 : 0; -if (isset($_POST['update_linkword'])) -{ - if(!$_POST['linkwords_word'] && $_POST['linkwords_url']) - { - $message = LWLAN_1; - } - else - { - $id = $_POST['id']; - $word = $tp -> toDB($_POST['linkword_word']); - $link = $tp -> toDB($_POST['linkword_link']); - $active = $_POST['linkword_active']; - $sql -> db_Update("linkwords", "linkword_active=$active, linkword_word='$word', linkword_link='$link' WHERE linkword_id=".$id); - $message = LWLAN_3; + $logString = implode('[!br!]',$data); + if (isset($_POST['submit_linkword'])) + { + if ($sql -> db_Insert('linkwords', $data)) + { + $message = LWLAN_2; + $admin_log->log_event('LINKWD_01',$logString,''); + } + else + { + $message = LWLAN_57; + } + } + elseif (isset($_POST['update_linkword'])) + { + $id = intval(varset($_POST['lw_edit_id'],0)); + if (($id > 0) && $sql -> db_UpdateArray('linkwords', $data, ' WHERE `linkword_id`='.$id)) + { + $message = LWLAN_3; + $logString = 'ID: '.$id.'[!br!]'.$logString; + $admin_log->log_event('LINKWD_02',$logString,''); + } + else + { + $message = LWLAN_57; + } + } } } @@ -131,13 +170,14 @@ if (isset($message)) } - +$chkNewWindow = " checked='checked'"; // Open links in new window by default if($action == "edit") { if($sql -> db_Select("linkwords", "*", "linkword_id=".$id)) { $row = $sql -> db_Fetch(); extract($row); + $chkNewWindow = $row['linkword_newwindow'] ? " checked='checked'" : ''; // Open links in new window by default define("LW_EDIT", TRUE); } } @@ -154,45 +194,64 @@ $text = "
".LWLAN_5." | -".LWLAN_6." | -".LWLAN_7." | -".LWLAN_8." | +||||
".LWLAN_61." | +".LWLAN_5." | +".LWLAN_6." | +".LWLAN_56." | +".LWLAN_50." | +".LWLAN_60." | +".LWLAN_7." | +".LWLAN_8." |