diff --git a/e107_plugins/links_page/admin_linkspage_config.php b/e107_plugins/links_page/admin_linkspage_config.php index 7d69fd6d6..d4f5b6028 100644 --- a/e107_plugins/links_page/admin_linkspage_config.php +++ b/e107_plugins/links_page/admin_linkspage_config.php @@ -33,7 +33,8 @@ require_once(e_PLUGIN.'links_page/link_defines.php'); require_once(e_ADMIN.'auth.php'); require_once(e_HANDLER.'userclass_class.php'); require_once(e_HANDLER.'form_handler.php'); -$rs = new form; +$rs = new form; // FIX v2 style? +$frm = e107::getForm(); require_once(e_HANDLER.'file_class.php'); $fl = new e_file; e107_require_once(e_HANDLER.'arraystorage_class.php'); diff --git a/e107_plugins/links_page/languages/English_admin_links_page.php b/e107_plugins/links_page/languages/English_admin_links_page.php index 2fa647176..58f371dd9 100644 --- a/e107_plugins/links_page/languages/English_admin_links_page.php +++ b/e107_plugins/links_page/languages/English_admin_links_page.php @@ -37,7 +37,7 @@ define("LCLAN_PAGETITLE_9", "Submit Link"); define("LCLAN_PAGETITLE_10", ""); -define("LCLAN_OPT_1", "general options"); +//define("LCLAN_OPT_1", "general options"); define("LCLAN_OPT_2", "Link Page Options"); define("LCLAN_OPT_3", "enabled"); define("LCLAN_OPT_4", "disabled"); @@ -126,7 +126,7 @@ define("LCLAN_OPT_85", "caption menu"); define("LCLAN_OPT_86", "link menu"); define("LCLAN_OPT_87", "show amount of links"); -define("LCLAN_ADMIN_1", "update"); // deprecated +//define("LCLAN_ADMIN_1", "update"); // deprecated define("LCLAN_ADMIN_2", "Link saved to database."); define("LCLAN_ADMIN_3", "Link updated in database."); define("LCLAN_ADMIN_4", "Link Category Saved"); @@ -205,7 +205,7 @@ define("LCLAN_ITEM_10", "The"); define("LCLAN_ITEM_11", "folder is not writable, you need to CHMOD 777 the folder before uploading"); define("LCLAN_ITEM_12", "px"); define("LCLAN_ITEM_13", "upload"); -define("LCLAN_ITEM_14", "Choose an icon:"); +define("LCLAN_ITEM_14", "Choose an icon:"); define("LCLAN_ITEM_15", "View Images"); define("LCLAN_ITEM_16", "Open Type:"); define("LCLAN_ITEM_17", "Opens in same window"); diff --git a/e107_plugins/links_page/link_class.php b/e107_plugins/links_page/link_class.php index a3cc90ee2..61b7b8f56 100644 --- a/e107_plugins/links_page/link_class.php +++ b/e107_plugins/links_page/link_class.php @@ -650,7 +650,11 @@ class linkclass function show_link_create() { - global $sql, $rs, $qs, $ns, $fl, $linkspage_pref, $e_event; + global $rs, $qs, $linkspage_pref, $e_event; + $sql = e107::getDb(); + $frm = e107::getForm(); + $ns = e107::getRender(); + $fl = e107::getFile(); $row['link_category'] = ""; $row['link_name'] = ""; @@ -695,12 +699,11 @@ class linkclass } $width = (e_PAGE == "admin_linkspage_config.php" ? ADMIN_WIDTH : "width:100%;"); $text = " -
".$rs -> form_open("post", e_SELF."?".e_QUERY, "linkform", "", "enctype='multipart/form-data'", "")." - +
- - + - - + - - + - - + - - + @@ -758,73 +761,74 @@ class linkclass $iconpath = e_PLUGIN."links_page/link_images/"; $iconlist = $fl->get_files($iconpath); $iconpath = e_PLUGIN_ABS."links_page/link_images/"; // Absolute paths now we've got the files - + // TODO FIX - needs replacement with up-to-date form handling, see below. $text .= " - - + + "; //0=same window, 1=_blank, 2=_parent, 3=_top, 4=miniwindow $text .= " - - + + - - + "; //triggerHook $data = array('method'=>'form', 'table'=>'links_page', 'id'=>$row['link_id'], 'plugin'=>'links_page', 'function'=>'show_link_create'); + $text .= $frm->renderHooks($data); - $text .= e107::getForm()->renderHooks($data); - - $text .= " -
".LCLAN_ITEM_2.""; + ".LCLAN_ITEM_2.""; if (!$link_cats = $sql->db_Select("links_page_cat")) { $text .= LCLAN_ITEM_3."
"; @@ -719,26 +722,26 @@ class linkclass
".LCLAN_ITEM_4." + ".LCLAN_ITEM_4." ".$rs -> form_text("link_name", 60, $row['link_name'], 100)."
".LCLAN_ITEM_5." + ".LCLAN_ITEM_5." ".$rs -> form_text("link_url", 60, $row['link_url'], 200)."
".LCLAN_ITEM_6." + ".LCLAN_ITEM_6." ".$rs -> form_textarea("link_description", '59', '3', $row['link_description'], "", "", "", "", "")."
".LCLAN_ITEM_7.""; + ".LCLAN_ITEM_7.""; if(!FILE_UPLOADS){ $text .= "".LCLAN_ITEM_9.""; }else{ @@ -748,7 +751,7 @@ class linkclass $text .= "
".LCLAN_ITEM_8." ".$rs -> form_text("link_resize_value", 3, $link_resize_value, 3)." ".LCLAN_ITEM_12." - ".$rs -> form_button("submit", "uploadlinkicon", LCLAN_ITEM_13, "", "", ""); + ".$frm->admin_button('uploadlinkicon', LCLAN_ITEM_13, 'submit'); } $text .= "
".LCLAN_ITEM_14." - -
"; - $selectjs = " onchange=\"document.getElementById('link_but').value=this.options[this.selectedIndex].value; if(this.options[this.selectedIndex].value!=''){document.getElementById('iconview').src='".$iconpath."'+this.options[this.selectedIndex].value; document.getElementById('iconview').style.display='block';}else{document.getElementById('iconview').src='';document.getElementById('iconview').style.display='none';}\""; - $text .= $rs -> form_select_open("link_button", $selectjs); - $text .= $rs -> form_option(LCLAN_ITEM_34, ($row['link_button'] ? "0" : "1"), ""); - foreach($iconlist as $icon){ - $text .= $rs -> form_option($icon['fname'], ($icon['fname'] == $row['link_button'] ? "1" : "0"), $icon['fname'] ); - } - $text .= $rs -> form_select_close(); - if(isset($row['link_button']) && $row['link_button']){ - $img = $iconpath.$row['link_button']; - }else{ - $blank_display = 'display: none'; - $img = e_PLUGIN_ABS."links_page/images/blank.gif"; - } - $text .= "

"; - $text .= "
-
".LCLAN_ITEM_14." + +
"; + $selectjs = " onchange=\"document.getElementById('link_but').value=this.options[this.selectedIndex].value; if(this.options[this.selectedIndex].value!=''){document.getElementById('iconview').src='".$iconpath."'+this.options[this.selectedIndex].value; document.getElementById('iconview').style.display='block';}else{document.getElementById('iconview').src='';document.getElementById('iconview').style.display='none';}\""; + $text .= $rs -> form_select_open("link_button", $selectjs); + $text .= $rs -> form_option(LCLAN_ITEM_34, ($row['link_button'] ? "0" : "1"), ""); + foreach($iconlist as $icon){ + $text .= $rs -> form_option($icon['fname'], ($icon['fname'] == $row['link_button'] ? "1" : "0"), $icon['fname'] ); + } + $text .= $rs -> form_select_close(); + if(isset($row['link_button']) && $row['link_button']){ + $img = $iconpath.$row['link_button']; + }else{ + $blank_display = 'display: none'; + $img = e_PLUGIN_ABS."links_page/images/blank.gif"; + } + $text .= "

"; + $text .= "
+
".LCLAN_ITEM_16." - ".$rs -> form_select_open("linkopentype")." - ".$rs -> form_option(LCLAN_ITEM_17, ($row['link_open'] == "0" ? "1" : "0"), "0", "")." - ".$rs -> form_option(LCLAN_ITEM_18, ($row['link_open'] == "1" ? "1" : "0"), "1", "")." - ".$rs -> form_option(LCLAN_ITEM_19, ($row['link_open'] == "4" ? "1" : "0"), "4", "")." - ".$rs -> form_select_close()." - ".LCLAN_ITEM_16." + ".$rs -> form_select_open("linkopentype")." + ".$rs -> form_option(LCLAN_ITEM_17, ($row['link_open'] == "0" ? "1" : "0"), "0", "")." + ".$rs -> form_option(LCLAN_ITEM_18, ($row['link_open'] == "1" ? "1" : "0"), "1", "")." + ".$rs -> form_option(LCLAN_ITEM_19, ($row['link_open'] == "4" ? "1" : "0"), "4", "")." + ".$rs -> form_select_close()." +
".LCLAN_ITEM_20." + ".LCLAN_ITEM_20." ".r_userclass("link_class", $row['link_class'], "off", "public,guest,nobody,member,admin,classes")."
"; + "; if (isset($qs[2]) && $qs[2] && $qs[1] == "edit") { $text .= $rs -> form_hidden("link_datestamp", $row['link_datestamp']); $text .= $rs -> form_checkbox("update_datestamp", 1, 0)." ".LCLAN_ITEM_21."

"; $text .= $rs -> form_button("submit", "add_link", LCLAN_ITEM_22, "", "", "").$rs -> form_hidden("link_id", $row['link_id']).$rs -> form_hidden("link_author", $row['link_author']); } else { - $text .= $rs -> form_button("submit", "add_link", LCLAN_ITEM_23, "", "", ""); + $text .= " +
+ ".$frm->admin_button('add_link', LCLAN_ITEM_23, 'submit')." +
"; } $text .= "
".$rs -> form_close()." -
"; - + "; + // TODO FIX - seperate div buttons-bar from table $ns->tablerender(LCLAN_PAGETITLE_1, $text); } @@ -835,7 +839,12 @@ class linkclass */ function show_links() { - global $sql, $qs, $rs, $ns, $tp, $from; + global $qs, $rs, $from; + $sql = e107::getDb(); + $frm = e107::getForm(); + $tp = e107::getParser(); + $ns = e107::getRender(); + $number = "20"; $LINK_CAT_NAME = ''; // May be appropriate to add a shortcode later @@ -863,13 +872,13 @@ class linkclass { // Display the individual links $text = $rs->form_open("post", e_SELF.(e_QUERY ? "?".e_QUERY : ""), "myform_{$row['link_id']}", "", ""); $text .= "
- +
- - - - - + + + + + "; while ($row = $sql->db_Fetch()) { @@ -915,19 +924,19 @@ class linkclass } $text .= " - - + - - - - - +
".LCLAN_ITEM_25."".LCLAN_ITEM_26."".LCLAN_ITEM_27."".LCLAN_ITEM_28."".LCLAN_ITEM_29."".LCLAN_ITEM_25."".LCLAN_ITEM_26."".LCLAN_ITEM_27."".LCLAN_ITEM_28."".LCLAN_ITEM_29."
".$img." + ".$img." ".LINK_ICON_LINK." ".$row['link_name']." + ".LINK_ICON_EDIT." toJS(LCLAN_ITEM_33." [ ".$row['link_name']." ]")."')\" /> + ".$up." ".$down." +
  - ".$rs->form_button("submit", "update_order", LCLAN_ITEM_30)." +   + ".$rs->form_button('update_order', LCLAN_ITEM_30, 'submit')."
@@ -952,7 +961,12 @@ class linkclass } function show_cat_create() { - global $qs, $sql, $rs, $ns, $tp, $fl; + global $qs, $rs; + $sql = e107::getDb(); + $frm = e107::getForm(); + $tp = e107::getParser(); + $ns = e107::getRender(); + $fl = e107::getFile(); $row['link_category_name'] = ""; $row['link_category_description'] = ""; @@ -978,37 +992,38 @@ class linkclass // $rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*'); $iconlist = $fl->get_files(e_PLUGIN."links_page/cat_images/"); - $text = "
+ $text = " ".$rs->form_open("post", e_SELF.(e_QUERY ? "?".e_QUERY : ""), "linkform", "", "enctype='multipart/form-data'", "")." - +
- - + + - - + + - - + + $text .= " + - - + - - + -
".LCLAN_CAT_13."".$rs->form_text("link_category_name", 50, $row['link_category_name'], 200)."".LCLAN_CAT_13."".$rs->form_text("link_category_name", 50, $row['link_category_name'], 200)."
".LCLAN_CAT_14."".$rs->form_text("link_category_description", 60, $row['link_category_description'], 200)."".LCLAN_CAT_14."".$rs->form_text("link_category_description", 60, $row['link_category_description'], 200)."
".LCLAN_CAT_15.""; - if(!FILE_UPLOADS){ - $text .= "".LCLAN_CAT_17.""; - }else{ - if(!is_writable(e_PLUGIN."links_page/cat_images/")){ - $text .= "".LCLAN_CAT_18." ".e_PLUGIN."links_page/cat_images/ ".LCLAN_CAT_19."
"; +
".LCLAN_CAT_15.""; + if(!FILE_UPLOADS){ + $text .= "".LCLAN_CAT_17.""; + }else{ + if(!is_writable(e_PLUGIN."links_page/cat_images/")){ + $text .= "".LCLAN_CAT_18." ".e_PLUGIN."links_page/cat_images/ ".LCLAN_CAT_19."
"; + } + $text .= " +
+ ".LCLAN_CAT_16." ".$rs -> form_text("link_cat_resize_value", 3, $link_cat_resize_value, 3)." ".LCLAN_CAT_20." + ".$frm->admin_button('uploadcatlinkicon', LCLAN_CAT_21, 'submit'); + } - $text .= " -
- ".LCLAN_CAT_16." ".$rs -> form_text("link_cat_resize_value", 3, $link_cat_resize_value, 3)." ".LCLAN_CAT_20." - ".$rs -> form_button("submit", "uploadcatlinkicon", LCLAN_CAT_21, "", "", ""); - } - $text .= " -
".LCLAN_CAT_22." + ".LCLAN_CAT_22." ".$rs -> form_text("link_category_icon", 60, $row['link_category_icon'], 100)." ".$rs -> form_button("button", '', LCLAN_CAT_23, "onclick=\"expandit('catico')\"")."
".LCLAN_CAT_24." + ".LCLAN_CAT_24." ".r_userclass("link_category_class", $row['link_category_class'], "off", "public,guest,nobody,member,admin,classes")."
"; +
"; if (is_numeric($qs[2])) { $text .= $rs -> form_hidden("link_category_order", $row['link_category_order']); $text .= $rs -> form_hidden("link_category_datestamp", $row['link_category_datestamp']); @@ -1033,7 +1048,7 @@ class linkclass $text .= $rs -> form_button("submit", "category_clear", LCLAN_CAT_27). $rs->form_hidden("link_category_id", $qs[2]); } else { - $text .= $rs -> form_button("submit", "create_category", LCLAN_CAT_28, "", "", ""); + $text .= $frm->admin_button('create_category', LCLAN_CAT_28, 'submit'); // TODO FIX LCLAN_CAT_22 td needs fixing and updating to v2 style, unfunctional atm. - above } $text .= "
".$rs->form_close()." @@ -1052,21 +1067,26 @@ class linkclass */ function show_categories($mode) { - global $sql, $rs, $ns, $tp, $fl; + global $rs; + $sql = e107::getDb(); + $frm = e107::getForm(); + $tp = e107::getParser(); + $ns = e107::getRender(); + $fl = e107::getFile(); if ($category_total = $sql->db_Select("links_page_cat", "*", "ORDER BY link_category_order ASC", "mode=no_where")) { $text = " -
+ ".$rs->form_open("post", e_SELF.(e_QUERY ? "?".e_QUERY : ""), "", "", "")." - +
- - - "; + + + "; if($mode == "cat"){ $text .= " - - "; + + "; } $text .= " "; @@ -1083,8 +1103,8 @@ class linkclass } $text .= " - - + "; @@ -1110,15 +1130,15 @@ class linkclass $down = ""; } $text .= " - - - "; } $text .= " @@ -1139,16 +1159,16 @@ class linkclass { $text .= " - - + "; }else{ $text .= " - - + "; } @@ -1173,9 +1193,9 @@ class linkclass ".$rs->form_open("post", e_SELF."?sn", "submitted_links")."
".LCLAN_CAT_1."".LCLAN_CAT_2."".LCLAN_CAT_3."".LCLAN_CAT_1."".LCLAN_CAT_2."".LCLAN_CAT_3."".LCLAN_CAT_4."".LCLAN_CAT_5."".LCLAN_CAT_4."".LCLAN_CAT_5."
".$img." + ".$img." ".LINK_ICON_LINK." ".$row['link_category_name']."
".$row['link_category_description']."
+ ".LINK_ICON_EDIT." toJS(LCLAN_CAT_8." [ ".$row['link_category_name']." ]")."')\"/> + ".$up." ".$down." + + $text .= " ".LINK_ICON_EDIT."
  - ".$rs->form_button("submit", "update_category_order", LCLAN_CAT_10)." +   + ".$frm->admin_button('update_category_order', LCLAN_CAT_10, 'submit')."
 ".$rs->form_button("button", "viewalllinks", LCLAN_ITEM_37, "onclick=\"document.location='".e_SELF."?link.view.all';\"")." +  ".$rs->form_button("button", "viewalllinks", LCLAN_ITEM_37, "onclick=\"document.location='".e_SELF."?link.view.all';\"")."
- - - + + + "; while ($row = $sql->db_Fetch()) { $tmp_time = $row['tmp_time']; @@ -1184,9 +1204,9 @@ class linkclass $submitted[2] = "http://".$submitted[2]; } $text .= " - - - + + @@ -1198,7 +1218,9 @@ class linkclass } function show_pref_options() { - global $linkspage_pref, $ns, $rs, $pref; + global $linkspage_pref, $rs; + $ns = e107::getRender(); + $pref = e107::getPref(); $text = "
".LCLAN_SL_3."".LCLAN_SL_4."".LCLAN_SL_5."".LCLAN_SL_3."".LCLAN_SL_4."".LCLAN_SL_5."
".$submitted[2]."".$submitted[5]." + ".$submitted[2]."".$submitted[5]." ".LINK_ICON_EDIT." toJS(LCLAN_SL_8." [ ".$tmp_time." ]")."')\" />