random gallery image
random tutorial
preview

..we are going to create a new app for the hacksuite. We're not going to do anything fancy here, we will make a simple app to get familiar how to write compatible scripts for the..

read more

random generators
THC xMap

Creates a blueprint/map of a server folder

more about this module
more of this category
more modules

HackSuite File Library
File Library
Here you can find the latest files and structure of the THC HackSuite, note that if you have an earlier version of the suite it's not recommended to update files manually. Instead you should overwrite your existing HackSuite environment.
<?php
/* Manager for search widgets

Author: Remco Kouw
Site: http://www.hacksuite.com
Last Edit: 08-03-2015
*/
if(!defined('IN_SCRIPT')){
    exit;
}
$_CONTEXT['subtitle'] = "Widgets";
// target files we need, so make sure they are present
$aFiles = array($_PATHS['functions_root']."/fwrite.php",$_PATHS['data_root']."/widgets.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['widgets'])){
    
$_CONTEXT['errors'][] = "No widgets present";
    include_once(
$_PATHS['end']);
}
// simple verification of content and extractor of useful stuff in the big widget array
$_CONTEXT['widget'] = array();
$_CONTEXT['widget']['keys'] = array();
$_CONTEXT['widget']['active'] = array();
foreach(
$_CONTEXT['widgets'] as $sKey=>$aValues){
    
$_CONTEXT['widget']['keys'][] = $sKey;
    
$_CONTEXT['widget']['active'][] = $aValues['active'];
}
if(
false==($iItems count($_CONTEXT['widget']['keys']))){
    
// no widgets or maybe a corrupt file or array
    
$_CONTEXT['errors'][] = "No widgets present or are you sure the file contains the proper data?";
    
// no need to end just log a warning if necessary
}
if(isset(
$_POST['submit'])){
    switch(
$_POST['submit']){
        
// activate or deactivate
        
case"Change State":
        if(
false==($sData GetFileData($_PATHS['data_root']."/widgets.php"))){
            include_once(
$_PATHS['end']);
        }
        
$sBeforeH md5($sData);
        
// verify submitted form field
        
for($x=0;$x<count($_CONTEXT['widget']['keys']);$x++){
            
$sVar strtolower($_CONTEXT['widget']['keys'][$x]);
            if(!isset(
$_POST[$sVar])){
                
$_CONTEXT['errors'][] = "Expecting variable <b>".$sVar."</b> to be present for widget <b>".$_CONTEXT['widget']['keys'][$x]."</b>";
                include_once(
$_PATHS['end']);
            }
            
$iNew $_POST[$sVar]!=1;
            
$iCurrent $_CONTEXT['widget']['active'][$x]!=1;
            
$sData str_replace("\$_CONTEXT['widgets']['".$sVar."']['active'] = ".$iCurrent.";","\$_CONTEXT['widgets']['".$sVar."']['active'] = ".$iNew.";",$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']."/widgets.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']);
    }
}
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 widgets</div>\n";
    for(
$x=0;$x<count($_CONTEXT['widget']['keys']);$x++){
        
$iCurrent $_CONTEXT['widget']['active'][$x]!=1;
        
$sVar strtolower($_CONTEXT['widget']['keys'][$x]);
        
$sCode .= "                <div class=\"cc_record\">\n";
        
$sCode .= "                    <div class=\"flt pad3 w150\"><b>".$_CONTEXT['widget']['keys'][$x]."</b></div><div class=\"flt pad3\"><b>active</b> <input type=\"radio\" name=\"".$sVar."\" value=\"1\" ".($iCurrent=="checked" "")." /> <b>disabled</b> <input type=\"radio\" name=\"".$sVar."\" value=\"0\" ".($iCurrent=="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=\"hidden\" name=\"iCFG\" value=\"".$_POST['iCFG']."\" /></div>\n";
    
$sCode .= "                </div>\n";
    
$sCode .= "            </div>\n";
    
$sCode .= "            </form>\n";
}
?>
powered by
site stats
cms statistics:
version: 0.6.0
downloads: 4372
native: 26
modules: 21
apps: 2
support development
It takes lots of calories in order to create new things for the hacksuite, so it would be grand if you could buy me a protein shake or extra energy to keep me going. Thanks!
disclaimer
We are not responsible for any direct or indirect damage caused by abusing the tools provided on hacksuite.com. The suite is developed for educational purposes, use at your own risk!
Created by Remco Kouw. Powered by protein shakes and a high calorie diet.