function showForm() { global $db, $xoopsOption, $xoopsUser, $mc, $tpl, $xoopsConfig, $xoopsModuleConfig, $user, $xoopsSecurity; $xoopsOption['template_main'] = "gs_submit.html"; $xoopsOption['module_subpage'] = 'submit'; include 'header.php'; GSFunctions::makeHeader(); $mc =& $xoopsModuleConfig; $tpl->assign('lang_uploadyour', __('Upload your Pictures', 'galleries')); $tpl->assign('lang_step1', __('Step 1:', 'galleries')); $tpl->assign('lang_step2', __('Step 2:', 'galleries')); $tpl->assign('lang_step3', __('Step 3:', 'galleries')); $tpl->assign('lang_step4', __('Step 4:', 'galleries')); $tpl->assign('lang_choose', __('Select Files', 'galleries')); $tpl->assign('lang_privacy', __('Set Privacy', 'galleries')); $tpl->assign('lang_privateme', __('Private (<em>Only you will seee these pictures</em>)', 'galleries')); $tpl->assign('lang_privatef', __('For Friends (<em>Only you and your friends will see these pictures</em>)', 'galleries')); $tpl->assign('lang_public', __('Public (<em>Pictures will visible for all</em>)')); $tpl->assign('lang_upload', __('Upload Files', 'galleries')); $tpl->assign('lang_clicktou', __('Click to Upload', 'galleries')); $tpl->assign('lang_tagsesp', __('Specify tags to use', 'galleries')); $tpl->assign('lang_tagsdesc', __('Separate each tag with a comma (,).', 'galleries')); $tpl->assign('lang_maxsize', sprintf(__('The maximum file size allowed is <strong>%s</strong>.', 'galleries'), RMUtilities::formatBytesSize($mc['size_image'] * 1024))); $tpl->assign('used_graph', GSFunctions::makeQuota($user, false)); $tpl->assign('form_action', GSFunctions::get_url() . ($mc['urlmode'] ? 'submit/' : '?submit=submit')); $tpl->assign('token', $xoopsSecurity->getTokenHTML()); $used = round($user->usedQuota() / $user->quota() * 100) . '%'; $tpl->assign('lang_used', sprintf(__('You have used <strong>%s</strong> of <strong>%s</strong> available. You left <strong>%s</strong>', 'galleries'), $used, RMUtilities::formatBytesSize($user->quota()), RMUtilities::formatBytesSize($user->usedQuota() >= $user->quota() ? 0 : $user->quota() - $user->usedQuota()))); RMTemplate::get()->add_xoops_style('submit.css', 'galleries'); include 'footer.php'; }
public function makeQuota(GSUser $user, $showpercent = false) { $rtn = '<div style="font-weight: bold; color: #999; font-family: Verdana, arial, helvetica, sans-serif; font-size: 10px; width: 102px; text-align: center:"><div style="text-align: left;width: 102px; height: 15px; border: 1px solid #ccc; background: url(' . XOOPS_URL . '/modules/galleries/images/quotagray.png) no-repeat;">'; $quota = $user->quota(); $used = $user->usedQuota(); $percent = $quota / 102; $rtn .= '<div style="text-align: center; width: ' . ($used > 0 ? $used / $percent > 102 ? 102 : round($used / $percent) : 0) . 'px; background: url(' . XOOPS_URL . '/modules/galleries/images/quotabar.png) no-repeat;"> </div>'; $rtn .= '</div>'; if ($showpercent) { $rtn .= round($user->usedQuota() * (100 / $quota)) . '%'; } else { $rtn .= RMUtilities::formatBytesSize($user->usedQuota()); } $rtn .= "</div>"; return $rtn; }
function show_dashboard() { global $xoopsModuleConfig; $db = Database::getInstance(); // Sets count $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_sets"); list($set_count) = $db->fetchRow($db->query($sql)); // Pictures count $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_images"); list($pic_count) = $db->fetchRow($db->query($sql)); // Users count $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_users"); list($user_count) = $db->fetchRow($db->query($sql)); // Tags count $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_tags"); list($tag_count) = $db->fetchRow($db->query($sql)); // E-Cards count $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_postcards"); list($post_count) = $db->fetchRow($db->query($sql)); // Used space $space = RMUtilities::formatBytesSize(GSFunctions::folderSize($xoopsModuleConfig['storedir'])); // Number of files $file_count = count_files(rtrim($xoopsModuleConfig['storedir'], '/')); // First picture $sql = "SELECT * FROM " . $db->prefix("gs_images") . " ORDER BY `created` ASC LIMIT 0,1"; $result = $db->query($sql); if ($db->getRowsNum($result) > 0) { $img = new GSImage(); $img->assignVars($db->fetchArray($result)); $user = new GSUser($img->owner(), 1); $tf = new RMTimeFormatter(0, '%M% %d%, %Y%'); $first_pic['date'] = $tf->format($img->created()); $first_pic['link'] = $user->userURL() . ($xoopsModuleConfig['urlmode'] ? 'img/' . $img->id() . '/set/' : '&img=' . $img->id()); } xoops_cp_header(); GSFunctions::toolbar(); RMTemplate::get()->add_style('dashboard.css', 'galleries'); RMTemplate::get()->add_style('admin.css', 'galleries'); RMTemplate::get()->add_head('<script type="text/javascript">var xurl = "' . XOOPS_URL . '";</script>'); RMTemplate::get()->add_local_script('dashboard.js', 'galleries'); include RMTemplate::get()->get_template('admin/gs_dashboard.php', 'module', 'galleries'); xoops_cp_footer(); }
/** * @desc Visualiza todos los usuarios existentes **/ function showUsers() { global $xoopsModule, $db, $tpl, $xoopsSecurity; $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1; $limit = 15; $search = rmc_server_var($_REQUEST, 'search', ''); $db = XoopsDatabaseFactory::getDatabaseConnection(); //Barra de Navegación $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_users'); $sql1 = ''; $search = trim($search); if ($search && strlen($search) > 2) { $sql1 .= $sql1 == '' ? " WHERE (uname LIKE '%{$search}%')" : " OR (uname LIKE '%{$search}%')"; } list($num) = $db->fetchRow($db->query($sql . $sql1)); $start = $num <= 0 ? 0 : ($page - 1) * $limit; $tpages = ceil($num / $limit); $nav = new RMPageNav($num, $limit, $page, 5); $nav->target_url("users.php?page={PAGE_NUM}&search={$search}"); $showmax = $start + $limit; $showmax = $showmax > $num ? $num : $showmax; //Fin de barra de navegación $sql = "SELECT * FROM " . $db->prefix('gs_users'); $sql2 = " LIMIT {$start},{$limit}"; $result = $db->query($sql . $sql1 . $sql2); while ($rows = $db->fetchArray($result)) { $uname = eregi_replace("({$search})", "<span class='searchResalte'>\\1</span>", $rows['uname']); $user = new GSUser(); $user->assignVars($rows); $users[] = array('id' => $user->id(), 'uid' => $user->uid(), 'uname' => $uname, 'quota' => RMUtilities::formatBytesSize($user->quota()), 'blocked' => $user->blocked(), 'used' => GSFunctions::makeQuota($user), 'pics' => $user->pics(), 'sets' => $user->sets(), 'date' => formatTimeStamp($user->date(), 'custom'), 'url' => $user->userUrl()); } GSFunctions::toolbar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . __('Users management', 'galleries')); RMTemplate::get()->assign('xoops_pagetitle', __('Users management', 'galleries')); RMTemplate::get()->add_script('../include/js/gsscripts.php?file=sets&form=frm-users'); RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js'); RMTemplate::get()->add_head("<script type='text/javascript'>\nvar delete_warning='" . __('Do you really wish to delete selected users?', 'galleries') . "';\n</script>"); xoops_cp_header(); include RMTemplate::get()->get_template("admin/gs_users.php", 'module', 'galleries'); xoops_cp_footer(); }
} else { $userData = array(); $userData['id'] = 0; $userData['uname'] = $xoopsModuleConfig['anonymous_prefix'] . $post->uname(); //$userData['rank'] = $xoopsConfig['anonymous']; //$userData['rank_image'] = ''; $userData['registered'] = ''; $userData['avatar'] = RMEvents::get()->run_event("rmcommon.get.avatar", '', 0); $userData['posts'] = sprintf(__('Posts: %u', 'bxpress'), 0); $userData['online'] = false; $userData['type'] = 'anon'; } // Adjuntos $attachs = array(); foreach ($post->attachments() as $k) { $attachs[] = array('title' => $k->name(), 'downs' => $k->downloads(), 'id' => $k->id(), 'ext' => $k->extension(), 'size' => RMUtilities::formatBytesSize($k->size()), 'icon' => $k->getIcon()); } $tf = new RMTimeFormatter(0, __('%T% %d%, %Y%', 'bxpress')); // Likes parsing if (!is_null($row['liked'])) { $likes_ids = explode(",", $row['liked'], 3); } else { $likes_ids = array(); } $likes = array(); foreach ($likes_ids as $like) { if (!isset($users[$like])) { $users[$like] = new XoopsUser($like); } $like_user = $users[$like]; $likes[] = array('uid' => $like, 'uname' => $like_user->getVar('uname'), 'name' => $like_user->getVar('name') != '' ? $like_user->getVar('name') : $like_user->getVar('uname'), 'avatar' => RMEvents::get()->run_event("rmcommon.get.avatar", $like_user->getVar('email'), 40));
$form->addElement($ele); // Adjuntar Archivos if ($forum->attachments() && $forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, 'attach')) { $forma = new RMForm('<a name="attachments"></a>' . __('Attached Files', 'bxpress'), 'frmAttach', 'edit.php'); $forma->addElement(new RMFormSubTitle(sprintf(__('You can upload new files to this post. You have a limit of <strong>%s</strong> attachment per post.', 'bxpress'), $xoopsModuleConfig['attachlimit']), 1, 'even')); if ($post->totalAttachments() < $xoopsModuleConfig['attachlimit']) { $ele = new RMFormFile(__('Attach File:', 'bxpress'), 'attach', 45, $xoopsModuleConfig['maxfilesize'] * 1024); $ele->setDescription(sprintf(__('Allowed File Types: %s', 'bxpress'), implode(',', $forum->extensions()))); $forma->addElement($ele, true); $forma->setExtra('enctype="multipart/form-data"'); } // Lista de Archivos Adjuntos $list = new RMFormCheck(__('Cuerrent Attachments', 'bxpress')); $list->asTable(1); foreach ($post->attachments() as $file) { $list->addOption("<img src='" . $file->getIcon() . "' align='absmiddle' /> " . $file->name() . " (" . RMUtilities::formatBytesSize($file->size()) . ")", 'files[]', $file->id()); } $forma->addElement($list); $ele = new RMFormButtonGroup(); if ($post->totalAttachments() < $xoopsModuleConfig['attachlimit']) { $ele->addButton('upload', __('Upload File', 'bxpress'), 'submit'); } $ele->addButton('delete', __('Delete File(s)', 'bxpress'), 'button', 'onclick="document.forms[\'frmAttach\'].op.value=\'delete\'; submit();"'); $ele->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="window.location = \'topic.php?pid=' . $post->id() . '#p' . $post->id() . '\'";'); $forma->addElement($ele); $forma->addElement(new RMFormHidden('op', 'upload')); $forma->addElement(new RMFormHidden('id', $id)); } $tpl->assign('topic_form', $form->render() . "<br />" . $forma->render()); $tpl->assign('lang_topicreview', __('Topic Review (Newest First)', 'bxpress')); include 'footer.php';
echo str_replace('http://', '', $file['url']); ?> </a></td> <td align="center"><?php echo $file['lang']; ?> </td> <td align="center"<?php echo time() - $file['time'] >= $plugin->get_config('time') ? ' class="warn"' : ''; ?> ><?php echo sprintf(__('%s secs.', 'booster'), time() - $file['time']); ?> </td> <td align="center"><?php echo RMUtilities::formatBytesSize($file['size']); ?> </td> <td align="center"> <input id="<?php echo $file['id']; ?> " class="del_file" type="button" value="<?php _e('Delete', 'booster'); ?> " /> </td> </tr> <?php } ?>