/**
  * Function making the update if a new version is available
  * 
  * @return json 
  */
 public function makeUpdate()
 {
     $r = array();
     $r['install'] = false;
     $update = new AutoUpdate();
     $update->setCurrentVersion($this->getCurrentVersion());
     $result = $update->update();
     //fait une simulation d'abord, si ok ça install
     if ($result === true) {
         //echo 'Update successful<br>';
         $r['install'] = true;
     } else {
         // si echec de la simulation d'install
         //echo 'Update failed: ' . $result . '!<br>';
         if ($result = AutoUpdate::ERROR_SIMULATE) {
             $r['information'] = '<pre>' . var_dump($update->getSimulationResults()) . '</pre>';
         }
     }
     return $this->sendResponse($r);
 }
Example #2
0
/register.php" rel="nohtml"><?php 
        echo T_('Register');
        ?>
</a>
                            <?php 
    }
    ?>
                        </span>
                    <?php 
}
?>
                    <span id="updateInfo">
                    <?php 
if (AmpConfig::get('autoupdate') && Access::check('interface', '100')) {
    if (AutoUpdate::is_update_available()) {
        AutoUpdate::show_new_version();
    }
}
$count_temp_playlist = count($GLOBALS['user']->playlist->get_items());
?>
                    </span>
                    <?php 
UI::show_box_bottom();
?>
                </div> <!-- End headerbox -->
            </div><!-- End header -->

        <?php 
if (AmpConfig::get('topmenu')) {
    ?>
            <div id="topmenu_container" class="topmenu_container-<?php 
Example #3
0
            Session::create_remember_cookie($username);
        }
    }
    // Update data from this auth if ours are empty
    if (empty($user->fullname) && !empty($auth['name'])) {
        $user->update_fullname($auth['name']);
    }
    if (empty($user->email) && !empty($auth['email'])) {
        $user->update_email($auth['email']);
    }
    if (empty($user->website) && !empty($auth['website'])) {
        $user->update_website($auth['website']);
    }
    $GLOBALS['user'] = $user;
    // If an admin, check for update
    if (AmpConfig::get('autoupdate') && Access::check('interface', '100')) {
        AutoUpdate::is_update_available(true);
    }
    /* Make sure they are actually trying to get to this site and don't try
     * to redirect them back into an admin section
     */
    $web_path = AmpConfig::get('web_path');
    if (substr($_POST['referrer'], 0, strlen($web_path)) == $web_path && strpos($_POST['referrer'], 'install.php') === false && strpos($_POST['referrer'], 'login.php') === false && strpos($_POST['referrer'], 'logout.php') === false && strpos($_POST['referrer'], 'update.php') === false && strpos($_POST['referrer'], 'activate.php') === false && strpos($_POST['referrer'], 'admin') === false) {
        header('Location: ' . $_POST['referrer']);
        exit;
    }
    // if we've got a referrer
    header('Location: ' . AmpConfig::get('web_path') . '/index.php');
    exit;
}
// auth success
Example #4
0
UI::show_header();
/* Switch on action boys */
switch ($_REQUEST['action']) {
    /* This re-generates the config file comparing
     * /config/ampache.cfg to .cfg.dist
     */
    case 'generate_config':
        ob_end_clean();
        $current = parse_ini_file(AmpConfig::get('prefix') . '/config/ampache.cfg.php');
        $final = generate_config($current);
        $browser = new Horde_Browser();
        $browser->downloadHeaders('ampache.cfg.php', 'text/plain', false, filesize(AmpConfig::get('prefix') . '/config/ampache.cfg.php.dist'));
        echo $final;
        exit;
    case 'reset_db_charset':
        Dba::reset_db_charset();
        show_confirmation(T_('Database Charset Updated'), T_('Your Database and associated tables have been updated to match your currently configured charset'), AmpConfig::get('web_path') . '/admin/system.php?action=show_debug');
        break;
    case 'show_debug':
        $configuration = AmpConfig::get_all();
        if ($_REQUEST['autoupdate'] == 'force') {
            $version = AutoUpdate::get_latest_version(true);
        }
        require_once AmpConfig::get('prefix') . '/templates/show_debug.inc.php';
        break;
    default:
        // Rien a faire
        break;
}
// end switch
UI::show_footer();
Example #5
0
 public static function makeUpdate($params)
 {
     //@tosee:
     //https://site.ru/local/dev/lp_b24_hosting/lp_b24_hosting.php?className=ShefAutoUpdate&functionName=makeUpdate&token=dekqkddeiorsojdoaixuiqcafwnhwudi&projectId=2
     $result = array();
     $update = new AutoUpdate(true);
     $update->currentVersion = iLPB24HOSTINGVER;
     $update->updateUrl = DEFAULT_UPDATE_SERVER;
     //Check for a new update
     $latest = $update->checkUpdate();
     if ($latest !== false) {
         if ($latest > $update->currentVersion) {
             //Install new update
             if ($update->update()) {
                 $result = array('response' => array('status' => 'ok', 'message' => 'Update_successful'), 'values' => array($update->latestVersionName));
             } else {
                 $result = array('response' => array('status' => 'error', 'message' => 'Update_failed'), 'values' => array());
             }
         } else {
             $result = array('response' => array('status' => 'ok', 'message' => 'Current_Version_is_up_to_date'), 'values' => array());
         }
     } else {
         $result = array('response' => array('status' => 'error', 'message' => $update->getLastError()), 'values' => array());
     }
     return $result;
 }
