function output_newsflash(&$row, &$params, &$access)
 {
     global $mainframe;
     $row->text = $row->introtext;
     $row->groups = '';
     $row->readmore = trim($row->fulltext) != '';
     $row->metadesc = '';
     $row->metakey = '';
     $row->access = '';
     $row->created = '';
     $row->modified = '';
     HTML_content::show($row, $params, $access, 0);
 }
Exemple #2
0
        }
        echo "</tr>\n</table>\n";
        break;
    case 'vert':
        foreach ($rows as $id) {
            $row->load($id);
            $row->text = $row->introtext;
            if ($image == 0) {
                $row->text = preg_replace('/\\<img[^>]+\\>/i', '', $row->text);
            }
            $row->groups = '';
            HTML_content::show($row, $params, $access, 0, 'com_content');
        }
        break;
    case 'flash':
    default:
        if ($numrows > 0) {
            srand((double) microtime() * 1000000);
            $flashnum = $rows[rand(0, $numrows - 1)];
        } else {
            $flashnum = 0;
        }
        $row->load($flashnum);
        $row->text = $row->introtext;
        if ($image == 0) {
            $row->text = preg_replace('/\\<img[^>]+\\>/i', '', $row->text);
        }
        $row->groups = '';
        HTML_content::show($row, $params, $access, 0, 'com_content');
        break;
}
    /**
     * Writes Container for Section & Category
     */
    function Section_Category(&$row, &$params)
    {
        if ($params->get('section') || $params->get('category')) {
            ?>
			<tr>
				<td>
			<?php 
        }
        // displays Section Name
        HTML_content::Section($row, $params);
        // displays Section Name
        HTML_content::Category($row, $params);
        if ($params->get('section') || $params->get('category')) {
            ?>
				</td>
			</tr>
		<?php 
        }
    }
Exemple #4
0
/**
* Shows the email form for a given content item.
*/
function emailContentSend($uid)
{
    global $database, $mainframe;
    global $mosConfig_live_site, $mosConfig_sitename;
    global $mosConfig_mailfrom, $mosConfig_fromname;
    $_Itemid = $mainframe->getItemid($uid, 0, 0);
    $email = trim(mosGetParam($_POST, 'email', ''));
    $yourname = trim(mosGetParam($_POST, 'yourname', ''));
    $youremail = trim(mosGetParam($_POST, 'youremail', ''));
    $subject_default = _EMAIL_INFO . " {$yourname}";
    $subject = trim(mosGetParam($_POST, 'subject', $subject_default));
    if (!$email || !$youremail || is_email($email) == false || is_email($youremail) == false) {
        echo "<script>alert (\"" . _EMAIL_ERR_NOINFO . "\"); window.history.go(-1);</script>";
        exit(0);
    }
    $template = '';
    $database->setQuery("SELECT template FROM #__templates_menu WHERE client_id='0' AND menuid='0'");
    $template = $database->loadResult();
    // link sent in email
    $link = sefRelToAbs($mosConfig_live_site . '/index.php?option=com_content&task=view&id=' . $uid . '&Itemid=' . $_Itemid);
    // message text
    $msg = sprintf(_EMAIL_MSG, $mosConfig_sitename, $yourname, $youremail, $link);
    // mail function
    mosMail($mosConfig_mailfrom, $mosConfig_fromname, $email, $subject, $msg);
    HTML_content::emailSent($email, $template);
}
Exemple #5
0
/**
* Form for copying item(s)
**/
function copyItem($cid, $sectionid, $option)
{
    global $database, $adminLanguage;
    if (!is_array($cid) || count($cid) < 1) {
        echo "<script> alert(\"" . $adminLanguage->A_COMP_CONTENT_SEL_MOVE . "\"); window.history.go(-1);</script>\n";
        exit;
    }
    //seperate contentids
    $cids = implode(',', $cid);
    ## Content Items query
    $query = "SELECT a.title" . "\n FROM #__content AS a" . "\n WHERE ( a.id IN (" . $cids . ") )" . "\n ORDER BY a.title";
    $database->setQuery($query);
    $items = $database->loadObjectList();
    ## Section & Category query
    $query = "SELECT CONCAT_WS(',',s.id,c.id) AS `value`, CONCAT_WS(' // ', s.name, c.name) AS `text`" . "\n FROM #__sections AS s" . "\n INNER JOIN #__categories AS c ON c.section = s.id" . "\n WHERE s.scope='content'" . "\n ORDER BY s.name, c.name";
    $database->setQuery($query);
    $rows = $database->loadObjectList();
    // build the html select list
    $sectCatList = mosHTML::selectList($rows, 'sectcat', 'class="inputbox" size="10"', 'value', 'text', NULL);
    HTML_content::copySection($option, $cid, $sectCatList, $sectionid, $items);
}
Exemple #6
0
/**
 * Shows the email form for a given content item.
 * @param int The content item id
 */
