Пример #1
0
 /**
  * Main function executed automatically by the controller
  *
  * @param	object		$registry		Registry object
  * @return	@e void
  */
 public function doExecute(ipsRegistry $registry)
 {
     //-----------------------------------------
     // Get forums class
     //-----------------------------------------
     if (!$this->registry->isClassLoaded('class_forums')) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
         $this->registry->setClass('class_forums', new $classToLoad($this->registry));
         $this->registry->getClass('class_forums')->strip_invisible = 1;
         $this->registry->getClass('class_forums')->forumsInit();
     }
     $this->lang->loadLanguageFile(array('public_search'));
     //-----------------------------------------
     // What to do?
     //-----------------------------------------
     switch ($this->request['do']) {
         default:
         case 'showForumsVncFilter':
             $this->showForm();
             break;
         case 'saveForumsVncFilter':
             $this->saveForm();
             break;
         case 'saveFollow':
             $this->saveFollow();
             break;
     }
 }
Пример #2
0
 /**
  * Class entry point
  *
  * @param	object		Registry reference
  * @return	@e void		[Outputs to screen]
  */
 public function doExecute(ipsRegistry $registry)
 {
     //-----------------------------------------
     // Load handler...
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
     $this->han_login = new $classToLoad($this->registry);
     $this->han_login->init();
     $this->registry->getClass('class_localization')->loadLanguageFile(array('public_login'), 'core');
     //-----------------------------------------
     // Show form or process login?
     //-----------------------------------------
     if ($this->request['do'] == 'showForm') {
         $additional_data = $this->han_login->additionalFormHTML();
         $replace = false;
         $data = array();
         if (!is_null($additional_data) and is_array($additional_data) and count($additional_data)) {
             $replace = $additional_data[0];
             $data = $additional_data[1];
         }
         $this->returnHtml($this->registry->getClass('output')->getTemplate('global')->loginForm($replace == 'replace' ? true : false, $data));
     } else {
         if ($this->request['do'] == 'authenticateUser') {
             return $this->_authenticateUser();
         } else {
             return $this->_doLogIn();
         }
     }
 }
Пример #3
0
 /**
  * Class entry point
  *
  * @param	object		Registry reference
  * @return	@e void		[Outputs to screen/redirects]
  */
 public function doExecute(ipsRegistry $registry)
 {
     /* Attachment Controller Class */
     $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('core') . '/sources/classes/attach/controller.php', 'classes_attach_controller');
     $controller = new $classToLoad($registry);
     $controller->run($this->request['do']);
 }
Пример #4
0
 /**
  * Grab the RSS document content and return it
  *
  * @return	string		RSS document
  */
 public function returnRSSDocument()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $member_id = intval(ipsRegistry::$request['member_id']);
     $secure_key = IPSText::md5Clean(ipsRegistry::$request['rss_key']);
     $rss_data = array();
     $to_print = '';
     if ($secure_key and $member_id) {
         if ($member_id == ipsRegistry::member()->getProperty('member_id')) {
             //-----------------------------------------
             // Get RSS export
             //-----------------------------------------
             $rss_data = ipsRegistry::DB()->buildAndFetch(array('select' => 'rss_cache', 'from' => 'rc_modpref', 'where' => "mem_id=" . $member_id . " AND rss_key='" . $secure_key . "'"));
             //-----------------------------------------
             // Got one?
             //-----------------------------------------
             if ($rss_data['rss_cache']) {
                 return $rss_data['rss_cache'];
             }
         }
         //-----------------------------------------
         // Create a dummy one
         //-----------------------------------------
         ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_reports'), 'core');
         $classToLoad = IPSLib::loadLibrary(IPS_KERNEL_PATH . 'classRss.php', 'classRss');
         $rss = new $classToLoad();
         $channel_id = $rss->createNewChannel(array('title' => ipsRegistry::getClass('class_localization')->words['rss_feed_title'], 'link' => ipsRegistry::$settings['board_url'], 'description' => ipsRegistry::getClass('class_localization')->words['reports_rss_desc'], 'pubDate' => $rss->formatDate(time())));
         $rss->createRssDocument();
         return $rss->rss_document;
     }
 }
Пример #5
0
 /**
  * Main function executed automatically by the controller
  *
  * @param	object		$registry		Registry object
  * @return	@e void
  */
 public function doExecute(ipsRegistry $registry)
 {
     /* Load Class */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . '/sources/classes/class_taskmanager.php', 'class_taskmanager');
     $this->func_taskmanager = new $classToLoad($registry);
     /* Load Skin and Language */
     $this->html = $this->registry->output->loadTemplate('cp_skin_system');
     $this->registry->class_localization->loadLanguageFile(array('admin_system'));
     $this->registry->output->core_nav[] = array($this->settings['base_url'] . 'module=logs&section=tasklogs', $this->lang->words['sched_error_logs']);
     /* URLs */
     $this->form_code = $this->html->form_code = 'module=logs&section=tasklogs';
     $this->form_code_js = $this->html->form_code_js = 'module=logs&section=tasklogs';
     switch ($this->request['do']) {
         default:
         case 'task_logs':
             $this->registry->getClass('class_permissions')->checkPermissionAutoMsg('tasklogs_view', '', 'system');
             $this->taskLogsOverview();
             break;
         case 'task_log_show':
             $this->registry->getClass('class_permissions')->checkPermissionAutoMsg('tasklogs_view', '', 'system');
             $this->taskLogsShow();
             break;
         case 'task_log_delete':
             $this->registry->getClass('class_permissions')->checkPermissionAutoMsg('tasklogs_delete', '', 'system');
             $this->taskLogsDelete();
             break;
     }
     /* Output */
     $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
     $this->registry->output->sendOutput();
 }
