diff --git a/oss/joomla/trunk/modules/index.html b/oss/joomla/trunk/modules/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_apoll/helper.php b/oss/joomla/trunk/modules/mod_apoll/helper.php new file mode 100644 index 00000000..0f4879e3 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_apoll/helper.php @@ -0,0 +1,126 @@ +nameQuote('#__apoll_options') . " AS o " . + " WHERE o.apoll_id = " . (int) $apoll_id . + " AND o.text <> ''" . + " ORDER BY o.ordering" + ; + + $db->setQuery($query); + + if (!($options = $db->loadObjectList())) { + echo "helper ".$db->stderr(); + return; + } + + return $options; + } + // checks if user has voted (if cookie is set) + function alreadyVoted($id) { + + global $mainframe; + + $cookieName = JUtility::getHash( $mainframe->getName() . 'apoll' . $id ); + $voted = JRequest::getVar( $cookieName, '0', 'COOKIE', 'INT'); + + return $voted; + } + + function userVoted($user_id, $apoll_id) { + $db =& JFactory::getDBO(); + $query = "SELECT date FROM ".$db->nameQuote('#__apoll_votes') + ." WHERE apoll_id=".(int) $apoll_id + ." AND user_id=".(int)$user_id + ; + $db->setQuery($query); + + return $userVoted=($db->loadResult())?1:0; + } + + function ipVoted($apoll_id) { + $db =& JFactory::getDBO(); + $ip = $_SERVER['REMOTE_ADDR']; +$query = "SELECT ip FROM ".$db->nameQuote('#__apoll_votes') + ."WHERE apoll_id=".(int) $apoll_id." + AND ip = INET_ATON('".$ip."')" + ; + $db->setQuery($query); + + return $ipVoted=($db->loadResult()) ? 1:0; + } + + function getResults($apoll_id) { + + $db =& JFactory::getDBO(); + $query = "SELECT o.*, COUNT(v.id) AS hits, + (SELECT COUNT(id) FROM ".$db->nameQuote('#__apoll_votes')." WHERE apoll_id=".$apoll_id.") AS votes + FROM ".$db->nameQuote('#__apoll_options')." AS o + LEFT JOIN ".$db->nameQuote('#__apoll_votes')." AS v + ON (o.id = v.option_id AND v.apoll_id = ".(int)$apoll_id . ") + WHERE o.apoll_id=".(int)$apoll_id ." + AND o.text <> '' + GROUP BY o.id + ORDER BY o.ordering"; + + $db->setQuery($query); + + return $db->loadObjectList(); + } + + function getActivePolls() { + $db =& JFactory::getDBO(); + $query = "SELECT id FROM ".$db->nameQuote('#__apoll_polls') . + " WHERE published = 1"; + $db->setQuery($query); + if ($ids = $db->loadResultArray()) { + return $ids; + } else { + return false; + } + } + + function getItemid($apoll_id) { + + $component =& JComponentHelper::getComponent('com_apoll'); + $menus =& JApplication::getMenu('site', array()); + $items = $menus->getItems('componentid', $component->id); + $match = null; + $itemid = null; + + if (isset($items)) { + foreach ($items as $item) { + if ((@$item->query['view'] == 'apoll') && (@$item->query['id'] == $apoll_id)) { + $itemid = $item->id; + break; + } + } + } + return '&Itemid='.$itemid; + } +} +?> diff --git a/oss/joomla/trunk/modules/mod_apoll/index.html b/oss/joomla/trunk/modules/mod_apoll/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_apoll/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_apoll/mod_apoll.php b/oss/joomla/trunk/modules/mod_apoll/mod_apoll.php new file mode 100644 index 00000000..b3a70692 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_apoll/mod_apoll.php @@ -0,0 +1,188 @@ +getItems('link', 'index.php?option=com_apoll&view=apoll'); +$itemid = isset($items[0]) ? '&Itemid='.$items[0]->id : ''; +$details = ""; + +$apoll_id = $params->get( 'id', 0 ); +//if Show random poll is selected +if (!$apoll_id) { + $ids = modApollHelper::getActivePolls(); + + if (count($ids) > 1) { + $apoll_id = $ids[array_rand($ids)]; + } else { + $apoll_id = $ids[0]; + } +} + +$results = modApollHelper::getResults($apoll_id); +//print_r($results); exit; +//get the component params +JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_apoll'.DS.'tables'); +$apoll =& JTable::getInstance('apoll', 'Table'); +$apoll->load( $apoll_id ); +$apollParams = new JParameter($apoll->params); +//merge them with the module params +$params->merge($apollParams, $params); + +$slug = ($apoll->alias=='')? $apoll->id : $apoll->id.":".$apoll->alias; +// check if cookie is set showing that the user has voted for this poll +$voted = modApollHelper::alreadyVoted($apoll_id); +// check if the registrated user has voted and if user has logged in +$user =& JFactory::getUser(); +$userVoted = modApollHelper::userVoted($user->id, $apoll_id); +$guest = $user->guest; +// check if this ip has been recorder +$ipVoted = modApollHelper::ipVoted($apoll_id); +//reset the var display_poll +$display_poll = 0; + +//check the start time and the end of poll +global $mainframe; +$date = &JFactory::getDate(); +$date->setOffset($mainframe->getCfg('offset')); +$now = $date->toFormat(); + +if(($now>$apoll->publish_up) && ($now<$apoll->publish_down)) { + $display_submit = 1; + + // if only registered users can vote + if ($params->get('only_registered')) { + //if the user is not a guest + if(!$guest) { + //if only one vote is allowed per logged user + if($params->get('one_vote_per_user')) { + //check if user has voted + if($userVoted) { + //display the poll with disabled options + $display_submit = 0; + $msg = "You have already voted."; + $details = JText::_("Only one vote per user is allowed."); + //user has not voted yet + } else { + //display the poll + $display_poll = 1; + $display_submit = 1; + $msg = ""; + } + // if loggedin user are allowed to vote unlimited times + } else { + // Check the cookie + if($voted) { + $display_poll = 0; + $display_submit = 0; + $msg = "You have already voted."; + $details = JText::sprintf("Only one vote each %u hours is allowed.", $apoll->lag/60); + + //hm check the ip please but only if allowed to do that + } elseif ($params->get('ip_check')) { + if($ipVoted) { + //display the poll with disabled options + $display_poll = 0; + $display_submit = 0; + $msg = "You have already voted."; + $details = JText::_("Only one vote per IP is allowed."); + //if user's ip has not been logged + } + //if user has not voted + } else { + //display the poll + $display_poll = 1; + $display_submit = 1; + $msg = ""; + } + } + //if the user has not logged in + } else { + //display message please log in + $display_poll = 1; + $display_submit = 0; + $msg = "Please register to vote"; + } + // if anybody can vote + } else { + //if user has voted, according to the cookie check + if($voted) { + //display the poll with disabled options or the results + $display_poll = ($params->get('if_voted'))? 1:0; + $display_submit = 0; + $msg = "You have already voted."; + $details = JText::sprintf("Only one vote each %u hours is allowed.", $apoll->lag/60); + //if user has not voted according to the cookie + } else { + //hm check the ip please but only if allowed to do that + if ($params->get('ip_check')) { + if($ipVoted) { + //display the poll with disabled options + $display_poll = ($params->get('if_voted'))? 1:0; + $display_submit = 0; + $msg = "You have already voted."; + $details = JText::_("Only one vote per IP is allowed."); + //if user's ip has not been logged + } else { + //display the poll + $display_poll = 1; + $display_submit = 1; + $msg = ""; + } + //if we are not allowed to do the ip check + } else { + //display the poll + $display_poll = 1; + $display_submit = 1; + $msg = ""; + } + } + } + +} else { + $display_submit = 0; + $msg = JText::_("The voting for this poll has not started yet.")." "; + $publish_up = JFactory::getDate($apoll->publish_up); + $details = JText::_("It will start on:")." ".$publish_up->toFormat($params->get('msg_date_format')); +} +//if deadline has passed change the msg +if($now>$apoll->publish_down) { + $display_poll = 0; + $msg = "The voting for this poll has ended"." "; + $publish_down = JFactory::getDate($apoll->publish_down); + $details = JText::_("on:")." ".$publish_down->toFormat($params->get('msg_date_format')); +} + +$disabled = ($display_submit)? '':'disabled="disabled"'; +//if show messages is set to no, reset all messages +//if(!$params->get('show_msg')) {$msg ='
';} + +if ( $apoll && $apoll->id ) { + $layout = JModuleHelper::getLayoutPath('mod_apoll'); + $tabcnt = 0; + $options = modApollHelper::getApollOptions($apoll_id); + $itemid = modApollHelper::getItemid($apoll_id); + + require($layout); + +} \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_apoll/mod_apoll.xml b/oss/joomla/trunk/modules/mod_apoll/mod_apoll.xml new file mode 100644 index 00000000..47f46f8c --- /dev/null +++ b/oss/joomla/trunk/modules/mod_apoll/mod_apoll.xml @@ -0,0 +1,86 @@ + + + + Apoll + Hristo Genev + October 2009 + Copyright (C) 2009 + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + harrygg@gmail.com + http://www.afactory.org + 2.1.005 + Apoll module for voting + + + mod_apoll.php + index.html + helper.php + tmpl + + + en-GB.mod_apoll.ini + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/oss/joomla/trunk/modules/mod_apoll/tmpl/default.php b/oss/joomla/trunk/modules/mod_apoll/tmpl/default.php new file mode 100644 index 00000000..ccf51f55 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_apoll/tmpl/default.php @@ -0,0 +1,188 @@ +addStyleDeclaration("div#apoll_loading_".$apoll->id." { + background: url(media/system/images/mootree_loader.gif) 0% 50% no-repeat; + width:100%; + height:20px; + padding: 4px 0 0 20px; +} +"); +?> + +
+ +get('show_poll_title')) : ?> +

