Example #1
0
// | Remote sites are not compatible with Piwigo 2.4+                      |
// +-----------------------------------------------------------------------+
$has_remote_site = false;
$query = 'SELECT galleries_url FROM ' . SITES_TABLE . ';';
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) {
    if (url_is_remote($row['galleries_url'])) {
        $has_remote_site = true;
    }
}
if ($has_remote_site) {
    include_once PHPWG_ROOT_PATH . 'admin/include/updates.class.php';
    include_once PHPWG_ROOT_PATH . 'admin/include/pclzip.lib.php';
    $page['errors'] = array();
    $step = 3;
    updates::upgrade_to('2.3.4', $step, false);
    if (!empty($page['errors'])) {
        echo '<ul>';
        foreach ($page['errors'] as $error) {
            echo '<li>' . $error . '</li>';
        }
        echo '</ul>';
    }
    exit;
}
// +-----------------------------------------------------------------------+
// |                            upgrade choice                             |
// +-----------------------------------------------------------------------+
$tables = get_tables();
$columns_of = get_columns_of($tables);
// find the current release
Example #2
0
// | This program 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 this program; if not, write to the Free Software           |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA.                                                                  |
// +-----------------------------------------------------------------------+
if (!defined("PHPWG_ROOT_PATH")) {
    die("Hacking attempt!");
}
$conf['updates_ignored'] = unserialize($conf['updates_ignored']);
include_once PHPWG_ROOT_PATH . 'admin/include/updates.class.php';
$autoupdate = new updates($page['page']);
$show_reset = false;
if (!$autoupdate->get_server_extensions()) {
    $page['errors'][] = l10n('Can\'t connect to server.');
    return;
    // TODO: remove this return and add a proper "page killer"
}
foreach ($autoupdate->types as $type) {
    $fs = 'fs_' . $type;
    $server = 'server_' . $type;
    $server_ext = $autoupdate->{$type}->{$server};
    $fs_ext = $autoupdate->{$type}->{$fs};
    if (empty($server_ext)) {
        continue;
    }
    foreach ($fs_ext as $ext_id => $fs_ext) {
/**
* @package
* @todo
*/
!defined('SDG') ? die('Triple protection!') : null;
// инициируем "Наименование страницы" отображаемое в форме
$arrNamePage = array(array('name' => MENU_ADMIN_MAIN, 'link' => CONF_ADMIN_FILE), array('name' => MENU_SYSTEM, 'link' => false), array('name' => MENU_UPDATES, 'link' => CONF_ADMIN_FILE . '?m=system&s=updates'));
/**
* иницализация массива подключаемых шаблонов: по умолчанию все значения - false
* для подключения шаблона, необходимо установить значение - true
* шаблоны подключаются в порядке установленном в файле головного шаблона
*/
$arrActions = array('config' => false, 'backup' => false, 'setup' => false, 'saveLog' => false, 'logs' => false);
// определяем шаблон для отображения
isset($_GET['action']) && isset($arrActions[$_GET['action']]) ? $arrActions[$_GET['action']] = true : null;
$updates = new updates();
/** Строка запроса из адресной строки браузера **/
$qString = !empty($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : 'm=system&s=updates';
// настройки обновлений
if ($arrActions['config']) {
    /*
    	// инициируем "Наименование страницы" отображаемое в форме
    	$arrNamePage[] = array('name' => MENU_CONFIG, 'link' => false);
    
    	if (isset($_POST['save'])) // сохраняем данные, переданные из формы
    	{
    		$data = "<?php\n\n"
    			  . "(!defined('SDG')) ? die ('Triple protection!') : null;\n\n"
    			  . 'define("CONF_UPDATES_PATH_TO_FILES", "' . filesys::setPath($_POST['path']) . '");' . "\n";
    
    		if (!tools::saveConfig('core/conf/const.config.updates.php', $data, CONF_ADMIN_FILE . '?m=system&s=updates&action=config'))
 function pEC($p_event, &$p_header)
 {
     return updates::preExtractCallBack($p_event, $p_header);
 }
Example #5
0
 //$logFile = CONF_UPDATES_PATH_TO_LOG_FILES . terms::currentDate() . '_update.log';
 //$message = addslashes(MESSAGE_WARNING_UPDATE_ERRORS_OCCURRED . SITE_UPDATE_ERROR_LOG_FILE . ' - <b><a href="' . CONF_ADMIN_FILE . '?m=system&s=updates&action=saveLog&file=' . $logFile . '" title="' . FORM_BUTTON_SAVE . '">' . $logFile . '</a></b>');
 if (1 == $_POST['step']) {
     if (!updates::setupUpdate(CONF_UPDATES_PATH_TO_FILES . $_POST['setupUpdate'])) {
         echo ajax::sdgJSONencode(array('error' => updates::$errorMessage));
     } else {
         // Если сообщения не пустые, значит ошибки были
         if (!empty(updates::$errorMessage)) {
             echo ajax::sdgJSONencode(array('success' => MESSAGE_WARNING_UPDATE_SETUP_BUT_ERRORS_OCCURRED));
         } else {
             echo ajax::sdgJSONencode(array('success' => updates::$message));
         }
         //echo (file_exists($logFile)) ? ajax::sdgJSONencode(array('response' => array('error' => $message))) : ajax::sdgJSONencode(array('response' => array('success' => updates::$message)));
     }
 } elseif (2 == $_POST['step']) {
     if (!updates::extractUpdate(CONF_UPDATES_PATH_TO_FILES . $_POST['setupUpdate'])) {
         echo ajax::sdgJSONencode(array('error' => updates::$errorMessage));
     } else {
         // Если сообщения не пустые, значит ошибки были
         if (!empty(updates::$errorMessage)) {
             echo ajax::sdgJSONencode(array('success' => MESSAGE_WARNING_UPDATE_SETUP_BUT_ERRORS_OCCURRED));
         } else {
             echo ajax::sdgJSONencode(array('success' => updates::$message));
         }
         // удаляем файлы кеша
         caching::dropCache();
         // удаляем файл обновлений
         unlink(CONF_UPDATES_PATH_TO_FILES . $_POST['setupUpdate']);
         // Переименовываем файл логов, вкючая в его имя номер сборки
         $logFile = CONF_UPDATES_PATH_TO_LOG_FILES . terms::currentDate() . '_update.log';
         if (file_exists($logFile)) {
Example #6
0
/**
 * API method
 * Checks for updates (core and extensions)
 * @param mixed[] $params
 */
function ws_extensions_checkupdates($params, $service)
{
    global $conf;
    include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
    include_once PHPWG_ROOT_PATH . 'admin/include/updates.class.php';
    $update = new updates();
    $result = array();
    if (!isset($_SESSION['need_update'])) {
        $update->check_piwigo_upgrade();
    }
    $result['piwigo_need_update'] = $_SESSION['need_update'];
    $conf['updates_ignored'] = unserialize($conf['updates_ignored']);
    if (!isset($_SESSION['extensions_need_update'])) {
        $update->check_extensions();
    } else {
        $update->check_updated_extensions();
    }
    if (!is_array($_SESSION['extensions_need_update'])) {
        $result['ext_need_update'] = null;
    } else {
        $result['ext_need_update'] = !empty($_SESSION['extensions_need_update']);
    }
    return $result;
}
Example #7
0
                    $main_template = $template_file;
                    include_once $work_file;
                } else {
                    messages::error404();
                }
            }
        }
    } elseif (isset($_GET['do']) && !empty($_GET['do'])) {
        $template_file = 'adm.' . $_GET['do'] . '.tpl';
        $work_file = 'core/includes/admin/adm.' . $_GET['do'] . '.php';
        if (@file_exists($work_file) && @file_exists(TEMPLATE_PATH_ADMIN . $template_file)) {
            $main_template = $template_file;
            include_once $work_file;
        } else {
            messages::error404();
        }
    } else {
        // Проверка наличия обновлений
        $avUpdates = array();
        $avUpdates['result'] = updates::checkUpdates();
        $avUpdates['error'] = is_numeric($avUpdates['result']) ? false : true;
        $smarty->assignByRef('avUpdates', $avUpdates);
    }
    // передаем в смарти "Наименование страницы" отображаемое форме
    isset($arrNamePage) && is_array($arrNamePage) ? $smarty->assignByRef('namePage', $arrNamePage) : $smarty->assign('namePage', false);
    /********** Собираем статистику запросов к БД **********/
    $smarty->assign('ScriptWorkReport', array('ID-DataBase' => db::$db_id, 'CountAllQuerysToDB' => db::$cntAllQuerys, 'ListAllQuerysToDB' => db::$arrAllQuerys));
    /********** Передаем в Smarty выводимый шаблон и отображаем его **********/
    $smarty->assignByRef('main_template', $main_template);
    $smarty->display('adm.index.tpl');
}
Example #8
0
// |                                Step 2                                 |
// +-----------------------------------------------------------------------+
if ($step == 2 and is_webmaster()) {
    if (isset($_POST['submit']) and isset($_POST['upgrade_to'])) {
        updates::upgrade_to($_POST['upgrade_to'], $step);
    }
}
// +-----------------------------------------------------------------------+
// |                                Step 3                                 |
// +-----------------------------------------------------------------------+
if ($step == 3 and is_webmaster()) {
    if (isset($_POST['dumpDatabase'])) {
        updates::dump_database(isset($_POST['includeHistory']));
    }
    if (isset($_POST['submit']) and isset($_POST['upgrade_to'])) {
        updates::upgrade_to($_POST['upgrade_to'], $step);
    }
    $updates = new updates();
    $updates->get_merged_extensions($upgrade_to);
    $updates->get_server_extensions($upgrade_to);
    $template->assign('missing', $updates->missing);
}
// +-----------------------------------------------------------------------+
// |                        Process template                               |
// +-----------------------------------------------------------------------+
if (!is_webmaster()) {
    $page['errors'][] = l10n('Webmaster status is required.');
}
$template->assign(array('STEP' => $step, 'PHPWG_VERSION' => PHPWG_VERSION, 'UPGRADE_TO' => $upgrade_to, 'RELEASE_URL' => PHPWG_URL . '/releases/' . $upgrade_to));
$template->set_filename('plugin_admin_content', 'updates_pwg.tpl');
$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');