Example #1
0
<?php

/**
 *
 */
include '../PHPFreebox/PHPFreebox.php';
include 'config.php';
$oFreebox = new PHPFreebox(FREEBOX_API_URL, FREEBOX_API_LOGIN, FREEBOX_API_PASSWORD);
//$oFreebox->_debug = true;
// Sample File : ISO Ubuntu
$dlReturn = $oFreebox->seedbox_addLink('http://releases.ubuntu.com/releases/precise/ubuntu-12.04.2-desktop-i386.iso');
echo 'addLink : ';
var_dump($dlReturn);
// Sample Torrent : ISO Fedora
$dlReturn = $oFreebox->seedbox_addTorrentURL('http://torrent.fedoraproject.org/torrents/Fedora-18-source-DVD.torrent');
echo 'addTorrentURL : ';
var_dump($dlReturn);
// Sample Torrent : ISO Fedora
$dlReturn = $oFreebox->seedbox_addTorrentFile(getcwd() . DIRECTORY_SEPARATOR . 'statics' . DIRECTORY_SEPARATOR . 'Fedora-18-i386-DVD.torrent');
echo 'addTorrentFile : ';
var_dump($dlReturn);
if ($dlReturn !== false && is_int($dlReturn)) {
    $oFreebox->seedbox_stopTorrent($dlReturn);
    $oFreebox->seedbox_startTorrent($dlReturn);
}
Example #2
0
<?php

include '../PHPFreebox/PHPFreebox.php';
include 'config.php';
$oFreebox = new PHPFreebox(FREEBOX_API_URL, FREEBOX_API_LOGIN, FREEBOX_API_PASSWORD);
$oFreebox->_debug = true;
$oFreebox->remote_setKey(FREEBOX_REMOTE_CODE);
//$oFreebox->remote_sendCommand(PHPFreebox::REMOTE_KEY_POWER); sleep(5);
//$oFreebox->remote_sendCommand(PHPFreebox::REMOTE_KEY_OK);
$oFreebox->remote_setChannel(1);
Example #3
0
<?php

/**
 *
 */
