Пример #1
0
    /* $data = array(array("SourceFile" => "{$metadatas[0]["SourceFile"]}",
           "XMP:Title" => "image",
           "XMP:Rights" => "image",
           "XMP:Creator" => "image",
           "XMP:City" => "image",
           "XMP:Country" => "image",
           "IPTC:Credit" => "image",
           "IPTC:Source" => "image"
       ));
       file_put_contents('../data/tmp.json', json_encode($data));
       $exiftool->setMetadata($uploaded_file,"../data/tmp.json");*/
    $model = new FileModel(pathinfo(basename($uploaded_file))['filename'] . ".json", "../data/");
    $metas = $exiftool->getMetadata($uploaded_file);
    $model->saveToFile($metas);
    $img = array('name' => $metas[0]["XMP"]["Title"], 'creator' => $metas[0]['XMP']["Creator"], 'filename' => pathinfo(basename($uploaded_file))['filename'], 'url' => "app/uploads/" . $metas[0]["File"]["FileName"]);
    append_to_file(json_encode($img), "../../images.json");
}
function append_to_file($data = array(), $file)
{
    if (file_exists($file)) {
        $inp = file_get_contents($file);
        $tempArray = json_decode($inp, true);
        if (isset($tempArray) && !empty($tempArray)) {
            array_push($tempArray, $data);
        } else {
            $tempArray = [$data];
        }
        $jsonData = json_encode($tempArray);
        file_put_contents($file, $jsonData);
    } else {
        echo "not exists";
Пример #2
0
$filename = preg_replace('/\\s+/', '_', $filename) . '.txt';
$regData = "regCode={$regCode}";
foreach ($_POST as $key => $value) {
    if ($regData != "") {
        $regData .= ",";
    }
    if ($key == "Amount") {
        $value = '\\$' . $value;
    }
    if ($key != "regCode") {
        $value = preg_replace('/,/', ';', $value);
        $regData .= $key . "=" . $value;
    }
}
$regData .= "\n";
append_to_file($filename, $regData);
$MerchantID = "107176";
$RegKey = "5B080255-FB4D-4AEB-8AB6-109AB736C339";
$RURL = "https://www.albanyepiscopaldiocese.org/pmtproc/pmtprocresponsepriest.php";
//Replace this with your response page
$x = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
$x .= '<html><body onload="document.frmReturn.submit()";>';
//
if ($Amount > '0') {
    //$x .= '<form action="https://www.albanyepiscopaldiocese.org/pmtproc/completeRegistrationPriest.php" method="post" name="frmReturn" id="frmReturn">';
    $x .= '<form action="https://webservices.primerchants.com/billing/TransactionCentral/EnterTransaction.asp?" method="post" name="frmReturn" id="frmReturn">';
    $x .= '<input type="hidden" name="MerchantID"   value="' . $MerchantID . '">';
    $x .= '<input type="hidden" name="RegKey"   value="' . $RegKey . '">';
    $x .= '<input type="hidden" name="RURL" value="' . $RURL . '">';
    $x .= '<input type="hidden" name="ConfirmPage"  value="' . $ConfirmPage . '">';
    $x .= '<input type="hidden" name="TransType"    value="' . $TransType . '">';