kopia lustrzana https://github.com/magicbug/Cloudlog
				
				
				
			Implement profile pic for hamqth
							rodzic
							
								
									79f4657c82
								
							
						
					
					
						commit
						8459f31422
					
				| 
						 | 
				
			
			@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
 | 
			
		|||
| be upgraded / downgraded to.
 | 
			
		||||
|
 | 
			
		||||
*/
 | 
			
		||||
$config['migration_version'] = 92;
 | 
			
		||||
$config['migration_version'] = 93;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
|--------------------------------------------------------------------------
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -153,7 +153,7 @@ class Logbook extends CI_Controller {
 | 
			
		|||
			$return['callsign_us_county'] = $this->logbook_model->call_us_county($callsign);
 | 
			
		||||
			$return['bearing'] = $this->bearing($return['callsign_qra'], $measurement_base, $station_id);
 | 
			
		||||
			$return['workedBefore'] = $this->worked_grid_before($return['callsign_qra'], $type, $band, $mode);
 | 
			
		||||
			if ($this->session->userdata('user_show_qrz_image')) {
 | 
			
		||||
			if ($this->session->userdata('user_show_profile_image')) {
 | 
			
		||||
				if (isset($callbook)) {
 | 
			
		||||
					if ($callbook['image'] == "") {
 | 
			
		||||
						$return['image'] = "n/a";
 | 
			
		||||
| 
						 | 
				
			
			@ -181,7 +181,7 @@ class Logbook extends CI_Controller {
 | 
			
		|||
			$return['callsign_iota'] = $callbook['iota'];
 | 
			
		||||
			$return['callsign_state'] = $callbook['state'];
 | 
			
		||||
			$return['callsign_us_county'] = $callbook['us_county'];
 | 
			
		||||
			if ($this->session->userdata('user_show_qrz_image')) {
 | 
			
		||||
			if ($this->session->userdata('user_show_profile_image')) {
 | 
			
		||||
				if ($callbook['image'] == "") {
 | 
			
		||||
					$return['image'] = "n/a";
 | 
			
		||||
				} else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -74,7 +74,7 @@ class User extends CI_Controller {
 | 
			
		|||
				$data['user_column3'] = $this->input->post('user_column3');
 | 
			
		||||
				$data['user_column4'] = $this->input->post('user_column4');
 | 
			
		||||
				$data['user_column5'] = $this->input->post('user_column5');
 | 
			
		||||
				$data['user_show_qrz_image'] = $this->input->post('user_show_qrz_image');
 | 
			
		||||
				$data['user_show_profile_image'] = $this->input->post('user_show_profile_image');
 | 
			
		||||
				$this->load->view('user/add', $data);
 | 
			
		||||
			} else {
 | 
			
		||||
				$this->load->view('user/add', $data);
 | 
			
		||||
| 
						 | 
				
			
			@ -102,7 +102,7 @@ class User extends CI_Controller {
 | 
			
		|||
				$this->input->post('user_column3'),
 | 
			
		||||
				$this->input->post('user_column4'),
 | 
			
		||||
				$this->input->post('user_column5'),
 | 
			
		||||
				$this->input->post('user_show_qrz_image'))) {
 | 
			
		||||
				$this->input->post('user_show_profile_image'))) {
 | 
			
		||||
				// Check for errors
 | 
			
		||||
				case EUSERNAMEEXISTS:
 | 
			
		||||
					$data['username_error'] = 'Username <b>'.$this->input->post('user_name').'</b> already in use!';
 | 
			
		||||
| 
						 | 
				
			
			@ -139,7 +139,7 @@ class User extends CI_Controller {
 | 
			
		|||
			$data['user_column3'] = $this->input->post('user_column3');
 | 
			
		||||
			$data['user_column4'] = $this->input->post('user_column4');
 | 
			
		||||
			$data['user_column5'] = $this->input->post('user_column5');
 | 
			
		||||
			$data['user_show_qrz_image'] = $this->input->post('user_show_qrz_image');
 | 
			
		||||
			$data['user_show_profile_image'] = $this->input->post('user_show_profile_image');
 | 
			
		||||
			$this->load->view('user/add', $data);
 | 
			
		||||
			$this->load->view('interface_assets/footer');
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -311,10 +311,10 @@ class User extends CI_Controller {
 | 
			
		|||
				$data['user_show_notes'] = $q->user_show_notes;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if($this->input->post('user_show_qrz_image')) {
 | 
			
		||||
				$data['user_show_qrz_image'] = $this->input->post('user_show_qrz_image', false);
 | 
			
		||||
			if($this->input->post('user_show_profile_image')) {
 | 
			
		||||
				$data['user_show_profile_image'] = $this->input->post('user_show_profile_image', false);
 | 
			
		||||
			} else {
 | 
			
		||||
				$data['user_show_qrz_image'] = $q->user_show_qrz_image;
 | 
			
		||||
				$data['user_show_profile_image'] = $q->user_show_profile_image;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if($this->input->post('user_column1')) {
 | 
			
		||||
| 
						 | 
				
			
			@ -396,7 +396,7 @@ class User extends CI_Controller {
 | 
			
		|||
			$data['user_column4'] = $this->input->post('user_column4');
 | 
			
		||||
			$data['user_column4'] = $this->input->post('user_column4');
 | 
			
		||||
			$data['user_column5'] = $this->input->post('user_column5');
 | 
			
		||||
			$data['user_show_qrz_image'] = $this->input->post('user_show_qrz_image');
 | 
			
		||||
			$data['user_show_profile_image'] = $this->input->post('user_show_profile_image');
 | 
			
		||||
			$this->load->view('user/edit');
 | 
			
		||||
			$this->load->view('interface_assets/footer');
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
 | 
			
		|||
$lang['qso_title_qso_map'] = 'QSO Map';
 | 
			
		||||
$lang['qso_title_suggestions'] = 'Suggestions';
 | 
			
		||||
$lang['qso_title_pervious_contacts'] = 'Previous Contacts';
 | 
			
		||||
$lang['qso_title_image'] = 'Profile Picture from qrz.com';
 | 
			
		||||
$lang['qso_title_image'] = 'Profile Picture';
 | 
			
		||||
 | 
			
		||||
// Input Help Text on the /QSO Display
 | 
			
		||||
$lang['qso_transmit_power_helptext'] = 'Give power value in Watts. Include only numbers in the input.';
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ defined('BASEPATH') OR exit('Direkter Zugriff auf Skripte ist nicht erlaubt');
 | 
			
		|||
$lang['qso_title_qso_map'] = 'QSO-Karte';
 | 
			
		||||
$lang['qso_title_suggestions'] = 'Vorschläge';
 | 
			
		||||
$lang['qso_title_pervious_contacts'] = 'Vorherige Kontakte';
 | 
			
		||||
$lang['qso_title_image'] = 'Profilbild von qrz.com';
 | 
			
		||||
$lang['qso_title_image'] = 'Profilbild';
 | 
			
		||||
 | 
			
		||||
// Input Help Text on the /QSO Display
 | 
			
		||||
$lang['qso_transmit_power_helptext'] = 'Gib die Ausgangsleistung in Watt an. Erfasse nur Zahlen bei der Eingabe.';
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -81,6 +81,7 @@ class Hamqth {
 | 
			
		|||
            $data['lat'] = (string)$xml->search->latitude;
 | 
			
		||||
            $data['long'] = (string)$xml->search->longitude;
 | 
			
		||||
            $data['iota'] = (string)$xml->search->iota;
 | 
			
		||||
            $data['image'] = (string)$xml->search->picture;
 | 
			
		||||
            $data['us_state'] = (string)$xml->search->us_state;
 | 
			
		||||
            $data['us_county'] = (string)$xml->search->us_county;
 | 
			
		||||
            $data['error'] = (string)$xml->session->error;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,34 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
defined('BASEPATH') OR exit('No direct script access allowed');
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class Migration_rename_profile_images
 | 
			
		||||
 *
 | 
			
		||||
 * Renames the qrz profile images column to also make it
 | 
			
		||||
 * suitable for hamqth.com
 | 
			
		||||
 * 
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
class Migration_rename_profile_images extends CI_Migration {
 | 
			
		||||
 | 
			
		||||
        public function up()
 | 
			
		||||
        {
 | 
			
		||||
                if ($this->db->field_exists('user_show_qrz_image', 'users')) {
 | 
			
		||||
                        $fields = array(
 | 
			
		||||
                                'user_show_qrz_image' => [ 'name' => 'user_show_profile_image', 'type' => ' BOOLEAN DEFAULT FALSE', ]
 | 
			
		||||
                        );
 | 
			
		||||
                        $this->dbforge->modify_column('users', $fields);
 | 
			
		||||
                }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public function down()
 | 
			
		||||
        {
 | 
			
		||||
                if ($this->db->field_exists('user_show_profile_image', 'users')) {
 | 
			
		||||
                        $fields = array(
 | 
			
		||||
                                'user_show_profile_image' => [ 'name' => 'user_show_qrz_image', 'type' => ' BOOLEAN DEFAULT FALSE', ]
 | 
			
		||||
                        );
 | 
			
		||||
                        $this->dbforge->modify_column('users', $fields);
 | 
			
		||||
                }
 | 
			
		||||
        }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -113,7 +113,7 @@ class User_Model extends CI_Model {
 | 
			
		|||
	// Add a user
 | 
			
		||||
	function add($username, $password, $email, $type, $firstname, $lastname, $callsign, $locator, $timezone,
 | 
			
		||||
				 $measurement, $user_date_format, $user_stylesheet, $user_sota_lookup, $user_show_notes,
 | 
			
		||||
				 $user_column1, $user_column2, $user_column3, $user_column4, $user_column5, $user_show_qrz_image) {
 | 
			
		||||
				 $user_column1, $user_column2, $user_column3, $user_column4, $user_column5, $user_show_profile_image) {
 | 
			
		||||
		// Check that the user isn't already used
 | 
			
		||||
		if(!$this->exists($username)) {
 | 
			
		||||
			$data = array(
 | 
			
		||||
| 
						 | 
				
			
			@ -136,7 +136,7 @@ class User_Model extends CI_Model {
 | 
			
		|||
				'user_column3' => xss_clean($user_column3),
 | 
			
		||||
				'user_column4' => xss_clean($user_column4),
 | 
			
		||||
				'user_column5' => xss_clean($user_column5),
 | 
			
		||||
				'user_show_qrz_image' => xss_clean($user_show_qrz_image),
 | 
			
		||||
				'user_show_profile_image' => xss_clean($user_show_profile_image),
 | 
			
		||||
			);
 | 
			
		||||
 | 
			
		||||
			// Check the password is valid
 | 
			
		||||
| 
						 | 
				
			
			@ -185,7 +185,7 @@ class User_Model extends CI_Model {
 | 
			
		|||
					'user_column3' => xss_clean($fields['user_column3']),
 | 
			
		||||
					'user_column4' => xss_clean($fields['user_column4']),
 | 
			
		||||
					'user_column5' => xss_clean($fields['user_column5']),
 | 
			
		||||
					'user_show_qrz_image' => xss_clean($fields['user_show_qrz_image']),
 | 
			
		||||
					'user_show_profile_image' => xss_clean($fields['user_show_profile_image']),
 | 
			
		||||
				);
 | 
			
		||||
 | 
			
		||||
				// Check to see if the user is allowed to change user levels
 | 
			
		||||
| 
						 | 
				
			
			@ -295,7 +295,7 @@ class User_Model extends CI_Model {
 | 
			
		|||
			'user_stylesheet' => $u->row()->user_stylesheet,
 | 
			
		||||
			'user_sota_lookup' => isset($u->row()->user_sota_lookup) ? $u->row()->user_sota_lookup : 0,
 | 
			
		||||
			'user_show_notes' => isset($u->row()->user_show_notes) ? $u->row()->user_show_notes : 1,
 | 
			
		||||
			'user_show_qrz_image' => isset($u->row()->user_show_qrz_image) ? $u->row()->user_show_qrz_image : 0,
 | 
			
		||||
			'user_show_profile_image' => isset($u->row()->user_show_profile_image) ? $u->row()->user_show_profile_image : 0,
 | 
			
		||||
			'user_column1' => isset($u->row()->user_column1) ? $u->row()->user_column1: 'Mode',
 | 
			
		||||
			'user_column2' => isset($u->row()->user_column2) ? $u->row()->user_column2: 'RSTS',
 | 
			
		||||
			'user_column3' => isset($u->row()->user_column3) ? $u->row()->user_column3: 'RSTR',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -521,7 +521,7 @@
 | 
			
		|||
        <div class="card-body callsign-suggestions"></div>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <?php if ($this->session->userdata('user_show_qrz_image')) { ?>
 | 
			
		||||
    <?php if ($this->session->userdata('user_show_profile_image')) { ?>
 | 
			
		||||
    <div class="card callsign-image" id="callsign-image" style="display: none;">
 | 
			
		||||
        <div class="card-header"><h4 style="font-size: 16px; font-weight: bold;" class="card-title"><?php echo $this->lang->line('qso_title_image'); ?></h4></div>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -228,12 +228,12 @@
 | 
			
		|||
		</div>
 | 
			
		||||
 | 
			
		||||
		<div class="form-group">
 | 
			
		||||
			<label for="showqrzimages">Show profile picture of QSO partner from qrz.com profile in the log QSO section.</label>
 | 
			
		||||
			<select class="custom-select" id="showqrzimages" name="user_show_qrz_image">
 | 
			
		||||
			<label for="profileimages">Show profile picture of QSO partner from qrz.com/hamqth.com profile in the log QSO section.</label>
 | 
			
		||||
			<select class="custom-select" id="profileimages" name="user_show_profile_image">
 | 
			
		||||
				<option value="0"><?php echo $this->lang->line('general_word_no'); ?></option>
 | 
			
		||||
				<option value="1"><?php echo $this->lang->line('general_word_yes'); ?></option>
 | 
			
		||||
			</select>
 | 
			
		||||
			<div class="small form-text text-muted">Please set your qrz.com credentials in the general config file.</div></td>
 | 
			
		||||
			<div class="small form-text text-muted">Please set your qrz.com/hamqth.com credentials in the general config file.</div></td>
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
		<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -420,16 +420,16 @@
 | 
			
		|||
			<div class="col-md">
 | 
			
		||||
				<div class="card">
 | 
			
		||||
					<div class="card-header">
 | 
			
		||||
						qrz.com Images
 | 
			
		||||
						qrz.com/hamqth.com Images
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="card-body">
 | 
			
		||||
						<div class="form-group">
 | 
			
		||||
							<label for="showqrzimages">Show profile picture of QSO partner from qrz.com profile in the log QSO section.</label>
 | 
			
		||||
							<select class="custom-select" id="showqrzimages" name="user_show_qrz_image">
 | 
			
		||||
								<option value="1" <?php if ($user_show_qrz_image == 1) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_yes'); ?></option>
 | 
			
		||||
								<option value="0" <?php if ($user_show_qrz_image == 0) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_no'); ?></option>
 | 
			
		||||
							<label for="profileimages">Show profile picture of QSO partner from qrz.com/hamqth.com profile in the log QSO section.</label>
 | 
			
		||||
							<select class="custom-select" id="profileimages" name="user_show_profile_image">
 | 
			
		||||
								<option value="1" <?php if ($user_show_profile_image == 1) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_yes'); ?></option>
 | 
			
		||||
								<option value="0" <?php if ($user_show_profile_image == 0) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_no'); ?></option>
 | 
			
		||||
							</select>
 | 
			
		||||
							<div class="small form-text text-muted">Please set your qrz.com credentials in the general config file.</div></td>
 | 
			
		||||
							<div class="small form-text text-muted">Please set your qrz.com/hamqth.com credentials in the general config file.</div></td>
 | 
			
		||||
						</div>
 | 
			
		||||
 | 
			
		||||
					</div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue