1
0

Update 3.0/modules/author/helpers/author_block.php

Updated with RWatcher edits
This commit is contained in:
floridave 2012-09-13 20:34:28 -06:00
parent 35dda08e8e
commit cb64c4c53c

View File

@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2011 Bharat Mediratta
* Copyright (C) 2000-2012 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -23,26 +23,35 @@ class author_block_Core {
}
static function get($block_id, $theme) {
$block = "";
$item = $theme->item;
if ($block_id != 'author' || $item->is_album() ) {
return '';
if ((!isset($theme->item)) || ($item->is_album())) {
return;
}
$record = db::build()
->select("author")
->from("author_records")
->where("item_id", "=", $item->id)
->execute()
->current();
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);
}
$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;
}
$block = new Block();
$block->content = new View("author_block.html");
$block->content->author = $byline;
return $block;
}
}