コード例 #1
0
 /**
  * Adds active promotion check
  *
  * @param array  $aWhere  SQL condition array
  * @param string $sqlFull SQL query string
  *
  * @return $sQ
  */
 protected function _prepareWhereQuery($aWhere, $sqlFull)
 {
     $sQ = parent::_prepareWhereQuery($aWhere, $sqlFull);
     $sDisplayType = (int) oxRegistry::getConfig()->getRequestParameter('displaytype');
     $sTable = getViewName("oxactions");
     //searchong for empty oxfolder fields
     if ($sDisplayType) {
         $sNow = date('Y-m-d H:i:s', oxRegistry::get("oxUtilsDate")->getTime());
         switch ($sDisplayType) {
             case 1:
                 // active
                 $sQ .= " and {$sTable}.oxactivefrom < '{$sNow}' and {$sTable}.oxactiveto > '{$sNow}' ";
                 break;
             case 2:
                 // upcoming
                 $sQ .= " and {$sTable}.oxactivefrom > '{$sNow}' ";
                 break;
             case 3:
                 // expired
                 $sQ .= " and {$sTable}.oxactiveto < '{$sNow}' and {$sTable}.oxactiveto != '0000-00-00 00:00:00' ";
                 break;
         }
     }
     return $sQ;
 }
コード例 #2
0
ファイル: theme_config.php プロジェクト: ioanok/symfoxid
 /**
  * Executes parent method parent::render(), creates deliveryset category tree,
  * passes data to Smarty engine and returns name of template file "deliveryset_main.tpl".
  *
  * @return string
  */
 public function render()
 {
     $myConfig = $this->getConfig();
     $sTheme = $this->_sTheme = $this->getEditObjectId();
     $sShopId = $myConfig->getShopId();
     if (!isset($sTheme)) {
         $sTheme = $this->_sTheme = $this->getConfig()->getConfigParam('sTheme');
     }
     $oTheme = oxNew('oxTheme');
     if ($oTheme->load($sTheme)) {
         $this->_aViewData["oTheme"] = $oTheme;
         try {
             $aDbVariables = $this->loadConfVars($sShopId, $this->_getModuleForConfigVars());
             $this->_aViewData["var_constraints"] = $aDbVariables['constraints'];
             $this->_aViewData["var_grouping"] = $aDbVariables['grouping'];
             foreach ($this->_aConfParams as $sType => $sParam) {
                 $this->_aViewData[$sParam] = $aDbVariables['vars'][$sType];
             }
         } catch (oxException $oEx) {
             oxRegistry::get("oxUtilsView")->addErrorToDisplay($oEx);
             $oEx->debugOut();
         }
     } else {
         oxRegistry::get("oxUtilsView")->addErrorToDisplay(oxNew("oxException", 'EXCEPTION_THEME_NOT_LOADED'));
     }
     return 'theme_config.tpl';
 }
コード例 #3
0
ファイル: dynscreen.php プロジェクト: mibexx/oxid_yttutorials
 /**
  * Sets up navigation for current view
  *
  * @param string $sNode None name
  */
 protected function _setupNavigation($sNode)
 {
     $myAdminNavig = $this->getNavigation();
     $sNode = oxRegistry::getConfig()->getRequestParameter("menu");
     // active tab
     $iActTab = oxRegistry::getConfig()->getRequestParameter('actedit');
     $iActTab = $iActTab ? $iActTab : $this->_iDefEdit;
     $sActTab = $iActTab ? "&actedit={$iActTab}" : '';
     // list url
     $this->_aViewData['listurl'] = $myAdminNavig->getListUrl($sNode) . $sActTab;
     // edit url
     $sEditUrl = $myAdminNavig->getEditUrl($sNode, $iActTab) . $sActTab;
     if (!getStr()->preg_match("/^http(s)?:\\/\\//", $sEditUrl)) {
         //internal link, adding path
         /** @var oxUtilsUrl $oUtilsUrl */
         $oUtilsUrl = oxRegistry::get("oxUtilsUrl");
         $sSelfLinkParameter = $this->getViewConfig()->getViewConfigParam('selflink');
         $sEditUrl = $oUtilsUrl->appendParamSeparator($sSelfLinkParameter) . $sEditUrl;
     }
     $this->_aViewData['editurl'] = $sEditUrl;
     // tabs
     $this->_aViewData['editnavi'] = $myAdminNavig->getTabs($sNode, $iActTab);
     // active tab
     $this->_aViewData['actlocation'] = $myAdminNavig->getActiveTab($sNode, $iActTab);
     // default tab
     $this->_aViewData['default_edit'] = $myAdminNavig->getActiveTab($sNode, $this->_iDefEdit);
     // passign active tab number
     $this->_aViewData['actedit'] = $iActTab;
     // buttons
     $this->_aViewData['bottom_buttons'] = $myAdminNavig->getBtn($sNode);
 }
