public function execute(HTTPRequestCustom $request)
 {
     $id = $request->get_getint('id', 0);
     if (!empty($id)) {
         try {
             $this->weblink = WebService::get_weblink('WHERE web.id = :id', array('id' => $id));
         } catch (RowNotFoundException $e) {
             $error_controller = PHPBoostErrors::unexisting_page();
             DispatchManager::redirect($error_controller);
         }
     }
     if ($this->weblink !== null && !DownloadAuthorizationsService::check_authorizations($this->weblink->get_id_category())->read()) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     } else {
         if ($this->weblink !== null && $this->weblink->is_visible()) {
             $this->weblink->set_number_views($this->weblink->get_number_views() + 1);
             WebService::update_number_views($this->weblink);
             WebCache::invalidate();
             AppContext::get_response()->redirect($this->weblink->get_url()->absolute());
         } else {
             $error_controller = PHPBoostErrors::unexisting_page();
             DispatchManager::redirect($error_controller);
         }
     }
 }
Beispiel #2
0
 public static function getStatus($name = "")
 {
     echo "Hallo";
     if ($name == null or $name . "" == "") {
         return 0;
     }
     $web = WebCache::get("http://mystatus.skype.com/" . $name . ".num", 300);
     return $web + 0;
 }
Beispiel #3
0
 /**
  * @param string $project
  * @return array
  */
 public static function getHostsForProject($project)
 {
     $json = WebCache::get('wikitech-v1-' . $project, 'https://wikitech.wikimedia.org/w/api.php?format=json&' . http_build_query(array('action' => 'query', 'list' => 'novainstances', 'niregion' => 'eqiad', 'niproject' => $project)));
     $data = json_decode($json);
     if (!isset($data->query->novainstances)) {
         return array();
     }
     $instances = array_map(function ($obj) {
         return $obj->name;
     }, $data->query->novainstances);
     sort($instances);
     return $instances;
 }
 public function execute(HTTPRequestCustom $request)
 {
     AppContext::get_session()->csrf_get_protect();
     $this->get_weblink($request);
     $this->check_authorizations();
     WebService::delete('WHERE id=:id', array('id' => $this->weblink->get_id()));
     WebService::get_keywords_manager()->delete_relations($this->weblink->get_id());
     PersistenceContext::get_querier()->delete(DB_TABLE_EVENTS, 'WHERE module=:module AND id_in_module=:id', array('module' => 'web', 'id' => $this->weblink->get_id()));
     CommentsService::delete_comments_topic_module('web', $this->weblink->get_id());
     NotationService::delete_notes_id_in_module('web', $this->weblink->get_id());
     Feed::clear_cache('web');
     WebCache::invalidate();
     AppContext::get_response()->redirect($request->get_url_referrer() ? $request->get_url_referrer() : WebUrlBuilder::home(), StringVars::replace_vars(LangLoader::get_message('web.message.success.delete', 'common', 'web'), array('name' => $this->weblink->get_name())));
 }
 public function get_menu_content()
 {
     //Create file template
     $tpl = new FileTemplate('web/WebModuleMiniMenu.tpl');
     //Assign the lang file to the tpl
     $tpl->add_lang(LangLoader::get('common', 'web'));
     //Load module cache
     $web_cache = WebCache::load();
     $partners_weblinks = $web_cache->get_partners_weblinks();
     $tpl->put('C_PARTNERS', !empty($partners_weblinks));
     foreach ($partners_weblinks as $partner) {
         $partner_picture = new Url($partner['partner_picture']);
         $picture = $partner_picture->rel();
         $tpl->assign_block_vars('partners', array('C_HAS_PARTNER_PICTURE' => !empty($picture), 'NAME' => $partner['name'], 'U_PARTNER_PICTURE' => $picture, 'U_VISIT' => WebUrlBuilder::visit($partner['id'])->rel()));
     }
     return $tpl->render();
 }
<?php

$db = new SQL(0);
$info = $db->cmdrow(0, 'SELECT T1.*,T2.*,T3.right FROM user_list as T1 LEFT JOIN user_action as T2 ON T1.id=T2.user LEFT JOIN user_rights as T3 ON T1.id=T3.user AND T3.right="expert" WHERE T1.id={0} LIMIT 0,1', array($params["user_id"]));
$str = WebCache::get("http://www.gravatar.com/" . md5(strtolower(trim($info["email_standard"]))) . ".json", 10000, array("entry", "}"));
$gdata = json_decode($str, true);
PageEngine::html("html_head", array("title" => _h("{0}'s Karmaprofil", array($info["username"]))));
PageEngine::html("header", array("searchquery" => isset($_GET["query"]) ? $_GET["query"] : ""));
?>
	<div id="Content" class="content-wrapper PageUserprofile">
		<article>
			
			<h1 class="search-result-summary"><?php 
echo _e("{0}'s Profil bearbeiten", array(0 => html($info["username"])));
?>
</h1>
<?php 
PageEngine::html("box_userprofile_navi", array("id" => $info["id"], "name" => $info["username"]));
?>
			
			<table class="wrapper"><tr style="vertical-align: top;">
			<td style="text-align: center;">
				<div class="box_gravatar" style="width:140px; height:140px margin-bottom: 10px; position: relative;">
					<img class="profile photo" src="http://www.gravatar.com/avatar/<?php 
