24 include __DIR__ .
'/header.php';
34 $mimetypes = array(
'image/gif',
'image/jpeg',
'image/pjpeg',
'image/x-png',
'image/png');
39 $op = Request::getCmd(
'op',
'list');
43 $xoops->header(
'admin:avatars/avatars_admin_system.tpl');
59 $xoops->theme()->addScript(
'media/xoops/xoops.js');
61 $xoops->theme()->addStylesheet(
'modules/avatars/css/admin.css');
68 $start = Request::getInt(
'start', 0);
72 $xoops->tpl()->assign(
'avatar_count', $avatar_count);
80 $avatar_list = array();
82 foreach (array_keys($avatars_arr) as
$i) {
83 $avatar_list[
$i] = $avatars_arr[
$i]->getValues();
86 $xoops->tpl()->assign(
'avatars_list', $avatar_list);
90 $xoops->tpl()->assign(
'nav_menu', $nav->renderNav(4));
121 if (!
$xoops->security()->check()) {
122 $xoops->redirect(
'avatar_system.php', 3, implode(
'<br />',
$xoops->security()->getErrors()));
124 $uploader_avatars_img =
127 $avatar_id = Request::getInt(
'avatar_id', 0);
128 if ($avatar_id > 0) {
134 $obj->setVars($_POST);
135 if (preg_match(
'/^\d+$/', $_POST[
"avatar_weight"]) ==
false) {
137 $obj->setVar(
"avatar_weight", 0);
139 $obj->setVar(
"avatar_weight", Request::getInt(
'avatar_weight', 0));
141 $obj->setVar(
'avatar_type',
's');
142 if ($uploader_avatars_img->fetchMedia(
'avatar_file')) {
143 $uploader_avatars_img->setPrefix(
'savt');
144 $uploader_avatars_img->fetchMedia(
'avatar_file');
145 if (!$uploader_avatars_img->upload()) {
146 $error_msg .= $uploader_avatars_img->getErrors();
147 $obj->setVar(
'avatar_file',
'avatars/blank.gif');
149 $obj->setVar(
'avatar_mimetype', $uploader_avatars_img->getMediaType());
150 $obj->setVar(
'avatar_file',
'avatars/' . $uploader_avatars_img->getSavedFileName());
153 $file = Request::getString(
'avatar_file',
'blank.gif');
154 $obj->setVar(
'avatar_file',
'avatars/' .
$file);
156 if ($error_msg ==
'') {
160 $error_msg .= $obj->getHtmlErrors();
172 $avatar_id = Request::getInt(
'avatar_id', 0);
174 if (isset($_POST[
"ok"]) && $_POST[
"ok"] == 1) {
175 if (!
$xoops->security()->check()) {
176 $xoops->redirect(
"avatar_system.php", 3, implode(
",",
$xoops->security()->getErrors()));
180 $file = $obj->getVar(
'avatar_file');
181 if (
$file !=
'avatars/blank.gif') {
183 if (is_file($fullname)) {
184 chmod($fullname, 0777);
189 $qb =
$xoops->db()->createXoopsQueryBuilder();
191 $query = $qb->updatePrefix(
'users')
192 ->set(
'user_avatar',
'blank.gif')
193 ->where($eb->eq(
'user_avatar',
':file '))
194 ->setParameter(
':file',
$file);
198 echo
$xoops->alert(
'error', $obj->getHtmlErrors());
201 if ($avatar_id > 0) {
203 $xoops->theme()->addStylesheet(
'modules/system/css/admin.css');
205 . $obj->getVar(
'avatar_file',
's')
206 .
'" alt="" /></div><div class="txtcenter bold">'
207 . $obj->getVar(
'avatar_name',
's') .
'</div>'
211 array(
'ok' => 1,
'op' =>
'delete',
'avatar_id' => $avatar_id),
221 case "update_display":
222 $avatar_id = Request::getInt(
'avatar_id', 0);
223 if ($avatar_id > 0) {
225 $old = $obj->getVar(
'avatar_display');
226 $obj->setVar(
'avatar_display', !$old);
230 echo $obj->getHtmlErrors();
const E_YOU_NEED_A_POSITIVE_INTEGER
if(!isset($xoops->paths[$path_type])) if($path_type== 'var') $file
const INFORMATION_FOR_UPLOADS
const ALERT_INFO_MIMETYPES
const Q_ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_ITEM
if(!is_object($module)||!$module->getVar('isactive')) $msg
const E_DATABASE_NOT_UPDATED