22 include __DIR__ .
'/header.php';
30 $mimetypes = array(
'image/gif',
'image/jpeg',
'image/pjpeg',
'image/x-png',
'image/png');
33 $op =
$system->cleanVars($_REQUEST,
'op',
'list',
'string');
37 $xoops->header(
'admin:userrank/userrank.tpl');
47 $xoops->theme()->addScript(
'media/xoops/xoops.js');
66 $xoops->tpl()->assign(
'userrank_count', $userrank_count);
67 if ($userrank_count > 0) {
68 foreach (array_keys($userrank_arr) as
$i) {
69 $rank_id = $userrank_arr[
$i]->getVar(
"rank_id");
70 $userrank[
'rank_id'] = $rank_id;
71 $userrank[
'rank_title'] = $userrank_arr[
$i]->getVar(
"rank_title");
72 $userrank[
'rank_min'] = $userrank_arr[
$i]->getVar(
"rank_min");
73 $userrank[
'rank_max'] = $userrank_arr[
$i]->getVar(
"rank_max");
74 $userrank[
'rank_special'] = $userrank_arr[
$i]->getVar(
"rank_special");
75 $rank_img = ($userrank_arr[
$i]->getVar(
"rank_image")) ? $userrank_arr[$i]->getVar(
"rank_image") :
'blank.gif';
76 $userrank[
'rank_image'] =
'<img src="' .
\XoopsBaseConfig::get(
'uploads-url') .
'/' . $rank_img .
'" alt="" />';
77 $xoops->tpl()->appendByRef(
'userrank', $userrank);
84 $xoops->tpl()->assign(
'nav_menu', $nav->renderNav(4));
101 case 'userrank_edit':
114 case 'userrank_save':
115 if (!
$xoops->security()->check()) {
116 $xoops->redirect(
"userrank.php", 3, implode(
",",
$xoops->security()->getErrors()));
118 if (isset($_POST[
"rank_id"])) {
124 $obj->setVar(
"rank_title", $_POST[
"rank_title"]);
125 $obj->setVar(
"rank_min", $_POST[
"rank_min"]);
126 $obj->setVar(
"rank_max", $_POST[
"rank_max"]);
127 $verif_rank_special = ($_POST[
"rank_special"] == 1) ?
"1" :
"0";
128 $obj->setVar(
"rank_special", $verif_rank_special);
132 if ($uploader_rank_img->fetchMedia(
"rank_image")) {
133 $uploader_rank_img->setPrefix(
"rank");
134 $uploader_rank_img->fetchMedia(
"rank_image");
135 if (!$uploader_rank_img->upload()) {
136 $errors = $uploader_rank_img->getErrors();
137 $xoops->redirect(
"javascript:history.go(-1)", 3, $errors);
139 $obj->setVar(
"rank_image",
'ranks/' . $uploader_rank_img->getSavedFileName());
142 $obj->setVar(
"rank_image",
'ranks/' . $_POST[
"rank_image"]);
151 case 'userrank_delete':
155 $rank_id =
$system->cleanVars($_REQUEST,
'rank_id', 0,
'int');
157 if (isset($_POST[
"ok"]) && $_POST[
"ok"] == 1) {
158 if (!
$xoops->security()->check()) {
159 $xoops->redirect(
"userrank.php", 3, implode(
",",
$xoops->security()->getErrors()));
163 if (is_file($urlfile)) {
164 chmod($urlfile, 0777);
169 echo
$xoops->alert(
'error', $obj->getHtmlErrors());
172 $rank_img = ($obj->getVar(
"rank_image")) ? $obj->getVar(
"rank_image") :
'blank.gif';
173 echo
$xoops->confirm(array(
174 "ok" => 1,
"rank_id" => $_REQUEST[
"rank_id"],
"op" =>
"userrank_delete"
180 case 'userrank_update_special':
182 $rank_id =
$system->cleanVars($_POST,
'rank_id', 0,
'int');
185 $old = $obj->getVar(
'rank_special');
186 $obj->setVar(
'rank_special', !$old);
190 echo $obj->getHtmlErrors();
const _AM_USERRANK_TIPS_FORM2
const _AM_USERRANK_SUREDEL
const _AM_USERRANK_TIPS_FORM1