示例#1
0
 public function warning($member)
 {
     if (!ipsRegistry::$settings['warn_on']) {
         return false;
     }
     if (ipsRegistry::$settings['warn_protected']) {
         if (IPSMember::isInGroup($member, explode(',', ipsRegistry::$settings['warn_protected']))) {
             return false;
         }
     }
     return true;
 }
示例#2
0
 /**
  * Checks to see if the specified member group can view ads
  *
  * @access	public
  *
  * @param	integer		$group_id		Group to check
  * @return	bool 
  */
 public function userCanViewAds()
 {
     /* Check to see if the system is globally disabled */
     if (!ipsRegistry::$settings['ad_code_global_enabled']) {
         return false;
     }
     /* Check to see if this member group can view ads */
     if (ipsRegistry::$settings['ad_code_exempt_groups']) {
         if (IPSMember::isInGroup(ipsRegistry::member()->fetchMemberData(), explode(',', ipsRegistry::$settings['ad_code_exempt_groups']))) {
             return false;
         }
     }
     return true;
 }
示例#3
0
 function globalTemplate($html, $documentHeadItems, $css, $jsModules, $metaTags, array $header_items, $items = array(), $footer_items = array(), $stats = array())
 {
     $IPBHTML = "";
     if (IPSLib::locationHasHooks('skin_global', $this->_funcHooks['globalTemplate'])) {
         $count_7faa034675d780584160b16b4682b835 = is_array($this->functionData['globalTemplate']) ? count($this->functionData['globalTemplate']) : 0;
         $this->functionData['globalTemplate'][$count_7faa034675d780584160b16b4682b835]['html'] = $html;
         $this->functionData['globalTemplate'][$count_7faa034675d780584160b16b4682b835]['documentHeadItems'] = $documentHeadItems;
         $this->functionData['globalTemplate'][$count_7faa034675d780584160b16b4682b835]['css'] = $css;
         $this->functionData['globalTemplate'][$count_7faa034675d780584160b16b4682b835]['jsModules'] = $jsModules;
         $this->functionData['globalTemplate'][$count_7faa034675d780584160b16b4682b835]['metaTags'] = $metaTags;
         $this->functionData['globalTemplate'][$count_7faa034675d780584160b16b4682b835]['header_items'] = $header_items;
         $this->functionData['globalTemplate'][$count_7faa034675d780584160b16b4682b835]['items'] = $items;
         $this->functionData['globalTemplate'][$count_7faa034675d780584160b16b4682b835]['footer_items'] = $footer_items;
         $this->functionData['globalTemplate'][$count_7faa034675d780584160b16b4682b835]['stats'] = $stats;
     }
     $IPBHTML .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\r\n\t<html xml:lang=\"en\" lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\"" . (IPSLib::fbc_enabled() === TRUE || $this->settings['fbc_appid'] ? " xmlns:fb=\"http://www.facebook.com/2008/fbml\"" : "") . ">\r\n\t<head>\r\n\t\t<meta http-equiv=\"content-type\" content=\"text/html; charset={$this->settings['gb_char_set']}\" />\r\n\t\t<title>{$header_items['title']}" . ($header_items['page'] ? " {$this->lang->words['page_title_page']} {$header_items['page']}" : "") . "</title>\r\n\t\t<!--<meta http-equiv=\"X-UA-Compatible\" content=\"IE=7\" />-->\r\n\t\t<link rel=\"shortcut icon\" href='" . ($this->registry->output->isHTTPS ? "{$this->settings['board_url_https']}" : "{$this->settings['board_url']}") . "/favicon.ico' />\r\n\t\t<meta property=\"og:title\" content=\"{$this->registry->output->encodeMetaTagContent(str_replace(' - ' . $this->settings['board_name'], '', $header_items['title']))}\"/>\r\n\t\t<meta property=\"og:site_name\" content=\"{$this->registry->output->encodeMetaTagContent($this->settings['board_name'])}\"/>\r\n\t\t<meta property=\"og:image\" content=\"{$this->settings['meta_imagesrc']}\"/>\r\n\t\t<meta property=\"og:type\" content=\"article\" />\r\n\t\t" . (method_exists($this->registry->getClass('output')->getTemplate('global'), 'includeMeta') ? $this->registry->getClass('output')->getTemplate('global')->includeMeta($metaTags) : '') . "" . (method_exists($this->registry->getClass('output')->getTemplate('global'), 'includeVars') ? $this->registry->getClass('output')->getTemplate('global')->includeVars() : '') . "" . (method_exists($this->registry->getClass('output')->getTemplate('global'), 'includeJS') ? $this->registry->getClass('output')->getTemplate('global')->includeJS($jsModules) : '') . "" . (method_exists($this->registry->getClass('output')->getTemplate('global'), 'includeCSS') ? $this->registry->getClass('output')->getTemplate('global')->includeCSS($css) : '') . "" . (method_exists($this->registry->getClass('output')->getTemplate('global'), 'includeFeeds') ? $this->registry->getClass('output')->getTemplate('global')->includeFeeds($documentHeadItems) : '') . "" . (method_exists($this->registry->getClass('output')->getTemplate('global'), 'includeRTL') ? $this->registry->getClass('output')->getTemplate('global')->includeRTL() : '') . "\r\n\t\t\r\n\t\t<!--<meta name=\"apple-mobile-web-app-capable\" content=\"yes\">-->\r\n\t\t<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\" />\r\n\t\t<meta name=\"viewport\" content=\"initial-scale=1, maximum-scale=1, user-scalable=no\">\r\n\t</head>\r\n\t<body id='ipboard_body'>\r\n\t\t<div id='ipbwrapper'>\r\n\t\t\t" . (count($items['navigation']) > 1 && !$this->settings['_mobile_nav_home'] ? "" . (($this->nav_count = count($items['navigation'])) ? "" : "") . "" . (($this->nav_back = isset($this->settings['_mobile_back_nav']) ? $this->settings['_mobile_back_nav'] : 2) ? "" : "") . "\r\n\t\t\t\t<div id='secondary_navigation'>\r\n\t\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("{$items['navigation'][$this->nav_count - $this->nav_back][1]}", "{$items['navigation'][$this->nav_count - $this->nav_back][4]}", ''), "{$items['navigation'][$this->nav_count - $this->nav_back][2]}", "{$items['navigation'][$this->nav_count - $this->nav_back][3]}") . "'>{$this->lang->words['_larr']} &nbsp;{$items['navigation'][$this->nav_count - $this->nav_back][0]}</a>\r\n\t\t\t\t</div>" : "" . ((count($items['navigation']) == 1 || $this->settings['_mobile_nav_home']) && !$this->settings['_mobile_hide_nav'] ? "\r\n\t\t\t\t\t<div id='secondary_navigation'>\r\n\t\t\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("act=idx", "public", ''), "false", "") . "' class='back'>{$this->lang->words['_larr']} {$this->lang->words['home']}</a>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t" : "") . "") . "\r\n\t\t\t" . (method_exists($this->registry->output->getTemplate($this->registry->getCurrentApplication() . '_global'), 'overwriteHeader') ? "\r\n\t\t\t\t" . (method_exists($this->registry->getClass('output')->getTemplate('' . $this->registry->getCurrentApplication() . '_global'), 'overwriteHeader') ? $this->registry->getClass('output')->getTemplate('' . $this->registry->getCurrentApplication() . '_global')->overwriteHeader() : '') . "\r\n\t\t\t" : "\r\n\t\t\t\t" . (method_exists($this->registry->getClass('output')->getTemplate('global'), 'defaultHeader') ? $this->registry->getClass('output')->getTemplate('global')->defaultHeader() : '') . "\r\n\t\t\t") . "\r\n\t\t\t<div id=\"options-button\">&raquo;</div>\r\n\t\t\t<div id='user_navigation' class='clearfix'>\r\n\t\t\t\t<ul class='clearfix' id='user_bar'>\r\n\t\t\t\t\t" . (!$this->memberData['member_id'] ? "\r\n\t\t\t\t\t\t<a class='button secondary' href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=global&amp;section=login", "public", ''), "", "") . "' title='{$this->lang->words['sign_in']}'>{$this->lang->words['sign_in']}</a>&nbsp;&nbsp;&nbsp;\r\n\t\t\t\t\t\t<a class='button secondary' href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=global&amp;section=register", "public", ''), "", "") . "\" title='{$this->lang->words['register']}'>{$this->lang->words['register']}</a>\r\n\t\t\t\t\t" : "\r\n\t\t\t\t\t\t<a class='button secondary' style='width:auto' href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=global&amp;section=login&amp;do=logout&amp;k={$this->member->form_hash}", "public", ''), "", "") . "\">{$this->lang->words['log_out']} {$this->memberData['members_display_name']}</a>\r\n\t\t\t\t\t") . "\r\n\t\t\t\t</ul>\r\n\t\t\t\t<ul class='clearfix launcher'>\r\n\t\t\t\t\t" . (($this->memberData['member_id'] and $this->memberData['g_use_pm'] and $this->memberData['members_disable_pm'] == 0) ? "<li id='nav_messages'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=messaging", "public", ''), "", "") . "' title='{$this->lang->words['your_messenger']}'><span class='icon'></span>" . ($this->memberData['msg_count_new'] ? "<span class='ipsHasNotifications'>{$this->memberData['msg_count_new']}</span>" : "") . "{$this->lang->words['your_messenger']}</a></li>" : "") . "\r\n\t\t\t\t\t" . ($this->memberData['member_id'] ? "<li id='nav_notifications'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=usercp&amp;tab=core&amp;area=notificationlog&amp;clear=true", "public", ''), "", "") . "'><span class='icon'></span>" . ($this->memberData['notification_cnt'] ? "<span class='ipsHasNotifications'>{$this->memberData['notification_cnt']}</span>" : "") . "{$this->lang->words['notifications_at_the_top']}</a></li>" : "") . "\r\n\t\t\t\t\t" . ($header_items['applications']['members']['app_show'] ? "\r\n\t\t\t\t\t\t<li id='nav_members'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("{$header_items['applications']['members']['app_link']}", "{$header_items['applications']['members']['app_base']}", ''), "{$header_items['applications']['members']['app_seotitle']}", "{$header_items['applications']['members']['app_template']}") . "' title='" . sprintf($this->lang->words['go_to_prefix'], IPSLib::getAppTitle('members')) . "'><span class='icon'></span>" . IPSLib::getAppTitle('members') . "</a></li>\r\n\t\t\t\t\t" : "") . "\r\n\t\t\t\t\t" . ($header_items['applications']['forums']['app_show'] ? "\r\n\t\t\t\t\t\t<li id='nav_forums'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("{$header_items['applications']['forums']['app_link']}", "{$header_items['applications']['forums']['app_base']}", ''), "{$header_items['applications']['forums']['app_seotitle']}", "{$header_items['applications']['forums']['app_template']}") . "' title='" . sprintf($this->lang->words['go_to_prefix'], IPSLib::getAppTitle('forums')) . "'><span class='icon'></span>" . IPSLib::getAppTitle('forums') . "</a></li>\r\n\t\t\t\t\t" : "") . "\r\n\t\t\t\t\t" . ($header_items['applications']['blog']['app_show'] ? "\r\n\t\t\t\t\t\t<li id='nav_blog'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("{$header_items['applications']['blog']['app_link']}", "{$header_items['applications']['blog']['app_base']}", ''), "{$header_items['applications']['blog']['app_seotitle']}", "{$header_items['applications']['blog']['app_template']}") . "' title='" . sprintf($this->lang->words['go_to_prefix'], IPSLib::getAppTitle('blog')) . "'><span class='icon'></span>" . IPSLib::getAppTitle('blog') . "</a></li>\r\n\t\t\t\t\t" : "") . "\r\n\t\t\t\t\t" . ($header_items['applications']['gallery']['app_show'] ? "\r\n\t\t\t\t\t\t<li id='nav_gallery'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("{$header_items['applications']['gallery']['app_link']}", "{$header_items['applications']['gallery']['app_base']}", ''), "{$header_items['applications']['gallery']['app_seotitle']}", "{$header_items['applications']['gallery']['app_template']}") . "' title='" . sprintf($this->lang->words['go_to_prefix'], IPSLib::getAppTitle('gallery')) . "'><span class='icon'></span>" . IPSLib::getAppTitle('gallery') . "</a></li>\r\n\t\t\t\t\t" : "") . "\r\n\t\t\t\t\t" . ($header_items['applications']['nexus']['app_show'] ? "\r\n\t\t\t\t\t\t<li id='nav_nexus_store'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=nexus&amp;module=payments&amp;section=store", "public", ''), "store", "") . "'><span class='icon'></span>{$this->lang->words['mobile_nexus_store']}</a></li>\r\n\t\t\t\t\t\t<li id='nav_nexus_ca'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=nexus&amp;module=clients", "public", ''), "", "") . "'><span class='icon'></span>{$this->lang->words['mobile_nexus_clients']}</a></li>\r\n\t\t\t\t\t" : "") . "\r\n\t\t\t\t\t<li id='nav_vnc'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=search&amp;do=viewNewContent&amp;search_app=" . (($this->registry->getCurrentApplication() != 'core' and IPSLib::appIsSearchable($this->registry->getCurrentApplication())) ? "{$this->registry->getCurrentApplication()}" : "forums") . "", "public", ''), "", "") . "' accesskey='2'><span class='icon'></span>{$this->lang->words['mobile_view_new_posts']}</a></li>\r\n\t\t\t\t\t<li id='nav_statuses'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=profile&amp;section=status&amp;type=all", "public", ''), "true", "members_status_all") . "'><span class='icon'></span>{$this->lang->words['mob_status_updates']}</a></li>\r\n\t\t\t\t\t<li id='nav_search'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=search", "public", ''), "", "") . "' accesskey='2'><span class='icon'></span>{$this->lang->words['sj_search']}</a></li>\r\n\t\t\t\t\t<li id='nav_markread'><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=forums&amp;module=forums&amp;section=markasread&amp;marktype=all&amp;k={$this->member->form_hash}", "public", ''), "", "") . "\" title='{$this->lang->words['mark_all_as_read']}'><span class='icon'></span>{$this->lang->words['mobile_mark_board_as_read']}</a></li>\r\n\t\t\t\t</ul>\r\n\t\t\t</div>\r\n\t\t\t<script type=\"text/javascript\">\r\n\t\t\t\t/* Prevent flash of header */\r\n\t\t\t\tdocument.getElementById('user_navigation').style.display = 'none';\r\n\t\t\t</script>\r\n\t\t\t\r\n\t\t\t<div id='content' class='clear'>\r\n\t\t\t\t" . ($html ? "{$html}" : "") . "\r\n\t\t\t</div>\r\n\t\t\t<div id='footer' class='clear'>\r\n\t\t\t\t" . ($this->memberData['userAgentType'] != 'mobileAppLegacy' || $this->registry->output->isLargeTouchDevice() ? "\r\n\t\t\t\t\t<a id='full_version' href='#'>{$this->lang->words['full_version']}</a>\r\n\t\t\t\t" : "") . "\r\n\t\t\t\t" . (count($footer_items['lang_chooser']['options']) > 1 ? "\r\n\t\t\t\t\t<a href='#' id='show_langs'>{$footer_items['lang_chooser']['default']}</a>\r\n\t\t\t\t\t<div id='show_langs_box' style='display: none'>\r\n\t\t\t\t\t\t<form action=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("{$this->settings['query_string_formatted']}", "public", ''), "", "") . "\" method=\"post\">\r\n\t\t\t\t\t\t\t<fieldset>\r\n\t\t\t\t\t\t\t\t<input type='hidden' name='k' value='{$this->member->form_hash}' />\r\n\t\t\t\t\t\t\t\t<input type='hidden' name='setlanguage' value='1' />\r\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"langurlbits\" value=\"&amp;cal_id={$this->request['cal_id']}\" />\r\n\t\t\t\t\t\t\t\t<label for='newLang' class='hide'>{$this->lang->words['language_prefix']}</label>\r\n\t\t\t\t\t\t\t\t<select name=\"langid\" id='newLang'>\r\n\t\t\t\t\t\t\t\t\t" . $this->__f__067cf3cbf4d56bffdcc0b9a010502a99($html, $documentHeadItems, $css, $jsModules, $metaTags, $header_items, $items, $footer_items, $stats) . "\t\t\t\t\t\t\t\t</select>\r\n\t\t\t\t\t\t\t\t<input type='submit' class='input_submit alt' value='{$this->lang->words['jmp_go']}' id='newLangSubmit' />\r\n\t\t\t\t\t\t\t</fieldset>\r\n\t\t\t\t\t\t</form>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t" : "") . "\r\n\t\t\t</div>\r\n\t\t\t<div id='task'>{$stats['task']}</div>\r\n\t\t</div>\r\n\t\t<div id='shade' style='display:none'></div>\r\n\t\t<!-- pre-load -->\r\n\t\t<div style='display:none'><img src='{style_images_url}/wait.gif' /></div>\r\n\t\t\r\n\t\t" . (($this->settings['viglink_enabled'] and (!$this->settings['viglink_groups'] or IPSMember::isInGroup($this->memberData, explode(',', $this->settings['viglink_groups'])))) ? "<script type=\"text/javascript\">\r\n\t\t\t  var vglnk = { api_url: '//api.viglink.com/api',\r\n\t\t\t                key: '{$this->settings['viglink_api_key']}'" . ($this->settings['viglink_subid'] ? ",\r\n\t\t\t                sub_id: '{$this->settings['sub_id']}'\r\n\t\t\t                " : "") . "\r\n\t\t\t              };\r\n\t\t\t\r\n\t\t\t  (function(d, t) {\r\n\t\t\t    var s = d.createElement(t); s.type = 'text/javascript'; s.async = true;\r\n\t\t\t    s.src = ('https:' == document.location.protocol ? vglnk.api_url :\r\n\t\t\t             '//cdn.viglink.com/api') + '/vglnk.js';\r\n\t\t\t    var r = d.getElementsByTagName(t)[0]; r.parentNode.insertBefore(s, r);\r\n\t\t\t  }(document, 'script'));\r\n\t\t\t</script>" : "") . "\r\n\t\t\r\n\t</body>\r\n</html>";
     return $IPBHTML;
 }
 /**
  * Parse/format the online list data for the records
  *
  * @author	Brandon Farber
  * @param	array 			Online list rows to check against
  * @return	array 			Online list rows parsed
  */
 public function parseOnlineEntries($rows)
 {
     if (!is_array($rows) or !count($rows)) {
         return $rows;
     }
     //-----------------------------------------
     // Init
     //-----------------------------------------
     $forums_raw = array();
     $forums = array();
     $topics_raw = array();
     $topics = array();
     $posts_raw = array();
     $posts = array();
     $final = array();
     //-----------------------------------------
     // Extract the topic/forum data
     //-----------------------------------------
     foreach ($rows as $row) {
         if ($row['current_appcomponent'] != 'forums' or !$row['current_module']) {
             continue;
         }
         if ($row['current_section'] == 'forums') {
             $forums_raw[$row['location_2_id']] = '';
         } else {
             if ($row['current_section'] == 'topics') {
                 $topics_raw[$row['location_1_id']] = $row['location_1_id'];
             } else {
                 if ($row['current_section'] == 'post') {
                     $forums_raw[$row['location_2_id']] = '';
                     $topics_raw[$row['location_1_id']] = $row['location_1_id'];
                 }
             }
         }
     }
     //-----------------------------------------
     // Get the forums, if you dare
     //-----------------------------------------
     ipsRegistry::getAppClass('forums');
     if (count($forums_raw)) {
         foreach (ipsRegistry::getClass('class_forums')->forum_by_id as $fid => $forum) {
             if (isset($forums_raw[$fid])) {
                 if (ipsRegistry::getClass('permissions')->check('view', $forum) !== false) {
                     $forums[$fid] = $forum['name'];
                 }
             }
         }
     }
     //-----------------------------------------
     // Get the topics, if you care
     //-----------------------------------------
     if (count($topics_raw)) {
         $_approved = ipsRegistry::getClass('class_forums')->fetchTopicHiddenQuery(array('visible'), 't.');
         ipsRegistry::DB()->build(array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => $_approved . ' AND t.tid IN(' . implode(',', $topics_raw) . ') AND ' . ipsRegistry::getClass('permissions')->buildPermQuery('p'), 'add_join' => array(array('from' => array('permission_index' => 'p'), 'where' => "p.perm_type_id=t.forum_id AND p.app='forums' AND p.perm_type='forum'", 'type' => 'left'))));
         $tr = ipsRegistry::DB()->execute();
         while ($r = ipsRegistry::DB()->fetch($tr)) {
             $_forum = ipsRegistry::getClass('class_forums')->getForumByid($r['forum_id']);
             if (count($_forum) and ipsRegistry::getClass('class_forums')->forumsCheckAccess($_forum['id'], false, 'topic', $r, true)) {
                 if (ipsRegistry::getClass('permissions')->check('read', $_forum) !== false) {
                     if ($_forum['password'] == '' or IPSMember::isInGroup(ipsRegistry::member()->fetchMemberData(), explode(',', $_forum['password_override'])) or IPSCookie::get("ipbforumpass_{$_forum['id']}") == md5($_forum['password'])) {
                         $topics[$r['tid']] = $r['title'];
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Put humpty dumpty together again
     //-----------------------------------------
     foreach ($rows as $row) {
         if ($row['current_appcomponent'] != 'forums') {
             $final[$row['id']] = $row;
             continue;
         }
         if (!$row['current_module']) {
             $row['where_line'] = ipsRegistry::getClass('class_localization')->words['board_index'];
             $final[$row['id']] = $row;
             continue;
         }
         if ($row['current_section'] == 'forums') {
             if (isset($forums[$row['location_2_id']])) {
                 $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_sf'];
                 $row['where_line_more'] = $forums[$row['location_2_id']];
                 $row['where_link'] = 'showforum=' . $row['location_2_id'];
                 $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl(ipsRegistry::getClass('output')->buildUrl("showforum=" . $row['location_2_id'], 'public'), IPSText::makeSeoTitle($forums[$row['location_2_id']]), 'showforum');
             }
         } else {
             if ($row['current_section'] == 'topics') {
                 if (isset($topics[$row['location_1_id']])) {
                     $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_st'];
                     $row['where_line_more'] = $topics[$row['location_1_id']];
                     $row['where_link'] = 'showtopic=' . $row['location_1_id'];
                     $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl(ipsRegistry::getClass('output')->buildUrl("showtopic=" . $row['location_1_id'], 'public'), IPSText::makeSeoTitle($topics[$row['location_1_id']]), 'showtopic');
                 }
             } else {
                 if ($row['current_section'] == 'post') {
                     if ($row['location_1_id']) {
                         if (isset($topics[$row['location_1_id']])) {
                             $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_postrep'];
                             $row['where_line_more'] = $topics[$row['location_1_id']];
                             $row['where_link'] = 'showtopic=' . $row['location_1_id'];
                             $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl(ipsRegistry::getClass('output')->buildUrl("showtopic=" . $row['location_1_id'], 'public'), IPSText::makeSeoTitle($topics[$row['location_1_id']]), 'showtopic');
                         }
                     } else {
                         if ($row['location_2_id']) {
                             if (isset($forums[$row['location_2_id']])) {
                                 $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_postnew'];
                                 $row['where_line_more'] = $forums[$row['location_2_id']];
                                 $row['where_link'] = 'showforum=' . $row['location_2_id'];
                                 $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl(ipsRegistry::getClass('output')->buildUrl("showforum=" . $row['location_2_id'], 'public'), IPSText::makeSeoTitle($forums[$row['location_2_id']]), 'showforum');
                             }
                         }
                     }
                 }
             }
         }
         $final[$row['id']] = $row;
     }
     return $final;
 }
示例#5
0
 /**
  * Perform a permission check
  *
  * @param	string	Type of check (add/edit/delete/editall/deleteall/approve all)
  * @param	array 	Array of GENERIC data
  * @return	true or string to be used in exception
  */
 public function can($type, array $array)
 {
     /* Init */
     $comment = array();
     /* Got data? */
     if (empty($array['comment_parent_id'])) {
         trigger_error("No parent ID passed to " . __FILE__, E_USER_WARNING);
     }
     /* Get the file */
     $event = $this->fetchParent($array['comment_parent_id']);
     /* Fetch comment */
     if ($array['comment_id']) {
         $comment = $this->fetchById($array['comment_id']);
     }
     /* Check permissions */
     switch ($type) {
         case 'view':
             if (!$this->registry->permissions->check('view', $event)) {
                 return 'NO_PERMISSION';
             }
             if ($event['event_private'] and (!$this->memberData['member_id'] or $this->memberData['member_id'] != $event['event_member_id'])) {
                 return 'NO_PERMISSION';
             }
             if ($event['event_perms'] != '*') {
                 $permissionGroups = explode(',', IPSText::cleanPermString($event['event_perms']));
                 if (!IPSMember::isInGroup($this->memberData, $permissionGroups)) {
                     return 'NO_PERMISSION';
                 }
             }
             return true;
             break;
         case 'edit':
             if (!$this->registry->permissions->check('comment', $event)) {
                 return 'NO_PERMISSION';
             }
             if (!$this->memberData['g_is_supmod'] and ($this->memberData['member_id'] != $comment['comment_author_id'] or !$comment['comment_author_id'])) {
                 return 'NO_PERMISSION';
             }
             return true;
             break;
         case 'add':
             if (!$this->registry->permissions->check('comment', $event)) {
                 return 'NO_PERMISSION';
             }
             return true;
             break;
         case 'delete':
             return $this->memberData['g_is_supmod'] ? true : 'NO_PERMISSION';
             break;
         case 'visibility':
         case 'moderate':
             return $this->memberData['g_is_supmod'] ? true : 'NO_PERMISSION';
             break;
         case 'hide':
             return IPSMember::canModerateContent($this->memberData, IPSMember::CONTENT_HIDE, $comment['comment_author_id']) ? TRUE : 'NO_PERMISSION';
             break;
         case 'unhide':
             return IPSMember::canModerateContent($this->memberData, IPSMember::CONTENT_UNHIDE, $comment['comment_author_id']) ? TRUE : 'NO_PERMISSION';
             break;
     }
 }
示例#6
0
文件: view.php 项目: mover5/imobackup
 /**
  * Show a single event based on eventid
  *
  * @return	@e void
  */
 public function calendarShowEvent()
 {
     //-----------------------------------------
     // Init
     //-----------------------------------------
     $event_id = intval($this->request['event_id']);
     if (!$event_id) {
         $this->registry->output->showError('calendar_event_not_found', 10429, null, null, 404);
     }
     //-----------------------------------------
     // Get the event data
     //-----------------------------------------
     $_joins = array(array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => 'm.member_id=e.event_member_id', 'type' => 'left'), array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'm.member_id=pp.pp_member_id', 'type' => 'left'));
     if ($this->settings['reputation_enabled']) {
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache');
         $this->registry->setClass('repCache', new $classToLoad());
         $_joins[] = $this->registry->getClass('repCache')->getTotalRatingJoin('event_id', $event_id, 'calendar');
         $_joins[] = $this->registry->getClass('repCache')->getUserHasRatedJoin('event_id', $event_id, 'calendar');
     }
     $event = $this->DB->buildAndFetch(array('select' => 'e.*', 'from' => array('cal_events' => 'e'), 'where' => 'e.event_id=' . $event_id, 'add_join' => $_joins));
     if (!$event['event_id']) {
         $this->registry->output->showError('calendar_event_not_found', 10430, null, null, 404);
     }
     //-----------------------------------------
     // Reset calendar
     //-----------------------------------------
     $this->calendar = $this->functions->getCalendar($event['event_calendar_id']);
     if ($this->calendar['cal_id'] != $event['event_calendar_id']) {
         $this->registry->output->showError('cal_no_perm', 1040.22, null, null, 403);
     }
     //-----------------------------------------
     // Check permissions
     //-----------------------------------------
     if ($event['event_private'] and $this->memberData['member_id'] != $event['event_member_id']) {
         $this->registry->output->showError('calendar_event_not_found', 10431, null, null, 403);
     }
     if (!$this->memberData['g_is_supmod'] and !$event['event_approved']) {
         $this->registry->output->showError('calendar_event_not_found', 10432.1, null, null, 404);
     }
     if ($event['event_perms'] != '*') {
         $permissionGroups = explode(',', IPSText::cleanPermString($event['event_perms']));
         if (!IPSMember::isInGroup($this->memberData, $permissionGroups)) {
             $this->registry->output->showError('calendar_event_not_found', 10432, null, null, 404);
         }
     }
     //-----------------------------------------
     // Are we RSVPing?
     //-----------------------------------------
     if ($this->request['_rsvp'] and $event['event_rsvp']) {
         if ($this->registry->permissions->check('rsvp', $this->calendar) and $this->memberData['member_id']) {
             //-----------------------------------------
             // Make sure we aren't already RSVPed
             //-----------------------------------------
             $_check = $this->DB->buildAndFetch(array('select' => 'rsvp_id', 'from' => 'cal_event_rsvp', 'where' => 'rsvp_event_id=' . $event['event_id'] . ' AND rsvp_member_id=' . $this->memberData['member_id']));
             if (!$_check['rsvp_id']) {
                 $_insert = array('rsvp_event_id' => $event['event_id'], 'rsvp_member_id' => $this->memberData['member_id'], 'rsvp_date' => time());
                 $this->DB->insert('cal_event_rsvp', $_insert);
                 $this->registry->output->redirectScreen($this->lang->words['rsvp_saved_im'], $this->settings['base_url'] . "app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id=" . $event['event_id'], $event['event_title_seo'], 'cal_event');
             }
         }
     }
     //-----------------------------------------
     // Comments class
     //-----------------------------------------
     require_once IPS_ROOT_PATH . 'sources/classes/comments/bootstrap.php';
     /*noLibHook*/
     $this->_comments = classes_comments_bootstrap::controller('calendar-events');
     $comments = array('html' => $this->_comments->fetchFormatted($event, array('offset' => intval($this->request['st']))), 'count' => $this->_comments->count($event));
     //-----------------------------------------
     // Highlight...
     //-----------------------------------------
     if ($this->request['hl']) {
         $event['event_content'] = IPSText::searchHighlight($event['event_content'], $this->request['hl']);
         $event['event_title'] = IPSText::searchHighlight($event['event_title'], $this->request['hl']);
     }
     //-----------------------------------------
     // Can we report?
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('core') . '/sources/classes/reportLibrary.php', 'reportLibrary', 'core');
     $reports = new $classToLoad($this->registry);
     $event['_canReport'] = $reports->canReport('calendar');
     //-----------------------------------------
     // Output
     //-----------------------------------------
     $member = IPSMember::load($event['event_member_id'], 'all');
     $this->registry->output->addNavigation($this->calendar['cal_title'], "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id={$this->calendar['cal_id']}", $this->calendar['cal_title_seo'], 'cal_calendar');
     //-----------------------------------------
     // Try to match out and improve navigation
     //-----------------------------------------
     $_referrer = $_SERVER['HTTP_REFERER'];
     if ($_referrer) {
         //-----------------------------------------
         // Came from add form?
         //-----------------------------------------
         if (preg_match("#/add\$#", $_referrer)) {
             $_data = $this->calendarMakeEventHTML($event, true);
             $_dateBits = explode('-', gmstrftime('%Y-%m-%d-%B', $_data['event']['_start_time']));
             $this->registry->output->addNavigation($_dateBits[3] . ' ' . $_dateBits[0], "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id={$this->calendar['cal_id']}&amp;m={$_dateBits[1]}&amp;y={$_dateBits[0]}", $this->calendar['cal_title_seo'], 'cal_month');
             $this->registry->output->addNavigation($_dateBits[3] . ' ' . $_dateBits[2] . ', ' . $_dateBits[0], "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id={$this->calendar['cal_id']}&amp;do=showday&amp;y={$_dateBits[0]}&amp;m={$_dateBits[1]}&amp;d={$_dateBits[2]}", $this->calendar['cal_title_seo'], 'cal_day');
         } else {
             if (preg_match("#/day\\-(\\d{4})\\-(\\d{1,2})\\-(\\d{1,2})\$#i", $_referrer, $matches)) {
                 $_dateBits = explode('-', gmstrftime('%Y-%m-%d-%B', gmmktime(0, 0, 0, $matches[2], $matches[3], $matches[1])));
                 $this->registry->output->addNavigation($_dateBits[3] . ' ' . $_dateBits[0], "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id={$this->calendar['cal_id']}&amp;m={$_dateBits[1]}&amp;y={$_dateBits[0]}", $this->calendar['cal_title_seo'], 'cal_month');
                 $this->registry->output->addNavigation($_dateBits[3] . ' ' . $_dateBits[2] . ', ' . $_dateBits[0], "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id={$this->calendar['cal_id']}&amp;do=showday&amp;y={$_dateBits[0]}&amp;m={$_dateBits[1]}&amp;d={$_dateBits[2]}", $this->calendar['cal_title_seo'], 'cal_day');
             } else {
                 if (preg_match("#/week\\-(\\d+?)\$#i", $_referrer, $matches)) {
                     $_dateBits = explode('-', gmstrftime('%Y-%m-%d-%B', $matches[1]));
                     $this->registry->output->addNavigation($_dateBits[3] . ' ' . $_dateBits[0], "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id={$this->calendar['cal_id']}&amp;m={$_dateBits[1]}&amp;y={$_dateBits[0]}", $this->calendar['cal_title_seo'], 'cal_month');
                     $this->registry->output->addNavigation("{$this->lang->words['week_beginning']} " . gmstrftime('%B %d, %Y', $matches[1]), "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id={$this->calendar['cal_id']}&amp;do=showweek&amp;week={$matches[1]}", $this->calendar['cal_title_seo'], 'cal_week');
                 } else {
                     if (preg_match("#/(\\d{1,2})\\-(\\d{4})\$#i", $_referrer, $matches)) {
                         $_dateBits = explode('-', gmstrftime('%Y-%m-%d-%B', gmmktime(0, 0, 0, $matches[1], 15, $matches[2])));
                         $this->registry->output->addNavigation($_dateBits[3] . " " . $_dateBits[0], "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id={$this->calendar['cal_id']}&amp;m={$_dateBits[1]}&amp;y={$_dateBits[0]}", $this->calendar['cal_title_seo'], 'cal_month');
                     } else {
                         if (preg_match("#/(\\d+?)\\-(.+?)\$#i", $_referrer, $matches)) {
                             $_data = $this->calendarMakeEventHTML($event, true);
                             $_dateBits = explode('-', gmstrftime('%Y-%m-%d-%B', $_data['event']['_start_time']));
                             $this->registry->output->addNavigation($_dateBits[3] . " " . $_dateBits[0], "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id={$this->calendar['cal_id']}&amp;m={$_dateBits[1]}&amp;y={$_dateBits[0]}", $this->calendar['cal_title_seo'], 'cal_month');
                         } else {
                             $_data = $this->calendarMakeEventHTML($event, true);
                             $_dateBits = explode('-', gmstrftime('%Y-%m-%d-%B', $_data['event']['_start_time']));
                             $this->registry->output->addNavigation($_dateBits[3] . ' ' . $_dateBits[0], "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id={$this->calendar['cal_id']}&amp;m={$_dateBits[1]}&amp;y={$_dateBits[0]}", $this->calendar['cal_title_seo'], 'cal_month');
                             $this->registry->output->addNavigation($_dateBits[3] . ' ' . $_dateBits[2] . ', ' . $_dateBits[0], "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id={$this->calendar['cal_id']}&amp;do=showday&amp;y={$_dateBits[0]}&amp;m={$_dateBits[1]}&amp;d={$_dateBits[2]}", $this->calendar['cal_title_seo'], 'cal_day');
                         }
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Finish output
     //-----------------------------------------
     $this->registry->output->addNavigation($event['event_title']);
     $this->registry->output->addMetaTag('keywords', $this->chosen_date['month_name'] . ' ' . $_dateBits[2] . ' events event calendar ' . $event['event_title'] . ' ' . IPSText::getTextClass('bbcode')->stripAllTags($event['event_content']), TRUE);
     $this->registry->output->addMetaTag('description', str_replace("\n", " ", str_replace("\r", "", IPSText::getTextClass('bbcode')->stripAllTags($event['event_content']))), FALSE, 155);
     $this->registry->output->addToDocumentHead('raw', "<link rel='up' href='" . $this->registry->output->buildSEOUrl('app=calendar&amp;module=calendar&amp;section=view&amp;cal_id=' . $event['event_calendar_id'], 'publicNoSession', $this->calendar['cal_title_seo'], 'cal_calendar') . "' />");
     $this->registry->output->addToDocumentHead('raw', "<link rel='author' href='" . $this->registry->output->buildSEOUrl('showuser='******'event_member_id'], 'publicNoSession', $member['members_seo_name'], 'showuser') . "' />");
     $this->registry->getClass('output')->addCanonicalTag('app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id=' . $event['event_id'], $event['event_title_seo'], 'cal_event');
     $this->page_title = $event['event_title'];
     $this->output .= $this->registry->output->getTemplate('calendar')->calendarShowEvent($this->calendarMakeEventHTML($event), $comments);
 }
示例#7
0
 /**
  * Retrieve upcoming events
  *
  * @return	string
  */
 public function getUpcomingEvents()
 {
     //-----------------------------------------
     // Make sure calendar app is installed
     //-----------------------------------------
     if (!$this->settings['show_calendar'] or !IPSLib::appIsInstalled('calendar')) {
         return '';
     }
     //-----------------------------------------
     // Get current date data
     //-----------------------------------------
     $a = explode(',', gmdate('Y,n,j,G,i,s', time() + $this->registry->class_localization->getTimeOffset()));
     $day = $a[2];
     $month = $a[1];
     $year = $a[0];
     //-----------------------------------------
     // Check calendar limit
     //-----------------------------------------
     $this->settings['calendar_limit'] = intval($this->settings['calendar_limit']) < 2 ? 1 : intval($this->settings['calendar_limit']);
     $our_unix = gmmktime(0, 0, 0, $month, $day, $year);
     $max_date = $our_unix + $this->settings['calendar_limit'] * 86400;
     $events = array();
     $show_events = array();
     //-----------------------------------------
     // Loop over the cache
     //-----------------------------------------
     if (is_array($this->caches['calendar_events']) and count($this->caches['calendar_events'])) {
         foreach ($this->caches['calendar_events'] as $u) {
             //-----------------------------------------
             // Private?
             //-----------------------------------------
             if ($u['event_private'] == 1 and $this->memberData['member_id'] != $u['event_member_id']) {
                 continue;
             }
             //-----------------------------------------
             // Got perms?
             //-----------------------------------------
             if ($u['event_perms'] != '*') {
                 $permissionGroups = explode(',', IPSText::cleanPermString($u['event_perms']));
                 if (!IPSMember::isInGroup($this->memberData, $permissionGroups)) {
                     continue;
                 }
             }
             //-----------------------------------------
             // Got calendar perms?
             //-----------------------------------------
             if (!$this->registry->permissions->check('view', $u)) {
                 continue;
             }
             //-----------------------------------------
             // Times and dates
             //-----------------------------------------
             $u['isoDate'] = gmdate('c', strtotime($u['event_start_date']));
             $u['_start_time'] = strtotime($u['event_start_date']);
             $u['_end_time'] = ($u['event_end_date'] and $u['event_end_date'] != '0000-00-00 00:00:00') ? strtotime($u['event_end_date']) : 0;
             if (!$u['event_all_day']) {
                 if ($this->memberData['member_id'] and $this->memberData['time_offset']) {
                     $u['_start_time'] = $u['_start_time'] + $this->memberData['time_offset'] * 3600;
                 } else {
                     if (!$this->memberData['member_id'] and $this->settings['time_offset']) {
                         $u['_start_time'] = $u['_start_time'] + $this->settings['time_offset'] * 3600;
                     }
                 }
                 if ($this->memberData['member_id'] and $this->memberData['time_offset']) {
                     $u['_end_time'] = $u['_end_time'] ? $u['_end_time'] + $this->memberData['time_offset'] * 3600 : 0;
                 } else {
                     if (!$this->memberData['member_id'] and $this->settings['time_offset']) {
                         $u['_end_time'] = $u['_end_time'] ? $u['_end_time'] + $this->settings['time_offset'] * 3600 : 0;
                     }
                 }
             }
             //-----------------------------------------
             // In range?
             //-----------------------------------------
             if (!$u['event_recurring'] and ($u['_end_time'] >= $our_unix and $u['_start_time'] <= $max_date or !$u['_end_time'] and $u['_start_time'] >= $our_unix and $u['_start_time'] <= $max_date)) {
                 if ($u['_end_time']) {
                     if ($u['_start_time'] < gmmktime(0)) {
                         $u['_start_time'] = gmmktime(0);
                     }
                 }
                 $events[str_pad($u['_start_time'] . $u['event_id'], 15, "0")] = $u;
             } elseif ($u['event_recurring'] > 0) {
                 $cust_range_s = $u['_start_time'];
                 while ($cust_range_s <= $u['_end_time']) {
                     if ($cust_range_s >= $our_unix and $cust_range_s <= $max_date) {
                         //-----------------------------------------
                         // Special case for "monthly" to ensure it lands on the same day
                         //-----------------------------------------
                         if ($u['event_recurring'] != 1) {
                             $u['_start_time'] = gmmktime(1, 1, 1, gmdate('n', $cust_range_s), gmdate('j', $u['_start_time']), gmdate('Y', $cust_range_s));
                         } else {
                             $u['_start_time'] = $cust_range_s;
                         }
                         $events[str_pad($u['_start_time'] . $u['event_id'], 15, "0")] = $u;
                     }
                     if ($u['event_recurring'] == 1) {
                         $cust_range_s += 604800;
                     } elseif ($u['event_recurring'] == 2) {
                         $cust_range_s += 2628000;
                     } else {
                         $cust_range_s += 31536000;
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Sort and format
     //-----------------------------------------
     ksort($events);
     foreach ($events as $event) {
         //-----------------------------------------
         // Recurring?
         //-----------------------------------------
         $c_time = gmstrftime('%x', $event['_start_time']);
         $url = $this->registry->output->buildSEOUrl("app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id={$event['event_id']}", 'public', $event['event_title_seo'], 'cal_event');
         $show_events[] = array('url' => $url, 'isoDate' => $event['isoDate'], 'date' => $c_time, 'title' => $event['event_title'], 'calendar' => $this->caches['calendars'][$event['event_calendar_id']]);
     }
     //-----------------------------------------
     // Send output to template and return HTML
     //-----------------------------------------
     $this->lang->words['calender_f_title'] = sprintf($this->lang->words['calender_f_title'], $this->settings['calendar_limit']);
     if (count($show_events) > 0) {
         $event_string = $show_events;
     } else {
         if (!$this->settings['autohide_calendar']) {
             $event_string = $this->lang->words['no_calendar_events'];
         }
     }
     return $this->registry->output->getTemplate('calendar')->boardIndexCalEvents($event_string);
 }
 function __f__cdf08cf85f92ef8ef4013206021a0615($links, $title = '', $url = '', $cssClass = 'topic_share left')
 {
     $_ips___x_retval = '';
     $__iteratorCount = 0;
     foreach ($links as $id => $data) {
         $__iteratorCount++;
         $_ips___x_retval .= "\n\t\t" . (($data['share_enabled'] and ($data['share_groups'] == '*' or IPSMember::isInGroup($this->memberData, explode(',', $data['share_groups'])))) ? "" . (($data['customOutput'] and is_array($data['customOutput'])) ? "\n\t\t\t\t" . $this->registry->output->getTemplate($data['customOutput'][0])->{$data}['customOutput'][1]($data['_rawUrl'], $title, $data['customOutput'][2]) . "\n\t\t\t" : "<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("sharelink={$data['share_key']};{$data['_url']};{$title}", "public", ''), "", "") . "" . ($data['overrideApp'] ? "&amp;overrideApp={$data['overrideApp']}" : "") . "\" rel=\"nofollow\" target=\"_blank\" title=\"" . (isset($this->lang->words['gbl_sharelink_with_' . $data['share_key']]) ? "{$this->lang->words['gbl_sharelink_with_' . $data['share_key']]}" : "{$this->lang->words['gbl_sharelink_with']} {$data['share_title']}") . "\" class='_slink' id='slink_{$data['share_key']}'><img src=\"{$this->settings['public_cdn_url']}style_extra/sharelinks/{$data['share_key']}.png\" /></a></li>") . "" : "") . "\n\t\n";
     }
     $_ips___x_retval .= '';
     unset($__iteratorCount);
     return $_ips___x_retval;
 }
示例#9
0
 /**
  * Share the link.
  *
  * @access	public
  * @param	string		Document title
  * @param	string		Document URL
  */
 public function share($title, $url)
 {
     /* Disabled? */
     if (!$this->settings['sl_enable']) {
         return false;
     }
     /* Permission Check */
     $cache = isset($this->caches['sharelinks']) ? $this->caches['sharelinks'] : ipsRegistry::cache()->getCache('sharelinks');
     if ($cache[$this->_pluginKey]['share_groups'] != '*' and !IPSMember::isInGroup($this->memberData, explode(',', $cache[$this->_pluginKey]['share_groups']))) {
         return false;
     }
     /* Ensure title is correctly de-html-ized */
     $title = IPSText::UNhtmlspecialchars($title);
     if (is_object($this->_plugin)) {
         /* Grab URL details */
         $data = $this->deconstructUrl($url);
         /* Requires a permission check? */
         if ($data['data_app'] and method_exists($this->_plugin, 'requiresPermissionCheck')) {
             if ($this->_plugin->requiresPermissionCheck($data) !== false) {
                 $_file = IPSLib::getAppDir($data['data_app']) . '/extensions/coreExtensions.php';
                 $_result = false;
                 /* Check for the file */
                 if (is_file($_file)) {
                     /* Get the file */
                     $_class = IPSLib::loadLibrary($_file, $data['data_app'] . 'ShareLinks', $data['data_app']);
                     /* Check for the class */
                     if (class_exists($_class)) {
                         /* Create an object */
                         $_obj = new $_class();
                         /* Check for the module */
                         if (method_exists($_obj, 'permissionCheck')) {
                             if ($_obj->permissionCheck($data) !== false) {
                                 $_result = true;
                             }
                         }
                     }
                 }
                 if ($_result === false) {
                     $this->registry->getClass('output')->showError('no_permission');
                 }
             }
         }
         /* Log it */
         $this->log($url, $title, $data);
         /* In almost all cases, there is no data to return as the plugin
            redirects or posts an action */
         $this->_plugin->share($title, $url);
     }
     return false;
 }
 /**
  * Check Forum Access
  *
  * @param	integer	$fid			Forum id
  * @param	bool	$prompt_login	Prompt login/show error
  * @param	string	$in				[topic|forum]
  * @param	array 	$topic			Topic data
  * @param	bool	$return			Return instead of displaying an error
  * @return	bool
  */
 public function forumsCheckAccess($fid, $prompt_login = 0, $in = 'forum', $topic = array(), $return = false)
 {
     $fid = intval($fid);
     $deny_access = 1;
     /* Pass it along */
     $this->registry->permissions->setMemberData($this->getMemberData());
     if ($this->registry->permissions->check('view', $this->allForums[$fid]) == TRUE) {
         if ($this->registry->permissions->check('read', $this->allForums[$fid]) == TRUE) {
             $deny_access = 0;
         } else {
             //-----------------------------------------
             // Can see topics?
             //-----------------------------------------
             if ($this->allForums[$fid]['permission_showtopic']) {
                 $this->read_topic_only = 1;
                 if ($in == 'forum') {
                     $deny_access = 0;
                 } else {
                     if ($return) {
                         return false;
                     }
                     $this->forumsCustomError($fid);
                     $deny_access = 1;
                 }
             } else {
                 if ($return) {
                     return false;
                 }
                 $this->forumsCustomError($fid);
                 $deny_access = 1;
             }
         }
     } else {
         if ($return) {
             return false;
         }
         $this->forumsCustomError($fid);
         $deny_access = 1;
     }
     /* Reset member data after use */
     $this->registry->permissions->setMemberData($this->memberData);
     //-----------------------------------------
     // Do we have permission to even see the password page?
     //-----------------------------------------
     if ($deny_access == 0) {
         $group_exempt = 0;
         if (isset($this->allForums[$fid]['password']) and $this->allForums[$fid]['password'] != '' and $this->allForums[$fid]['sub_can_post']) {
             if (isset($this->allForums[$fid]['password_override']) && IPSText::cleanPermString($this->allForums[$fid]['password_override']) != '') {
                 if (IPSMember::isInGroup($this->_memberData, explode(",", IPSText::cleanPermString($this->allForums[$fid]['password_override'])))) {
                     $group_exempt = 1;
                     $deny_access = 0;
                 }
             }
             if ($group_exempt == 0) {
                 if ($this->forumsComparePassword($fid) == TRUE) {
                     $deny_access = 0;
                 } else {
                     $deny_access = 1;
                     if ($prompt_login == 1) {
                         if ($return) {
                             return false;
                         }
                         $this->forumsShowLogin($fid);
                     }
                 }
             }
         }
     }
     if (is_array($topic) && count($topic)) {
         if (!$this->_memberData['g_other_topics'] and $topic['starter_id'] != $this->_memberData['member_id']) {
             if ($return) {
                 return false;
             }
             $this->registry->getClass('output')->showError('forums_no_view_topic', 103136, null, null, 404);
         } else {
             if (!$this->allForums[$fid]['can_view_others'] and !$this->_memberData['is_mod'] and $topic['starter_id'] != $this->_memberData['member_id']) {
                 if ($return) {
                     return false;
                 }
                 $this->registry->getClass('output')->showError('forums_no_view_topic', 103137, null, null, 404);
             }
         }
     }
     if ($this->allForums[$fid]['min_posts_view'] && $this->allForums[$fid]['min_posts_view'] > $this->_memberData['posts'] && !$this->_memberData['g_is_supmod']) {
         if ($return) {
             return false;
         }
         $this->registry->getClass('output')->showError('forums_not_enough_posts', 103138, null, null, 403);
     }
     if ($deny_access == 1) {
         if ($return) {
             return false;
         }
         $this->registry->getClass('output')->showError('forums_no_permission', 103139, null, null, 404);
     } else {
         return TRUE;
     }
 }
示例#11
0
 /**
  * Show the forum leaders
  *
  * @return	@e void		[Outputs to screen]
  */
 protected function _showLeaders()
 {
     /* Load language */
     $this->lang->loadLanguageFile(array('public_online', 'public_profile'), 'members');
     /* Init */
     $st = intval($this->request['st']);
     $perpage = 25;
     $group_ids = array();
     $member_ids = array();
     $members = array();
     $forumsMembers = array();
     $pagination = '';
     $mids = array();
     $location_info = array();
     $whereClause = array();
     /* Work out who our super mods / mods aer */
     foreach ($this->cache->getCache('group_cache') as $i) {
         if ($i['g_is_supmod']) {
             $group_ids[$i['g_id']] = '*';
         } elseif ($i['g_access_cp']) {
             $group_ids[$i['g_id']] = array();
         }
     }
     $modCache = $this->cache->getCache('moderators');
     $modCache = is_array($modCache) && count($modCache) ? $modCache : array();
     foreach ($modCache as $i) {
         if ($i['is_group'] && !$this->caches['group_cache'][$i['group_id']]['gbw_hide_leaders_page']) {
             if (isset($group_ids[$i['group_id']])) {
                 if (is_array($group_ids[$i['group_id']])) {
                     $group_ids[$i['group_id']][$i['forum_id']] = ipsRegistry::getClass('class_forums')->forum_by_id[$i['forum_id']]['name'];
                 }
             } else {
                 $group_ids[$i['group_id']] = array($i['forum_id'] => ipsRegistry::getClass('class_forums')->forum_by_id[$i['forum_id']]['name']);
             }
         } else {
             if ($i['member_id']) {
                 $member_ids[$i['member_id']] = $i['member_id'];
                 $forumsMembers[$i['member_id']][$i['forum_id']] = ipsRegistry::getClass('class_forums')->forum_by_id[$i['forum_id']]['name'];
             }
         }
     }
     /* Custom Fields */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields');
     $custom_fields_class = new $classToLoad();
     //-----------------------------------------
     // Get em
     //-----------------------------------------
     /* Got groups? */
     if (count($group_ids)) {
         $whereClause[] = $this->DB->buildWherePermission(array_keys($group_ids), 'm.member_group_id', FALSE);
     }
     /* Got members? */
     if (count($member_ids)) {
         $whereClause[] = $this->DB->buildWherePermission(array_keys($member_ids), 'm.member_id', FALSE);
     }
     /* So we got something? If not skip the whole thing.. */
     if (count($whereClause)) {
         /* Get a count */
         $count = $this->DB->buildAndFetch(array('select' => 'count(*) as dracula', 'from' => array('members' => 'm'), 'where' => implode(' OR ', $whereClause)));
         if ($count['dracula']) {
             /* Sort out pagination */
             $pagination = $this->registry->output->generatePagination(array('totalItems' => $count['dracula'], 'itemsPerPage' => $perpage, 'currentStartValue' => $st, 'baseUrl' => "app=forums&module=extras&section=stats&do=leaders"));
             /* Fetch the ones we want */
             $this->DB->build(array('select' => 'm.*, m.member_id as my_member_id', 'from' => array('members' => 'm'), 'add_join' => array(array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left'), array('select' => 'pf.*', 'from' => array('pfields_content' => 'pf'), 'where' => 'pf.member_id=m.member_id', 'type' => 'left')), 'where' => implode(' OR ', $whereClause), 'order' => 'm.members_display_name', 'limit' => array($st, $perpage)));
             $e = $this->DB->execute();
             while ($r = $this->DB->fetch($e)) {
                 /* Reset member ID just in case.. */
                 $r['member_id'] = $r['my_member_id'];
                 $members[$r['member_id']] = IPSMember::buildDisplayData($r);
             }
             /* Now fetch session data */
             $this->DB->build(array('select' => '*', 'from' => 'sessions', 'where' => 'member_id IN (' . implode(',', array_keys($members)) . ')'));
             $this->DB->execute();
             while ($r = $this->DB->fetch()) {
                 if (!$r['id'] or IPSMember::isLoggedInAnon($members[$r['member_id']])) {
                     $location_info[$r['member_id']] = '';
                 } else {
                     $location_info[$r['member_id']] = IPSMember::getLocation($r);
                 }
             }
             //-----------------------------------------
             // Display
             //-----------------------------------------
             foreach ($members as $k => $member) {
                 $forums = isset($member_ids[$member['member_id']]) ? $member_ids[$member['member_id']] : array();
                 if ($forums == '*') {
                     $forums = $this->lang->words['leader_all_forums'];
                 } else {
                     $forums = array();
                     foreach ($group_ids as $gid => $fs) {
                         if (IPSMember::isInGroup($member, $gid)) {
                             if ($fs == '*') {
                                 $forums = $this->lang->words['leader_all_forums'];
                                 break;
                             } else {
                                 foreach ($fs as $f_id => $f_name) {
                                     if (!isset($forums[$f_id]) && $this->registry->getClass('class_forums')->forumsCheckAccess($f_id, 0, 'forum', array(), true)) {
                                         $forums[$f_id] = $f_name;
                                     }
                                 }
                             }
                         }
                     }
                     /* Now merge in member specific */
                     if (!is_string($forums) && !empty($forumsMembers[$member['member_id']])) {
                         foreach ($forumsMembers[$member['member_id']] as $f_id => $f_name) {
                             if (!isset($forums[$f_id]) && $this->registry->getClass('class_forums')->forumsCheckAccess($f_id, 0, 'forum', array(), true)) {
                                 $forums[$f_id] = $f_name;
                             }
                         }
                     }
                 }
                 /* Do not list if the user cannot see the forums this mod is a mod of - Bug report 36929 */
                 if (empty($forums)) {
                     unset($members[$k]);
                     continue;
                 }
                 $members[$k]['forums'] = $forums;
                 $members[$k]['online_extra'] = isset($location_info[$k]['online_extra']) ? $location_info[$k]['online_extra'] : '';
                 $members[$k]['last_active'] = $members[$k]['member_id'] == $this->memberData['member_id'] ? IPS_UNIX_TIME_NOW : ($members[$k]['online_extra'] ? $members[$k]['last_activity'] : $members[$k]['last_visit']);
             }
         }
     }
     $this->output .= $this->registry->getClass('output')->getTemplate('stats')->group_strip($this->lang->words['forum_leaders'], $members, $pagination);
     $this->registry->output->setTitle($this->lang->words['forum_leaders'] . ' - ' . ipsRegistry::$settings['board_name']);
     $this->registry->output->addNavigation($this->lang->words['forum_leaders'], '');
 }
 /**
  * Marks member(s) as spam
  *
  * @note	Exceptions CAN bubble up, so you should still capture exceptions from calls to this method
  * @param	array 	Array of member ids
  * @return	string	Confirmation message
  */
 public function markMembersAsSpam($ids)
 {
     /* Grab members */
     $members = IPSMember::load($ids);
     /* Load moderator's library */
     $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . '/sources/classes/moderate.php', 'moderatorLibrary', 'forums');
     $modLibrary = new $classToLoad($this->registry);
     /* Load custom profile fields class */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields');
     $fields = new $classToLoad();
     /* Load language file */
     $this->registry->getClass('class_localization')->loadLanguageFile(array('public_mod'), 'forums');
     /* Cycle all members */
     foreach ($members as $member_id => $member) {
         /* Protected group? */
         if (IPSMember::isInGroup($member, explode(',', ipsRegistry::$settings['warn_protected']))) {
             continue;
         }
         /**
          * Update member group and then flag as spammer,
          * we're removing them from the validating queue anyway
          * 
          * We must run this query here before they're flagged as spammer because
          * the 'onProfileUpdate' member sync call could edit further their group
          */
         $this->DB->update('members', array('member_group_id' => $this->settings['member_group']), 'member_id=' . $member['member_id']);
         $member['member_group_id'] = $this->settings['member_group'];
         # Change group here too to reflect the update just in case
         IPSMember::flagMemberAsSpammer($member, $this->memberData, FALSE);
     }
     /* Remove validating rows */
     $this->DB->delete('validating', "member_id IN (" . implode(",", $ids) . ")");
     /* Reset last member */
     IPSMember::resetLastRegisteredMember();
     $message = sprintf($this->lang->words['t_setasspammers'], count($ids));
     ipsRegistry::getClass('adminFunctions')->saveAdminLog($message);
     return $message;
 }
示例#13
0
 /**
  * Parse a member for display
  *
  * @param	mixed	Either array of member data, or member ID to self load
  * @param	array 	Array of flags to parse: 'signature', 'customFields', 'warn'
  * @return	array 	Parsed member data
  */
 public static function buildDisplayData($member, $_parseFlags = array())
 {
     $_NOW = IPSDebug::getMemoryDebugFlag();
     /* test to see if member_title has been passed */
     if (isset($member['member_title'])) {
         $member['title'] = $member['member_title'];
     }
     //-----------------------------------------
     // Figure out parse flags
     //-----------------------------------------
     $parseFlags = array('signature' => isset($_parseFlags['signature']) ? $_parseFlags['signature'] : 0, 'customFields' => isset($_parseFlags['customFields']) ? $_parseFlags['customFields'] : 0, 'reputation' => isset($_parseFlags['reputation']) ? $_parseFlags['reputation'] : 1, 'warn' => isset($_parseFlags['warn']) ? $_parseFlags['warn'] : 1, 'cfSkinGroup' => isset($_parseFlags['cfSkinGroup']) ? $_parseFlags['cfSkinGroup'] : '', 'cfGetGroupData' => isset($_parseFlags['cfGetGroupData']) ? $_parseFlags['cfGetGroupData'] : '', 'cfLocation' => isset($_parseFlags['cfLocation']) ? $_parseFlags['cfLocation'] : '', 'checkFormat' => isset($_parseFlags['checkFormat']) ? $_parseFlags['checkFormat'] : 0, 'photoTagSize' => isset($_parseFlags['photoTagSize']) ? $_parseFlags['photoTagSize'] : false, 'spamStatus' => isset($_parseFlags['spamStatus']) ? $_parseFlags['spamStatus'] : 0);
     if (isset($_parseFlags['__all__'])) {
         foreach ($parseFlags as $k => $v) {
             if (in_array($k, array('cfSkinGroup', 'cfGetGroupData', 'photoTagSize'))) {
                 continue;
             }
             $parseFlags[$k] = 1;
         }
         $parseFlags['spamStatus'] = !empty($parseFlags['spamStatus']) ? 1 : 0;
     }
     //-----------------------------------------
     // Load the member?
     //-----------------------------------------
     if (!is_array($member) and ($member == intval($member) and $member > 0)) {
         $member = self::load($member, 'all');
     }
     //-----------------------------------------
     // Caching
     //-----------------------------------------
     static $buildMembers = array();
     $_key = $member['member_id'];
     $_arr = serialize($member);
     foreach ($parseFlags as $_flag => $_value) {
         $_key .= $_flag . $_value;
     }
     $_key = md5($_key . $_arr);
     if (isset($buildMembers[$_key])) {
         IPSDebug::setMemoryDebugFlag("IPSMember::buildDisplayData: " . $member['member_id'] . " - CACHED", $_NOW);
         return $buildMembers[$_key];
     }
     //-----------------------------------------
     // Basics
     //-----------------------------------------
     if (!$member['member_group_id']) {
         $member['member_group_id'] = ipsRegistry::$settings['guest_group'];
     }
     /* Unpack bitwise if required */
     if (!isset($member['bw_is_spammer'])) {
         $member = self::buildBitWiseOptions($member);
     }
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $rank_cache = ipsRegistry::cache()->getCache('ranks');
     $group_cache = ipsRegistry::cache()->getCache('group_cache');
     $group_name = self::makeNameFormatted($group_cache[$member['member_group_id']]['g_title'], $member['member_group_id']);
     $pips = 0;
     $topic_id = intval(isset(ipsRegistry::$request['t']) ? ipsRegistry::$request['t'] : 0);
     $forum_id = intval(isset(ipsRegistry::$request['f']) ? ipsRegistry::$request['f'] : 0);
     //-----------------------------------------
     // SEO Name
     //-----------------------------------------
     $member['members_seo_name'] = self::fetchSeoName($member);
     $member['_group_formatted'] = $group_name;
     //-----------------------------------------
     // Ranks
     //-----------------------------------------
     if (is_array($rank_cache) and count($rank_cache)) {
         foreach ($rank_cache as $k => $v) {
             if ($member['posts'] >= $v['POSTS']) {
                 if (empty($member['title'])) {
                     $member['title'] = $v['TITLE'];
                 }
                 $pips = $v['PIPS'];
                 break;
             }
         }
     }
     //-----------------------------------------
     // Group image
     //-----------------------------------------
     $member['member_rank_img'] = '';
     $member['member_rank_img_i'] = '';
     if ($group_cache[$member['member_group_id']]['g_icon']) {
         $_img = $group_cache[$member['member_group_id']]['g_icon'];
         if (substr($_img, 0, 4) != 'http' and strpos($_img, '{style_images_url}') === false) {
             $_img = ipsRegistry::$settings['_original_base_url'] . '/' . ltrim($_img, '/');
         }
         $member['member_rank_img_i'] = 'img';
         $member['member_rank_img'] = $_img;
     } else {
         if ($pips and $member['member_id']) {
             if (is_numeric($pips)) {
                 for ($i = 1; $i <= $pips; ++$i) {
                     $member['member_rank_img_i'] = 'pips';
                     $member['member_rank_img'] = $member['member_rank_img'] . ipsRegistry::getClass('output')->getReplacement('pip_pip');
                 }
             } else {
                 $member['member_rank_img_i'] = 'img';
                 $member['member_rank_img'] = ipsRegistry::$settings['public_dir'] . 'style_extra/team_icons/' . $pips;
             }
         }
     }
     //-----------------------------------------
     // Moderator data
     //-----------------------------------------
     if (($parseFlags['spamStatus'] or $parseFlags['warn']) and $member['member_id']) {
         /* Possible forums class isn't init at this point */
         if (!ipsRegistry::isClassLoaded('class_forums')) {
             try {
                 $viewingMember = IPSMember::setUpModerator(ipsRegistry::member()->fetchMemberData());
                 ipsRegistry::member()->setProperty('forumsModeratorData', $viewingMember['forumsModeratorData']);
             } catch (Exception $error) {
                 IPS_exception_error($error);
             }
         }
         $moderator = ipsRegistry::member()->getProperty('forumsModeratorData');
     }
     $forum_id = isset(ipsRegistry::$request['f']) ? intval(ipsRegistry::$request['f']) : 0;
     //-----------------------------------------
     // Spammer status
     //-----------------------------------------
     if ($parseFlags['spamStatus'] and $member['member_id'] and ipsRegistry::member()->getProperty('member_id')) {
         /* Defaults */
         $member['spamStatus'] = NULL;
         $member['spamImage'] = NULL;
         if (!empty($moderator[$forum_id]['bw_flag_spammers']) or ipsRegistry::member()->getProperty('g_is_supmod')) {
             if (!ipsRegistry::$settings['warn_on'] or !IPSMember::isInGroup($member, explode(',', ipsRegistry::$settings['warn_protected']))) {
                 if ($member['bw_is_spammer']) {
                     $member['spamStatus'] = TRUE;
                 } else {
                     $member['spamStatus'] = FALSE;
                 }
             }
         }
     }
     //-----------------------------------------
     // Warny porny?
     //-----------------------------------------
     $member['show_warn'] = FALSE;
     if ($parseFlags['warn'] and $member['member_id']) {
         if (ipsRegistry::$settings['warn_on'] and !IPSMember::isInGroup($member, explode(',', ipsRegistry::$settings['warn_protected']))) {
             /* Warnings */
             if (!empty($moderator[$forum_id]['allow_warn']) or ipsRegistry::member()->getProperty('g_is_supmod') or ipsRegistry::$settings['warn_show_own'] and ipsRegistry::member()->getProperty('member_id') == $member['member_id']) {
                 $member['show_warn'] = TRUE;
             } else {
                 if (is_array($moderator) && count($moderator) && !$forum_id) {
                     foreach ($moderator as $forum) {
                         if ($forum['allow_warn']) {
                             $member['show_warn'] = TRUE;
                             break;
                         }
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Profile fields stuff
     //-----------------------------------------
     $member['custom_fields'] = "";
     if ($parseFlags['customFields'] == 1 and $member['member_id']) {
         if (isset(self::$_parsedCustomFields[$member['member_id']])) {
             $member['custom_fields'] = self::$_parsedCustomFields[$member['member_id']];
             if ($parseFlags['cfGetGroupData'] and isset(self::$_parsedCustomGroups[$member['member_id']]) and is_array(self::$_parsedCustomGroups[$member['member_id']])) {
                 $member['custom_field_groups'] = self::$_parsedCustomGroups[$member['member_id']];
             } else {
                 if ($parseFlags['cfGetGroupData']) {
                     $member['custom_field_groups'] = self::$custom_fields_class->fetchGroupTitles();
                     self::$_parsedCustomGroups[$member['member_id']] = $member['custom_field_groups'];
                 }
             }
         } else {
             if (!is_object(self::$custom_fields_class)) {
                 $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields');
                 self::$custom_fields_class = new $classToLoad();
             }
             if (self::$custom_fields_class) {
                 self::$custom_fields_class->member_data = $member;
                 self::$custom_fields_class->skinGroup = $parseFlags['cfSkinGroup'];
                 self::$custom_fields_class->initData();
                 self::$custom_fields_class->parseToView($parseFlags['checkFormat'], $parseFlags['cfLocation']);
                 $member['custom_fields'] = self::$custom_fields_class->out_fields;
                 self::$_parsedCustomFields[$member['member_id']] = $member['custom_fields'];
                 if ($parseFlags['cfGetGroupData']) {
                     $member['custom_field_groups'] = self::$custom_fields_class->fetchGroupTitles();
                     self::$_parsedCustomGroups[$member['member_id']] = $member['custom_field_groups'];
                 }
             }
         }
     }
     //-----------------------------------------
     // Profile photo
     //-----------------------------------------
     $member = self::buildProfilePhoto($member);
     if (!empty($parseFlags['photoTagSize'])) {
         $parseFlags['photoTagSize'] = is_array($parseFlags['photoTagSize']) ? $parseFlags['photoTagSize'] : array($parseFlags['photoTagSize']);
         foreach ($parseFlags['photoTagSize'] as $size) {
             $member['photoTag' . ucfirst($size)] = self::buildPhotoTag($member, $size);
         }
     }
     //-----------------------------------------
     // Signature bbcode
     //-----------------------------------------
     if (!empty($member['signature']) and $parseFlags['signature']) {
         if (isset(self::$_parsedSignatures[$member['member_id']])) {
             $member['signature'] = self::$_parsedSignatures[$member['member_id']];
         } else {
             if ($member['cache_content']) {
                 $member['signature'] = '<!--signature-cached-' . gmdate('r', $member['cache_updated']) . '-->' . $member['cache_content'];
             } else {
                 /* Grab the parser file */
                 if (self::$_sigParser === null) {
                     /* Load parser */
                     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser');
                     self::$_sigParser = new $classToLoad();
                 }
                 /* set up parser */
                 self::$_sigParser->set(array('memberData' => $member, 'parseBBCode' => 1, 'parseHtml' => $group_cache[$member['member_group_id']]['g_dohtml'] && $member['bw_html_sig'], 'parseEmoticons' => 1, 'parseArea' => 'signatures'));
                 $member['signature'] = self::$_sigParser->display($member['signature']);
                 IPSContentCache::update($member['member_id'], 'sig', $member['signature']);
             }
             self::$_parsedSignatures[$member['member_id']] = $member['signature'];
         }
     }
     //-----------------------------------------
     // If current session, reset last_activity
     //-----------------------------------------
     if (!empty($member['running_time'])) {
         $member['last_activity'] = $member['running_time'] > $member['last_activity'] ? $member['running_time'] : $member['last_activity'];
     }
     //-----------------------------------------
     // Online?
     //-----------------------------------------
     $time_limit = time() - ipsRegistry::$settings['au_cutoff'] * 60;
     $member['_online'] = 0;
     $bypass_anon = ipsRegistry::member()->getProperty('g_access_cp') ? 1 : 0;
     list($be_anon, $loggedin) = explode('&', empty($member['login_anonymous']) ? '0&0' : $member['login_anonymous']);
     /* Is not anon but the group might be forced to? */
     if (empty($be_anon) && self::isLoggedInAnon($member)) {
         $be_anon = 1;
     }
     /* Finally set the online flag */
     if (($member['last_visit'] > $time_limit or $member['last_activity'] > $time_limit) and ($be_anon != 1 or $bypass_anon == 1) and $loggedin == 1) {
         $member['_online'] = 1;
     }
     //-----------------------------------------
     // Last Active
     //-----------------------------------------
     $member['_last_active'] = ipsRegistry::getClass('class_localization')->getDate($member['last_activity'], 'SHORT');
     // Member last logged in anonymous ?
     if ($be_anon == 1 && !ipsRegistry::member()->getProperty('g_access_cp')) {
         $member['_last_active'] = ipsRegistry::getClass('class_localization')->words['private'];
     }
     //-----------------------------------------
     // Rating
     //-----------------------------------------
     $member['_pp_rating_real'] = intval($member['pp_rating_real']);
     //-----------------------------------------
     // Display name formatted
     //-----------------------------------------
     $member['members_display_name_formatted'] = self::makeNameFormatted($member['members_display_name'], $member['member_id'] ? $member['member_group_id'] : ipsRegistry::$settings['guest_group']);
     //-----------------------------------------
     // Long display names
     //-----------------------------------------
     $member['members_display_name_short'] = IPSText::truncate($member['members_display_name'], 16);
     //-----------------------------------------
     // Reputation
     //-----------------------------------------
     $member['pp_reputation_points'] = $member['pp_reputation_points'] ? $member['pp_reputation_points'] : 0;
     if ($parseFlags['reputation'] and $member['member_id']) {
         if (!ipsRegistry::isClassLoaded('repCache')) {
             $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache');
             ipsRegistry::setClass('repCache', new $classToLoad());
         }
         $member['author_reputation'] = ipsRegistry::getClass('repCache')->getReputation($member['pp_reputation_points']);
     }
     //-----------------------------------------
     // Other stuff not worthy of individual comments
     //-----------------------------------------
     $member['members_profile_views'] = isset($member['members_profile_views']) ? $member['members_profile_views'] : 0;
     /* BG customization */
     if ($member['pp_customization'] and !empty($member['gbw_allow_customization']) and !$member['bw_disable_customization']) {
         $member['customization'] = IPSLib::safeUnserialize($member['pp_customization']);
         if (is_array($member['customization'])) {
             /* Figure out BG URL */
             if ($member['customization']['type'] == 'url' and $member['customization']['bg_url'] and $member['gbw_allow_url_bgimage']) {
                 $member['customization']['_bgUrl'] = $member['customization']['bg_url'];
             } else {
                 if ($member['customization']['type'] == 'upload' and $member['customization']['bg_url'] and $member['gbw_allow_upload_bgimage']) {
                     $member['customization']['_bgUrl'] = ipsRegistry::$settings['upload_url'] . '/' . $member['customization']['bg_url'];
                 } else {
                     if ($member['customization']['bg_color']) {
                         $member['customization']['type'] = 'bgColor';
                     }
                 }
             }
         }
     }
     /* Title is ambigious */
     $member['member_title'] = $member['title'];
     IPSDebug::setMemoryDebugFlag("IPSMember::buildDisplayData: " . $member['member_id'] . " - Completed", $_NOW);
     $buildMembers[$_key] = $member;
     return $member;
 }
示例#14
0
 /**
  * Parse/format the online list data for the records
  *
  * @access	public
  * @author	Brandon Farber
  * @param	array 			Online list rows to check against
  * @return   array 			Online list rows parsed
  */
 public function parseOnlineEntries($rows)
 {
     if (!is_array($rows) or !count($rows)) {
         return $rows;
     }
     ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_calendar'), 'calendar');
     //-----------------------------------------
     // Init
     //-----------------------------------------
     $cals_raw = array();
     $cals = array();
     $events_raw = array();
     $events = array();
     $final = array();
     //-----------------------------------------
     // Extract the data
     //-----------------------------------------
     foreach ($rows as $row) {
         if ($row['current_appcomponent'] != 'calendar' or !$row['current_module']) {
             continue;
         }
         if ($row['location_1_type'] == 'event') {
             $events_raw[$row['location_1_id']] = $row['location_1_id'];
         } else {
             if ($row['location_1_type'] == 'calendar') {
                 $cals_raw[$row['location_1_id']] = $row['location_1_id'];
             }
         }
     }
     //-----------------------------------------
     // Get calendars
     //-----------------------------------------
     $calendars = ipsRegistry::cache()->getCache('calendars');
     if (count($cals_raw)) {
         foreach ($calendars as $cid => $calendar) {
             if (isset($cals_raw[$cid])) {
                 if (ipsRegistry::getClass('permissions')->check('view', $calendar)) {
                     $cals[$cid] = $calendar;
                 }
             }
         }
     }
     //-----------------------------------------
     // And events
     //-----------------------------------------
     if (count($events_raw)) {
         ipsRegistry::DB()->build(array('select' => 'event_id, event_title, event_title_seo, event_calendar_id, event_approved, event_private, event_perms', 'from' => 'cal_events', 'where' => 'event_id IN(' . implode(',', $events_raw) . ')'));
         $tr = ipsRegistry::DB()->execute();
         while ($r = ipsRegistry::DB()->fetch($tr)) {
             if (ipsRegistry::getClass('permissions')->check('view', $calendars[$r['event_calendar_id']])) {
                 if ($r['event_private'] and $this->memberData['member_id'] != $r['event_member_id']) {
                     continue;
                 }
                 if (!$this->memberData['g_is_supmod'] and !$r['event_approved']) {
                     continue;
                 }
                 if ($r['event_perms'] != '*') {
                     $permissionGroups = explode(',', IPSText::cleanPermString($r['event_perms']));
                     if (!IPSMember::isInGroup($this->memberData, $permissionGroups)) {
                         continue;
                     }
                 }
                 $events[$r['event_id']] = $r;
             }
         }
     }
     //-----------------------------------------
     // Extract the topic/forum data
     //-----------------------------------------
     foreach ($rows as $row) {
         if ($row['current_appcomponent'] == 'calendar') {
             if ($row['location_1_type'] == 'event' and isset($events[$row['location_1_id']])) {
                 $row['where_line'] = ipsRegistry::getClass('class_localization')->words['cal_event_ol'];
                 $row['where_line_more'] = $events[$row['location_1_id']]['event_title'];
                 $row['where_link'] = "app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id={$events[$row['location_1_id']]['event_id']}";
                 $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->buildSEOUrl($row['where_link'], 'public', $events[$row['location_1_id']]['event_title_seo'], 'cal_event');
             } else {
                 if ($row['location_1_type'] == 'calendar' and isset($cals[$row['location_1_id']])) {
                     $row['where_line'] = ipsRegistry::getClass('class_localization')->words['cal_calendar_ol'];
                     $row['where_line_more'] = $cals[$row['location_1_id']]['cal_title'];
                     $row['where_link'] = "app=calendar&amp;module=calendar&amp;section=view&amp;cal_id={$cals[$row['location_1_id']]['cal_id']}";
                     $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->buildSEOUrl($row['where_link'], 'public', $cals[$row['location_1_id']]['cal_title_seo'], 'cal_calendar');
                 } else {
                     $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_calendar'];
                     $row['where_link'] = 'app=calendar';
                     $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->buildSEOUrl('app=calendar', 'public', 'false', 'app=calendar');
                 }
             }
         }
         $final[$row['id']] = $row;
     }
     return $final;
 }
示例#15
0
 /**
  * Flag a user account as a spammer
  *
  * @return	@e void
  */
 protected function _setAsSpammer()
 {
     //-----------------------------------------
     // Init
     //-----------------------------------------
     $member_id = intval($this->request['member_id']);
     $toSave = array('core' => array('bw_is_spammer' => 1));
     $topicId = intval($this->request['t']);
     $topic = array();
     if ($topicId) {
         $topic = $this->DB->buildAndFetch(array('select' => 'tid, title_seo, forum_id', 'from' => 'topics', 'where' => 'tid=' . $topicId));
     }
     //-----------------------------------------
     // Load member
     //-----------------------------------------
     $member = IPSMember::load($member_id);
     if (!$member['member_id']) {
         $this->registry->output->showError('moderate_no_permission', 10311900, true, null, 404);
     }
     if (!$this->memberData['g_access_cp'] and $member['g_access_cp']) {
         return $this->registry->getClass('output')->getTemplate('modcp')->modcpMessage($this->lang->words['mod_cannot_edit_admin']);
     }
     //-----------------------------------------
     // Check permissions
     //-----------------------------------------
     if (!$this->memberData['g_is_supmod'] and !$this->memberData['forumsModeratorData'][$topic['forum_id']]['bw_flag_spammers']) {
         $this->registry->output->showError('moderate_no_permission', 103119, true, null, 403);
     }
     if (IPSMember::isInGroup($member, explode(',', $this->settings['warn_protected']))) {
         $this->registry->output->showError('moderate_no_permission', 10311901, true, null, 403);
     }
     if ($this->request['auth_key'] != $this->member->form_hash) {
         $this->registry->output->showError('moderate_no_permission', 10311902, null, null, 403);
     }
     //-----------------------------------------
     // Do it
     //-----------------------------------------
     IPSMember::flagMemberAsSpammer($member, $this->memberData);
     //-----------------------------------------
     // Redirect
     //-----------------------------------------
     if ($topicId) {
         $this->registry->output->redirectScreen($this->lang->words['flag_spam_done'], $this->settings['base_url'] . "showtopic=" . $topic['tid'] . "&amp;st=" . intval($this->request['st']), $topic['title_seo'], 'showtopic');
     } else {
         $this->registry->output->redirectScreen($this->lang->words['flag_spam_done'], $this->settings['base_url'] . "showuser=" . $member['member_id'], $member['members_seo_name'], 'showuser');
     }
 }
示例#16
0
 /**
  * Class entry point
  *
  * @param	object		Registry reference
  * @return	@e void		[Outputs to screen/redirects]
  */
 public function doExecute(ipsRegistry $registry)
 {
     /* Disabled? */
     if (!$this->settings['sl_enable']) {
         $this->registry->output->showError('forward_turned_off', 103240.1);
     }
     /* Permission Check */
     $cache = isset($this->caches['sharelinks']) ? $this->caches['sharelinks'] : ipsRegistry::cache()->getCache('sharelinks');
     if ($cache['email']['share_groups'] != '*' and !IPSMember::isInGroup($this->memberData, explode(',', $cache['email']['share_groups']))) {
         $this->registry->output->showError('forward_turned_off', 103240.2);
     }
     //-----------------------------------------
     // Grab skin and lang stuff
     //-----------------------------------------
     ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_emails'), 'core');
     /* Via URL and topic title? */
     if ($this->request['url'] and $this->request['title']) {
         $this->page['url'] = IPSText::parseCleanValue(IPSText::base64_decode_urlSafe($this->request['url']));
         $this->page['title'] = IPSText::parseCleanValue(urldecode($this->request['title']));
     } else {
         //-----------------------------------------
         // Check the input
         //-----------------------------------------
         $this->request['t'] = intval($this->request['t']);
         $this->request['f'] = intval($this->request['f']);
         if (!$this->request['t']) {
             $this->registry->output->showError('forward_no_tid', 10321);
         }
         //-----------------------------------------
         // Get the topic details
         //-----------------------------------------
         $this->topic = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'topics', 'where' => "tid=" . $this->request['t']));
         $this->forum = ipsRegistry::getClass('class_forums')->forum_by_id[$this->topic['forum_id']];
         //-----------------------------------------
         // Error out if we can not find the forum
         //-----------------------------------------
         if (!$this->forum['id']) {
             $this->registry->output->showError('forward_no_fid', 10322);
         }
         //-----------------------------------------
         // Error out if we can not find the topic
         //-----------------------------------------
         if (!$this->topic['tid']) {
             $this->registry->output->showError('forward_no_tid', 10323);
         }
         //-----------------------------------------
         // Check viewing permissions, private forums,
         // password forums, etc
         //-----------------------------------------
         if (!$this->memberData['member_id']) {
             $this->registry->output->showError('forward_only_members', 10324);
         }
         ipsRegistry::getClass('class_forums')->forumsCheckAccess($this->forum['id']);
     }
     /* last check */
     if (!$this->topic['tid'] and !$this->page['url']) {
         $this->registry->output->showError('forward_no_tid', 10323.2);
     }
     /* Ok, I lied. Is this share entry enabled? */
     $cache = ipsRegistry::cache()->getCache('sharelinks');
     if (!is_array($cache['email']) or !$cache['email']['share_enabled']) {
         $this->registry->output->showError('forward_turned_off', 103240);
     }
     //-----------------------------------------
     // What to do?
     //-----------------------------------------
     if ($this->request['do'] == '01') {
         $this->_sendEmail();
     } else {
         $this->_showForm();
     }
 }
 function globalTemplateMinimal($html, $documentHeadItems, $css, $jsModules, $metaTags, array $header_items, $items = array(), $footer_items = array(), $stats = array())
 {
     $IPBHTML = "";
     if (IPSLib::locationHasHooks('skin_global_other', $this->_funcHooks['globalTemplateMinimal'])) {
         $count_25be4b93e45d45a0afcf5f204d65ae86 = is_array($this->functionData['globalTemplateMinimal']) ? count($this->functionData['globalTemplateMinimal']) : 0;
         $this->functionData['globalTemplateMinimal'][$count_25be4b93e45d45a0afcf5f204d65ae86]['html'] = $html;
         $this->functionData['globalTemplateMinimal'][$count_25be4b93e45d45a0afcf5f204d65ae86]['documentHeadItems'] = $documentHeadItems;
         $this->functionData['globalTemplateMinimal'][$count_25be4b93e45d45a0afcf5f204d65ae86]['css'] = $css;
         $this->functionData['globalTemplateMinimal'][$count_25be4b93e45d45a0afcf5f204d65ae86]['jsModules'] = $jsModules;
         $this->functionData['globalTemplateMinimal'][$count_25be4b93e45d45a0afcf5f204d65ae86]['metaTags'] = $metaTags;
         $this->functionData['globalTemplateMinimal'][$count_25be4b93e45d45a0afcf5f204d65ae86]['header_items'] = $header_items;
         $this->functionData['globalTemplateMinimal'][$count_25be4b93e45d45a0afcf5f204d65ae86]['items'] = $items;
         $this->functionData['globalTemplateMinimal'][$count_25be4b93e45d45a0afcf5f204d65ae86]['footer_items'] = $footer_items;
         $this->functionData['globalTemplateMinimal'][$count_25be4b93e45d45a0afcf5f204d65ae86]['stats'] = $stats;
     }
     $IPBHTML .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\t<html xml:lang=\"ru\" lang=\"ru\" xmlns=\"http://www.w3.org/1999/xhtml\"" . (IPSLib::fbc_enabled() === TRUE ? " xmlns:fb=\"http://www.facebook.com/2008/fbml\"" : "") . ">\n\t<head>\n\t\t<meta http-equiv=\"content-type\" content=\"text/html; charset={$this->settings['gb_char_set']}\" />\n\t\t<title>{$header_items['title']}" . ($header_items['page'] ? " {$this->lang->words['page_title_page']} {$header_items['page']}" : "") . "</title>\n\t\t<link rel=\"shortcut icon\" href='" . ($this->registry->output->isHTTPS ? "{$this->settings['board_url_https']}" : "{$this->settings['board_url']}") . "/favicon.ico' />\n\t\t\n\t\t" . (method_exists($this->registry->getClass('output')->getTemplate('global'), 'includeJS') ? $this->registry->getClass('output')->getTemplate('global')->includeJS($jsModules) : '') . "" . (method_exists($this->registry->getClass('output')->getTemplate('global'), 'includeCSS') ? $this->registry->getClass('output')->getTemplate('global')->includeCSS($css) : '') . "\n\t\t<!--<meta http-equiv=\"X-UA-Compatible\" content=\"IE=7\" />-->\n\t\t" . (method_exists($this->registry->getClass('output')->getTemplate('global'), 'includeMeta') ? $this->registry->getClass('output')->getTemplate('global')->includeMeta($metaTags) : '') . "" . (method_exists($this->registry->getClass('output')->getTemplate('global'), 'includeFeeds') ? $this->registry->getClass('output')->getTemplate('global')->includeFeeds($documentHeadItems) : '') . "" . (method_exists($this->registry->getClass('output')->getTemplate('global'), 'includeRTL') ? $this->registry->getClass('output')->getTemplate('global')->includeRTL() : '') . "\n\t\t\n\t\t<!--<meta name=\"apple-mobile-web-app-capable\" content=\"yes\">-->\n\t\t<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\" />\n\t\t<meta name=\"viewport\" content=\"initial-scale=1, maximum-scale=1, user-scalable = no;\">\n\t</head>\n\t<body id='ipboard_body'>\n\t\t<div id='ipbwrapper'>\n\t\t\t" . (count($items['navigation']) > 1 && !$this->settings['_mobile_nav_home'] ? "" . (($this->nav_count = count($items['navigation'])) ? "" : "") . "" . (($this->nav_back = isset($this->settings['_mobile_back_nav']) ? $this->settings['_mobile_back_nav'] : 2) ? "" : "") . "\n\t\t\t\t<div id='secondary_navigation'>\n\t\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("{$items['navigation'][$this->nav_count - $this->nav_back][1]}", "public", ''), "{$items['navigation'][$this->nav_count - $this->nav_back][2]}", "{$items['navigation'][$this->nav_count - $this->nav_back][3]}") . "'>{$this->lang->words['_larr']} &nbsp;{$items['navigation'][$this->nav_count - $this->nav_back][0]}</a>\n\t\t\t\t</div>" : "" . ((count($items['navigation']) == 1 || $this->settings['_mobile_nav_home']) && !$this->settings['_mobile_hide_nav'] ? "\n\t\t\t\t\t<div id='secondary_navigation'>\n\t\t\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("act=idx", "public", ''), "false", "") . "' class='back'>{$this->lang->words['_larr']} {$this->lang->words['home']}</a>\n\t\t\t\t\t</div>\n\t\t\t\t" : "") . "") . "\n\t\t\t" . (method_exists($this->registry->output->getTemplate($this->registry->getCurrentApplication() . '_global'), 'overwriteHeader') ? "\n\t\t\t\t" . (method_exists($this->registry->getClass('output')->getTemplate('' . $this->registry->getCurrentApplication() . '_global'), 'overwriteHeader') ? $this->registry->getClass('output')->getTemplate('' . $this->registry->getCurrentApplication() . '_global')->overwriteHeader() : '') . "\n\t\t\t" : "\n\t\t\t\t" . (method_exists($this->registry->getClass('output')->getTemplate('global'), 'defaultHeader') ? $this->registry->getClass('output')->getTemplate('global')->defaultHeader() : '') . "\n\t\t\t") . "\n\t\t\t<div id=\"options-button\">&raquo;</div>\t\n\t\t\t<div id='user_navigation'>\n\t\t\t\t" . (!$this->memberData['member_id'] ? "\n\t\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=global&amp;section=login", "public", ''), "", "") . "' title='{$this->lang->words['sign_in']}'>{$this->lang->words['sign_in']}</a>\n\t\t\t\t\t<a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=global&amp;section=register", "public", ''), "", "") . "\" title='{$this->lang->words['register']}'>{$this->lang->words['register']}</a>\n\t\t\t\t" : "<a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=global&amp;section=login&amp;do=logout&amp;k={$this->member->form_hash}", "public", ''), "", "") . "\">{$this->lang->words['log_out']} ({$this->memberData['members_display_name']})</a>\n\t\t\t\t\t" . (($this->memberData['g_use_pm'] and $this->memberData['members_disable_pm'] == 0) ? "\n\t\t\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=messaging", "public", ''), "", "") . "' title='{$this->lang->words['your_messenger']}'>{$this->lang->words['your_messenger']}</a>\n\t\t\t\t\t" : "") . "") . "\n\t\t\t\t" . (!ipsRegistry::$applications['members']['app_hide_tab'] && !count(ipsRegistry::$applications['members']['app_tab_groups']) && !IPSMember::isInGroup($this->memberData, ipsRegistry::$applications['members']['app_tab_groups']) ? "<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members", "public", ''), "false", "") . "' title='{$this->lang->words['go_to_memberlist']}'>{$this->lang->words['tb_mlist']}</a>" : "") . "\n\t\t\t\t" . (ipsRegistry::$applications['blog']['app_enabled'] ? "\n\t\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=blog", "public", ''), "false", "") . "' title='{$this->lang->words['go_to_prefix']}" . IPSLib::getAppTitle('blog') . "'>" . IPSLib::getAppTitle('blog') . "</a>\n\t\t\t\t" : "") . "\n\t\t\t\t" . (ipsRegistry::$applications['gallery']['app_enabled'] ? "\n\t\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=gallery", "public", ''), "false", "") . "' title='{$this->lang->words['go_to_prefix']}" . IPSLib::getAppTitle('gallery') . "'>" . IPSLib::getAppTitle('gallery') . "</a>\n\t\t\t\t" : "") . "\n\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=search&amp;do=viewNewContent&amp;search_app=" . (($this->registry->getCurrentApplication() != 'core' and IPSLib::appIsSearchable($this->registry->getCurrentApplication())) ? "{$this->registry->getCurrentApplication()}" : "forums") . "", "public", ''), "", "") . "' accesskey='2'>{$this->lang->words['view_new_posts']}</a>\n\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=profile&amp;section=status&amp;type=all", "public", ''), "true", "members_status_all") . "'>{$this->lang->words['mob_status_updates']}</a>\n\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=search", "public", ''), "", "") . "' accesskey='2'>{$this->lang->words['sj_search']}</a>\n\t\t\t</div>\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\t/* Prevent flash of header */\n\t\t\t\tdocument.getElementById('user_navigation').style.display = 'none';\n\t\t\t</script>\n\t\t\t\n\t\t\t<div id='content' class='clear'>\n\t\t\t\t" . ($html ? "{$html}" : "") . "\n\t\t\t</div>\n\t\t\t\n\t\t\t<div id='footer' class='clear'>\n\t\t\t\t" . ($this->memberData['userAgentType'] != 'mobileAppLegacy' || $this->registry->output->isLargeTouchDevice() ? "\n\t\t\t\t\t<a id='full_version' href='#'>{$this->lang->words['full_version']}</a>\n\t\t\t\t" : "") . "\n\t\t\t\t" . (count($footer_items['lang_chooser']['options']) ? "\n\t\t\t\t\t<a href='#' id='show_langs'>{$footer_items['lang_chooser']['default']}</a>\n\t\t\t\t\t<div id='show_langs_box' style='display: none'>\n\t\t\t\t\t\t<form action=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("{$this->settings['query_string_formatted']}", "public", ''), "", "") . "\" method=\"post\">\n\t\t\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t\t\t<input type='hidden' name='k' value='{$this->member->form_hash}' />\n\t\t\t\t\t\t\t\t<input type='hidden' name='setlanguage' value='1' />\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"langurlbits\" value=\"cal_id={$this->request['cal_id']}\" />\n\t\t\t\t\t\t\t\t<label for='newLang' class='hide'>{$this->lang->words['language_prefix']}</label>\n\t\t\t\t\t\t\t\t<select name=\"langid\" id='newLang'>\n\t\t\t\t\t\t\t\t\t" . $this->__f__42eeecc43bfed00ea413c2df51bfa966($html, $documentHeadItems, $css, $jsModules, $metaTags, $header_items, $items, $footer_items, $stats) . "\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t<input type='submit' class='input_submit alt' value='{$this->lang->words['jmp_go']}' id='newLangSubmit' />\n\t\t\t\t\t\t\t</fieldset>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t</div>\n\t\t\t\t" : "") . "\n\t\t\t\t" . (($this->memberData['userAgentKey'] == 'iphone' || $this->memberData['userAgentKey'] == 'ipodtouch' and !$this->member->isMobileApp) ? "\n\t\t\t\t\t<div><a href=\"http://www.invisionpower.com/download/goiphone.php\">{$this->lang->words['freeiphoneapp']}</a></div>\n\t\t\t\t" : "") . "\n\t\t\t</div>\n\t\t\t<div id='task'>{$stats['task']}</div>\n\t\t</div>\n\t\t<div id='shade' style='display:none'></div>\n\t\t<!-- pre-load -->\n\t\t<div style='display:none'><img src='{style_images_url}/wait.gif' /></div>\n\t</body>\n</html>";
     return $IPBHTML;
 }
