Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NewsManger / xml question
#1
Hey all!

I customized NewsManager for my needs (added read more function)!
And it works perfect, but i saw the xml writing part and im not sure where the: XMLsave and @getXML comes from!

Code:
if (!file_exists($file)) {
    $date = date('d. m. Y.');
  } else {
    $data = @getXML($file);
    $date = $data->date;
  }

  $xml = @new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><item></item>');
  $xml->addChild('title', $title);
  $xml->addChild('date', $date);
  $xml->addChild('short', $short);
  $xml->addChild('content', $content);
  
  
  XMLsave($xml, $file);

I need to know where that comes from, becasue i need it in one of my projects!
Reply
#2
rigor789 Wrote:I customized NewsManager for my needs (added read more function)!
And it works perfect, but i saw the xml writing part and im not sure where the: XMLsave and @getXML comes from!

They are part of GetSimple: admin/inc/basic.php
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#3
mvlcek Wrote:
rigor789 Wrote:I customized NewsManager for my needs (added read more function)!
And it works perfect, but i saw the xml writing part and im not sure where the: XMLsave and @getXML comes from!

They are part of GetSimple: admin/inc/basic.php
That was quick! Big Grin thanks Wink
Reply
#4
oh and could you please check my code? It gives no errors, but it dosent works.... im too tired to debug it Sad

Code:
<?php

$ip=$_SERVER['REMOTE_ADDR'];
$key=$_GET["securitykey"];
$status=$_GET["status"];


if ($key=="md5ior6xsomk485asegilsa"){
writeDetails();//change the key here and in your ServerIP config file!
}else{
echo "Fail";
}


function writeDetails()
{
if(isset($_GET["status"])&&isset($_GET["players"])&&isset($_GET["maxplayers"])&&isset($_GET["writeonlineplayers"])){

$ip=$_SERVER['REMOTE_ADDR'];
$status=$_GET["status"];
$players=$_GET["players"];
$maxplayers=$_GET["maxplayers"];
$function=$_GET["writeonlineplayers"];
$File = "status.xml";

    $xml = @new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><item></item>');
    if ($status=="Offline") $ip="-";
    $xml->addChild('ip', $ip);
    $xml->addChild('players', $players);
    $xml->addChild('maxplayers', $maxplayers);
    $xml->addChild('function', $function);
    XMLsave($xml, $file);
}else{
echo "Missing data!";
}
}
class SimpleXMLExtended extends SimpleXMLElement{  
  public function addCData($cdata_text){  
   $node= dom_import_simplexml($this);  
   $no = $node->ownerDocument;  
   $node->appendChild($no->createCDATASection($cdata_text));  
  }
}
function XMLsave($xml, $file) {
    $xml->asXML($file);
    
    if (defined('GSCHMOD')) {
        chmod($file, GSCHMOD);
    } else {
        chmod($file, 0755);
    }
}
function getXML($file) {
    $xml = @file_get_contents($file);
    $data = simplexml_load_string($xml, 'SimpleXMLExtended', LIBXML_NOCDATA);
    return $data;
}

?>
Reply




Users browsing this thread: 1 Guest(s)