Changeset 31841


Ignore:
Timestamp:
06/06/17 11:31:27 (3 years ago)
Author:
ddtddt
Message:

[extensions] - user_custom_fields - Add import data plugin AddInfoUser

Location:
extensions/user_custom_fields
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • extensions/user_custom_fields/admin.php

    r31542 r31841  
    33// | User Custom Fields plugin for Piwigo                                  | 
    44// +-----------------------------------------------------------------------+ 
    5 // | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ | 
     5// | Copyright(C) 2016-2017 ddtddt               http://temmii.com/piwigo/ | 
    66// +-----------------------------------------------------------------------+ 
    77// | This program is free software; you can redistribute it and/or modify  | 
     
    2222if (!defined('PHPWG_ROOT_PATH')) 
    2323    die('Hacking attempt!'); 
    24 global $template, $conf, $user; 
     24global $template, $conf, $user, $prefixeTable; 
    2525include_once(PHPWG_ROOT_PATH . 'admin/include/tabsheet.class.php'); 
    2626$my_base_url = get_admin_plugin_menu_link(__FILE__); 
     
    7171                                                'UCFADMINONLY' => $user_custom_fields['adminonly'], 
    7272                                                'UCFOBLIGATORY' => $user_custom_fields['obligatory'], 
     73                                                'U_DELETE' => $admin_base_url . '&delete=' . $user_custom_fields['id_ucf'], 
    7374                        'U_HIDE' => $admin_base_url . '&hide=' . $user_custom_fields['id_ucf'], 
    7475                        'U_SHOW' => $admin_base_url . '&show=' . $user_custom_fields['id_ucf'], 
     
    203204            pwg_query($query); 
    204205                } 
     206        /*Import information *AA */ 
     207        $exp = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'AddInfousers';")); 
     208        if($exp['state']=='active'){ 
     209                $template->assign( 
     210                        'gestImp', 
     211                                array( 
     212                                 'yep'=>l10n('yep'), 
     213                )); 
     214        } 
     215                if (isset($_POST['submitimport'])){ 
     216 
     217        $iducf=pwg_db_fetch_assoc(pwg_query('SELECT id_ucf FROM ' . UCF_TABLE . ' ORDER BY id_ucf DESC LIMIT 1;'));      
     218         
     219         
     220        $iducf=$iducf['id_ucf']; 
     221        $iducf1=$iducf+1;$iducf2=$iducf+2;$iducf3=$iducf+3;$iducf4=$iducf+4;$iducf5=$iducf+5;$iducf6=$iducf+6;$iducf7=$iducf+7; 
     222        $q = 'INSERT INTO ' . $prefixeTable . 'user_custom_fields(id_ucf,wording,order_ucf,active,edit,adminonly,obligatory)VALUES ('.$iducf1.',"infos1",'.$iducf1.',1,1,0,1);'; 
     223    pwg_query($q); 
     224        $q = 'INSERT INTO ' . $prefixeTable . 'user_custom_fields(id_ucf,wording,order_ucf,active,edit,adminonly,obligatory)VALUES ('.$iducf2.',"infos2",'.$iducf2.',1,1,0,1);'; 
     225    pwg_query($q); 
     226        $q = 'INSERT INTO ' . $prefixeTable . 'user_custom_fields(id_ucf,wording,order_ucf,active,edit,adminonly,obligatory)VALUES ('.$iducf3.',"infos3",'.$iducf3.',1,1,0,1);'; 
     227    pwg_query($q); 
     228        $q = 'INSERT INTO ' . $prefixeTable . 'user_custom_fields(id_ucf,wording,order_ucf,active,edit,adminonly,obligatory)VALUES ('.$iducf4.',"infos4",'.$iducf4.',1,1,0,1);'; 
     229    pwg_query($q); 
     230        $q = 'INSERT INTO ' . $prefixeTable . 'user_custom_fields(id_ucf,wording,order_ucf,active,edit,adminonly,obligatory)VALUES ('.$iducf5.',"infos5",'.$iducf5.',1,1,0,1);'; 
     231    pwg_query($q); 
     232        $q = 'INSERT INTO ' . $prefixeTable . 'user_custom_fields(id_ucf,wording,order_ucf,active,edit,adminonly,obligatory)VALUES ('.$iducf6.',"infos6",'.$iducf6.',1,1,0,1);'; 
     233    pwg_query($q); 
     234        $q = 'INSERT INTO ' . $prefixeTable . 'user_custom_fields(id_ucf,wording,order_ucf,active,edit,adminonly,obligatory)VALUES ('.$iducf7.',"infos7",'.$iducf7.',1,1,0,1);'; 
     235    pwg_query($q); 
     236         
     237         
     238        $query = 'SELECT * FROM '. $prefixeTable . 'addinfo_users;'; 
     239        $result = pwg_query($query); 
     240        if (pwg_db_num_rows($result)) { 
     241                while ($info = pwg_db_fetch_assoc($result)){ 
     242                        $q = 'INSERT INTO ' . $prefixeTable . 'user_custom_fields_data(id_user,id_ucf,data)VALUES ('.$info['id'].','.$iducf1.',"'.htmlspecialchars($info['info1']).'");'; 
     243                        pwg_query($q); 
     244                        $q = 'INSERT INTO ' . $prefixeTable . 'user_custom_fields_data(id_user,id_ucf,data)VALUES ('.$info['id'].','.$iducf2.',"'.htmlspecialchars($info['info2']).'");'; 
     245                        pwg_query($q); 
     246                        $q = 'INSERT INTO ' . $prefixeTable . 'user_custom_fields_data(id_user,id_ucf,data)VALUES ('.$info['id'].','.$iducf3.',"'.htmlspecialchars($info['info3']).'");'; 
     247                        pwg_query($q); 
     248                        $q = 'INSERT INTO ' . $prefixeTable . 'user_custom_fields_data(id_user,id_ucf,data)VALUES ('.$info['id'].','.$iducf4.',"'.htmlspecialchars($info['info4']).'");'; 
     249                        pwg_query($q); 
     250                        $q = 'INSERT INTO ' . $prefixeTable . 'user_custom_fields_data(id_user,id_ucf,data)VALUES ('.$info['id'].','.$iducf5.',"'.htmlspecialchars($info['info5']).'");'; 
     251                        pwg_query($q); 
     252                        $q = 'INSERT INTO ' . $prefixeTable . 'user_custom_fields_data(id_user,id_ucf,data)VALUES ('.$info['id'].','.$iducf6.',"'.htmlspecialchars($info['info6']).'");'; 
     253                        pwg_query($q); 
     254                        $q = 'INSERT INTO ' . $prefixeTable . 'user_custom_fields_data(id_user,id_ucf,data)VALUES ('.$info['id'].','.$iducf7.',"'.htmlspecialchars($info['info7']).'");'; 
     255                        pwg_query($q); 
     256 
     257                } 
     258        } 
     259        pwg_query( 'UPDATE ' . PLUGINS_TABLE . ' SET state="inactive" WHERE id="AddInfousers"'); 
     260        $_SESSION['page_infos'] = array(l10n('Import is successful')); 
     261        redirect($admin_base_url); 
     262        }  
     263        /*End *AA */ 
    205264  break; 
    206265  case 'edit_user': 
  • extensions/user_custom_fields/admin.tpl

    r31783 r31841  
    169169} 
    170170{/html_style} 
    171  
     171{if isset ($gestImp)} 
     172        <form method="post" > 
     173                <fieldset> 
     174                        <legend>{'Import infos since Add Info Users'|@translate}</legend> 
     175                        <input class="submit" name="submitimport" type="submit" value="{'Import'|@translate}"> 
     176                </fieldset> 
     177        </form> 
     178{/if} 
    172179 
    173180<div class="titrePage"> 
     
    181188        <form method="post" > 
    182189            <fieldset> 
    183                 <legend><span id="leg_add">{'Create new custom fields'|@translate}</span><span id="leg_edit">{'Edit custom fields'|@translate}</span></legend> 
     190                <legend><span id="leg_add">{'Create new custom fields'|@translate}</span><span id="leg_edit">{'Edit custom filds'|@translate}</span></legend> 
    184191                <input id="hideid" type="hidden" name="invisibleID" value="{$addinfo_edit2.AIPID}"> 
    185192                <p class="input"> 
  • extensions/user_custom_fields/include/function.inc.php

    r31542 r31841  
    44// | User Custom Fields plugin for Piwigo                                  | 
    55// +-----------------------------------------------------------------------+ 
    6 // | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ | 
     6// | Copyright(C) 2016-2017 ddtddt               http://temmii.com/piwigo/ | 
    77// +-----------------------------------------------------------------------+ 
    88// | This program is free software; you can redistribute it and/or modify  | 
  • extensions/user_custom_fields/initadmin.php

    r31544 r31841  
    33// | User Custom Fields plugin for Piwigo                                  | 
    44// +-----------------------------------------------------------------------+ 
    5 // | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ | 
     5// | Copyright(C) 2016-2017 ddtddt               http://temmii.com/piwigo/ | 
    66// +-----------------------------------------------------------------------+ 
    77// | This program is free software; you can redistribute it and/or modify  | 
  • extensions/user_custom_fields/initprofile.php

    r31542 r31841  
    33// | User Custom Fields plugin for Piwigo                                  | 
    44// +-----------------------------------------------------------------------+ 
    5 // | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ | 
     5// | Copyright(C) 2016-2017 ddtddt               http://temmii.com/piwigo/ | 
    66// +-----------------------------------------------------------------------+ 
    77// | This program is free software; you can redistribute it and/or modify  | 
  • extensions/user_custom_fields/initregister.php

    r31541 r31841  
    33// | User Custom Fields plugin for Piwigo                                  | 
    44// +-----------------------------------------------------------------------+ 
    5 // | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ | 
     5// | Copyright(C) 2016-2017 ddtddt               http://temmii.com/piwigo/ | 
    66// +-----------------------------------------------------------------------+ 
    77// | This program is free software; you can redistribute it and/or modify  | 
  • extensions/user_custom_fields/language/en_UK/plugin.lang.php

    r31783 r31841  
    33// | User Custom Fields plugin for Piwigo                                  | 
    44// +-----------------------------------------------------------------------+ 
    5 // | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ | 
     5// | Copyright(C) 2016-2017 ddtddt               http://temmii.com/piwigo/ | 
    66// +-----------------------------------------------------------------------+ 
    77// | This program is free software; you can redistribute it and/or modify  | 
     
    2525$lang['Custom fields delete'] = 'Custom fields delete'; 
    2626$lang['Data custom fields update'] = 'Data custom fields update'; 
    27 $lang['Manage custom fields'] = 'Manage custom fields'; 
    28 $lang['Create new custom fields'] = 'Create new custom fields'; 
    29 $lang['Edit custom fields'] = 'Edit custom fields'; 
     27$lang['Manage custom filds'] = 'Manage custom filds'; 
     28$lang['Create new custom filds'] = 'Create new custom filds'; 
     29$lang['Edit custom filds'] = 'Edit custom filds'; 
    3030$lang['Wording'] = 'Wording'; 
    3131$lang['Admin only'] = 'Admin only'; 
     
    3333$lang['Fields List'] = 'Fields List'; 
    3434 
     35/*data user add info*/ 
     36$lang['Import infos since Add Info Users'] = 'Import infos since Add Info Users'; 
     37$lang['Import'] = 'Import'; 
     38$lang['Import is successful'] = 'Import is successful'; 
     39 
    3540?> 
  • extensions/user_custom_fields/language/fr_FR/plugin.lang.php

    r31783 r31841  
    33// | User Custom Fields plugin for Piwigo                                  | 
    44// +-----------------------------------------------------------------------+ 
    5 // | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ | 
     5// | Copyright(C) 2016-2017 ddtddt               http://temmii.com/piwigo/ | 
    66// +-----------------------------------------------------------------------+ 
    77// | This program is free software; you can redistribute it and/or modify  | 
     
    2525$lang['Custom fields delete'] = 'Champs utilisateur supprimée'; 
    2626$lang['Data custom fields update'] = 'Données des champs pour l\'utilisateur mises à jour'; 
    27 $lang['Manage user custom fields'] = 'Gérer Manage custom fields'; 
    28 $lang['Create new custom fields'] = 'Créer un nouveau champs personnalisé'; 
    29 $lang['Edit custom fields'] = 'Éditer champs personnalisé'; 
     27$lang['Manage user custom filds'] = 'Gérer Manage custom filds'; 
     28$lang['Create new custom filds'] = 'Créer un nouveau champs personnalisé'; 
     29$lang['Edit custom filds'] = 'Editer champs personnalisé'; 
    3030$lang['Wording'] = 'Libellé'; 
    3131$lang['Admin only'] = 'Seulement l\'administrateur'; 
     
    3333$lang['Fields List'] = 'Liste des Champs'; 
    3434 
     35/*data user add info*/ 
     36$lang['Import infos since Add Info Users'] = 'Importer les informations du plugin Add Info Users'; 
     37$lang['Import'] = 'Import'; 
     38$lang['Import is successful'] = 'L\'import est un succès'; 
     39 
    3540?> 
  • extensions/user_custom_fields/main.inc.php

    r31598 r31841  
    1212// | User Custom Fields plugin for Piwigo                                  | 
    1313// +-----------------------------------------------------------------------+ 
    14 // | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ | 
     14// | Copyright(C) 2016-2017 ddtddt               http://temmii.com/piwigo/ | 
    1515// +-----------------------------------------------------------------------+ 
    1616// | This program is free software; you can redistribute it and/or modify  | 
  • extensions/user_custom_fields/maintain.class.php

    r31534 r31841  
    33// | User Custom Fields plugin for Piwigo                                  | 
    44// +-----------------------------------------------------------------------+ 
    5 // | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ | 
     5// | Copyright(C) 2016-2017 ddtddt               http://temmii.com/piwigo/ | 
    66// +-----------------------------------------------------------------------+ 
    77// | This program is free software; you can redistribute it and/or modify  | 
Note: See TracChangeset for help on using the changeset viewer.