Ejemplo n.º 1
0
function initialize()
{
    global $txt, $context, $smfInfo, $sourcedir, $forum_version, $db_show_debug, $db_last_error, $modSettings;
    // Set this to true so we get the correct forum value
    $ssi_gzip = true;
    $forum_version = get_file_versions(true);
    $smfInfo = !empty($modSettings['smfInfo']) ? $modSettings['smfInfo'] : '';
    if (empty($smfInfo) || allowedTo('admin_forum') && isset($_GET['regenerate'])) {
        generate_password();
    }
    // If the user isn't an admin or they don't have a password in the URL, or its incorrect, kick 'em out
    if (!allowedTo('admin_forum') && (!isset($_POST['pass']) || strcmp($_POST['pass'], $smfInfo) != 0)) {
        show_password_form();
    }
    // Either their an admin or have the right password
    require_once $sourcedir . '/Subs-Package.php';
    // Enable error reporting.
    error_reporting(E_ALL);
    @session_start();
    if ($context['user']['is_admin'] && isset($_GET['delete'])) {
        // This won't work on all servers...
        @unlink(__FILE__);
        // Now just redirect to the forum...
        redirectexit();
    }
}
Ejemplo n.º 2
0
 * MMC 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 MMC; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
print "<h1>" . _T('View all versions', 'backuppc') . "</h1>";
if (isset($_GET['isdir'])) {
    die("Sorry, cannot view vesion history for directories.");
}
require_once "includes/xmlrpc.inc.php";
require_once 'modules/backuppc/includes/xmlrpc.php';
$response = get_file_versions($_GET['host'], $_GET['sharename'], $_GET['dir']);
if (!$response['err']) {
    if (count($response['backup_nums']) == 0) {
        print _T('No other version.', 'backuppc');
    }
    $points = $response['backup_nums'];
    $datetimes = $response['datetimes'];
    $ages = $response['ages'];
    for ($i = 0; $i < count($points); $i++) {
        $param_str = "host=" . $_GET['host'] . "&backupnum=" . $points[$i] . "&sharename=" . urlencode($_GET['sharename']);
        $param_str .= "&dir=" . urlencode($_GET['dir']);
        preg_match("#.+ (.+)#", $datetimes[$i], $result);
        $time = time() - floatval($ages[$i]) * 24 * 60 * 60;
        $time_str = strftime(_T("%A, %B %e %Y", 'backuppc'), $time) . ' - ' . $result[1];
        print '<a href="#" onclick="RestoreFile(\'' . $param_str . '\')">' . _T("Restore from ", "backuppc") . $time_str . "</a><br/>";
    }
Ejemplo n.º 3
0
/**
 * Generate the fetch passsword or accept one so support can see the info
 */
function initialize()
{
    global $context, $elkinfo, $forum_version, $modSettings;
    $forum_version = get_file_versions(true);
    $elkinfo = !empty($modSettings['elkinfo']) ? $modSettings['elkinfo'] : '';
    if (empty($elkinfo) || allowedTo('admin_forum') && isset($_GET['regenerate'])) {
        generate_password();
    }
    // If the user isn't an admin or they don't have a password in the URL, or its incorrect, kick 'em out
    if (!allowedTo('admin_forum') && (!isset($_POST['pass']) || strcmp($_POST['pass'], $elkinfo) != 0)) {
        show_password_form();
    }
    // Either their an admin or have the right password
    require_once SUBSDIR . '/Package.subs.php';
    // Enable error reporting.
    error_reporting(E_ALL);
    @session_start();
    // Try to remove the info file
    if ($context['user']['is_admin'] && isset($_GET['delete'])) {
        // This won't work on all servers...
        @unlink(__FILE__);
        // Now just redirect to the forum...
        redirectexit();
    }
}