1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

gsitemap - plugin.xml, admin logging

This commit is contained in:
e107steved 2008-12-20 21:48:06 +00:00
parent 8b83953ff8
commit 8b43545212
8 changed files with 229 additions and 186 deletions

View File

@ -1,26 +1,28 @@
<?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/gsitemap/admin_config.php,v $
| $Revision: 1.3 $
| $Date: 2007-06-14 19:23:23 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Plugin Administration - gsitemap
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/gsitemap/admin_config.php,v $
* $Revision: 1.4 $
* $Date: 2008-12-20 21:48:06 $
* $Author: e107steved $
*
*/
require_once("../../class2.php");
if(!getperms("P")){ header("location:".e_BASE."index.php"); }
if(!getperms("P") || !plugInstalled('gsitemap'))
{
header("location:".e_BASE."index.php");
exit();
}
require_once(e_ADMIN."auth.php");
require_once(e_HANDLER."userclass_class.php");
include_lan(e_PLUGIN."gsitemap/languages/gsitemap_".e_LANGUAGE.".php");
include_lan(e_PLUGIN."gsitemap/languages/".e_LANGUAGE."_admin_gsitemap.php");
$gsm = new gsitemap;
@ -32,8 +34,6 @@ class gsitemap
var $message;
var $freq_list = array();
/*+----------------------#######################################################################################---------------------+*/
function gsitemap()
{
/* constructor */
@ -94,7 +94,6 @@ class gsitemap
}
}
/*+----------------------#######################################################################################---------------------+*/
function showList()
{
@ -163,7 +162,6 @@ class gsitemap
$ns -> tablerender("<div style='text-align:center'>".GSLAN_24."</div>", $text);
}
/*+----------------------#######################################################################################---------------------+*/
function editSme()
{
@ -180,7 +178,7 @@ class gsitemap
}
}
/*+----------------------#######################################################################################---------------------+*/
function doForm($editArray=FALSE)
{
@ -230,7 +228,8 @@ class gsitemap
<td class='forumheader3'>
<select class='tbox' name='gsitemap_priority' >\n";
for ($i=0.1; $i<1.0; $i=$i+0.1) {
for ($i=0.1; $i<1.0; $i=$i+0.1)
{
$sel = ($editArray['gsitemap_priority'] == number_format($i,1))? "selected='selected'" : "";
$text .= "<option value='".number_format($i,1)."' $sel>".number_format($i,1)."</option>\n";
};
@ -280,39 +279,49 @@ class gsitemap
";
$ns -> tablerender("<div style='text-align:center'>".GSLAN_29."</div>", $text);
}
/*+----------------------#######################################################################################---------------------+*/
function addLink()
{
global $sql, $tp;
$gsitemap_name = $tp -> toDB($_POST['gsitemap_name']);
$gsitemap_url = $tp -> toDB($_POST['gsitemap_url']);
global $sql, $tp, $admin_log;
$gmap = array(
'gsitemap_name' => $tp->toDB($_POST['gsitemap_name']),
'gsitemap_url' => $tp->toDB($_POST['gsitemap_url']),
'gsitemap_priority' => $_POST['gsitemap_priority'],
'gsitemap_lastmod' => $_POST['gsitemap_lastmod'],
'gsitemap_freq' => $_POST['gsitemap_freq'],
'gsitemap_order' => $_POST['gsitemap_order'],
'gsitemap_active' => $_POST['gsitemap_active']
);
if(isset($_POST['gsitemap_id']))
{
$this -> message = $sql -> db_Update("gsitemap", "gsitemap_name='$gsitemap_name', gsitemap_url='$gsitemap_url', gsitemap_priority='".$_POST['gsitemap_priority']."', gsitemap_lastmod='".$_POST['gsitemap_lastmod']."', gsitemap_freq= '".$_POST['gsitemap_freq']."', gsitemap_order='".$_POST['gsitemap_order']."', gsitemap_active='".$_POST['gsitemap_active']."' WHERE gsitemap_id='".$_POST['gsitemap_id']."' ") ? LAN_UPDATED : LAN_UPDATED_FAILED;
$this -> message = $sql -> db_UpdateArray("gsitemap", $gmap, ' WHERE gsitemap_id= '.intval($_POST['gsitemap_id'])) ? LAN_UPDATED : LAN_UPDATED_FAILED;
$admin_log->logArrayAll('GSMAP_04',$gmap);
}
else
{
$this -> message = ($sql -> db_Insert("gsitemap", "0, '".$_POST['gsitemap_name']."', '".$gsitemap_url."', '".$_POST['gsitemap_lastmod']."', '".$_POST['gsitemap_freq']."', '".$_POST['gsitemap_priority']."', '".$_POST['gsitemap_cat']."', '".$_POST['gsitemap_order']."', '".$_POST['gsitemap_img']."', '".$_POST['gsitemap_active']."' ")) ? LAN_CREATED : LAN_CREATED_FAILED;
$gmap['gsitemap_img'] = $_POST['gsitemap_img'];
$gmap['gsitemap_cat'] = $_POST['gsitemap_cat'];
$this -> message = ($sql -> db_Insert('gsitemap',$gmap)) ? LAN_CREATED : LAN_CREATED_FAILED;
$admin_log->logArrayAll('GSMAP_03',$gmap);
}
}
/*+----------------------#######################################################################################---------------------+*/
function deleteSme()
{
global $sql;
global $sql, $admin_log;
$d_idt = array_keys($_POST['delete']);
$this -> message = ($sql -> db_Delete("gsitemap", "gsitemap_id='".$d_idt[0]."'")) ? LAN_DELETED : LAN_DELETED_FAILED;
$admin_log->log_event('GSMAP_02',$this->message.': '.$d_idt[0], E_LOG_INFORMATIVE,'');
}
/*+----------------------#######################################################################################---------------------+*/
// Import site links
function importSme()
{
global $sql, $sql2, $PLUGINS_DIRECTORY, $ns;
@ -343,39 +352,40 @@ class gsitemap
/* forums ... */
$sql -> db_Select("forum", "*", "forum_parent!='0' ORDER BY forum_order ASC");
$nfArray = $sql -> db_getList();
foreach($nfArray as $row)
{
if(!$sql -> db_Select("gsitemap", "*", "gsitemap_name='".$row['forum_name']."' "))
if(plugInstalled('forum'))
{
$sql -> db_Select("forum", "*", "forum_parent!='0' ORDER BY forum_order ASC");
$nfArray = $sql -> db_getList();
foreach($nfArray as $row)
{
$importArray[] = array('name' => $row['forum_name'], 'url' => $PLUGINS_DIRECTORY."forum/forum_viewforum.php?".$row['forum_id'], 'type' => "Forum");
if(!$sql -> db_Select("gsitemap", "*", "gsitemap_name='".$row['forum_name']."' "))
{
$importArray[] = array('name' => $row['forum_name'], 'url' => $PLUGINS_DIRECTORY."forum/forum_viewforum.php?".$row['forum_id'], 'type' => "Forum");
}
}
}
/* content pages ... */
$sql -> db_Select("pcontent", "content_id, content_heading", "LEFT(content_parent,1) = '0' ORDER BY content_heading");
$nfArray = $sql -> db_getList();
foreach($nfArray as $row)
{
$sql2 -> db_Select("pcontent", "content_id, content_heading", "content_parent = '".$row['content_id']."' AND content_refer != 'sa' ORDER BY content_heading");
$nfArray2 = $sql2 -> db_getList();
foreach($nfArray2 as $row2)
if(plugInstalled('content'))
{
$sql -> db_Select("pcontent", "content_id, content_heading", "LEFT(content_parent,1) = '0' ORDER BY content_heading");
$nfArray = $sql -> db_getList();
foreach($nfArray as $row)
{
if(!$sql -> db_Select("gsitemap", "*", "gsitemap_name='".$row2['content_heading']."' "))
$sql2 -> db_Select("pcontent", "content_id, content_heading", "content_parent = '".$row['content_id']."' AND content_refer != 'sa' ORDER BY content_heading");
$nfArray2 = $sql2 -> db_getList();
foreach($nfArray2 as $row2)
{
$importArray[] = array('name' => $row2['content_heading'], 'url' => $PLUGINS_DIRECTORY."content/content.php?content.".$row2['content_id'], 'type' => $row['content_heading']);
if(!$sql -> db_Select("gsitemap", "*", "gsitemap_name='".$row2['content_heading']."' "))
{
$importArray[] = array('name' => $row2['content_heading'], 'url' => $PLUGINS_DIRECTORY."content/content.php?content.".$row2['content_id'], 'type' => $row['content_heading']);
}
}
}
}
/* end */
$text = "
<form action='".e_SELF."' id='form' method='post'>
<table style='".ADMIN_WIDTH."' class='fborder'>
@ -404,17 +414,13 @@ class gsitemap
";
}
$text .= "
<tr>
<td colspan='4' style='text-align:center' class='forumheader'>
<div> ".GSLAN_8." &nbsp; ".GSLAN_9." :&nbsp;<select class='tbox' name='import_priority' >\n";
for ($i=0.1; $i<1.0; $i=$i+0.1) {
for ($i=0.1; $i<1.0; $i=$i+0.1)
{
$sel = ($editArray['gsitemap_priority'] == number_format($i,1))? "selected='selected'" : "";
$text .= "<option value='".number_format($i,1)."' $sel>".number_format($i,1)."</option>\n";
};
@ -423,15 +429,14 @@ class gsitemap
<select class='tbox' name='import_freq' >\n";
foreach($this->freq_list as $k=>$fq){
foreach($this->freq_list as $k=>$fq)
{
$sel = ($editArray['gsitemap_freq'] == $k)? "selected='selected'" : "";
$text .= "<option value='$k' $sel>$fq</option>\n";
$text .= "<option value='{$k}' {$sel}>{$fq}</option>\n";
}
$text.="</select> <br /><br />
</div>
<input class='button' type='submit' name='import_links' value='".GSLAN_18."' />
</td>
@ -443,11 +448,11 @@ class gsitemap
$ns -> tablerender("<div style='text-align:center'>".GSLAN_7."</div>", $text);
}
/*+----------------------#######################################################################################---------------------+*/
function importLink()
{
global $sql, $tp;
global $sql, $tp, $admin_log;
foreach($_POST['importid'] as $import)
{
list($name, $url, $type) = explode("^", $import);
@ -456,9 +461,10 @@ class gsitemap
$sql -> db_Insert("gsitemap", "0, '$name', '$url', '".time()."', '".$_POST['import_freq']."', '".$_POST['import_priority']."', '$type', '0', '', '0' ");
}
$this -> message = count($_POST['importid'])." link(s) imported.";
$admin_log->log_event('GSMAP_01',$this->message, E_LOG_INFORMATIVE,'');
}
/*+----------------------#######################################################################################---------------------+*/
function instructions()
{
@ -475,18 +481,16 @@ class gsitemap
";
$ns -> tablerender("<div style='text-align:center'>".GSLAN_32."</div>", $text);
}
/*+----------------------#######################################################################################---------------------+*/
}
require_once(e_ADMIN."footer.php");
function admin_config_adminmenu() {
function admin_config_adminmenu()
{
$action = (e_QUERY) ? e_QUERY : "list";
$var['list']['text'] = GSLAN_20;
$var['list']['link'] = e_SELF;

View File

@ -1,6 +1,25 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Plugin configuration module - gsitemap
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/gsitemap/e_cron.php,v $
* $Revision: 1.2 $
* $Date: 2008-12-20 21:48:06 $
* $Author: e107steved $
*
*/
if (!defined('e107_INIT')) { exit; }
if(!plugInstalled('gsitemap'))
{
return;
}
// -------- e_cron setup -----------------------------------------------------

View File

@ -1,10 +1,29 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Plugin configuration module - gsitemap
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/gsitemap/e_module.php,v $
* $Revision: 1.3 $
* $Date: 2008-12-20 21:48:06 $
* $Author: e107steved $
*
*/
if (!defined('e107_INIT')) { exit; }
if(!plugInstalled('gsitemap'))
{
return '';
}
global $e_event,$e107cache,$ns;
$e_event->register("newspost", "pingit");
$e_event->register("newsupd", "pingit");
// $e_event->register("newspost", "pingit");
// $e_event->register("newsupd", "pingit"); // Disable these for now, until admin functions written
function pingit($vals)
{

View File

@ -0,0 +1,70 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Plugin language file - gsitemap
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/gsitemap/languages/English_admin_gsitemap.php,v $
* $Revision: 1.1 $
* $Date: 2008-12-20 21:48:06 $
* $Author: e107steved $
*
*/
define("GSLAN_Name", "Sitemap");
define("GSLAN_1", "Site Link");
define("GSLAN_2", "Import?");
define("GSLAN_3", "Type");
define("GSLAN_4", "Name");
define("GSLAN_5", "Url");
define("GSLAN_6", "Tick links to mark them for import ...");
define("GSLAN_7", "Import Links");
define("GSLAN_8", "Import with:");
define("GSLAN_9", "Priority");
define("GSLAN_10", "Frequency");
define("GSLAN_11", "always");
define("GSLAN_12", "hourly");
define("GSLAN_13", "daily");
define("GSLAN_14", "weekly");
define("GSLAN_15", "monthly");
define("GSLAN_16", "yearly");
define("GSLAN_17", "never");
define("GSLAN_18", "Import ticked links");
define("GSLAN_19", "Google Sitemap");
define("GSLAN_20", "Listing");
define("GSLAN_21", "Instructions");
define("GSLAN_22", "Create New Entry");
define("GSLAN_23", "Import");
define("GSLAN_24", "Google Sitemap Entries");
define("GSLAN_25", "Name");
define("GSLAN_26", "URL");
define("GSLAN_27", "Lastmod");
define("GSLAN_28", "Freq.");
define("GSLAN_29", "Google Sitemap Configuration");
define("GSLAN_30", "Display Order");
define("GSLAN_31", "Visible to");
define("GSLAN_32", "How to use Google Sitemaps");
define("GSLAN_33", "GSiteMap Instructions");
define("GSLAN_34", "First, create the links you wish to have listed in your sitemap. You can import most of your links by clicking the 'Import' button on the right");
define("GSLAN_35", "If you've chosen to import your links, click 'Import' and then check the links you wish to import");
define("GSLAN_36", "You can also enter individual links manually by clicking 'Create New Entry'");
define("GSLAN_37", "Once you have some entries, go to <a href='https://www.google.com/webmasters/sitemaps/stats'>https://www.google.com/webmasters/sitemaps/stats</a> and enter the following URL -> <b>".SITEURL."gsitemap.php</b> - if this url doesn't look right to you, please make sure your site url is correct in admin -> preferences");
define("GSLAN_38", "For more information on Google Sitemap protocol, go to <a href='http://www.google.com/webmasters/sitemaps/docs/en/protocol.html'>http://www.google.com/webmasters/sitemaps/docs/en/protocol.html</a>.");
define("GSLAN_39", "No links in sitemap - import sitelinks?");
define("GSLAN_40", "Google Sitemap Entries");
define('GSLAN_41', "Google Sitemap. For more information on the Google Sitemap protocol, go to <a href='http://www.google.com/webmasters/sitemaps/docs/en/protocol.html'>http://www.google.com/webmasters/sitemaps/docs/en/protocol.html</a>");
define('GSLAN_42', 'Installation Successful..');
// Admin log messages
//-------------------
define('LAN_AL_GSMAP_01', 'Import sitelinks');
define('LAN_AL_GSMAP_02', 'Sitemap link deleted');
define('LAN_AL_GSMAP_03', 'Sitemap link added');
define('LAN_AL_GSMAP_04', 'Sitemap link updated');
define('LAN_AL_GSMAP_05', '');
?>

View File

@ -1,22 +1,22 @@
<?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/gsitemap/languages/gsitemap_English.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:20 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Plugin language file - gsitemap
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/gsitemap/languages/gsitemap_English.php,v $
* $Revision: 1.2 $
* $Date: 2008-12-20 21:48:06 $
* $Author: e107steved $
*
*/
define("GSLAN_Name", "Sitemap");
/*
define("GSLAN_1", "Site Link");
define("GSLAN_2", "Import?");
define("GSLAN_3", "Type");
@ -57,5 +57,6 @@ define("GSLAN_37", "Once you have some entries, go to <a href='https://www.googl
define("GSLAN_38", "For more information on Google Sitemap protocol, go to <a href='http://www.google.com/webmasters/sitemaps/docs/en/protocol.html'>http://www.google.com/webmasters/sitemaps/docs/en/protocol.html</a>.");
define("GSLAN_39", "No links in sitemap - import sitelinks?");
define("GSLAN_40", "Google Sitemap Entries");
*/
?>

View File

@ -1,98 +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/gsitemap/plugin.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:19 $
| $Author: mcfly_e107 $
+---------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
// Plugin info -------------------------------------------------------------------------------------------------------
$eplug_name = "Google Sitemap";
$eplug_version = "1.0";
$eplug_author = "cameron / jalist";
$eplug_url = "http://e107coders.org";
$eplug_email = "cameron@e107coders.org";
$eplug_description = "Google Sitemap. For more information on the Google Sitemap protocol, go to <a href='http://www.google.com/webmasters/sitemaps/docs/en/protocol.html'>http://www.google.com/webmasters/sitemaps/docs/en/protocol.html</a>";
$eplug_compatible = "e107 v0.7";
$eplug_readme = ""; // leave blank if no readme file
// Name of the plugin's folder -------------------------------------------------------------------------------------
$eplug_folder = "gsitemap";
// Mane of menu item for plugin ----------------------------------------------------------------------------------
$eplug_menu_name = "";
// Name of the admin configuration file --------------------------------------------------------------------------
$eplug_conffile = "admin_config.php";
// Icon image and caption text ------------------------------------------------------------------------------------
$eplug_icon = $eplug_folder."/images/icon.png";
$eplug_icon_small = $eplug_folder."/images/icon_16.png";
$eplug_logo = $eplug_folder."/images/icon.png";
$eplug_caption = "Configure Sitemap";
// List of preferences -----------------------------------------------------------------------------------------------
$eplug_prefs = "";
$eplug_module = TRUE;
$eplug_table_names = array("gsitemap");
// List of sql requests to create tables -----------------------------------------------------------------------------
$eplug_tables = array("
CREATE TABLE ".MPREFIX."gsitemap (
gsitemap_id int(11) unsigned NOT NULL auto_increment,
gsitemap_name varchar(200) NOT NULL default '',
gsitemap_url varchar(200) NOT NULL default '',
gsitemap_lastmod varchar(15) NOT NULL default '',
gsitemap_freq varchar(10) NOT NULL default '',
gsitemap_priority char(3) NOT NULL default '',
gsitemap_cat varchar(100) NOT NULL default '',
gsitemap_order int(3) NOT NULL default '0',
gsitemap_img varchar(50) NOT NULL default '',
gsitemap_active int(3) NOT NULL default '0',
PRIMARY KEY (gsitemap_id)
) TYPE=MyISAM;"
);
// Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
$eplug_link = TRUE;
$eplug_link_name = "Sitemap";
$eplug_link_url = "gsitemap.php?show";
// Text to display after plugin successfully installed ------------------------------------------------------------------
$eplug_done = "Installation Successful..";
$eplug_uninstall_done = "You should delete gsitemap.php from your root directory.";
// upgrading ... //
$upgrade_add_prefs = "";
$upgrade_remove_prefs = "";
$upgrade_alter_tables = "";
$eplug_upgrade_done = "";
?>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Id: plugin.xml,v 1.1 2008-12-20 21:48:06 e107steved Exp $ -->
<e107Plugin name="GSLAN_19" version="1.0" compatibility="0.8" installRequired="true">
<author name="cameron / jalist" url="http://e107coders.org" email="cameron@e107coders.org" />
<description>GSLAN_41</description>
<logLanguageFile filename="languages/--LAN--_admin_gsitemap.php" />
<folder>gsitemap</folder>
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
<administration>
<configFile>admin_config.php</configFile>
<icon>images/icon.png</icon>
<iconSmall>images/icon_16.png</iconSmall>
<caption>Configure Sitemap</caption>
<installDone>GSLAN_42</installDone>
</administration>
<menuLink name="Sitemap" url="/gsitemap.php?show" />
<mainPrefs>
</mainPrefs>
</e107Plugin>

View File

@ -38,6 +38,13 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
if(!plugInstalled('gsitemap'))
{
header("location:".e_BASE."index.php");
exit();
}
// include the XML-RPC class library
require_once('xmlrpc/xmlrpc.inc');