function main()
 {
     $feUserObj = tslib_eidtools::initFeUser();
     // Initialize FE user object
     tslib_eidtools::connectDB();
     //Connect to database
     $table = 'tx_drwiki_pages';
     $myPid = intval(t3lib_div::_GET('myPid'));
     $myKeyword = $GLOBALS['TYPO3_DB']->fullQuoteStr(trim(t3lib_div::_GET('myKeyword')), $table);
     $myKeyword = substr($myKeyword, 1, strlen($myKeyword) - 2);
     $searchString = $table . ".pid IN (" . $myPid . ") AND keyword like '%" . $myKeyword . "%'";
     // get Database entries
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, $searchString);
     $results = array();
     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $results[$row["uid"]] = $row["keyword"];
     }
     // Wir geben der Anfrage ein XML Objekt zurŸck
     $ajax_return_data = t3lib_div::array2xml($results);
     header('Expires: Mon, 26 Jul 2000 03:00:00 GMT');
     header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . 'GMT');
     header('Cache-Control: no-cache, must-revalidate');
     header('Pragma: no-cache');
     header('Content-Length: ' . strlen($ajax_return_data));
     header('Content-Type: text/xml');
     echo $ajax_return_data;
 }
	/**
	 * Check FE Session
	 *
	 * @return 	boolean
	 */
	public function render() {
		// settings
		global $TYPO3_CONF_VARS;
		$userObj = tslib_eidtools::initFeUser();
		$GLOBALS['TSFE'] = t3lib_div::makeInstance(
			'tslib_fe',
			$TYPO3_CONF_VARS,
			t3lib_div::_GET('id'),
			0,
			true
		);
		$GLOBALS['TSFE']->fe_user = $userObj;

		// random value for session storing
		$value = md5(time());

		// store in session
		$GLOBALS['TSFE']->fe_user->setKey('ses', $this->sessionKey, $value);
		$GLOBALS['TSFE']->storeSessionData();

		if ($GLOBALS['TSFE']->fe_user->getKey('ses', $this->sessionKey) === $value) {
			return true;
		}
		return false;
	}
 public function __construct()
 {
     tslib_eidtools::connectDB();
     tslib_eidtools::initFeUser();
     tslib_eidtools::initLanguage();
     tslib_eidtools::initTCA();
 }
 function main()
 {
     // Initialize FE user object
     $this->feUserObj = tslib_eidtools::initFeUser();
     //Connect to database
     tslib_eidtools::connectDB();
     // sanitize params
     // ticket uid
     $this->ticketUid = intval(t3lib_div::_GP('ticketUid'));
     if (!$this->ticketUid) {
         die;
     }
     // cobj id
     $this->cObjId = intval(t3lib_div::_GP('cobjid'));
     if (!$this->cObjId) {
         die;
     }
     // other params
     $this->storagePid = intval(t3lib_div::_GP('storagePid'));
     $toDoUid = intval(t3lib_div::_GP('toDoUid'));
     $progressValue = intval(t3lib_div::_GP('progressValue'));
     $title = t3lib_div::removeXSS(t3lib_div::_GP('title'));
     $doneStatus = intval(t3lib_div::_GP('doneStatus'));
     $sorting = t3lib_div::_GP('sorting');
     // check user's permissions
     // exit if user has no permission for this ticket
     if (!$this->checkPermission()) {
         exit;
     }
     // switch actions
     switch (t3lib_div::_GP('action')) {
         case 'getToDos':
             echo json_encode($this->getToDos());
             break;
         case 'updateProgress':
             $this->setProgress($progressValue);
             break;
         case 'addToDo':
             $result = $this->addToDo($title, $storagePid);
             if ($result) {
                 echo json_encode($result);
             }
             break;
         case 'updateToDoStatus':
             echo json_encode($this->updateToDoStatus($toDoUid, $doneStatus));
             break;
         case 'removeToDo':
             echo json_encode($this->removeToDo($toDoUid));
             break;
         case 'calculateTicketProgress':
             echo json_encode($this->calculateTicketProgress());
             break;
         case 'updateSorting':
             echo json_encode($this->updateSorting($sorting));
             break;
     }
 }
 /**
  * Routes the given eID action to the related ExtDirect method with the necessary
  * ajax object.
  * 
  * @return void
  */
 public function routeAction()
 {
     tslib_eidtools::initLanguage();
     tslib_eidtools::connectDB();
     $ajaxID = t3lib_div::_GP('action');
     $ajaxScript = $GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX']['ExtDirect::' . $ajaxID];
     $this->ajaxObject = t3lib_div::makeInstance('TYPO3AJAX', 'ExtDirect::' . $ajaxID);
     $parameters = array();
     t3lib_div::callUserFunction($ajaxScript, $parameters, $this->ajaxObject, FALSE, TRUE);
 }
 /**
  * Initializes the instance of this class.
  */
 public function __construct()
 {
     $params = unserialize(base64_decode(t3lib_div::_GP('data')));
     if (is_array($params)) {
         $this->pageId = $params['id'];
         $this->parameters = $params['parameters'];
     }
     if (method_exists('tslib_eidtools', 'initTCA')) {
         tslib_eidtools::initTCA();
     }
     tslib_eidtools::connectDB();
 }
 protected function init()
 {
     $this->fieldname = $_GET['field'];
     $this->value = $_GET['value'];
     if (isset($_GET['pid'])) {
         $this->id = intval($_GET['pid']);
     } else {
         $this->id = intval($_GET['id']);
     }
     tslib_eidtools::connectDB();
     $this->initializeTSFE($this->id);
 }
