<?php require_once 'console.php'; // Перенос для каталога $query = new MSTable('{catalog_items}'); $query->setFields(['*']); $items = $query->getItems(); $imagies_out = []; $galleries = []; foreach ($items as $key => $item) { $r = unserialize($item['image_out']); $t = unserialize($item['gallery']); if (isset($r[0]['path']['original'])) { $imagies_out[$key] = $r[0]['path']['original']; } if (isset($t[0]['path']['original'])) { $galleries[$key] = $t[0]['path']['original']; } } //$conf = array(160, 110, true, // 'watermark' => array( // 'src' => DOC_ROOT . '/DESIGN/SITE/images/watermark100x100.png', // 'offset_x' => 30, // 'offset_y' => 0 // )); // //foreach ($items as $key => $item) { // // if (isset($imagies_out[$key])) { // $result = MSFiles::makeImageThumb(DOC_ROOT . $imagies_out[$key], $conf); //
/** * sendMail.php * * Отправитель писем, работает по CRON * * @author Pereskokov Yurii * @copyright 2016 Pereskokov Yurii * @license Mediasite LLC * @link http://www.mediasite.ru/ */ require_once dirname(__FILE__) . '/../console.php'; // Достать письма $query = new MSTable('{mails}'); $query->setFields(['*']); $mails = $query->getItems(); // Отправить письма foreach ($mails as $mailItem) { $mail = new SendMail(); $mail->init(); $mail->setEncoding("utf8"); $mail->setEncType("base64"); $mail->setSubject($mailItem['subject']); $mail->setMessage($mailItem['text']); $mail->setFrom($mailItem['from'], "apstroy"); $mail->setFiles([$mailItem['files']]); $emails = MSCore::db()->getCol('SELECT `mail` FROM `' . PRFX . 'mailer`'); foreach ($emails as $email) { $mail->setTo($email); $mail->send(); }
/** * Возвращает элементы в корзине указанного типа * * @param string $type тип товара * * @return array|null */ public function getItemsType($type) { if (!$type) { return null; } if ($type == 'catalog') { $query = new MSTable('' . $this->_cartTableName . ' cart'); $query->setFields(['cart.`amount`', 'cart.`cost`', 'cart.`type`', 'catalog.*', 'articles.`code` as path']); $query->setJoin('' . $this->_itemsTableName . ' catalog', 'INNER', 'cart.`item_id` = catalog.`id`', 'idJoin'); $query->setJoin('{catalog_rent_articles} articles', 'INNER', 'catalog.`parent` = articles.`id`', 'pathJoin'); $query->setFilter('cart.`type`="catalog"'); $query->setFilter('cart.`user_id`="' . $this->_userId . '"'); } elseif ($type == 'lent') { $query = new MSTable('' . $this->_cartTableName . ' cart'); $query->setFields(['cart.`amount`', 'cart.`cost`', 'catalog.*']); $query->setJoin('' . $this->_itemsTableName2 . ' catalog', 'INNER', 'cart.`item_id` = catalog.`id`', 'pathJoin'); $query->setFilter('cart.`type`="lent"'); $query->setFilter('cart.`user_id`="' . $this->_userId . '"'); } else { return null; } return $query->getItems(); }