title; ?>

+ + +
+ + +
+ + + get('show_msg')) : + echo '
'.JText::_($msg); + if($params->get('show_detailed_msg')) echo " ".$details; + echo '
'; + endif; + ?> +
+ /> +
+ + + + +get('ajax')) : ?> + + + + +".JHTML::_( 'form.token' )."
"; ?> + + +get('ajax')) { +// add mootools +JHTML::_('behavior.mootools'); + +$updateValue = ''; + +for ($i=0; $iget('only_one_color')) { + $background_color = $params->get('apoll_bars_color'); + } else { + $background_color = "' + options.item($i).attributes[3].nodeValue + '"; + } + + $updateValue .= "
' + text.item($i).firstChild.nodeValue + ' - ' + options.item($i).attributes[1].nodeValue + '%
get('apoll_bars_border_color').";\">
"; +} + + if($params->get('show_total')) { + $updateValue .= "
".JText::_('Total votes').": ' + voters.item(0).firstChild.nodeValue + '"; + } +$js = " +/* id."').addEvent('submit', function(e) { + // Prevent the submit event + new Event(e).stop(); + + var options = $('apoll_vote_".$apoll->id."').getElements('input[name=voteid]'); + + var nothing_selected = 1; + options.each(function(item, index){ + if(item.checked==1) {nothing_selected = 0;} + }); + if (nothing_selected) { + alert('".JText::_('Please select an option')."'); + return false; + } else { + + $('submit_vote_".$apoll->id."').disabled = 1; + $('apoll_loading_".$apoll->id."').setStyle('display',''); + + // Update the page + this.send({ + onComplete: function(response, responseXML) + { + // get the XML nodes + var root = responseXML.documentElement; + var options = root.getElementsByTagName('option'); + var text = root.getElementsByTagName('text'); + //var percentages = root.getElementsByTagName('percentages'); + var voters = root.getElementsByTagName('voters'); + + // prepare the XHTML + var updateValue = '".$updateValue."'; + + // update the page element 'update' + //$('apolldiv_".$apoll->id."').removeClass('ajax-loading'); + $('apolldiv_".$apoll->id."').empty().setHTML(updateValue); + var apollSlide = new Fx.Slide('apoll_comp_form'); + apollSlide.slideOut(); + }}); + } + }); + });/* ]]> */"; + + +$document->addScriptDeclaration( $js ); + + +} +//If user has voted + } else { + + foreach ($results as $row) : + $percent = ($row->votes)? round((100*$row->hits)/$row->votes, 1):0; + $width = ($percent)? $percent:2; + if($params->get('only_one_color')) + $background_color = $params->get('apoll_bars_color'); + else + $background_color = $row->color; ?> + +
+
text." - ".$percent; ?>%
+
+
+
+
+get('show_total')) + echo "
".JText::_('Total votes').": ".$row->votes; + + if($params->get('show_msg')) : + echo '
'.JText::_($msg); + if($params->get('show_detailed_msg')) { + echo " ".$details; + } + echo '
'; + endif; + } ?> + + +
+get('show_view_details')) || ($params->get('rel_article_window'))) { ?> + + + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_apoll/tmpl/index.html b/oss/joomla/trunk/modules/mod_apoll/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_apoll/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_archive/helper.php b/oss/joomla/trunk/modules/mod_archive/helper.php new file mode 100644 index 00000000..2ac2a221 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_archive/helper.php @@ -0,0 +1,53 @@ +setQuery($query, 0, intval($params->get('count'))); + $rows = $db->loadObjectList(); + + $menu = &JSite::getMenu(); + $item = $menu->getItems('link', 'index.php?option=com_content&view=archive', true); + $itemid = isset($item) ? '&Itemid='.$item->id : ''; + + $i = 0; + $lists = array(); + foreach ( $rows as $row ) + { + $date =& JFactory::getDate($row->created); + + $created_month = $date->toFormat("%m"); + $month_name = $date->toFormat("%B"); + $created_year = $date->toFormat("%Y"); + + $lists[$i]->link = JRoute::_('index.php?option=com_content&view=archive&year='.$created_year.'&month='.$created_month.$itemid); + $lists[$i]->text = $month_name.', '.$created_year; + $i++; + } + return $lists; + } +} diff --git a/oss/joomla/trunk/modules/mod_archive/index.html b/oss/joomla/trunk/modules/mod_archive/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_archive/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_archive/mod_archive.php b/oss/joomla/trunk/modules/mod_archive/mod_archive.php new file mode 100644 index 00000000..97299a92 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_archive/mod_archive.php @@ -0,0 +1,23 @@ +def('count', 10); +$list = modArchiveHelper::getList($params); + +require(JModuleHelper::getLayoutPath('mod_archive')); \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_archive/mod_archive.xml b/oss/joomla/trunk/modules/mod_archive/mod_archive.xml new file mode 100644 index 00000000..349605b6 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_archive/mod_archive.xml @@ -0,0 +1,26 @@ + + + Archived Content + Joomla! Project + July 2006 + (C) 2005 - 2008 Open Source Matters. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + admin@joomla.org + www.joomla.org + 1.5.0 + DESCARCHIVE + + mod_archive.php + + + + + + + + + + + + + diff --git a/oss/joomla/trunk/modules/mod_archive/tmpl/default.php b/oss/joomla/trunk/modules/mod_archive/tmpl/default.php new file mode 100644 index 00000000..a08ccd3b --- /dev/null +++ b/oss/joomla/trunk/modules/mod_archive/tmpl/default.php @@ -0,0 +1,10 @@ + + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_archive/tmpl/index.html b/oss/joomla/trunk/modules/mod_archive/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_archive/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_banners/helper.php b/oss/joomla/trunk/modules/mod_banners/helper.php new file mode 100644 index 00000000..164ae1a4 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_banners/helper.php @@ -0,0 +1,128 @@ +get( 'cid' ); + $vars['catid'] = (int) $params->get( 'catid' ); + $vars['limit'] = (int) $params->get( 'count', 1 ); + $vars['ordering'] = $params->get( 'ordering' ); + + if ($params->get( 'tag_search' )) + { + $document =& JFactory::getDocument(); + $keywords = $document->getMetaData( 'keywords' ); + + $vars['tag_search'] = BannerHelper::getKeywords( $keywords ); + } + + $banners = $model->getList( $vars ); + $model->impress( $banners ); + + return $banners; + } + + function getModel() + { + if (!class_exists( 'BannersModelBanner' )) + { + // Build the path to the model based upon a supplied base path + $path = JPATH_SITE.DS.'components'.DS.'com_banners'.DS.'models'.DS.'banner.php'; + $false = false; + + // If the model file exists include it and try to instantiate the object + if (file_exists( $path )) { + require_once( $path ); + if (!class_exists( 'BannersModelBanner' )) { + JError::raiseWarning( 0, 'Model class BannersModelBanner not found in file.' ); + return $false; + } + } else { + JError::raiseWarning( 0, 'Model BannersModelBanner not supported. File not found.' ); + return $false; + } + } + + $model = new BannersModelBanner(); + return $model; + } + + function renderBanner($params, &$item) + { + $link = JRoute::_( 'index.php?option=com_banners&task=click&bid='. $item->bid ); + $baseurl = JURI::base(); + + $html = ''; + if (trim($item->custombannercode)) + { + // template replacements + $html = str_replace( '{CLICKURL}', $link, $item->custombannercode ); + $html = str_replace( '{NAME}', $item->name, $html ); + } + else if (BannerHelper::isImage( $item->imageurl )) + { + $image = ''.JText::_('Banner').''; + if ($item->clickurl) + { + switch ($params->get( 'target', 1 )) + { + // cases are slightly different + case 1: + // open in a new window + $a = ''; + break; + + case 2: + // open in a popup window + $a = ""; + break; + + default: // formerly case 2 + // open in parent window + $a = ''; + break; + } + + $html = $a . $image . ''; + } + else + { + $html = $image; + } + } + else if (BannerHelper::isFlash( $item->imageurl )) + { + //echo $item->params; + $banner_params = new JParameter( $item->params ); + $width = $banner_params->get( 'width'); + $height = $banner_params->get( 'height'); + + $imageurl = $baseurl."images/banners/".$item->imageurl; + $html = " + + "; + } + + return $html; + } +} diff --git a/oss/joomla/trunk/modules/mod_banners/index.html b/oss/joomla/trunk/modules/mod_banners/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_banners/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_banners/mod_banners.php b/oss/joomla/trunk/modules/mod_banners/mod_banners.php new file mode 100644 index 00000000..7f8dfda8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_banners/mod_banners.php @@ -0,0 +1,24 @@ +get( 'header_text' ) ); +$footerText = trim( $params->get( 'footer_text' ) ); + +$list = modBannersHelper::getList($params); +require(JModuleHelper::getLayoutPath('mod_banners')); diff --git a/oss/joomla/trunk/modules/mod_banners/mod_banners.xml b/oss/joomla/trunk/modules/mod_banners/mod_banners.xml new file mode 100644 index 00000000..0626e7e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_banners/mod_banners.xml @@ -0,0 +1,46 @@ + + + Banner + Joomla! Project + July 2006 + Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + admin@joomla.org + www.joomla.org + 1.5.0 + DESCBANNER + + mod_banners.php + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/oss/joomla/trunk/modules/mod_banners/tmpl/default.php b/oss/joomla/trunk/modules/mod_banners/tmpl/default.php new file mode 100644 index 00000000..d22202f5 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_banners/tmpl/default.php @@ -0,0 +1,22 @@ + +
+ + +
+
+
+ + + +
+ +
+ +
\ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_banners/tmpl/index.html b/oss/joomla/trunk/modules/mod_banners/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_banners/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_breadcrumbs/helper.php b/oss/joomla/trunk/modules/mod_breadcrumbs/helper.php new file mode 100644 index 00000000..cbf6a767 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_breadcrumbs/helper.php @@ -0,0 +1,75 @@ +getPathway(); + $items = $pathway->getPathWay(); + + $count = count($items); + for ($i = 0; $i < $count; $i ++) + { + $items[$i]->name = stripslashes(htmlspecialchars($items[$i]->name)); + $items[$i]->link = JRoute::_($items[$i]->link); + } + + if ($params->get('showHome', 1)) + { + $item = new stdClass(); + $item->name = $params->get('homeText', JText::_('Home')); + $item->link = JURI::base(); + array_unshift($items, $item); + } + + return $items; + } + + /** + * Set the breadcrumbs separator for the breadcrumbs display. + * + * @param string $custom Custom xhtml complient string to separate the + * items of the breadcrumbs + * @return string Separator string + * @since 1.5 + */ + function setSeparator($custom = null) + { + global $mainframe; + + $lang =& JFactory::getLanguage(); + + /** + * If a custom separator has not been provided we try to load a template + * specific one first, and if that is not present we load the default separator + */ + if ($custom == null) { + if($lang->isRTL()){ + $_separator = JHTML::_('image.site', 'arrow_rtl.png'); + } + else{ + $_separator = JHTML::_('image.site', 'arrow.png'); + } + } else { + $_separator = $custom; + } + return $_separator; + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_breadcrumbs/index.html b/oss/joomla/trunk/modules/mod_breadcrumbs/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_breadcrumbs/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_breadcrumbs/mod_breadcrumbs.php b/oss/joomla/trunk/modules/mod_breadcrumbs/mod_breadcrumbs.php new file mode 100644 index 00000000..a840f3f3 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_breadcrumbs/mod_breadcrumbs.php @@ -0,0 +1,27 @@ +get( 'separator' )); + +require(JModuleHelper::getLayoutPath('mod_breadcrumbs')); \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_breadcrumbs/mod_breadcrumbs.xml b/oss/joomla/trunk/modules/mod_breadcrumbs/mod_breadcrumbs.xml new file mode 100644 index 00000000..0b8c706b --- /dev/null +++ b/oss/joomla/trunk/modules/mod_breadcrumbs/mod_breadcrumbs.xml @@ -0,0 +1,33 @@ + + + Breadcrumbs + Joomla! Project + July 2006 + Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + admin@joomla.org + www.joomla.org + 1.5.0 + This module displays the breadcrumbs + + mod_breadcrumbs.php + + + + + + + + + + + + + + + + + + + + diff --git a/oss/joomla/trunk/modules/mod_breadcrumbs/tmpl/default.php b/oss/joomla/trunk/modules/mod_breadcrumbs/tmpl/default.php new file mode 100644 index 00000000..944210e7 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_breadcrumbs/tmpl/default.php @@ -0,0 +1,18 @@ + + +link)) { + echo ''.$list[$i]->name.''; + } else { + echo $list[$i]->name; + } + echo ' '.$separator.' '; + } else if ($params->get('showLast', 1)) { // when $i == $count -1 and 'showLast' is true + echo $list[$i]->name; + } +endfor; ?> + diff --git a/oss/joomla/trunk/modules/mod_breadcrumbs/tmpl/index.html b/oss/joomla/trunk/modules/mod_breadcrumbs/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_breadcrumbs/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_custom/index.html b/oss/joomla/trunk/modules/mod_custom/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_custom/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_custom/mod_custom.xml b/oss/joomla/trunk/modules/mod_custom/mod_custom.xml new file mode 100644 index 00000000..605c34a3 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_custom/mod_custom.xml @@ -0,0 +1,15 @@ + + + Custom HTML + Joomla! Project + July 2004 + Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + admin@joomla.org + www.joomla.org + 1.5.0 + DESCMODCUSTOM + + + + diff --git a/oss/joomla/trunk/modules/mod_feed/helper.php b/oss/joomla/trunk/modules/mod_feed/helper.php new file mode 100644 index 00000000..636014f1 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_feed/helper.php @@ -0,0 +1,60 @@ +get('rssurl', ''); + + // get RSS parsed object + $options = array(); + $options['rssUrl'] = $rssurl; + if ($params->get('cache')) { + $options['cache_time'] = $params->get('cache_time', 15) ; + $options['cache_time'] *= 60; + } else { + $options['cache_time'] = null; + } + + $rssDoc =& JFactory::getXMLparser('RSS', $options); + + $feed = new stdclass(); + + if ($rssDoc != false) + { + // channel header and link + $feed->title = $rssDoc->get_title(); + $feed->link = $rssDoc->get_link(); + $feed->description = $rssDoc->get_description(); + + // channel image if exists + $feed->image->url = $rssDoc->get_image_url(); + $feed->image->title = $rssDoc->get_image_title(); + + // items + $items = $rssDoc->get_items(); + + // feed elements + $feed->items = array_slice($items, 0, $params->get('rssitems', 5)); + } else { + $feed = false; + } + + return $feed; + } +} \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_feed/index.html b/oss/joomla/trunk/modules/mod_feed/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_feed/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_feed/mod_feed.php b/oss/joomla/trunk/modules/mod_feed/mod_feed.php new file mode 100644 index 00000000..6abc0041 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_feed/mod_feed.php @@ -0,0 +1,43 @@ +get('rssurl', ''); +$rssrtl = $params->get('rssrtl', 0); + +//check if cache diretory is writable as cache files will be created for the feed +$cacheDir = JPATH_BASE.DS.'cache'; +if (!is_writable($cacheDir)) +{ + echo '
'; + echo JText::_('Please make cache directory writable.'); + echo '
'; + return; +} + +//check if feed URL has been set +if (empty ($rssurl)) +{ + echo '
'; + echo JText::_('No feed URL specified.'); + echo '
'; + return; +} + +$feed = modFeedHelper::getFeed($params); +require(JModuleHelper::getLayoutPath('mod_feed')); diff --git a/oss/joomla/trunk/modules/mod_feed/mod_feed.xml b/oss/joomla/trunk/modules/mod_feed/mod_feed.xml new file mode 100644 index 00000000..d19ebffc --- /dev/null +++ b/oss/joomla/trunk/modules/mod_feed/mod_feed.xml @@ -0,0 +1,49 @@ + + + Feed Display + Joomla! Project + July 2005 + Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + admin@joomla.org + www.joomla.org + 1.5.0 + This module allows the displaying of a syndicated feed + + mod_feed.php + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/oss/joomla/trunk/modules/mod_feed/tmpl/default.php b/oss/joomla/trunk/modules/mod_feed/tmpl/default.php new file mode 100644 index 00000000..ca927545 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_feed/tmpl/default.php @@ -0,0 +1,110 @@ + +
+image->url) ? $feed->image->url : null; + $iTitle = isset($feed->image->title) ? $feed->image->title : null; + ?> + + title ) && $params->get('rsstitle', 1)) { + ?> + + + + get('rssdesc', 1)) { + ?> + + + + get('rssimage', 1) && $iUrl) { + ?> + + + + items ); + $setItems = $params->get('rssitems', 5); + + if ($setItems > $actualItems) { + $totalItems = $actualItems; + } else { + $totalItems = $setItems; + } + ?> + + + +
+ + + title; ?> + +
description; ?>
<?php echo @$iTitle; ?>
+
    + def('word_count', 0); + for ($j = 0; $j < $totalItems; $j ++) + { + $currItem = & $feed->items[$j]; + // item title + ?> +
  • + get_link() ) ) { + ?> + + get_title(); ?> + get('rssitemdesc', 1)) + { + // item description + $text = $currItem->get_description(); + $text = str_replace(''', "'", $text); + + // word limit check + if ($words) + { + $texts = explode(' ', $text); + $count = count($texts); + if ($count > $words) + { + $text = ''; + for ($i = 0; $i < $words; $i ++) { + $text .= ' '.$texts[$i]; + } + $text .= '...'; + } + } + ?> +
    + +
    + +
  • + +
+
+ +
diff --git a/oss/joomla/trunk/modules/mod_feed/tmpl/index.html b/oss/joomla/trunk/modules/mod_feed/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_feed/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_footer/index.html b/oss/joomla/trunk/modules/mod_footer/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_footer/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_footer/mod_footer.php b/oss/joomla/trunk/modules/mod_footer/mod_footer.php new file mode 100644 index 00000000..e9cf1aca --- /dev/null +++ b/oss/joomla/trunk/modules/mod_footer/mod_footer.php @@ -0,0 +1,35 @@ +toFormat('%Y'); +$csite_name = $mainframe->getCfg('sitename'); + +if (JString::strpos(JText :: _('FOOTER_LINE1'), '%date%')) { + $line1 = ereg_replace('%date%', $cur_year, JText :: _('FOOTER_LINE1')); +} else { + $line1 = JText :: _('FOOTER_LINE1'); +} + +if (JString::strpos($line1, '%sitename%')) { + $lineone = ereg_replace('%sitename%', $csite_name, $line1); +} else { + $lineone = $line1; +} + +require(JModuleHelper::getLayoutPath('mod_footer')); diff --git a/oss/joomla/trunk/modules/mod_footer/mod_footer.xml b/oss/joomla/trunk/modules/mod_footer/mod_footer.xml new file mode 100644 index 00000000..89461e76 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_footer/mod_footer.xml @@ -0,0 +1,21 @@ + + + Footer + Joomla! Project + July 2006 + Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + admin@joomla.org + www.joomla.org + 1.5.0 + This module shows the Joomla! Copyright information + + mod_footer.php + + + + + + + + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_footer/tmpl/default.php b/oss/joomla/trunk/modules/mod_footer/tmpl/default.php new file mode 100644 index 00000000..973380a5 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_footer/tmpl/default.php @@ -0,0 +1,4 @@ + +
+
\ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_footer/tmpl/index.html b/oss/joomla/trunk/modules/mod_footer/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_footer/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_latestnews/helper.php b/oss/joomla/trunk/modules/mod_latestnews/helper.php new file mode 100644 index 00000000..b6fbb598 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_latestnews/helper.php @@ -0,0 +1,119 @@ +get('id'); + + $count = (int) $params->get('count', 5); + $catid = trim( $params->get('catid') ); + $secid = trim( $params->get('secid') ); + $show_front = $params->get('show_front', 1); + $aid = $user->get('aid', 0); + + $contentConfig = &JComponentHelper::getParams( 'com_content' ); + $access = !$contentConfig->get('show_noauth'); + + $nullDate = $db->getNullDate(); + + $date =& JFactory::getDate(); + $now = $date->toMySQL(); + + $where = 'a.state = 1' + . ' AND ( a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).' )' + . ' AND ( a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).' )' + ; + + // User Filter + switch ($params->get( 'user_id' )) + { + case 'by_me': + $where .= ' AND (created_by = ' . (int) $userId . ' OR modified_by = ' . (int) $userId . ')'; + break; + case 'not_me': + $where .= ' AND (created_by <> ' . (int) $userId . ' AND modified_by <> ' . (int) $userId . ')'; + break; + } + + // Ordering + switch ($params->get( 'ordering' )) + { + case 'm_dsc': + $ordering = 'a.modified DESC, a.created DESC'; + break; + case 'c_dsc': + default: + $ordering = 'a.created DESC'; + break; + } + + if ($catid) + { + $ids = explode( ',', $catid ); + JArrayHelper::toInteger( $ids ); + $catCondition = ' AND (cc.id=' . implode( ' OR cc.id=', $ids ) . ')'; + } + if ($secid) + { + $ids = explode( ',', $secid ); + JArrayHelper::toInteger( $ids ); + $secCondition = ' AND (s.id=' . implode( ' OR s.id=', $ids ) . ')'; + } + + // Content Items only + $query = 'SELECT a.*, ' . + ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'. + ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug'. + ' FROM #__content AS a' . + ($show_front == '0' ? ' LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id' : '') . + ' INNER JOIN #__categories AS cc ON cc.id = a.catid' . + ' INNER JOIN #__sections AS s ON s.id = a.sectionid' . + ' WHERE '. $where .' AND s.id > 0' . + ($access ? ' AND a.access <= ' .(int) $aid. ' AND cc.access <= ' .(int) $aid. ' AND s.access <= ' .(int) $aid : ''). + ($catid ? $catCondition : ''). + ($secid ? $secCondition : ''). + ($show_front == '0' ? ' AND f.content_id IS NULL ' : ''). + ' AND s.published = 1' . + ' AND cc.published = 1' . + ' ORDER BY '. $ordering; + $db->setQuery($query, 0, $count); + $rows = $db->loadObjectList(); + + $i = 0; + $lists = array(); + foreach ( $rows as $row ) + { + if($row->access <= $aid) + { + $lists[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid)); + } else { + $lists[$i]->link = JRoute::_('index.php?option=com_user&view=login'); + } + $lists[$i]->text = htmlspecialchars( $row->title ); + $i++; + } + + return $lists; + } +} diff --git a/oss/joomla/trunk/modules/mod_latestnews/index.html b/oss/joomla/trunk/modules/mod_latestnews/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_latestnews/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_latestnews/mod_latestnews.php b/oss/joomla/trunk/modules/mod_latestnews/mod_latestnews.php new file mode 100644 index 00000000..3141ac5f --- /dev/null +++ b/oss/joomla/trunk/modules/mod_latestnews/mod_latestnews.php @@ -0,0 +1,21 @@ + + + Latest News + Joomla! Project + July 2004 + Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + admin@joomla.org + www.joomla.org + 1.5.0 + DESCLATESTNEWS + + mod_latestnews.php + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/oss/joomla/trunk/modules/mod_latestnews/tmpl/default.php b/oss/joomla/trunk/modules/mod_latestnews/tmpl/default.php new file mode 100644 index 00000000..32d1fb92 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_latestnews/tmpl/default.php @@ -0,0 +1,10 @@ + + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_latestnews/tmpl/index.html b/oss/joomla/trunk/modules/mod_latestnews/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_latestnews/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_login/helper.php b/oss/joomla/trunk/modules/mod_login/helper.php new file mode 100644 index 00000000..ea14e2d7 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_login/helper.php @@ -0,0 +1,42 @@ +get($type)) + { + $menu =& JSite::getMenu(); + $item = $menu->getItem($itemid); + $url = JRoute::_($item->link.'&Itemid='.$itemid, false); + } + else + { + // stay on the same page + $uri = JFactory::getURI(); + $url = $uri->toString(array('path', 'query', 'fragment')); + } + + return base64_encode($url); + } + + function getType() + { + $user = & JFactory::getUser(); + return (!$user->get('guest')) ? 'logout' : 'login'; + } +} diff --git a/oss/joomla/trunk/modules/mod_login/index.html b/oss/joomla/trunk/modules/mod_login/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_login/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_login/mod_login.php b/oss/joomla/trunk/modules/mod_login/mod_login.php new file mode 100644 index 00000000..d66285e7 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_login/mod_login.php @@ -0,0 +1,27 @@ +def('greeting', 1); + +$type = modLoginHelper::getType(); +$return = modLoginHelper::getReturnURL($params, $type); + +$user =& JFactory::getUser(); + +require(JModuleHelper::getLayoutPath('mod_login')); \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_login/mod_login.xml b/oss/joomla/trunk/modules/mod_login/mod_login.xml new file mode 100644 index 00000000..78fb88ea --- /dev/null +++ b/oss/joomla/trunk/modules/mod_login/mod_login.xml @@ -0,0 +1,38 @@ + + + Login + Joomla! Project + July 2006 + Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + admin@joomla.org + www.joomla.org + 1.5.0 + DESCLOGINFORM + + mod_login.php + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/oss/joomla/trunk/modules/mod_login/tmpl/default.php b/oss/joomla/trunk/modules/mod_login/tmpl/default.php new file mode 100644 index 00000000..ace81440 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_login/tmpl/default.php @@ -0,0 +1,78 @@ + + +
+get('greeting')) : ?> +
+ get('name')) : { + echo JText::sprintf( 'HINAME', $user->get('name') ); + } else : { + echo JText::sprintf( 'HINAME', $user->get('username') ); + } endif; ?> +
+ +
+ +
+ + + + +
+ +load( 'plg_authentication_openid', JPATH_ADMINISTRATOR ); + $langScript = 'var JLanguage = {};'. + ' JLanguage.WHAT_IS_OPENID = \''.JText::_( 'WHAT_IS_OPENID' ).'\';'. + ' JLanguage.LOGIN_WITH_OPENID = \''.JText::_( 'LOGIN_WITH_OPENID' ).'\';'. + ' JLanguage.NORMAL_LOGIN = \''.JText::_( 'NORMAL_LOGIN' ).'\';'. + ' var modlogin = 1;'; + $document = &JFactory::getDocument(); + $document->addScriptDeclaration( $langScript ); + JHTML::_('script', 'openid.js'); +endif; ?> +
+ get('pretext'); ?> +
+

