1<?php 2/* vim:set softtabstop=4 shiftwidth=4 expandtab: */ 3/** 4 * 5 * LICENSE: GNU Affero General Public License, version 3 (AGPL-3.0-or-later) 6 * Copyright 2001 - 2020 Ampache.org 7 * 8 * This program is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU Affero General Public License as published by 10 * the Free Software Foundation, either version 3 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU Affero General Public License for more details. 17 * 18 * You should have received a copy of the GNU Affero General Public License 19 * along with this program. If not, see <https://www.gnu.org/licenses/>. 20 * 21 */ 22 23// Because this is a reset of the persons password make the form a little more secure 24 25use Ampache\Config\AmpConfig; 26use Ampache\Repository\Model\User; 27use Ampache\Module\Authorization\Access; 28use Ampache\Module\System\AmpError; 29use Ampache\Module\System\Core; 30use Ampache\Module\Util\Ui; 31 32/** @var User $client */ 33 34$display_fields = (array) AmpConfig::get('registration_display_fields'); ?> 35<?php echo AmpError::display('general'); ?> 36<form method="post" name="preferences" action="<?php echo AmpConfig::get('web_path'); ?>/preferences.php?action=update_user" enctype="multipart/form-data"> 37 <table class="tabledata"> 38 <?php if (in_array('fullname', $display_fields)) { ?> 39 <tr> 40 <td><?php echo T_('Full Name'); ?>:</td> 41 <td><input type="text" name="fullname" id="fullname" value="<?php echo scrub_out($client->fullname); ?>" /></td> 42 </tr> 43 <?php 44} ?> 45 <tr> 46 <td><?php echo T_('E-mail'); ?>:</td> 47 <td><input type="text" name="email" id="email" value="<?php echo scrub_out($client->email); ?>" /></td> 48 </tr> 49 <?php if (in_array('website', $display_fields)) { ?> 50 <tr> 51 <td><?php echo T_('Website'); ?>:</td> 52 <td><input type="text" name="website" id="website" value="<?php echo scrub_out($client->website); ?>" /></td> 53 </tr> 54 <?php 55 } ?> 56 <?php if (in_array('state', $display_fields)) { ?> 57 <tr> 58 <td><?php echo T_('State'); ?>:</td> 59 <td><input type="text" name="state" id="state" value="<?php echo scrub_out($client->state); ?>" /></td> 60 </tr> 61 <?php 62 } ?> 63 <?php if (in_array('city', $display_fields)) { ?> 64 <tr> 65 <td><?php echo T_('City'); ?>:</td> 66 <td><input type="text" name="city" id="city" value="<?php echo scrub_out($client->city); ?>" /></td> 67 </tr> 68 <?php 69 } ?> 70 <tr> 71 <td><?php echo T_('New Password'); ?>:</td> 72 <td><?php echo AmpError::display('password'); ?><input type="password" name="password1" id="password1" /></td> 73 </tr> 74 <tr> 75 <td><?php echo T_('Confirm Password'); ?>:</td> 76 <td><input type="password" name="password2" id="password2" /></td> 77 </tr> 78 <tr> 79 <td><?php echo T_('Avatar'); ?> (< <?php echo Ui::format_bytes(AmpConfig::get('max_upload_size')); ?>)</td> 80 <td><input type="file" id="avatar" name="avatar" value="" /> 81 </tr> 82 <tr> 83 <td> 84 </td> 85 <td> 86 <?php 87 if ($client->f_avatar) { 88 echo $client->f_avatar; 89 } ?> 90 <a href="<?php echo AmpConfig::get('web_path'); ?>/admin/users.php?action=show_delete_avatar&user_id=<?php echo $client->id; ?>"><?php echo Ui::get_icon('delete', T_('Delete')); ?></a> 91 <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo AmpConfig::get('max_upload_size'); ?>" /></td> 92 </tr> 93 <tr> 94 <td> 95 <?php echo T_('API key'); ?> 96 <?php if (Access::check('interface', 100)) { ?> 97 <a href="<?php echo AmpConfig::get('web_path'); ?>/admin/users.php?action=show_generate_apikey&user_id=<?php echo $client->id; ?>"><?php echo Ui::get_icon('random', T_('Generate new API key')); ?></a> 98 <?php } ?> 99 </td> 100 <td> 101 <span> 102 <?php if ($client->apikey) { ?> 103 <br /> 104 <div style="background-color: #ffffff; border: 8px solid #ffffff; width: 128px; height: 128px;"> 105 <div id="apikey_qrcode"></div> 106 </div> 107 <br /> 108 <script>$('#apikey_qrcode').qrcode({width: 128, height: 128, text: '<?php echo $client->apikey; ?>', background: '#ffffff', foreground: '#000000'});</script> 109 <?php echo $client->apikey; ?> 110 <?php 111 } ?> 112 </span> 113 </td> 114 </tr> 115 <tr> 116 <td> 117 <?php echo T_('RSS Token'); ?> 118 <?php if (Access::check('interface', 100)) { ?> 119 <a href="<?php echo AmpConfig::get('web_path'); ?>/admin/users.php?action=show_generate_rsstoken&user_id=<?php echo $client->id; ?>"><?php echo Ui::get_icon('random', T_('Generate new RSS token')); ?></a> 120 <?php } ?> 121 </td> 122 <td> 123 <span> 124 <?php if ($client->rsstoken) { 125 echo $client->rsstoken; 126 } ?> 127 </span> 128 </td> 129 </tr> 130 <tr> 131 <td><?php echo T_('Clear Stats'); ?>:</td> 132 <td><input type="checkbox" name="clear_stats" value="1" /></td> 133 </tr> 134 </table> 135 <div class="formValidation"> 136 <input type="hidden" name="user_id" value="<?php echo scrub_out($client->id); ?>" /> 137 <?php echo Core::form_register('update_user'); ?> 138 <input type="hidden" name="tab" value="<?php echo scrub_out(Core::get_request('tab')); ?>" /> 139 <input class="button" type="submit" value="<?php echo T_('Update Account'); ?>" /> 140 </div> 141</form> 142