コード例 #4
0
 /**
  * Add PayPal payment method set EN and DE long descriptions
  */
 public static function addPaymentMethod()
 {
     $aPaymentDescriptions = array('en' => '<div>When selecting this payment method you are being redirected to PayPal where you can login into your account or open a new account. In PayPal you are able to authorize the payment. As soon you have authorized the payment, you are again redirected to our shop where you can confirm your order.</div> <div style="margin-top: 5px">Only after confirming the order, transfer of money takes place.</div>', 'de' => '<div>Bei Auswahl der Zahlungsart PayPal werden Sie im n&auml;chsten Schritt zu PayPal weitergeleitet. Dort k&ouml;nnen Sie sich in Ihr PayPal-Konto einloggen oder ein neues PayPal-Konto er&ouml;ffnen und die Zahlung autorisieren. Sobald Sie Ihre Daten f&uuml;r die Zahlung best&auml;tigt haben, werden Sie automatisch wieder zur&uuml;ck in den Shop geleitet, um die Bestellung abzuschlie&szlig;en.</div> <div style="margin-top: 5px">Erst dann wird die Zahlung ausgef&uuml;hrt.</div>');
     $oPayment = oxNew('oxPayment');
     if (!$oPayment->load('oxidpaypal')) {
         $oPayment->setId('oxidpaypal');
         $oPayment->oxpayments__oxactive = new oxField(1);
         $oPayment->oxpayments__oxdesc = new oxField('PayPal');
         $oPayment->oxpayments__oxaddsum = new oxField(0);
         $oPayment->oxpayments__oxaddsumtype = new oxField('abs');
         $oPayment->oxpayments__oxfromboni = new oxField(0);
         $oPayment->oxpayments__oxfromamount = new oxField(0);
         $oPayment->oxpayments__oxtoamount = new oxField(10000);
         $oLanguage = oxRegistry::get('oxLang');
         $aLanguages = $oLanguage->getLanguageIds();
         foreach ($aPaymentDescriptions as $sLanguageAbbreviation => $sDescription) {
             $iLanguageId = array_search($sLanguageAbbreviation, $aLanguages);
             if ($iLanguageId !== false) {
                 $oPayment->setLanguage($iLanguageId);
                 $oPayment->oxpayments__oxlongdesc = new oxField($sDescription);
                 $oPayment->save();
             }
         }
     }
 }
コード例 #5
0
 /**
  * Composes and sends drawal form, returns false if some parameters are missing
  *
  * @return bool
  */
 public function send()
 {
     $aParams = $this->getConfig()->getRequestParameter('editval');
     // checking email address
     if (!oxRegistry::getUtils()->isValidEmail($aParams['pswdf_email'])) {
         oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_INPUT_NOVALIDEMAIL');
         return false;
     }
     // spam spider prevension
     $sMac = $this->getConfig()->getRequestParameter('c_mac');
     $sMacHash = $this->getConfig()->getRequestParameter('c_mach');
     $oCaptcha = $this->getCaptcha();
     if (!$oCaptcha->pass($sMac, $sMacHash)) {
         // even if there is no exception, use this as a default display method
         oxRegistry::get("oxUtilsView")->addErrorToDisplay('MESSAGE_WRONG_VERIFICATION_CODE');
         return false;
     }
     $sSubject = $this->getConfig()->getRequestParameter('c_subject');
     if (!$aParams['pswdf_ordernr'] || !$aParams['pswdf_articles'] || !$aParams['pswdf_orderdate'] || !$aParams['pswdf_receiveddate'] || !$aParams['pswdf_name'] || !$aParams['pswdf_address'] || !$aParams['pswdf_email'] || !$aParams['pswdf_drawaldate']) {
         // even if there is no exception, use this as a default display method
         oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_INPUT_NOTALLFIELDS');
         return false;
     }
     $oShop = $this->getConfig()->getActiveShop();
     $oLang = oxRegistry::getLang();
     $sMessage = $oLang->translateString('PSWDF_MSG2') . "\r\n\r\n" . $oLang->translateString('PSWDF_ORDERNR') . " " . $aParams['pswdf_ordernr'] . "\r\n" . $oLang->translateString('PSWDF_DATE_ARTICLES') . " " . $aParams['pswdf_articles'] . "\r\n" . $oLang->translateString('PSWDF_DATE_ORDER') . " " . $aParams['pswdf_orderdate'] . "\r\n" . $oLang->translateString('PSWDF_DATE_RECEIVED') . " " . $aParams['pswdf_receiveddate'] . "\r\n\r\n" . $oLang->translateString('PSWDF_NAME') . " " . $aParams['pswdf_name'] . "\r\n" . $oLang->translateString('PSWDF_ADDRESS') . " " . $aParams['pswdf_address'] . "\r\n" . $oLang->translateString('PSWDF_EMAIL') . " " . $aParams['pswdf_email'] . "\r\n" . $oLang->translateString('PSWDF_DATE_DRAWAL') . " " . $aParams['pswdf_drawaldate'] . "\r\n";
     $oEmail = oxNew('oxemail');
     $blSendToOwner = $oEmail->sendEmail($oShop->oxshops__oxorderemail->value, $oLang->translateString('PSWDF_SUBJECT') . " " . $aParams['pswdf_name'] . " (#" . $aParams['pswdf_ordernr'] . ")", $sMessage);
     $blSendToCustomer = $oEmail->sendEmail($aParams['pswdf_email'], $oLang->translateString('PSWDF_SUBJECT_CUSTOMER') . " " . $aParams['pswdf_name'] . " (#" . $aParams['pswdf_ordernr'] . ")", $sMessage);
     if ($blSendToOwner && $blSendToCustomer) {
         $this->_blDrawalFormSendStatus = 1;
     } else {
         oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_CHECK_EMAIL');
     }
 }
