/** * @desc Envía correo de aprobación de publicación * @param Object $res Publicación **/ function mail_approved(RDResource &$res) { global $xoopsModuleConfig, $xoopsConfig; $config_handler =& xoops_gethandler('config'); $mconfig = $config_handler->getConfigsByCat(XOOPS_CONF_MAILER); $errors = ''; $user = new XoopsUser($res->getVar('owner')); $member_handler =& xoops_gethandler('member'); $method = $user->getVar('notify_method'); $mailer = new RMMailer('text/plain'); $mailer->add_xoops_users($user); $mailer->set_subject(sprintf(__('Publication <%s> approved!', 'docs'), $res->getVar('title'))); $mailer->assign('dear_user', $user->getVar('name') != '' ? $user->getVar('name') : $user->getVar('uname')); $mailer->assign('link_to_resource', $res->permalink()); $mailer->assign('site_name', $xoopsConfig['sitename']); $mailer->assign('resource_name', $res->getVar('title')); $mailer->template(RMTemplate::get()->get_template('mail/resource_approved.php', 'module', 'docs')); switch ($method) { case '1': $mailer->set_from_xuser($mconfig['fromuid']); $ret = $mailer->send_pm(); break; case '2': $ret = $mailer->send(); break; } $page = rmc_server_var($_POST, 'page', 1); return $ret; }
function b_weblog_links_show($options) { global $xoopsDB, $xoopsUser; $mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0]; $link_module = $options[1]; $link_num = $options[2]; $only_post = $options[3]; $showdsc = $options[4]; if ($only_post == "1") { if (!preg_match("|weblog\\d*/post\\.php\$|", $_SERVER['SCRIPT_NAME'])) { return false; } } $currentuid = !empty($xoopsUser) ? $xoopsUser->getVar('uid', 'E') : 0; $user_id = !empty($_GET['user_id']) ? intval($_GET['user_id']) : 0; $submitter = empty($user_id) ? $currentuid : $user_id; $block = array(); if (preg_match("/^mylinks\\d*\$/", $options[0])) { // in case of mylinks module $sql = sprintf('SELECT c.title as category, l.title as title, url, description as dsc FROM %s as c, %s as l, %s as d WHERE c.cid=l.cid and d.lid=l.lid and status=1 ', $xoopsDB->prefix($options[0] . '_cat'), $xoopsDB->prefix($options[0] . '_links'), $xoopsDB->prefix($options[0] . '_text')); if ($submitter) { $sql = sprintf('%s and submitter=%d', $sql, $submitter); } $sql .= " order by l.cid,l.date "; } elseif (preg_match("/^weblinks\\d*\$/", $options[0])) { // in case of weblink module $sql = sprintf('select link.title as title, link.url as url, link.description as dsc, cat.title as category from %s as cat, %s as link, %s as clink where link.lid=clink.lid and clink.cid=cat.cid ', $xoopsDB->prefix($options[0] . '_category'), $xoopsDB->prefix($options[0] . '_link'), $xoopsDB->prefix($options[0] . '_catlink')); if ($submitter) { $sql = sprintf('%s and link.uid=%d', $sql, $submitter); } $sql .= " order by clink.cid,clink.lid "; } if (!isset($sql)) { return array(); } $result = $xoopsDB->query($sql, $link_num, 0); while ($myrow = $xoopsDB->fetchArray($result)) { $category = $myrow['category']; if (!isset($block['links'][$category])) { $block['links'][$category] = array(); } $block['links'][$category][] = array("title" => $myrow['title'], "url" => $myrow['url'], "dsc" => $myrow['dsc']); } if ($submitter) { $blogOwner = new XoopsUser($submitter); $block['lang_whose'] = sprintf(_MB_WEBLOG_LANG_LINKS_FOR, $blogOwner->getVar('uname', 'E')); } else { $block['lang_whose'] = _MB_WEBLOG_LANG_LINKS_FOR_EVERYONE; } if ($showdsc) { $block['showdsc'] = 1; } return $block; }
/** * Get User Timestamp * * @param mixed $time * @param string $timeoffset * * @return int */ public function getUserTimestamp($time, $timeoffset = '') { if ($timeoffset == '') { if ($this->isUser()) { $timeoffset = $this->user->getVar('timezone_offset'); } else { $timeoffset = $this->getConfig('default_TZ'); } } $usertimestamp = (int) $time + ((double) $timeoffset - $this->getConfig('server_TZ')) * 3600; return (int) $usertimestamp; }
function getShouts($online, $bbcode, $limit) { global $xoopsUser; $shouts = array(); $myts =& MyTextSanitizer::getInstance(); $objs = $this->handler->getShouts($limit); $i = 0; foreach ($objs as $obj) { $uid = $obj->getVar('uid'); $shouts[$i]['uid'] = $uid; $shouts[$i]['online'] = 0; $shouts[$i]['url'] = ''; $shouts[$i]['email'] = ''; $shouts[$i]['avatar'] = $this->getDefaultAvatar(); $shouts[$i]['uname'] = $obj->getVar('uname'); $shouts[$i]['time'] = $obj->time(shoutbox_getOption('stamp_format')); $shouts[$i]['ip'] = $obj->getVar('ip'); $obj->setVar('doxcode', $bbcode); $shouts[$i]['message'] = $myts->censorString($obj->getVar('message')); if ($wordwrap = shoutbox_getOption('wordwrap_setting')) { $shouts[$i]['message'] = wordwrap($shouts[$i]['message'], $wordwrap, "\r\n", true); } if ($uid != 0) { $thisUser = new XoopsUser($uid); if ($thisUser->isOnline()) { $shouts[$i]['online'] = 1; } if ($thisUser->getVar("url") != "") { $shouts[$i]['url'] = $thisUser->getVar("url"); } if ($thisUser->getVar("user_viewemail") == 1 || $xoopsUser && $xoopsUser->isAdmin()) { $shouts[$i]['email'] = $thisUser->getVar("email"); } $shouts[$i]['avatar'] = XOOPS_URL . '/uploads/' . $thisUser->getVar("user_avatar"); } $i++; } return $shouts; }
/** * @param int $uid * @param string $subject * @param string $body * @return bool */ private function sendPM($uid, $subject, $body) { $xoops = Xoops::getInstance(); $pm_handler = $xoops->getHandlerPrivmessage(); $pm = $pm_handler->create(); $pm->setVar("subject", $subject); // RMV-NOTIFY $pm->setVar('from_userid', !empty($this->fromUser) ? $this->fromUser->getVar('uid') : (!$xoops->isUser() ? 1 : $xoops->user->getVar('uid'))); $pm->setVar("msg_text", $body); $pm->setVar("to_userid", $uid); $pm->setVar('msg_time', time()); if (!$pm_handler->insert($pm)) { return false; } return true; }
function b_mp_cont_show($options) { global $xoopsDB, $xoopsUser, $xoopsModuleConfig, $HTTP_SERVER_VARS; if (is_object($xoopsUser)) { $uid = $xoopsUser->getVar('uid'); $uname = $xoopsUser->getVar('uname'); } else { $uid = 0; $uname = ''; } $block = array(); if (!is_object($xoopsUser)) { $block['lang_none'] = _MP_BL_YOUDONTHAVE; } else { $online = 0; $offline = 0; $user = ''; $cont_handler =& xoops_gethandler('priv_msgscont'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('ct_userid', $xoopsUser->getVar('uid'))); $amount = $cont_handler->getCount($criteria); $criteria->setSort('ct_uname'); $criteria->setOrder('desc'); $pm_cont =& $cont_handler->getObjects($criteria); foreach (array_keys($pm_cont) as $i) { $poster = new XoopsUser($pm_cont[$i]->getVar('ct_contact')); /* Online poster */ if ($poster->isOnline()) { $user .= "<a href='javascript:openWithSelfMain(\"" . XOOPS_URL . "/pmlite.php?send2=1&to_userid=" . $pm_cont[$i]->getVar('ct_contact') . "\",\"pmlite\", 450, 380)'>" . $poster->getVar('uname') . "</a>, "; $online++; } else { $offline++; } } $block['online_total'] = $amount; $block['online'] = $online; $block['offline'] = $offline; $block['user'] = $user; $block['lang_online'] = _MP_BLOCK_ONLINE; $block['lang_offline'] = _MP_BLOCK_OFFLINE; $block['lang_contact'] = _MP_BLOCK_CONTACT; } return $block; }
function xoops_module_update_mpmanager(&$module) { global $xoopsConfig, $xoopsDB, $xoopsUser, $xoopsModule; if (file_exists(XOOPS_ROOT_PATH . "/modules/mpmanager/language/" . $xoopsConfig['language'] . "/admin.php")) { include XOOPS_ROOT_PATH . "/modules/mpmanager/language/" . $xoopsConfig['language'] . "/admin.php"; } else { include XOOPS_ROOT_PATH . "/modules/mpmanager/language/english/admin.php"; } $xoopsDB->queryF("UPDATE " . $xoopsDB->prefix('modules') . " SET weight = 0 WHERE mid = " . $module->getVar('mid') . ""); if (is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->mid())) { if (!TableExists($xoopsDB->prefix('priv_msgs'))) { $xoopsDB->queryFromFile(XOOPS_ROOT_PATH . "/modules/mpmanager/sql/mysqlmsg.sql"); } //mise ajour table message if (!FieldExists('msg_pid', $xoopsDB->prefix('priv_msgs'))) { $result = $xoopsDB->queryF("ALTER TABLE `" . $xoopsDB->prefix('priv_msgs') . "` ADD msg_pid MEDIUMINT( 8 ) UNSIGNED DEFAULT '0' NOT NULL AFTER msg_id"); } if (!FieldExists('reply_msg', $xoopsDB->prefix('priv_msgs'))) { $sq1 = $xoopsDB->queryF("ALTER TABLE `" . $xoopsDB->prefix('priv_msgs') . "` ADD reply_msg TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL AFTER read_msg"); } if (!FieldExists('anim_msg', $xoopsDB->prefix('priv_msgs'))) { $sq1 = $xoopsDB->queryF("ALTER TABLE `" . $xoopsDB->prefix('priv_msgs') . "` ADD anim_msg VARCHAR(100) AFTER reply_msg"); } if (!FieldExists('cat_msg', $xoopsDB->prefix('priv_msgs'))) { $sq1 = $xoopsDB->queryF("ALTER TABLE `" . $xoopsDB->prefix('priv_msgs') . "` ADD cat_msg MEDIUMINT( 8 ) UNSIGNED DEFAULT '1' NOT NULL AFTER anim_msg"); } if (!FieldExists('file_msg', $xoopsDB->prefix('priv_msgs'))) { $sq1 = $xoopsDB->queryF("ALTER TABLE `" . $xoopsDB->prefix('priv_msgs') . "` ADD file_msg MEDIUMINT( 8 ) UNSIGNED DEFAULT '0' NOT NULL AFTER cat_msg"); } //mise a jour message if (TableExists($xoopsDB->prefix('priv_msgsave'))) { $sq2 = "SELECT * FROM " . $xoopsDB->prefix('priv_msgsave') . ""; $result2 = $xoopsDB->query($sq2); while ($row = $xoopsDB->fetchArray($result2)) { $sql = "INSERT INTO `" . $xoopsDB->prefix("priv_msgs") . "` (msg_id, msg_image,subject,from_userid,to_userid,msg_time,msg_text,read_msg,reply_msg,anim_msg,cat_msg,file_msg) VALUES('','" . $row['msg_image'] . "','" . $row['subject'] . "','" . $row['sauv_userid'] . "','" . $row['to_userid'] . "','" . $row['msg_time'] . "','" . $row['msg_text'] . "','" . $row['read_msg'] . "','" . $row['reply_msg'] . "','" . $row['anim_msg'] . "', '3','') "; $result = $xoopsDB->queryF($sql); } $result = $xoopsDB->queryF("DROP TABLE `" . $xoopsDB->prefix("priv_msgsave") . "`"); } //add table priv_msgscat if (!TableExists($xoopsDB->prefix('priv_msgscat'))) { $xoopsDB->queryFromFile(XOOPS_ROOT_PATH . "/modules/mpmanager/sql/mysqlcat.sql"); } $sq1 = $xoopsDB->queryF("INSERT INTO `" . $xoopsDB->prefix('priv_msgscat') . "` (`cid`, `pid`, `title`, `uid`, `ver`) VALUES (1, 0, '" . _MP_BOX1 . "', NULL, 1)"); $sq1 = $xoopsDB->queryF("INSERT INTO `" . $xoopsDB->prefix('priv_msgscat') . "` (`cid`, `pid`, `title`, `uid`, `ver`) VALUES (2, 0, '" . _MP_BOX2 . "', NULL, 1)"); $sq1 = $xoopsDB->queryF("INSERT INTO `" . $xoopsDB->prefix('priv_msgscat') . "` (`cid`, `pid`, `title`, `uid`, `ver`) VALUES (3, 0, '" . _MP_BOX3 . "', NULL, 1)"); //add and update priv_msgscont if (!TableExists($xoopsDB->prefix('priv_msgscont'))) { $xoopsDB->queryFromFile(XOOPS_ROOT_PATH . "/modules/mpmanager/sql/mysqlcont.sql"); } else { if (!FieldExists('ct_name', $xoopsDB->prefix('priv_msgscont'))) { $sql = "ALTER TABLE `" . $xoopsDB->prefix("priv_msgscont") . "` ADD `ct_name` varchar(60) NOT NULL default '' AFTER `ct_contact`"; $result = $xoopsDB->queryF($sql); } if (!FieldExists('ct_uname', $xoopsDB->prefix('priv_msgscont'))) { $sql = "ALTER TABLE `" . $xoopsDB->prefix("priv_msgscont") . "` ADD `ct_uname` varchar(25) NOT NULL default '' AFTER `ct_name`"; $result = $xoopsDB->queryF($sql); } if (!FieldExists('ct_regdate', $xoopsDB->prefix('priv_msgscont'))) { $sql = "ALTER TABLE `" . $xoopsDB->prefix("priv_msgscont") . "` ADD `ct_regdate` int(10) NOT NULL default '0' AFTER `ct_uname`"; $result = $xoopsDB->queryF($sql); } $sq3 = "SELECT * FROM " . $xoopsDB->prefix('priv_msgscont') . ""; $result3 = $xoopsDB->query($sq3); while ($row = $xoopsDB->fetchArray($result3)) { $poster = new XoopsUser($row['ct_contact']); $sql = "UPDATE `" . $xoopsDB->prefix('priv_msgscont') . "` SET ct_name='" . $poster->getVar('name') . "', ct_uname='" . $poster->getVar('uname') . "', ct_regdate='" . $poster->getVar('user_regdate') . "' WHERE ct_contact='" . $row['ct_contact'] . "'"; $result = $xoopsDB->queryF($sql); } } ////add and update tables priv_msgsopt if (!TableExists($xoopsDB->prefix('priv_msgsopt'))) { $xoopsDB->queryFromFile(XOOPS_ROOT_PATH . "/modules/mpmanager/sql/mysqlopt.sql"); } else { if (!FieldExists('resend', $xoopsDB->prefix('priv_msgsopt'))) { $sql = "ALTER TABLE `" . $xoopsDB->prefix("priv_msgsopt") . "` ADD `resend` tinyint(1) NOT NULL default '0'"; $result = $xoopsDB->queryF($sql); } if (!FieldExists('limite', $xoopsDB->prefix('priv_msgsopt'))) { $sq1 = "ALTER TABLE `" . $xoopsDB->prefix("priv_msgsopt") . "` ADD `limite` tinyint(2) default NULL"; $result = $xoopsDB->queryF($sql); } if (!FieldExists('home', $xoopsDB->prefix('priv_msgsopt'))) { $sql = "ALTER TABLE " . $xoopsDB->prefix("priv_msgsopt") . " ADD `home` tinyint(2) DEFAULT '1' NOT NULL AFTER `limite`"; $result = $xoopsDB->queryF($sql); } if (!FieldExists('sortname', $xoopsDB->prefix('priv_msgsopt'))) { $sql = "ALTER TABLE " . $xoopsDB->prefix("priv_msgsopt") . " ADD `sortname` varchar(15) AFTER `home`"; $result = $xoopsDB->queryF($sql); } if (!FieldExists('sortorder', $xoopsDB->prefix('priv_msgsopt'))) { $sql = "ALTER TABLE " . $xoopsDB->prefix("priv_msgsopt") . " ADD `sortorder` varchar(15) AFTER `sortname`"; $result = $xoopsDB->queryF($sql); } if (!FieldExists('vieworder', $xoopsDB->prefix('priv_msgsopt'))) { $sql = "ALTER TABLE " . $xoopsDB->prefix("priv_msgsopt") . " ADD `vieworder` varchar(15) AFTER `sortorder`"; $result = $xoopsDB->queryF($sql); } if (!FieldExists('formtype', $xoopsDB->prefix('priv_msgsopt'))) { $sql = "ALTER TABLE " . $xoopsDB->prefix("priv_msgsopt") . " ADD `formtype` tinyint(1) AFTER `vieworder`"; $result = $xoopsDB->queryF($sql); } } //add and update tables priv_msgsup if (!TableExists($xoopsDB->prefix('priv_msgsup'))) { $xoopsDB->queryFromFile(XOOPS_ROOT_PATH . "/modules/mpmanager/sql/mysqlup.sql"); //update priv_msgsup $sq5 = "SELECT * FROM " . $xoopsDB->prefix('priv_msgs') . "WHERE file_msg !='' "; $result5 = $xoopsDB->query($sq5); while ($row = $xoopsDB->fetchArray($result5)) { $result = $xoopsDB->queryF("INSERT INTO `" . $xoopsDB->prefix("priv_msgsup") . "` (`msg_id`, `u_id`, `u_name`, `u_mimetype`, `u_file`, `u_file`, `u_weight`) VALUES ('', " . $row['msg_id'] . ", " . $row['file_msg'] . ", '', " . $row['file_msg'] . ", '')"); $sql = "UPDATE " . $xoopsDB->prefix('priv_msgs') . " SET file_msg=1 WHERE msg_id='" . $row['msg_id'] . "'"; } //update file_msg $sql = "ALTER TABLE " . $xoopsDB->prefix("priv_msgs") . " CHANGE `file_msg` `file_msg` MEDIUMINT(8) NOT NULL DEFAULT '0'"; $result = $xoopsDB->queryF($sql); } } xoops_template_clear_module_cache($xoopsModule->getVar('mid')); $tpllist = array('mp_box.html', 'mp_contbox.html', 'mp_filebox.html', 'mp_index.html', 'mp_msgbox.html', 'mp_optionbox.html', 'mp_subox.html', 'mp_viewbox.html', 'mp_block_cont.html', 'mp_block_new.html'); $xoopsTpl = new XoopsTpl(); foreach ($tpllist as $onetemplate) { $xoopsTpl->clear_cache('db:' . $onetemplate); } return true; }
/** * Returns a value for output of this field * * @param XoopsUser $user {@link XoopsUser} object to get the value of * @param profileProfile $profile object to get the value of * * @return mixed **/ function getOutputValue(&$user, $profile) { if (file_exists($file = $GLOBALS['xoops']->path('modules/profile/language/' . $GLOBALS['xoopsConfig']['language'] . '/modinfo.php'))) { include_once $file; } else { include_once $GLOBALS['xoops']->path('modules/profile/language/english/modinfo.php'); } $value = in_array($this->getVar('field_name'), $this->getUserVars()) ? $user->getVar($this->getVar('field_name')) : $profile->getVar($this->getVar('field_name')); switch ($this->getVar('field_type')) { default: case "textbox": if ($this->getVar('field_name') == 'url' && $value != '') { return '<a href="' . formatURL($value) . '" rel="external">' . $value . '</a>'; } else { return $value; } break; case "textarea": case "dhtml": case 'theme': case "language": case "list": return $value; break; case "select": case "radio": $options = $this->getVar('field_options'); if (isset($options[$value])) { $value = htmlspecialchars(defined($options[$value]) ? constant($options[$value]) : $options[$value]); } else { $value = ""; } return $value; break; case "select_multi": case "checkbox": $options = $this->getVar('field_options'); $ret = array(); if (count($options) > 0) { foreach (array_keys($options) as $key) { if (in_array($key, $value)) { $ret[$key] = htmlspecialchars(defined($options[$key]) ? constant($options[$key]) : $options[$key]); } } } return $ret; break; case "group": $member_handler =& xoops_gethandler('member'); $options = $member_handler->getGroupList(); $ret = isset($options[$value]) ? $options[$value] : ''; return $ret; break; case "group_multi": $member_handler =& xoops_gethandler('member'); $options = $member_handler->getGroupList(); $ret = array(); foreach (array_keys($options) as $key) { if (in_array($key, $value)) { $ret[$key] = htmlspecialchars($options[$key]); } } return $ret; break; case "longdate": //return YYYY/MM/DD format - not optimal as it is not using local date format, but how do we do that //when we cannot convert it to a UNIX timestamp? return str_replace("-", "/", $value); case "date": return formatTimestamp($value, 's'); break; case "datetime": if (!empty($value)) { return formatTimestamp($value, 'm'); } else { return $value = _PROFILE_MI_NEVER_LOGGED_IN; } break; case "autotext": $value = $user->getVar($this->getVar('field_name'), 'n'); //autotext can have HTML in it $value = str_replace("{X_UID}", $user->getVar("uid"), $value); $value = str_replace("{X_URL}", XOOPS_URL, $value); $value = str_replace("{X_UNAME}", $user->getVar("uname"), $value); return $value; break; case "rank": $userrank = $user->rank(); $user_rankimage = ""; if (isset($userrank['image']) && $userrank['image'] != "") { $user_rankimage = '<img src="' . XOOPS_UPLOAD_URL . '/' . $userrank['image'] . '" alt="' . $userrank['title'] . '" /><br />'; } return $user_rankimage . $userrank['title']; break; case "yesno": return $value ? _YES : _NO; break; case "timezone": include_once $GLOBALS['xoops']->path('class/xoopslists.php'); $timezones = XoopsLists::getTimeZoneList(); $value = empty($value) ? "0" : strval($value); return $timezones[str_replace('.0', '', $value)]; break; } }
$start = isset($_GET['start']) ? intval($_GET['start']) : 0; $online_handler =& xoops_gethandler('online'); $online_total =& $online_handler->getCount(); $limit = $online_total > 2 ? 20 : $online_total; $criteria = new CriteriaCompo(); $criteria->setLimit($limit); $criteria->setStart($start); $onlines =& $online_handler->getAll($criteria); $count = count($onlines); $anonymous_count = 0; for ($i = 0; $i < $count; $i++) { if ($onlines[$i]['online_uid'] == 0) { $onlineUsers[$i]['uname'] = $xoopsConfig['anonymous']; $onlineUsers[$i]['uid'] = 0; $anonymous_count++; } else { $thisUser = new XoopsUser($onlines[$i]['online_uid']); $onlineUsers[$i]['uname'] = $thisUser->getVar('uname'); $onlineUsers[$i]['uid'] = $thisUser->getVar('uid'); } } if ($online_total > 20) { include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; $nav = new XoopsPageNav($online_total, 20, $start, 'start', ''); $xoopsTpl->assign('online_navigation', $nav->renderNav()); } $xoopsTpl->assign('users', $onlineUsers); $xoopsTpl->assign('anonymous_count', $anonymous_count); $xoopsTpl->assign('online_total', $online_total); $xoopsTpl->xoops_setCaching(0); $xoopsTpl->display('db:shoutbox_online.html');
} foreach (array_keys($pm_tree) as $i) { $result = $xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("priv_msgs") . " SET read_msg = '1' WHERE msg_id=" . $pm_tree[$i]->getVar('msg_id') . ""); if ($vieworder == 'thread') { $msg_thread = !empty($_REQUEST['msg_thread']) ? intval($_REQUEST['msg_thread']) : $pm_tree[$i]->getVar('msg_pid'); if ($msg_thread != $pm_tree[$i]->getVar('msg_id')) { if (!$pm_tree[$i]->getVar('msg_image')) { $tree_img = "<img src='../../images/read.gif' alt='' />"; } else { $tree_img = "<img src='../../images/subject/" . $pm_tree[$i]->getVar('msg_image') . "' alt='' />"; } $tree_poster = new XoopsUser($pm_tree[$i]->getVar("from_userid")); if (!$tree_poster->isActive()) { $poster = $myts->HtmlSpecialChars($xoopsConfig['anonymous']); } else { $poster = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $tree_poster->getVar("uid") . '">' . $tree_poster->getVar("uname") . '</a>'; } if (strlen($pm_tree[$i]->getVar("subject")) >= $xoopsModuleConfig['MPmaxtitle']) { $mp_treesubject = $pm_tree[$i]->getVar('subject') ? $myts->displayTarea(substr($pm_tree[$i]->getVar('subject'), 0, $xoopsModuleConfig['MPmaxtitle'])) . '...' : _MP_NONESUBJ; } else { $mp_treesubject = $pm_tree[$i]->getVar('subject') ? $myts->displayTarea($pm_tree[$i]->getVar('subject')) : _MP_NONESUBJ; } //$mp_treesubject = $pm_tree[$i]->getVar('subject') ? $myts->displayTarea($pm_tree[$i]->getVar('subject')) : _MP_NONESUBJ ; @($prefix .= " "); $xoopsTpl->append("topic_trees", array("post_id" => $pm_tree[$i]->getVar('msg_id'), "post_time" => formatTimestamp($pm_tree[$i]->getVar('msg_time')), "post_image" => $tree_img, "post_title" => '<a href="viewbox.php?op=view&start=' . $start . '&sortname=' . $sortname . '&sortorder=' . $sortorder . '&vieworder=' . $vieworder . '&treesortorder=' . $treesortorder . '&catbox=' . $catbox . '&viewstart=' . $viewstart . '&msg_thread=' . $pm_tree[$i]->getVar('msg_id') . '#' . $pm_tree[$i]->getVar('msg_id') . '">' . $mp_treesubject . '</a>', "post_prefix" => $prefix, "poster" => $poster)); } else { $eachpost = mp_post($view_perms, $pm_tree[$i], @$mpstop); } } else { $eachpost = mp_post($view_perms, $pm_tree[$i], @$mpstop); }
function getDetailView() { if (isset($_POST['cancel'])) { $base_url = XMOBILE_URL . '/?act=pmessage&sess=' . $this->sessionHandler->getSessionID(); header('Location: ' . $base_url); exit; } $this->controller->render->template->assign('show_detail', true); $myts =& MyTextSanitizer::getInstance(); // $op = $myts->makeTboxData4Show($this->utils->getGetPost('op', '')); $msg_id = intval($this->utils->getGetPost('msg_id', 0)); $session_id = $this->sessionHandler->getSessionID(); $uid = $this->sessionHandler->getUid(); $message = ''; /* if(isset($_POST['reply'])) { $base_url = XMOBILE_URL.'/?act=pmessage&view=confirm&reply=1&msg_id='.$msg_id.'&sess='.$this->sessionHandler->getSessionID(); header('Location: '.$base_url); exit(); } */ if ($uid == 0) { $base_url = $this->utils->getLinkUrl('register', null, null, $this->sessionHandler->getSessionID()); $message = _MD_XMOBILE_PM_SORRY . '<br /><a href="' . $base_url . '">' . _MD_XMOBILE_REGISTERNOW . '</a>.'; $this->controller->render->redirectHeader($message, 5, $base_url); exit; } $pm_handler =& xoops_gethandler('privmessage'); /* if(!empty($_POST['delete'])) { $pm =& $pm_handler->get(intval($_POST['msg_id'])); if(!is_object($pm) || $pm->getVar('to_userid') != $uid || !$pm_handler->delete($pm)) { $base_url = $this->utils->getLinkUrl($this->controller->getActionState(),null,null,$this->sessionHandler->getSessionID()); $this->controller->render->redirectHeader(_MD_XMOBILE_DELETE_FAILED,5,$base_url); exit(); } else { $base_url = $this->utils->getLinkUrl($this->controller->getActionState(),null,null,$this->sessionHandler->getSessionID()); $this->controller->render->redirectHeader(_MD_XMOBILE_PM_DELETED,3,$base_url); exit(); } } */ // $start = !empty($_GET['start']) ? intval($_GET['start']) : 0; // $total_messages = !empty($_GET['total_messages']) ? intval($_GET['total_messages']) : 0; /* $criteria = new Criteria('to_userid', $uid); $criteria->setLimit($limit); $criteria->setStart($start); $criteria->setSort('msg_time'); $criteria->setOrder('DESC'); $pm_arr =& $pm_handler->getObjects($criteria); */ $criteria =& new Criteria('to_userid', $uid); $criteria->setSort('msg_time'); $criteria->setOrder('DESC'); $extra_arg = $this->baseUrl; $total_messages = $pm_handler->getCount($criteria); $limit = 1; $pageNavi =& new XmobilePageNavigator($total_messages, $limit, 'start', $extra_arg); $criteria->setLimit($limit); $criteria->setStart($pageNavi->getStart()); $pm_arr =& $pm_handler->getObjects($criteria); if (empty($pm_arr)) { $has_message = false; } else { $has_message = true; $pm_handler->setRead($pm_arr[0]); // check read_msg $poster = new XoopsUser($pm_arr[0]->getVar('from_userid')); if ($poster->isActive()) { $poster_name = $poster->getVar('uname'); // $extの値はgetLinkUrl()でhtmlspecialchars()を掛けられるので&ではなく&と記述しておく // $ext = 'uid='.$pm_arr[0]->getVar('from_userid'); $ext = 'uid=' . $poster->getVar('uid'); $base_url = $this->utils->getLinkUrl('userinfo', null, null, $this->controller->sessionHandler->getSessionID(), $ext); $poster_name = '<a href="' . $base_url . '">' . $poster->getVar('uname') . '</a>'; $reply = true; } else { $poster_name = $xoopsConfig['anonymous']; $reply = false; } $token =& XoopsMultiTokenHandler::quickCreate('pm'); // $base_url = $this->utils->getLinkUrl($this->controller->getActionState(),$this->controller->getViewState(),null,$this->sessionHandler->getSessionID()); $ext = 'send=1'; $base_url = $this->utils->getLinkUrl('pmessage', 'confirm', null, $this->controller->sessionHandler->getSessionID(), $ext); $base_url = preg_replace('/&/i', '&', $base_url); $this->controller->render->template->assign('base_url', $base_url); $this->controller->render->template->assign('ticket_html', $token->getHtml()); $this->controller->render->template->assign('session_name', session_name()); $this->controller->render->template->assign('session_id', session_id()); $this->controller->render->template->assign('referer_url', $this->getBaseUrl()); $this->controller->render->template->assign('subject', $pm_arr[0]->getVar('subject')); $this->controller->render->template->assign('poster_name', $poster_name); $this->controller->render->template->assign('msg_time', formatTimestamp($pm_arr[0]->getVar('msg_time'))); $this->controller->render->template->assign('msg_text', $pm_arr[0]->getVar('msg_text')); $this->controller->render->template->assign('msg_id', $pm_arr[0]->getVar('msg_id')); $this->controller->render->template->assign('reply', $reply); // page navigation /* $previous = $start - 1; $next = $start + 1; $pm_page_navi = ''; if($previous >= 0) { // $extの値はgetLinkUrl()でhtmlspecialchars()を掛けられるので&ではなく&と記述しておく $ext = 'start='.$previous.'&total_messages='.$total_messages; $base_url = $this->utils->getLinkUrl('pmessage','detail',null,$this->sessionHandler->getSessionID(),$ext); $pm_page_navi .= '<a href="'.$base_url.'">'._MD_XMOBILE_PM_PREVIOUS.'</a> '; } if($next < $total_messages) { // $extの値はgetLinkUrl()でhtmlspecialchars()を掛けられるので&ではなく&と記述しておく $ext = 'start='.$next.'&total_messages='.$total_messages; $base_url = $this->utils->getLinkUrl('pmessage','detail',null,$this->sessionHandler->getSessionID(),$ext); $pm_page_navi .= '<a href="'.$base_url.'">'._MD_XMOBILE_PM_NEXT.'</a>'; } $this->controller->render->template->assign('pm_page_navi',$pm_page_navi); */ $this->controller->render->template->assign('pm_page_navi', $pageNavi->renderNavi()); } $this->controller->render->template->assign('message', $message); $this->controller->render->template->assign('has_message', $has_message); }
function order_notify($data, $email, $value) { global $xoopsModuleConfig, $xoopsUser, $xoopsModule; $poster = new XoopsUser($data['uid']); $eid = $data['eid']; $exid = $data['exid']; $url = EGUIDE_URL . '/event.php?eid=' . $eid . ($exid ? "&sub={$exid}" : ''); $xoopsMailer =& getMailer(); $xoopsMailer->useMail(); $tplname = $data['autoaccept'] ? "accept%s.tpl" : "order%s.tpl"; $extra = eguide_form_options('reply_extension'); $tplfile = sprintf($tplname, ''); // default template name $tmpdir = template_dir($tplfile); if ($extra) { $vals = unserialize_text($value); if (isset($vals[$extra])) { $extpl = sprintf($tplname, $vals[$extra]); if (file_exists("{$tmpdir}{$extpl}")) { $tplfile = $extpl; } } } else { $extra = eguide_form_options('reply_tpl_suffix'); if ($extra) { $extpl = sprintf($tplname, $extra); if (file_exists("{$tmpdir}{$extpl}")) { $tplfile = $extpl; } } } $xoopsMailer->setTemplateDir($tmpdir); $xoopsMailer->setTemplate($tplfile); if ($xoopsModuleConfig['member_only'] && is_object($xoopsUser)) { $user = $xoopsUser; if (isset($data['reserv_uid'])) { $ruid = $data['reserv_uid']; $user = new XoopsUser($ruid); } else { $xoopsMailer->setToUsers($user); } $uinfo = sprintf("%s: %s (%s)\n", _MD_UNAME, $user->getVar('uname'), $user->getVar('name')); } else { if (!empty($email)) { $xoopsMailer->setToEmails($email); } $uinfo = ""; } if ($email) { $uinfo .= sprintf("%s: %s\n", _MD_EMAIL, $email); } $rvid = $data['rvid']; $conf = $data['confirm']; $edate = eventdate($data['edate']); $tags = array("EVENT_URL" => $url, "RVID" => $rvid, "CANCEL_KEY" => $conf, "CANCEL_URL" => EGUIDE_URL . "/reserv.php?op=cancel&rvid={$rvid}&key={$conf}", "INFO" => $uinfo . $value, "TITLE" => $edate . " " . $data['title'], "EVENT_DATE" => $edate, "EVENT_TITLE" => $data['title'], "SUMMARY" => strip_tags($data['summary'])); $subj = eguide_form_options('reply_subject', _MD_SUBJECT); $xoopsMailer->assign($tags); $xoopsMailer->setSubject($subj); $xoopsMailer->setFromEmail($poster->getVar('email')); $xoopsMailer->setFromName(eguide_from_name()); $ret = $xoopsMailer->send(); // send to order person if (!$ret) { return $ret; } $xoopsMailer->reset(); $xoopsMailer->useMail(); $xoopsMailer->setTemplateDir(template_dir($tplfile)); $xoopsMailer->setTemplate($tplfile); $xoopsMailer->assign($tags); $xoopsMailer->setSubject($subj); $xoopsMailer->setFromEmail($poster->getVar('email')); $xoopsMailer->setFromName(eguide_from_name()); if ($data['notify']) { if (!in_array($xoopsModuleConfig['notify_group'], $poster->groups())) { $xoopsMailer->setToUsers($poster); } $member_handler =& xoops_gethandler('member'); $notify_group = $member_handler->getGroup($xoopsModuleConfig['notify_group']); $xoopsMailer->setToGroups($notify_group); $xoopsMailer->send(); } return $ret; }
$signature = sanitize($row['com_sig']); $status = sanitize($row['com_status']); $params = sanitize($row['com_exparams']); $dohtml = sanitize($row['dohtml']); $dosmiley = sanitize($row['dosmiley']); $xcode = sanitize($row['doxcode']); $doimage = sanitize($row['doimage']); $linebreak = sanitize($row['dobr']); $user = new XoopsUser($row['com_uid']); $avatar = $user->user_avatar($row['com_uid']); $rank = $user->rank($row['com_uid']); $rank_title = $rank['title']; $rank_image = XOOPS_UPLOAD_URL . "/" . $rank['image']; $regdate = date("d-m-Y", $user->user_regdate($row['com_uid'])); $userLocation = $user->user_from($row['com_uid']); $numposts = $user->getVar("posts"); $checkstatus = $user->isOnline(); if ($checkstatus > 0) { $status = "Online"; } else { $status = "Offline"; } if ($icon = '') { $comment_image = ''; } else { $comment_image = '<img src="' . XOOPS_UPLOAD_URL . "/" . $icon . '" alt=""></img>'; } if ($avatar == '') { $avatar = 'blank.gif'; } $uname = $user->getVar('uname');
$view = isset($_GET['view']) && array_key_exists(intval($_GET['view']), $view_array) ? intval($_GET['view']) : $d_view; $d_limit = $xoopsModuleConfig['comnum']; $limit_array = array('5' => 5, '10' => 10, '20' => 20, '50' => 50, '100' => 100); $limit = isset($_GET['limit']) && array_key_exists(intval($_GET['limit']), $limit_array) ? intval($_GET['limit']) : $d_limit; if ($uid == 0) { redirect_header(XOOPS_URL, 2, _NOPERM); exit; } $myts =& MyTextSanitizer::getInstance(); $xoopsOption['template_main'] = 'mycomments_comments.html'; include_once XOOPS_ROOT_PATH . '/header.php'; $thisuser = new XoopsUser($uid); switch ($xoopsModuleConfig['displayname']) { case 1: // Username $username = $thisuser->getVar('uname'); break; case 2: // Display full name (if it is not empty) if (xoops_trim($thisuser->getVar('name')) == '') { $username = $thisuser->getVar('uname'); } else { $username = $thisuser->getVar('name'); } break; } // admins can view all comments and IPs, others can only view approved(active) comments if (is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) { $admin_view = true; } else { $admin_view = false;
} else { $currentUser =& new XoopsUser(); $currentUser->setVar('uid', 0); $useroffset = $xoopsConfig['default_TZ'] - $xoopsConfig['server_TZ']; } $isAdmin = $currentUser->isAdmin($xoopsModule->mid()); $currentuid = $currentUser->getVar('uid'); // specify template $xoopsOption['template_main'] = 'weblog' . $mydirnumber . '_entries.html'; // obtain class instances $myts =& MyTextSanitizer::getInstance(); $weblog =& Weblog::getInstance(); $weblogcat =& WeblogCategories::getInstance(); if ($user_id > 0) { $blogOwner = new XoopsUser($user_id); $page_subtitle = sprintf(_BL_ENTRIES_FOR, $blogOwner->getVar('uname', 'E')); $page_rss = sprintf(_BL_RSS_RECENT_FOR, $blogOwner->getVar('uname', 'E')); } else { $page_subtitle = _BL_MOST_RECENT; $page_rss = _BL_RSS_RECENT; } if ($xoopsModuleConfig['update_reads_when'] == 2 && $user_id > 0 || $xoopsModuleConfig['update_reads_when'] == 3) { $updateReads = true; } else { $updateReads = false; } // obtain row count //$count = $weblog->getCountByUser($currentuid, $user_id); //$count = $weblog->getCountByCategory($currentuid, $cat_id, $user_id); $count = $weblog->getCountByDate($currentuid, $cat_id, $user_id, $date, $useroffset); // obtain entries
function save_comment() { global $xoopsSecurity; $id = rmc_server_var($_POST, 'id', 0); $page = rmc_server_var($_POST, 'page', 1); $filter = rmc_server_var($_POST, 'filter', ''); $w = rmc_server_var($_POST, 'w', '1'); $qs = "id={$id}&w={$w}&page={$page}&filter={$filter}"; if (!$xoopsSecurity->check()) { redirectMsg('comments.php?action=edit&' . $qs, __('Sorry, session token expired!', 'rmcommon'), 1); die; } if ($id <= 0) { redirectMsg('comments.php', __('Comment ID not specified!', 'rmcommon'), 1); die; } $comment = new RMComment($id); if ($comment->isNew()) { redirectMsg('comments.php?' . $qs, __('Specified comment does not exist!', 'rmcommon'), 1); die; } $status = rmc_server_var($_POST, 'status', 'unapproved'); $status = $status == 'approved' ? $status : 'unapproved'; $user = rmc_server_var($_POST, 'user', 0); $content = rmc_server_var($_POST, 'content', ''); // save basic info in comment object $comment->setVar('content', $content); $comment->setVar('status', $status); // Modify, if neccessary, the user $cuser = new RMCommentUser($comment->getVar('user')); if ($cuser->getVar('xuid') != $user) { if ($user == 0) { $cuser->setVar('xuid', 0); $cuser->save(); } else { $xuser = new XoopsUser($user); $cuser = new RMCommentUser($xuser->getVar('email')); $cuser->setVar('name', $xuser->getVar('uname')); $cuser->setVar('email', $xuser->getVar('email')); $cuser->setVar('xuid', $user); $cuser->setVar('url', $xuser->getVar('url')); $cuser->save(); } $comment->setVar('user', $cuser->id()); } if ($comment->save()) { redirectMsg('comments.php?' . $qs, __('Comment updated successfully!', 'rmcommon'), 0); } else { redirectMsg('comments.php?action=edit&' . $qs, __('Errros ocurrs while trying to update comment!', 1) . '<br />' . $comment->errors(), 1); } }
} if (!news_getmoduleoption('newsbythisauthor')) { redirect_header('index.php', 2, _ERRORS); exit; } $myts =& MyTextSanitizer::getInstance(); $articles = new NewsStory(); $xoopsOption['template_main'] = 'news_by_this_author.html'; include_once XOOPS_ROOT_PATH . '/header.php'; $dateformat = news_getmoduleoption('dateformat'); $infotips = news_getmoduleoption('infotips'); $thisuser = new XoopsUser($uid); switch ($xoopsModuleConfig['displayname']) { case 1: // Username $authname = $thisuser->getVar('uname'); break; case 2: // Display full name (if it is not empty) if (xoops_trim($thisuser->getVar('name')) == '') { $authname = $thisuser->getVar('uname'); } else { $authname = $thisuser->getVar('name'); } break; case 3: // Nothing $authname = ''; break; } $xoopsTpl->assign('lang_page_title', _MI_NEWSBYTHISAUTHOR . ' - ' . $authname);
/** * 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); }
for ($i = 0; $i < $size; $i++) { switch ($option) { default: redirect_header("javascript:history.go(-1)", 1, _PM_REDNON); break; case "email_messages": $pm_handler =& xoops_gethandler('priv_msgs'); $pm =& $pm_handler->get($msg_id[$i]); $poster = new XoopsUser($pm->getVar("from_userid")); $body .= " \r\n<table border='0' cellspacing='1' cellpadding='4' width='100%' style='border: #ccc 1px solid'>\r\n<tr><td width='20%'>" . _PM_FROM . ": <b><a href='" . XOOPS_URL . "/userinfo.php?uid=" . $poster->getVar("uid") . "'>" . $poster->getVar("uname") . "</a></td>\r\n <td>" . _MP_POSTED . ": <b>" . formatTimestamp($pm->getVar("msg_time")) . "</b></td>\r\n</tr>\t\r\n<tr><td valign='top' colspan='2'><div align='left'>" . _PM_SUBJECT . ": " . $myts->htmlSpecialChars($myts->stripSlashesGPC($pm->getVar("subject"))) . "<br />\r\n" . _MP_MMES . ": " . $myts->htmlSpecialChars($myts->stripSlashesGPC($pm->getVar("msg_text"))) . "</div></td></tr></table>"; break; case "email_messagess": $pm_handler =& xoops_gethandler('priv_msgs'); $pm =& $pm_handler->get($msg_id[$i]); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('to_userid', $xoopsUser->getVar('uid'))); $criteria->add(new Criteria('msg_pid', $pm->getVar('msg_pid'))); $pm =& $pm_handler->getObjects($criteria); foreach (array_keys($pm) as $i) { $poster = new XoopsUser($pm[$i]->getVar("from_userid")); $body .= " \r\n<table border='0' cellspacing='1' cellpadding='4' width='100%' style='border: #ccc 1px solid'>\r\n<tr><td width='20%'>" . _PM_FROM . ": <b><a href='" . XOOPS_URL . "/userinfo.php?uid=" . $poster->getVar("uid") . "'>" . $poster->getVar("uname") . "</a></td>\r\n <td>" . _MP_POSTED . ": <b>" . formatTimestamp($pm[$i]->getVar("msg_time")) . "</b></td>\r\n</tr>\t\r\n<tr><td valign='top' colspan='2'><div align='left'>" . _PM_SUBJECT . ": " . $myts->htmlSpecialChars($myts->stripSlashesGPC($pm[$i]->getVar("subject"))) . "<br />\r\n" . _MP_MMES . ": " . $myts->htmlSpecialChars($myts->stripSlashesGPC($pm[$i]->getVar("msg_text"))) . "</div></td></tr></table>"; } break; } } $xoopsMailer->setBody($myts->oopsStripSlashesGPC($body)); if ($xoopsMailer->send()) { redirect_header("javascript:history.go(-1)", 1, _PM_EMAIL); } else { redirect_header("javascript:history.go(-1)", 1, _PM_REDNON); }
/** * __construct * * @param XoopsUser|XoopsObject &$obj user object */ public function __construct(XoopsUser &$obj) { $xoops = Xoops::getInstance(); if ($obj->isNew()) { //Add user $uid_value = ""; $uname_value = ""; $name_value = ""; $email_value = ""; $email_cbox_value = 0; $url_value = ""; $timezone_value = $xoops->getConfig('default_TZ'); $icq_value = ""; $aim_value = ""; $yim_value = ""; $msnm_value = ""; $location_value = ""; $occ_value = ""; $interest_value = ""; $sig_value = ""; $sig_cbox_value = 0; $bio_value = ""; $rank_value = 0; $mailok_value = 0; $form_title = SystemLocale::ADD_USER; $form_isedit = false; $groups = array(FixedGroups::USERS); } else { //Edit user $uid_value = $obj->getVar("uid", "E"); $uname_value = $obj->getVar("uname", "E"); $name_value = $obj->getVar("name", "E"); $email_value = $obj->getVar("email", "E"); $email_cbox_value = $obj->getVar("user_viewemail") ? 1 : 0; $url_value = $obj->getVar("url", "E"); $timezone_value = $obj->getVar("timezone_offset"); $icq_value = $obj->getVar("user_icq", "E"); $aim_value = $obj->getVar("user_aim", "E"); $yim_value = $obj->getVar("user_yim", "E"); $msnm_value = $obj->getVar("user_msnm", "E"); $location_value = $obj->getVar("user_from", "E"); $occ_value = $obj->getVar("user_occ", "E"); $interest_value = $obj->getVar("user_intrest", "E"); $sig_value = $obj->getVar("user_sig", "E"); $sig_cbox_value = $obj->getVar("attachsig") == 1 ? 1 : 0; $bio_value = $obj->getVar("bio", "E"); $rank_value = $obj->rank(false); $mailok_value = $obj->getVar('user_mailok', 'E'); $form_title = sprintf(SystemLocale::F_UPDATE_USER, $obj->getVar("uname")); $form_isedit = true; $groups = array_values($obj->getGroups()); } //Affichage du formulaire parent::__construct($form_title, "form_user", "admin.php", "post", true); $this->addElement(new Xoops\Form\Text(XoopsLocale::USER_NAME, "username", 4, 25, $uname_value), true); $this->addElement(new Xoops\Form\Text(XoopsLocale::NAME, "name", 5, 60, $name_value)); $email_tray = new Xoops\Form\ElementTray(XoopsLocale::EMAIL, "<br />"); $email_text = new Xoops\Form\Text("", "email", 5, 60, $email_value); $email_tray->addElement($email_text, true); $email_cbox = new Xoops\Form\Checkbox("", "user_viewemail", $email_cbox_value); $email_cbox->addOption(1, XoopsLocale::ALLOW_OTHER_USERS_TO_VIEW_EMAIL); $email_tray->addElement($email_cbox); $this->addElement($email_tray, true); $this->addElement(new Xoops\Form\Text(XoopsLocale::WEB_URL, "url", 5, 100, $url_value)); $this->addElement(new Xoops\Form\SelectTimeZone(XoopsLocale::TIME_ZONE, "timezone_offset", $timezone_value)); $this->addElement(new Xoops\Form\Text(XoopsLocale::ICQ, "user_icq", 3, 15, $icq_value)); $this->addElement(new Xoops\Form\Text(XoopsLocale::AIM, "user_aim", 3, 18, $aim_value)); $this->addElement(new Xoops\Form\Text(XoopsLocale::YIM, "user_yim", 3, 25, $yim_value)); $this->addElement(new Xoops\Form\Text(XoopsLocale::MSNM, "user_msnm", 3, 100, $msnm_value)); $this->addElement(new Xoops\Form\Text(XoopsLocale::LOCATION, "user_from", 5, 100, $location_value)); $this->addElement(new Xoops\Form\Text(XoopsLocale::OCCUPATION, "user_occ", 5, 100, $occ_value)); $this->addElement(new Xoops\Form\Text(XoopsLocale::INTEREST, "user_intrest", 5, 150, $interest_value)); $sig_tray = new Xoops\Form\ElementTray(XoopsLocale::SIGNATURE, "<br />"); $sig_tarea = new Xoops\Form\TextArea("", "user_sig", $sig_value, 5, 5); $sig_tray->addElement($sig_tarea); $sig_cbox = new Xoops\Form\Checkbox("", "attachsig", $sig_cbox_value); $sig_cbox->addOption(1, XoopsLocale::ALWAYS_ATTACH_MY_SIGNATURE); $sig_tray->addElement($sig_cbox); $this->addElement($sig_tray); $this->addElement(new Xoops\Form\TextArea(XoopsLocale::EXTRA_INFO, "bio", $bio_value, 5, 5)); if ($xoops->isActiveModule('userrank')) { $rank_select = new Xoops\Form\Select(XoopsLocale::RANK, "rank", $rank_value); $ranklist = XoopsLists::getUserRankList(); $rank_select->addOption(0, "--------------"); if (count($ranklist) > 0) { $rank_select->addOptionArray($ranklist); } $this->addElement($rank_select); } else { $this->addElement(new Xoops\Form\Hidden("rank", $rank_value)); } // adding a new user requires password fields if (!$form_isedit) { $this->addElement(new Xoops\Form\Password(XoopsLocale::PASSWORD, "password", 3, 32), true); $this->addElement(new Xoops\Form\Password(XoopsLocale::RETYPE_PASSWORD, "pass2", 3, 32), true); } else { $this->addElement(new Xoops\Form\Password(XoopsLocale::PASSWORD, "password", 3, 32)); $this->addElement(new Xoops\Form\Password(XoopsLocale::RETYPE_PASSWORD, "pass2", 3, 32)); } $this->addElement(new Xoops\Form\RadioYesNo(XoopsLocale::ONLY_USERS_THAT_ACCEPT_EMAIL, 'user_mailok', $mailok_value)); //Groups administration addition XOOPS 2.0.9: Mith $gperm_handler = $xoops->getHandlerGroupperm(); $group_select = array(); //If user has admin rights on groups if ($gperm_handler->checkRight("system_admin", XOOPS_SYSTEM_GROUP, $xoops->user->getGroups(), 1)) { //add group selection $group_select[] = new Xoops\Form\SelectGroup(XoopsLocale::GROUPS, 'groups', false, $groups, 5, true); } else { //add each user groups foreach ($groups as $key => $group) { $group_select[] = new Xoops\Form\Hidden('groups[' . $key . ']', $group); } } foreach ($group_select as $group) { $this->addElement($group); unset($group); } $this->addElement(new Xoops\Form\Hidden("fct", "users")); $this->addElement(new Xoops\Form\Hidden("op", "users_save")); $this->addElement(new Xoops\Form\Button("", "submit", XoopsLocale::A_SUBMIT, "submit")); if (!empty($uid_value)) { $this->addElement(new Xoops\Form\Hidden("uid", $uid_value)); } }
function xhnewbb_show_tree(&$arr, $current = 0, $key = 0, $prefix = '', $foundusers = array()) { global $xoopsConfig; if ($key != 0) { if (0 != $arr[$key]['obj']->uid()) { if (!isset($foundusers[$arr[$key]['obj']->uid()])) { $eachposter = new XoopsUser($arr[$key]['obj']->uid()); $foundusers[$arr[$key]['obj']->uid()] =& $eachposter; } else { $eachposter =& $foundusers[$arr[$key]['obj']->uid()]; } $poster_rank = $eachposter->rank(); if (!empty($poster_rank['image'])) { $poster_rank['image'] = '<img src="' . XOOPS_UPLOAD_URL . '/' . $poster_rank['image'] . '" alt="" />'; } if ($eachposter->isActive()) { $posterarr = array('poster_uid' => $eachposter->getVar('uid'), 'poster_uname' => '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $eachposter->getVar('uid') . '">' . $eachposter->getVar('uname') . '</a>'); } else { $posterarr = array('poster_uid' => 0, 'poster_uname' => $xoopsConfig['anonymous']); } } else { $posterarr = array('poster_uid' => 0, 'poster_uname' => $xoopsConfig['anonymous']); } $posticon = $arr[$key]['obj']->icon(); if (isset($posticon) && $posticon != '') { $post_image = '<img src="' . XOOPS_URL . '/modules/xhnewbb/images/' . $posticon . '" alt="" />'; } else { $post_image = '<img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" />'; } if ($current != $key) { $subject = '<a href="viewtopic.php?topic_id=' . $arr[$key]['obj']->topic() . '&post_id=' . $arr[$key]['obj']->postid() . '&viewmode=thread#forumpost' . $arr[$key]['obj']->postid() . '">' . $arr[$key]['obj']->subject() . '</a>'; $GLOBALS['xoopsTpl']->append("topic_trees", array_merge($posterarr, array("post_id" => $arr[$key]['obj']->postid(), "post_parent_id" => $arr[$key]['obj']->parent(), "post_date" => formatTimestamp($arr[$key]['obj']->posttime(), "m"), "post_image" => $post_image, "post_title" => $subject, "post_prefix" => $prefix))); } else { $subject = '<b>' . $arr[$key]['obj']->subject() . '</b>'; $thisprefix = substr($prefix, 0, -6) . "<b>»</b>"; $GLOBALS['xoopsTpl']->append("topic_trees", array_merge($posterarr, array("post_id" => $arr[$key]['obj']->postid(), "post_parent_id" => $arr[$key]['obj']->parent(), "post_date" => formatTimestamp($arr[$key]['obj']->posttime(), "m"), "post_image" => $post_image, "post_title" => $subject, "post_prefix" => $thisprefix))); } } if (isset($arr[$key]['replies']) && !empty($arr[$key]['replies'])) { $prefix .= " "; foreach ($arr[$key]['replies'] as $replykey) { $current = $current == 0 ? $replykey : $current; xhnewbb_show_tree($arr, $current, $replykey, $prefix, $foundusers); } } }
/** * Add Users as recipients for message. * Users can be passed as object or as ids * * @param array Users (ids or objects) */ public function add_users($users, $field = 'to') { if (!is_array($users)) { return; } foreach ($users as $user) { if (is_a($user, "XoopsUser")) { $this->add_user($user->gatVar('email'), $user->getVar('name') != '' ? $user->getVar('name') : $user->getVar('uname'), $field); } else { $user = new XoopsUser($user); if ($user->isNew()) { continue; } $this->add_user($user->getVar('email'), $user->getVar('name') != '' ? $user->getVar('name') : $user->getVar('uname'), $field); } } }
$box_actions[] = "<input type='submit' class='xo-message-form' onclick='document.prvmsg.action=\"delcont.php?option=delete_cont\"' id='del' disabled value='" . _MP_FORMDEL . "'>"; $box_actions[] = "<input type='hidden' name='catbox' value='" . $catbox . "'>"; // $box_actions[] = "<input type='hidden' name='after' value='".$after."'>"; $box_actions[] = "<input type='hidden' name='limit_msg' value='" . $limit_msg . "'>"; $box_actions[] = "<input type='hidden' name='sortname' value='" . $sortname . "'>"; $box_actions[] = "<input type='hidden' name='sortorder' value='" . $sortorder . "'>"; $xoopsTpl->assign('box_actions', $box_actions); $xoopsTpl->assign('mp_amount', $amount); if ($amount == 0) { $xoopsTpl->assign('lang_none', _MP_YOUDONTCONTACT); } $i = $start + 0; foreach (array_keys($pm_cont) as $i) { $poster = new XoopsUser($pm_cont[$i]->getVar('ct_contact')); $mp['msg_id'] = $pm_cont[$i]->getVar('ct_contact'); $postername = $poster->getVar('uname') . "<br />" . $poster->getVar('name'); $userrank =& $poster->rank(); /* No need to show deleted users */ if ($postername) { $mp['msg_poster'] = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $pm_cont[$i]->getVar('ct_contact') . "'>" . $postername . "</a>"; } else { $mp['msg_poster'] = $xoopsConfig['anonymous']; } $mp['msg_joindate'] = formatTimestamp($poster->getVar("user_regdate")); /* Online poster */ if ($poster->isOnline()) { $mp['msg_online'] = '<img src="' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/images/online.png" title="' . _MP_ONLINE . '" style="width: 20px; height: 20px;"/>'; } else { $mp['msg_online'] = '<img src="' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/images/offline.png" title="' . _MP_OFFLINE . '" style="width: 20px; height: 20px;"/>'; } /**/
/** * Event: new_user_by_email * Triggered after new user account is created during ticket submission * @param string $password Password for new account * @param XoopsUser $user XOOPS user object for new account */ function new_user_by_email($password, &$user) { // Send Welcome Email to submitter //global $xoopsUser; $tags = array(); $tags['XOOPS_USER_NAME'] = $user->getVar('uname'); $tags['XOOPS_USER_EMAIL'] = $user->getVar('email'); $tags['XOOPS_USER_ID'] = $user->getVar('uname'); $tags['XOOPS_USER_PASSWORD'] = $password; $tags['X_UACTLINK'] = XHELP_SITE_URL . "/user.php?op=actv&id=" . $user->getVar("uid") . "&actkey=" . $user->getVar('actkey'); if ($email_tpl = $this->_getEmailTpl('ticket', 'new_user_byemail', $this->_module, $template_id)) { $sendTo = $this->_getUserEmail($user->getVar('uid')); $success = $this->_sendEvents($email_tpl, $sendTo, $tags); } }
/** * Subscribe for notification for an event(s) * * @param string $category category of notification * @param int $item_id ID of the item * @param mixed $events event string or array of events * @param int $mode force a particular notification mode * (e.g. once_only) (default to current user preference) * @param int $module_id ID of the module (default to current module) * @param int $user_id ID of the user (default to current user) **/ function subscribe($category, $item_id, $events, $mode = null, $module_id = null, $user_id = null) { if (!isset($user_id)) { global $xoopsUser; if (empty($xoopsUser)) { return false; // anonymous cannot subscribe } else { $user_id = $xoopsUser->getVar('uid'); } } if (!isset($module_id)) { global $xoopsModule; $module_id = $xoopsModule->getVar('mid'); } if (!isset($mode)) { $user = new XoopsUser($user_id); $mode = $user->getVar('notify_mode'); } if (!is_array($events)) { $events = array($events); } foreach ($events as $event) { if ($notification =& $this->getNotification($module_id, $category, $item_id, $event, $user_id)) { if ($notification->getVar('not_mode') != $mode) { $this->updateByField($notification, 'not_mode', $mode); } } else { $notification =& $this->create(); $notification->setVar('not_modid', $module_id); $notification->setVar('not_category', $this->_escapeValue($category)); $notification->setVar('not_itemid', $item_id); $notification->setVar('not_uid', $user_id); $notification->setVar('not_event', $this->_escapeValue($event)); $notification->setVar('not_mode', $mode); $this->insert($notification); } } }
foreach ($hooked_function['cancel'] as $func) { if (!$func($eid, $exid, $data['ruid'], $data['uid'])) { echo "Cancel failed"; } } } } if ($data['notify'] && empty($data['operator']) && $data['edate'] - $data['closetime'] > $now) { $poster = new XoopsUser($data['uid']); $title = eventdate($data['edate']) . " " . $data['title']; $email = $data['email']; $xoopsMailer =& getMailer(); $xoopsMailer->useMail(); if ($xoopsModuleConfig['member_only'] && $data['ruid']) { $user = new XoopsUser($data['ruid']); $uinfo = sprintf("%s: %s (%s)\n", _MD_UNAME, $user->getVar('uname'), $user->getVar('name')); $xoopsMailer->setToUsers($user); } else { $uinfo = ""; } if ($email) { $uinfo .= sprintf("%s: %s\n", _MD_EMAIL, $email); } if (is_object($xoopsUser)) { $xoopsMailer->assign("REQ_UNAME", $xoopsUser->getVar('uname')); $xoopsMailer->assign("REQ_NAME", $xoopsUser->getVar('name')); } else { $xoopsMailer->assign("REQ_UNAME", '*anonymous*'); $xoopsMailer->assign("REQ_NAME", $xoopsConfig['anonymous']); } $tags = array("TITLE" => "{EVENT_DATE} {EVENT_TITLE}", "EVENT_DATE" => eventdate($data['edate']), "EVENT_TITLE" => $data['title'], "EVENT_URL" => $evurl, "RVID" => $rvid, "INFO" => $uinfo . $data['info']);
/** * Send a message to user's email * * @param XoopsObject|PmMessage $pm * @param null|XoopsUser $user * @return bool */ public function sendEmail(PmMessage $pm, XoopsUser $user = null) { $xoops = Xoops::getInstance(); if (!is_object($user)) { $user = $xoops->user; } $msg = sprintf(_PM_EMAIL_DESC, $user->getVar("uname")); $msg .= "\n\n"; $msg .= XoopsLocale::formatTimestamp($pm->getVar("msg_time")); $msg .= "\n"; $from = new XoopsUser($pm->getVar("from_userid")); $to = new XoopsUser($pm->getVar("to_userid")); $msg .= sprintf(_PM_EMAIL_FROM, $from->getVar("uname") . " (" . \XoopsBaseConfig::get('url') . "/userinfo.php?uid=" . $pm->getVar("from_userid") . ")"); $msg .= "\n"; $msg .= sprintf(_PM_EMAIL_TO, $to->getVar("uname") . " (" . \XoopsBaseConfig::get('url') . "/userinfo.php?uid=" . $pm->getVar("to_userid") . ")"); $msg .= "\n"; $msg .= _PM_EMAIL_MESSAGE . ":\n"; $msg .= "\n" . $pm->getVar("subject") . "\n"; $msg .= "\n" . strip_tags(str_replace(array("<p>", "</p>", "<br />", "<br />"), "\n", $pm->getVar("msg_text"))) . "\n\n"; $msg .= "--------------\n"; $msg .= $xoops->getConfig('sitename') . ": " . \XoopsBaseConfig::get('url') . "\n"; $xoopsMailer = $xoops->getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setToEmails($user->getVar("email")); $xoopsMailer->setFromEmail($xoops->getConfig('adminmail')); $xoopsMailer->setFromName($xoops->getConfig('sitename')); $xoopsMailer->setSubject(sprintf(_PM_EMAIL_SUBJECT, $pm->getVar("subject"))); $xoopsMailer->setBody($msg); return $xoopsMailer->send(); }
return '<span style="font-weight: bolder; background-color: ' . $color . ';">' . $matches[0] . '</span>'; } $highlight = false; $highlight = news_getmoduleoption('keywordshighlight'); if ($highlight && isset($_GET['keywords'])) { $keywords = $myts->htmlSpecialChars(trim(urldecode($_GET['keywords']))); $h = new keyhighlighter($keywords, true, 'my_highlighter'); $story['text'] = $h->highlight($story['text']); } // **************************************************************************************************************** $story['poster'] = $article->uname(); if ($story['poster']) { $story['posterid'] = $article->uid(); $story['poster'] = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $story['posterid'] . '">' . $story['poster'] . '</a>'; $tmp_user = new XoopsUser($article->uid()); $story['poster_avatar'] = XOOPS_UPLOAD_URL . '/' . $tmp_user->getVar('user_avatar'); $story['poster_signature'] = $tmp_user->getVar('user_sig'); $story['poster_email'] = $tmp_user->getVar('email'); $story['poster_url'] = $tmp_user->getVar('url'); $story['poster_from'] = $tmp_user->getVar('user_from'); unset($tmp_user); } else { $story['poster'] = ''; $story['posterid'] = 0; $story['poster_avatar'] = ''; $story['poster_signature'] = ''; $story['poster_email'] = ''; $story['poster_url'] = ''; $story['poster_from'] = ''; if (news_getmoduleoption('displayname') != 3) { $story['poster'] = $xoopsConfig['anonymous'];
/** * Send a message to user's email * @param object $pm {@link XoopsPrivmessage} object * @param object $user * @return bool **/ function sendEmail(&$pm, &$user) { global $xoopsConfig; if (!is_object($user)) { $user =& $GLOBALS["xoopsUser"]; } $msg = sprintf(_PM_EMAIL_DESC, $user->getVar("uname")); $msg .= "\n\n"; $msg .= formatTimestamp($pm->getVar("msg_time")); $msg .= "\n"; $from = new XoopsUser($pm->getVar("from_userid")); $to = new XoopsUser($pm->getVar("to_userid")); $msg .= sprintf(_PM_EMAIL_FROM, $from->getVar("uname") . " (" . XOOPS_URL . "/userinfo.php?uid=" . $pm->getVar("from_userid") . ")"); $msg .= "\n"; $msg .= sprintf(_PM_EMAIL_TO, $to->getVar("uname") . " (" . XOOPS_URL . "/userinfo.php?uid=" . $pm->getVar("to_userid") . ")"); $msg .= "\n"; $msg .= _PM_EMAIL_MESSAGE . ":\n"; $msg .= "\n" . $pm->getVar("subject") . "\n"; $msg .= "\n" . strip_tags(str_replace("<p>", "\n", str_replace("</p>", "\n", str_replace("<br>", "\n", str_replace("<br />", "\n", $pm->getVar("msg_text")))))) . "\n\n"; $msg .= "--------------\n"; $msg .= $xoopsConfig['sitename'] . ": " . XOOPS_URL . "\n"; $xoopsMailer =& getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setToEmails($user->getVar("email")); $xoopsMailer->setFromEmail($xoopsConfig['adminmail']); $xoopsMailer->setFromName($xoopsConfig['sitename']); $xoopsMailer->setSubject(sprintf(_PM_EMAIL_SUBJECT, $pm->getVar("subject"))); $xoopsMailer->setBody($msg); return $xoopsMailer->send(); }
if ($content == '') { redirect_header('post_comment.php?id=' . $id . '&ret=' . urlencode($ret) . '&action=edit', 2, __('You must provide a text for comment!', 'rmcommon')); die; } // save basic info in comment object $comment->setVar('content', $content); $comment->setVar('status', $status); // Modify, if neccessary, the user $cuser = new RMCommentUser($comment->getVar('user')); if ($cuser->getVar('xuid') != $user) { if ($user == 0) { $cuser->setVar('xuid', 0); $cuser->save(); } else { $xuser = new XoopsUser($user); $cuser = new RMCommentUser($xuser->getVar('email')); $cuser->setVar('name', $xuser->getVar('uname')); $cuser->setVar('email', $xuser->getVar('email')); $cuser->setVar('xuid', $user); $cuser->setVar('url', $xuser->getVar('url')); $cuser->save(); } $comment->setVar('user', $cuser->id()); } RMEvents::get()->run_event('rmcommon.comment.saved', $comment, $ret); if ($comment->save()) { redirect_header($ret . '#comment-' . $comment->id(), 2, __('Comment updated successfully!', 'rmcommon')); } else { redirect_header($ret . '#comment-' . $comment->id(), 2, __('Errros ocurrs while trying to update comment!', 'rmcommon')); } }