Пример #6
0
 public function generate()
 {
     if (!IPSLib::appIsInstalled('ccs')) {
         return;
     }
     $maxPages = 10000;
     $curPages = 0;
     while ($curPages < $maxPages) {
         $permCheck = $this->DB->buildWherePermission(array($this->caches['group_cache'][$this->settings['guest_group']]['g_perm_id']), 'page_view_perms', true);
         $this->DB->build(array('select' => '*', 'from' => 'ccs_pages', 'where' => "({$permCheck}) AND page_content_type = 'page'", 'order' => 'page_last_edited DESC', 'limit' => array($curPages, 100)));
         $result = $this->DB->execute();
         if ($result) {
             // Add the resulting rows to the sitemap:
             while ($row = $this->DB->fetch($result)) {
                 if (!$this->registry->isClassLoaded('ccsFunctions')) {
                     $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('ccs') . '/sources/functions.php', 'ccsFunctions', 'ccs');
                     $this->registry->setClass('ccsFunctions', new $classToLoad($this->registry));
                 }
                 $url = $this->registry->ccsFunctions->returnPageUrl($row);
                 $priority = $row['page_folder'] == '' && $row['page_seo_name'] == $this->settings['ccs_default_page'] ? $this->settings['sitemap_priority_ccs_index'] : $this->settings['sitemap_priority_ccs_page'];
                 $this->sitemap->addURL($url, $row['page_last_edited'], $priority);
             }
             // If we've got back less rows than expected, we've probably got no more to pull:
             $pulledRows = $this->DB->getTotalRows($result);
             $curPages += $pulledRows;
             if ($pulledRows < 100) {
                 break;
             }
         }
     }
 }
 public function generate()
 {
     $galleryClassFile = IPSLib::getAppDir('gallery') . '/sources/classes/gallery.php';
     if (!IPSLib::appIsInstalled('gallery') || $this->settings['sitemap_priority_gallery_images'] == 0 || !is_file($galleryClassFile)) {
         return;
     }
     $classToLoad = IPSLib::loadLibrary($galleryClassFile, 'ipsGallery', 'gallery');
     $this->registry->setClass('gallery', new $classToLoad($this->registry));
     $max = $this->settings['sitemap_count_gallery_images'];
     if (!ipSeo_SitemapGenerator::isCronJob() && ($max > 10000 || $max == -1)) {
         $max = 10000;
     } elseif (ipSeo_SitemapGenerator::isCronJob() && $max == -1) {
         $max = 500000000;
     }
     $addedCount = 0;
     $limitCount = 0;
     while ($addedCount < $max) {
         if (ipSeo_SitemapGenerator::isCronJob()) {
             sleep(0.5);
         }
         $filters = array('sortOrder' => 'desc', 'sortKey' => 'date', 'offset' => $limitCount, 'limit' => 100, 'getLatestComment' => 1);
         $memberId = 0;
         $images = $this->registry->gallery->helper('image')->fetchImages($memberId, $filters);
         foreach ($images as $image) {
             $url = "{$this->settings['board_url']}/index.php?app=gallery&image={$image['image_id']}";
             $url = ipSeo_FURL::build($url, 'none', $image['image_caption_seo'], 'viewimage');
             $lastMod = is_null($image['comment_post_date']) ? $image['image_date'] : $image['comment_post_date'];
             $addedCount = $this->sitemap->addUrl($url, $lastMod, $this->settings['sitemap_priority_gallery_images']);
         }
         $limitCount += 100;
         if (count($images) < 100) {
             break;
         }
     }
 }
Пример #8
0
 /**
  * Main class entry point
  *
  * @param	object		ipsRegistry reference
  * @return	@e void		[Outputs to screen]
  */
 public function doExecute(ipsRegistry $registry)
 {
     //-----------------------------------------
     // Require and run
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_taskmanager.php', 'class_taskmanager');
     /*noLibHook*/
     $functions = new $classToLoad($registry);
     //-----------------------------------------
     // Check shutdown functions
     //-----------------------------------------
     if (IPS_USE_SHUTDOWN) {
         define('IS_SHUTDOWN', 1);
         register_shutdown_function(array($functions, 'runTask'));
     } else {
         $functions->runTask();
     }
     if ($functions->type != 'cron' && !$_SERVER['SHELL']) {
         //-----------------------------------------
         // Print out the 'blank' gif
         //-----------------------------------------
         ob_start();
         @header("Content-Type: image/gif");
         print base64_decode("R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==");
     }
 }
