Example #1
0
 /**
  * Searches for stuff
  */
 public function actionSearch()
 {
     $query = isset($_GET['q']) ? $_GET['q'] : null;
     // Scope
     $users = null;
     $shares = null;
     if ($query != null) {
         // Make the criteria object
         $userCriteria = new CDbCriteria();
         $searchCriteria = new CDbCriteria();
         // If there is a @ symbol, do a user search
         preg_match_all('/@([A-Za-z0-9\\/\\.]*)/', $query, $matches);
         $mentions = implode(',', $matches[1]);
         if (!empty($matches[1])) {
             $userCriteria->addInCondition('username', $matches[1]);
             $users = User::model()->findAll($userCriteria);
             // Remove the @users from the remaining query
             foreach ($matches[1] as $u) {
                 $query = str_replace('@' . $u, '', $query);
             }
         }
         // Do a like Query
         $searchCriteria->addSearchCondition('text', $query);
         $searchCriteria->limit = 30;
         $shares = Share::model()->findAll($searchCriteria);
     }
     // Render the search
     $this->render('search', array('users' => $users, 'shares' => $shares));
 }
 public function actionIndex()
 {
     //   $refreshTime= UserRefreshForm::model()->findByPk(Yii::app()->user->userId)->refreshTime;
     $currentTime = time();
     //   UserRefreshForm::model()->updateByPk(Yii::app()->user->userId, array('refreshTime'=>$currentTime));
     $criteria = new CDbCriteria();
     $mFriends = new MFriends();
     $friendsList = $mFriends->getFriendsList();
     array_push($friendsList, Yii::app()->user->userId);
     $criteria->select = 't.*,count(tbl_myr_share_comment.shareId) as count';
     $criteria->join = 'LEFT JOIN tbl_myr_share_comment ON tbl_myr_share_comment.shareId=t.shareId';
     // $criteria->addCondition('t.createTime>='.$refreshTime);
     $criteria->addInCondition('t.userId', $friendsList);
     $criteria->group = 't.shareId';
     $criteria->order = 't.shareId DESC';
     $share = Share::model();
     $total = $share->count($criteria);
     $pager = new CPagination($total);
     $pager->pageSize = 10;
     $pager->applyLimit($criteria);
     $shareList = $share->findAll($criteria);
     $dataFormat = new DataFormat();
     $format = array();
     $format = $dataFormat->format($shareList);
     $data = array('shareList' => $format, 'pages' => $pager);
     if ($total > 0) {
         $clientFlash = new ClientFlash();
         $clientFlash->pushMobile(0, $format);
     } else {
         _echo(3, 'data empty');
     }
     $this->render('index', $data);
 }
Example #3
0
 public function show($id)
 {
     $course = $this->course->with(['modules'])->findBySlugOrIdOrFail($id);
     $modules = $course->modules;
     $courses = $this->course->all();
     $sharer = \Share::load(route('learning.course.show', $course->slug), trans('course::show.messages.sharer', ['name' => $course->name]))->services('facebook', 'gplus', 'twitter');
     return \Theme::view('courses/learning/show', compact('course', 'modules', 'sharer', 'courses'));
 }
 /**
  * Display the specified sharetransaction.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $account = Shareaccount::findOrFail($id);
     $credit = DB::table('sharetransactions')->where('shareaccount_id', '=', $account->id)->where('type', '=', 'credit')->sum('amount');
     $debit = DB::table('sharetransactions')->where('shareaccount_id', '=', $account->id)->where('type', '=', 'debit')->sum('amount');
     $balance = $credit - $debit;
     $sh = Share::findOrFail(1);
     $sharevalue = $sh->value;
     if ($sharevalue != 0) {
         $shares = $balance / $sharevalue;
     } else {
         $shares = 0;
     }
     return View::make('sharetransactions.show', compact('account', 'shares'));
 }
Example #5
0
 /**
  * @param bool $permanent
  */
 public function __construct($permanent = true)
 {
     static $mh_cache, $ch_cache;
     if (!$permanent || !$mh_cache) {
         $mh_cache = curl_multi_init();
         $ch_cache = array();
         for ($i = 0; $i < self::MAX_CONNECTIONS; ++$i) {
             $ch = curl_init();
             Share::setup($ch);
             $ch_cache[] = $ch;
         }
     }
     $this->mh = $mh_cache;
     $this->unused = $ch_cache;
     $this->permanent = $permanent;
     // for PHP<5.5 @see getFinishedResults()
     $this->blackhole = fopen('php://temp', 'wb');
 }