コード例 #6
0
 public function fakeOrder($oUser, $oBasket)
 {
     $this->_setUser($oUser);
     $this->_loadFromBasket($oBasket);
     $oUserPayment = $this->_setPayment($oBasket->getPaymentId());
     $this->oxorder__oxordernr = new oxField("777");
     $sDate = date('Y-m-d H:i:s', oxRegistry::get("oxUtilsDate")->getTime());
     $this->oxorder__oxorderdate = new oxField($sDate);
     $this->oxorder__oxsenddate = new oxField($sDate);
     $this->_oUser = $oUser;
     $this->_oBasket = $oBasket;
     $this->_oPayment = $oUserPayment;
     /*
     oxRegistry::getUtils()->writeToLog(print_r($oBasket,true),"log.log");
     $this->_aVoucherList = $oBasket->getVouchers();
     //var_dump($oBasket->getVouchers());
     if (is_array($this->_aVoucherList))
     {
     
         foreach ($this->_aVoucherList as $sVoucherId => $oSimpleVoucher)
         {
             $oVoucher = oxNew('oxvoucher');
             $oVoucher->load($sVoucherId);
             $this->_aVoucherList[$sVoucherId] = $oVoucher;
         }
     }
     */
 }
コード例 #7
0
 public function testPrepareStrForSearch()
 {
     $this->assertEquals(' &auml; &ouml; &uuml; &Auml; &Ouml; &Uuml; &szlig; &', oxRegistry::get("oxUtilsString")->prepareStrForSearch(' ä ö ü Ä Ö Ü ß &amp;'));
     $this->assertEquals(' h&auml;user', oxRegistry::get("oxUtilsString")->prepareStrForSearch(' häuser'));
     $this->assertEquals('', oxRegistry::get("oxUtilsString")->prepareStrForSearch('qwertz'));
     $this->assertEquals('', oxRegistry::get("oxUtilsString")->prepareStrforSearch(''));
 }
