public static function Report() { $sql = 'SELECT * FROM {{orders}} WHERE loyalty=1 AND sent=0'; $list = DB::getAll($sql); foreach ($list as $order) { $sql = ' SELECT * FROM {{orders_items}} WHERE orders=' . $order['id'] . ' '; $items = DB::getAll($sql); $data = $order; foreach ($items as $item) { $temp = Tree::getInfo($item['tree']); if ($temp['path'] != 'catalogopt') { $data['list'][] = Catalog::getOne($item['tree']); } } $text = View::getRenderEmpty('email/report', $data); $mail = new Email(); $mail->Text($text); $mail->Subject('Оставьте отзыв о товаре на сайте www.' . str_replace('www.', '', $_SERVER["HTTP_HOST"])); $mail->From('robot@' . str_replace('www.', '', $_SERVER["HTTP_HOST"])); $mail->To($order['email']); $mail->Send(); $sql = ' UPDATE {{orders}} SET sent=1 WHERE id=' . $order['id'] . ' '; DB::exec($sql); } }
public static function addMessage($touser, $message) { $sql = ' INSERT INTO {{messages}} SET fromuser='******'iuser']['id'] . ', touser='******', message=\'' . $message . '\', cdate=NOW() '; DB::exec($sql); $sql = 'SELECT CONCAT(fname,\' \',lname) AS name, email FROM {{iusers}} WHERE id=' . $touser . ''; $row = DB::getRow($sql); $toname = $row['name']; $email = $row['email']; if (trim($toname) == '') { $toname = 'Неизвестный'; } $text = ' Здравствуйте, ' . $toname . '!<br /><br /> ' . $_SESSION['iuser']['name'] . ' написал Вам новое сообщение на сайте <a href="http://' . $_SERVER['HTTP_HOST'] . '">' . $_SERVER['HTTP_HOST'] . '</a>.<br /><br /> '; $text = View::getRenderEmpty('email/simple', array('text' => $text, 'title' => 'Новое сообщение')); $mail = new Email(); $mail->To($email); $mail->Subject('Новое сообщение от ' . $_SESSION['iuser']['name'] . ' на сайте ' . $_SERVER['HTTP_HOST']); $mail->Text($text); $mail->Send(); }
function ajax() { $data = array(); $sql = 'SELECT * FROM {{tree}} WHERE parent=' . $_POST['id'] . ' ORDER BY num'; $list = DB::getAll($sql); foreach ($list as $item) { $sql = 'SELECT COUNT(*) FROM {{tree}} WHERE parent=' . $item['id'] . ''; $count = DB::getOne($sql); if ($count > 0) { $item['inner'] = 'inner'; } $data[] = $item; } print View::getRenderEmpty('tree/branch', array('sub' => $data)); die; }
function payment() { DB::escapePost(); //print '<pre>';print_r($_POST);print '</pre>'; if ($_POST) { $token = Api::getToken(); if ($_POST['token'] == $token) { Api::payment(); print View::getRenderEmpty('api/payment'); } else { print json_encode(array('error' => 'Wrong token')); } } else { print json_encode(array('error' => 'Post empty')); //$this->redirect(Funcs::$conf['settings']['source']); } }
public static function OneSSA() { if (Funcs::$prop['panel'] == 0) { if ($_SESSION['user']) { print View::getRenderEmpty('../' . ONESSA_DIR . '/views/onessa/panel'); } } else { unset($_SESSION['user']['panel']['edit']); } }
" <?php if (in_array($item['id'], $user['access']['tree'])) { ?> checked<?php } ?> ><span class="form_label_text"><?php echo $item['name']; ?> </span> </label> <?php if (count($item['sub']) > 0) { ?> <?php echo View::getRenderEmpty('user/labeltree', array('tree' => $item['sub'], 'left' => 1, 'user' => $user)); ?> <?php } ?> </li> <?php } ?> </ul> </td> </tr> </table> </li> </ul> </div>
public static function getBasket() { print View::getRenderEmpty('basket/basketinc', Basket::getOrder()); }
<input type="checkbox" name="tree[]" value="<?php echo $item['id']; ?> " <?php if (in_array($item['id'], $group['access']['tree'])) { ?> checked<?php } ?> /><span class="form_label_text"><?php echo $item['name']; ?> </span> </label> <?php if (count($item['sub']) > 0) { ?> <?php echo View::getRenderEmpty('user/labeltree', array('tree' => $item['sub'], 'left' => $left + 1, 'group' => $group)); ?> <?php } ?> </li> <?php } ?> <?php } ?> </ul>
public function phpinfo() { print View::getRenderEmpty('tools/phpinfo'); }
function delfeaturesgroup() { Fields::deleteFeaturesGroups(); print View::getRenderEmpty('fields/groupfeatureslist'); }
public static function error($sql, $backtrace) { if (DEBUG == 0 && Funcs::$uri[0] != ONESSA_DIR) { header("HTTP/1.0 404 Not Found"); DB::$error = true; View::$layout = 'main'; View::render('site/error404'); } elseif (DEBUG != 0 && Funcs::$uri[0] != ONESSA_DIR) { header("HTTP/1.0 404 Not Found"); print View::getRenderEmpty('site/error', array('sql' => $sql, 'backtrace' => $backtrace)); } else { print View::getRenderOneSSAEmpty('site/error', array('sql' => $sql, 'backtrace' => $backtrace)); } }
<ul> <?php foreach ($sub as $item) { ?> <li> <a href="<?php echo $item['path']; ?> "><?php echo $item['name']; ?> (<?php echo $item['path']; ?> )</a> <?php if (count($item['sub']) > 0) { ?> <?php echo View::getRenderEmpty('site/sitemapbranch', array('sub' => $item['sub'], 'i' => $i + 1)); ?> <?php } ?> </li> <?php } ?> </ul>
</table> </li> <?php if ($_GET['tree'] != 'new' && $module['type'] == 'struct') { ?> <li class="edit_form_section jsMoveFixed jsSlideInfoContainer edit_form_section_other edit_form_section_row"> <header class="edit_form_section_header"> <strong><a href="javascript:;" class="jsSlideInfoToggle">Поля характеристик раздела</a></strong> </header> <div class="jsSlideInfoContent"> <section class="features_section"> <header class="features_section_header">Группы характеристик:</header> <ul class="features_group_list" id="groupFeatures"> <?php echo View::getRenderEmpty('fields/groupfeatureslist'); ?> </ul> <div class="features_group_add"> <div class="inline-label">Имя <input class="input_text" type="text" id="groupFeaturesName" /></div> <div class="inline-label">Алиас <input class="input_text" type="text" id="groupFeaturesPath" /></div> <div class="inline-label"> <span class="button-white" id="groupFeaturesButton" onclick="addFeaturesGroup(0)">Добавить</span> <span class="button-white" id="groupFeaturesCancel" style="display:none;" onclick="cancelFeaturesGroup();">Отменить</span> </div> </div> </section> <section class="features_section"> <header class="features_section_header">Поля характеристик раздела:</header> <div class="features_table_layout jsScrollContainer"> <div class="jsScrollWrapper">
foreach ($tree as $item) { ?> <?php if ($_GET['id'] != $item['id']) { ?> <option value="<?php echo $item['id']; ?> " <?php if ($_GET['parent'] == $item['id']) { ?> selected<?php } ?> ><?php echo str_repeat(' ', $left * 3); echo $item['name']; ?> </option> <?php if (count($item['sub']) > 0) { ?> <?php echo View::getRenderEmpty('fields/parentbranch', array('tree' => $item['sub'], 'left' => $left + 1)); ?> <?php } ?> <?php } }
} ?> <?php if ($item['gal'][0]['path']) { ?> <img src="/of/<?php echo $item['gal'][0]['path']; ?> ?h=100&w=100&c=1" /><?php } ?> </span> </div> <?php echo View::getRenderEmpty('fields/treeselectbranch', $item); ?> </li> <?php } ?> </ul> </div> </div> </div> </section> <section class="ltRow"> <div class="hspopup_buttons"> <span class="button-white" onclick="sendCheckbox()">Сохранить</span>
} ?> <div class="comment">Отзыв о данном товаре может быть оставлен только человеком, ранее совершившим его приобретение</div> </div> </div> </div> <div class="hr" style="margin-bottom: 16px;"></div> <h3>Схожие предложения</h3> <table class="catalog-list"> <tr> <?php foreach ($similargoods as $i => $item) { ?> <td> <?php echo View::getRenderEmpty('catalog/listmodel', $item); ?> </td> <?php if ($i < 2) { ?> <td class="sep"> </td> <?php } ?> <?php } ?> </tr> </table> </div>
public static function getFieldsByTree($id, $option = '') { $gal = 0; $data = array(); $return = array(); $sql = 'SELECT * FROM {{data}} WHERE tree=' . $id . ' AND field=0 ORDER BY num'; $additional = DB::getAll($sql); foreach ($additional as $item) { if ($item['type'] == 'editor' || $item['type'] == 'text') { if ($_SESSION['user']['panel']['edit'] == 'on') { $item['value'] = $item['value_text']; $item['field'] = 'value_text'; $data[$item['path']] = View::getRenderEmpty('../' . ONESSA_DIR . '/views/onessa/field', $item); } else { $data[$item['path']] = $item['value_text']; } } elseif ($item['type'] == 'string') { if ($_SESSION['user']['panel']['edit'] == 'on') { $item['value'] = $item['value_string']; $item['field'] = 'value_string'; $data[$item['path']] = View::getRenderEmpty('../' . ONESSA_DIR . '/views/onessa/field', $item); } else { $data[$item['path']] = $item['value_string']; } } elseif ($item['type'] == 'integer') { $data[$item['path']] = $item['value_int']; } elseif ($item['type'] == 'radio') { //$data[$item['path']]=$item['value_int']; $data[$item['path']] = $item['value_int'] == 1 ? 'Да' : 'Нет'; } elseif ($item['type'] == 'float') { $data[$item['path']] = $item['value_float']; } elseif ($item['type'] == 'select') { $data[$item['path']] = $item['value_text']; } elseif ($item['type'] == 'gallery') { $galname = $item['path']; if ($option == 'gal') { $gal++; $galname = 'gal' . $gal; } if (class_exists(GalleryWidget)) { $data[$galname] = GalleryWidget::run($item); if ($option == 'wide' || $option == 'gal') { $data['files_' . $galname] = GalleryWidget::$files; } } else { $sql = ' SELECT id FROM {{data}} WHERE tree=' . $item['tree'] . ' AND path=\'' . $item['path'] . '\' AND type=\'gallery\' '; $dataId = DB::getOne($sql); if ($dataId) { $sql = ' SELECT id2 FROM {{relations}} WHERE modul1=\'data\' AND modul2=\'files\' AND id1=' . $dataId . ' '; $fileId = DB::getAll($sql, 'id2'); if (count($fileId) > 0) { $sql = ' SELECT * FROM {{files}} WHERE id IN (' . implode(',', $fileId) . ') ORDER BY num '; $temp = DB::getAll($sql); foreach ($temp as $item) { $item['file'] = Funcs::getFileInfo($item['path']); $data['files_' . $galname][$item['mime']][] = $item; } } } } } elseif ($item['type'] != 'multival' && $item['type'] != 'multiselect' && $item['type'] != 'treeselectval' && $item['type'] != 'treeselect' && $item['type'] != 'select' && $item['type'] != 'fstring' && $item['type'] != 'fnumber' && $item['type'] != 'fcheckbox' && $item['type'] != 'fgroup') { $data[$item['type']] = FormWidget::run($item['type']); } } if ($option != 'wide') { foreach ($data as $key => $item) { if (is_numeric($key)) { $return['additional'] .= $item; } else { $return[$key] = $item; } } return $return; } else { return $data; } }
public function setReport($id) { foreach ($_POST as $key => $value) { $_POST[$key] = htmlspecialchars(trim(strip_tags($value))); } $cbid = 0; $sql = ' INSERT INTO {{reports}} SET `tree`=' . $id . ', `name`=\'' . $_POST['name'] . '\', `email`=\'' . $_POST['email'] . '\', `report`=\'' . $_POST['report'] . '\', `stars`=' . $_POST['stars'] . ', `create_date`=NOW() '; DB::exec($sql); $sql = 'SELECT * FROM {{reports}} WHERE tree=' . $id . ''; $list = DB::getAll($sql); $count = count($list); $sum = 0; foreach ($list as $item) { $sum += $item['stars']; } $rating = round($sum / $count); $sql = ' UPDATE {{catalog}} SET rating=' . $rating . ' WHERE tree=' . $id . ' '; DB::exec($sql); $path = Tree::getPathToTree($id); $text = View::getRenderEmpty('email/adminreport', array('path' => $path)); $mail = new Email(); $mail->Text($text); $mail->Subject('Оставлен отзыв на сайте www.' . str_replace('www.', '', $_SERVER["HTTP_HOST"])); $mail->From('robot@' . str_replace('www.', '', $_SERVER["HTTP_HOST"])); $mail->mailTo(Funcs::$conf['email']['report']); $mail->Send(); }