Exemplo n.º 1
0
}
if (AmpConfig::get('userflags')) {
    ?>
<td class="cel_userflag" id="userflag_<?php 
    echo $artist->id;
    ?>
_artist"><?php 
    Userflag::show($artist->id, 'artist');
    ?>
</td>
<?php 
}
?>
<td class="cel_action">
<?php 
if (Access::check_function('batch_download')) {
    ?>
    <a href="<?php 
    echo AmpConfig::get('web_path');
    ?>
/batch.php?action=artist&amp;id=<?php 
    echo $artist->id;
    ?>
">
            <?php 
    echo UI::get_icon('batch_download', '', T_('Batch Download'));
    ?>
        </a>
<?php 
}
if (Access::check('interface', '50')) {
        }
        ?>
            <?php 
        if (AmpConfig::get('share')) {
            ?>
                <?php 
            Share::display_ui('album', $c_album->id, false);
            ?>
            <?php 
        }
        ?>
        <?php 
    }
    ?>
        <?php 
    if (Access::check_function('batch_download') && check_can_zip('album')) {
        ?>
            <a rel="nohtml" href="<?php 
        echo $web_path;
        ?>
/batch.php?action=album&<?php 
        echo $c_album->get_http_album_query_ids('id');
        ?>
"><?php 
        echo UI::get_icon('batch_download', T_('Download'));
        ?>
</a>
        <?php 
    }
    ?>
        <?php 
Exemplo n.º 3
0
    if (AmpConfig::get('userflags')) {
        ?>
    <td class="cel_userflag" id="userflag_<?php 
        echo $libitem->id;
        ?>
_playlist"><?php 
        Userflag::show($libitem->id, 'playlist');
        ?>
</td>
    <?php 
    }
}
?>
<td class="cel_action">
<?php 
if (Access::check_function('batch_download') && check_can_zip('playlist')) {
    ?>
        <a rel="nohtml" href="<?php 
    echo AmpConfig::get('web_path');
    ?>
/batch.php?action=playlist&amp;id=<?php 
    echo $libitem->id;
    ?>
">
            <?php 
    echo UI::get_icon('batch_download', T_('Batch Download'));
    ?>
        </a>
<?php 
}
if (Access::check('interface', '25')) {
Exemplo n.º 4
0
        echo UI::get_icon('comment', T_('Post Shout'));
        ?>
</a>
    <?php 
    }
    ?>
    <?php 
    if (AmpConfig::get('share')) {
        ?>
        <?php 
        Share::display_ui('video', $libitem->id, false);
        ?>
    <?php 
    }
}
if (Access::check_function('download')) {
    ?>
    <a rel="nohtml" href="<?php 
    echo AmpConfig::get('web_path');
    ?>
/stream.php?action=download&video_id=<?php 
    echo $libitem->id;
    ?>
"><?php 
    echo UI::get_icon('download', T_('Download'));
    ?>
</a>
<?php 
}
if (Access::check('interface', '50')) {
    ?>
Exemplo n.º 5
0
 /**
  * createShare
  * Create a public url that can be used by anyone to stream media.
  * Takes the file id with optional description and expires parameters.
  */
 public static function createshare($input)
 {
     self::check_version($input, "1.6.0");
     $id = self::check_parameter($input, 'id');
     $description = $input['description'];
     if (AmpConfig::get('share')) {
         if (isset($input['expires'])) {
             $expires = $input['expires'];
             // Parse as a string to work on 32-bit computers
             if (strlen($expires) > 3) {
                 $expires = intval(substr($expires, 0, -3));
             }
             $expire_days = round(($expires - time()) / 86400, 0, PHP_ROUND_HALF_EVEN);
         } else {
             $expire_days = AmpConfig::get('share_expire');
         }
         $object_id = Subsonic_XML_Data::getAmpacheId($id);
         if (Subsonic_XML_Data::isAlbum($id)) {
             $object_type = 'album';
         } else {
             if (Subsonic_XML_Data::isSong($id)) {
                 $object_type = 'song';
             }
         }
         if (!empty($object_type)) {
             $r = Subsonic_XML_Data::createSuccessResponse();
             $shares = array();
             $shares[] = Share::create_share($object_type, $object_id, true, Access::check_function('download'), $expire_days, Share::generate_secret(), 0, $description);
             Subsonic_XML_Data::addShares($r, $shares);
         } else {
             $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_DATA_NOTFOUND);
         }
     } else {
         $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_UNAUTHORIZED);
     }
     self::apiOutput($input, $r);
 }
