コード例 #1
0
[BEGIN_COT_EXT]
Hooks=comments.send.new
[END_COT_EXT]
==================== */
/**
 * Ads board module for Cotonti Siena
 *
 * @package Advboard
 * @author Kalnov Alexey    <*****@*****.**>
 * @copyright (c) 2015 Portal30 Studio http://portal30.ru
 */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_incfile('advboard', 'module');
$adv_cat = '';
if ($comarray['com_area'] == 'advboard' && cot::$cfg['advboard']['notifyUserNewComment'] == 1 && $comarray['com_code'] > 0) {
    $advert = advboard_model_Advert::getById($comarray['com_code']);
    if ($advert && $advert->issetEmail(true)) {
        // Очистить кеш
        // todo очистка кеша в одном файле с мультихуком
        //        if (ab_inBoardCat($adv_cat) && $cache && $cfg['plugin']['advboard']['recentAdvCacheTime'] > 0) {
        //            /** @var Memcache_driver $ab_CacheDrv  */
        //            $ab_CacheDrv = ab_getCacheDrv();
        //            $cache_key = 'RECENT_ADVS';
        //            $advRealm = COT_DEFAULT_REALM;
        //            $ab_CacheDrv->remove($cache_key, $advRealm);
        //        }
        //Очистить кеш
        $advertUrl = $advert->getUrl();
        if (!cot_url_check($advertUrl)) {
            $advertUrl = COT_ABSOLUTE_URL . $advertUrl;
        }
コード例 #2
0
ファイル: Main.php プロジェクト: ASDAFF/advboard
 public function deleteAction()
 {
     $id = cot_import('id', 'G', 'INT');
     // id Объявления
     $b = cot_import('b', 'G', 'HTM');
     // Куда вернуться
     /* === Hook === */
     foreach (cot_getextplugins('advboard.delete.first') as $pl) {
         include $pl;
     }
     /* ===== */
     // Права на любую категорию доски объявлений
     list(cot::$usr['auth_read'], cot::$usr['auth_write'], cot::$usr['isadmin']) = cot_auth('advboard', 'any');
     cot_block(cot::$usr['auth_write']);
     $advert = advboard_model_Advert::getById($id);
     if (!$advert) {
         cot_die_message(404, TRUE);
     }
     if (!cot::$usr['isadmin']) {
         if ($advert->user != cot::$usr['id']) {
             cot_die_message(404, TRUE);
         }
     }
     $title = $advert->title;
     $userId = $advert->user;
     $advert->delete();
     /* === Hook === */
     foreach (cot_getextplugins('advboard.delete.done') as $pl) {
         include $pl;
     }
     /* ===== */
     if (!empty($b)) {
         $b = unserialize(base64_decode($b));
     } elseif (!empty($_SESSION['cot_com_back']) && !empty($_SESSION['cot_com_back']['advboard'])) {
         $b = $_SESSION['cot_com_back']['advboard'];
         unset($_SESSION['cot_com_back']['advboard']);
     }
     if (empty($b)) {
         $b = array('m' => 'user');
         if ($userId != cot::$usr['id']) {
             $b['uid'] = $userId;
         }
     }
     cot_message(sprintf(cot::$L['advboard_deleted'], $title));
     cot_redirect(cot_url('advboard', $b, '', true));
 }