コード例 #1
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();
         }
     }
 }
コード例 #2
0
ファイル: oxseoTest.php プロジェクト: Crease29/oxideshop_ce
 public function tearDown()
 {
     oxDb::getDb()->execute("delete from oxcategories where oxid like '_test%'");
     oxDb::getDb()->execute("delete from oxarticles where oxid like '_test%'");
     oxDb::getDb()->execute("delete from oxobject2category where oxobjectid like '_test%'");
     oxDb::getDb()->execute("delete from oxseo where oxobjectid like '_test%'");
 }
コード例 #3
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;
 }
コード例 #4
0
ファイル: oxstate.php プロジェクト: ioanok/symfoxid
 /**
  * Get state title by id
  *
  * @param integer|string $iStateId
  *
  * @return string
  */
 public function getTitleById($iStateId)
 {
     $oDb = oxDb::getDb();
     $sQ = "SELECT oxtitle FROM " . getViewName("oxstates") . " WHERE oxid = " . $oDb->quote($iStateId);
     $sStateTitle = $oDb->getOne($sQ);
     return (string) $sStateTitle;
 }
 /**
  *  Setup: Prepare data - create need tables
  */
 public function setUp()
 {
     oePayPalEvents::addOrderPaymentsTable();
     oePayPalEvents::addOrderTable();
     oxDb::getDb()->execute('TRUNCATE TABLE `oepaypal_order`');
     oxDb::getDb()->execute('TRUNCATE TABLE `oepaypal_orderpayments`');
 }
コード例 #6
0
 /**
  * Tear down the fixture.
  *
  * @return null
  */
 protected function tearDown()
 {
     $this->cleanUpTable('oxuser');
     oxDb::getDb()->execute("delete from oxremark where oxparentid = '_testArt'");
     oxDb::getDb()->execute("delete from oxnewssubscribed where oxuserid = '_testArt'");
     parent::tearDown();
 }
コード例 #7
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();
 }
コード例 #8
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));
 }
コード例 #9
0
 /**
  * Set up
  */
 protected function setUp()
 {
     parent::setUp();
     // fix for state ID compatability between editions
     $sSqlState = "REPLACE INTO `oxstates` (`OXID`, `OXCOUNTRYID`, `OXTITLE`, `OXISOALPHA2`, `OXTITLE_1`, `OXTITLE_2`, `OXTITLE_3`, `OXTIMESTAMP`) " . "VALUES ('333', '8f241f11096877ac0.98748826', 'USA last state', 'SS', 'USA last state', '', '', CURRENT_TIMESTAMP);";
     oxDb::getDb()->execute($sSqlState);
 }
コード例 #10
0
 /**
  * Executes parent method parent::render(), creates oxpricealarm object
  * and passes it's data to Smarty engine. Returns name of template file
  * "pricealarm_main.tpl".
  *
  * @return string
  */
 public function render()
 {
     $config = $this->getConfig();
     parent::render();
     $shopId = $config->getShopId();
     //articles price in subshop and baseshop can be different
     $this->_aViewData['iAllCnt'] = 0;
     $query = "\n            SELECT oxprice, oxartid\n            FROM oxpricealarm\n            WHERE oxsended = '000-00-00 00:00:00' AND oxshopid = '{$shopId}' ";
     $result = oxDb::getDb()->execute($query);
     if ($result != false && $result->recordCount() > 0) {
         $simpleCache = array();
         while (!$result->EOF) {
             $price = $result->fields[0];
             $articleId = $result->fields[1];
             if (isset($simpleCache[$articleId])) {
                 if ($simpleCache[$articleId] <= $price) {
                     $this->_aViewData['iAllCnt'] += 1;
                 }
             } else {
                 $article = oxNew("oxArticle");
                 if ($article->load($articleId)) {
                     $articlePrice = $simpleCache[$articleId] = $article->getPrice()->getBruttoPrice();
                     if ($articlePrice <= $price) {
                         $this->_aViewData['iAllCnt'] += 1;
                     }
                 }
             }
             $result->moveNext();
         }
     }
     return "pricealarm_mail.tpl";
 }
コード例 #11
0
 /**
  * returns delivery set id
  *
  * @param string $sTitle delivery name
  *
  * @return string
  */
 public function getIdByName($sTitle)
 {
     $oDb = oxDb::getDb();
     $sQ = "SELECT `oxid` FROM `" . getViewName('oxdeliveryset') . "` WHERE  `oxtitle` = " . $oDb->quote($sTitle);
     $sId = $oDb->getOne($sQ);
     return $sId;
 }