Exemplo n.º 6
0
 public static function display_ui_links($object_type, $object_id)
 {
     echo "<ul>";
     echo "<li><a onclick=\"handleShareAction('" . AmpConfig::get('web_path') . "/share.php?action=show_create&type=" . $object_type . "&id=" . $object_id . "')\">" . UI::get_icon('share', T_('Advanced Share')) . " &nbsp;" . T_('Advanced Share') . "</a></li>";
     if (AmpConfig::get('download')) {
         $dllink = "";
         if ($object_type == "song" || $object_type == "video") {
             $dllink = AmpConfig::get('web_path') . "/play/index.php?action=download&type=" . $object_type . "&oid=" . $object_id . "&uid=-1";
         } else {
             if (Access::check_function('batch_download') && check_can_zip($object_type)) {
                 $dllink = AmpConfig::get('web_path') . "/batch.php?action=" . $object_type . "&id=" . $object_id;
             }
         }
         if (!empty($dllink)) {
             if (AmpConfig::get('require_session')) {
                 // Add session information to the link to avoid authentication
                 $dllink .= "&ssid=" . Stream::get_session();
             }
             echo "<li><a rel=\"nohtml\" href=\"" . $dllink . "\">" . UI::get_icon('download', T_('Temporary direct link')) . " &nbsp;" . T_('Temporary direct link') . "</a></li>";
         }
     }
     echo "<li style='padding-top: 8px; text-align: right;'>";
     $plugins = Plugin::get_plugins('external_share');
     foreach ($plugins as $plugin_name) {
         echo "<a onclick=\"handleShareAction('" . AmpConfig::get('web_path') . "/share.php?action=external_share&plugin=" . $plugin_name . "&type=" . $object_type . "&id=" . $object_id . "')\" target=\"_blank\">" . UI::get_icon('share_' . strtolower($plugin_name), $plugin_name) . "</a>&nbsp;";
     }
     echo "</li>";
     echo "</ul>";
 }
Exemplo n.º 7
0
</td>
<td class="cel_random"><?php 
echo $libitem->random ? T_('Yes') : T_('No');
?>
</td>
<td class="cel_limit"><?php 
echo $libitem->limit > 0 ? $libitem->limit : T_('None');
?>
</td>
<td class="cel_owner"><?php 
echo scrub_out($libitem->f_user);
?>
</td>
<td class="cel_action">
        <?php 
