1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-18 05:09:05 +01:00

links_page - plugin.xml, admin log, bit of a tidy up

This commit is contained in:
e107steved 2008-12-13 16:06:11 +00:00
parent e842d52f71
commit 2d6fc3af73
10 changed files with 906 additions and 392 deletions

View File

@ -11,186 +11,252 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/links_page/admin_linkspage_config.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:20 $
| $Author: mcfly_e107 $
| $Revision: 1.2 $
| $Date: 2008-12-13 16:06:11 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
require_once("../../class2.php");
if (!getperms("P")) {
if (!getperms("P") || !plugInstalled('links_page'))
{
header("location:".e_BASE."index.php");
exit;
}
require_once(e_PLUGIN.'links_page/link_shortcodes.php');
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");
require_once(e_ADMIN.'auth.php');
require_once(e_HANDLER.'userclass_class.php');
require_once(e_HANDLER.'form_handler.php');
$rs = new form;
require_once(e_HANDLER."file_class.php");
require_once(e_HANDLER.'file_class.php');
$fl = new e_file;
e107_require_once(e_HANDLER.'arraystorage_class.php');
$eArrayStorage = new ArrayData();
require_once(e_PLUGIN.'links_page/link_class.php');
$lc = new linkclass;
$lan_file = $plugindir."languages/".e_LANGUAGE.".php";
include_once(file_exists($lan_file) ? $lan_file : $plugindir."languages/English.php");
@include_lan($plugindir."languages/".e_LANGUAGE."_admin_links_page.php");
$linkspage_pref = $lc -> getLinksPagePref();
$deltest = array_flip($_POST);
//if (e_QUERY) {
// $qs = explode(".", e_QUERY);
//}
if(e_QUERY){
if(e_QUERY)
{
$qs = explode(".", e_QUERY);
if(is_numeric($qs[0])){
if(is_numeric($qs[0]))
{
$from = array_shift($qs);
}else{
}
else
{
$from = "0";
}
}
if(isset($_POST['delete'])){
if(isset($_POST['delete']))
{
$tmp = array_pop($tmp = array_flip($_POST['delete']));
list($delete, $del_id) = explode("_", $tmp);
$del_id = intval($del_id);
}
if (isset($_POST['create_category'])) {
if (isset($_POST['create_category']))
{
$lc -> dbCategoryCreate();
}
if (isset($_POST['update_category'])) {
if (isset($_POST['update_category']))
{
$lc -> dbCategoryUpdate();
}
if (isset($_POST['updateoptions'])) {
if (isset($_POST['updateoptions']))
{
$linkspage_pref = $lc -> UpdateLinksPagePref();
$lc -> show_message(LCLAN_ADMIN_6);
}
if (isset($_POST['add_link'])) {
if (isset($_POST['add_link']))
{
$lc -> dbLinkCreate();
}
//upload link icon
if(isset($_POST['uploadlinkicon'])){
if(isset($_POST['uploadlinkicon']))
{
$lc -> uploadLinkIcon();
}
//upload category icon
if(isset($_POST['uploadcatlinkicon'])){
if(isset($_POST['uploadcatlinkicon']))
{
$lc -> uploadCatLinkIcon();
}
//update link order
if (isset($_POST['update_order'])) {
if (isset($_POST['update_order']))
{
$lc -> dbOrderUpdate($_POST['link_order']);
}
//update link category order
if (isset($_POST['update_category_order'])) {
if (isset($_POST['update_category_order']))
{
$lc -> dbOrderCatUpdate($_POST['link_category_order']);
}
if (isset($_POST['inc'])) {
if (isset($_POST['inc']))
{
$lc -> dbOrderUpdateInc($_POST['inc']);
}
if (isset($_POST['dec'])) {
if (isset($_POST['dec']))
{
$lc -> dbOrderUpdateDec($_POST['dec']);
}
//delete link
if (isset($delete) && $delete == 'main') {
$sql->db_Select("links_page", "link_order", "link_id='".$del_id."'");
if (isset($delete) && ($delete == 'main') && $del_id)
{
$sql->db_Select("links_page", "link_order", "link_id=".$del_id);
$row = $sql->db_Fetch();
$sql2 = new db;
$sql->db_Select("links_page", "link_id", "link_order>'".$row['link_order']."' && link_category='".$id."'");
while ($row = $sql->db_Fetch()) {
$sql->db_Select("links_page", "link_id", "link_order>'".$row['link_order']."' && link_category=".intval($row['link_category']));
while ($row = $sql->db_Fetch())
{
$sql2->db_Update("links_page", "link_order=link_order-1 WHERE link_id='".$row['link_id']."'");
}
if ($sql->db_Delete("links_page", "link_id='".$del_id."'")) {
if ($sql->db_Delete("links_page", "link_id=".$del_id))
{
$admin_log->log_event('LINKS_02','ID: '.$del_id,E_LOG_INFORMATIVE,'');
$lc->show_message(LCLAN_ADMIN_10." #".$del_id." ".LCLAN_ADMIN_11);
}
}
//delete category
if (isset($delete) && $delete == 'category') {
if (isset($delete) && ($delete == 'category') && $del_id)
{
//check if links are present for this category
if($sql->db_Select("links_page", "*", "link_category='$del_id' ")) {
if($sql->db_Select("links_page", "*", "link_category=".$del_id ))
{
$lc->show_message(LCLAN_ADMIN_12." #".$del_id." ".LAN_DELETED_FAILED."<br />".LCLAN_ADMIN_15);
//no? then we can safely remove this category
}else{
if ($sql->db_Delete("links_page_cat", "link_category_id='$del_id' ")) {
}
else
{
if ($sql->db_Delete("links_page_cat", "link_category_id=".$del_id))
{
$admin_log->log_event('LINKS_03','ID: '.$del_id,E_LOG_INFORMATIVE,'');
$lc->show_message(LCLAN_ADMIN_12." #".$del_id." ".LCLAN_ADMIN_11);
unset($id);
}
}
}
//delete submitted link
if (isset($delete) && $delete == 'sn') {
if ($sql->db_Delete("tmp", "tmp_time='$del_id' ")) {
if (isset($delete) && ($delete == 'sn') && $del_id)
{
if ($sql->db_Delete("tmp", "tmp_time=".$del_id))
{
$admin_log->log_event('LINKS_04','ID: '.$del_id,E_LOG_INFORMATIVE,'');
$lc->show_message(LCLAN_ADMIN_13);
}
}
//show link categories (cat edit)
if (!e_QUERY) {
if (!e_QUERY)
{
$lc->show_categories("cat");
}
//show cat edit form
if (isset($qs[0]) && $qs[0] == 'cat' && isset($qs[1]) && $qs[1] == 'edit' && isset($qs[2]) && is_numeric($qs[2])) {
if (isset($qs[0]) && $qs[0] == 'cat' && isset($qs[1]) && $qs[1] == 'edit' && isset($qs[2]) && is_numeric($qs[2]))
{
$lc->show_cat_create();
}
//show cat create form
if (isset($qs[0]) && $qs[0] == 'cat' && isset($qs[1]) && $qs[1] == 'create' && !isset($qs[2]) ) {
if (isset($qs[0]) && $qs[0] == 'cat' && isset($qs[1]) && $qs[1] == 'create' && !isset($qs[2]) )
{
$lc->show_cat_create();
}
if (isset($qs[0]) && $qs[0] == 'link') {
//view categories (link select cat)
if (!isset($qs[1])){
if (isset($qs[0]) && $qs[0] == 'link')
{
$gotVal = FALSE;
switch(varset($qs[1],''))
{
case 'view' : //view links in cat
if (isset($qs[2]) && (is_numeric($qs[2]) || $qs[2] == "all") )
{
$lc->show_links();
$gotVal = TRUE;
}
break;
case 'edit' : //edit link
if (isset($qs[2]) && is_numeric($qs[2]))
{
$lc->show_link_create();
$gotVal = TRUE;
}
break;
case 'create' : //create link
if (!isset($qs[2]) )
{
$lc->show_link_create();
$gotVal = TRUE;
}
break;
case 'sn' : //post submitted
if (isset($qs[2]) && is_numeric($qs[2]) )
{
$lc->show_link_create();
$gotVal = TRUE;
}
break;
default :
}
if (!$gotVal)
{
$lc->show_categories("link");
//view links in cat
}elseif (isset($qs[1]) && $qs[1] == 'view' && isset($qs[2]) && (is_numeric($qs[2]) || $qs[2] == "all") ) {
$lc->show_links();
//edit link
}elseif (isset($qs[1]) && $qs[1] == 'edit' && isset($qs[2]) && is_numeric($qs[2])) {
$lc->show_link_create();
//create link
}elseif (isset($qs[1]) && $qs[1] == 'create' && !isset($qs[2]) ) {
$lc->show_link_create();
//post submitted
}elseif (isset($qs[1]) && $qs[1] == 'sn' && isset($qs[2]) && is_numeric($qs[2]) ) {
$lc->show_link_create();
}
}
//view submitted links
if (isset($qs[0]) && $qs[0] == 'sn') {
if (isset($qs[0]) && $qs[0] == 'sn')
{
$lc->show_submitted();
}
//options
if (isset($qs[0]) && $qs[0] == 'opt') {
if (isset($qs[0]) && $qs[0] == 'opt')
{
$lc->show_pref_options();
}
// ##### Display options --------------------------------------------------------------------------
function admin_linkspage_config_adminmenu(){
function admin_linkspage_config_adminmenu()
{
global $qs, $sql;
if ($qs[0] == "") {
$act = "cat";
}else{
$act = $qs[0];
if(isset($qs[1])){
if($qs[1] == "create"){
$act .= ".create";
}
if($qs[1] == "edit"){
$act .= "";
}
if($qs[1] == "view"){
$act .= "";
}
$act = varset($qs[0],'cat');
if($act == 'cat' && isset($qs[1]))
{
if($qs[1] == "create")
{
$act .= ".create";
}
elseif ($qs[1] == "edit")
{
$act .= "";
}
elseif ($qs[1] == "view")
{
$act .= "";
}
}
@ -206,7 +272,8 @@ function admin_linkspage_config_adminmenu(){
$var['link.create']['text'] = LCLAN_ADMINMENU_5;
$var['link.create']['link'] = e_SELF."?link.create";
if ($tot = $sql->db_Select("tmp", "*", "tmp_ip='submitted_link' ")) {
if ($tot = $sql->db_Select("tmp", "*", "tmp_ip='submitted_link' "))
{
$var['sn']['text'] = LCLAN_ADMINMENU_7." (".$tot.")";
$var['sn']['link'] = e_SELF."?sn";
}
@ -216,10 +283,12 @@ function admin_linkspage_config_adminmenu(){
show_admin_menu(LCLAN_ADMINMENU_1, $act, $var);
if($qs[0] != "opt"){
if($qs[0] != "opt")
{
unset($var);
$var=array();
if ($sql->db_Select("links_page_cat", "*")) {
if ($sql->db_Select("links_page_cat", "*"))
{
while ($row = $sql->db_Fetch()) {
$var[$row['link_category_id']]['text'] = $row['link_category_name'];
$var[$row['link_category_id']]['link'] = e_SELF."?link.view.".$row['link_category_id'];
@ -228,7 +297,8 @@ function admin_linkspage_config_adminmenu(){
show_admin_menu(LCLAN_ADMINMENU_8, $active, $var);
}
}
if(isset($qs[0]) && $qs[0] == "opt"){
if(isset($qs[0]) && $qs[0] == "opt")
{
unset($var);
$var=array();
$var['optgeneral']['text'] = LCLAN_OPT_MENU_1;

View File

@ -0,0 +1,74 @@
<?php
if (!defined('e107_INIT')) { exit; }
@include_lan($plugindir."languages/".e_LANGUAGE."_admin_links_page.php");
if(!e_QUERY)
{
$text = LAN_ADMIN_HELP_1;
}
else
{
$qs = explode(".", e_QUERY);
if(is_numeric($qs[0]))
{
$from = array_shift($qs);
}
else
{
$from = "0";
}
//##### LINK --------------------------------------------------
//manage Link items
if($qs[0] == "link" && !isset($qs[1]) )
{
$text = LAN_ADMIN_HELP_3;
//edit
}
elseif($qs[0] == "link" && $qs[1] == "edit" && is_numeric($qs[2]) )
{
$text = LAN_ADMIN_HELP_9;
//view links in cat
}
elseif($qs[0] == "link" && $qs[1] == "view" && (is_numeric($qs[2]) || $qs[2] == "all") )
{
$text = LAN_ADMIN_HELP_8;
//create
}
elseif($qs[0] == "link" && $qs[1] == "create" && !isset($qs[2]))
{
$text = LAN_ADMIN_HELP_4;
//create/post submitted
}
elseif($qs[0] == "link" && $qs[1] == "sn" && is_numeric($qs[2]))
{
$text = LAN_ADMIN_HELP_10;
//##### SUBMITTED --------------------------------------------------
}
elseif($qs[0] == "sn" && !isset($qs[1]) )
{
$text = LAN_ADMIN_HELP_5;
//##### OPTION --------------------------------------------------
}
elseif($qs[0] == "opt" && !isset($qs[1]) )
{
$text = LAN_ADMIN_HELP_6;
//##### CATEGORY --------------------------------------------------
}
elseif($qs[0] == "cat" && $qs[1] == "create" )
{
$text = LAN_ADMIN_HELP_2;
}
elseif($qs[0] == "cat" && $qs[1] == "edit" && is_numeric($qs[2]) )
{
$text = LAN_ADMIN_HELP_7;
}
}
$ns -> tablerender(LAN_ADMIN_HELP_0, $text);
?>

View File

@ -1,54 +0,0 @@
<?php
if (!defined('e107_INIT')) { exit; }
$lan_file = $plugindir."languages/".e_LANGUAGE.".php";
include_once(file_exists($lan_file) ? $lan_file : $plugindir."languages/English.php");
if(!e_QUERY){
$text = LAN_ADMIN_HELP_1;
}else{
if(e_QUERY){
$qs = explode(".", e_QUERY);
if(is_numeric($qs[0])){
$from = array_shift($qs);
}else{
$from = "0";
}
}
//##### LINK --------------------------------------------------
//manage Link items
if($qs[0] == "link" && !isset($qs[1]) ){
$text = LAN_ADMIN_HELP_3;
//edit
}elseif($qs[0] == "link" && $qs[1] == "edit" && is_numeric($qs[2]) ){
$text = LAN_ADMIN_HELP_9;
//view links in cat
}elseif($qs[0] == "link" && $qs[1] == "view" && (is_numeric($qs[2]) || $qs[2] == "all") ){
$text = LAN_ADMIN_HELP_8;
//create
}elseif($qs[0] == "link" && $qs[1] == "create" && !isset($qs[2])){
$text = LAN_ADMIN_HELP_4;
//create/post submitted
}elseif($qs[0] == "link" && $qs[1] == "sn" && is_numeric($qs[2])){
$text = LAN_ADMIN_HELP_10;
//##### SUBMITTED --------------------------------------------------
}elseif($qs[0] == "sn" && !isset($qs[1]) ){
$text = LAN_ADMIN_HELP_5;
//##### OPTION --------------------------------------------------
}elseif($qs[0] == "opt" && !isset($qs[1]) ){
$text = LAN_ADMIN_HELP_6;
//##### CATEGORY --------------------------------------------------
}elseif($qs[0] == "cat" && $qs[1] == "create" ){
$text = LAN_ADMIN_HELP_2;
}elseif($qs[0] == "cat" && $qs[1] == "edit" && is_numeric($qs[2]) ){
$text = LAN_ADMIN_HELP_7;
}
}
$ns -> tablerender(LAN_ADMIN_HELP_0, $text);
?>

View File

@ -4,15 +4,15 @@
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/links_page/languages/English.php,v $
| $Revision: 1.4 $
| $Date: 2008-07-16 20:45:24 $
| $Revision: 1.5 $
| $Date: 2008-12-13 16:06:11 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
define("LCLAN_USERPROFILE_1", ">> view all links");
define("LCLAN_USERPROFILE_2", "links: {total} links found");
/*
define("LCLAN_PLUGIN_LAN_1", "Links Page");
define("LCLAN_PLUGIN_LAN_2", "Links Page For Displaying External Web Links");
define("LCLAN_PLUGIN_LAN_3", "Configure Links Page");
@ -107,8 +107,9 @@ define("LCLAN_OPT_64", "only links with a rating larger then the given value are
define("LCLAN_OPT_65", "show empty categories");
define("LCLAN_OPT_66", "link to each category");
define("LCLAN_OPT_67", "link to all links");
*/
define("LCLAN_OPT_68", "view all links");
/*
define("LCLAN_OPT_69", "rendertype navigator links");
define("LCLAN_OPT_70", "show category links");
define("LCLAN_OPT_71", "rendertype category links");
@ -260,6 +261,7 @@ define("LAN_LINKS_MANAGER_6", "");
define("LAN_LINKS_MANAGER_7", "");
define("LAN_LINKS_MANAGER_8", "");
define("LAN_LINKS_MANAGER_9", "");
*/
define("LAN_LINKS_1", "Total links");
define("LAN_LINKS_2", "Total links activated");
@ -313,7 +315,7 @@ define("LAN_LINKS_49", "");
define("LAN_LINKS_50", "You do not have permission to submit links at present");
define('LAN_LINKS_SCH_1','Posted in reply to link');
/*
define("LAN_ADMIN_HELP_0", "linkspage help area");
define("LAN_ADMIN_HELP_1", "<i>the manage link categories page shows all categories present.</i><br /><br /><b>detailed list</b><br />You see a list of all categories with their icon, name and description, options, and sorting options.<br /><br /><b>explanation of icons</b><br />
@ -360,4 +362,5 @@ define("LAN_ADMIN_HELP_8", "<i>this page shows all existing links in the selecte
define("LAN_ADMIN_HELP_9", "<i>the edit link page allows you to edit an existing link</i><br /><br />You can upload a new icon, and after uploading assign the icon to the link.<br /><br />the open type allows you to define how the link will be opened when a user clicks on it.");
define("LAN_ADMIN_HELP_10", "<i>the post submitted link page allows you to add a submitted link to the existing links</i><br /><br />A small submitted text is added into the description field.<br /><br />You can upload a new icon, and after uploading assign the icon to the link.<br /><br />the open type allows you to define how the link will be opened when a user clicks on it.");
*/
?>

View File

@ -0,0 +1,385 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/links_page/languages/English_admin_links_page.php,v $
| $Revision: 1.1 $
| $Date: 2008-12-13 16:06:11 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
//define("LCLAN_USERPROFILE_1", ">> view all links");
//define("LCLAN_USERPROFILE_2", "links: {total} links found");
define("LCLAN_PLUGIN_LAN_1", "Links Page");
define("LCLAN_PLUGIN_LAN_2", "Links Page For Displaying External Web Links");
define("LCLAN_PLUGIN_LAN_3", "Configure Links Page");
define("LCLAN_PLUGIN_LAN_4", "links");
define("LCLAN_PLUGIN_LAN_5", "Links page has successfully installed, please configure it from the Links Page link on the admin front page.");
define("LCLAN_PLUGIN_LAN_6", "Links_page successfully upgraded, now using version");
define("LCLAN_OPT_MENU_1", "general options");
define("LCLAN_OPT_MENU_2", "personal link managers");
define("LCLAN_OPT_MENU_3", "category page");
define("LCLAN_OPT_MENU_4", "links display");
define("LCLAN_OPT_MENU_5", "refer page");
define("LCLAN_OPT_MENU_6", "rating page");
define("LCLAN_OPT_MENU_7", "menu");
define("LCLAN_PAGETITLE_1", "Links");
define("LCLAN_PAGETITLE_2", "All categories");
define("LCLAN_PAGETITLE_3", "All Links");
define("LCLAN_PAGETITLE_4", "category");
define("LCLAN_PAGETITLE_5", "Top Rated");
define("LCLAN_PAGETITLE_6", "Top Referrals");
define("LCLAN_PAGETITLE_7", "Personal Link Manager");
define("LCLAN_PAGETITLE_8", "Link Comments");
define("LCLAN_PAGETITLE_9", "Submit Link");
define("LCLAN_PAGETITLE_10", "");
define("LCLAN_OPT_1", "general options");
define("LCLAN_OPT_2", "Link Page Options");
define("LCLAN_OPT_3", "enabled");
define("LCLAN_OPT_4", "disabled");
define("LCLAN_OPT_5", "px");
define("LCLAN_OPT_6", "");
define("LCLAN_OPT_7", "divide categories into individual pages");
define("LCLAN_OPT_8", "allow links to be submitted");
define("LCLAN_OPT_9", "who can submit links");
define("LCLAN_OPT_10", "use multiple pages to show the links");
define("LCLAN_OPT_11", "number of links per page");
define("LCLAN_OPT_12", "category page");
define("LCLAN_OPT_13", "display which sections");
define("LCLAN_OPT_14", "icon");
define("LCLAN_OPT_15", "description");
define("LCLAN_OPT_16", "amount");
define("LCLAN_OPT_17", "referral");
define("LCLAN_OPT_18", "url");
define("LCLAN_OPT_19", "total category info line");
define("LCLAN_OPT_20", "link to top refer");
define("LCLAN_OPT_21", "link to top rated");
define("LCLAN_OPT_22", "show default icon if none is present");
define("LCLAN_OPT_23", "default sort method");
define("LCLAN_OPT_24", "default order method");
define("LCLAN_OPT_25", "default resize value");
define("LCLAN_OPT_26", "links page");
define("LCLAN_OPT_27", "allow users to rate links");
define("LCLAN_OPT_28", "show default icon if none present");
define("LCLAN_OPT_29", "display sort and order menu");
define("LCLAN_OPT_30", "ascending");
define("LCLAN_OPT_31", "descending");
define("LCLAN_OPT_32", "use override of link open method");
define("LCLAN_OPT_33", "default resize value");
define("LCLAN_OPT_34", "name");
define("LCLAN_OPT_35", "url");
define("LCLAN_OPT_36", "order");
define("LCLAN_OPT_37", "refer");
define("LCLAN_OPT_38", "");
define("LCLAN_OPT_39", "");
define("LCLAN_OPT_40", "name");
define("LCLAN_OPT_41", "id");
define("LCLAN_OPT_42", "use individual link setting");
define("LCLAN_OPT_43", "Opens in same window");
define("LCLAN_OPT_44", "Opens in new window");
define("LCLAN_OPT_45", "Opens in 600x400 mini-window");
define("LCLAN_OPT_46", "who can manage links");
define("LCLAN_OPT_47", "these users can add/edit their own personal links");
define("LCLAN_OPT_48", "allow direct posting");
define("LCLAN_OPT_49", "if enabled links are submitted directly, else a site admin needs to approve them");
define("LCLAN_OPT_50", "allow direct deleting");
define("LCLAN_OPT_51", "if enabled the link managers can delete their own links");
define("LCLAN_OPT_52", "personal link managers");
define("LCLAN_OPT_53", "date");
define("LCLAN_OPT_54", "allow personal management on links");
define("LCLAN_OPT_55", "allow comments on all links");
define("LCLAN_OPT_56", "minimum refer value");
define("LCLAN_OPT_57", "only links with a refer count larger then the given value are displayed (0 or empty = all)");
define("LCLAN_OPT_58", "link to submit link");
define("LCLAN_OPT_59", "link to personal manager (only if allowed)");
define("LCLAN_OPT_60", "link to link frontpage");
define("LCLAN_OPT_61", "link to all categories");
define("LCLAN_OPT_62", "show these navigator links");
define("LCLAN_OPT_63", "minimum rating value");
define("LCLAN_OPT_64", "only links with a rating larger then the given value are displayed (0 or empty = all)");
define("LCLAN_OPT_65", "show empty categories");
define("LCLAN_OPT_66", "link to each category");
define("LCLAN_OPT_67", "link to all links");
define("LCLAN_OPT_68", "view all links");
define("LCLAN_OPT_69", "rendertype navigator links");
define("LCLAN_OPT_70", "show category links");
define("LCLAN_OPT_71", "rendertype category links");
define("LCLAN_OPT_72", "show recent links");
define("LCLAN_OPT_73", "display which data");
define("LCLAN_OPT_74", "how many recent links are displayed");
define("LCLAN_OPT_75", "hyperlinks");
define("LCLAN_OPT_76", "selectbox");
define("LCLAN_OPT_77", "category");
define("LCLAN_OPT_78", "description");
define("LCLAN_OPT_79", "caption navigator");
define("LCLAN_OPT_80", "caption categories");
define("LCLAN_OPT_81", "caption recent list");
define("LCLAN_OPT_82", "navigator");
define("LCLAN_OPT_83", "categories");
define("LCLAN_OPT_84", "recent list");
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_2", "Link saved to database.");
define("LCLAN_ADMIN_3", "Link updated in database.");
define("LCLAN_ADMIN_4", "Link Category Saved");
define("LCLAN_ADMIN_5", "Link Category Updated");
define("LCLAN_ADMIN_6", "Options Saved");
define("LCLAN_ADMIN_7", "link icon was uploaded successfully !");
define("LCLAN_ADMIN_8", "link icon was not uploaded !");
define("LCLAN_ADMIN_9", "Order updated");
define("LCLAN_ADMIN_10", "Link");
define("LCLAN_ADMIN_11", "deleted"); // deprecated
define("LCLAN_ADMIN_12", "Link Category");
define("LCLAN_ADMIN_13", "Submitted link deleted");
define("LCLAN_ADMIN_14", "Links");
define("LCLAN_ADMIN_15", "This category still contains links, please (re)move them first");
define('LCLAN_ADMIN_16', 'Nothing changed - not updated');
define("LCLAN_SL_1", "Submitted Links");
define("LCLAN_SL_2", "No submitted links");
define("LCLAN_SL_3", "Link");
define("LCLAN_SL_4", "Submitted by");
define("LCLAN_SL_5", "Options");
define("LCLAN_SL_6", "Post");
define("LCLAN_SL_7", "Delete");
define("LCLAN_SL_8", "Are you sure you want to delete this submitted link?");
define("LCLAN_SL_9", "After submitting your link it will be reviewed by a site admin and if appropriate it will be added to the main links page.");
define("LCLAN_SL_10", "Category:");
define("LCLAN_SL_11", "name");
define("LCLAN_SL_12", "url");
define("LCLAN_SL_13", "description");
define("LCLAN_SL_14", "URL to link button:");
define("LCLAN_SL_15", "Underlined fields are required.");
define("LCLAN_SL_16", "Submit Link");
define("LCLAN_SL_17", "");
define("LCLAN_SL_18", "");
define("LCLAN_CAT_1", "Image");
define("LCLAN_CAT_2", "Category");
define("LCLAN_CAT_3", "Options");
define("LCLAN_CAT_4", "Move");
define("LCLAN_CAT_5", "Order");
define("LCLAN_CAT_6", "Edit");
define("LCLAN_CAT_7", "Are");
define("LCLAN_CAT_8", "Are you sure you want to delete this category?");
define("LCLAN_CAT_9", "View Links");
define("LCLAN_CAT_10", "Reorder");
define("LCLAN_CAT_11", "No link categories");
define("LCLAN_CAT_12", "Existing Link Categories");
define("LCLAN_CAT_13", "Name:");
define("LCLAN_CAT_14", "Description:");
define("LCLAN_CAT_15", "Upload a new icon:");
define("LCLAN_CAT_16", "Auto-Thumbnail size:");
define("LCLAN_CAT_17", "This option is disabled as file uploading is not enabled on your server");
define("LCLAN_CAT_18", "The");
define("LCLAN_CAT_19", "folder is not writable, you need to CHMOD 777 the folder before uploading");
define("LCLAN_CAT_20", "px");
define("LCLAN_CAT_21", "upload");
define("LCLAN_CAT_22", "Choose an icon:");
define("LCLAN_CAT_23", "View Images");
define("LCLAN_CAT_24", "Visible for:");
define("LCLAN_CAT_25", "tick to update timestamp to current time");
define("LCLAN_CAT_26", "Update Link Category");
define("LCLAN_CAT_27", "Clear Form");
define("LCLAN_CAT_28", "Create Link Category");
define("LCLAN_CAT_29", "Link Category");
define("LCLAN_ITEM_1", "Submitted by");
define("LCLAN_ITEM_2", "Category:");
define("LCLAN_ITEM_3", "no categories yet");
define("LCLAN_ITEM_4", "Name:");
define("LCLAN_ITEM_5", "Url:");
define("LCLAN_ITEM_6", "Description:");
define("LCLAN_ITEM_7", "Upload an icon:");
define("LCLAN_ITEM_8", "Auto-Thumbnail size:");
define("LCLAN_ITEM_9", "This option is disabled as file uploading is not enabled on your server");
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_15", "View Images");
define("LCLAN_ITEM_16", "Open Type:");
define("LCLAN_ITEM_17", "Opens in same window");
define("LCLAN_ITEM_18", "Opens in new window");
define("LCLAN_ITEM_19", "Opens in 600x400 mini-window");
define("LCLAN_ITEM_20", "Visible for:");
define("LCLAN_ITEM_21", "tick to update timestamp to current time");
define("LCLAN_ITEM_22", "Update Link");
define("LCLAN_ITEM_23", "Create link");
define("LCLAN_ITEM_24", "Links");
define("LCLAN_ITEM_25", "Image");
define("LCLAN_ITEM_26", "Link Name");
define("LCLAN_ITEM_27", "Options");
define("LCLAN_ITEM_28", "Move");
define("LCLAN_ITEM_29", "Order");
define("LCLAN_ITEM_30", "Reorder");
define("LCLAN_ITEM_31", "edit");
define("LCLAN_ITEM_32", "delete");
define("LCLAN_ITEM_33", "Are you sure you want to delete this link?");
define("LCLAN_ITEM_34", "no icon");
define("LCLAN_ITEM_35", "manage personal links");
define("LCLAN_ITEM_36", "go");
define("LCLAN_ITEM_37", "view all links");
define("LCLAN_ITEM_38", "All Links");
define("LCLAN_ITEM_39", "Rating");
define("LCLAN_ADMINMENU_1", "Link Options");
define("LCLAN_ADMINMENU_2", "Manage Link Categories");
define("LCLAN_ADMINMENU_3", "Create Link Category");
define("LCLAN_ADMINMENU_4", "Manage Links");
define("LCLAN_ADMINMENU_5", "Create Link");
define("LCLAN_ADMINMENU_6", "Options");
define("LCLAN_ADMINMENU_7", "Submitted Links");
define("LCLAN_ADMINMENU_8", "Categories");
define("NT_LAN_LP_1", "Links Page Events");
define("NT_LAN_LP_2", "Link submitted by user");
define("NT_LAN_LP_3", "Link Submitted");
define("LNK_SCH_LAN_2", "All Links Categories");
define("LNK_SCH_LAN_3", "All links details");
define("LAN_LINKS_MANAGER_0", "icon");
define("LAN_LINKS_MANAGER_1", "link");
define("LAN_LINKS_MANAGER_2", "options");
define("LAN_LINKS_MANAGER_3", "create new link");
define("LAN_LINKS_MANAGER_4", "you don't have any links present");
define("LAN_LINKS_MANAGER_5", "category");
define("LAN_LINKS_MANAGER_6", "");
define("LAN_LINKS_MANAGER_7", "");
define("LAN_LINKS_MANAGER_8", "");
define("LAN_LINKS_MANAGER_9", "");
/*
define("LAN_LINKS_1", "Total links");
define("LAN_LINKS_2", "Total links activated");
define("LAN_LINKS_3", "Anonymous");
define("LAN_LINKS_4", "heading");
define("LAN_LINKS_5", "url");
define("LAN_LINKS_6", "order");
define("LAN_LINKS_7", "refer");
define("LAN_LINKS_8", "ascending");
define("LAN_LINKS_9", "descending");
define("LAN_LINKS_10", "Top Links : Refer");
define("LAN_LINKS_11", "Top Links : Rating");
define("LAN_LINKS_12", "view links by refer");
define("LAN_LINKS_13", "view links by rating");
define("LAN_LINKS_14", "view links frontpage");
define("LAN_LINKS_15", "sort by");
define("LAN_LINKS_16", "in this category");
define("LAN_LINKS_17", "link");
define("LAN_LINKS_18", "links");
define("LAN_LINKS_19", "categories");
define("LAN_LINKS_20", "category");
define("LAN_LINKS_21", "There");
define("LAN_LINKS_22", "is");
define("LAN_LINKS_23", "are");
define("LAN_LINKS_24", "total in");
define("LAN_LINKS_25", "show all links");
define("LAN_LINKS_26", "Referrals");
define("LAN_LINKS_27", "submit a link");
define("LAN_LINKS_28", "Thank you");
define("LAN_LINKS_29", "Your link has been saved and will be reviewed by a site administrator.");
define("LAN_LINKS_30", "Link Categories");
define("LAN_LINKS_31", "submit a link");
define("LAN_LINKS_32", "Category:");
define("LAN_LINKS_33", "No Links are rated yet.");
define("LAN_LINKS_34", "There are currently no links");
define("LAN_LINKS_35", "personal links manager");
define("LAN_LINKS_36", "link comments");
define("LAN_LINKS_37", "Comments");
define("LAN_LINKS_38", "date");
define("LAN_LINKS_39", "Links");
define("LAN_LINKS_40", "Category");
define("LAN_LINKS_41", "no categories yet");
define("LAN_LINKS_42", "no links are referred yet");
define("LAN_LINKS_43", "view all categories");
define("LAN_LINKS_44", "id");
define("LAN_LINKS_45", "Link Category");
define("LAN_LINKS_46", "Link Subcategories");
define("LAN_LINKS_47", "link navigator...");
define("LAN_LINKS_48", "-- view category --");
define("LAN_LINKS_49", "");
define("LAN_LINKS_50", "You do not have permission to submit links at present");
define('LAN_LINKS_SCH_1','Posted in reply to link');
*/
// Admin log texts
//----------------
define('LAN_AL_LINKS_01', 'Links page preferences changed');
define('LAN_AL_LINKS_02', 'Link deleted');
define('LAN_AL_LINKS_03', 'Link category deleted');
define('LAN_AL_LINKS_04', 'Submitted link deleted');
define('LAN_AL_LINKS_05', 'Link category added');
define('LAN_AL_LINKS_06', 'Link category updated');
define('LAN_AL_LINKS_07', 'Link order updated');
define('LAN_AL_LINKS_08', 'Link Category order updated');
define('LAN_AL_LINKS_09', 'Link: move up');
define('LAN_AL_LINKS_10', 'Category: move up');
define('LAN_AL_LINKS_11', 'Link: move down');
define('LAN_AL_LINKS_12', 'Category: move down');
define('LAN_AL_LINKS_13', 'Link created');
define('LAN_AL_LINKS_14', 'Link updated');
define('LAN_AL_LINKS_15', '');
define('LAN_AL_LINKS_16', '');
define("LAN_ADMIN_HELP_0", "linkspage help area");
define("LAN_ADMIN_HELP_1", "<i>the manage link categories page shows all categories present.</i><br /><br /><b>detailed list</b><br />You see a list of all categories with their icon, name and description, options, and sorting options.<br /><br /><b>explanation of icons</b><br />
".LINK_ICON_LINK." : link to the category<br /><br />
".LINK_ICON_EDIT." : edit the category<br /><br />
".LINK_ICON_DELETE." : delete the category<br /><br />
".LINK_ICON_ORDER_UP." : the up button allows you to move the category item one up in order.<br /><br />
".LINK_ICON_ORDER_DOWN." : the down button allows you to move the category item one down in order.<br />
<br />
<b>order</b><br />here you can manually set the order of all the categories. You need to change the values in the select boxes to the order of your kind and press the reorder button below to save the new order.<br />");
define("LAN_ADMIN_HELP_2", "<i>the create link category page allows you to add new categories</i><br /><br />You can upload a new icon, and after uploading assign the icon to the category.");
define("LAN_ADMIN_HELP_3", "<i>the manage links page first show all categories.</i><br /><br />".LINK_ICON_LINK." : link to the category<br /><br />".LINK_ICON_EDIT." : click the icon to view all links in this category<br />");
define("LAN_ADMIN_HELP_4", "<i>the create link page allows you to add a new link</i><br /><br />You can upload a new icon, and after uploading assign the icon to the link.<br /><br />the open type allows you to define how the link will be opened when a user clicks on it.");
define("LAN_ADMIN_HELP_5", "<i>the submitted links page shows all links that are submitted by users</i><br /><br /><b>detailed list</b><br />You see the link url, the name of the user who submitted the link and options.<br /><br /><b>explanation of icons</b><br />
".LINK_ICON_EDIT." : post the submitted link to the link create form<br /><br />
".LINK_ICON_DELETE." : delete the submitted link<br />
");
define("LAN_ADMIN_HELP_6", "<i>the options page allows you to change the behaviour of the links_page plugin</i><br /><br />
general options<br />
these options are generally used throughout the link pages.<br /><br />
personal link managers<br />
the personal link managers are privileged users who can manage their own personally added links.<br /><br />
category page<br />
here you can change options for the category page.<br /><br />
links page<br />
These options are used on the link pages.<br /><br />
refer page<br />
These options are used on the top refer links page.<br /><br />
rating page<br />
These options are used on the top rated links page.<br />
");
define("LAN_ADMIN_HELP_7", "<i>the edit link category page allows you to edit an existing category</i><br /><br />You can upload a new icon, and after uploading assign the icon to the category.<br />You can update the timestamp of the link by checking the box.");
define("LAN_ADMIN_HELP_8", "<i>this page shows all existing links in the selected category.</i><br /><br /><b>detailed list</b><br />You see a list of the links with their image, name, options, and sorting options.<br /><br /><b>explanation of icons</b><br />
".LINK_ICON_LINK." : link to the website<br /><br />
".LINK_ICON_EDIT." : edit the link<br /><br />
".LINK_ICON_DELETE." : delete the link<br /><br />
".LINK_ICON_ORDER_UP." : the up button allows you to move the link one up in order.<br /><br />
".LINK_ICON_ORDER_DOWN." : the down button allows you to move the link one down in order.<br />
<br />
<b>order</b><br />here you can manually set the order of all the links. You need to change the values in the select boxes to the order of your kind and press the reorder button below to save the new order.<br />");
define("LAN_ADMIN_HELP_9", "<i>the edit link page allows you to edit an existing link</i><br /><br />You can upload a new icon, and after uploading assign the icon to the link.<br /><br />the open type allows you to define how the link will be opened when a user clicks on it.");
define("LAN_ADMIN_HELP_10", "<i>the post submitted link page allows you to add a submitted link to the existing links</i><br /><br />A small submitted text is added into the description field.<br /><br />You can upload a new icon, and after uploading assign the icon to the link.<br /><br />the open type allows you to define how the link will be opened when a user clicks on it.");
?>

View File

@ -11,18 +11,19 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/links_page/link_class.php,v $
| $Revision: 1.9 $
| $Date: 2008-11-20 20:35:24 $
| $Revision: 1.10 $
| $Date: 2008-12-13 16:06:11 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
class linkclass {
function LinkPageDefaultPrefs(){
class linkclass
{
function LinkPageDefaultPrefs()
{
$linkspage_pref['link_page_categories'] = "0";
$linkspage_pref['link_submit'] = "0";
$linkspage_pref['link_submit_class'] = "0";
@ -95,11 +96,13 @@ class linkclass {
return $linkspage_pref;
}
function getLinksPagePref(){
function getLinksPagePref()
{
global $sql, $eArrayStorage;
$num_rows = $sql -> db_Select("core", "*", "e107_name='links_page' ");
if ($num_rows == 0) {
if ($num_rows == 0)
{
$linkspage_pref = $this->LinkPageDefaultPrefs();
$tmp = $eArrayStorage->WriteArray($linkspage_pref);
$sql -> db_Insert("core", "'links_page', '{$tmp}' ");
@ -111,38 +114,54 @@ class linkclass {
return $linkspage_pref;
}
function UpdateLinksPagePref(){
global $sql, $eArrayStorage, $tp;
function UpdateLinksPagePref()
{
global $sql, $eArrayStorage, $tp, $admin_log;
$num_rows = $sql -> db_Select("core", "*", "e107_name='links_page' ");
if ($num_rows == 0) {
$sql -> db_Insert("core", "'links_page', '' ");
}else{
$row = $sql -> db_Fetch();
//assign new preferences
foreach($_POST as $k => $v){
if(strpos($k, "link_") === 0){
$linkspage_pref[$k] = $tp->toDB($v);
}
}
//create new array of preferences
$tmp = $eArrayStorage->WriteArray($linkspage_pref);
$sql -> db_Update("core", "e107_value = '{$tmp}' WHERE e107_name = 'links_page' ");
if ($num_rows == 0)
{
$sql -> db_Insert("core", "'links_page', '' "); // Create dummy entry if none present
$oldPref = array();
}
else
{
$row = $sql -> db_Fetch(MYSQL_ASSOC);
$oldPref = $eArrayStorage->ReadArray($row['e107_value']);
unset($row);
}
$linkspage_pref = array();
//assign new preferences
foreach($_POST as $k => $v)
{
if(strpos($k, "link_") === 0)
{
$linkspage_pref[$k] = $tp->toDB($v);
}
}
if ($admin_log->logArrayDiffs($linkspage_pref, $oldPref, 'LINKS_01'))
{
//create new array of preferences
$tmp = $eArrayStorage->WriteArray($linkspage_pref);
$sql -> db_Update("core", "`e107_value` = '{$tmp}' WHERE `e107_name` = 'links_page' ");
}
return $linkspage_pref;
}
function ShowNextPrev($from='0', $number, $total){
function ShowNextPrev($from='0', $number, $total)
{
global $linkspage_pref, $qs, $tp, $link_shortcodes, $LINK_NEXTPREV, $LINK_NP_TABLE, $pref;
$number = (e_PAGE == 'admin_linkspage_config.php' ? '20' : $number);
if($total<=$number){
if($total<=$number)
{
return;
}
if(e_PAGE == 'admin_linkspage_config.php' || (isset($linkspage_pref["link_nextprev"]) && $linkspage_pref["link_nextprev"])){
if(e_PAGE == 'admin_linkspage_config.php' || (isset($linkspage_pref["link_nextprev"]) && $linkspage_pref["link_nextprev"]))
{
$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."";
$LINK_NEXTPREV = $tp->parseTemplate("{NEXTPREV={$parms}}");
@ -159,7 +178,9 @@ class linkclass {
}
}
function setPageTitle(){
function setPageTitle()
{
global $sql, $qs, $linkspage_pref;
//show all categories
@ -207,8 +228,8 @@ class linkclass {
function parse_link_append($rowl){
function parse_link_append($rowl)
{
global $tp, $linkspage_pref;
if($linkspage_pref['link_open_all'] && $linkspage_pref['link_open_all'] == "5"){
$link_open_type = $rowl['link_open'];
@ -239,7 +260,8 @@ class linkclass {
function showLinkSort($mode=''){
function showLinkSort($mode='')
{
global $rs, $ns, $qs, $linkspage_pref;
$check = "";
@ -292,7 +314,9 @@ class linkclass {
return $sotext;
}
function parseOrderCat($orderstring){
function parseOrderCat($orderstring)
{
if(substr($orderstring,6) == "heading"){
$orderby = "link_category_name";
$orderby2 = "";
@ -310,7 +334,8 @@ class linkclass {
return $orderby." ".(substr($orderstring,5,1) == "a" ? "ASC" : "DESC")." ".$orderby2;
}
function parseOrderLink($orderstring){
function parseOrderLink($orderstring)
{
if(substr($orderstring,6) == "heading"){
$orderby = "link_name";
$orderby2 = "";
@ -334,7 +359,8 @@ class linkclass {
return $orderby." ".(substr($orderstring,5,1) == "a" ? "ASC" : "DESC")." ".$orderby2;
}
function getOrder($mode=''){
function getOrder($mode='')
{
global $qs, $linkspage_pref;
if(isset($qs[0]) && substr($qs[0],0,5) == "order"){
@ -370,12 +396,14 @@ class linkclass {
return $order;
}
function show_message($message, $caption='') {
function show_message($message, $caption='')
{
global $ns;
$ns->tablerender($caption, "<div style='text-align:center'><b>".$message."</b></div>");
}
function uploadLinkIcon(){
function uploadLinkIcon()
{
global $ns, $pref;
$pref['upload_storagetype'] = "1";
require_once(e_HANDLER."upload_handler.php");
@ -383,9 +411,11 @@ class linkclass {
$uploaded = file_upload($pathicon);
$icon = "";
if($uploaded) {
if($uploaded)
{
$icon = $uploaded[0]['name'];
if($_POST['link_resize_value']){
if($_POST['link_resize_value'])
{
require_once(e_HANDLER."resize_handler.php");
resize_image($pathicon.$icon, $pathicon.$icon, $_POST['link_resize_value'], "nocopy");
}
@ -394,7 +424,8 @@ class linkclass {
$this -> show_message($msg);
}
function uploadCatLinkIcon(){
function uploadCatLinkIcon()
{
global $ns, $pref;
$pref['upload_storagetype'] = "1";
require_once(e_HANDLER."upload_handler.php");
@ -402,9 +433,11 @@ class linkclass {
$uploaded = file_upload($pathicon);
$icon = "";
if($uploaded) {
if($uploaded)
{
$icon = $uploaded[0]['name'];
if($_POST['link_cat_resize_value']){
if($_POST['link_cat_resize_value'])
{
require_once(e_HANDLER."resize_handler.php");
resize_image($pathicon.$icon, $pathicon.$icon, $_POST['link_cat_resize_value'], "nocopy");
}
@ -413,135 +446,190 @@ class linkclass {
$this -> show_message($msg);
}
function dbCategoryCreate() {
global $sql, $tp;
function dbCategoryCreate()
{
global $sql, $tp, $admin_log;
$link_t = $sql->db_Count("links_page_cat", "(*)");
$sql->db_Insert("links_page_cat", " '0', '".$tp -> toDB($_POST['link_category_name'])."', '".$tp -> toDB($_POST['link_category_description'])."', '".$tp -> toDB($_POST['link_category_icon'])."', '".($link_t+1)."', '".$tp -> toDB($_POST['link_category_class'])."', '".time()."' ");
$linkData = array();
$linkData['link_category_name'] = $tp -> toDB($_POST['link_category_name']);
$linkData['link_category_description'] = $tp -> toDB($_POST['link_category_description']);
$linkData['link_category_icon'] = $tp -> toDB($_POST['link_category_icon']);
$linkData['link_category_order'] = $link_t+1;
$linkData['link_category_class'] = $tp -> toDB($_POST['link_category_class']);
$linkData['link_category_datestamp'] = time();
$sql->db_Insert("links_page_cat", $linkData);
$admin_log->logArrayAll('LINKS_05',$linkData);
$this->show_message(LCLAN_ADMIN_4);
}
function dbCategoryUpdate() {
function dbCategoryUpdate()
{
global $sql, $tp, $admin_log;
global $sql, $tp;
$time = ($_POST['update_datestamp'] ? time() : ($_POST['link_category_datestamp'] != "0" ? $_POST['link_category_datestamp'] : time()) );
$sql->db_Update("links_page_cat", "link_category_name ='".$tp -> toDB($_POST['link_category_name'])."', link_category_description='".$tp -> toDB($_POST['link_category_description'])."', link_category_icon='".$tp -> toDB($_POST['link_category_icon'])."', link_category_order='".$tp -> toDB($_POST['link_category_order'])."', link_category_class='".$tp -> toDB($_POST['link_category_class'])."', link_category_datestamp='".intval($time)."' WHERE link_category_id='".intval($_POST['link_category_id'])."'");
$linkData = array();
$linkData['link_category_name'] = $tp -> toDB($_POST['link_category_name']);
$linkData['link_category_description'] = $tp -> toDB($_POST['link_category_description']);
$linkData['link_category_icon'] = $tp -> toDB($_POST['link_category_icon']);
$linkData['link_category_order'] = $link_t+1;
$linkData['link_category_class'] = $tp -> toDB($_POST['link_category_class']);
$linkData['link_category_datestamp'] = $time;
$sql->db_UpdateArray("links_page_cat", $linkData," WHERE link_category_id='".intval($_POST['link_category_id'])."'");
$admin_log->logArrayAll('LINKS_06',$linkData);
$this->show_message(LCLAN_ADMIN_5);
}
function dbOrderUpdate($order) {
global $sql;
foreach ($order as $order_id) {
function dbOrderUpdate($order)
{
global $sql, $admin_log;
foreach ($order as $order_id)
{
$tmp = explode(".", $order_id);
$sql->db_Update("links_page", "link_order=".intval($tmp[1])." WHERE link_id=".intval($tmp[0]));
$sql->db_Update("links_page", "link_order=".intval($tmp[1])." WHERE link_id=".intval($tmp[0]));
}
$admin_log->logArrayAll('LINKS_07',$order);
$this->show_message(LCLAN_ADMIN_9);
}
function dbOrderCatUpdate($order) {
global $sql;
foreach ($order as $order_id) {
function dbOrderCatUpdate($order)
{
global $sql, $admin_log;
foreach ($order as $order_id)
{
$tmp = explode(".", $order_id);
$sql->db_Update("links_page_cat", "link_category_order=".intval($tmp[1])." WHERE link_category_id=".intval($tmp[0]));
}
$admin_log->logArrayAll('LINKS_08',$order);
$this->show_message(LCLAN_ADMIN_9);
}
function dbOrderUpdateInc($inc) {
global $sql;
function dbOrderUpdateInc($inc)
{
global $sql, $admin_log;
$tmp = explode(".", $inc);
$linkid = intval($tmp[0]);
$link_order = intval($tmp[1]);
$location = $tmp[2];
if(isset($location)){
$location = intval($location);
$sql->db_Update("links_page", "link_order=link_order+1 WHERE link_order='".($link_order-1)."' AND link_category='$location'");
$sql->db_Update("links_page", "link_order=link_order-1 WHERE link_id='$linkid' AND link_category='$location'");
}else{
$sql->db_Update("links_page_cat", "link_category_order=link_category_order+1 WHERE link_category_order='".($link_order-1)."' ");
$sql->db_Update("links_page_cat", "link_category_order=link_category_order-1 WHERE link_category_id='$linkid' ");
if(isset($tmp[2]))
{
$location = intval($tmp[2]);
$sql->db_Update("links_page", "link_order=link_order+1 WHERE link_order='".($link_order-1)."' AND link_category=".$location);
$sql->db_Update("links_page", "link_order=link_order-1 WHERE link_id='{$linkid}' AND link_category=".$location);
$admin_log->log_event('LINKS_09','ID: '.$location.' -inc- '.$link_order,E_LOG_INFORMATIVE,'');
}
else
{
$sql->db_Update("links_page_cat", "link_category_order=link_category_order+1 WHERE link_category_order=".($link_order-1));
$sql->db_Update("links_page_cat", "link_category_order=link_category_order-1 WHERE link_category_id=".$linkid);
$admin_log->log_event('LINKS_10','ID: '.$linkid.' -inc- '.$link_order,E_LOG_INFORMATIVE,'');
}
}
function dbOrderUpdateDec($dec) {
global $sql;
function dbOrderUpdateDec($dec)
{
global $sql, $admin_log;
$tmp = explode(".", $dec);
$linkid = intval($tmp[0]);
$link_order = intval($tmp[1]);
$location = $tmp[2];
if(isset($location)){
$location = intval($location);
$sql->db_Update("links_page", "link_order=link_order-1 WHERE link_order='".($link_order+1)."' AND link_category='$location'");
$sql->db_Update("links_page", "link_order=link_order+1 WHERE link_id='$linkid' AND link_category='$location'");
}else{
if(isset($tmp[2]))
{
$location = intval($tmp[2]);
$sql->db_Update("links_page", "link_order=link_order-1 WHERE link_order='".($link_order+1)."' AND link_category=".$location);
$sql->db_Update("links_page", "link_order=link_order+1 WHERE link_id='{$linkid}' AND link_category=".$location);
$admin_log->log_event('LINKS_11','ID: '.$location.' -dec- '.$link_order,E_LOG_INFORMATIVE,'');
}
else
{
$sql->db_Update("links_page_cat", "link_category_order=link_category_order-1 WHERE link_category_order='".($link_order+1)."' ");
$sql->db_Update("links_page_cat", "link_category_order=link_category_order+1 WHERE link_category_id='$linkid' ");
$sql->db_Update("links_page_cat", "link_category_order=link_category_order+1 WHERE link_category_id=".$linkid);
$admin_log->log_event('LINKS_12','ID: '.$linkid.' -dec- '.$link_order,E_LOG_INFORMATIVE,'');
}
}
// Create a new link. If $mode == 'submit', link has to go through the approval process; else its admin entry
function dbLinkCreate($mode='')
{
global $ns, $tp, $qs, $sql, $e107cache, $e_event, $linkspage_pref;
global $ns, $tp, $qs, $sql, $e107cache, $e_event, $linkspage_pref, $admin_log;
$link_name = $tp->toDB($_POST['link_name']);
$link_url = $tp->toDB($_POST['link_url']);
$link_description = $tp->toDB($_POST['link_description']);
$link_button = $tp->toDB($_POST['link_but']);
$edata_ls = array(
'link_category' => intval($_POST['cat_id']),
'link_name' => $tp->toDB($_POST['link_name']),
'link_url' => $tp->toDB($_POST['link_url']),
'link_description' => $tp->toDB($_POST['link_description']),
'link_button' => $tp->toDB($_POST['link_but'])
);
if (!$link_name || !$link_url || !$link_description)
if (!$edata_ls['link_name'] || !$edata_ls['link_url'] || !$edata_ls['link_description'])
{
message_handler("ALERT", 5);
return;
message_handler("ALERT", 5);
return;
}
if ($link_url && !strstr($link_url, "http"))
if ($edata_ls['link_url'] && !strstr($edata_ls['link_url'], "http"))
{
$link_url = "http://".$link_url;
$edata_ls['link_url'] = "http://".$edata_ls['link_url'];
}
//create link, submit area, tmp table
if(isset($mode) && $mode == "submit")
{
$username = (defined('USERNAME')) ? USERNAME : LAN_LINKS_3;
$edata_ls['username'] = (defined('USERNAME')) ? USERNAME : LAN_LINKS_3;
$submitted_link = intval($_POST['cat_id'])."^".$link_name."^".$link_url."^".$link_description."^".$link_button."^".$username;
$sql->db_Insert("tmp", "'submitted_link', '".time()."', '$submitted_link' ");
$submitted_link = implode('^', $edata_ls);
$sql->db_Insert("tmp", "'submitted_link', '".time()."', '$submitted_link' ");
$edata_ls = array("link_category" => $_POST['cat_id'], "link_name" => $link_name, "link_url" => $link_url, "link_description" => $link_description, "link_button" => $link_button, "username" => $username, "submitted_link" => $submitted_link);
$e_event->trigger("linksub", $edata_ls);
$edata_ls['submitted_link'] = $submitted_link;
$e_event->trigger("linksub", $edata_ls);
//header("location:".e_SELF."?s");
js_location(e_SELF."?s");
js_location(e_SELF."?s");
}
else
{
{ // Admin-entered link
$link_t = $sql->db_Count("links_page", "(*)", "WHERE link_category='".intval($_POST['cat_id'])."'");
$time = ($_POST['update_datestamp'] ? time() : ($_POST['link_datestamp'] != "0" ? $_POST['link_datestamp'] : time()) );
$edata_ls['link_open'] = intval($_POST['linkopentype']);
$edata_ls['link_class'] =intval(varset($_POST['link_class']));
$edata_ls['link_author'] = USERID; // Default
//update link
if (is_numeric($qs[2]) && $qs[1] != "sn") {
$link_class = $_POST['link_class'];
if($qs[1] == "manage"){
$link_author = USERID;
}else{
$link_author = ($_POST['link_author'] && $_POST['link_author']!='' ? $tp -> toDB($_POST['link_author']) : USERID);
if (is_numeric($qs[2]) && $qs[1] != "sn")
{
if($qs[1]!== "manage")
{
$edata_ls['link_author'] = ($_POST['link_author'] && $_POST['link_author']!='' ? $tp -> toDB($_POST['link_author']) : USERID);
}
$sql->db_Update("links_page", "link_name='$link_name', link_url='$link_url', link_description='$link_description', link_button= '$link_button', link_category='".intval($_POST['cat_id'])."', link_open='".intval($_POST['linkopentype'])."', link_class='".intval($link_class)."', link_datestamp='".intval($time)."', link_author='".$link_author."' WHERE link_id='".intval($qs[2])."'");
$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);
$e107cache->clear("sitelinks");
$this->show_message(LCLAN_ADMIN_3);
//create link
} else {
$sql->db_Insert("links_page", "0, '$link_name', '$link_url', '$link_description', '$link_button', '".intval($_POST['cat_id'])."', '".($link_t+1)."', '0', '".intval($_POST['linkopentype'])."', '".intval($_POST['link_class'])."', '".time()."', '".USERID."' ");
}
else
{
$edata_ls['link_datestamp'] = time();
$edata_ls['link_order'] = $link_t+1;
$sql->db_Insert("links_page", $edata_ls);
$admin_log->logArrayAll('LINKS_13',$edata_ls);
$e107cache->clear("sitelinks");
$this->show_message(LCLAN_ADMIN_2);
}
//delete from tmp table after approval
if (is_numeric($qs[2]) && $qs[1] == "sn") {
$sql->db_Delete("tmp", "tmp_time='".intval($qs[2])."' ");
if (is_numeric($qs[2]) && $qs[1] == "sn")
{
$sql->db_Delete("tmp", "tmp_time=".intval($qs[2]));
}
}
}
function show_link_create() {
function show_link_create()
{
global $sql, $rs, $qs, $ns, $fl, $linkspage_pref;
$row['link_category'] = "";
@ -553,13 +641,16 @@ class linkclass {
$row['link_class'] = "";
$link_resize_value = (isset($linkspage_pref['link_resize_value']) && $linkspage_pref['link_resize_value'] ? $linkspage_pref['link_resize_value'] : "100");
if (isset($qs[1]) && $qs[1] == 'edit' && !isset($_POST['submit'])) {
if ($sql->db_Select("links_page", "*", "link_id='".intval($qs[2])."' ")) {
if (isset($qs[1]) && $qs[1] == 'edit' && !isset($_POST['submit']))
{
if ($sql->db_Select("links_page", "*", "link_id='".intval($qs[2])."' "))
{
$row = $sql->db_Fetch();
}
}
if (isset($qs[1]) && $qs[1] == 'sn') {
if (isset($qs[1]) && $qs[1] == 'sn')
{
if ($sql->db_Select("tmp", "*", "tmp_time='".intval($qs[2])."'")) {
$row = $sql->db_Fetch();
$submitted = explode("^", $row['tmp_info']);
@ -1433,7 +1524,8 @@ class linkclass {
$ns->tablerender(LCLAN_OPT_2, $text);
}
function pref_submit() {
function pref_submit()
{
global $rs;
$text = "
<tr>

View File

@ -1,5 +1,10 @@
<?php
if (!defined('e107_INIT')) { exit; }
if (!plugInstalled('links_page'))
{
return '';
}
unset($text);
require_once(e_PLUGIN.'links_page/link_class.php');
@ -8,8 +13,7 @@ require_once(e_HANDLER."form_handler.php");
$rs = new form;
global $tp;
$lan_file = e_PLUGIN."links_page/languages/".e_LANGUAGE.".php";
include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."links_page/languages/English.php");
@include_lan(e_PLUGIN."links_page/languages/".e_LANGUAGE.".php");
$bullet = "<img src='".THEME_ABS."images/bullet2.gif' alt='' style='border:0;' />";
global $linkspage_pref;
@ -18,9 +22,10 @@ $linkspage_pref = $lc -> getLinksPagePref();
//navigator -------------------------
$mains = "";
$text = "";
$baseurl = e_PLUGIN."links_page/links.php";
$baseurl = e_PLUGIN_ABS."links_page/links.php";
if(isset($linkspage_pref['link_menu_navigator_frontpage']) && $linkspage_pref['link_menu_navigator_frontpage']){
if(isset($linkspage_pref['link_menu_navigator_rendertype']) && $linkspage_pref['link_menu_navigator_rendertype'] == "1"){
if(isset($linkspage_pref['link_menu_navigator_rendertype']) && $linkspage_pref['link_menu_navigator_rendertype'] == "1")
{
$mains .= $rs -> form_option(LAN_LINKS_14, "0", $baseurl, "");
}else{
$mains .= $bullet." <a href='".$baseurl."'>".LAN_LINKS_14."</a><br />";

View File

@ -11,12 +11,17 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/links_page/links.php,v $
| $Revision: 1.11 $
| $Date: 2008-11-18 22:03:32 $
| $Revision: 1.12 $
| $Date: 2008-12-13 16:06:11 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
require_once('../../class2.php');
if (!plugInstalled('links_page'))
{
header("location:".e_BASE."index.php");
exit;
}
require_once(e_HANDLER."rate_class.php");
$rater = new rater;
@ -42,28 +47,32 @@ $deltest = array_flip($_POST);
if(e_QUERY){
$qs = explode(".", e_QUERY);
if(is_numeric($qs[0])){
if(is_numeric($qs[0]))
{
$from = array_shift($qs);
}else{
}
else
{
$from = "0";
}
}
if (file_exists(e_PLUGIN."links_page/languages/".e_LANGUAGE.".php")) {
include_once(e_PLUGIN."links_page/languages/".e_LANGUAGE.".php");
} else {
include_once(e_PLUGIN."links_page/languages/English.php");
}
@include_lan(e_PLUGIN."links_page/languages/".e_LANGUAGE.".php");
$lc -> setPageTitle();
//submit comment
if (isset($_POST['commentsubmit'])) {
if (!$sql->db_Select("links_page", "link_id", "link_id = '".intval($qs[1])."' ")) {
if (isset($_POST['commentsubmit']))
{
if (!$sql->db_Select("links_page", "link_id", "link_id = '".intval($qs[1])."' "))
{
header("location:".e_BASE."index.php");
exit;
} else {
}
else
{
$row = $sql->db_Fetch();
if ($row[0] && (ANON === TRUE || USER === TRUE)) {
if ($row[0] && (ANON === TRUE || USER === TRUE))
{
$cobj->enter_comment($_POST['author_name'], $_POST['comment'], "links_page", $qs[1], $pid, $_POST['subject']);
$e107cache->clear("comment.links_page.{$qs[1]}");
}
@ -85,50 +94,71 @@ if (isset($qs[0]) && $qs[0] == "view" && isset($qs[1]) && is_numeric($qs[1]))
require_once(HEADERF);
if (is_readable(THEME."links_template.php")) {
if (is_readable(THEME."links_template.php"))
{
require_once(THEME."links_template.php");
} else {
}
else
{
require_once(e_PLUGIN."links_page/links_template.php");
}
//submit / manage link
if (isset($_POST['add_link'])) {
if (isset($_POST['add_link']))
{
if($qs[0] == "submit"){
if(check_class($linkspage_pref['link_submit_class'])){
if(isset($linkspage_pref['link_submit_directpost']) && $linkspage_pref['link_submit_directpost']){
if(check_class($linkspage_pref['link_submit_class']))
{
if(isset($linkspage_pref['link_submit_directpost']) && $linkspage_pref['link_submit_directpost'])
{
$lc -> dbLinkCreate();
}else{
}
else
{
$lc -> dbLinkCreate("submit");
}
}else{
}
else
{
js_location(e_SELF);
}
}
if($qs[0] == "manage"){
if(check_class($linkspage_pref['link_manager_class'])){
if($qs[0] == "manage")
{
if(check_class($linkspage_pref['link_manager_class']))
{
$lc->verify_link_manage($qs[2]);
if(isset($linkspage_pref['link_directpost']) && $linkspage_pref['link_directpost']){
if(isset($linkspage_pref['link_directpost']) && $linkspage_pref['link_directpost'])
{
$lc -> dbLinkCreate();
}else{
}
else
{
$lc -> dbLinkCreate("submit");
}
}else{
}
else
{
js_location(e_SELF);
}
}
}
//message submitted link
if(isset($qs[0]) && $qs[0] == "s"){
if(isset($qs[0]) && $qs[0] == "s")
{
$lc->show_message(LAN_LINKS_29, LAN_LINKS_28);
}
$qsorder = FALSE;
if(isset($qs[0]) && substr($qs[0],0,5) == "order"){
if(isset($qs[0]) && substr($qs[0],0,5) == "order")
{
$qsorder = TRUE;
}
//show all categories
if((!isset($qs[0]) || $qsorder) && $linkspage_pref['link_page_categories']){
if((!isset($qs[0]) || $qsorder) && $linkspage_pref['link_page_categories'])
{
echo displayNavigator('cat');
displayCategory();
}

View File

@ -1,111 +0,0 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| ©Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/links_page/plugin.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:24 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
// Plugin info -------------------------------------------------------------------------------------------------------
@include_once(e_PLUGIN.'links_page/link_defines.php');
@include_once(e_PLUGIN.'links_page/languages/'.e_LANGUAGE.'.php');
@include_once(e_PLUGIN.'links_page/languages/English.php');
$eplug_name = "LCLAN_PLUGIN_LAN_1";
$eplug_version = "1.12";
$eplug_author = "e107devs";
$eplug_url = "http://e107.org";
$eplug_email = "";
$eplug_description = LCLAN_PLUGIN_LAN_2;
$eplug_compatible = "e107v0.7+";
$eplug_readme = "";
$eplug_latest = TRUE; //Show reported threads in admin (use e_latest.php)
$eplug_status = TRUE; //Show post count in admin (use e_status.php)
// Name of the plugin's folder -------------------------------------------------------------------------------------
$eplug_folder = "links_page";
// Name of menu item for plugin ----------------------------------------------------------------------------------
$eplug_menu_name = "";
// Name of the admin configuration file --------------------------------------------------------------------------
$eplug_conffile = "admin_linkspage_config.php";
// Icon image and caption text ------------------------------------------------------------------------------------
$eplug_icon = $eplug_folder."/images/linkspage_32.png";
$eplug_icon_small = $eplug_folder."/images/linkspage_16.png";
$eplug_caption = LCLAN_PLUGIN_LAN_3;
// List of preferences -----------------------------------------------------------------------------------------------
$eplug_prefs = array();
// List of table names -----------------------------------------------------------------------------------------------
$eplug_table_names = array(
"links_page_cat",
"links_page" );
// List of sql requests to create tables -----------------------------------------------------------------------------
$eplug_tables = array(
"CREATE TABLE ".MPREFIX."links_page_cat (
link_category_id int(10) unsigned NOT NULL auto_increment,
link_category_name varchar(100) NOT NULL default '',
link_category_description varchar(250) NOT NULL default '',
link_category_icon varchar(100) NOT NULL default '',
link_category_order int(10) unsigned NOT NULL default '0',
link_category_class varchar(100) NOT NULL default '0',
link_category_datestamp int(10) unsigned NOT NULL default '0',
PRIMARY KEY (link_category_id)
) TYPE=MyISAM;",
"CREATE TABLE ".MPREFIX."links_page (
link_id int(10) unsigned NOT NULL auto_increment,
link_name varchar(100) NOT NULL default '',
link_url varchar(200) NOT NULL default '',
link_description text NOT NULL,
link_button varchar(100) NOT NULL default '',
link_category tinyint(3) unsigned NOT NULL default '0',
link_order int(10) unsigned NOT NULL default '0',
link_refer int(10) unsigned NOT NULL default '0',
link_open tinyint(1) unsigned NOT NULL default '0',
link_class tinyint(3) unsigned NOT NULL default '0',
link_datestamp int(10) unsigned NOT NULL default '0',
link_author varchar(255) NOT NULL default '',
PRIMARY KEY (link_id)
) TYPE=MyISAM;" );
// Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
$eplug_link = TRUE;
$eplug_link_name = LCLAN_PAGETITLE_1;
$eplug_link_url = e_PLUGIN."links_page/links.php";
// Text to display after plugin successfully installed ------------------------------------------------------------------
$eplug_done = LCLAN_PLUGIN_LAN_5;
$upgrade_add_prefs = "";
$upgrade_remove_prefs = "";
// upgrading ... //
$upgrade_alter_tables = array(
"ALTER TABLE ".MPREFIX."links_page ADD link_datestamp int(10) unsigned NOT NULL default '0'",
"ALTER TABLE ".MPREFIX."links_page ADD link_author varchar(255) NOT NULL default ''",
"ALTER TABLE ".MPREFIX."links_page_cat ADD link_category_order int(10) unsigned NOT NULL default '0'",
"ALTER TABLE ".MPREFIX."links_page_cat ADD link_category_class varchar(100) NOT NULL default '0'",
"ALTER TABLE ".MPREFIX."links_page_cat ADD link_category_datestamp int(10) unsigned NOT NULL default '0'"
);
$eplug_upgrade_done = LCLAN_PLUGIN_LAN_6.': '.$eplug_version;
?>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Id: plugin.xml,v 1.1 2008-12-13 16:06:11 e107steved Exp $ -->
<e107Plugin name="LCLAN_PLUGIN_LAN_1" version="1.12" compatibility="0.8" installRequired="true">
<author name="e107devs" url="http://e107.org" />
<description>Links Page For Displaying External Web Links</description>
<folder>links_page</folder>
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
<administration>
<configFile>admin_linkspage_config.php</configFile>
<icon>images/linkspage_32.png</icon>
<iconSmall>images/linkspage_16.png</iconSmall>
<caption>Configure Links Page</caption>
<installDone>Links page has successfully installed, please configure it from the Links Page link on the admin front page.</installDone>
</administration>
<menuLink name="Links" url="links_page/links.php" />
<mainPrefs>
</mainPrefs>
</e107Plugin>