Example #6
0
            $result = ShefB24Uploader::uploadProjectFiles($_REQUEST['params'], $_REQUEST['projectId']);
            break;
        case 'ShefB24Uploader::compileProject':
            $result = ShefB24Uploader::compileProject($_REQUEST['params'], $_REQUEST['projectId']);
            break;
        case 'ShefBitrix24Lead::insert':
            $result = ShefBitrix24Lead::insert($_REQUEST['params'], $_REQUEST['projectId']);
            break;
        case 'ShefBitrix24Test::testConnect':
            $result = ShefBitrix24Test::testConnect($_REQUEST['params'], $_REQUEST['projectId']);
            break;
        case 'ShefB24Uploader::getVer':
            $result = array('response' => array('status' => 'ok', 'message' => iLPB24HOSTINGVER), 'values' => array());
            break;
        case 'ShefAutoUpdate::makeUpdate':
            $result = AutoUpdate::makeUpdate($_REQUEST['params']);
            break;
        default:
            $result = array('response' => array('status' => 'error', 'message' => 'bad name space'), 'values' => array());
            break;
    }
    Response::setValue('response', $result['response']);
    if (isset($result['values'])) {
        Response::setValue('values', $result['values']);
    }
} catch (Exception $e) {
    ob_get_clean();
    Response::setValue('response', array('status' => 'error', 'message' => 'Exception: ' . $e->getMessage()));
}
Response::sendValues();
die;
Example #7
0
Bittytorrent is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Bittytorrent.  If not, see <http://www.gnu.org/licenses/>. 
*/
if (!defined("IN_TORRENT")) {
    die("Access denied!");
}
$smarty->assign('returnUpdate', false);
if (isset($_GET['updateNow'])) {
    require $path . '/libs/Update.class.php';
    $update = new AutoUpdate(true);
    $update->currentVersion = 2;
    //Must be an integer - you can't compare strings
    $update->updateUrl = 'http://localhost/libs';
    //Replace with your server update directory
    //Check for a new update
    $latest = $update->checkUpdate();
    if ($latest !== false) {
        // var_dump($update->currentVersion);
        if ($latest > $update->currentVersion) {
            //Install new update
            $rUpdate = "";
            $rUpdate .= "New Version: " . $update->latestVersionName . "<br />";
            $rUpdate .= "Installing Update...<br />";
            if ($update->update()) {
                $rUpdate .= "Update successful!";
Example #8
0
if (!isset($_REQUEST['type']) || $_REQUEST['type'] != 'sources') {
    // We need this stuff
    define('NO_SESSION', 1);
    define('OUTDATED_DATABASE_OK', 1);
}
require_once 'lib/init.php';
// Get the version and format it
$version = Update::get_version();
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'update') {
    if ($_REQUEST['type'] == 'sources') {
        if (!Access::check('interface', '100')) {
            UI::access_denied();
            exit;
        }
        set_time_limit(300);
        AutoUpdate::update_files();
        echo '<script language="javascript" type="text/javascript">window.location="' . AmpConfig::get('web_path') . '";</script>';
        exit;
    } else {
        /* Run the Update Mojo Here */
        Update::run_update();
        /* Get the New Version */
        $version = Update::get_version();
    }
}
$htmllang = str_replace("_", "-", AmpConfig::get('lang'));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
echo $htmllang;
?>
Example #9
0
    // We need this stuff
    define('NO_SESSION', 1);
    define('OUTDATED_DATABASE_OK', 1);
}
require_once 'lib/init.php';
// Get the version and format it
$version = Update::get_version();
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'update') {
    if ($_REQUEST['type'] == 'sources') {
        if (!Access::check('interface', '100')) {
            UI::access_denied();
            exit;
        }
        set_time_limit(300);
        AutoUpdate::update_files();
        AutoUpdate::update_dependencies();
        echo '<script language="javascript" type="text/javascript">window.location="' . AmpConfig::get('web_path') . '";</script>';
        exit;
    } else {
        /* Run the Update Mojo Here */
        Update::run_update();
        /* Get the New Version */
        $version = Update::get_version();
    }
}
$htmllang = str_replace("_", "-", AmpConfig::get('lang'));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
echo $htmllang;
?>
Example #10
0
<?php

require 'version.php';
require 'update.php';
$update = new AutoUpdate(true);
$update->currentVersionName = CURRENT_VERSION_NAME;
$update->currentVersion = CURRENT_VERSION;
$update->updateUrl = REPOSITORY_URL;
//Check for a new update
$latest = $update->checkUpdate();
if ($latest !== false) {
    if ($latest > $update->currentVersion) {
        //Install new update
        echo "An update is available.\nDo you want to download and install it now?\nMining activities will not be affected.\nCurrent Version: " . $update->currentVersionName . "\nNew version: " . $update->latestVersionName;
    } else {
        //echo "Current Version is up to date";
        echo '';
    }
} else {
    echo $update->getLastError();
}
Example #11
0
}
if ($pgDisplayPechoFatal) {
    $pgVerbose[] = 4;
}
$pgIRCTrigger = array('!', '.');
//Last version check
$tmp = null;
if (function_exists('mb_internal_encoding')) {
    mb_internal_encoding("UTF-8");
}
// Suppress warnings if timezone not set on server
date_default_timezone_set(@date_default_timezone_get());
//Check for updates before loading Peachy.
if (!$pgDisableUpdates && !defined('PEACHY_PHPUNIT_TESTS')) {
    //the below MUST have its own Http object or else things will break
    $updater = new AutoUpdate(new HTTP());
    $Uptodate = $updater->Checkforupdate();
    if (!$Uptodate) {
        $updater->updatePeachy();
    }
}
require_once $pgIP . 'Includes/Peachy.php';
/**
 * Simple version_compare() wrapper
 * @param string $check_version string
 * @throws DependencyError
 * @return void
 */
function peachyCheckPHPVersion($check_version)
{
    if (version_compare(PHP_VERSION, $check_version, '<')) {