コード例 #1
0
ファイル: settings.php プロジェクト: azizjonm/fhq
<?php

/*
 * API_NAME: Settings
 * API_DESCRIPTION: returned all config. Passwords will be removed.
 * API_ACCESS: only admin
 * API_INPUT: token - guid, secret token
 */
$curdir_admin_settings = dirname(__FILE__);
include_once $curdir_admin_settings . "/../api.lib/api.base.php";
include_once $curdir_admin_settings . "/../api.lib/api.security.php";
include_once $curdir_admin_settings . "/../api.lib/api.helpers.php";
include_once $curdir_admin_settings . "/../api.lib/api.updates.php";
include_once $curdir_admin_settings . "/../../config/config.php";
$response = APIHelpers::startpage($config);
$conn = APIHelpers::createConnection($config);
APIHelpers::checkAuth();
if (!APISecurity::isAdmin()) {
    APIHelpers::showerror(1280, 'This method only for admin');
}
$response['result'] = 'ok';
$response['data'] = $config;
unset($response['data']['mail']['password']);
unset($response['data']['db']['userpass']);
$response['data']['db']['version'] = APIUpdates::getVersion($conn);
APIHelpers::endpage($response);
コード例 #2
0
ファイル: install_updates.php プロジェクト: azizjonm/fhq
}
$result = array('result' => 'fail', 'data' => array());
$result['result'] = 'ok';
$conn = APIHelpers::createConnection($config);
$version = APIUpdates::getVersion($conn);
$result['version'] = $version;
$updates = array();
$curdir = dirname(__FILE__);
$filename = $curdir . '/updates/' . $version . '.php';
while (file_exists($filename)) {
    include_once $filename;
    $function_update = 'update_' . $version;
    if (!function_exists($function_update)) {
        $result['data'][$version] = 'Not found function ' . $function_update;
        break;
    }
    if ($function_update($conn)) {
        APIUpdates::insertUpdateInfo($conn, $version, $updates[$version]['to_version'], $updates[$version]['name'], $updates[$version]['description'], APISecurity::userid());
        $result['data'][$version] = 'installed';
    } else {
        $result['data'][$version] = 'failed';
    }
    $new_version = APIUpdates::getVersion($conn);
    if ($new_version == $version) {
        break;
    }
    $version = $new_version;
    $result['version'] = $version;
    $filename = $curdir . '/updates/' . $version . '.php';
}
echo json_encode($result);