示例#1
0
<?php

if (!_gotErrors()) {
    $displayFiles = _getDisplay();
    $assignVars = _getAssign();
    // assigning smarty variables
    $smarty->assign($assignVars);
    // displaying every template given
    foreach ($displayFiles as $d) {
        $smarty->display($d);
    }
} else {
    // display error template instead of display queue
    $arrErrors = _getErrors();
    __cfthrow(array("type" => "runtime.applicationErrors", "message" => $arrErrors, "detail" => join("\n", $arrErrors)));
}
示例#2
0
                 array_unshift($fb_["rootpath"], "..");
             }
         }
     }
     $fb_["rootpath"] = implode("/", $fb_["rootpath"]);
     if (strlen($fb_["rootpath"]) > 0) {
         $fb_["rootpath"] .= "/";
     }
     $fb_["application"]["fusebox"]["circuits"][$thiscircuit["xmlAttributes"]["alias"]]["rootpath"] = $fb_["rootpath"];
     // read in the circuit.xml file
     $fb_["circuitXMLfile"] = $fb_["application"]["fusebox"]["approotdirectory"] . ereg_replace("\\/", $fb_["application"]["fusebox"]["osdelimiter"], $fb_["application"]["fusebox"]["circuits"][$thiscircuit["xmlAttributes"]["alias"]]["path"]) . "circuit.xml.php";
     if (!file_exists($fb_["circuitXMLfile"])) {
         if (file_exists($fb_["application"]["fusebox"]["approotdirectory"] . ereg_replace("\\/", $fb_["application"]["fusebox"]["osdelimiter"], $fb_["application"]["fusebox"]["circuits"][$thiscircuit["xmlAttributes"]["alias"]]["path"]) . "circuit.xml")) {
             $fb_["circuitXMLfile"] = $fb_["application"]["fusebox"]["approotdirectory"] . ereg_replace("\\/", $fb_["application"]["fusebox"]["osdelimiter"], $fb_["application"]["fusebox"]["circuits"][$thiscircuit["xmlAttributes"]["alias"]]["path"]) . "circuit.xml";
         } else {
             __cfthrow(array("type" => "fusebox.missingCircuitXML", "message" => "missing circuit.xml", "detail" => "The circuit xml file, " . $fb_["circuitXMLfile"] . ", for circuit " . $fb_["alias"] . " could not be found."));
         }
     }
     $cp = fopen($fb_["circuitXMLfile"], "r");
     $fb_["circuitXMLcode"] = fread($cp, filesize($fb_["circuitXMLfile"]));
     $fb_["application"]["fusebox"]["circuits"][$thiscircuit["xmlAttributes"]["alias"]]["xml"] = xmlParse($fb_["circuitXMLcode"], "overwrite,evaluate,append,addtoken,required,callsuper");
     $fb_["application"]["fusebox"]["circuits"][$fb_["alias"]]["timestamp"] = $fb_["timestamp"][0];
     fclose($cp);
 }
 // an interim write to the application.fusebox structure
 $application["fusebox"] = array_merge($fb_["application"]["fusebox"], array());
 // loop over all circuits to determine each circuit's "circuitTrace"
 foreach (array_keys($fb_["application"]["fusebox"]["circuits"]) as $fb_["aCircuit"]) {
     $fb_["application"]["fusebox"]["circuits"][$fb_["aCircuit"]]["circuitTrace"] = array();
     array_push($fb_["application"]["fusebox"]["circuits"][$fb_["aCircuit"]]["circuitTrace"], $fb_["aCircuit"]);
     $fb_["thisCircuit"] = $fb_["application"]["fusebox"]["circuits"][$fb_["aCircuit"]]["parent"];
 $fb_["fcount"] = 0;
 foreach (array_keys($application["fusebox"]["circuits"][$myFusebox["thisCircuit"]]["fuseactions"]) as $fb_["tempfa"]) {
     if ($fb_["tempfa"] == $myFusebox["thisFuseaction"]) {
         $fb_["fcount"]++;
     }
 }
 if ($fb_["fcount"] == 0) {
     die("You referenced a fuseaction, " . $myFusebox["thisFuseaction"] . ", which does not exist in the circuit " . $myFusebox["thisCircuit"] . ".");
 }
 if ($fb_["fcount"] > 1) {
     die("You referenced a fuseaction, " . $myFusebox["thisFuseaction"] . ", which has been defined multiple times in circuit " . $myFusebox["thisCircuit"] . ". Fusebox does not allow overloaded methods.");
 }
 // check this fuseaction's access permissions
 $fb_["access"] = $application["fusebox"]["circuits"][$myFusebox["thisCircuit"]]["fuseactions"][$myFusebox["thisFuseaction"]]["access"];
 if (strtolower($fb_["access"]) == "private" && $myFusebox["thisCircuit"] != $fb_["fuseQ"][$fb_["pointer"]]["circuit"]) {
     __cfthrow(array("type" => "fusebox.invalidAccessModifier", "message" => "invalid access modifier", "detail" => "The fuseaction '" . $myFusebox["thisCircuit"] . "." . $myFusebox["thisFuseaction"] . "' has an access modifier of private and can only be called from within its own circuit. Use an access modifier of internal or public to make it available outside its immediate circuit."));
 }
 // set the value of myFusebox.thisCircuit
 // (both here and at the end of the parsing of this <do> so that we always return to the right value of myFusebox.thisCircuit)
 $fb_["xnInitFA"] = array();
 $fb_["xnCloseFA"] = array();
 $fb_["temp"] = array();
 $fb_["temp"]["xmlName"] = "set";
 $fb_["temp"]["circuit"] = $myFusebox["thisCircuit"];
 $fb_["temp"]["fuseaction"] = $myFusebox["thisFuseaction"];
 $fb_["temp"]["phase"] = $fb_["phase"];
 $fb_["temp"]["xmlAttributes"] = array();
 $fb_["temp"]["xmlAttributes"]["name"] = "myFusebox['thisCircuit']";
 $fb_["temp"]["xmlAttributes"]["value"] = $myFusebox["thisCircuit"];
 array_push($fb_["xnInitFA"], $fb_["temp"]);
 $fb_["temp"]["circuit"] = $fb_["fuseQ"][$fb_["pointer"]]["circuit"];
示例#4
0
function _throw($errorCode, $errorText)
{
    _bye("FATAL ERROR [" . $errorCode . "] " . $errorText);
    return __cfthrow(array("type" => "runtime.fatalError", "message" => "{$errorCode}: {$errorText}", "detail" => "Halted: {$errorText} ({$errorCode})"));
}
示例#5
0
             $fb_["verbInfo"]["lexicon"] = $fb_["lexicon"];
             $fb_["verbInfo"]["verb"] = $fb_["lexiconVerb"];
             $fb_["verbInfo"]["attributes"] = $fb_["fuseQ"][$fb_["i"]]["xmlAttributes"];
             if (array_key_exists($fb_["lexicon"], $application["fusebox"]["lexicons"])) {
                 if (file_exists($application["fusebox"]["approotdirectory"] . $application["fusebox"]["lexiconPath"] . $application["fusebox"]["lexicons"][$fb_["lexicon"]]["path"] . $fb_["lexiconVerb"] . '.' . $application["fusebox"]["scriptFileDelimiter"])) {
                     include ereg_replace("[\\/]+", "/", $application["fusebox"]["WebRootToAppRootPath"] . $application["fusebox"]["lexiconPath"] . $application["fusebox"]["lexicons"][$fb_["lexicon"]]["path"] . $fb_["lexiconVerb"] . '.' . $application["fusebox"]["scriptFileDelimiter"]);
                 } else {
                     if (!$application["fusebox"]["ignoreBadGrammar"]) {
                         __cfthrow(array("type" => "fusebox.badGrammar", "message" => "Bad Grammar verb in circuit file", "detail" => "The implementation file for the '" . $fb_["lexiconVerb"] . "' verb from the '" . $fb_["lexicon"] . "' custom lexicon could not be found.  It is used in the '" . $fb_["fuseQ"][$fb_["i"]]["circuit"] . "' circuit."));
                     } else {
                         // do nothing
                     }
                 }
             } else {
                 if (!$application["fusebox"]["ignoreBadGrammar"]) {
                     __cfthrow(array("type" => "fusebox.badGrammar", "message" => "Bad Grammar verb in circuit file", "detail" => "The '" . $fb_["lexicon"] . "' lexicon is not registered in fusebox.xml, but is used in the '" . $fb_["fuseQ"][$fb_["i"]]["circuit"] . "' circuit."));
                 }
             }
         } else {
             if ($application["fusebox"]["parseWithComments"]) {
                 fb_appendLine("// generated by fuseQ[" . $fb_["i"] . "]  UNKNOWN VERB: " . $fb_["fuseQ"][$fb_["i"]]["xmlName"]);
             }
             if (!$application["fusebox"]["ignoreBadGrammar"]) {
                 die("A bad grammar construct was encountered in the circuit " . $fb_["fuseQ"][$fb_["i"]]["circuit"] . " caused by the unknown or misspelled Fusebox grammar verb " . $fb_["fuseQ"][$fb_["i"]]["xmlName"] . ".");
             }
         }
         break;
 }
 if ($fb_["errorLevel"] > 0) {
     fb_appendLine("if ( \$php_errormsg ) break;");
 } else {
    flock($fp, LOCK_UN);
    fclose($fp);
    if (!isset($fb_["hasAssertions"])) {
        $fb_["hasAssertions"] = false;
    }
    if ($application["fusebox"]["mode"] != "production") {
        // write out the devparsed file
        if ($fb_["hasAssertions"]) {
            $fp = fopen($application["fusebox"]["approotdirectory"] . $fb_["assertedfile2Parse"], "w");
            if (!flock($fp, LOCK_EX)) {
                die("Could not get exclusive lock to Parsed File file");
            }
            if (!fwrite($fp, $fb_["devparsedfilecontents"])) {
                __cfthrow(array("type" => "fusebox.errorWritingParsedFile", "message" => "An Error during write of Parsed File or Parsing Directory not found.", "detail" => "Attempting to write the parsed file '" . $fb_["assertedfile2Parse"] . "' threw an error. This can also occur if the parsed file directory cannot be found."));
            }
            flock($fp, LOCK_UN);
            fclose($fp);
        }
    }
}
// OK, now execute everything
if ($myFusebox["parameters"]["execute"]) {
    if ($application["fusebox"]["useAssertions"] == true && file_exists($application["fusebox"]["approotdirectory"] . $fb_["assertedfile2Parse"])) {
        $fb_["file2Execute"] = $application["fusebox"]["WebRootToAppRootPath"] . $fb_["assertedfile2Parse"];
    } else {
        $fb_["file2Execute"] = $application["fusebox"]["WebRootToAppRootPath"] . $fb_["file2Parse"];
    }
    if (!(include $fb_["file2Execute"])) {
        __cfthrow(array("type" => "fusebox.missingParsedFile", "message" => "Parsed File or Directory not found.", "detail" => "Attempting to execute the parsed file " . $fb_["file2Execute"] . " threw an error. This can occur if the parsed file does not exist in the parsed directory or if the parsed directory itself is missing."));
    }
}