/**
  * @see Action::execute()
  */
 public function execute()
 {
     // check permission
     WCF::getUser()->checkPermission('admin.smiley.canDeleteSmiley');
     // delete smiley
     require_once WCF_DIR . 'lib/data/message/smiley/SmileyEditor.class.php';
     $smiley = new SmileyEditor($this->smileyID);
     if (!$smiley->smileyID) {
         throw new IllegalLinkException();
     }
     $smiley->delete();
     // reset cache
     SmileyEditor::resetCache();
     $this->executed();
     // forward to list page
     HeaderUtil::redirect('index.php?page=SmileyList&deletedSmileyID=' . $this->smileyID . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
 /**
  * @see Form::save()
  */
 public function save()
 {
     ACPForm::save();
     // save
     $this->smileyCategory->update($this->title, $this->showOrder);
     // reset cache
     SmileyEditor::resetCache();
     $this->saved();
     // show success message
     WCF::getTPL()->assign('success', true);
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     // check permission
     WCF::getUser()->checkPermission('admin.smiley.canEditSmiley');
     if ($this->showOrder) {
         $this->smiley->update($this->smiley->smileyPath, $this->smiley->smileyTitle, $this->smiley->smileyCode, $this->showOrder, $this->smiley->smileyCategoryID);
         //$this->smiley->removePositions();
         //$this->smiley->addPosition($this->smiley->smileyCategoryID, ($this->showOrder ? $this->showOrder : null));
     }
     SmileyEditor::resetCache();
     $this->executed();
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     WCF::getUser()->checkPermission('admin.smiley.canEditSmileyCategory');
     // delete category
     $this->smileyCategory->enable();
     SmileyEditor::resetCache();
     $this->executed();
     // forward to list page
     HeaderUtil::redirect('index.php?page=SmileyCategoryList&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     // check permission
     WCF::getUser()->checkPermission('admin.smiley.canDeleteSmiley');
     // delete makred smileys
     $markedSmileys = WCF::getSession()->getVar('markedSmileys');
     if ($markedSmileys !== null) {
         foreach ($markedSmileys as $smileyID) {
             $smiley = new SmileyEditor($smileyID);
             if ($smiley->smileyID) {
                 $smiley->delete();
             }
         }
     }
     // reset cache
     SmileyEditor::resetCache();
     // unmark smileys
     WCF::getSession()->unregister('markedSmileys');
     $this->executed();
     // forward to list page
     HeaderUtil::redirect('index.php?page=SmileyList&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // save
     SmileyCategoryEditor::create($this->title, $this->showOrder);
     // reset cache
     SmileyEditor::resetCache();
     $this->saved();
     // reset values
     $this->title = '';
     $this->showOrder = 0;
     // show success message
     WCF::getTPL()->assign('success', true);
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     WCF::getUser()->checkPermission(array('admin.smiley.canEditSmiley', 'admin.smiley.canDeleteSmiley'));
     // mark / unmark
     if ($this->action == 'mark') {
         SmileyEditor::mark($this->smileyID);
     } else {
         if ($this->action == 'unmark') {
             SmileyEditor::unmark($this->smileyID);
         }
     }
     $this->executed();
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     // check permission
     WCF::getUser()->checkPermission('admin.smiley.canEditSmiley');
     // delete makred smileys
     $markedSmileys = WCF::getSession()->getVar('markedSmileys');
     if ($markedSmileys !== null) {
         $sql = "UPDATE\twcf" . WCF_N . "_smiley\n\t\t\t\tSET\tsmileyCategoryID = " . $this->smileyCategoryID . "\n\t\t\t\tWHERE\tsmileyID IN (" . implode(',', $markedSmileys) . ")";
         WCF::getDB()->sendQuery($sql);
     }
     // reset cache
     SmileyEditor::resetCache();
     // unmark smileys
     WCF::getSession()->unregister('markedSmileys');
     $this->executed();
     // forward to list page
     HeaderUtil::redirect('index.php?page=SmileyList&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
 /**
  * Creates a new smiley.
  * 
  * @return	Smiley		new smiley
  */
 public static function create($filename, $destination, $field, $title = null, $code = null, $showOrder = 0, $smileyCategoryID = 0)
 {
     if (!file_exists($filename)) {
         throw new UserInputException($field, 'notFound');
     }
     if (!getImageSize($filename)) {
         throw new UserInputException($field, 'noValidImage');
     }
     // copy
     if ($filename != $destination && !copy($filename, $destination)) {
         throw new UserInputException($field, 'copyFailed');
     }
     // set permissions
     @chmod($destination, 0666);
     // generate title & code by filename
     $name = preg_replace('/\\.[^\\.]+$/', '', basename($destination));
     if ($title === null) {
         $title = $name;
     }
     if ($code === null) {
         $code = ':' . $name . ':';
     }
     // save data
     $smileyID = self::insert(str_replace(WCF_DIR, '', $destination), $code, array('smileyTitle' => $title, 'showOrder' => $showOrder, 'smileyCategoryID' => $smileyCategoryID));
     // get editor object
     $smiley = new SmileyEditor($smileyID);
     // save position
     $smiley->addPosition($smileyCategoryID, $showOrder);
     // save data
     return $smiley;
 }
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // reset values
     $this->filename = $this->title = $this->code = '';
     $this->showOrder = $this->smileyCategoryID = 0;
     // reset cache
     SmileyEditor::resetCache();
     $this->saved();
 }
 /**
  * @see Page::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     WCF::getTPL()->assign(array('smilies' => $this->smileyList->getObjects(), 'deletedSmileyID' => $this->deletedSmileyID, 'smileyCategoryID' => $this->smileyCategoryID, 'smileyCategories' => $this->smileyCategories, 'defaultSmileys' => $this->defaultSmileys, 'markedSmileys' => SmileyEditor::getMarkedSmileys()));
 }
 /**
  * @see Form::validate()
  */
 public function save()
 {
     AbstractForm::save();
     // update
     $this->smiley->update($this->path, $this->title, $this->code, $this->showOrder, $this->smileyCategoryID);
     $this->smiley->removePositions();
     $this->smiley->addPosition($this->smileyCategoryID, $this->showOrder ? $this->showOrder : null);
     // reset cache
     SmileyEditor::resetCache();
     $this->saved();
     // show success message
     WCF::getTPL()->assign('success', true);
 }