コード例 #1
0
ファイル: delivery_articles.php プロジェクト: ioanok/symfoxid
 /**
  * Executes parent method parent::render(), creates delivery category tree,
  * passes data to Smarty engine and returns name of template file "delivery_main.tpl".
  *
  * @return string
  */
 public function render()
 {
     parent::render();
     $soxId = $this->getEditObjectId();
     if ($soxId != "-1" && isset($soxId)) {
         $this->_createCategoryTree("artcattree");
         // load object
         $oDelivery = oxNew("oxdelivery");
         $oDelivery->load($soxId);
         $this->_aViewData["edit"] = $oDelivery;
         //Disable editing for derived articles
         if ($oDelivery->isDerived()) {
             $this->_aViewData['readonly'] = true;
         }
     }
     $iAoc = oxRegistry::getConfig()->getRequestParameter("aoc");
     if ($iAoc == 1) {
         $oDeliveryArticlesAjax = oxNew('delivery_articles_ajax');
         $this->_aViewData['oxajax'] = $oDeliveryArticlesAjax->getColumns();
         return "popups/delivery_articles.tpl";
     } elseif ($iAoc == 2) {
         $oDeliveryCategoriesAjax = oxNew('delivery_categories_ajax');
         $this->_aViewData['oxajax'] = $oDeliveryCategoriesAjax->getColumns();
         return "popups/delivery_categories.tpl";
     }
     return "delivery_articles.tpl";
 }
コード例 #2
0
ファイル: loginTest.php プロジェクト: Crease29/oxideshop_ce
 /**
  * Tries to login with old password from different subshop, makes sure there are no crashes
  */
 public function testAdminLoginWithOldPasswordMultishop()
 {
     $this->setAdminMode(true);
     //faking cookie check
     $oUtils = $this->getMock("oxUtilsServer", array("getOxCookie"));
     $oUtils->expects($this->any())->method("getOxCookie")->will($this->returnValue(array("test" => "test")));
     oxRegistry::set("oxUtilsServer", $oUtils);
     //creating test admin user
     $oUser = $this->_createUser($this->_sDefaultUserName, $this->_sOldEncodedPassword, $this->_sOldSalt);
     //updating user over oxBase methods as oxUser restricts rights update
     $oUpdUser = oxNew('oxBase');
     $oUpdUser->init("oxuser");
     $oUpdUser->load($oUser->getId());
     $oUpdUser->oxuser__oxrights = new oxField(1);
     $oUpdUser->oxuser__oxshopid = new oxField(1);
     $oUpdUser->save();
     //set active shop 2
     oxRegistry::getConfig()->setShopId(2);
     //perform the login
     $this->_login($this->_sDefaultUserName, $this->_sDefaultUserPassword);
     $oUser->load($oUser->getId());
     $this->assertEquals(1, $oUser->oxuser__oxshopid->value, "User shop ID changed");
     $this->assertSame($oUser->getId(), oxRegistry::getSession()->getVariable('auth'), 'User ID is missing in session.');
     $this->assertNotSame($this->_sOldEncodedPassword, $oUser->oxuser__oxpassword->value, 'Old and new passwords must not match.');
     $this->assertNotSame($this->_sOldSalt, $oUser->oxuser__oxpasssalt->value, 'Old and new salt must not match.');
 }
コード例 #3
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;
 }
コード例 #4
0
 /**
  * Adds selection lists to article.
  */
 public function addSel()
 {
     $aAddSel = $this->_getActionIds('oxselectlist.oxid');
     $soxId = oxRegistry::getConfig()->getRequestParameter('synchoxid');
     // adding
     if (oxRegistry::getConfig()->getRequestParameter('all')) {
         $sSLViewName = $this->_getViewName('oxselectlist');
         $aAddSel = $this->_getAll($this->_addFilter("select {$sSLViewName}.oxid " . $this->_getQuery()));
     }
     if ($soxId && $soxId != "-1" && is_array($aAddSel)) {
         $oDb = oxDb::getDb();
         foreach ($aAddSel as $sAdd) {
             $oNew = oxNew("oxbase");
             $oNew->init("oxobject2selectlist");
             $sObjectIdField = 'oxobject2selectlist__oxobjectid';
             $sSelectetionIdField = 'oxobject2selectlist__oxselnid';
             $sOxSortField = 'oxobject2selectlist__oxsort';
             $oNew->{$sObjectIdField} = new oxField($soxId);
             $oNew->{$sSelectetionIdField} = new oxField($sAdd);
             $sSql = "select max(oxsort) + 1 from oxobject2selectlist where oxobjectid =  {$oDb->quote($soxId)} ";
             $oNew->{$sOxSortField} = new oxField((int) $oDb->getOne($sSql, false, false));
             $oNew->save();
         }
     }
 }