Пример #9
0
 /**
  * Grab the RSS document content and return it
  * 
  * @return	string		RSS document
  */
 public function returnRSSDocument()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $cal_id = intval(ipsRegistry::$request['id']);
     $rss_data = array();
     $to_print = '';
     $this->expires = time();
     $_calendarCache = ipsRegistry::cache()->getCache('calendars');
     //-----------------------------------------
     // Get RSS export
     //-----------------------------------------
     $rss_data = $_calendarCache[$cal_id];
     //-----------------------------------------
     // Got one?
     //-----------------------------------------
     if ($rss_data['cal_id'] and $rss_data['cal_rss_export']) {
         //-----------------------------------------
         // Correct expires time
         //-----------------------------------------
         $this->expires = $rss_data['cal_rss_update_last'] + $rss_data['cal_rss_update'] * 60;
         //-----------------------------------------
         // Need to recache?
         //-----------------------------------------
         if (!$rss_data['cal_rss_cache'] or time() - $rss_data['cal_rss_update'] * 60 > $rss_data['cal_rss_update_last']) {
             $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('calendar') . '/sources/cache.php', 'calendar_cache', 'calendar');
             $rss_export = new $classToLoad(ipsRegistry::instance());
             return $rss_export->rebuildCalendarRSSCache($rss_data['cal_id']);
         } else {
             return $rss_data['cal_rss_cache'];
         }
     }
 }
Пример #10
0
 /**
  * Constructor
  * 
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Hard limit - not used in Sphinx but may need to revisit if we bust IN()s */
     //IPSSearchRegistry::set('set.hardLimit', ( ipsRegistry::$settings['search_hardlimit'] ) ? ipsRegistry::$settings['search_hardlimit'] : 200 );
     /* Get class forums, used for displaying forum names on results */
     if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
         ipsRegistry::setClass('class_forums', new $classToLoad(ipsRegistry::instance()));
         ipsRegistry::getClass('class_forums')->strip_invisible = 1;
         ipsRegistry::getClass('class_forums')->forumsInit();
     }
     /* Get live or archive */
     $this->searchArchives = ipsRegistry::$request['search_app_filters']['forums']['liveOrArchive'] == 'archive' ? true : false;
     if ($this->searchArchives) {
         /* Load up archive class */
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/archive/reader.php', 'classes_archive_reader');
         $this->archiveReader = new $classToLoad();
         $this->archiveReader->setApp('forums');
         $this->table = $this->archiveReader->getFields();
         $this->table['_table_'] = 'forums_archive_posts';
         $this->table['_prefix_'] = 'p.archive_';
         $this->table['forums_search_posts_main'] = 'forums_search_archive_main';
         $this->table['forums_search_posts_delta'] = 'forums_search_archive_delta';
         /* disable max days search */
         $this->settings['search_ucontent_days'] = 0;
     } else {
         $this->table = array('_table_' => 'posts', '_prefix_' => 'p.', 'pid' => 'pid', 'author_id' => 'author_id', 'author_name' => 'author_name', 'ip_address' => 'ip_address', 'post_date' => 'post_date', 'post' => 'post', 'queued' => 'queued', 'topic_id' => 'topic_id', 'new_topic' => 'new_topic', 'post_bwoptions' => 'post_bwoptions', 'post_key' => 'post_key', 'post_htmlstate' => 'post_htmlstate', 'use_sig' => 'use_sig', 'use_emo' => 'use_emo', 'append_edit' => 'append_edit', 'edit_time' => 'edit_time', 'edit_name' => 'edit_name', 'post_edit_reason' => 'post_edit_reason', 'forums_search_posts_main' => 'forums_search_posts_main', 'forums_search_posts_delta' => 'forums_search_posts_delta');
     }
     parent::__construct($registry);
 }
Пример #11
0
 /**
  * Serve the iCalendar feed (valid for both download as .ics and webcal:// protocol)
  *
  * @return	@e void
  */
 public function downloadIcalFeed()
 {
     //-----------------------------------------
     // Get main view class
     //-----------------------------------------
     $classToLoad = IPSLib::loadActionOverloader(IPSLib::getAppDir('calendar') . '/modules_public/calendar/view.php', 'public_calendar_calendar_view');
     $calendar = new $classToLoad($this->registry);
     $calendar->makeRegistryShortcuts($this->registry);
     $calendar->initCalendar();
     //-----------------------------------------
     // Load (all) events
     //-----------------------------------------
     $calendar->calendarGetEventsSQL(gmstrftime('%m'), gmstrftime('%Y'), array('timenow' => '1', 'timethen' => '2000000000', 'cal_id' => $this->calendar['cal_id'], 'honor_permissions' => true, 'no_date_convert' => true));
     $events = $calendar->calendarGetAllEvents();
     //-----------------------------------------
     // Load iCalendar class
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('calendar') . "/sources/icalendar.php", 'app_calendar_classes_icalendarOutput', 'calendar');
     $iCalendar = new $classToLoad($this->registry, $this->calendar['cal_id']);
     //-----------------------------------------
     // Send data to iCalendar class and get output
     //-----------------------------------------
     foreach ($events as $event) {
         $event = $calendar->calendarMakeEventHTML($event, true);
         $iCalendar->addEvent($event);
     }
     $feed = $iCalendar->buildICalendarFeed();
     //-----------------------------------------
     // Output
     //-----------------------------------------
     @header("Content-type: text/calendar; charset=" . IPS_DOC_CHAR_SET);
     @header("Content-Disposition: inline; filename=calendarEvents.ics");
     print $feed;
     exit;
 }
