Beehive PHP Cross Reference Discussion Forums

Source: /display_emoticons.php - 155 lines - 5279 bytes - Summary - Text - Print

   1  <?php
   2  
   3  /*======================================================================
   4  Copyright Project Beehive Forum 2002
   5  
   6  This file is part of Beehive Forum.
   7  
   8  Beehive Forum 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 3 of the License, or
  11  (at your option) any later version.
  12  
  13  Beehive Forum is distributed in the hope that it will be useful,
  14  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16  GNU General Public License for more details.
  17  
  18  You should have received a copy of the GNU General Public License
  19  along with Beehive; if not, write to the Free Software
  20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  21  USA
  22  ======================================================================*/
  23  
  24  // Bootstrap
  25  require_once  'boot.php';
  26  
  27  // Required includes
  28  require_once  BH_INCLUDE_PATH . 'constants.inc.php';
  29  require_once  BH_INCLUDE_PATH . 'emoticons.inc.php';
  30  require_once  BH_INCLUDE_PATH . 'form.inc.php';
  31  require_once  BH_INCLUDE_PATH . 'format.inc.php';
  32  require_once  BH_INCLUDE_PATH . 'forum.inc.php';
  33  require_once  BH_INCLUDE_PATH . 'html.inc.php';
  34  require_once  BH_INCLUDE_PATH . 'session.inc.php';
  35  // End Required includes
  36  
  37  // Check we're logged in correctly
  38  if (!session::logged_in()) {
  39      html_guest_error();
  40  }
  41  
  42  // Array to hold the emoticons
  43  $emoticon = array();
  44  
  45  // Get array of available emoticon sets
  46  $emoticon_sets_array = emoticons_get_available(false);
  47  
  48  // Check for preview argument in URL.
  49  if (isset($_GET['pack']) && emoticons_set_exists($_GET['pack'])) {
  50  
  51      // Get the emoticon pack from the URL.
  52      $emoticon_set = basename($_GET['pack']);
  53  
  54  } else if (isset($_SESSION['EMOTICONS']) && strlen(trim($_SESSION['EMOTICONS'])) > 0) {
  55  
  56      $emoticon_set = $_SESSION['EMOTICONS'];
  57  
  58  } else {
  59  
  60      // Get the user's emoticon pack.
  61      $emoticon_set = basename(forum_get_setting('default_emoticons', null, 'default'));
  62  }
  63  
  64  // Check the emoticon set exists.
  65  if (!emoticons_set_exists($emoticon_set)) {
  66  
  67      // Use the forum default emoticon pack.
  68      $emoticon_set = basename(forum_get_setting('default_emoticons', null, 'default'));
  69  }
  70  
  71  // Make sure the emoticon set has no path info.
  72  $emoticon_set = basename($emoticon_set);
  73  
  74  // Output starts here
  75  html_draw_top(sprintf("title=%s", gettext("Emoticons")), "js/emoticons.js", 'pm_popup_disabled', 'class=window_title', "emoticons=$emoticon_set");
  76  
  77  echo "<h1>", gettext("Emoticons"), "</h1>\n";
  78  echo "<br />\n";
  79  echo "<div align=\"center\">\n";
  80  echo "<table cellpadding=\"0\" cellspacing=\"0\" width=\"450\">\n";
  81  echo "  <tr>\n";
  82  echo "    <td align=\"left\">\n";
  83  echo "      <table class=\"box\" width=\"100%\">\n";
  84  echo "        <tr>\n";
  85  echo "          <td align=\"left\" valign=\"top\">\n";
  86  echo "            <table class=\"posthead\" width=\"100%\">\n";
  87  echo "              <tr>\n";
  88  echo "                <td align=\"left\" class=\"subhead\">", gettext("Emoticons"), "</td>\n";
  89  echo "              </tr>\n";
  90  echo "              <tr>\n";
  91  echo "                <td align=\"center\">\n";
  92  echo "                  <table class=\"posthead\" width=\"95%\">\n";
  93  echo "                    <tr>\n";
  94  
  95  // Array to hold text to emoticon lookups.
  96  $emoticon = array();
  97  
  98  // Array to hold emoticon to text lookups
  99  $emoticon_text = array();
 100  
 101  // Include the emoticon pack.
 102  if (@file_exists(__DIR__ . "/emoticons/$emoticon_set/definitions.php")) {
 103      /** @noinspection PhpIncludeInspection */
 104      include(__DIR__ . "/emoticons/$emoticon_set/definitions.php");
 105  }
 106  
 107  // Group emoticons by text
 108  if (sizeof($emoticon) > 0) {
 109  
 110      foreach ($emoticon as $emot_text => $emot_class) {
 111          $emoticon_text[$emot_class][] = $emot_text;
 112      }
 113  }
 114  
 115  echo "                      <td align=\"left\">\n";
 116  echo "                        <table class=\"posthead\" width=\"300\">\n";
 117  
 118  // Display the preview
 119  foreach ($emoticon_text as $emot_class => $emot_text_array) {
 120  
 121      echo "                          <tr>\n";
 122      echo "                            <td align=\"left\" width=\"100\">\n";
 123  
 124      printf('                              <span class="emoticon e_%1$s" title="%2$s"><span class="e__">%2$s</span></span>', $emot_class, $emot_text_array[0]);
 125  
 126      echo "                            </td>\n";
 127      echo "                            <td align=\"left\">", implode('&nbsp;', htmlentities_array($emot_text_array)), "</td>\n";
 128      echo "                          </tr>\n";
 129  }
 130  
 131  echo "                          <tr>\n";
 132  echo "                            <td align=\"left\">&nbsp;</td>\n";
 133  echo "                          </tr>\n";
 134  echo "                        </table>\n";
 135  echo "                      </td>\n";
 136  echo "                    </tr>\n";
 137  echo "                  </table>\n";
 138  echo "                </td>\n";
 139  echo "              </tr>\n";
 140  echo "            </table>\n";
 141  echo "          </td>\n";
 142  echo "        </tr>\n";
 143  echo "      </table>\n";
 144  echo "    </td>\n";
 145  echo "  </tr>\n";
 146  echo "  <tr>\n";
 147  echo "    <td align=\"left\">&nbsp;</td>\n";
 148  echo "  </tr>\n";
 149  echo "  <tr>\n";
 150  echo "    <td align=\"center\">", form_button('close_popup', gettext("Close")), "</td>\n";
 151  echo "  </tr>\n";
 152  echo "</table>\n";
 153  echo "</div>\n";
 154  
 155  html_draw_bottom();

title

Description

title

Description

title

Description

title

title

Body