コード例 #8
0
 public function request_product()
 {
     $myConfig = $this->getConfig();
     $myUtils = oxRegistry::getUtils();
     //control captcha
     $sMac = oxRegistry::getConfig()->getRequestParameter('c_mac');
     $sMacHash = oxRegistry::getConfig()->getRequestParameter('c_mach');
     $oCaptcha = $this->getCaptcha();
     if (!$oCaptcha->pass($sMac, $sMacHash)) {
         oxRegistry::get("oxUtilsView")->addErrorToDisplay('MESSAGE_WRONG_VERIFICATION_CODE');
         return;
     }
     /** @var oxMailValidator $oMailValidator */
     $oMailValidator = oxNew('oxMailValidator');
     $aParams = oxRegistry::getConfig()->getRequestParameter('pa');
     if (!isset($aParams['email']) || !$oMailValidator->isValidEmail($aParams['email'])) {
         oxRegistry::get("oxUtilsView")->addErrorToDisplay('MESSAGE_INVALID_EMAIL');
         return;
     }
     $aParams['aid'] = $this->getProduct()->getId();
     $oArticleRequest = oxNew("psarticlerequest");
     $oArticleRequest->psarticlerequest__oxuserid = new oxField(oxRegistry::getSession()->getVariable('usr'));
     $oArticleRequest->psarticlerequest__oxemail = new oxField($aParams['email']);
     $oArticleRequest->psarticlerequest__oxartid = new oxField($aParams['aid']);
     $oArticleRequest->psarticlerequest__oxshopid = new oxField($myConfig->getShopId());
     $oArticleRequest->psarticlerequest__oxlang = new oxField(oxRegistry::getLang()->getBaseLanguage());
     $oArticleRequest->psarticlerequest__oxstatus = new oxField(psArticleRequest::STATUS_RECEIVED);
     $oArticleRequest->save();
     $oEmail = oxNew("oxEmail");
     $oEmail->sendArticleRequestNotification($aParams, $oArticleRequest);
     $this->_iArticleRequestStatus = 1;
     oxRegistry::get("oxUtilsView")->addErrorToDisplay('PS_ARTICLEREQUEST_SUCCESS');
 }
コード例 #9
0
ファイル: module_config.php プロジェクト: ioanok/symfoxid
 /**
  * Executes parent method parent::render(), creates deliveryset category tree,
  * passes data to Smarty engine and returns name of template file "deliveryset_main.tpl".
  *
  * @return string
  */
 public function render()
 {
     $myConfig = $this->getConfig();
     $sModuleId = $this->_sModuleId = $this->getEditObjectId();
     $sShopId = $myConfig->getShopId();
     $oModule = oxNew('oxModule');
     if ($sModuleId && $oModule->load($sModuleId)) {
         try {
             $aDbVariables = $this->_loadMetadataConfVars($oModule->getInfo("settings"));
             $this->_aViewData["var_constraints"] = $aDbVariables['constraints'];
             $this->_aViewData["var_grouping"] = $aDbVariables['grouping'];
             $iCount = 0;
             foreach ($this->_aConfParams as $sType => $sParam) {
                 $this->_aViewData[$sParam] = $aDbVariables['vars'][$sType];
                 $iCount += count($aDbVariables['vars'][$sType]);
             }
         } catch (oxException $oEx) {
             oxRegistry::get("oxUtilsView")->addErrorToDisplay($oEx);
             $oEx->debugOut();
         }
     } else {
         oxRegistry::get("oxUtilsView")->addErrorToDisplay(new oxException('EXCEPTION_MODULE_NOT_LOADED'));
     }
     $this->_aViewData["oModule"] = $oModule;
     return 'module_config.tpl';
 }
コード例 #10
0
 /**
  * Returns SEO uri for content object. Includes parent category path info if
  * content is assigned to it
  *
  * @param oxcontent $oCont        content category object
  * @param int       $iLang        language
  * @param bool      $blRegenerate if TRUE forces seo url regeneration
  *
  * @return string
  */
 public function getContentUri($oCont, $iLang = null, $blRegenerate = false)
 {
     if (!isset($iLang)) {
         $iLang = $oCont->getLanguage();
     }
     //load details link from DB
     if ($blRegenerate || !($sSeoUrl = $this->_loadFromDb('oxContent', $oCont->getId(), $iLang))) {
         if ($iLang != $oCont->getLanguage()) {
             $sId = $oCont->getId();
             $oCont = oxNew('oxContent');
             $oCont->loadInLang($iLang, $sId);
         }
         $sSeoUrl = '';
         if ($oCont->getCategoryId() && $oCont->getType() === 2) {
             $oCat = oxNew('oxCategory');
             if ($oCat->loadInLang($iLang, $oCont->oxcontents__oxcatid->value)) {
                 $sParentId = $oCat->oxcategories__oxparentid->value;
                 if ($sParentId && $sParentId != 'oxrootid') {
                     $oParentCat = oxNew('oxCategory');
                     if ($oParentCat->loadInLang($iLang, $oCat->oxcategories__oxparentid->value)) {
                         $sSeoUrl .= oxRegistry::get("oxSeoEncoderCategory")->getCategoryUri($oParentCat);
                     }
                 }
             }
         }
         $sSeoUrl .= $this->_prepareTitle($oCont->oxcontents__oxtitle->value, false, $oCont->getLanguage()) . '/';
         $sSeoUrl = $this->_processSeoUrl($sSeoUrl, $oCont->getId(), $iLang);
         $this->_saveToDb('oxcontent', $oCont->getId(), $oCont->getBaseStdLink($iLang), $sSeoUrl, $iLang);
     }
     return $sSeoUrl;
 }
