1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-27 00:05:46 +02:00

Outdated ping functions removed from news and gsitemap. xmlrpc classes removed.

This commit is contained in:
Cameron
2020-12-05 12:39:50 -08:00
parent 645c05cfbf
commit 68e251d771
8 changed files with 25 additions and 6429 deletions

View File

@@ -1,4 +1,4 @@
<?php
<?php /** @noinspection PhpMissingFieldTypeInspection */
/*
* e107 website system
*
@@ -26,10 +26,10 @@ $gsm = new gsitemap;
class gsitemap
{
var $message;
var $error;
var $errortext;
var $freq_list = array();
protected $message;
protected $error;
protected $errortext;
protected $freq_list = array();
//function gsitemap()
function __construct()
@@ -120,7 +120,7 @@ class gsitemap
$text = "
<form action='".e_SELF."?import' id='import' method='post'>
".GSLAN_39."<br /><br />"
.$frm->admin_button('import',LAN_YES,'submit')."
.$frm->admin_button('import',LAN_YES)."
</form>";
$mes->addInfo($text);
@@ -255,9 +255,9 @@ class gsitemap
{
$sel = ($editArray['gsitemap_priority'] == number_format($i,1))? "selected='selected'" : "";
$text .= "<option value='".number_format($i,1)."' $sel>".number_format($i,1)."</option>\n";
};
}
$text.="</select></td>
$text.="</select></td>
</tr>
<tr>
<td>".LAN_ORDER."</td>
@@ -332,8 +332,8 @@ class gsitemap
// Inserting new record
else
{
$gmap['gsitemap_img'] = vartrue($_POST['gsitemap_img'], '');
$gmap['gsitemap_cat'] = vartrue($_POST['gsitemap_cat'], '');
$gmap['gsitemap_img'] = vartrue($_POST['gsitemap_img']);
$gmap['gsitemap_cat'] = vartrue($_POST['gsitemap_cat']);
if($sql->insert('gsitemap', $gmap))
{
@@ -360,7 +360,7 @@ class gsitemap
if($sql->delete("gsitemap", "gsitemap_id='".$d_idt[0]."'"))
{
$this->message = LAN_DELETED;
$log->log_event('GSMAP_02', $this->message.': '.$d_idt[0], E_LOG_INFORMATIVE,'');
$log->log_event('GSMAP_02', $this->message.': '.$d_idt[0]);
}
else
{
@@ -381,7 +381,7 @@ class gsitemap
$mes = e107::getMessage();
$existing = array();
$sql->select("gsitemap", "*");
$sql->select("gsitemap");
while($row = $sql->fetch())
{
$existing[] = $row['gsitemap_name'];
@@ -502,12 +502,14 @@ class gsitemap
</table>
<div class='buttons-bar center'>
".
$frm->admin_button('import_links',GSLAN_18,'submit')."
$frm->admin_button('import_links',GSLAN_18)."
</div>
</form>
";
$ns->tablerender(GSLAN_7, $mes->render(). $text);
unset($PLUGINS_DIRECTORY);
}
@@ -529,7 +531,7 @@ class gsitemap
}
$this->message = count($_POST['importid'])." link(s) imported.";
$log->log_event('GSMAP_01',$this->message, E_LOG_INFORMATIVE,'');
$log->log_event('GSMAP_01',$this->message);
}
@@ -573,7 +575,7 @@ class gsitemap
require_once(e_ADMIN."footer.php");
// loaded automatically.
function admin_config_adminmenu()
{
$action = (e_QUERY) ? e_QUERY : "list";

View File

@@ -1,4 +1,4 @@
<?php
<?php /** @noinspection PhpMissingReturnTypeInspection */
/*
* e107 website system
*
@@ -42,7 +42,6 @@ class gsitemap_cron // include plugin-folder in the name.
{
// Whatever code you wish.
e107::getMessage()->add("Executed dummy function within gsitemap/e_cron.php");
return ;
}

View File

@@ -21,30 +21,7 @@ if(!e107::isInstalled('gsitemap'))
return '';
}
global $e_event,$e107cache,$ns;
// $e_event->register("newspost", "pingit");
// $e_event->register("newsupd", "pingit"); // Disable these for now, until admin functions written
function pingit($vals)
{
global $admin_log;
require(e_PLUGIN."gsitemap/weblog_pinger.php");
$pinger = new Weblog_Pinger();
// $pinger->ping_ping_o_matic("Ekzemplo", "http://www.ekzemplo.com/");
$xml_rpc_server = "blogsearch.google.com";
$xml_rpc_port = 80;
$xml_rpc_path = "/ping/RPC2";
$xml_rpc_method = "weblogUpdates.extendedPing";
$weblog_name = SITENAME;
$weblog_url = $_SERVER['HTTP_HOST'].e_HTTP;
$changes_url = $_SERVER['HTTP_HOST'].e_HTTP."news.php?extend.".$vals['news_id'];
$cat_or_rss = $_SERVER['HTTP_HOST'].e_PLUGIN_ABS."rss_menu/rss.php?1.2";
$extended = TRUE;
$pinger->ping($xml_rpc_server, $xml_rpc_port, $xml_rpc_path, $xml_rpc_method, $weblog_name, $weblog_url, $changes_url, $cat_or_rss, $extended);
$log = strip_tags($vals['news_title']."\n".$changes_url."\n".$cat_or_rss."\n".$pinger->smessage);
e107::getLog()->add("Gsitemap Google-ping",$log, 4);
}

View File

@@ -1,42 +1,4 @@
<?php
/* weblog_pinger.php
Weblog_Pinger PHP Class Library by Rogers Cadenhead
Version 1.3
Web: http://www.cadenhead.org/workbench/weblog-pinger
Copyright (C) 2005 Rogers Cadenhead
The Weblog_Pinger class can send a ping message over XML-RPC to
weblog notification services such as Weblogs.Com, Blo.gs,
and Technorati.
This class should be stored in a directory accessible to
the PHP scripts that will use it.
This software requires the XML-RPC for PHP class library by
Usefulinc: http://xmlrpc.usefulinc.com/php.html.
Example use:
require('weblog_pinger.php');
$pinger = new Weblog_Pinger();
echo $pinger->ping_ping_o_matic("Ekzemplo",
"http://www.ekzemplo.com/");
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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(!e107::isInstalled('gsitemap'))
{
@@ -45,193 +7,3 @@ if(!e107::isInstalled('gsitemap'))
}
// include the XML-RPC class library
include (e_HANDLER.'xmlrpc/xmlrpc.inc.php');
include (e_HANDLER.'xmlrpc/xmlrpcs.inc.php');
include (e_HANDLER.'xmlrpc/xmlrpc_wrappers.inc.php');
class Weblog_Pinger {
// Weblogs.Com XML-RPC settings
var $weblogs_com_server = "rpc.weblogs.com";
var $weblogs_com_port = 80;
var $weblogs_com_path = "/RPC2";
var $weblogs_com_method = "weblogUpdates.ping";
var $weblogs_com_extended_method = "weblogUpdates.extendedPing";
// Blo.gs XML-RPC settings
var $blo_gs_server = "ping.blo.gs";
var $blo_gs_port = 80;
var $blo_gs_path = "/";
var $blo_gs_method = "weblogUpdates.ping";
// Ping-o-Matic XML-RPC settings
var $ping_o_matic_server = "rpc.pingomatic.com";
var $ping_o_matic_port = 80;
var $ping_o_matic_path = "/RPC2";
var $ping_o_matic_method = "weblogUpdates.ping";
// Technorati XML-RPC settings
var $technorati_server = "rpc.technorati.com";
var $technorati_port = 80;
var $technorati_path = "/rpc/ping";
var $technorati_method = "weblogUpdates.ping";
// Audio.Weblogs.Com XML-RPC settings
var $audio_weblogs_com_server = "audiorpc.weblogs.com";
var $audio_weblogs_com_port = 80;
var $audio_weblogs_com_path = "/RPC2";
var $audio_weblogs_com_method = "weblogUpdates.ping";
// log settings
var $log_file = "";
var $log_level = "full"; // full, short, or none;
var $smessage = "";
var $software_version = "1.3";
var $debug = TRUE;
// report errors
function report_error($message) {
error_log("Weblog Pinger: " . $message);
}
/* Ping Weblogs.Com to indicate that a weblog has been updated. Returns true
on success and false on failure. */
function ping_weblogs_com($weblog_name, $weblog_url, $changes_url = "", $category = "") {
return $this->ping($this->weblogs_com_server, $this->weblogs_com_port,
$this->weblogs_com_path, $this->weblogs_com_method, $weblog_name,
$weblog_url, $changes_url, $category);
}
/* Ping Blo.gs to indicate that a weblog has been updated. Returns true on success
and false on failure. */
function ping_blo_gs($weblog_name, $weblog_url, $changes_url = "", $category = "") {
return $this->ping($this->blo_gs_server, $this->blo_gs_port,
$this->blo_gs_path, $this->blo_gs_method, $weblog_name, $weblog_url,
$changes_url, $category);
}
/* Ping Technorati to indicate that a weblog has been updated. Returns true on
success and false on failure. */
function ping_technorati($weblog_name, $weblog_url, $changes_url = "", $category = "") {
return $this->ping($this->technorati_server, $this->technorati_port,
$this->technorati_path, $this->technorati_method, $weblog_name, $weblog_url,
$changes_url, $category);
}
/* Ping all of the above services to indicate that a weblog has been updated.
Returns true on success and false on failure. */
function ping_all($weblog_name, $weblog_url, $changes_url = "", $category = "") {
$error[0] = $this->ping_technorati($weblog_name, $weblog_url, $changes_url, $category);
$error[1] = $this->ping_weblogs_com($weblog_name, $weblog_url, $changes_url, $category);
$error[2] = $this->ping_blo_gs($weblog_name, $weblog_url, $changes_url, $category);
$all_ok = $error[0] & $error[1] & $error[2];
return array($all_ok, $error);
}
/* Ping Pingomatic to indicate that a weblog has been updated. Returns true on success
and false on failure. */
function ping_ping_o_matic($weblog_name, $weblog_url, $changes_url = "", $category = "") {
return $this->ping($this->ping_o_matic_server, $this->ping_o_matic_port,
$this->ping_o_matic_path, $this->ping_o_matic_method, $weblog_name,
$weblog_url, $changes_url, $category);
}
/* Ping Audio.Weblogs.Com to indicate that a weblog with a podcast has been updated.
Returns true on success and false on failure. */
function ping_audio_weblogs_com($weblog_name, $weblog_url, $changes_url = "",
$category = "") {
return $this->ping($this->audio_weblogs_com_server, $this->audio_weblogs_com_port,
$this->audio_weblogs_com_path, $this->audio_weblogs_com_method, $weblog_name,
$weblog_url, $changes_url, $category);
}
/* Ping Weblogs.Com (extended version) to indicate that a weblog has been updated.
Returns true on success and false on failure. */
function ping_weblogs_com_extended($weblog_name, $weblog_url, $changes_url, $rss_url) {
if ($this->debug) $this->report_error(
"Sending extended ping to Weblogs.Com for "
. "$weblog_name, $weblog_url, $changes_url, $rss_url");
return $this->ping($this->weblogs_com_server, $this->weblogs_com_port,
$this->weblogs_com_path, $this->weblogs_com_extended_method, $weblog_name,
$weblog_url, $changes_url, $rss_url, true);
}
/* Multi-purpose ping for any XML-RPC server that supports the Weblogs.Com interface. */
function ping($xml_rpc_server, $xml_rpc_port, $xml_rpc_path, $xml_rpc_method, $weblog_name, $weblog_url, $changes_url, $cat_or_rss, $extended = false)
{
// build the parameters
$name_param = new xmlrpcval($weblog_name, 'string');
$url_param = new xmlrpcval($weblog_url, 'string');
$changes_param = new xmlrpcval($changes_url, 'string');
$cat_or_rss_param = new xmlrpcval($cat_or_rss, 'string');
$method_name = "weblogUpdates.ping";
if ($extended) $method_name = "weblogUpdates.extendedPing";
if ($cat_or_rss != "") {
$params = array($name_param, $url_param, $changes_param, $cat_or_rss_param);
$call_text = "$method_name(\"$weblog_name\", \"$weblog_url\", \"$changes_url\", \"$cat_or_rss\")";
} else {
if ($changes_url != "") {
$params = array($name_param, $url_param, $changes_param);
$call_text = "$method_name(\"$weblog_name\", \"$weblog_url\", \"$changes_url\")";
} else {
$params = array($name_param, $url_param);
$call_text = "$method_name(\"$weblog_name\", \"$weblog_url\")";
}
}
// create the message
$message = new xmlrpcmsg($xml_rpc_method, $params);
$client = new xmlrpc_client($xml_rpc_path, $xml_rpc_server,
$xml_rpc_port);
$response = $client->send($message);
// log the message
$this->log_ping("Request: " . $call_text);
$this->log_ping($message->serialize(), true);
if ($response == 0) {
$error_text = "Error: " . $xml_rpc_server . ": " . $client->errno . " "
. $client->errstring;
$this->report_error($error_text);
$this->log_ping($error_text);
return false;
}
if ($response->faultCode() != 0) {
$error_text = "Error: " . $xml_rpc_server . ": " . $response->faultCode()
. " " . $response->faultString();
$this->report_error($error_text);
return false;
}
$response_value = $response->value();
if ($this->debug) $this->report_error($response_value->serialize());
$this->log_ping($response_value->serialize(), true);
$fl_error = $response_value->structmem('flerror');
$message = $response_value->structmem('message');
// read the response
if ($fl_error->scalarval() != false) {
$error_text = "Error: " . $xml_rpc_server . ": " . $message->scalarval();
$this->report_error($error_text);
$this->log_ping($error_text);
return false;
}
return true;
}
// save ping data to a log file
function log_ping($message, $xml_data = false) {
$this->smessage = $xml_data." ".$message;
return;
/* if ($this->log_level == "none") {
return;
}
if (($this->log_level == "short") & ($xml_data)) {
return;
}
if (!is_writable($this->log_file)) {
$this->report_error("File {$this->log_file} is not writable");
return;
}
$fhandle = fopen($this->log_file, "a");
fwrite($fhandle, $message . "\r\n");
fclose($fhandle);*/
}
}