示例#18
0
 /**
  * Class entry point
  *
  * @access	public
  * @param	object		Registry reference
  * @return	@e void		[Outputs to screen/redirects]
  */
 public function doExecute(ipsRegistry $registry)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $event_id = intval($this->request['event_id']);
     $rating_id = intval($this->request['rating']);
     $this->registry->class_localization->loadLanguageFile(array('public_calendar'));
     //-----------------------------------------
     // Functions class
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('calendar') . "/sources/functions.php", 'app_calendar_classes_functions', 'calendar');
     $functions = new $classToLoad($this->registry);
     //-----------------------------------------
     // Get data
     //-----------------------------------------
     if (!$event_id) {
         $this->returnJsonArray(array('error_key' => 'topics_no_tid', 'error_code' => '104101.1'));
     }
     $event = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'cal_events', 'where' => 'event_id=' . $event_id));
     if (!$event['event_id']) {
         $this->returnJsonArray(array('error_key' => 'topics_no_tid', 'error_code' => '104102.1'));
     }
     //-----------------------------------------
     // Check permissions
     //-----------------------------------------
     if (!$event['event_approved']) {
         $this->returnJsonArray(array('error_key' => 'topics_no_tid', 'error_code' => '104103.1'));
     }
     if ($event['event_private']) {
         if (!$this->memberData['member_id'] or $this->memberData['member_id'] != $event['event_member_id']) {
             $this->returnJsonArray(array('error_key' => 'topics_no_tid', 'error_code' => '104104.1'));
         }
     }
     if ($event['event_perms'] != '*') {
         $permissionGroups = explode(',', IPSText::cleanPermString($event['event_perms']));
         if (!IPSMember::isInGroup($this->memberData, $permissionGroups)) {
             $this->returnJsonArray(array('error_key' => 'topics_no_tid', 'error_code' => '104105.1'));
         }
     }
     //-----------------------------------------
     // Get our calendar
     //-----------------------------------------
     $calendar = $functions->getCalendar($event['event_calendar_id']);
     if (!$calendar['cal_id'] or $calendar['cal_id'] != $event['event_calendar_id']) {
         $this->returnJsonArray(array('error_key' => 'topics_no_tid', 'error_code' => '104106.1'));
     }
     //-----------------------------------------
     // Can we rate?
     //-----------------------------------------
     $_can_rate = ($this->memberData['member_id'] and $this->registry->permissions->check('rate', $calendar)) ? intval($this->memberData['g_topic_rate_setting']) : 0;
     if (!$_can_rate) {
         $this->returnJsonArray(array('error_key' => 'topic_rate_no_perm', 'error_code' => '104107.1'));
     }
     //-----------------------------------------
     // Sneaky members rating more than 5?
     //-----------------------------------------
     if ($rating_id > 5) {
         $rating_id = 5;
     }
     if ($rating_id < 0) {
         $rating_id = 0;
     }
     //-----------------------------------------
     // Have we rated before?
     //-----------------------------------------
     $rating = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'cal_event_ratings', 'where' => "rating_eid={$event['event_id']} and rating_member_id=" . $this->memberData['member_id']));
     if ($rating['rating_id']) {
         //-----------------------------------------
         // Do we allow re-ratings?
         //-----------------------------------------
         if ($this->memberData['g_topic_rate_setting'] == 2) {
             if ($rating_id != $rating['rating_value']) {
                 $new_rating = $rating_id - $rating['rating_value'];
                 $this->DB->update('cal_event_ratings', array('rating_value' => $rating_id), 'rating_id=' . $rating['rating_id']);
                 $this->DB->update('topics', array('event_rating_total' => intval($event['event_rating_total']) + $new_rating, 'event_rating_avg' => round((intval($event['event_rating_total']) + $new_rating) / $event['event_rating_hits'])), 'event_id=' . $event['event_id']);
             }
             $this->returnJsonArray(array('rated' => 'update', 'message' => $this->lang->words['event_rating_changed'], 'topic_rating_total' => intval($event['event_rating_total']) + $new_rating, 'topic_rating_hits' => $event['event_rating_hits']));
         } else {
             $this->returnJsonArray(array('error_key' => 'topic_rated_already', 'error_code' => 0));
         }
     } else {
         $this->DB->insert('cal_event_ratings', array('rating_eid' => $event['event_id'], 'rating_member_id' => $this->memberData['member_id'], 'rating_value' => $rating_id, 'rating_ip_address' => $this->member->ip_address));
         $this->DB->update('cal_events', array('event_rating_total' => intval($event['event_rating_total']) + $rating_id, 'event_rating_hits' => intval($event['event_rating_hits']) + 1, 'event_rating_avg' => round((intval($event['event_rating_total']) + $rating_id) / (intval($event['event_rating_hits']) + 1))), 'event_id=' . $event_id);
         $this->returnJsonArray(array('rated' => 'new', 'message' => $this->lang->words['event_rating_done'], 'topic_rating_total' => intval($event['event_rating_total']) + $rating_id, 'topic_rating_hits' => intval($event['event_rating_hits']) + 1, '_rate_int' => round((intval($event['event_rating_total']) + $rating_id) / (intval($event['event_rating_hits']) + 1))));
     }
 }
