Example #1
0
</td></tr>
		<tr><td class="title" ><?php 
i18n('BACKUP_OF');
?>
:</td><td>
			<?php 
if (isset($id)) {
    echo '<a target="_blank" href="' . find_url($url, $parent) . '">' . find_url($url, $parent) . '</a>';
}
?>
		</td></tr>
		<tr><td class="title" ><?php 
i18n('DATE');
?>
:</td><td><?php 
echo output_datetime($pubDate);
?>
</td></tr>
		<tr><td class="title" ><?php 
i18n('TAG_KEYWORDS');
?>
:</td><td><em><?php 
echo $metak;
?>
</em></td></tr>
		<tr><td class="title" ><?php 
i18n('META_DESC');
?>
:</td><td><em><?php 
echo $metad;
?>
Example #2
0
function lngDate($dt = null)
{
    return output_datetime($dt);
}
Example #3
0
</a></li>
                    <?php 
    }
}
?>
                </ul>
            </div>
        </div>
            
    <?php 
if ($url != '') {
    ?>
        <p class="editfooter"><?php 
    if (!$newdraft && isset($pubDate)) {
        echo '<span><i class="fa fa-clock-o"></i>';
        echo sprintf($draft ? i18n_r('DRAFT_LAST_SAVED') : i18n_r('LAST_SAVED'), '<em>' . (empty($author) ? i18n_r('UNKNOWN') : $author . '</em>')) . ' ' . output_datetime($pubDate) . '</span>';
    }
    if ($draft && fileHasBackup(GSDATADRAFTSPATH . $url . '.xml')) {
        echo '<span>&bull;</span><a href="backup-edit.php?p=view&amp;draft&amp;id=' . $url . '" target="_blank" ><i class="fa fa-file-archive-o"></i>' . i18n_r('BACKUP_AVAILABLE') . '</a></span>';
    } else {
        if (!$draft && fileHasBackup(GSDATAPAGESPATH . $url . '.xml')) {
            echo '<span>&bull;</span><span><a href="backup-edit.php?p=view&amp;id=' . $url . '" target="_blank" ><i class="fa fa-file-archive-o"></i>' . i18n_r('BACKUP_AVAILABLE') . '</a></span>';
        }
    }
    ?>
</p>
    <?php 
}
?>
    </form>
    </div><!-- end main -->
?>

<?php 
echo $this->session->flashdata('message');
?>

<?php 
echo form_open('participation/reschedule_submit/' . $participation->id, array('class' => 'pure-form'));
?>

<?php 
echo form_fieldset(lang('reschedule'));
?>
<p>
<?php 
echo sprintf(lang('reschedule_info'), name($participant), $experiment->name, output_datetime($participation->appointment));
?>
</p>
<p>
<?php 
echo sprintf(lang('call_dates'), name($participant), $min_date, $max_date);
?>
</p>
<?php 
echo form_input('appointment', $appointment, 'id="appointment"');
?>

<?php 
echo form_submit_only();
echo form_cancel('participation/experiment/' . $experiment->id);
echo form_fieldset_close();
Example #5
0
                    }
                    //check if its an ip address
                    if (do_reg($d, $ip_regex)) {
                        if ($d == $_SERVER['REMOTE_ADDR']) {
                            $d = i18n_r('THIS_COMPUTER') . ' (<a href="' . $whois_url . $d . '" target="_blank" >' . $d . '</a>)';
                        } else {
                            $d = '<a href="' . $whois_url . $d . '" target="_blank" >' . $d . '</a>';
                        }
                    }
                    //check if its an email address
                    if (check_email_address($d)) {
                        $d = '<a href="mailto:' . $d . '">' . $d . '</a>';
                    }
                    //check if its a date
                    if ($n === 'date') {
                        $d = output_datetime($d);
                    }
                    // echo stripslashes($d);
                    echo $d;
                    echo ' <br />';
                }
                echo "</p></li>";
                $count++;
            }
        }
        ?>
			</ol>
			<?php 
    }
    ?>
			<?php 
/**
 * Get API Details
 *
 * Returns the contents of an API url request
 *
 * This is needed because of the "XmlHttpRequest error: Origin null is not allowed by Access-Control-Allow-Origin"
 * error that javascript gets when trying to access outside domains sometimes. 
 *
 * @since 3.1
 * @uses GSADMININCPATH
 * @uses GSCACHEPATH
 *
 * @param string $type, default is 'core'
 * @param array $args, default is empty
 * 
 * @returns string
 */