コード例 #12
0
 /**
  * Executes parent method parent::render(), creates oxuser, oxlist and
  * oxRemark objects, passes data to Smarty engine and returns name of
  * template file "user_remark.tpl".
  *
  * @return string
  */
 public function render()
 {
     parent::render();
     $soxId = $this->getEditObjectId();
     $sRemoxId = oxRegistry::getConfig()->getRequestParameter("rem_oxid");
     if ($soxId != "-1" && isset($soxId)) {
         // load object
         $oUser = oxNew("oxuser");
         $oUser->load($soxId);
         $this->_aViewData["edit"] = $oUser;
         // all remark
         $oRems = oxNew("oxlist");
         $oRems->init("oxremark");
         $sQuotedUserId = oxDb::getDb()->quote($oUser->getId());
         $sSelect = "select * from oxremark where oxparentid=" . $sQuotedUserId . " order by oxcreate desc";
         $oRems->selectString($sSelect);
         foreach ($oRems as $key => $val) {
             if ($val->oxremark__oxid->value == $sRemoxId) {
                 $val->selected = 1;
                 $oRems[$key] = $val;
                 break;
             }
         }
         $this->_aViewData["allremark"] = $oRems;
         if (isset($sRemoxId)) {
             $oRemark = oxNew("oxRemark");
             $oRemark->load($sRemoxId);
             $this->_aViewData["remarktext"] = $oRemark->oxremark__oxtext->value;
             $this->_aViewData["remarkheader"] = $oRemark->oxremark__oxheader->value;
         }
     }
     return "user_remark.tpl";
 }
コード例 #13
0
 /**
  * Returns ongr version id.
  *
  * @return int
  */
 public function getONGRVersionId()
 {
     $oDb = oxDb::getDb();
     $sql = 'SELECT ID FROM ongr_sync_jobs WHERE OXID=';
     $sql .= $oDb->quote($this->getId()) . ' ORDER BY ID DESC LIMIT 1';
     return (int) $oDb->getOne($sql);
 }
コード例 #14
0
ファイル: jxamazoncategory.php プロジェクト: rkonweh/jxTaxo
 public function jxGetCategoryList($sParent, $sNoPath, $sCatPath)
 {
     $myConfig = $this->getConfig();
     if (!empty($sNoPath)) {
         $sNoPath .= '.';
         $sCatPath .= ' / ';
     }
     $sWhere = "";
     if ($myConfig->getConfigParam('sJxGTaxoDisplayInactive') == FALSE) {
         $sWhere .= "AND c.oxactive = 1 ";
     }
     if ($myConfig->getConfigParam('sJxGTaxoDisplayHidden') == FALSE) {
         $sWhere .= "AND c.oxhidden = 0 ";
     }
     $sSql = "SELECT c.oxid, c.oxtitle, c.oxactive, c.oxhidden, " . "(SELECT COUNT(*) FROM oxobject2category o2c WHERE o2c.oxcatnid = c.oxid) AS artcount, " . "(SELECT COUNT(*) FROM oxcategories c1 WHERE c1.oxparentid=c.oxid) AS count, c.jxamazoncategory AS taxonomy " . "FROM oxcategories c " . "WHERE c.oxparentid = '{$sParent}' " . $sWhere . "ORDER BY c.oxtitle";
     $oDb = oxDb::getDb(oxDB::FETCH_MODE_ASSOC);
     $rs = $oDb->Execute($sSql);
     $i = 1;
     while (!$rs->EOF) {
         $aCols = $rs->fields;
         $aCols['path'] = $sNoPath . $i;
         $aCols['oxtitle'] = $sCatPath . $aCols['oxtitle'];
         array_push($this->aCategories, $aCols);
         if ($aCols['count'] != 0) {
             $this->jxGetCategoryList($aCols['oxid'], $aCols['path'], $aCols['oxtitle']);
         }
         $rs->MoveNext();
         $i++;
     }
     return;
 }
コード例 #15
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);
     }
 }
