[ Index ]
 

Code source de Joomla 1.0.13

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/administrator/components/com_syndicate/ -> admin.syndicate.php (source)

   1  <?php
   2  /**
   3  * @version $Id: admin.syndicate.php 3714 2006-05-29 03:55:59Z stingrey $
   4  * @package Joomla
   5  * @subpackage Syndicate
   6  * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
   7  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
   8  * Joomla! is free software. This version may have been modified pursuant
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and details.
  13  */
  14  
  15  // no direct access
  16  defined( '_VALID_MOS' ) or die( 'Restricted access' );
  17  
  18  // ensure user has access to this function
  19  if (!($acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'components', 'all' ) | $acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'components', 'com_contact' ))) {
  20      mosRedirect( 'index2.php', _NOT_AUTH );
  21  }
  22  
  23  require_once( $mainframe->getPath( 'admin_html' ) );
  24  
  25  switch ($task) {
  26      case 'save':
  27          saveSyndicate( $option );
  28          break;
  29  
  30        case 'cancel':
  31          cancelSyndicate( );
  32          break;
  33  
  34      default:
  35          showSyndicate( $option );
  36          break;
  37  }
  38  
  39  /**
  40  * List the records
  41  * @param string The current GET/POST option
  42  */
  43  function showSyndicate( $option ) {
  44      global $database, $mainframe;
  45  
  46      $query = "SELECT a.id"
  47      . "\n FROM #__components AS a"
  48      . "\n WHERE ( a.admin_menu_link = 'option=com_syndicate' OR a.admin_menu_link = 'option=com_syndicate&hidemainmenu=1' )"
  49      . "\n AND a.option = 'com_syndicate'"
  50      ;
  51      $database->setQuery( $query );
  52      $id = $database->loadResult();
  53  
  54      // load the row from the db table
  55      $row = new mosComponent( $database );
  56      $row->load( $id );
  57  
  58      // get params definitions
  59      $params = new mosParameters( $row->params, $mainframe->getPath( 'com_xml', $row->option ), 'component' );
  60  
  61      HTML_syndicate::settings( $option, $params, $id );
  62  }
  63  
  64  /**
  65  * Saves the record from an edit form submit
  66  * @param string The current GET/POST option
  67  */
  68  function saveSyndicate( $option ) {
  69      global $database;
  70  
  71      $params = mosGetParam( $_POST, 'params', '' );
  72      if (is_array( $params )) {
  73          $txt = array();
  74          foreach ($params as $k=>$v) {
  75              $txt[] = "$k=$v";
  76          }
  77          $_POST['params'] = mosParameters::textareaHandling( $txt );
  78      }
  79  
  80      $id = intval( mosGetParam( $_POST, 'id', '17' ) );
  81      $row = new mosComponent( $database );
  82      $row->load( $id );
  83  
  84      if (!$row->bind( $_POST )) {
  85          echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
  86          exit();
  87      }
  88  
  89      if (!$row->check()) {
  90          echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
  91          exit();
  92      }
  93      if (!$row->store()) {
  94          echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
  95          exit();
  96      }
  97  
  98      $msg = 'Settings successfully Saved';
  99      mosRedirect( 'index2.php?option='. $option, $msg );
 100  }
 101  
 102  /**
 103  * Cancels editing and checks in the record
 104  */
 105  function cancelSyndicate(){
 106      mosRedirect( 'index2.php' );
 107  }
 108  ?>


Généré le : Wed Nov 21 14:43:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics