1 | <?php |
---|
2 | //admin menu |
---|
3 | add_event_handler('get_admin_plugin_menu_links', 'addinfousers_admin_menu'); |
---|
4 | |
---|
5 | function addinfousers_admin_menu($menu) |
---|
6 | { |
---|
7 | array_push($menu, array( |
---|
8 | 'NAME' => 'Add Info Users', |
---|
9 | 'URL' => get_admin_plugin_menu_link(ADDINFOUSERS_PATH . 'admin/admin.php'))); |
---|
10 | return $menu; |
---|
11 | } |
---|
12 | |
---|
13 | //add prefiter |
---|
14 | add_event_handler('loc_begin_admin', 'adddinfousersPIL', 55 ); |
---|
15 | function adddinfousersPIL() |
---|
16 | { |
---|
17 | global $template, $prefixeTable, $conf, $page ; |
---|
18 | $template->set_prefilter('user_list', 'adddinfousersPTL'); |
---|
19 | } |
---|
20 | |
---|
21 | function adddinfousersPTL($content, &$smarty) |
---|
22 | { |
---|
23 | load_language('plugin.lang', ADDINFOUSERS_PATH); |
---|
24 | load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) ); |
---|
25 | $search = '<div class="userPropertiesSetTitle">{\'Properties\'|translate}</div>'; |
---|
26 | return str_replace($search, $search."\n".'<a target="_blank" href="admin.php?page=profile&user_id=<%- user.id %>" class="icon-pencil">{\'addinfousers_complete\'|@translate}</a>'."\n", $content); |
---|
27 | } |
---|
28 | |
---|
29 | add_event_handler('loc_begin_admin', 'adddinfousersPI', 55 ); |
---|
30 | function adddinfousersPI() |
---|
31 | { |
---|
32 | load_language('plugin.lang', ADDINFOUSERS_PATH); |
---|
33 | load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) ); |
---|
34 | global $template, $prefixeTable; |
---|
35 | $template->set_prefilter('profile_content', 'adddinfousersPT'); |
---|
36 | $template->set_filename('profile_add', realpath(ADDINFOUSERS_PATH.'profile_add.tpl')); |
---|
37 | |
---|
38 | if (isset($_GET['user_id'])) |
---|
39 | { |
---|
40 | $query = ' |
---|
41 | select id,info1,info2,info3,info4,info5,info6,info7 |
---|
42 | FROM ' . ADDINFOUSERS_TABLE . ' |
---|
43 | WHERE id = '.$_GET['user_id'].' |
---|
44 | ;'; |
---|
45 | $result = pwg_query($query); |
---|
46 | $row = pwg_db_fetch_assoc($result); |
---|
47 | $idaddinfo=$row['id']; |
---|
48 | $info1=$row['info1']; |
---|
49 | $info2=$row['info2']; |
---|
50 | $info3=$row['info3']; |
---|
51 | $info4=$row['info4']; |
---|
52 | $info5=$row['info5']; |
---|
53 | $info6=$row['info6']; |
---|
54 | $info7=$row['info7']; |
---|
55 | |
---|
56 | $template->assign( |
---|
57 | array( |
---|
58 | 'AICONTENTID' => $_GET['user_id'], |
---|
59 | 'AICONTENT' => htmlspecialchars($info1), |
---|
60 | 'AICONTENT2' => htmlspecialchars($info2), |
---|
61 | 'AICONTENT3' => htmlspecialchars($info3), |
---|
62 | 'AICONTENT4' => htmlspecialchars($info4), |
---|
63 | 'AICONTENT5' => htmlspecialchars($info5), |
---|
64 | 'AICONTENT6' => htmlspecialchars($info6), |
---|
65 | 'AICONTENT7' => htmlspecialchars($info7), |
---|
66 | )); |
---|
67 | } |
---|
68 | $template->assign_var_from_handle('PROFILE_ADD', 'profile_add'); |
---|
69 | } |
---|
70 | |
---|
71 | function adddinfousersPT($content, &$smarty) |
---|
72 | { |
---|
73 | $search = '<p class="bottomButtons">'; |
---|
74 | return str_replace($search, '{$PROFILE_ADD}'."\n".$search, $content); |
---|
75 | } |
---|
76 | |
---|
77 | function adddinfousersPI2() |
---|
78 | { |
---|
79 | load_language('plugin.lang', ADDINFOUSERS_PATH); |
---|
80 | load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) ); |
---|
81 | } |
---|
82 | |
---|
83 | add_event_handler('save_profile_from_post', 'addInfousersPT2'); |
---|
84 | |
---|
85 | function addInfousersPT2() |
---|
86 | { |
---|
87 | global $prefixeTable,$conf; |
---|
88 | $query = ' |
---|
89 | DELETE |
---|
90 | FROM ' . ADDINFOUSERS_TABLE . ' |
---|
91 | WHERE id = '.$_POST['inserID'].' |
---|
92 | ;'; |
---|
93 | $result = pwg_query($query); |
---|
94 | $q = ' |
---|
95 | INSERT INTO ' . $prefixeTable . 'AddInfo_users(id,info1,info2,info3,info4,info5,info6,info7)VALUES ("'.$_POST['inserID'].'","'.$_POST['inser'].'","'.$_POST['inser2'].'","'.$_POST['inser3'].'","'.$_POST['inser4'].'","'.$_POST['inser5'].'","'.$_POST['inser6'].'","'.$_POST['inser7'].'");'; |
---|
96 | pwg_query($q); |
---|
97 | } |
---|
98 | |
---|
99 | add_event_handler('delete_user', 'addInfousersPT3'); |
---|
100 | |
---|
101 | function addInfousersPT3($user_id) |
---|
102 | { |
---|
103 | global $prefixeTable; |
---|
104 | $query = ' |
---|
105 | DELETE |
---|
106 | FROM ' . ADDINFOUSERS_TABLE . ' |
---|
107 | WHERE id = '.$user_id.' |
---|
108 | ;'; |
---|
109 | $result = pwg_query($query); |
---|
110 | } |
---|
111 | ?> |
---|