Exemplo n.º 1
0
    AddVote($voteid, $vote);
} elseif ($enews == 'AddInfoVote') {
    if ($_GET['id']) {
        $id = $_GET['id'];
        $classid = $_GET['classid'];
        $vote = $_GET['vote'];
    } else {
        $id = $_POST['id'];
        $classid = $_POST['classid'];
        $vote = $_POST['vote'];
    }
    AddInfoVote($classid, $id, $vote);
} elseif ($enews == 'AddInfoPfen') {
    if ($_GET['id']) {
        $add = $_GET;
    } else {
        $add = $_POST;
    }
    AddInfoPfen($add);
} elseif ($enews == "AddGbook") {
    AddGbook($_POST);
} elseif ($enews == "AddFeedback") {
    $doetran = 1;
    AddFeedback($_POST);
} elseif ($enews == "AddError") {
    AddError($_POST);
} else {
    printerror("ErrorUrl", "history.go(-1)", 1);
}
db_close();
$empire = null;
Exemplo n.º 2
0
 function save_file($path, $overwrite_mode = "3")
 {
     $this->path = $path;
     if ($this->accepted) {
         AddError(__FILE__ . __LINE__, "Info: Salva file en '{$path}', con name '" . $this->file["name"]) . "'";
         // Clean up file name (only lowercase letters, numbers and underscores)
         $this->file["name"] = preg_replace("/[^a-z0-9._]/i", "", str_replace(" ", "_", str_replace("%20", "_", strtolower($this->file["name"]))));
         // Clean up text file breaks
         if (preg_match("/text/", $this->file["type"])) {
             $this->cleanup_text_file($this->file["tmp_name"]);
         }
         // get the raw name of the file (without it's extenstion)
         if (preg_match("/(\\.)([a-z0-9]{2,5})\$/", $this->file["name"])) {
             $pos = strrpos($this->file["name"], ".");
             if (!$this->file["extention"]) {
                 $this->file["extention"] = substr($this->file["name"], $pos, strlen($this->file["name"]));
             }
             $this->file['raw_name'] = substr($this->file["name"], 0, $pos);
         } else {
             $this->file['raw_name'] = $this->file["name"];
             if ($this->file["extention"]) {
                 $this->file["name"] = $this->file["name"] . $this->file["extention"];
             }
         }
         # Terminan en el directorio del nuke, mas el dir especificado en path
         $log = "Status: path: " . $this->path . " - name: " . $this->file["name"] . " - tmp:" . $this->file["tmp_name"] . " - raw:" . $this->file["raw_name"];
         AddError(__FILE__ . __LINE__, "Info: con {$log}");
         $copy = '';
         $n = 0;
         switch ($overwrite_mode) {
             case 1:
                 // overwrite mode
                 $aok = copy($this->file["tmp_name"], $this->path . $this->file["name"]);
                 break;
             case 2:
                 // create new with incremental extention
                 while (file_exists($this->path . $this->file['raw_name'] . $copy . $this->file["extention"])) {
                     $copy = "_copy" . $n;
                     $n++;
                 }
                 $this->file["name"] = $this->file['raw_name'] . $copy . $this->file["extention"];
                 if ($this->file["tmp_name"] == "") {
                     return;
                 }
                 $aok = copy($this->file["tmp_name"], $this->path . $this->file["name"]);
                 break;
             case 3:
                 // do nothing if exists, highest protection
                 if (file_exists($this->path . $this->file["name"])) {
                     $this->errors[4] = "File &quot" . $this->path . $this->file["name"] . "&quot already exists";
                     $aok = null;
                 } else {
                     $aok = copy($this->file["tmp_name"], $this->path . $this->file["name"]);
                 }
                 break;
             default:
                 break;
         }
         # Terminan en el directorio del nuke, mas el dir especificado en path
         AddError(__FILE__ . __LINE__, "Info-- path: " . $this->path . " - name: " . $this->file["name"] . " - tmp:" . $this->file["tmp_name"] . " - raw:" . $this->file["raw_name"]);
         if (!$aok) {
             unset($this->file['tmp_name']);
         }
         return $aok;
     } else {
         $this->errors[3] = "Only " . preg_replace("/\\|/i", " or ", $accept_type) . " files may be uploaded";
         return FALSE;
     }
 }