include '../PHPFreebox/PHPFreebox.php';
include 'config.php';
$oFreebox = new PHPFreebox(FREEBOX_API_URL, FREEBOX_API_LOGIN, FREEBOX_API_PASSWORD);
//$oFreebox->_debug = true;
$resDownloads = $oFreebox->seedbox_list();
echo '<ul>';
foreach ($resDownloads as $item) {
    if ($item['type'] == 'http') {
        echo '<li>T&eacute;l&eacute;chargement de type FICHIER :';
        echo '<ul>';
        echo '<li> ID : ' . $item['id'] . '</li>';
        echo '<li> Nom : ' . $item['name'] . '</li>';
        echo '<li> URL : ' . $item['url'] . '</li>';
        echo '<li> Bytes (total) : ' . $item['size'] . '</li>';
        echo '<li> Bytes (transf&eacute;r&eacute;) : ' . $item['transferred'] . '</li>';
        echo '<li> Statut : ' . $item['status'] . '</li>';
        echo '<li> Erreur : ' . $item['errmsg'] . '</li>';
        echo '<li> Taux de t&eacute;l&eacute;chargement : ' . $item['rx_rate'] . '</li>';
        echo '</ul>';
        echo '</li>';
    }
    if ($item['type'] == 'torrent') {
        echo '<li>T&eacute;l&eacute;chargement de type TORRENT :';
        echo '<ul>';
        echo '<li> ID : ' . $item['id'] . '</li>';
        echo '<li> Nom : ' . $item['name'] . '</li>';
Example #4
0
<?php

include '../PHPFreebox/PHPFreebox.php';
include 'config.php';
$oFreebox = new PHPFreebox(FREEBOX_API_URL, FREEBOX_API_LOGIN, FREEBOX_API_PASSWORD);
//$oFreebox->_debug  = true;
echo 'Freebox : ' . $oFreebox->getVersionFreebox() . '<br />';
echo 'PHPFreebox : ' . $oFreebox->getVersion() . '<br /><br />';
echo 'Serial : ' . $oFreebox->system_getSerial() . '<br /><br />';
$iUptime = $oFreebox->system_getUptime();
$iUptimeSec = $iUptime;
echo 'Uptime : ' . $iUptimeSec . 's<br />';
$iUptimeMin = (int) ($iUptime / 60);
$iUptimeSec = $iUptime - $iUptimeMin * 60;
echo 'Uptime : ' . $iUptimeMin . 'm ' . $iUptimeSec . 's<br />';
$iUptimeHour = (int) ($iUptime / 60 / 60);
$iUptimeMin = (int) (($iUptime - $iUptimeHour * 60 * 60) / 60);
$iUptimeSec = $iUptime - $iUptimeHour * 60 * 60 - $iUptimeMin * 60;
echo 'Uptime : ' . $iUptimeHour . 'h ' . $iUptimeMin . 'm ' . $iUptimeSec . 's<br />';
$iUptimeDay = (int) ($iUptime / 60 / 60 / 24);
$iUptimeHour = (int) (($iUptime - $iUptimeDay * 60 * 60 * 24) / 60 / 60);
$iUptimeMin = (int) (($iUptime - $iUptimeDay * 60 * 60 * 24 - $iUptimeHour * 60 * 60) / 60);
$iUptimeSec = $iUptime - $iUptimeDay * 60 * 60 * 24 - $iUptimeHour * 60 * 60 - $iUptimeMin * 60;
echo 'Uptime : ' . $iUptimeDay . 'd  ' . $iUptimeHour . 'h ' . $iUptimeMin . 'm ' . $iUptimeSec . 's<br />';
// Reboot
//$result = $oFreebox->system_reboot(5);
//echo 'reboot : '; var_dump($result);
Example #5
0
<?php

include '../PHPFreebox/PHPFreebox.php';
include 'config.php';
$oFreebox = new PHPFreebox(FREEBOX_API_URL, FREEBOX_API_LOGIN, FREEBOX_API_PASSWORD);
//$oFreebox->_debug  = true;
$resStorage = $oFreebox->storage_list();
foreach ($resStorage as $key => $item) {
    echo '<ul>';
    echo '<li>#' . $key . '</li>';
    echo '<li>ID : ' . $item['partitions'][0]['partition_id'] . '</li>';
    echo '<li>Label : ' . $item['partitions'][0]['label'] . '</li>';
    echo '<li>Etat : ' . $item['partitions'][0]['state'] . '</li>';
    echo '<ul>';
}
Example #6
0
<?php

/**
 * Play with Airplay and photo
 */
include '../PHPFreebox/PHPFreebox.php';
include 'config.php';
$oFreebox = new PHPFreebox(FREEBOX_API_URL, FREEBOX_API_LOGIN, FREEBOX_API_PASSWORD);
//$oFreebox->_debug  = true;
$oFreebox->airPlay_setPicture(getcwd() . '\\statics\\wikimedia_commons_caracal.jpg', PHPFreebox::AIRPLAY_SLIDE_RIGHT, 3000);
Example #7
0
<?php

include '../PHPFreebox/PHPFreebox.php';
include 'config.php';
$oFreebox = new PHPFreebox(FREEBOX_API_URL, FREEBOX_API_LOGIN, FREEBOX_API_PASSWORD);
//$oFreebox->_debug  = true;
$oFreebox->fs_createDirectory('/Disque dur/Musiques/AAAA');
$oFreebox->fs_createDirectory('/Disque dur/Musiques/BBBB');
$oFreebox->fs_move('/Disque dur/Musiques/BBBB', '/Disque dur/Musiques/AAAA');
$oFreebox->fs_copy('/Disque dur/Musiques/AAAA', '/Disque dur/Musiques/CCCC');
$oFreebox->fs_removeDirectory('/Disque dur/Musiques/AAAA');
$oFreebox->fs_removeDirectory('/Disque dur/Musiques/CCCC');
Example #8
0
<?php

/**
 * List directories and file from Freebox
 */
include '../PHPFreebox/PHPFreebox.php';
include 'config.php';
if (isset($_GET['dir']) && !empty($_GET['dir'])) {
    $paramDir = $_GET['dir'];
} else {
    $paramDir = '';
}
$oFreebox = new PHPFreebox(FREEBOX_API_URL, FREEBOX_API_LOGIN, FREEBOX_API_PASSWORD);
//$oFreebox->_debug  = true;
$arrListing = $oFreebox->fs_listDirectory($paramDir);
if (!empty($arrListing)) {
    $sDir = '';
    $sFile = '';
    if ($paramDir != '') {
        $arrParent = explode('/', $paramDir);
        array_pop($arrParent);
        $sParent = '<li>[dir] <a href="?dir=' . urlencode(implode('/', $arrParent)) . '">..</a>';
    } else {
        $sParent = '';
    }
    foreach ($arrListing as $item) {
        if ($item['type'] == 'dir') {
            $sDir .= '<li>[' . $item['type'] . '] <a href="?dir=' . urlencode($paramDir . '/' . $item['name']) . '">' . utf8_decode($item['name']) . '</a>';
        }
        if ($item['type'] == 'file') {
            $sFile .= '<li>[' . $item['type'] . '] ' . utf8_decode($item['name']) . '';
Example #9
0
<?php

/**
 * Gestion du RĂ©seau
 */
include '../PHPFreebox/PHPFreebox.php';
include 'config.php';
$oFreebox = new PHPFreebox(FREEBOX_API_URL, FREEBOX_API_LOGIN, FREEBOX_API_PASSWORD);
//$oFreebox->_debug  = true;
$oFreebox->_useCache = true;
$oFreebox->network_setWifiStatus(false);
$oFreebox->network_setWifiStatus(true);
echo '<ul>';
echo '<li> Mat&eacute;riel :';
echo '<ul>';
echo '<li> Addresse MAC ' . $oFreebox->network_getMacAddress();
echo '</ul>';
echo '</li>';
echo '<li> WIFI :';
echo '<ul>';
echo '<li> Config :';
echo '<ul>';
echo '<li> Activ&eacute; : ' . $oFreebox->network_getWifiConfig('is_enabled') . '</li>';
echo '<li> Canal : ' . $oFreebox->network_getWifiConfig('channel') . '</li>';
echo '<li> Mode 802.11n : ' . $oFreebox->network_getWifiConfig('mode') . '</li>';
echo '</ul>';
echo '</li>';
echo '<li> R&eacute;seau Personnel :';
echo '<ul>';
echo '<li> Activ&eacute; : ' . $oFreebox->network_getWifiConfig_PrivateNetwork('is_enabled') . '</li>';
echo '<li> Cacher le SSID : ' . $oFreebox->network_getWifiConfig_PrivateNetwork('is_ssid_hidden') . '</li>';
Example #10
0
<?php

include '../PHPFreebox/PHPFreebox.php';
include 'config.php';
$oFreebox = new PHPFreebox(FREEBOX_API_URL, FREEBOX_API_LOGIN, FREEBOX_API_PASSWORD);
//$oFreebox->_debug  = true;
$oFreebox->_useCache = true;
// Doc : Transmission RPC (https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt#L441)
echo '<ul>';
echo '<li>max global download speed (KBps) :                                                                 : ' . $oFreebox->transmission_get('alt-speed-down') . '</li>';
echo '<li>true means use the alt speeds                                                                      : ' . $oFreebox->transmission_get('alt-speed-enabled') . '</li>';
echo '<li>when to turn on alt speeds (units: minutes after midnight)                                         : ' . $oFreebox->transmission_get('alt-speed-time-begin') . '</li>';
echo '<li>true means the scheduled on/off times are used                                                     : ' . $oFreebox->transmission_get('alt-speed-time-enabled') . '</li>';
echo '<li>when to turn off alt speeds (units: same)                                                          : ' . $oFreebox->transmission_get('alt-speed-time-end') . '</li>';
echo '<li>what day(s) to turn on alt speeds (look at tr_sched_day)                                           : ' . $oFreebox->transmission_get('alt-speed-time-day') . '</li>';
echo '<li>max global upload speed (KBps)                                                                     : ' . $oFreebox->transmission_get('alt-speed-up') . '</li>';
echo '<li>Adresse de la blocklist pour utiliser pour "blocklist-update"                                      : ' . $oFreebox->transmission_get('blocklist-url') . '</li>';
echo '<li>Etat de la blocklist(true means enabled)                                                           : ' . $oFreebox->transmission_get('blocklist-enabled') . '</li>';
echo '<li>number of rules in the blocklist                                                                   : ' . $oFreebox->transmission_get('blocklist-size') . '</li>';
echo '<li>maximum size of the disk cache (MB)                                                                : ' . $oFreebox->transmission_get('cache-size-mb') . '</li>';
echo '<li>location of transmission\'s configuration directory                                                : ' . $oFreebox->transmission_get('config-dir') . '</li>';
echo '<li>default path to download torrents                                                                  : ' . utf8_decode($oFreebox->transmission_get('download-dir')) . '</li>';
echo '<li>max number of torrents to download at once (see download-queue-enabled)                            : ' . $oFreebox->transmission_get('download-queue-size') . '</li>';
echo '<li>if true, limit how many torrents can be downloaded at once                                         : ' . $oFreebox->transmission_get('download-queue-enabled') . '</li>';
echo '<li>Etat du DHT pour les torrents publics                                                              : ' . $oFreebox->transmission_get('dht-enabled') . '</li>';
echo '<li>Etat de l\'encyption forc&eacute;e des Pairs ("required", "preferred", "tolerated")                : ' . $oFreebox->transmission_get('encryption') . '</li>';
echo '<li>torrents we\'re seeding will be stopped if they\'re idle for this long                             : ' . $oFreebox->transmission_get('idle-seeding-limit') . '</li>';
echo '<li>true if the seeding inactivity limit is honored by default                                         : ' . $oFreebox->transmission_get('idle-seeding-limit-enabled') . '</li>';
echo '<li>path for incomplete torrents, when enabled                                                         : ' . utf8_decode($oFreebox->transmission_get('incomplete-dir')) . '</li>';
echo '<li>true means keep torrents in incomplete-dir until done                                              : ' . $oFreebox->transmission_get('incomplete-dir-enabled') . '</li>';
echo '<li>true means allow Local Peer Discovery in public torrents                                           : ' . $oFreebox->transmission_get('lpd-enabled') . '</li>';
Example #11
0
<?php

/**
 *
 */
include '../PHPFreebox/PHPFreebox.php';
include 'config.php';
$oFreebox = new PHPFreebox(FREEBOX_API_URL, FREEBOX_API_LOGIN, FREEBOX_API_PASSWORD);
//$oFreebox->_debug = true;
$resDownloads = $oFreebox->seedbox_list();
echo '<ul>';
foreach ($resDownloads as $item) {
    if ($item['type'] == 'http') {
        $oFreebox->seedbox_removeLink($item['id']);
    }
    if ($item['type'] == 'torrent') {
        $oFreebox->seedbox_removeTorrent($item['id']);
    }
}
echo '<ul>';