コード例 #5
0
/**
 * Smarty function
 * -------------------------------------------------------------
 * Purpose: Modifies provided language constant with it's translation
 * usage: [{$val|oxmultilangassign}]
 * -------------------------------------------------------------
 *
 * @param string $sIdent language constant ident
 * @param mixed  $args   for constants using %s notations
 *
 * @return string
 */
function smarty_modifier_oxmultilangassign($sIdent, $args = null)
{
    if (!isset($sIdent)) {
        $sIdent = 'IDENT MISSING';
    }
    $oLang = oxRegistry::getLang();
    $oConfig = oxRegistry::getConfig();
    $oShop = $oConfig->getActiveShop();
    $iLang = $oLang->getTplLanguage();
    $blShowError = true;
    if ($oShop->isProductiveMode()) {
        $blShowError = false;
    }
    try {
        $sTranslation = $oLang->translateString($sIdent, $iLang, $oLang->isAdmin());
        $blTranslationNotFound = !$oLang->isTranslated();
    } catch (\OxidEsales\EshopCommunity\Core\Exception\LanguageException $oEx) {
        // is thrown in debug mode and has to be caught here, as smarty hangs otherwise!
    }
    if (!$blTranslationNotFound) {
        if ($args) {
            if (is_array($args)) {
                $sTranslation = vsprintf($sTranslation, $args);
            } else {
                $sTranslation = sprintf($sTranslation, $args);
            }
        }
    } elseif ($blShowError) {
        $sTranslation = 'ERROR: Translation for ' . $sIdent . ' not found!';
    }
    return $sTranslation;
}
コード例 #6
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');
 }
コード例 #7
0
 /**
  * Is called on module deactivation. Deletes the theme settings. Note that after deactivation the settings
  * will be lost.
  */
 public static function onDeactivate()
 {
     $iShopId = oxRegistry::getConfig()->getShopId();
     $sThemeName = self::_getThemeName();
     $sDeleteSQL = "\n            DELETE\n                oxconfig.*,\n                oxconfigdisplay.*\n            FROM `oxconfig`\n                LEFT JOIN `oxconfigdisplay`\n                    ON ( `oxconfig`.`OXID` = `oxconfigdisplay`.`OXID` )\n            WHERE `oxconfig`.`OXMODULE` = ? AND `oxconfig`.`oxshopid` = ?\n        ";
     oxDb::getDb()->Execute($sDeleteSQL, array('theme:' . $sThemeName, $iShopId));
 }
コード例 #8
0
 /**
  * Executes parent method parent::render(), creates discount category tree,
  * passes data to Smarty engine and returns name of template file "discount_main.tpl".
  *
  * @return string
  */
 public function render()
 {
     parent::render();
     $soxId = $this->getEditObjectId();
     if (isset($soxId) && $soxId != '-1') {
         // load object
         $oDiscount = oxNew('oxdiscount');
         $oDiscount->load($soxId);
         $this->_aViewData['edit'] = $oDiscount;
         //disabling derived items
         if ($oDiscount->isDerived()) {
             $this->_aViewData['readonly'] = true;
         }
         // generating category tree for artikel choose select list
         $this->_createCategoryTree("artcattree");
     }
     $iAoc = oxRegistry::getConfig()->getRequestParameter("aoc");
     if ($iAoc == 1) {
         $oDiscountArticlesAjax = oxNew('discount_articles_ajax');
         $this->_aViewData['oxajax'] = $oDiscountArticlesAjax->getColumns();
         return "popups/discount_articles.tpl";
     } elseif ($iAoc == 2) {
         $oDiscountCategoriesAjax = oxNew('discount_categories_ajax');
         $this->_aViewData['oxajax'] = $oDiscountCategoriesAjax->getColumns();
         return "popups/discount_categories.tpl";
     }
     return 'discount_articles.tpl';
 }
