コード例 #1
0
ファイル: robots.php プロジェクト: hkirsman/tsitaat_com
 function _generate_pages_temp_without_slash()
 {
     global $config_q;
     $cq = new quote();
     $page_count = ceil($cq->get_quotes_count() / $config_q["quotes_on_page"]) + 1;
     // just in case deny page that does not exist... or does it?
     for ($i = 1; $i < $page_count; $i++) {
         $this->robotstxt .= "Disallow: /l{$i}\n";
     }
 }
コード例 #2
0
ファイル: ajax.php プロジェクト: hkirsman/tsitaat_com
 function get_quote_for_facebook($q_id)
 {
     global $config_q;
     $a_quote = quote::get_quotes(array("q_id" => $q_id));
     $author_name = str_replace('"', '\\"', $a_quote[0]["author_name"]);
     if (strlen($a_quote[0]["author_born_death"])) {
         $author_born_death = ", " . $a_quote[0]["author_born_death"];
     } else {
         $author_born_death = "";
     }
     $quote = str_replace('"', '\\"', $a_quote[0]["quote"]);
     if (isset($a_quote[0]["author_img"])) {
         $author_img = $config_q["baseurl_static2"] . "/cache/images/" . str_replace(".jpg", "_90px.jpg", $a_quote[0]["author_img"]["nice_name"]);
     } else {
         $author_img = $config_q["baseurl_static2"] . "/img/noauthorimg.jpg";
     }
     $quote_url = $config_q["baseurl"] . "/" . _("quotes") . "/" . _("authors") . "/" . $a_quote[0]["url_friendly_author_name"];
     $quote_url2 = $config_q["baseurl"] . "/" . _("quotes") . "/" . _("authors") . "/" . $a_quote[0]["url_friendly_author_name"] . "/" . $a_quote[0]["quotes_id"];
     $out = "var attachment = {";
     $out .= "'name' : \"" . $author_name . $author_born_death . "\",";
     //$out .= "'caption' : \"".$quote."\",";
     $out .= "'description': \"" . $quote . "\",";
     $out .= "'media': [{'type': 'image', 'src': '" . $author_img . "', 'href': '" . $quote_url . "'}] };";
     $out .= "var action_links = [{'text':'" . _("Go to quotation") . "', 'href':'" . $quote_url2 . "'}];";
     return $out;
 }
