Ejemplo n.º 1
0
$plugin_dir = $plugin_folder.$plugin_name;


include ($plugin_dir."/config/config_default.php");
include ($plugin_dir."/config/config.php");
include ($plugin_dir."/server/utility.php");
include ($plugin_dir."/server/bootstrap.php");

//include commsy auth interface
include ($plugin_dir.'/commsy_auth.php');
$auth = new CommsyAuthManager($environment);

include_once($plugin_dir.'/server/db_mysql.php');
$mediabirdDb = new MediabirdDboMySql();

if ( !$mediabirdDb->connect() ) {
   include_once('function/error_function.php');
   trigger_error('cannot open database - aborting execution',E_USER_ERROR);
   exit();
}


if(isset($id) && $id>0){

$controller = new MediabirdController($mediabirdDb, $auth);
$record = $controller->Files->checkFileAuth($id);

if($record){
	//render and read the image of that page
		if($record->type == MediabirdConstants::fileTypePdf) {
			if(!isset($_GET['page']) || !is_numeric($_GET['page'])) {
Ejemplo n.º 2
0
   public function getDetailActionAsHTML () {
      $retour = '';
      $current_user = $this->_environment->getCurrentUserItem();
      if ( $this->_environment->inPrivateRoom() ) {
         $own_room = $this->_environment->getCurrentContextItem();
      } else {
         $own_room = $current_user->getOwnRoom();
      }
      if ( isset($own_room)
           and !$current_user->isOnlyReadUser()
         ) {

         $system = 'mediabird';

         $url_params = array();
         $url_params['name'] = $system;
         $url_params['SID'] = $this->_environment->getSessionID();
         include_once('functions/security_functions.php');
         $url_params['security_token'] = getToken();
         $url_params['output'] = 'pure';

         $plugin_folder = 'plugins';
         $plugin_name = '/mediabird';
         $plugin_dir = $plugin_folder.$plugin_name;

         $commsyUrl = $this->_getContentLink();

         include_once($plugin_dir.'/config/config_default.php');
         include($plugin_dir.'/config/config.php');
         include_once($plugin_dir.'/server/helper.php');
         include_once($plugin_dir.'/server/utility.php');
         include_once($plugin_dir.'/server/dbo.php');
         include_once($plugin_dir.'/server/db_mysql.php');
         global $mediabirdDb;
         $mediabirdDb = new MediabirdDboMySql();
         $helper = new MediabirdHtmlHelper();

         $userId = $this->_getMBUserID();

         if($mediabirdDb->connect()) {
            $relatedNotes = $helper->findRelatedNotes($commsyUrl,$userId,$mediabirdDb);
            $title = $this->_translator->getMessage('MEDIABIRD_ACTION_ICON_USER_TITLE');
            if($relatedNotes && count($relatedNotes[0])>0) {					// there are own notices
               $card_id = $relatedNotes[0][0];
               $img = ucfirst($this->_translator->getMessage('MEDIABIRD_ACTION_NAME_DETAIL')).' ('.count($relatedNotes[0]).')';
            }
            else { //no related notes yet
               $img = ucfirst($this->_translator->getMessage('MEDIABIRD_ACTION_NAME_DETAIL'));

               //determine the card the user's been to most recently
               if(isset($userId) && ($sessionRecord = $mediabirdDb->getRecord(MediabirdConfig::tableName("Session",true),"user_id=$userId"))) {
                  $card_id = $sessionRecord->card_id;
               }
            }

            $mediabirdDb->disconnect();
         } else {
            $title = $this->_translator->getMessage('MEDIABIRD_ACTION_ICON_USER_TITLE');
            $img = ucfirst($this->_translator->getMessage('MEDIABIRD_ACTION_NAME_DETAIL'));
         }

         $retour = '<a href="javascript:void(0)" id="mediabirdLink" title="'.$title.'">'.$img.'</a>'.LF;

         $frameUrl  = _curl(false,$this->_environment->getCurrentContextID(),$system,'index',$url_params);
         $frameUrl .= "&mb_url=".urlencode($commsyUrl);

         if ( !empty( $card_id ) ) {
            $frameUrl .= "&mb_card_id=".urlencode($card_id);
         }

         $titleHtml = '<div class="title">'.$this->_translator->getMessage('MEDIABIRD_OVERLAY_TITLE').'</div>';

         $retour .= '<div id="mediabirdOverlay" class="mediabird-overlay">'.LF;
         $retour .= '   <div class="bar"><a href="javascript:void(0)" class="closer">X</a><a href="javascript:void(0)" class="expander expanded"></a>'.$titleHtml.'</div>'.LF;
         $retour .= '   <div class="resize-handle right"></div>'.LF;
         $retour .= '   <div class="resize-handle"></div>'.LF;
         $retour .= '   <iframe src="" frameborder="no" scrolling="no" id="mediabirdFrame">'.LF;
         $retour .= '   </iframe>'.LF;
         $retour .= '</div>'.LF;
         $retour .= '<script type="text/javascript" src="'.$plugin_dir.'/js/overlay.js"></script>'.LF;
         $retour .= '<link rel="stylesheet" href="'.$plugin_dir.'/css/overlay_commsy.php?cid='.$this->_environment->getCurrentContextID().'"/>'.LF;
         $retour .= '<script type="text/javascript">'.LF;
         $retour .= '//<![CDATA['.LF;
         $retour .= '   mbOverlay.MAX_HEIGHT = 544;'.LF;
         $retour .= '   mbOverlay.MAX_WIDTH = 685;'.LF;
         $retour .= '   mbOverlay.SIZE_SECURE = 34;'.LF;
         $retour .= '   var url = "'.$frameUrl.'";'.LF;
         $retour .= '   mbOverlay.doIframe(url,document.getElementById("mediabirdLink"),document.getElementById("mediabirdOverlay"),{width:685,height:544},document.getElementById("mediabirdFrame"));'.LF;
         $retour .= '//]]>'.LF;
         $retour .= '</script>'.LF;

      } elseif ( $current_user->isOnlyReadUser() ) {
         $title = $this->_translator->getMessage('COMMON_NO_ACTION_NEW',$this->_translator->getMessage('MEDIABIRD_OVERLAY_TITLE'));
         $img =  '<img src="'.$this->getActionNotActiveIcon().'" style="vertical-align:bottom;" title="'.$title.'"/>';
         $retour =  $img.LF;
      } else {
         $title = $this->_translator->getMessage('MEDIABIRD_ACTION_ICON_NOT_ACTIVE_TITLE');
         $img =  '<img src="'.$this->getActionNotActiveIcon().'" style="vertical-align:bottom;" title="'.$title.'"/>';
         $retour =  $img.LF;
      }
      return $retour;
   }