random gallery image
random tutorial
preview

..more modules you must have seen the iframes used for realtime result display. In this tutorial I'm going to show you how to insert them into your module and how they function. what we..

read more

random stress testing
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
/* Set version and project code name

Author: Remco Kouw
Site: http://www.hacksuite.com
Last Edit: 07-03-2015
*/
if(!defined('IN_SCRIPT')){
    exit;
}
$_CONTEXT['subtitle'] = "Set version";
// target files we need, so make sure they are present
$aFiles = array($_PATHS['functions_root']."/fwrite.php",$_PATHS['functions_root']."/get_file_data.php",$_PATHS['data_root']."/version.php");
for(
$x=0;$x<count($aFiles);$x++){
    (!
IsThere($aFiles[$x]) ? include_once($_PATHS['end']) : include_once($aFiles[$x]));
}
// correct values
$aValues = array(0,1);
$sCode = (isset($sCode) ? $sCode "");
$sTemplate "";
if(!isset(
$_POST['sent'])){
    
/* construct form */
    
$sCode .= "            <form method=\"post\" class=\"install\">\n";
    
$sCode .= "            <div class=\"emboss borderr5 border1pxtrans pad5 edgeglow overflw\">\n";
    
$sCode .= "                <div class=\"embosshdrnocenter border1pxtrans pad10\">Set version and project</div>\n";
    
$sCode .= "                <div class=\"cc_record\">\n";
    
$sCode .= "                    <div class=\"flt pad3 w150\">cms version</div>\n";
    
$sCode .= "                    <div class=\"flt pad3\"><input type=\"text\" name=\"sVersion\" value=\"".$_CONTEXT['version']."\" /></div>\n";
    
$sCode .= "                </div>\n";
    
$sCode .= "                <div class=\"clear\"></div>\n";
    
$sCode .= "                <div class=\"cc_record\">\n";
    
$sCode .= "                    <div class=\"flt pad3 w150\">project name</div>\n";
    
$sCode .= "                    <div class=\"flt pad3\"><input type=\"text\" name=\"sCMS\" value=\"".$_CONTEXT['projcname']."\" /></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=\"sent\" value=\"1\"><input type=\"hidden\" name=\"iCFG\" value=\"".$_POST['iCFG']."\" /><input type=\"submit\" name=\"submit\" value=\"Set\" /></div>\n";
    
$sCode .= "                </div>\n";
    
$sCode .= "                <div class=\"clear\"></div>\n";
    
$sCode .= "            </div>\n";
    
$sCode .= "            </form>\n";
}
else{
    if(
$_CONTEXT['version']==$_POST['sVersion']){
        
$sCode .= "<div class=\"spacingmsg\">".$_CONTEXT['result_headers']['error']."This version is the current version</div>\n";
    }
    else{
        
// validate input 
        
$_POST['sVersion'] = trim($_POST['sVersion']);
        
$_POST['sCMS'] = trim($_POST['sCMS']);
        if(!
preg_match('/^([0-9]\.){2}[0-9]{1}$/',$_POST['sVersion'])){
            
$sCode .= "<div class=\"spacingmsg\">".$_CONTEXT['result_headers']['error']."Invalid version, expecting x.x.x format</div>\n";
        }
        else{
            
$sDest $_PATHS['data_root']."/version.php";
            
$aVersionNew explode(".",$_POST['sVersion']);
            
$aVersionOld explode(".",$_CONTEXT['version']);
            
// eg 0.5.4 > 0.6.0
            
$bNewCodeName false;
            
// eg 0.5.4 > 0.5.5
            
$bNewRelease false;
            if(
$aVersionNew[0]==$aVersionOld[0]){
                if(
$aVersionNew[1]==$aVersionOld[1]){
                    if(
$aVersionNew[2]<$aVersionOld[2]){
                        
$sCode .= "<div class=\"spacingmsg\">".$_CONTEXT['result_headers']['error']."You can't downgrade a HackSuite version</div>\n";
                    }
                    else{
                        
$bNewRelease true;
                    }
                }
                elseif(
$aVersionNew[1]>$aVersionOld[1]){
                    
$bNewCodeName true;
                }
                else{
                    
$sCode .= "<div class=\"spacingmsg\">".$_CONTEXT['result_headers']['error']."You can't downgrade a HackSuite version</div>\n";
                }
            }
            elseif(
$aVersionNew[0]>$aVersionOld[0]){
                
$bNewCodeName true;
            }
            else{
                
$sCode .= "<div class=\"spacingmsg\">".$_CONTEXT['result_headers']['error']."You can't downgrade a HackSuite version</div>\n";
            }
            if(
$bNewCodeName){
                if(
$_POST['sCMS']==$_CONTEXT['projcname']){
                    
$sCode .= "<div class=\"spacingmsg\">".$_CONTEXT['result_headers']['error']."Expecting a new codename for the HackSuite</div>\n";
                }
                else{
                    if(!@
preg_match('/^([A-Z]){3,10}$/',$_POST['sCMS'])){
                        
$sCode .= "<div class=\"spacingmsg\">".$_CONTEXT['result_headers']['error']."Codename for the HackSuite must be in uppercase characters and between 3-10 characters long</div>\n";
                    }
                    else{
                        
// overwrite version and codename
                        
$sFileData GetFileData($sDest);
                        
$sFileData str_replace("\$_CONTEXT['version'] = \"".$_CONTEXT['version']."\";","\$_CONTEXT['version'] = \"".$_POST['sVersion']."\";",$sFileData);
                        
$sFileData str_replace("\$_CONTEXT['projcname'] = \"".$_CONTEXT['projcname']."\";","\$_CONTEXT['projcname'] = \"".$_POST['sCMS']."\";",$sFileData);
                        
$sCode .= "<div class=\"spacingmsg\">".$_CONTEXT['result_headers']['result'].(WriteF($sDest,$sFileData,"w") ? "Successfully updated release" "Failed to update release")."</div>\n";
                    }
                }
            }
            elseif(
$bNewRelease){
                
// overwrite version only
                
$sFileData GetFileData($sDest);
                
$sFileData str_replace("\$_CONTEXT['version'] = \"".$_CONTEXT['version']."\";","\$_CONTEXT['version'] = \"".$_POST['sVersion']."\";",$sFileData);
                
$sCode .= "<div class=\"spacingmsg\">".$_CONTEXT['result_headers']['result'].(WriteF($sDest,$sFileData,"w") ? "Successfully updated release" "Failed to update release")."</div>\n";
            }
        }
    }
}
?>
powered by
site stats
cms statistics:
version: 0.6.0
downloads: 3837
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.