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 / smilies / smilies.php < prev    next >
Encoding:
PHP Script  |  2007-09-09  |  6.7 KB  |  122 lines

  1. <?php
  2. // $Id: smilies.php 1029 2007-09-09 03:49:25Z phppp $
  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. function SmilesAdmin()
  36. {
  37.     $db =& Database::getInstance();
  38.     $url_smiles = XOOPS_UPLOAD_URL;
  39.     $myts =& MyTextSanitizer::getInstance();
  40.     xoops_cp_header();
  41.     echo "<h4 style='text-align:left;'>"._AM_SMILESCONTROL."</h4>";
  42.  
  43.     if ($getsmiles = $db->query("SELECT * FROM ".$db->prefix("smiles"))) {
  44.         if (($numsmiles = $db->getRowsNum($getsmiles)) == "0") {
  45.             //EMPTY
  46.         } else {
  47.             echo '<form action="admin.php" method="post"><table width="100%" class="outer" cellpadding="4" cellspacing="1">';
  48.             echo "<tr align='center'><th align='left'>" ._AM_CODE."</th>";
  49.             echo "<th>" ._AM_SMILIE."</th>";
  50.             echo "<th>"._AM_SMILEEMOTION."</th>";
  51.             echo "<th>" ._AM_DISPLAYF."</th>";
  52.             echo "<th>"._AM_ACTION."</th>";
  53.             echo "</tr>\n";
  54.             $i = 0;
  55.             while ($smiles = $db->fetchArray($getsmiles)) {
  56.                 if ($i % 2 == 0) {
  57.                     $class = 'even';
  58.                 } else {
  59.                     $class= 'odd';
  60.                 }
  61.                 $smiles['code'] = $myts->makeTboxData4Show($smiles['code']);
  62.                 $smiles['smile_url'] = $myts->makeTboxData4Edit($smiles['smile_url']);
  63.                 $smiles['smile_emotion'] = $myts->makeTboxData4Edit($smiles['emotion']);
  64.                 echo "<tr align='center' class='$class'>";
  65.                 echo "<td align='left'>".$smiles['code']."</td>";
  66.                 echo "<td><img src='".$url_smiles."/".$smiles['smile_url']."' alt='' /></td>";
  67.                 echo '<td>'.$smiles['smile_emotion'].'</td>';
  68.                 echo '<td><input type="hidden" name="smile_id['.$i.']" value="'.$smiles['id'].'" /><input type="hidden" name="old_display['.$i.']" value="'.$smiles['display'].'" /><input type="checkbox" value="1" name="smile_display['.$i.']"';
  69.                 if ($smiles['display'] == 1) {
  70.                     echo ' checked="checked"';
  71.                 }
  72.                 echo " /></td><td><a href='admin.php?fct=smilies&op=SmilesEdit&id=".$smiles['id']."'>" ._AM_EDIT."</a> ";
  73.                 echo "<a href='admin.php?fct=smilies&op=SmilesDel&id=".$smiles['id']."'>" ._AM_DEL."</a></td>";
  74.                 echo "</tr>\n";
  75.                 $i++;
  76.             }
  77.             echo '<tr><td class="foot" colspan="5" align="center"><input type="hidden" name="op" value="SmilesUpdate" /><input type="hidden" name="fct" value="smilies" />'.$GLOBALS['xoopsSecurity']->getTokenHTML().'<input type="submit" value="'._SUBMIT.'" /></tr></table></form>';
  78.         }
  79.     } else {
  80.         echo _AM_CNRFTSD;
  81.     }
  82.     $smiles['smile_code'] = '';
  83.     $smiles['smile_url'] = 'blank.gif';
  84.     $smiles['smile_desc'] = '';
  85.     $smiles['smile_display'] = 1;
  86.     $smiles['smile_form'] = _AM_ADDSMILE;
  87.     $smiles['op'] = 'SmilesAdd';
  88.     $smiles['id'] = '';
  89.     include XOOPS_ROOT_PATH.'/modules/system/admin/smilies/smileform.php';
  90.     $smile_form->display();
  91.     xoops_cp_footer();
  92. }
  93.  
  94. function SmilesEdit($id)
  95. {
  96.     $db =& Database::getInstance();
  97.     $myts =& MyTextSanitizer::getInstance();
  98.     xoops_cp_header();
  99.     echo '<a href="admin.php?fct=smilies">'._AM_SMILESCONTROL .'</a> <span style="font-weight:bold;">»»</span> '._AM_EDITSMILE.'<br /><br />';
  100.     if ($getsmiles = $db->query("SELECT * FROM ".$db->prefix("smiles")." WHERE id = $id")) {
  101.         $numsmiles = $db->getRowsNum($getsmiles);
  102.         if ( $numsmiles == 0 ) {
  103.             //EMPTY
  104.         } else {
  105.             if ($smiles = $db->fetchArray($getsmiles)) {
  106.                 $smiles['smile_code'] = $myts->makeTboxData4Edit($smiles['code']);
  107.                 $smiles['smile_url'] = $myts->makeTboxData4Edit($smiles['smile_url']);
  108.                 $smiles['smile_desc'] = $myts->makeTboxData4Edit($smiles['emotion']);
  109.                 $smiles['smile_display'] = $smiles['display'];
  110.                 $smiles['smile_form'] = _AM_EDITSMILE;
  111.                 $smiles['op'] = 'SmilesSave';
  112.                 include XOOPS_ROOT_PATH.'/modules/system/admin/smilies/smileform.php';
  113.                 $smile_form->addElement(new XoopsFormHidden('old_smile', $smiles['smile_url']));
  114.                 $smile_form->display();
  115.             }
  116.         }
  117.     } else {
  118.         echo _AM_CNRFTSD;
  119.     }
  120.     xoops_cp_footer();
  121. }
  122. ?>