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
cmsmadesimple-2-0 / admin / footer.php
100644 85 lines (73 sloc) 2.079 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
<?php
if (isset($USE_THEME) && $USE_THEME == false)
  {
    echo '<!-- admin theme disabled -->';
  }
else
  {
    $themeObject->DisplayMainDivEnd();
    $themeObject->OutputFooterJavascript();
    $themeObject->DisplayFooter();
  }
 
if ($gCms->config["debug"] == true)
{
  echo '<div id="DebugFooter">';
  global $sql_queries;
  if (FALSE == empty($sql_queries))
   {
   echo "<div>".$sql_queries."</div>\n";
   }
  foreach ($gCms->errors as $error)
  {
    echo $error;
  }
  echo '</div> <!-- end DebugFooter -->';
}
 
?>
 
</body>
</html>
 
<?php
 
#Pull the stuff out of the buffer...
$htmlresult = '';
if (!(isset($USE_OUTPUT_BUFFERING) && $USE_OUTPUT_BUFFERING == false))
{
  $htmlresult = @ob_get_contents();
  @ob_end_clean();
}
 
#Do any header replacements (this is for WYSIWYG stuff)
$footertext = '';
$formtext = '';
$formsubmittext = '';
$bodytext = '';
 
$userid = get_userid();
$wysiwyg = get_preference($userid, 'wysiwyg');
 
foreach($gCms->modules as $key=>$value)
{
  if ($gCms->modules[$key]['installed'] == true &&
    $gCms->modules[$key]['active'] == true &&
    $gCms->modules[$key]['object']->IsWYSIWYG()
    )
  {
    $loadit=false;
    if ($gCms->modules[$key]['object']->WYSIWYGActive()) {
      $loadit=true;
    } else {
     if (get_preference(get_userid(), 'wysiwyg')==$gCms->modules[$key]['object']->GetName()) {
       $loadit=true;
     }
    }
    if ($loadit) {
     $bodytext.=$gCms->modules[$key]['object']->WYSIWYGGenerateBody();
     $footertext.=$gCms->modules[$key]['object']->WYSIWYGGenerateHeader($htmlresult);
     $formtext.=$gCms->modules[$key]['object']->WYSIWYGPageForm();
     $formsubmittext.=$gCms->modules[$key]['object']->WYSIWYGPageFormSubmit();
    }
  }
}
 
$htmlresult = str_replace('<!-- THIS IS WHERE HEADER STUFF SHOULD GO -->', $footertext, $htmlresult);
$htmlresult = str_replace('##FORMSUBMITSTUFFGOESHERE##', ' '.$formtext, $htmlresult);
$htmlresult = str_replace('##INLINESUBMITSTUFFGOESHERE##', ' '.$formsubmittext, $htmlresult);
$htmlresult = str_replace('##BODYSUBMITSTUFFGOESHERE##', ' '.$bodytext, $htmlresult);
 
echo $htmlresult;
 
# vim:ts=4 sw=4 noet
?>