Exemplo n.º 3
0
             }
         }
         $objectCount++;
     }
 }
 if ($errors == 0 && isset($_POST['pog_test']) && $_POST['pog_test'] == 'yes') {
     AddTrace("\nPOG Relations");
     $objectCount = 1;
     foreach ($objects as $object) {
         $objectName = GetObjectName("../objects/" . $object);
         if (isset($objectName) && array_search($objectName, $ignoreObjects) === false) {
             eval('$instance = new ' . $objectName . '();');
             AddTrace("\t[" . $objectName . "]");
             if (!TestRelations($instance, $objectNameList, $ignoreObjects)) {
                 $errors++;
                 AddError("Object {$objectName} failed relations tests");
             }
             if ($objectCount != sizeof($objects)) {
                 AddTrace("\t***");
             }
         }
         $objectCount++;
     }
 }
 if ($errors == 0) {
     $_SESSION['diagnosticsSuccessful'] = true;
 }
 if (isset($_POST['pog_test']) && $_POST['pog_test'] == 'no') {
     AddTrace("\nUNIT TESTS NOT PERFORMED. FOUND {$errors} ERROR(S)");
 } else {
     AddTrace("\nCHECKED " . count($objectNameList) . " OBJECT(S). FOUND {$errors} ERROR(S)" . ($errors == 0 ? ". HURRAY!" : ":"));
Exemplo n.º 4
0
/**
 * Unit test for SetSiblingList()
 *
 * @param unknown_type $object
 * @param unknown_type $trace
 */
function TestSetSiblingList($object, $trace = true, $ignoreObjects)
{
    $thisObjectName = get_class($object);
    if (!TestSaveDeep_Sibling($object, false, $ignoreObjects)) {
        AddTrace("\tSetSiblingList(deep) ignored");
        AddError("SetSiblingList ignored since SaveDeep could not be performed");
        return false;
    }
    //get all sibling classes
    $siblingList = array();
    eval("\$object = new {$thisObjectName}();");
    $object = PopulateTestValues($object);
    $attribute_types = $object->pog_attribute_type;
    foreach ($attribute_types as $key => $attribute_array) {
        if ($attribute_array['db_attributes'][1] == "JOIN") {
            $siblingList[] = $key;
        }
    }
    $errors = 0;
    foreach ($siblingList as $sibling) {
        //instantiate
        $siblingInstanceList = array();
        eval("\$siblingInstance = new {$sibling}();");
        eval("\$siblingInstance2 = new {$sibling}();");
        $siblingInstance = PopulateTestValues($siblingInstance);
        $siblingInstance2 = PopulateTestValues($siblingInstance2);
        //add sibling to array
        $siblingInstanceList[] = $siblingInstance;
        $siblingInstanceList[] = $siblingInstance2;
        eval("\$object -> Set" . $sibling . "List(\$siblingInstanceList);");
    }
    //test
    if (!$object->Save(true)) {
        $errors++;
        return false;
    }
    foreach ($siblingList as $sibling) {
        //instantiate
        eval("\$siblingArray = \$object->Get" . $sibling . "List();");
        if (sizeof($siblingArray) == 0) {
            if ($trace) {
                AddTrace("\tSet({$sibling})List failed");
            }
            $errors++;
        } else {
            if ($trace) {
                AddTrace("\tSet({$sibling})List....OK!");
            }
        }
    }
    //cleanup
    $object->Delete(false, true);
    if ($errors == 0) {
        return true;
    }
    return false;
}
Exemplo n.º 5
0
function Execute($Action, $Statement)
{
    try {
        $Statement->execute();
    } catch (PDOException $e) {
        $ErrorMSG = 'Error 0: ' . $e->getMessage() . "\n";
        $PHP = 1;
        AddError($Action, $ErrorMSG, $PHP);
    }
}
Exemplo n.º 6
0
        }
    }
}
unset($SecNames, $Formatters);
$KnownLanguages = ['en' => 'en', 'de' => 'de', 'sr' => 'sr', 'tr' => 'tr', 'fr' => 'fr', 'sv' => 'sv', 'da' => 'da', 'pl' => 'pl', 'nl' => 'nl', 'es' => 'es', 'bp' => 'bp', 'cz' => 'cz', 'fi' => 'fi', 'bg' => 'bg', 'ro' => 'ro', 'hu' => 'hu', 'lt' => 'lt', 'sk' => 'sk', 'mk' => 'mk', 'hr' => 'hr', 'bs' => 'bs', 'ru' => 'ru', 'cn' => 'cn'];
foreach ($KnownLanguages as $Language) {
    if (!array_key_exists($Language, $FoundLanguages)) {
        AddError(0, "info", $Language, "Missing language <b>{$Language}</b>.");
    }
}
foreach ($FoundLanguages as $Language => $Derp) {
    if ($Language === 'ls') {
        AddError(0, "info", $Language, "Please remove leet speak language.");
    }
    if (!array_key_exists($Language, $KnownLanguages)) {
        AddError(0, "info", $Language, "Unknown language <b>{$Language}</b>.");
    }
}
unset($KnownLanguages);
$Time = Number_Format(microtime(true) - $Timer_Start, 4, '.', '');
if (empty($Errors)) {
    echo '<div class="alert alert-success">Congratulations! No errors were found.';
    echo ' Analyzed <span class="text-primary">' . $Number . '</span> lines ';
    echo '(<span class="text-primary">' . Count($FoundLanguages) . '</span> languages) in <span class="text-primary">' . $Time . '</span> seconds.</div>';
} else {
    echo '<div class="alert alert-danger">Found ' . Count($Errors) . ' errors.';
    echo ' Analyzed <span class="text-primary">' . $Number . '</span> lines ';
    echo '(<span class="text-primary">' . Count($FoundLanguages) . '</span> languages) in <span class="text-primary">' . $Time . '</span> seconds.</div>';
    echo "<ol id=\"error_loop\">";
    foreach ($Errors as $Section => $Derp) {
        echo "<li class=\"msg_loop\"><h3>Section <b>[" . HtmlEntities($Section) . "]</b></h3><ol>";