示例#1
0
 /**
  * @brief showing up roundcube iFrame
  * @param path to roundcube installation, Note: The first parameter is the URL-path of the RC inst  NOT the file-system path http://host.com/path/to/roundcube/ --> "/path/to/roundcube" $maildir
  * @param roundcube username $ownUser
  * @param roundcube password $ownPass
  *
  */
 public static function showMailFrame($maildir, $ownUser, $ownPass)
 {
     // Create RC login object.
     $rcl = new RoundcubeLogin($maildir);
     try {
         // Try to login
         OCP\Util::writeLog('roundcube', 'Trying to log into roundcube webinterface under ' . $maildir . ' as user ' . $ownUser, OCP\Util::DEBUG);
         if ($rcl->isLoggedIn()) {
             $rcl->logout();
             $rcl = new RoundcubeLogin($maildir);
         }
         if ($rcl->login($ownUser, $ownPass)) {
             OCP\Util::writeLog('roundcube', 'Successfully logged into roundcube ', OCP\Util::DEBUG);
         } else {
             // If the login fails, display an error message in the loggs
             OCP\Util::writeLog('roundcube', 'RoundCube can\'t login to roundcube due to a login error to roundcube', OCP\Util::ERROR);
         }
         OCP\Util::writeLog('roundcube', 'Preparing iFrame for roundcube:' . $rcl->getRedirectPath(), OCP\Util::DEBUG);
         // loadign image
         $loader_image = OCP\Util::imagePath('roundcube', 'loader.gif');
         $removeHeaderNav = OCP\Config::getAppValue('roundcube', 'removeHeaderNav', '');
         if (strcmp($removeHeaderNav, '1') == 0) {
             $disable_header_nav = 'true';
         } else {
             $disable_header_nav = 'false';
         }
         // create iFrame begin
         echo '<img src="' . $loader_image . '" id="loader">';
         echo '<iframe  style="display:none" src="' . $rcl->getRedirectPath() . '" id="roundcubeFrame" name="roundcube" width="100%" width="100%"> </iframe>';
         echo '<input type="hidden" id="disable_header_nav" value="' . $disable_header_nav . '"/>';
         echo '<script type="text/javascript" src="apps/roundcube/js/mailFrameScripts.js"></script>';
         // create iFrame end
     } catch (RoundcubeLoginException $ex) {
         echo "ERROR: Technical problem, " . $ex->getMessage();
         $rcl->dumpDebugStack();
         exit;
         OCP\Util::writeLog('roundcube', 'RoundCube can\'t login to roundcube due to a login exception to roundcube', OCP\Util::ERROR);
     }
 }