Example #6
0
$seo_data['description'] = $description;
seo::set($seo_data);
?>
<script type="text/javascript" charset="UTF-8" src="<?php 
echo BASE_URL;
?>
/runtime/_systemjs/artTemplate/artTemplate.js"></script><script type="text/javascript" charset="UTF-8" src="<?php 
echo BASE_URL;
?>
/runtime/_systemjs/artTemplate/artTemplate-plugin.js"></script>
<script type="text/javascript" charset="UTF-8" src="<?php 
echo BASE_URL;
?>
/runtime/_systemjs/cookie/jquery.cookie.js"></script>
<?php 
$shareInstance = new Share();
$shareInstance->show();
$breadGuide = goods_class::catRecursion($category);
?>

<link rel="stylesheet" type="text/css" href="<?php 
echo IUrl::creatUrl("") . "views/" . $this->theme . "/javascript/jquery.jqzoom/css/jquery.jqzoom.css";
?>
" />
<script type="text/javascript" src="<?php 
echo IUrl::creatUrl("") . "views/" . $this->theme . "/javascript/jquery.jqzoom/js/jquery.jqzoom-core-pack.js";
?>
"></script>

<link rel="stylesheet" type="text/css" href="<?php 
echo IUrl::creatUrl("") . "views/" . $this->theme . "/javascript/jquery.bxSlider/jquery.bxslider.css";
?>
</th>
            <th class="cel_public_url essential"><?php 
echo T_('Public Url');
?>
</th>
            <th class="cel_action  essential"><?php 
echo T_('Actions');
?>
</th>
        </tr>
    </thead>
    <tbody>
    <?php 
foreach ($object_ids as $share_id) {
    $libitem = new Share($share_id);
    $libitem->format();
    ?>
    <tr id="share_<?php 
    echo $libitem->id;
    ?>
" class="<?php 
    echo UI::flip_class();
    ?>
">
        <?php 
    require AmpConfig::get('prefix') . UI::find_template('show_share_row.inc.php');
    ?>
    </tr>
    <?php 
}
Example #8
0
function moveSize(Share $obj)
{
    $obj->movBy(10, 0);
    $obj->resizeBy(10);
}
Example #9
0
                $limit = $browse->get_offset();
                if ($limit > 0 && $value > 0) {
                    $total = $browse->get_total();
                    $pages = ceil($total / $limit);
                    if ($value <= $pages) {
                        $offset = ($value - 1) * $limit;
                        $browse->set_start($offset);
                    }
                }
                break;
        }
        ob_start();
        $browse->show_objects(null, $argument);
        $results[$browse->get_content_div()] = ob_get_clean();
        break;
    case 'get_share_links':
        $object_type = $_REQUEST['object_type'];
        $object_id = intval($_REQUEST['object_id']);
        if (Core::is_library_item($object_type) && $object_id > 0) {
            Share::display_ui_links($object_type, $object_id);
            exit;
        }
        break;
    default:
        $results['rfc3514'] = '0x1';
        break;
}
// switch on action;
$browse->store();
// We always do this
echo xoutput_from_array($results);
Example #10
0
 /**
  * updateShare
  * Update the description and/or expiration date for an existing share.
  * Takes the share id to update with optional description and expires parameters.
  * Not supported.
  */
 public static function updateshare($input)
 {
     self::check_version($input, "1.6.0");
     $id = self::check_parameter($input, 'id');
     $description = $input['description'];
     if (AmpConfig::get('share')) {
         $share = new Share($id);
         if ($share->id > 0) {
             $expires = $share->expire_days;
             if (isset($input['expires'])) {
                 // Parse as a string to work on 32-bit computers
                 $expires = $input['expires'];
                 if (strlen($expires) > 3) {
                     $expires = intval(substr($expires, 0, -3));
                 }
                 if ($expires > 0) {
                     $expires = ($expires - $share->creation_date) / 86400;
                     $expires = ceil($expires);
                 }
             }
             $data = array('max_counter' => $share->max_counter, 'expire' => $expires, 'allow_stream' => $share->allow_stream, 'allow_download' => $share->allow_download, 'description' => $description ?: $share->description);
             if ($share->update($data)) {
                 $r = Subsonic_XML_Data::createSuccessResponse();
             } else {
                 $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_UNAUTHORIZED);
             }
         } 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);
 }
