$last_check = $version->_db_list[0]['last_version_check'] > '0000-00-00 00:00:00' ? $current_user->makeDate(PCPIN_Common::datetimeToTimestamp($version->_db_list[0]['last_version_check'])) : $l->g('never');
    $new_version_available = $version->_db_list[0]['new_version_available'];
    $new_version_url = $version->_db_list[0]['new_version_url'];
} else {
    $current_version = 6.0;
    $last_check = $l->g('never');
    $new_version_available = $current_version;
    $new_version_url = '';
}
$current_version = number_format($current_version, 2, '.', '');
$new_version_available = number_format($new_version_available, 2, '.', '');
if (!empty($do_check)) {
    // Check for new version
    // Generate new security key
    $key = PCPIN_Common::randomString(36, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-()[].,');
    $version->setVersionCheckKey($key);
    $session->_s_updateSession($session->_s_id, true, true, null, null, null, md5($key));
    header('Location: ' . PCPIN_VERSIONCHECKER_URL . '?' . htmlspecialchars($key));
    die;
}
// Initialize template handler
_pcpin_loadClass('pcpintpl');
$tpl = new PcpinTpl();
$tpl->setBasedir('./tpl');
$tpl->readTemplatesFromFile('./admin/versions.tpl');
// Add global vars to template
foreach ($global_tpl_vars as $key => $val) {
    $tpl->addGlobalVar($key, htmlspecialchars($val));
}
// Add language expressions to template
foreach ($tpl->tpl_vars_plain as $var) {
예제 #2
0
        $current_version = 6.0;
        $last_check = $l->g('never');
        $new_version_available = $current_version;
        $new_version_url = '';
        $version_check_key = PCPIN_Common::randomString(mt_rand(10, 20));
    }
    $version->_db_freeList();
    // Check security key
    if (!empty($version_check_key) && md5($sk) == $version_check_key) {
        if ($session->_db_getList('_s_id', '_s_security_code = ' . $version_check_key, 1)) {
            // Security key check passed
            $old_session = $session->_db_list[0]['_s_id'];
            // Save version number
            $version->setLastVersionCheckTime();
            $version->setNewestAvailableVersion($nv);
            $version->setVersionCheckKey();
            $version->setNewVersionDownloadUrl(base64_decode($dl));
            $session->_s_updateSession($old_session, false, true, null, null, null, '');
            header('Location: ' . PCPIN_ADMIN_FORMLINK . '?s_id=' . $old_session . '&ainc=versions&version_checked');
            die;
        }
    }
}
if (!empty($b_id)) {
    // Binary file requested
    require_once './inc/get_binary.inc.php';
    die;
} elseif (!empty($ajax)) {
    // AJAX request
    require_once './inc/ajax/_main.inc.php';
    die;