static function get($block_id, $theme)
 {
     $block = "";
     $item = $theme->item;
     if (!isset($theme->item) || $item->is_album()) {
         return;
     }
     switch ($block_id) {
         case "author":
             $record = ORM::factory("author_record")->where("item_id", "=", $item->id)->find();
             $byline = "";
             if ($record->loaded()) {
                 $byline = $record->author;
             }
             if ($byline == '') {
                 $byline = author::fix($item);
             }
             $block = new Block();
             $block->css_id = "g-author";
             $block->content = new View("author_block.html");
             $block->content->author = $byline;
             break;
     }
     return $block;
 }
Beispiel #2
0
 public static function get_authors($arr = array())
 {
     global $config_q;
     if (isset($arr["current_page"])) {
         $limit_start = ($arr["current_page"] - 1) * $config_q["quotes_on_page"];
         $limit = "LIMIT " . ($arr["current_page"] - 1) * $config_q["quotes_on_page"] . "," . $config_q["quotes_on_page"];
     }
     if (isset($arr["char"])) {
         $s_where = "WHERE author_lastname_" . $config_q["locale"] . " LIKE '" . $arr["char"] . "%' ";
     }
     if (strlen($s_where) > 0) {
         $s_where .= "\n\t\t\t\tAND\n\t\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors.id = " . $config_q["db"]["prefix"] . "quotes.author_id\n\t\t\t\tAND\n\t\t\t\t\tactive = 1\n\t\t\t\tAND\n\t\t\t\t\tlang = '" . $config_q["locale"] . "' ";
     } else {
         $s_where .= "\n\t\t\t\tWHERE\n\t\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors.id = " . $config_q["db"]["prefix"] . "quotes.author_id\n\t\t\t\tAND\n\t\t\t\t\tactive = 1\n\t\t\t\tAND\n\t\t\t\t\tlang = '" . $config_q["locale"] . "' ";
     }
     $a_out = array();
     $q = "\n\t\t\tSELECT\n\t\t\t\tDISTINCT\n\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors.id as author_id,\n\t\t\t\tauthor_name_freeform_" . $config_q["locale"] . ",\n\t\t\t\tauthor_firstname_" . $config_q["locale"] . ",\n\t\t\t\tauthor_midname_" . $config_q["locale"] . ",\n\t\t\t\tauthor_lastname_" . $config_q["locale"] . ",\n\t\t\t\tauthor_born_death_circa,\n\t\t\t\tauthor_born,\n\t\t\t\tauthor_death,\n\t\t\t\tauthor_profession_" . $config_q["locale"] . ",\n\t\t\t\tauthor_wiki_url_" . $config_q["locale"] . ",\n\t\t\t\turl_friendly_author_name_" . $config_q["locale"] . "\n\t\t\tFROM\n\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes\n\t\t\t{$s_where}\n\t\t\torder by\n\t\t\t\tauthor_lastname_" . $config_q["locale"] . " asc\n\t\t\t{$limit};\n\t\t";
     $r = q($q);
     $a_out = array();
     while ($row = mysqli_fetch_array($r, MYSQL_ASSOC)) {
         $row = author::parse_author_born_death($row);
         $row = author::parse_author_name($row);
         $row = author::parse_url_friendly_author_name($row);
         $a_out[] = $row;
     }
     return $a_out;
 }
 public function update(Request $request, Author $author)
 {
     //var_dump($author->id);
     //dd($author->name);
     $author = author::findOrFail($author->id);
     //dd($request);
     $author->fill($request->all());
     //$author->fill($request->all());
     $author->save();
     //var_dump ($id);
     //return redirect('/wizard#/Authors');
 }
Beispiel #4
0
 private static function _generate_authors()
 {
     $authors = author::get_authors();
     $current_lastname_firstchar = $robotstxt = "";
     foreach ($authors as $key => $var) {
         $robotstxt .= "Allow: /" . _("quotes") . "/" . _("authors") . "/" . $var["url_friendly_author_name"] . "\n";
     }
     $author_index = author::get_author_index();
     foreach ($author_index as $key => $var) {
         $robotstxt .= "Disallow: /" . _("quotes") . "/" . _("authors") . "/" . $var["char"] . "/\n";
     }
     return $robotstxt;
 }
 static function get($block_id, $theme)
 {
     $item = $theme->item;
     if ($block_id != 'author' || $item->is_album()) {
         return '';
     }
     $record = db::build()->select("author")->from("author_records")->where("item_id", "=", $item->id)->execute()->current();
     $byline = $record->author;
     if ($byline == '') {
         $byline = author::fix($item);
     }
     $block = new Block();
     $block->content = new View("author_block.html");
     $block->content->author = $byline;
     return $block;
 }
