当前位置: 首页>>代码示例>>PHP>>正文


PHP SQL::slashes方法代码示例

本文整理汇总了PHP中SQL::slashes方法的典型用法代码示例。如果您正苦于以下问题:PHP SQL::slashes方法的具体用法?PHP SQL::slashes怎么用?PHP SQL::slashes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQL的用法示例。


在下文中一共展示了SQL::slashes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actDefault

 function actDefault()
 {
     global $ST, $get;
     $field_name = $this->getURIVal('enum');
     if (($field_value = $this->getURIVal($field_name)) && $field_value != 'mode') {
         $data = array('field_name' => $field_name, 'field_value' => $field_value, 'position' => 0, 'value_desc' => '');
         $rs = $ST->select("SELECT * FROM sc_enum WHERE field_name='" . SQL::slashes($field_name) . "' AND  field_value='" . SQL::slashes($field_value) . "'");
         if ($rs->next()) {
             $data = $rs->getRow();
         }
         $this->display($data, dirname(__FILE__) . '/enum_item.tpl.php');
     } elseif ($field_name) {
         $rs = $ST->select("SELECT * FROM sc_enum WHERE field_name='{$field_name}' ORDER BY position");
         $data = array('rs' => $rs, 'field_name' => $field_name);
         $data['mode'] = array('add', 'pos', 'value', 'desc', 'name');
         if ($mode = $this->getURIVal('mode')) {
             $data['mode'] = explode(',', $mode);
         }
         if ($get->get('title')) {
             $this->setPageTitle($get->get('title'));
             $data['hidename'] = true;
         }
         if ($get->exists('autoval')) {
             $data['autoval'] = true;
         }
         $this->display($data, dirname(__FILE__) . '/enum.tpl.php');
     } else {
         $rs = $ST->select("SELECT DISTINCT field_name FROM sc_enum ORDER BY field_name")->toArray();
         $data = array('rs' => $rs);
         $this->display($data, dirname(__FILE__) . '/enum_list.tpl.php');
     }
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:32,代码来源:Enum.class.php

示例2: getQuery

 function getQuery($key)
 {
     if ($key == 'news') {
         $cond = " type='news' \n\t\t\t\t\tAND (state='main' OR state='public') ";
         //				$relev=" MATCH nws_title, nws_content,nws_desc AGAINST ('".$this->search."') ";
         $cond .= " AND (content ILIKE '%" . SQL::slashes($this->search) . "%' OR title ILIKE '%" . SQL::slashes($this->search) . "%' OR description ILIKE '%" . SQL::slashes($this->search) . "%')";
         $q = "SELECT id ,title, description FROM sc_news WHERE " . $cond . " ";
         $countQ = "SELECT COUNT(id) AS c FROM sc_news WHERE " . $cond;
         $href = "/news/view/";
         $title = "Новости";
     }
     if ($key == 'content') {
         $cond = " mod_content_id=c_id AND (mod_location LIKE 'main' OR  mod_location LIKE 'footer' OR  mod_location LIKE 'top')\n\t\t\t\t\t\tAND (mod_name ILIKE '%" . SQL::slashes($this->search) . "%' OR mod_title ILIKE '%" . SQL::slashes($this->search) . "%' OR c_text ILIKE '%" . SQL::slashes($this->search) . "%')";
         $cond = " c_name ILIKE '%'||mod_alias||'%' AND mod_alias <>'/'";
         //				$cond=" mod_alias ILIKE '%'||c_name||'%' ";
         //				$cond=" mod_alias =c_name ";
         //				$cond.=" AND (mod_location LIKE '%main%' OR  mod_location LIKE '%footer%' OR  mod_location LIKE '%top%')";
         $cond .= " AND (mod_name ILIKE '%" . SQL::slashes($this->search) . "%' OR mod_title ILIKE '%" . SQL::slashes($this->search) . "%' OR c_text ILIKE '%" . SQL::slashes($this->search) . "%')";
         $q = "SELECT mod_alias AS id,mod_title AS title,mod_description AS description FROM sc_content,sc_module WHERE " . $cond . " ";
         $q = "SELECT c_name AS id,mod_title AS title,mod_description AS description FROM sc_content,sc_module WHERE " . $cond . " ";
         $countQ = "SELECT COUNT(c_id) AS c FROM sc_content,sc_module WHERE " . $cond;
         $href = "";
         $title = "Разделы сайта";
     }
     if ($key == 'catalog') {
         $cond = "  c.id=g.category AND of.in_stock>0 AND of.itemid=g.id AND of.region='{$this->getRegion()}'";
         $cond .= " AND (g.name ILIKE '%" . SQL::slashes($this->search) . "%' OR g.description ILIKE '%" . SQL::slashes($this->search) . "%' OR c.name ILIKE '%" . SQL::slashes($this->search) . "%' )";
         $q = "SELECT g.*, g.id AS id, g.name AS title, g.description AS description FROM sc_shop_catalog c,sc_shop_item g, sc_shop_offer of WHERE " . $cond . "";
         $countQ = "SELECT COUNT(g.id) AS c FROM sc_shop_catalog c,sc_shop_item g, sc_shop_offer of  WHERE " . $cond;
         $href = "/catalog/goods/";
         $title = "Товары и услуги";
     }
     return array($q, $countQ, $href, $title);
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:34,代码来源:Search.class(2).php

示例3: actDefault

 function actDefault()
 {
     global $ST;
     if ($id = $this->getURIIntVal(trim($this->mod_uri, '/'))) {
         $this->actView($id);
         return;
     }
     $page = new Page($this->cfg('PAGE_SIZE'));
     //		$page=new Page(1);
     $type = trim($this->mod_uri, '/');
     $condition = "g.type='" . SQL::slashes($type) . "' AND g.sort>-1";
     $cat_list = $this->enum("gal_{$type}_cat");
     $label_list = $this->enum("gal_{$type}_label");
     $label_list = array();
     $rs = $ST->select("SELECT * FROM sc_enum e WHERE field_name='gal_{$type}_label' AND EXISTS (SELECT gallery_id FROM sc_gallery_label , sc_gallery g WHERE gallery_id=g.id AND label_id=e.field_value AND type='" . SQL::slashes($type) . "' AND sort>-1) ORDER BY position");
     while ($rs->next()) {
         $label_list[$rs->get('field_value')] = $rs->get('value_desc');
     }
     $cat = '';
     if (preg_match('|cat-([\\d\\w]+)|', $this->getURIVal($type), $res)) {
         $cat = $res[1];
         $condition .= " AND cat='{$cat}'";
     }
     $label = '';
     if (preg_match('|label-([\\d\\w]+)|', $this->getURIVal($type), $res)) {
         $label = $res[1];
         $condition .= "  AND EXISTS (SELECT gallery_id FROM sc_gallery_label WHERE gallery_id=g.id AND label_id={$label}) ";
     }
     $queryStr = "SELECT COUNT(*) as c FROM sc_gallery g WHERE {$condition}";
     $rs = $ST->select($queryStr);
     if ($rs->next()) {
         $page->all = $rs->getInt("c");
     }
     $order = "ORDER BY g.sort DESC, g.date DESC, g.id DESC";
     if ($type == 'staff') {
         $order = "ORDER BY ct.position, g.sort DESC, g.date DESC, g.id DESC";
     }
     $queryStr = "SELECT g.*,p.title AS p_title,p.id AS p_id,ct.value_desc AS ct_desc  FROM sc_gallery g\r\n\t\t\tLEFT JOIN (SELECT field_value,value_desc,position FROM sc_enum WHERE field_name='gal_{$type}_cat') AS ct ON ct.field_value=g.cat\r\n\t\t\tLEFT JOIN (SELECT n.* FROM sc_news n,(SELECT MAX(id) as id ,gallery FROM sc_news GROUP BY gallery) AS mn WHERE type='public' AND mn.id=n.id) AS p ON p.gallery=g.id \r\n\t\t\r\n\t\tWHERE {$condition} {$order} LIMIT " . $page->getBegin() . "," . $page->per;
     $rs = $ST->select($queryStr)->toArray();
     $data = array('rs' => $rs, 'pg' => $page, 'type' => $type);
     $data['cat_list'] = $cat_list;
     $data['cat_list_item'] = array();
     //		$data['cat']=$cat;
     $rs = $ST->select("SELECT * FROM sc_gallery WHERE type='{$type}' AND cat<>''");
     while ($rs->next()) {
         $data['cat_list_item'][$rs->get('cat')][] = $rs->getRow();
     }
     //		$data['label_list']=$label_list;
     //		$data['label']=$label;
     $tpl = dirname(__FILE__) . '/' . $type . '.tpl.php';
     if (file_exists($tpl)) {
         $this->display($data, $tpl);
         return;
     }
     $this->display($data, dirname(__FILE__) . '/gallery.tpl.php');
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:56,代码来源:Gallery.class.php

示例4: actGetText

 function actGetText()
 {
     global $ST, $post;
     $data = array('rule' => '', 'text' => '', 'url' => $post->get('url'), 'exists' => false);
     $rs = $ST->select("SELECT text,url,rule FROM sc_ceo_text\r\n\t\t\t WHERE\r\n\t\t\t \tplace='{$post->get('place')}' \r\n\t\t\t \tAND ((url='" . SQL::slashes($post->get('url')) . "' AND rule='=') \r\n\t\t\t \tOR ('" . SQL::slashes($post->get('url')) . "' LIKE CONCAT(url,'%') AND rule!='=' ))\r\n\t\t\t ORDER BY LENGTH(url) DESC LIMIT 1");
     if ($rs->next()) {
         $data = $rs->getRow();
         $data['exists'] = true;
     }
     $data['place'] = $post->get('place');
     echo printJSON($data);
     exit;
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:13,代码来源:Ceo.class.php

示例5: actRemove

 function actRemove()
 {
     global $ST, $get, $post;
     if ($get->get('name')) {
         $ST->delete('sc_config', "name='" . SQL::slashes($get->get('name')) . "'");
     }
     if ($item = $post->getArray('item')) {
         foreach ($item as $n) {
             $ST->delete('sc_config', "name='" . SQL::slashes($n) . "'");
         }
     }
     echo $this->rndList();
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:13,代码来源:Config.class.php

示例6: actOrder1c

 function actOrder1c()
 {
     global $ST, $get;
     $login = $get->get('login');
     $password = $get->get('password');
     $q = "SELECT * FROM sc_users WHERE type='admin' \n\t\t\tAND login='" . SQL::slashes($login) . "'\n\t\t\tAND password=PASSWORD('" . SQL::slashes($password) . "')";
     $rs = $ST->select($q);
     if (!$rs->next()) {
         exit;
     }
     $data = array('make_date' => date('Y-m-d'), 'make_time' => date('H:i:s'), 'document' => array());
     $date_from = date('Y-m-d');
     $date_to = date('Y-m-d', time() + 3600 * 24);
     if ($get->get('date_from')) {
         $date_from = $get->get('date_from');
     }
     if ($get->get('date_to')) {
         $date_to = $get->get('date_to');
     }
     $q = "SELECT * FROM sc_shop_order o,sc_users u WHERE u.u_id=o.userid\n\t\t\tAND o.create_time>='{$date_from}' AND o.create_time<='{$date_to}'\n\t\t";
     $rs = $ST->select($q);
     while ($rs->next()) {
         $d = array('id' => $rs->get('id'), 'num' => $rs->get('id'), 'date' => dte($rs->get('create_time'), 'Y-m-d'), 'summ' => $rs->get('total_price'), 'contragent' => array('id' => $rs->get('u_id') . '#' . $rs->get('login') . '#' . $rs->get('name'), 'name' => $rs->get('type') == 'user_jur' ? $rs->get('company') : $rs->get('name'), 'address' => $rs->get('address'), 'mail' => $rs->get('mail')), 'time' => dte($rs->get('create_time'), 'H:i:s'), 'additionally' => $rs->get('additionally'), 'goods' => array());
         $q = "SELECT *,ec.id AS ext_cat_id, oi.price AS price \t\n\t\t\tFROM sc_shop_order_item AS oi, sc_shop_item AS si\n\t\t\tLEFT JOIN sc_shop_srv_extcat AS ec ON ec.lnk=si.category\n\t\t\tWHERE\n\t\t\t\tsi.id=oi.itemid\n\t\t\t\tAND oi.orderid={$rs->get('id')} \n\t\t\t\t\n\t\t\t";
         $q = "SELECT *, oi.price AS price \t\n\t\t\tFROM sc_shop_order_item AS oi, sc_shop_item AS si\n\t\t\t\n\t\t\tWHERE\n\t\t\t\tsi.id=oi.itemid\n\t\t\t\tAND oi.orderid={$rs->get('id')} \n\t\t\t\t\n\t\t\t";
         $rs1 = $ST->select($q);
         while ($rs1->next()) {
             $g = array('name' => $rs1->get('name'), 'id' => $rs1->get('ext_id'), 'price' => $rs1->get('price') / $rs1->get('count'), 'count' => $rs1->get('count'), 'summ' => $rs1->get('price'));
             $d['goods'][] = $g;
         }
         $data['document'][] = $d;
     }
     if ($data['document']) {
         echo '<?xml version="1.0" encoding="windows-1251"?>';
         echo $this->render($data, dirname(__FILE__) . '/order1c.xml.php');
         exit;
     } else {
         echo 'Нет заказов';
     }
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:40,代码来源:Catsrv.class.php

示例7: actSave

 function actSave()
 {
     global $ST, $post;
     $id = $post->getInt('c_id');
     if (!trim($post->get('c_name'))) {
         echo printJSON(array('err' => 'Введите название'));
         exit;
     }
     $rs = $ST->select("SELECT * FROM sc_content WHERE c_name='" . SQL::slashes($post->get('c_name')) . "' AND c_id<>{$id}");
     if ($rs->next()) {
         echo printJSON(array('err' => 'Содержимое с таким названием СУЩЕСТВУЕТ'));
         exit;
     }
     $data = array('c_name' => $post->get('c_name'), 'c_text' => $post->get('c_text'));
     if ($id) {
         $ST->update('sc_content', $data, 'c_id=' . $id);
     } else {
         $id = $ST->insert('sc_content', $data, 'c_id');
     }
     echo printJSON(array('msg' => 'Сохранено', 'c_id' => $id));
     exit;
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:22,代码来源:Content.class.php

示例8: act_recountMan

 function act_recountMan()
 {
     global $ST;
     $rs = $ST->select("SELECT * FROM sc_shop_item WHERE manufacturer <>''");
     while ($rs->next()) {
         $rs1 = $ST->select("SELECT * FROM sc_manufacturer WHERE name='" . SQL::slashes($rs->get('manufacturer')) . "'");
         if ($rs1->next()) {
             $manid = $rs1->get('id');
         } else {
             $manid = $ST->insert('sc_manufacturer', array('name' => $rs->get('manufacturer')));
         }
         $ST->update('sc_shop_item', array('manufacturer_id' => $manid), 'id=' . $rs->get('id'));
     }
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:14,代码来源:AdminCatalog.class.php

示例9: actPasschange

 function actPasschange()
 {
     global $ST, $post;
     $ST->executeUpdate("UPDATE sc_users SET password=PASSWORD('" . SQL::slashes($post->get('password')) . "') WHERE u_id=" . $this->getUserId());
     echo printJSON(array('msg' => 'Пароль принят'));
     exit;
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:7,代码来源:AdminUsr.class.php

示例10: getQuery

 function getQuery($key)
 {
     $search = explode(' ', trim(preg_replace('/\\s+/', ' ', $this->search)));
     if (in_array($key, array('public', 'news'))) {
         $cond = " type IN('{$key}') \r\n\t\t\t\t\tAND (state='main' OR state='public') ";
         //				$relev=" MATCH nws_title, nws_content,nws_desc AGAINST ('".$this->search."') ";
         //				$cond.=" AND (content ILIKE '%".SQL::slashes($this->search)."%' OR title ILIKE '%".SQL::slashes($this->search)."%' OR description ILIKE '%".SQL::slashes($this->search)."%')";
         $subCond = array();
         foreach ($search as $s) {
             $subCond[] = "(content LIKE '%" . SQL::slashes($s) . "%' OR title LIKE '%" . SQL::slashes($s) . "%' OR description LIKE '%" . SQL::slashes($s) . "%')";
         }
         //				$cond.=" AND (".implode(' OR ',$subCond).")";
         $cond .= " AND (" . implode(' AND ', $subCond) . ")";
         $q = "SELECT id ,title, description FROM sc_news WHERE " . $cond . " ";
         $countQ = "SELECT COUNT(id) AS c FROM sc_news WHERE " . $cond;
         $href = "/news/view/";
         $title = "Статьи";
     }
     if ($key == 'gallery') {
         $cond = " type='gallery' \r\n\t\t\t\t\t";
         $subCond = array();
         foreach ($search as $s) {
             $subCond[] = "(text LIKE '%" . SQL::slashes($s) . "%' OR name LIKE '%" . SQL::slashes($s) . "%' OR description LIKE '%" . SQL::slashes($s) . "%')";
         }
         //				$cond.=" AND (".implode(' OR ',$subCond).")";
         $cond .= " AND (" . implode(' AND ', $subCond) . ")";
         $q = "SELECT id ,name as title, description FROM sc_gallery WHERE " . $cond . " ";
         $countQ = "SELECT COUNT(id) AS c FROM sc_gallery WHERE " . $cond;
         $href = "/gallery/";
         $title = "Галлерея";
     }
     if ($key == 'content') {
         //				$cond=" mod_content_id=c_id AND (mod_location LIKE 'main' OR  mod_location LIKE 'footer' OR  mod_location LIKE 'top')
         //						AND (mod_name ILIKE '%".SQL::slashes($this->search)."%' OR mod_title ILIKE '%".SQL::slashes($this->search)."%' OR c_text ILIKE '%".SQL::slashes($this->search)."%')";
         //				$cond=" c_name ILIKE '%'||mod_alias||'%' AND mod_alias <>'/'";
         $cond = " mod_alias LIKE CONCAT('%',c_name,'%') AND mod_title<>'' AND c_text<>''";
         //				$cond=" mod_alias =c_name ";
         //				$cond.=" AND (mod_location LIKE '%main%' OR  mod_location LIKE '%footer%' OR  mod_location LIKE '%top%')";
         //				$cond.=" AND (mod_name ILIKE '%".SQL::slashes($this->search)."%' OR mod_title ILIKE '%".SQL::slashes($this->search)."%' OR c_text ILIKE '%".SQL::slashes($this->search)."%')";
         $subCond = array();
         foreach ($search as $s) {
             $subCond[] = "(mod_name LIKE '%" . SQL::slashes($s) . "%' OR mod_title LIKE '%" . SQL::slashes($s) . "%' OR c_text LIKE '%" . SQL::slashes($s) . "%')";
         }
         //				$cond.=" AND (".implode(' OR ',$subCond).")";
         $cond .= " AND (" . implode(' AND ', $subCond) . ")";
         //				$q="SELECT mod_alias AS id,mod_title AS title,mod_description AS description FROM sc_content,sc_module WHERE ".$cond." ";
         $q = "SELECT c_name AS id,mod_title AS title,mod_description AS description FROM sc_content,sc_module WHERE " . $cond . " ";
         $countQ = "SELECT COUNT(c_id) AS c FROM sc_content,sc_module WHERE " . $cond;
         $href = "";
         $title = "Разделы сайта";
     }
     if ($key == 'catalog') {
         $cond = "";
         //				$cond.=" AND (g.name ILIKE '%".SQL::slashes($this->search)."%' OR g.description ILIKE '%".SQL::slashes($this->search)."%' OR c.name ILIKE '%".SQL::slashes($this->search)."%' )";
         $subCond = array();
         foreach ($search as $s) {
             $subCond[] = "(i.name LIKE '%" . SQL::slashes($s) . "%' OR i.description LIKE '%" . SQL::slashes($s) . "%' )";
         }
         //				$cond.=" AND (".implode(' OR ',$subCond).")";
         $cond .= " AND (" . implode(' AND ', $subCond) . ")";
         $cat = LibCatalog::getInstance();
         $q = "SELECT g.*, g.id AS id, g.name AS title, g.description AS description FROM sc_shop_item g WHERE " . $cond . "";
         $q = "{$cat->select()} " . $cond . "";
         $countQ = "{$cat->selectCount()} " . $cond;
         $href = "/catalog/goods/";
         $title = "Товары";
     }
     return array($q, $countQ, $href, $title);
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:69,代码来源:Search.class.php

示例11: actSave

 function actSave()
 {
     global $ST, $get, $post;
     $id = $post->getInt('id');
     $data = array('content' => $post->get('content'), 'description' => $post->get('description'), 'title' => $post->get('title'), 'author' => $post->get('author'), 'date' => dte($post->get('date'), 'Y-m-d'), 'state' => $post->get('state'), 'category' => $post->getInt('category'), 'position' => $post->getInt('position'), 'gallery' => $post->getInt('gallery'), 'type' => $this->getType());
     $img_out = "";
     if (!empty($_FILES['upload']['name']) && isImg($_FILES['upload']['name'])) {
         $img = $this->cfg('NEWS_IMAGE_PATH') . '/' . md5($_FILES['upload']['tmp_name']) . "." . file_ext($_FILES['upload']['name']);
         move_uploaded_file($_FILES['upload']['tmp_name'], ROOT . $img);
         $data['img'] = $img;
         $img_out = scaleImg($img, 'w200');
     }
     if ($post->getInt('clear')) {
         $data['img'] = '';
     }
     if ($id) {
         $ST->update('sc_news', $data, "id=" . $id);
     } else {
         $id = $ST->insert('sc_news', $data);
     }
     $ST->delete('sc_relation', "parent={$id} AND type='public'");
     foreach ($post->getArray('public_rel') as $v) {
         $ST->insert('sc_relation', array('parent' => $id, 'type' => 'public', 'child' => $v));
     }
     $msg = "Сохранено";
     if (true) {
         $content = '';
         $content .= '<small>' . date('d.m.Y') . '</small> ';
         $content .= '<strong>' . $post->getHtml('title') . '</strong><br />';
         $content .= '<span>' . $post->getHtml('description') . '</span><br />';
         $content .= '<a href="http://' . $this->cfg('SITE') . '/' . $post->get('type') . '/' . $id . '/">подробнее...</a>';
         if ($post->exists('save_and_send')) {
             $mail = new Mail();
             $mail->setFromMail(array($this->cfg('SITE'), $this->cfg('mail')));
             $key = 'http://' . $this->cfg('SITE') . '/cabinet/unsubscribe/?key=' . md5($this->getUser('mail') . $this->getType() . 'unsubscribe') . '&type=' . $this->getType() . '&mail=' . $this->getUser('mail');
             $key = '<a href="' . $key . '">' . $key . '</a>';
             $mail->setTemplate('letter_' . $this->getType(), array('FROM_SITE' => $this->cfg('SITE'), 'CONTENT' => $content, 'BODY' => $post->get('content'), 'TITLE' => $post->get('title')));
             $mail->xsend($this->getUser('mail'), array('UNSUBSCRIBE' => $key));
         } elseif ($post->exists('save_and_send_all')) {
             $q = "SELECT distinct mail,id FROM sc_subscribe WHERE type LIKE '%" . $this->getType() . "%' \r\n\t\t\t\tAND NOT EXISTS(SELECT mailid FROM sc_news_sendlog WHERE id=mailid AND newsid={$id}){$this->getMailFilter()}";
             if ($post->getInt('pack')) {
                 $q .= " LIMIT {$post->getInt('pack')}";
             }
             $rs = $ST->select($q);
             $mail = new Mail();
             //				$mail->setFromMail($this->getConfig('mail'));
             $mail->setFromMail(array($this->cfg('SITE'), $this->cfg('mail')));
             $mail->setTemplate('letter_' . $this->getType(), array('FROM_SITE' => $this->cfg('SITE'), 'CONTENT' => $content, 'BODY' => $post->get('content'), 'TITLE' => $post->get('title')));
             $n = 0;
             while ($rs->next()) {
                 if (check_mail($m = trim($rs->get('mail')))) {
                     $key = 'http://' . $this->cfg('SITE') . '/cabinet/unsubscribe/?key=' . md5($rs->get('mail') . $this->getType() . 'unsubscribe') . '&type=' . $this->getType() . '&mail=' . $rs->get('mail');
                     $key = '<a href="' . $key . '">' . $key . '</a>';
                     $mail->xsend($m, array('UNSUBSCRIBE' => $key));
                     $ST->insert('sc_news_sendlog', array('mailid' => $rs->get('id'), 'newsid' => $id));
                     $n++;
                 } else {
                     $ST->delete('sc_subscribe', "mail='" . SQL::slashes($rs->get('mail')) . "'");
                 }
             }
             $msg .= " отправлено {$n}";
         }
     }
     echo printJSONP(array('msg' => $msg, 'id' => $id, 'img' => $img_out));
     exit;
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:66,代码来源:AdminArticle.class.php

示例12: actUnsubscribe

 function actUnsubscribe()
 {
     DB::delete("sc_subscribe", "mail='" . SQL::slashes($_GET['mail']) . "'");
     header("Location: " . $_SERVER['HTTP_REFERER']);
     exit;
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:6,代码来源:Users.class.php

示例13: actDoRename

 function actDoRename()
 {
     global $ST, $post;
     $upd = $ST->executeUpdate("UPDATE sc_shop_item SET name=REPLACE(name,'" . SQL::slashes($post->get('name')) . "','" . SQL::slashes($post->get('new_name')) . "')");
     echo printJSON(array('msg' => "Затронуто {$upd} записей"));
     exit;
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:7,代码来源:AdminCatsrv.class.php

示例14: actUnsubscribe

 function actUnsubscribe()
 {
     global $get, $ST;
     if ($get->get('key') == md5($get->get('mail') . $get->get('type') . 'unsubscribe')) {
         $rs = $ST->select("SELECT * FROM sc_subscribe WHERE mail='" . SQL::slashes($get->get('mail')) . "'");
         if ($rs->next()) {
             $t = array();
             if (trim($rs->get('type'))) {
                 $t = explode(' ', trim($rs->get('type')));
                 $t = array_diff($t, array($get->get('type')));
             }
             $ST->update('sc_subscribe', array('type' => implode(' ', $t)), "mail='" . SQL::slashes($get->get('mail')) . "'");
         }
     }
     $this->setPageTitle('Отписаться');
     $this->display(array(), dirname(__FILE__) . '/cabinet_unsubscribe.tpl.php');
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:17,代码来源:Cabinet.class.php

示例15: ob_start

$rs = DB::select($q)->toArray();
if (!$rs) {
    exit;
}
ob_start();
include dirname(__FILE__) . "/catalog_subscribe.tpl.php";
$content = ob_get_contents();
ob_end_clean();
$type = 'catalog';
$mail = new Mail();
//	$mail->setFromMail($this->getConfig('mail'));
$mail->setFromMail(array(Cfg::get('SITE'), Cfg::get('mail')));
$mail->setTemplate('letter_catalog', array('FROM_SITE' => Cfg::get('SITE'), 'CONTENT' => $content));
$q = "SELECT distinct mail,id FROM sc_subscribe WHERE type LIKE '%" . $type . "%' \n\t\t\t\tAND NOT EXISTS(SELECT mailid FROM sc_news_sendlog WHERE id=mailid AND newsid={$id})";
$rs = DB::select($q);
$n = 0;
while ($rs->next()) {
    if (check_mail($m = trim($rs->get('mail')))) {
        $key = 'http://' . Cfg::get('SITE') . '/cabinet/unsubscribe/?key=' . md5($rs->get('mail') . $type . 'unsubscribe') . '&type=' . $type . '&mail=' . $rs->get('mail');
        $key = '<a href="' . $key . '">' . $key . '</a>';
        $mail->xsend($m, array('UNSUBSCRIBE' => $key));
        DB::insert('sc_news_sendlog', array('mailid' => $rs->get('id'), 'newsid' => $id));
        $n++;
    } else {
        DB::delete('sc_subscribe', "mail='" . SQL::slashes($rs->get('mail')) . "'");
    }
}
$rs = DB::select("SELECT MAX(create_time) AS m FROM sc_shop_proposal");
if ($rs->next()) {
    file_put_contents($last_time_fname, $rs->get('m'));
}
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:31,代码来源:catalog_subscribe.php


注:本文中的SQL::slashes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。