function emailContentSend($uid, $gid)
{
    global $database, $mainframe;
    global $mosConfig_live_site, $mosConfig_sitename, $mosConfig_hideEmail;
    $id = intval(mosGetParam($_REQUEST, 'id', 0));
    if ($id) {
        $query = 'SELECT attribs FROM #__content WHERE `id`=' . $id;
        $database->setQuery($query);
        $params = new mosParameters($database->loadResult());
    } else {
        $params = new mosParameters('');
    }
    $paramEmail = intval($params->get('email', 0));
    if ($mosConfig_hideEmail && !$paramEmail) {
        echo _NOT_AUTH;
        return;
    }
    // simple spoof check security
    josSpoofCheck(1);
    // check for session cookie
    // Session Cookie `name`
    $sessionCookieName = mosMainFrame::sessionCookieName();
    // Get Session Cookie `value`
    $sessioncookie = mosGetParam($_COOKIE, $sessionCookieName, null);
    if (!(strlen($sessioncookie) == 32 || $sessioncookie == '-')) {
        mosErrorAlert(_NOT_AUTH);
    }
    $itemid = intval(mosGetParam($_POST, 'itemid', 0));
    $now = _CURRENT_SERVER_TIME;
    $nullDate = $database->getNullDate();
    // query to check for state and access levels
    $query = "SELECT a.*, cc.name AS category, s.name AS section, s.published AS sec_pub, cc.published AS cat_pub," . "\n  s.access AS sec_access, cc.access AS cat_access, s.id AS sec_id, cc.id as cat_id" . "\n FROM #__content AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope = 'content'" . "\n WHERE a.id = " . (int) $uid . "\n AND a.state = 1" . "\n AND a.access <= " . (int) $gid . "\n AND ( a.publish_up = " . $database->Quote($nullDate) . " OR a.publish_up <= " . $database->Quote($now) . " )" . "\n AND ( a.publish_down = " . $database->Quote($nullDate) . " OR a.publish_down >= " . $database->Quote($now) . " )";
    $database->setQuery($query);
    $row = NULL;
    if ($database->loadObject($row)) {
        /*
         * check whether category is published
         */
        if (!$row->cat_pub && $row->catid) {
            mosNotAuth();
            return;
        }
        /*
         * check whether section is published
         */
        if (!$row->sec_pub && $row->sectionid) {
            mosNotAuth();
            return;
        }
        /*
         * check whether category access level allows access
         */
        if ($row->cat_access > $gid && $row->catid) {
            mosNotAuth();
            return;
        }
        /*
         * check whether section access level allows access
         */
        if ($row->sec_access > $gid && $row->sectionid) {
            mosNotAuth();
            return;
        }
        $email = strval(mosGetParam($_POST, 'email', ''));
        $yourname = strval(mosGetParam($_POST, 'yourname', ''));
        $youremail = strval(mosGetParam($_POST, 'youremail', ''));
        $subject = strval(mosGetParam($_POST, 'subject', ''));
        if (empty($subject)) {
            $subject = _EMAIL_INFO . ' ' . $yourname;
        }
        if ($uid < 1 || !$email || !$youremail || JosIsValidEmail($email) == false || JosIsValidEmail($youremail) == false) {
            mosErrorAlert(_EMAIL_ERR_NOINFO);
        }
        $query = "SELECT template" . "\n FROM #__templates_menu" . "\n WHERE client_id = 0" . "\n AND menuid = 0";
        $database->setQuery($query);
        $template = $database->loadResult();
        // determine Itemid for Item
        if ($itemid) {
            $_itemid = '&Itemid=' . $itemid;
        } else {
            $itemid = $mainframe->getItemid($uid, 0, 0);
            $_itemid = '&Itemid=' . $itemid;
        }
        // link sent in email
        $link = sefRelToAbs('index.php?option=com_content&task=view&id=' . $uid . $_itemid);
        // message text
        $msg = sprintf(_EMAIL_MSG, html_entity_decode($mosConfig_sitename, ENT_QUOTES), $yourname, $youremail, $link);
        // mail function
        $success = mosMail($youremail, $yourname, $email, $subject, $msg);
        if (!$success) {
            mosErrorAlert(_EMAIL_ERR_NOINFO);
        }
        HTML_content::emailSent($email, $template);
    } else {
        mosNotAuth();
        return;
    }
}
/**
* Compiles a list of frontpage items
*/
function viewFrontPage($option)
{
    global $database, $mainframe, $mosConfig_list_limit;
    $catid = intval($mainframe->getUserStateFromRequest("catid{$option}", 'catid', 0));
    $filter_authorid = intval($mainframe->getUserStateFromRequest("filter_authorid{$option}", 'filter_authorid', 0));
    $filter_sectionid = intval($mainframe->getUserStateFromRequest("filter_sectionid{$option}", 'filter_sectionid', 0));
    $limit = intval($mainframe->getUserStateFromRequest("viewlistlimit", 'limit', $mosConfig_list_limit));
    $limitstart = intval($mainframe->getUserStateFromRequest("view{$option}limitstart", 'limitstart', 0));
    $search = $mainframe->getUserStateFromRequest("search{$option}", 'search', '');
    if (get_magic_quotes_gpc()) {
        $search = stripslashes($search);
    }
    $where = array("c.state >= 0");
    // used by filter
    if ($filter_sectionid > 0) {
        $where[] = "c.sectionid = " . (int) $filter_sectionid;
    }
    if ($catid > 0) {
        $where[] = "c.catid = " . (int) $catid;
    }
    if ($filter_authorid > 0) {
        $where[] = "c.created_by = " . (int) $filter_authorid;
    }
    if ($search) {
        $where[] = "LOWER( c.title ) LIKE '%" . $database->getEscaped(trim(strtolower($search))) . "%'";
    }
    // get the total number of records
    $query = "SELECT count(*)" . "\n FROM #__content AS c" . "\n INNER JOIN #__categories AS cc ON cc.id = c.catid" . "\n INNER JOIN #__sections AS s ON s.id = cc.section AND s.scope='content'" . "\n INNER JOIN #__content_frontpage AS f ON f.content_id = c.id" . (count($where) ? "\n WHERE " . implode(' AND ', $where) : '');
    $database->setQuery($query);
    $total = $database->loadResult();
    require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php';
    $pageNav = new mosPageNav($total, $limitstart, $limit);
    $query = "SELECT c.*, g.name AS groupname, cc.name, s.name AS sect_name, u.name AS editor, f.ordering AS fpordering, v.name AS author" . "\n FROM #__content AS c" . "\n INNER JOIN #__categories AS cc ON cc.id = c.catid" . "\n INNER JOIN #__sections AS s ON s.id = cc.section AND s.scope='content'" . "\n INNER JOIN #__content_frontpage AS f ON f.content_id = c.id" . "\n INNER JOIN #__groups AS g ON g.id = c.access" . "\n LEFT JOIN #__users AS u ON u.id = c.checked_out" . "\n LEFT JOIN #__users AS v ON v.id = c.created_by" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : "") . "\n ORDER BY f.ordering";
    $database->setQuery($query, $pageNav->limitstart, $pageNav->limit);
    $rows = $database->loadObjectList();
    if ($database->getErrorNum()) {
        echo $database->stderr();
        return false;
    }
    // get list of categories for dropdown filter
    $query = "SELECT cc.id AS value, cc.title AS text, section" . "\n FROM #__categories AS cc" . "\n INNER JOIN #__sections AS s ON s.id = cc.section " . "\n ORDER BY s.ordering, cc.ordering";
    $categories[] = mosHTML::makeOption('0', _SEL_CATEGORY);
    $database->setQuery($query);
    $categories = array_merge($categories, $database->loadObjectList());
    $lists['catid'] = mosHTML::selectList($categories, 'catid', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', $catid);
    // get list of sections for dropdown filter
    $javascript = 'onchange="document.adminForm.submit();"';
    $lists['sectionid'] = mosAdminMenus::SelectSection('filter_sectionid', $filter_sectionid, $javascript);
    // get list of Authors for dropdown filter
    $query = "SELECT c.created_by, u.name" . "\n FROM #__content AS c" . "\n INNER JOIN #__sections AS s ON s.id = c.sectionid" . "\n LEFT JOIN #__users AS u ON u.id = c.created_by" . "\n WHERE c.state != -1" . "\n AND c.state != -2" . "\n GROUP BY u.name" . "\n ORDER BY u.name";
    $authors[] = mosHTML::makeOption('0', _SEL_AUTHOR, 'created_by', 'name');
    $database->setQuery($query);
    $authors = array_merge($authors, $database->loadObjectList());
    $lists['authorid'] = mosHTML::selectList($authors, 'filter_authorid', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'created_by', 'name', $filter_authorid);
    HTML_content::showList($rows, $search, $pageNav, $option, $lists);
}
                        //$Itemid = $mainframe->getItemid( $row->id, 0, 0, $bs, $bc, $gbs );
                        $query = "SELECT id" . "\n FROM #__menu" . "\n WHERE " . "\n link LIKE '%task=section&id=" . $row->sectionid . "%'" . "\n OR link LIKE '%sectionid=" . $row->sectionid . "%'";
                        $database->setQuery($query);
                        $Itemid = $database->loadResult();
                        break;
                }
                // Blank itemid checker for SEF
                /*
                if ($Itemid == NULL) {
                	$Itemid = '';
                } else {
                	$Itemid = '&amp;Itemid='. $Itemid;
                }
                */
                $link = sefRelToAbs('index.php?option=com_content&amp;task=view&amp;id=' . $row->id . $Itemid);
                echo "<td valign=top>\n";
                //echo '<a href="'.$link.'">'.$row->title.'</a>'."\n";
                $newrow->load($row->id);
                $newrow->text = $newrow->introtext;
                $newrow->groups = '';
                $ItemidCount = array('bc' => $bc, 'bs' => $bs, 'gbs' => $gbs);
                //$params->set( 'readmore', 0 );
                HTML_content::show($newrow, $params, $access, 0, 'com_content', $ItemidCount);
                //print_r($ItemidCount);
                //echo '<a class="readon" href="'.$link.'">Read More..</a>'."\n";
                echo "</td>\n";
            }
            echo "</tr>\n</table>\n";
            break;
    }
}
Exemple #9
0
/**
* Displays front page settings option
*/
function viewSettings($option, $act)
{
    global $database;
    $database->setQuery("SELECT col_main FROM #__templates WHERE id=0");
    $col = $database->loadResult();
    $params = array();
    $database->setQuery("SELECT params FROM #__menu WHERE link='index.php?option=com_frontpage'");
    $param = mosParseParams($database->loadResult());
    $params['count'] = isset($param->count) ? $param->count : 6;
    $params['intro'] = isset($param->intro) ? $param->intro : 3;
    $params['image'] = @$param->image ? 1 : 0;
    $params['header'] = @$param->header;
    $params['empty'] = @$param->empty;
    $params['orderby'] = @$param->orderby;
    $params['image'] = mosHTML::yesnoSelectList('image', 'class="inputbox" size="1"', $params['image']);
    $orderby[] = mosHTML::makeOption('ordering', 'Ordering');
    $orderby[] = mosHTML::makeOption('date', 'Date asc');
    $orderby[] = mosHTML::makeOption('rdate', 'Date desc');
    $params['orderby'] = mosHTML::selectList($orderby, 'orderby', 'class="inputbox" size="1"', 'value', 'text', $params['orderby']);
    HTML_content::showSettings($col, $option, $params, $act);
}
Exemple #10
0
/**
* Shows the email form for a given content item.
*/
function emailContentSend($uid)
{
    global $database, $mainframe;
    global $mosConfig_live_site, $mosConfig_sitename;
    global $mosConfig_mailfrom, $mosConfig_fromname;
    $_Itemid = $mainframe->getItemid($uid, 0, 0);
    $email = trim(mosGetParam($_POST, 'email', ''));
    $yourname = trim(mosGetParam($_POST, 'yourname', ''));
    $youremail = trim(mosGetParam($_POST, 'youremail', ''));
    $subject_default = sprintf(T_('Item sent by %s'), $yourname);
    $subject = trim(mosGetParam($_POST, 'subject', $subject_default));
    session_start();
    $form_check = mosGetParam($_POST, 'form_check', '');
    if (empty($_SESSION['_form_check_']['com_content']) || $form_check != $_SESSION['_form_check_']['com_content']) {
        // the form hasn't been generated by the server on this session
        exit;
    }
    if (!$email || !$youremail || is_email($email) == false || is_email($youremail) == false) {
        echo "<script>alert (\"" . T_('You must enter valid e-mail addresses for both yourself and your recipient.') . "\"); window.history.go(-1);</script>";
        exit(0);
    }
    $template = '';
    $database->setQuery("SELECT template FROM #__templates_menu WHERE client_id='0' AND menuid='0'");
    $template = $database->loadResult();
    // link sent in email
    $link = sefRelToAbs($mosConfig_live_site . '/index.php?option=com_content&task=view&id=' . $uid . '&Itemid=' . $_Itemid);
    // message text
    $msg = sprintf(T_(' The following page from the \\"%s\\" website has been sent to you by %s ( %s ).\\n\\nYou can access it at the following url:\\n%s'), $mosConfig_sitename, $yourname, $youremail, $link);
    // mail function
    mosMail($mosConfig_mailfrom, $mosConfig_fromname, $email, $subject, $msg);
    HTML_content::emailSent($email, $template);
}
Exemple #11
0
 /**
  * Method to replace HTML content
  *
  * @param int   $id
  * @param int   $tpl
  *
  * @return string
  */
 public function replaceContentHtml($id, $tpl)
 {
     $content = '';
     if ($id != 0) {
         // Editor user type check
         $access = new stdClass();
         $access->canEdit = $access->canEditOwn = $access->canPublish = 0;
         $row = $this->retrieveContent($id);
         if ($row) {
             $params = $row->params;
             $model = new BwPostmanModelNewsletter();
             $lang = $model->getArticleLanguage($row->id);
             $_Itemid = ContentHelperRoute::getArticleRoute($row->id, 0, $lang);
             $link = JRoute::_(JURI::base());
             if ($_Itemid) {
                 $link .= $_Itemid;
             }
             //				$app->triggerEvent('onPrepareContent', array(&$row, &$params, 0), true);
             $intro_text = $row->text;
             $html_content = new HTML_content();
             ob_start();
             // Displays Item Title
             $html_content->Title($row, $params, $access);
             $content .= ob_get_contents();
             ob_end_clean();
             // Displays Category
             ob_start();
             // Displays Created Date
             if ($tpl->article['show_createdate'] != 0) {
                 $html_content->CreateDate($row, $params);
             }
             // Displays Author Name
             if ($tpl->article['show_author'] != 0) {
                 $html_content->Author($row, $params);
             }
             // Displays Urls
             $content .= ob_get_contents();
             ob_end_clean();
             $content .= '<div class="intro_text">' . $intro_text . '</div>';
             if ($tpl->article['show_readon'] != 0) {
                 $content .= '<div class="read_on">' . '		<p>' . '		<a href="' . str_replace('administrator/', '', $link) . '" class="readon">' . JText::_('READ_MORE') . '		</a><br/><br/>' . '		</p>' . '	</div>';
             }
             return stripslashes($content);
         }
     }
     return JText::sprintf('COM_BWPOSTMAN_NL_ERROR_RETRIEVING_CONTENT', $id);
 }