Exemple #1
0
}
$dbconn = dbauth::connect('directory', null, $_SERVER['REMOTE_USER']) or die("Could not connect: " . pg_last_error());
pg_query($dbconn, "begin");
$personid = isset($_GET['person_id']) ? $_GET['person_id'] : null;
// the order by is used to get the non-NULL ones pushed to the top , tho now
// there should be only one row
$query = "\n\tselect  p.person_id,\n\t\tcoalesce(p.preferred_first_name, p.first_name) as first_name,\n\t\tcoalesce(p.preferred_last_name, p.last_name) as last_name,\n\t\tcoalesce(pc.nickname, p.nickname) as nickname,\n\t\tpc.position_title,\n\t\tpc.person_company_relation,\n\t\tdate_part('month', p.birth_date) as birth_date_month,\n\t\tdate_part('day', p.birth_date) as birth_date_day,\n\t\tdate_part('epoch', p.birth_date) as birth_date_epoch,\n\t\tpc.hire_date,\n\t\tc.company_name,\n\t\tc.company_id,\n\t\tpi.person_image_id,\n\t\tpc.manager_person_id,\n\t\tcoalesce(mgrp.preferred_first_name, mgrp.first_name) as mgr_first_name,\n\t\tcoalesce(mgrp.preferred_last_name, mgrp.last_name) as mgr_last_name,\n\t\tac.account_collection_id,\n\t\tac.account_collection_name,\n\t\ta.login,\n\t\tnumreports.tally as num_reports,\n\t\tofc.display_label,\n\t\tofc.building,\n\t\tofc.floor,\n\t\tofc.section,\n\t\tofc.seat_number\n\t   from person p\n\t   \tinner join (\n\t\t\tselect * from person_company\n\t\t\twhere hire_date is null or hire_date <= now()\n\t\t) pc using (person_id)\n\t\tinner join company c using (company_id)\n\t\tinner join v_corp_family_account a\n\t\t\ton p.person_id = a.person_id\n\t\t\tand pc.company_id = a.company_id\n\t\t\tand a.account_role = 'primary'\n\t\tleft join ( select ac.*, account_id\n\t\t\t\t\tFROM account_collection ac\n\t\t\t\t\t\tINNER JOIN account_collection_account\n\t\t\t\t\t\tUSING (account_collection_id)\n\t\t\t\t\tWHERE account_collection_type = 'department'\n\t\t) ac USING (account_id)\n\t\tleft join (     \n        \tselect  pi.*, piu.person_image_usage\n       \t\t  from\tperson_image pi\n        \t\t\tinner join person_image_usage piu\n        \t\t\t\ton pi.person_image_id = piu.person_image_id\n        \t\t\t\tand piu.person_image_usage = 'corpdirectory'\n        \t) pi on p.person_id = pi.person_id\n\t\tleft join person mgrp\n\t\t\ton pc.manager_person_id = mgrp.person_id\n\t\tleft join ( -- this probably needs to be smarter\n\t\t\t   select manager_person_id as person_id, count(*)  as tally\n\t\t\t     from person_company\n\t\t\t     where person_company_status = 'enabled'\n\t\t\t     group by manager_person_id\n\t\t) numreports on p.person_id = numreports.person_id\n\t\tleft join (\n\t\t\tselect\tpl.person_id, \n\t\t\t\tpa.display_label,\n\t\t\t\tpl.building,\n\t\t\t\tpl.floor,\n\t\t\t\tpl.section,\n\t\t\t\tpl.seat_number\n\t\t\tfrom   person_location pl\n\t\t\t\tinner join physical_address pa\n\t\t\t\t\tUSING (physical_address_id)\n\t\t\twhere   pl.person_location_type = 'office'\n\t\t\torder by site_rank\n\t\t) ofc on ofc.person_id = p.person_id\n\twhere p.person_id = \$1\n\torder by ac.account_collection_name\n";
$result = pg_query_params($dbconn, $query, array($personid)) or die('Query failed: ' . pg_last_error());
$row = pg_fetch_array($result, null, PGSQL_ASSOC) or die("no person");
$name = $row['first_name'] . " " . $row['last_name'];
header('Content-Type: text/vcard');
header("Content-disposition: inline; filename=\"vcard-{$name}.vcf\"");
$email = get_email($dbconn, $row['person_id']);
if (isset($email) || isset($row['login'])) {
    if ($email == null) {
        $email = $row['login'] . "@" . get_default_domain($dbconn);
    }
}
$fn = $row['first_name'];
$sn = $row['last_name'];
$title = $row['position_title'];
echo "BEGIN:VCARD\n";
echo "VERSION:3.0\n";
echo "N:{$sn};{$fn};\n";
echo "FN:{$name}\n";
echo "TITLE:{$title}\n";
// echo "PHOTO;VALUE=URL;TYPE=GIF:http://www.example.com/dir_photos/my_photo.gif\n";
$q = "\n\tselect\tpc.person_contact_id,\n\t\t\tvcc.dial_country_code,\n\t\t\tpc.phone_number,\n\t\t\tpc.phone_extension,\n\t\t\tpc.person_contact_type,\n\t\t\tpc.person_contact_technology,\n\t\t\tpc.person_contact_location_type,\n\t\t\tpc.person_contact_privacy\n\tfrom\tperson_contact pc\n\t\t\tinner join val_country_code vcc\n\t\t\t\tusing(iso_country_code)\n\t\t\tinner join val_person_contact_loc_type vpclt\n\t\t\t\tusing (person_contact_location_type)\n\t\t\tinner join val_person_contact_technology vpct\n\t\t\t\tusing (person_contact_technology)\n\twhere\tperson_id = \$1\n\tand\tpc.person_contact_type = 'phone'\n\tand\tperson_contact_privacy != 'HIDDEN'\n\tand person_contact_technology in ('phone', 'mobile', 'fax')\n\torder by person_contact_order\n";
$args = array($personid);
$r = pg_query_params($dbconn, $q, $args) or die('Query failed: ' . pg_last_error());
while ($pc = pg_fetch_array($r, null, PGSQL_ASSOC)) {
Exemple #2
0
		<?php 
if (isset(pb_backupbuddy::$options['dat_file']['is_multisite']) && (pb_backupbuddy::$options['dat_file']['is_multisite'] === true || pb_backupbuddy::$options['dat_file']['is_multisite'] == 'true')) {
    // multisite
    ?>
			<br><br>Note: This URL above will also be the new Multisite Network URL.
			<br><br>
			<label>
				MultiSite Domain
				<?php 
    pb_backupbuddy::tip('This is the MultiSite main domain. Ex: foo.com. WARNING: Changing this may result in URL problems. Use caution.', '', true);
    ?>
<br>
				<br><br>&nbsp;
			</label>
			<input type="text" name="domain" value="<?php 
    echo get_default_domain();
    ?>
" size="40" /><br>
			&nbsp;<span class="light" style="display: inline-block; width: 400px;">previously: <?php 
    echo pb_backupbuddy::$options['dat_file']['domain'];
    ?>
</span>
			<br><br>
		<?php 
} else {
    ?>
		
		<label style="width: 420px; margin-left: 200px;">
			<input type="checkbox" name="custom_home" class="option_toggle" value="on" id="custom_home">
			Use optional custom site address (Home URL)?
			<?php 
Exemple #3
0
				restoring / migrating to reside. Ex: http://foo.com/wp', '', true ); ?>
			<br>
			<span class="light">(Site URL)</span>
			<br><br>&nbsp;
		</label>
		<input type="text" name="siteurl" value="<?php echo $default_url; ?>" size="40" /><br>
		&nbsp;<span class="light" style="display: inline-block; width: 200px;">previously: <?php echo pb_backupbuddy::$options['dat_file']['siteurl']; ?></span>
		
		<?php if ( isset( pb_backupbuddy::$options['dat_file']['is_multisite'] ) && ( ( pb_backupbuddy::$options['dat_file']['is_multisite'] === true ) || ( pb_backupbuddy::$options['dat_file']['is_multisite'] == 'true' ) ) ) { // multisite ?>
			<br><br>
			<label>
				MultiSite Domain
				<?php pb_backupbuddy::tip( 'This is the MultiSite main domain. Ex: foo.com', '', true ); ?><br>
				<br><br>&nbsp;
			</label>
			<input type="text" name="domain" value="<?php echo get_default_domain(); ?>" size="40" /><br>
			&nbsp;<span class="light" style="display: inline-block; width: 400px;">previously: <?php echo pb_backupbuddy::$options['dat_file']['domain']; ?></span>
			<br><br>
		<?php } else { ?>
		
		<label style="width: 420px; margin-left: 200px;">
			<input type="checkbox" name="custom_home" class="option_toggle" value="on" id="custom_home">
			Use optional custom site address (Home URL)?
			<?php pb_backupbuddy::tip( $custom_home_tip, '', true ); ?>
		</label>
		<br><br>
		
		<div class="custom_home_toggle" style="display: none;">
			<label>
				Site Address
				<?php pb_backupbuddy::tip( $custom_home_tip, '', true ); ?>