コード例 #1
0
ファイル: contacts.php プロジェクト: sd-studio/or
<?php

require_once 'init.php';
require_once cf\Config::path . 'mailer/class.phpmailer.php';
$page = cf\api\page\get('contacts');
$smarty->assign('pageId', $page['id']);
$smarty->assign('pageText', cf\api\page\getText($page['id']));
if (isset($_POST['name'])) {
    $mail = new PHPMailer();
    $mail->CharSet = 'UTF-8';
    $mail->AddAddress("*****@*****.**");
    $mail->Subject = 'Сообщение с ortorise.ru';
    $name = stripslashes(trim($_POST['name']));
    $phone = trim($_POST['phone']);
    $email = trim($_POST['email']);
    $mail->Body = $name . ' (' . $email . ', ' . $phone . ") пишет: \n" . stripslashes(trim($_POST['msg']));
    if (@$mail->Send()) {
        header('Location: /contacts?state=ok');
    } else {
        header('Location: /contacts?state=error');
        // $mail->ErrorInfo
    }
}
$smarty->assign('state', isset($_REQUEST['state']) ? $_REQUEST['state'] : false);
show('contacts', $page['name'], array(), $page['title'], $page['keywords'], $page['descr']);
コード例 #2
0
ファイル: index.php プロジェクト: sd-studio/sh
             $pid = $pathInfo['page_id'];
             if (strlen($pathInfo['notfound'])) {
                 $p = cf\Page::get($pid);
                 if (!(cf\Page::isDescendantOf($p, 'catalog') && ($productId = cf\Product::findByPath($pathInfo['notfound']))) && $p['permalink'] != 'articles') {
                     $pid = 'error';
                 }
             }
         } else {
             $pid = 'error';
         }
     }
 } catch (Exception $e) {
     $pid = 'error';
 }
 $page = cf\Page::get($pid);
 $pageText = cf\api\page\getText($page['id']);
 $crumbs = array();
 foreach ($page['branch'] as $p) {
     $crumbs[] = array('name' => $p['menu_name'], 'link' => $p['path']);
 }
 if (cf\Page::isDescendantOf($page, 'catalog')) {
     $page['template'] = $productId ? 'product' : 'category';
 }
 if (strlen($page['template']) && file_exists($_SERVER['DOCUMENT_ROOT'] . '/' . $page['template'] . '.php')) {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/' . $page['template'] . '.php';
 }
 $tpl = 'page';
 if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/templates/' . $page['code'] . '.tpl')) {
     $tpl = $page['code'];
 }
 $smarty->assign('page', $page);