-
Notifications
You must be signed in to change notification settings - Fork 0
/
categorize_list.php
61 lines (50 loc) · 2.04 KB
/
categorize_list.php
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
<?php
// $Header: /cvsroot-fuse/tikiwiki/tiki/categorize_list.php,v 1.10.2.2 2006/08/24 17:55:33 ohertel Exp $
// Copyright (c) 2002-2005, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
//this script may only be included - so its better to die if called directly.
if (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !== FALSE) {
//smarty is not there - we need setup
require_once('tiki-setup.php');
$smarty->assign('msg',tra("This script cannot be called directly"));
$smarty->display("error.tpl");
die;
}
include_once ('lib/categories/categlib.php');
if ($feature_categories == 'y') {
$smarty->assign('cat_categorize', 'n');
if (isset($_REQUEST["cat_categorize"]) && $_REQUEST["cat_categorize"] == 'on') {
$smarty->assign('cat_categorize', 'y');
}
$cats = $categlib->get_object_categories($cat_type, $cat_objid);
$categories = $categlib->list_categs();
$num_categories = count($categories);
for ($i = 0; $i < $num_categories; $i++) {
if (in_array($categories[$i]["categId"], $cats)) {
$categories[$i]["incat"] = 'y';
} else {
$categories[$i]["incat"] = 'n';
}
if (isset($_REQUEST["cat_categories"]) && isset($_REQUEST["cat_categorize"]) && $_REQUEST["cat_categorize"] == 'on') {
if (in_array($categories[$i]["categId"], $_REQUEST["cat_categories"])) {
$categories[$i]["incat"] = 'y';
// allow to preselect categories when creating a new article
// like this: /tiki-edit_article.php?cat_categories[]=1&cat_categorize=on
$smarty->assign('categ_checked', 'y');
} else {
$categories[$i]["incat"] = 'n';
}
}
}
$smarty->assign('catsdump', implode(',',$cats));
$smarty->assign_by_ref('categories', $categories);
// check if this page is categorized
if ($categlib->is_categorized($cat_type, $cat_objid)) {
$cat_categorize = 'y';
} else {
$cat_categorize = 'n';
}
$smarty->assign('cat_categorize', $cat_categorize);
}
?>