public function clearSeoUTF($name) { $seo = Core::clearUTF(trim($name)); $seo = preg_replace('/[^A-Za-z0-9\\-\\s\\s+]/', '', $seo); $seo = Core::clearSeoUTF($seo); return str_replace('/', '', strtolower($seo)); }
public function importPagescheme($file) { $file = ROOTPATH . 'themes' . DS . $file; require_once ROOTPATH . 'lib' . DS . 'zip' . DS . 'zip.php'; $archive = new PclZip($file); $this->targetFolder = 'temp' . date('YmdHis'); $archive->extract(PCLZIP_OPT_PATH, ROOTPATH . 'themes' . DS . $this->targetFolder); $info = $this->getMainInfo(); $seo = Core::clearUTF(trim($info['name'])); $seo = preg_replace('/[^A-Za-z0-9\\-\\s\\s+]/', '', $seo); $seo = Core::clearSeoUTF($seo); $this->templateFolder = str_replace('/', '', strtolower($seo)); if (is_dir(ROOTPATH . 'themes' . DS . $this->templateFolder)) { $this->templateFolder = $this->templateFolder . date('YmdHis'); $info['name'] = $info['name'] . ' (Kopia ' . date('Y-m-d H:i:s') . ')'; } rename(ROOTPATH . 'themes' . DS . $this->targetFolder, ROOTPATH . 'themes' . DS . $this->templateFolder); $this->getImportData(); Db::getInstance()->beginTransaction(); if (!empty($this->importData)) { $this->pageSchemeId = App::getModel('pagescheme')->addPageScheme(array('name' => $info['name'], 'templatefolder' => $this->templateFolder)); $this->saveBoxes($this->importData['boxes'], $this->pageSchemeId); $this->saveSubpages($this->importData['layouts'], $this->pageSchemeId); } Db::getInstance()->commit(); $this->clearCache(ROOTPATH . DS . 'serialization', false); $this->clearCache(ROOTPATH . DS . 'cache', false); }
public function saveOrder($Data) { $objResponse = new xajaxResponse(); try { $order = $this->setClientOrder($Data); if ($order != NULL) { if (empty($order['dispatchmethod'])) { $objResponse->script("GError('" . _('ERR_ORDER_SAVE') . "', '" . _('ERR_NO_DELIVERY_SELECTED') . "');"); return $objResponse; } if (empty($order['payment'])) { $objResponse->script("GError('" . _('ERR_ORDER_SAVE') . "', '" . _('ERR_NO_PAYMENT_SELECTED') . "');"); return $objResponse; } $saveOrder = App::getModel('order')->saveOrder($order); $clientid = Session::getActiveClientid(); Session::setActiveorderid($saveOrder); $email = $order['contactData']['email']; $orderid = Session::getActiveorderid(); $orderlink = App::getModel('order')->generateOrderLink($orderid); if ($orderlink != NULL && $orderid != NULL) { App::getModel('order')->changeOrderLink($orderid, $orderlink); $banktransfer = $this->registry->core->loadModuleSettings('banktransfer', Helper::getViewId()); $payment_model = App::getModel('Admin/paymentmethod/paymentmethod')->getPaymentmethodModelById($order['payment']['idpaymentmethod']); $this->registry->template->assign('order', $order); $this->registry->template->assign('orderId', $orderid); $this->registry->template->assign('orderlink', $orderlink); $this->registry->template->assign('paymentmodel', $payment_model); $this->registry->template->assign('bankdata', $banktransfer); $mailer = App::getModel('mailer'); if (!empty($this->layer['terms'])) { $mailer->AddAttachment('./upload/' . $this->layer['terms'], Core::clearUTF(_('TXT_CONDITIONS')) . '.pdf'); } $mailer->sendEmail(array('template' => 'orderClient', 'email' => array($email), 'bcc' => true, 'subject' => _('TXT_ORDER_CLIENT') . ': ' . $orderid, 'viewid' => Helper::getViewId())); Session::unsetActiveCart(); Session::unsetActiveglobalPriceWithDispatchmethod(); Session::unsetActiveglobalPriceWithDispatchmethodNetto(); Session::unsetActiveDispatchmethodChecked(); Session::unsetActivePaymentMethodChecked(); Session::unsetActiveGlobalPrice(); Session::unsetActiveGlobalPriceWithoutVat(); $paymentMethodData = array('orderId' => Session::getActiveorderid(), 'orderData' => Session::getActiveClientOrder()); Session::setActivePaymentData($paymentMethodData); Session::unsetActiveorderid(); Session::unsetActiveClientOrder(); App::getModel('dataset')->flushCache(); $url = $this->registry->router->generate('frontend.payment', true, array('action' => 'accept')); $objResponse->script("window.location.href = '{$url}';"); } } else { $objResponse->script("GError('" . _('ERR_ORDER_SAVE') . "','" . _('ERR_ORDER_NOT_DEFINED') . "');"); } } catch (Exception $e) { $objResponse->script("GError('" . _('ERR_ORDER_SAVE') . "','" . _('ERR_ORDER_SAVE_MSG') . "');"); } return $objResponse; }
protected final function insertFile($name) { $sql = 'INSERT INTO file(name, filetypeid, fileextensionid, viewid) VALUES (:name, :filetypeid, :fileextensionid, :viewid)'; $stmt = Db::getInstance()->prepare($sql); $stmt->bindValue('name', Core::clearUTF($name)); $stmt->bindValue('filetypeid', current($this->fileType)); $stmt->bindValue('viewid', Helper::getViewId()); $stmt->bindValue('fileextensionid', $this->allowedExtensions[strtolower($this->tmpExtension)]); try { $stmt->execute(); } catch (Exception $e) { throw new Exception($e->getMessage()); } $idFile = Db::getInstance()->lastInsertId(); $this->insertedFileFullName = $idFile . '.' . $this->tmpExtension; $this->registry->cache->delete('files'); $this->setFiles(); return $idFile; }