当前位置: 首页>>代码示例>>PHP>>正文


PHP Cache_Lite::clean方法代码示例

本文整理汇总了PHP中Cache_Lite::clean方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache_Lite::clean方法的具体用法?PHP Cache_Lite::clean怎么用?PHP Cache_Lite::clean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cache_Lite的用法示例。


在下文中一共展示了Cache_Lite::clean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CacheDelete

 public function CacheDelete($mode = TRUE)
 {
     $cacheoptions = array('automaticCleaningFactor' => '100', 'cacheDir' => dirname(__FILE__) . '/nicocache/cache/');
     $CacheLite = new Cache_Lite($cacheoptions);
     if ($mode) {
         $flag = $CacheLite->clean();
     } else {
         $flag = $CacheLite->clean(FALSE, 'old');
     }
     return $flag;
 }
开发者ID:NsProject,项目名称:NicoSubLine-OPNE-,代码行数:11,代码来源:nicoclass.php

示例2: intercept_page

 public function intercept_page(&$page)
 {
     if ($this->_in_excluded_pages()) {
         return;
     }
     $frontend = Frontend::instance();
     $logged_in = $frontend->isLoggedIn();
     $headers = $page['page']->_headers;
     $url = getCurrentPage();
     $options = array('cacheDir' => CACHE . "/", 'lifeTime' => $this->_get_lifetime());
     $cl = new Cache_Lite($options);
     if ($page['page']->_param['url-flush'] == 'site') {
         $cl->clean();
     } else {
         if (array_key_exists('url-flush', $page['page']->_param)) {
             $cl->remove($url);
         } else {
             if (!$logged_in && ($output = $cl->get($url))) {
                 # Ensure the original headers are served out
                 foreach ($headers as $header) {
                     header($header);
                 }
                 print $output;
                 if ($this->_get_comment_pref() == 'yes') {
                     echo "<!-- Cache served: " . $cl->_fileName . " -->";
                 }
                 exit;
             }
         }
     }
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:31,代码来源:extension.driver.php

示例3: clean_usericoncache

function clean_usericoncache($user)
{
    if ($user instanceof steam_user) {
        $user->delete_value("OBJ_ICON");
        $icon = $user->get_attribute("OBJ_ICON");
        clean_iconcache($icon);
        // Clean Icon data from cache
        require_once "Cache/Lite.php";
        $cache = new Cache_Lite(array("cacheDir" => PATH_CACHE));
        $cache->clean($user->get_name());
        // Clean profile data from cache
        $cache = get_cache_function($user->get_name(), 86400);
        $cache->drop("lms_steam::user_get_profile", $user->get_name());
        // TODO: In Menu "Your Desktop" some Icon data comes from lms_user
        // stored in session => delete/refresh this value in session here
        $portal = $GLOBALS["portal"];
        $steam_user = $portal->get_user();
        $steam_user->init_attributes();
    }
}
开发者ID:rolwi,项目名称:koala,代码行数:20,代码来源:profile_icon.php

示例4: clean

 /**
  * Clean cache for a group given a mode.
  *
  * group mode    : cleans all cache in the group
  * notgroup mode : cleans all cache not in the group
  *
  * @param   string  $group  The cache data group
  * @param   string  $mode   The mode for cleaning cache [group|notgroup]
  *
  * @return  boolean
  *
  * @since   11.1
  */
 public function clean($group, $mode = null)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     switch ($mode) {
         case 'notgroup':
             $clmode = 'notingroup';
             $success = static::$CacheLiteInstance->clean($group, $clmode);
             break;
         case 'group':
             if (is_dir($this->_root . '/' . $group)) {
                 $clmode = $group;
                 static::$CacheLiteInstance->setOption('cacheDir', $this->_root . '/' . $group . '/');
                 $success = static::$CacheLiteInstance->clean($group, $clmode);
                 // Remove sub-folders of folder; disable all filtering
                 $folders = JFolder::folders($this->_root . '/' . $group, '.', false, true, array(), array());
                 foreach ($folders as $folder) {
                     if (is_link($folder)) {
                         if (JFile::delete($folder) !== true) {
                             return false;
                         }
                     } elseif (JFolder::delete($folder) !== true) {
                         return false;
                     }
                 }
             } else {
                 $success = true;
             }
             break;
         default:
             if (is_dir($this->_root . '/' . $group)) {
                 $clmode = $group;
                 static::$CacheLiteInstance->setOption('cacheDir', $this->_root . '/' . $group . '/');
                 $success = static::$CacheLiteInstance->clean($group, $clmode);
             } else {
                 $success = true;
             }
             break;
     }
     return $success;
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:54,代码来源:cachelite.php

示例5: showAll

 function showAll()
 {
     $idSite = getRequestVar('site', -1, 'int');
     if ($idSite == -1) {
         $allSiteArchive = DataModel::getSites();
     } else {
         $allSiteArchive[] = new Site($idSite);
     }
     $uniqCacheId = DataModel::getSitesSignature() . date("Y-m-d") . serialize($_GET) . '.rss';
     // Set a few options
     $options = array('cacheDir' => DIR_CACHE_RSS, 'lifeTime' => CACHE_RSS_LIFETIME);
     // Create a Cache_Lite object
     $Cache_Lite = new Cache_Lite($options);
     if (time() % 500 === 0) {
         $Cache_Lite->clean();
     }
     // Test if thereis a valide cache for this id
     if (SMARTY_DEBUG || !($allData = $Cache_Lite->get($uniqCacheId))) {
         $dataTmp = $this->data;
         $o_config =& PmvConfig::getInstance();
         $allItems = array();
         foreach ($allSiteArchive as $id => $infoSite) {
             $allArchives = $dataTmp->getLastArchives(NB_DAYS_FOR_RSS_ITEMS, 0, DATE_NORMAL, $infoSite);
             $i = 0;
             foreach ($allArchives as $date => $o_archive) {
                 //var_dump($date);
                 $this->request->setDate($o_archive->date->get());
                 $this->request->setModuleName('view_visits_rss');
                 $o_mod = new ViewVisitsRss($infoSite);
                 $o_mod->init($this->request, $this->tpl, $o_archive);
                 //var_dump($o_mod->data->archive->date->get());
                 $rssContent = $o_mod->showAll(true);
                 $dateRss = date("r", time() - 100 * $i++ - 10 * $id);
                 $item['pubDate'] = $dateRss;
                 $url = PHPMV_URL . "/?site=" . $infoSite->getId() . "&mod=view_visits&date=" . $o_archive->date->get();
                 $item['guid'] = $url;
                 //"http://www.phpmyvisites.us/".md5($dateRss);
                 $item['link'] = $url;
                 $item['title'] = vsprintf($GLOBALS['lang']['rss_titre'], array($infoSite->getName(), $date));
                 $rssContent = $item['title'] . $rssContent;
                 $item['author'] = "phpmyvisites@gmail.com (phpMyVisites)";
                 $item['date_ts'] = time() - 10 * $id;
                 $item['description'] = $rssContent;
                 $item['date_ts'] = $o_archive->date->getTimestamp();
                 $allItems[] = $item;
                 $urls[] = $url;
             }
         }
         $GLOBALS['sorting_index'] = 'date_ts';
         uasort($allItems, "sortingDataInfo");
         $channel['title'] = "phpMyVisites stats by RSS";
         $channel['link'] = "http://www.phpmyvisites.us";
         $channel['description'] = "Enjoy phpmyvisites power ! :)";
         $channel['pubDate'] = date("r");
         $channel['generator'] = "phpMyVisites";
         $channel['language'] = $GLOBALS['lang']['lang_iso'];
         $channel['lastBuildDate'] = date("r");
         foreach ($allItems as $chan) {
             unset($chan['date_ts']);
             $channel[] = $chan;
         }
         $rss = array('channel' => $channel);
         // An array of serializer options
         $serializer_options = array('addDecl' => TRUE, 'encoding' => 'UTF-8', 'indent' => '  ', 'rootName' => 'rss', 'defaultTagName' => 'item', 'rootAttributes' => array('version' => '2.0'));
         $Serializer =& new XML_Serializer($serializer_options);
         // Serialize the data structure
         $Serializer->setOption("keyAttribute", "rdf:about");
         $status = $Serializer->serialize($rss);
         $allData = $Serializer->getSerializedData();
         $Cache_Lite->save($allData);
     }
     $this->displayRss($allData);
 }
开发者ID:ber5ien,项目名称:www.jade-palace.co.uk,代码行数:73,代码来源:ViewRss.class.php

示例6: clean

 public function clean($group = null)
 {
     $this->LOGGER->info($group ? "Очистка кеша по группе [{$group}]" : 'Полная очистка кеша');
     $this->CACHELITE->clean($group);
     if ($group) {
         //Эту группу больше не нужно валидировать
         $this->TREE->setGroupValidated($group);
         //Очистим ключи локального хранилища
         $keys = $this->CACHE->keys();
         $removed = array();
         $prefix = $this->localCacheGroup($group);
         foreach ($keys as $key) {
             if (starts_with($key, $prefix)) {
                 $removed[] = $key;
                 $this->CACHE->remove($key);
             }
         }
         if ($removed) {
             $this->LOGGER->info('В локальном кеше были удалены следующие ключи: {}.', concat($removed));
         }
     } else {
         $this->CACHE->clear();
         $this->TREE->setAllValidated('Полная очистка кеша');
     }
 }
开发者ID:ilivanoff,项目名称:www,代码行数:25,代码来源:PSCache.php

示例7: execute

 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->params[0];
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     //if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     //{
     //	include( "bad_link.php" );
     //	exit;
     //}
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $date->get_environment()->get_id());
         } else {
             include "bad_link.php";
             exit;
         }
     } else {
         $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $weblogId);
         define("OBJ_ID", $weblogId);
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     $date = $weblog;
     //if(!isset($date))
     //throw new \Exception("variable date is not set.");
     //if ( $_SERVER[ "REQUEST_METHOD" ] == "POST" && $date->check_access_write( $user ) )
     if (false) {
         $values = $_POST["values"];
         if (!isset($values["delete"])) {
             $values["delete"] = false;
         }
         if ($values["delete"]) {
             require_once "Cache/Lite.php";
             $cache = new Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache->clean($weblog->get_id());
             $cache->clean($date->get_id());
             $trashbin = $GLOBALS["STEAM"]->get_current_steam_user();
             if (is_object($trashbin)) {
                 $date->move($trashbin);
             } else {
                 $date->delete();
             }
         }
         header("Location: " . $values["return_to"]);
         exit;
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         //echo "hund";
         $values = $_POST["values"];
         $problem = "";
         $hint = "";
         if (isset($values["save"])) {
             $values["save"] = true;
         } else {
             $values["save"] = false;
         }
         if ($values["save"]) {
             if (empty($values["url"])) {
                 $problem = gettext("The URL is missing.") . " ";
                 $hint = gettext("Please insert the URL, starting with 'http://'") . " ";
             }
             if (empty($values["name"])) {
                 $problem .= gettext("The name is missing.");
                 $hint .= gettext("How is the title of the webpage?");
             } else {
                 if (strpos($values["name"], "/")) {
                     if (!isset($problem)) {
                         $problem = "";
                     }
                     $problem .= gettext("Please don't use the \"/\"-char in the name of the blogroll entry.");
                 }
             }
             if (empty($problem)) {
                 $environment = $weblog->get_blogroll();
                 if (!is_object($environment)) {
                     throw new \Exception("Environment is not correct.");
                 }
                 if (!$environment instanceof \steam_container) {
                     throw new \Exception("Environment is no container.");
                 }
                 if (!$environment->check_access_write($user)) {
                     throw new \Exception("No write access on this container.", E_USER_RIGHTS);
                 }
                 if (empty($problem)) {
                     $docextern = \steam_factory::create_docextern($GLOBALS["STEAM"]->get_id(), $values["name"], $values["url"], $environment, $values["desc"]);
                     header("Location: " . $values["return_to"]);
                     exit;
                 } else {
                     //TODO: PROBDESC
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Blogroll.class.php

示例8: cleanup

 /**
  * Performs data store cleanup (removes all expired items)
  *
  * @return	bool
  */
 public function cleanup()
 {
     return $this->cache_lite->clean('vivvo_cache', 'old') === true;
 }
开发者ID:ahanjir07,项目名称:vivvo-dev,代码行数:9,代码来源:Cache_Lite.php

示例9: cleanPluginCache

 /**
  * A method to delete cached plugin data.
  *
  * @static
  * @param string $module The plugin module name (i.e. /plugins/module directory).
  * @param string $package The plugin package name (i.e. /plugins/module/package
  *                        directory).
  * @param string $name Optional name of the PHP file which contains the plugin,
  *                     otherwise the plugin with the same name as the package
  *                     is assumed.
  * @param string $mode An optional PEAR::Cache_Lite cleaning mode. Default is
  *                     'ingroup', to delete all cached data for the plugin.
  * @param array $aOptions An optional array of constructor options for
  *                        PEAR::Cache_Lite. The default values are those
  *                        obtained from {@link MAX_Plugin::prepareCacheOptions()}.
  * @return boolean True on success, false otherwise.
  */
 function cleanPluginCache($module, $package, $name = null, $mode = 'ingroup', $aOptions = null)
 {
     if (is_null($name)) {
         $name = $package;
     }
     if (is_null($aOptions)) {
         $aOptions = MAX_Plugin::prepareCacheOptions($module, $package);
     }
     $oCache = new Cache_Lite($aOptions);
     return $oCache->clean($name, $mode);
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:28,代码来源:Plugin.php

示例10: Date

                }
                $oStartDate = new Date($oConnectionDate->format('%Y-%m-%d %H:00:00'));
                $oEndDate = new Date($oConnectionDate->format('%Y-%m-%d %H:00:00'));
                $oDal->_saveSummaryUpdateWithFinanceInfo($oStartDate, $oEndDate, $data_summary_table);
                if (!is_null($plugin)) {
                    $plugin->serviceLocatorRemove();
                }
            }
        }
    }
    if ($modified) {
        // Clear cache
        include_once 'Cache/Lite.php';
        $options = array('cacheDir' => MAX_CACHE);
        $cache = new Cache_Lite($options);
        $cache->clean(OX_getHostName() . 'stats');
    }
}
$addUrl = "entity=conversions&clientid={$clientId}&campaignid={$campaignId}&bannerid={$bannerId}&affiliateid={$affiliateId}&zoneid={$zoneId}";
if (!empty($period_preset)) {
    $addUrl .= "&period_preset={$period_preset}&period_start={$period_start}&period_end={$period_end}";
}
if (!empty($day)) {
    $addUrl .= "&day={$day}";
}
if (!empty($howLong)) {
    $addUrl .= "&howLong={$howLong}";
}
if (!empty($hour)) {
    $addUrl .= "&hour={$hour}";
}
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:31,代码来源:connections-modify.php