示例#19
0
文件: rsvp.php 项目: mover5/imobackup
 /**
  * Class entry point
  *
  * @access	public
  * @param	object		Registry reference
  * @return	@e void		[Outputs to screen/redirects]
  */
 public function doExecute(ipsRegistry $registry)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $event_id = intval($this->request['event_id']);
     $this->registry->class_localization->loadLanguageFile(array('public_calendar'));
     //-----------------------------------------
     // Functions class
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('calendar') . "/sources/functions.php", 'app_calendar_classes_functions', 'calendar');
     $functions = new $classToLoad($this->registry);
     //-----------------------------------------
     // Get data
     //-----------------------------------------
     if (!$event_id) {
         $this->returnJsonError($this->lang->words['rsvp__no_event']);
     }
     $event = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'cal_events', 'where' => 'event_id=' . $event_id));
     if (!$event['event_id']) {
         $this->returnJsonError($this->lang->words['rsvp__no_event']);
     }
     //-----------------------------------------
     // Check permissions
     //-----------------------------------------
     if (!$event['event_approved']) {
         $this->returnJsonError($this->lang->words['rsvp__no_event']);
     }
     if ($event['event_private']) {
         if (!$this->memberData['member_id'] or $this->memberData['member_id'] != $event['event_member_id']) {
             $this->returnJsonError($this->lang->words['rsvp__no_event']);
         }
     }
     if ($event['event_perms'] != '*') {
         $permissionGroups = explode(',', IPSText::cleanPermString($event['event_perms']));
         if (!IPSMember::isInGroup($this->memberData, $permissionGroups)) {
             $this->returnJsonError($this->lang->words['rsvp__no_event']);
         }
     }
     //-----------------------------------------
     // Get our calendar
     //-----------------------------------------
     $calendar = $functions->getCalendar($event['event_calendar_id']);
     if (!$calendar['cal_id'] or $calendar['cal_id'] != $event['event_calendar_id']) {
         $this->returnJsonError($this->lang->words['rsvp__no_event']);
     }
     //-----------------------------------------
     // Can we RSVP?
     //-----------------------------------------
     $_can_rsvp = ($this->memberData['member_id'] and $this->registry->permissions->check('rsvp', $calendar) and $event['event_rsvp']) ? 1 : 0;
     if (!$_can_rsvp) {
         $this->returnJsonError($this->lang->words['rsvp__no_perm']);
     }
     //-----------------------------------------
     // Have we already RSVP?
     //-----------------------------------------
     $_check = $this->DB->buildAndFetch(array('select' => 'rsvp_id', 'from' => 'cal_event_rsvp', 'where' => 'rsvp_event_id=' . $event['event_id'] . ' AND rsvp_member_id=' . $this->memberData['member_id']));
     if ($_check['rsvp_id']) {
         $this->returnJsonError($this->lang->words['rsvp__already_rsvp']);
     }
     //-----------------------------------------
     // Store RSVP
     //-----------------------------------------
     $_insert = array('rsvp_event_id' => $event['event_id'], 'rsvp_member_id' => $this->memberData['member_id'], 'rsvp_date' => time());
     $this->DB->insert('cal_event_rsvp', $_insert);
     $rsvp_id = $this->DB->getInsertId();
     $this->returnJsonArray(array('html' => $this->registry->output->getTemplate('calendar')->eventAttendee(array_merge(array('rsvp_id' => $rsvp_id, 'rsvp_date' => time()), $this->memberData), $event)));
 }
