/**
  * Clears the content cache
  *
  * @ignore
  * @internal
  * @access private
  * @return void
  */
 function ClearCache()
 {
     $gCms = cmsms();
     $smarty = $gCms->GetSmarty();
     cms_content_cache::clear();
     unset($gCms->hrinstance);
     $smarty->clear_all_cache();
     $smarty->clear_compiled_tpl();
     if (is_file(TMP_CACHE_LOCATION . '/contentcache.php')) {
         unlink(TMP_CACHE_LOCATION . '/contentcache.php');
     }
     @touch(cms_join_path(TMP_CACHE_LOCATION, 'index.html'));
     @touch(cms_join_path(TMP_TEMPLATES_C_LOCATION, 'index.html'));
 }
    $config = cmsms()->GetConfig();
    $redirect = false;
    $db =& $this->GetDb();
    # get all content of type advanced that need to be set to active/inactive
    $query = "SELECT C.content_id, C.active\r\n\t\tFROM " . cms_db_prefix() . "content C\r\n\t\tLEFT JOIN " . cms_db_prefix() . "content_props USE_EXP\r\n\t\t\tON USE_EXP.content_id = C.content_id\r\n\t\tLEFT JOIN " . cms_db_prefix() . "content_props START_DATE\r\n\t\t\tON START_DATE.content_id = C.content_id\r\n\t\tLEFT JOIN " . cms_db_prefix() . "content_props END_DATE\r\n\t\t\tON END_DATE.content_id = C.content_id\r\n\t\tWHERE\r\n\t\t\tC.type = ? AND\r\n\t\t\tUSE_EXP.prop_name = ? AND\r\n\t\t\tUSE_EXP.content = ? AND (\r\n\t\t\t\t(\r\n\t\t\t\t\tSTART_DATE.prop_name = ? AND\r\n\t\t\t\t\tSTART_DATE.content <= ? AND\r\n\t\t\t\t\tEND_DATE.prop_name = ? AND\r\n\t\t\t\t\tEND_DATE.content > ? AND\r\n\t\t\t\t\tC.active = ?\r\n\t\t\t\t)\r\n\t\t\t\tOR\r\n\t\t\t\t(\r\n\t\t\t\t\tEND_DATE.prop_name = ? AND\r\n\t\t\t\t\tEND_DATE.content <= ? AND\r\n\t\t\t\t\tC.active = ?\r\n\t\t\t\t)\r\n\t\t\t)\r\n\t\t";
    $dbresult = $db->Execute($query, array('content2', 'use_expire_date', '1', 'start_date', time(), 'end_date', time(), 0, 'end_date', time(), 1));
    $contents = array();
    while ($dbresult && ($row = $dbresult->FetchRow())) {
        if ($row['active']) {
            $contents[$row['content_id']] = 0;
        } else {
            $contents[$row['content_id']] = 1;
        }
    }
    if (count($contents)) {
        cms_content_cache::clear();
        #$this->smarty->clear_all_cache();
        $this->smarty->clear_compiled_tpl();
        foreach ($contents as $contentId => $active) {
            $query = "UPDATE " . cms_db_prefix() . "content\r\n\t\t\t\tSET active = ? WHERE content_id = ?";
            $dbresult = $db->Execute($query, array($active, $contentId));
            if ($contentId == cms_utils::get_current_pageid()) {
                $redirect = $contentId;
            }
        }
    }
    if ($redirect) {
        $params['content'] = '';
        $this->RedirectContent($redirect);
    }
}