コード例 #9
0
 /**
  * Returns SQL query for data to fetc
  *
  * @return string
  */
 protected function _getQuery()
 {
     // looking for table/view
     $sArtTable = $this->_getViewName('oxarticles');
     $sO2CView = $this->_getViewName('oxobject2category');
     $oDb = oxDb::getDb();
     $oConfig = oxRegistry::getConfig();
     $sVendorId = $oConfig->getRequestParameter('oxid');
     $sSynchVendorId = $oConfig->getRequestParameter('synchoxid');
     // vendor selected or not ?
     if (!$sVendorId) {
         $sQAdd = ' from ' . $sArtTable . ' where ' . $sArtTable . '.oxshopid="' . $oConfig->getShopId() . '" and 1 ';
         $sQAdd .= $oConfig->getConfigParam('blVariantsSelection') ? '' : " and {$sArtTable}.oxparentid = '' and {$sArtTable}.oxvendorid != " . $oDb->quote($sSynchVendorId);
     } else {
         // selected category ?
         if ($sSynchVendorId && $sSynchVendorId != $sVendorId) {
             $sQAdd = " from {$sO2CView} left join {$sArtTable} on ";
             $sQAdd .= $oConfig->getConfigParam('blVariantsSelection') ? " ( {$sArtTable}.oxid = {$sO2CView}.oxobjectid or {$sArtTable}.oxparentid = oxobject2category.oxobjectid )" : " {$sArtTable}.oxid = {$sO2CView}.oxobjectid ";
             $sQAdd .= 'where ' . $sArtTable . '.oxshopid="' . $oConfig->getShopId() . '" and ' . $sO2CView . '.oxcatnid = ' . $oDb->quote($sVendorId) . ' and ' . $sArtTable . '.oxvendorid != ' . $oDb->quote($sSynchVendorId);
         } else {
             $sQAdd = " from {$sArtTable} where {$sArtTable}.oxvendorid = " . $oDb->quote($sVendorId);
         }
         $sQAdd .= $oConfig->getConfigParam('blVariantsSelection') ? '' : " and {$sArtTable}.oxparentid = '' ";
     }
     return $sQAdd;
 }
コード例 #10
0
 /**
  * Executes parent method parent::render()
  * passes data to Smarty engine and returns name of template file "deliveryset_payment.tpl".
  *
  * @return string
  */
 public function render()
 {
     parent::render();
     $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
     if ($soxId != "-1" && isset($soxId)) {
         // load object
         $odeliveryset = oxNew("oxdeliveryset");
         $odeliveryset->setLanguage($this->_iEditLang);
         $odeliveryset->load($soxId);
         $oOtherLang = $odeliveryset->getAvailableInLangs();
         if (!isset($oOtherLang[$this->_iEditLang])) {
             // echo "language entry doesn't exist! using: ".key($oOtherLang);
             $odeliveryset->setLanguage(key($oOtherLang));
             $odeliveryset->load($soxId);
         }
         $this->_aViewData["edit"] = $odeliveryset;
         //Disable editing for derived articles
         if ($odeliveryset->isDerived()) {
             $this->_aViewData['readonly'] = true;
         }
     }
     $iAoc = oxRegistry::getConfig()->getRequestParameter("aoc");
     if ($iAoc == 1) {
         $oDeliverysetPaymentAjax = oxNew('deliveryset_payment_ajax');
         $this->_aViewData['oxajax'] = $oDeliverysetPaymentAjax->getColumns();
         return "popups/deliveryset_payment.tpl";
     } elseif ($iAoc == 2) {
         $oDeliverysetCountryAjax = oxNew('deliveryset_country_ajax');
         $this->_aViewData['oxajax'] = $oDeliverysetCountryAjax->getColumns();
         return "popups/deliveryset_country.tpl";
     }
     return "deliveryset_payment.tpl";
 }
コード例 #11
0
 /**
  * Adds category to Attributes list
  */
 public function addCatToAttr()
 {
     $aAddCategory = $this->_getActionIds('oxcategories.oxid');
     $soxId = oxRegistry::getConfig()->getRequestParameter('synchoxid');
     $oAttribute = oxNew("oxattribute");
     // adding
     if (oxRegistry::getConfig()->getRequestParameter('all')) {
         $sCatTable = $this->_getViewName('oxcategories');
         $aAddCategory = $this->_getAll($this->_addFilter("select {$sCatTable}.oxid " . $this->_getQuery()));
     }
     if ($oAttribute->load($soxId) && is_array($aAddCategory)) {
         $oDb = oxDb::getDb();
         foreach ($aAddCategory as $sAdd) {
             $oNewGroup = oxNew("oxbase");
             $oNewGroup->init("oxcategory2attribute");
             $sOxSortField = 'oxcategory2attribute__oxsort';
             $sObjectIdField = 'oxcategory2attribute__oxobjectid';
             $sAttributeIdField = 'oxcategory2attribute__oxattrid';
             $sOxIdField = 'oxattribute__oxid';
             $oNewGroup->{$sObjectIdField} = new oxField($sAdd);
             $oNewGroup->{$sAttributeIdField} = new oxField($oAttribute->{$sOxIdField}->value);
             $sSql = "select max(oxsort) + 1 from oxcategory2attribute where oxobjectid = '{$sAdd}' ";
             $oNewGroup->{$sOxSortField} = new oxField((int) $oDb->getOne($sSql, false, false));
             $oNewGroup->save();
         }
     }
     $this->resetContentCache();
 }