示例#20
0
 /**
  * Rebuild calendar RSS cache
  *
  * @param	mixed	[$calendar_id]	"all", or a specific calendar ID
  * @return	string	RSS document
  */
 public function rebuildCalendarRSSCache($calendar_id = 'all')
 {
     //-----------------------------------------
     // Ensure calendar is installed
     //-----------------------------------------
     if (!$this->DB->checkForTable('cal_calendars')) {
         return '';
     }
     if (!IPSLib::appIsInstalled('calendar')) {
         $this->cache->setCache('rss_calendar', array(), array('donow' => 1, 'array' => 1));
         return '';
     }
     //-----------------------------------------
     // Init
     //-----------------------------------------
     $seenids = array();
     $cache = array();
     //--------------------------------------------
     // Get classes
     //--------------------------------------------
     $classToLoad = IPSLib::loadActionOverloader(IPSLib::getAppDir('calendar') . '/modules_public/calendar/view.php', 'public_calendar_calendar_view');
     $calendar = new $classToLoad($this->registry);
     $calendar->makeRegistryShortcuts($this->registry);
     if (!$calendar->initCalendar(true, true)) {
         return '';
     }
     $classToLoad = IPSLib::loadLibrary(IPS_KERNEL_PATH . 'classRss.php', 'classRss');
     $class_rss = new $classToLoad();
     $class_rss->doc_type = IPS_DOC_CHAR_SET;
     //-----------------------------------------
     // Get calendars that support RSS and loop
     //-----------------------------------------
     $this->DB->build(array('select' => 'c.*', 'from' => array('cal_calendars' => 'c'), 'where' => 'c.cal_rss_export_days > 0 AND c.cal_rss_export_max > 0 AND c.cal_rss_export=1', 'add_join' => array(array('select' => 'p.*', 'from' => array('permission_index' => 'p'), 'where' => "p.perm_type='calendar' AND perm_type_id=c.cal_id", 'type' => 'left'))));
     $outer = $this->DB->execute();
     while ($row = $this->DB->fetch($outer)) {
         $row['cal_rss_export_max'] = $row['cal_rss_export_max'] ? $row['cal_rss_export_max'] : 10;
         if ($row['cal_rss_export']) {
             $cache[] = array('url' => $this->settings['board_url'] . '/index.php?app=core&amp;module=global&amp;section=rss&amp;type=calendar&amp;id=' . $row['cal_id'], 'title' => $row['cal_title']);
         }
         //-----------------------------------------
         // Are we including events from this calendar?
         //-----------------------------------------
         if ($calendar_id == $row['cal_id'] or $calendar_id == 'all') {
             //-----------------------------------------
             // Start channel
             //-----------------------------------------
             $channel_id = $class_rss->createNewChannel(array('title' => $row['cal_title'], 'link' => $this->registry->output->buildSEOUrl('app=calendar&amp;module=calendar&amp;section=view&amp;cal_id=' . $row['cal_id'], 'publicNoSession', $row['cal_title_seo'], 'cal_calendar'), 'pubDate' => $class_rss->formatDate(time()), 'ttl' => $row['cal_rss_update'] * 60, 'description' => $row['cal_title']));
             //-----------------------------------------
             // Verify if guests can view
             //-----------------------------------------
             if (!$this->registry->permissions->check('view', $row, explode(',', IPSText::cleanPermString($this->caches['group_cache'][$this->settings['guest_group']]['g_perm_id'])))) {
                 continue;
             }
             //-----------------------------------------
             // Sort out date stuff
             //-----------------------------------------
             $row['cal_rss_export_days'] = intval($row['cal_rss_export_days']) + 1;
             $startTime = gmmktime(0, 0, 0, gmstrftime('%m'), 1);
             $endTime = gmmktime(0, 0, 0, gmstrftime('%m'), gmstrftime('%d') + $row['cal_rss_export_days']);
             $nowTime = gmmktime(0, 0, 0, gmstrftime('%m'), gmstrftime('%d') - 1);
             $items = 0;
             list($month, $day, $year) = explode('-', gmstrftime('%m-%d-%Y'));
             //-----------------------------------------
             // Get the events
             //-----------------------------------------
             $calendar->calendarGetEventsSQL($month, $year, array('timenow' => $startTime, 'timethen' => $endTime, 'cal_id' => $row['cal_id']));
             //--------------------------------------------
             // Loop through events and cache
             //--------------------------------------------
             for ($i = 0; $i <= $row['cal_rss_export_days']; $i++) {
                 list($_month, $_day, $_year) = explode('-', gmstrftime('%m-%d-%Y', $nowTime));
                 $eventcache = $calendar->calendarGetDayEvents($_month, $_day, $_year);
                 foreach ($eventcache as $event) {
                     //-----------------------------------------
                     // Hit our max?
                     //-----------------------------------------
                     if ($row['cal_rss_export_max'] <= $items) {
                         break;
                     }
                     //-----------------------------------------
                     // Can guests access?
                     //-----------------------------------------
                     $permissionGroups = explode(',', IPSText::cleanPermString($event['event_perms']));
                     if (!$event['event_approved'] or $event['event_private'] or $event['event_perms'] != '*' and !IPSMember::isInGroup(array('member_group_id' => $this->settings['guest_group']), $permissionGroups)) {
                         continue;
                     }
                     //-----------------------------------------
                     // Check the event and add it
                     //-----------------------------------------
                     if (!in_array($event['event_id'], $seenids)) {
                         if (!$event['event_recurring'] or $calendar->checkRecurring($event, $_month, $_day, $_year)) {
                             $event = $calendar->calendarMakeEventHTML($event, true);
                             if ($event['event']['recurring']) {
                                 $event['event']['event_content'] = $this->registry->output->getTemplate('calendar')->calendar_rss_recurring($event['event']);
                             } else {
                                 if ($event['event']['single']) {
                                     $event['event']['event_content'] = $this->registry->output->getTemplate('calendar')->calendar_rss_single($event['event']);
                                 } else {
                                     $event['event']['event_content'] = $this->registry->output->getTemplate('calendar')->calendar_rss_range($event['event']);
                                 }
                             }
                             //-----------------------------------------
                             // Re-adjust the event time for the RSS feed
                             // to represent the next occurrence of recurring
                             // and ranged events
                             //-----------------------------------------
                             if ($event['event']['event_recurring']) {
                                 $_incrementor = 0;
                                 switch ($event['event']['event_recurring']) {
                                     case 1:
                                         $_incrementor = 604800;
                                         break;
                                     case 2:
                                         $_incrementor = 2592000;
                                         break;
                                     case 3:
                                         $_incrementor = 31536000;
                                         break;
                                 }
                                 if ($event['event']['_start_time'] < gmmktime(0)) {
                                     while ($event['event']['_start_time'] < gmmktime(0)) {
                                         $event['event']['_start_time'] += $_incrementor;
                                     }
                                 }
                             } else {
                                 if ($event['event']['_end_time']) {
                                     if ($event['event']['_start_time'] < gmmktime(0) and $event['event']['_end_time'] > gmmktime(0)) {
                                         while ($event['event']['_start_time'] < gmmktime(0)) {
                                             $event['event']['_start_time'] += 86400;
                                         }
                                     }
                                 }
                             }
                             //-----------------------------------------
                             // Add to the channel
                             //-----------------------------------------
                             $class_rss->addItemToChannel($channel_id, array('title' => $event['event']['event_title'], 'link' => $this->registry->output->buildSEOUrl('app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id=' . $event['event']['event_id'], 'publicNoSession', $event['event']['event_title_seo'], 'cal_event'), 'description' => $event['event']['event_content'], 'pubDate' => $class_rss->formatDate($event['event']['_start_time']), 'guid' => $event['event']['event_id']));
                         }
                         //-----------------------------------------
                         // Increment counters and cache event
                         //-----------------------------------------
                         $seenids[$event['event']['event_id']] = $event['event']['event_id'];
                         $items++;
                     }
                 }
                 $nowTime += 86400;
             }
             //-----------------------------------------
             // Create RSS document
             //-----------------------------------------
             $class_rss->createRssDocument();
             //-----------------------------------------
             // Update calendar RSS cache
             //-----------------------------------------
             $this->DB->update('cal_calendars', array('cal_rss_update_last' => time(), 'cal_rss_cache' => $class_rss->rss_document), 'cal_id=' . $row['cal_id']);
         }
     }
     //-----------------------------------------
     // Update cache and return RSS document
     //-----------------------------------------
     $this->cache->setCache('rss_calendar', $cache, array('donow' => 1, 'array' => 1));
     return $class_rss->rss_document;
 }
