24 include __DIR__ .
'/header.php';
38 $mimetypes = array(
'image/gif',
'image/jpeg',
'image/pjpeg',
'image/x-png',
'image/png');
44 $op = Request::getCmd(
'op',
'list');
47 $xoops->header(
'admin:avatars/avatars_admin_custom.tpl');
62 $xoops->theme()->addScript(
'media/xoops/xoops.js');
64 $xoops->theme()->addStylesheet(
'modules/avatars/css/admin.css');
70 $start = Request::getInt(
'start', 0);
74 $xoops->tpl()->assign(
'avatar_count', $avatar_count);
82 $avatar_list = array();
84 foreach (array_keys($avatars_arr) as
$i) {
85 $avatar_list[
$i] = $avatars_arr[
$i]->getValues();
88 $avatar_list[
$i][
'user'] =
$user[0];
91 $xoops->tpl()->assign(
'avatars_list', $avatar_list);
95 $xoops->tpl()->assign(
'nav_menu', $nav->renderNav(4));
114 if (!
$xoops->security()->check()) {
115 $xoops->redirect(
'avatar_custom.php', 3, implode(
'<br />',
$xoops->security()->getErrors()));
117 $uploader_avatars_img =
120 $avatar_id = Request::getInt(
'avatar_id', 0);
121 if ($avatar_id > 0) {
127 $obj->setVars($_POST);
128 if (preg_match(
'/^\d+$/', $_POST[
"avatar_weight"]) ==
false) {
130 $obj->setVar(
"avatar_weight", 0);
132 $obj->setVar(
"avatar_weight", Request::getInt(
'avatar_weight', 0));
134 $obj->setVar(
'avatar_type',
'C');
135 if ($uploader_avatars_img->fetchMedia(
'avatar_file')) {
136 $uploader_avatars_img->setPrefix(
'savt');
137 $uploader_avatars_img->fetchMedia(
'avatar_file');
138 if (!$uploader_avatars_img->upload()) {
139 $error_msg .= $uploader_avatars_img->getErrors();
140 $obj->setVar(
'avatar_file',
'avatars/blank.gif');
142 $obj->setVar(
'avatar_mimetype', $uploader_avatars_img->getMediaType());
143 $obj->setVar(
'avatar_file',
'avatars/' . $uploader_avatars_img->getSavedFileName());
146 $file = Request::getString(
'avatar_file',
'blank.gif');
147 $obj->setVar(
'avatar_file',
'avatars/' .
$file);
149 if ($error_msg ==
'') {
153 $error_msg .= $obj->getHtmlErrors();
165 $avatar_id = Request::getInt(
'avatar_id', 0);
167 if (Request::getBool(
'ok',
false,
'POST')) {
168 if (!
$xoops->security()->check()) {
169 $xoops->redirect(
"avatar_custom.php", 3, implode(
",",
$xoops->security()->getErrors()));
173 $file = $obj->getVar(
'avatar_file');
174 if (
$file !=
'avatars/blank.gif') {
176 if (is_file($fullname)) {
177 chmod($fullname, 0777);
182 $qb =
$xoops->db()->createXoopsQueryBuilder();
184 $query = $qb->updatePrefix(
'users')
185 ->set(
'user_avatar',
'blank.gif')
186 ->where($eb->eq(
'user_avatar',
':file '))
187 ->setParameter(
':file',
$file);
191 echo
$xoops->alert(
'error', $obj->getHtmlErrors());
194 if ($avatar_id > 0) {
196 $xoops->theme()->addStylesheet(
'modules/system/css/admin.css');
198 . $obj->getVar(
'avatar_file',
's')
199 .
'" alt="" /></div><div class="txtcenter bold">'
200 . $obj->getVar(
'avatar_name',
's') .
'</div>'
204 array(
'ok' => 1,
'op' =>
'delete',
'avatar_id' => $avatar_id),
214 case "update_display":
215 $avatar_id = Request::getInt(
'avatar_id', 0);
216 if ($avatar_id > 0) {
218 $old = $obj->getVar(
'avatar_display');
219 $obj->setVar(
'avatar_display', !$old);
223 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