getPath( 'front_html' ) ); require_once( $mainframe->getPath( 'class' ) ); // this also includes the configuration include_once( $mosConfig_absolute_path . '/components/com_mmsblog/update.php' ); $lngfile = $mosConfig_absolute_path . '/components/com_mmsblog/language/' . $mosConfig_lang . '.php'; if( !file_exists($lngfile) ) { $lngfile = $mosConfig_absolute_path . '/components/com_mmsblog/language/english.php'; } require_once ( $lngfile ); $mainframe->setPageTitle( JMMSBlogHelper::title() ); if ($mosMMSblog_tb_image || $mosMMSblog_tb_movie) { $mainframe->addCustomHeadTag( "" ); $mainframe->addCustomHeadTag( "" ); $mainframe->addCustomHeadTag( "" ); } $file = mosGetParam( $_REQUEST, 'file', '' ); $id = intval(mosGetParam( $_REQUEST, 'id', 0 )); $user = intval(mosGetParam( $_REQUEST, 'user', 0 )); $page = intval(mosGetParam( $_REQUEST, 'page', 1 )); switch( $task ) { case 'audio': HTML_mmsblog::showAudio( $file ); break; case 'video': HTML_mmsblog::showVideo( $file ); break; case 'show': showMMSblog1( $id ); break; case 'users'; showMMSusers(); break; default: updateBlog(); showMMSblog( $user, $page ); break; } function showMMSusers() { global $database, $Itemid, $mainframe; if( (!$Itemid) || ($Itemid == 99999999) ) { $Itemid = JMMSBlogHelper::itemid(); if( $Itemid ) { mosRedirect( JMMSBlogHelper::linkUsers( $id, $Itemid ) ); } } $mainframe->appendPathWay( MMS_USERS ); $query = "SELECT id, name FROM #__mmsblog_user WHERE published=1 ORDER BY name"; $database->setQuery( $query ); $rows = $database->loadObjectList(); if( $database->getErrorNum() > 0 ) { echo $database->stderr(); return; } HTML_mmsblog::showusers( $rows ); } function showMMSblog1( $id ) { global $database, $Itemid, $mainframe; if( (!$Itemid) || ($Itemid == 99999999) ) { $Itemid = JMMSBlogHelper::itemid(); if( $Itemid ) { mosRedirect( JMMSBlogHelper::linkOne( $id, $Itemid ) ); } } $query = "SELECT m.*, u.name FROM #__mmsblog AS m" . " \nLEFT JOIN #__mmsblog_user u ON m.uid = u.id" . " \nWHERE u.published=1 AND m.published=1 AND m.id=$id" . " \nORDER BY m.ordering DESC"; $database->setQuery( $query ); $rows = $database->loadObjectList(); if( $database->getErrorNum() > 0 ) { echo $database->stderr(); return; } if( count($rows) == 0 ) { return; } for( $i=0, $n=count($rows); $i<$n; $i++) { $regex = '/{mmsimg\s(\S*)\s(.*?)}/i'; $rows[$i]->content = preg_replace_callback( $regex, 'mmsimg_callback', $rows[$i]->content); $regex = '/{mmsvid\s(\S*)\s(.*?)}/i'; $rows[$i]->content = preg_replace_callback( $regex, 'mmsvid_callback', $rows[$i]->content); $regex = '/{mmsaudio\s(\S*)\s(.*?)}/i'; $rows[$i]->content = preg_replace_callback( $regex, 'mmsaudio_callback', $rows[$i]->content); } $mainframe->appendPathWay( htmlentities($rows[0]->title) ); HTML_mmsblog::showMMSblog( $rows ); HTML_mmsblog::footer(); } function showMMSblog( $user=0, $page=1 ) { global $database, $Itemid, $mosMMSblog_numonpage; global $mainframe; if( (!$Itemid) || ($Itemid == 99999999)) { $Itemid = JMMSBlogHelper::itemid(); if( $Itemid ) { mosRedirect( JMMSBlogHelper::link( $page, $Itemid, $user ) ); } } $where = ( $user != 0 ) ? "AND u.id=$user" : ''; if( $user ) { $tmp = new mosMMSUser(); $tmp->load( $user ); $mainframe->appendPathWay( htmlspecialchars($tmp->name) ); } $query = "SELECT count(*) FROM #__mmsblog AS m" . " \nLEFT JOIN #__mmsblog_user u ON m.uid = u.id" . " \nWHERE u.published=1 AND m.published=1" . " \n$where"; $database->setQuery( $query ); $total = intval( $database->loadResult() ); if( $database->getErrorNum() > 0 ) { echo $database->stderr(); return; } $limitstart = $mosMMSblog_numonpage * ($page-1); $limit = $mosMMSblog_numonpage; $pages = intval($total/$mosMMSblog_numonpage); if($total%$mosMMSblog_numonpage) { $pages++; } $query = "SELECT m.*, u.name FROM #__mmsblog AS m" . " \nLEFT JOIN #__mmsblog_user u ON m.uid = u.id" . " \nWHERE u.published=1 AND m.published=1" . " \n$where" . " \nORDER BY m.ordering DESC" . " \nLIMIT $limitstart, $limit"; $database->setQuery( $query ); $rows = $database->loadObjectList(); if( $database->getErrorNum() > 0 ) { echo $database->stderr(); return; } for( $i=0, $n=count($rows); $i<$n; $i++) { $rows[$i]->content = str_replace('Thank you for using easyedgeSM Picture Messaging by U.S. Cellular. See www.uscellular.com for info.', '', $rows[$i]->content); $regex = '/{mmsimg\s(\S*)\s(.*?)}/i'; $rows[$i]->content = preg_replace_callback( $regex, 'mmsimg_callback', $rows[$i]->content); $regex = '/{mmsvid\s(\S*)\s(.*?)}/i'; $rows[$i]->content = preg_replace_callback( $regex, 'mmsvid_callback', $rows[$i]->content); $regex = '/{mmsaudio\s(\S*)\s(.*?)}/i'; $rows[$i]->content = preg_replace_callback( $regex, 'mmsaudio_callback', $rows[$i]->content); } HTML_mmsblog::showMMSblog( $rows, $page, $pages, $user ); HTML_mmsblog::footer(true); } function mmsimg_callback( &$matches ) { global $mosConfig_absolute_path, $mosConfig_live_site, $mosMMSblog_maxwidth, $mosMMSblog_path, $mosMMSblog_tb_image; $file = $mosConfig_absolute_path . $mosMMSblog_path . $matches[1]; $url = $mosConfig_live_site . $mosMMSblog_path . $matches[1]; $alt = htmlentities($matches[2]); list( $width, $height ) = @getimagesize( $file ); if( $width > $mosMMSblog_maxwidth ) { $height = $height * $mosMMSblog_maxwidth / $width; $width = $mosMMSblog_maxwidth; } $imgtag = sprintf( '%s