Пример #12
0
 /**
  * Method constructor
  *
  * If you pass false as the key, it will not save out the imported GUIDs
  * @access	public
  * @return	@e void
  * 
  */
 public function __construct($config = array())
 {
     $this->_config = $config;
     $classToLoad = IPSLib::loadLibrary(IPS_KERNEL_PATH . 'classFileManagement.php', 'classFileManagement');
     $this->_cfm = new $classToLoad();
     $this->_cfm->timeout = 15;
 }
Пример #13
0
 /**
  * Remove user's photo
  *
  * @return	@e void		[Outputs to screen]
  */
 protected function remove_photo()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $member_id = intval($this->request['member_id']);
     //-----------------------------------------
     // Get member
     //-----------------------------------------
     $member = IPSMember::load($member_id);
     if (!$member['member_id']) {
         $this->returnJsonError($this->lang->words['m_noid']);
         exit;
     }
     //-----------------------------------------
     // Allowed to upload pics for administrators?
     //-----------------------------------------
     if ($member['g_access_cp'] and !$this->registry->getClass('class_permissions')->checkPermission('member_photo_admin', 'members', 'members')) {
         $this->returnJsonError($this->lang->words['m_editadmin']);
         exit;
     }
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/member/photo.php', 'classes_member_photo');
     $photos = new $classToLoad($this->registry);
     $photos->remove($member_id);
     ipsRegistry::getClass('adminFunctions')->saveAdminLog(sprintf($this->lang->words['m_imgremlog'], $member_id));
     $member = IPSMember::load($member_id);
     $member = IPSMember::buildDisplayData($member, 0);
     //-----------------------------------------
     // Return
     //-----------------------------------------
     $this->returnJsonArray(array('success' => 1, 'pp_main_photo' => $member['pp_main_photo'], 'pp_main_width' => $member['pp_main_width'], 'pp_main_height' => $member['pp_main_height']));
 }
Пример #14
0
 /**
  * Constructor
  *
  * Use this to do any initiation required by your application
  */
 public function __construct()
 {
     //-----------------------------------------
     // Init IPB
     //-----------------------------------------
     define('IPS_ENFORCE_ACCESS', TRUE);
     define('IPB_THIS_SCRIPT', 'public');
     require_once '../../initdata.php';
     require_once IPS_ROOT_PATH . 'sources/base/ipsRegistry.php';
     require_once IPS_ROOT_PATH . 'sources/base/ipsController.php';
     $this->registry = ipsRegistry::instance();
     $this->registry->init();
     //-----------------------------------------
     // Set up shortcuts
     //-----------------------------------------
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     $this->masterKey = md5(md5($this->settings['sql_user'] . $this->settings['sql_pass']) . $this->settings['board_start']);
     //-----------------------------------------
     // Init han_login
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
     $this->han_login = new $classToLoad($this->registry);
     $this->han_login->init();
 }
Пример #15
0
 /**
  * Run this task
  *
  * @return	@e void
  */
 public function runTask()
 {
     /* Language class */
     $this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core');
     /* Load up archive class */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/archive/writer.php', 'classes_archive_writer');
     $archiveWriter = new $classToLoad();
     $archiveWriter->setApp('forums');
     /* Do it! DO IT */
     $count = $archiveWriter->processBatch();
     $this->class->appendTaskLog($this->task, sprintf($this->lang->words['task_archiveprocess'], intval($count)));
     /* Load up restore class */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/archive/restore.php', 'classes_archive_restore');
     $archiveRestore = new $classToLoad();
     $archiveRestore->setApp('forums');
     /* Do it! DO IT */
     $count = $archiveRestore->processBatch();
     if ($count) {
         $this->class->appendTaskLog($this->task, sprintf($this->lang->words['task_unarchiveprocess'], $count));
     }
     //-----------------------------------------
     // Unlock Task: DO NOT MODIFY!
     //-----------------------------------------
     $this->class->unlockTask($this->task);
 }
Пример #16
0
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     /* Make registry objects */
     $this->registry = ipsRegistry::instance();
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     /* Check for class_forums */
     if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
         $this->registry->setClass('class_forums', new $classToLoad($this->registry));
         $this->registry->class_forums->forumsInit();
     }
     /* Load topic class */
     if (!$this->registry->isClassLoaded('topics')) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/topics.php", 'app_forums_classes_topics', 'forums');
         $this->registry->setClass('topics', new $classToLoad($this->registry));
     }
     /* Language class */
     $this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core');
     /* Fetch engine class */
     $this->settings['archive_engine'] = $this->settings['archive_engine'] ? $this->settings['archive_engine'] : 'sql';
     /* Load up archive class */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/archive/reader/' . $this->settings['archive_engine'] . '.php', 'classes_archive_reader_' . $this->settings['archive_engine']);
     $this->engine = new $classToLoad();
     $this->fields = $this->registry->topics->getPostTableFields();
 }