示例11: processCampaignForm


//.........这里部分代码省略.........
        }
        if ($aFields['companion'] != 1) {
            $aFields['companion'] = 0;
        }
        if ($aFields['show_capped_no_cookie'] != 1) {
            $aFields['show_capped_no_cookie'] = 0;
        }
        $new_campaign = $aFields['campaignid'] == 'null';
        if (empty($aFields['revenue']) || $aFields['revenue'] <= 0) {
            // No revenue information, set to null
            $aFields['revenue'] = OX_DATAOBJECT_NULL;
        }
        if (empty($aFields['ecpm']) || $aFields['ecpm'] <= 0) {
            // No ecpm information, set to null
            $aFields['ecpm'] = OX_DATAOBJECT_NULL;
        }
        // Get the capping variables
        $block = _initCappingVariables($aFields['time'], $aFields['capping'], $aFields['session_capping']);
        $doCampaigns = OA_Dal::factoryDO('campaigns');
        $doCampaigns->campaignname = $aFields['campaignname'];
        $doCampaigns->clientid = $aFields['clientid'];
        $doCampaigns->views = $aFields['impressions'];
        $doCampaigns->clicks = $aFields['clicks'];
        $doCampaigns->conversions = $aFields['conversions'];
        $doCampaigns->priority = $aFields['priority'];
        $doCampaigns->weight = $aFields['weight'];
        $doCampaigns->target_impression = $target_impression;
        $doCampaigns->target_click = $target_click;
        $doCampaigns->target_conversion = $target_conversion;
        $doCampaigns->min_impressions = $aFields['min_impressions'];
        $doCampaigns->ecpm = $aFields['ecpm'];
        $doCampaigns->anonymous = $aFields['anonymous'];
        $doCampaigns->companion = $aFields['companion'];
        $doCampaigns->show_capped_no_cookie = $aFields['show_capped_no_cookie'];
        $doCampaigns->comments = $aFields['comments'];
        $doCampaigns->revenue = $aFields['revenue'];
        $doCampaigns->revenue_type = $aFields['revenue_type'];
        $doCampaigns->block = $block;
        $doCampaigns->capping = $aFields['capping'];
        $doCampaigns->session_capping = $aFields['session_capping'];
        // Activation and expiration
        $doCampaigns->activate_time = isset($activate) ? $activate : OX_DATAOBJECT_NULL;
        $doCampaigns->expire_time = isset($expire) ? $expire : OX_DATAOBJECT_NULL;
        if (!empty($aFields['campaignid']) && $aFields['campaignid'] != "null") {
            $doCampaigns->campaignid = $aFields['campaignid'];
            $doCampaigns->setEcpmEnabled();
            $doCampaigns->update();
        } else {
            $doCampaigns->setEcpmEnabled();
            $aFields['campaignid'] = $doCampaigns->insert();
        }
        if ($oComponent) {
            $oComponent->processCampaignForm($aFields);
        }
        // Recalculate priority only when editing a campaign
        // or moving banners into a newly created, and when:
        //
        // - campaign changes status (activated or deactivated) or
        // - the campaign is active and target/weight are changed
        //
        if (!$new_campaign) {
            $doCampaigns = OA_Dal::staticGetDO('campaigns', $aFields['campaignid']);
            $status = $doCampaigns->status;
            switch (true) {
                case (bool) $status != (bool) $aFields['status_old']:
                    // Run the Maintenance Priority Engine process
                    OA_Maintenance_Priority::scheduleRun();
                    break;
                case $status == OA_ENTITY_STATUS_RUNNING:
                    if (!empty($aFields['target_type']) && ${$aFields['target_type']} != $aFields['target_old'] || !empty($aFields['target_type']) && $aFields['target_type_old'] != $aFields['target_type'] || $aFields['weight'] != $aFields['weight_old'] || $aFields['clicks'] != $aFields['previousclicks'] || $aFields['conversions'] != $aFields['previousconversions'] || $aFields['impressions'] != $aFields['previousimpressions']) {
                        // Run the Maintenance Priority Engine process
                        OA_Maintenance_Priority::scheduleRun();
                    }
                    break;
            }
        }
        // Rebuild cache
        // include_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php';
        // phpAds_cacheDelete();
        // Delete channel forecasting cache
        include_once 'Cache/Lite.php';
        $options = array('cacheDir' => MAX_CACHE);
        $cache = new Cache_Lite($options);
        $group = 'campaign_' . $aFields['campaignid'];
        $cache->clean($group);
        $translation = new OX_Translation();
        if ($new_campaign) {
            // Queue confirmation message
            $translated_message = $translation->translate($GLOBALS['strCampaignHasBeenAdded'], array(MAX::constructURL(MAX_URL_ADMIN, 'campaign-edit.php?clientid=' . $aFields['clientid'] . '&campaignid=' . $aFields['campaignid']), htmlspecialchars($aFields['campaignname']), MAX::constructURL(MAX_URL_ADMIN, 'banner-edit.php?clientid=' . $aFields['clientid'] . '&campaignid=' . $aFields['campaignid'])));
            OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
            OX_Admin_Redirect::redirect("advertiser-campaigns.php?clientid=" . $aFields['clientid']);
        } else {
            $translated_message = $translation->translate($GLOBALS['strCampaignHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, 'campaign-edit.php?clientid=' . $aFields['clientid'] . '&campaignid=' . $aFields['campaignid']), htmlspecialchars($aFields['campaignname'])));
            OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
            OX_Admin_Redirect::redirect("campaign-edit.php?clientid=" . $aFields['clientid'] . "&campaignid=" . $aFields['campaignid']);
        }
    }
    //return processing errors
    return $errors;
}
开发者ID:Apeplazas,项目名称:plazadelatecnologia,代码行数:101,代码来源:campaign-edit.php

