Example #1
0
    if (!Preference::exists('myplex_username')) {
        Preference::insert('myplex_username', 'myPlex Username', '', '25', 'string', 'internal');
        Preference::insert('myplex_authtoken', 'myPlex Auth Token', '', '25', 'string', 'internal');
        Preference::insert('myplex_published', 'Plex Server is published to myPlex', '0', '25', 'boolean', 'internal');
        Preference::insert('plex_uniqid', 'Plex Server Unique Id', uniqid(), '25', 'string', 'internal');
        Preference::insert('plex_servername', 'Plex Server Name', 'Ampache', '25', 'string', 'internal');
        Preference::insert('plex_public_address', 'Plex Public Address', '', '25', 'string', 'internal');
        Preference::insert('plex_public_port', 'Plex Public Port', '32400', '25', 'string', 'internal');
        Preference::insert('plex_local_auth', 'myPlex authentication required on local network', '0', '25', 'boolean', 'internal');
        Preference::insert('plex_match_email', 'Link myPlex users to Ampache based on e-mail address', '1', '25', 'boolean', 'internal');
        User::rebuild_all_preferences();
    }
}
init_db();
$myplex_username = Plex_XML_Data::getMyPlexUsername();
$myplex_authtoken = Plex_XML_Data::getMyPlexAuthToken();
$myplex_published = Plex_XML_Data::getMyPlexPublished();
$plex_servername = Plex_XML_Data::getServerName();
$plex_public_address = Plex_XML_Data::getServerPublicAddress();
$plex_public_port = Plex_XML_Data::getServerPublicPort();
$plex_local_port = Plex_XML_Data::getServerPort();
$plex_local_auth = AmpConfig::get('plex_local_auth');
$plex_match_email = AmpConfig::get('plex_match_email');
$plexact = $_REQUEST['plexact'];
switch ($plexact) {
    case 'auth_myplex':
        $myplex_username = $_POST['myplex_username'];
        $myplex_password = $_POST['myplex_password'];
        $plex_public_port = $_POST['plex_public_port'];
        if (!empty($myplex_username)) {
            // Register the server on myPlex and get auth token
Example #2
0
 protected static function get_users_account($authtoken = '')
 {
     if (empty($authtoken)) {
         $authtoken = Plex_XML_Data::getMyPlexAuthToken();
     }
     $action = 'users/account?auth_token=' . $authtoken;
     $res = self::myPlexRequest($action);
     return $res['xml'];
 }