Пример #17
0
 /**
  * Main class entry point
  *
  * @param	object		ipsRegistry reference
  * @return	@e void		[Outputs to screen]
  */
 public function doExecute(ipsRegistry $registry)
 {
     /* Load editor stuff */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite');
     $this->editor = new $classToLoad();
     $this->lang->loadLanguageFile('public_editors', 'core');
     /* What to do? */
     switch ($this->request['do']) {
         case 'autoSave':
             $this->_autoSave();
             break;
         case 'switch':
             $this->_switch();
             break;
         case 'showSettings':
             $this->_showSettings();
             break;
         case 'getEmoticons':
             $this->_getEmoticons();
             break;
         case 'saveSettings':
             $this->_saveSettings();
             break;
     }
 }
Пример #18
0
 /**
  * Gets the uploader form/data for ajaxy stuffs
  */
 protected function _getForumsAppUploader()
 {
     $this->registry->getClass('class_localization')->loadLanguageFile(array('public_post', 'public_topics'), 'forums');
     $attach_post_key = trim($this->request['attach_post_key']);
     $attach_rel_id = intval($this->request['attach_rel_id']);
     $forum_id = intval($this->request['forum_id']);
     $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php', 'class_attach');
     $class_attach = new $classToLoad($this->registry);
     $class_attach->type = 'post';
     $class_attach->attach_post_key = $attach_post_key;
     $class_attach->init();
     $class_attach->getUploadFormSettings();
     $html = $this->registry->getClass('output')->getTemplate('post')->uploadForm($this->post_key, 'post', $class_attach->attach_stats, $attach_rel_id, $forum_id);
     /* Need to make sure they are unique - if we implement, change template to accept a prefix */
     $html = str_replace("id='add_files_attach_", "id='add_files_attach_pu_", $html);
     $html = str_replace("id='nojs_attach_", "id='nojs_attach_pu_", $html);
     $html = str_replace("id='help_msg'", "id='pu_help_msg'", $html);
     $html = str_replace("id='space_info_attach_", "id='space_info_attach_pu_", $html);
     $html = str_replace("<ul id='attachments'>", "<ul id='pu_attachments'>", $html);
     /* Remove help msg */
     /* remove inline execution */
     preg_match_all('#<script type=\'text/javascript\'>(.+?)</script>#is', $html, $matches, PREG_SET_ORDER);
     foreach ($matches as $val) {
         $all = $val[0];
         $javascript = $val[1];
         if (stristr($all, 'ipb.attach.registerUploader')) {
             $html = str_replace($all, '', $html);
         }
     }
     $this->returnHtml($html);
 }
Пример #19
0
 /**
  * Main function executed automatically by the controller
  *
  * @param	object		$registry		Registry object
  * @return	@e void
  */
 public function doExecute(ipsRegistry $registry)
 {
     /* Set up */
     $inapp = trim($this->request['inapp']);
     $do = !empty($this->request['do']) ? $this->request['do'] : 'all';
     /* Load navigation stuff */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/navigation/build.php', 'classes_navigation_build');
     $navigation = new $classToLoad($inapp);
     /* Show warning if offline */
     if ($this->settings['board_offline'] and !$this->memberData['g_access_offline']) {
         $row = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'core_sys_conf_settings', 'where' => "conf_key='offline_msg'"));
         IPSText::getTextClass('bbcode')->parse_bbcode = 1;
         IPSText::getTextClass('bbcode')->parse_html = 1;
         IPSText::getTextClass('bbcode')->parse_emoticons = 1;
         IPSText::getTextClass('bbcode')->parse_nl2br = 1;
         IPSText::getTextClass('bbcode')->parsing_section = 'global';
         $row['conf_value'] = IPSText::getTextClass('bbcode')->preDisplayParse(IPSText::getTextClass('bbcode')->preDbParse($row['conf_value']));
         return $this->returnHtml($this->registry->output->getTemplate('global_other')->quickNavigationOffline($row['conf_value']));
     }
     /* Return */
     if ($do == 'all') {
         return $this->returnHtml($this->registry->output->getTemplate('global_other')->quickNavigationWrapper($navigation->loadApplicationTabs(), $navigation->loadNavigationData(), $navigation->getApp()));
     } else {
         return $this->returnHtml($this->registry->output->getTemplate('global_other')->quickNavigationPanel($navigation->loadNavigationData(), $navigation->getApp()));
     }
 }
