home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / CMS / xoops-2.0.18.1.exe / xoops-2.0.18.1 / htdocs / modules / system / admin / userrank / userrank.php < prev    next >
Encoding:
PHP Script  |  2005-11-03  |  5.3 KB  |  108 lines

  1. <?php
  2. // $Id: userrank.php 2 2005-11-02 18:23:29Z skalpa $
  3. //  ------------------------------------------------------------------------ //
  4. //                XOOPS - PHP Content Management System                      //
  5. //                    Copyright (c) 2000 XOOPS.org                           //
  6. //                       <http://www.xoops.org/>                             //
  7. //  ------------------------------------------------------------------------ //
  8. //  This program is free software; you can redistribute it and/or modify     //
  9. //  it under the terms of the GNU General Public License as published by     //
  10. //  the Free Software Foundation; either version 2 of the License, or        //
  11. //  (at your option) any later version.                                      //
  12. //                                                                           //
  13. //  You may not change or alter any portion of this comment or credits       //
  14. //  of supporting developers from this source code or any supporting         //
  15. //  source code which is considered copyrighted (c) material of the          //
  16. //  original comment or credit authors.                                      //
  17. //                                                                           //
  18. //  This program is distributed in the hope that it will be useful,          //
  19. //  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
  20. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
  21. //  GNU General Public License for more details.                             //
  22. //                                                                           //
  23. //  You should have received a copy of the GNU General Public License        //
  24. //  along with this program; if not, write to the Free Software              //
  25. //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
  26. //  ------------------------------------------------------------------------ //
  27. // Author: Kazumi Ono (AKA onokazu)                                          //
  28. // URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
  29. // Project: The XOOPS Project                                                //
  30. // ------------------------------------------------------------------------- //
  31.  
  32. if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
  33.     exit("Access Denied");
  34. }
  35.  
  36. function RankForumAdmin()
  37. {
  38.     $db =& Database::getInstance();
  39.     xoops_cp_header();
  40.     echo "<h4 style='text-align:left;'>"._AM_RANKSSETTINGS."</h4>
  41.     <table width='100%' class='outer' cellpadding='4' cellspacing='1'>
  42.     <tr align='center'>
  43.     <th align='left'>"._AM_TITLE."</th>
  44.     <th>"._AM_MINPOST."</th>
  45.     <th>"._AM_MAXPOST."</th>
  46.     <th>"._AM_IMAGE."</th>
  47.     <th>"._AM_SPERANK."</th>
  48.     <th>"._AM_ACTION."</th></tr>";
  49.     $result = $db->query("SELECT * FROM ".$db->prefix("ranks")." ORDER BY rank_id");
  50.     $count = 0;
  51.     while ( $rank = $db->fetchArray($result) ) {
  52.         if ($count % 2 == 0) {
  53.             $class = 'even';
  54.         } else {
  55.             $class = 'odd';
  56.         }
  57.         echo "<tr class='$class' align='center'>
  58.         <td align='left'>".$rank['rank_title']."</td>
  59.         <td>".$rank['rank_min']."</td>
  60.         <td>".$rank['rank_max']."</td>
  61.         <td>";
  62.         if ($rank['rank_image'] && file_exists(XOOPS_UPLOAD_PATH.'/'.$rank['rank_image'])) {
  63.             echo '<img src="'.XOOPS_UPLOAD_URL.'/'.$rank['rank_image'].'" alt="" /></td>';
  64.         } else {
  65.             echo ' ';
  66.         }
  67.         if ($rank['rank_special'] == 1) {
  68.             echo '<td>'._AM_ON.'</td>';
  69.         } else {
  70.             echo '<td>'._AM_OFF.'</td>';
  71.         }
  72.         echo"<td><a href='admin.php?fct=userrank&op=RankForumEdit&rank_id=".$rank['rank_id']."'>"._AM_EDIT."</a> <a href='admin.php?fct=userrank&op=RankForumDel&rank_id=".$rank['rank_id']."&ok=0'>"._AM_DEL."</a></td></tr>";
  73.         $count++;
  74.     }
  75.     echo '</table><br /><br />';
  76.     $rank['rank_min'] = 0;
  77.     $rank['rank_max'] = 0;
  78.     $rank['rank_special'] = 0;
  79.     $rank['rank_id'] = '';
  80.     $rank['rank_title'] = '';
  81.     $rank['rank_image'] = 'blank.gif';
  82.     $rank['form_title'] = _AM_ADDNEWRANK;
  83.     $rank['op'] = 'RankForumAdd';
  84.     include_once XOOPS_ROOT_PATH.'/modules/system/admin/userrank/rankform.php';
  85.     $rank_form->display();
  86.     xoops_cp_footer();
  87. }
  88.  
  89.  
  90. function RankForumEdit($rank_id)
  91. {
  92.     $db =& Database::getInstance();
  93.     $myts =& MyTextSanitizer::getInstance();
  94.     xoops_cp_header();
  95.     echo '<a href="admin.php?fct=userrank">'. _AM_RANKSSETTINGS .'</a> <span style="font-weight:bold;">»»</span> '._AM_EDITRANK.'<br /><br />';
  96.     $result = $db->query("SELECT * FROM ".$db->prefix("ranks")." WHERE rank_id=".$rank_id);
  97.     $rank = $db->fetchArray($result);
  98.     $rank['rank_title'] = $myts->makeTboxData4Edit($rank['rank_title']);
  99.     $rank['rank_image'] = $myts->makeTboxData4Edit($rank['rank_image']);
  100.     $rank['form_title'] = _AM_EDITRANK;
  101.     $rank['op'] = 'RankForumSave';
  102.     include_once XOOPS_ROOT_PATH.'/modules/system/admin/userrank/rankform.php';
  103.     $rank_form->addElement(new XoopsFormHidden('old_rank', $rank['rank_image']));
  104.     $rank_form->display();
  105.     xoops_cp_footer();
  106. }
  107.  
  108. ?>