On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • SendPingのモジュール&プラグインのバージョン1.05です。
    修正は、1.04cのミスと若干の記述の変更です。
    機能的なアップはありません。

    • Michael van Laar Reply #2, 9 years ago
      After installing the plugin and module I received a lot of "Deprecated" error mesages. I could solve this by updating the xmlrpc.inc to the latest version.

      But there is still one error message left:

      Fatal error: Call to a member function scalarval() on a non-object in /[...path on my server...]/assets/modules/ping/modxping.inc.php on line 204


      Any idea how to fix this?
      • I’ve updated the modxping.inc.php file such that the designs arent screwed anymore

        <?php
        /*
         * Class: WeblogUpdate.ping Sending
         * 
         * Author: ZeRo
         * Version: 1.00
         * Date: 01/02/2007
         */
        
        class MODxPing {
        var $ping_sites;
        var $ping_lang;
        var $sitemap_name;
        var $type;
        var $plugin_mode; // 0:manual 1:automatic 2:automatic&manual
        
        	function MODxPing($type = "module",$list=null,$sitemap=null,$plugin_mode=0)
        	{
        	global $modx;
        		
        		$this->type = strtolower($type);
        		
        		if(isset($GLOBALS['manager_language']) && file_exists($modx->config['base_path']."assets/modules/ping/lang/".$GLOBALS['manager_language'].".inc.php")) {
        			include_once $modx->config['base_path']."assets/modules/ping/lang/".$GLOBALS['manager_language'].".inc.php";
        		} 
        		else {
        			include_once $modx->config['base_path']."assets/modules/ping/lang/english.inc.php";
        		}
        		$this->ping_lang = $ping_lang;
        		$chunk_data = $modx->getChunk($list);
        		$chunk_data =  str_replace("\r\n","\n",$chunk_data);
        		$this->ping_sites = explode("\n",$chunk_data);
        		$this->sitemap_name = $sitemap;
        		$this->plugin_mode = $plugin_mode;
        	}
        	
        	//
        	// view Select 
        	function viewSite()
        	{	$output = '';
        		for ($i = 0;$i < count($this->ping_sites);$i++)
        		{
        			 $output .= '<input name="ping_tbl[]" type="checkbox" value="'.$i.'" checked>'.$this->ping_sites[$i]."<br />";
        		}
        		return $output;
        	}
        	
        	//
        	// view Select Domain(Host)
        	//
        	function viewDomain()
        	{
        	global $modx;
        		$output = '';
        		if (isset($modx->config['subdomains']))
        		{
        			$output .= '<div class="sectionHeader"> '.$this->ping_lang['select_domain'].'</div>';
        			$output .= '<div class="sectionBody">';
        			$output .= '<select name="domain">';
        			$host_array = array($modx->config['site_url']);
        			$domains = $modx->config['subdomains'];
        			foreach ($domains as $domain => $value)
        			{
        				if (!strstr($domain,"http://"))
        				{ 	$domain = "http://".$domain."/";
        				}
        			   array_push($host_array,$domain);
        			}
        
        			foreach ($host_array as $host) {
        			    $output .= "<option value=\"{$host}\">{$host}</option>\n";
        			}
        			$output .= "</select></div>";
        		} else
        		{
        			$output .= '<input type="hidden" name="domain" value="'.$modx->config['site_url'].'">';
        		}
        		return $output;
        	}
        	
        	//
        	// View Form
        	//
        	function viewForm()
        	{
        		
        		switch ($this->type)
        		{
        		case "module":
        			$default_sitemap = $this->sitemap_name != '' ? 'checked':' disabled';
        			$output = '
        			<h1>'.$this->ping_lang['title'].'</h1>
        
        <div id="actions">
        		<ul class="actionButtons">
            		  <li id="Button4">
            			<a href="#" onclick="document.location.href=\'index.php?a=106\';">
            			  <img src="media/style/MODxCarbon/images/icons/stop.png" />Cancel</a>
            		  </li>
        		</ul>
        </div>
        
        			<script language="JavaScript" type="text/javascript">
        			function postForm(opcode){
        			document.module.opcode.value=opcode;
        			document.module.submit();
        			}
        			</script>
        			<form name="module" method="post">
        			<input name="opcode" type="hidden" value="" />
        			'.$this->viewDomain().'
        			<div class="sectionHeader"> '.$this->ping_lang['select_host'].'</div>
        			<div class="sectionBody">
        			'.$this->viewSite().'
        			</div>
        			<div class="sectionHeader"> '.$this->ping_lang['sitemap_title'].'</div>
        			<div class="sectionBody">
        			<input type="checkbox" name="google_sitemap" '.$default_sitemap.' />'.$this->ping_lang['sitemap_send'].'</div>
        			<input type="submit" style="margin-left:5em;" name="submit" onclick="postForm(\'send\');" value="'.$this->ping_lang['submit'].'" />
        			</form>';
        			break;
        		case "plugin":
        			if (!$this->plugin_mode)
        			{	$default_exec = $this->plugin_mode == 0 ? 'checked':'';
        				$default_sitemap = $this->sitemap_name != '' ? 'checked':' disabled';
        				$output =
        				'
        <div class="sectionHeader"> '.$this->ping_lang['title'].'</div>
        					<div class="sectionBody">
        					<input type="checkbox" name="ping_go" '.$default_exec.' />'.$this->ping_lang['execute'].$this->viewDomain()
        					.'<div class="sectionHeader"> '
        					.$this->ping_lang['select_host'].'</div>
        					<div class="sectionBody">'.$this->viewSite().'</div>
        					<div class="sectionHeader"> '
        					.$this->ping_lang['sitemap_title'].'</div>
        					<div class="sectionBody">
        					<input type="checkbox" name="google_sitemap" '.$default_sitemap.' />'.$this->ping_lang['sitemap_send'].'
        					</div>
        				</div>';
        			}
        			break;
        		}
        		return $output;
        	}
        	function Send()
        	{
        	global $modx;
        	
        		require_once($modx->config['base_path']."assets/modules/ping/lib/xmlrpc.inc");
        		$output = '
        			<h1>'.$this->ping_lang['title'].'</h1>
        
        <div id="actions">
        		<ul class="actionButtons">
            		  <li id="Button4">
            			<a href="#" onclick="document.location.href=\'index.php?a=106\';">
            			  <img src="media/style/MODxCarbon/images/icons/save.png" />OK</a>
            		  </li>
        		</ul>
        </div>
        
        	<div class="sectionHeader">'.$this->ping_lang['result_title'].'</div>';
        		
        		$site_url = isset($_POST['domain']) ? $_POST['domain']:$modx->config['site_url'];
        		if ($site_url != $modx->config['site_url'])
        		{	$domainreq = substr($site_url,7,-1);
        			$start_id = $modx->config['subdomains'][$domainreq]['startid'];
        			$start_doc = $modx->getDocument($start_id);
        			$site_title = $modx->config['site_name']." ".$start_doc['longtitle'];
        
        		}else
        		{      $site_title = $modx->config['site_name'];
        		}
        		if ($this->ping_lang['encode'] != "")
        		{
        			if ($modx->config['modx_charset'] != $this->ping_lang['encode'])
        			{
        				$site_name = mb_convert_encoding($site_title,$this->ping_lang['encode'],$modx->config['modx_charset']);
        			} else
        			{	$site_name = $site_title;
        			}
        			$GLOBALS['xmlrpc_internalencoding']=$this->ping_lang['encode'];
        		}
        		$name_param = new xmlrpcval($site_name, 'string');
        		$url_param = new xmlrpcval($site_url.'feed.rss', 'string');
        		$params = array($name_param, $url_param);
        
        		if (isset($_POST['ping_tbl']) || ($this->type == "plugin" && $this->plugin_mode == 1))
        		{
        			if (isset($_POST['ping_tbl']))
        			{
        				$ping_tbl = $_POST['ping_tbl'];
        			} else
        			{
        				for ($i = 0;$i < count($this->ping_sites);$i++)
        				{	$ping_tbl[] = $i;
        				}
        			}
        			$output .= '<div class="sectionBody"><ul>';
        			foreach ($ping_tbl as $idx)
        			{
        				$ping_url  = $this->ping_sites[$idx];
        				$output .=  "<li>".$ping_url.":" ;
        				$target_path = parse_url($ping_url);
        				$message = new xmlrpcmsg("weblogUpdates.ping", $params);
        				$client = new xmlrpc_client($target_path['path'], $target_path['host'], 80);
        				if ($this->ping_lang["encode"] != "") $client->request_charset_encoding = $this->ping_lang["encode"];
        				$response =  $client->send($message);
        				if ($response == 0) {
        				    $output .= "  Error pinging " . $client->errno . " " . $client->errstring;
        				    continue;
        				}
        				if ($response->faultCode() != 0)  {
        				    $output .="  Error pinging " . $response->faultCode() . " " . $response->faultString();
        				    continue;
        				}
        				$response_value = $response->value();
        			    if ($response_value->scalartyp() != $GLOBALS['xmlrpcInt'])
        				{	$fl_error = $response_value->structmem('flerror');
        					$message = $response_value->structmem('message');
        					// read the response
        					 $output .= $response->value()->serialize();
        				} else
        				{	$output .= "  Unkown type (Success?)";
        				}
        			}
        			$output .= "</ul></div>";
        		}
        		if ($this->sitemap_name != '' && (isset($_POST['google_sitemap']) || ($this->type == "plugin" && $this->plugin_mode == 1)))
        		{
        			$sitemap_url = $site_url.$this->sitemap_name;
        			$output.= '<div class="sectionHeader">'.$this->ping_lang['sitemap_title'].'</div>';
        			$output .= '<div class="sectionBody">'.$sitemap_url.'</div>';
        			$google_ping = "http://www.google.com/webmasters/sitemaps/ping?sitemap=".urlencode($sitemap_url);
        			@file_get_contents($google_ping);
        		}
        		return $output;
        	}
        }
        ?>
          http://www.gameports.net/ - easy gaming on line!
        • Hello Freundschaft -san,

          Thank you for your updating. laugh
          • Quote from: Freundschaft at Jul 06, 2010, 05:14 PM

            I’ve updated the modxping.inc.php file such that the designs arent screwed anymore

            Thanks! Now it works smiley
            • I hope someone is still listening to this topic - I’m trying to implement this, but is there anything I need to adjust for Evolution 1.0.4/5? I’ve followed the read-me, and the module seems to be working fine. However, when I go in to edit a page, the plugin doesn’t seem to be triggering. I don’t get any options at the bottom of the edit page. Should I be selecting additional System Events? Thanks!
              • where can i download this plugin?