Beispiel #1
0
    public function getCartText($withPayPal = false)
    {
        $text = "";
        $paypalHTML = '<form id="formPayPal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
	<input type="hidden" name="cmd" value="_cart" />
	<input type="hidden" name="upload" value="1" />
	<input type="hidden" name="currency_code" value="EUR" />
	<input type="hidden" name="charset" value="utf-8" />
	<input type="hidden" name="invoice" value=";;;REPLACETHIS;;;" />
	<input type="hidden" name="business" value="' . $this->sellerEmail . '" />';
        $steuern = array();
        $gesamt = 0;
        $netto = 0;
        /*$c = $this->useClass;
        		
        		$mwst = $this->mwstField;
        		$name = $this->nameField;
        		$preis = $this->preisField;*/
        $i = 0;
        if ($this->cookie != "") {
            $text .= "\n        " . str_pad("Artikel", 40, " ") . " MwSt      Preis            Gesamt\n-------------------------------------------------------------------------------------------";
            while ($t = $this->getNextElement()) {
                $num = array_search($t[2], $this->useClass);
                if ($t[2] != "CookieCart") {
                    $c = $this->useClass[$num];
                    $A = new $c($t[0], false);
                    $A->loadMe();
                    $mwst = $this->mwstField[$num];
                    $name = $this->nameField[$num];
                    $preis = $this->preisField[$num];
                    $artikelnummer = $this->artikelnummerField[$num];
                } else {
                    $A = $this;
                    $this->PostenID = $t[0];
                    $mwst = "mwst";
                    $name = "artikelname";
                    $preis = "preis";
                    $artikelnummer = "artikelnummer";
                }
                try {
                    new Staffelpreis(-1);
                    if (class_exists("Staffelpreis")) {
                        $ac = new anyC();
                        $ac->setCollectionOf("Staffelpreis");
                        $ac->addAssocV3("StaffelpreisClass", "=", $this->useClass);
                        $ac->addAssocV3("StaffelpreisClassID", "=", $t[0]);
                        $ac->addAssocV3("StaffelpreisAmount", "<=", $t[1]);
                        $ac->addOrderV3("StaffelpreisAmount", "DESC");
                        $ac->setLimitV3("1");
                        $ac2 = $ac->getNextEntry();
                        if ($ac2 != null) {
                            $A->changeA($preis, $ac2->A("StaffelpreisPrice"));
                        }
                    }
                } catch (Exception $e) {
                }
                if (!isset($steuern[$A->getA()->{$mwst}])) {
                    $steuern[$A->getA()->{$mwst}] = 0;
                }
                $gesamt += $A->getA()->{$preis} * 1 * ($A->getA()->{$mwst} / 100 + 1) * $t[1];
                $netto += $A->getA()->{$preis} * 1 * $t[1];
                $steuern[$A->getA()->{$mwst}] += $A->getA()->{$preis} * 1 * ($A->getA()->{$mwst} / 100) * $t[1];
                #$image = $this->invokeParser($this->imagePathCallback, $t[0], $A);
                $tName = str_pad(substr($A->getA()->{$name}, 0, 38), 40, " ", STR_PAD_RIGHT);
                $tName .= str_pad("", Util::countUmlaute($tName), " ");
                $brutto = $A->getA()->{$preis} * 1 * ($A->getA()->{$mwst} / 100 + 1) * $t[1];
                $this->sum += $brutto;
                $this->count += $t[1];
                $text .= "\n" . str_pad($t[1], 5, " ", STR_PAD_LEFT) . " x " . $tName . "|" . str_pad(Util::formatNumber("de_DE", $A->getA()->{$mwst} * 1, 2, true, false), 7, " ", STR_PAD_LEFT) . "% |" . str_pad(Util::conv_euro8(Util::formatCurrency("de_DE", $A->getA()->{$preis} * 1 * ($A->getA()->{$mwst} / 100 + 1), true)), 15, " ", STR_PAD_LEFT) . " |" . str_pad(Util::conv_euro8(Util::formatCurrency("de_DE", $brutto, true)), 15, " ", STR_PAD_LEFT) . "";
                /**
                 * Artikelnummer in neuer Zeile
                 */
                if (isset($A->getA()->{$artikelnummer}) and $A->getA()->{$artikelnummer} != "") {
                    $text .= "\n" . str_pad("", 5, " ", STR_PAD_LEFT) . "   " . str_pad(substr("Art.Nr. " . $A->getA()->{$artikelnummer}, 0, 38), 40, " ", STR_PAD_RIGHT) . "|         |                |";
                }
                $i++;
                $ppName = str_replace(array("Ä", "Ö", "Ü", "ß", "ä", "ö", "ü"), array("Ae", "Oe", "Ue", "ss", "ae", "oe", "ue"), $tName);
                if ($t[2] == "CookieCart" and ($t[0] == "1" or $t[0] == "1010")) {
                    $paypalHTML .= '<input type="hidden" name="discount_amount_cart" value="' . abs($brutto) . '" />';
                } else {
                    $paypalHTML .= '
	<input type="hidden" name="item_name_' . $i . '" value="' . trim($ppName) . '"/ >
	<input type="hidden" name="amount_' . $i . '" value="' . Util::formatCurrency("en_GB", $brutto, false) . '" />';
                }
            }
            if ($this->versandkostenBrutto != null) {
                $tName = str_pad(substr($this->versandkostenBrutto[0], 0, 38), 40, " ", STR_PAD_RIGHT);
                $tName .= str_pad("", Util::countUmlaute($tName), " ");
                $text .= "\n" . str_pad("1", 5, " ", STR_PAD_LEFT) . " x " . $tName . "|" . str_pad(Util::formatNumber("de_DE", $this->versandkostenBrutto[2], 2, true, false), 7, " ", STR_PAD_LEFT) . "% |" . str_pad(Util::conv_euro8(Util::formatCurrency("de_DE", $this->versandkostenBrutto[1], true)), 15, " ", STR_PAD_LEFT) . " |" . str_pad(Util::conv_euro8(Util::formatCurrency("de_DE", $this->versandkostenBrutto[1], true)), 15, " ", STR_PAD_LEFT) . "";
                $gesamt += $this->versandkostenBrutto[1];
                $netto += Util::kRound($this->versandkostenBrutto[1] / ($this->versandkostenBrutto[2] + 100) * 100, 2);
                $steuern[number_format($this->versandkostenBrutto[2], 2)] += Util::kRound($this->versandkostenBrutto[1] / ($this->versandkostenBrutto[2] + 100) * $this->versandkostenBrutto[2], 2);
            }
            $s = "";
            foreach ($steuern as $key => $value) {
                $s .= ($s != "" ? "\n" : "") . "" . str_pad(Util::conv_euro8("Gesamt MwSt" . str_pad(Util::formatNumber("de_DE", $key * 1, 2, true, false), 7, " ", STR_PAD_LEFT) . "%: " . str_pad(Util::formatCurrency("de_DE", $value, true), 15, " ", STR_PAD_LEFT)), 91, " ", STR_PAD_LEFT);
            }
            $text .= "\n-------------------------------------------------------------------------------------------\n                                                        Gesamt Netto        " . str_pad(Util::conv_euro8(Util::formatCurrency("de_DE", $netto, true)), 15, " ", STR_PAD_LEFT) . "\n{$s}\n                                                      -------------------------------------\n                                                              Gesamt        " . str_pad(Util::conv_euro8(Util::formatCurrency("de_DE", $gesamt, true)), 15, " ", STR_PAD_LEFT);
        } else {
            $text = "Ihr Warenkorb enthält keine Artikel.";
        }
        $this->elementPointer = 0;
        $paypalHTML .= '
	<p>
	<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc.gif" style="width:auto;border:0px;" name="submit" />
	</p>
</form>';
        #if($withPayPal) $_SESSION["CookieCart_payPalHTML"] = $paypalHTML;
        #elseif(isset($_SESSION["CookieCart_payPalHTML"])) unset($_SESSION["CookieCart_payPalHTML"]);
        $this->PayPalButton = $paypalHTML;
        return $text;
    }
 public function useUser($username = null)
 {
     $ac = new anyC();
     $ac->setCollectionOf("User");
     if ($username != null) {
         $ac->addAssocV3("username", "=", $username);
     }
     $ac->addAssocV3("isAdmin", "=", "0");
     $ac->setLimitV3("1");
     $u = $ac->getNextEntry();
     if ($u == null) {
         $this->errors[] = "100";
         return false;
     }
     return $this->login($u->A("username"), $u->A("SHApassword"), true);
 }
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 *  2007 - 2012, Rainer Furtmeier - Rainer@Furtmeier.de
 */
