public function absolute_url_for($to) { $old_base = URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']); $args = func_get_args(); $url = call_user_func_array(array($this, 'url_for'), $args); URLHelper::setBaseURL($old_base); return $url; }
public function getURL($absolute_url = false) { if ($absolute_url) { $old_base = URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']); } $url = URLHelper::getURL("plugins.php/pluginmarket/presenting/image/" . $this->getId(), array(), true); if ($absolute_url) { URLHelper::setBaseURL($old_base); } return $url; }
// 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. // +---------------------------------------------------------------------------+ ob_start(); require '../lib/bootstrap.php'; page_open(array("sess" => "Seminar_Session", "auth" => "Seminar_Default_Auth", "perm" => "Seminar_Perm", "user" => "Seminar_User")); require_once 'lib/datei.inc.php'; //basename() needs setlocale() init_i18n($_SESSION['_language']); // Set Base URL, otherwise links will fail on SENDFILE_LINK_MODE = rewrite URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']); $file_id = escapeshellcmd(basename(Request::get('file_id'))); $type = Request::int('type'); if ($type < 0 || $type > 7) { $type = 0; } $document = new StudipDocument($file_id); $object_id = $document->getValue('seminar_id'); $no_access = true; //download from course or institute or document is a message attachement if ($object_id && in_array($type, array(0, 6, 7))) { $no_access = !$document->checkAccess($GLOBALS['user']->id); } //download from archive, allowed if former participant if ($type == 1) { $query = "SELECT seminar_id FROM archiv WHERE archiv_file_id = ?";
public function testSetBaseURL() { $this->assertEquals('foo/bar', URLHelper::getLink('foo/bar')); $this->assertEquals('/foo/bar', URLHelper::getLink('/foo/bar')); $this->assertEquals('http://www.studip.de/foo/bar', URLHelper::getLink('http://www.studip.de/foo/bar')); URLHelper::setBaseURL('/dir/'); $this->assertEquals('/dir/foo/bar', URLHelper::getLink('foo/bar')); $this->assertEquals('/foo/bar', URLHelper::getLink('/foo/bar')); $this->assertEquals('http://www.studip.de/foo/bar', URLHelper::getLink('http://www.studip.de/foo/bar')); URLHelper::setBaseURL('http://cnn.com/test/'); $this->assertEquals('http://cnn.com/test/foo/bar', URLHelper::getLink('foo/bar')); $this->assertEquals('http://cnn.com/foo/bar', URLHelper::getLink('/foo/bar')); $this->assertEquals('http://www.studip.de/foo/bar', URLHelper::getLink('http://www.studip.de/foo/bar')); }
public function getDownloadLink($inline = false, $absolute = false) { if ($absolute) { $old_base_url = URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']); } $url = $inline ? URLHelper::getURL('dispatch.php/document/download/' . $this->id . '/inline', array(), true) : URLHelper::getURL('dispatch.php/document/download/' . $this->id, array(), true); if ($absolute) { URLHelper::setBaseURL($old_base_url); } return $url; }
function getPluginText($plugin, $range_id, $r_data, $m_name) { $base_url = URLHelper::setBaseURL(''); $nav = $plugin->getIconNavigation($range_id, $r_data['visitdate'], $GLOBALS['user']->id); UrlHelper::setBaseURl($base_url); if ($nav instanceof Navigation && $nav->isVisible(true)) { if ($nav->getBadgeNumber()) { $url = 'seminar_main.php?again=yes&auswahl=' . $range_id . '&redirect_to=' . strtr($nav->getURL(), '?', '&'); $icon = $nav->getImage(); $tab = array_pop($plugin->getTabNavigation()); if ($tab instanceof Navigation && $tab->isVisible()) { $text = $tab->getTitle(); } if (!$text) { $text = $this->registered_modules[$m_name]['name']; } if ($nav->getBadgeNumber() == 1) { $text .= ' - ' . _("Ein neuer Beitrag:"); } else { $text .= ' - ' . sprintf(_("%s neue Beiträge:"), $nav->getBadgeNumber()); } return compact('text', 'url', 'icon', 'range_id'); } else { return null; } } }