Beispiel #6
0
 function _generate_authors()
 {
     global $config_q;
     $out = "";
     $authors = author::get_authors();
     $current_lastname_firstchar = $robotstxt = "";
     foreach ($authors as $key => $var) {
         $out .= "<url>" . "\n";
         $out .= "  <loc>" . $config_q["baseurl"] . "/" . _("quotes") . "/" . _("authors") . "/" . $var["url_friendly_author_name"] . "</loc>\n";
         $out .= "  <priority>0.80</priority>\n";
         $out .= "  <lastmod>" . date("Y-m-d\\T07:28:24+00:00", time()) . "</lastmod>\n";
         $out .= "  <changefreq>daily</changefreq>\n";
         $out .= "</url>\n";
         //$this->count_links++;
     }
     return $out;
 }
 /**
  * @expectedException ActiveRecord\ActiveRecordException
  */
 public function test_delete_with_no_primary_key_defined()
 {
     Author::table()->pk = array();
     $author = author::first();
     $author->delete();
 }
Beispiel #8
0
 /**
  * Fügt Eintrag aus Benutzer-Liste in Ergebnisliste ein
  * @param \fpcm\model\users\author $author
  * @param array $data
  * @return array
  * @since FPCM 3.2.0
  */
 private function userListResultById(author $author, array $data)
 {
     $data[$author->getId()] = $author;
     return $data;
 }
Beispiel #9
0
     $erm = "Please check you email to verify your account.";
 } else {
     include_once '../include/PasswordHash.php';
     // Related comments in signup.php
     $checker = new PasswordHash(8, FALSE);
     if ($checker->CheckPassword($password, $row['password'])) {
         $_SESSION["id"] = $row["ID"];
         $id = $row["ID"];
         $_SESSION["username"] = $row["username"];
         $_SESSION["imgExist"] = $row["profilePic"];
         $_SESSION["imgExt"] = $row["profilePicExt"];
         date_default_timezone_set("Asia/Kolkata");
         $curTime = date("Y-m-d H:i:s");
         mysqli_query($link, "UPDATE membasic SET lastLogin='******' WHERE ID={$id}") or die("dont die");
         require_once '../author/classes/authorClass.php';
         $newAuthor = new author();
         $authentic = $newAuthor->authenticate();
         if ($authentic) {
             $_SESSION['author_id'] = $authentic;
         }
         unset($newAuthor);
         unset($authentic);
         session_regenerate_id();
         session_write_close();
         header("location: {$retUrl}");
         exit;
     } else {
         $erm = "Invalid password";
         $er = true;
     }
 }
Beispiel #10
0
 Start Date : 7 Mar, 2015 4:29:16 PM
 Author: Adarsh
 Purpose :
*/
if (!isset($_GET['id'])) {
    header("LOCATION: ../");
    exit;
}
session_start();
$er = FALSE;
if (!is_numeric($_GET['id'])) {
    $er = TRUE;
} else {
    $author_id = (int) $_GET['id'];
    require_once 'classes/authorClass.php';
    $newAuthor = new author();
    $authorRes = $newAuthor->getAuthorDetails($author_id);
    if (!$authorRes) {
        $er = TRUE;
    }
}
?>

<!DOCTYPE HTML>
<html>
<head>
  <title><?php 
echo $authorRes['author_name'];
?>
 | BIT UnOfficial</title>
  <meta charset="utf-8">
<?php