Example #11
0
 public function actionShares($id = null)
 {
     if ($id == null) {
         if (Yii::app()->user->isGuest) {
             $this->redirect($this->createUrl('site/login'));
         }
         $id = Yii::app()->user->id;
     }
     $shares = Share::model()->findAllByAttributes(array('author_id' => $id));
     $this->render('shares', array('shares' => $shares));
 }
/stream.php?action=download&amp;<?php 
        echo $object_type;
        ?>
_id=<?php 
        echo $libitem->id;
        ?>
">
        <?php 
        echo UI::get_icon('download', T_('Download'));
        ?>
    </a>
    <?php 
    }
    if (Access::check('interface', '25')) {
        if (AmpConfig::get('share')) {
            Share::display_ui($object_type, $libitem->id, false);
        }
    }
    if (get_class($playlist) == "Playlist" && $playlist->has_access()) {
        echo Ajax::button('?page=playlist&action=delete_track&playlist_id=' . $playlist->id . '&track_id=' . $object['track_id'], 'delete', T_('Delete'), 'track_del_' . $object['track_id']);
    }
    ?>
</td>
<?php 
    if (Access::check('interface', '50') && get_class($playlist) == "Playlist") {
        ?>
<td class="cel_drag">
    <?php 
        echo UI::get_icon('drag', T_('Reorder'));
        ?>
        </td>
Example #13
0
 public function run()
 {
     $branch = new Branch();
     $branch->name = 'Head Office';
     $branch->save();
     $currency = new Currency();
     $currency->name = 'Kenyan Shillings';
     $currency->shortname = 'KES';
     $currency->save();
     $organization = new Organization();
     $organization->name = 'Lixnet Technologies';
     $organization->save();
     $share = new Share();
     $share->value = 0;
     $share->transfer_charge = 0;
     $share->charged_on = 'donor';
     $share->save();
     $perm = new Permission();
     $perm->name = 'create_employee';
     $perm->display_name = 'Create employee';
     $perm->category = 'Employee';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'update_employee';
     $perm->display_name = 'Update employee';
     $perm->category = 'Employee';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'delete_employee';
     $perm->display_name = 'Deactivate employee';
     $perm->category = 'Employee';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'view_employee';
     $perm->display_name = 'View employee';
     $perm->category = 'Employee';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'manage_earning';
     $perm->display_name = 'Manage earnings';
     $perm->category = 'Payroll';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'manage_deduction';
     $perm->display_name = 'Manage deductions';
     $perm->category = 'Payroll';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'manage_allowance';
     $perm->display_name = 'Manage allowance';
     $perm->category = 'Payroll';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'manage_relief';
     $perm->display_name = 'Manage releif';
     $perm->category = 'Payroll';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'manage_benefit';
     $perm->display_name = 'Manage benefits';
     $perm->category = 'Payroll';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'process_payroll';
     $perm->display_name = 'Process payroll';
     $perm->category = 'Payroll';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'view_payroll_report';
     $perm->display_name = 'View reports';
     $perm->category = 'Payroll';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'manage_settings';
     $perm->display_name = 'Manage settings';
     $perm->category = 'Payroll';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'view_application';
     $perm->display_name = 'View applications';
     $perm->category = 'Leave';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'amend_application';
     $perm->display_name = 'Amend applications';
     $perm->category = 'Leave';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'approve_application';
     $perm->display_name = 'Approve applications';
     $perm->category = 'Leave';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'reject_application';
     $perm->display_name = 'Reject applications';
     $perm->category = 'Leave';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'cancel_application';
     $perm->display_name = 'Cancel applications';
     $perm->category = 'Leave';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'manage_type';
     $perm->display_name = 'Manage leave types';
     $perm->category = 'Leave';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'manage_holiday';
     $perm->display_name = 'Manage holidays';
     $perm->category = 'Leave';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'view_leave_report';
     $perm->display_name = 'View reports';
     $perm->category = 'Leave';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'manage_organization';
     $perm->display_name = 'manage organization';
     $perm->category = 'Organization';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'manage_branch';
     $perm->display_name = 'manage branches';
     $perm->category = 'Organization';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'manage_group';
     $perm->display_name = 'manage groups';
     $perm->category = 'Organization';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'manage_organization_settings';
     $perm->display_name = 'manage settings';
     $perm->category = 'Organization';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'manage_user';
     $perm->display_name = 'manage users';
     $perm->category = 'System';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'manage_role';
     $perm->display_name = 'manage roles';
     $perm->category = 'System';
     $perm->save();
     $perm = new Permission();
     $perm->name = 'manage_audit';
     $perm->display_name = 'manage audits';
     $perm->category = 'System';
     $perm->save();
     $perms = Permission::all();
     $pers = array();
     foreach ($perms as $p) {
         $pers[] = $p->id;
     }
     $role = new Role();
     $role->name = 'superadmin';
     $role->save();
     $role->perms()->sync($pers);
     $data = array('username' => 'superadmin', 'email' => '*****@*****.**', 'password' => 'superadmin', 'password_confirmation' => 'superadmin', 'user_type' => 'admin', 'organization_id' => 1);
     $repo = App::make('UserRepository');
     $user = $repo->register($data);
     $user->attachRole($role);
     /*
         $perm = new Permission;
         $perm->name = 'view_loan_product';
         $perm->display_name = 'view loan products';
         $perm->category = 'Loanproduct';
         $perm->save();
         $perm = new Permission;
         $perm->name = 'delete_loan_product';
         $perm->display_name = 'delete loan products';
         $perm->category = 'Loanproduct';
         $perm->save();
         $perm = new Permission;
         $perm->name = 'create_loan_account';
         $perm->display_name = 'create loan account';
         $perm->category = 'Loanaccount';
         $perm->save();
         $perm = new Permission;
         $perm->name = 'view_loan_account';
         $perm->display_name = 'view loan account';
         $perm->category = 'Loanaccount';
         $perm->save();
         $perm = new Permission;
         $perm->name = 'approve_loan_account';
         $perm->display_name = 'approve loan';
         $perm->category = 'Loanaccount';
         $perm->save();
         $perm = new Permission;
         $perm->name = 'disburse_loan';
         $perm->display_name = 'disburse loan';
         $perm->category = 'Loanaccount';
         $perm->save();
         $perm = new Permission;
         $perm->name = 'view_savings_account';
         $perm->display_name = 'view savings account';
         $perm->category = 'Savingaccount';
         $perm->save();
         $perm = new Permission;
         $perm->name = 'open_saving_account';
         $perm->display_name = 'Open savings account';
         $perm->category = 'Savingaccount';
         $perm->save();
     */
 }
        ?>
                </a>
            <?php 
    }
    ?>
        <?php 
}
?>
        <?php 
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'));
Example #15
0
?>
</td>
    <td>
        <?php 
