Esempio n. 1
0
 /**
  * Returns array, which determinate what post types are defaults of the blogs
  *
  * @return array ( key => Blog ID, value => ItemType ID )
  */
 static function get_default_ids()
 {
     global $DB;
     // Get default value of blog setting "default_post_type"
     load_class('collections/model/_collsettings.class.php', 'CollectionSettings');
     $CollectionSettings = new CollectionSettings();
     $item_types['default'] = $CollectionSettings->get_default('default_post_type');
     // Get default post type of each blog
     $SQL = new SQL();
     $SQL->SELECT('cset_coll_ID, cset_value');
     $SQL->FROM('T_coll_settings');
     $SQL->WHERE('cset_name = "default_post_type"');
     $item_types += $DB->get_assoc($SQL->get());
     return $item_types;
 }
Esempio n. 2
0
 /**
  * Update the DB based on previously recorded changes
  */
 function dbupdate()
 {
     global $DB, $Plugins, $servertimenow;
     $DB->begin();
     parent::dbupdate();
     // if this blog settings was modified we need to invalidate this blog's page caches
     // this way all existing cached page on this blog will be regenerated during next display
     // TODO: Ideally we want to detect if the changes are minor/irrelevant to caching and not invalidate the page cache if not necessary.
     // In case of doubt (and for unknown changes), it's better to invalidate.
     $this->set_setting('last_invalidation_timestamp', $servertimenow);
     if (isset($this->CollectionSettings)) {
         $this->CollectionSettings->dbupdate();
     }
     $Plugins->trigger_event('AfterCollectionUpdate', $params = array('Blog' => &$this));
     $DB->commit();
     // Thick grained invalidation:
     // This collection has been modified, cached content depending on it should be invalidated:
     BlockCache::invalidate_key('coll_ID', $this->ID);
     // Fine grained invalidation:
     // EXPERIMENTAL: Below are more granular invalidation dates:
     BlockCache::invalidate_key('set_coll_ID', $this->ID);
     // Settings have changed
     BlockCache::invalidate_key('set_coll_ID', 'any');
     // Settings of a have changed (for widgets tracking a change on ANY blog)
     // cont_coll_ID  // Content has not changed
 }
Esempio n. 3
0
 /**
  * Update the DB based on previously recorded changes
  */
 function dbupdate()
 {
     global $DB;
     $DB->begin();
     parent::dbupdate();
     if (isset($this->CollectionSettings)) {
         $this->CollectionSettings->dbupdate();
     }
     $DB->commit();
 }
    }
    $subs_blog_IDs[] = $blog_sub->blog_ID;
    $subscriptions = array(array('sub_items_' . $blog_sub->blog_ID, '1', T_('All posts'), $blog_sub->sub_items), array('sub_comments_' . $blog_sub->blog_ID, '1', T_('All comments'), $blog_sub->sub_comments));
    $Form->checklist($subscriptions, 'subscriptions', format_to_output($blog_sub->blog_shortname, 'htmlbody'));
}
$Form->hidden('subs_blog_IDs', implode(',', $subs_blog_IDs));
if ($is_admin_page && $Settings->get('subscribe_new_blogs') == 'page') {
    // To subscribe from blog page only
    $Form->info_field('', T_('In order to subscribe to a new blog, go to the relevant blog and subscribe from there.'), array('class' => 'info_full'));
} else {
    // To subscribe from current list of blogs
    // Init $BlogCache object to display a select list to subscribe
    $BlogCache = new BlogCache();
    $BlogCache_SQL = $BlogCache->get_SQL_object();
    load_class('collections/model/_collsettings.class.php', 'CollectionSettings');
    $CollectionSettings = new CollectionSettings();
    if ($CollectionSettings->get_default('allow_subscriptions') == 0) {
        // If default setting disables to subscribe on blogs, we should get only the blogs which allow the subsriptions
        $BlogCache_SQL->FROM_add('LEFT JOIN T_coll_settings ON cset_coll_ID = blog_ID');
        $BlogCache_SQL->WHERE_and('cset_name = \'allow_subscriptions\'');
        $BlogCache_SQL->WHERE_and('cset_value = 1');
    } else {
        // If default setting enables to subscribe on blogs, we should exclude the blogs which don't allow the subsriptions
        $blogs_settings_SQL = new SQL('Get blogs which don\'t allow the subscriptions');
        $blogs_settings_SQL->SELECT('cset_coll_ID');
        $blogs_settings_SQL->FROM('T_coll_settings');
        $blogs_settings_SQL->WHERE('cset_name = \'allow_subscriptions\'');
        $blogs_settings_SQL->WHERE_and('cset_value = 0');
        $blogs_disabled_subscriptions_IDs = $DB->get_col($blogs_settings_SQL->get());
        if (count($blogs_disabled_subscriptions_IDs)) {
            // Exclude the blogs which don't allow the subscriptions