forked from q2a-projects/Q2A-Ultimate-SEO
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtag-editor-page.php
80 lines (64 loc) · 2.41 KB
/
tag-editor-page.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
<?php
class useo_tag_editor_page
{
function match_request($request)
{
$parts = explode('/', $request);
return $parts[0] == 'tag-edit';
}
function process_request($request)
{
$parts = explode('/', $request);
$tag = $parts[1] ?? '';
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html_sub('useo/edit_desc_for_x', qa_html($tag));
if (qa_user_permit_error('useo_tag_desc_permit_edit')) {
$qa_content['error'] = qa_lang_html('users/no_permission');
return $qa_content;
}
require_once QA_INCLUDE_DIR . 'db/metas.php';
if (qa_clicked('dosave')) {
require_once QA_INCLUDE_DIR . 'util/string.php';
$taglc = qa_strtolower($tag);
qa_db_tagmeta_set($taglc, 'title', qa_post_text('tagtitle'));
qa_db_tagmeta_set($taglc, 'description', qa_post_text('tagdesc'));
qa_db_tagmeta_set($taglc, 'icon', qa_post_text('tagicon'));
qa_redirect('tag/' . $tag);
}
$qa_content['form'] = array(
'tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"',
'style' => 'tall', // could be 'wide'
'fields' => array(
array(
'label' => 'Title:',
'type' => 'text',
'rows' => 2,
'tags' => 'NAME="tagtitle" ID="tagtitle"',
'value' => qa_html(qa_db_tagmeta_get($tag, 'title')),
),
array(
'label' => 'Description:',
'type' => 'text',
'rows' => 4,
'tags' => 'NAME="tagdesc" ID="tagdesc"',
'value' => qa_html(qa_db_tagmeta_get($tag, 'description')),
),
array(
'label' => 'Icon image:',
'type' => 'text',
'rows' => 1,
'tags' => 'NAME="tagicon" ID="tagicon"',
'value' => qa_html(qa_db_tagmeta_get($tag, 'icon')),
),
),
'buttons' => array(
array(
'tags' => 'NAME="dosave"',
'label' => qa_lang_html('useo/save_desc_button'),
),
),
);
$qa_content['focusid'] = 'tagdesc';
return $qa_content;
}
}