if (Access::check_function('batch_download') && check_can_zip('search')) {
    ?>
                <a rel="nohtml" href="<?php 
    echo AmpConfig::get('web_path');
    ?>
/batch.php?action=search&amp;id=<?php 
    echo $libitem->id;
    ?>
">
                    <?php 
    echo UI::get_icon('batch_download', T_('Batch Download'));
    ?>
                </a>
        <?php 
}
if ($libitem->has_access()) {
Exemplo n.º 8
0
if (Access::check('interface', '25')) {
    ?>
            <?php 
    if (AmpConfig::get('share')) {
        ?>
                <?php 
        Share::display_ui('podcast_episode', $episode->id, false);
        ?>
            <?php 
    }
    ?>
        <?php 
}
?>
        <?php 
if (Access::check_function('download') && !empty($episode->file)) {
    ?>
            <a rel="nohtml" href="<?php 
    echo Podcast_Episode::play_url($episode->id);
    ?>
"><?php 
    echo UI::get_icon('link', T_('Link'));
    ?>
</a>
            <a rel="nohtml" href="<?php 
    echo AmpConfig::get('web_path');
    ?>
/stream.php?action=download&amp;podcast_episode_id=<?php 
    echo $episode->id;
    ?>
"><?php 
Exemplo n.º 9
0
        UI::show_footer();
        exit;
    case 'external_share':
        if (AmpConfig::get('demo_mode')) {
            UI::access_denied();
            exit;
        }
        $plugin = new Plugin($_GET['plugin']);
        if (!$plugin) {
            UI::access_denied('Access Denied - Unkown external share plugin.');
            exit;
        }
        $plugin->load($GLOBALS['user']);
        $type = $_REQUEST['type'];
        $id = $_REQUEST['id'];
        $allow_download = $type == 'song' && Access::check_function('download') || Access::check_function('batch_download');
        $secret = Share::generate_secret();
        $share_id = Share::create_share($type, $id, true, $allow_download, AmpConfig::get('share_expire'), $secret, 0);
        $share = new Share($share_id);
        $share->format(true);
        header("Location: " . $plugin->_plugin->external_share($share->public_url, $share->f_name));
        exit;
}
/**
 * If Access Control is turned on then we don't
 * even want them to be able to get to the login
 * page if they aren't in the ACL
 */
if (AmpConfig::get('access_control')) {
    if (!Access::check_network('interface', '', '5')) {
        debug_event('UI::access_denied', 'Access Denied:' . $_SERVER['REMOTE_ADDR'] . ' is not in the Interface Access list', '3');
Exemplo n.º 10
0
    </td>
</tr>
<tr>
    <td><?php 
echo T_('Allow Stream');
?>
</td>
    <td>
        <input type="checkbox" name="allow_stream" value="1" <?php 
echo $_REQUEST['allow_stream'] || $_SERVER['REQUEST_METHOD'] === 'GET' ? 'checked' : '';
?>
 />
    </td>
</tr>
<?php 
if (($_REQUEST['type'] == 'song' || $_REQUEST['type'] == 'video') && Access::check_function('download') || Access::check_function('batch_download')) {
    ?>
<tr>
    <td><?php 
    echo T_('Allow Download');
    ?>
</td>
    <td>
        <input type="checkbox" name="allow_download" value="1" <?php 
    echo $_REQUEST['allow_download'] || $_SERVER['REQUEST_METHOD'] === 'GET' ? 'checked' : '';
    ?>
 />
    </td>
</tr>
<?php 
}
Exemplo n.º 11
0
 */
if (!defined('NO_SESSION')) {
    if (isset($_REQUEST['ssid'])) {
        define('NO_SESSION', 1);
        require_once 'lib/init.php';
        if (!Session::exists('stream', $_REQUEST['ssid'])) {
            UI::access_denied();
            exit;
        }
    } else {
        require_once 'lib/init.php';
    }
}
ob_end_clean();
//test that batch download is permitted
if (!defined('NO_SESSION') && !Access::check_function('batch_download')) {
    UI::access_denied();
    exit;
}
/* Drop the normal Time limit constraints, this can take a while */
set_time_limit(0);
$media_ids = array();
$default_name = "Unknown.zip";
$object_type = scrub_in($_REQUEST['action']);
$name = $default_name;
if ($object_type == 'browse') {
    $object_type = $_REQUEST['type'];
}
if (!check_can_zip($object_type)) {
    debug_event('batch', 'Object type `' . $object_type . '` is not allowed to be zipped.', 1);
    UI::access_denied();
Exemplo n.º 12
0
echo scrub_out($libitem->expire_days);
?>
" /></td>
            </tr>
            <tr>
                <td class="edit_dialog_content_header"></td>
                <td><input type="checkbox" name="allow_stream" value="1" <?php 
echo $libitem->allow_stream ? 'checked' : '';
?>
 /> <?php 
echo T_('Allow Stream');
?>
</td>
            </tr>
            <?php 
if (($libitem->object_type == 'song' || $libitem->object_type == 'video') && Access::check_function('download') || Access::check_function('batch_download')) {
    ?>
                    <tr>
                        <td class="edit_dialog_content_header"></td>
                        <td><input type="checkbox" name="allow_download" value="1" <?php 
    echo $libitem->allow_download ? 'checked' : '';
    ?>
 /> <?php 
    echo T_('Allow Download');
    ?>
</td>
                    </tr>
                <?php 
}
?>
        </table>
Exemplo n.º 13
0
 *
 */
UI::show_box_top(T_('Options'), 'info-box');
?>
<div id="information_actions">
<ul>
<li>
    <?php 
echo Ajax::button('?action=basket&type=browse_set&browse_id=' . $browse->id, 'add', T_('Add Search Results'), 'add_search_results');
?>
    <?php 
echo T_('Add Search Results');
?>
</li>
    <?php 
if (Access::check_function('batch_download') && check_can_zip($_REQUEST['type'])) {
    ?>
<li>
    <a rel="nohtml" href="<?php 
    echo AmpConfig::get('web_path');
    ?>
/batch.php?action=browse&amp;type=<?php 
    echo scrub_out($_REQUEST['type']);
    ?>
&amp;browse_id=<?php 
    echo $browse->id;
    ?>
"><?php 
    echo UI::get_icon('batch_download', T_('Batch Download'));
    ?>
</a>
Exemplo n.º 14
0
        ?>
    <td class="cel_userflag" id="userflag_<?php 
        echo $libitem->id;
        ?>
_podcast_episode">
        <?php 
        Userflag::show($libitem->id, 'podcast_episode');
        ?>
    </td>
    <?php 
    }
}
?>
<td class="cel_action">
    <?php 
if (Access::check_function('download') && !empty($libitem->file)) {
    ?>
            <a rel="nohtml" href="<?php 
    echo AmpConfig::get('web_path');
    ?>
/stream.php?action=download&amp;podcast_episode_id=<?php 
    echo $libitem->id;
    ?>
"><?php 
    echo UI::get_icon('download', T_('Download'));
    ?>
</a>
        <?php 
}
if (Access::check('interface', '50')) {
    ?>