source: extensions/AddInfousers/initprofileadmin.php @ 15555

Last change on this file since 15555 was 10743, checked in by ddtddt, 13 years ago

[extensions] - AddInfousers

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1<?php
2
3//Aaded admin menu
4add_event_handler('get_admin_plugin_menu_links', 'addinfousers_admin_menu');
5
6function addinfousers_admin_menu($menu)
7        {
8  array_push($menu, array(
9        'NAME' => 'Add Info Users',
10    'URL' => get_admin_plugin_menu_link(ADDINFOUSERS_PATH . 'admin/admin.php')));
11  return $menu;
12        }
13
14
15//add prefiter
16add_event_handler('loc_begin_admin', 'adddinfousersPI', 55 );
17
18function adddinfousersPI()
19 {
20        load_language('plugin.lang', ADDINFOUSERS_PATH);
21        load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) );
22 
23                global $template, $prefixeTable;
24        $template->set_prefilter('profile_content', 'adddinfousersPT');
25        $template->set_filename('profile_add', realpath(ADDINFOUSERS_PATH.'profile_add.tpl'));
26       
27 if (isset($_GET['user_id']))
28        {
29        $query = '
30         select id,info1,info2,info3,info4,info5,info6,info7
31         FROM ' . ADDINFOUSERS_TABLE . '
32         WHERE id = '.$_GET['user_id'].'
33         ;';
34        $result = pwg_query($query);
35        $row = mysql_fetch_array($result);
36        $idaddinfo=$row['id'];
37        $info1=$row['info1'];
38        $info2=$row['info2'];
39        $info3=$row['info3'];
40        $info4=$row['info4'];
41        $info5=$row['info5'];
42        $info6=$row['info6'];
43        $info7=$row['info7'];
44
45        $template->assign(
46                array(
47                 'AICONTENTID' => $_GET['user_id'],
48                 'AICONTENT' => htmlspecialchars($info1),
49                 'AICONTENT2' => htmlspecialchars($info2),
50                 'AICONTENT3' => htmlspecialchars($info3),
51                 'AICONTENT4' => htmlspecialchars($info4),
52                 'AICONTENT5' => htmlspecialchars($info5),
53                 'AICONTENT6' => htmlspecialchars($info6),
54                 'AICONTENT7' => htmlspecialchars($info7),
55                ));
56        }       
57                $template->assign_var_from_handle('PROFILE_ADD', 'profile_add');
58 }
59
60function adddinfousersPT($content, &$smarty)
61 {
62  $search = '<p class="bottomButtons">';
63  return str_replace($search, '{$PROFILE_ADD}'."\n".$search, $content);
64 }
65 
66 
67function adddinfousersPI2()
68 {
69 load_language('plugin.lang', ADDINFOUSERS_PATH);
70 load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) );
71
72
73 }
74 
75add_event_handler('save_profile_from_post', 'addInfousersPT2');
76
77function addInfousersPT2()
78{
79global $prefixeTable,$conf;
80
81        $query = '
82DELETE
83  FROM ' . ADDINFOUSERS_TABLE . '
84  WHERE id = '.$_POST['inserID'].'
85  ;';
86$result = pwg_query($query);
87
88        $q = '
89INSERT 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'].'");';
90    pwg_query($q);
91}
92
93add_event_handler('delete_user', 'addInfousersPT3');
94
95function addInfousersPT3($user_id)
96{
97global $prefixeTable;
98
99        $query = '
100DELETE
101  FROM ' . ADDINFOUSERS_TABLE . '
102  WHERE id = '.$user_id.'
103  ;';
104$result = pwg_query($query);
105}
106
107?>
Note: See TracBrowser for help on using the repository browser.