Ejemplo n.º 8
0
 /**
  * Initialize.
  */
 public function initialize()
 {
     $hash = t3lib_div::_GP('hash');
     if (!preg_match('/^[a-z0-9]{32}$/i', $hash)) {
         $this->errors[] = array('ident' => 'badHash', 'message' => 'Incorrect hash given [' . $hash . ']!');
         return;
     }
     $this->hash = $hash;
     if (!tslib_eidtools::connectDB()) {
         $this->errors[] = array('ident' => 'noDb', 'message' => 'Could not connect to DB!');
         $this->hash = false;
     }
 }
 /**
  * Processes eID request.
  *
  * @return	void
  */
 public function main()
 {
     // Due to the nature of OpenID (redrections, etc) we need to force user
     // session fetching if there is no session around. This ensures that
     // our service is called even if there is no login data in the request.
     // Inside the service we will process OpenID response and authenticate
     // the user.
     $GLOBALS['TYPO3_CONF_VARS']['SVCONF']['auth']['FE_fetchUserIfNoSession'] = true;
     // Initialize Frontend user
     tslib_eidtools::connectDB();
     tslib_eidtools::initFeUser();
     // Redirect to the original location in any case (authenticated or not)
     @ob_end_clean();
     t3lib_utility_Http::redirect(t3lib_div::_GP('tx_openid_location'), t3lib_utility_Http::HTTP_STATUS_303);
 }
 /**
  * Initialize the class. Read GET parameters
  *
  * @return void
  */
 protected function init()
 {
     if (isset($_GET['pid'])) {
         $this->id = intval($_GET['pid']);
     } else {
         $this->id = intval($_GET['id']);
     }
     $this->componentManager = Tx_Formhandler_Component_Manager::getInstance();
     $this->globals = Tx_Formhandler_Globals::getInstance();
     $this->utilityFuncs = Tx_Formhandler_UtilityFuncs::getInstance();
     tslib_eidtools::connectDB();
     $this->utilityFuncs->initializeTSFE($this->id);
     $elementUID = intval($_GET['uid']);
     $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'tt_content', 'uid=' . $elementUID . ' AND pid=' . $this->id . $GLOBALS['TSFE']->cObj->enableFields('tt_content'));
     if (!empty($row)) {
         $GLOBALS['TSFE']->cObj->data = $row;
         $GLOBALS['TSFE']->cObj->current = 'tt_content_' . $elementUID;
     }
     $this->globals->setCObj($GLOBALS['TSFE']->cObj);
     $randomID = htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('randomID'));
     $this->globals->setRandomID($randomID);
     $this->globals->setAjaxMode(TRUE);
     if (!$this->globals->getSession()) {
         $ts = $GLOBALS['TSFE']->tmpl->setup['plugin.']['Tx_Formhandler.']['settings.'];
         $sessionClass = $this->utilityFuncs->getPreparedClassName($ts['session.'], 'Session_PHP');
         $this->globals->setSession($this->componentManager->getComponent($sessionClass));
     }
     $this->settings = $this->globals->getSession()->get('settings');
     $this->langFiles = $this->utilityFuncs->readLanguageFiles(array(), $this->settings);
     //init ajax
     if ($this->settings['ajax.']) {
         $class = $this->utilityFuncs->getPreparedClassName($this->settings['ajax.'], 'AjaxHandler_JQuery');
         $ajaxHandler = $this->componentManager->getComponent($class);
         $this->globals->setAjaxHandler($ajaxHandler);
         $ajaxHandler->init($this->settings['ajax.']['config.']);
         $ajaxHandler->initAjax();
     }
 }
 protected function init()
 {
     $this->fieldName = $_GET['field'];
     $this->uploadedFileName = $_GET['uploadedFileName'];
     if (isset($_GET['pid'])) {
         $this->id = intval($_GET['pid']);
     } else {
         $this->id = intval($_GET['id']);
     }
     $this->componentManager = Tx_Formhandler_Component_Manager::getInstance();
     tslib_eidtools::connectDB();
     $this->initializeTSFE($this->id);
     Tx_Formhandler_Globals::$cObj = $GLOBALS['TSFE']->cObj;
     $randomID = t3lib_div::_GP('randomID');
     Tx_Formhandler_Globals::$randomID = $randomID;
     if (!Tx_Formhandler_Globals::$session) {
         $ts = $GLOBALS['TSFE']->tmpl->setup['plugin.']['Tx_Formhandler.']['settings.'];
         $sessionClass = 'Tx_Formhandler_Session_PHP';
         if ($ts['session.']) {
             $sessionClass = Tx_Formhandler_StaticFuncs::prepareClassName($ts['session.']['class']);
         }
         Tx_Formhandler_Globals::$session = $this->componentManager->getComponent($sessionClass);
     }
     $this->settings = Tx_Formhandler_Globals::$session->get('settings');
     //init ajax
     if ($this->settings['ajax.']) {
         $class = $this->settings['ajax.']['class'];
         if (!$class) {
             $class = 'Tx_Formhandler_AjaxHandler_JQuery';
         }
         $class = Tx_Formhandler_StaticFuncs::prepareClassName($class);
         $ajaxHandler = $this->componentManager->getComponent($class);
         Tx_Formhandler_Globals::$ajaxHandler = $ajaxHandler;
         $ajaxHandler->init($this->settings['ajax.']['config.']);
         $ajaxHandler->initAjax();
     }
 }
 /**
  * The init Function, to check the access rights
  *
  * @return void
  */
 function init()
 {
     $this->arrExtConf = $this->GetExtConf();
     $this->u = intval(t3lib_div::_GP('u'));
     if (!$this->u) {
         $this->u = 0;
     }
     $this->hash = t3lib_div::_GP('hash');
     $this->t = t3lib_div::_GP('t');
     $this->file = t3lib_div::_GP('file');
     $this->data = $this->u . $this->file . $this->t;
     $this->checkhash = t3lib_div::hmac($this->data);
     // Hook for init:
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/naw_securedl/class.tx_nawsecuredl_output.php']['init'])) {
         $_params = array('pObj' => &$this);
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/naw_securedl/class.tx_nawsecuredl_output.php']['init'] as $_funcRef) {
             t3lib_div::callUserFunction($_funcRef, $_params, $this);
         }
     }
     if ($this->checkhash != $this->hash) {
         header('HTTP/1.1 403 Forbidden');
         exit('Access denied!');
     }
     if (intval($this->t) < time()) {
         header('HTTP/1.1 403 Forbidden');
         exit('Access denied!');
     }
     $this->feUserObj = tslib_eidtools::initFeUser();
     tslib_eidtools::connectDB();
     if ($this->u != 0) {
         $feuser = $this->feUserObj->user['uid'];
         if ($this->u != $feuser) {
             header('HTTP/1.1 403 Forbidden');
             exit('Access denied!');
         }
     }
 }
    function form_builder()
    {
        $bootstrapData = null;
        tslib_eidtools::connectDB();
        $tt_contentArray = $_GET['edit']['tt_content'];
        $pluginId = str_replace(',', '', key($tt_contentArray));
        if (!$tt_contentArray) {
            $tt_contentArray = urldecode($_GET['TSFE_EDIT']['record']);
            $tt_contentArray = explode(':', $tt_contentArray);
            $pluginId = $tt_contentArray[1];
        }
        $userId = $GLOBALS["BE_USER"]->user["uid"];
        ///index.php?eID=feeditadvanced&TSFE_EDIT%5Brecord%5D=tt_content%3A527&TSFE_EDIT%5Bpid%5D=1250&TSFE_EDIT[cmd]=edit&pid=1250
        $ajaxUrl = '/typo3/ajax.php';
        $ajaxId = 'ajaxID : "mailformplus_admin::ajaxFunctions"';
        if (strstr($_SERVER["REQUEST_URI"], 'feeditadvanced')) {
            $ajaxUrl = 'index.php';
            $ajaxId = 'eID : "tx_mailformplusadmin"';
        }
        $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery("uid,pid,title,lang,bodytext", "tx_mailformplusadmin_standardforms", "deleted=0", "", "", "") or die("8: " . $pageId . mysql_error());
        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
            $uid = $row["uid"];
            $formTitle = $row['title'];
            $otherForms .= "<option value=\"{$uid}\">{$formTitle}</option>";
        }
        $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery("uid,bodytext", "tt_content", "list_type='mailformplus_admin_pi2' AND deleted=0 AND bodytext LIKE '%\"user\":\"{$userId}\"}%'", "", "", "") or die("8: " . $pageId . mysql_error());
        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
            $uid = $row["uid"];
            $bodytext = $row["bodytext"];
            $jsonArray = json_decode($bodytext, true);
            $formTitle = $jsonArray['formtitle'];
            $formDescription = $jsonArray['formdescription'];
            $json = json_encode($jsonArray['fields']);
            if ($uid === $pluginId) {
                $bootstrapData = $json;
            } else {
                $otherForms .= "<option value=\"{$uid}\">{$formTitle} {$uid} {$pluginId} {$userId}</option>";
            }
        }
        $GLOBALS["TYPO3_DB"]->sql_free_result($res);
        if (!$bootstrapData) {
            $bootstrapData = '[{
                        "label": "Förnamn",
                        "field_type": "text",
                        "required": true,
                        "field_options": {"size":"medium"},
                        "cid": "c1"
                      },
                      {
                        "label": "Efternamn",
                        "field_type": "text",
                        "required": true,
                        "field_options": {"size":"medium"},
                        "cid": "c2"
                      },
                      {
                        "label": "Epostadress",
                        "field_type": "text",
                        "required": true,
                        "field_options": {"size":"medium"},
                        "cid": "c3"
                      },
                      {
                        "label": "Telefon",
                        "field_type": "text",
                        "required": true,
                        "field_options": {"size":"medium"},
                        "cid": "c4"
                      }
                      ]';
        }
        $otherForms = "Standard Forms<br /><select id=\"otherforms\" size=\"4\" onchange=\"changeForm('tx_mailformplusadmin_standardforms');\">{$otherForms}</select>";
        $formTitle = "Form Title<br /><input type=\"text\" name=\"formtitle\" id=\"formtitle\" value=\"{$formTitle}\" />";
        $formDescription = "Form Description<br /><textarea name=\"formdescription\" id=\"formdescription\" />{$formDescription}</textarea>";
        $fbghpPath = '/typo3conf/ext/mailformplus_admin/vendor/fbghp';
        $content = '<link rel="stylesheet" href="' . $fbghpPath . '/vendor/css/vendor.css" />
        <link rel="stylesheet" href="' . $fbghpPath . '/dist/formbuilder.css" />
            <link href="http://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet">
        <style>
            * {
                box-sizing: border-box;
            }

            body {
              font-family: sans-serif;
            }
            
            .ui-dialog {
                z-index:3600;
            }
            
            .fb-dialog {
                padding:
                background-color: #ccc;
            }

            .fb-main {
                background-color: #fff;
                border-radius: 5px;
                min-height: 600px;
                display: none;
            }
            
            .fb-button-container {
                position:relative;
                bottom:40px;
                padding:10px;
                background-color: green;
                border:1px black solid;
            }
            
            a.fb-button-container:link, a.fb-button-container:visited {
                text-decoration: none !important;
                color:#fff !important;
            }

            input[type=text] {
                height: 26px;
                margin-bottom: 3px;
            }

            select {
                margin-bottom: 5px;
                /*font-size: 40px;*/
            }
            
            .fb-field-wrapper {
                margin-bottom:0px;
            }
            
            .fb-left {
                padding-top: 0px;
            }
            
            .fb-right {
                padding-top: 40px;
            }

            .fb-head-cols {
                float:left;
                padding:10px;
            }
        </style>
        <div class="fb-button-container"><a href=#" onclick="loadFormBuilder();">Show Form Builder</a></div>
        <div class="fb-dialog"><div class="fb-head"><div class="fb-head-cols">' . $otherForms . '</div><div class="fb-head-cols">' . $formTitle . '</div><div class="fb-head-cols">' . $formDescription . '</div></div><div class="fb-main"></div></div>

            <script src="' . $fbghpPath . '/vendor/js/vendor.js"></script>
            <script src="' . $fbghpPath . '/vendor/js/jquery-ui-1.10.4.custom.min.js"></script>
            <script src="' . $fbghpPath . '/dist/formbuilder.js"></script>
                
            <script>
            
                function loadFormBuilder()
                {
                    
                    jQuery(".fb-dialog").dialog({
                        height: 700,
                        width: 800,
                        title: "Success",
                        modal: false
                     });
                     jQuery(".fb-dialog").dialog("open");
                     jQuery(".fb-head-display").show();
                     jQuery(".fb-main").show();
                }
                if (typeof(jQuery) == "undefined") {
                    var iframeBody = document.getElementsByTagName("body")[0];
                    var jQuery = function (selector) { return parent.jQuery(selector, iframeBody); };
                    var $ = jQuery;
                }
                if (typeof($) == "undefined") {
                    var iframeBody = document.getElementsByTagName("body")[0];
                    var $ = function (selector) { return parent.jQuery(selector, iframeBody); };
                    var jQuery = $;
                }
                jQuery(function(){
                    fb = new Formbuilder({
                        selector: ".fb-main",
                        bootstrapData: ' . $bootstrapData . '
                        
                    });
                    
                    jQuery(".fb-main").before(\'<div class="fb-head-display" style="padding:10px;clear:both;width:100%;height:120px;display:none;">\'+jQuery(".fb-head").html()+\'</div>\');
                    jQuery(".fb-head").remove();
                    

                    fb.on("save", function(payload){
                    //console.log(payload);
                        if(payload) {
                            ajaxFunction("saveFormStructure","' . $pluginId . ':' . $userId . '",payload);
                        }
                    })
                });
                
                function ajaxFunction(action,scope,json_str)
                {
		console.log("209");
                    if(json_str) {
                        var strformtitle = jQuery("#formtitle").val();
                        var strformdescription = jQuery("#formdescription").val();
                        var json_obj = JSON.parse(json_str);
                        json_obj.formtitle = strformtitle;
                        json_obj.formdescription = strformdescription;
                        json_str = JSON.stringify( json_obj );
                        //console.log("json_str"+json_str);
                    }
                    
                    jQuery.ajax({
                        type : "POST",
                        url : "' . $ajaxUrl . '",
                        data: {
                            ' . $ajaxId . ',
                            action : action,
                            scope : scope,
                            query : json_str,
                            sid : Math.random(),
                        },
                        dataType: "json",
                        /*beforeSend: function () {
                            $("#txtContent").html("<img src="/fileadmin/templates/images/ajax-loader.gif" />");
                        },*/
                        success: function(data) {
                            if(data) {
                                if(action=="getFormStructure") {
                                    var bootstrapData = data.fields;
                                    var formtitle = JSON.stringify(data.formtitle);
                                    var formdescription = JSON.stringify(data.formdescription);
                                    jQuery("#formtitle").val(formtitle);
                                    jQuery("#formdescription").val(formdescription);
                                    fb = new Formbuilder({
                                        selector: ".fb-main",
                                        bootstrapData: bootstrapData
                                    });
                                    //console.log(bootstrapData);
                                } else if(data=="saveFormStructure") {
                                    console.log(json_str);
                                }
                            }
                        },
                        complete: function(data) {
                            //console.log("complete"+data.content);
                        },
                        failure: function(errMsg) {
                            //console.log("failure"+errMsg);
                        },
                        error: function(errMsg) {
                            //console.log("error"+JSON.stringify(errMsg)+errMsg.content);
                        }
                    });
                }
                
                function changeForm(table)
                {
                    if(confirm("All your changes will be lost. Are you sure you want to do this?")) {
                        scope = jQuery("#otherforms").val();
                        //console.log("266: "+scope+":"+table);
                        ajaxFunction("getFormStructure",scope+":"+table,"")
                    }
                }
            </script>

        ';
        return $content;
    }
