/** * Construct auth controller * * @param Request $request * @return AuthController */ function __construct($request) { parent::__construct($request); // if user is using mobile device, redirect it to mobile access login page if (module_loaded('mobile_access') && is_mobile_device(USER_AGENT)) { if ($request->matched_route != 'logout') { $this->redirectTo('mobile_access_login'); } else { $this->redirectTo('mobile_access_logout'); } // if } // if $this->setLayout('application'); }
/** * Check the page availability * The page is unavailable if it's accessed by mobile device and the setting "avail_in_mobile" is set to false * @param $this_page - string, the page location used as a key in $_pages */ function page_available($this_page) { global $_pages; if (is_mobile_device() && isset($_pages[$this_page]["avail_in_mobile"]) && !$_pages[$this_page]["avail_in_mobile"]) { return false; } else { return isset($_pages[$this_page]); } }
function get_system_default_theme() { if (is_mobile_device()) { if ($_SESSION['prefs']['PREF_RESPONSIVE'] == 1 || $_COOKIE['responsive'] == 1) { return 'default'; } else { return 'mobile'; } } else { return 'default'; } }
} $_SESSION['prefs']['PREF_THEME'] = $addslashes($_POST['theme']); $_SESSION['prefs']['PREF_MOBILE_THEME'] = $addslashes($_POST['mobile_theme']); } else { if (isset($_POST['set_default'])) { // Once users select to reset theme to the default theme in user perference popup window, // apply the default theme immediate. See users/pref_wizard/index.php for // resetting other prefs. $_SESSION['prefs']['PREF_THEME'] = 'default'; $_SESSION['prefs']['PREF_MOBILE_THEME'] = 'mobile'; } } // Reset PREF_THEME when: // 1. If PREF_THEME is not set // 2. The request is from the mobile device but PREF_THEME is not a mobile theme if (!isset($_SESSION['prefs']['PREF_THEME']) || $_SESSION['prefs']['PREF_THEME'] == "" || is_mobile_device() && !is_mobile_theme($_SESSION['prefs']['PREF_THEME'])) { // get default $_SESSION['prefs']['PREF_THEME'] = get_default_theme(); } if (!is_dir(AT_SYSTEM_THEME_DIR . $_SESSION['prefs']['PREF_THEME']) && !is_dir(AT_SUBSITE_THEME_DIR . $_SESSION['prefs']['PREF_THEME']) || $_SESSION['prefs']['PREF_THEME'] == '') { $_SESSION['prefs']['PREF_THEME'] = get_system_default_theme(); } // use "mobile" theme for mobile devices. For now, there's only one mobile theme and it's hardcoded. // When more mobile themes come in, this should be changed. if (isset($_SESSION['prefs']['PREF_THEME']) && isset($_SESSION['valid_user']) && $_SESSION['valid_user'] === true) { //check if the theme is enabled $row = queryDB("SELECT status FROM %sthemes WHERE dir_name='%s'", array(TABLE_PREFIX, $_SESSION['prefs']['PREF_THEME']), true); if ($row['status'] == 0) { // get user defined default theme if the preference theme is disabled $default_theme = get_default_theme(); if (!is_dir(AT_SYSTEM_THEME_DIR . $default_theme) && !is_dir(AT_SUBSITE_THEME_DIR . $default_theme)) {
function printMenu($parent_id, $depth, $path, $children, $truncate, $ignore_state, $from = '') { global $cid, $_my_uri, $_base_path, $rtl, $substr, $strlen; static $temp_path; $redirect_to = $from == 'sitemap' ? '1' : '0'; if (!isset($temp_path)) { if ($cid) { $temp_path = $this->getContentPath($cid); } else { $temp_path = $this->getContentPath($_SESSION['s_cid']); } } $highlighted = array(); if (is_array($temp_path)) { foreach ($temp_path as $temp_path_item) { $_SESSION['menu'][$temp_path_item['content_id']] = 1; $highlighted[$temp_path_item['content_id']] = true; } } if ($this->start) { reset($temp_path); $this->start = false; } if (isset($this->_menu[$parent_id]) && is_array($this->_menu[$parent_id])) { $top_level = $this->_menu[$parent_id]; $counter = 1; $num_items = count($top_level); echo '<div id="folder' . $parent_id . $from . '">' . "\n"; foreach ($top_level as $garbage => $content) { $link = ''; //tests do not have content id $content['content_id'] = isset($content['content_id']) ? $content['content_id'] : ''; $content['parent_content_id'] = $parent_id; if (!$ignore_state) { $link .= '<a name="menu' . $content['content_id'] . '"></a>'; } $on = false; if (($_SESSION['s_cid'] != $content['content_id'] || $_SESSION['s_cid'] != $cid) && ($content['content_type'] == CONTENT_TYPE_CONTENT || $content['content_type'] == CONTENT_TYPE_WEBLINK)) { // non-current content nodes with content type "CONTENT_TYPE_CONTENT" if (isset($highlighted[$content['content_id']])) { $link .= '<strong>'; $on = true; } //content test extension @harris //if this is a test link. if (isset($content['test_id'])) { $title_n_alt = $content['title']; $in_link = 'mods/_standard/tests/test_intro.php?tid=' . $content['test_id'] . SEP . 'in_cid=' . $content['parent_content_id']; $img_link = ' <img src="' . $_base_path . 'images/check.gif" title="' . $title_n_alt . '" alt="' . $title_n_alt . '" />'; } else { $in_link = 'content.php?cid=' . $content['content_id']; $img_link = ''; } $full_title = $content['title']; $link .= $img_link . ' <a href="' . $_base_path . htmlentities_utf8(url_rewrite($in_link)) . '" title="'; $base_title_length = 29; if ($_SESSION['prefs']['PREF_NUMBERING']) { $base_title_length = 24; } $link .= $content['title'] . '">'; if ($truncate && $strlen($content['title']) > $base_title_length - $depth * 4) { $content['title'] = htmlspecialchars(rtrim($substr(htmlspecialchars_decode($content['title']), 0, $base_title_length - $depth * 4 - 4))) . '...'; } if (isset($content['test_id'])) { $link .= $content['title']; } else { $link .= '<span class="inlineEdits" id="menu-' . $content['content_id'] . '" title="' . $full_title . '">'; if ($_SESSION['prefs']['PREF_NUMBERING']) { $link .= $path . $counter; } $link .= ' ' . $content['title'] . '</span>'; } $link .= '</a>'; if ($on) { $link .= '</strong>'; } // instructors have privilege to delete content if (authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN) && !isset($content['test_id']) && !is_mobile_device()) { $link .= '<a href="' . $_base_path . 'mods/_core/editor/delete_content.php?cid=' . $content['content_id'] . '&redirect_to=' . $redirect_to . '"><img src="' . AT_BASE_HREF . 'images/x.gif" alt="' . _AT("delete_content") . '" title="' . _AT("delete_content") . '" class="del-content-icon" /></a>'; } } else { // current content page & nodes with content type "CONTENT_TYPE_FOLDER" $base_title_length = 33; if ($_SESSION['prefs']['PREF_NUMBERING']) { $base_title_length = 26; } if (isset($highlighted[$content['content_id']])) { $link .= '<strong>'; $on = true; } if ($content['content_type'] == CONTENT_TYPE_CONTENT || $content['content_type'] == CONTENT_TYPE_WEBLINK) { // current content page $full_title = $content['title']; $link .= '<a href="' . $_my_uri . '"><img src="' . $_base_path . 'images/clr.gif" alt="' . _AT('you_are_here') . ': '; if ($_SESSION['prefs']['PREF_NUMBERING']) { $link .= $path . $counter; } $link .= $content['title'] . '" height="1" width="1" border="0" /></a><strong class="current-content" title="' . $content['title'] . '">' . "\n"; if ($truncate && $strlen($content['title']) > $base_title_length - $depth * 4) { $content['title'] = htmlspecialchars(rtrim($substr(htmlspecialchars_decode($content['title']), 0, $base_title_length - $depth * 4 - 4))) . '...'; } $link .= '<a name="menu' . $content['content_id'] . '"></a><span class="inlineEdits" id="menu-' . $content['content_id'] . '" title="' . $full_title . '">'; if ($_SESSION['prefs']['PREF_NUMBERING']) { $link .= $path . $counter; } $link .= $content['title'] . '</span></strong>'; // instructors have privilege to delete content if (authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN) && !is_mobile_device()) { $link .= '<a href="' . $_base_path . 'mods/_core/editor/delete_content.php?cid=' . $content['content_id'] . '&redirect_to=' . $redirect_to . '"><img src="' . AT_BASE_HREF . 'images/x.gif" alt="' . _AT("delete_content") . '" title="' . _AT("delete_content") . '" class="del-content-icon" /></a>'; } } else { // nodes with content type "CONTENT_TYPE_FOLDER" $full_title = $content['title']; if (authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN) && !is_mobile_device()) { $link .= '<a href="' . $_base_path . "mods/_core/editor/edit_content_folder.php?cid=" . $content['content_id'] . '" title="' . $full_title . _AT('click_edit') . '">' . "\n"; } else { $link .= '<span style="cursor:pointer" onclick="javascript: ATutor.course.toggleFolder(\'' . $content['content_id'] . $from . '\', \'' . _AT('expand') . '\', \'' . _AT('collapse') . '\', ' . $this->course_id . '); ">' . "\n"; } if ($truncate && $strlen($content['title']) > $base_title_length - $depth * 4) { $content['title'] = htmlspecialchars(rtrim($substr(htmlspecialchars_decode($content['title']), 0, $base_title_length - $depth * 4 - 4))) . '...'; } if (isset($content['test_id'])) { $link .= $content['title']; } else { $link .= '<span class="inlineEdits" id="menu-' . $content['content_id'] . '" title="' . $full_title . '">'; } if ($_SESSION['prefs']['PREF_NUMBERING']) { $link .= $path . $counter; } $link .= ' ' . $content['title'] . '</span>'; if (authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN) && !is_mobile_device()) { $link .= '</a>' . "\n"; } else { $link .= '</span>' . "\n"; } // instructors have privilege to delete content if (authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN) && !is_mobile_device()) { $link .= '<a href="' . $_base_path . 'mods/_core/editor/delete_content.php?cid=' . $content['content_id'] . '&redirect_to=' . $redirect_to . '"><img src="' . AT_BASE_HREF . 'images/x.gif" alt="' . _AT("delete_content") . '" title="' . _AT("delete_content") . '" class="del-content-icon" /></a>'; } } if ($on) { $link .= '</strong>'; } } if ($ignore_state) { $on = true; } echo '<span>' . "\n"; if (isset($this->_menu[$content['content_id']]) && is_array($this->_menu[$content['content_id']])) { /* has children */ for ($i = 0; $i < $depth; $i++) { if ($children[$i] == 1) { echo '<img src="' . AT_BASE_HREF . $this->tree_vertline_icon . '" alt="" border="0" width="16" height="16" class="img-size-tree" />' . "\n"; } else { echo '<img src="' . $_base_path . 'images/clr.gif" alt="" border="0" width="16" height="16" class="img-size-tree" />' . "\n"; } } if ($counter == $num_items && $depth > 0) { echo '<img src="' . AT_BASE_HREF . $this->tree_end_icon . '" alt="" border="0" width="16" height="16" class="img-size-tree" />' . "\n"; $children[$depth] = 0; } else { if ($counter == $num_items) { echo '<img src="' . AT_BASE_HREF . $this->tree_end_icon . '" alt="" border="0" width="16" height="16" class="img-size-tree" />' . "\n"; $children[$depth] = 0; } else { echo '<img src="' . AT_BASE_HREF . $this->tree_split_icon . '" alt="" border="0" width="16" height="16" class="img-size-tree" />' . "\n"; $children[$depth] = 1; } } if ($_SESSION['s_cid'] == $content['content_id']) { if (is_array($this->_menu[$content['content_id']])) { $_SESSION['menu'][$content['content_id']] = 1; } } if (isset($_SESSION['menu'][$content['content_id']]) && $_SESSION['menu'][$content['content_id']] == 1) { if ($on) { echo '<a href="javascript:void(0)" onclick="javascript: ATutor.course.toggleFolder(\'' . $content['content_id'] . $from . '\', \'' . _AT('expand') . '\', \'' . _AT('collapse') . '\', ' . $this->course_id . '); "><img src="' . AT_BASE_HREF . $this->tree_collapse_icon . '" id="tree_icon' . $content['content_id'] . $from . '" alt="' . _AT('collapse') . '" border="0" width="16" height="16" title="' . _AT('collapse') . '" class="img-size-tree" /></a>' . "\n"; } else { echo '<a href="' . $_my_uri . 'collapse=' . $content['content_id'] . '">' . "\n"; echo '<img src="' . AT_BASE_HREF . $this->tree_collapse_icon . '" id="tree_icon' . $content['content_id'] . $from . '" alt="' . _AT('collapse') . '" border="0" width="16" height="16" title="' . _AT('collapse') . ' ' . $content['title'] . '" class="img-size-tree" onclick="javascript: ATutor.course.toggleFolder(\'' . $content['content_id'] . $from . '\', \'' . _AT('expand') . '\', \'' . _AT('collapse') . '\', ' . $this->course_id . '); " />' . "\n"; echo '</a>' . "\n"; } } else { if ($on) { echo '<a href="javascript:void(0)" onclick="javascript: ATutor.course.toggleFolder(\'' . $content['content_id'] . $from . '\', \'' . _AT('expand') . '\', \'' . _AT('collapse') . '\', ' . $this->course_id . '); "><img src="' . AT_BASE_HREF . $this->tree_collapse_icon . '" id="tree_icon' . $content['content_id'] . $from . '" alt="' . _AT('collapse') . '" border="0" width="16" height="16" title="' . _AT('collapse') . '" class="img-size-tree" /></a>' . "\n"; } else { echo '<a href="' . $_my_uri . 'expand=' . $content['content_id'] . '">' . "\n"; echo '<img src="' . AT_BASE_HREF . $this->tree_expand_icon . '" id="tree_icon' . $content['content_id'] . $from . '" alt="' . _AT('expand') . '" border="0" width="16" height="16" title="' . _AT('expand') . ' ' . $content['title'] . '" class="img-size-tree" onclick="javascript: ATutor.course.toggleFolder(\'' . $content['content_id'] . $from . '\', \'' . _AT('expand') . '\', \'' . _AT('collapse') . '\', ' . $this->course_id . '); " />'; echo '</a>' . "\n"; } } } else { /* doesn't have children */ if ($counter == $num_items) { for ($i = 0; $i < $depth; $i++) { if ($children[$i] == 1) { echo '<img src="' . AT_BASE_HREF . $this->tree_vertline_icon . '" alt="" border="0" width="16" height="16" class="img-size-tree" />' . "\n"; } else { echo '<img src="' . $_base_path . 'images/clr.gif" alt="" border="0" width="16" height="16" class="img-size-tree" />' . "\n"; } } echo '<img src="' . AT_BASE_HREF . $this->tree_end_icon . '" alt="" border="0" class="img-size-tree" />' . "\n"; } else { for ($i = 0; $i < $depth; $i++) { if ($children[$i] == 1) { echo '<img src="' . AT_BASE_HREF . $this->tree_vertline_icon . '" alt="" border="0" width="16" height="16" class="img-size-tree" />' . "\n"; } else { echo '<img src="' . AT_BASE_HREF . $this->tree_space_icon . '" alt="" border="0" width="16" height="16" class="img-size-tree" />' . "\n"; } } echo '<img src="' . AT_BASE_HREF . $this->tree_split_icon . '" alt="" border="0" width="16" height="16" class="img-size-tree" />' . "\n"; } echo '<img src="' . AT_BASE_HREF . $this->tree_horizontal_icon . '" alt="" border="0" width="16" height="16" class="img-size-tree" />' . "\n"; } echo $link; echo "\n<br /></span>\n\n"; if ($ignore_state || isset($_SESSION['menu'][$content['content_id']]) && $_SESSION['menu'][$content['content_id']] == 1) { $depth++; $this->printMenu($content['content_id'], $depth, $path . $counter . '.', $children, $truncate, $ignore_state, $from); $depth--; } $counter++; } // end of foreach print "</div>\n\n"; } }
function get_system_default_theme() { if (is_mobile_device()) { return 'mobile'; } else { return 'default'; } }
//the html $content_test_rs = $contentManager->getContentTestsAssoc($cid); foreach ($content_test_rs as $content_test_row) { $content_test_ids[] = $content_test_row; } /*TODO***************BOLOGNA***************REMOVE ME**********/ /* the content forums extension page*/ $content_forum_ids = array(); //the html $content_forum_rs = $contentManager->getContentForumsAssoc($cid); foreach ($content_forum_rs as $content_forum_row) { $content_forum_ids[] = $content_forum_row; } // use any styles that were part of the imported document, except on the mobile theme. // $_custom_css = $_base_href.'headstuff.php?cid='.$cid.SEP.'path='.urlEncode($_base_href.$course_base_href.$content_base_href); if (is_mobile_device() == false) { if ($content_row['use_customized_head'] && strlen($content_row['head']) > 0) { $_custom_head .= "\n" . $content_row['head']; } } global $_custom_head; $_custom_head .= ' <script type="text/javascript"> //<!-- jQuery(".tooltip").tooltip(); //--> </script> '; save_last_cid($cid); if (isset($top_num) && $top_num != (int) $top_num) { $top_num = substr($top_num, 0, strpos($top_num, '.'));
function embed_media($text) { global $_base_path; if (preg_match("/\[media(\|[0-9]+\|[0-9]+)?\]*/", $text)==0){ return $text; } // 1. remove the spaces in [media] tag, otherwise, the next line converts URL inside [media] into <a> tag $text = preg_replace("/(\[media\])([\s]*)(.*)(\[\/media\])/", '$1$3$4', $text); $text = preg_replace("/(\[media\])(.*)([\s]*)(\[\/media\])/U", '$1$2$4', $text); $media_matches = array(); $media_replace = array(); // First, we search though the text for all different kinds of media defined by media tags and store the results in $media_matches. // Then the different replacements for the different media tags are stored in $media_replace. // Lastly, we loop through all $media_matches / $media_replaces. (We choose $media_replace as index because $media_matches is multi-dimensioned.) It is important that for each $media_matches there is a $media_replace with the same index. For each media match we check the width/height, or we use the default value of 425x350. We then replace the height/width/media1/media2 parameter placeholders in $media_replace with the correct ones, before running a str_replace on $text, replacing the given media with its correct replacement. // youtube videos if (is_mobile_device() && get_mobile_device_type() == BLACKBERRY_DEVICE) { preg_match_all("#\[media[0-9a-z\|]*\]http://([a-z0-9\.]*)?youtube.com/watch\?v=(.*)\[/media\]#iU",$text,$media_matches[],PREG_SET_ORDER); $media_replace[] = '<script type="text/javascript" src="'.$_base_path.'jscripts/ATutorYouTubeOnBlackberry.js"></script>'."\n". '<p id="blackberry_##MEDIA2##">'."\n". '<script'."\n". ' src="http://gdata.youtube.com/feeds/mobile/videos/##MEDIA2##?alt=json-in-script&callback=ATutor.course.showYouTubeOnBlackberry&format=6" [^]'."\n". ' type="text/javascript">'."\n". '</script>'; } else { preg_match_all("#\[media[0-9a-z\|]*\]http://([a-z0-9\.]*)?youtube.com/watch\?v=(.*)\[/media\]#iU",$text,$media_matches[],PREG_SET_ORDER); $media_replace[] = '<object width="##WIDTH##" height="##HEIGHT##"><param name="movie" value="http://##MEDIA1##youtube.com/v/##MEDIA2##"></param><embed src="http://##MEDIA1##youtube.com/v/##MEDIA2##" type="application/x-shockwave-flash" width="##WIDTH##" height="##HEIGHT##"></embed></object>'; } // .mpg preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+).mpg\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER); $media_replace[] = "<object data=\"##MEDIA1##.mpg\" type=\"video/mpeg\" width=\"##WIDTH##\" height=\"##HEIGHT##\"><param name=\"src\" value=\"##MEDIA1##.mpg\"><param name=\"autoplay\" value=\"false\"><param name=\"autoStart\" value=\"0\"><a href=\"##MEDIA1##.mpg\">##MEDIA1##.mpg</a></object>"; // .avi preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+).avi\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER); $media_replace[] = "<object data=\"##MEDIA1##.avi\" type=\"video/x-msvideo\" width=\"##WIDTH##\" height=\"##HEIGHT##\"><param name=\"src\" value=\"##MEDIA1##.avi\"><param name=\"autoplay\" value=\"false\"><param name=\"autoStart\" value=\"0\"><a href=\"##MEDIA1##.avi\">##MEDIA1##.avi</a></object>"; // .wmv preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+).wmv\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER); $media_replace[] = "<object data=\"##MEDIA1##.wmv\" type=\"video/x-ms-wmv\" width=\"##WIDTH##\" height=\"##HEIGHT##\"><param name=\"src\" value=\"##MEDIA1##.wmv\"><param name=\"autoplay\" value=\"false\"><param name=\"autoStart\" value=\"0\"><a href=\"##MEDIA1##.wmv\">##MEDIA1##.wmv</a></object>"; // .mov preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+).mov\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER); $media_replace[] = "<object classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\" width=\"##WIDTH##\" height=\"##HEIGHT##\">\n". " <param name=\"src\" value=\"##MEDIA1##.mov\">\n". " <param name=\"controller\" value=\"true\">\n". " <param name=\"autoplay\" value=\"false\">\n". " <!--[if gte IE 7] > <!-->\n". " <object type=\"video/quicktime\" data=\"##MEDIA1##.mov\" width=\"##WIDTH##\" height=\"##HEIGHT##\">\n". " <param name=\"controller\" value=\"true\">\n". " <param name=\"autoplay\" value=\"false\">\n". " <a href=\"##MEDIA1##.mov\">##MEDIA1##.mov</a>\n". " </object>\n". " <!--<![endif]-->\n". " <!--[if lt IE 7]>\n". " <a href=\"##MEDIA1##.mov\">##MEDIA1##.mov</a>\n". " <![endif]-->\n". "</object>"; // .swf preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+).swf\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER); $media_replace[] = "<object type=\"application/x-shockwave-flash\" data=\"##MEDIA1##.swf\" width=\"##WIDTH##\" height=\"##HEIGHT##\"> <param name=\"movie\" value=\"##MEDIA1##.swf\"><param name=\"loop\" value=\"false\"><a href=\"##MEDIA1##.swf\">##MEDIA1##.swf</a></object>"; // .mp3 preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+).mp3\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER); $media_replace[] = "<object type=\"audio/mpeg\" data=\"##MEDIA1##.mp3\" width=\"##WIDTH##\" height=\"##HEIGHT##\"><param name=\"src\" value=\"##MEDIA1##.mp3\"><param name=\"autoplay\" value=\"false\"><param name=\"autoStart\" value=\"0\"><a href=\"##MEDIA1##.mp3\">##MEDIA1##.mp3</a></object>"; // .wav preg_match_all("#\[media[0-9a-z\|]*\](.+[^\s\"]+).wav\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER); $media_replace[] ="<object type=\"audio/x-wav\" data=\"##MEDIA1##.wav\" width=\"##WIDTH##\" height=\"##HEIGHT##\"><param name=\"src\" value=\"##MEDIA1##.wav\"><param name=\"autoplay\" value=\"false\"><param name=\"autoStart\" value=\"0\"><a href=\"##MEDIA1##.wav\">##MEDIA1##.wav</a></object>"; // .ogg preg_match_all("#\[media[0-9a-z\|]*\](.+[^\s\"]+).ogg\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER); $media_replace[] ="<object type=\"application/ogg\" data=\"##MEDIA1##.ogg\" width=\"##WIDTH##\" height=\"##HEIGHT##\"><param name=\"src\" value=\"##MEDIA1##.ogg\"><a href=\"##MEDIA1##.ogg\">##MEDIA1##.ogg</a></object>"; // .ogm preg_match_all("#\[media[0-9a-z\|]*\](.+[^\s\"]+).ogm\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER); $media_replace[] ="<object type=\"application/ogm\" data=\"##MEDIA1##.ogm\" width=\"##WIDTH##\" height=\"##HEIGHT##\"><param name=\"src\" value=\"##MEDIA1##.ogm\"><a href=\"##MEDIA1##.ogg\">##MEDIA1##.ogm</a></object>"; // .mid preg_match_all("#\[media[0-9a-z\|]*\](.+[^\s\"]+).mid\[/media\]#i",$text,$media_matches[],PREG_SET_ORDER); $media_replace[] ="<object type=\"application/x-midi\" data=\"##MEDIA1##.mid\" width=\"##WIDTH##\" height=\"##HEIGHT##\"><param name=\"src\" value=\"##MEDIA1##.mid\"><a href=\"##MEDIA1##.mid\">##MEDIA1##.mid</a></object>"; $text = preg_replace("#\[media[0-9a-z\|]*\](.+[^\s\"]+).mid\[/media\]#i", "<object type=\"application/x-midi\" data=\"\\1.mid\" width=\"".$width."\" height=\"".$height."\"><param name=\"src\" value=\"\\1.mid\"><a href=\"\\1.mid\">\\1.mid</a></object>", $text); // Executing the replace for ($i=0;$i<count($media_replace);$i++){ foreach($media_matches[$i] as $media) { //find width and height for each matched media if (preg_match("/\[media\|([0-9]*)\|([0-9]*)\]*/", $media[0], $matches)) { $width = $matches[1]; $height = $matches[2]; } else { $width = 425; $height = 350; } //replace media tags with embedded media for each media tag $media_input = $media_replace[$i]; $media_input = str_replace("##WIDTH##","$width",$media_input); $media_input = str_replace("##HEIGHT##","$height",$media_input); $media_input = str_replace("##MEDIA1##","$media[1]",$media_input); $media_input = str_replace("##MEDIA2##","$media[2]",$media_input); $text = str_replace($media[0],$media_input,$text); } } return $text; }
} //save most preferences to session and db assign_session_prefs($temp_prefs); save_prefs(); //update email notification and auto-login settings separately save_email_notification($mnot); $is_auto_login = isset($auto_login) ? setAutoLoginCookie($auto_login) : $is_auto_login; $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); header('Location: preferences.php?current_tab=' . $current_tab); exit; } $member_id = $_SESSION['member_id']; // Re-set selected desktop theme if the request is from a mobile device // because now $_SESSION['prefs']['PREF_THEME'] == $_SESSION['prefs']['PREF_MOBILE_THEME'] instead of the desktop theme // The code below re-assign $_SESSION['prefs']['PREF_THEME'] back to what it should be if (is_mobile_device()) { $row = queryDB('SELECT * FROM %smembers WHERE member_id=%d', array(TABLE_PREFIX, $member_id), true); foreach (unserialize(stripslashes($row['preferences'])) as $pref_name => $value) { $desktop_theme = $pref_name == 'PREF_THEME' ? $value : $desktop_theme; } } else { $desktop_theme = $_SESSION['prefs']['PREF_THEME']; } if ($_SESSION['first_login']) { $_SESSION['prefs']['PREF_MODIFIED'] = 1; //flag to indicate that this preference has been changed. save_prefs(); } unset($_SESSION['first_login']); $row_notify = queryDB('SELECT inbox_notify FROM %smembers WHERE member_id=%d', array(TABLE_PREFIX, $member_id), true); $languages = $languageManager->getAvailableLanguages();
function mobile_switch() { if (is_mobile_device() > 0) { ?> <ul id="mobile_switch" title="<?php echo _AT('mobile_toggle'); ?> "> <?php if ($_SESSION['prefs']['PREF_RESPONSIVE'] > 0) { ?> <li class="disabled left"><a href="<?php echo $_SERVER['PHP_SELF']; ?> ?mobile=2" title="<?php echo _AT("mobile_disabled"); ?> " aria-disabled="true"><?php echo _AT('mobile'); ?> </a></li> <?php } else { ?> <li class="active left"><?php echo _AT('mobile'); ?> </li> <?php } ?> <?php if ($_SESSION['prefs']['PREF_RESPONSIVE'] > 0) { ?> <li class="active right"><?php echo _AT('off'); ?> </li> <?php } else { ?> <li class="disabled right"><a href="<?php echo $_SERVER['PHP_SELF']; ?> ?mobile=1" title="<?php echo _AT("mobile_active"); ?> " aria-disabled="false"><?php echo _AT('off'); ?> </a></li> <?php } ?> </ul> <?php } }
function mobify_redirect() { global $MOBIFY_COOKIE_NAME; global $MOBIFY_COOKIE_EXPIRE; $groups = null; preg_match("/(?P<domain>[\\w+]+\\.[\\w]+)\$/", get_option('mobify_redirect_base'), $groups); $cookie_domain = "." . $groups[0]; // get parameter has highest priority if (mobify_param_value() == 1) { go_mobile(); } elseif (mobify_param_value() == 0) { go_desktop(); return; } // mobify_param is not set, check out cookie setting if (mobify_cookie_value() == 1) { go_mobile(); } elseif (mobify_cookie_value() == 0) { go_desktop(); return; } // nothing is set, do autodetection if (is_mobile_device()) { go_mobile(); } go_desktop(); return; }
//require_once(AT_INCLUDE_PATH . 'classes/ErrorHandler/ErrorHandler.class.php'); //$err = new ErrorHandler(); //TODO*******************BOLOGNA*******************REMOVE ME*******************/ // if filemanager is a inside a popup or a frame // i don't like this code. i don't know were these two variables are coming from // anyone can add ?framed=1 to a URL to alter the behaviour. // global $_course_id is set when a guest accessing a public course. // This is to solve the issue that the google indexing fails as the session vars are lost. if (isset($_SESSION['course_id'])) { $_course_id = $_SESSION['course_id']; } else { if (isset($_GET['p_course'])) { // p_course is set when pretty url is turned on and public course is accessed $_course_id = $_GET['p_course']; } } $savant->assign('course_id', $_course_id); $savant->assign('is_mobile_device', is_mobile_device()); $savant->assign('mobile_device_type', get_mobile_device_type()); if (isset($_REQUEST['framed']) && $_REQUEST['framed'] || isset($_REQUEST['popup']) && $_REQUEST['popup']) { $savant->assign('framed', 1); $savant->assign('popup', 1); if (isset($tool_flag) && $tool_flag) { $savant->display('include/tm_header.tmpl.php'); } else { $savant->display('include/fm_header.tmpl.php'); } } else { //$savant->assign('opensocial', open_social_libs($_base_href)); $savant->display('include/header.tmpl.php'); }
<?php function is_mobile_device() { if (!isset($_SERVER['HTTP_USER_AGENT'])) { define('OUTLOOK', 0); return 0; } if (strstr($_SERVER['HTTP_USER_AGENT'], "Microsoft Outlook")) { define('OUTLOOK', 1); } else { define('OUTLOOK', 0); } if (preg_match('/(android|ipad|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i', $_SERVER['HTTP_USER_AGENT']) || preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i', substr($_SERVER['HTTP_USER_AGENT'], 0, 4))) { return 1; } return 0; } define('MOBILE_DEVICE', is_mobile_device());