function get_api_details($type = 'core', $args = null)
{
    global $debugApi, $nocache, $nocurl;
    include GSADMININCPATH . 'configuration.php';
    # core api details
    if ($type == 'core') {
        # core version request, return status 0-outdated,1-current,2-bleedingedge
        $fetch_this_api = $api_url . '?v=' . GSVERSION;
    } else {
        if ($type == 'plugin' && $args) {
            # plugin api details. requires a passed plugin i
            $apiurl = $site_link_back_url . 'api/extend/?file=';
            $fetch_this_api = $apiurl . $args;
        } else {
            if ($type == 'custom' && $args) {
                # custom api details. requires a passed url
                $fetch_this_api = $args;
            } else {
                return;
            }
        }
    }
    // get_execution_time();
    debug_api_details("type: " . $type . " " . $args);
    debug_api_details("address: " . $fetch_this_api);
    # debug_api_details(debug_backtrace());
    if (!isset($api_timeout) or (int) $api_timeout < 100) {
        $api_timeout = 500;
    }
    // default and clamp min to 100ms
    debug_api_details("timeout: " . $api_timeout);
    # check to see if cache is available for this
    $cachefile = md5($fetch_this_api) . '.txt';
    $cacheExpire = 39600;
    // 11 minutes
    if (!$nocache) {
        debug_api_details('cache check for ' . $fetch_this_api . ' ' . $cachefile);
    } else {
        debug_api_details('cache check: disabled');
    }
    $cacheAge = file_exists(GSCACHEPATH . $cachefile) ? filemtime(GSCACHEPATH . $cachefile) : '';
    debug_api_details('cache age: ' . output_datetime($cacheAge));
    if (!$nocache && !empty($cacheAge) && time() - $cacheExpire < $cacheAge) {
        # grab the api request from the cache
        $data = read_file(GSCACHEPATH . $cachefile);
        debug_api_details('returning api cache ' . GSCACHEPATH . $cachefile);
    } else {
        # make the api call
        if (function_exists('curl_init') && function_exists('curl_exec') && !$nocurl) {
            // USE CURL
            $ch = curl_init();
            if (!$ch) {
                debug_api_details("curl init failed");
                return;
            }
            // define missing curlopts php<5.2.3
            if (!defined('CURLOPT_CONNECTTIMEOUT_MS')) {
                define('CURLOPT_CONNECTTIMEOUT_MS', 156);
            }
            if (!defined('CURLOPT_TIMEOUT_MS')) {
                define('CURLOPT_TIMEOUT_MS', 155);
            }
            // min cURL 7.16.2
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $api_timeout);
            // define the maximum amount of time that cURL can take to connect to the server
            curl_setopt($ch, CURLOPT_TIMEOUT_MS, $api_timeout);
            // define the maximum amount of time cURL can execute for.
            curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
            // prevents SIGALRM during dns allowing timeouts to work http://us2.php.net/manual/en/function.curl-setopt.php#104597
            curl_setopt($ch, CURLOPT_HEADER, false);
            // ensures header is not in output
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_URL, $fetch_this_api);
            if ($debugApi) {
                // $verbose = fopen(GSDATAOTHERPATH .'logs/curllog.txt', 'w+');
                $verbose = tmpfile();
                // curl_setopt($ch, CURLOPT_WRITEHEADER, $verbose );
                curl_setopt($ch, CURLOPT_HEADER, true);
                curl_setopt($ch, CURLOPT_VERBOSE, true);
                curl_setopt($ch, CURLOPT_STDERR, $verbose);
                curl_setopt($ch, CURLINFO_HEADER_OUT, true);
            }
            $data = curl_exec($ch);
            if ($debugApi) {
                debug_api_details("using curl");
                debug_api_details("curl version: ");
                debug_api_details(print_r(curl_version(), true));
                debug_api_details("curl info:");
                debug_api_details(print_r(curl_getinfo($ch), true));
                if (!$data) {
                    debug_api_details("curl error number:" . curl_errno($ch));
                    debug_api_details("curl error:" . curl_error($ch));
                }
                debug_api_details("curl Verbose: ");
                debug_api_details(!rewind($verbose) . nl2br(htmlspecialchars(stream_get_contents($verbose))));
                fclose($verbose);
                // output header and response then remove header from data
                $dataparts = explode("\r\n", $data);
                debug_api_details("curl Data: ");
                debug_api_details($data);
                $data = end($dataparts);
            }
            curl_close($ch);
        } else {
            if (ini_get('allow_url_fopen')) {
                // USE FOPEN
                debug_api_details("using fopen");
                $timeout = $api_timeout / 1000;
                // ms to float seconds
                // $context = stream_context_create();
                // stream_context_set_option ( $context, array('http' => array('timeout' => $timeout)) );
                $context = stream_context_create(array('http' => array('timeout' => $timeout)));
                $data = read_file($fetch_this_api, false, $context);
                debug_api_details("fopen data: " . $data);
            } else {
                debug_api_details("No api methods available");
                return;
            }
        }
        // debug_api_details("Duration: ".get_execution_time());
        $response = json_decode($data);
        debug_api_details('JSON:');
        debug_api_details(print_r($response, true), '');
        // if response is invalid set status to -1 error
        // and we pass on our own data, it is also cached to prevent constant rechecking
        if (!$response) {
            $data = '{"status":-1}';
        }
        debug_api_details($data);
        save_file(GSCACHEPATH . $cachefile, $data);
        return $data;
    }
    return $data;
}
echo output_date($participant->created);
?>
</td>
				</tr>
			</table>
		</div>
		<div class="pure-u-2-5">
			<?php 
