Example #1
0
-------------------------------------------------
License: AGPL
Author: Valérian Saliou
*/
// PHP base
define('JAPPIX_BASE', '..');
// We get the needed files
require_once './functions.php';
require_once './functions-get.php';
require_once './read-main.php';
require_once './read-hosts.php';
// Prepare application
enableErrorSink();
hideErrors();
// Get some parameters
$is_developer = isDeveloper();
$has_compression = hasCompression();
// Cache control (for development & production)
if ($is_developer) {
    header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
} else {
    if (hasCaching()) {
        $expires = 31536000;
        header('Cache-Control: maxage=' . $expires);
        header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT');
    }
}
// Initialize the vars
$type = '';
$file = '';
// Read the type var
function newUpdates($force)
{
    // No need to check if developer mode
    if (isDeveloper()) {
        return false;
    }
    $cache_path = JAPPIX_BASE . '/store/updates/version.xml';
    // No cache, obsolete one or refresh forced
    if (!file_exists($cache_path) || file_exists($cache_path) && time() - filemtime($cache_path) >= 86400 || $force) {
        // Get the content
        $last_version = read_url('http://codingteam.net/project/jappix/upload/briefcase/version.xml');
        // Write the content
        file_put_contents($cache_path, $last_version);
    } else {
        $last_version = file_get_contents($cache_path);
    }
    // Parse the XML
    $xml = @simplexml_load_string($last_version);
    // No data?
    if ($xml === FALSE) {
        return false;
    }
    // Get the version numbers
    $current_version = getVersion();
    $last_version = $xml->id;
    // Check if we have the latest version
    $current_version = versionNumber($current_version);
    $last_version = versionNumber($last_version);
    if ($current_version < $last_version) {
        return true;
    }
    return false;
}
Example #3
0
function hideErrors()
{
    // Hide errors if not developer
    if (!isDeveloper()) {
        ini_set('display_errors', 0);
        ini_set('error_reporting', E_WARNING);
    } else {
        ini_set('display_errors', 1);
        ini_set('error_reporting', E_ALL);
    }
    // Force timezone (avoids getting warnings on some PHP setups)
    date_default_timezone_set(@date_default_timezone_get());
}
                    } else {
                        if ($id == 7) {
                            ?>
				<h3 class="updates manager-images"><?php 
                            _e("Updates");
                            ?>
</h3>
				
				<p><?php 
                            _e("Update your Jappix node with this tool, or check if a new one is available. Informations about the latest version are also displayed (in english).");
                            ?>
</p>
				
				<?php 
                            // Using developer mode (no need to update)?
                            if (isDeveloper()) {
                                ?>
					<h4><?php 
                                _e("Check for updates");
                                ?>
</h4>
					
					<p class="info smallspace neutral"><?php 
                                printf(T_("You are using a development version of Jappix. Update it through our repository by executing: %s."), '<em>svn up</em>');
                                ?>
</p>
				<?php 
                            } else {
                                if (newUpdates($check_updates)) {
                                    // Get the update informations
                                    $update_infos = updateInformations();
Example #5
0
:<br>
			</td>
			<td>
				<?php 
echo $email . ' ' . helpIcon(MSG00237);
?>
			</td>
			<td style="font-weight:bold; text-align:right;">
				<?php 
echo MSG00215;
?>
:
			</td>
			<td>
				<?php 
if (isDeveloper($userid)) {
    echo $renewdate . ' ' . helpIcon(MSG00240);
} else {
    echo $renewdate . ' ' . helpIcon(MSG00241);
}
?>
			</td>
		</tr>
		<tr style="background-color:#000000;">
			<td colspan="4" style="color:yellow;font-size:12px;text-align:center; font-weight:normal;"><?php 
echo $profilemsg . ' ' . helpIcon(MSG00244);
?>
</td>
		</tr>
	</tbody>
</table>
Example #6
0
function compressThis()
{
    if (canCompress() && !isDeveloper()) {
        ob_start('ob_gzhandler');
    }
}
Example #7
0
function hideErrors()
{
    // Hide errors if not developer
    if (!isDeveloper()) {
        ini_set('display_errors', 0);
        ini_set('error_reporting', E_WARNING);
    } else {
        ini_set('display_errors', 1);
        ini_set('error_reporting', E_ALL);
    }
}
Example #8
0
function newUpdates($force)
{
    // No need to check if developer mode
    if (isDeveloper()) {
        return false;
    }
    $cache_path = JAPPIX_BASE . '/tmp/cache/version.xml';
    // No cache, obsolete one or refresh forced
    if (!file_exists($cache_path) || file_exists($cache_path) && time() - filemtime($cache_path) >= 86400 || $force) {
        // Get the content
        $last_version = readUrl('https://jappix.org/xml/version.xml');
        // Write the content
        file_put_contents($cache_path, $last_version, LOCK_EX);
    } else {
        // Read from cache
        $last_version = file_get_contents($cache_path);
    }
    // Parse the XML
    $xml = @simplexml_load_string($last_version);
    // No data?
    if ($xml === FALSE) {
        return false;
    }
    // Get the version numbers
    $current_version = getVersion();
    $last_version = $xml->id;
    // Check if we have the latest version
    $current_version = versionNumber($current_version);
    $last_version = versionNumber($last_version);
    if ($current_version < $last_version) {
        return true;
    }
    return false;
}
Example #9
0
function upgradeAccount($userid)
{
    if (isUser($userid)) {
        //if user is currently a User
        //set acc to demo
    } elseif (isDeveloper($userid)) {
        //if user is currently a Developer
        //set maxwebsites to 0
    }
}