Till Brehm
2016-04-22 ebd0e986ed11f2a34fb58cdd33efbfab192083ad
commit | author | age
0920f0 1 <?php
V 2 /*
a892b8 3 Copyright (c) 2007-2010, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
0920f0 4 All rights reserved.
V 5
6 Redistribution and use in source and binary forms, with or without modification,
7 are permitted provided that the following conditions are met:
8
9     * Redistributions of source code must retain the above copyright notice,
10       this list of conditions and the following disclaimer.
11     * Redistributions in binary form must reproduce the above copyright notice,
12       this list of conditions and the following disclaimer in the documentation
13       and/or other materials provided with the distribution.
14     * Neither the name of ISPConfig nor the names of its contributors
15       may be used to endorse or promote products derived from this software without
16       specific prior written permission.
17
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30
31 /******************************************
32 * Begin Form configuration
33 ******************************************/
34
35 $list_def_file = "list/client_template.list.php";
36 $tform_def_file = "form/client_template.tform.php";
37
38 /******************************************
39 * End Form configuration
40 ******************************************/
41
7fe908 42 require_once '../../lib/config.inc.php';
MC 43 require_once '../../lib/app.inc.php';
0920f0 44
V 45 //* Check permissions for module
46 $app->auth->check_module_permissions('client');
d6bec7 47 if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) die('Client-Templates are for Admins and Resellers only.');
0920f0 48
V 49 $app->uses('tpl,tform');
50 $app->load('tform_actions');
51
52 class page_action extends tform_actions {
c86da3 53     function onBeforeDelete() {
T 54         global $app;
7fe908 55
7b47c0 56         // check new style
7fe908 57         $rec = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client_template_assigned WHERE client_template_id = ".$this->id);
7b47c0 58         if($rec['number'] > 0) {
T 59             $app->error($app->tform->lng('template_del_aborted_txt'));
60         }
7fe908 61
MC 62         // check old style
c86da3 63         $rec = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client WHERE template_master = ".$this->id." OR template_additional like '%/".$this->id."/%'");
T 64         if($rec['number'] > 0) {
65             $app->error($app->tform->lng('template_del_aborted_txt'));
66         }
7fe908 67
c86da3 68     }
7fe908 69
0920f0 70 }
V 71
72 $page = new page_action;
73 $page->onDelete()
74
7fe908 75 ?>