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


PHP Blog::read方法代码示例

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


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

示例1: Blog

// This file checks the rss of a blog against its url.
// If they don't agrre, store a new url
include '../config.php';
include mnminclude . 'blog.php';
include mnminclude . 'link.php';
header("Content-Type: text/plain");
$blog = new Blog();
//$count = $db->get_var("SELECT count(*) from blogs where blog_url regexp 'http://.+/.+'");
$count = $db->get_var("SELECT count(*) from blogs where blog_url regexp 'http://.+'");
echo "{$count} <br>\n";
flush();
$ids = $db->get_col("SELECT blog_id from blogs where blog_url regexp 'http://.+' order by blog_id asc");
foreach ($ids as $dbid) {
    $blog->id = $dbid;
    if (!$blog->read()) {
        continue;
    }
    $url = $db->get_var("select link_url from links where link_blog = {$dbid} limit 1");
    if (!empty($url)) {
        $old_url = $blog->url;
        $blog->find_base_url($url);
        $old_key = $blog->key;
        $blog->calculate_key();
        if ($blog->url != $old_url || $old_key != $blog->key) {
            echo "NEW: {$new_url} ({$old_url})<br>\n";
            $old_id = $db->get_var("select blog_id from blogs where blog_key = '{$blog->key}' and blog_id != {$blog->id}");
            if ($old_id > 0) {
                echo "REPE: {$old_id} -> {$blog->id}<br>\n";
                $db->query("update links set link_blog={$blog->id} where link_blog={$old_id}");
                $db->query("delete from blogs where blog_id = {$old_id}");
开发者ID:GallardoAlba,项目名称:Meneame,代码行数:30,代码来源:check_blogs.php

示例2: do_submit1


//.........这里部分代码省略.........
		if ($linkres->ban['expire'] > 0) {
			echo '<p class="note"><strong>'._('caduca').'</strong>: '.get_date_time($linkres->ban['expire']).'</p>';
		}
		print_empty_submit_form();
		echo '</div>'. "\n";
		return;
	}

	// If the URL has changed, check again is not dupe
	if($linkres->url != $url && report_dupe($linkres->url)) return;

	$linkres->randkey = intval($_POST['randkey']);
	if(!$linkres->valid) {
		echo '<p class="error"><strong>'._('error leyendo el url').':</strong> '.htmlspecialchars($url).'</p>';
		// Dont allow new users with low karma to post wrong URLs
		if ($current_user->user_karma < 8 && $current_user->user_level == 'normal') {
			echo '<p>'._('URL inválido, incompleto o no permitido. Está fuera de línea, o tiene mecanismos antibots.').'</p>';
			print_empty_submit_form();
			return;
		}
		echo '<p>'._('no es válido, está fuera de línea, o tiene mecanismos antibots. <strong>Continúa</strong>, pero asegúrate que sea correcto').'</p>';
	}

	$linkres->status='discard';
	$linkres->author=$current_user->user_id;

	if (!$linkres->pingback()) {
		$linkres->trackback();
	}
	$trackback=htmlspecialchars($linkres->trackback);
	$linkres->create_blog_entry();
	$blog = new Blog;
	$blog->id = $linkres->blog;
	$blog->read();

	$blog_url_components = @parse_url($blog->url);
	$blog_url = $blog_url_components['host'].$blog_url_components['path'];
	// Now we check again against the blog table
	// it's done because there could be banned blogs like http://lacotelera.com/something
	if(($ban = check_ban($blog->url, 'hostname', false, true))) {
		echo '<p class="error"><strong>'._('URL inválido').':</strong> '.htmlspecialchars($url).'</p>';
		echo '<p>'._('el sitio').' '.$ban['match'].' '. _('está deshabilitado'). ' ('. $ban['comment'].') </p>';
		if ($ban['expire'] > 0) {
			echo '<p class="note"><strong>'._('caduca').'</strong>: '.get_date_time($ban['expire']).'</p>';
		}
		syslog(LOG_NOTICE, "Meneame, banned site ($current_user->user_login): $blog->url <- $_POST[url]");
		print_empty_submit_form();
		echo '</div>'. "\n";
		/*
		// If the domain is banned, decrease user's karma
		if ($linkres->banned && $current_user->user_level == 'normal') {
			$db->query("update users set user_karma = user_karma - 0.05 where user_id = $current_user->user_id");
		}
		*/
		return;
	}


	// check for users spamming several sites and networks
	// it does not allow a low "entropy"
  // DISABLED BY MANEL: let the user send news from the same sources
  /*
	if ($sents > 30) {
		$ratio = (float) $db->get_var("select count(distinct link_blog)/count(*) from links where link_author=$current_user->user_id and link_date > date_sub(now(), interval 60 day)");
		$threshold = 1/log($sents, 2);
		if ($ratio <  $threshold ) {
开发者ID:rasomu,项目名称:chuza,代码行数:67,代码来源:submit.php

示例3: Blog

	function get_thumb($debug = false) {
		global $globals;

		$site = false;
		if (empty($this->url)) {
			if (!$this->read()) return false;
		}
		$blog = new Blog();
		$blog->id = $this->blog;
		if ($blog->read()) {
			$site = $blog->url;
		}
		$this->image_parser = new HtmlImages($this->url, $site);
		$this->image_parser->debug = $debug;
		$this->image_parser->referer = $this->get_permalink();
		echo "<!-- Meneame, before image_parser -->\n";
		$img = $this->image_parser->get();
		echo "<!-- Meneame, after image_parser -->\n";
		$this->thumb_status = 'checked';
		$this->thumb = '';
		if ($img) {
			$filepath = mnmpath.'/'.$globals['cache_dir'];
			@mkdir($filepath);
			$chain = get_cache_dir_chain($this->id);
			create_cache_dir_chain($filepath, $chain);
			$filepath .= "/$chain/thumb-$this->id.jpg";
			if ($img->type == 'local') {
				$img->scale($globals['thumb_size']);
				if($img->save($filepath)) {
					@chmod($filepath, 0777);
					$this->thumb_x = $img->x;
					$this->thumb_y = $img->y;
					// Upload to S3
					if ($globals['Amazon_S3_media_bucket'] && $globals['Amazon_S3_media_url'] && Media::put($filepath, 'thumbs', "$this->id.jpg")) {
							//$this->thumb = $globals['Amazon_S3_media_url'] . "/thumbs/$this->id.jpg";
							$this->thumb_status = 'remote';
					} else {
						//$this->thumb = $globals['base_url'].$globals['cache_dir'].'/thumbs';
						//$this->thumb .= "/$chain/$this->id.jpg";
						$this->thumb_status='local';
					}
					syslog(LOG_NOTICE, "Meneame, new thumbnail $img->url to " . $this->get_permalink());
					if ($debug)
						echo "<!-- Meneame, new thumbnail $img->url -->\n";
				} else {
					$this->thumb_status = 'error';
					if ($debug)
						echo "<!-- Meneame, error saving thumbnail ".$this->get_permalink()." -->\n";
				}
			}
			if ($img->video) $this->content_type = 'video';
		} elseif ($this->thumb_x || $this->thumb_y) {
			$this->delete_thumb();
			return false;
		}
		$this->store_thumb();
		return $this->has_thumb();
	}
开发者ID:rasomu,项目名称:chuza,代码行数:58,代码来源:link.php

示例4: type

	function type() {
		if (empty($this->type)) {
			if ($this->blog > 0) {
				require_once(mnminclude.'blog.php');
				$blog = new Blog();
				$blog->id = $this->blog;
				if($blog->read()) {
					$this->type=$blog->type;
					return $this->type;
				}
			}
			return 'normal';
		}
		return $this->type;
	}
开发者ID:BackupTheBerlios,项目名称:meneamenet-svn,代码行数:15,代码来源:link.php

示例5: Blog

 function get_thumb($debug = false, $url = false)
 {
     global $globals;
     $site = false;
     if (empty($this->url)) {
         if (!$this->read()) {
             return false;
         }
     }
     $blog = new Blog();
     $blog->id = $this->blog;
     if ($blog->read()) {
         $site = $blog->url;
     }
     if (!empty($url)) {
         $this->image_parser = new HtmlImages($url);
     } else {
         $this->image_parser = new HtmlImages($this->url, $site);
         $this->image_parser->debug = $debug;
         $this->image_parser->referer = $this->get_permalink();
     }
     if ($debug) {
         echo "<!-- Meneame, before image_parser -->\n";
     }
     $img = $this->image_parser->get();
     if ($debug) {
         echo "<!-- Meneame, after image_parser: {$img->url} -->\n";
     }
     $this->thumb_status = 'checked';
     $this->thumb = '';
     if ($img) {
         $filepath = Upload::get_cache_dir() . "/tmp/thumb-{$this->id}.jpg";
         $thumbnail = $img->scale($globals['medium_thumb_size']);
         $thumbnail->save($filepath, IMAGETYPE_JPEG);
         if (!$this->move_tmp_image(basename($filepath), 'image/jpeg')) {
             $this->thumb_status = 'error';
             if ($debug) {
                 echo "<!-- Meneame, error saving thumbnail " . $this->get_permalink() . " -->\n";
             }
         } else {
             $this->image_parser->seen_add($img->url);
             $this->thumb_status = 'remote';
             if ($debug) {
                 echo "<!-- Meneame, new thumbnail {$img->url} -->\n";
             }
         }
     }
     $this->store_thumb_status();
     return $this->has_thumb();
 }
开发者ID:brainsqueezer,项目名称:fffff,代码行数:50,代码来源:link.php

示例6: Blog

 function get_thumb($debug = false, $url = false)
 {
     global $globals;
     $site = false;
     if (empty($this->url)) {
         if (!$this->read()) {
             return false;
         }
     }
     $blog = new Blog();
     $blog->id = $this->blog;
     if ($blog->read()) {
         $site = $blog->url;
     }
     if (!empty($url)) {
         $this->image_parser = new HtmlImages($url);
     } else {
         $this->image_parser = new HtmlImages($this->url, $site);
         $this->image_parser->debug = $debug;
         $this->image_parser->referer = $this->get_permalink();
     }
     if ($debug) {
         echo "<!-- Meneame, before image_parser -->\n";
     }
     $img = $this->image_parser->get();
     if ($debug) {
         echo "<!-- Meneame, after image_parser: {$img->url} -->\n";
     }
     $this->thumb_status = 'checked';
     $this->thumb = '';
     if ($img) {
         Upload::create_cache_dir($this->id);
         $filepath = Upload::get_cache_dir($this->id) . "/thumb-{$this->id}.jpg";
         $oks = 0;
         if ($img->type == 'local') {
             foreach (Link::thumb_sizes() as $b => $s) {
                 $filepath = Upload::get_cache_dir($this->id) . "/{$b}-{$this->id}.jpg";
                 $thumbnail = $img->scale($s);
                 $res = $thumbnail->save($filepath);
                 if (!$res) {
                     continue;
                 }
                 $oks++;
                 @chmod($filepath, 0777);
                 if ($b == 'thumb') {
                     $this->thumb_x = $thumbnail->getWidth();
                     $this->thumb_y = $thumbnail->getHeight();
                 }
                 if ($b == 'thumb_medium' && $globals['Amazon_S3_media_bucket']) {
                     Media::put($filepath, 'thumbs', "medium_{$this->id}.jpg");
                 }
             }
             if ($oks > 0) {
                 // syslog(LOG_NOTICE, "Meneame, new thumbnail $img->url to " . $this->get_permalink());
                 if ($debug) {
                     echo "<!-- Meneame, new thumbnail {$img->url} -->\n";
                 }
             } else {
                 $this->thumb_status = 'error';
                 if ($debug) {
                     echo "<!-- Meneame, error saving thumbnail " . $this->get_permalink() . " -->\n";
                 }
             }
         }
     } elseif ($this->thumb_x || $this->thumb_y) {
         $this->delete_thumb();
         return false;
     }
     $this->store_thumb();
     return $this->has_thumb();
 }
开发者ID:manelio,项目名称:woolr,代码行数:71,代码来源:link.php

示例7: do_submit1


//.........这里部分代码省略.........
        } else {
            $e .= $link->url;
        }
        add_submit_error($e, _('Razón') . ': ' . $link->ban['comment']);
        if ($link->ban['expire'] > 0) {
            add_submit_error($e, _('caduca') . ': ' . get_date_time($link->ban['expire']));
        }
        return false;
    }
    // If the URL has changed, check again is not dupe
    if ($link->url != $url && report_duplicated($link->url)) {
        return;
    }
    $link->randkey = intval($_POST['randkey']);
    if (!$link->valid) {
        //echo '<p class="error"><strong>'._('error leyendo el url').':</strong> '.htmlspecialchars($url).'</p>';
        $e = _('error leyendo el url') . ': ' . htmlspecialchars($url);
        // Dont allow new users with low karma to post wrong URLs
        if ($current_user->user_karma < 8 && $current_user->user_level == 'normal') {
            add_submit_error($e, _('URL inválido, incompleto o no permitido. Está fuera de línea, o tiene mecanismos antibots.'));
            return false;
        }
        add_submit_error($e, _('no es válido, está fuera de línea, o tiene mecanismos antibots. <strong>Continúa</strong>, pero asegúrate que sea correcto'));
    }
    $link->status = 'discard';
    $link->author = $current_user->user_id;
    if (!$link->pingback()) {
        $link->trackback();
    }
    $link->trackback = htmlspecialchars($link->trackback);
    $link->create_blog_entry();
    $blog = new Blog();
    $blog->id = $link->blog;
    $blog->read();
    $blog_url_components = @parse_url($blog->url);
    $blog_url = $blog_url_components['host'] . $blog_url_components['path'];
    // Now we check again against the blog table
    // it's done because there could be banned blogs like http://lacotelera.com/something
    if ($ban = check_ban($blog->url, 'hostname', false, true)) {
        $e = _('URL inválido') . ': ' . htmlspecialchars($url);
        add_submit_error($e, _('el sitio') . ' ' . $ban['match'] . ' ' . _('está deshabilitado') . ' (' . $ban['comment'] . ')');
        if ($ban['expire'] > 0) {
            add_submit_error($e, _('caduca') . ': ' . get_date_time($ban['expire']));
        }
        syslog(LOG_NOTICE, "Meneame, banned site ({$current_user->user_login}): {$blog->url} <- " . $_REQUEST['url']);
        return false;
    }
    // check for users spamming several sites and networks
    // it does not allow a low "entropy"
    if ($sents > 30) {
        $ratio = (double) $db->get_var("select count(distinct link_blog)/count(*) from links where link_author={$current_user->user_id} and link_date > date_sub(now(), interval 60 day)");
        $threshold = 1 / log($sents, 2);
        if ($ratio < $threshold) {
            if ($db->get_var("select count(*) from links where link_author={$current_user->user_id} and link_date > date_sub(now(), interval 60 day) and link_blog = {$blog->id}") > 2) {
                syslog(LOG_NOTICE, "Meneame, forbidden due to low entropy: {$ratio} <  {$threshold}  ({$current_user->user_login}): {$link->url}");
                add_submit_error(_('ya has enviado demasiados enlaces a los mismos sitios'), _('varía las fuentes, podría ser considerado spam'));
                return false;
            }
        }
    }
    // Check the user does not send too many images or vídeos
    // they think this is a fotolog
    if ($sents > 5 && ($link->content_type == 'image' || $link->content_type == 'video')) {
        $image_links = intval($db->get_var("select count(*) from links where link_author={$current_user->user_id} and link_date > date_sub(now(), interval 60  day) and link_content_type in ('image', 'video')"));
        if ($image_links > $sents * 0.8) {
            syslog(LOG_NOTICE, "Meneame, forbidden due to too many images or video sent by user ({$current_user->user_login}): {$link->url}");
开发者ID:brainsqueezer,项目名称:fffff,代码行数:67,代码来源:submit.php

示例8: do_submit1


//.........这里部分代码省略.........
        echo '<p><strong>' . _('Razón') . ':</strong> ' . $globals['ban_message'] . '</p>';
        // If the domain is banned, decrease user's karma
        if ($linkres->banned) {
            $db->query("update users set user_karma = user_karma - 0.05 where user_id = {$current_user->user_id}");
        }
        print_empty_submit_form();
        echo '</div>' . "\n";
        return;
    }
    // If the URL has changed, check again is not dupe
    if ($linkres->url != $url && report_dupe($linkres->url)) {
        return;
    }
    $linkres->randkey = intval($_POST['randkey']);
    if (!$linkres->valid) {
        echo '<p class="error"><strong>' . _('error leyendo el url') . ':</strong> ' . htmlspecialchars($url) . '</p>';
        // Dont allow new users with low karma to post wrong URLs
        if ($current_user->user_karma < 12 && $current_user->user_level == 'normal') {
            echo '<p>' . _('URL inválido, incompleto o no permitido') . '</p>';
            print_empty_submit_form();
            return;
        }
        echo '<p>' . _('No es válido, está fuera de línea, o tiene mecanismos antibots. <strong>Continúa</strong>, pero asegúrate que sea correcto') . '</p>';
    }
    $linkres->status = 'discard';
    $linkres->author = $current_user->user_id;
    if (!$linkres->trackback()) {
        $linkres->pingback();
    }
    $trackback = htmlspecialchars($linkres->trackback);
    $linkres->create_blog_entry();
    $blog = new Blog();
    $blog->id = $linkres->blog;
    $blog->read();
    $blog_url_components = @parse_url($blog->url);
    $blog_url = $blog_url_components[host] . $blog_url_components[path];
    // Now we check again against the blog table
    // it's done because there could be banned blogs like http://lacotelera.com/something
    if (check_ban($blog->url, 'hostname', false, true)) {
        echo '<p class="error"><strong>' . _('URL inválido') . ':</strong> ' . htmlspecialchars($url) . '</p>';
        echo '<p>' . _('El sitio') . " {$globals['ban_match']} " . _('está deshabilitado') . ' (' . $globals['ban_message'] . ') </p>';
        syslog(LOG_NOTICE, "Meneame, banned site ({$current_user->user_login}): {$blog->url} <- {$_POST['url']}");
        print_empty_submit_form();
        echo '</div>' . "\n";
        return;
    }
    // check for users spamming several sites and networks
    // it does not allow a low "entropy"
    if ($sents > 30) {
        $ratio = (double) $db->get_var("select count(distinct link_blog)/count(*) from links where link_author={$current_user->user_id} and link_date > date_sub(now(), interval 60 day)");
        $threshold = 1 / log($sents, 2);
        if ($ratio < $threshold) {
            if ($db->get_var("select count(*) from links where link_author={$current_user->user_id} and link_date > date_sub(now(), interval 60 day) and link_blog = {$blog->id}") > 2) {
                syslog(LOG_NOTICE, "Meneame, forbidden due to low entropy: {$ratio} <  {$threshold}  ({$current_user->user_login}): {$linkres->url}");
                echo '<p class="error"><strong>' . _('ya has enviado demasiados enlaces a los mismos sitios') . '</strong></p> ';
                echo '<p class="error-text">' . _('varía las fuentes, podría ser considerado spam') . '</p>';
                echo '<br style="clear: both;" />' . "\n";
                echo '</div>' . "\n";
                return;
            }
        }
    }
    // Check the user does not send too many images or vídeos
    // they think this is a fotolog
    if ($sents > 5 && ($linkres->content_type == 'image' || $linkres->content_type == 'video')) {
        $image_links = intval($db->get_var("select count(*) from links where link_author={$current_user->user_id} and link_date > date_sub(now(), interval 60  day) and link_content_type in ('image', 'video')"));
开发者ID:brainsqueezer,项目名称:fffff,代码行数:67,代码来源:submit.php


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