+
+ +

+

+
+ +

+ +

+ + +

+ + +
+ + get('posttext'); ?> + + + + + +
+ \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_login/tmpl/index.html b/oss/joomla/trunk/modules/mod_login/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/modules/mod_login/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/modules/mod_mainmenu/helper.php b/oss/joomla/trunk/modules/mod_mainmenu/helper.php new file mode 100644 index 00000000..1d988bcb --- /dev/null +++ b/oss/joomla/trunk/modules/mod_mainmenu/helper.php @@ -0,0 +1,418 @@ +getItems('menutype', $params->get('menutype')); + $maxdepth = $params->get('maxdepth',10); + + // Build Menu Tree root down (orphan proof - child might have lower id than parent) + $user =& JFactory::getUser(); + $ids = array(); + $ids[0] = true; + $last = null; + $unresolved = array(); + // pop the first item until the array is empty if there is any item + if ( is_array($rows)) { + while (count($rows) && !is_null($row = array_shift($rows))) + { + if (array_key_exists($row->parent, $ids)) { + $row->ionly = $params->get('menu_images_link'); + $menu->addNode($params, $row); + + // record loaded parents + $ids[$row->id] = true; + } else { + // no parent yet so push item to back of list + // SAM: But if the key isn't in the list and we dont _add_ this is infinite, so check the unresolved queue + if(!array_key_exists($row->id, $unresolved) || $unresolved[$row->id] < $maxdepth) { + array_push($rows, $row); + // so let us do max $maxdepth passes + // TODO: Put a time check in this loop in case we get too close to the PHP timeout + if(!isset($unresolved[$row->id])) $unresolved[$row->id] = 1; + else $unresolved[$row->id]++; + } + } + } + } + return $menu->toXML(); + } + + function &getXML($type, &$params, $decorator) + { + static $xmls; + + if (!isset($xmls[$type])) { + $cache =& JFactory::getCache('mod_mainmenu'); + $string = $cache->call(array('modMainMenuHelper', 'buildXML'), $params); + $xmls[$type] = $string; + } + + // Get document + $xml = JFactory::getXMLParser('Simple'); + $xml->loadString($xmls[$type]); + $doc = &$xml->document; + + $menu = &JSite::getMenu(); + $active = $menu->getActive(); + $start = $params->get('startLevel'); + $end = $params->get('endLevel'); + $sChild = $params->get('showAllChildren'); + $path = array(); + + // Get subtree + if ($start) + { + $found = false; + $root = true; + if(!isset($active)){ + $doc = false; + } + else{ + $path = $active->tree; + for ($i=0,$n=count($path);$i<$n;$i++) + { + foreach ($doc->children() as $child) + { + if ($child->attributes('id') == $path[$i]) { + $doc = &$child->ul[0]; + $root = false; + break; + } + } + + if ($i == $start-1) { + $found = true; + break; + } + } + if ((!is_a($doc, 'JSimpleXMLElement')) || (!$found) || ($root)) { + $doc = false; + } + } + } + + if ($doc && is_callable($decorator)) { + $doc->map($decorator, array('end'=>$end, 'children'=>$sChild)); + } + return $doc; + } + + function render(&$params, $callback) + { + switch ( $params->get( 'menu_style', 'list' ) ) + { + case 'list_flat' : + // Include the legacy library file + require_once(dirname(__FILE__).DS.'legacy.php'); + mosShowHFMenu($params, 1); + break; + + case 'horiz_flat' : + // Include the legacy library file + require_once(dirname(__FILE__).DS.'legacy.php'); + mosShowHFMenu($params, 0); + break; + + case 'vert_indent' : + // Include the legacy library file + require_once(dirname(__FILE__).DS.'legacy.php'); + mosShowVIMenu($params); + break; + + default : + // Include the new menu class + $xml = modMainMenuHelper::getXML($params->get('menutype'), $params, $callback); + if ($xml) { + $class = $params->get('class_sfx'); + $xml->addAttribute('class', 'menu'.$class); + if ($tagId = $params->get('tag_id')) { + $xml->addAttribute('id', $tagId); + } + + $result = JFilterOutput::ampReplace($xml->toString((bool)$params->get('show_whitespace'))); + $result = str_replace(array('