function module_contributors($mod_reference, $module_params) { global $smarty, $userlib, $wikilib, $tikilib, $headerlib; $currentObject = current_object(); if ($currentObject['type'] == 'wiki page') { $objectperms = Perms::get(array('type' => 'wiki page', 'object' => $currentObject['object'])); if ($objectperms->view) { $contributors = $wikilib->get_contributors($currentObject['object']); $contributors_details = array(); $headerlib->add_css('div.contributors div br {clear: both;}'); // Avoid avatar conflicts with lines below foreach ($contributors as $contributor) { $details = array('login' => $contributor); $details['realName'] = $userlib->get_user_preference($contributor, 'realName'); $country = $tikilib->get_user_preference($contributor, 'country'); if (!is_null($country) && $country != 'Other') { $details['country'] = $country; } $email_isPublic = $tikilib->get_user_preference($contributor, 'email is public'); if ($email_isPublic != 'n') { include_once ('lib/userprefs/scrambleEmail.php'); $details['email'] = $userlib->get_user_email($contributor); $details['scrambledEmail'] = scrambleEmail($details['email'], $email_isPublic); } $details['homePage'] = $tikilib->get_user_preference($contributor, 'homePage'); $details['avatar'] = $tikilib->get_user_avatar($contributor); $contributors_details[] = $details; } $smarty->assign_by_ref('contributors_details', $contributors_details); $hiddenContributors = count($contributors_details) - 5; if ($hiddenContributors > 0) { $smarty->assign('hiddenContributors', $hiddenContributors); } } } }
function onSetupPage($homepageUrl) { global $user, $prefs, $tiki_p_messages; $userlib = TikiLib::lib('user'); $tikilib = TikiLib::lib('tiki'); $smarty = TikiLib::lib('smarty'); // Run the parent first parent::onSetupPage($homepageUrl); $showPage = false; // Show if option is selected if ($prefs['feature_userPreferences'] === 'y') { $showPage = true; } if (!$showPage) { return false; } $userwatch = $user; $smarty->assign('userwatch', $userwatch); $smarty->assign('show_mouseover_user_info', isset($prefs['show_mouseover_user_info']) ? $prefs['show_mouseover_user_info'] : $prefs['feature_community_mouseover']); $mailCharsets = array('utf-8', 'iso-8859-1'); $smarty->assign_by_ref('mailCharsets', $mailCharsets); $mytiki_pages = $tikilib->get_user_preference($userwatch, 'mytiki_pages', 'y'); $smarty->assign('mytiki_pages', $mytiki_pages); $mytiki_blogs = $tikilib->get_user_preference($userwatch, 'mytiki_blogs', 'y'); $smarty->assign('mytiki_blogs', $mytiki_blogs); $mytiki_gals = $tikilib->get_user_preference($userwatch, 'mytiki_gals', 'y'); $smarty->assign('mytiki_gals', $mytiki_gals); $mytiki_items = $tikilib->get_user_preference($userwatch, 'mytiki_items', 'y'); $smarty->assign('mytiki_items', $mytiki_items); $mytiki_msgs = $tikilib->get_user_preference($userwatch, 'mytiki_msgs', 'y'); $smarty->assign('mytiki_msgs', $mytiki_msgs); $mytiki_tasks = $tikilib->get_user_preference($userwatch, 'mytiki_tasks', 'y'); $smarty->assign('mytiki_tasks', $mytiki_tasks); $mylevel = $tikilib->get_user_preference($userwatch, 'mylevel', '1'); $smarty->assign('mylevel', $mylevel); $allowMsgs = $tikilib->get_user_preference($userwatch, 'allowMsgs', 'y'); $smarty->assign('allowMsgs', $allowMsgs); $minPrio = $tikilib->get_user_preference($userwatch, 'minPrio', 3); $smarty->assign('minPrio', $minPrio); $theme = $tikilib->get_user_preference($userwatch, 'theme', ''); $smarty->assign('theme', $theme); $language = $tikilib->get_user_preference($userwatch, 'language', $prefs['language']); $smarty->assign('language', $language); $email_isPublic = $tikilib->get_user_preference($userwatch, 'email is public', 'n'); if (isset($user_preferences[$userwatch]['email is public'])) { $user_preferences[$userwatch]['email_isPublic'] = $user_preferences[$userwatch]['email is public']; $email_isPublic = $user_preferences[$userwatch]['email is public']; } $smarty->assign('email_isPublic', $email_isPublic); $mailCharset = $tikilib->get_user_preference($userwatch, 'mailCharset', $prefs['default_mail_charset']); $smarty->assign('mailCharset', $mailCharset); $user_dbl = $tikilib->get_user_preference($userwatch, 'user_dbl', 'n'); $userbreadCrumb = $tikilib->get_user_preference($userwatch, 'userbreadCrumb', $prefs['site_userbreadCrumb']); $smarty->assign('userbreadCrumb', $userbreadCrumb); $smarty->assign('user_dbl', $user_dbl); $display_12hr_clock = $tikilib->get_user_preference($userwatch, 'display_12hr_clock', 'n'); $smarty->assign('display_12hr_clock', $display_12hr_clock); $userinfo = $userlib->get_user_info($userwatch); $smarty->assign_by_ref('userinfo', $userinfo); $llist = array(); $llist = $tikilib->list_styles(); $smarty->assign_by_ref('styles', $llist); $languages = array(); $languages = $tikilib->list_languages(); $smarty->assign_by_ref('languages', $languages); $user_pages = $tikilib->get_user_pages($userwatch, -1); $smarty->assign_by_ref('user_pages', $user_pages); $bloglib = TikiLib::lib('blog'); $user_blogs = $bloglib->list_user_blogs($userwatch, false); $smarty->assign_by_ref('user_blogs', $user_blogs); $user_galleries = $tikilib->get_user_galleries($userwatch, -1); $smarty->assign_by_ref('user_galleries', $user_galleries); $user_items = TikiLib::lib('trk')->get_user_items($userwatch); $smarty->assign_by_ref('user_items', $user_items); $scramblingMethods = array("n", "strtr", "unicode", "x", 'y'); // email_isPublic utilizes 'n' $smarty->assign_by_ref('scramblingMethods', $scramblingMethods); $scramblingEmails = array(tra("no"), scrambleEmail($userinfo['email'], 'strtr'), scrambleEmail($userinfo['email'], 'unicode') . "-" . tra("unicode"), scrambleEmail($userinfo['email'], 'x'), $userinfo['email']); $smarty->assign_by_ref('scramblingEmails', $scramblingEmails); $mailCharsets = array('utf-8', 'iso-8859-1'); $smarty->assign_by_ref('mailCharsets', $mailCharsets); $smarty->assign_by_ref('user_prefs', $user_preferences[$userwatch]); $tikilib->get_user_preference($userwatch, 'diff_versions', 'n'); $usertrackerId = false; $useritemId = false; if ($prefs['userTracker'] == 'y') { $re = $userlib->get_usertracker($userinfo["userId"]); if (isset($re['usersTrackerId']) and $re['usersTrackerId']) { $trklib = TikiLib::lib('trk'); $info = $trklib->get_item_id($re['usersTrackerId'], $trklib->get_field_id($re['usersTrackerId'], 'Login'), $userwatch); $usertrackerId = $re['usersTrackerId']; $useritemId = $info; } } $smarty->assign('usertrackerId', $usertrackerId); $smarty->assign('useritemId', $useritemId); //// Custom fields //foreach ($customfields as $custpref => $prefvalue) { //$customfields[$custpref]['value'] = $tikilib->get_user_preference($userwatch, $customfields[$custpref]['prefName'], $customfields[$custpref]['value']); //$smarty->assign($customfields[$custpref]['prefName'], $customfields[$custpref]['value']); //} if ($prefs['feature_messages'] == 'y' && $tiki_p_messages == 'y') { $unread = $tikilib->user_unread_messages($userwatch); $smarty->assign('unread', $unread); } $smarty->assign('timezones', TikiDate::getTimeZoneList()); // Time zone data for the user if ($prefs['users_prefs_display_timezone'] == 'Site') { $smarty->assign('warning_site_timezone_set', 'y'); } if (isset($prefs['display_timezone'])) { $smarty->assign('display_timezone', $prefs['display_timezone']); } $smarty->assign('userPageExists', 'n'); if ($prefs['feature_wiki'] == 'y' and $prefs['feature_wiki_userpage'] == 'y') { if ($tikilib->page_exists($prefs['feature_wiki_userpage_prefix'] . $user)) { $smarty->assign('userPageExists', 'y'); } } $smarty->assign_by_ref('tikifeedback', $tikifeedback); return true; }
function smarty_modifier_userlink($other_user, $class = 'link', $idletime = 'not_set', $fullname = '') { global $tikilib, $userlib, $cachelib, $user, $feature_score, $feature_friends, $highlight_group, $feature_community_mouseover, $feature_community_mouseover_name, $feature_community_mouseover_picture, $feature_community_mouseover_friends, $feature_community_mouseover_score, $feature_community_mouseover_country, $feature_community_mouseover_email, $feature_community_mouseover_lastlogin; $cachePeriod = 60 * 60 * 2; // how long does an entry stay in the cache for? 2hr $show_mouseover = $feature_community_mouseover == 'y' && $userlib->get_user_preference($user, 'show_mouseover_user_info', 'y') == 'y'; $show_friends = $feature_friends == 'y' && $tikilib->verify_friendship($user, $other_user); if ($show_mouseover || $show_friends) { $cacheItem = "userlink." . $user . "." . $other_user . $fullname; } else { $cacheItem = "userlink." . $other_user . $fullname; } $cacheDate = $cachelib->getCachedDate($cacheItem); if ($cacheDate) { if (time() - $cacheDate < $cachePeriod) { return $cachelib->getCached($cacheItem); } else { $cachelib->invalidate($cacheItem); } } $star = ''; $info = array(); if ($feature_community_mouseover || $feature_score) { $info = $userlib->get_user_info($other_user); } if ($feature_score == 'y') { if ($other_user == "admin" || $other_user == "system" || $other_user == "Anonymous") { $star = ""; } else { $star = $tikilib->get_star($info['score']); } } $friend = ""; if ($show_friends) { $friend = ' <img src="img/icons/ico_friend.gif" width="7" height="10" alt="' . tra("Friend") . '" /> '; } if ($fullname) { $ou = $fullname; } else { $ou = $other_user; } if ($userlib->user_exists($other_user) && (!empty($friend) || $tikilib->get_user_preference($other_user, 'user_information', 'public') == 'public')) { if (isset($info) and is_array($info) and $highlight_group and in_array($highlight_group, $info['groups'])) { $ou = '<i class="highlightgroup"><b>' . $ou . '</b></i>'; } $mouseover = ''; if ($show_mouseover) { $content = ''; if ($feature_community_mouseover_name == 'y') { $line .= $userlib->get_user_preference($other_user, "realName"); if ($line) { $content .= $line . "<br />"; } } if ($feature_community_mouseover_friends == 'y' && $feature_friends == 'y') { $content .= "<img src='img/icons/ico_friend.gif' /> "; $content .= $tikilib->get_friends_count($other_user) . ' '; } if ($feature_community_mouseover_score == 'y') { $content .= $star . $info['score']; } if ($feature_community_mouseover_score == 'y' || $feature_community_mouseover_friends == 'y') { $content .= "<br />"; } if ($feature_community_mouseover_country == 'y') { $country = $tikilib->get_user_preference($other_user, "country", ""); if ($country && $country != "Other") { $content .= "<img src='img/flags/{$country}.gif' /> " . tra($country) . "<br />"; } } if ($feature_community_mouseover_distance == 'y') { $distance = $tikilib->get_userdistance($other_user, $user); if (!is_null($distance)) { $content .= $distance . " " . tra("km") . "<br />"; } } if ($feature_community_mouseover_email == 'y') { $email_isPublic = $tikilib->get_user_preference($other_user, "email is public"); if ($email_isPublic != 'n') { include_once 'lib/userprefs/scrambleEmail.php'; $content .= scrambleEmail($info['email'], $email_isPublic) . "<br />"; } elseif (!empty($friend)) { $content .= $info['email'] . "<br />"; } } if ($feature_community_mouseover_lastlogin == 'y') { $content .= tra("Last seen on ") . $tikilib->get_short_datetime($info['lastLogin']); $content .= "<br />"; } if (is_numeric($idletime)) { $content .= sprintf(tra("(idle for %s seconds)"), $idletime) . "<br />"; } if ($feature_community_mouseover_picture == 'y') { if ($info['avatarLibName'] != "") { $img = "<img border='0' width='45' height='45' src='" . $info['avatarLibName'] . "' alt='' />"; } else { if ($info['avatarData'] != "") { $img = "<img src='tiki-show_user_avatar.php?user={$other_user}' width='45' height='45' alt='' />"; } else { $img = ""; } } if (empty($content)) { $content = $img; } elseif ($img != "") { $content = "<table><tr><td>{$img}</td><td>{$content}</td></tr></table>"; } } if (!empty($content)) { $mouseover = " onmouseover=\"return overlib('" . addslashes($content) . "',HAUTO,VAUTO,CAPTION,'<div align=\\'center\\'>" . tra("User information - Click for more info") . "</div>');\" onmouseout=\"nd()\" "; } } if (is_numeric($idletime) && empty($mouseover)) { $ret = "<a class='{$class}' target='_top' href='tiki-user_information.php?view_user="******"' title='" . tra("More info about {$other_user}") . " " . tra("(idle for {$idletime} seconds)") . "'>{$ou}</a>{$friend}{$star}"; $cachelib->cacheItem($cacheItem, $ret); return $ret; } else { $ret = "<a class='{$class}' {$mouseover} target='_top' href='tiki-user_information.php?view_user="******"' >{$ou}</a>{$friend}{$star}"; $cachelib->cacheItem($cacheItem, $ret); return $ret; } } else { $ret = "<span class='{$class}'>{$ou}</span>{$friend}{$star}"; $cachelib->cacheItem($cacheItem, $ret); return $ret; } }
/** * Show user info popup * * @param $input JitFilter (username) * @return array */ function action_info($input) { global $prefs, $user; $tikilib = TikiLib::lib('tiki'); $sociallib = TikiLib::lib('social'); $result = array('fullname' => '', 'gender' => '', 'starHtml' => '', 'country' => '', 'distance' => '', 'email' => '', 'lastSeen' => '', 'avatarHtml' => '', 'error' => '', 'shared_groups' => ''); if ($prefs['feature_community_mouseover'] == 'y' && $this->lib->get_user_preference($user, 'show_mouseover_user_info', 'y') == 'y' || $prefs['feature_friends'] == 'y') { $other_user = $input->username->email(); $result['other_user'] = $other_user; if ($this->lib->user_exists($other_user) && ($tikilib->get_user_preference($other_user, 'user_information', 'public') === 'public' || $user == $other_user || $prefs['feature_friends'] == 'y')) { $info = $this->lib->get_user_info($other_user); $result['add_friend_button'] = ''; $result['friendship'] = array(); if ($prefs['feature_friends'] === 'y' && $user) { $friendship = array(); if ($prefs['social_network_type'] === 'friend') { $friend = $this->isFriend($sociallib->listFriends($user), $other_user); if ($friend) { $friendship[] = array('type' => 'friend', 'label' => tra('Friend'), 'remove' => tra('Remove Friend')); } else { $result['add_friend_button'] = tra('Add Friend'); } } else { $follower = $this->isFriend($sociallib->listFollowers($user), $other_user); $following = $this->isFriend($sociallib->listFollowers($other_user), $user); if ($follower) { $friendship[] = array('type' => 'follower', 'label' => tra('Following you')); if ($prefs['social_network_type'] === 'follow_approval') { $friendship[count($friendship) - 1]['remove'] = tra('Remove Follower'); } } if ($following) { $friendship[] = array('type' => 'following', 'label' => tra('You are following'), 'remove' => tra('Stop Following')); } else { $result['add_friend_button'] = tra('Follow'); } } $incoming = $this->isFriend($sociallib->listIncomingRequests($user), $other_user); if ($incoming) { $friendship[] = array('type' => 'incoming', 'label' => tra('Awaiting your approval'), 'remove' => tra('Refuse Request'), 'add' => tra('Accept & Add')); if ($prefs['social_network_type'] === 'follow_approval') { $friendship[count($friendship) - 1]['approve'] = tra('Accept Request'); } $result['add_friend_button'] = ''; } $outgoing = $this->isFriend($sociallib->listOutgoingRequests($user), $other_user); if ($outgoing) { $friendship[] = array('type' => 'outgoing', 'label' => tra('Waiting for approval'), 'remove' => tra('Cancel Request')); $result['add_friend_button'] = ''; } $result['friendship'] = $friendship; if ($user === $other_user) { $result['add_friend_button'] = ''; // can't befriend yourself } } if ($prefs['feature_community_mouseover_name'] == 'y') { $result['fullname'] = $this->lib->clean_user($other_user); } else { $result['fullname'] = $other_user; } if ($prefs['feature_community_mouseover_gender'] == 'y' && $prefs['feature_community_gender'] == 'y') { $result['gender'] = $this->lib->get_user_preference($other_user, 'gender'); if ($result['gender'] == tr('Hidden')) { $result['gender'] = ''; } } if ($prefs['feature_score'] == 'y') { if ($prefs['feature_community_mouseover_score'] == 'y' && !empty($info['score']) && $other_user !== 'admin' && $other_user !== 'system' && $other_user !== 'Anonymous') { $result['starHtml'] = $tikilib->get_star($info['score']); } else { $result['starHtml'] = ''; } } if ($prefs['feature_community_mouseover_country'] == 'y') { $result['country'] = $tikilib->get_user_preference($other_user, 'country', ''); if ($result['country'] == tr('Other')) { $result['country'] = ''; } } if ($prefs['feature_community_mouseover_distance'] == 'y') { $distance = TikiLib::lib('userprefs')->get_userdistance($other_user, $user); if ($distance) { $result['distance'] = $distance . ' ' . tra('km'); } } if ($prefs['feature_community_mouseover_email'] == 'y') { $email_isPublic = $tikilib->get_user_preference($other_user, 'email is public'); if ($email_isPublic != 'n') { include_once 'lib/userprefs/scrambleEmail.php'; $result['email'] = scrambleEmail($info['email'], $email_isPublic); //} elseif ($friend) { // $result['email'] = $info['email']; // should friends see each other's emails whatever the settings? I doubt it (jb) } } if ($prefs['feature_community_mouseover_lastlogin'] == 'y') { $result['lastSeen'] = $info['currentLogin'] ? $info['currentLogin'] : null; } if ($prefs['feature_community_mouseover_picture'] == 'y') { $result['avatarHtml'] = $tikilib->get_user_avatar($other_user); } if ($user !== $other_user) { // should have a new pref? $theirGroups = TikiLib::lib('user')->get_user_groups($other_user); $myGroups = TikiLib::lib('user')->get_user_groups($user); $choiceGroups = TikiLib::lib('user')->get_groups_userchoice(); $sharedGroups = array_intersect($theirGroups, $myGroups, $choiceGroups); $result['shared_groups'] = implode(', ', $sharedGroups); } } } else { $result['error'] = tra("You cannot see this user's data."); if ($user) { $result['error'] .= '<br>' . tra('You need to set your own info to be shown on mouseover.') . '<br>' . '<a href="tiki-user_preferences.php?cookietab=2">' . tra('Click here') . '</a>'; } else { $result['error'] .= '<br>' . tra('You need to log in.'); } } return $result; }
if ($prefs['feature_messages'] != 'y') { $smarty->assign('msg', tra('This feature is disabled') . ': feature_messages'); $smarty->display('error.tpl'); die; } if ($prefs['contact_anon'] != 'y' && !$user) { $smarty->assign('msg', 'You are not logged in'); $smarty->display('error.tpl'); die; } $smarty->assign('mid', 'tiki-contact.tpl'); $email = $userlib->get_user_email($prefs['contact_user']); if ($email == '') { $email = $userlib->get_admin_email(); } $email = scrambleEmail($email, $tikilib->get_user_preference('admin', "email is public")); $smarty->assign('email', $email); if ($user == '' and $prefs['contact_anon'] == 'y') { $smarty->assign('sent', 0); if (isset($_REQUEST['send'])) { check_ticket('contact'); $message = ''; // Validation: // must have a subject or body non-empty (or both) if (empty($_REQUEST['subject']) && empty($_REQUEST['body'])) { $smarty->assign('message', tra('ERROR: you must include a subject or a message at least')); $smarty->assign('priority', $_REQUEST['priority']); $smarty->display("tiki.tpl"); die; } if ($prefs['feature_antibot'] == 'y') {
$smarty->assign('country', $country); $anonpref = $tikilib->get_preference('userbreadCrumb', 4); $userbreadCrumb = $tikilib->get_user_preference($userwatch, 'userbreadCrumb', $anonpref); $smarty->assign_by_ref('realName', $realName); $smarty->assign_by_ref('gender', $gender); $smarty->assign_by_ref('userbreadCrumb', $userbreadCrumb); $homePage = $tikilib->get_user_preference($userwatch, 'homePage', ''); $smarty->assign_by_ref('homePage', $homePage); $avatar = $tikilib->get_user_avatar($userwatch); $smarty->assign('avatar', $avatar); $user_information = $tikilib->get_user_preference($userwatch, 'user_information', 'public'); $smarty->assign('user_information', $user_information); $userinfo = $userlib->get_user_info($userwatch); $email_isPublic = $tikilib->get_user_preference($userwatch, 'email is public', 'n'); if ($email_isPublic != 'n') { $smarty->assign('scrambledEmail', scrambleEmail($userinfo['email'], $email_isPublic)); } $smarty->assign_by_ref('userinfo', $userinfo); $smarty->assign_by_ref('email_isPublic', $email_isPublic); $userPage = $prefs['feature_wiki_userpage_prefix'] . $userinfo['login']; $exist = $tikilib->page_exists($userPage); $smarty->assign("userPage_exists", $exist); if ($prefs['feature_display_my_to_others'] == 'y') { if ($prefs['feature_wiki'] == 'y') { $wikilib = TikiLib::lib('wiki'); $user_pages = $wikilib->get_user_all_pages($userwatch, 'pageName_asc'); $smarty->assign_by_ref('user_pages', $user_pages); } if ($prefs['feature_blogs'] == 'y') { $bloglib = TikiLib::lib('blog'); $user_blogs = $bloglib->list_user_blogs($userwatch, false);
$smarty->assign_by_ref('languages', $languages); $user_pages = $tikilib->get_user_pages($userwatch, -1); $smarty->assign_by_ref('user_pages', $user_pages); $bloglib = TikiLib::lib('blog'); $user_blogs = $bloglib->list_user_blogs($userwatch, false); $smarty->assign_by_ref('user_blogs', $user_blogs); $user_galleries = $tikilib->get_user_galleries($userwatch, -1); $smarty->assign_by_ref('user_galleries', $user_galleries); $user_items = TikiLib::lib('trk')->get_user_items($userwatch); $smarty->assign_by_ref('user_items', $user_items); $flags = $tikilib->get_flags('', '', '', true); $smarty->assign_by_ref('flags', $flags); $scramblingMethods = array("n", "strtr", "unicode", "x", 'y'); // email_isPublic utilizes 'n' $smarty->assign_by_ref('scramblingMethods', $scramblingMethods); $scramblingEmails = array(tra("no"), scrambleEmail($userinfo['email'], 'strtr'), scrambleEmail($userinfo['email'], 'unicode') . "-" . tra("unicode"), scrambleEmail($userinfo['email'], 'x'), $userinfo['email']); $smarty->assign_by_ref('scramblingEmails', $scramblingEmails); $avatar = $tikilib->get_user_avatar($userwatch); $smarty->assign_by_ref('avatar', $avatar); $mailCharsets = array('utf-8', 'iso-8859-1'); $smarty->assign_by_ref('mailCharsets', $mailCharsets); $smarty->assign_by_ref('user_prefs', $user_preferences[$userwatch]); $tikilib->get_user_preference($userwatch, 'user_information', 'public'); $tikilib->get_user_preference($userwatch, 'diff_versions', 'n'); $usertrackerId = false; $useritemId = false; if ($prefs['userTracker'] == 'y') { $re = $userlib->get_usertracker($userinfo["userId"]); if (isset($re['usersTrackerId']) and $re['usersTrackerId']) { $trklib = TikiLib::lib('trk'); $info = $trklib->get_item_id($re['usersTrackerId'], $re['usersFieldId'], $userwatch);
require_once 'tiki-setup.php'; include_once 'lib/messu/messulib.php'; include_once 'lib/userprefs/scrambleEmail.php'; if (!$user and $contact_anon != 'y') { $smarty->assign('msg', tra("You are not logged in")); $smarty->display("error.tpl"); die; } if ($feature_contact != 'y') { $smarty->assign('msg', tra("This feature is disabled") . ": feature_contact"); $smarty->display("error.tpl"); die; } $smarty->assign('mid', 'tiki-contact.tpl'); $email = $userlib->get_admin_email(); $email = scrambleEmail($email, 'strtr'); $smarty->assign('email', $email); if ($user == '' and $contact_anon == 'y') { $user = '******'; $smarty->assign('sent', 0); if (isset($_REQUEST['send'])) { check_ticket('contact'); $smarty->assign('sent', 1); $message = ''; // Validation: // must have a subject or body non-empty (or both) if (empty($_REQUEST['subject']) && empty($_REQUEST['body'])) { $smarty->assign('message', tra('ERROR: you must include a subject or a message at least')); $smarty->display("tiki.tpl"); die; }
function generate_feed($feed, $uniqueid, $rss_version, $changes, $itemurl, $urlparam, $id, $title, $titleId, $desc, $descId, $dateId, $authorId) { global $tikiIndex; global $userslib; if ($rss_version == '') { // override version if set as request parameter if (isset($_REQUEST["ver"])) { $ver = $_REQUEST["ver"]; $rss_version = $this->get_rss_version($ver); } else { $rss_version = 9; // default to RSS 0.91 } } else { $rss_version = $this->get_rss_version($rss_version); } $now = date("U"); $output = $this->get_from_cache($uniqueid, $rss_version); if ($output != "EMPTY") { return $output; } $urlarray = parse_url($_SERVER["REQUEST_URI"]); /* this gets the correct directory name aka dirname when tikiwiki is on the main directory, i mean when ur site is www.yoursite.com, the dirname of your site is "/" and when tikiwiki is not on main directory, i mean www.yoursite.com/tiki, the dirname returns "/tiki". so, on URLs, we just need to add a extra slash when the tikiwiki isnt on the main directory, what means, dirname($urlarray["path"]) equals to "/tiki", otherwise we can ommit them. This is a quick hack to solve the infamous double-slash problem, which was introduced somewhen after 1.9.0 release http://dev.tikiwiki.org/tiki-view_tracker_item.php?trackerId=5&itemId=291 */ $dirname = dirname($urlarray["path"]) != "/" ? "/" : ""; $url = htmlspecialchars($this->httpPrefix() . $_SERVER["REQUEST_URI"]); $home = htmlspecialchars($this->httpPrefix() . dirname($urlarray["path"]) . $dirname . $tikiIndex); $img = htmlspecialchars($this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "img/tiki.jpg"); $title = htmlspecialchars($title); $desc = htmlspecialchars($desc); $read = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . $itemurl; // different stylesheets for atom and rss $cssStyleSheet = ""; $xslStyleSheet = ""; $encoding = "ISO-8859-1"; $encoding = "UTF-8"; $contenttype = "application/xml"; // valid format strings are: RSS0.91, RSS1.0, RSS2.0, PIE0.1, MBOX, OPML, ATOM0.3, HTML, JS // valid format ids : 9 , 1 , 2 , 3 , 4 , 6 , 5 , 7 , 8 switch ($rss_version) { case "1": // RSS 1.0 $cssStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/rss-style.css"; break; case "2": // RSS 2.0 $cssStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/rss-style.css"; $xslStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/rss20.xsl"; break; case "3": // PIE 0.1 break; case "4": // MBOX $contenttype = "text/plain"; break; case "5": // ATOM0.3 $cssStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/atom-style.css"; break; case "6": // OPML $xslStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/opml.xsl"; break; case "7": // HTML $contenttype = "text/plain"; break; case "8": // JS $contenttype = "text/javascript"; break; case "9": // RSS 0.91 $cssStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/rss-style.css"; break; } $rss = new UniversalFeedCreator(); $rss->title = $title; $rss->description = $desc; //optional $rss->descriptionTruncSize = 500; $rss->descriptionHtmlSyndicated = true; $rss->cssStyleSheet = htmlspecialchars($cssStyleSheet); $rss->xslStyleSheet = htmlspecialchars($xslStyleSheet); $rss->encoding = $encoding; $rss->language = $this->get_preference("rssfeed_language", "en-us"); $rss->editor = $this->get_preference("rssfeed_editor", ""); $rss->webmaster = $this->get_preference("rssfeed_webmaster", ""); $rss->link = $url; $rss->feedURL = $url; $image = new FeedImage(); $image->title = tra("tikiwiki logo"); $image->url = $img; $image->link = $home; $image->description = tra(sprintf("Feed provided by %s. Click to visit.", $home)); //optional $image->descriptionTruncSize = 500; $image->descriptionHtmlSyndicated = true; $rss->image = $image; global $dbTiki; if (!isset($userslib)) { $userslib = new Userslib($dbTiki); } foreach ($changes["data"] as $data) { $item = new FeedItem(); $item->title = $data["{$titleId}"]; // 2 parameters to replace if ($urlparam != '') { $item->link = sprintf($read, urlencode($data["{$id}"]), urlencode($data["{$urlparam}"])); } else { $item->link = sprintf($read, urlencode($data["{$id}"])); } if (isset($data["{$descId}"])) { $item->description = $data["{$descId}"]; } else { $item->description = ""; } //optional //item->descriptionTruncSize = 500; $item->descriptionHtmlSyndicated = true; $item->date = (int) $data["{$dateId}"]; $item->source = $url; $item->author = ""; if ($authorId != "") { if ($userslib->user_exists($data["{$authorId}"])) { $item->author = $data["{$authorId}"]; // only use realname <email> if existing and $tmp = ""; if ($this->get_user_preference($data["{$authorId}"], 'user_information', 'private') == 'public') { $tmp = $this->get_user_preference($data["{$authorId}"], "realName"); } $epublic = $this->get_user_preference($data["{$authorId}"], 'email is public', 'n'); if ($epublic != 'n') { $res = $userslib->get_user_info($data["{$authorId}"], false); if ($tmp != "") { $tmp .= ' '; } $tmp .= "<" . scrambleEmail($res['email'], $epublic) . ">"; } if ($tmp != "") { $item->author = $tmp; } } else { $item->author = $data["{$authorId}"]; } } $rss->addItem($item); } $data = $rss->createFeed($this->get_rss_version_name($rss_version)); $this->put_to_cache($uniqueid, (int) $data, $rss_version); $output = array(); $output["data"] = $data; $output["content-type"] = $contenttype; $output["encoding"] = $encoding; return $output; }
$smarty->assign_by_ref('site',$homePage); $timezone_options = $tikilib->get_timezone_list(true); $smarty->assign_by_ref('timezone_options', $timezone_options); $server_time = new Date(); $display_timezone = $tikilib->get_user_preference($view_user, 'display_timezone', $server_time->tz->getID()); $smarty->assign_by_ref('display_timezone', $display_timezone); $userPage = $feature_wiki_userpage_prefix.$userinfo['login']; $exist = $tikilib->page_exists($userPage); $smarty->assign("userPage_exists", $exist); ********************************/ $user_style = $tikilib->get_user_preference($view_user, 'theme', 'bolha.css'); $smarty->assign_by_ref('user_style', $user_style); $allowMsgs = $tikilib->get_user_preference($view_user, 'allowMsgs', 1); $smarty->assign('allowMsgs', $allowMsgs); $realName = $tikilib->get_user_preference($view_user, 'realName', ''); $local = $tikilib->get_user_preference($view_user, 'local', ''); $smarty->assign('local', $local); $smarty->assign_by_ref('realName', $realName); $site = $tikilib->get_user_preference($view_user, 'site', ''); $smarty->assign_by_ref('site', $site); $isPublic = $tikilib->get_user_preference($view_user, 'isPublic', '1'); $smarty->assign('isPublic', $isPublic); $userinfo = $userlib->get_user_info($view_user); $smarty->assign_by_ref('userinfo', $userinfo); $email_isPublic = $tikilib->get_user_preference($view_user, 'email is public', 'y'); if ($email_isPublic != 'n') { $userinfo['email'] = scrambleEmail($userinfo['email'], $email_isPublic); } $smarty->assign_by_ref('email_isPublic', $email_isPublic); $smarty->assign('mid', 'el-user.tpl'); $smarty->display("tiki.tpl");
/** * Return information about the user acording to its preferences * * @param string $login * @return array author data (can be the login name or the realName if set and email if public) */ function process_item_author($login) { global $userlib, $tikilib; $author = array(); if ($userlib->user_exists($login) && $tikilib->get_user_preference($login, 'user_information', 'private') == 'public') { // if realName is not set use $login $author['name'] = $tikilib->get_user_preference($login, 'realName', $login); if ($tikilib->get_user_preference($login, 'email is public', 'n') != 'n') { $res = $userlib->get_user_info($login, false); require_once 'lib/userprefs/scrambleEmail.php'; $author['email'] = scrambleEmail($res['email']); } } else { $author['name'] = $login; } return $author; }
/** * \brief Smarty modifier plugin to create user links with optional mouseover info * * - type: modifier * - name: userlink * - purpose: to return a user link * * @author * @param string class (optional) * @param string idletime (optional) * @param string fullname (optional) * @param integer max_length (optional) * @return string user link * * Syntax: {$foo|userlink[:"<class>"][:"<idletime>"][:"<fullname>"][:<max_length>]} (optional params in brackets) * * Example: {$userinfo.login|userlink:'link':::25} */ function smarty_modifier_userlink($other_user, $class = 'link', $idletime = 'not_set', $fullname = '', $max_length = 0, $popup = 'y') { global $tikilib, $userlib, $cachelib, $user, $prefs, $userprefslib, $smarty; $show_mouseover = $popup != 'n' && $prefs['feature_community_mouseover'] == 'y' && $userlib->get_user_preference($user, 'show_mouseover_user_info', 'y') == 'y'; $show_friends = $prefs['feature_friends'] == 'y' && $tikilib->verify_friendship($user, $other_user); if ($show_mouseover || $show_friends) { $cacheItem = 'userlink.' . $user . '.' . $other_user . $fullname . $max_length; } else { $cacheItem = 'userlink.' . $other_user . $fullname . $max_length; } if ($cached = $cachelib->getCached($cacheItem)) { return $cached; } $star = ''; $metadata = ''; $info = array(); if ($prefs['feature_community_mouseover'] || $prefs['feature_score']) { $info = $userlib->get_user_info($other_user); } if ($prefs['feature_score'] == 'y') { if (empty($info['score']) || $other_user == 'admin' || $other_user == 'system' || $other_user == 'Anonymous') { $star = ''; } else { $star = $tikilib->get_star($info['score']); } } $friend = ''; if ($show_friends) { $friend = ' <img src="img/icons/ico_friend.gif" width="7" height="10" alt="' . tra('Friend') . '" /> '; } if ($fullname != '') { $ou = $fullname; } else { $ou = $userlib->clean_user($other_user); } if (empty($ou) || $ou == '') { $ou = $other_user; } if ($max_length > 0) { $smarty->loadPlugin('smarty_modifier_truncate'); $ou = smarty_modifier_truncate($ou, $max_length, '...', true); } $ou = htmlspecialchars($ou); if ($userlib->user_exists($other_user) && (!empty($friend) || $tikilib->get_user_preference($other_user, 'user_information', 'public') == 'public')) { if (isset($info) and is_array($info) and $prefs['highlight_group'] and in_array($prefs['highlight_group'], $info['groups'])) { $ou = '<i class="highlightgroup"><b>' . $ou . '</b></i>'; } $mouseover = ''; if ($show_mouseover) { $content = ''; if ($prefs['feature_community_mouseover_name'] == 'y') { $line = $userlib->get_user_preference($other_user, 'realName'); if ($line) { $content .= $line . '<br />'; } } if ($prefs['feature_community_mouseover_gender'] == 'y' && $prefs['feature_community_gender'] == 'y') { $gender = $userlib->get_user_preference($other_user, 'gender'); if (!empty($gender) && $gender != 'Hidden') { $content .= tra('Gender:') . ' '; $content .= tra($gender) . '<br />'; } } if ($prefs['feature_community_mouseover_friends'] == 'y' && $prefs['feature_friends'] == 'y') { $content .= '<img src="img/icons/ico_friend.gif" /> '; $content .= $tikilib->get_friends_count($other_user) . ' '; } if ($prefs['feature_community_mouseover_score'] == 'y' && $star) { $content .= $star . $info['score']; } if (($prefs['feature_community_mouseover_score'] == 'y' || $prefs['feature_community_mouseover_friends'] == 'y') && $star) { $content .= '<br />'; } if ($prefs['feature_community_mouseover_country'] == 'y') { $country = $tikilib->get_user_preference($other_user, 'country', ''); if ($country && $country != 'Other') { $content .= "<img src='img/flags/{$country}.gif' /> " . tra(str_replace('_', ' ', $country)) . '<br />'; } } if ($prefs['feature_community_mouseover_distance'] == 'y') { global $userprefslib; include_once 'lib/userprefs/userprefslib.php'; $distance = $userprefslib->get_userdistance($other_user, $user); if (!is_null($distance)) { $content .= $distance . ' ' . tra('km') . '<br />'; } } if ($prefs['feature_community_mouseover_email'] == 'y') { $email_isPublic = $tikilib->get_user_preference($other_user, 'email is public'); if ($email_isPublic != 'n') { include_once 'lib/userprefs/scrambleEmail.php'; $content .= scrambleEmail($info['email'], $email_isPublic) . '<br />'; } elseif (!empty($friend)) { $content .= $info['email'] . '<br />'; } } if ($prefs['feature_community_mouseover_lastlogin'] == 'y') { $content .= tra('Last seen on') . ' ' . $tikilib->get_short_datetime($info['lastLogin']); $content .= "<br />"; } if (is_numeric($idletime)) { $content .= sprintf(tra('(idle for %s seconds)'), $idletime) . '<br />'; } if ($prefs['feature_community_mouseover_picture'] == 'y') { $img = $tikilib->get_user_avatar($info); if (empty($content)) { $content = $img; } elseif ($img != '') { $content = "<table><tr><td>{$img}</td><td>{$content}</td></tr></table>"; } } if (!empty($content) && $prefs['feature_jquery_tooltips'] == 'y') { // not really mouseover, this goes in title for JQ $mouseover = tra('User information - Click for more info') . '|' . htmlspecialchars($content); } } if (empty($prefs['urlOnUsername'])) { $url = 'tiki-user_information.php?userId=' . urlencode($info['userId']); if ($prefs['feature_sefurl'] == 'y') { include_once 'tiki-sefurl.php'; $url = filter_out_sefurl($url); } } else { $url = preg_replace(array('/%userId%/', '/%user%/'), array($info['userId'], $info['login']), $prefs['urlOnUsername']); } $lat = $userlib->get_user_preference($other_user, 'lat'); $lon = $userlib->get_user_preference($other_user, 'lon'); $zoom = $userlib->get_user_preference($other_user, 'zoom'); if ($lat || $lon) { $class .= " geolocated"; $metadata .= " data-geo-lat='{$lat}' data-geo-lon='{$lon}'"; if ($zoom) { $metadata .= " data-geo-zoom='{$zoom}'"; } } if (is_numeric($idletime) && empty($mouseover)) { $ret = "<a class=\"{$class}\" target=\"_top\" href=\"{$url}\" {$metadata} title=\"" . tr('More info about %0 (idle for %1)', $ou, $idletime . tra(' seconds')) . "\">{$ou}</a>{$friend}{$star}"; $cachelib->cacheItem($cacheItem, $ret); return $ret; } else { if ($show_mouseover && !empty($mouseover)) { $ret = "<a class='{$class} titletips' title=\"{$mouseover}\" {$metadata} href='{$url}' >{$ou}</a>{$friend}{$star}"; } else { $ret = "<a class='{$class}' {$metadata} href='{$url}' >{$ou}</a>{$friend}{$star}"; } $cachelib->cacheItem($cacheItem, $ret); return $ret; } } else { $ret = "<span class='{$class}' {$metadata}>{$ou}</span>{$friend}{$star}"; $cachelib->cacheItem($cacheItem, $ret); return $ret; } }