/**
  * Check if there is a new version of application available
  *
  * @param boolean $force When forced check will always construct the versions feed object
  *   try to fech the data and check for a new version. Version feed object is also returned
  * @return VersionFeed In case of error this function will return false
  */
 static function check($force = true)
 {
     $allow_url_fopen = strtolower(ini_get('allow_url_fopen'));
     if (function_exists('simplexml_load_file') && ($allow_url_fopen == '1' || $allow_url_fopen == 'on')) {
         // Execute once a day, if not forced check if we need to execute it now
         if (!$force) {
             if (config_option('upgrade_last_check_new_version', false)) {
                 return true;
                 // already have it checked and already have a new version
             }
             // if
             $last_check = config_option('upgrade_last_check_datetime');
             if ($last_check instanceof DateTimeValue && $last_check->getTimestamp() + 86400 > DateTimeValueLib::now()->getTimestamp()) {
                 return true;
                 // checked in the last day
             }
             // if
         }
         // if
         try {
             $versions_feed = new VersionsFeed();
             set_config_option('upgrade_last_check_datetime', DateTimeValueLib::now());
             set_config_option('upgrade_last_check_new_version', $versions_feed->hasNewVersions(product_version()));
             return $force ? $versions_feed : true;
         } catch (Exception $e) {
             return false;
         }
         // try
     } else {
         set_config_option('upgrade_check_enabled', false);
         return false;
     }
     // if
 }
Beispiel #2
0
function check_upgrade() {
	_log("Checking for upgrades...");
	$version_feed = VersionChecker::check(true);
	if (!($version_feed instanceof VersionsFeed)) {
		_log("Error checking for upgrades.");
	} else {
		if ($version_feed->hasNewVersions(product_version())) {
			_log("Found new versions.");
		} else {
			_log("No new versions.");
		}
	}
}
  </div>
  <input type="hidden" name="submited" value="submited" />
<?php 
}
?>
  <div id="forgotPasswordSubmit">
  <?php 
if (!isset($_GET['instructions_sent']) || !$_GET['instructions_sent']) {
    echo submit_button(lang('change password'));
}
?>
  	<span>(<a class="internalLink" href="<?php 
echo get_url('access', 'login');
?>
"><?php 
echo lang('login');
?>
</a>)</span>
  </div>
</div>
</form>


</div>
<div class="login-footer">
	<div class="powered-by">
		<?php 
echo lang('footer powered', clean(PRODUCT_URL), clean(product_name())) . ' - ' . lang('version') . ' ' . product_version();
?>
	</div>
</div>
 function auto_upgrade()
 {
     $this->setLayout("dialog");
     $version_number = array_var($_GET, 'version');
     if (!$version_number) {
         flash_error(lang('error upgrade version must be specified'));
         return;
     }
     $versions_feed = VersionChecker::check(true);
     $versions = $versions_feed->getNewVersions(product_version());
     if (count($versions) <= 0) {
         flash_error(lang('error upgrade version not found', $version_number));
         return;
     }
     $zipurl = null;
     foreach ($versions as $version) {
         if ($version->getVersionNumber() == $version_number) {
             $zipurl = $version->getDownloadLinkByFormat("zip")->getUrl();
             break;
         }
     }
     @set_time_limit(0);
     if (!$zipurl) {
         flash_error(lang('error upgrade invalid zip url', $version_number));
         return;
     }
     $zipname = "fengoffice_" . str_replace(" ", "_", $version_number) . ".zip";
     try {
         $in = fopen($zipurl, "r");
         $zippath = "tmp/" . $zipname;
         $out = fopen($zippath, "w");
         fwrite($out, stream_get_contents($in));
         fclose($out);
         fclose($in);
         $zip = zip_open($zippath);
         if (!is_resource($zip)) {
             flash_error("error upgrade cannot open zip file");
             return;
         }
         while ($zip_entry = zip_read($zip)) {
             $completePath = dirname(zip_entry_name($zip_entry));
             $completeName = zip_entry_name($zip_entry);
             $completePath = substr($completePath, strpos($completePath, "fengoffice") + strlen("fengoffice") + 1);
             $completeName = substr($completeName, strpos($completeName, "fengoffice") + strlen("fengoffice") + 1);
             @mkdir($completePath, 0777, true);
             if (zip_entry_open($zip, $zip_entry, "r")) {
                 if ($fd = @fopen($completeName, 'w')) {
                     fwrite($fd, zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)));
                     fclose($fd);
                 } else {
                     // Empty directory
                     @mkdir($completeName, 0777);
                 }
                 zip_entry_close($zip_entry);
             }
         }
         zip_close($zip);
     } catch (Error $ex) {
         flash_error($ex->getMessage());
         return;
     }
     $this->redirectToUrl("public/upgrade/index.php?upgrade_to=" . urlencode($version_number));
 }
Beispiel #5
0
</title>
	<?php 
echo link_tag(with_slash(ROOT_URL) . "favicon.ico", "rel", "shortcut icon");
?>
	<?php 