error_reporting(E_ALL);
require "./multiCMSData/connect.php";
if (isset($_GET["filedl"])) {
    $DL = new Download($_GET["filedl"]);
    $DL->makeDownload();
    header("Location: " . $DL->getA()->url);
    exit;
}
if (isset($_GET["newestdl"])) {
    $aC = new anyC();
    $aC->setCollectionOf("Download");
    $aC->addAssocV3("ContentID", "=", $_GET["newestdl"]);
    $aC->addOrderV3("datum", "DESC");
    $aC->setLimitV3("1");
    $DL = $aC->getNextEntry();
    $DL = new Download($DL->getID());
    if (!isset($_GET["getLink"])) {
        $DL->makeDownload();
        header("Location: " . $DL->getA()->url);
        exit;
    } else {
        die($DL->getA()->url);
    }
}
Beispiel #4
0
 public function setTimer($id, $action, $type, $stunden, $minuten, $deviceName)
 {
     if ($action == "setBPSValue") {
         $action = $_SESSION["BPS"]->getProperty("mFhemTimer", "FhemValue");
     }
     switch ($type) {
         case "D":
             $F = new Fhem($id);
             $F->loadMe();
             $S = new FhemServer($F->getA()->FhemServerID);
             $S->loadMe();
             break;
         case "P":
             $ac = new anyC();
             $ac->setCollectionOf("FhemPreset");
             $ac->addJoinV3("FhemServer", "FhemPresetServerID", "=", "FhemServerID");
             $ac->addAssocV3("FhemPresetID", "=", $id);
             $ac->setLimitV3("1");
             $S = $ac->getNextEntry();
             $action = "on";
             break;
     }
     try {
         $T = new Telnet($S->getA()->FhemServerIP, $S->getA()->FhemServerPort);
     } catch (NoServerConnectionException $e) {
         die("error:'The connection to the server with IP-address " . $S->getA()->FhemServerIP . " could not be established!'");
     }
     $T->fireAndForget("define a" . rand(10, 10000000) . " at " . ($stunden < 10 ? "0" : "") . "{$stunden}:" . ($minuten < 10 ? "0" : "") . "{$minuten}:00 set " . $deviceName . " {$action}");
     $T->disconnect();
 }
 public function update($echo = false)
 {
     $oldest = new anyC();
     $oldest->setCollectionOf("Serie");
     $oldest->addOrderV3("lastupdate", "ASC");
     $oldest->addAssocV3("status", "=", "Continuing");
     $oldest->addAssocV3("lastupdate", "<", time() - 3600 * 24 * 3);
     $oldest->setLimitV3("2");
     while ($S = $oldest->getNextEntry()) {
         $this->download($S, $echo);
     }
     $oldest = new anyC();
     $oldest->setCollectionOf("Serie");
     $oldest->addOrderV3("lastupdate", "ASC");
     $oldest->addAssocV3("status", "=", "Ended");
     $oldest->addAssocV3("lastupdate", "<", time() - 3600 * 24 * 21);
     $oldest->setLimitV3("1");
     while ($S = $oldest->getNextEntry()) {
         $this->download($S, $echo);
     }
     $oldest = new anyC();
     $oldest->setCollectionOf("Serie");
     $oldest->addOrderV3("lastupdate", "ASC");
     $oldest->addAssocV3("lastupdate", "<", time() - 3600 * 24 * 3, "AND", "1");
     $oldest->addAssocV3("status", "=", "Continuing", "AND", "1");
     $oldest->addAssocV3("lastupdate", "<", time() - 3600 * 24 * 21, "OR", "2");
     $oldest->addAssocV3("status", "=", "Ended", "AND", "2");
     $oldest->lCV3();
     return $oldest->numLoaded();
 }