4 include_once(
'OFFLINE/Class.OfflineClientBuilder.php');
6 $action->parent->AddJsRef(
"OFFLINE/Layout/off_dlclient.js");
7 $action->parent->AddCssRef(
"CORE:welcome.css",
true);
8 $action->parent->AddCssRef(
"OFFLINE:off_dlclient.css",
true);
10 $action->lay->set(
"thisyear",strftime(
"%Y", time()));
11 $action->lay->set(
"userRealName",$action->user->firstname.
" ".$action->user->lastname);
15 $parms[
'os'] = getHttpVars(
'os',
'none');
16 $parms[
'arch'] = getHttpVars(
'arch',
'none');
18 $clientDir = $action->parent->getParam(
'OFFLINE_CLIENT_BUILD_OUTPUT_DIR',
'');
19 if( ! is_dir($clientDir) ) {
20 $action->ExitError(sprintf(
'OFFLINE_CLIENT_BUILD_OUTPUT_DIR: '._(
"OFFLINE:%s directory not found"), $clientDir));
23 $clientDir = realpath($clientDir);
26 $fext = $action->getLayoutFile(
"off_externals.xml");
27 $action->lay->set(
"HAVE_EXTERNALS",
false);
29 if (file_exists($fext)) {
31 foreach($fdata as $k=>$v) {
32 $action->lay->set(
"HAVE_EXTERNALS",
true);
33 $ds = explode(
"#", $v);
34 $trd[] = array(
"site"=>$ds[0],
"name"=>$ds[1],
"license"=>$ds[2]);
37 $action->lay->setBlockData(
"EXTERNALS", $trd);
42 if( $parms[
'os'] !=
'none' && $parms[
'arch'] !=
'none' ) {
43 return sendClient($action, $parms[
'os'], $parms[
'arch']);
50 $osArchList = $ocb->getOsArchList();
52 $action->lay->set(
"version",$ocb->getOfflineInfo(
'Version'));
53 $action->lay->set(
"buildid",$ocb->getOfflineInfo(
'BuildID'));
56 foreach( $osArchList as &$spec ) {
57 $file = sprintf(
'%s/%s', $clientDir, $spec[
'file']);
58 if( ! is_file($file) ) {
62 'DL_OS' => htmlspecialchars($spec[
'os']),
63 'DL_ARCH' => htmlspecialchars($spec[
'arch']),
64 'DL_TITLE' => htmlspecialchars($spec[
'title']),
65 'DL_ICON' => $spec[
'icon']
70 $action->lay->setBlockData(
'DL_LIST', $dl_list);
76 include_once(
'OFFLINE/Class.OfflineClientBuilder.php');
78 $clientDir = $action->parent->getParam(
'OFFLINE_CLIENT_BUILD_OUTPUT_DIR',
'');
79 if( ! is_dir($clientDir) ) {
80 $action->ExitError(sprintf(
'OFFLINE_CLIENT_BUILD_OUTPUT_DIR: '._(
"OFFLINE:%s directory not found"), $clientDir));
83 $clientDir = realpath($clientDir);
86 $osArchList = $ocb->getOsArchList();
89 foreach( $osArchList as &$spec ) {
90 if( $spec[
'os'] == $os && $spec[
'arch'] == $arch ) {
91 $filename = $spec[
'file'];
97 if( $filename !=
'' ) {
98 $sendFile = sprintf(
'%s/%s', $clientDir, $filename);
99 if( ! is_file($sendFile) ) {
100 $action->ExitError(sprintf(_(
"OFFLINE:File '%s' not found"), $sendFile));
103 $fileSize = filesize($sendFile);
104 $fh = fopen($sendFile,
'rb');
105 header(sprintf(
'Content-Type: application/binary'));
106 header(sprintf(
'Content-Length: %s', $fileSize));
107 header(sprintf(
'Content-Disposition: attachment; filename=%s', $filename));
112 $action->ExitError(sprintf(_(
"OFFLINE:File not found for '%s'"), sprintf(
"{os:'%s', arch:'%s'}", $os, $arch)));
sendClient(&$action, $os, $arch)