echo $object->f_link;
?>
    </td>
</tr>
<tr>
    <td><?php 
echo T_('Secret');
?>
</td>
    <td>
        <input type="text" name="secret" value="<?php 
echo scrub_out($_REQUEST['secret'] ?: Share::generate_secret());
?>
" />
        <?php 
AmpError::display('secret');
?>
    </td>
</tr>
<tr>
    <td><?php 
echo T_('Max Counter');
?>
</td>
    <td>
        <input type="text" name="max_counter" value="<?php 
echo scrub_out($_REQUEST['max_counter'] ?: '0');
 /**
  * Get Share Info - get the share info of a folder
  *
  * @param folderId - required -
  * 		Id of the folder.
  * @return The Share object containing the share folder info or the error status of the operation.
  */
 public function getShareInfo($folderId)
 {
     $urld = 'dpi/v1/folder/' . $folderId . '/share';
     $parameters = array();
     $this->response = $this->restTransportInstance->sendRequest($urld, $parameters, self::HTTP_GET, $this->authToken);
     $responseBody = simplexml_load_string($this->response);
     $returnObject = new Share();
     if ($responseBody === false) {
         $errorCode = 'N/A';
         $errorMessage = 'The server has encountered an error, please try again.';
         $errorObject = new ErrorStatus($errorCode, $errorMessage);
         $returnObject->setErrorStatus($errorObject);
     } else {
         $errorStatus = $responseBody->errorStatus;
         if (empty($errorStatus)) {
             if ($responseBody->count() > 0) {
                 $members = array();
                 foreach ($responseBody->children() as $child) {
                     $member = new Member();
                     $member->setStatus((string) $child->status);
                     $member->setCanInvite((string) $child->canInvite);
                     $member->setCanRead((string) $child->canRead);
                     $member->setCanWrite((string) $child->canWrite);
                     $member->setEmail((string) $child->email);
                     $member->setInvitationKey((string) $child->invitationKey);
                     array_push($members, $member);
                 }
                 $returnObject->setMembers($members);
             }
         } else {
             $errorCode = (string) $responseBody->errorStatus->code;
             $errorMessage = (string) $responseBody->errorStatus->message;
             $errorObject = new ErrorStatus($errorCode, $errorMessage);
             $returnObject->setErrorStatus($errorObject);
         }
     }
     return $returnObject;
 }