コード例 #12
0
 /**
  * Saves user extended information.
  *
  * @return mixed
  */
 public function save()
 {
     parent::save();
     $soxId = $this->getEditObjectId();
     if (!$this->_allowAdminEdit($soxId)) {
         return false;
     }
     $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
     $oUser = oxNew("oxuser");
     if ($soxId != "-1") {
         $oUser->load($soxId);
     } else {
         $aParams['oxuser__oxid'] = null;
     }
     // checkbox handling
     $aParams['oxuser__oxactive'] = $oUser->oxuser__oxactive->value;
     $blNewsParams = oxRegistry::getConfig()->getRequestParameter("editnews");
     if (isset($blNewsParams)) {
         $oNewsSubscription = $oUser->getNewsSubscription();
         $oNewsSubscription->setOptInStatus((int) $blNewsParams);
         $oNewsSubscription->setOptInEmailStatus((int) oxRegistry::getConfig()->getRequestParameter("emailfailed"));
     }
     $oUser->assign($aParams);
     $oUser->save();
     // set oxid if inserted
     $this->setEditObjectId($oUser->getId());
 }
コード例 #13
0
ファイル: DumpCommand.php プロジェクト: adriankirchner/oxrun
 /**
  * Executes the current command.
  *
  * @param InputInterface $input An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // allow empty password
     $dbPwd = \oxRegistry::getConfig()->getConfigParam('dbPwd');
     if (!empty($dbPwd)) {
         $dbPwd = '-p' . $dbPwd;
     }
     $file = $input->getOption('file');
     if (!empty($file)) {
         $file = "> " . $file;
     } else {
         $file = "";
     }
     $exec = sprintf("mysqldump -h%s %s -u%s %s %s 2>&1", \oxRegistry::getConfig()->getConfigParam('dbHost'), $dbPwd, \oxRegistry::getConfig()->getConfigParam('dbUser'), \oxRegistry::getConfig()->getConfigParam('dbName'), $file);
     exec($exec, $commandOutput, $returnValue);
     if ($returnValue > 0) {
         $output->writeln('<error>' . implode(PHP_EOL, $commandOutput) . '</error>');
         return;
     }
     if (!empty($file)) {
         $output->writeln("<info>Dump {$input->getOption('file')} created.</info>");
     } else {
         $output->writeln($commandOutput);
     }
 }
コード例 #14
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');
     }
 }
コード例 #15
0
ファイル: StylaSEO_Setup.php プロジェクト: styladev/oxid
 public static function cleanup()
 {
     $oDb = oxDb::getDb();
     $sShopId = oxRegistry::getConfig()->getShopId();
     $sQuery = "DELETE FROM `oxseo` WHERE `OXSTDURL` LIKE '%StylaSEO_Output%' and oxshopid = " . $oDb->quote($sShopId) . " ;";
     $oDb->Execute($sQuery);
 }
コード例 #16
0
 /**
  * Saves changed shop configuration parameters.
  */
 public function save()
 {
     $myConfig = $this->getConfig();
     $sOxId = $this->getEditObjectId();
     // base parameters
     $aConfStrs = oxRegistry::getConfig()->getRequestParameter("confstrs");
     $aConfAArs = oxRegistry::getConfig()->getRequestParameter("confaarrs");
     $aConfBools = oxRegistry::getConfig()->getRequestParameter("confbools");
     // validating language Ids
     if (is_array($aConfAArs['aTsLangIds'])) {
         $blActive = isset($aConfBools["blTsWidget"]) && $aConfBools["blTsWidget"] == "true" ? true : false;
         $sPkg = "OXID_ESALES";
         $aActiveLangs = array();
         foreach ($aConfAArs['aTsLangIds'] as $sLangId => $sId) {
             $aActiveLangs[$sLangId] = false;
             if ($sId) {
                 $sTsUser = $myConfig->getConfigParam('sTsUser');
                 $sTsPass = $myConfig->getConfigParam('sTsPass');
                 // validating and switching on/off
                 $sResult = $this->_validateId($sId, (bool) $blActive, $sTsUser, $sTsPass, $sPkg);
                 // keeping activation state
                 $aActiveLangs[$sLangId] = $sResult == "OK" ? true : false;
                 // error message
                 if ($sResult && $sResult != "OK") {
                     $this->_aViewData["errorsaving"] = "DYN_TRUSTED_RATINGS_ERR_{$sResult}";
                 }
             }
         }
         $myConfig->saveShopConfVar("arr", "aTsActiveLangIds", $aActiveLangs, $sOxId);
     }
     parent::save();
 }