コード例 #16
0
 /**
  * Returns count of users assigned to active newsletter receiver group
  *
  * @return int
  */
 public function getUserCount()
 {
     if ($this->_iUserCount === null) {
         $this->_iUserCount = 0;
         // load object
         $oNewsletter = oxNew("oxnewsletter");
         if ($oNewsletter->load($this->getEditObjectId())) {
             // get nr. of users in these groups
             // we do not use lists here as we dont need this overhead right now
             $oDB = oxDb::getDb();
             $blSep = false;
             $sSelectGroups = " ( oxobject2group.oxgroupsid in ( ";
             // remove already added groups
             foreach ($oNewsletter->getGroups() as $oInGroup) {
                 if ($blSep) {
                     $sSelectGroups .= ",";
                 }
                 $sSelectGroups .= $oDB->quote($oInGroup->oxgroups__oxid->value);
                 $blSep = true;
             }
             $sSelectGroups .= " ) ) ";
             // no group selected
             if (!$blSep) {
                 $sSelectGroups = " oxobject2group.oxobjectid is null ";
             }
             $sShopId = $this->getConfig()->getShopID();
             $sQ = "select count(*) from ( select oxnewssubscribed.oxemail as _icnt from oxnewssubscribed left join\n                   oxobject2group on oxobject2group.oxobjectid = oxnewssubscribed.oxuserid\n                   where ( oxobject2group.oxshopid = '{$sShopId}'\n                   or oxobject2group.oxshopid is null ) and {$sSelectGroups} and\n                   oxnewssubscribed.oxdboptin = 1 and ( not ( oxnewssubscribed.oxemailfailed = '1') )\n                   and (not(oxnewssubscribed.oxemailfailed = '1')) and oxnewssubscribed.oxshopid = '{$sShopId}'\n                   group by oxnewssubscribed.oxemail ) as _tmp";
             $this->_iUserCount = $oDB->getOne($sQ, false, false);
         }
     }
     return $this->_iUserCount;
 }
コード例 #17
0
 /**
  * Module deactivation script: executes the sql to delte the opening time snippet.
  */
 public static function onDeactivate()
 {
     $oDb = oxDb::getDb();
     $delete_sql = "DELETE FROM `oxcontents` WHERE `OXLOADID` = 'openingHours'";
     $oDb->execute($delete_sql);
     return true;
 }
コード例 #18
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());
     }
 }
コード例 #19
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);
 }
コード例 #20
0
 /**
  * Adds this payments to this set
  *
  * @return null
  */
 public function addpaytoset()
 {
     $aChosenSets = $this->_getActionIds('oxpayments.oxid');
     $soxId = oxConfig::getParameter('synchoxid');
     // adding
     if (oxConfig::getParameter('all')) {
         $sPayTable = $this->_getViewName('oxpayments');
         $aChosenSets = $this->_getAll($this->_addFilter("select {$sPayTable}.oxid " . $this->_getQuery()));
     }
     if ($soxId && $soxId != "-1" && is_array($aChosenSets)) {
         $oDb = oxDb::getDb();
         foreach ($aChosenSets as $sChosenSet) {
             // check if we have this entry already in
             $sID = $oDb->GetOne("select oxid from oxobject2payment where oxpaymentid = " . $oDb->quote($sChosenSet) . "  and oxobjectid = " . $oDb->quote($soxId) . " and oxtype = 'oxdelset'");
             if (!isset($sID) || !$sID) {
                 $oObject = oxNew('oxbase');
                 $oObject->init('oxobject2payment');
                 $oObject->oxobject2payment__oxpaymentid = new oxField($sChosenSet);
                 $oObject->oxobject2payment__oxobjectid = new oxField($soxId);
                 $oObject->oxobject2payment__oxtype = new oxField("oxdelset");
                 $oObject->save();
             }
         }
     }
 }
コード例 #21
0
/**
 * Smarty plugin
 * -------------------------------------------------------------
 * File: function.toxid_load.php
 * Type: string, html
 * Name: toxid_load
 * Purpose: Collect needed javascript includes and calls, but execute them at the bottom of the page.
 *
 * Add [{ toxid_load type="oxarticle" oxid="943ed656e21971fb2f1827facbba9bec" assign="oProduct"}]
 * to load oxarticle object to oProduct by its oxid
 * Add [{toxid_load type="oxarticle" ident="0802-85-823" assign="oProduct"}]
 * to load oxarticle object to oProduct by its artnum
 *
 * -------------------------------------------------------------
 *
 * @param array  $params  params
 * @param Smarty &$smarty clever simulation of a method
 *
 * @return string
 */