Example #17
0
                        debug_event('UI::access_denied', 'Streaming access denied: ' . $GLOBALS['user']->username . "'s session has expired", 3);
                        header('HTTP/1.1 403 Session Expired');
                        exit;
                    }
                }
            }
            // Now that we've confirmed the session is valid
            // extend it
            Session::extend($sid, 'stream');
        }
    }
    /* Update the users last seen information */
    $GLOBALS['user']->update_last_seen();
} else {
    $secret = $_REQUEST['share_secret'];
    $share = new Share($share_id);
    if (!$share->is_valid($secret, 'stream')) {
        header('HTTP/1.1 403 Access Unauthorized');
        exit;
    }
    if (!$share->is_shared_media($oid)) {
        header('HTTP/1.1 403 Access Unauthorized');
        exit;
    }
    $GLOBALS['user'] = new User($share->user);
    Preference::init();
}
/* If we are in demo mode.. die here */
if (AmpConfig::get('demo_mode') || !Access::check('interface', '25')) {
    debug_event('UI::access_denied', "Streaming Access Denied:" . AmpConfig::get('demo_mode') . "is the value of demo_mode. Current user level is " . $GLOBALS['user']->access, '3');
    UI::access_denied();
Example #18
0
        ?>
</a>
            <?php 
    }
    ?>
        <?php 
}
?>
    <?php 
if (Access::check('interface', '25')) {
    ?>
            <?php 
    if (AmpConfig::get('share')) {
        ?>
                <?php 
        Share::display_ui('video', $video->id, false);
        ?>
            <?php 
    }
    ?>
        <?php 
}
?>
        <?php 
