Example #1
0
    // Sort to time order
    foreach ($sorted_files as $file) {
        $filename = basename($file);
        $type = preg_match('/^database/', $filename) ? 'database' : 'files';
        $restore = preg_match('/^database_full|files/', $filename) ? '?_g=maintenance&node=index&restore=' . $filename . '#backup' : false;
        $existing_backups[] = array('filename' => $filename, 'delete_link' => '?_g=maintenance&node=index&delete=' . $filename . '#backup', 'download_link' => '?_g=maintenance&node=index&download=' . $filename . '#backup', 'restore_link' => $restore, 'type' => $type, 'warning' => $type == 'database' ? $lang['maintain']['restore_db_confirm'] : $lang['maintain']['restore_files_confirm'], 'size' => formatBytes(filesize($file), true));
    }
}
$GLOBALS['smarty']->assign('EXISTING_BACKUPS', $existing_backups);
## Upgrade
## Check current version
if ($request = new Request('www.cubecart.com', '/version-check/' . '2.3.22')) {
    $request->skiplog(true);
    $request->setMethod('get');
    $request->cache(true);
    $request->setSSL(true);
    $request->setUserAgent('CubeCart');
    $request->setData(array('version' => CC_VERSION));
    if (($response = $request->send()) !== false) {
        if (version_compare(trim($response), CC_VERSION, '>')) {
            $GLOBALS['smarty']->assign('OUT_OF_DATE', sprintf($lang['dashboard']['error_version_update'], $response, CC_VERSION));
            $GLOBALS['smarty']->assign('LATEST_VERSION', $response);
            $GLOBALS['smarty']->assign('UPGRADE_NOW', $lang['maintain']['upgrade_now']);
            $GLOBALS['smarty']->assign('FORCE', '0');
        } else {
            $GLOBALS['smarty']->assign('LATEST_VERSION', CC_VERSION);
            $GLOBALS['smarty']->assign('UPGRADE_NOW', $lang['maintain']['force_upgrade']);
            $GLOBALS['smarty']->assign('FORCE', '1');
        }
    }
}
Example #2
0
                     } else {
                         $GLOBALS['main']->setACPNotify($lang['module']['backup_created']);
                     }
                 }
                 if ($extract) {
                     if ($source->extract(PCLZIP_OPT_PATH, $destination, PCLZIP_OPT_REPLACE_NEWER) == 0) {
                         $GLOBALS['main']->setACPWarning($lang['module']['failed_install']);
                     } else {
                         // Attempt email template install
                         if ($import_language) {
                             $GLOBALS['language']->importEmail($import_language);
                         }
                         $GLOBALS['main']->setACPNotify($lang['module']['success_install']);
                         $request = new Request($cc_domain, $cc_conf_path, 80, false, true, 10);
                         $request->setMethod('get');
                         $request->setSSL();
                         $request->setData(array('null' => 0));
                         $request->setUserAgent('CubeCart');
                         $request->skiplog(true);
                     }
                 }
             } else {
                 $GLOBALS['main']->setACPWarning(sprintf($lang['module']['read_fail'], $data['file_name']));
             }
         } else {
             $GLOBALS['main']->setACPWarning(sprintf($lang['module']['not_writable'], $destination));
         }
     } else {
         $GLOBALS['main']->setACPWarning(sprintf($lang['module']['not_exist'], $destination));
     }
 } else {