示例#1
0
$stylesheet_file = "css/registerForm.css";
include "templates/checkLevel.php";
include "templates/header.php";
// DB-Verbindung herstellen
require_once 'configuration.php';
// Kein Button betätigt, Aufruf über Menü, Daten zu User holen und anzeigen
if (!isset($_POST['logout']) && !isset($_POST['speichern']) && !isset($_POST['register']) && isset($_SESSION['userid'])) {
    getUserData($dbmysql);
}
// Button registrieren gedrückt, User neu anlegen
if (isset($_POST['register']) && isset($_POST['f_username'])) {
    createNewUser($dbmysql);
}
// Benutzer hat Daten geändert und speichern geklickt, Daten speichern
if (isset($_POST['speichern']) && isset($_SESSION['username'])) {
    saveUserData($dbmysql);
}
include "templates/breadcrumbs.html";
include "templates/navAndLogin.php";
// Verbindung wird in Login, was hier included wird, geschlossen
// -------------------
// HTML-Teil der Seite
// -------------------
?>

	<main>
		<?php 
// UserID noch nicht vorhanden -> Registrierung
if (!isset($_SESSION['userid'])) {
    ?>
			<h2>Registriere dich als Helfer</h2>
$filefield = 'custom4upload';
$upLoader =& new AMPSystem_Upload($_FILES[$filefield]['name']);
// $this->_initUploader( $data, $filefield, $upLoader );
$upLoader->setFolder(AMP_CONTENT_URL_IMAGES . AMP_IMAGE_CLASS_ORIGINAL);
if (!$upLoader->execute($_FILES[$filefield]['tmp_name'])) {
    return false;
}
$reSizer =& new ContentImage_Resize();
if ($reSizer->setImageFile($upLoader->getTargetPath())) {
    $reSizer->execute();
    AMP_lookup_clear_cached('images');
}
$imagePath = explode('/', $upLoader->getTargetPath());
$imageName = array_pop($imagePath);
if ($imageName) {
    $output = saveUserData($imageName);
    header("HTTP/1.1 200 OK");
    echo $output;
    //	exit();
}
ampredirect('/article.php?list=type&type=12');
function saveUserData($imageName)
{
    $json = new Services_JSON();
    $filefield = 'custom4upload';
    $debug = '';
    foreach ($_POST as $key => $value) {
        $debug .= "{$key}: {$value}<br />";
    }
    //Save User Data
    $userupdate = new AMP_User_Profile(AMP_Registry::getDbcon(), $_POST['Id']);
示例#3
0
    /**
     * Event listener method handles all Frontend actions
     *
     * @param Enlight_Event_EventArgs $args
     */
    static function onPostRatepayDispatch(Enlight_Event_EventArgs $args) {
        $config = Shopware()->Plugins()->Frontend()->PigmbhRatePAYPayment()->Config();
        Shopware()->Template()->addTemplateDir(dirname(__FILE__) . '/Views/Frontend/');
        /** @var $request Enlight_Controller_Request_RequestHttp */
        $request = $args->getSubject()->Request();
        // just be active in the frontend and while the plugin is enabled
        if ($request->getModuleName() == 'frontend' && $config->multishopactive == true) {
            $view = $args->getSubject()->View();
            Shopware()->Session()->pi_ratepay_rate_calc_path = Shopware()->Config()->get('basepath') . '/engine/Shopware/Plugins/Default/Frontend/PigmbhRatePAYPayment/Ratenrechner/';
            // return if no template could be found.
            if(!$view->hasTemplate()) {
                return;
            }
            $userData = $view->sUserData;
            if(isset($userData['billingadress']['id'])) {
                Shopware()->Session()->RatepayCustomerId=$userData['billingadress']['id'];
            }
            $ratepayPayment=checkRatepayPayment($userData);
            if ($userData && $ratepayPayment) {
                checkBillingEqualShipping($userData, $view);
                checkB2BAllowed($userData, $view);
                if(Shopware()->Session()->ratepayB2BInvoice && $userData["additional"]["payment"]["name"] == "RatePAYInvoice"
                    || Shopware()->Session()->ratepayB2BRate && $userData["additional"]["payment"]["name"] == "RatePAYRate"
                    || Shopware()->Session()->ratepayB2BDebit && $userData["additional"]["payment"]["name"] == "RatePAYDebit"
                    || Shopware()->Session()->ratePAYadressDiff) {
                    $sql = "UPDATE `s_user` SET `paymentID` = ? WHERE `id` = ?";
                    Shopware()->Db()->query($sql, array(
                        (int)Shopware()->Config()->Paymentdefault,
                        (int)$userData['billingaddress']['userID']
                    ));
                }
            }
            $view->extendsTemplate('index/header.tpl');
            //Checks if customer can pay with RatePAY, sets error messages and loads payment_fieldset template
            //Also implements fix for older templates and sets debit data
            // sViewport has been removed - instead $args->getSubject()->Request()->getControllerName() can be used
            if ($request->getControllerName() == 'account' || $request->getControllerName() == 'checkout' || $request->getControllerName() == 'register') {
                $basket = Shopware()->Session()->sOrderVariables['sBasket'];
                //gets userage and checks user data
                if ($userData) {
                    $userAge = getUserAge($userData, $view);
                    checkBillingEqualShipping($userData, $view);
                    checkUserData($userData, $view, $userAge);
                    checkB2BAllowed($userData, $view);
	                $view->debitData = getEncodedDebitData($userData['billingaddress']['userID']);
	                if(!isset($view->debitData)) $view->debitData = getDebitData();
                }
                //displays surcharge at payment selection
                if($basket){
                    setSurcharge($basket, $view);
                    Shopware()->Session()->pi_ratepay_Warenkorbbetrag = number_format($basket['AmountNumeric'], 2, ".", "");
                 }

                $view->activateDebit = $config->activate_debit;
                $view->extendsTemplate('register/payment_fieldset.tpl');
                //Saves data entered in RatePAY form
                if ($request->getActionName() == 'savePayment') {
                    $post = $args->getSubject()->Request()->getPost();
                    setDirectDebitSession($post);
                    if (isset($post['saveRatepayInvoiceData']) || isset($post['saveRatepayRateData']) || isset($post['saveRatepayDebitData'])){
                        saveUserData($args);
                    }
                    elseif($post['register']['payment'] == getDebitPaymentId()
                           || ($post['register']['payment']== getRatePaymentId() && Shopware()->Session()->RatepayDirectDebit)){
                        if(!checkDebitData($post)){
                            header('Location:'.str_replace("savePayment","payment",Shopware()->Config()->Host.$_SERVER['REQUEST_URI']));
                            //break;
                        } else{
                            Shopware()->Session()->RatepayRateMissingBankData = false;
                            Shopware()->Session()->RatepayDebitMissingBankData = false;
                            saveDebitData($args);
                        }
                    }
                }

                 //template fix and saving of direct debit selection for ratepay installment
                if($request->getActionName() == 'payment'){
                    if(Shopware()->Session()->RatepayDebitMissingBankData){
                            $view->RatepayDebitMissingBankData = true;
                    }
                    elseif(Shopware()->Session()->RatepayRateMissingBankData){
                            $view->RatepayRateMissingBankData = true;
                    }
                }

                //Sets debit data
                if(Shopware()->Session()->RatepayDirectDebit){
                    $view->ratepayDebitPayType = Shopware()->Session()->RatepayDirectDebit;
                }
                //Extends checkout with RatePAY AGB, rate calculator and payment notices and also sets template vars
                if ($request->getControllerName() == 'checkout' && $request->getActionName() != 'finish' && $request->getActionName() != 'cart'
                        && $request->sTargetAction != 'cart' && isset($ratepayPayment)) {
                    $view->extendsTemplate('checkout/confirm.tpl');
                    setTemplateVars($view, $request, $config, $userData);
                }
                //Confirms RatePAY order at finish page
                if ($request->getControllerName() == 'checkout' && $request->getActionName() == 'finish' && $request->getActionName() != 'cart'
                        && $ratepayPayment && !Shopware()->Session()->pi_ratepay_Confirm){
                    confirmPayment($config, $userData);
                }
            }
        }
    }
示例#4
0
<?php

require_once 'JSON/JSON.php';
require_once 'AMP/User/Profile/Profile.php';
if ($_GET['Type'] == 'Get' && isset($_GET['Type']) && isset($_GET['Id'])) {
    $output = getUserData(intval($_GET['Id']));
    header("HTTP/1.1 200 OK");
    echo $output;
    exit;
}
if ($_GET['Type'] == 'Post' && isset($_GET['Type']) && isset($_GET['Id'])) {
    $output = saveUserData();
    header("HTTP/1.1 200 OK");
    echo $output;
    exit;
}
function saveUserData()
{
    $json = new Services_JSON();
    $debug = '';
    foreach ($_GET as $key => $value) {
        $debug .= "{$key}: {$value}<br />";
    }
    //Validate incoming User Data
    if ($_GET['Email'] == NULL || $_GET['Email'] == '') {
        $message = array('type' => 'bad', 'text' => 'Please Enter an Email Address');
        $json_data = array('message' => $message, 'debug' => $debug);
        $output = $json->encode($json_data);
        return $output;
    }
    //Save User Data