25 include __DIR__ .
'/header.php';
28 $xoops->header(
'admin:smilies/smilies_smilies.tpl');
31 $xoops->theme()->addScript(
'media/xoops/xoops.js');
32 $xoops->theme()->addStylesheet(
'modules/system/css/admin.css');
36 $mimetypes = array(
'image/gif',
'image/jpeg',
'image/pjpeg',
'image/x-png',
'image/png');
42 $op = Request::getCmd(
'op',
'list');
43 $start = Request::getInt(
'start', 0);
53 $smilies_count =
$helper->getHandlerSmilies()->getCount();
56 $xoops->tpl()->assign(
'smilies', $smilies);
57 $xoops->tpl()->assign(
'smilies_count', $smilies_count);
62 $xoops->tpl()->assign(
'nav_menu', $nav->renderNav(2));
72 $obj =
$helper->getHandlerSmilies()->create();
83 $smiley_id = Request::getInt(
'smiley_id', 0);
84 $obj =
$helper->getHandlerSmilies()->get($smiley_id);
91 if (!
$xoops->security()->check()) {
92 $xoops->redirect(
'smilies.php', 3, implode(
'<br />',
$xoops->security()->getErrors()));
95 $smiley_id = Request::getInt(
'smiley_id', 0);
96 if (isset($smiley_id) && $smiley_id !=0) {
97 $obj =
$helper->getHandlerSmilies()->get($smiley_id);
99 $obj =
$helper->getHandlerSmilies()->create();
102 $obj->setVar(
'smiley_code', Request::getString(
'smiley_code',
''));
103 $obj->setVar(
'smiley_emotion', Request::getString(
'smiley_emotion',
''));
104 $obj->setVar(
'smiley_display', Request::getBool(
'smiley_display',
true));
105 $obj->setVar(
'smiley_url',
'smilies/' . Request::getPath(
'smiley_url',
''));
106 $xoops_upload_file = Request::getArray(
'xoops_upload_file', array());
109 if ($_FILES[$xoops_upload_file[0]][
'error'] === 0) {
111 if ($uploader->fetchMedia($xoops_upload_file[0])) {
112 $uploader->setPrefix(
'smil');
113 if (!$uploader->upload()) {
114 $error_msg .= $uploader->getErrors();
115 $obj->setVar(
'smiley_url',
'blank.gif');
117 $obj->setVar(
'smiley_url',
'smilies/' . $uploader->getSavedFileName());
121 if ($error_msg ==
'') {
122 if (
$helper->getHandlerSmilies()->insert($obj)) {
125 $error_msg .= $obj->getHtmlErrors();
137 $smiley_id = Request::getInt(
'smiley_id', 0);
138 $ok = Request::getInt(
'ok', 0);
139 $obj =
$helper->getHandlerSmilies()->get($smiley_id);
142 if (!
$xoops->security()->check()) {
143 $xoops->redirect(
'smilies.php', 3, implode(
',',
$xoops->security()->getErrors()));
146 if (
$helper->getHandlerSmilies()->delete($obj)) {
147 if (is_file($path_file)) {
148 chmod($path_file, 0777);
153 echo
$xoops->alert(
'error', $obj->getHtmlErrors());
156 $smilies_img = ($obj->getVar(
'smiley_url')) ? $obj->getVar(
'smiley_url') :
'blank.gif';
157 echo
$xoops->confirm(array(
158 'ok' => 1,
'smiley_id' => $smiley_id,
'op' =>
'del'
159 ), \
XoopsBaseConfig::get(
'url') .
'/modules/smilies/admin/smilies.php', sprintf(
_AM_SMILIES_SUREDEL) .
'<br /><strong>' . $obj->getVar(
'smiley_emotion') .
'</strong><br /><img src="' .
\XoopsBaseConfig::get(
'uploads-url') .
'/' . $smilies_img .
'" alt="' . $obj->getVar(
'smiley_emotion') .
'"><br />');
163 case 'smilies_update_display':
164 $smiley_id = Request::getInt(
'smiley_id', 0);
165 if ($smiley_id > 0) {
166 $obj =
$helper->getHandlerSmilies()->get($smiley_id);
167 $old = $obj->getVar(
'smiley_display');
168 $obj->setVar(
'smiley_display', !$old);
169 if (
$helper->getHandlerSmilies()->insert($obj)) {
172 echo $obj->getHtmlErrors();
const _AM_SMILIES_ALERT_INFO_MIMETYPES
const _AM_SMILIES_ALERT_INFO_TITLE
const _AM_SMILIES_SUREDEL
const _AM_SMILIES_ALERT_ERROR_TITLE
const _AM_SMILIES_DELETED
const _AM_SMILIES_ALERT_INFO_MAXFILE