示例12: execute

 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //var_dump($GLOBALS[ "STEAM" ]->get_id());
     //		$portal = \lms_portal::get_instance();
     //		$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //		$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->id;
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     //if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     //{
     //	include( "bad_link.php" );
     //	exit;
     //}
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $date->get_environment()->get_id());
         } else {
             include "bad_link.php";
             exit;
         }
     } else {
         $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $weblogId);
         define("OBJ_ID", $weblogId);
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     $content = \Weblog::getInstance()->loadTemplate("weblog_entry_edit.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "weblog_entry_edit.template.html" );
     if ($_SERVER["REQUEST_METHOD"] == "GET") {
         $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $date->check_access_write($user)) {
         $values = $_POST["values"];
         if (!empty($values["save"])) {
             $problem = "";
             $hint = "";
             if (empty($values["title"])) {
                 $problem .= gettext("The title is missing.") . "&nbsp;";
                 $hint .= gettext("Please add the missing values.");
             }
             if (empty($values["body"])) {
                 $problem .= gettext("There is no message for your readers.") . "&nbsp;";
                 $hint .= gettext("Please write your post into the text area.");
             }
             if (!empty($values["category"]) && $values["category"] != 0) {
                 $category = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $values["category"]);
                 if (!$category instanceof \steam_container) {
                     throw new \Exception("Not a valid category: " . $values["category"]);
                 }
             } else {
                 $category = "";
             }
             if (!($timestamp = strtotime($values["date"] . ":00"))) {
                 $problem .= gettext("I cannot parse the date and time.");
                 $hint .= gettext("Please verify your date and time format") . ": YYYY-MM-DD HH:MM";
             }
             if (empty($problem)) {
                 require_once "Cache/Lite.php";
                 $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
                 $cache->clean($weblog->get_id());
                 $cache->clean($date->get_id());
                 $attributes = array("DATE_START_DATE" => $timestamp, "DATE_TITLE" => $values["title"], "DATE_DESCRIPTION" => $values["body"]);
                 $date->set_attributes($attributes);
                 $weblog->categorize_entry($date, $category);
                 header("Location: " . $values["return_to"]);
                 exit;
             } else {
                 //TODO: PROBLEMDESCRIPTION
                 //$portal->set_problem_description( $problem, $hint );
             }
         }
         if ($values["preview"]) {
             $content->setCurrentBlock("BLOCK_PREVIEW");
             $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the edit"));
             $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["body"]));
             $content->parse("BLOCK_PREVIEW");
         }
     }
     $content->setVariable("LABEL_HERE_IT_IS", "");
     $content->setVariable("LABEL_DATE", gettext("Date"));
     $content->setVariable("LABEL_SUBJECT", gettext("Subject"));
     $content->setVariable("LABEL_CATEGORY", gettext("Category"));
     $content->setVariable("CAT_NO_SELECTION", gettext("nothing selected"));
     $content->setVariable("LABEL_YOUR_POST", gettext("Your post"));
     $content->setVariable("LABEL_PREVIEW", gettext("Preview"));
     $content->setVariable("LABEL_SAVE_CHANGES", gettext("Save changes"));
     $content->setVariable("LABEL_RETURN", gettext("back"));
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Entryedit.class.php