コード例 #11
0
 /**
  * {@inheritdoc}
  */
 public function execute(oxIOutput $oOutput)
 {
     $oInput = $this->getInput();
     $oDebugOutput = $oInput->hasOption(array('n', 'no-debug')) ? oxNew('oxNullOutput') : $oOutput;
     try {
         $aModuleIds = $this->_parseModuleIds();
         $aShopConfigs = $this->_parseShopConfigs();
     } catch (oxInputException $oEx) {
         $oOutput->writeLn($oEx->getMessage());
         return;
     }
     /** @var oxModuleStateFixer $oModuleStateFixer */
     $oModuleStateFixer = oxRegistry::get('oxModuleStateFixer');
     /** @var oxModule $oModule */
     $oModule = oxNew('oxModule');
     foreach ($aShopConfigs as $oConfig) {
         $oDebugOutput->writeLn('[DEBUG] Working on shop id ' . $oConfig->getShopId());
         foreach ($aModuleIds as $sModuleId) {
             if (!$oModule->load($sModuleId)) {
                 $oDebugOutput->writeLn("[DEBUG] {$sModuleId} can not be loaded - skipping");
                 continue;
             }
             $oDebugOutput->writeLn("[DEBUG] Fixing {$sModuleId} module");
             $oModuleStateFixer->fix($oModule, $oConfig);
         }
         $oDebugOutput->writeLn();
     }
     $oOutput->writeLn('Fixed module states successfully');
 }
コード例 #12
0
ファイル: StylaSEO_Util.php プロジェクト: styladev/oxid
 public function getRemoteContent($username)
 {
     $seoServerUrl = oxRegistry::getConfig()->getConfigParam('styla_seo_server');
     if (!$seoServerUrl) {
         $seoServerUrl = self::SEO_URL;
     }
     $basedir = oxRegistry::getConfig()->getConfigParam('styla_seo_basedir');
     if (!$basedir) {
         $basedir = StylaSEO_Setup::STYLA_BASEDIR;
     }
     // Get the correct url for the server's url parameter
     $request = oxRegistry::get('oxUtilsServer')->getServerVar('REQUEST_URI');
     $request = substr($request, strpos($request, $basedir) + strlen($basedir) + 1);
     $url = rtrim($seoServerUrl, '/') . '/clients/' . $username . '?url=' . urlencode($request);
     $cache_key = preg_replace('/[\\/:]/i', '-', 'stylaseo_' . $url);
     if (!($arr = $this->loadFromCache($cache_key))) {
         try {
             $arr = $this->_fetchSeoData($url);
             if ($arr) {
                 $this->saveToCache($cache_key, $arr);
             }
         } catch (Exception $e) {
             echo 'ERROR: ' . $e->getMessage();
             return false;
         }
     }
     return $arr;
 }
コード例 #13
0
 /**
  * clear cache and reloading smarty object
  */
 public static function onActivate()
 {
     self::_clearCache();
     self::install();
     // reloading smarty object after activation
     oxRegistry::get("oxUtilsView")->getSmarty(true);
 }
コード例 #14
0
 /**
  * Parse response message received from Online License Key Check web service and save it to response object.
  *
  * @param string $sRawResponse
  *
  * @throws oxException
  *
  * @return oxOnlineLicenseCheckResponse
  */
 protected function _formResponse($sRawResponse)
 {
     /** @var oxUtilsXml $oUtilsXml */
     $oUtilsXml = oxRegistry::get("oxUtilsXml");
     if (empty($sRawResponse) || !($oDomDoc = $oUtilsXml->loadXml($sRawResponse))) {
         throw new oxException('OLC_ERROR_RESPONSE_NOT_VALID');
     }
     if ($oDomDoc->documentElement->nodeName != $this->_sResponseElement) {
         throw new oxException('OLC_ERROR_RESPONSE_UNEXPECTED');
     }
     $oResponseNode = $oDomDoc->firstChild;
     if (!$oResponseNode->hasChildNodes()) {
         throw new oxException('OLC_ERROR_RESPONSE_NOT_VALID');
     }
     $oNodes = $oResponseNode->childNodes;
     /** @var oxOnlineLicenseCheckResponse $oResponse */
     $oResponse = oxNew('oxOnlineLicenseCheckResponse');
     // iterate through response node to get response parameters
     for ($i = 0; $i < $oNodes->length; $i++) {
         $sNodeName = $oNodes->item($i)->nodeName;
         $sNodeValue = $oNodes->item($i)->nodeValue;
         $oResponse->{$sNodeName} = $sNodeValue;
     }
     return $oResponse;
 }