function smarty_function_toxid_load($params, &$smarty)
{
    if (!isset($params['assign'])) {
        return;
    }
    $aSupportedTypes = array('oxarticle', 'oxcategory', 'oxmanufacturer');
    $sType = isset($params['type']) ? $params['type'] : '';
    if (!in_array(strtolower($sType), $aSupportedTypes)) {
        return;
    }
    $sOxid = isset($params['oxid']) ? $params['oxid'] : null;
    $sIdent = isset($params['ident']) ? $params['ident'] : null;
    if (!$sOxid && !$sIdent) {
        return;
    }
    $oObject = oxNew($sType);
    if ($sIdent) {
        switch ($sType) {
            case 'oxarticle':
                $sOxid = oxDb::getDb()->getOne('SELECT OXID FROM oxarticles WHERE OXARTNUM = ?', array($sIdent));
                break;
        }
    }
    if ($sOxid) {
        $oObject->load($sOxid);
    } else {
        return;
    }
    $smarty->assign($params['assign'], $oObject);
}
コード例 #22
0
 /**
  * execute a sql statement and rests the sql string
  */
 protected function executeSqlStm()
 {
     $oDb = oxDb::getDb();
     $this->_oOutput->writeLn($this->sSql);
     $oDb->execute($this->sSql);
     $this->sSql = "";
 }
コード例 #23
0
 /**
  * To save block information
  */
 public function save()
 {
     if ($this->getOxid() != "") {
         $query = "UPDATE oxtplblocks set\n              OXACTIVE='" . $this->getOxActive() . "',\n              OXPOS='" . $this->getOxPos() . "'\n              WHERE OXID='" . $this->getOxid() . "'";
         $db = oxDb::getDb(oxDb::FETCH_MODE_ASSOC);
         $db->execute($query);
     }
 }
コード例 #24
0
 /**
  * Selects and loads all address for particular user.
  *
  * @param string $sUserId user id
  */
 public function load($sUserId)
 {
     $sViewName = getViewName('oxcountry');
     $oBaseObject = $this->getBaseObject();
     $sSelectFields = $oBaseObject->getSelectFields();
     $sSelect = "\n                SELECT {$sSelectFields}, `oxcountry`.`oxtitle` AS oxcountry\n                FROM oxaddress\n                LEFT JOIN {$sViewName} AS oxcountry ON oxaddress.oxcountryid = oxcountry.oxid\n                WHERE oxaddress.oxuserid = " . oxDb::getDb()->quote($sUserId);
     $this->selectString($sSelect);
 }
コード例 #25
0
 /**
  * Performs cleanup of statistic data for selected period.
  *
  * @return null
  */
 public function cleanup()
 {
     $iTimeFrame = oxConfig::getParameter("timeframe");
     $dNow = time();
     $sDeleteFrom = date("Y-m-d H:i:s", mktime(date("H", $dNow), date("i", $dNow), date("s", $dNow), date("m", $dNow), date("d", $dNow) - $iTimeFrame, date("Y", $dNow)));
     $oDb = oxDb::getDb();
     $oDb->Execute("delete from oxlogs where oxtime < " . $oDb->quote($sDeleteFrom));
 }
コード例 #26
0
 /**
  * ActionsArticleAjax::setActionArticle() test case
  *
  * @return null
  */
 public function testSetActionArticle()
 {
     $this->setRequestParameter("oxid", '_testActionSet');
     $this->setRequestParameter("oxarticleid", '_testObject');
     $oView = oxNew('actions_article_ajax');
     $oView->setactionarticle();
     $this->assertTrue((bool) oxDb::getDb()->getOne("select oxid from oxobject2action where oxactionid='_testActionSet' limit 1"));
 }
コード例 #27
0
 /**
  * Tear down the fixture.
  *
  * @return null
  */
 protected function tearDown()
 {
     $myDB = oxDb::getDB();
     // removing vouchers
     $sQ = 'delete from oxvouchers where oxvouchers.oxvoucherserieid = "' . $this->_sOxid . '"';
     $myDB->Execute($sQ);
     parent::tearDown();
 }
コード例 #28
0
 /**
  * Tear down the fixture.
  *
  * @return null
  */
 protected function tearDown()
 {
     $this->cleanUpTable('oxorder');
     $this->cleanUpTable('oxorderarticles');
     $oDb = oxDb::getDb();
     $oDb->execute("TRUNCATE TABLE `oxorderfiles`");
     parent::tearDown();
 }
コード例 #29
0
 /**
  * Tear down the fixture.
  *
  * @return null
  */
 protected function tearDown()
 {
     $oDB = oxDb::getDb();
     $myConfig = $this->getConfig();
     $sInsert = "DELETE from `oxratings` where OXID='test'";
     $oDB->Execute($sInsert);
     parent::tearDown();
 }
コード例 #30
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;
 }