if (Access::check_function('download')) {
    ?>
            <a rel="nohtml" href="<?php 
    echo Video::play_url($video->id);
    ?>
"><?php 
    echo UI::get_icon('link', T_('Link'));
Example #19
0
 /**
  * deleteShare
  * Delete an existing share.
  * Takes the share id to delete in parameters.
  */
 public static function deleteshare($input)
 {
     self::check_version($input, "1.6.0");
     $id = self::check_parameter($input, 'id');
     if (AmpConfig::get('share')) {
         if (Share::delete_share($id)) {
             $r = Subsonic_XML_Data::createSuccessResponse();
         } 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);
 }
<?php

/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
 *
 * LICENSE: GNU General Public License, version 2 (GPLv2)
 * Copyright 2001 - 2014 Ampache.org
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License v2
 * as published by the Free Software Foundation.
 *
 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */
$object_ids = Share::get_share_list();
$browse = new Browse();
$browse->set_type('share');
$browse->set_static_content(true);
$browse->save_objects($object_ids);
$browse->show_objects($object_ids);
$browse->store();
Example #21
0
</a>
            <?php 
    }
    ?>
        <?php 
}
?>
    <?php 
if (Access::check('interface', '25')) {
    ?>
            <?php 
    if (AmpConfig::get('share')) {
        ?>
            <li>
                <?php 
        Share::display_ui('album', $album->id);
        ?>
            </li>
            <?php 
    }
    ?>
        <?php 
}
?>
        <?php 
if ($owner_id > 0 && $owner_id == $GLOBALS['user']->id || Access::check('interface', '50')) {
    ?>
        <?php 
    if (AmpConfig::get('statistical_graphs')) {
        ?>
            <li>
Example #22
0
 /**
  * Remove the specified share from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Share::destroy($id);
     return Redirect::route('shares.index');
 }
Example #23
0
/shout.php?action=show_add_shout&type=album&amp;id=<?php 
        echo $libitem->id;
        ?>
">
            <?php 
        echo UI::get_icon('comment', T_('Post Shout'));
        ?>
        </a>
    <?php 
    }
    if (Access::check('interface', '25')) {
        if (AmpConfig::get('share') && (!$libitem->allow_group_disks || $libitem->allow_group_disks && !count($libitem->album_suite))) {
            Share::display_ui('album', $libitem->id, false);
        }
        if (AmpConfig::get('share') && (!$libitem->allow_group_disks || $libitem->allow_group_disks && !count($libitem->album_suite))) {
            Share::display_ui('album', $libitem->id, false);
        }
    }
    if (Access::check_function('batch_download') && check_can_zip('album')) {
        ?>
            <a rel="nohtml" href="<?php 
        echo AmpConfig::get('web_path');
        ?>
            /batch.php?action=album&<?php 
        echo $libitem->get_http_album_query_ids('id');
        ?>
">
                <?php 
        echo UI::get_icon('batch_download', T_('Batch Download'));
        ?>
            </a>
Example #24
0
/**
 * 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');
        UI::access_denied();
        exit;
    }
}
// access_control is enabled
$id = $_REQUEST['id'];
$secret = $_REQUEST['secret'];
$share = new Share($id);
if (empty($action) && $share->id) {
    if ($share->allow_stream) {
        $action = 'stream';
    } elseif ($share->allow_download) {
        $action = 'download';
    }
}
if (!$share->is_valid($secret, $action)) {
    UI::access_denied();
    exit;
}
$share->format();
$share->save_access();
if ($action == 'download') {
    if ($share->object_type == 'song' || $share->object_type == 'video') {
Example #25
0
        ?>
/shout.php?action=show_add_shout&type=video&id=<?php 
        echo $libitem->id;
        ?>
"><?php 
        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'));
    ?>
Example #26
0
    function getMinimumShareId($iCount, $current_upstream)
    {
        // We don't use baseline here to be more accurate
        $iCount = $iCount * pow(2, $this->config['difficulty'] - 16);
        $stmt = $this->mysqli->prepare("\n      SELECT MIN(b.id) AS id FROM\n      (\n        SELECT id, @total := @total + IF(difficulty=0, POW(2, (" . $this->config['difficulty'] . " - 16)), difficulty) AS total\n        FROM {$this->table}, (SELECT @total := 0) AS a\n        WHERE our_result = 'Y'\n        AND id <= ? AND @total < ?\n        ORDER BY id DESC\n      ) AS b\n      WHERE total <= ?");
        if ($this->checkStmt($stmt) && $stmt->bind_param('iii', $current_upstream, $iCount, $iCount) && $stmt->execute() && ($result = $stmt->get_result())) {
            return $result->fetch_object()->id;
        }
        return $this->sqlError();
    }
    /**
     * Fetch the lowest needed share ID from archive
     **/
    function getMinArchiveShareId($iCount)
    {
        // We don't use baseline here to be more accurate
        $iCount = $iCount * pow(2, $this->config['difficulty'] - 16);
        $stmt = $this->mysqli->prepare("\n      SELECT MIN(b.share_id) AS share_id FROM\n      (\n        SELECT share_id, @total := @total + IF(difficulty=0, POW(2, (" . $this->config['difficulty'] . " - 16)), difficulty) AS total\n        FROM {$this->tableArchive}, (SELECT @total := 0) AS a\n        WHERE our_result = 'Y'\n        AND @total < ?\n        ORDER BY share_id DESC\n      ) AS b\n      WHERE total <= ?\n      ");
        if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $iCount, $iCount) && $stmt->execute() && ($result = $stmt->get_result())) {
            return $result->fetch_object()->share_id;
        }
        return $this->sqlError();
    }
}
$share = new Share();
$share->setDebug($debug);
$share->setMysql($mysqli);
$share->setConfig($config);
$share->setUser($user);
$share->setBlock($block);
$share->setErrorCodes($aErrorCodes);
            ?>