コード例 #15
0
ファイル: oxdbTest.php プロジェクト: Crease29/oxideshop_ce
 /**
  * Clean-up oxarticles table + parent::tearDown()
  */
 protected function tearDown()
 {
     $this->cleanUpTable('oxarticles');
     $oDb = oxDb::getInstance();
     $oDb->setConfig(oxRegistry::get('oxConfigFile'));
     parent::tearDown();
 }
コード例 #16
0
 /**
  * Magic call method making a default workflow call to Paymorrow API.
  *
  * @param string $sMethodName
  * @param array  $aArguments
  *
  * @return array
  */
 public function __call($sMethodName, $aArguments)
 {
     // Get all gateway related instances: client, data provider and response, handler
     /** @var OxpsOxid2Paymorrow $oOxidToPm */
     $oOxidToPm = oxNew('OxpsOxid2Paymorrow');
     /** @var OxpsPaymorrowClient|PaymorrowClient $oClient */
     $oClient = $this->getPmClient();
     /** @var OxpsPaymorrowEshopDataProvider $oDataProvider */
     $oDataProvider = $oOxidToPm->getEshopDataProvider();
     /** @var OxpsPaymorrowResponseHandler $oResponseHandler */
     $oResponseHandler = oxRegistry::get('OxpsPaymorrowResponseHandler');
     // Set method URL
     $oClient->setEndPoint($this->getEndPointUrl() . $sMethodName);
     // Collect auth data and perform a request
     $aResponseData = $oClient->sendRequest(array_merge($oDataProvider->collectCommonData(), (array) reset($aArguments)));
     // Check it response is OK or an error
     if (isset($aResponseData['response_status']) and $aResponseData['response_status'] === 'OK') {
         $sResponseHandlerMethodFormat = 'handle%sResponseOK';
     } else {
         $sResponseHandlerMethodFormat = 'handle%sResponseError';
     }
     // Call the response handler method
     $sResponseHandlerMethod = sprintf($sResponseHandlerMethodFormat, ucfirst($sMethodName));
     $oResponseHandler->{$sResponseHandlerMethod}($aResponseData);
     // Return formatted response data
     return $this->prepareResponseData($aResponseData);
 }
 /**
  * @return ContainerInterface
  */
 public function getContainer()
 {
     if ($this->container === null) {
         $this->container = \oxRegistry::get('container');
     }
     return $this->container;
 }
コード例 #18
0
ファイル: download.php プロジェクト: mibexx/oxid_yttutorials
 /**
  * Checks if given token is valid, formats HTTP headers,
  * and outputs file to buffer.
  *
  * If token is not valid, redirects to start page.
  */
 public function render()
 {
     $sFileOrderId = oxRegistry::getConfig()->getRequestParameter('sorderfileid');
     if ($sFileOrderId) {
         $oArticleFile = oxNew('oxFile');
         try {
             /** @var oxOrderFile $oOrderFile */
             $oOrderFile = oxNew('oxOrderFile');
             if ($oOrderFile->load($sFileOrderId)) {
                 $sFileId = $oOrderFile->getFileId();
                 $blLoadedAndExists = $oArticleFile->load($sFileId) && $oArticleFile->exist();
                 if ($sFileId && $blLoadedAndExists && $oOrderFile->processOrderFile()) {
                     $oArticleFile->download();
                 } else {
                     $sError = "ERROR_MESSAGE_FILE_DOESNOT_EXIST";
                 }
             }
         } catch (oxException $oEx) {
             $sError = "ERROR_MESSAGE_FILE_DOWNLOAD_FAILED";
         }
     } else {
         $sError = "ERROR_MESSAGE_WRONG_DOWNLOAD_LINK";
     }
     if ($sError) {
         $oEx = new oxExceptionToDisplay();
         $oEx->setMessage($sError);
         oxRegistry::get("oxUtilsView")->addErrorToDisplay($oEx, false);
         oxRegistry::getUtils()->redirect(oxRegistry::getConfig()->getShopUrl() . 'index.php?cl=account_downloads');
     }
 }
