本文整理汇总了PHP中XoopsUser::uname方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsUser::uname方法的具体用法?PHP XoopsUser::uname怎么用?PHP XoopsUser::uname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsUser
的用法示例。
在下文中一共展示了XoopsUser::uname方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showFriends
/**
* @desc Visualiza la lista de amigos del usuario
**/
function showFriends()
{
global $xoopsOption, $tpl, $db, $xoopsUser, $xoopsModuleConfig, $pag, $xoopsConfig;
$xoopsOption['template_main'] = 'gs_panel_friends.html';
include 'header.php';
$mc =& $xoopsModuleConfig;
GSFunctions::makeHeader();
//Barra de Navegación
$sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_friends') . " WHERE gsuser='" . $xoopsUser->uid() . "'";
$page = isset($pag) ? $pag : '';
$limit = 30;
list($num) = $db->fetchRow($db->query($sql));
if ($page > 0) {
$page -= 1;
}
$start = $page * $limit;
$tpages = (int) ($num / $limit);
if ($num % $limit > 0) {
$tpages++;
}
$pactual = $page + 1;
if ($pactual > $tpages) {
$rest = $pactual - $tpages;
$pactual = $pactual - $rest + 1;
$start = ($pactual - 1) * $limit;
}
if ($tpages > 1) {
if ($mc['urlmode']) {
$urlnav = 'cpanel/friends';
} else {
$urlnav = 'cpanel.php?by=cpanel/friends';
}
$nav = new GsPageNav($num, $limit, $start, 'pag', $urlnav, 0);
$tpl->assign('friendsNavPage', $nav->renderNav(4, 1));
}
$showmax = $start + $limit;
$showmax = $showmax > $num ? $num : $showmax;
$tpl->assign('lang_showing', sprintf(__('Sowing friends %u to %u from %u.', 'galleries'), $start + 1, $showmax, $num));
$tpl->assign('limit', $limit);
$tpl->assign('pag', $pactual);
//Fin de barra de navegación
$sql = "SELECT * FROM " . $db->prefix('gs_friends') . " WHERE gsuser='" . $xoopsUser->uid() . "'";
$sql .= " LIMIT {$start},{$limit}";
$result = $db->query($sql);
while ($row = $db->fetchArray($result)) {
$xu = new XoopsUser($row['uid']);
$tpl->append('users', array('uid' => $xu->uid(), 'uname' => $xu->uname(), 'link' => XOOPS_URL . "/modules/galleries/" . ($mc['urlmode'] ? "usr/" . $xu->uname() . "/" : "user.php?id=usr/" . $xu->uname()), 'avatar' => RMEvents::get()->run_event('rmcommon.get.avatar', $xu->email(), 0, $xu->user_avatar() != '' ? XOOPS_URL . '/uploads/avatars/' . $xu->user_avatar() : GS_URL . '/images/avatar.png')));
}
$tpl->assign('lang_uname', __('User name', 'galleries'));
$tpl->assign('lang_newfriend', __('New Friend', 'galleries'));
$tpl->assign('lang_del', __('Delete', 'galleries'));
$tpl->assign('lang_confirm', __('Do you really wish to delete specified friend?', 'galleries'));
$tpl->assign('lang_confirms', __('Do you really wish to delete selected friends?', 'galleries'));
$tpl->assign('form_action_add', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/add/' : '?cp=add'));
$tpl->assign('form_action_del', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/delete/' : '?cp=delete'));
$tpl->assign('delete_link', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/deletefriend/pag/' . $pactual . '/id/' : '?cp=deletefriend&page=' . $pactual . '&id='));
RMTemplate::get()->add_style('panel.css', 'galleries');
createLinks();
include 'footer.php';
}
示例2: cm_show_messages
/**
* Shows all messages sent by users and stored in database
*/
function cm_show_messages()
{
global $xoopsDB, $xoopsModuleConfig, $xoopsSecurity;
// Styles
RMTemplate::get()->add_style('admin.css', 'contact');
// Pagination
$page = rmc_server_var($_GET, 'page', 1);
$page = $page <= 0 ? 1 : $page;
$result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("contactme"));
list($num) = $xoopsDB->fetchRow($result);
$limit = $xoopsModuleConfig['limit'];
$tpages = ceil($num / $limit);
$page = $page > $tpages ? $tpages : $page;
$start = $num <= 0 ? 0 : ($page - 1) * $limit;
$nav = new RMPageNav($num, $limit, $page, 5);
$nav->target_url('index.php?page={PAGE_NUM}');
// Get messages
$messages = array();
$result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("contactme") . " ORDER BY id_msg DESC LIMIT {$start},{$limit}");
$time = new RMTimeFormatter(0, __('%M% %d%, %Y%', 'contact'));
while ($row = $xoopsDB->fetchArray($result)) {
$msg = new CTMessage();
$msg->assignVars($row);
if ($msg->getVar('xuid')) {
$user = new XoopsUser($msg->getVar('xuid'));
}
$messages[] = array('id' => $msg->id(), 'subject' => $msg->getVar('subject'), 'ip' => $msg->getVar('ip'), 'email' => $msg->getVar('email'), 'name' => $msg->getVar('name'), 'company' => $msg->getVar('org'), 'body' => $msg->getVar('body'), 'phone' => $msg->getVar('phone'), 'register' => $msg->getVar('register'), 'xuid' => $msg->getVar('xuid'), 'uname' => $msg->getVar('xuid') > 0 ? $user->uname() : '', 'date' => $time->format($msg->getVar('date')));
}
RMTemplate::get()->add_local_script('admin.js', 'contact');
RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon');
xoops_cp_header();
include RMTemplate::get()->get_template('admin/ct_dashboard.php', 'module', 'contact');
xoops_cp_footer();
}
示例3: XoopsUser
function get_submitter_info($uid)
{
if ($uid <= 0) {
return _GUESTS;
}
$poster = new XoopsUser($uid);
// check if invalid uid
if ($poster->uname() == '') {
return '';
}
if ($this->nameoruname == 'uname') {
$name = $poster->uname();
} else {
$name = trim($poster->name());
if ($name == "") {
$name = $poster->uname();
}
}
return "<a href='" . XOOPS_URL . "/userinfo.php?uid={$uid}'>{$name}</a>";
}
示例4: showReports
function showReports()
{
global $xoopsModule, $xoopsConfig, $xoopsSecurity;
//Indica la lista a mostrar
$show = isset($_REQUEST['show']) ? intval($_REQUEST['show']) : '0';
//$show = 0 Muestra todos los reportes
//$show = 1 Muestra los reportes revisados
//$show = 2 Muestra los reportes no revisados
define('RMCSUBLOCATION', $show == 0 ? 'allreps' : ($show == 1 ? 'reviews' : 'noreviewd'));
$db = XoopsDatabaseFactory::getDatabaseConnection();
//Lista de Todos los reportes
$sql = "SELECT * FROM " . $db->prefix('mod_bxpress_report') . ($show ? $show == 1 ? " WHERE zapped=1" : " WHERE zapped=0 " : '') . " ORDER BY report_time DESC";
$result = $db->queryF($sql);
$reports = array();
$tf = new RMTimeFormatter(0, '%T% %d%, %Y% %h%:%i%:%s%');
while ($rows = $db->fetchArray($result)) {
$report = new bXReport();
$report->assignVars($rows);
$user = new XoopsUser($report->user());
$post = new bXPost($report->post());
$topic = new bXTopic($post->topic());
$forum = new bXForum($post->forum());
if ($report->zappedBy() > 0) {
$zuser = new XoopsUser($report->zappedBy());
}
$reports[] = array('id' => $report->id(), 'post' => array('link' => $post->permalink(), 'id' => $report->post()), 'user' => $user->uname(), 'uid' => $user->uid(), 'date' => $tf->format($report->time()), 'report' => $report->report(), 'forum' => array('link' => $forum->permalink(), 'name' => $forum->name()), 'topic' => array('link' => $topic->permalink(), 'title' => $topic->title()), 'zapped' => $report->zapped(), 'zappedby' => $report->zappedby() > 0 ? array('uid' => $zuser->uid(), 'name' => $zuser->uname()) : '', 'zappedtime' => $report->zappedtime() > 0 ? $tf->format($report->zappedtime()) : '');
}
RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
RMTemplate::get()->add_local_script('admin.js', 'bxpress');
RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/bxpress-forums/introduccion/standalone/1/');
RMTemplate::get()->assign('xoops_pagetitle', __('Reports Management', 'bxpress'));
$bc = RMBreadCrumb::get();
$bc->add_crumb(__('Reports management', 'bxpress'));
xoops_cp_header();
include RMTemplate::get()->get_template('admin/forums-reports.php', 'module', 'bxpress');
xoops_cp_footer();
}
示例5: saveUsers
/**
* @desc Almacena la información del usuario en la base de datos
**/
function saveUsers($edit = 0)
{
global $xoopsSecurity, $mc;
foreach ($_POST as $k => $v) {
${$k} = $v;
}
$ruta = "&pag={$page}&search={$search}";
if (!$xoopsSecurity->check()) {
redirectMsg('users.php?' . ($edit ? "op=edit&id={$id}&" : '') . $ruta, __('Session token expired!', 'galleries'), 1);
die;
}
$db = XoopsDatabaseFactory::getDatabaseConnection();
if ($edit) {
//Verificamos que el usuario sea válido
if ($id <= 0) {
redirectMsg('./users.php?' . $ruta, __('User id is not valid!', 'galleries'), 1);
die;
}
//Verificamos que el usuario exista
$user = new GSUser($id);
if ($user->isNew()) {
redirectMsg('./users.php?' . $ruta, __('Specified user does not exists!', 'galleries'), 1);
die;
}
//Verificamos que el usuario no se encuentre registrado
$sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_users') . " WHERE uid={$uid} AND id_user<>{$id}";
list($num) = $db->fetchRow($db->query($sql));
if ($num > 0) {
redirectMsg('./users.php?' . $ruta, __('This is user has been registered already!', 'galleries'), 1);
die;
}
} else {
//Verificamos que el usuario no se encuentre registrado
$sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_users') . " WHERE uid={$uid}";
list($num) = $db->fetchRow($db->query($sql));
if ($num > 0) {
redirectMsg('./users.php?' . $ruta, __('This is user has been registered already!', 'galleries'), 1);
die;
}
$user = new GSUser();
}
$user->setUid($uid);
$xu = new XoopsUser($uid);
$user->setUname($xu->uname());
$user->setQuota($quota * 1024 * 1024);
$user->isNew() ? $user->setDate(time()) : '';
$user->setBlocked($block);
if (!$user->save()) {
redirectMsg('./users.php?' . $ruta, __('Errors ocurred while trying to save this user.', 'galleries') . '<br />' . $user->errors(), 1);
die;
} else {
if ($edit) {
@mkdir($mc['storedir'] . "/" . $user->uname(), 511);
@mkdir($mc['storedir'] . "/" . $user->uname() . "/ths", 511);
@mkdir($mc['storedir'] . "/" . $user->uname() . "/formats", 511);
} else {
mkdir($mc['storedir'] . "/" . $user->uname(), 511);
mkdir($mc['storedir'] . "/" . $user->uname() . "/ths", 511);
mkdir($mc['storedir'] . "/" . $user->uname() . "/formats", 511);
}
redirectMsg('./users.php?' . $ruta, __('User saved successfully!', 'galleries'), 0);
die;
}
}
示例6: while
$post->setAuthor($row['uid']);
$post->setDate($row['created']);
$post->setModDate($row['published']);
$post->setText($row['hometext'] . '<br />' . $row['bodytext']);
$post->setStatus(1);
$post->setAllowComs(1);
$post->setAdvance(0);
$post->addToCatego($cats[$row['topicid']]);
$post->save();
$stories[$row['storyid']] = $post->getID();
}
// Guardamos los comentarios
$result = $db->query("SELECT * FROM " . $db->prefix("xoopscomments") . " WHERE com_modid='" . $module->mid() . "'");
while ($row = $db->fetchArray($result)) {
$xu = new XoopsUser($row['com_uid']);
$sql = "INSERT INTO " . $db->prefix("mw_comments") . " (`post`,`nombre`,`email`,`texto`,`xu`,`fecha`,`aprovado`)\n\t\t\t\t\tVALUES ('" . $stories[$row['com_itemid']] . "','" . $xu->uname() . "','" . $xu->email() . "','{$row['com_text']}',\n\t\t\t\t\t'{$row['com_uid']}','{$row['com_created']}','" . ($row['com_status'] == 2 ? 1 : 0) . "')";
$db->queryF($sql);
$post = new NPPost($stories[$row['com_itemid']]);
$post->setComments($post->getComments() + 1);
$post->update();
}
redirect_header('posts.php', 2, _AS_NP_DBOK);
die;
break;
default:
xoops_cp_header();
makeAdminNav();
$hiddens['op'] = 'do';
$buttons['sbt']['value'] = _SUBMIT;
$buttons['sbt']['type'] = 'submit';
$util->msgBox($hiddens, 'import_news.php', sprintf(_AS_NP_CONFIRMIMPORT, 'News'), '../images/question.png', $buttons, true, 400);
示例7: rd_save_sections
/**
* @desc Almacena información de las secciones
**/
function rd_save_sections($edit = 0)
{
global $xoopsUser, $xoopsSecurity;
foreach ($_POST as $k => $v) {
${$k} = $v;
}
if (!$xoopsSecurity->check()) {
redirectMsg('./sections.php?op=new&id=' . $id, __('Session token expired!', 'docs'), 1);
die;
}
if ($id <= 0) {
redirectMsg('resources.php', __('A Document was not specified!', 'docs'), 1);
die;
}
$res = new RDResource($id);
if ($res->isNew()) {
redirectMsg('resources.php', __('Specified Document does not exists!', 'docs'), 1);
die;
}
$db = XoopsDatabaseFactory::getDatabaseConnection();
if ($edit) {
//Verifica si la sección es válida
if ($id_sec <= 0) {
redirectMsg('./sections.php?id=' . $id, __('No section has been specified', 'docs'), 1);
die;
}
//Comprueba si la sección es existente
$sec = new RDSection($id_sec);
if ($sec->isNew()) {
redirectMsg('./sections.php?id=' . $id, __('Section does not exists!', 'docs'), 1);
die;
}
//Comprueba que el título de la sección no exista
$sql = "SELECT COUNT(*) FROM " . $db->prefix('rd_sections') . " WHERE title='{$title}' AND id_res='{$id}' AND id_sec<>{$id_sec}";
list($num) = $db->fetchRow($db->queryF($sql));
if ($num > 0) {
redirectMsg('./sections.php?op=new&id=' . $id, __('Already exists another section with same title!', 'docs'), 1);
die;
}
} else {
//Comprueba que el título de la sección no exista
$sql = "SELECT COUNT(*) FROM " . $db->prefix('rd_sections') . " WHERE title='{$title}' AND id_res='{$id}'";
list($num) = $db->fetchRow($db->queryF($sql));
if ($num > 0) {
redirectMsg('./sections.php?op=new&id=' . $id, __('Already exists another section with same title!', 'docs'), 1);
die;
}
$sec = new RDSection();
}
//Genera $nameid Nombre identificador
$nameid = !isset($nameid) || $nameid == '' ? TextCleaner::getInstance()->sweetstring($title) : $nameid;
$sec->setVar('title', $title);
$sec->setVar('content', $content);
$sec->setVar('order', $order);
$sec->setVar('id_res', $id);
$sec->setVar('nameid', $nameid);
$sec->setVar('parent', $parent);
if (!isset($uid)) {
$sec->setVar('uid', $xoopsUser->uid());
$sec->setVar('uname', $xoopsUser->uname());
} else {
$xu = new XoopsUser($uid);
if ($xu->isNew()) {
$sec->setVar('uid', $xoopsUser->uid());
$sec->setVar('uname', $xoopsUser->uname());
} else {
$sec->setVar('uid', $uid);
$sec->setVar('uname', $xu->uname());
}
}
if ($sec->isNew()) {
$sec->setVar('created', time());
$sec->setVar('modified', time());
} else {
$sec->setVar('modified', time());
}
// Metas
if ($edit) {
$sec->clear_metas();
}
// Clear all metas
// Initialize metas array if not exists
if (!isset($metas)) {
$metas = array();
}
// Get meta key if "select" is visible
if (isset($meta_name_sel) && $meta_name_sel != '') {
$meta_name = $meta_name_sel;
}
// Add meta to metas array
if (isset($meta_name) && $meta_name != '') {
array_push($metas, array('key' => $meta_name, 'value' => $meta_value));
}
// Assign metas
foreach ($metas as $value) {
$sec->add_meta($value['key'], $value['value']);
}
//.........这里部分代码省略.........
示例8: get_pic_data
function get_pic_data($album, &$count, &$album_name, $limit1 = -1, $limit2 = -1, $set_caption = true)
{
global $USER, $xoopsModuleConfig, $ALBUM_SET, $CURRENT_CAT_NAME, $HTML_SUBST, $THEME_DIR;
global $GLOBALS;
global $xoopsDB, $xoopsModule, $xoopsConfig;
$myts =& MyTextSanitizer::getInstance();
// MyTextSanitizer object
$sort_array = array('na' => 'filename ASC', 'nd' => 'filename DESC', 'da' => 'pid ASC', 'dd' => 'pid DESC');
$sort_code = isset($USER['sort']) ? $USER['sort'] : $xoopsModuleConfig['default_sort_order'];
$sort_order = isset($sort_array[$sort_code]) ? $sort_array[$sort_code] : $sort_array[$xoopsModuleConfig['default_sort_order']];
$limit = $limit1 != -1 ? ' LIMIT ' . $limit1 : '';
$limit .= $limit2 != -1 ? ' ,' . $limit2 : '';
if ($limit2 == 1) {
$select_columns = '*';
} else {
$select_columns = 'pid, filepath, filename, url_prefix, filesize, pwidth, pheight, ctime';
}
// Regular albums
if (is_numeric($album)) {
$album_name = get_album_name($album);
$approved = GALLERY_ADMIN_MODE ? '' : 'AND approved=\'YES\'';
$result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE aid='{$album}' {$approved} {$ALBUM_SET}");
$nbEnr = $xoopsDB->fetchArray($result);
$count = $nbEnr['count(*)'];
$xoopsDB->freeRecordSet($result);
if ($select_columns != '*') {
$select_columns .= ', title, caption, owner_id';
}
$result = $xoopsDB->query("SELECT {$select_columns} from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE aid='{$album}' {$approved} {$ALBUM_SET} ORDER BY {$sort_order} {$limit}");
$rowset = db_fetch_rowset($result);
$xoopsDB->freeRecordSet($result);
// Set picture caption
if ($set_caption) {
foreach ($rowset as $key => $row) {
$caption = $rowset[$key]['title'] ? "<span class=\"thumb_title\">" . $rowset[$key]['title'] . "</span>" : '';
if ($xoopsModuleConfig['caption_in_thumbview']) {
$caption .= $rowset[$key]['caption'] ? "<span class=\"thumb_caption\">" . $myts->makeTareaData4Show($rowset[$key]['caption'], 0) . "</span>" : '';
}
if ($xoopsModuleConfig['display_comment_count']) {
$comments_nr = xoops_comment_count($xoopsModule->mid(), $row['pid']);
if ($comments_nr > 0) {
$caption .= "<span class=\"thumb_num_comments\">" . sprintf(_MD_FUNC_COM, $comments_nr) . "</span>";
}
}
$rowset[$key]['caption_text'] = $caption;
}
}
return $rowset;
}
// Meta albums
switch ($album) {
case 'lastcom':
// Last comments
if ($ALBUM_SET && $CURRENT_CAT_NAME) {
$album_name = $album_name = _MD_LASTCOM . ' - ' . $CURRENT_CAT_NAME;
} else {
$album_name = _MD_LASTCOM;
}
$result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xoopscomments") . ", " . $xoopsDB->prefix("xcgal_pictures") . " WHERE com_modid = " . $xoopsModule->mid() . " AND approved='YES' AND com_itemid = pid {$ALBUM_SET}");
$nbEnr = $xoopsDB->fetchArray($result);
$count = $nbEnr['count(*)'];
$xoopsDB->freeRecordSet($result);
if ($select_columns != '*') {
$select_columns = $select_columns . ', com_id, com_uid,com_itemid,com_rootid, com_exparams, com_created, com_title';
}
include_once XOOPS_ROOT_PATH . "/include/comment_constants.php";
$result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xoopscomments") . ", " . $xoopsDB->prefix("xcgal_pictures") . " WHERE com_modid = " . $xoopsModule->mid() . " AND approved = 'YES' AND pid = com_itemid AND com_status=" . XOOPS_COMMENT_ACTIVE . " {$ALBUM_SET} ORDER by com_id DESC {$limit}");
$rowset = db_fetch_rowset($result);
$xoopsDB->freeRecordSet($result);
$member_handler =& xoops_gethandler('member');
$comment_config = $xoopsModule->getInfo('comments');
if ($set_caption) {
foreach ($rowset as $key => $row) {
if ($row['com_uid'] > 0) {
$poster =& $member_handler->getUser($row['com_uid']);
if (is_object($poster)) {
$posters = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $row['com_uid'] . '">' . $poster->getVar('uname') . '</a>';
} else {
$posters = $GLOBALS['xoopsConfig']['anonymous'];
}
} else {
$posters = $GLOBALS['xoopsConfig']['anonymous'];
}
$comtitle = '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/' . $comment_config['pageName'] . '?' . $comment_config['itemName'] . '=' . $row['com_itemid'] . '&com_id=' . $row['com_id'] . '&com_rootid=' . $row['com_rootid'] . '&com_mode=flat&' . $row['com_exparams'] . '#comment' . $row['com_id'] . '">' . $row['com_title'] . '</a>';
$caption = "<span class=\"thumb_title\">" . $posters . '</span>' . "<span class=\"thumb_caption\">" . formatTimestamp($row['com_created'], 'm') . '</span>' . "<span class=\"thumb_caption\">" . $comtitle . '</span>';
$rowset[$key]['caption_text'] = $caption;
}
}
return $rowset;
break;
case 'lastup':
// Last uploads
if ($ALBUM_SET && $CURRENT_CAT_NAME) {
$album_name = _MD_LASTUP . ' - ' . $CURRENT_CAT_NAME;
} else {
$album_name = _MD_LASTUP;
}
$result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' {$ALBUM_SET}");
$nbEnr = $xoopsDB->fetchArray($result);
$count = $nbEnr['count(*)'];
//.........这里部分代码省略.........
示例9: dt_delete_items
/**
* desc Elimina de la base de datos los elementos
**/
function dt_delete_items()
{
global $xoopsModuleConfig, $xoopsConfig, $xoopsModule, $xoopsSecurity, $rmc_config, $xoopsUser;
$ids = rmc_server_var($_POST, 'ids', array());
$page = rmc_server_var($_POST, 'page', 1);
$search = rmc_server_var($_POST, 'search', '');
$sort = rmc_server_var($_POST, 'sort', 'id_soft');
$mode = rmc_server_var($_POST, 'mode', 1);
$cat = rmc_server_var($_POST, 'cat', 0);
$type = rmc_server_var($_POST, 'type', '');
$params = '?pag=' . $page . '&search=' . $search . '&sort=' . $sort . '&mode=' . $mode . '&cat=' . $cat . '&type=' . $type;
//Verificamos que el software sea válido
if (!is_array($ids) && $ids <= 0) {
redirectMsg('items.php' . $params, __('You must select at least one download item to delete!', 'dtransport'), RMMSG_WARN);
}
if (!is_array($ids)) {
$ids = array($ids);
}
if (!$xoopsSecurity->check()) {
redirectMsg('items.php' . $params, __('Session token expired!', 'dtransport'), RMMSG_ERROR);
}
$errors = '';
$mailer = new RMMailer('text/html');
$etpl = DT_PATH . '/lang/deletion_' . $rmc_config['lang'] . '.php';
if (!file_exists($etpl)) {
$etpl = DT_PATH . '/lang/deletion_en.php';
}
$mailer->template($etpl);
$mailer->assign('siteurl', XOOPS_URL);
$mailer->assign('dturl', $xoopsModuleConfig['permalinks'] ? XOOPS_URL . '/' . trim($xoopsModuleConfig['htbase'], '/') : DT_URL);
$mailer->assign('downcp', $xoopsModuleConfig['permalinks'] ? XOOPS_URL . '/' . trim($xoopsModuleConfig['htbase'], '/') . '/cp/' : DT_URL . '/?p=cpanel');
$mailer->assign('dtname', $xoopsModule->name());
$mailer->assign('sitename', $xoopsConfig['sitename']);
foreach ($ids as $id) {
$sw = new DTSoftware($id);
if ($sw->isNew()) {
continue;
}
if (!$sw->delete()) {
$errors .= $sw->errors();
continue;
}
$xu = new XoopsUser($sw->getVar('uid'));
$mailer->add_users(array($xu));
$mailer->assign('uname', $xu->name() != '' ? $xu->name() : $xu->uname());
$mailer->assign('download', $sw->getVar('name'));
$mailer->assign('email', $xu->getVar('email'));
$mailer->assign('method', $xu->getVar('notify_method'));
$mailer->set_subject(sprintf(__('Your download %s has been deleted!', 'dtransport'), $sw->getVar('name')));
if ($xu->getVar('notify_method') == 1) {
$mailer->set_from_xuser($xoopsUser);
$mailer->send_pm();
} else {
$mailer->send();
}
}
if ($errors != '') {
redirectMsg('items.php' . $params, __('Errors ocurred while trying to delete selected downloads!', 'dtransport') . '<br />' . $errors, RMMSG_ERROR);
}
redirectMsg('items.php' . $params, __('Downloads deleted successfully!', 'dtransport'), RMMSG_SUCCESS);
}
示例10: formatTimestamp
$answer = str_replace("\r\n", "<br>", $answer);
$answer = str_replace("\n", "<br>", $answer);
$faqsa['answer'] = $answer;
$faqsa['datesub'] = formatTimestamp($datesub, "D, d-M-Y, H:i");
$faqsa['counter'] = $counter;
$faqsa['question'] = $question;
//$faqsa['printer'] = "index.php?op=print&t=".$t;
//$faqsa['cjump'] = generatecjump();
$faqsa['catlink'] = "<a href='javascript:history.go(-1)'>" . _MD_BACK2CAT . "</a><b> | </b><a href='./index.php'>" . _MD_RETURN2INDEX . "</a>";
if ($uid == 0) {
$faqsa['poster'] = "Guest";
} else {
$thisUser = new XoopsUser($uid);
$thisUser->getVar("uname");
$thisUser->getVar("uid");
$faqsa['poster'] = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $thisUser->uid() . "'>" . $thisUser->uname() . "</a>";
//$thisUser->getVar("uname");
}
$xoopsTpl->assign('faqpage', $faqsa);
$xoopsTpl->assign(array('lang_faq' => _MD_FAQ, 'lang_publish' => _MD_PUBLISH, 'lang_posted' => _MD_POSTED, 'lang_read' => _MD_READ, 'lang_times' => _MD_TIMES, 'lang_articleheading' => '<h4>' . $question . '</h4>'));
break;
case "default":
default:
global $xoopsUser, $xoopsConfig, $xoopsDB;
$index = array();
$xoopsOption['template_main'] = 'wffaq_index.html';
$result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("faqcategories") . " ORDER BY name");
$total = $xoopsDB->getRowsNum($result);
if ($total == 0) {
redirect_header("javascript:history.go(-1)", 1, _MD_MAINNOCATADDED);
exit;
示例11: XoopsUser
xoops_cp_header();
echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"even\">";
//echo $HTTP_POST_VARS['ishtml'];
echo _AM_NOMAINTEXT . "<br />";
echo "</td></tr></table>";
break;
}
if ($article->approved && $article->type() != "admin") {
$article->setPublished(time());
$isnew = '1';
}
$article->store();
if (!empty($isnew) && $article->notifypub() && $article->uid() != 0) {
$poster = new XoopsUser($article->uid());
$subject = _AM_ARTPUBLISHED;
$message = sprintf(_AM_HELLO, $poster->uname());
$message .= "\n\n" . _AM_YOURARTPUB . "\n\n";
$message .= _AM_TITLEC . $article->title() . "\n" . _AM_URLC . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/article.php?articleryid=" . $article->storyid() . "\n" . _AM_PUBLISHEDC . formatTimestamp($article->published(), "{$timestanp}", 0) . "\n\n";
$message .= $xoopsConfig['sitename'] . "\n" . XOOPS_URL . "";
$xoopsMailer =& getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setToEmails($poster->getVar("email"));
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
$xoopsMailer->setFromName($xoopsConfig['sitename']);
$xoopsMailer->setSubject($subject);
$xoopsMailer->setBody($message);
$xoopsMailer->send();
}
redirect_header('allarticles.php', 1, _AM_DBUPDATED);
exit;
break;
示例12: SaveTutorial
//.........这里部分代码省略.........
$codes = 3;
}
if ($framebrowse == 1) {
$codes += 10;
}
if ($HTTP_POST_VARS["gid"]) {
$gid = $HTTP_POST_VARS["gid"];
} else {
$gid = 0;
}
$tname = $myts->makeTboxData4Save($HTTP_POST_VARS["tname"]);
$tauthor = $myts->makeTboxData4Save($HTTP_POST_VARS["tauthor"]);
$timg = $myts->makeTboxData4Save($HTTP_POST_VARS["timg"]);
if (ereg("http://", $timg) || $timg == "") {
$timgwidth = 0;
$timgheight = 0;
} else {
$timgwidth = $HTTP_POST_VARS["timgwidth"];
$timgheight = $HTTP_POST_VARS["timgheight"];
}
$tdesc = $myts->makeTboxData4Save($HTTP_POST_VARS["tdesc"]);
$tcont = $myts->makeTareaData4Save($HTTP_POST_VARS["tcont"], $html, $smiley, 1);
$submitter = $HTTP_POST_VARS["submitter"];
$message = "";
if (!empty($HTTP_POST_VARS["tlink"])) {
$tlink = $myts->makeTboxData4Save($HTTP_POST_VARS["tlink"]);
}
// Check if Title exist
if ($tname == "") {
$message .= "<h4><font color=\"#ff0000\">";
$message .= _MD_ERRORNAME . "</font></h4><br>";
$error = 1;
}
// Check if Description exist
if ($tdesc == "") {
$message .= "<h4><font color=\"#ff0000\">";
$message .= _MD_ERRORDESC . "</font></h4><br>";
$error = 1;
}
// Check if Content exist
if ($tcont == "" && $tlink == "") {
$message .= "<h4><font color=\"#ff0000\">";
$message .= _MD_ERRORCONT . "</font></h4><br>";
$error = 1;
}
if ($error == 1) {
xoops_cp_header();
OpenTable();
echo $message;
echo "<center><input type=\"button\" value=\"" . _MD_GOBACK . "\" onclick=\"javascript:history.go(-1)\"></center>";
CloseTable();
xoops_cp_footer();
exit;
}
if ($tid == 0) {
$newid = $db->genId("tutorials_tid_seq");
$db->query("INSERT INTO " . $db->prefix("tutorials") . " (tid, cid, gid, tname, tdesc, timg, tcont, tlink, tauthor, status, codes, hits, rating, votes, date, submitter, dir, timgwidth, timgheight) VALUES ({$newid}, {$cid}, {$gid}, '{$tname}', '{$tdesc}', '{$timg}', '{$tcont}', '{$tlink}', '{$tauthor}', {$status}, {$codes}, 0, 0, 0, {$time}, {$submitter}, {$dir}, {$timgwidth}, {$timgheight})") or $eh->show("0013");
} elseif ($status == 0) {
$db->query("UPDATE " . $db->prefix("tutorials") . " set tid={$tid}, cid={$cid}, gid={$gid}, tname='{$tname}', tdesc='{$tdesc}', timg='{$timg}', tcont='{$tcont}', tlink='{$tlink}', tauthor='{$tauthor}', status={$status}, codes={$codes}, hits=0, rating=0, votes=0, date={$time}, timgwidth={$timgwidth}, timgheight={$timgheight} where tid={$tid}") or $eh->show("0013");
} elseif ($tid > 0 && $status == 3) {
$result = $db->query("SELECT status, date FROM " . $db->prefix("tutorials") . " WHERE tid={$tid}");
list($statusdb, $date) = $db->fetch_row($result);
if ($statusdb != 2) {
$time = time();
}
$date = $time;
$db->query("UPDATE " . $db->prefix("tutorials") . " set tid={$tid}, cid={$cid}, gid={$gid}, tname='{$tname}', tdesc='{$tdesc}', timg='{$timg}', tcont='{$tcont}', tlink='{$tlink}', tauthor='{$tauthor}', status={$status}, codes={$codes}, date={$date}, timgwidth={$timgwidth}, timgheight={$timgheight} where tid={$tid}") or $eh->show("0013");
} else {
$date = time();
$db->query("UPDATE " . $db->prefix("tutorials") . " set tid={$tid}, cid={$cid}, gid={$gid}, tname='{$tname}', tdesc='{$tdesc}', timg='{$timg}', tcont='{$tcont}', tlink='{$tlink}', tauthor='{$tauthor}', status={$status}, codes={$codes}, date={$date}, timgwidth={$timgwidth}, timgheight={$timgheight} where tid={$tid}") or $eh->show("0013");
}
if ($status == 1 || $status == 3) {
$result = $db->query("SELECT submitter FROM " . $db->prefix("tutorials") . " WHERE tid={$tid}");
list($submitter) = $db->fetch_row($result);
if ($xoopsUser->uid() != $submitter) {
$submitter = new XoopsUser($submitter);
$subject = sprintf(_MD_YOURFILEAT, $xoopsConfig['sitename']);
$message = sprintf(_MD_HELLO, $submitter->uname());
if ($status == 1) {
$message .= "\n\n" . _MD_WEAPPROVED . "\n\n";
}
if ($status == 3) {
$message .= "\n\n" . _MD_WEAPPROVEDMOD . "\n\n";
}
$siteurl = XOOPS_URL . "/modules/tutorials/";
$message .= sprintf(_MD_VISITAT, $siteurl);
$message .= "\n\n" . _MD_THANKSSUBMIT . "\n\n" . $xoopsConfig['sitename'] . "\n" . XOOPS_URL . "\n" . $xoopsConfig['adminmail'] . "";
$xoopsMailer =& getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setToEmails($submitter->getVar("email"));
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
$xoopsMailer->setFromName($xoopsConfig['sitename']);
$xoopsMailer->setSubject($subject);
$xoopsMailer->setBody($message);
$xoopsMailer->send();
}
}
redirect_header("index.php", 1, _MD_DBUPDATED);
exit;
}
示例13: saveBulkImages
/**
* @desc Almacena la información del grupo de imágenes
**/
function saveBulkImages()
{
global $util, $mc, $xoopsUser;
XoopsLogger::getInstance()->activated = false;
XoopsLogger::getInstance()->renderingEnabled = false;
set_time_limit(0);
foreach ($_POST as $k => $v) {
${$k} = $v;
}
$ruta = "page={$page}&search={$search}&owner={$uid}&sort={$sort}&mode={$mode}";
if ($xoopsUser->uid() == $uid) {
$xu = $xoopsUser;
} else {
$xu = new XoopsUser($uid);
}
//Verificamos si el usuario se encuentra registrado
$user = new GSUser($xu->uname());
if ($user->isNew()) {
//Insertamos información del usuario
$user->setUid($uid);
$user->setUname($xu->uname());
$user->setQuota($mc['quota'] * 1024 * 1024);
$user->setDate(time());
if (!$user->save()) {
send_error(__('User owner could not be created!', 'galleries') . "<br />" . $user->errors());
die;
} else {
mkdir($mc['storedir'] . "/" . $user->uname());
mkdir($mc['storedir'] . "/" . $user->uname() . "/ths");
mkdir($mc['storedir'] . "/" . $user->uname() . "/formats");
}
} else {
@mkdir($mc['storedir'] . "/" . $user->uname());
@mkdir($mc['storedir'] . "/" . $user->uname() . "/ths");
@mkdir($mc['storedir'] . "/" . $user->uname() . "/formats");
}
// Insertamos las etiquetas
$tgs = explode(",", $tags);
/**
* @desc Almacena los ids de las etiquetas que se asignarán a la imágen
*/
$ret = array();
foreach ($tgs as $k) {
$k = trim($k);
if ($k == '') {
continue;
}
// Comprobamos que la palabra tenga la longitud permitida
if (strlen($k) < $mc['min_tag'] || strlen($k) > $mc['max_tag']) {
continue;
}
// Creamos la etiqueta
$tag = new GSTag($k);
if (!$tag->isNew()) {
// Si ya existe nos saltamos
$ret[] = $tag->id();
continue;
}
$tag->setTag($k);
if ($tag->save()) {
$ret[] = $tag->id();
}
}
$errors = '';
$k = 1;
include_once RMCPATH . '/class/uploader.php';
$updir = $mc['storedir'] . "/" . $xu->uname();
$upths = $mc['storedir'] . "/" . $xu->uname() . "/ths";
// Cargamos la imágen
if (!file_exists($updir)) {
mkdir($updir, 511);
}
if (!file_exists($upths)) {
mkdir($upths, 511);
}
$uploader = new RMFileUploader($updir, $mc['size_image'] * 1024, array('gif', 'jpg', 'jpeg', 'png'));
$err = array();
if (!$uploader->fetchMedia('Filedata')) {
send_error($uploader->getErrors());
}
if (!$uploader->upload()) {
send_error($uploader->getErrors());
}
// Insertamos el archivo en la base de datos
$img = new GSImage();
$img->setTitle($uploader->savedFileName);
$img->setOwner($uid);
$img->setPublic(2);
$img->setCreated(time());
$img->setImage($uploader->getSavedFileName());
if (!$image->save()) {
unlink($uploader->savedDestination);
send_error(__('File could not be inserted to database!', 'galleries'));
}
$ret['message'] = '1';
$ret['id'] = $image->id();
echo json_encode($ret);
//.........这里部分代码省略.........
示例14: sendChat
function sendChat() {
global $xoopsDB, $xoopsUser;
$from = $_SESSION['xoopsUserId'];
$to = $_POST['to'];
$message = $_POST['message'];
$user = new XoopsUser($from);
$uname = $user->uname();
$avatar =$user->user_avatar();
if ($avatar!='blank.gif') {
$avatarURL = XOOPS_URL."/uploads/".$avatar;
} else {
$avatarURL = XOOPS_URL."/modules/xim/images/default_avatar.png";
}
$_SESSION['openChatBoxes'][$_POST['to']] = date('Y-m-d H:i:s', time());
$config = im_Getconfig($user);
$soundUrl = XOOPS_URL.'/modules/xim/media/0.mp3';
$status = $config['status'];
$messagesan = sanitize($message);
header('Content-type: application/json');
echo '{"message":"'.$messagesan.'"}';
if (!isset($_SESSION['chatHistory'][$_POST['to']])) {
$_SESSION['chatHistory'][$_POST['to']] = '';
}
$_SESSION['chatHistory'][$_POST['to']] .= <<<EOD
{"s":"1","n":"{$uname}","a":"$avatarURL","f":"{$to}","m":"{$messagesan}","q":"$soundUrl","p":"$status"},
EOD;
unset($_SESSION['tsChatBoxes'][$_POST['to']]);
$sql = "insert into ".$xoopsDB->prefix(xim_chat)." (".$xoopsDB->prefix(xim_chat).".from,".$xoopsDB->prefix(xim_chat).".to,message,sent) values ('".mysql_real_escape_string($from)."', '".mysql_real_escape_string($to)."','".mysql_real_escape_string($message)."',NOW())";
$query = $xoopsDB->query($sql);
//echo "1";
exit(0);
}
示例15: while
$n = 0;
echo "<form method='post'>\n";
if ($count > $max) {
echo "<div>" . $nav->renderNav() . "</div>";
}
echo "<table class='outer'>\n";
echo "<tr><th>" . _AM_RESERVATION . "</th><th>" . _AM_EVENT_DAY . "</th><th>" . _AM_TITLE . "</th>";
echo "<th>" . _AM_POSTER . "</th><th>" . _AM_DISP_STATUS . "</th>";
echo "<th>" . _AM_OPERATION . "</th></tr>\n";
while ($data = $xoopsDB->fetchArray($result)) {
$bg = $tags[$n++ % 2];
$eid = $data['eid'];
$date = eventdate($data['edate']);
$title = "<a href='../event.php?eid={$eid}'>" . $data['title'] . "</a>";
$poster = new XoopsUser($data['uid']);
$u = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $poster->uid() . "'>" . $poster->uname() . "</a>";
$s = $data['status'];
$sn = $ev_stats[$data['status']];
if ($s == STAT_DELETED) {
$sn = "<a href='../admin.php?op=delete&eid={$eid}' class='deleted'>{$sn}</a>";
} elseif ($s == STAT_POST) {
$sn = "<strong>{$sn}</strong>";
}
$ors = $xoopsDB->query("SELECT reservation FROM " . OPTBL . " WHERE eid={$eid}");
if ($xoopsDB->getRowsNum($ors)) {
list($resv) = $xoopsDB->fetchRow($ors);
$mk = "<input type='hidden' name='rv[{$eid}]' value='on' />";
$mk .= "<input type='checkbox' name='ck[{$eid}]' " . ($resv ? " checked" : "") . " />";
} else {
$mk = " ";
}