Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rwatcher suggested this. #122

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 26 additions & 17 deletions 3.0/modules/author/helpers/author_block.php
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -23,26 +23,35 @@ static function get_site_list() {
}

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->content = new View("author_block.html");
$block->content->author = $byline;
$block = new Block();
$block->css_id = "g-author";
$block->content = new View("author_block.html");
$block->content->author = $byline;

break;
}
return $block;

}
}