..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..
Creates a blueprint/map of a server folder
<?php
/* Changes current style
Author: Remco Kouw
Site: http://www.hacksuite.com
Last Edit: 10-03-2015
*/
if(!defined('IN_SCRIPT')){
exit;
}
$_CONTEXT['subtitle'] = "Style Manager";
// target files we need, so make sure they are present
$aFiles = array($_PATHS['functions_root']."/fwrite.php",$_PATHS['functions_root']."/getdirbydir.php",$_PATHS['data_root']."/style.php");
for($x=0;$x<count($aFiles);$x++){
(!IsThere($aFiles[$x]) ? include_once($_PATHS['end']) : include_once($aFiles[$x]));
}
// no need to go on if there are no directories in the template directory
if(false==($aDirs = GetDirByDir($_PATHS['templates_root'],0))){
$_CONTEXT['fatal'] = true;
include_once($_PATHS['end']);
}
if(isset($_POST['sStyle'])){
// form submitted, let's make sure we have some styles present and that it's worth updating the data file
if(!in_array($_POST['sStyle'],$aDirs)){
// orly did you rly believe you can change to a style that isn't even there?
$_CONTEXT['errors'][] = "Style doesn't exist";
include_once($_PATHS['end']);
}
if($_POST['sStyle']==$_PATHS['style_user']){
// now stop being silly, why change it to the same style.. odd ppl out there :p
$_CONTEXT['errors'][] = "You already have that style enabled";
include_once($_PATHS['end']);
}
// make sure that the template has an index page, add a path too, we might need to use it even more in the future
$_PATHS['new_style_root'] = $_PATHS['templates_root']."/".$_POST['sStyle'];
$sDest = $_PATHS['new_style_root']."/index.php";
if(!IsThere($sDest)){
include_once($_PATHS['end']);
}
// create the new style.php file data
$sData = "<?php\n";
$sData .= "/* Style environment */\n";
$sData .= "\$_STYLE = \"".$_POST['sStyle']."\";\n";
$sData .= "?>";
// let's hope the update succeeds
$sDest = $_PATHS['data_root']."/style.php";
(!WriteF($sDest,$sData,"w") ? include_once($_PATHS['end']) : $sCode .= "<div class=\"spacingmsg\">".$_CONTEXT['result_headers']['result']."Successfully changed style, click <a href=\"configuration.php\">here</a> to continue</div>");
}
else{
/* update style form */
// output the templates that are available
$sSelect = "<select name=\"sStyle\">\n";
for($x=0;$x<count($aDirs);$x++){
// let's make the selection menu
$sSelect .= "<option value=\"".$aDirs[$x]."\"".($aDirs[$x]==$_PATHS['style_user'] ? " selected" : "").">".$aDirs[$x]."</option>\n";
}
$sSelect .= "</select>\n";
$sCode .= " <form method=\"post\">\n";
$sCode .= " <div class=\"emboss borderr5 border1pxtrans pad5 edgeglow overflw\">\n";
$sCode .= " <div class=\"embosshdrnocenter border1pxtrans pad10\">Change the look and feel of the THC HackSuite</div>\n";
$sCode .= " <div class=\"cc_record\">\n";
$sCode .= " <div class=\"flt pad3 w150\">select a style:</div>\n";
$sCode .= " <div class=\"flt pad3\">".$sSelect."</div>\n";
$sCode .= " </div>\n";
$sCode .= " <div class=\"clear\"></div>\n";
$sCode .= " <div class=\"cc_record\">\n";
$sCode .= " <div class=\"flt pad3\"><input type=\"hidden\" name=\"iCFG\" value=\"".$_POST['iCFG']."\" /><input type=\"submit\" name=\"submit\" value=\"Change Style\" /></div>\n";
$sCode .= " </div>\n";
$sCode .= " <div class=\"clear\"></div>\n";
$sCode .= " </div>\n";
$sCode .= " </form>\n";
}
?>