/shout.php?action=show_add_shout&type=album&id=<?php 
            echo $c_album->id;
            ?>
"><?php 
            echo UI::get_icon('comment', T_('Post Shout'));
            ?>
</a>
            <?php 
        }
        ?>
            <?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');
Example #28
0
            <a href="<?php 
            echo AmpConfig::get('web_path');
            ?>
/shout.php?action=show_add_shout&type=song&id=<?php 
            echo $libitem->id;
            ?>
"><?php 
            echo UI::get_icon('comment', T_('Post Shout'));
            ?>
</a>
        <?php 
        }
    }
    if (Access::check('interface', '25')) {
        if (AmpConfig::get('share')) {
            Share::display_ui('song', $libitem->id, false);
        }
    }
    if (Access::check_function('download')) {
        ?>
        <a rel="nohtml" href="<?php 
        echo AmpConfig::get('web_path');
        ?>
/stream.php?action=download&song_id=<?php 
        echo $libitem->id;
        ?>
"><?php 
        echo UI::get_icon('download', T_('Download'));
        ?>
</a>
<?php 
Example #29
0
        <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')) {
    if (AmpConfig::get('share')) {
        Share::display_ui('playlist', $libitem->id, false);
    }
}
if ($libitem->has_access()) {
    ?>
    <a id="<?php 
    echo 'edit_playlist_' . $libitem->id;
    ?>
" onclick="showEditDialog('playlist_row', '<?php 
    echo $libitem->id;
    ?>
', '<?php 
    echo 'edit_playlist_' . $libitem->id;
    ?>
', '<?php 
    echo T_('Playlist edit');
?>
</th>
            <th class="cel_public_url essential"><?php 
echo T_('Public Url');
?>
</th>
            <th class="cel_action  essential"><?php 
echo T_('Actions');
?>
</th>
        </tr>
    </thead>
    <tbody>
    <?php 
foreach ($object_ids as $share_id) {
    $share = new Share($share_id);
    $share->format();
    ?>
    <tr id="share_<?php 
    echo $share->id;
    ?>
" class="<?php 
    echo UI::flip_class();
    ?>
">
        <?php 
    require AmpConfig::get('prefix') . '/templates/show_shared_object_row.inc.php';
    ?>
    </tr>
    <?php 
}