コード例 #3
0
$datetime_today = date("Y-m-d") . " 00:00:00";
$q = "\n\tSELECT\n\t\t" . $config_q["db"]["prefix"] . "quotes.id as quote_id,\n\t\t" . $config_q["db"]["prefix"] . "quotes.quote,\n\t\t" . $config_q["db"]["prefix"] . "quotes.rank,\n\t\t" . $config_q["db"]["prefix"] . "quotes.tag,\n\t\t" . $config_q["db"]["prefix"] . "quotes.author_id,\n\t\t" . $config_q["db"]["prefix"] . "quote_authors.author_name_freeform_" . $config_q["locale"] . ",\n\t\t" . $config_q["db"]["prefix"] . "quote_authors.author_firstname_" . $config_q["locale"] . ",\n\t\t" . $config_q["db"]["prefix"] . "quote_authors.author_midname_" . $config_q["locale"] . ",\n\t\t" . $config_q["db"]["prefix"] . "quote_authors.author_lastname_" . $config_q["locale"] . ",\n\t\t" . $config_q["db"]["prefix"] . "quote_authors.url_friendly_author_name_" . $config_q["locale"] . "\n\tFROM\n\t\t" . $config_q["db"]["prefix"] . "quotes,\n\t\t" . $config_q["db"]["prefix"] . "quote_authors\n\tWHERE\n\t\t" . $config_q["db"]["prefix"] . "quotes.id\n\tNOT IN\n\t(\n\t\tSELECT \n\t\t\tquote_id\n\t\tFROM\n\t\t\t" . $config_q["db"]["prefix"] . "twitter_log\n\t)\n\tAND\n\t\trank > 0\n\tAND\n\t\t" . $config_q["db"]["prefix"] . "quotes.author_id = " . $config_q["db"]["prefix"] . "quote_authors.id\n\tAND\n\t\t" . $config_q["db"]["prefix"] . "quotes.lang = '" . $config_q["locale"] . "'\n\tORDER BY\n\t\t" . $config_q["db"]["prefix"] . "quotes.created_time\n\tASC\n\tLIMIT 1\n\t";
echo $q;
$r = q($q);
$i = 0;
$a_out = array();
$row = mysqli_fetch_array($r, MYSQL_ASSOC);
$row["quote"] = str_replace(array(" -", "[-]", "  "), array("&nbsp;&#8212;", "[&#8212;]", "&nbsp;&nbsp;"), $row["quote"]);
if (strpos($row["quote"], '"') !== false) {
    $row["quote"] = preg_replace("/\"(.*)\"/imsU", "“\\1”", $row["quote"]);
} else {
    $row["quote"] = "“" . $row["quote"] . "”";
}
$row = author::parse_author_name($row);
$a_out[] = $row;
$a_out = quote::parse_author_photos($a_out);
$row = $a_out[0];
$first_tag = explode(",", $row["tag"]);
$first_tag = str_replace("_", " ", trim($first_tag[0]));
$facebook_attachment = array('name' => $row["author_name_wo_brackets"] . ' ' . _('quotations'), 'href' => $config_q["baseurl"] . '/' . _("quotes") . '/' . _("authors") . '/' . $row["url_friendly_author_name_" . $config_q["locale"]], 'caption' => str_replace("http://", "", $config_q["baseurl"]), 'description' => $row["author_name_wo_brackets"] . ' ' . _('quotations'), 'properties' => array(_('Tag') => array('text' => $first_tag, 'href' => $config_q["baseurl"] . '/' . _("quotes") . '/' . _("tags") . '/' . $first_tag), _('Rating') => $row["rank"]));
if (strlen($row["author_img"]["nice_name"]) > 0) {
    $facebook_attachment['media'] = array(array('type' => 'image', 'src' => $config_q["baseurl"] . '/cache/images/' . str_replace(".jpg", "_90px.jpg", $row["author_img"]["nice_name"]), 'href' => $config_q["baseurl"] . '/' . _("quotes") . '/' . _("authors") . '/' . $row["url_friendly_author_name_" . $config_q["locale"]]));
}
facebook_wrapper::publish_to_wall($row["quote"], $facebook_attachment, array(array('text' => _('Go to quotation'), 'href' => $config_q["baseurl"] . "/" . $row["quote_id"])), $config_q["facebook"]["wall_id"]);
$ct = new twitter_quote($config_q["twitter"]["username"], $config_q["twitter"]["password"]);
$url = str_replace("http://", "", $config_q["baseurl"]) . "/" . $row["quote_id"];
if ($ct->set_status($row["quote"] . " " . $row["author_name_wo_brackets"], $url) != true) {
    die("Twitter is unavailable at this time");
}
q("\n\tINSERT INTO\n\t\t" . $config_q["db"]["prefix"] . "twitter_log\n\t\t(\n\t\t\tquote_id\n\t\t)\n\tVALUES\n\t\t(\n\t\t\t'" . $row["quote_id"] . "'\n\t\t);\n\t");
ob_flush();
コード例 #4
0
ファイル: html.inc.php プロジェクト: hiproz/zhaotaoci.cc
     $all ? msg($MOD['name'] . '生成成功', $this_forward) : dmsg($MOD['name'] . '生成成功', $this_forward);
 }
 $catid = isset($catid) ? intval($catid) : '';
 $sql = $catid ? " AND catid={$catid}" : '';
 if (!isset($fid)) {
     $r = $db->get_one("SELECT min(itemid) AS fid FROM {$table} WHERE status=3 {$sql}");
     $fid = $r['fid'] ? $r['fid'] : 0;
 }
 isset($sid) or $sid = $fid;
 if (!isset($tid)) {
     $r = $db->get_one("SELECT max(itemid) AS tid FROM {$table} WHERE status=3 {$sql}");
     $tid = $r['tid'] ? $r['tid'] : 0;
 }
 if ($update) {
     require MD_ROOT . '/quote.class.php';
     $do = new quote($moduleid);
 }
 isset($num) or $num = 100;
 if ($fid <= $tid) {
     $result = $db->query("SELECT itemid FROM {$table} WHERE status=3 AND itemid>={$fid} {$sql} ORDER BY itemid LIMIT 0,{$num} ");
     if ($db->affected_rows($result)) {
         while ($r = $db->fetch_array($result)) {
             $itemid = $r['itemid'];
             $update ? $do->update($itemid) : tohtml('show', $module);
         }
         $itemid += 1;
     } else {
         $itemid = $fid + $num;
     }
 } else {
     if ($update) {
コード例 #5
0
ファイル: index.php プロジェクト: hkirsman/tsitaat_com
		$smarty_q->assign("author_wiki_url_de", $quotes_temp[0]["author_wiki_url_de"]);
		break;
	case "generate_indexes":
		acl();
		tag::generate_index();
		robots::generate("robots_".$config_q["locale"].".txt");
		sitemap::generate("sitemap_".$config_q["locale"].".xml");
		die("done");
		break;
	case "find_similar_quotes":
		acl();
		quote::find_similar_quotes();
		break;
	case "get_new_quotes_from_zitate_de":
		acl();
		quote::get_new_quotes_from_zitate_de();
		break;
	case "admin":
		acl();
		echo "admin";
		break;
	case "userprofile":
		$context["h1"] = "";
		$context["fake_h1"] = _("User") ." ". $a_path[0];

		$userinfo = user_q::user_info($a_path[0]);

		if ($config_q["locale"] == "et")
		{
			$content = ucwords($a_path[0]) . " on olnud tsitaat.com kasutaja alates ".$userinfo["user_regdate_parsed"].'. Ta on '.
      ($userinfo["quotes_added"]?'<a href="'.$user->data["username_clean"]."/".$context["labels"]["added-quotes_clean"].'">':'').
コード例 #6
0
ファイル: my.inc.php プロジェクト: hiproz/zhaotaoci.cc
<?php

defined('IN_DESTOON') or exit('Access Denied');
require DT_ROOT . '/module/' . $module . '/common.inc.php';
$MG['quote_limit'] > -1 or dalert(lang('message->without_permission_and_upgrade'), 'goback');
require DT_ROOT . '/include/post.func.php';
include load($module . '.lang');
include load('my.lang');
require MD_ROOT . '/quote.class.php';
$do = new quote($moduleid);
if (in_array($action, array('add', 'edit'))) {
    $FD = cache_read('fields-' . substr($table, strlen($DT_PRE)) . '.php');
    if ($FD) {
        require DT_ROOT . '/include/fields.func.php';
    }
    isset($post_fields) or $post_fields = array();
    $CP = $MOD['cat_property'];
    if ($CP) {
        require DT_ROOT . '/include/property.func.php';
    }
    isset($post_ppt) or $post_ppt = array();
}
$sql = $_userid ? "username='******'" : "ip='{$DT_IP}'";
$limit_used = $limit_free = $need_password = $need_captcha = $need_question = $fee_add = 0;
if (in_array($action, array('', 'add'))) {
    $r = $db->get_one("SELECT COUNT(*) AS num FROM {$table} WHERE {$sql} AND status>1");
    $limit_used = $r['num'];
    $limit_free = $MG['quote_limit'] > $limit_used ? $MG['quote_limit'] - $limit_used : 0;
}
switch ($action) {
    case 'add':
コード例 #7
0
ファイル: index.inc.php プロジェクト: hcd2008/destoon
<?php

defined('IN_DESTOON') or exit('Access Denied');
require MD_ROOT . '/quote.class.php';
$do = new quote($moduleid);
$menus = array(array('添加' . $MOD['name'], '?moduleid=' . $moduleid . '&action=add'), array($MOD['name'] . '列表', '?moduleid=' . $moduleid), array('审核' . $MOD['name'], '?moduleid=' . $moduleid . '&action=check'), array('未通过' . $MOD['name'], '?moduleid=' . $moduleid . '&action=reject'), array('回收站', '?moduleid=' . $moduleid . '&action=recycle'), array('移动分类', '?moduleid=' . $moduleid . '&action=move'));
if (in_array($action, array('add', 'edit'))) {
    $FD = cache_read('fields-' . substr($table, strlen($DT_PRE)) . '.php');
    if ($FD) {
        require DT_ROOT . '/include/fields.func.php';
    }
    isset($post_fields) or $post_fields = array();
    $CP = $MOD['cat_property'];
    if ($CP) {
        require DT_ROOT . '/include/property.func.php';
    }
    isset($post_ppt) or $post_ppt = array();
}
if ($_catids || $_areaids) {
    require DT_ROOT . '/admin/admin_check.inc.php';
}
if (in_array($action, array('', 'check', 'reject', 'recycle'))) {
    $sfields = array('模糊', '标题', '产品名', '简介', '会员名', 'IP');
    $dfields = array('keyword', 'title', 'tag', 'introduce', 'username', 'ip');
    $sorder = array('结果排序方式', '添加时间降序', '添加时间升序', '更新时间降序', '更新时间升序', '浏览次数降序', '浏览次数升序', '信息ID降序', '信息ID升序');
    $dorder = array($MOD['order'], 'addtime DESC', 'addtime ASC', 'edittime DESC', 'edittime ASC', 'hits DESC', 'hits ASC', 'itemid DESC', 'itemid ASC');
    isset($fields) && isset($dfields[$fields]) or $fields = 0;
    isset($order) && isset($dorder[$order]) or $order = 0;
    $level = isset($level) ? intval($level) : 0;
    isset($datetype) && in_array($datetype, array('edittime', 'addtime', 'totime')) or $datetype = 'addtime';
    $fromdate = isset($fromdate) && is_date($fromdate) ? $fromdate : '';
コード例 #8
0
ファイル: quote.php プロジェクト: hkirsman/tsitaat_com
 public static function get_new_quotes_from_zitate_de()
 {
     while (quote::zitate_de__check_if_can_fetch_quotes()) {
         $quote = quote::zitate_de__get_1_new_quote_from_zitate_de();
         arr($quote);
         quote::zitate_de__insert_quote_to_database($quote);
         flush2();
         //$i++;
     }
 }
コード例 #9
0
ファイル: feed.php プロジェクト: ready4god2513/Antiquotr
foreach ($quotes as $quote) {
    ?>
    <item>
        <title><?php 
    echo $quote->author->name;
    ?>
 : <?php 
    echo quote::truncate($quote->quote);
    ?>
</title>
        <link><?php 
    echo $quote->permalink();
    ?>
</link>
        <description><?php 
    echo quote::truncate($quote->quote);
    ?>
</description>
        <author><?php 
    echo $quote->author->name;
    ?>
</author>
        <pubDate><?php 
    echo date("D, d M Y H:i:s T", strtotime($quote->created_at));
    ?>
</pubDate>
    </item>
    <?php 
}
?>
</channel>
コード例 #10
0
 public function __construct($symb, $portfolio)
 {
     // setup the the parent class (db connection etc)
     $workingDate = $portfolio->getWorkingDate();
     $exch = $portfolio->exch->getID();
     $pfid = $portfolio->getID();
     $this->pfid = $pfid;
     parent::__construct($symb, $exch, $workingDate);
     // load the info from the stocks table
     $query = "select * from holdings where symb = '{$symb}' and pfid = '{$pfid}';";
     try {
         $result = $this->dbh->query($query);
     } catch (PDOException $e) {
         tr_warn('holding:__construct:' . $query . ':' . $e->getMessage());
         die("[FATAL]Class: holding, function: __construct\n");
     }
     $row = $result->fetch(PDO::FETCH_ASSOC);
     if (isset($row['symb']) and $row['symb'] == $symb) {
         $this->hid = $row['hid'];
         $this->pfid = $row['pfid'];
         $this->openDate = $row['date'];
         $this->price = $row['price'];
         $this->qty = $row['volume'];
         $this->comment = $row['comment'];
     }
 }