コード例 #1
0
ファイル: bit_setup_inc.php プロジェクト: bitweaver/liberty
 * @package  liberty
 * @subpackage functions
 */
$registerHash = array('package_name' => 'liberty', 'package_path' => dirname(__FILE__) . '/', 'required_package' => TRUE);
$gBitSystem->registerPackage($registerHash);
// initiate LibertySystem
require_once LIBERTY_PKG_PATH . 'LibertySystem.php';
LibertySystem::loadSingleton();
$gBitSmarty->assignByRef('gLibertySystem', $gLibertySystem);
// We can't load this in liberty/bit_setup_inc.php becuase it's too soon in the process.
// packages haven't been scanned yet making things like <pkg>_PKG_URL and similar
// unavailable to the plugins that are kept in <pkg>/liberty_plugins/
$current_default_format_guid = $gBitSystem->getConfig('default_format');
if ($gLibertySystem->mDb->isValid()) {
    // install condition check
    $plugin_status = $gBitSystem->getConfig('liberty_plugin_status_' . $current_default_format_guid);
    if (empty($current_default_format_guid) || empty($plugin_status) || $plugin_status != 'y') {
        $gLibertySystem->scanAllPlugins();
    } else {
        $gLibertySystem->loadActivePlugins();
    }
}
$gLibertySystem->registerService('liberty', LIBERTY_PKG_NAME, array('content_edit_mini_tpl' => 'bitpackage:liberty/service_content_edit_mini_inc.tpl', 'content_edit_tab_tpl' => 'bitpackage:liberty/service_content_edit_tab_inc.tpl', 'content_icon_tpl' => 'bitpackage:liberty/service_content_icon_inc.tpl', 'content_body_tpl' => 'bitpackage:liberty/service_content_body_inc.tpl', 'content_display_function' => 'liberty_content_display', 'content_edit_function' => 'liberty_content_edit', 'content_load_sql_function' => 'liberty_content_load_sql', 'content_list_sql_function' => 'liberty_content_list_sql', 'content_preview_function' => 'liberty_content_preview'), array('description' => tra('Provides core functionality, including enforcing some access control and dynamic layout components.'), 'required' => TRUE));
// delete cache file if requested
if (!empty($_REQUEST['refresh_liberty_cache']) && BitBase::verifyId($_REQUEST['refresh_liberty_cache'])) {
    require_once LIBERTY_PKG_PATH . 'LibertyContent.php';
    LibertyContent::expungeCacheFile($_REQUEST['refresh_liberty_cache']);
}
// make thumbnail sizes available to smarty
global $gThumbSizes;
$gBitSmarty->assignByRef('gThumbSizes', $gThumbSizes);
コード例 #2
0
ファイル: LibertyContent.php プロジェクト: bitweaver/liberty
 /**
  * Delete content object and all related records
  *
  * @access public
  * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
  */
 function expunge()
 {
     global $gBitSystem, $gLibertySystem;
     $ret = FALSE;
     if ($this->isValid()) {
         $this->StartTrans();
         $this->expungeComments();
         // services, filters and cache
         $this->invokeServices('content_expunge_function', $this);
         if ($this->getField('format_guid') && ($func = $gLibertySystem->getPluginFunction($this->getField('format_guid'), 'expunge_function'))) {
             $func($this->mContentId);
         }
         $this->filterData($this->mInfo['data'], $this->mInfo, 'expunge');
         LibertyContent::expungeCacheFile($this->mContentId);
         // remove favorites - this probably should be a content_expunge_function in users
         $this->mDb->query("DELETE FROM `" . BIT_DB_PREFIX . "users_favorites_map` WHERE `favorite_content_id`=?", array($this->mContentId));
         // remove entries in the history
         $this->expungeVersion();
         // Remove individual permissions for this object if they exist
         $query = "delete from `" . BIT_DB_PREFIX . "liberty_content_permissions` where `content_id`=?";
         $result = $this->mDb->query($query, array($this->mContentId));
         // Remove aliases
         $this->mDb->query("DELETE FROM `" . BIT_DB_PREFIX . "liberty_aliases` WHERE `content_id`=?", array($this->mContentId));
         // Remove structures
         // it's not this simple. what about orphans? needs real work. :( xoxo - spider
         //			$query = "DELETE FROM `".BIT_DB_PREFIX."liberty_structures` WHERE `content_id` = ?";
         //			$result = $this->mDb->query( $query, array( $this->mContentId ) );
         // Remove any queued data processing (images, movies, etc.)
         $query = "DELETE FROM `" . BIT_DB_PREFIX . "liberty_process_queue` WHERE `content_id` = ?";
         $result = $this->mDb->query($query, array($this->mContentId));
         // Remove data
         $query = "DELETE FROM `" . BIT_DB_PREFIX . "liberty_content_data` WHERE `content_id` = ?";
         $result = $this->mDb->query($query, array($this->mContentId));
         // Remove hits
         $query = "DELETE FROM `" . BIT_DB_PREFIX . "liberty_content_hits` WHERE `content_id` = ?";
         $result = $this->mDb->query($query, array($this->mContentId));
         // Remove content preferences
         $query = "DELETE FROM `" . BIT_DB_PREFIX . "liberty_content_prefs` WHERE `content_id` = ?";
         $result = $this->mDb->query($query, array($this->mContentId));
         // Remove content links
         $query = "DELETE FROM `" . BIT_DB_PREFIX . "liberty_content_links` WHERE `to_content_id` = ? or `from_content_id` = ?";
         $result = $this->mDb->query($query, array($this->mContentId, $this->mContentId));
         // Remove content
         $query = "DELETE FROM `" . BIT_DB_PREFIX . "liberty_content` WHERE `content_id` = ?";
         $result = $this->mDb->query($query, array($this->mContentId));
         $this->mLogs['content_expunge'] = "Deleted";
         $this->storeActionLog();
         $this->CompleteTrans();
         $ret = TRUE;
         parent::expunge();
     }
     return $ret;
 }
コード例 #3
0
ファイル: filter.bitlinks.php プロジェクト: kailIII/liberty
 /**
  * expunge bitlinks in the database
  *
  * @param numeric $pContentId
  * @access public
  * @return void
  */
 function expungeLinks($pContentId)
 {
     if (!empty($pContentId)) {
         // remove any cached file pointing to this page
         $links = $this->mDb->getCol("SELECT `from_content_id` FROM `" . BIT_DB_PREFIX . "liberty_content_links` WHERE to_content_id=?", array($pContentId));
         foreach ($links as $content_id) {
             LibertyContent::expungeCacheFile($content_id);
         }
         $this->mDb->query("DELETE FROM `" . BIT_DB_PREFIX . "liberty_content_links` WHERE from_content_id=? OR to_content_id=?", array($pContentId, $pContentId));
     }
 }