..I will show you how to create native tools. I'm not going to make a new tool though, instead I will show you what is required to create one. You can find all the native tools in the..
<?php
/* Manager for remote rss locations
Author: Remco Kouw
Site: http://www.hacksuite.com
Last Edit: 07-03-2015
*/
if(!defined('IN_SCRIPT')){
exit;
}
$_CONTEXT['subtitle'] = "RSS Manager";
// target files we need, so make sure they are present
$aFiles = array($_PATHS['functions_root']."/fwrite.php",$_PATHS['data_root']."/remote.php",$_PATHS['functions_root']."/get_file_data.php");
for($x=0;$x<count($aFiles);$x++){
(!IsThere($aFiles[$x]) ? include_once($_PATHS['end']) : include_once($aFiles[$x]));
}
if(!isset($_CONTEXT['rsources'])){
$_CONTEXT['errors'][] = "No rss resources present";
include_once($_PATHS['end']);
}
// verify if handlers exist
foreach($_CONTEXT['rsources'] as $sKey=>$aValues){
if(!@file_exists($_PATHS['rss_root']."/".$aValues['rssfile'])){
$_CONTEXT['errors'][] = "Failed to find rss file: ".$aValues['rssfile'];
include_once($_PATHS['end']);
}
}
if(isset($_POST['submit'])){
switch($_POST['submit']){
// disable rss
case"Disable RSS":
if(!$_CONTEXT['allow_remote_locations']){
$sCode .= "<div class=\"spacingmsg\">".$_CONTEXT['result_headers']['notice']."RSS feeds have already been disabled.. click <a href=\"javascript:history.go(-1)\">here</a> to return</div>\n";
}
else{
$_CONTEXT['switchfeeds'] = array("\$_CONTEXT['allow_remote_locations'] = true;","\$_CONTEXT['allow_remote_locations'] = false;");
}
break;
// enable rss
case"Enable RSS":
if($_CONTEXT['allow_remote_locations']){
$sCode .= "<div class=\"spacingmsg\">".$_CONTEXT['result_headers']['notice']."RSS feeds have already been enabled.. click <a href=\"javascript:history.go(-1)\">here</a> to return</div>\n";
}
else{
$_CONTEXT['switchfeeds'] = array("\$_CONTEXT['allow_remote_locations'] = false;","\$_CONTEXT['allow_remote_locations'] = true;");
}
break;
// activate or deactivate feeds
case"Change State":
if(false==($sData = GetFileData($_PATHS['data_root']."/remote.php"))){
include_once($_PATHS['end']);
}
$sBeforeH = md5($sData);
foreach($_POST as $sKey=>$iValue){
if(isset($_CONTEXT['rsources'][$sKey])){
$_POST[$sKey] = ($_POST[$sKey]==1 ? 1 : 0);
if($_CONTEXT['rsources'][$sKey]['state']!=$_POST[$sKey]){
// replace old value
$sData = str_replace("\$_CONTEXT['rsources']['".$sKey."']['state'] = ".$_CONTEXT['rsources'][$sKey]['state'].";","\$_CONTEXT['rsources']['".$sKey."']['state'] = ".$_POST[$sKey].";",$sData);
}
}
}
$sAfterH = md5($sData);
if($sAfterH==$sBeforeH){
$sCode .= "<div class=\"spacingmsg\">".$_CONTEXT['result_headers']['result']."No changes have been made.. click <a href=\"javascript:history.go(-1)\">here</a> to return</div>\n";
}
else{
if(!WriteF($_PATHS['data_root']."/remote.php",$sData,"w")){
include_once($_PATHS['end']);
}
else{
$sCode .= "<div class=\"spacingmsg\">".$_CONTEXT['result_headers']['result']."Update succeeded, click <a href=\"javascript:history.go(-1)\">here</a> to return</div>\n";
}
}
break;
// default
default:
$_CONTEXT['errors'][] = "Invalid submission button value";
include_once($_PATHS['end']);
}
if(isset($_CONTEXT['switchfeeds'])){
if(false==($sData = GetFileData($_PATHS['root']."/vars.php"))){
include_once($_PATHS['end']);
}
$sData = str_replace($_CONTEXT['switchfeeds'][0],$_CONTEXT['switchfeeds'][1],$sData);
if(!WriteF($_PATHS['root']."/vars.php",$sData,"w")){
include_once($_PATHS['end']);
}
else{
$sCode .= "<div class=\"spacingmsg\">".$_CONTEXT['result_headers']['result']."Update succeeded, click <a href=\"javascript:history.go(-1)\">here</a> to return</div>\n";
}
}
}
else{
// output form
$sCode .= " <form method=\"post\">\n";
$sCode .= " <div class=\"emboss borderr5 border1pxtrans pad5 edgeglow overflw\">\n";
$sCode .= " <div class=\"embosshdrnocenter border1pxtrans pad10\">Enable or disable RSS feeds</div>\n";
foreach($_CONTEXT['rsources'] as $sKey=>$aValues){
$sCode .= " <div class=\"cc_record emboss overflw borderr5 mt5\">\n";
$iCurrent = $aValues['state']!=1 ? 0 : 1;
$sCode .= " <div class=\"flt pad3 w150\">".$aValues['label']."</div>\n";
$sCode .= " <div class=\"flt pad3\"><b>active</b> <input type=\"radio\" name=\"".$sKey."\" value=\"1\" ".($iCurrent==1 ? "checked" : "")." /> <b>disabled</b> <input type=\"radio\" name=\"".$sKey."\" value=\"0\" ".($iCurrent==0 ? "checked" : "")." /></div>\n";
$sCode .= " </div>\n";
$sCode .= " <div class=\"clear\"></div>\n";
}
$sCode .= " <div class=\"cc_record\">\n";
$sCode .= " <div class=\"flt pad3\"><input type=\"submit\" name=\"submit\" value=\"Change State\" /> <input type=\"submit\" name=\"submit\" value=\"".($_CONTEXT['allow_remote_locations'] ? "Disable" : "Enable")." RSS\" /><input type=\"hidden\" name=\"iCFG\" value=\"".$_POST['iCFG']."\" /></div>\n";
$sCode .= " </div>\n";
$sCode .= " <div class=\"clear\"></div>\n";
$sCode .= " </div>\n";
$sCode .= " </form>\n";
}
?>