Пример #20
0
 /**
  * Main executable
  *
  * @param	object	registry object
  * @return	@e void
  */
 public function doExecute(ipsRegistry $registry)
 {
     $registry->getClass('class_localization')->loadLanguageFile(array('admin_templates'), 'core');
     //-----------------------------------------
     // Load functions and cache classes
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/useragents/userAgentFunctions.php', 'userAgentFunctions');
     $this->userAgentFunctions = new $classToLoad($registry);
     //-----------------------------------------
     // What shall we do?
     //-----------------------------------------
     switch ($this->request['do']) {
         case 'saveuAgent':
             if (!$registry->getClass('class_permissions')->checkPermission('ua_manage', ipsRegistry::$current_application, 'tools')) {
                 $this->returnJsonError($registry->getClass('class_localization')->words['sk_ajax_noperm']);
             }
             $this->_saveuAgent();
             break;
         case 'removeuAgent':
             if (!$registry->getClass('class_permissions')->checkPermission('ua_remove', ipsRegistry::$current_application, 'tools')) {
                 $this->returnJsonError($registry->getClass('class_localization')->words['sk_ajax_noperm']);
             }
             $this->_removeuAgent();
             break;
     }
 }
 public function generate()
 {
     $galleryClassFile = IPSLib::getAppDir('gallery') . '/sources/classes/gallery.php';
     if (!IPSLib::appIsInstalled('gallery') || $this->settings['sitemap_priority_gallery_albums'] == 0 || !is_file($galleryClassFile)) {
         return;
     }
     $classToLoad = IPSLib::loadLibrary($galleryClassFile, 'ipsGallery', 'gallery');
     $this->registry->setClass('gallery', new $classToLoad($this->registry));
     $limitCount = 0;
     while (1) {
         if (ipSeo_SitemapGenerator::isCronJob()) {
             sleep(0.5);
         }
         $filters = array('sortOrder' => 'desc', 'sortKey' => 'date', 'offset' => $limitCount, 'limit' => 100, 'isViewable' => true, 'memberData' => array('member_id' => 0));
         $albums = $this->registry->gallery->helper('albums')->fetchAlbumsByFilters($filters);
         foreach ($albums as $album) {
             $url = "{$this->settings['board_url']}/index.php?app=gallery&album={$album['album_id']}";
             $url = ipSeo_FURL::build($url, 'none', $album['album_name_seo'], 'viewalbum');
             $addedCount = $this->sitemap->addUrl($url, $album['album_last_img_date'], $this->settings['sitemap_priority_gallery_albums']);
         }
         $limitCount += 100;
         if (count($albums) < 100) {
             break;
         }
     }
 }
Пример #22
0
 /**
  * Constructor
  *
  * @param	object		ipsRegistry reference
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     if (IN_ACP) {
         try {
             require_once IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php";
             /*noLibHook*/
             $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/admin_forum_functions.php", 'admin_forum_functions', 'forums');
             $this->registry->setClass('class_forums', new $classToLoad($registry));
             $this->registry->getClass('class_forums')->strip_invisible = 0;
         } catch (Exception $error) {
             IPS_exception_error($error);
         }
     } else {
         try {
             $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
             $this->registry->setClass('class_forums', new $classToLoad($registry));
             $this->registry->getClass('class_forums')->strip_invisible = 1;
         } catch (Exception $error) {
             IPS_exception_error($error);
         }
     }
     //---------------------------------------------------
     // Grab and cache the topic now as we need the 'f' attr for
     // the skins...
     //---------------------------------------------------
     if (!empty($_GET['showtopic'])) {
         /* Load tagging stuff */
         if (!$this->registry->isClassLoaded('tags')) {
             require_once IPS_ROOT_PATH . 'sources/classes/tags/bootstrap.php';
             /*noLibHook*/
             $this->registry->setClass('tags', classes_tags_bootstrap::run('forums', 'topics'));
         }
         $this->request['t'] = intval($_GET['showtopic']);
         $this->DB->build(array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => 't.tid=' . $this->request['t'], 'add_join' => array($this->registry->tags->getCacheJoin(array('meta_id_field' => 't.tid')))));
         $this->DB->execute();
         $topic = $this->DB->fetch();
         $this->registry->getClass('class_forums')->topic_cache = $topic;
         $this->request['f'] = $topic['forum_id'];
         /* Update query location */
         $this->member->sessionClass()->addQueryKey('location_2_id', ipsRegistry::$request['f']);
     }
     $this->registry->getClass('class_forums')->forumsInit();
     //-----------------------------------------
     // Set up moderators
     //-----------------------------------------
     $this->memberData = IPSMember::setUpModerator($this->memberData);
     /* Other set up for this app */
     $this->settings['topic_title_max_len'] = $this->settings['topic_title_max_len'] > 2 ? $this->settings['topic_title_max_len'] : 2;
 }
 public function getOutput()
 {
     if (is_file(IPSLib::getAppDir('ipchat') . '/sources/hooks.php')) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('ipchat') . '/sources/hooks.php', 'hooksApi', 'ipchat');
         $chatting = new $classToLoad($this->registry);
         return $chatting->whosChatting();
     }
 }