コード例 #17
0
 /**
  * Saves category description text to DB.
  *
  * @return mixed
  */
 public function save()
 {
     parent::save();
     $myConfig = $this->getConfig();
     $soxId = $this->getEditObjectId();
     $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
     $oCategory = oxNew("oxCategory");
     $iCatLang = oxRegistry::getConfig()->getRequestParameter("catlang");
     $iCatLang = $iCatLang ? $iCatLang : 0;
     if ($soxId != "-1") {
         $oCategory->loadInLang($iCatLang, $soxId);
     } else {
         $aParams['oxcategories__oxid'] = null;
     }
     //Disable editing for derived items
     if ($oCategory->isDerived()) {
         return;
     }
     $oCategory->setLanguage(0);
     $oCategory->assign($aParams);
     $oCategory->setLanguage($iCatLang);
     $oCategory->save();
     // set oxid if inserted
     $this->setEditObjectId($oCategory->getId());
 }
コード例 #18
0
ファイル: news_text.php プロジェクト: Crease29/oxideshop_ce
 /**
  * Saves news text.
  *
  * @return mixed
  */
 public function save()
 {
     parent::save();
     $soxId = $this->getEditObjectId();
     $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
     $oNews = oxNew("oxnews");
     $iNewsLang = oxRegistry::getConfig()->getRequestParameter("newslang");
     if (!isset($iNewsLang)) {
         $iNewsLang = $this->_iEditLang;
     }
     if ($soxId != "-1") {
         $oNews->loadInLang($iNewsLang, $soxId);
     } else {
         $aParams['oxnews__oxid'] = null;
     }
     // Disable editing for derived items.
     if ($oNews->isDerived()) {
         return;
     }
     $oNews->setLanguage(0);
     $oNews->assign($aParams);
     $oNews->setLanguage($iNewsLang);
     $oNews->save();
     // set oxid if inserted
     $this->setEditObjectId($oNews->getId());
 }
コード例 #19
0
 /**
  * Gets path to module directory.
  *
  * @return string
  */
 public function getPathToModuleDirectory()
 {
     if (is_null($this->_sPathToModuleDirectory)) {
         $this->setPathToModuleDirectory(oxRegistry::getConfig()->getModulesDir());
     }
     return $this->_sPathToModuleDirectory;
 }
コード例 #20
0
ファイル: vtec_oxbasket.php プロジェクト: Themroc/VTEC_Pfand
 /**
  * Vergibt eine ArtikelID für den Pfandartikel und schreibt den Pfandpreis in die DB
  */
 protected function PfandArtikelID($price)
 {
     /* $oxLang = oxLang::getInstance(); */
     // bis CE 4.8.9
     $oxLang = oxRegistry::getLang();
     // ab CE 4.9.0
     $title = $oxLang->translateString('VTEC_PFAND', 0);
     /* $vtec_mwst = oxConfig::getInstance()->getConfigParam('vtec_pfand_mwst');  */
     // bis CE 4.8.9
     $vtec_mwst = oxRegistry::getConfig()->getConfigParam('vtec_pfand_mwst');
     // ab CE 4.9.0
     $sSelect = "SELECT oxid FROM oxarticles WHERE oxtitle = '" . $title . "' AND oxprice = '" . $price . "' LIMIT 1";
     $qResult = oxDb::getDb(ADODB_FETCH_ASSOC)->getOne($sSelect);
     if ($qResult == false || $qResult == null) {
         $oArticle = oxNew("oxarticle");
         $aLangs = $oxLang->getLanguageIds();
         $oArticle->assign(array('oxarticles__active' => 1, 'oxarticles__oxissearch' => 0, 'oxarticles__oxprice' => $price, 'oxarticles__oxpricea' => $price, 'oxarticles__oxpriceb' => $price, 'oxarticels__oxpricec' => $price, 'oxarticles__oxpic1' => 'pfand.jpg', 'oxarticles__oxvat' => $vtec_mwst));
         $oArticle->save();
         //foreach ($aLangs as $iLang){
         for ($i = 0; $i < count($aLangs); $i++) {
             $oArticle->setLanguage($i);
             $oArticle->assign(array("oxarticles__oxtitle" => $oxLang->translateString('VTEC_PFAND', $i)));
             $oArticle->save();
         }
         $qResult = $oArticle->oxarticles__oxid->value;
     }
     return $qResult;
 }
