Dotclear

source: plugins/databasespy/index.php @ 1573

Revision 1573, 2.7 KB checked in by JcDenis, 14 years ago (diff)

databasespy 0.4:

  • First lab release
Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3# This file is part of databasespy, a plugin for Dotclear 2.
4#
5# Copyright (c) 2009 JC Denis and contributors
6# jcdenis@gdwd.com
7#
8# Licensed under the GPL version 2.0 license.
9# A copy of this license is available in LICENSE file or at
10# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11# -- END LICENSE BLOCK ------------------------------------
12
13if (!defined('DC_CONTEXT_ADMIN')){return;}
14dcPage::checkSuper();
15
16$p_url = 'plugin.php?p=databasespy';
17
18/** Combos arrays **/
19require_once dirname(__FILE__).'/inc/lib.combos.php';
20
21/** Prepare some vars **/
22
23# Load et create dbSpy object
24$spy = new dbSpy($core,$combo_settings_install);
25
26# Load dbSpy settings
27$settings = $spy->getSettings();
28
29# Parse some $_GET and $_POST
30$_m = (!empty($_GET['m']))?$_GET['m']:'summary';
31$_t = (!empty($_GET['t']))?$_GET['t']:'';
32$_a = (!empty($_POST['action']))?$_POST['action']:'';
33
34# Create page
35$P = new libDbSpyPage($settings);
36
37# Page menus
38foreach($combo_menu AS $k => $v)
39{
40     $P->menu($v,$k,$p_url.'&amp;m='.$v);
41}
42
43/** Post forms actions **/
44# Create table object to work on
45if (isset($_POST['table']))
46{
47     $_T_ = $spy->table($_POST['table']);
48}
49require_once dirname(__FILE__).'/inc/lib.forms.php';
50
51# Show database request for Post actions
52if (isset($_T_) && $settings['show_request'])
53{
54     $sql_req = $_T_->getSqlRequest();
55     foreach($sql_req AS $req)
56     {
57          $P->setSql($req);
58     }
59}
60
61/** Prepare admin page **/
62
63# Show error and warning
64if (isset($error)) { $P->error($error); }
65if (isset($msg)) { $P->warning($msg); }
66
67# Create table object to work on
68if (!empty($_t)) { $_T_ = $spy->table($_t); }
69
70/** Construct admin page **/
71require_once dirname(__FILE__).'/inc/lib.pages.php';
72
73# Show database request page actions
74if (!empty($_t) && $settings['show_request'])
75{
76     $sql_req = $_T_->getSqlRequest();
77     foreach($sql_req AS $req)
78     {
79          $P->setSql($req);
80     }
81}
82
83/** Display Result **/
84?>
85<html>
86<head>
87 <title><?php echo __('Database Spy'); ?></title>
88 <?php echo 
89     dcPage::jsToolBar().
90     dcPage::jsToolMan().
91     dcPage::jsPageTabs('tab_'.$tab);
92 ?>
93<script type="text/javascript">
94$(function() {
95     $(".checkboxes-helpers").each(function() {
96          dotclear.checkboxesHelpers(this);
97     });
98     dotclear.postsActionsHelper();
99});
100</script>
101<link rel="stylesheet" type="text/css" href="index.php?pf=databasespy/style.css" />
102</head>
103<body>
104<?php  echo $P->get($_m); ?>
105<hr class="clear" />
106<?php echo dcPage::helpBlock('databasespy'); ?>
107<p class="right">
108databasespy - <?php echo $core->plugins->moduleInfo('databasespy','version'); ?> 
109<img alt="databasespy" src="index.php?pf=databasespy/icon.png" />
110</p>
111</body>
112</html>
Note: See TracBrowser for help on using the repository browser.

Sites map