if (!$participant->activated) {
    $reason = $participant->deactivated_reason;
    $new = $reason == DeactivateReason::NewParticipant;
    $class = $new ? 'warning' : 'info';
    echo '<div class="' . $class . '"';
    echo "<p>" . lang('p_not_yet_active') . "</p>";
    echo "<p>" . lang('reason') . br();
    echo lang('reason_' . $reason) . ' (' . output_datetime($participant->deactivated) . ")</p>";
    if ($new) {
        echo participant_activate_link($participant, lang('activate'));
    }
    echo "</div>";
}
?>
		</div>
	</div>

	<!-- Contact details -->
	<?php 
echo heading(lang('contact_details'), 3);
?>
	<div>
		<table class="pure-table">
 /** Reschedules a participation */
 public function reschedule($participation_id)
 {
     $participation = $this->participationModel->get_participation_by_id($participation_id);
     $participant = $this->participationModel->get_participant_by_participation($participation_id);
     $experiment = $this->participationModel->get_experiment_by_participation($participation_id);
     $data = get_min_max_days($participant, $experiment);
     $data['appointment'] = output_datetime($participation->appointment, TRUE);
     $data['participation'] = $participation;
     $data['participant'] = $participant;
     $data['experiment'] = $experiment;
     $this->load->view('templates/header', $data);
     $this->load->view('participation_reschedule', $data);
     $this->load->view('templates/footer');
 }
</th>
			<td><?php 
echo $participation->comment;
?>
</td>
		</tr>
		<?php 
if (!empty($participation->appointment)) {
    ?>
		<tr>
			<th><?php 
    echo lang('appointment');
    ?>
</th>
			<td><?php 
    echo output_datetime($participation->appointment);
    ?>
</td>
		</tr>
		<tr>
			<th><?php 
    echo lang('age');
    ?>
</th>
			<td><?php 
    echo age_in_months_and_days($participant->dateofbirth, $participation->appointment);
    ?>
			</td>
		</tr>
		<?php 
}
Example #10
0
    ?>
</a></li>
                        <?php 
}
?>
                    </ul>
                </div>
                
            </div>
            
            <?php 
if ($url != '') {
    ?>
                <p class="backuplink" ><?php 
    if (isset($pubDate)) {
        echo sprintf(i18n_r('LAST_SAVED'), '<em>' . $author . '</em>') . ' ' . output_datetime($pubDate) . '&nbsp;&nbsp; ';
    }
    if (file_exists($bakpagespath . $url . '.bak.xml')) {
        echo '&bull;&nbsp;&nbsp; <a href="backup-edit.php?p=view&amp;id=' . $url . '" target="_blank" >' . i18n_r('BACKUP_AVAILABLE') . '</a>';
    }
    ?>
</p>
            <?php 
}
?>
    </form>
    </div><!-- end main -->
    </div><!-- end maincontent -->
    
    <div id="sidebar" >
        <?php 
 /** Gets the availability dates in readable format */
 function availability_dates($availability)
 {
     return output_datetime($availability->from) . ' - ' . output_datetime($availability->to);
 }
 /** Gets the closing dates in readable format */
 function closing_dates($closing)
 {
     return output_datetime($closing->from) . ' - ' . output_datetime($closing->to);
 }
Example #13
0
</th><th style="text-align:right;" ><?php 
i18n('FILE_SIZE');
?>
</th><th></th></tr>
			</thead>
			<tbody>
			<?php 
$count = "0";
$path = tsl(GSBACKUPSPATH . 'zip/');
$filenames = getFiles($path);
natsort($filenames);
rsort($filenames);
foreach ($filenames as $file) {
    if ($file[0] != ".") {
        $timestamp = explode('_', $file);
        $name = output_datetime($timestamp[0]);
        clearstatcache();
        $ss = stat($path . $file);
        $size = fSize($ss['size']);
        if (!getdef('GSALLOWDOWNLOADS', true)) {
            $download_link = $name;
        } else {
            $download_link = '<a title="' . i18n_r('DOWNLOAD_ARCHIVES') . ' ' . $name . '" href="download.php?file=' . $path . $file . '&amp;nonce=' . get_nonce("archive", "download.php") . '">' . $name . '</a>';
        }
        echo '<tr>
								<td>' . $download_link . '</td>
								<td style="width:70px;text-align:right;" ><span>' . $size . '</span></td>
								<td class="delete" ><a class="delconfirm" title="' . i18n_r('DELETE_ARCHIVE') . ': ' . $name . '?" href="deletefile.php?zip=' . $file . '&amp;nonce=' . get_nonce("delete", "deletefile.php") . '">&times;</a></td>
							  </tr>';
        $count++;
    }