コード例 #19
0
ファイル: report_base.php プロジェクト: ioanok/symfoxid
 /**
  * Returns array with week range points
  *
  * @return array
  */
 public function getWeekRange()
 {
     $myConfig = $this->getConfig();
     // initializing one week before current..
     $iFrom = oxRegistry::get("oxUtilsDate")->getWeekNumber($myConfig->getConfigParam('iFirstWeekDay'), strtotime(oxRegistry::getConfig()->getRequestParameter("time_from")));
     $iTo = oxRegistry::get("oxUtilsDate")->getWeekNumber($myConfig->getConfigParam('iFirstWeekDay'), strtotime(oxRegistry::getConfig()->getRequestParameter("time_to")));
     return array($iFrom - 1, $iTo + 1);
 }
コード例 #20
0
 public function getLink($iLang = null)
 {
     //echo $this->oxcontents__external->value;
     if ($this->oxcontents__external->value == 1) {
         return oxRegistry::get("oxUtilsView")->parseThroughSmarty($this->oxcontents__oxcontent->value, "cmsmenu_" . $this->getId());
     }
     return parent::getLink($iLang);
 }
コード例 #21
0
ファイル: oxremark.php プロジェクト: Crease29/oxideshop_ce
 /**
  * Inserts object data fields in DB. Returns true on success.
  *
  * @return bool
  */
 protected function _insert()
 {
     // set oxcreate
     $sNow = date('Y-m-d H:i:s', oxRegistry::get("oxUtilsDate")->getTime());
     $this->oxremark__oxcreate = new oxField($sNow, oxField::T_RAW);
     $this->oxremark__oxheader = new oxField($sNow, oxField::T_RAW);
     return parent::_insert();
 }
コード例 #22
0
 public function init()
 {
     parent::init();
     if (!oxConfig::getParameter('fnc')) {
         $oViewConf = $this->getViewConfig();
         oxRegistry::get('oxUtils')->redirect($oViewConf->getHomeLink(), false);
     }
 }
コード例 #23
0
 /**
  * {@inheritdoc}
  */
 public function configure()
 {
     $this->setName('g:module');
     $this->setDescription('Generate new module scaffold');
     $this->_oSmarty = oxRegistry::get('oxUtilsView')->getSmarty();
     $this->_sModuleDir = OX_BASE_PATH . 'modules' . DIRECTORY_SEPARATOR;
     $this->_sTemplatesDir = __DIR__ . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'module' . DIRECTORY_SEPARATOR;
 }
コード例 #24
0
 public function getModuleExtensions()
 {
     $m = $this->getModule();
     var_dump($m);
     exit;
     //->getExtensions()
     oxRegistry::get("devutils")->success();
 }
コード例 #25
0
 private function log($message, $debuginfo)
 {
     if (oxRegistry::getConfig()->getShopConfVar('PAYMILL_ACTIVATE_LOGGING')) {
         $logging = oxNew('paymill_logging');
         $logging->assign(array('identifier' => $this->getSession()->getVar('paymill_identifier'), 'debug' => $debuginfo, 'message' => $message, 'date' => date('Y-m-d H:i:s', oxRegistry::get("oxUtilsDate")->getTime())));
         $logging->save();
     }
 }