コード例 #21
0
ファイル: oxstr.php プロジェクト: ioanok/symfoxid
 /**
  * Non static getter returning str handler. The sense of getStr() and _getStrHandler() is
  * to be possible to call this method statically ( oxStr::getStr() ), yet leaving the
  * possibility to extend it in modules by overriding _getStrHandler() method.
  *
  * @return object
  */
 protected function _getStrHandler()
 {
     if (oxRegistry::getConfig()->isUtf() && function_exists('mb_strlen')) {
         return oxNew("oxStrMb");
     }
     return oxNew("oxStrRegular");
 }
コード例 #22
0
/**
 * Smarty plugin
 * -------------------------------------------------------------
 * File: insert.oxid_newbasketitem.php
 * Type: string, html
 * Name: newbasketitem
 * Purpose: Used for tracking in econda, etracker etc.
 * -------------------------------------------------------------
 *
 * @param array  $params  params
 * @param Smarty &$smarty clever simulation of a method
 *
 * @return string
 */
function smarty_insert_oxid_newbasketitem($params, &$smarty)
{
    $myConfig = oxRegistry::getConfig();
    $aTypes = array('0' => 'none', '1' => 'message', '2' => 'popup', '3' => 'basket');
    $iType = $myConfig->getConfigParam('iNewBasketItemMessage');
    // If corect type of message is expected
    if ($iType && $params['type'] && $params['type'] != $aTypes[$iType]) {
        return '';
    }
    //name of template file where is stored message text
    $sTemplate = $params['tpl'] ? $params['tpl'] : 'inc_newbasketitem.snippet.tpl';
    //allways render for ajaxstyle popup
    $blRender = $params['ajax'] && $iType == 2;
    //fetching article data
    $oNewItem = oxRegistry::getSession()->getVariable('_newitem');
    $oBasket = oxRegistry::getSession()->getBasket();
    if ($oNewItem) {
        // loading article object here because on some system passing article by session couses problems
        $oNewItem->oArticle = oxNew('oxarticle');
        $oNewItem->oArticle->Load($oNewItem->sId);
        // passing variable to template with unique name
        $smarty->assign('_newitem', $oNewItem);
        // deleting article object data
        oxRegistry::getSession()->deleteVariable('_newitem');
        $blRender = true;
    }
    // returning generated message content
    if ($blRender) {
        return $smarty->fetch($sTemplate);
    }
}
コード例 #23
0
ファイル: oxjson_setup.php プロジェクト: rahsm/oxidjson
 /**
  * Setup routine
  */
 public static function onActivate()
 {
     if (class_exists('oxRegistry')) {
         $myConfig = oxRegistry::getConfig();
     } else {
         $myConfig = oxConfig::getInstance()->getConfig();
     }
     $bIsEE = $myConfig->getEdition() === "EE";
     try {
         $db = oxDb::getDb();
         // create oxjson groups
         if ($bIsEE) {
             $maxRRId = intval($db->getOne("select MAX(OXRRID) from oxgroups"));
             $nextRRId = $maxRRId + 1;
             $sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1, OXRRID) VALUES ('oxjsonro', '1', 'OXJSON Read-only', 'OXJSON Read-only', '{$nextRRId}');";
             $db->Execute($sQ);
             $nextRRId++;
             $sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1, OXRRID) VALUES ('oxjsonfull', '1', 'OXJSON Full', 'OXJSON Full', '{$nextRRId}');";
             $db->Execute($sQ);
         } else {
             $sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1) VALUES ('oxjsonro', '1', 'OXJSON Read-only', 'OXJSON Read-only');";
             $db->Execute($sQ);
             $nextRRId++;
             $sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1) VALUES ('oxjsonfull', '1', 'OXJSON Full', 'OXJSON Full');";
             $db->Execute($sQ);
         }
     } catch (Exception $ex) {
         error_log("Error activating module: " . $ex->getMessage());
     }
 }
