[10574] | 1 | <?php |
---|
| 2 | |
---|
| 3 | //Aaded admin menu |
---|
| 4 | add_event_handler('get_admin_plugin_menu_links', 'addinfousers_admin_menu'); |
---|
| 5 | |
---|
| 6 | function 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 |
---|
| 16 | add_event_handler('loc_begin_admin', 'adddinfousersPI', 55 ); |
---|
| 17 | |
---|
| 18 | function 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 | |
---|
| 60 | function adddinfousersPT($content, &$smarty) |
---|
| 61 | { |
---|
| 62 | $search = '<p class="bottomButtons">'; |
---|
| 63 | return str_replace($search, '{$PROFILE_ADD}'."\n".$search, $content); |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | function 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 | |
---|
| 75 | add_event_handler('save_profile_from_post', 'addInfousersPT2'); |
---|
| 76 | |
---|
| 77 | function addInfousersPT2() |
---|
| 78 | { |
---|
| 79 | global $prefixeTable,$conf; |
---|
| 80 | |
---|
| 81 | $query = ' |
---|
| 82 | DELETE |
---|
| 83 | FROM ' . ADDINFOUSERS_TABLE . ' |
---|
| 84 | WHERE id = '.$_POST['inserID'].' |
---|
| 85 | ;'; |
---|
| 86 | $result = pwg_query($query); |
---|
| 87 | |
---|
| 88 | $q = ' |
---|
| 89 | 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'].'");'; |
---|
| 90 | pwg_query($q); |
---|
[10743] | 91 | } |
---|
[10574] | 92 | |
---|
[10743] | 93 | add_event_handler('delete_user', 'addInfousersPT3'); |
---|
[10574] | 94 | |
---|
[10743] | 95 | function addInfousersPT3($user_id) |
---|
| 96 | { |
---|
| 97 | global $prefixeTable; |
---|
| 98 | |
---|
| 99 | $query = ' |
---|
| 100 | DELETE |
---|
| 101 | FROM ' . ADDINFOUSERS_TABLE . ' |
---|
| 102 | WHERE id = '.$user_id.' |
---|
| 103 | ;'; |
---|
| 104 | $result = pwg_query($query); |
---|
[10574] | 105 | } |
---|
| 106 | |
---|
| 107 | ?> |
---|