echo md5($info["email_standard"]);
?>
?s=140&d=identicon" style="border: #EEE 1px solid; padding: 5px; border-radius: 3px; ">
		<?php 
if (isset($info["right"]) and $info["right"] == "expert") {
    echo '<img src="' . get_path("/skins/default/images/icons/expert.png") . '" TITLE="Experte für dieses Thema" style="position: absolute; width: 70px; height: 70px; bottom: -35px; right: -35px;"/>';
}
 private function save()
 {
     $weblink = $this->get_weblink();
     $weblink->set_name($this->form->get_value('name'));
     $weblink->set_rewrited_name(Url::encode_rewrite($weblink->get_name()));
     $weblink->set_id_category($this->form->get_value('id_category')->get_raw_value());
     $weblink->set_url(new Url($this->form->get_value('url')));
     $weblink->set_contents($this->form->get_value('contents'));
     $weblink->set_short_contents($this->form->get_value('short_contents_enabled') ? $this->form->get_value('short_contents') : '');
     $weblink->set_partner($this->form->get_value('partner'));
     $weblink->set_partner_picture(new Url($this->form->get_value('partner_picture')));
     $weblink->set_privileged_partner($this->form->get_value('privileged_partner'));
     if ($this->is_contributor_member()) {
         if ($weblink->get_id() === null) {
             $weblink->set_creation_date(new Date());
         }
         $weblink->set_approbation_type(WebLink::NOT_APPROVAL);
         $weblink->clean_start_and_end_date();
     } else {
         $weblink->set_creation_date($this->form->get_value('creation_date'));
         $weblink->set_approbation_type($this->form->get_value('approbation_type')->get_raw_value());
         if ($weblink->get_approbation_type() == WebLink::APPROVAL_DATE) {
             $weblink->set_start_date($this->form->get_value('start_date'));
             if ($this->form->get_value('end_date_enable')) {
                 $weblink->set_end_date($this->form->get_value('end_date'));
             } else {
                 $weblink->clean_end_date();
             }
         } else {
             $weblink->clean_start_and_end_date();
         }
     }
     if ($weblink->get_id() === null) {
         $id = WebService::add($weblink);
     } else {
         $id = $weblink->get_id();
         WebService::update($weblink);
     }
     $this->contribution_actions($weblink, $id);
     WebService::get_keywords_manager()->put_relations($id, $this->form->get_value('keywords'));
     Feed::clear_cache('web');
     WebCache::invalidate();
 }
 private static function renderTweet($matches)
 {
     $a = WebCache::get("http://api.twitter.com/1/statuses/oembed.json?align=none&id=" . $matches[1], 86400, array("}"));
     $b = json_decode($a, true);
     return $b["html"];
 }
Beispiel #9
0
function setCache($name = '', $data, $interval = 0)
{
    if ($interval == 0) {
        $interval = WebCache::App()->get_config('cachetime_short');
    }
    $name = $name . '_' . $interval;
    $ret = WebCache::App()->set_cache($name, $data, $interval);
    return $ret;
}
<div class="hidden">
<?php 
$webstr = WebCache::get("http://news.google.de/news?hl=de&ned=de&ie=UTF-8&output=rss&scoring=n&q=" . urlencode($params["query"]), 86400, array("</rss>", "</channel>", "</item>"));
$doc = new DomDocument();
if ($webstr . "" != "") {
    $doc->loadXML($webstr);
    foreach ($doc->getElementsByTagName('item') as $row) {
        echo '<p>' . strip_tags($row->getElementsByTagName("description")->item(0)->nodeValue) . '</p>';
    }
}
?>
</div>

 private function save()
 {
     $this->config->set_items_number_per_page($this->form->get_value('items_number_per_page'));
     $this->config->set_categories_number_per_page($this->form->get_value('categories_number_per_page'));
     $this->config->set_columns_number_per_line($this->form->get_value('columns_number_per_line'));
     $this->config->set_category_display_type($this->form->get_value('category_display_type')->get_raw_value());
     if ($this->config->get_category_display_type() != WebConfig::DISPLAY_ALL_CONTENT) {
         if ($this->form->get_value('display_descriptions_to_guests')) {
             $this->config->display_descriptions_to_guests();
         } else {
             $this->config->hide_descriptions_to_guests();
         }
     }
     if ($this->form->get_value('comments_enabled')) {
         $this->config->enable_comments();
     } else {
         $this->config->disable_comments();
     }
     if ($this->form->get_value('notation_enabled')) {
         $this->config->enable_notation();
         $this->config->set_notation_scale($this->form->get_value('notation_scale'));
         if ($this->form->get_value('notation_scale') != $this->config->get_notation_scale()) {
             NotationService::update_notation_scale('web', $this->config->get_notation_scale(), $this->form->get_value('notation_scale'));
         }
     } else {
         $this->config->disable_notation();
     }
     $this->config->set_root_category_description($this->form->get_value('root_category_description'));
     $this->config->set_sort_type($this->form->get_value('sort_type')->get_raw_value());
     $this->config->set_sort_mode($this->form->get_value('sort_mode')->get_raw_value());
     $this->config->set_partners_number_in_menu($this->form->get_value('partners_number_in_menu'));
     $this->config->set_authorizations($this->form->get_value('authorizations')->build_auth_array());
     WebConfig::save();
     WebService::get_categories_manager()->regenerate_cache();
     WebCache::invalidate();
 }