Форумы / National / Russian / Вопросы и пожелания к движку

Для юзеров Seditio и новичков

Dayver
#38167 16.10.2013 17:58

папка myplug

в нем два файла myplug.setup.php и myplug.page.add.done.php

в первом (myplug.setup.php) такое:

PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
/* ====================
[BEGIN_COT_EXT]
Name=Redir to main
Category=navigation-structure
Description=Редирект на глваную после добавления страницы
Version=1.0
Date=2013-10-16
Author=Dayver
Copyright=All rights reserved (c) Cotonti Team 2008-2013
Auth_guests=R
Lock_guests=W12345A
Auth_members=RW
Lock_members=12345
Requires_modules=page
[END_COT_EXT]
==================== */
defined('COT_CODE') or die('Wrong URL');

во втором (myplug.page.add.done.php) такое:

PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/* ====================
[BEGIN_COT_EXT]
Hooks=page.add.add.done,page.edit.update.done
[END_COT_EXT]
==================== */
defined('COT_CODE') or die('Wrong URL');
 
global $m;
if ($m  == 'add')
{
        if ($rpage['page_state'] == 0 && $cache)
        {
                if ($cfg['cache_page'])
                {
                        $cache->page->clear('page/' . str_replace('.', '/', $structure['page'][$rpage['page_cat']]['path']));
                }
                if ($cfg['cache_index'])
                {
                        $cache->page->clear('index');
                }
        }
        cot_shield_update(30, "r page");
        cot_log("Add page #".$id, 'adm');
}
else if ($m == 'edit')
{
        if (($rpage['page_state'] == 0  || $rpage['page_cat'] != $row_page['page_cat']) && $cache)
        {
                if ($cfg['cache_page'])
                {
                        $cache->page->clear('page/' . str_replace('.', '/', $structure['page'][$rpage['page_cat']]['path']));
                        if ($rpage['page_cat'] != $row_page['page_cat'])
                        {
                                $cache->page->clear('page/' . str_replace('.', '/', $structure['page'][$row_page['page_cat']]['path']));
                        }
                }
                if ($cfg['cache_index'])
                {
                        $cache->page->clear('index');
                }
        }
}
 
        cot_redirect(cot_url('index'));

 

Pavlo Tkachenko aka Dayver
Отредактировано: Dayver (16.10.2013 19:58, 11 лет назад)