public
Description: Git mirror of the CMS Made Simple 2.0 rewrite
Homepage: http://cmsmadesimple.org
Clone URL: git://github.com/tedkulp/cmsmadesimple-2-0.git
commit  a21425135b490b2caf32682bc4ef2fc6cfbd7c19
tree    a46b8e3aa3dfb168dec5f3e89b5a3a9bb918d4ac
parent  e34223b6addd2ea537224ce7a5ce8213fd5b8cbb
cmsmadesimple-2-0 / admin / moduleinterface.php
100644 164 lines (151 sloc) 4.131 kb
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
#CMS - CMS Made Simple
#(c)2004-2008 by Ted Kulp (ted@cmsmadesimple.org)
#This project's homepage is: http://cmsmadesimple.sf.net
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANthe TY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#$Id$
 
$CMS_ADMIN_PAGE=1;
 
require_once("../include.php");
 
check_login();
$userid = get_userid();
 
$smarty = cms_smarty();
$smarty->assign('date_format_string',get_preference($userid,'date_format_string','%x %X'));
 
$id = '';
$module = '';
$action = 'defaultadmin';
$suppressOutput = false;
if (isset($_REQUEST['module'])) $module = $_REQUEST['module'];
if (isset($_REQUEST['action'])) $action = $_REQUEST['action'];
if (isset($_REQUEST['id']))
{
  $id = $_REQUEST['id'];
}
elseif (isset($_REQUEST['mact']))
{
  $ary = explode(',', cms_htmlentities($_REQUEST['mact']), 4);
  $module = (isset($ary[0])?$ary[0]:'');
  $id = (isset($ary[1])?$ary[1]:'');
  $action = (isset($ary[2])?$ary[2]:'');
}
 
if (isset($gCms->modules[$module]) && $gCms->modules[$module]['object']->is_wysiwyg())
{
  if (get_preference($userid, 'use_wysiwyg') == "1")
  {
    $htmlarea_flag = "true";
    $htmlarea_replaceall = true;
  }
}
 
$USE_OUTPUT_BUFFERING = true;
if (isset($gCms->modules[$module]['object']) && $gCms->modules[$module]['object']->has_admin_buffering() == false)
{
  $USE_OUTPUT_BUFFERING = false;
}
else if (isset($_REQUEST[$id . 'disable_buffer']))
{
  $USE_OUTPUT_BUFFERING = false;
}
else if (isset($_REQUEST['disable_buffer']))
{
  $USE_OUTPUT_BUFFERING = false;
}
 
$USE_THEME = true;
if( isset( $_REQUEST[$id . 'disable_theme'] ))
{
  $USE_THEME = false;
}
else if( isset( $_REQUEST['disable_theme'] ))
{
  $USE_THEME = false;
}
if (isset($gCms->modules[$module]['object']) && $gCms->modules[$module]['object']->get_header_html() != false)
  {
    $headtext = $gCms->modules[$module]['object']->get_header_html();
  }
 else
   {
     $headtext = '';
   }
 
if (isset($gCms->modules[$module]['object']) && $gCms->modules[$module]['object']->suppress_admin_output($_REQUEST) != false)
  {
  $suppressOutput = true;
  }
else
  {
  include_once("header.php");
   }
 
if (count($gCms->modules) > 0)
{
  if (isset($USE_THEME) && $USE_THEME == false)
  {
    echo '';
  }
  else
  {
   $params = GetModuleParameters($id);
   if (FALSE == empty($params['module_message']))
   {
   echo $themeObject->show_message($params['module_message']);
   }
   if (FALSE == empty($params['module_error']))
   {
   echo $themeObject->show_errors($params['module_error']);
   }
   if (!$suppressOutput)
   {
   echo '<div class="pagecontainer">';
   echo '<div class="pageoverflow">';
   echo $themeObject->show_header($gCms->modules[$module]['object']->get_friendly_name(), '', '', 'both').'</div>';
   }
  }
 
  if (isset($gCms->modules[$module]))
  {
    if (!(isset($USE_OUTPUT_BUFFERING) && $USE_OUTPUT_BUFFERING == false))
    {
      @ob_start();
    }
    $id = 'm1_';
    $params = GetModuleParameters($id);
    echo $gCms->modules[$module]['object']->do_action_base($action, $id, $params);
    if (!(isset($USE_OUTPUT_BUFFERING) && $USE_OUTPUT_BUFFERING == false))
    {
      $content = @ob_get_contents();
      @ob_end_clean();
      echo $content;
    }
    if (!$suppressOutput)
      {
      echo '</div>';
      }
  }
  else
  {
    redirect("index.php");
  }
}
 
if (isset($USE_THEME) && $USE_THEME == false)
{
  echo '';
}
elseif (!$suppressOutput)
{
  echo '<p class="pageback"><a class="pageback" href="'.$themeObject->back_url().'">&#171; '.lang('back').'</a></p>';
}
if (!$suppressOutput)
  {
  include_once("footer.php");
   }
# vim:ts=4 sw=4 noet
?>