PM-1123 Podar features enterprise de la version 3.0 para sacar el beta 3.0

Marcas para la deshabilitar code Scan
This commit is contained in:
norahmollo
2014-12-23 17:22:42 -04:00
parent 76096583c3
commit 6a62837acb
8 changed files with 39 additions and 22 deletions

View File

@@ -52,8 +52,10 @@ pake_task('new-plugin', 'project_exists');
pake_desc("Update the plugin attributes in all workspaces\n args: <plugin-name>");
pake_task("update-plugin-attributes", "project_exists");
/*----------------------------------********---------------------------------*/
pake_desc("Check disabled code in plugins\n args: [enterprise-plugin|custom-plugin|all|<plugin-name>]");
pake_task("check-plugin-disabled-code", "project_exists");
/*----------------------------------********---------------------------------*/
pake_desc("pack plugin in .tar file \n args: <plugin>");
pake_task('pack-plugin', 'project_exists');
@@ -2573,8 +2575,8 @@ function checkFileStandardCode ( $file ) {
}
}
function checkFolderStandardCode ( $folder, $bSubFolders ) {
/*----------------------------------********---------------------------------*/
/*function checkFolderStandardCode ( $folder, $bSubFolders ) {
global $aFiles;
$rootFolder = str_replace ( PATH_TRUNK, '', $folder );
//printf("%s \n", pakeColor::colorize($rootFolder, 'INFO'));
@@ -2591,8 +2593,10 @@ function checkFolderStandardCode ( $folder, $bSubFolders ) {
}
}
}
}
}*/
/*----------------------------------********---------------------------------*/
/*----------------------------------********---------------------------------*/
function run_check_standard_code ( $task, $options) {
global $aFiles;
$aFiles = array();
@@ -2619,7 +2623,7 @@ function run_check_standard_code ( $task, $options) {
pakeColor::colorize($val['dos'] ? 'dos' : ' ', 'INFO'), $val['file'] );
}
}
/*----------------------------------********---------------------------------*/
function run_update_plugin_attributes($task, $args)
{
try {

View File

@@ -3283,7 +3283,9 @@ class Cases
public function executeTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType, $aFields = array())
{
/*----------------------------------********---------------------------------*/
G::LoadClass("codeScanner");
/*----------------------------------********---------------------------------*/
$aTriggers = $this->loadTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType);
@@ -3295,12 +3297,14 @@ class Cases
$arraySystemConfiguration = System::getSystemConfiguration(PATH_CONFIG . "env.ini");
/*----------------------------------********---------------------------------*/
$cs = new CodeScanner((isset($arraySystemConfiguration["enable_blacklist"]) && (int)($arraySystemConfiguration["enable_blacklist"]) == 1)? "DISABLED_CODE" : "");
$strFoundDisabledCode = "";
/*----------------------------------********---------------------------------*/
foreach ($aTriggers as $aTrigger) {
//Check disabled code
/*----------------------------------********---------------------------------*/
$arrayFoundDisabledCode = $cs->checkDisabledCode("SOURCE", $aTrigger["TRI_WEBBOT"]);
if (count($arrayFoundDisabledCode) > 0) {
@@ -3313,7 +3317,7 @@ class Cases
$strFoundDisabledCode .= "<br />- " . $aTrigger["TRI_TITLE"] . ": " . $strCodeAndLine;
continue;
}
/*----------------------------------********---------------------------------*/
//Execute
$bExecute = true;
@@ -3327,10 +3331,11 @@ class Cases
$oPMScript->execute();
}
}
/*----------------------------------********---------------------------------*/
if ($strFoundDisabledCode != "") {
G::SendTemporalMessage(G::LoadTranslation("ID_DISABLED_CODE_TRIGGER_TO_EXECUTE", array($strFoundDisabledCode)), "", "string");
}
/*----------------------------------********---------------------------------*/
return $oPMScript->aFields;
} else {

View File

@@ -4431,13 +4431,16 @@ class Processes
public function getDisabledCode($processUid = "")
{
try {
/*----------------------------------********---------------------------------*/
G::LoadClass("codeScanner");
/*----------------------------------********---------------------------------*/
$arrayDisabledCode = array();
//Set variables
/*----------------------------------********---------------------------------*/
$cs = new CodeScanner("DISABLED_CODE");
/*----------------------------------********---------------------------------*/
$delimiter = DBAdapter::getStringDelimiter();
//Processes

View File

@@ -8,6 +8,7 @@ G::LoadClass("system");
$rbacUser = new RbacUsers();
$user = new Users();
die($data['USR_USERNAME']);
$data['USR_USERNAME'] = strip_tags($data['USR_USERNAME']);
$userData = $rbacUser->getByUsername($data['USR_USERNAME']);

View File

@@ -40,14 +40,13 @@ if (isset($_FILES["PROCESS_FILENAME"]) &&
fclose($fh);
if (is_object($data) && isset($data->triggers) && is_array($data->triggers) && count($data->triggers) > 0) {
/*----------------------------------********---------------------------------*/
G::LoadClass("codeScanner");
$arraySystemConfiguration = System::getSystemConfiguration(PATH_CONFIG . "env.ini");
$cs = new CodeScanner((isset($arraySystemConfiguration["enable_blacklist"]) && (int)($arraySystemConfiguration["enable_blacklist"]) == 1)? "DISABLED_CODE" : "");
$strFoundDisabledCode = "";
foreach ($data->triggers as $value) {
$arrayTriggerData = $value;
@@ -63,7 +62,7 @@ if (isset($_FILES["PROCESS_FILENAME"]) &&
$strFoundDisabledCode .= (($strFoundDisabledCode != "")? "\n" : "") . "- " . $arrayTriggerData["TRI_TITLE"] . ": " . $strCodeAndLine;
}
}
if ($strFoundDisabledCode != "") {
$response["status"] = "DISABLED-CODE";
$response["success"] = true;
@@ -72,6 +71,7 @@ if (isset($_FILES["PROCESS_FILENAME"]) &&
echo G::json_encode($response);
exit(0);
}
/*----------------------------------********---------------------------------*/
}
} catch (Exception $e) {
$response["status"] = "ERROR";

View File

@@ -48,13 +48,15 @@ if ($handle = opendir( PATH_PLUGINS )) {
$pluginName = str_replace(".php", "", $pluginFile);
if (is_file(PATH_PLUGINS . $pluginName . ".php") && is_dir(PATH_PLUGINS . $pluginName)) {
/*----------------------------------********---------------------------------*/
//Check disabled code
G::LoadClass("codeScanner");
/*----------------------------------********---------------------------------*/
$arraySystemConfiguration = System::getSystemConfiguration(PATH_CONFIG . "env.ini");
/*----------------------------------********---------------------------------*/
$cs = new CodeScanner((isset($arraySystemConfiguration["enable_blacklist"]) && (int)($arraySystemConfiguration["enable_blacklist"]) == 1)? "DISABLED_CODE" : "");
$arrayFoundDisabledCode = array_merge($cs->checkDisabledCode("FILE", PATH_PLUGINS . $pluginName . ".php"), $cs->checkDisabledCode("PATH", PATH_PLUGINS . $pluginName));
if (count($arrayFoundDisabledCode) > 0) {
@@ -65,7 +67,7 @@ if ($handle = opendir( PATH_PLUGINS )) {
echo G::json_encode($response);
exit(0);
}
/*----------------------------------********---------------------------------*/
//print "change to ENABLED";
require_once(PATH_PLUGINS . $pluginFile);
$details = $oPluginRegistry->getPluginDetails($pluginFile);

View File

@@ -163,12 +163,11 @@ try {
unset( $oClass );
}
$res = $tar->extract( $path );
/*----------------------------------********---------------------------------*/
//Check disabled code
G::LoadClass("codeScanner");
$arraySystemConfiguration = System::getSystemConfiguration(PATH_CONFIG . "env.ini");
$cs = new CodeScanner((isset($arraySystemConfiguration["enable_blacklist"]) && (int)($arraySystemConfiguration["enable_blacklist"]) == 1)? "DISABLED_CODE" : "");
$arrayFoundDisabledCode = array_merge($cs->checkDisabledCode("FILE", $path . $pluginFile), $cs->checkDisabledCode("PATH", $path . $sClassName));
@@ -176,7 +175,8 @@ try {
if (count($arrayFoundDisabledCode) > 0) {
throw new Exception(G::LoadTranslation("ID_DISABLED_CODE_PLUGIN"));
}
/*----------------------------------********---------------------------------*/
//Check if is enterprise plugin
$sContent = file_get_contents( $path . $pluginFile );
$chain = preg_quote( 'extends enterprisePlugin' );

View File

@@ -67,8 +67,9 @@ if (isset( $sfunction ) && $sfunction == 'lookforNameTrigger') {
echo $flag;
} else {
G::LoadClass("processMap");
/*----------------------------------********---------------------------------*/
G::LoadClass("codeScanner");
/*----------------------------------********---------------------------------*/
$response = array();
try {
@@ -82,9 +83,9 @@ if (isset( $sfunction ) && $sfunction == 'lookforNameTrigger') {
}
if (isset($value["TRI_WEBBOT"])) {
/*----------------------------------********---------------------------------*/
//Check disabled code
$arraySystemConfiguration = System::getSystemConfiguration(PATH_CONFIG . "env.ini");
$cs = new CodeScanner((isset($arraySystemConfiguration["enable_blacklist"]) && (int)($arraySystemConfiguration["enable_blacklist"]) == 1)? "DISABLED_CODE" : "");
$arrayFoundDisabledCode = $cs->checkDisabledCode("SOURCE", $value["TRI_WEBBOT"]);
@@ -98,6 +99,7 @@ if (isset( $sfunction ) && $sfunction == 'lookforNameTrigger') {
throw new Exception(G::LoadTranslation("ID_DISABLED_CODE_TRIGGER", array($strCodeAndLine)));
}
/*----------------------------------********---------------------------------*/
}
if ($value['TRI_UID'] != '') {