Changeset 27289
- Timestamp:
- Feb 9, 2014, 6:41:58 PM (10 years ago)
- Location:
- extensions/AddInfousers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AddInfousers/initprofileadmin.php
r21552 r27289 1 1 <?php 2 3 //Aaded admin menu 2 //admin menu 4 3 add_event_handler('get_admin_plugin_menu_links', 'addinfousers_admin_menu'); 5 4 6 5 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 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 } 14 12 15 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 16 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')); 17 37 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 = pwg_db_fetch_assoc($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']; 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']; 44 55 45 46 47 48 49 50 51 52 53 54 55 56 57 58 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 } 59 70 60 71 function adddinfousersPT($content, &$smarty) 61 72 { 62 73 $search = '<p class="bottomButtons">'; 63 74 return str_replace($search, '{$PROFILE_ADD}'."\n".$search, $content); 64 } 65 75 } 66 76 67 77 function adddinfousersPI2() 68 78 { 69 79 load_language('plugin.lang', ADDINFOUSERS_PATH); 70 80 load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) ); 71 72 73 } 81 } 74 82 75 83 add_event_handler('save_profile_from_post', 'addInfousersPT2'); … … 77 85 function addInfousersPT2() 78 86 { 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); 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); 91 97 } 92 98 … … 96 102 { 97 103 global $prefixeTable; 98 99 104 $query = ' 100 DELETE101 102 103 104 $result = pwg_query($query);105 DELETE 106 FROM ' . ADDINFOUSERS_TABLE . ' 107 WHERE id = '.$user_id.' 108 ;'; 109 $result = pwg_query($query); 105 110 } 106 107 111 ?> -
extensions/AddInfousers/main.inc.php
r10574 r27289 17 17 define('ADDINFOUSERS_TABLE' , $prefixeTable . 'AddInfo_users'); 18 18 19 19 //plugin on register 20 20 if (script_basename() == 'register') 21 21 { 22 22 include_once(dirname(__FILE__).'/initregister.php'); 23 23 } 24 25 // Plugin on profile page 24 // Plugin on profile page 26 25 if (script_basename() == 'profile') 27 26 { 28 27 include_once(dirname(__FILE__).'/initprofile.php'); 29 28 } 30 31 // Plugin for admin 29 // Plugin for admin 32 30 if (script_basename() == 'admin') 33 31 { 34 32 include_once(dirname(__FILE__).'/initprofileadmin.php'); 35 33 } 36 37 34 ?> -
extensions/AddInfousers/profile_add.tpl
r11674 r27289 1 <fieldset> 2 <legend>{'addinfousers_complete'|@translate}</legend> 3 <input type="hidden" name="inserID" value="{$AICONTENTID}"> 4 <ul> 5 <li id="addinfouser_1"> 6 <span class="property"> {'addinfousers_info1'|@translate} : </span> 7 <input type="text" name="inser" value="{$AICONTENT}" size="80" maxlength="250"> 8 </li> 9 <li id="addinfouser_2"> 10 <span class="property"> {'addinfousers_info2'|@translate} : </span> 11 <input type="text" name="inser2" value="{$AICONTENT2}" size="80" maxlength="250"> 12 </li> 13 <li id="addinfouser_3"> 14 <span class="property">{'addinfousers_info3'|@translate} : </span> 15 <input type="text" name="inser3" value="{$AICONTENT3}" size="80" maxlength="250"> 16 </li> 17 <li id="addinfouser_4"> 18 <span class="property">{'addinfousers_info4'|@translate} : </span> 19 <input type="text" name="inser4" value="{$AICONTENT4}" size="80" maxlength="250"> 20 </li> 21 <li id="addinfouser_5"> 22 <span class="property">{'addinfousers_info5'|@translate} : </span> 23 <input type="text" name="inser5" value="{$AICONTENT5}" size="80" maxlength="250"> 24 </li> 25 <li id="addinfouser_6"> 26 <span class="property">{'addinfousers_info6'|@translate} : </span> 27 <input type="text" name="inser6" value="{$AICONTENT6}" size="80" maxlength="250"> 28 </li> 29 <li id="addinfouser_7"> 30 <span class="property">{'addinfousers_info7'|@translate} : </span> 31 <input type="text" name="inser7" value="{$AICONTENT7}" size="80" maxlength="250"> 32 </li> 33 </fieldset> 1 <fieldset> 2 <legend>{'addinfousers_complete'|@translate}</legend> 3 <input type="hidden" name="inserID" value="{$AICONTENTID}"> 4 <ul> 5 <li id="addinfouser_1"> 6 <span class="property"> {'addinfousers_info1'|@translate} : </span> 7 <input type="text" name="inser" value="{$AICONTENT}" size="80" maxlength="250"> 8 </li> 9 <li id="addinfouser_2"> 10 <span class="property"> {'addinfousers_info2'|@translate} : </span> 11 <input type="text" name="inser2" value="{$AICONTENT2}" size="80" maxlength="250"> 12 </li> 13 <li id="addinfouser_3"> 14 <span class="property">{'addinfousers_info3'|@translate} : </span> 15 <input type="text" name="inser3" value="{$AICONTENT3}" size="80" maxlength="250"> 16 </li> 17 <li id="addinfouser_4"> 18 <span class="property">{'addinfousers_info4'|@translate} : </span> 19 <input type="text" name="inser4" value="{$AICONTENT4}" size="80" maxlength="250"> 20 </li> 21 <li id="addinfouser_5"> 22 <span class="property">{'addinfousers_info5'|@translate} : </span> 23 <input type="text" name="inser5" value="{$AICONTENT5}" size="80" maxlength="250"> 24 </li> 25 <li id="addinfouser_6"> 26 <span class="property">{'addinfousers_info6'|@translate} : </span> 27 <input type="text" name="inser6" value="{$AICONTENT6}" size="80" maxlength="250"> 28 </li> 29 <li id="addinfouser_7"> 30 <span class="property">{'addinfousers_info7'|@translate} : </span> 31 <input type="text" name="inser7" value="{$AICONTENT7}" size="80" maxlength="250"> 32 </li> 33 </ul> 34 </fieldset>
Note: See TracChangeset
for help on using the changeset viewer.