2018-07-13 18:39:55 +02:00
|
|
|
<?php
|
|
|
|
|
2020-03-30 19:57:38 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) Codiad & Kent Safranski (codiad.com), distributed
|
|
|
|
* as-is and without warranty under the MIT License. See
|
|
|
|
* [root]/license.txt for more. This information must remain intact.
|
|
|
|
*/
|
2018-07-13 18:39:55 +02:00
|
|
|
|
2020-03-30 19:57:38 +02:00
|
|
|
require_once('../../common.php');
|
|
|
|
require_once('class.active.php');
|
2018-07-13 18:39:55 +02:00
|
|
|
|
2020-03-30 19:57:38 +02:00
|
|
|
$Active = new Active();
|
2018-07-13 18:39:55 +02:00
|
|
|
|
2020-03-30 19:57:38 +02:00
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
// Verify Session or Key
|
|
|
|
//////////////////////////////////////////////////////////////////
|
2018-07-13 18:39:55 +02:00
|
|
|
|
2020-03-30 19:57:38 +02:00
|
|
|
checkSession();
|
2018-07-13 18:39:55 +02:00
|
|
|
|
2020-03-30 19:57:38 +02:00
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
// Get user's active files
|
|
|
|
//////////////////////////////////////////////////////////////////
|
2018-07-13 18:39:55 +02:00
|
|
|
|
2020-03-30 19:57:38 +02:00
|
|
|
if( $_GET['action'] == 'list' ) {
|
|
|
|
|
|
|
|
$Active->username = $_SESSION['user'];
|
|
|
|
$Active->ListActive();
|
2018-07-13 18:39:55 +02:00
|
|
|
}
|
|
|
|
|
2020-03-30 19:57:38 +02:00
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
// Add active record
|
|
|
|
//////////////////////////////////////////////////////////////////
|
2018-07-13 18:39:55 +02:00
|
|
|
|
2020-03-30 19:57:38 +02:00
|
|
|
if ( $_GET['action'] == 'add' ) {
|
|
|
|
|
|
|
|
$Active->username = $_SESSION['user'];
|
|
|
|
$Active->path = $_GET['path'];
|
|
|
|
$Active->Add();
|
2018-07-13 18:39:55 +02:00
|
|
|
}
|
|
|
|
|
2020-03-30 19:57:38 +02:00
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
// Rename
|
|
|
|
//////////////////////////////////////////////////////////////////
|
2018-07-13 18:39:55 +02:00
|
|
|
|
2020-03-30 19:57:38 +02:00
|
|
|
if ( $_GET['action'] == 'rename' ) {
|
|
|
|
|
|
|
|
$Active->username = $_SESSION['user'];
|
|
|
|
$Active->path = $_GET['old_path'];
|
|
|
|
$Active->new_path = $_GET['new_path'];
|
|
|
|
$Active->Rename();
|
2018-07-13 18:39:55 +02:00
|
|
|
}
|
|
|
|
|
2020-03-30 19:57:38 +02:00
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
// Check if file is active
|
|
|
|
//////////////////////////////////////////////////////////////////
|
2018-07-13 18:39:55 +02:00
|
|
|
|
2020-03-30 19:57:38 +02:00
|
|
|
if ( $_GET['action'] == 'check' ) {
|
|
|
|
|
|
|
|
$Active->username = $_SESSION['user'];
|
|
|
|
$Active->path = $_GET['path'];
|
|
|
|
$Active->Check();
|
2018-07-13 18:39:55 +02:00
|
|
|
}
|
|
|
|
|
2020-03-30 19:57:38 +02:00
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
// Remove active record
|
|
|
|
//////////////////////////////////////////////////////////////////
|
2018-07-13 18:39:55 +02:00
|
|
|
|
2020-03-30 19:57:38 +02:00
|
|
|
if ( $_GET['action'] == 'remove' ) {
|
|
|
|
|
|
|
|
$Active->username = $_SESSION['user'];
|
|
|
|
$Active->path = $_GET['path'];
|
|
|
|
$Active->remove( $Active->path );
|
2018-07-13 18:39:55 +02:00
|
|
|
}
|
2020-03-30 19:57:38 +02:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
// Remove all active record
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
if( $_GET['action'] == 'removeall' ) {
|
|
|
|
|
|
|
|
$Active->username = $_SESSION['user'];
|
|
|
|
$Active->RemoveAll();
|
2018-07-13 18:39:55 +02:00
|
|
|
}
|
2019-05-01 15:11:50 +02:00
|
|
|
|
2020-03-30 19:57:38 +02:00
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
// Mark file as focused
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
if( $_GET['action'] == 'focused' ) {
|
2019-05-01 15:11:50 +02:00
|
|
|
|
2020-03-30 19:57:38 +02:00
|
|
|
$Active->username = $_SESSION['user'];
|
|
|
|
$Active->path = $_GET['path'];
|
|
|
|
$Active->MarkFileAsFocused();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( $_GET['action'] == 'save_positions' ) {
|
|
|
|
|
2019-05-01 15:11:50 +02:00
|
|
|
ignore_user_abort( true );
|
2020-03-30 19:57:38 +02:00
|
|
|
$Active->username = $_SESSION['user'];
|
|
|
|
$Active->savePositions( $_POST["positions"] );
|
2019-05-01 15:11:50 +02:00
|
|
|
}
|