示例#21
0
 /**
  * Finish URLs for display
  * Truncates them, applies white/black lists, adds rel / targets
  * @param	string	In
  * @return	string	Out
  */
 protected function _finishUrlsForDisplay($txt)
 {
     /* If HTML mode, don't clean links */
     if (parent::$Perms['parseHtml']) {
         return $txt;
     }
     /* Reset counter */
     $this->cache->updateCacheWithoutSaving('_tmp_bbcode_media', 0);
     /* Parse media URLs that are NOT linked */
     $txt = preg_replace_callback('#(^|\\s|\\)|\\(|\\{|\\}|>|\\]|\\[|;|href=\\S)((http|https|news|ftp)://(?:[^<>\\)\\[\\"\\s]+|[a-zA-Z0-9/\\._\\-!&\\#;,%\\+\\?:=]+))(</a>)?#is', array($this, '_parseMediaUrls_CallBack'), $txt);
     /* LEGACY stuffs - a post from < 3.4 may not be HTMLised properly */
     if ($this->_urlsEnabled === true && preg_match('#(http|https)://#', $txt) && !stristr($txt, '<a')) {
         $txt = $this->_autoLinkUrls($txt);
     }
     preg_match_all('#<a\\s+?(?:[^>]*?)href=["\']([^"\']+?)?["\']([^>]*?)?>(.+?)</a>#is', $txt, $urlMatches);
     /* Finish up URLs and such */
     for ($i = 0; $i < count($urlMatches[0]); $i++) {
         $raw = $urlMatches[0][$i];
         $url = $urlMatches[1][$i];
         $attr = $urlMatches[2][$i];
         $text = $urlMatches[3][$i];
         $done = false;
         $pm = true;
         preg_match('#data-ipb=["\']([^"\']+?)?["\']#i', $raw, $matches);
         if ($matches[1] && stristr($matches[1], 'noparse')) {
             continue;
         } else {
             if ($matches[1] && stristr($matches[1], 'nomediaparse')) {
                 $pm = false;
             }
         }
         preg_match('#rel=["\']([^"\']+?)?["\']#i', $raw, $matches);
         if ($matches[1] && stristr($matches[1], 'lightbox')) {
             continue;
         }
         /* Urls disabled? */
         if ($this->_urlsEnabled !== true) {
             $txt = str_replace($raw, $url, $txt);
             continue;
         }
         /* Restored 1st March, Matt @link http://community.invisionpower.com/resources/bugs.html/_/ip-board/some-previously-embedded-content-youtube-etc-now-showing-as-links-after-upgrade-r41411 */
         /* Is this a media URL? */
         /* Updated 14 May, http://community.invisionpower.com/resources/bugs.html/_/ip-board/url-tags-get-changed-to-media-tags-automatically-r40467 - 
         			Editor now sets "noparsemedia" data-ipb attribute, which we can skip here for automatic parsing */
         if ($pm and $this->settings['bbcode_automatic_media'] and isset($this->_bbcodes['media']) and ($this->_bbcodes['media']['bbcode_sections'] == 'all' or in_array(parent::$Perms['parseArea'], explode(',', $this->_bbcodes['media']['bbcode_sections'])))) {
             $media = $this->cache->getCache('mediatag');
             if ($url == $text && is_array($media) and count($media)) {
                 foreach ($media as $type => $r) {
                     if (preg_match("#^" . $r['match'] . "\$#is", $url)) {
                         $this->cache->updateCacheWithoutSaving('_tmp_autoparse_media', 1);
                         $_result = $this->_parseBBCode('[media]' . $url . '[/media]', 'display', array('media'));
                         $this->cache->updateCacheWithoutSaving('_tmp_autoparse_media', 0);
                         $txt = str_replace($raw, $_result, $txt);
                         $done = true;
                     }
                 }
             }
         }
         /* Format the URL */
         if ($done !== true) {
             // -----------------------------------------
             // URL filtering?
             // -----------------------------------------
             if (!$this->isAllowedUrl($url)) {
                 /* Unlink */
                 $txt = str_replace($raw, $url, $txt);
             }
             // -----------------------------------------
             // Let's remove any nested links..
             // -----------------------------------------
             $text = preg_replace('/<a href=[\'"](.+?)[\'"](.*?)>(.+?)<\\/a>/is', "\\3", $text);
             // -----------------------------------------
             // Need to "truncate" the "content" to ~35
             // EDIT: but only if it's the same as content
             // -----------------------------------------
             /*
              * Changes here @link
              * http://community.invisionpower.com/tracker/issue-36082-long-links-on-mobile-extend-width/   # V V Don't split if URL has entities V V #
              */
             if (empty($this->settings['__noTruncateUrl']) and IPSText::mbstrlen($text) > 38 && !preg_match('#&\\#([0-9]{2,4})#i', $text) and (substr($text, 0, 7) == 'http://' or substr($text, 0, 8) == 'https://')) {
                 $text = htmlspecialchars(IPSText::mbsubstr(html_entity_decode(urldecode($text)), 0, 20)) . '...' . htmlspecialchars(IPSText::mbsubstr(html_entity_decode(urldecode($text)), -15));
             }
             // -----------------------------------------
             // Adding rel='nofollow'?
             // -----------------------------------------
             $rels = array();
             $rel = '';
             $_title = '';
             /* Skipping VigLink? */
             if ($this->settings['viglink_norewrite'] and IPSMember::isInGroup(parent::$Perms['memberData'], explode(',', $this->settings['viglink_norewrite']))) {
                 $rels[] = 'norewrite';
             }
             /* Fetch actual host for better matching */
             $data = @parse_url($url);
             if ($this->settings['posts_add_nofollow']) {
                 if (!stristr($data['host'], $_SERVER['HTTP_HOST'])) {
                     $rels[] = "nofollow";
                 }
             }
             if ($this->settings['links_external']) {
                 if (!stristr($data['host'], $_SERVER['HTTP_HOST'])) {
                     /* Look a little closer */
                     $rels[] = "external";
                     $_title = $this->lang->words['bbc_external_link'];
                 }
             }
             if (count($rels)) {
                 $rel = " rel='" . implode(' ', $rels) . "'";
             }
             $replace = "<a href='{$url}' class='bbc_url' title='{$_title}'{$rel}>{$text}</a>";
             $txt = str_replace($raw, $replace, $txt);
         }
     }
     return $txt;
 }