<?php

$ajax = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('request');
$ajax['vendor'] = 'Nng';
$ajax['extensionName'] = 'Nnfesubmit';
$TSFE = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('\\TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $TYPO3_CONF_VARS, 0, 0);
tslib_eidtools::connectDB();
tslib_eidtools::initLanguage();
// Get FE User Information
$TSFE->initFEuser();
// Important: no Cache for Ajax stuff
$TSFE->set_no_cache();
// TCA laden für extensions
$TSFE->includeTCA();
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA('nnfesubmit');
$TSFE->checkAlternativeIdMethods();
$TSFE->determineId();
//$TSFE->id = 2060;
$TSFE->initTemplate();
$TSFE->getConfigArray();
\TYPO3\CMS\Core\Core\Bootstrap::getInstance();
$TSFE->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('\\TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
$TSFE->settingLanguage();
$TSFE->settingLocale();
if (!$TSFE->baseUrl) {
    $baseUrl = $GLOBALS['TSFE']->config['config']['baseURL'];
    $TSFE->baseUrl = $baseUrl ? $baseUrl : $_SERVER['HTTP_HOST'];
}
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('\\TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
/**
 * Initialize Extbase bootstap
 function main()
 {
     $version = class_exists('t3lib_utility_VersionNumber') ? t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) : t3lib_div::int_from_ver(TYPO3_version);
     $this->cObj = t3lib_div::makeInstance('tslib_cObj');
     if ($version < 6002000) {
         $GLOBALS['TSFE'] = t3lib_div::makeInstance('tslib_fe');
         $GLOBALS['TSFE']->connectToDB();
         $GLOBALS['TSFE']->initFEuser();
         $GLOBALS['TSFE']->determineId();
         $GLOBALS['TSFE']->getCompressedTCarray();
         $GLOBALS['TSFE']->initTemplate();
         $GLOBALS['TSFE']->getConfigArray();
         $this->templateCode = $this->cObj->fileResource($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_myquizpoll_pi1.']['templateFile']);
         $template = $this->cObj->getSubpart($this->templateCode, "###TEMPLATE_STAR_RATING_DETAILS_ITEM###");
     } else {
         $template = '<div class="tx_myquizpoll_pi1-details_item">###ITEM_ANSWER### <span class="tx_myquizpoll_pi1-details_percent">###ITEM_PERCENT###%</span> <span class="tx_myquizpoll_pi1-details_count">(###ITEM_COUNTS###)</span></div>';
     }
     // Initialize FE user object:
     //$feUserObj = tslib_eidtools::initFeUser();
     // Connect to database:
     tslib_eidtools::connectDB();
     $qid = intval(t3lib_div::_GET('qid'));
     if ($qid) {
         if ($this->conf['answerChoiceMax']) {
             $this->answerChoiceMax = intval($this->conf['answerChoiceMax']);
         }
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery("*", "tx_myquizpoll_question", "hidden = 0 AND deleted = 0 AND uid = " . $qid, "", "uid ASC");
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             $answerNumber = 1;
             $totalAnswers = 0;
             while ($answerNumber <= $this->answerChoiceMax) {
                 if ($row['answer' . $answerNumber]) {
                     $totalAnswers++;
                 }
                 $answerNumber++;
             }
         }
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery("*", "tx_myquizpoll_relation", "hidden = 0 AND question_id = " . $qid, "", "uid ASC");
         $totalPoints = 0;
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             $answerNumber = 1;
             while ($answerNumber <= $totalAnswers) {
                 if ($row['checked' . $answerNumber]) {
                     $stat[$qid]['stars'][$answerNumber] += $row['checked' . $answerNumber];
                     $totalPoints++;
                 }
                 $answerNumber++;
             }
         }
         if ($stat) {
             $answerNumber = 1;
             while ($answerNumber <= $totalAnswers) {
                 $points = $stat[$qid]['stars'][$answerNumber] ? $stat[$qid]['stars'][$answerNumber] : '0';
                 $percent = number_format($points / $totalPoints * 100, 0, ',', ' ');
                 $stars = 1;
                 //$resstr .= $qid.' '.$answerNumber.': ';
                 $tempAnswer = '';
                 //$tempAnswer = '<div>';
                 while ($stars <= $totalAnswers) {
                     $tempAnswer .= '<input type="radio" name="qid' . $qid . '-answer' . $answerNumber . '" class="star" disabled="disabled" ' . ($answerNumber == $stars ? 'checked="checked" ' : '') . ' />';
                     $stars++;
                 }
                 $markerArray["###ITEM_ANSWER###"] = $tempAnswer;
                 $markerArray["###ITEM_PERCENT###"] = $percent;
                 $markerArray["###ITEM_COUNTS###"] = $points;
                 //$tempAnswer .= ' '.$percent.'% ('.$points.')</div>';
                 $resstr .= $this->cObj->substituteMarkerArray($template, $markerArray);
                 //$resstr .= $tempAnswer;
                 $answerNumber++;
             }
         }
     }
     $resstr = empty($resstr) ? '-1' : $resstr;
     // and fire ...
     //$ajax_return_data = t3lib_div::array2xml(array('data'=>$resstr));
     $ajax_return_data = $resstr;
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . 'GMT');
     header('Cache-Control: no-cache, must-revalidate');
     header('Pragma: no-cache');
     header('Content-Length: ' . strlen($ajax_return_data));
     //header('Content-Type: text/xml');
     echo $ajax_return_data;
     //echo "id: ".$GLOBALS["TSFE"]->id;
     exit;
 }
 /**
  * Get the current frontend user object
  *
  * @access	public
  *
  * @return	tslib_feUserAuth		Instance of tslib_feUserAuth or NULL on failure
  */
 public static function getFeUser()
 {
     if (TYPO3_MODE === 'FE') {
         // Check if a user is currently logged in.
         if (!empty($GLOBALS['TSFE']->loginUser)) {
             return $GLOBALS['TSFE']->fe_user;
         } elseif (t3lib_div::_GP('eID') !== NULL) {
             return tslib_eidtools::initFeUser();
         }
     } else {
         if (TYPO3_DLOG) {
             t3lib_div::devLog('[tx_dlf_helper->getFeUser()] Unexpected TYPO3_MODE "' . TYPO3_MODE . '"', self::$extKey, SYSLOG_SEVERITY_ERROR);
         }
     }
     return;
 }
 /**
  * Initialize the class. Read GET parameters
  *
  * @return void
  */
 protected function init()
 {
     $this->fieldname = htmlspecialchars(stripslashes($_GET['field']));
     $this->value = htmlspecialchars(stripslashes($_GET['value']));
     if (isset($_GET['pid'])) {
         $this->id = intval($_GET['pid']);
     } else {
         $this->id = intval($_GET['id']);
     }
     tslib_eidtools::connectDB();
     $this->globals = Tx_Formhandler_Globals::getInstance();
     $this->globals->setAjaxMode(TRUE);
     $this->utilityFuncs = Tx_Formhandler_UtilityFuncs::getInstance();
     $this->utilityFuncs->initializeTSFE($this->id);
 }
Ejemplo n.º 18
0
<?php

// deprecated, missing too much functionality
require_once PATH_tslib . 'class.tslib_pibase.php';
require_once PATH_tslib . 'class.tslib_eidtools.php';
tslib_eidtools::connectDB();
$GLOBALS['TSFE']->fe_user = tslib_eidtools::initFeUser();
$this->ms['eID'] = 1;
include_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'pi1/classes/class.mslib_fe.php';
include_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'pi1/classes/class.mslib_befe.php';
//require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('pagepath').'class.tx_pagepath_api.php');
$typeGet = mslib_fe::RemoveXSS(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('type'));
// pagepath plugin must be added soon to support cooluri urls when working in eID
/*
function typolink ($page_id='', $vars='')
{
	if (!$page_id) $page_id=$GLOBALS["TSFE"]->id;
	$conf=array();
	$conf['parameter']=$page_id;
	if ($vars) $conf['additionalParams']='&'.$vars;
	$conf['returnLast'] = 'url'; // get it as URL
//	$url = htmlspecialchars($GLOBALS["TSFE"]->cObj->typolink(NULL, $conf));	
	$url = tx_pagepath_api::getPagePath($page_id, $conf);
//		$url = $GLOBALS["TSFE"]->cObj->typolink(NULL, $conf);	
	return $url;
}
*/
Ejemplo n.º 19
0
 function _initFeUser()
 {
     tslib_eidtools::initFeUser();
 }
Ejemplo n.º 20
0
 function main()
 {
     $feUserObj = tslib_eidtools::initFeUser();
     // Initialize FE user object
     tslib_eidtools::connectDB();
     //Connect to database
     $id = t3lib_div::_GP('id');
     $action = t3lib_div::_GP('action');
     $username = $feUserObj->user[username];
     $get = t3lib_div::_GET();
     $post = t3lib_div::_POST();
     //t3lib_div::devLog('$get: ' . print_r($get,true), 'tx_he_tools_eid', 0);
     //t3lib_div::devLog('$post: ' . print_r($post,true), 'tx_he_tools_eid', 0);
     /** @var  $dbSuche  tx_he_tools_lib_db_suche */
     $dbSuche = t3lib_div::makeInstance('tx_he_tools_lib_db_suche');
     if ($action === 'hochschule_a_bis_z_suche') {
         $buchstabe = $get['buchstabe'];
         $eingabe = $get['eingabe'];
         $trenner = $get['trenner'];
         return $dbSuche->hochschuleABisZSucheGetList($eingabe, $buchstabe, $trenner, $username);
     } else {
         if ($action === 'abfall_a_bis_z_suche') {
             $buchstabe = $get['buchstabe'];
             $eingabe = $get['eingabe'];
             $trenner = $get['trenner'];
             return $dbSuche->abfallABisZSucheGetList($eingabe, $buchstabe, $trenner);
         } else {
             if ($action === 'ajaxContentForm') {
                 $data = array();
                 foreach ($get as $key => $val) {
                     if ($key != 'eID' && $key != 'app' && $key != 'action') {
                         $data[$key] = $val;
                     }
                     $data['username'] = $username;
                 }
                 return $dbSuche->ajaxContentFormGetList($get['app'], $data);
             } else {
                 if ($action === 'personensuche') {
                     if (empty($username)) {
                         exit;
                     }
                     if (isset($get['eingabe'])) {
                         $eingabe = $get['eingabe'];
                     } else {
                         $eingabe = '';
                     }
                     if (isset($get['bereich'])) {
                         $bereich = $get['bereich'];
                     } else {
                         $bereich = '';
                     }
                     if (isset($get['rolle'])) {
                         $rolle = $get['rolle'];
                     } else {
                         $rolle = '';
                     }
                     return $dbSuche->personenSucheGetList($eingabe, $bereich, $rolle);
                 } else {
                     if ($action === 'typo3_be_userliste') {
                         return tx_he_tools_pers_verwaltung::printBenutzerlisteBackend($get['val'], $get['groups']);
                     } else {
                         if ($action === 'typo3_fe_userliste') {
                             return tx_he_tools_pers_verwaltung::printBenutzerlisteFrontend($get['val'], $get['studis'], $get['groups']);
                         } else {
                             if ($action === 'typo3_fe_userliste_ohne_backend') {
                                 return tx_he_tools_pers_verwaltung::printBenutzerlisteFrontendOhneBackend(trim($get['val']));
                             } else {
                                 if ($action === 'addBeUser') {
                                     $returnUrl = $get['returnUrl'];
                                     $username = trim($get['fe_username']);
                                     return tx_he_tools_pers_verwaltung::addBackendUserFromFrontendUserData($username, $returnUrl);
                                 } else {
                                     if ($action === 'typo3_be_aliasliste_search') {
                                         return tx_he_tools_alias::printAliaslisteSearch($get['scriptUrl'], $get['val']);
                                     } else {
                                         if ($action === 'typo3_be_aliasliste_id') {
                                             return tx_he_tools_alias::printAliaslisteId($get['scriptUrl'], $get['val']);
                                         } else {
                                             if ($action === 'typo3_be_aliasLoeschen') {
                                                 return tx_he_tools_alias::aliasLoeschen($get['aliasUid']);
                                             } else {
                                                 if ($action === 'erzeugeKurzUrl') {
                                                     if (isset($get['length'])) {
                                                         $length = $get['length'];
                                                     } else {
                                                         $length = '';
                                                     }
                                                     $kurzUrl = tx_he_tools_alias::erzeugeKurzUrl($length);
                                                     self::returnTextData($kurzUrl);
                                                 } else {
                                                     if ($action === 'qr_url') {
                                                         $url = $get['url'];
                                                         if (isset($get['size'])) {
                                                             $size = $get['size'];
                                                         } else {
                                                             $size = '';
                                                         }
                                                         return tx_he_tools_qr_codes::getUrlLink($url, $size);
                                                     } else {
                                                         if ($action === 'download_qr_code') {
                                                             if (!isset($get['url'])) {
                                                                 return 'Keine URL übergeben!';
                                                             } else {
                                                                 $url = $get['url'];
                                                                 if (isset($get['size'])) {
                                                                     $size = $get['size'];
                                                                 } else {
                                                                     $size = '';
                                                                 }
                                                                 if (isset($get['alias'])) {
                                                                     $alias = $get['alias'];
                                                                 } else {
                                                                     $alias = '';
                                                                 }
                                                                 return tx_he_tools_qr_codes::downloadQrCode($url, $alias, $size);
                                                             }
                                                         } else {
                                                             if ($action === 'qr_alias_liste') {
                                                                 if (isset($get['quality'])) {
                                                                     $quality = $get['quality'];
                                                                 } else {
                                                                     $quality = '';
                                                                 }
                                                                 return tx_he_tools_qr_codes::printAliasliste($get['val'], $quality);
                                                             } else {
                                                                 if ($action === 'solr_action') {
                                                                     $solr = t3lib_div::makeInstance('tx_he_tools_solr');
                                                                     return $solr->eidAction($get);
                                                                 } else {
                                                                     if ($action === 'get_page_tstamp') {
                                                                         $res = tx_he_tools_util::getPageTstamp($get['uid']);
                                                                         $this->returnTextData($res);
                                                                     } else {
                                                                         if ($action === 'get_infoscreen_page_tstamp') {
                                                                             $res = tx_he_tools_infoscreen::getInfoscreenPageTstamp($get['uid']);
                                                                             $this->returnTextData($res);
                                                                         } else {
                                                                             if ($action === 'fe_logout') {
                                                                                 $where = 'ses_id = "' . $feUserObj->user['ses_id'] . '" AND ses_name = "fe_typo_user"';
                                                                                 $GLOBALS['TYPO3_DB']->exec_DELETEquery('fe_sessions', $where);
                                                                                 print 1;
                                                                                 exit;
                                                                             } else {
                                                                                 if ($action === 'fe_user_exists') {
                                                                                     $username = $get['username'];
                                                                                     $result = 0;
                                                                                     if (!empty($username)) {
                                                                                         $where = 'username = "******" AND deleted=0 and disable=0';
                                                                                         $anzahl = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'fe_users', $where);
                                                                                         if ($anzahl > 0) {
                                                                                             $result = 1;
                                                                                         }
                                                                                     }
                                                                                     print $result;
                                                                                     exit;
                                                                                 } else {
                                                                                     if ($action === 'gib_lsf_modb_vertiefungen') {
                                                                                         $lsf = t3lib_div::makeInstance('tx_he_tools_lsf');
                                                                                         $modulId = $get['modId'];
                                                                                         $data = $lsf->gibVertiefungenSelect($modulId);
                                                                                         $this->returnTextData($data);
                                                                                     } else {
                                                                                         if ($action === 'gib_lsf_modb_versionen') {
                                                                                             $lsf = t3lib_div::makeInstance('tx_he_tools_lsf');
                                                                                             $vertiefung = $get['vertiefung'];
                                                                                             $version = $get['version'];
                                                                                             $data = $lsf->gibVersionenSelect($vertiefung);
                                                                                             $this->returnTextData($data);
                                                                                         } else {
                                                                                             if ($action === 'test_gastkennungen_csv_exportiert') {
                                                                                                 $gastKennungen = t3lib_div::makeInstance('tx_he_tools_gast_kennungen');
                                                                                                 $uid = $get['uid'];
                                                                                                 $csvTest = $gastKennungen->csvDatenExportiert($uid);
                                                                                                 $this->returnJsonData($csvTest);
                                                                                                 exit;
                                                                                             } else {
                                                                                                 if ($action === 'gastkennung_loeschen') {
                                                                                                     $gastKennungen = t3lib_div::makeInstance('tx_he_tools_gast_kennungen');
                                                                                                     $antragsId = $get['antragsId'];
                                                                                                     $gastKennungen->gastKennungLoeschen($antragsId, $username);
                                                                                                     exit;
                                                                                                 } else {
                                                                                                     if ($action === 'file_download') {
                                                                                                         $fileUrl = base64_decode($get['file']);
                                                                                                         return tx_he_tools_util::downloadFile($fileUrl);
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return false;
 }
 /**
  * Initialize the class. Read GET parameters
  *
  * @return void
  */
 protected function init()
 {
     $this->fieldName = htmlspecialchars($_GET['field']);
     $this->uploadedFileName = htmlspecialchars($_GET['uploadedFileName']);
     if (isset($_GET['pid'])) {
         $this->id = intval($_GET['pid']);
     } else {
         $this->id = intval($_GET['id']);
     }
     $this->componentManager = Tx_Formhandler_Component_Manager::getInstance();
     $this->globals = Tx_Formhandler_Globals::getInstance();
     $this->utilityFuncs = Tx_Formhandler_UtilityFuncs::getInstance();
     tslib_eidtools::connectDB();
     $this->utilityFuncs->initializeTSFE($this->id);
     $this->globals->setCObj($GLOBALS['TSFE']->cObj);
     $randomID = htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('randomID'));
     $this->globals->setRandomID($randomID);
     if (!$this->globals->getSession()) {
         $ts = $GLOBALS['TSFE']->tmpl->setup['plugin.']['Tx_Formhandler.']['settings.'];
         $sessionClass = $this->utilityFuncs->getPreparedClassName($ts['session.'], 'Session_PHP');
         $this->globals->setSession($this->componentManager->getComponent($sessionClass));
     }
     $this->settings = $this->globals->getSession()->get('settings');
     $this->langFiles = $this->utilityFuncs->readLanguageFiles(array(), $this->settings);
     //init ajax
     if ($this->settings['ajax.']) {
         $class = $this->utilityFuncs->getPreparedClassName($this->settings['ajax.'], 'AjaxHandler_JQuery');
         $ajaxHandler = $this->componentManager->getComponent($class);
         $this->globals->setAjaxHandler($ajaxHandler);
         $ajaxHandler->init($this->settings['ajax.']['config.']);
         $ajaxHandler->initAjax();
     }
 }
Ejemplo n.º 22
0
<?php

define('BBT_restpath', dirname(__FILE__));
$GLOBALS['user'] = tslib_eidtools::initFeUser();
tslib_eidtools::connectDB();
require 'Slim/Slim/Slim.php';
require 'debug.php';
error_reporting(0);
$env_mock = array();
$specialHeaders = array('REQUEST_METHOD', 'REMOTE_ADDR', 'CONTENT_TYPE', 'CONTENT_LENGTH', 'PHP_AUTH_USER', 'PHP_AUTH_PW', 'PHP_AUTH_DIGEST', 'AUTH_TYPE', 'SCRIPT_NAME', 'QUERY_STRING', 'SERVER_NAME', 'SEVER_PORT');
foreach ($_SERVER as $key => $value) {
    $value = is_string($value) ? trim($value) : $value;
    if (strpos($key, 'HTTP_') === 0) {
        $env_mock[substr($key, 5)] = $value;
    } else {
        if (strpos($key, 'X_') === 0 || in_array($key, $specialHeaders)) {
            $env_mock[$key] = $value;
        }
    }
}
$env_mock['PATH_INFO'] = $_REQUEST['route'];
$env_mock['slim.url_scheme'] = empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off' ? 'http' : 'https';
$rawInput = @file_get_contents('php://input');
if (!$rawInput) {
    $rawInput = '';
}
$env_mock['slim.input'] = $rawInput;
$env_mock['slim.errors'] = fopen('php://stderr', 'w');
Slim_Environment::mock($env_mock);
$we_betatext = new Slim();
// die Funktionen für die einzelnen Abfragetypen liegen in eigenen Dateien
Ejemplo n.º 23
0
<?php

$user = tslib_eidtools::initFeUser();
$response = new \stdClass();
if ($user->user['uid'] > 0) {
    $response->foundUser = true;
    $response->userName = $user->user['username'];
} else {
    $response->foundUser = false;
}
header('Cache-Control: no-cache, no-store, must-revalidate');
// HTTP 1.1.
header('Pragma: no-cache');
// HTTP 1.0.
header('Expires: 0');
// Proxies.
header('Content-type: application/json');
echo json_encode($response);
die;