コード例 #24
0
 /**
  * Runs all asserts
  *
  * @param array $aExpectedResult
  */
 protected function runAsserts($aExpectedResult)
 {
     $oConfig = oxRegistry::getConfig();
     $oValidator = new Validator($oConfig);
     if (isset($aExpectedResult['blocks'])) {
         $this->assertTrue($oValidator->checkBlocks($aExpectedResult['blocks']), 'Blocks do not match expectations');
     }
     if (isset($aExpectedResult['extend'])) {
         $this->assertTrue($oValidator->checkExtensions($aExpectedResult['extend']), 'Extensions do not match expectations');
     }
     if (isset($aExpectedResult['files'])) {
         $this->assertTrue($oValidator->checkFiles($aExpectedResult['files']), 'Files do not match expectations');
     }
     if (isset($aExpectedResult['events'])) {
         $this->assertTrue($oValidator->checkEvents($aExpectedResult['events']), 'Events do not match expectations');
     }
     if (isset($aExpectedResult['settings'])) {
         $this->assertTrue($oValidator->checkConfigAmount($aExpectedResult['settings']), 'Configs do not match expectations');
     }
     if (isset($aExpectedResult['versions'])) {
         $this->assertTrue($oValidator->checkVersions($aExpectedResult['versions']), 'Versions do not match expectations');
     }
     if (isset($aExpectedResult['templates'])) {
         $this->assertTrue($oValidator->checkTemplates($aExpectedResult['templates']), 'Templates do not match expectations');
     }
     if (isset($aExpectedResult['disabledModules'])) {
         $this->assertTrue($oValidator->checkDisabledModules($aExpectedResult['disabledModules']), 'Disabled modules do not match expectations');
     }
     if (isset($aExpectedResult['settings_values'])) {
         $this->assertTrue($oValidator->checkConfigValues($aExpectedResult['settings_values']), 'Config values does not match expectations');
     }
 }
コード例 #25
0
ファイル: DumpCommand.php プロジェクト: marcharding/oxrun
 /**
  * Executes the current command.
  *
  * @param InputInterface $input An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // allow empty password
     $dbPwd = \oxRegistry::getConfig()->getConfigParam('dbPwd');
     if (!empty($dbPwd)) {
         $dbPwd = '-p' . $dbPwd;
     }
     $file = $input->getOption('file');
     if (!empty($file)) {
         $file = "> " . $file;
     } else {
         $file = "";
     }
     if ($input->getOption('ignoreViews')) {
         $dbName = \oxRegistry::getConfig()->getConfigParam('dbName');
         $viewsResultArray = \oxDb::getDb()->getArray("SHOW FULL TABLES IN {$dbName} WHERE TABLE_TYPE LIKE 'VIEW'");
         $ignoreViewTables = array();
         foreach ($viewsResultArray as $viewArray) {
             $ignoreViewTables[] = '--ignore-table=' . $dbName . '.' . $viewArray[0];
         }
         $ignoreViewTables = implode(' ', $ignoreViewTables);
     }
     $exec = sprintf("mysqldump -h%s %s -u%s %s %s %s 2>&1", \oxRegistry::getConfig()->getConfigParam('dbHost'), $dbPwd, \oxRegistry::getConfig()->getConfigParam('dbUser'), \oxRegistry::getConfig()->getConfigParam('dbName'), $ignoreViewTables, $file);
     exec($exec, $commandOutput, $returnValue);
     if ($returnValue > 0) {
         $output->writeln('<error>' . implode(PHP_EOL, $commandOutput) . '</error>');
         return;
     }
     if (!empty($file)) {
         $output->writeln("<info>Dump {$input->getOption('file')} created.</info>");
     } else {
         $output->writeln($commandOutput);
     }
 }
コード例 #26
0
ファイル: oxutilsview_nca.php プロジェクト: oligoform/vt-nca
 function smarty_function_newestCategoryArticles($params, &$smarty)
 {
     // default values
     $oxid = $params['oxid'] ? $params['oxid'] : oxRegistry::getConfig()->getRequestParameter('cnid');
     $am = $params['amount'] ? $params['amount'] : null;
     $head = $params['head'] ? $params['head'] : "vtnca_newestarticles";
     $file = $params['file'] ? $params['file'] : "widget/product/boxproducts.tpl";
     //_oBoxProducts=$oView->getTop5ArticleList() _sHeaderIdent="TOP_OF_THE_SHOP"}]
     if (!$oxid) {
         return "<!-- vt-nca: no category id given -->";
     }
     // exit if no oxID given
     // getting newest category articles
     $oArtList = oxNew('oxarticlelist');
     $oArtList->loadNewestCategoryArticles($oxid, $am);
     if (!$oArtList->count()) {
         return;
     }
     // exit if no products in category
     if ($params['assign']) {
         $smarty->assign($params['assign'], $oArtList);
         return;
     }
     // for default boxproducts
     $smarty->assign("_sHeaderIdent", $head);
     $smarty->assign("_oBoxProducts", $oArtList);
     // for stabdard list.tpl
     $smarty->assign("head", $head);
     $smarty->assign("products", $oArtList);
     $html = $smarty->fetch($file);
     //$smarty->clear_assign("__nca_".$oxid);
     return $html;
 }
コード例 #27
0
/**
 * Smarty plugin
 * -------------------------------------------------------------
 * File: insert.oxid_nocache.php
 * Type: string, html
 * Name: oxid_nocache
 * Purpose: Inserts Items not cached
 * -------------------------------------------------------------
 *
 * @param array  $params  params
 * @param Smarty &$smarty clever simulation of a method
 *
 * @return string
 */
