This repository has been archived by the owner on Sep 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tagedit.php
84 lines (63 loc) · 2.04 KB
/
tagedit.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
require_once("../../class2.php");
require_once(HEADERF);
$tp = e107::getParser();
include_lan(e_PLUGIN.'tags/languages/'.e_LANGUAGE.'/lan_tagcloud.php');
//allows the edit of a set of tags from the front end
if (ADMIN)
{
$tmp = explode(".", e_QUERY);
$area = $tmp[0];
$id = intval($tmp[1]);
if (isset($_POST['update'])) {$text .= "Updated!";
$tmp = explode(",", $_POST['tags']);
$sql->db_delete("tag_main","Tag_Type = '".$area."' AND Tag_Item_ID =".$id);
$cnt = 0;
foreach ($tmp as $updatetag)
{
$cnt++;
$updatetag = trim($updatetag);
$updatetag = preg_replace ("#\s#","_",$updatetag);
if ($updatetag <>''){
$insertsting = "null,".$id.",'".$area."','".$updatetag."',".$cnt.",null";
$sql->db_insert("tag_main",$insertsting);
}
//echo "$updatetag<p>";
}
}
if($sql->select("tag_main","*","Tag_Type = '".$area."' AND Tag_Item_ID =".$id." ORDER BY Tag_Rank"))
{
while ($tags = $sql->fetch())
{
$tagtemp = preg_replace("#_#"," ",$tags['Tag_Name']);
$tagtext .= $tagtemp.", ";
}
}
$text .= "
<div style='text-align:center'>
<form method='post' action='".e_SELF."?".e_QUERY."' id='tageditform'>
<table style='' class='fborder'>
<tr>
<td class='fcaption' style='text-align:center'><b>".LAN_TG3."</b></td>
</tr>
<tr>
<td class='forumheader3' style='width:40%'>
<textarea class='fborder' name='tags' cols='30' rows='6'>".$tagtext."</textarea>
</td>
</tr>
<tr>
<td colspan ='2' class='forumheader3' style='text-align:center'>
<input class='button' type='submit' name='update' value='Update' />
</td>
</tr>
</table>
</form>
</div>
";
}
else
{$text=LAN_TG2;} //"error!"
//-----------
$ns->tablerender($pagehead, $text);
require_once(FOOTERF);
?>