echo add_javascript_to_page("og/app.js");
?>
	<?php 
echo add_javascript_to_page(get_url("access", "get_javascript_translation"));
?>
	<?php 
//echo add_javascript_to_page(with_slash(ROOT_URL) . 'language/' . Localization::instance()->getLocale() . "/lang.js")
?>
	<?php 
echo meta_tag('content-type', 'text/html; charset=utf-8', true);
$version = product_version();
if (defined('COMPRESSED_CSS') && COMPRESSED_CSS) {
    echo stylesheet_tag("ogmin.css");
} else {
    echo stylesheet_tag('website.css');
}
$theme = config_option('theme', DEFAULT_THEME);
if (is_file(PUBLIC_FOLDER . "/assets/themes/{$theme}/stylesheets/custom.css")) {
    echo stylesheet_tag('custom.css');
}
$css = array();
Hook::fire('autoload_stylesheets', null, $css);
foreach ($css as $c) {
    echo stylesheet_tag($c);
}
if (defined('COMPRESSED_JS') && COMPRESSED_JS) {
Beispiel #6
0
<?php

// Set page title and set crumbs to index
set_page_title(lang('upgrade'));
administration_tabbed_navigation();
administration_crumbs(lang('upgrade'));
if (is_array($versions = $versions_feed->getNewVersions(product_version())) && count($versions)) {
    ?>
<div id="availableVersions">
<?php 
    foreach ($versions as $version) {
        ?>
  <div class="availableVerion">
    <h2><a href="<?php 
        echo $version->getDetailsUrl();
        ?>
"><?php 
        echo clean($version->getSignature());
        ?>
</a></h2>
    <div class="releaseNotes"><?php 
        echo do_textile($version->getReleaseNotes());
        ?>
</div>
<?php 
        $download_links = array();
        foreach ($version->getDownloadLinks() as $download_link) {
            $download_links[] = '<a href="' . $download_link->getUrl() . '">' . clean($download_link->getFormat()) . ' (' . format_filesize($download_link->getSize()) . ')</a>';
        }
        // foreach
        ?>
Beispiel #7
0
 /**
 * Returns product signature (name and version). If user is not logged in and
 * is not member of owner company he will see only product name
 *
 * @param void
 * @return string
 */
 function product_signature() {
   if (function_exists('logged_user') && (logged_user() instanceof User) && logged_user()->isMemberOfOwnerCompany()) {
     $result = lang('footer powered', 'http://www.projectpier.org/', clean(product_name()) . ' ' . product_version());
     if (Env::isDebugging()) {
       ob_start();
       benchmark_timer_display(false);
       $result .= '. ' . ob_get_clean();
       if (function_exists('memory_get_usage')) {
         $result .= '. ' . format_filesize(memory_get_usage());
       } // if
     } // if
     return $result;
   } else {
     return lang('footer powered', 'http://www.ProjectPier.org/', clean(product_name()));
   } // if
 } // product_signature
Beispiel #8
0
    		<td rowspan=2 colspan=3 class="loginContents" >
			<div style="padding:10px 0px 10px 6px;">
<?php if(!is_null(flash_get('success'))) { ?>
          <div id="success" onclick="this.style.display = 'none'"><?php echo clean(flash_get('success')) ?></div>
<?php } ?>
<?php if(!is_null(flash_get('error'))) { ?>
          <div id="error" onclick="this.style.display = 'none'"><?php echo clean(flash_get('error')) ?></div>
<?php } ?>
<?php echo $content_for_layout ?>
    		</div>

			</td>
    		<td rowspan=2 class="m5">&nbsp;</td>
    	</tr>
    	<tr style="">
    		<td class="m1">&nbsp;</td>
    	</tr>
    	<tr>
    		<td class="b1">&nbsp;</td>
    		<td class="b2">&nbsp;</td>
    		<td class="b3">&nbsp;</td>
    		<td class="b4">&nbsp;</td>
    		<td class="b5">&nbsp;</td>
    	</tr>
    </table>
    </div>
    <div class="powered-by">
    <?php echo lang('footer powered', 'http://www.fengoffice.com/', clean(product_name())) . ' - ' . lang('version') . ' ' . product_version();?>
    </div>
  </body>
</html>
Beispiel #9
0
/**
 * Returns product signature (name and version). If user is not logged in and
 * is not member of owner company he will see only product name
 *
 * @param void
 * @return string
 */
function product_signature()
{
    if (function_exists('logged_user') && logged_user() instanceof Contact) {
        $result = lang('footer powered', clean(PRODUCT_URL), clean(product_name()) . ' ' . product_version());
        if (Env::isDebugging()) {
            ob_start();
            benchmark_timer_display(false);
            $result .= '. ' . ob_get_clean();
            if (function_exists('memory_get_usage')) {
                $result .= '. ' . format_filesize(memory_get_usage());
            }
            // if
        }
        // if
        return $result;
    } else {
        return lang('footer powered', clean(PRODUCT_URL), clean(product_name()));
    }
    // if
}