Пример #24
0
 /**
  * Class entry point
  *
  * @param	object		Registry reference
  * @return	@e void		[Outputs to screen]
  */
 public function doExecute(ipsRegistry $registry)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $member_id = intval(ipsRegistry::$request['member_id']);
     $md5check = IPSText::md5Clean($this->request['md5check']);
     $CONFIG = array();
     $tab = explode(':', ipsRegistry::$request['tab']);
     $app = substr(IPSText::alphanumericalClean(str_replace('..', '', trim($tab[0]))), 0, 20);
     $tab = substr(IPSText::alphanumericalClean(str_replace('..', '', trim($tab[1]))), 0, 20);
     $this->registry->class_localization->loadLanguageFile(array('public_profile'), 'members');
     //-----------------------------------------
     // MD5 check
     //-----------------------------------------
     if ($md5check != $this->member->form_hash) {
         $this->returnString('error');
     }
     //-----------------------------------------
     // Load member
     //-----------------------------------------
     $member = IPSMember::load($member_id);
     //-----------------------------------------
     // Check
     //-----------------------------------------
     if (!$member['member_id']) {
         $this->returnString('error');
     }
     //-----------------------------------------
     // Load config
     //-----------------------------------------
     if (!is_file(IPSLib::getAppDir($app) . '/extensions/profileTabs/' . $tab . '.conf.php')) {
         $this->returnString('error');
     }
     require IPSLib::getAppDir($app) . '/extensions/profileTabs/' . $tab . '.conf.php';
     /*noLibHook*/
     //-----------------------------------------
     // Active?
     //-----------------------------------------
     if (!$CONFIG['plugin_enabled']) {
         $this->returnString('error');
     }
     //-----------------------------------------
     // Load main class...
     //-----------------------------------------
     if (!is_file(IPSLib::getAppDir($app) . '/extensions/profileTabs/' . $tab . '.php')) {
         $this->returnString('error');
     }
     require IPSLib::getAppDir('members') . '/sources/tabs/pluginParentClass.php';
     /*noLibHook*/
     $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir($app) . '/extensions/profileTabs/' . $tab . '.php', 'profile_' . $tab, $app);
     $plugin = new $classToLoad($this->registry);
     $html = $plugin->return_html_block($member);
     //-----------------------------------------
     // Return it...
     //-----------------------------------------
     $this->returnHtml($html);
 }
 public function __construct()
 {
     /* Make registry objects */
     $this->registry = ipsRegistry::instance();
     if (is_file(IPSLib::getAppDir('ipchat') . '/sources/hooks.php')) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('ipchat') . '/sources/hooks.php', 'hooksApi', 'ipchat');
         $this->chatting = new $classToLoad($this->registry);
     }
 }
Пример #26
0
 /**
  * Main class entry point
  *
  * @param	object		ipsRegistry reference
  * @return	@e void		[Outputs to screen]
  */
 public function doExecute(ipsRegistry $registry)
 {
     //-----------------------------------------
     // Load skin
     //-----------------------------------------
     $this->html = ipsRegistry::getClass('output')->loadTemplate('cp_skin_hooks_export', 'core');
     //-----------------------------------------
     // Load hooks library
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('core') . '/sources/classes/hooksFunctions.php', 'hooksFunctions');
     $this->hooksFunctions = new $classToLoad($registry);
     //-----------------------------------------
     // Load lang
     //-----------------------------------------
     ipsRegistry::getClass('class_localization')->loadLanguageFile(array('admin_hooks'));
     switch ($this->request['do']) {
         case 'getStrings':
             $this->_getAjaxStrings();
             break;
         case 'getLangFiles':
             $this->_getAjaxFiles();
             break;
         case 'getTemplates':
             $this->_getAjaxTemplates();
             break;
         case 'getSkinFiles':
             $this->_getAjaxSkins();
             break;
             // These are for the add file form
         // These are for the add file form
         case 'getGroupsForAdd':
             $this->_getGroupsForAdd();
             break;
         case 'getTemplatesForAdd':
             $this->_getTemplatesForAdd();
             break;
         case 'getHookIds':
             $this->_getHookIds();
             break;
         case 'getDataLocationsForAdd':
             $this->_getDataLocationsForAdd();
             break;
         case 'getApplications':
             $this->_getApplications();
             break;
         case 'getAppVersions':
             $this->_getAppVersions();
             break;
         case 'save':
             $this->save();
             break;
         case 'show':
         default:
             $this->show();
             break;
     }
 }
 /**
  * Run this task
  *
  * @return	@e void
  */
 public function runTask()
 {
     $licenseData = $this->registry->cache()->getCache('licenseData');
     if (isset($licenseData['iphoneNotifications']) and $licenseData['iphoneNotifications']) {
         /* INIT */
         $maxNotificationsToProcess = 250;
         $licenseKey = ipsRegistry::$settings['ipb_reg_number'];
         $forum = urlencode($this->settings['board_name']);
         $domain = urlencode(ipsRegistry::$settings['board_url']);
         $apiBaseURL = "http://apn-server.invisionpower.com/index.php?api=addMessageToQueue&key={$licenseKey}&forum={$forum}&domain={$domain}";
         /* Get the file managemnet class */
         $classToLoad = IPSLib::loadLibrary(IPS_KERNEL_PATH . 'classFileManagement.php', 'classFileManagement');
         $query = new $classToLoad();
         /* Get waiting notifications */
         $this->DB->build(array('select' => 'n.*', 'from' => array('mobile_notifications' => 'n'), 'where' => 'n.notify_sent=0', 'order' => 'n.notify_date ASC', 'limit' => array(0, $maxNotificationsToProcess)));
         $e = $this->DB->execute();
         $_sentIds = array();
         while ($r = $this->DB->fetch($e)) {
             $this->DB->build(array('select' => '*', 'from' => 'mobile_device_map', 'where' => "member_id={$r['member_id']}"));
             $f = $this->DB->execute();
             while ($device = $this->DB->fetch($f)) {
                 $message = urlencode(strip_tags($r['notify_title']));
                 if (!$device['token'] || !$message) {
                     continue;
                 }
                 /* Query the api */
                 $response = $query->getFileContents("{$apiBaseURL}&ipsToken={$device['token']}&message={$message}&notify_url={$r['notify_url']}");
                 /* If the response tells us to delete this device ID, do so */
                 if ($response == 'REMOVE_DEVICE') {
                     $this->DB->delete('mobile_device_map', "token='{$device['token']}'");
                 }
                 #IPSDebug::addLogMessage( $response, 'mobileNotifications', array( 'notifications' => $r, 'device' => $device ), true );
             }
             /* Save the ID */
             $_sentIds[] = $r['id'];
         }
         #IPSDebug::addLogMessage( implode( ',', $_sentIds ), 'mobileNotifications', false, true );
         /* Update the table */
         if (count($_sentIds)) {
             $this->DB->update('mobile_notifications', array('notify_sent' => 1), 'id IN (' . implode(',', $_sentIds) . ')');
         }
         //-----------------------------------------
         // Log to log table - modify but dont delete
         //-----------------------------------------
         $this->class->appendTaskLog($this->task, $this->lang->words['task_mobileNotifications']);
     } else {
         //-----------------------------------------
         // Log to log table - modify but dont delete
         //-----------------------------------------
         $this->class->appendTaskLog($this->task, $this->lang->words['task_mobileNotifications_badlicense']);
     }
     //-----------------------------------------
     // Unlock Task: DO NOT MODIFY!
     //-----------------------------------------
     $this->class->unlockTask($this->task);
 }
