本文整理汇总了PHP中IPSLib::getEnabledApplications方法的典型用法代码示例。如果您正苦于以下问题:PHP IPSLib::getEnabledApplications方法的具体用法?PHP IPSLib::getEnabledApplications怎么用?PHP IPSLib::getEnabledApplications使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPSLib
的用法示例。
在下文中一共展示了IPSLib::getEnabledApplications方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _showPane
/**
* Show the panel to select your media
*
* @return @e void
*/
protected function _showPane()
{
//-----------------------------------------
// Loop through apps and collect tabs
//-----------------------------------------
$_plugins = array();
$_tabs = array();
foreach (IPSLib::getEnabledApplications() as $application) {
if (is_dir(IPSLib::getAppDir($application['app_directory']) . '/extensions/sharedmedia')) {
try {
foreach (new DirectoryIterator(IPSLib::getAppDir($application['app_directory']) . '/extensions/sharedmedia') as $file) {
if (!$file->isDot() && $file->isFile()) {
if (preg_match('/^plugin_(.+?)\\.php$/', $file->getFileName(), $matches)) {
$classToLoad = IPSLib::loadLibrary($file->getPathName(), 'plugin_' . $application['app_directory'] . '_' . $matches[1], $application['app_directory']);
$_plugins[$application['app_directory']][$matches[1]] = new $classToLoad($this->registry);
if ($_plugins[$application['app_directory']][$matches[1]]->getTab()) {
$_tabs[] = array('app' => $application['app_directory'], 'plugin' => $matches[1], 'title' => $_plugins[$application['app_directory']][$matches[1]]->getTab());
}
}
}
}
} catch (Exception $e) {
}
}
}
return $this->returnJsonArray(array('html' => $this->registry->output->getTemplate('editors')->sharedMedia($_tabs)));
}
示例2: getCloudData
/**
* Fetches a single random image (few holes)
* @param array $album
* @return string
*/
public function getCloudData($data)
{
$where = $data['where'];
$limit = $data['limit'];
foreach (IPSLib::getEnabledApplications() as $app) {
$_apps[] = "'" . $app['app_directory'] . "'";
}
$where[] = "tag_meta_app IN (" . implode(",", $_apps) . ")";
$where = count($where) ? ' ' . implode(' AND ', $where) : ' 1=1 ';
$prefix = $this->tbl;
$this->DB->allow_sub_select = true;
$query = "SELECT t.tag_text, COUNT(t.tag_text) as times, t.tag_meta_app, t.tag_meta_area\n\t\t\t\t\tFROM {$prefix}core_tags t WHERE " . $where . "\n\t\t\t\t\tAND t.tag_aai_lookup IN( SELECT p.tag_perm_aai_lookup FROM {$prefix}core_tags_perms p WHERE\n\t\t\t\t " . $this->DB->buildWherePermission($this->member->perm_id_array, 'p.tag_perm_text', true) . " AND p.tag_perm_visible=1 ) GROUP BY t.tag_text";
if (!empty($limit[0]) || !empty($limit[1])) {
$query .= "\n ORDER BY times DESC\nLIMIT " . $limit[0] . ", " . $limit[1];
} else {
$query .= "\n ORDER BY NULL";
}
return $query;
}
示例3: manage
/**
* Manage
*/
public function manage()
{
$enhancements = array();
foreach (IPSLib::getEnabledApplications() as $app) {
if (is_dir(IPSLib::getAppDir($app['app_directory']) . '/extensions/enhancements')) {
$dir = new DirectoryIterator(IPSLib::getAppDir($app['app_directory']) . '/extensions/enhancements');
foreach ($dir as $file) {
if ($file->isFile() and !$file->isDot() and substr($file, 0, 1) !== '.' and substr($file, -4) === '.php') {
$className = "enhancements_{$app['app_directory']}_" . str_replace('.php', '', $file->getFilename());
/* Backup system isn't ready */
if ($className == 'enhancements_core_ipsbackup') {
continue;
}
$classToLoad = IPSLib::loadLibrary($file->getPathName(), $className);
$enhancements[$className] = new $classToLoad($this->registry);
}
}
}
}
uasort($enhancements, create_function('$a, $b', 'return $a->title > $b->title;'));
$this->registry->output->html .= $this->html->communityEnhancements($enhancements);
}
示例4: setUpSecondaryGroups
/**
* Set up a member's secondary groups
*
* @param array $data Member data
* @return @e array Member data with secondary group perms set properly
*/
public static function setUpSecondaryGroups($data)
{
if (!empty($data['mgroup_others'])) {
$cache = ipsRegistry::cache()->getCache('group_cache');
$groups_id = explode(',', $data['mgroup_others']);
$exclude = array('g_id', 'g_title', 'g_icon', 'prefix', 'suffix', 'g_promotion', 'g_photo_max_vars');
$less_is_more = array('g_search_flood');
$neg1_is_best = array();
$zero_is_best = array('g_attach_max', 'g_attach_per_post', 'g_edit_cutoff', 'g_max_messages', 'g_pm_perday', 'g_pm_flood_mins', 'g_displayname_unit', 'g_sig_unit', 'g_mod_preview', 'g_ppd_limit', 'g_ppd_unit', 'gbw_no_status_update', 'g_max_bgimg_upload', 'gbw_disable_prefixes', 'gbw_disable_tagging');
$special = array('g_signature_limits', 'g_dname_date', 'g_dname_changes', 'g_mod_post_unit', 'gbw_mod_post_unit_type');
//-----------------------------------------
// Merge in per-app group overrides
//-----------------------------------------
foreach (IPSLib::getEnabledApplications() as $application) {
if (!empty($application['extensions']['groupOptions'])) {
if (!empty($application['extensions']['groupOptions']['neg1_is_best']) and is_array($application['extensions']['groupOptions']['neg1_is_best'])) {
$neg1_is_best = array_merge($neg1_is_best, $application['extensions']['groupOptions']['neg1_is_best']);
}
if (!empty($application['extensions']['groupOptions']['zero_is_best']) and is_array($application['extensions']['groupOptions']['zero_is_best'])) {
$zero_is_best = array_merge($zero_is_best, $application['extensions']['groupOptions']['zero_is_best']);
}
if (!empty($application['extensions']['groupOptions']['less_is_more']) and is_array($application['extensions']['groupOptions']['less_is_more'])) {
$less_is_more = array_merge($less_is_more, $application['extensions']['groupOptions']['less_is_more']);
}
if (!empty($application['extensions']['groupOptions']['exclude']) and is_array($application['extensions']['groupOptions']['exclude'])) {
$exclude = array_merge($exclude, $application['extensions']['groupOptions']['exclude']);
}
}
}
//-----------------------------------------
// Merge permissions
//-----------------------------------------
if (count($groups_id)) {
foreach ($groups_id as $pid) {
if (empty($cache[$pid]['g_id'])) {
continue;
}
//-----------------------------------------
// Loop through and mix
//-----------------------------------------
foreach ($cache[$pid] as $k => $v) {
if (!in_array($k, $exclude)) {
//-----------------------------------------
// Add to perm id list
//-----------------------------------------
if ($k == 'g_perm_id') {
$data['g_perm_id'] .= ',' . $v;
} else {
if (in_array($k, $zero_is_best)) {
if (empty($data[$k])) {
continue;
} else {
if ($v == 0) {
$data[$k] = 0;
} else {
if ($v > $data[$k]) {
$data[$k] = $v;
}
}
}
} else {
if (in_array($k, $neg1_is_best)) {
if ($data[$k] == -1) {
continue;
} else {
if ($v == -1) {
$data[$k] = -1;
} else {
if ($v > $data[$k]) {
$data[$k] = $v;
}
}
}
} else {
if (in_array($k, $less_is_more)) {
if ($v < $data[$k]) {
$data[$k] = $v;
}
} else {
if (in_array($k, $special)) {
switch ($k) {
case 'g_signature_limits':
//-----------------------------------------
// No limits should win out
//-----------------------------------------
if (!$data[$k]) {
continue;
}
//-----------------------------------------
// We have limits
//-----------------------------------------
if ($v) {
$values = explode(':', $v);
$_cur = explode(':', $data[$k]);
//.........这里部分代码省略.........
示例5: doExecute
/**
* Main function executed automatically by the controller
*
* @param object $registry Registry object
* @return @e void
*/
public function doExecute(ipsRegistry $registry)
{
//-----------------------------------------
// Load basic things
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile(array('public_reports'));
$this->DB->loadCacheFile(IPSLib::getAppDir('core') . '/sql/' . ips_DBRegistry::getDriverType() . '_report_queries.php', 'report_sql_queries');
$classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('core') . '/sources/classes/reportLibrary.php', 'reportLibrary');
$this->registry->setClass('reportLibrary', new $classToLoad($this->registry));
//-----------------------------------------
// Check permissions...
//-----------------------------------------
if ($this->request['do'] and $this->request['do'] != 'report' and !IPSMember::isInGroup($this->memberData, explode(',', IPSText::cleanPermString($this->settings['report_mod_group_access'])))) {
$this->registry->output->showError('no_reports_permission', 2018, true, null, 403);
}
$this->registry->output->setTitle($this->lang->words['main_title'] . ' - ' . ipsRegistry::$settings['board_name']);
//-----------------------------------------
// Which road are we going to take?
//-----------------------------------------
switch ($this->request['do']) {
default:
case 'report':
$this->_initReportForm();
break;
case 'showMessage':
$this->_viewReportedMessage();
break;
case 'index':
$this->_displayReportCenter();
break;
case 'process':
$this->_processReports();
break;
case 'findfirst':
$this->findFirstReport();
break;
case 'show_report':
$this->_displayReport();
break;
}
if ($this->request['do'] and $this->request['do'] != 'report') {
/* Init some data */
$_tabs = array();
$_activeNav = array('primary' => 'reported_content', 'secondary' => 'reports');
$moderator = $this->registry->class_forums->getModerator();
$this->registry->class_localization->loadLanguageFile(array('public_modcp'), 'core');
/**
* Loop through all apps and get plugins
*
* @note When updating this code below remember to update also the core in public_core_modcp_modcp
*/
foreach (IPSLib::getEnabledApplications() as $appDir => $appData) {
if (is_dir(IPSLib::getAppDir($appDir) . '/extensions/modcp')) {
try {
foreach (new DirectoryIterator(IPSLib::getAppDir($appDir) . '/extensions/modcp') as $file) {
if (!$file->isDot() && $file->isFile()) {
if (preg_match("/^plugin_(.+?)\\.php\$/", $file->getFileName(), $matches)) {
//-----------------------------------------
// We load each plugin so it can determine
// if it should show based on permissions
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary($file->getPathName(), 'plugin_' . $appDir . '_' . $matches[1], $appDir);
$_plugins[$appDir][$matches[1]] = new $classToLoad($this->registry);
if ($_plugins[$appDir][$matches[1]]->canView($moderator)) {
//-----------------------------------------
// Hacky solution - we want forum plugins to
// come first as they're the most used
//-----------------------------------------
if ($appDir == 'forums' and !empty($_tabs[$_plugins[$appDir][$matches[1]]->getPrimaryTab()])) {
array_unshift($_tabs[$_plugins[$appDir][$matches[1]]->getPrimaryTab()], array($_plugins[$appDir][$matches[1]]->getSecondaryTab(), $appDir, $matches[1]));
} else {
$_tabs[$_plugins[$appDir][$matches[1]]->getPrimaryTab()][] = array($_plugins[$appDir][$matches[1]]->getSecondaryTab(), $appDir, $matches[1]);
}
}
}
}
}
} catch (Exception $e) {
}
}
}
// Move trash can to the bottom - if available
if (isset($_tabs['deleted_content'])) {
$trashCan = $_tabs['deleted_content'];
unset($_tabs['deleted_content']);
$_tabs['deleted_content'] = $trashCan;
}
$this->output = $this->registry->output->getTemplate('modcp')->portalPage($this->output, $_tabs, $_activeNav);
}
//-----------------------------------------
// Output
//-----------------------------------------
$this->registry->getClass('output')->addContent($this->output);
$this->registry->output->sendOutput();
//.........这里部分代码省略.........
示例6: viewFollowedContent
/**
* View content you are following
*
* @author Brandon Farber
* @param string $error Error message
* @return @e void
*/
public function viewFollowedContent($error = '')
{
IPSSearchRegistry::set('in.search_app', $this->request['search_app']);
IPSSearchRegistry::set('opt.searchType', 'titles');
IPSSearchRegistry::set('opt.noPostPreview', true);
$results = array();
$formatted = array();
$count = 0;
//-----------------------------------------
// Determine content type
//-----------------------------------------
$contentTypes = IPSSearchRegistry::get('config.followContentTypes');
//-----------------------------------------
// Verify likes are available
//-----------------------------------------
if (count(IPSLib::getEnabledApplications('like')) and count($contentTypes) and IPSLib::appIsInstalled(IPSSearchRegistry::get('in.search_app'), true)) {
//-----------------------------------------
// What content type?
//-----------------------------------------
$_type = '';
if ($this->request['contentType'] and in_array($this->request['contentType'], $contentTypes)) {
$_type = $this->request['contentType'];
} else {
$_type = $contentTypes[0];
}
$this->request['contentType'] = $_type;
IPSSearchRegistry::set('in.followContentType', $this->request['contentType']);
/* Fetch like class */
try {
require_once IPS_ROOT_PATH . 'sources/classes/like/composite.php';
/*noLibHook*/
$this->_like = classes_like::bootstrap(IPSSearchRegistry::get('in.search_app'), $_type);
} catch (Exception $e) {
/* Fail safe... */
$this->registry->output->addNavigation($this->lang->words['followed_ct_title'], '');
$this->title = $this->lang->words['followed_ct_title'];
$this->output .= $this->registry->output->getTemplate('search')->followedContentView(array(), '', 0, $error, $contentTypes);
}
/* Do we have some custom join and sort data? */
if (method_exists($this->_like, 'getSearchJoinAndSortBy')) {
$custom = $this->_like->getSearchJoinAndSortBy();
$countQ = array('select' => 'COUNT(*) as er', 'from' => array('core_like' => 'l'), 'where' => 'like_member_id=' . $this->memberData['member_id'] . " AND like_visible=1 AND like_app='" . IPSSearchRegistry::get('in.search_app') . "' AND like_area='" . $_type . "'");
if ($custom['from']) {
$countQ['add_join'][] = array('from' => $custom['from'], 'where' => $custom['where']);
}
if ($custom['order']) {
$countQ['order'] = $custom['order'] . ' DESC';
}
if ($custom['extraWhere']) {
$countQ['where'] .= ' AND ' . $custom['extraWhere'];
}
$count = $this->DB->buildAndFetch($countQ);
$count = $count['er'];
$q = array('select' => 'l.*', 'from' => array('core_like' => 'l'), 'where' => 'l.like_member_id=' . $this->memberData['member_id'] . " AND l.like_visible=1 AND l.like_app='" . IPSSearchRegistry::get('in.search_app') . "' AND l.like_area='" . $_type . "'", 'limit' => array(IPSSearchRegistry::get('in.start'), IPSSearchRegistry::get('opt.search_per_page')), 'order' => 'like_added DESC');
if ($custom['from']) {
$q['add_join'][] = array('from' => $custom['from'], 'where' => $custom['where']);
}
if ($custom['order']) {
$q['order'] = $custom['order'] . ' DESC';
}
if ($custom['extraWhere']) {
$q['where'] .= ' AND ' . $custom['extraWhere'];
}
$this->DB->build($q);
} else {
$count = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as er', 'from' => 'core_like', 'where' => 'like_member_id=' . $this->memberData['member_id'] . " AND like_visible=1 AND like_app='" . IPSSearchRegistry::get('in.search_app') . "' AND like_area='" . $_type . "'"));
$count = $count['er'];
$this->DB->build(array('select' => '*', 'from' => 'core_like', 'where' => 'like_member_id=' . $this->memberData['member_id'] . " AND like_visible=1 AND like_app='" . IPSSearchRegistry::get('in.search_app') . "' AND like_area='" . $_type . "'", 'limit' => array(IPSSearchRegistry::get('in.start'), IPSSearchRegistry::get('opt.search_per_page')), 'order' => 'like_added DESC'));
}
$outer = $this->DB->execute();
while ($r = $this->DB->fetch($outer)) {
$results[] = $r['like_rel_id'];
$formatted[$r['like_id']] = $r;
}
/* Process */
$results = $this->searchController->fetchFollowedContentOutput($results, $formatted);
$pages = $this->registry->getClass('output')->generatePagination(array('totalItems' => $count, 'itemsPerPage' => IPSSearchRegistry::get('opt.search_per_page'), 'currentStartValue' => IPSSearchRegistry::get('in.start'), 'baseUrl' => "app=core&module=search&do=followed&search_app=" . IPSSearchRegistry::get('in.search_app') . '&sid=' . $this->request['_sid'] . "&contentType=" . $this->request['contentType']));
} else {
$count = 0;
$results = array();
}
/* Output */
$this->registry->output->addNavigation($this->lang->words['followed_ct_title'], '');
$this->title = $this->lang->words['followed_ct_title'];
$this->output .= $this->registry->output->getTemplate('search')->followedContentView($results, $pages, $count, $error, $contentTypes);
}
示例7: hookSidebarProfile
function hookSidebarProfile($author = array())
{
$IPBHTML = "";
if (IPSLib::locationHasHooks('skin_boards', $this->_funcHooks['hookSidebarProfile'])) {
$count_bfcfe5d42d57144d1b6e99bab2989ca3 = is_array($this->functionData['hookSidebarProfile']) ? count($this->functionData['hookSidebarProfile']) : 0;
$this->functionData['hookSidebarProfile'][$count_bfcfe5d42d57144d1b6e99bab2989ca3]['author'] = $author;
}
$IPBHTML .= "<!-- ::: Sidebar profilis - pradžia kodo ::: -->\n\n<td>\n<div id='content3'>\n" . ($this->memberData['member_id'] ? "<div class='ipsSideBlock clearfix'" . (($this->memberData['is_mod'] or !empty($this->memberData['access_report_center']) || ($this->memberData['g_access_cp'] and !$this->settings['security_remove_acp_link'])) ? "" : "") . "'>\n <h3>{$this->lang->words['info_hytext']}, <a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("showuser={$this->memberData['member_id']}", "public", ''), "{$this->memberData['members_seo_name']}", "showuser") . "\" title='{$this->lang->words['your_profile']}'> {$this->memberData['members_display_name']}</a></h3>\n<div class='_sbcollapsable'>\n\n<center>\n<a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("showuser={$this->memberData['member_id']}", "public", ''), "{$this->memberData['members_seo_name']}", "showuser") . "\" title='{$this->lang->words['your_profile']}'>\n<div class=\"align: center\"><img src='{$this->memberData['pp_small_photo']}' alt=\"" . sprintf($this->lang->words['users_photo'], $this->memberData['members_display_name']) . "\" class='ipsUserPhotoSidebare ipsUserPhoto_profileside photo' /></a><br />\n<br /><div class=\"titlebgg\">{$this->memberData['g_title']}</div>\n</div><br />\n\n</center>\n<h2 style=\"text-align:left;text-indent:0px;position:absolute;left:10px;right:10px;\">{$this->lang->words['info_profinfo']}<ul class='ipsList_inline right'>\n\n " . (!(!$this->memberData['member_id'] && $this->settings['force_login']) && !($this->settings['board_offline'] && !$this->memberData['g_access_offline']) ? "\n <a href=\"?app=members&module=messaging\"><img src=\"http://community.invisionpower.com/filestore/public/style_images/master/email.png\" /></a>\n \n <li><a href=\"?app=core&module=usercp&tab=core&area=notificationlog\"><img src=\"http://community.invisionpower.com/filestore/public/style_images/master/bell.png\" /></a></li>\n " : "") . "</ul></h2>\n<br><br><br /><br />\n<div class=\"extraUserInfo\">\n\n <dl class=\"pairsJustified\">\n <li class=\"post_count desc lighter\">\n <dt>{$this->lang->words['info_postcont']}:</dt>\n <dd><div class='textbordg'>{$this->memberData['posts']}</div></dd>\n </li>\n </dl>\n <dl class=\"pairsJustified\">\n <li class=\"post_count desc lighter\">\n <dt>{$this->lang->words['info_profview']}:</dt>\n <dd><div class=\"textbordg\">{$this->memberData['members_profile_views']}</div></dd>\n </li>\n </dl>\n <dl class=\"pairsJustified\">\n <li class=\"post_count desc lighter\">\n <dt>ID:</dt>\n <dd><div class=\"textbordg\">{$this->memberData['member_id']}</div></dd>\n </li>\n </dl>\n <dl class=\"pairsJustified\">\n <li class=\"post_count desc lighter\">\n <dt>{$this->lang->words['info_regdate']}:</dt>\n <dd><div class=\"textbordg\">" . IPSText::htmlspecialchars($this->registry->getClass('class_localization')->getDate($this->memberData['joined'], "long", 0)) . "</div></dd>\n </li>\n </dl>\n\n<dl class=\"pairsJustified\">\n <li class=\"post_count desc lighter\">\n <dt>{$this->lang->words['info_repsize']}:</dt>\n <dd><div class=\"textbordg\">{$this->memberData['pp_reputation_points']}</div></dd>\n </li>\n </dl>\n \n</div>\n<br /><br /><br />\n<div class='left quicklinks'>\n<h2 style=\"text-align:left;text-indent:0px;position:absolute;left:10px;right:10px;\">Навигация</h2>\n <ul style='list-style: none;margin-top:32px;margin-bottom:10px;'>\n <br />\n<dl class=\"pairsJustified\">\n<dl class=\"pairsJustified\"></dl>\n<li class=\"post_count desc lighter\"><dt>\n <li id='user_ucp'><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&module=usercp", "public", ''), "", "") . "\" title=\"{$this->lang->words['cp_tool_tip']}\">{$this->lang->words['your_cp']}</a></li>\n</li></dt></li>\n </dl></dl>\n<dl class=\"pairsJustified\">\n<li class=\"post_count desc lighter\"><dt>\n <li id='user_content'><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&module=search&do=user_activity&mid={$this->memberData['member_id']}", "public", ''), "", "") . "\" title=\"{$this->lang->words['my_content_link']}\">{$this->lang->words['my_content_link']}</a></li></dt></li>\n</dl>\n<dl class=\"pairsJustified\">\n<li class=\"post_count desc lighter\"><dt>\n " . (count(IPSLib::getEnabledApplications('like')) ? "\n <li id='user_likes'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&module=search&do=followed", "public", ''), "", "") . "' title='{$this->lang->words['your_likes']}'>{$this->lang->words['your_likes']}</a></li></dt></li>\n</dl>\n " : "") . "\n<dl class=\"pairsJustified\">\n<li class=\"post_count desc lighter\"><dt>\n " . ($this->settings['friends_enabled'] && $this->memberData['g_can_add_friends'] ? "\n <li id='user_friends'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&module=profile&section=friends&do=list", "public", ''), "", "") . "' title=\"{$this->lang->words['manage_friends']}\" class='manage_friends'>{$this->lang->words['manage_friends']}</a></li></dt></li>\n </dl>" : "") . "\n<dl class=\"pairsJustified\">\n<li class=\"post_count desc lighter\"><dt>\n <li id='user_enemies'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&module=usercp&tab=core&area=ignoredusers", "public", ''), "", "") . "' title=\"{$this->lang->words['manage_ignored_users']}\" class='manage_enemies'>{$this->lang->words['manage_ignored_users']}</a></li></dl></dt></li>\n<dl class=\"pairsJustified\">\n<li class=\"post_count desc lighter\"><dt>\n " . (($this->memberData['has_blog'] and IPSLib::appIsInstalled('blog')) ? "\n <li id='user_blog'><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=blog&module=manage", "public", ''), "false", "manageblog") . "\">{$this->lang->words['manage_blogs']}</a></li></dl></dt></li>\n " : "") . "\n " . ($this->memberData['members_disable_pm'] != 2 && $this->memberData['g_use_pm'] ? "\n <li id='user_pm'><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&module=messaging", "public", ''), "", "") . "\">{$this->lang->words['user_dd_go_pm']}</a></li>\n " : "") . "\n<li class=\"post_count desc lighter\"><dt>\n " . (($this->memberData['has_gallery'] and IPSLib::appIsInstalled('gallery')) ? "\n <li id='user_gallery'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=gallery&user={$this->memberData['member_id']}", "public", ''), "{$this->memberData['members_seo_name']}", "useralbum") . "' title=\"{$this->lang->words['go_to_my_gallery']}\">{$this->lang->words['my_gallery']}</a></li></dt></li>\n " : "") . "\n " . (IPSLib::appIsInstalled('nexus') ? "\n <li id='user_nexus'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=nexus&module=clients", "public", ''), "", "") . "' title=\"{$this->lang->words['client_area']}\">{$this->lang->words['client_area']}</a></li>\n " : "") . "\n</ul>\n</div>\n<br>\n<br>\n<br>\n<table style='align:center;width:100%;'>\n<!-- <td>\n<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("showuser={$this->memberData['member_id']}", "public", ''), "{$this->memberData['members_seo_name']}", "showuser") . "' title='{$this->lang->words['your_profile']}'><div class='positiv'>{$this->lang->words['my_profile']}</div></a>\n</td>--><td> \n<a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&module=global&section=login&do=logout&k={$this->member->form_hash}", "public", ''), "", "") . "\" title='{$this->lang->words['log_out']}'><div class='singout'>{$this->lang->words['log_out']}</div></a>\n</td></table>\n<br>\n" . (($this->memberData['is_mod'] or !empty($this->memberData['access_report_center']) || ($this->memberData['g_access_cp'] and !$this->settings['security_remove_acp_link'])) ? "<table style=\"align:center;width:100%;\">\n<tbody><tr><td> \n<a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&module=modcp", "public", ''), "", "") . "\" title='{$this->lang->words['gbl_modcp_link']}'><div class=\"mini-positiv\">{$this->lang->words['gbl_modcp_link']}</div></a>\n</td>" . (($this->memberData['g_access_cp'] and !$this->settings['security_remove_acp_link']) ? "<td>\n<a href=\"{$this->settings['_admin_link']}\" title='{$this->lang->words['admin_cp']}' target=\"_blank\"><div class=\"mini-error\">{$this->lang->words['login_to_acp']}</div></a>\n</td>" : "") . "\n" . ($this->memberData['access_report_center'] && $this->memberData['_cache']['report_num'] > 0 ? "\n<td>\n<a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&module=reports&do=index", "public", ''), "", "") . "\" title='{$this->lang->words['view_reports']}'><div class=\"mini-error\">{$this->memberData['_cache']['report_num']} {$this->lang->words['report_member_bar']}</div></a>\n</td>" : "") . "\n\n</tr></tbody></table>" : "") . "\n</div>\n</div>\n</div>" : "") . " \n <!-- ::: Sidebar profilis - pabaiga kodo ::: -->";
return $IPBHTML;
}
示例8: getNotificationPanelEntries
/**
* Builds a list of nag panel entries
*
* @return array
*/
public function getNotificationPanelEntries()
{
/* INIT */
$entries = array();
/* Look for notification classes */
foreach (IPSLib::getEnabledApplications() as $r) {
/* Notification Class */
$_file = IPSLib::getAppDir($r['app_directory']) . '/extensions/dashboardNotifications.php';
/* Look for the file */
if (is_file($_file)) {
/* Get the file */
$_class = IPSLib::loadLibrary($_file, 'dashboardNotifications__' . $r['app_directory'], $r['app_directory']);
/* Look for the class */
if (class_exists($_class)) {
/* Create the object */
$notifyObj = new $_class();
/* Look for the method */
if (method_exists($notifyObj, 'get')) {
/* Get the entries */
$_entries = $notifyObj->get();
if (is_array($_entries) && count($_entries)) {
$entries = array_merge($entries, $_entries);
}
}
}
}
}
/* Return entries */
return $entries;
}
示例9: fetchOutput
/**
* Fetches the output
*
* @access public
* @param string Output gathered
* @param string Title of the document
* @param array Navigation gathered
* @param array Array of document head items
* @param array Array of JS loader items
* @param array Array of extra data
* @return string Output to be printed to the client
*/
public function fetchOutput($output, $title, $navigation, $documentHeadItems, $jsLoaderItems, $extraData = array())
{
//-----------------------------------------
// INIT
//-----------------------------------------
$system_vars_cache = $this->caches['systemvars'];
$pmData = FALSE;
$notificationLatest = array();
//-----------------------------------------
// NORMAL
//-----------------------------------------
if ($this->_outputType == 'normal') {
//-----------------------------------------
// Do we have a notification show?
//-----------------------------------------
if (!empty($this->memberData['msg_show_notification']) and $this->memberData['_cache']['show_notification_popup']) {
if (!$this->settings['board_offline'] or $this->memberData['g_access_offline']) {
if (strpos(ipsRegistry::$settings['query_string_real'], 'module=messaging') === false) {
IPSMember::save($this->memberData['member_id'], array('core' => array('msg_show_notification' => 0)));
/* Grab inline notifications... */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications');
$notifyLibrary = new $classToLoad($this->registry);
$notifyLibrary->setMember($this->memberData);
$tmp = $notifyLibrary->getLatestNotificationForInlinePopUp();
$weNeed = array('notify_title', 'member_member_id', 'member_PhotoTag', 'member_members_display_name', 'date_parsed', 'title', 'url', 'type', 'content', 'member_HoverCard');
foreach ($weNeed as $k) {
$notificationLatest[$k] = $tmp[$k];
}
}
}
}
//-----------------------------------------
// Add identifier URL
//-----------------------------------------
$http = 'http://';
if (strpos($this->settings['board_url'], 'https://') === 0) {
$http = 'https://';
}
$this->addMetaTag('identifier-url', $http . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
//-----------------------------------------
// Add in task image?
//-----------------------------------------
$task = '';
$system_vars_cache['task_next_run'] = isset($system_vars_cache['task_next_run']) ? $system_vars_cache['task_next_run'] : 0;
if (!$this->settings['task_use_cron'] and time() >= $system_vars_cache['task_next_run'] or defined('FORCE_TASK_KEY')) {
$_url = !$this->registry->getClass('output')->isHTTPS ? $this->settings['base_url'] : $this->settings['base_url_https'];
$task = "<div><img src='" . $_url . "app=core&module=task' alt='' style='border: 0px;height:1px;width:1px;' /></div>";
}
//-----------------------------------------
// Grab output
//-----------------------------------------
/* Inline msg */
$inlineMsg = $this->member->sessionClass()->getInlineMessage();
$templateName = 'globalTemplate';
$templateGroup = 'global';
if ($this->useMinimalWrapper) {
$templateName = 'globalTemplateMinimal';
$templateGroup = 'global_other';
}
/* Do pagination */
if (strstr($title, '<%pageNumber%>')) {
$replace = $this->_current_page_title ? ' ' . $this->lang->words['page_title_page'] . ' ' . $this->_current_page_title : '';
$title = str_replace('<%pageNumber%>', $replace, $title);
} else {
if ($this->_current_page_title) {
$title = $title . ' ' . $this->lang->words['page_title_page'] . ' ' . $this->_current_page_title;
}
}
$finalOutput = $this->output->getTemplate($templateGroup)->{$templateName}($output, $documentHeadItems, $this->_css, $jsLoaderItems, $this->_metaTags, array('title' => $title, 'applications' => $this->core_fetchApplicationData(), 'page' => $this->_current_page_title, 'notifications' => $notificationLatest ? IPSText::jsonEncodeForTemplate($notificationLatest) : '', 'inlineMsg' => $inlineMsg), array('navigation' => $navigation, 'adHeaderCode' => !empty($extraData['adHeaderCode']) ? $extraData['adHeaderCode'] : '', 'adFooterCode' => !empty($extraData['adFooterCode']) ? $extraData['adFooterCode'] : ''), array('time' => $this->registry->getClass('class_localization')->getDate(time(), 'SHORT', 1), 'mark_read_apps' => IPSLib::getEnabledApplications('itemMarking'), 'lang_chooser' => $this->html_buildLanguageDropDown(), 'skin_chooser' => $this->html_fetchSetsDropDown(), 'copyright' => $this->html_fetchCopyright()), array('ex_time' => (isset($this->request['faster']) and $this->request['faster'] == 'yes') ? $this->_getFasterText() : sprintf("%.4f", IPSDebug::endTimer()), 'gzip_status' => $this->settings['disable_gzip'] == 1 ? $this->lang->words['gzip_off'] : $this->lang->words['gzip_on'], 'server_load' => ipsRegistry::$server_load, 'queries' => $this->DB->getQueryCount(), 'task' => $task));
} else {
if ($this->_outputType == 'redirect') {
$extraData['full'] = 1;
# SEO?
if ($extraData['seoTitle']) {
$extraData['url'] = $this->output->buildSEOUrl($extraData['url'], 'none', $extraData['seoTitle'], $extraData['seoTemplate']);
}
$finalOutput = $this->output->getTemplate('global_other')->redirectTemplate($documentHeadItems, $this->_css, $jsLoaderItems, $extraData['text'], $extraData['url'], $extraData['full']);
} else {
if ($this->_outputType == 'popup') {
$finalOutput = $this->output->getTemplate('global_other')->displayPopUpWindow($documentHeadItems, $this->_css, $jsLoaderItems, $title, $output);
}
}
}
//-----------------------------------------
// Set a class on the body for print
//-----------------------------------------
if ($this->_printOnly) {
$finalOutput = str_replace("<body", "<body class='printpreview'", $finalOutput);
//.........这里部分代码省略.........
示例10: forumSave
/**
* Save the forum
*
* @param string $type [new|edit]
* @return @e void
*/
public function forumSave($type = 'new')
{
/* If this is not a redirect forum anymore empty the redirect url - #35126 */
if ($this->request['forum_type'] != 'redirect') {
$this->request['redirect_url'] = '';
}
//-----------------------------------------
// Converting the type?
//-----------------------------------------
if ($this->request['convert']) {
$this->forumForm($type, 1);
return;
}
//-----------------------------------------
// INIT
//-----------------------------------------
$this->request['name'] = trim($this->request['name']);
$this->request['f'] = intval($this->request['f']);
$this->request['parent_id'] = !empty($this->request['parent_id']) ? intval($this->request['parent_id']) : -1;
$forum_cat_lang = intval($this->request['parent_id']) == -1 ? $this->lang->words['for_iscat_y'] : $this->lang->words['for_iscat_n'];
//-----------------------------------------
// Auth check...
//-----------------------------------------
$this->registry->adminFunctions->checkSecurityKey();
//-----------------------------------------
// Check
//-----------------------------------------
if ($this->request['name'] == "") {
$this->registry->output->global_message = sprintf($this->lang->words['for_entertitle'], mb_strtolower($forum_cat_lang));
$this->forumForm($type);
return;
}
//-----------------------------------------
// Are we trying to do something stupid
// like running with scissors or moving
// the parent of a forum into itself
// spot?
//-----------------------------------------
if ($this->request['parent_id'] != $this->registry->getClass('class_forums')->forum_by_id[$this->request['f']]['parent_id']) {
$ids = $this->registry->getClass('class_forums')->forumsGetChildren($this->request['f']);
$ids[] = $this->request['f'];
if (in_array($this->request['parent_id'], $ids)) {
$this->registry->output->global_error = $this->lang->words['for_whymovethere'];
$this->forumForm($type);
return;
}
}
//if( $this->request['parent_id'] < 1 )
//{
// $this->request['sub_can_post'] = 1;
//}
//-----------------------------------------
// Save array
//-----------------------------------------
$save = array('name' => IPSText::getTextClass('bbcode')->xssHtmlClean(nl2br(IPSText::stripslashes($_POST['name']))), 'name_seo' => IPSText::makeSeoTitle(strip_tags(IPSText::UNhtmlspecialchars($this->request['name']))), 'description' => IPSText::getTextClass('bbcode')->xssHtmlClean(nl2br(IPSText::stripslashes($_POST['description']))), 'use_ibc' => isset($this->request['use_ibc']) ? intval($this->request['use_ibc']) : 1, 'use_html' => intval($this->request['use_html']), 'password' => $this->request['password'], 'password_override' => is_array($this->request['password_override']) ? implode(",", $this->request['password_override']) : '', 'sort_key' => $this->request['sort_key'], 'sort_order' => $this->request['sort_order'], 'prune' => intval($this->request['prune']), 'topicfilter' => $this->request['topicfilter'], 'preview_posts' => intval($this->request['preview_posts']), 'allow_poll' => intval($this->request['allow_poll']), 'allow_pollbump' => intval($this->request['allow_pollbump']), 'forum_allow_rating' => intval($this->request['forum_allow_rating']), 'inc_postcount' => intval($this->request['inc_postcount']), 'parent_id' => intval($this->request['parent_id']), 'sub_can_post' => intval($this->request['sub_can_post']), 'redirect_on' => intval($this->request['redirect_on']), 'redirect_hits' => intval($this->request['redirect_hits']), 'redirect_url' => $this->request['redirect_url'], 'notify_modq_emails' => $this->request['notify_modq_emails'], 'permission_showtopic' => $this->request['parent_id'] == -1 ? 1 : intval($this->request['permission_showtopic']), 'min_posts_post' => intval($this->request['min_posts_post']), 'min_posts_view' => intval($this->request['min_posts_view']), 'can_view_others' => intval($this->request['can_view_others']), 'hide_last_info' => intval($this->request['hide_last_info']), 'disable_sharelinks' => intval($this->request['disable_sharelinks']), 'tag_predefined' => $this->request['tag_predefined'], 'forums_bitoptions' => IPSBWOPtions::freeze($this->request, 'forums', 'forums'), 'permission_custom_error' => nl2br(IPSText::stripslashes($_POST['permission_custom_error'])), 'ipseo_priority' => $this->request['ipseo_priority'], 'viglink' => intval($this->request['viglink']));
/* Save data from application tabs */
IPSLib::loadInterface('admin/forum_form.php');
$_forumPlugins = array();
foreach (IPSLib::getEnabledApplications() as $app_dir => $app_data) {
if (is_file(IPSLib::getAppDir($app_dir) . '/extensions/admin/forum_form.php')) {
$_class = IPSLib::loadLibrary(IPSLib::getAppDir($app_dir) . '/extensions/admin/forum_form.php', 'admin_forum_form__' . $app_dir, $app_dir);
$_forumPlugins[$_class] = new $_class($this->registry);
$remote = $_forumPlugins[$_class]->getForSave();
$save = array_merge($save, $remote);
}
}
//-----------------------------------------
// ADD
//-----------------------------------------
if ($type == 'new') {
$this->DB->build(array('select' => 'MAX(id) as top_forum', 'from' => 'forums'));
$this->DB->execute();
$row = $this->DB->fetch();
if ($row['top_forum'] < 1) {
$row['top_forum'] = 0;
}
$row['top_forum']++;
/* Forum Information */
//$save['id'] = $row['top_forum'];
$save['position'] = $row['top_forum'];
$save['topics'] = 0;
$save['posts'] = 0;
$save['last_post'] = 0;
$save['last_poster_id'] = 0;
$save['last_poster_name'] = "";
/* Insert the record */
$this->DB->insert('forums', $save);
$forum_id = $this->DB->getInsertId();
/* Permissions */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_public_permissions.php', 'classPublicPermissions');
$permissions = new $classToLoad(ipsRegistry::instance());
$permissions->savePermMatrix($this->request['perms'], $forum_id, 'forum');
if (!$save['can_view_others']) {
$this->DB->update('permission_index', array('owner_only' => 1), "app='forums' AND perm_type='forum' AND perm_type_id={$forum_id}");
//.........这里部分代码省略.........
示例11: doExecute
/**
* Main class entry point
*
* @param object ipsRegistry reference
* @return @e void [Outputs to screen]
*/
public function doExecute(ipsRegistry $registry)
{
//-----------------------------------------
// INIT
//-----------------------------------------
$_thisNav = array();
//-----------------------------------------
// Load language
//-----------------------------------------
$this->registry->getClass('class_localization')->loadLanguageFile(array('public_usercp'));
//-----------------------------------------
// Logged in?
//-----------------------------------------
if (!$this->memberData['member_id']) {
$this->registry->getClass('output')->silentRedirect($this->settings['base_url'] . '&app=core&module=global§ion=login&do=form');
exit;
}
//-----------------------------------------
// Make sure they're clean
//-----------------------------------------
$this->request['tab'] = IPSText::alphanumericalClean($this->request['tab']);
$this->request['area'] = IPSText::alphanumericalClean($this->request['area']);
//-----------------------------------------
// Set up some basics...
//-----------------------------------------
$_TAB = $this->request['tab'] ? $this->request['tab'] : 'core';
$_AREA = $this->request['area'] ? $this->request['area'] : 'settings';
$_DO = $this->request['do'] ? $this->request['do'] : 'show';
$_FUNC = $_DO == 'show' ? 'showForm' : ($_DO == 'save' ? 'saveForm' : $_DO);
$tabs = array();
$errors = array();
//-----------------------------------------
// Got a plug in?
//-----------------------------------------
IPSLib::loadInterface('interface_usercp.php');
$EXT_DIR = IPSLib::getAppDir($_TAB) . '/extensions';
if (!is_file($EXT_DIR . '/usercpForms.php')) {
$this->registry->getClass('output')->showError('usercp_bad_tab', 10147);
exit;
}
//-----------------------------------------
// Cycle through applications and load
// usercpForm extensions
//-----------------------------------------
foreach (IPSLib::getEnabledApplications() as $app_dir => $app_data) {
$ext_dir = IPSLib::getAppDir($app_dir) . '/extensions';
// Make sure the extension exists
if (!is_file($ext_dir . '/usercpForms.php')) {
continue;
}
$__class = IPSLib::loadLibrary($ext_dir . '/usercpForms.php', 'usercpForms_' . $app_dir, $app_dir);
if (!class_exists($__class)) {
continue;
}
$_usercp_module = new $__class();
/* Block based on version to prevent old files showing up/causing an error */
if (!$_usercp_module->version or $_usercp_module->version < 32) {
continue;
}
$_usercp_module->makeRegistryShortcuts($this->registry);
if (is_callable(array($_usercp_module, 'init'))) {
$_usercp_module->init();
/* Set default area? */
if ($_TAB == $app_dir and !isset($_REQUEST['area'])) {
if (isset($_usercp_module->defaultAreaCode)) {
$this->request['area'] = $_AREA = $_usercp_module->defaultAreaCode;
}
}
}
if (is_callable(array($_usercp_module, 'getLinks'))) {
$tabs[$app_dir]['_menu'] = $_usercp_module->getLinks();
/* Got any links? */
if (!is_array($tabs[$app_dir]['_menu']) || !count($tabs[$app_dir]['_menu'])) {
unset($tabs[$app_dir]);
continue;
}
/* Get title */
$tabs[$app_dir]['_name'] = $_usercp_module->tab_name ? $_usercp_module->tab_name : IPSLib::getAppTitle($app_dir);
/* Add in 'last' element */
$tabs[$app_dir]['_menu'][count($tabs[$app_dir]['_menu']) - 1]['last'] = 1;
/* This nav? */
if (!count($_thisNav) and $app_dir == $_TAB) {
foreach ($tabs[$app_dir]['_menu'] as $_navData) {
if ($_navData['url'] == 'area=' . $_AREA) {
$_thisNav = array('app=core&module=usercp&tab=' . $_TAB . '&area=' . $_AREA, $_navData['title']);
}
}
}
}
}
//-----------------------------------------
// Set up basic navigation
//-----------------------------------------
$this->_nav[] = array($this->lang->words['t_title'], '&app=core&module=usercp');
//.........这里部分代码省略.........
示例12: return_html_block
/**
* Feturn HTML block
*
* @param array Member information
* @return string HTML block
*/
public function return_html_block($member = array())
{
//-----------------------------------------
// Get supported applications
//-----------------------------------------
$supportedApps = array();
foreach (IPSLib::getEnabledApplications() as $app) {
$file = IPSLib::getAppDir($app['app_directory']) . '/extensions/reputation.php';
if (is_file($file)) {
require_once $file;
/*maybeLibHook*/
if (class_exists('reputation_' . $app['app_directory'])) {
$supportedApps[$app['app_directory']] = $app;
}
}
}
//-----------------------------------------
// Get results
//-----------------------------------------
/* What is it we're getting? */
$app = (!empty($this->request['app_tab']) and isset($supportedApps[$this->request['app_tab']])) ? $this->request['app_tab'] : 'forums';
$type = (isset($this->request['type']) and $this->request['type'] == 'given') ? 'given' : 'received';
$st = isset($this->request['st']) ? intval($this->request['st']) : 0;
/* Can we view given reputation - If not, no point going any further*/
if ($type == 'given' && !$this->memberData['gbw_view_reps']) {
return $this->registry->getClass('output')->getTemplate('profile')->tabReputation($member, $app, 'received', $supportedApps);
}
/* Load our extension class */
$classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir($app) . '/extensions/reputation.php', 'reputation_' . $app, $app);
$reputationClass = new $classToLoad();
/* Get our query */
$_query = $reputationClass->fetch($type, $member);
$_query['group'] = 'r.app, r.type, r.type_id';
/* Get a count */
$queryForCount = $_query;
$queryForCount['select'] = 'r.type_id';
$this->DB->build($queryForCount);
$rawQuery = $this->DB->fetchSqlString();
$this->DB->flushQuery();
$this->DB->allow_sub_select = 1;
$this->DB->query('SELECT COUNT(*) as dracula FROM ( ' . $rawQuery . ') as x');
$this->DB->execute();
$count = $this->DB->fetch();
/* Get em? */
$processedResults = '';
$pagination = '';
if (!empty($count['dracula'])) {
$_query['limit'] = array($st, self::PER_PAGE);
$_query['order'] = $type == 'received' ? 'r.type_id DESC' : 'r.rep_date DESC';
$results = array();
$this->DB->build($_query);
$e = $this->DB->execute();
while ($row = $this->DB->fetch($e)) {
$results[] = $reputationClass->process($row);
}
/* Sort out pagination */
$pagination = $this->registry->output->generatePagination(array('totalItems' => intval($count['dracula']), 'itemsPerPage' => self::PER_PAGE, 'currentStartValue' => $st, 'baseUrl' => "showuser={$member['member_id']}&tab=reputation&app_tab={$app}&type={$type}", 'seoTitle' => $member['members_seo_name'], 'seoTemplate' => 'showuser'));
/* Process Results */
$processedResults = $reputationClass->display($results);
}
/* Display processed results */
return $this->registry->getClass('output')->getTemplate('profile')->tabReputation($member, $app, $type, $supportedApps, $processedResults, $pagination);
}
示例13: getNotificationData
/**
* Get notification config file data
*
* @access public
* @param bool If true, will check show_callback to see if user has permission
* @return array
*/
public function getNotificationData($checkCallbacks = FALSE)
{
//-----------------------------------------
// Already stored the data?
//-----------------------------------------
if (count($this->_notificationData)) {
return $this->_notificationData;
}
//-----------------------------------------
// Get for each application
//-----------------------------------------
foreach (IPSLib::getEnabledApplications(array(), TRUE) as $app_dir => $application) {
$newLocation = IPSLib::getAppDir($app_dir) . '/extensions/notifications/config.php';
$oldLocation = IPSLib::getAppDir($app_dir) . '/extensions/notifications.php';
if (!is_file($newLocation)) {
$newLocation = $oldLocation;
}
if (is_file($newLocation)) {
$classToLoad = IPSLib::loadLibrary($newLocation, $app_dir . '_notifications', $app_dir);
if (class_exists($classToLoad)) {
$class = new $classToLoad();
$class->memberData = ipsRegistry::member()->fetchMemberData();
$_NOTIFY = $class->getConfiguration();
if ($checkCallbacks) {
foreach ($_NOTIFY as $n) {
$n['app'] = $app_dir;
if ($n['show_callback'] and method_exists($class, $n['key'])) {
if ($class->{$n}['key']($this->_member)) {
$this->_notificationData[] = $n;
}
} else {
$this->_notificationData[] = $n;
}
}
} else {
$_NEW = array();
foreach ($_NOTIFY as $notify) {
$notify['app'] = $app_dir;
$_NEW[] = $notify;
}
$_NOTIFY = $_NEW;
$this->_notificationData = is_array($this->_notificationData) ? $this->_notificationData : array();
$this->_notificationData = array_merge($this->_notificationData, $_NOTIFY);
}
}
}
}
return $this->_notificationData;
}
示例14: doExecute
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen]
*/
public function doExecute(ipsRegistry $registry)
{
//-----------------------------------------
// Get supported applications
//-----------------------------------------
$supportedApps = array();
foreach (IPSLib::getEnabledApplications() as $app) {
$file = IPSLib::getAppDir($app['app_directory']) . '/extensions/reputation.php';
if (is_file($file)) {
require_once $file;
/*maybeLibHook*/
if (class_exists('reputation_' . $app['app_directory'])) {
$supportedApps[$app['app_directory']] = $app;
}
}
}
//-----------------------------------------
// Get results
//-----------------------------------------
/* What is it we're getting? */
$app = (is_string($this->request['app_tab']) && !empty($this->request['app_tab']) and isset($supportedApps[$this->request['app_tab']])) ? $this->request['app_tab'] : 'forums';
/* Load our extension class */
$classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir($app) . '/extensions/reputation.php', 'reputation_' . $app, $app);
$reputationClass = new $classToLoad();
/* Get our query */
$_query = $reputationClass->fetch('most');
$PRE = trim(ipsRegistry::dbFunctions()->getPrefix());
/* Got something? */
if ($_query['inner']) {
/* Build inner join */
$this->DB->build($_query['inner']);
$inner = $this->DB->fetchSqlString();
$this->DB->flushQuery();
$this->DB->allow_sub_select = 1;
$this->DB->query('SELECT * FROM ' . $PRE . "reputation_totals WHERE rt_app_type=MD5( CONCAT( '" . $app . "', ';', '" . $_query['type'] . "' ) ) AND rt_type_id IN (" . $inner . ") AND rt_total > 0 GROUP BY rt_key ORDER BY rt_total DESC LIMIT 0," . self::NUMBER_TO_SHOW);
$this->DB->execute();
$typeIds = array();
$results = array();
$index = array();
while ($row = $this->DB->fetch()) {
$typeIds[$row['rt_total'] . '.' . $row['rt_type_id']] = $row['rt_type_id'];
$index[$row['rt_type_id']] = $row['rt_total'] . '.' . $row['rt_type_id'];
}
if (count($typeIds)) {
$this->DB->build(array('select' => 'r.*', 'from' => array('reputation_index' => 'r'), 'where' => "r.app='" . $app . "' AND r.type='" . $_query['type'] . "' AND r.type_id IN (" . implode(',', array_values($typeIds)) . ")", 'group' => 'r.app, r.type, r.type_id', 'add_join' => $_query['joins']));
$e = $this->DB->execute();
while ($row = $this->DB->fetch($e)) {
$results[$index[$row['type_id']]] = $reputationClass->process($row);
}
krsort($results);
}
}
//-----------------------------------------
// Output
//-----------------------------------------
/* Process Results */
$processedResults = count($results) ? $reputationClass->display($results) : '';
$this->lang->loadLanguageFile(array('public_profile'), 'members');
/* Setup page */
$langBit = ipsRegistry::$settings['reputation_point_types'] == 'like' ? 'most_rep_likes' : 'most_rep_rep';
$this->registry->output->setTitle($this->lang->words[$langBit] . ' - ' . IPSLib::getAppTitle($app));
$this->registry->output->addNavigation($this->lang->words[$langBit], NULL);
/* Display processed results */
$this->registry->output->addContent($this->registry->getClass('output')->getTemplate('profile')->reputationPage($langBit, $app, $supportedApps, $processedResults));
$this->registry->output->sendOutput();
}
示例15: _indexPage
/**
* Show the mod CP portal
*
* @return @e void
*/
protected function _indexPage()
{
//-----------------------------------------
// Init
//-----------------------------------------
ipsRegistry::getAppClass('forums');
$this->request['tab'] = empty($this->request['tab']) ? 'index' : trim($this->request['tab']);
$this->request['fromapp'] = empty($this->request['fromapp']) ? 'index' : trim($this->request['fromapp']);
$_plugins = array();
$_tabs = array();
$_activeNav = array('primary' => 'index', 'secondary' => 'index');
$_output = '';
$moderator = $this->registry->class_forums->getModerator();
$tab = $this->request['tab'];
$app = $this->request['fromapp'];
/**
* Loop through all apps and get plugins
*
* @note When updating this code below remember to update also the core in public_core_reports_reports
*/
foreach (IPSLib::getEnabledApplications() as $appDir => $appData) {
if (is_dir(IPSLib::getAppDir($appDir) . '/extensions/modcp')) {
try {
foreach (new DirectoryIterator(IPSLib::getAppDir($appDir) . '/extensions/modcp') as $file) {
if (!$file->isDot() && $file->isFile()) {
if (preg_match('/^plugin_(.+?)\\.php$/', $file->getFileName(), $matches)) {
//-----------------------------------------
// We load each plugin so it can determine
// if it should show based on permissions
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary($file->getPathName(), 'plugin_' . $appDir . '_' . $matches[1], $appDir);
if (class_exists($classToLoad)) {
$_plugins[$appDir][$matches[1]] = new $classToLoad($this->registry);
if ($_plugins[$appDir][$matches[1]]->canView($moderator)) {
//-----------------------------------------
// Hacky solution - we want forum plugins to
// come first as they're the most used
//-----------------------------------------
if ($appDir == 'forums' and !empty($_tabs[$_plugins[$appDir][$matches[1]]->getPrimaryTab()])) {
array_unshift($_tabs[$_plugins[$appDir][$matches[1]]->getPrimaryTab()], array($_plugins[$appDir][$matches[1]]->getSecondaryTab(), $appDir, $matches[1]));
} else {
$_tabs[$_plugins[$appDir][$matches[1]]->getPrimaryTab()][] = array($_plugins[$appDir][$matches[1]]->getSecondaryTab(), $appDir, $matches[1]);
}
/* Sort active tab */
if ($appDir == $app && $tab == $matches[1]) {
$_activeNav = array('primary' => $_plugins[$appDir][$matches[1]]->getPrimaryTab(), 'secondary' => $_plugins[$appDir][$matches[1]]->getSecondaryTab());
}
}
}
}
}
}
} catch (Exception $e) {
}
}
}
// Move trash can to the bottom - if available
if (isset($_tabs['deleted_content'])) {
$trashCan = $_tabs['deleted_content'];
unset($_tabs['deleted_content']);
$_tabs['deleted_content'] = $trashCan;
}
//-----------------------------------------
// If we can't view any tabs, show an error
//-----------------------------------------
if (!count($_tabs)) {
$this->registry->output->showError($this->lang->words['modcp_no_access'], 10194.12, false, null, 403);
}
//-----------------------------------------
// Pass the necessary template variables into the plugin
//-----------------------------------------
$this->registry->output->getTemplate('modcp')->templateVars['tabs'] = $_tabs;
$this->registry->output->getTemplate('modcp')->templateVars['activeNav'] = $_activeNav;
//-----------------------------------------
// Get appropriate content to show
//-----------------------------------------
if ($tab and $app and isset($_plugins[$app][$tab])) {
$_output = $_plugins[$app][$tab]->executePlugin($moderator);
} else {
switch ($this->request['do']) {
case 'editmember':
$_output = $this->_editMember();
break;
case 'doeditmember':
$_output = $this->_doEditMember();
break;
case 'setAsSpammer':
$_output = $this->_setAsSpammer();
break;
default:
$_output = $this->registry->output->getTemplate('modcp')->overview();
break;
}
}
//-----------------------------------------
//.........这里部分代码省略.........