コード例 #26
0
 /**
  * Uploaded file processor (filters, etc), sets configuration parameters to  passed object and returns it.
  *
  * @param object $oObject          Object, that parameters are modified according to passed files.
  * @param array  $aFiles           Name of files to process.
  * @param bool   $blUseMasterImage Use master image as source for processing.
  * @param bool   $blUnique         TRUE - forces new file creation with unique name.
  *
  * @return object
  */
 public function processFiles($oObject = null, $aFiles = array(), $blUseMasterImage = false, $blUnique = true)
 {
     $aFiles = $aFiles ? $aFiles : $_FILES;
     if (isset($aFiles['myfile']['name'])) {
         $oDb = oxDb::getDb();
         $oConfig = $this->getConfig();
         $oStr = getStr();
         // A. protection for demoshops - strictly defining allowed file extensions.
         $blDemo = (bool) $oConfig->isDemoShop();
         // Folder where images will be processed.
         $sTmpFolder = $oConfig->getConfigParam('sCompileDir');
         $iNewFilesCounter = 0;
         $aSource = $aFiles['myfile']['tmp_name'];
         $aError = $aFiles['myfile']['error'];
         $sErrorsDescription = '';
         $oEx = oxNew('oxExceptionToDisplay');
         while (list($sKey, $sValue) = each($aFiles['myfile']['name'])) {
             $sSource = $aSource[$sKey];
             $iError = $aError[$sKey];
             $aFiletype = explode('@', $sKey);
             $sKey = $aFiletype[1];
             $sType = $aFiletype[0];
             $sValue = strtolower($sValue);
             $sImagePath = $this->_getImagePath($sType);
             // Should translate error to user if file was uploaded.
             if (UPLOAD_ERR_OK !== $iError && UPLOAD_ERR_NO_FILE !== $iError) {
                 $sErrorsDescription = $this->translateError($iError);
                 $oEx->setMessage($sErrorsDescription);
                 oxRegistry::get('oxUtilsView')->addErrorToDisplay($oEx, false);
             }
             // Checking file type and building final file name.
             if ($sSource && ($sValue = $this->_prepareImageName($sValue, $sType, $blDemo, $sImagePath, $blUnique))) {
                 // Moving to tmp folder for processing as safe mode or spec. open_basedir setup.
                 // Usually does not allow file modification in php's temp folder.
                 $sProcessPath = $sTmpFolder . basename($sSource);
                 if ($sProcessPath) {
                     if ($blUseMasterImage) {
                         // Using master image as source, so only copying it to.
                         $blMoved = $this->_copyFile($sSource, $sImagePath . $sValue);
                     } else {
                         $blMoved = $this->_moveImage($sSource, $sImagePath . $sValue);
                     }
                     if ($blMoved) {
                         // New image successfully add.
                         $iNewFilesCounter++;
                         // Assign the name.
                         if ($oObject && isset($oObject->{$sKey})) {
                             $oObject->{$sKey}->setValue($sValue);
                             $oDb->Execute("INSERT INTO `ongr_sync_jobs` SET\n                                            `TYPE` = 'U',\n                                            `WORKER_TYPE` = 'P',\n                                            `ENTITY` = 'pictures',\n                                            `TABLE` = ?,\n                                            `OXID` = ?,\n                                            `STATUS` = 0,\n                                            `PRIORITY` = 0,\n                                            `CHANGES` = ?", array($oObject->getCoreTableName(), $oObject->getId(), $sKey));
                         }
                     }
                 }
             }
         }
         $this->_setNewFilesCounter($iNewFilesCounter);
     }
     return $oObject;
 }
コード例 #27
0
ファイル: oxsmartyrenderer.php プロジェクト: ioanok/symfoxid
 /**
  * Template renderer
  *
  * @param string $sTemplateName Template name.
  * @param array  $aViewData     Array of view data (optional).
  *
  * @return string
  */
 public function renderTemplate($sTemplateName, $aViewData = array())
 {
     $oSmarty = oxRegistry::get("oxUtilsView")->getSmarty();
     foreach ($aViewData as $key => $value) {
         $oSmarty->assign($key, $value);
     }
     $sBody = $oSmarty->fetch($sTemplateName);
     return $sBody;
 }
コード例 #28
0
 /**
  * Initialize the fixture.
  *
  * @return null
  */
 protected function setUp()
 {
     parent::setUp();
     $oDB = oxDb::getDb();
     $myConfig = $this->getConfig();
     $sDate = date('Y-m-d', oxRegistry::get("oxUtilsDate")->getTime() - 5 * 24 * 60 * 60);
     $sInsert = "INSERT INTO `oxratings` (`OXID` ,`OXSHOPID` ,`OXUSERID` ,`OXOBJECTID` ,`OXRATING` ,`OXTIMESTAMP` ,\n                    `OXTYPE`) VALUES ('test', '" . $myConfig->getShopId() . "', 'oxdefaultadmin', '1651', '5', '{$sDate}', 'oxarticle')";
     $oDB->Execute($sInsert);
 }
コード例 #29
0
ファイル: pserrorlog_show.php プロジェクト: suabo/psErrorLog
 /**
  * Deletes logfile
  * 
  * @return array
  */
 public function deleteLogFile()
 {
     $sLogFilePath = oxRegistry::getConfig()->getLogsDir() . $this->_LogFileName;
     if (unlink($sLogFilePath)) {
         oxRegistry::get("oxUtilsView")->addErrorToDisplay('PSERRORLOG_DELETE_OK');
     } else {
         oxRegistry::get("oxUtilsView")->addErrorToDisplay('PSERRORLOG_DELETE_ERROR');
     }
 }
コード例 #30
0
 /**
  * returns instance of toxidCurl
  * @return toxidCurl
  */
 public function getToxid()
 {
     $toxidCurl = oxRegistry::get('toxidcurl');
     if (!$toxidCurl->getInitialized()) {
         $smartyParser = new toxid_curl_smarty_parser();
         $toxidCurl->init($smartyParser);
     }
     return $toxidCurl;
 }