Пример #28
0
 /**
  * Constructor
  */
 public function __construct()
 {
     /* Init attachments */
     $classname = IPSLib::loadLibrary(IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php', 'class_attach');
     $this->class_attach = new $classname(ipsRegistry::instance());
     ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_topic'), 'forums');
     $this->class_attach->type = 'post';
     $this->class_attach->init();
     $this->class_attach->getUploadFormSettings();
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache');
     ipsRegistry::setClass('repCache', new $classToLoad());
 }
Пример #29
0
 /**
  * Show the captcha image
  * Refreshes the captcha image.
  *
  * @return	@e void
  */
 public function refreshImage()
 {
     /* INIT */
     $captcha_unique_id = trim($this->request['captcha_unique_id']);
     /*  Throw away */
     $blah = $this->class_captcha->getTemplate();
     $classToLoad = IPSLib::loadLibrary(IPS_KERNEL_PATH . 'classAjax.php', 'classAjax');
     $ajax = new $classToLoad();
     /* Show Image... */
     $ajax->returnString($this->class_captcha->captchaKey);
     exit;
 }
Пример #30
-1
 /**
  * Save Settings
  */
 public function saveSettings()
 {
     /* Are we turning off? */
     if (ipsRegistry::$request['off']) {
         IPSLib::updateSettings(array('mandrill_username' => '', 'mandrill_api_key' => ''));
         ipsRegistry::getClass('output')->silentRedirect(ipsRegistry::$settings['_base_url'] . "app=core&amp;module=applications&amp;section=enhancements&amp;do=edit&amp;service=enhancements_members_mandrill");
         return;
     }
     /* Load language files so we have error messages if we need em */
     ipsRegistry::getClass('class_localization')->loadLanguageFile('admin_bulkmail', 'members');
     /* Are we adding new values or just enabling SMTP? */
     if (ipsRegistry::$request['smtp_on']) {
         ipsRegistry::$request['username'] = ipsRegistry::$settings['mandrill_username'];
         ipsRegistry::$request['api_key'] = ipsRegistry::$settings['mandrill_api_key'];
         ipsRegistry::$request['smtp'] = 1;
         $update = array();
     } else {
         /* Trim (like a haircut, but with strings) */
         ipsRegistry::$request['username'] = trim(ipsRegistry::$request['username']);
         ipsRegistry::$request['api_key'] = trim(ipsRegistry::$request['api_key']);
         /* If we don't have anything, tell them off */
         if (!ipsRegistry::$request['username'] or !ipsRegistry::$request['username']) {
             return $this->editSettings('mandrill_setup_noinfo');
         }
         /* Now shoot that over to Mandrill to make sure they're cool with it */
         require_once IPSLib::getAppDir('members') . '/sources/classes/mandrill.php';
         $mandrill = new Mandrill(ipsRegistry::$request['api_key']);
         $info = $mandrill->users_info();
         if ($info === NULL or $info->username != ipsRegistry::$request['username']) {
             return $this->editSettings('mandrill_bad_credentials');
         }
         /* So we're saving at least the API key and the username */
         $update = array('mandrill_username' => ipsRegistry::$request['username'], 'mandrill_api_key' => ipsRegistry::$request['api_key']);
     }
     /* Fire that off to IPS so Mandrill knows it's one of ours */
     $classToLoad = IPSLib::loadLibrary(IPS_KERNEL_PATH . 'classFileManagement.php', 'classFileManagement');
     $file = new $classToLoad();
     $json = NULL;
     /* If they want to use Mandrill for SMTP too, that call will contain the SMTP info,
        so set it if we got it, or if the call failed, throw an error */
     if (ipsRegistry::$request['smtp']) {
         if ($json) {
             $json = json_decode($json, TRUE);
             $update = array_merge($update, $json);
         } else {
             return $this->editSettings('mandrill_error');
         }
     }
     /* Update the settings */
     IPSLib::updateSettings($update);
     /* And boink the hell out of it */
     ipsRegistry::getClass('output')->silentRedirect(ipsRegistry::$settings['_base_url'] . "app=core&amp;module=applications&amp;section=enhancements&amp;do=edit&amp;service=enhancements_members_mandrill");
     return;
 }