', $url, $alt, $width, $height ); if ($mosMMSblog_tb_image) { $link = sprintf( '%s', $url, $imgtag ); } else { $link = sprintf( '%s', $url, $imgtag ); } return $link; } function mmsvid_callback( &$matches ) { global $mosConfig_absolute_path, $mosConfig_live_site, $mosMMSblog_maxwidth, $mosMMSblog_path, $mosMMSblog_tb_movie; $file = $mosConfig_absolute_path . $mosMMSblog_path . $matches[1]; $url = $mosConfig_live_site . $mosMMSblog_path . $matches[1]; $alt = htmlentities($matches[2]); $href = $mosConfig_live_site . '/index2.php?option=com_mmsblog&task=video&file=' . $matches[1]; if ($mosMMSblog_tb_movie) { $href = $href . "&keepThis=true&TB_iframe=true&height=500&width=580"; $link = sprintf( ''.MMS_WATCH_MOVIE.': %s

', $href, $alt, $alt ); } else { $href = "javascript:MMSblog_video('$href',640,480);"; $link = sprintf( ''.MMS_WATCH_MOVIE.': %s

', $href, $alt, $alt ); } return $link; } function mmsaudio_callback( &$matches ) { global $mosConfig_absolute_path, $mosConfig_live_site, $mosMMSblog_maxwidth, $mosMMSblog_path, $mosMMSblog_tb_movie; $file = $mosConfig_absolute_path . $mosMMSblog_path . $matches[1]; $url = $mosConfig_live_site . $mosMMSblog_path . $matches[1]; $alt = htmlentities($matches[2]); $href = $mosConfig_live_site . '/index2.php?option=com_mmsblog&task=audio&file=' . $matches[1]; if ($mosMMSblog_tb_movie) { $href = $href . "&keepThis=true&TB_iframe=true&height=120&width=250"; $link = sprintf( ''.MMS_LISTEN_AUDIO.': %s

', $href, $alt, $alt ); } else { $href = "javascript:MMSblog_video('$href',250,120);"; $link = sprintf( ''.MMS_LISTEN_AUDIO.': %s

', $href, $alt, $alt ); } return $link; } ?>