[10574] | 1 | <?php |
---|
| 2 | |
---|
| 3 | //add prefiter |
---|
| 4 | add_event_handler('loc_begin_profile', 'adddinfousersPI', 55 ); |
---|
| 5 | |
---|
| 6 | function adddinfousersPI() |
---|
| 7 | { |
---|
| 8 | global $template, $prefixeTable, $userdata; |
---|
| 9 | |
---|
| 10 | load_language('plugin.lang', ADDINFOUSERS_PATH); |
---|
| 11 | load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) ); |
---|
| 12 | |
---|
| 13 | $template->set_prefilter('profile_content', 'adddinfousersPT'); |
---|
| 14 | $template->set_filename('profile_add', realpath(ADDINFOUSERS_PATH.'profile_add.tpl')); |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | if (isset($userdata['id'])) |
---|
| 19 | { |
---|
| 20 | $query = ' |
---|
| 21 | select id,info1,info2,info3,info4,info5,info6,info7 |
---|
| 22 | FROM ' . ADDINFOUSERS_TABLE . ' |
---|
| 23 | WHERE id = '.$userdata['id'].' |
---|
| 24 | ;'; |
---|
| 25 | $result = pwg_query($query); |
---|
[21552] | 26 | $row = pwg_db_fetch_assoc($result); |
---|
[10574] | 27 | $idaddinfo=$row['id']; |
---|
| 28 | $info1=$row['info1']; |
---|
| 29 | $info2=$row['info2']; |
---|
| 30 | $info3=$row['info3']; |
---|
| 31 | $info4=$row['info4']; |
---|
| 32 | $info5=$row['info5']; |
---|
| 33 | $info6=$row['info6']; |
---|
| 34 | $info7=$row['info7']; |
---|
| 35 | |
---|
| 36 | $template->assign( |
---|
| 37 | array( |
---|
| 38 | 'AICONTENTID' => $userdata['id'], |
---|
| 39 | 'AICONTENT' => htmlspecialchars($info1), |
---|
| 40 | 'AICONTENT2' => htmlspecialchars($info2), |
---|
| 41 | 'AICONTENT3' => htmlspecialchars($info3), |
---|
| 42 | 'AICONTENT4' => htmlspecialchars($info4), |
---|
| 43 | 'AICONTENT5' => htmlspecialchars($info5), |
---|
| 44 | 'AICONTENT6' => htmlspecialchars($info6), |
---|
| 45 | 'AICONTENT7' => htmlspecialchars($info7), |
---|
| 46 | )); |
---|
| 47 | } |
---|
| 48 | $template->assign_var_from_handle('PROFILE_ADD', 'profile_add'); |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | function adddinfousersPT($content, &$smarty) |
---|
| 52 | { |
---|
| 53 | $search = '<p class="bottomButtons">'; |
---|
| 54 | return str_replace($search, '{$PROFILE_ADD}'."\n".$search, $content); |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | add_event_handler('save_profile_from_post', 'addInfousersPT2'); |
---|
| 58 | |
---|
| 59 | function addInfousersPT2() |
---|
| 60 | { |
---|
| 61 | global $prefixeTable,$conf; |
---|
| 62 | |
---|
| 63 | $query = ' |
---|
| 64 | DELETE |
---|
| 65 | FROM ' . ADDINFOUSERS_TABLE . ' |
---|
| 66 | WHERE id = '.$_POST['inserID'].' |
---|
| 67 | ;'; |
---|
| 68 | $result = pwg_query($query); |
---|
| 69 | |
---|
| 70 | $q = ' |
---|
| 71 | 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'].'");'; |
---|
| 72 | pwg_query($q); |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | ?> |
---|