/*
 Project name : BITuN
 Start Date : 22 Mar, 2015 2:32:27 PM
 Author: Adarsh
 Purpose :
*/
session_start();
include 'classes/authorClass.php';
$author = new author();
$author_id = $author->authenticate();
if (!$author_id) {
    header('location:../index.php');
    exit;
}
$er = false;
$suc = false;
$result = $author->getAuthorDetails($author_id);
require_once '../include/newCon.php';
if (isset($_POST['formNo'])) {
    if ($_POST['formNo'] == 1) {
        if ($_FILES['newPic']['size'] === 0 || $_FILES['newPic']['size'] > 1000000 || $_FILES['newPic']['error'] > 0) {
            $er = true;
            $erm = "File too large/small. ";
            @unlink($_FILES['newPic']['tmp_name']);
        } else {
            $nama = explode('.', $_FILES['newPic']['name']);
            $ext = end($nama);
            $ext = strtolower($ext);
            if ($ext === "jpg") {
Beispiel #12
0
		$smarty_q->assign("content", '
			<div id="cse-search-results"></div>
			<script type="text/javascript">
				var googleSearchIframeName = "cse-search-results";
				var googleSearchFormName = "cse-search-box";
				var googleSearchFrameWidth = 900;
				var googleSearchDomain = "www.google.com";
				var googleSearchPath = "/cse";
			</script>
			<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>
		');
		break;
	case "statistics":
		$context["h1"] = "";
		$context["fake_h1"] = _("Statistics");
		$content = author::get_author_top();
		$content .= "<br /><h2>"._("Other statistics")."</h2>";
		$content .= _("Quotations count") . ": ". statistics::quote_count() . "<br />";
		if ($config_q["locale"] == "et" ) {
			$content .= _("User count") . ": ". statistics::user_count() . "<br />";
		}
		$content .= _("Domain registration") . ": ". date("d.m.Y", $config_q["domain_registration_time"]) . "<br />";
		$content .= _("Quotations add rate per day") . ": ". round( statistics::quote_count()/((time()-$config_q["domain_registration_time"])/3600/24), 1 );
		$context["content"] = $content;
		break;
	case "shortcut":
		header("Location: ".quote::get_long_link_for_permalink($a_path[0]),TRUE,301);
		die();
		break;
	case "contributors":
		$smarty_q->assign("h1", _("Quotation contributors"));
Beispiel #13
0
 public static function get_from_waitinglist()
 {
     global $user, $config_q, $table_prefix;
     $q = "\n\t\t\tSELECT\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.id AS waiting_quote_id,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.author_id AS author_id,\n\n\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors.author_name_freeform_et AS author_name_freeform_et,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors.author_lastname_et AS author_lastname_et,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors.author_midname_et AS author_midname_et,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors.author_firstname_et AS author_firstname_et,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors.url_friendly_author_name_" . $config_q["locale"] . ",\n\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.author_name AS waiting_author_name,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.author_profession_et AS waiting_author_profession_et,\n\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.author_born AS waiting_author_born,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.author_death AS waiting_author_death,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.quote AS quote,\n\t\t\t\t" . $config_q["db"]["prefix"] . "categories.name_" . $config_q["locale"] . " as category,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.tag AS tag,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.source_title AS waiting_source_title,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.source_year_start AS waiting_source_year_start,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.created_by AS waiting_created_by,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.date_inserted AS waiting_date_inserted,\n\t\t\t\t" . USERS_TABLE . ".username AS username\n\t\t\tFROM\n\t\t\t(\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval,\n\t\t\t\t" . USERS_TABLE . ",\n\t\t\t\t" . $config_q["db"]["prefix"] . "categories\n\t\t\t)\n\t\t\tLEFT JOIN\n\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors\n\t\t\tON\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.author_id = " . $config_q["db"]["prefix"] . "_quote_authors.id\n\t\t\tWHERE\n\t\t\t\t" . USERS_TABLE . ".user_id = " . $config_q["db"]["prefix"] . "quotes_waiting_approval.created_by\n\t\t\t\tAND\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.author_id != 0\n\t\t\t\tAND\n\t\t\t\tstatus = 0\n\t\t\t\tAND\n\t\t\t\t" . $config_q["db"]["prefix"] . "categories.id = " . $config_q["db"]["prefix"] . "quotes_waiting_approval.category\n\t\t\tORDER BY \n\t\t\t\tdate_inserted\n\t\t\tASC\n\t\t;";
     $r = q($q);
     $a_out = array();
     while ($row = mysqli_fetch_array($r, MYSQL_ASSOC)) {
         $row = quote::parse_tags($row);
         $row = author::parse_author_name($row);
         $row = author::parse_author_born_death($row);
         $row = author::parse_author_profession($row);
         $row = author::parse_url_friendly_author_name($row);
         $a_out[] = $row;
     }
     //$a_out = $this->get_author_img_data2($a_out);
     $a_out = quote::parse_author_photos($a_out);
     return $a_out;
 }
 function editArticle()
 {
     parent::author();
 }
 static function item_created($item)
 {
     $byline = author::fix($item);
 }
 /**
  * @expectedException ActiveRecord\ActiveRecordException
  */
 public function testDeleteWithNoPrimaryKeyDefined()
 {
     Author::table()->pk = array();
     $author = author::first();
     $author->delete();
 }
require_once $config_q["basepath"] . '/classes/twitter.php';
require_once $config_q["basepath"] . '/classes/twitter_quote.php';
$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");
}
Beispiel #18
0
  $context["section"] = $section;
	if ($user->data["user_id"]==2)
	{
    $context["admin"] = true;
    $context["categories"] = $category->get_categories();
	}
  $context["username"] = $user->data["username"];
  $context["username_clean"] = $user->data["username_clean"];
  $context["user_id"] = $user->data["user_id"];
  //$smarty_q->assign ("user_type", $user->data["user_type"]);
  //$smarty_q->assign ("group_id", $user->data["group_id"]);
	//$smarty_q->assign ("robots_index", false);

	//$smarty_q->assign ("keywords", _("quotes, quotations, world"));
	//$smarty_q->assign ("author_index", author::get_author_index());
  $context["author_index"] = author::get_author_index();
	//$smarty_q->author_index ("tag_index", tag::get_tag_index());
  $context["tag_index"] = tag::get_tag_index();
  //$smarty_q->assign ("category_index", category::get_categories());
	//$smarty_q->assign ("a_path", $a_path);
  $context["a_path"] = $a_path;
	//$smarty_q->assign ("enable_voting", true);
  $context["enable_voting"] = true;
	//$smarty_q->assign ("show_sidecontent", true);
	//$smarty_q->assign ("search_return_url", $config_q["baseurl"] . "/" . _("search"));
	//$smarty_q->assign ("config_q", $config_q);
	//$smarty_q->assign ("analytics", $config_q["analytics"]);
	////$smarty_q->assign ("label_previous_page", _("Previous page"));
	////$smarty_q->assign ("label_next_page", _("Next page"));
	////$smarty_q->assign ("label_share_on_facebook", _("Share on Facebook"));
	//$smarty_q->assign ("google_site_verification", $config_q["google_site_verification"]);