示例#22
0
 /**
  * Class entry point
  *
  * @access	public
  * @param	object		Registry reference
  * @return	@e void		[Outputs to screen/redirects]
  */
 public function doExecute(ipsRegistry $registry)
 {
     //-----------------------------------------
     // Check key
     //-----------------------------------------
     if ($this->request['secure_key'] != $this->member->form_hash) {
         $this->registry->output->showError('usercp_forums_bad_key', 104100, null, null, 403);
     }
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $event_id = intval($this->request['event_id']);
     $rating_id = intval($this->request['rating']);
     $this->registry->class_localization->loadLanguageFile(array('public_calendar'));
     //-----------------------------------------
     // Functions class
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('calendar') . "/sources/functions.php", 'app_calendar_classes_functions', 'calendar');
     $functions = new $classToLoad($this->registry);
     //-----------------------------------------
     // Get data
     //-----------------------------------------
     if (!$event_id) {
         $this->registry->output->showError('no_event_for_rate', 104101, null, null, 404);
     }
     $event = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'cal_events', 'where' => 'event_id=' . $event_id));
     if (!$event['event_id']) {
         $this->registry->output->showError('no_event_for_rate', 104102, null, null, 404);
     }
     //-----------------------------------------
     // Check permissions
     //-----------------------------------------
     if (!$event['event_approved']) {
         $this->registry->output->showError('no_event_for_rate', 104103, null, null, 404);
     }
     if ($event['event_private']) {
         if (!$this->memberData['member_id'] or $this->memberData['member_id'] != $event['event_member_id']) {
             $this->registry->output->showError('no_event_for_rate', 104104, null, null, 404);
         }
     }
     if ($event['event_perms'] != '*') {
         $permissionGroups = explode(',', IPSText::cleanPermString($event['event_perms']));
         if (!IPSMember::isInGroup($this->memberData, $permissionGroups)) {
             $this->registry->output->showError('no_event_for_rate', 104105, null, null, 404);
         }
     }
     //-----------------------------------------
     // Get our calendar
     //-----------------------------------------
     $calendar = $functions->getCalendar($event['event_calendar_id']);
     if (!$calendar['cal_id'] or $calendar['cal_id'] != $event['event_calendar_id']) {
         $this->registry->output->showError('no_event_for_rate', 104106, null, null, 404);
     }
     //-----------------------------------------
     // Can we rate?
     //-----------------------------------------
     $_can_rate = ($this->memberData['member_id'] and $this->registry->permissions->check('rate', $calendar)) ? intval($this->memberData['g_topic_rate_setting']) : 0;
     if (!$_can_rate) {
         $this->registry->output->showError('no_rate_permission', 104107, null, null, 403);
     }
     //-----------------------------------------
     // Sneaky members rating more than 5?
     //-----------------------------------------
     if ($rating_id > 5) {
         $rating_id = 5;
     }
     if ($rating_id < 0) {
         $rating_id = 0;
     }
     //-----------------------------------------
     // Have we rated before?
     //-----------------------------------------
     $rating = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'cal_event_ratings', 'where' => "rating_eid={$event['event_id']} and rating_member_id=" . $this->memberData['member_id']));
     if ($rating['rating_id']) {
         //-----------------------------------------
         // Do we allow re-ratings?
         //-----------------------------------------
         if ($this->memberData['g_topic_rate_setting'] == 2) {
             if ($rating_id != $rating['rating_value']) {
                 $new_rating = $rating_id - $rating['rating_value'];
                 $this->DB->update('cal_event_ratings', array('rating_value' => $rating_id), 'rating_id=' . $rating['rating_id']);
                 $this->DB->update('cal_events', array('event_rating_total' => intval($event['event_rating_total']) + $new_rating, 'event_rating_avg' => round((intval($event['event_rating_total']) + $new_rating) / $event['event_rating_hits'])), 'event_id=' . $event['event_id']);
             }
             $this->registry->output->redirectScreen($this->lang->words['event_rating_changed'], $this->settings['base_url'] . "app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id={$event['event_id']}", $event['event_title_seo'], 'cal_event');
         } else {
             $this->registry->output->redirectScreen($this->lang->words['event_rated_already'], $this->settings['base_url'] . "app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id={$event['event_id']}", $event['event_title_seo'], 'cal_event');
         }
     } else {
         $this->DB->insert('cal_event_ratings', array('rating_eid' => $event['event_id'], 'rating_member_id' => $this->memberData['member_id'], 'rating_value' => $rating_id, 'rating_ip_address' => $this->member->ip_address));
         $this->DB->update('cal_events', array('event_rating_total' => intval($event['event_rating_total']) + $rating_id, 'event_rating_hits' => intval($event['event_rating_hits']) + 1, 'event_rating_avg' => round((intval($event['event_rating_total']) + $rating_id) / (intval($event['event_rating_hits']) + 1))), 'event_id=' . $event_id);
     }
     $this->registry->output->redirectScreen($this->lang->words['event_rating_done'], $this->settings['base_url'] . "app=calendar&amp;module=calendar&amp;section=view&amp;do=showevent&amp;event_id={$event['event_id']}", $event['event_title_seo'], 'cal_event');
 }
