summaryrefslogtreecommitdiffstats
path: root/modules-available/imgmanagement/page.inc.php
blob: 99f1a1a3882af06945a0e5ca9e1eb9bb5460266d (plain) (blame)
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
<?php

class Page_Imgmanagement extends Page
{

	private $page;
	private $baselocation;
	private $images;

	protected function doPreprocess()
	{
		
		User::load();
		if (!User::hasPermission('baseconfig_local')) {
			Message::addError('main.no-permission');
			Util::redirect('?do=Main');
		}

		error_reporting(E_ALL);
		ini_set('display_errors','on');

		Session::get('token');

	}

	protected function doRender()
	{  
 		error_reporting(E_ALL);
		ini_set('display_errors','on');

        $actives = array();
        $deactives = array();

        $res = Database::simpleQuery("SELECT id, name, path, userid, is_template, is_active, description FROM images ORDER BY id DESC");
        while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
            if($row['is_active'])
                $actives[] = array(
                    'id' => $row['id'],
                    'name' => $row['name'],
                    'path' => $row['path'],
                    'userid' => $row['userid'],
                    'is_template' => $row['is_template'],
                    'is_active' => $row['is_active'],
                    'description' => $row['description']
                );
            else
                $deactives[] = array(
                    'id' => $row['id'],
                    'name' => $row['name'],
                    'path' => $row['path'],
                    'userid' => $row['userid'],
                    'is_template' => $row['is_template'],
                    'is_active' => $row['is_active'],
                    'description' => $row['description']
                );
                
        }

		Render::addTemplate('page-imgmanagement', array( 
			'deactives' => $deactives,
			'actives' => $actives));
	}
}