function smarty_insert_oxid_nocache($params, &$smarty)
{
    $myConfig = oxRegistry::getConfig();
    $smarty->caching = false;
    /* if( isset( $smarty->oxobject->oProduct))
       $smarty->assign_by_ref( "product", $smarty->oxobject->oProduct);*/
    // #1184M - specialchar search
    $sSearchParamForHTML = oxRegistry::getConfig()->getRequestParameter("searchparam");
    $sSearchParamForLink = rawurlencode(oxRegistry::getConfig()->getRequestParameter("searchparam", true));
    if ($sSearchParamForHTML) {
        $smarty->assign_by_ref("searchparamforhtml", $sSearchParamForHTML);
        $smarty->assign_by_ref("searchparam", $sSearchParamForLink);
    }
    $sSearchCat = oxRegistry::getConfig()->getRequestParameter("searchcnid");
    if ($sSearchCat) {
        $smarty->assign_by_ref("searchcnid", rawurldecode($sSearchCat));
    }
    foreach (array_keys($params) as $key) {
        $viewData =& $params[$key];
        $smarty->assign_by_ref($key, $viewData);
    }
    $sOutput = $smarty->fetch($params['tpl']);
    $smarty->caching = false;
    return $sOutput;
}
コード例 #28
0
ファイル: vt_dev_oxutils.php プロジェクト: kermie/vt-devutils
 public function setLangCache($sCacheName, $aLangCache)
 {
     if (oxRegistry::getConfig()->getConfigParam("bl_VtDev_disableLangCache")) {
         return true;
     }
     return parent::setLangCache($sCacheName, $aLangCache);
 }
コード例 #29
0
 /**
  * Collects article crosselling and attributes information, passes
  * them to Smarty engine and returns name or template file
  * "article_crossselling.tpl".
  *
  * @return string
  */
 public function render()
 {
     parent::render();
     $this->_aViewData['edit'] = $oArticle = oxNew('oxarticle');
     // crossselling
     $this->_createCategoryTree("artcattree");
     // accessoires
     $this->_createCategoryTree("artcattree2");
     $soxId = $this->getEditObjectId();
     if ($soxId != "-1" && isset($soxId)) {
         // load object
         $oArticle->load($soxId);
         if ($oArticle->isDerived()) {
             $this->_aViewData['readonly'] = true;
         }
     }
     $iAoc = oxRegistry::getConfig()->getRequestParameter("aoc");
     if ($iAoc == 1) {
         $oArticleCrossellingAjax = oxNew('article_crossselling_ajax');
         $this->_aViewData['oxajax'] = $oArticleCrossellingAjax->getColumns();
         return "popups/article_crossselling.tpl";
     } elseif ($iAoc == 2) {
         $oArticleAccessoriesAjax = oxNew('article_accessories_ajax');
         $this->_aViewData['oxajax'] = $oArticleAccessoriesAjax->getColumns();
         return "popups/article_accessories.tpl";
     }
     return "article_crossselling.tpl";
 }
コード例 #30
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);
 }