示例#23
0
 /**
  * Check permissions for "can report"
  *
  * @param	string	$className	Report center class name
  * @return	@e bool
  */
 public function canReport($className)
 {
     if (!$this->caches['report_plugins'][$className]['com_id']) {
         return false;
     }
     if (IPSMember::isInGroup($this->memberData, explode(',', IPSText::cleanPermString($this->caches['report_plugins'][$className]['group_can_report'])))) {
         return true;
     }
     return false;
 }
示例#24
0
 /**
  * Class entry point
  *
  * @param	object		Registry reference
  * @return	@e void		[Outputs to screen]
  */
 public function doExecute(ipsRegistry $registry)
 {
     //-----------------------------------------
     // Init
     //-----------------------------------------
     /* Do we even have warnings enabled? */
     if (!$this->settings['warn_on']) {
         $this->registry->output->showError('no_permission', 10260, null, null, 403);
     }
     /* Load the member */
     $memberId = intval($this->request['member']);
     $this->_member = IPSMember::load($memberId);
     if (!$this->_member['member_id']) {
         $this->_member = $this->memberData;
     }
     /* Is this user protected? */
     if ($this->settings['warn_protected']) {
         if (IPSMember::isInGroup($this->_member, explode(',', $this->settings['warn_protected']))) {
             $this->registry->output->showError('warn_protected_member', 10265, null, null, 403);
         }
     }
     /* Can we view? */
     $pass = FALSE;
     $this->canWarn = FALSE;
     $modType = NULL;
     if ($this->memberData['member_id']) {
         if ($this->memberData['g_is_supmod']) {
             $pass = TRUE;
             $this->canWarn = TRUE;
             $modType = 'warn_gmod_day';
         } elseif ($this->memberData['is_mod']) {
             $other_mgroups = array();
             $_other_mgroups = IPSText::cleanPermString($this->memberData['mgroup_others']);
             if ($_other_mgroups) {
                 $other_mgroups = explode(",", $_other_mgroups);
             }
             $other_mgroups[] = $this->memberData['member_group_id'];
             $this->DB->build(array('select' => '*', 'from' => 'moderators', 'where' => "(member_id='" . $this->memberData['member_id'] . "' OR (is_group=1 AND group_id IN(" . implode(",", $other_mgroups) . ")))"));
             $this->DB->execute();
             while ($this->moderator = $this->DB->fetch()) {
                 if ($this->moderator['allow_warn']) {
                     $pass = TRUE;
                     $this->canWarn = TRUE;
                     $modType = 'warn_mod_day';
                     break;
                 }
             }
         }
         if (!$pass && $this->memberData['member_id'] == $this->_member['member_id']) {
             if ($this->settings['warn_show_own'] || $this->canWarn || in_array($this->request['do'], array('acknowledge', 'do_acknowledge'))) {
                 $pass = TRUE;
             }
         }
     }
     if (!$pass) {
         $this->registry->output->showError('no_permission', 10262, null, null, 403);
     }
     /* Are we limited per day? */
     if ($this->canWarn and !$this->memberData['g_access_cp'] and $this->settings[$modType] != -1) {
         $count = $this->DB->buildAndFetch(array('select' => 'count(*) as dracula', 'from' => 'members_warn_logs', 'where' => "wl_moderator={$this->memberData['member_id']} AND wl_member={$this->_member['member_id']} AND wl_date>" . (time() - 86400)));
         if ($count['dracula'] >= $this->settings[$modType]) {
             $this->canWarn = FALSE;
         }
     }
     /* Load reasons */
     $this->DB->build(array('select' => '*', 'from' => 'members_warn_reasons', 'order' => 'wr_order'));
     $this->DB->execute();
     while ($row = $this->DB->fetch()) {
         $this->reasons[$row['wr_id']] = $row;
     }
     /* Output init */
     $this->registry->class_localization->loadLanguageFile(array('public_profile'), 'members');
     $this->registry->output->addNavigation("{$this->lang->words['page_title_pp']}: {$this->_member['members_display_name']}", "showuser={$this->_member['member_id']}", $this->_member['members_seo_name'], 'showuser');
     $this->registry->output->addNavigation($this->lang->words['warnings'], "app=members&module=profile&section=warnings&member={$this->_member['member_id']}");
     //-----------------------------------------
     // What are we doing?
     //-----------------------------------------
     switch ($this->request['do']) {
         case 'add':
             $this->form();
             break;
         case 'save':
             $this->save();
             break;
         case 'acknowledge':
             $this->acknowledge();
             break;
         case 'do_acknowledge':
             $this->doAcknowledge();
             break;
         default:
             $this->viewWarnings();
             break;
     }
     //-----------------------------------------
     // Output
     //-----------------------------------------
     $this->registry->output->sendOutput();
 }
