Source for file weblinks.php
Documentation is available at weblinks.php
* @author Mambo Foundation Inc see README.php
* @copyright Mambo Foundation Inc.
* See COPYRIGHT.php for copyright notices and details.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see
* Mambo is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2 of the
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
/** load the html drawing class */
require_once( $mainframe->getPath( 'front_html' ) );
require_once( $mainframe->getPath( 'class' ) );
$mainframe->setPageTitle( T_('Web Links') );
/** disabled until permissions system can handle it */
global $mainframe, $database, $my;
global $mosConfig_shownoauth, $mosConfig_live_site, $mosConfig_absolute_path;
global $cur_template, $Itemid;
/* Query to retrieve all categories that belong under the web links section and that are published. */
$query =
"SELECT *, COUNT(a.id) AS numlinks FROM #__categories AS cc"
.
"\n LEFT JOIN #__weblinks AS a ON a.catid = cc.id"
.
"\n WHERE a.published='1' AND a.approved='1' AND section='com_weblinks' AND cc.published='1' AND cc.access <= '$my->gid'"
.
"\n ORDER BY cc.ordering"
$database->setQuery( $query );
$categories =
$database->loadObjectList();
// url links info for category
$query =
"SELECT id, url, title, description, date, hits, params FROM #__weblinks"
.
"\nWHERE catid = '$catid' AND published='1' AND approved='1' AND archived=0"
$database->setQuery( $query );
$rows =
$database->loadObjectList();
$query =
"SELECT name, description, image, image_position FROM #__categories"
.
"\n WHERE id = '$catid'"
.
"\n AND published = '1'"
$database->setQuery( $query );
$database->loadObject( $currentcat );
$params->def( 'page_title', 1 );
$params->def( 'header', $menu->name );
$params->def( 'pageclass_sfx', '' );
$params->def( 'headings', 1 );
$params->def( 'hits', $mainframe->getCfg( 'hits' ) );
$params->def( 'item_description', 1 );
$params->def( 'other_cat_section', 1 );
$params->def( 'other_cat', 1 );
$params->def( 'description', 1 );
$params->def( 'description_text', T_('From the list below choose one of our web link categories, then select a URL to visit the site.') );
$params->def( 'image', '-1' );
$params->def( 'weblink_icons', '' );
$params->def( 'image_align', 'right' );
$params->def( 'back_button', $mainframe->getCfg( 'back_button' ) );
$params->set( 'type', 'category' );
$params->set( 'type', 'section' );
$currentcat->descrip =
'';
if( ( @$currentcat->description ) <>
'' ) {
$currentcat->descrip =
$currentcat->description;
if ( $params->get( 'description' ) ) {
$currentcat->descrip =
$params->get( 'description_text' );
$path =
$mosConfig_live_site .
'/images/stories/';
if ( ( @$currentcat->image ) <>
'' ) {
$currentcat->img =
$path .
$currentcat->image;
$currentcat->align =
$currentcat->image_position;
if ( $params->get( 'image' ) <> -
1 ) {
$currentcat->img =
$path .
$params->get( 'image' );
$currentcat->align =
$params->get( 'image_align' );
if ( @$currentcat->name <>
'' ) {
$currentcat->header =
$currentcat->name;
$pathway->addItem($currentcat->name, '');
$currentcat->header =
$params->get( 'header' );
// used to show table rows in alternating colours
$tabclass =
array( 'sectiontableentry1', 'sectiontableentry2' );
HTML_weblinks::displaylist( $categories, $rows, $catid, $currentcat, $params, $tabclass );
$sql=
"UPDATE #__weblinks SET hits = hits + 1 WHERE id = ".
$id .
"";
$database->setQuery( $sql );
$database->setQuery( "SELECT url FROM #__weblinks WHERE id = ".
$id .
"" );
$url =
$database->loadResult();
global $mosConfig_absolute_path, $mosConfig_live_site;
// load the row from the db table
// fail if checked out not by 'me'
if ($row->checked_out &&
$row->checked_out <>
$my->id) {
mosRedirect( "index2.php?option=$option",sprintf(T_('The module %s is currently being edited by another administrator.'), $row->title) );
$row->checkout( $my->id );
// make the select list for the image positions
$yesno[] = mosHTML::makeOption( '0', 'No' );
$yesno[] = mosHTML::makeOption( '1', 'Yes' );
// build the html select list
$applist = mosHTML::selectList( $yesno, 'approved', 'class="inputbox" size="2"', 'value', 'text', $row->approved );
// build the html select list for ordering
$query = "SELECT ordering AS value, title AS text"
. "\n WHERE catid='$row->catid'"
$lists['ordering'] = mosAdminMenus::SpecificOrdering( $row, $id, $query, 1 );
// build list of categories
require_once($mosConfig_absolute_path.
'/administrator/includes/mosAdminMenus.php');
* Saves the record on an edit form submit
* @param database A database connector object
global $database, $my, $mosConfig_absolute_path, $mosConfig_mailfrom;
if (!$row->bind( $_POST, "approved published" )) {
echo
"<script> alert('".
$row->getError().
"'); window.history.go(-1); </script>\n";
$row->title =
$database->getEscaped($row->title);
$row->catid =
$database->getEscaped($row->catid);
echo
"<script> alert('".
$row->getError().
"'); window.history.go(-1); </script>\n";
echo
"<script> alert('".
$row->getError().
"'); window.history.go(-1); </script>\n";
// messaging for new items
require_once( $mosConfig_absolute_path .
'/components/com_messages/messages.class.php' );
$query =
"SELECT id,email FROM #__users WHERE sendEmail = '1'";
$database->setQuery( $query );
$rows =
$database->loadObjectList();
foreach ($rows as $user) {
$msg->send( $my->id, $user->id, T_("New Item"), sprintf( T_('A new WebLink has been submitted by [ %s ] titled [ %s ] '), $my->username, $row->title ) );
mosMail ( $mosConfig_mailfrom, $mosConfig_mailfrom, $user->email, "A new Web Link has been submitted", 'A new WebLink has been submitted by ['.
$my->username.
'] titled ['.
$row->title.
']. Please login to view and approve it.');
$msg =
$isNew ?
T_('Thanks for your submission; it will be reviewed before being posted to the site.') :
'';
Documentation generated on Mon, 05 May 2008 16:24:16 +0400 by phpDocumentor 1.4.0