4,5c4,9
< //
< define('BIBLE_GOLDEN_VERSE_DEFAULT_URL', 'http://bible.mikelee.idv.tw/bless.aspx?c=dgv');
---
> /**
>  * @file
>  * Displays the Christian bible.
>  *
>  * Provides an interface for importing and displaying Christian bible translations.
>  */
9c13
<  * Define the permissions this module uses
---
>  * Defines the permissions this module uses
16,21c20,23
< * Generate HTML for the bible block
< * @param op the operation from the URL
< * @param delta offset
< * @returns block HTML 
< */
< function bible_block($op = 'list', $delta = 0, $edit = array()) {
---
>  * Implementation of hook_block()
>  * Defines the blocks generated by this module
>  */
> function bible_block ($op = 'list', $delta = 0, $edit = array()){
24c26,28
<       $blocks[0]['info'] = t('Daily Golden Verse');
---
>       $blocks[0]['info'] = t('Bible Search');
>       $blocks[1]['info'] = t('Daily Proverb');
>       $blocks[2]['info'] = t('Golden Verse');
28,33c32,40
<       if ($delta == 0) {
<         $form['block_bible_string'] = array(
<           '#type' => 'textfield',
<           '#title' => t('Bible Daily Reading'),
<           '#size' => 60,
<           '#description' => t('Daily a verse for daily Bible reading.'),
---
>       // Provide display options for the Daily Proverb block
>       if ($delta == 1) {
>         $form['proverb_options'] = array(
>           '#type' => 'select',
>           '#title' => t('Display Options'),
>           '#options' => array(
>               'verse' => t('First verse only'),
>               'chapter' => t('Whole chapter'),),
>           '#description' => t('Select display options.'),
35c42
<             variable_get('block_bible_string',  t('Bible Golden Verse')),
---
>             variable_get('proverb_options',  t('verse')),
40,42c47,48
<       if ($delta == 0) {
<         // Have Drupal save the string to the database.
<         variable_set('block_example_string', $edit['block_example_string']);
---
>       if ($delta == 1) {
>         variable_set('proverb_options', $edit['proverb_options']);
46,47d51
<       // If $op is "view", then we need to generate the block for display
<       // purposes. The $delta parameter tells us which block is being requested.
50,64c54,69
<           // The subject is displayed at the top of the block. Note that it
<           // should be passed through t() for translation.
<           $block['subject'] = t('Daily Golden Verse');
<           // The content of the block is typically generated by calling a custom
<           // function.
<           $default_url = variable_get('bible_golden_verse_fetch_url', BIBLE_GOLDEN_VERSE_DEFAULT_URL);
<           $xml = drupal_http_request($default_url);
< 	  if ($xml->code==200) {
< 	    $xml_parser = xml_parser_create();
<    	    xml_parse_into_struct($xml_parser, $xml->data, $vals, $index);
< 	    xml_parser_free($xml_parser);
< 	    if ($vals[0]['value']) $block['content'] = get_verse($vals[0]['value']);
< 	  }
< 	  else 
<             $block['content'] = 'No Data.Err:'.$xml->code;
---
>           $block['subject'] = t('Bible Search');
>           $block['content'] = drupal_get_form('bible_search_form');        
>           break;
>         case 1:
>           $block['subject'] = t('Daily Proverb');                  
>           // Get bible translation
>           $bid = variable_get('bible_select', 1);
>           // Display options. One verse ($opt=verse) or whole chapter ($opt=chapter)
>           $opt = variable_get('proverb_options', 'verse');
>           $block['content'] = theme_bible_daily_proverb($bid, bible_get_daily_proverb($bid), $opt);
>           break;
>         case 2:
>           $block['subject'] = t('Golden Verse'); 
>           // Bible translation
>           $bid = variable_get('bible_select', 1);        
>           $block['content'] = theme_bible_golden_verse(bible_get_random_verse($bid));
68c73
<   }
---
>   }   
70a76,79
> /**
>  * Implementation of hook_menu()
>  * Defines the menu callbacks generated by this module
>  */
72d80
< 
74,146c82,142
< 
<   //if ($may_cache) {
<     $items[] = array(
<       'path' => 'admin/settings/bible',
<       'title' => t('Bible module settings'),
<       'description' => t('Bible module settings control'),
<       'callback' => 'bible_admin_list',
<       'access' => user_access('access administration pages'),
<       'type' => MENU_NORMAL_ITEM,
<     );
< 
<     // Manage languages subtabs
<     $items[] = array(
<       'path' => 'admin/settings/bible/list',
<       'title' => t('List'),
<       'callback' => 'bible_admin_list',
<       'weight' => 0,
<       'type' => MENU_DEFAULT_LOCAL_TASK
<     );
<       
<     $items[] = array(
<       'path' => 'admin/settings/bible/select',
<       'title' => t('Select bible'),
<       'callback' => 'drupal_get_form',
<       'callback arguments' => array('bible_admin_select'),
<       'weight' => 5,
<       'type' => MENU_LOCAL_TASK
<     );
<     
<     $items[] = array(
<       'path' => 'admin/settings/bible/import',
<       'title' => t('Import'),
<       'callback' => 'drupal_get_form',
<       'callback arguments' => array('bible_admin_import'),
<       'weight' => 10,
<       'type' => MENU_LOCAL_TASK
<     );
<   
<     $items[] = array(
<       'path' => 'admin/settings/bible/delete',
<       'title' => t('Delete Select Bible'),
<       'description' => t('Delete selected bible.'),
<       'callback' => 'drupal_get_form',
<       'callback arguments' => array('bible_admin_delete'),
<       'access' => user_access('access administration pages'),
<       'weight' => 20,
<       'type' => MENU_LOCAL_TASK
<     );
<     
<     //this is added for this current tutorial.
<     $items[] = array(
<       'path' => 'bible',
<       'title' => t('Bible'),
<       'callback' => 'bible_all',
<       'access' => user_access('access bible content'),
<       'type' => MENU_CALLBACK
<     );
<     $items[] = array(
<       'path' => 'bible/search',
<       'title' => t('Bible Search'),
<       'callback' => 'drupal_get_form',
<       'callback arguments' => array('bible_search_form'),
<       'access' => user_access('access bible content'),
<       'type' => MENU_CALLBACK
<     );
<     $items[] = array(
<       'path' => 'bible/search/kw',
<       'title' => t('Bible Search'),
<       'callback' => 'bible_search_keyword',
<       'access' => user_access('access bible content'),
<       'type' => MENU_CALLBACK
<     );
<   //}   // if maycache
---
>   // Admin settings for the bible module.
>   $items[] = array(
>     'path' => 'admin/settings/bible',
>     'title' => t('Bible module settings'),
>     'description' => t('Bible module settings control'),
>     'callback' => 'bible_admin_list',
>     'access' => user_access('access administration pages'),
>     'type' => MENU_NORMAL_ITEM,
>   );
>   // Admin list of bible translations.
>   $items[] = array(
>     'path' => 'admin/settings/bible/list',
>     'title' => t('List'),
>     'callback' => 'bible_admin_list',
>     'weight' => 0,
>     'type' => MENU_DEFAULT_LOCAL_TASK
>   );
>   // Admin settings for adjusting the default bible translation.  
>   $items[] = array(
>     'path' => 'admin/settings/bible/select',
>     'title' => t('Select default bible'),
>     'callback' => 'drupal_get_form',
>     'callback arguments' => array('bible_admin_select'),
>     'weight' => 5,
>     'type' => MENU_LOCAL_TASK
>   );
>   // Admin settings for importing bible translations.   
>   $items[] = array(
>     'path' => 'admin/settings/bible/import',
>     'title' => t('Import'),
>     'callback' => 'drupal_get_form',
>     'callback arguments' => array('bible_admin_import'),
>     'weight' => 10,
>     'type' => MENU_LOCAL_TASK
>   );
>   // Displays the bible based on arguments in the URL.
>   $items[] = array(
>     'path' => 'bible',
>     'title' => t('Bible'),
>     'callback' => 'bible_all',
>     'access' => user_access('access bible content'),
>     'type' => MENU_NORMAL_ITEM
>   );
>   // Displays the bible search form.
>   $items[] = array(
>     'path' => 'bible/search',
>     'title' => t('Bible Search'),
>     'callback' => 'drupal_get_form',
>     'callback arguments' => array('bible_search_form'),
>     'access' => user_access('access bible content'),
>     'type' => MENU_CALLBACK
>   );
>   // Display search results.
>   $items[] = array(
>     'path' => 'bible/search/kw',
>     'title' => t('Bible Search'),
>     'callback' => 'bible_search_keyword',
>     'access' => user_access('access bible content'),
>     'type' => MENU_CALLBACK
>   );
>   // Return menu items.
150,151c146,151
< function bible_admin_select()
< {
---
> /**
>  * FAPI definition for selecting the default bible translation.
>  * @ingroup forms
>  * @see bible_admin_select_submit()
>  */
> function bible_admin_select(){
153,154c153,156
<   $queryResult = db_query("SELECT * FROM {bible_list}");
<   while ($bb = db_fetch_object($queryResult)) $biblelist[$bb->bid] = $bb->bname;
---
>   $queryResult = db_query("SELECT bid, bname FROM {bible_list}");
>   while ($bb = db_fetch_object($queryResult)){
>   	$biblelist[$bb->bid] = $bb->bname;
>   }
170,171c172,177
< function bible_admin_select_submit($form_id, $form_values)
< {
---
> /**
>  * FAPI definition for submiting the default bible translation.
>  * @ingroup forms
>  * @see bible_admin_select()
>  */
> function bible_admin_select_submit($form_id, $form_values){
175a182,189
> /**
>  * Displays bible translations.
>  *
>  * Displays administrative view of bible translations.
>  *
>  * @return
>  *   A themed table of bible translations.
>  */
177,190c191,199
<   $page_content = '';
<   $page_content .= '<table><tr><th>#</th><th>'.t('ShortName').'</th><th>'.t('Bible Name').'</th>';
<   $page_content .= '<th>'.t('Language').'</th><th>'.t('Chapter Count').'</th>';
<   $page_content .= '<th>'.t('Verse Count').'</th><th>'.t('Action').'</th>';
<   $queryResult = db_query("SELECT * FROM {bible_list}");
<   while ($bb = db_fetch_object($queryResult)) {
<     $page_content .= '<tr';
<     if ($bb->bid==variable_get('bible_select',1)) $page_content .=' bgcolor=FFCCCC';
<     $page_content .= '><td>'.$bb->bid.'</td><td>'.$bb->bsn.'</td><td>'.$bb->bname.'</td><td>'.$bb->lang.'</td>';
<     $qr1 = db_fetch_object(db_query("SELECT COUNT(*) as C FROM {bible_book_name} WHERE bid=".$bb->bid));
<     $page_content .= '<td>'.$qr1->C.'</td>';
<     $qr1 = db_fetch_object(db_query("SELECT COUNT(*) as C FROM {bible_context} WHERE bid=".$bb->bid));
<     $page_content .= '<td>'.$qr1->C.'</td>';
<     $page_content .= '<td>'.l(t('Delete'), 'admin/settings/bible/delete/'.$bb->bid).'</td></tr>';
---
>    // Initialize page content
>   $page_content = ''; 
>   // Get bible list with books
>   $bible_list = bible_get_bible_list();
>   if($bible_list){
>       foreach($bible_list as $bl){
>           $book_list = bible_get_book_list($bl->bid);
>           $blwb[] = array('bid' => $bl->bid, 'bsn' => $bl->bsn, 'bname' => $bl->bname, 'lang' => $bl->lang, 'books' => $book_list, 'chapter_count' => bible_get_book_count($bl->bid), 'verse_count' => bible_get_verse_count($bl->bid));
>       }
192c201,203
<   $page_content .= '</table>';
---
>   // Theme content
>   $page_content .= theme_bible_list($blwb, $opt = 'admin');
>   // Return themed table
196,197c207,212
< function bible_admin_import()
< {
---
> /**
>  * FAPI definition for importing bible translation.
>  * @ingroup forms
>  * @see bible_admin_import_submit()
>  */
> function bible_admin_import(){
210d224
< 
215c229,231
<  * Process the locale import form submission.
---
>  * FAPI definition for submiting bible translation.
>  * @ingroup forms
>  * @see bible_admin_import()
224a241,245
> /**
>  * FAPI provides a form and confirmation for deleting a bible translation.
>  * @ingroup forms
>  * @see bible_admin_delete_submit()
>  */
226,227c247,251
<   if (!arg(4)) drupal_goto("admin/settings/bible");
<   $form['bible'] = array('#type' => 'value', '#value' => arg(4));
---
>   // Initialize variable from the URL
>   $bid = check_plain(arg(4));
>   // Check URL arguments
>   if ($bid != '') drupal_goto("admin/settings/bible");
>   $form['bible'] = array('#type' => 'value', '#value' => $bid);
229c253
<     t('Are you sure you want to delete the bible %name?', array('%name' => get_bible_name(arg(4)))), 
---
>     t('Are you sure you want to delete the bible %name?', array('%name' => bible_get_bible_name($bid))), 
234a259,263
> /**
>  * FAPI Deletes a bible translation.
>  * @ingroup forms
>  * @see bible_admin_delete()
>  */
242a272,277
> /**
>  * Imports a bible text document into the various database tables. 
>  *
>  * @param
>  *   $file A specialized text document containing a single bible translation.
>  */
309a345,353
> /**
>  * Returns bible views.
>  *
>  * Returns the various bible views:
>  *   (Verse, Chapter, Book, Translation, Default)
>  *
>  * @return
>  *   STRING themed bible content.
>  */
311,358c355,444
<   // arg: bible/book/chap/verse
<   $page_content = '';
<   if (arg(1)) $page_content .= l(get_bible_name(arg(1)), 'bible/'.arg(1));
<   if (arg(2)) $page_content .= '>'.l(get_chapter_name(arg(1), arg(2)), 'bible/'.arg(1).'/'.arg(2));
<   if (arg(3)) $page_content .= '>'.l(t('Chapter @chap', array('@chap'=>arg(3))), 'bible/'.arg(1).'/'.arg(2).'/'.arg(3));
<   if (arg(3)) {	// bible/book/chap    
<     $sqlcmd = "SELECT * FROM {bible_context} WHERE bid=".arg(1)." AND book='".arg(2)."' AND chapter=".arg(3)." ORDER BY vsid";
<     $chap = db_query($sqlcmd);
<     $pnchap = explode(":", get_prevnextchap(arg(2).':'.arg(3)));
<     $pnline1  = l($pnchap[2].t('Chapter @chap', array('@chap'=>$pnchap[1])), 'bible/'.arg(1).'/'.$pnchap[0].'/'.$pnchap[1]);
<     $pnline2 = l($pnchap[5].t('Chapter @chap', array('@chap'=>$pnchap[4])), 'bible/'.arg(1).'/'.$pnchap[3].'/'.$pnchap[4]);
<     $page_content .= '<div align=right>'.$pnline1.'</div>';
<     $page_content .= '<table>';
<     while ($verse = db_fetch_object($chap))
<     {
<        if ($verse->linemark=='*')
<        $page_content .= '<tr bgcolor=CCCCCC><td></td><td>'.$verse->context.'</td>';
<          else
<        $page_content .= '<tr><td>'.$verse->verse.'</td><td>'.$verse->context.'</td>';
<     }
<     $page_content .= '</table>';
<     $page_content .= '<div align=right>'.$pnline2.'</div>';
<   } else
<   if (arg(2)) {	// bible/book
<     $page_content .= '<br/>'.t("Select Chapter:");
<     $page_content .= '<table>';
<     $sqlcmd = "SELECT * FROM {bible_book_name} WHERE bid=".arg(1)." AND book='".arg(2)."'";
<     $book = db_fetch_object(db_query($sqlcmd));
<     for ($i=1; $i<=$book->chap; $i++) {
<       if ($i % 10 == 1) $page_content .= '<tr>';
<       $page_content .= '<td>'.l($i, 'bible/'.arg(1).'/'.arg(2).'/'.$i).'</td>';
<     }
<     $page_content .= '</table>';
<   } else 
<   {
<     if (!arg(1)) {
<       //TODO: Check if any bible Imported.
<   	//$defaultBible = db_result(db_query("SELECT Min(bid) FROM {bible_list}"));
<   	//if ($defaultBible=='') return t("No bible imported.");
<       $defaultBible = variable_get('bible_select', 1);
<     } else $defaultBible = arg(1);
<     $queryResult = db_query("SELECT * FROM {bible_list} WHERE bid=".$defaultBible);
<     $bible = db_fetch_object($queryResult);
<     $page_content .= '<table>';
<     $queryResult = db_query("SELECT * FROM {bible_book_name} WHERE bid=".$bible->bid." ORDER BY bkid");
<     while ($qr = db_fetch_object($queryResult)) {
<       if ($qr->bkid % 6 ==1) $page_content .= '<tr>';
<       $page_content .= '<td>'.l($qr->fname, 'bible/'.$bible->bid.'/'.$qr->book);
---
>   // Initialize variables
>   // Use check_plain to escape an bad character strings from the URL arguments
>   $verse = check_plain(arg(4));
>   $chapter = check_plain(arg(3));
>   $book = check_plain(arg(2));
>   $translation = check_plain(arg(1));
>   $page_content = "";
>   
>   // Verse View: /Translation/Book/Chapter/Verse
>   // Example: /1/GEN/1/1
>   if($verse){
>    	// Additional Variables
>   	$verse_content = bible_get_verse($translation, $book, $chapter, $verse);
>   	$book_name = bible_get_book_name($translation, $book);
>   	$translation_name = bible_get_bible_name($translation);	   
>     // Bread Crumbs
>   	$crumbs = array(
>   	  l(t($translation_name) , 'bible/'.$translation), 
>   		l(t($book_name) , 'bible/'.$translation.'/'.$book),
>   		l(t($chapter), 'bible/'.$translation.'/'.$book.'/'.$chapter),
>   		l(t($verse) , 'bible/'.$translation.'/'.$book.'/'.$chapter.'/'.$verse)
>   	);
>   	// Theme and content
>   	$page_content .= theme_breadcrumb ($crumbs);
>   	$page_content .= theme_bible_verse ($book_name, $chapter, $verse, $verse_content);
>   	return $page_content;
>   }
> 
>   // Chapter View: /Translation/Book/Chapter
>   // Example: /1/GEN/1
>   if($chapter && !$verse){
>    	// Additional Variables
>   	$chapter_content = bible_get_chapter($translation, $book, $chapter);
>   	$book_name = bible_get_book_name($translation, $book);
>   	$translation_name = bible_get_bible_name($translation);	 
>     // Bread Crumbs
>   	$crumbs = array(
>   	  l(t($translation_name) , 'bible/'.$translation), 
>   		l(t($book_name) , 'bible/'.$translation.'/'.$book),
>   		l(t($chapter), 'bible/'.$translation.'/'.$book.'/'.$chapter)
>   	);
>   	// Theme and content
>   	$page_content .= theme_breadcrumb ($crumbs);
>   	$page_content .= theme_bible_chapter ($book_name, $chapter, $chapter_content);
>   	return $page_content;
>   }
> 
>   // Book View: /Translation/Book
>   // Example: /1/GEN
>   if($book && !$chapter && !$verse){
>    	// Additional Variables
>   	$book_chapters = bible_get_chapter_count($translation, $book);
>   	$book_name = bible_get_book_name($translation, $book);
>   	$translation_name = bible_get_bible_name($translation);	
>     // Bread Crumbs
>   	$crumbs = array(
>   	  l(t($translation_name) , 'bible/'.$translation), 
>   		l(t($book_name) , 'bible/'.$translation.'/'.$book)
>   	);
>   	// Theme and content
>   	$page_content .= theme_breadcrumb ($crumbs);
>   	$page_content .= theme_bible_book ($translation, $book, $book_name, $book_chapters);
>   	return $page_content;
>   }
> 
>   // Translation View: /Translation/
>   // Example: /1/
>   if($translation && !$book && !$chapter && !$verse){
>    	// Additional Variables
>   	$translation_name = bible_get_bible_name($translation);	
>   	$translation_books = bible_get_book_list($translation); 
>   	$translation_book_list = bible_get_book_list_chapters($translation_books);	 
>     // Bread Crumbs
>   	$crumbs = array(
>   	  l(t($translation_name) , 'bible/'.$translation)
>   	);
>   	// Theme and content
>   	$page_content .= theme_breadcrumb ($crumbs);
>   	$page_content .= theme_bible_translation ($translation_name, $translation_book_list);
>   	return $page_content;
>   }
> 
>   // Default View: bible
>   // Example: bible
>   // Get bible list with books
>   $bible_list = bible_get_bible_list();
>   if($bible_list){
>     foreach($bible_list as $bl){
>       $book_list = bible_get_book_list($bl->bid);
>       $blwb[] = array('bid' => $bl->bid, 'bsn' => $bl->bsn, 'bname' => $bl->bname, 'lang' => $bl->lang, 'books' => $book_list);
360d445
<     $page_content .= '</table>';
362,364c447,450
<   $page_content .= '<hr/>'.l(t("Search Keyword in Bible"), 'bible/search');
<   return $page_content;
< } // end bible_all
---
>   // Theme content
>   $page_content .= theme_bible_list($blwb);
>   return $page_content;  
> }
366,369c452,479
< function bible_search_keyword()
< {
<   if (!arg(3)) {
<     return t("Please input Search Keyword.");
---
> /**
>  * Returns table of keyword matches.
>  *
>  * @return
>  *   TABLE of matching search keywords.
>  */
> function bible_search_keyword(){
>   // Initialize variables
>   $translation_id = check_plain(arg(4));
>   $keyword = check_plain(arg(3));
>   $page_content = "";
>   // Keyword and Translation 
>   if($keyword != '' && $translation_id != ''){
>     $queryResults = db_query("SELECT b.vsid, b.bid, b.book, b.chapter, b.verse, b.context FROM {bible_context} b WHERE bid = %d AND b.context REGEXP '%s' ORDER BY b.vsid", $translation_id, $keyword);
>     if(db_num_rows($queryResults)){
>       while($verse = db_fetch_object($queryResults)){
>         $rows[] = array(l(t($verse->book." ".$verse->chapter.":".$verse->verse), 'bible/'.$translation_id.'/'.$verse->book.'/'.$verse->chapter.'/'.$verse->verse), str_ireplace($keyword,'<strong>'.$keyword.'</strong>', $verse->context));
>       }
>       // Get translation name
>       $translation_name = bible_get_bible_name($translation_id);
>       // Get themed table of results
>       $page_content .= theme_bible_search_keyword ($keyword, $translation_id, $translation_name, $rows);
>       return $page_content;
>     }
>     else{
>        $page_content .= t("Sorry, no verse found.");
>        return $page_content;
>     }
371,385c481,494
<   if (arg(4)) $defaultBible = arg(4); else $defaultBible = variable_get('bible_select', 1);
<   $page_content = t("Search in Bible [@bible] for Keyword[@kw]", array('@bible'=>get_bible_name($defaultBible),'@kw'=>arg(3)));
<   $sqlcmd = "SELECT * FROM {bible_context} WHERE bid=".$defaultBible." AND context like '%".arg(3)."%' ORDER BY vsid";
<   $kwlist = db_query($sqlcmd);
<   if (db_num_rows($kwlist)) {
<     $page_content .= ','.t("Found:").db_num_rows($kwlist);
<     $page_content .= '<table>';
<     while ($verse = db_fetch_object($kwlist)) {
<        if ($verse->linemark=='*')
<          $page_content .= '<tr bgcolor=CCCCCC><td></td><td>'.$verse->context.'</td>';
<        else {
<          $bls = $verse->book.':'.$verse->chapter;
<          $page_content .= '<tr><td>'.l($bls.':'.$verse->verse, 'bible/'.$defaultBible.'/'.$verse->book.'/'.$verse->chapter).'</td>';
<          $page_content .= '<td>'.str_replace(arg(3),'<b>'.arg(3).'</b>', $verse->context.'</td>');
<        }
---
>   // Keyword no Translation
>   elseif($keyword != '' && $translation_id == ''){  
>     // Get default translation
>     $translation_id = variable_get('bible_select', 1);
>     $queryResults = db_query("SELECT b.vsid, b.bid, b.book, b.chapter, b.verse, b.context FROM {bible_context} b WHERE bid = %d AND b.context REGEXP '%s' ORDER BY b.vsid", $translation_id, $keyword);
>     if(db_num_rows($queryResults)){
>       while($verse = db_fetch_object($queryResults)){
>         $rows[] = array(l(t($verse->book." ".$verse->chapter.":".$verse->verse), 'bible/'.$translation_id.'/'.$verse->book.'/'.$verse->chapter.'/'.$verse->verse), str_ireplace($keyword,'<strong>'.$keyword.'</strong>', $verse->context));
>       }
>       // Get translation name
>       $translation_name = bible_get_bible_name($translation_id);
>       // Get themed table of results
>       $page_content .= theme_bible_search_keyword ($keyword, $translation_id, $translation_name, $rows);
>       return $page_content;
387,388c496
<     $page_content .= '</table>';  
<     } else
---
>     else{
390c498,505
<     return $page_content;
---
>       return $page_content;
>     }
>   }  
>   // No Keyword or Translation
>   else{
>     $page_content .= t("Enter a search term.");
>     return $page_content;      
>   }
393,395c508,514
< function bible_search_form()
< {
<   $form['search'] = array(
---
> /**
>  * FAPI collects a keyword search.
>  * @ingroup forms
>  * @see bible_search_form_submit()
>  */
> function bible_search_form(){
>   $form['bible_search'] = array(
399c518
<   $form['search']['keyword'] = array(
---
>   $form['bible_search']['keyword'] = array(
406,413c525,534
<   while ($bb = db_fetch_object($queryResult)) $biblelist[$bb->bid] = $bb->bname;
<   $form['search']['select'] = array('#type' => 'select',
<     '#title' => t('Bible name'),
<     '#default_value' => variable_get('bible_select',1),
<     '#options' => $biblelist,
<     '#description' => t('Select Bible you want to search.'),
<   );
<   $form['search']['submit'] = array('#type' => 'submit', '#value' => t('Search'));
---
>   while ($bb = db_fetch_object($queryResult)){
>     $biblelist[$bb->bid] = $bb->bname;
>     $form['bible_search']['select'] = 
>         array('#type' => 'select',
>               '#title' => t('Bible name'),
>               '#default_value' => variable_get('bible_select',1),
>               '#options' => $biblelist,
>               '#description' => t('Select Bible you want to search.'));
>     $form['bible_search']['submit'] = array('#type' => 'submit', '#value' => t('Search'));
>   }
417,419c538,544
< function bible_search_form_submit($form_id, $form_values)
< {
<   return '/bible/search/kw/'.$form_values['keyword'].'/'.$form_values['select'];
---
> /**
>  * FAPI submits a keyword search.
>  * @ingroup forms
>  * @see bible_search_form()
>  */
> function bible_search_form_submit($form_id, $form_values){
>   return 'bible/search/kw/'.$form_values['keyword'].'/'.$form_values['select'];
422,427c547,576
< function get_bible_name($bid)
< {
<   $queryResult = db_query("SELECT * FROM {bible_list} WHERE bid=".$bid);
<   if (db_num_rows($queryResult)) {
<     $bb = db_fetch_object($queryResult);
<     return $bb->bname;
---
> /**
>  * Returns bible list.
>  *
>  * @return
>  *   ARRAY of bible translations.
>  */
> function bible_get_bible_list(){
>   $queryResult = db_query("SELECT * FROM {bible_list}");
>   while($bo = db_fetch_object($queryResult)){
>   	$bl[]= $bo;
>   }  
>   return $bl;
> }
> 
> /**
>  * Returns bible name.
>  *
>  * @param $bid
>  *   STRING integer identifying the translation id.
>  * @return
>  *   STRING containing the translation name.
>  */
> function bible_get_bible_name($bid){
>   // Check variable
>   if($bid){
>     $queryResult = db_query("SELECT b.bid, b.bname FROM {bible_list} b WHERE b.bid = %d", $bid);
>     if (db_num_rows($queryResult)) {
>       $bb = db_fetch_object($queryResult);
>       return $bb->bname;
>     }
429c578
<     return '';
---
>   return '';
432,437c581,758
< function get_chapter_name($bid, $book)
< {
<   $queryResult = db_query("SELECT * FROM {bible_book_name} WHERE bid=".$bid." AND book='".$book."'");
<   if (db_num_rows($queryResult)) {
<     $book = db_fetch_object($queryResult);
<     return $book->fname;
---
> /**
>  * Returns verses found in a book.
>  *
>  * @param $bid
>  *   STRING integer identifying the translation id.
>  * @param $book
>  *   STRING book short name.
>  * @return
>  *   ARRAY of verses that match the translation id and book short name.
>  */
> function bible_get_book($bid, $book){
>   // Checks variables
>   if($bid != '' && $book != ''){
>     $queryResult = db_query("SELECT b.bvsid, b.bid, b.book, b.context FROM {bible_context} b WHERE b.bid = %d AND b.book = '%s' ORDER BY b.vsid", $bid, $book);
>     if (db_num_rows($queryResult)) { 
>       while($bo = db_fetch_object($queryResult)){
>         $book_context[] = $bo->context;
>       }
>   	  return $book_context;
>     } 
>   } else
>   return '';   
> }
> 
> /**
>  * Returns book name.
>  *
>  * @param $bid
>  *   STRING integer identifying the translation id.
>  * @param $book
>  *   STRING book short name.
>  * @return
>  *   STRING book full name.
>  */
> function bible_get_book_name($bid, $book){
>   // Check variables
>   if($bid != '' && $book != ''){
>     $queryResult = db_query("SELECT b.bid, b.book, b.fname FROM {bible_book_name} b WHERE b.bid = %d AND b.book = '%s'", $bid, $book);
>     if (db_num_rows($queryResult)) {
>       $book = db_fetch_object($queryResult);
>       return $book->fname;
>     } 
>   } else
>   return '';
> }
> 
> /**
>  * Returns number of books.
>  *
>  * @param $bid
>  *   STRING integer identifying the translation id.
>  * @return
>  *   INT of the number of books.
>  */
> function bible_get_book_count($bid){
>   if($bid){
>     $queryResult = db_fetch_object(db_query("SELECT COUNT(*) as C FROM {bible_book_name} WHERE bid = %d", $bid));
>     return $queryResult->C;
>   }
>   return '';
> }
> 
> /**
>  * Returns a book list.
>  *
>  * @param $bid
>  *   STRING integer identifying the translation id.
>  * @return
>  *   ARRAY containing the book list.
>  */
> function bible_get_book_list($bid){
>   // Check variable
>   if($bid){
>     $queryResult = db_query("SELECT b.bid, b.bkid, b.book, b.fname FROM {bible_book_name} b WHERE bid = %d ORDER BY b.bkid", $bid);
>     if (db_num_rows($queryResult)) {
>       while($bl = db_fetch_object($queryResult)){
>         $book_list[] = $bl;
>       }
>   	  return $book_list;
>     } 
>   } else
>   return '';
> }
> 
> /**
>  * Returns a book list with chapter.
>  *
>  * @param $translation_books
>  *   ARRAY containing the book list for a translation.
>  * @return
>  *   ARRAY containing the book list with a list of chapters.
>  */
> function bible_get_book_list_chapters ($translation_books){
> 	// Check Variables
>   if($translation_books){
> 		foreach($translation_books as $tb){
> 			$chapter_list = count(bible_get_chapter_count($tb->bid, $tb->book));
> 			$translation_book_list[] = array('bid' => $tb->bid, 'book' => $tb->book, 'fname' => $tb->fname, 'chapters' => $chapter_list);
> 		}
> 		return $translation_book_list;
> 	} else
> 	  return '';
> }
> /**
>  * Returns a bible chapter.
>  *
>  * @param $bid
>  *   STRING integer identifying the default bible translation.
>  * @param $book
>  *   STRING identifying the book short name. Example: 'GEN'.
>  * @param $chapter
>  *   STRING integer identifying the chapter.
>  * @return
>  *   ARRAY containing chapter verses.
>  */
> function bible_get_chapter($bid, $book, $chapter){
>   // Check variables
>   if($bid != '' && $book != '' && $chapter != ''){
>     $queryResult = db_query("SELECT b.vsid, b.bid, b.book, b.chapter, b.context FROM {bible_context} b WHERE b.bid = %d AND b.book = '%s' AND b.chapter = %d ORDER BY b.vsid", $bid, $book, $chapter);
>     if (db_num_rows($queryResult)) { 
>       while($co = db_fetch_object($queryResult)){
>         $chapter_context[] = $co->context;
>       }
> 	    return $chapter_context;
>     }       
>   }
>   return '';   
> }
> 
> /**
>  * Returns number of chapters.
>  *
>  * Returns an array of chapters based on the translation id an book name.
>  *
>  * @param $bid
>  *   STRING integer identifying the default bible translation.
>  * @param $book
>  *   STRING short name of the book.
>  * @return
>  *   ARRAY containing chapter numbers.
>  */
> function bible_get_chapter_count($bid, $book){
>   // Initialize variables
>   $current_chapter = 0;
>   // Check variables
>   if($bid != '' && $book != ''){
>     $queryResult = db_query("SELECT b.vsid, b.bid, b.book, b.chapter, b.verse FROM {bible_context} b WHERE bid = %d AND book = '%s' ORDER BY b.vsid", $bid, $book);
>     if (db_num_rows($queryResult)) { 
>       while($cc = db_fetch_object($queryResult)){
>         if($cc->chapter != $current_chapter){
>           $chapter_count[] = $cc->chapter;
>           $current_chapter++;
>         }
>       }
>       return $chapter_count;
>     } 
>   } else
>     return ''; 
> }
> 
> /**
>  * Returns single verse.
>  *
>  * Returns the text of a single verse based on the $translation, $book, $chapter and $verse id's.
>  *
>  * @param $bid
>  *   STRING integer identifying the default bible translation.
>  * @return
>  *   INT containing number of verses.
>  */
> function bible_get_verse($bid, $book, $chapter, $verse){
>   // Check Variables
>   if($bid != '' && $book != '' && $chapter != '' && $verse != ''){
>     $queryResult = db_query("SELECT b.bid, b.book, b.chapter, b.verse, b.context FROM {bible_context} b WHERE b.bid = %d AND b.book = '%s' AND b.chapter = %d AND b.verse = %d", $bid, $book, $chapter, $verse);
>     if (db_num_rows($queryResult)) {
>       $vo = db_fetch_object($queryResult);
>       return $vo->context;
>     }
442,458c763,779
< function get_verse($bls)
< {
<   $bid = variable_get('bible_select', 1);
<   $data = explode(":", $bls);
<   $sqlcmd = "SELECT * FROM {bible_context} WHERE bid=".$bid." AND book='".$data[0]."' AND chapter=".$data[1]." AND linemark=''";
<   if (strpos($data[2],"-")===FALSE)
<     $sqlcmd .= " AND verse=".$data[2];
<   else {
<     $vv = explode("-", $data[2]);
<     $sqlcmd .= " AND verse>=".$vv[0]." AND verse<=".$vv[1];
<   }
<   $queryResult = db_query($sqlcmd);
<   if (db_num_rows($queryResult)==0) return t('N/A');
<   $verse = "";
<   while ($qr = db_fetch_object($queryResult))
<     $verse .= $qr->context;
<   return l($bls, 'bible/'.$bid.'/'.$data[0].'/'.$data[1])."<br/>".$verse;    
---
> /**
>  * Counts the number of verses in a translation.
>  *
>  * @param $bid
>  *   STRING integer identifying the default bible translation.
>  * @return
>  *   INT containing number of verses.
>  */
> function bible_get_verse_count($bid){
>   // Initialize variable
>   $page_content = '';
>   // Check variable
>   if($bid){
>     $queryResult = db_fetch_object(db_query("SELECT COUNT(*) as C FROM {bible_context} WHERE bid = %d", $bid));
>     $page_content = $queryResult->C;
>   }
>   return $page_content;
461,484c782,1154
< function get_prevnextchap($bls)
< {
<   $bid = variable_get('bible_select', 1);
<   $data = explode(":", $bls);
<   $sqlcmd = "SELECT * FROM {bible_book_name} WHERE bid=".$bid." AND book='".$data[0]."'";
<   $queryResult = db_query($sqlcmd);
<   if (!db_num_rows($queryResult)) return "";
<   $book = db_fetch_object($queryResult);
<   // Find Prev Chapter
<   if ($data[1]>1) $prevchap = $data[0].':'.($data[1]-1).':'.$book->fname;
<   else {
<     if ($book->bkid==1) $bkid=66; else $bkid=($book->bkid)-1;
<     $qr1 = db_query("SELECT * FROM {bible_book_name} WHERE bid=".$bid." AND bkid=".$bkid);
<     $prevbk = db_fetch_object($qr1);
<     $prevchap = $prevbk->book.':'.$prevbk->chap.':'.$prevbk->fname;
<   }
<   // Find Next Chapter
<   if (($book->chap)>$data[1])
<     $nextchap = $data[0].':'.($data[1]+1).':'.$book->fname;
<   else {
<     if ($book->bkid==66) $bkid=1; else $bkid=($book->bkid)+1;
<     $qr1 = db_query("SELECT * FROM {bible_book_name} WHERE bid=".$bid." AND bkid=".$bkid);
<     $nextbk = db_fetch_object($qr1);
<     $nextchap = $nextbk->book.':1:'.$nextbk->fname;
---
> /**
>  * Returns a Daily Proverb
>  *
>  * Returns a Daily Proverb from the database based on the current day of the month.
>  *
>  * @param $bid
>  *   A string integer identifying the default bible translation.
>  * @return
>  *   ARRAY containing chapter verses.
>  */
> function bible_get_daily_proverb ($bid = 1){
>   // Initialize variable
>   $page_content = '';
>   // Set book to Proverbs 'PRO'
>   $book = 'PRO';
>   // Set chapter the current day of the month
>   $chapter = date("j");
>   // Call get chapter method 
>   $page_content = bible_get_chapter($bid, $book, $chapter);
>   // Return Proverb chapter
>   return $page_content;  
> }
> 
> /**
>  * Grabs a random verse
>  *
>  * Grabs a random verse from the database based on the default translation.
>  *
>  * @param $bid
>  *   STRING integer identifying the default bible translation.
>  * @return
>  *   ARRAY containing verse information.
>  */
> function bible_get_random_verse ($bid = 1){
>   // Initialize variables
>   $verse_array = '';
>   $count = '';
>   $min = '';
>   $max = '';
>   $rand = '';
>   // Determine verse limits based on translation
>   $queryResults = db_query("SELECT b.vsid, b.bid FROM {bible_context} b WHERE b.bid = %d ORDER BY b.vsid", $bid);  
>   $count = db_num_rows($queryResults);
>   if($count != ''){
>     while($vl = db_fetch_object($queryResults)){
>       $max = $vl->vsid;
>     }       
>     $min = $max - $count;    
>     $rand = rand($min, $max);       
>     // Grab random verse from db using translation and random verse id
>     $verseResults = db_query("SELECT b.vsid, b.bid, b.book, b.chapter, b.verse, b.context FROM {bible_context} b WHERE b.vsid = %d AND b.bid = %d", $rand, $bid);
>     if (db_num_rows($verseResults)) {
>       $vo = db_fetch_object($verseResults);
>       $verse_array = array('bid' => $vo->bid, 'book' => $vo->book, 'chapter' => $vo->chapter, 'verse' => $vo->verse, 'context' => $vo->context);            
>     } 
>   }   
>   // Return verse array
>   return $verse_array;   
> }
> 
> /**
>  * Displays a single verse.
>  *
>  * @param $book
>  *   STRING identifying the short name of the book.
>  * @param $chapter
>  *   STRING integer identifying the chapter id.
>  * @param $verse
>  *   STRING integer identifying the verse id.
>  * @param $context
>  *   ARRAY of verses.
>  * @return
>  *   STRING a themed box containing a single verse.
>  * @ingroup themeable
>  */
> function theme_bible_verse ($book, $chapter, $verse, $context){
> 	// Initialize variable
>   $page_content .= '';
>   // Check variables
>   if($book != '' && $chapter != '' && $verse != '' && $context != ''){	  
>     $title = t($book." ".$chapter.":".$verse);
>     $content = t($context);
>     $page_content = theme_box($title, $content);
>   }
>   return $page_content;
> }
> 
> /**
>  * Displays a list of verses.
>  *
>  * Displays an ordered list of verses based on chapter.
>  *
>  * @param $book
>  *   STRING identifying the short name of the book.
>  * @param $chapter
>  *   STRING integer identifying the chapter id.
>  * @param $context
>  *   ARRAY of verses.
>  * @return
>  *   STRING a themed list of verses.
>  * @ingroup themeable
>  */
> function theme_bible_chapter ($book, $chapter, $context){
>   // Initialize variable
>   $page_content .= '';
>   // Check variable
>   if($book != '' && $chapter != '' && $context != ''){
>     $title = t($book." ".$chapter);
>     $content = theme_item_list($context, '', $type = 'ol');
>     $page_content = theme_box($title, $content);
>   }	
>   return $page_content;
> }
> 
> /**
>  * Displays a list of chapters.
>  *
>  * Displays an un-ordered list of chapters based on book.
>  *
>  * @param $translation
>  *   STRING integer identifying the bible translation id.
>  * @param $book
>  *   STRING identifying the short name of the book.
>  * @param $book_name
>  *   STRING containing the book name.
>  * @param $context
>  *   ARRAY of chapters.
>  * @return
>  *   STRING a themed list of chapters.
>  * @ingroup themeable
>  */
> function theme_bible_book ($translation, $book, $book_name, $context){
>   // Initialize variable
>   $page_content .= '';
>   // Check variables 
>   if($translation != '' && $book != '' && $book_name != '' && $context != ''){
>     $title = t($book_name);
>     foreach($context as $cn){
>       $ca[] = l(t($cn."."), 'bible/'.$translation.'/'.$book.'/'.$cn);
>     }
>     // Create themed un-ordered list
>     $content = theme_item_list($ca, '', $type = 'ul');
>     $page_content = theme_box($title, $content);
>   }	
>   return $page_content;
> }
> 
> /**
>  * Displays a table of books.
>  *
>  * Displays a table of books based on the translation.
>  *
>  * @param $translation_name
>  *   STRING identifying the bible translation name.
>  * @param $translation_book_list
>  *   ARRAY of books and chapters.
>  * @return
>  *   STRING a themed table of translations.
>  * @ingroup themeable
>  */
> function theme_bible_translation ($translation_name, $translation_book_list){
>   // Initialize variable
>   $page_content = '';
> 	// Check if variables exist
>   if($translation_name != '' && $translation_book_list != ''){
>     // Additional variables
>     $title = t($translation_name);
>     $header = array('Book', 'Chapters');
>     $book_count = count($translation_book_list);
>     //
>     for($i=0; $i <= $book_count; $i++){  
>       $chapter_links = '';
>       for($j=1; $j <= $translation_book_list[$i]['chapters']; $j++){
>         $current_chapter_num = $j;
>         $current_chapter_link = l(t($current_chapter_num."."), 'bible/'.$translation_book_list[$i]['bid'].'/'.$translation_book_list[$i]['book']."/".$current_chapter_num);
>         // First Chapter Number
>         if($current_chapter_num == 1){
>           $chapter_links = $current_chapter_link;
>         }
>         // Other Chapter Numbers
>         else{
>           $chapter_links = $chapter_links." | ".$current_chapter_link;
>         }
>       }
>       // Create $row array
>       $rows[$i] = array(l(t($translation_book_list[$i]['fname']), 'bible/'.$translation_book_list[$i]['bid'].'/'.$translation_book_list[$i]['book']), $chapter_links);
>     }
>     // Create themed table
>     $page_content = theme_table($header, $rows);	 
>   }
>   else{
>     $page_content = "Unable to display bible translation.";
>   }	
>   return $page_content;
> }
> 
> /**
>  * Displays a random verse.
>  *
>  * Displays a random verse based on the default translation.
>  *
>  * @param $blwb
>  *   ARRAY containing a list of translations along with book and chapter information.
>  * @param $opt
>  *   STRING used to determine the view ('admin' or 'public').
>  * @return
>  *   STRING a themed table.
>  * @ingroup themeable
>  */
> function theme_bible_list($blwb, $opt = 'public') {
> 
> /*
>   
>   // Initialize page content
>   $page_content = '';
> 
>   // Bible list array of objects (Object: bid, bsn, bname, lang)
>   $bl = $bibleList;
>   
>   // Display admin list
>   if($opt == 'admin'){
>   
> 	  // Create table header arrays
> 	  $header = array('ID', 'Short Name', 'Bible Name', 'Language', 'Book Count', 'Verse Count', 'Action');
> 	  
> 	  // Create table row arrays
> 	  if($bl != ''){
> 		foreach($bl as $bp){
> 		  $rows[] = array($bp->bid, 
> 						  l(t($bp->bsn), 'bible/'.$bp->bid), 
> 						  l(t($bp->bname), 'bible/'.$bp->bid), 
> 						  $bp->lang, 
> 						  get_book_count($bp->bid), 
> 						  get_verse_count($bp->bid), 
> 						  l(t('Delete'), 'admin/settings/bible/delete/'.$bp->bid));
> 		}
> 	  }
>   }
>   else{
> 
> 	  // Create table header arrays
> 	  $header = array('ID', 'Short Name', 'Bible Name', 'Language', 'Books');
> 	  
> 	  // Create table row arrays
> 	  if($bl != ''){
> 		foreach($bl as $bp){
> 		
> 		  // Get book list
> 		  $book_list = $bookList;
> 		  
> 		  foreach($book_list as $book_info){
> 		  	$list[] = l(t($book_info->fname), 'bible/'.$book_info->bid.'/'.$book_info->book);
> 		  }
> 		
> 		  $rows[] = array($bp->bid, 
> 						  l(t($bp->bsn), 'bible/'.$bp->bid), 
> 						  l(t($bp->bname), 'bible/'.$bp->bid), 
> 						  $bp->lang,
> 						  theme_item_list($list));
> 		}
> 	  }
>   }
>   
>   // Pass table headers and rows to be themed
>   $page_content .= theme_table($header, $rows);
> 
> */
>   // Bible list with books
>   $bl = $blwb;
>   // Admin View 
>   if($opt == 'admin'){
>     // Create table header arrays
>     $header = array('ID', 'Short Name', 'Bible Name', 'Language', 'Book Count', 'Verse Count', 'Action');
>     // Create table row arrays
>     if($bl != ''){
>       foreach($bl as $bp){
>         $rows[] = array($bp['bid'], 
>                         l(t($bp['bsn']), 'bible/'.$bp['bid']), 
>                         l(t($bp['bname']), 'bible/'.$bp['bid']), 
>                         $bp['lang'], 
>                         $bp['chapter_count'], 
>                         $bp['verse_count'], 
>                         l(t('Delete'), 'admin/settings/bible/delete/'.$bp['bid']));
>       }
>     }
>   }
>   // Public View
>   else{
>     // Create table header arrays
>     $header = array('ID', 'Short Name', 'Bible Name', 'Language', 'Books');
>     // Create table row arrays
>     if($bl != ''){
>       foreach($bl as $bp){
>         // Get book list
>         $book_list = $bp['books'];
>         // Initialize and reset $list
>         $list = '';
>         // Create book links
>         foreach($book_list as $book_info){
>           $list[] = l(t($book_info->fname), 'bible/'.$book_info->bid.'/'.$book_info->book);
>         }
>         $rows[] = array($bp['bid'], 
>                         l(t($bp['bsn']), 'bible/'.$bp['bid']), 
>                         l(t($bp['bname']), 'bible/'.$bp['bid']), 
>                         $bp['lang'],
>                         theme_item_list($list));
>       }
>     }
>   }
>   // Pass table headers and rows to be themed
>   $page_content .= theme_table($header, $rows);
>   // Return themed table
>   return $page_content;
> }
> 
> /**
>  * Displays search results.
>  *
>  * Displays a table of bible verses that match the search keyword.
>  *
>  * @param $keyword
>  *   STRING keyword.
>  * @param $translation_id
>  *   STRING integer identifying the bible translation id.
>  * @param $translation_name
>  *   STRING identifying the bible translation name.
>  * @param $results
>  *   ARRAY of bible verses that matched the keyword search.
>  * @return
>  *   STRING a themed table of search results.
>  * @ingroup themeable
>  */
> function theme_bible_search_keyword ($keyword, $translation_id, $translation_name, $results){
>   // Create search feedback text
>   $page_content = t('Search results in: "'.$translation_name.'" translation for keyword: "'.$keyword.'". Found: '. count($results));
>   // Create Header
>   $header = array();
>   // Pass table to be themed
>   $page_content .= theme_table($header, $results);
>   // Return themed table
>   return $page_content;
> }
> 
> /**
>  * Displays a daily Proverb.
>  *
>  * Displays a daily Proverb based on the day of the month.
>  *
>  * @param $bid
>  *   STRING integer identifying the bible translation id.
>  * @param $chapter
>  *   ARRAY of strings containing each verse.
>  * @param $opt
>  *   STRING which identifies which view to display ('admin', or 'verse').
>  * @return
>  *   STRING a themed box.
>  * @ingroup themeable
>  */
> function theme_bible_daily_proverb($bid, $chapter, $opt = 'verse'){
>   $page_content .= '';
>   $chapter_id = date("j");
>   // Show the whole chapter
>   if($opt == 'chapter'){
>     $title = t("Proverbs ".$chapter_id);
>     $content = theme_item_list($chapter, '', $type = 'ol');
>     $page_content .= theme_box($title, $content);      
>   }
>   // Show just the first verse
>   else{
>     $title = t("Proverbs ".$chapter_id.":1");
>     $content = $chapter[0];
>     $page_content .= theme_box($title, $content);
>     $page_content .= "<div>".l(t("More"), 'bible/'.$bid.'/PRO/'.$chapter_id)."</div>";
486c1156,1179
<   return $prevchap.':'.$nextchap;
---
>   // Return themed table
>   return $page_content;
> }
> 
> /**
>  * Displays a random verse.
>  *
>  * Displays a random verse based on the default translation.
>  *
>  * @param $verse_array
>  *   ARRAY containing the translation, book, chapter and verse information.
>  * @return
>  *   STRING a themed box.
>  * @ingroup themeable
>  */
> function theme_bible_golden_verse($verse_array){
>   $page_content .= '';
>   // Show just the first verse
>   $title = t($verse_array['book']." ".$verse_array['chapter'].":".$verse_array['verse']);
>   $content = $verse_array['context'];
>   $page_content .= theme_box($title, $content);
>   $page_content .= "<div>".l(t("More"), 'bible/'.$verse_array['bid'].'/'.$verse_array['book'].'/'.$verse_array['chapter'])."</div>";
>   // Return themed table
>   return $page_content;