示例#25
0
 function portalPage($output, $tabs = array(), $_activeNav = array())
 {
     $IPBHTML = "";
     if (IPSLib::locationHasHooks('skin_modcp', $this->_funcHooks['portalPage'])) {
         $count_4b0815a22323ae41fee4cea611d36d08 = is_array($this->functionData['portalPage']) ? count($this->functionData['portalPage']) : 0;
         $this->functionData['portalPage'][$count_4b0815a22323ae41fee4cea611d36d08]['output'] = $output;
         $this->functionData['portalPage'][$count_4b0815a22323ae41fee4cea611d36d08]['tabs'] = $tabs;
         $this->functionData['portalPage'][$count_4b0815a22323ae41fee4cea611d36d08]['_activeNav'] = $_activeNav;
     }
     $IPBHTML .= "<h1 class='ipsType_pagetitle'>{$this->lang->words['modcp_page_title']}</h1>\n<br />\n<div class='ipsBox'>\n\t<div class='ipsVerticalTabbed ipsLayout ipsLayout_withleft ipsLayout_smallleft clearfix'>\n\t\t<div class='ipsVerticalTabbed_tabs ipsLayout_left' id='modcp_tabs'>\n\t\t\t<ul class='clear'>\n\t\t\t\t<li id='index' class='" . ($_activeNav['primary'] == 'index' && $_activeNav['secondary'] == 'index' ? "active " : "") . "tab_toggle'>\n\t\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=modcp", "public", ''), "", "") . "'>{$this->lang->words['modcp_tab_index']}</a>\n\t\t\t\t</li>\n\t\t\t\t" . (IPSMember::isInGroup($this->memberData, explode(',', IPSText::cleanPermString($this->settings['report_mod_group_access']))) ? "<li id='reported_content' class='" . ($_activeNav['primary'] == 'reported_content' && $_activeNav['secondary'] == 'reports' ? "active " : "") . "tab_toggle'>\n\t\t\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=reports&amp;do=index", "public", ''), "", "") . "'>{$this->lang->words['modcp_tab_reports']}</a>\n\t\t\t\t\t</li>" : "") . "\n\t\t\t\t" . $this->__f__6bf8cc55ec9f44287662e825eacb265d($output, $tabs, $_activeNav) . "\t\t\t</ul>\n\t\t</div>\n\t\t<div class='ipsVerticalTabbed_content ipsLayout_content ipsBox_container' id='modcp_content'>\n\t\t\t<div class='ipsPad'>\n\t\t\t\t{$output}\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n<script type='text/javascript'>\n\t\$(\"modcp_content\").setStyle( { minHeight: \$('modcp_tabs').measure('margin-box-height') + 5 + \"px\" } );\n</script>";
     return $IPBHTML;
 }
示例#26
0
 /**
  * Main function for making reports and uses the custom plugins
  *
  * @return	@e void
  */
 public function _initReportForm()
 {
     //-----------------------------------------
     // Make sure we have an rcom
     //-----------------------------------------
     $rcom = IPSText::alphanumericalClean($this->request['rcom']);
     if (!$rcom) {
         $this->registry->output->showError('reports_what_now', 10134);
     }
     //-----------------------------------------
     // Request plugin info from database
     //-----------------------------------------
     $row = $this->caches['report_plugins'][$rcom];
     if (!$row['com_id']) {
         $this->registry->output->showError('reports_what_now', 10135);
     } else {
         //-----------------------------------------
         // Can this group report this type of page?
         //-----------------------------------------
         if (!$row['my_class'] or !IPSMember::isInGroup($this->memberData, explode(',', IPSText::cleanPermString($row['group_can_report'])))) {
             $this->registry->output->showError('reports_cant_report', 10136, null, null, 403);
         }
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('core') . '/sources/classes/reportNotifications.php', 'reportNotifications');
         $notify = new $classToLoad($this->registry);
         //-----------------------------------------
         // Let's get cooking! Load the plugin
         //-----------------------------------------
         $this->registry->getClass('reportLibrary')->loadPlugin($row['my_class'], $row['app']);
         if (!is_object($this->registry->getClass('reportLibrary')->plugins[$row['my_class']])) {
             $this->registry->output->showError('reports_no_plugin', 10136.1, null, null, 403);
         }
         //-----------------------------------------
         // Process 'extra data' for the plugin
         //-----------------------------------------
         if ($row['extra_data'] && $row['extra_data'] != 'N;') {
             $this->registry->getClass('reportLibrary')->plugins[$row['my_class']]->_extra = unserialize($row['extra_data']);
         } else {
             $this->registry->getClass('reportLibrary')->plugins[$row['my_class']]->_extra = array();
         }
         $send_code = intval($this->request['send']);
         if ($send_code == 0) {
             //-----------------------------------------
             // Request report form from plugin
             //-----------------------------------------
             $this->output .= $this->registry->getClass('reportLibrary')->plugins[$row['my_class']]->reportForm($row);
         } else {
             //-----------------------------------------
             // Form key not valid
             //-----------------------------------------
             if ($this->request['k'] != $this->member->form_hash) {
                 $this->registry->getClass('output')->showError('no_permission', 20114, null, null, 403);
             }
             //-----------------------------------------
             // Check Captcha
             //-----------------------------------------
             if (!$this->memberData['member_id'] and $this->settings['guest_captcha'] and $this->settings['bot_antispam_type'] != 'none') {
                 if (!$this->registry->getClass('class_captcha')->validate()) {
                     $this->registry->output->showError('posting_bad_captcha', '20116', null, null, 403);
                 }
             }
             //-----------------------------------------
             // Empty report
             //-----------------------------------------
             if (!trim(strip_tags($this->request['message']))) {
                 $this->registry->output->showError('reports_cant_empty', 10181);
             }
             //-----------------------------------------
             // Sending report... do necessary things
             //-----------------------------------------
             $report_data = $this->registry->getClass('reportLibrary')->plugins[$row['my_class']]->processReport($row);
             $this->registry->getClass('reportLibrary')->updateCacheTime();
             //-----------------------------------------
             // Send out notfications...
             //-----------------------------------------
             $notify->initNotify($this->registry->getClass('reportLibrary')->plugins[$row['my_class']]->getNotificationList(IPSText::cleanPermString($row['mod_group_perm']), $report_data), $report_data);
             $notify->sendNotifications();
             //-----------------------------------------
             // Redirect...
             //-----------------------------------------
             $this->registry->getClass('reportLibrary')->plugins[$row['my_class']]->reportRedirect($report_data);
         }
     }
 }
示例#27
0
 /**
  * Fetch navigation tabs
  *
  * @return	@e array
  */
 public function core_fetchApplicationData()
 {
     $tabs = array();
     /* Check for cache */
     if (!isset($this->caches['navigation_tabs']) or !count($this->caches['navigation_tabs'])) {
         $this->registry->cache()->rebuildCache('navigation_tabs', 'global');
         $this->caches['navigation_tabs'] = $this->registry->cache()->getCache('navigation_tabs');
     }
     foreach ($this->caches['navigation_tabs'] as $tab) {
         if (IPSLib::appIsInstalled($tab['app']) !== TRUE) {
             continue;
         }
         /* Sort if we can view that tab */
         $show = TRUE;
         if ($tab['app'] == 'core' or ipsRegistry::$applications[$tab['app']]['app_hide_tab'] or count($tab['groups']) and !IPSMember::isInGroup($this->memberData, array_diff(array_keys($this->caches['group_cache']), $tab['groups']))) {
             $show = FALSE;
         }
         /* Mark tab as active? */
         $active = FALSE;
         if (ipsRegistry::$current_application == $tab['app']) {
             if ($tab['module']) {
                 if (ipsRegistry::$current_module == $tab['module']) {
                     $active = TRUE;
                 }
             } else {
                 $active = TRUE;
             }
         }
         /* Sort out link */
         $link = '';
         $template = '';
         switch ($tab['app']) {
             case 'forums':
                 $link = 'act=idx';
                 break;
             case 'members':
                 $link = 'app=members&amp;module=list';
                 $template = 'members_list';
                 break;
             default:
                 $link = "app={$tab['app']}";
                 if ($tab['module']) {
                     $link .= "&amp;module={$tab['module']}";
                 }
                 /* http://community.invisionpower.com/resources/bugs.html/_/ip-board/ips-default-public-app-and-navigation-r41028 */
                 if ($tab['app'] == IPS_DEFAULT_PUBLIC_APP) {
                     $link = "";
                 }
                 break;
         }
         $tabs[$tab['app']] = array('app_dir' => $tab['app'], 'app_module' => $tab['module'], 'app_title' => $tab['title'], 'app_show' => $show, 'app_active' => $active, 'app_link' => $link, 'app_seotitle' => 'false', 'app_template' => $template, 'app_base' => 'public');
     }
     return $tabs;
 }
示例#28
0
文件: post.php 项目: mover5/imobackup
 /**
  * Form for creating/modifying calendar events
  *
  * @param	string  $type  Either add or edit
  * @return	@e void
  */
 public function calendarEventForm($type = 'add')
 {
     //-----------------------------------------
     // Init
     //-----------------------------------------
     $event_id = $this->request['event_id'] ? intval($this->request['event_id']) : 0;
     $calendar_jump = $this->functions->getCalendarJump($this->calendar['cal_id'], array('start'));
     $group_select = '';
     $allDay = 1;
     //-----------------------------------------
     // Output stuff
     //-----------------------------------------
     $this->registry->output->addToDocumentHead('javascript', "{$this->settings['js_base_url']}js/3rd_party/calendar_date_select/calendar_date_select.js");
     if ($this->settings['calendar_date_select_locale'] and $this->settings['calendar_date_select_locale'] != 'en') {
         $this->registry->output->addToDocumentHead('javascript', "{$this->settings['js_base_url']}js/3rd_party/calendar_date_select/locale/{$this->settings['calendar_date_select_locale']}.js");
     }
     $this->registry->output->addToDocumentHead('javascript', "{$this->settings['js_base_url']}js/3rd_party/calendar_date_select/format_{$this->settings['cal_date_format']}.js");
     $this->registry->output->addToDocumentHead('importcss', "{$this->settings['css_base_url']}style_css/{$this->registry->output->skin['_csscacheid']}/calendar_select.css");
     //-----------------------------------------
     // Adding or editing?
     //-----------------------------------------
     if ($type == 'add') {
         if ($this->timezone) {
             $_offset = $this->timezone * 3600;
         }
         $nd = $this->request['d'] ? str_pad($this->request['d'], 2, '0', STR_PAD_LEFT) : gmstrftime('%d', time() + $_offset);
         $nm = $this->request['m'] ? str_pad($this->request['m'], 2, '0', STR_PAD_LEFT) : gmstrftime('%m', time() + $_offset);
         $ny = $this->request['y'] ? $this->request['y'] : gmstrftime('%Y', time() + $_offset);
         $nh = $this->settings['cal_time_format'] == 'standard' ? gmstrftime('%I', time() + $_offset) : gmstrftime('%H', time() + $_offset);
         $nmi = '00';
         $nap = gmstrftime('%p', time() + $_offset);
         $_fauxEndTime = strtotime("now + 2 hours");
         $fd = gmstrftime('%d', $_fauxEndTime + $_offset);
         $fm = gmstrftime('%m', $_fauxEndTime + $_offset);
         $fy = gmstrftime('%Y', $_fauxEndTime + $_offset);
         $fh = $this->settings['cal_time_format'] == 'standard' ? gmstrftime('%I', $_fauxEndTime + $_offset) : gmstrftime('%H', $_fauxEndTime + $_offset);
         $fmi = '00';
         $fap = gmstrftime('%p', $_fauxEndTime + $_offset);
         $_setEndTime = false;
         $event = array('event_smilies' => 1, 'event_content' => '', 'event_timeset' => '', 'event_recurring' => 0, 'event_id' => 0, 'event_post_key' => $this->request['post_key'] ? $this->request['post_key'] : md5(uniqid(microtime(), true)));
     } else {
         //-----------------------------------------
         // Get event
         //-----------------------------------------
         if (!$event_id) {
             $this->registry->output->showError('calendar_event_not_found', 1048, null, null, 404);
         }
         $event = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'cal_events', 'where' => 'event_id=' . $event_id));
         if (!$event['event_id']) {
             $this->registry->output->showError('calendar_event_not_found', 1049, null, null, 404);
         }
         //-----------------------------------------
         // Check permissions
         //-----------------------------------------
         if ($event['event_perms'] != '*') {
             $permissionGroups = explode(',', IPSText::cleanPermString($event['event_perms']));
             if (!IPSMember::isInGroup($this->memberData, $permissionGroups)) {
                 $this->registry->output->showError('calendar_event_not_found', 10411, null, null, 404);
             }
         }
         if (!$this->memberData['g_is_supmod'] and $this->memberData['member_id'] != $event['event_member_id']) {
             $this->registry->output->showError('calendar_no_edit_perm', 10410, null, null, 403);
         }
         //-----------------------------------------
         // Date stuff
         //-----------------------------------------
         $_eventStart = strtotime($event['event_start_date']);
         $_eventEnd = ($event['event_end_date'] and $event['event_end_date'] != '0000-00-00 00:00:00') ? strtotime($event['event_end_date']) : 0;
         //-----------------------------------------
         // Apply timezone offset for editing user
         //-----------------------------------------
         if ($this->timezone and !$event['event_all_day']) {
             $_eventStart += $this->timezone * 3600;
             $_eventEnd = $_eventEnd ? $_eventEnd + $this->timezone * 3600 : 0;
         }
         $_hour = $this->settings['cal_time_format'] == 'standard' ? '%I' : '%H';
         list($nd, $nm, $ny, $nh, $nmi, $nap, $_nh) = explode('-', gmstrftime("%d-%m-%Y-{$_hour}-%M-%p-%H", $_eventStart));
         if ($_eventEnd) {
             list($fd, $fm, $fy, $fh, $fmi, $fap) = explode('-', gmstrftime("%d-%m-%Y-{$_hour}-%M-%p", $_eventEnd));
             $_setEndTime = true;
         } else {
             $fd = $fm = $fy = $fh = $fmi = $fap = 0;
             $_setEndTime = false;
         }
         $allDay = $event['event_all_day'];
     }
     //-----------------------------------------
     // If we are previewing, reset..
     //-----------------------------------------
     if ($this->request['preview']) {
         $event['event_title'] = $this->request['event_title'];
         $event['event_recurring'] = $this->request['set_recurfields'] ? $this->request['recur_unit'] : 0;
         $event['event_private'] = $this->request['e_type'] == 'public' ? 0 : 1;
         $event['event_smilies'] = $this->request['event_smilies'];
         $event['event_content'] = $_POST['Post'];
         $event['event_perms'] = count($this->request['e_groups']) ? implode(",", $this->request['e_groups']) : '*';
         $_ndate = $this->request['start_date'];
         $_stTime = explode(':', $this->request['start_time']);
         $nh = $_stTime[0];
         $nmi = $_stTime[1];
         $nap = $this->request['start_time_ampm'];
         $_edate = $this->request['end_date'];
         $_etTime = explode(':', $this->request['end_time']);
         $fh = $_etTime[0];
         $fmi = $_etTime[1];
         $fap = $this->request['end_time_ampm'];
         $allDay = $this->request['all_day'];
         $_setEndTime = $this->request['set_enddate'];
         $this->timezone = $this->request['event_timezone'];
     }
     //-----------------------------------------
     // Time zone dropdown
     //-----------------------------------------
     $_timeZoneOptions = '';
     foreach ($this->lang->words as $_key => $_word) {
         if (preg_match("/^time_(-?[\\d\\.]+)\$/", $_key, $match)) {
             $_timeZoneOptions .= "<option value='{$match[1]}'" . ($this->timezone == $match[1] ? " selected='selected'" : '') . ">{$_word}</option>\n";
         }
     }
     //-----------------------------------------
     // Get editor
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite');
     $editor = new $classToLoad();
     //-----------------------------------------
     // Build group select menu
     //-----------------------------------------
     if ($this->memberData['g_access_cp']) {
         foreach ($this->caches['group_cache'] as $r) {
             $selected = IPSMember::isInGroup(array('member_group_id' => $r['g_id'], 'mgroup_others' => ''), explode(',', IPSText::cleanPermString($event['event_perms'])), false) ? " selected='selected'" : '';
             $group_select .= "<option value='" . $r['g_id'] . "'" . $selected . ">" . $r['g_title'] . "</option>\n";
         }
     }
     //-----------------------------------------
     // Unparse event content for editing
     //-----------------------------------------
     if ($event['event_content']) {
         $editor->setContent($event['event_content'], 'calendar');
     }
     //-----------------------------------------
     // Get attachments class
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php', 'class_attach');
     $class_attach = new $classToLoad($this->registry);
     $class_attach->type = 'event';
     $class_attach->attach_post_key = $event['event_post_key'];
     $class_attach->init();
     $class_attach->getUploadFormSettings();
     //-----------------------------------------
     // Date (formatted based on setting)
     //-----------------------------------------
     if (!$this->request['preview']) {
         switch ($this->settings['cal_date_format']) {
             case 'american':
             default:
                 $_ndate = $nm . '/' . $nd . '/' . $ny;
                 $_edate = $fm ? $fm . '/' . $fd . '/' . $fy : '';
                 break;
             case 'danish':
                 $_ndate = $ny . '/' . $nm . '/' . $nd;
                 $_edate = $fm ? $fy . '/' . $fm . '/' . $fd : '';
                 break;
             case 'italian':
                 $_ndate = $nd . '/' . $nm . '/' . $ny;
                 $_edate = $fm ? $fd . '/' . $fm . '/' . $fy : '';
                 break;
             case 'db':
                 $_ndate = $ny . '-' . $nm . '-' . $nd;
                 $_edate = $fm ? $fy . '-' . $fm . '-' . $fd : '';
                 break;
         }
     }
     //-----------------------------------------
     // Output
     //-----------------------------------------
     $this->output .= $this->registry->output->getTemplate('calendar')->calendarEventForm(array('event' => $event, 'calendar' => $this->calendar, 'code' => $type == 'edit' ? 'doedit' : 'addnewevent', 'jump' => $calendar_jump, 'timezone' => $this->timezone, '_time_zones' => $_timeZoneOptions, '_can_set_rsvp' => $this->registry->permissions->check('askrsvp', $this->calendar), 'dates' => array('nd' => $nd, 'nm' => $nm, 'ny' => $ny, 'nh' => $nh, 'nmi' => $nmi, 'nap' => $nap, 'fd' => $fd, 'fm' => $fm, 'fy' => $fy, 'fh' => $fh, 'fmi' => $fmi, 'fap' => $fap, 'allday' => $allDay, 'enddate' => $_setEndTime, 'ndate' => $_ndate, 'edate' => $_edate), '_groupSelect' => $group_select, 'editor' => $editor->show('Post'), 'button' => $type == 'edit' ? $this->lang->words['calendar_edit_submit'] : $this->lang->words['calendar_submit'], 'uploadForm' => $this->memberData['g_attach_max'] != -1 ? $this->registry->getClass('output')->getTemplate('post')->uploadForm($event['event_post_key'], 'event', $class_attach->attach_stats, $event['event_id'], 0) : ""));
     $this->registry->output->addNavigation($this->lang->words['post_new_event']);
 }