示例13: h

$user = lms_steam::get_current_user();
if ($_SERVER["REQUEST_METHOD"] == "POST" && $object->check_access_write($user)) {
    $values = $_POST["values"];
    if ($values["delete"]) {
        $_SESSION["confirmation"] = str_replace("%NAME", h($object->get_name()), gettext("The forum '%NAME' has been deleted."));
        $workroom = $object->get_environment();
        lms_steam::delete($object);
        // Clean Cache for the deleted Forum
        require_once "Cache/Lite.php";
        $cache = new Cache_Lite(array("cacheDir" => PATH_CACHE));
        $cache = get_cache_function(OBJ_ID, 600);
        $cache->drop("lms_steam::get_annotations", OBJ_ID);
        // Handle Related Cache-Data
        require_once "Cache/Lite.php";
        $cache = new Cache_Lite(array("cacheDir" => PATH_CACHE));
        $cache->clean(OBJ_ID);
        // clean forum cache
        $fcache = get_cache_function(OBJ_ID, 600);
        $fcache->drop("lms_forum::get_discussions", OBJ_ID);
        // clean cache for forum RSS Feed for the Comments
        $fcache->drop("lms_steam::get_annotations", OBJ_ID);
        // clean rsscache
        $rcache = get_cache_function("rss", 600);
        $feedlink = PATH_URL . "services/feeds/forum_public.php?id=" . OBJ_ID;
        $rcache->drop("lms_rss::get_items", $feedlink);
        // Clean communication summary cache für the group/course
        if (is_object($workroom)) {
            $cache = get_cache_function(lms_steam::get_current_user()->get_name(), 600);
            $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_MESSAGEBOARD, array("FORUM_LANGUAGE"));
            $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
        }
开发者ID:rolwi,项目名称:koala,代码行数:31,代码来源:forum_delete.php

示例14: frameResponse

 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $forum_id = $this->params[0];
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     $rss_feeds = $user->get_attribute("USER_RSS_FEEDS");
     if (!($messageboard = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $forum_id))) {
         include "bad_link.php";
         exit;
     }
     if ($messageboard instanceof \steam_document) {
         $thread = $messageboard;
         $messageboard = $thread->get_annotating();
         define("OBJ_ID", $thread->get_id());
         if (!$thread->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     } else {
         define("OBJ_ID", $messageboard->get_id());
         if (!$messageboard->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     if (!$messageboard instanceof \steam_messageboard) {
         include "bad_link.php";
         exit;
     }
     $is_watching = FALSE;
     if (is_array($rss_feeds)) {
         foreach (array_keys($rss_feeds) as $item) {
             if ($item == $messageboard->get_id()) {
                 $is_watching = TRUE;
             }
         }
     }
     $content = \Messageboard::getInstance()->loadTemplate("forum_post.template.html");
     $headline = gettext("Post a new topic");
     // TODO: Passt der link?
     $backlink = empty($_POST["values"]["backlink"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["backlink"];
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         $problems = "";
         if (empty($values["title"])) {
             $problems = gettext("Please enter a subject for your message.");
         }
         if (empty($values["body"])) {
             $problems .= empty($problems) ? gettext("Please enter your message.") : "<br>" . gettext("Please enter your message.");
         }
         if (get_magic_quotes_gpc()) {
             if (!empty($values['title'])) {
                 $values['title'] = stripslashes($values['title']);
             }
             if (!empty($values['body'])) {
                 $values['body'] = stripslashes($values['body']);
             }
         }
         if (!empty($problems)) {
             $portal->set_problem_description($problems);
         }
         if (!empty($values["preview_comment"])) {
             $content->setCurrentBlock("BLOCK_PREVIEW_COMMENT");
             $content->setVariable("TEXT_COMMENT", get_formatted_output($values["body"]));
             $content->setVariable("LABEL_PREVIEW_YOUR_COMMENT", gettext("Preview your comment"));
             $template->parse("BLOCK_PREVIEW_COMMENT");
             $headline = gettext("Change it?");
         }
         if (!empty($values["save"]) && empty($problems)) {
             if (!strpos($values["title"], "/")) {
                 $new_thread = $messageboard->add_thread($values["title"], $values["body"]);
                 //      		$all_user = steam_factory::groupname_to_object( $GLOBALS[ "STEAM" ]->get_id(), STEAM_ALL_USER );
                 //      		$new_thread->set_acquire( FALSE );
                 //      		$new_thread->set_read_access( $all_user, TRUE );
                 //      		$new_thread->set_write_access( $all_user, FALSE );
                 //      		$new_thread->set_annotate_access( $all_user, TRUE );
                 // Handle Related Cache-Data
                 require_once "Cache/Lite.php";
                 $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
                 $cache->clean(OBJ_ID);
                 // clean forumcache
                 $fcache = get_cache_function($forum_id, 600);
                 $fcache->drop("lms_forum::get_discussions", $forum_id);
                 // clean rsscache of the forum
                 // TODO: Passt der link?
                 $feedlink = PATH_URL . "services/feeds/forum_public.php?id=" . $forum_id;
                 $rcache = get_cache_function("rss", 600);
                 $rcache->drop("lms_rss::get_items", $feedlink);
                 header("Location: " . PATH_URL . "messageboard/viewDiscussion/" . $new_thread->get_id() . "/");
                 exit;
             } else {
                 $portal->set_problem_description(gettext("Please don't use the \"/\"-char in the title."));
             }
         }
         if (!empty($values["preview"]) && !empty($values['body'])) {
             // PREVIEW
             $content->setCurrentBlock("BLOCK_PREVIEW");
             $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the edit"));
             $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["body"]));
             $content->parse("BLOCK_PREVIEW");
             $headline = gettext("Change it?");
         }
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:NewDiscussion.class.php

示例15: execute

 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //		$portal = \lms_portal::get_instance();
     //	$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->id;
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     //if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     //{
     //	include( "bad_link.php" );
     //	exit;
     //}
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog($GLOBALS["STEAM"], $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog($GLOBALS["STEAM"], $date->get_environment()->get_id());
         } else {
             include "bad_link.php";
             exit;
         }
     } else {
         $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $weblogId);
         if (!defined("OBJ_ID")) {
             define("OBJ_ID", $weblogId);
         }
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $category->check_access_write($user)) {
         $values = $_POST["values"];
         if ($values["delete"]) {
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache->clean($weblog->get_id());
             $link_objects = $category->get_inventory(CLASS_LINK);
             foreach ($link_objects as $link_object) {
                 $date_object = $link_object->get_source_object();
                 $link_object->delete();
                 if ($values["delete_all_dates"]) {
                     $date_object->delete();
                 } else {
                     $date_object->set_attribute("DATE_CATEGORY", "0");
                 }
             }
             $category->delete();
         }
         header("Location: " . PATH_URL . "weblog/" . $weblog->get_id() . "/");
         exit;
     }
     $content = \Weblog::getInstance()->loadTemplate("weblog_category_delete.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "weblog_category_delete.template.html" );
     $content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure you want to delete this category?"));
     $content->setVariable("NAME_CATEGORY", h($category->get_name()));
     $content->setVariable("TEXT_CATEGORY", get_formatted_output($category->get_attribute("OBJ_DESC")));
     $content->setVariable("LABEL_DELETE_ALL_DATES", str_replace("%NO", count($category->get_inventory(CLASS_LINK)), gettext("Should all %NO entries in this category be deleted, too?")));
     $content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it"));
     $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
     $content->setVariable("LABEL_RETURN", gettext("back"));
     $rootlink = \lms_steam::get_link_to_root($weblog);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("link" => PATH_URL . "weblog/" . $category->get_id() . "/", "name" => h($category->get_name())), array("link" => "", "name" => str_replace("%NAME", h($category->get_name()), gettext("Delete '%NAME'?"))));
     /*$portal->set_page_main(
     		$headline,
     		$content->get(),
     	""
     		);
     		return $portal->get_html();*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
开发者ID:rolwi,项目名称:koala,代码行数:80,代码来源:CategoryDelete.class.php


注:本文中的Cache_Lite::clean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。