Source for file AdminInsertSmilies.class.php

Documentation is available at AdminInsertSmilies.class.php

  1. <?php
  2. /**
  3.  * Class AdminInsertSmilies - Admin area
  4.  *
  5.  * LICENSE: CREATIVE COMMONS PUBLIC LICENSE  "Namensnennung — Nicht-kommerziell 2.0"
  6.  *
  7.  * @copyright  2009 <SEDesign />
  8.  * @license    http://creativecommons.org/licenses/by-nc/2.0/de/
  9.  * @version    $3.0.6$
  10.  * @link       http://www.sedesign.de/de_produkte_chat-v3.html
  11.  * @since      File available since Alpha 1.0
  12.  */
  13.  
  14. {
  15.  
  16.     /**
  17.     * Constructor
  18.     *
  19.     * @uses ConnectDB::sqlSet()
  20.     * @uses ConnectDB::sqlGet()
  21.     * @uses ConnectDB::close()
  22.     * @return void 
  23.     */
  24.     public function __construct ()
  25.         
  26.         // call parent Constructor from class DbConectionMaker
  27.         parent::__construct()
  28.  
  29.         session_start();
  30.  
  31.         header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0');
  32.         // Sets charset and content-type for index.php
  33.         header('content-type: text/html; charset=utf-8');
  34.         
  35.         // create new LangXml Object
  36.         $langObj = new LangXml();
  37.         $lang=$langObj->getLang()->admin[0]->admin_smilies[0];
  38.         
  39.         
  40.         if ($_SESSION['etchat_'.$this->_prefix.'user_priv']=="admin"){
  41.  
  42.             $uploaddir './smilies/';
  43.             $checkfile "./smilies/".$_FILES['smiliefile']['name'];
  44.             
  45.             if(file_exists($checkfile)){
  46.                 $nowname time()."_".$_FILES['smiliefile']['name'];
  47.                 $notes ="".$lang->file_exists[0]->tagData." ".time().".".$_FILES['smiliefile']['name']."<br>";
  48.             }else{
  49.                 $nowname $_FILES['smiliefile']['name'];
  50.                 $notes ="";
  51.             }
  52.  
  53.             // Test if the sign exists in the DB
  54.             $res $this->dbObj->sqlGet("select etchat_smileys_id FROM {$this->_prefix}etchat_smileys where etchat_smileys_sign = '".$_POST['sign']."'");
  55.             if (is_array($res)){
  56.                 $print_result.= $lang->sign_exists[0]->tagData."<br>";
  57.                 $print_result.= "<a href='./?AdminSmiliesIndex'>".$lang->back[0]->tagData."</a>";
  58.             }else{
  59.                 if (move_uploaded_file($_FILES['smiliefile']['tmp_name'], $uploaddir . $nowname) && (stripos($nowname, '.png')!==false || stripos($nowname, '.gif')!==false || stripos($nowname, '.jpg')!==false )) {
  60.                     $this->dbObj->sqlSet("INSERT INTO {$this->_prefix}etchat_smileys(etchat_smileys_sign,etchat_smileys_img) VALUES ('".$_POST['sign']."', 'smilies/".$nowname."')");
  61.                     $print_result.= $lang->isupload[0]->tagData."<br>";
  62.                     $print_result.= $notes;
  63.                     $print_result.= "<br><a href='./?AdminCreateNewSmilies'>".$lang->smilie[0]->tagData."</a>";
  64.                     $print_result.= "<br /><a href='./?AdminSmiliesIndex'>".$lang->back[0]->tagData."</a>";
  65.                 } else {
  66.                     $print_result.= $lang->noupload[0]->tagData;
  67.                     //print_r($_FILES);
  68.                     $print_result.= "<br /><br /><a href='./?AdminSmiliesIndex'>".$lang->back[0]->tagData."</a>";
  69.                 }
  70.             }    
  71.             // Include Template
  72.             include_once("styles/admin_tpl/insertSmiliesMessage.tpl.html");
  73.         }else{
  74.             echo $lang->error[0]->tagData;
  75.             return false;
  76.         }
  77.     }

Documentation generated on Thu, 05 May 2011 14:05:52 +0000 by phpDocumentor 1.4.3