WordPress.org

Plugin Directory

Changeset 58027 for sermon-browser/trunk


Ignore:
Timestamp:
08/04/08 10:08:02 (6 years ago)
Author:
mark8barnes
Message:
 
Location:
sermon-browser/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sermon-browser/trunk/sb-includes/frontend.php

    r57080 r58027  
    224224// Display podcast, or download linked files 
    225225function sb_hijack() { 
    226     function sb_get_download_count ($stuff_name) { 
    227         global $wpdb; 
    228         $count = $wpdb->get_var("SELECT COUNT FROM ".$wpdb->prefix."sb_stuff WHERE name='".mysql_real_escape_string($stuff_name)."'"); 
    229         return $count; 
    230     } 
    231      
     226    //Increases the download count 
    232227    function sb_increase_download_count ($stuff_name) { 
    233228        global $wpdb; 
     
    235230    } 
    236231     
    237     global $filetypes; 
     232    // Safer readfile function for large files 
     233    function readfile_segments($filename,$retbytes=true) { 
     234        $segmentsize = 1048576; 
     235        $buffer = ''; 
     236        $cnt =0; 
     237        $handle = fopen($filename, 'rb'); 
     238        if ($handle === false) { 
     239            return false; 
     240        } 
     241        while (!feof($handle)) { 
     242            set_time_limit(ini_get('max_execution_time')); 
     243            $buffer = fread($handle, $segmentsize); 
     244            echo $buffer; 
     245            ob_flush(); 
     246            flush(); 
     247            if ($retbytes) { 
     248                $cnt += strlen($buffer); 
     249            } 
     250        } 
     251        $status = fclose($handle); 
     252        if ($retbytes && $status) 
     253            return $cnt; 
     254        return $status; 
     255    } 
     256     
     257    global $filetypes, $wpdb; 
    238258     
    239259    //Displays podcast 
     
    261281        die(); 
    262282    } 
    263      
     283 
    264284    //Forces sermon download of local file 
    265285    if (isset($_REQUEST['download']) AND isset($_REQUEST['file_name'])) { 
    266286        $file_name = urldecode($_GET['file_name']); 
    267         header("Pragma: public"); 
    268         header("Expires: 0"); 
    269         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");  
    270         header("Content-Type: application/force-download"); 
    271         header("Content-Type: application/octet-stream"); 
    272         header("Content-Type: application/download"); 
    273         header("Content-Disposition: attachment; filename=".$file_name.";"); 
    274         header("Content-Transfer-Encoding: binary"); 
    275         sb_increase_download_count ($file_name); 
    276         $file_name = sb_get_value('wordpress_path').get_option("sb_sermon_upload_dir").$file_name; 
    277         header("Content-Length: ".filesize($file_name)); 
    278         @readfile($file_name); 
     287        $file_name = $wpdb->get_var("SELECT name FROM {$wpdb->prefix}sb_stuff WHERE name='{$file_name}'"); 
     288        if (!is_null($file_name)) { 
     289            header("Pragma: public"); 
     290            header("Expires: 0"); 
     291            header("Cache-Control: must-revalidate, post-check=0, pre-check=0");  
     292            header("Content-Type: application/force-download"); 
     293            header("Content-Type: application/octet-stream"); 
     294            header("Content-Type: application/download"); 
     295            header("Content-Disposition: attachment; filename=".$file_name.";"); 
     296            header("Content-Transfer-Encoding: binary"); 
     297            sb_increase_download_count ($file_name); 
     298            $file_name = sb_get_value('wordpress_path').get_option("sb_sermon_upload_dir").$file_name; 
     299            header("Content-Length: ".filesize($file_name)); 
     300            readfile_segments($file_name); 
     301        } 
    279302        exit(); 
    280303    } 
     
    310333            if ($filesize) header("Content-Length: ".$filesize); 
    311334            sb_increase_download_count ($url); 
    312             @readfile($url); 
     335            readfile_segments($url); 
    313336            exit(); 
    314337        } 
     
    323346        global $filetypes; 
    324347        $file_name = urldecode($_GET['file_name']); 
    325         $ext = substr($file_name, strrpos($file_name, '.') + 1); 
    326         if (isset($filetypes[$ext]['content-type'])) { 
    327             header ("Content-Type: ".$filetypes[$ext]['content-type']); } 
    328         else { 
    329             header ("Content-Type: application/octet-stream"); } 
    330         sb_increase_download_count ($file_name); 
    331         $file_name = sb_get_value('wordpress_path').get_option("sb_sermon_upload_dir").$file_name; 
    332         header("Content-Length: ".filesize($file_name)); 
    333         header("Content-Transfer-Encoding: binary"); 
    334         @readfile($file_name); 
     348        $file_name = $wpdb->get_var("SELECT name FROM {$wpdb->prefix}sb_stuff WHERE name='{$file_name}'"); 
     349        if (!is_null($file_name)) { 
     350            $ext = substr($file_name, strrpos($file_name, '.') + 1); 
     351            if (isset($filetypes[$ext]['content-type'])) { 
     352                header ("Content-Type: ".$filetypes[$ext]['content-type']); } 
     353            else { 
     354                header ("Content-Type: application/octet-stream"); } 
     355            sb_increase_download_count ($file_name); 
     356            $file_name = sb_get_value('wordpress_path').get_option("sb_sermon_upload_dir").$file_name; 
     357            header("Content-Length: ".filesize($file_name)); 
     358            header("Content-Transfer-Encoding: binary"); 
     359            readfile_segments($file_name); 
     360        } 
    335361        exit(); 
    336362    } 
     
    361387            if ($filesize) header("Content-Length: ".$filesize); 
    362388            sb_increase_download_count ($url); 
    363             @readfile($url); 
     389            readfile_segments($url); 
    364390            exit(); 
    365391        } 
  • sermon-browser/trunk/sb-includes/sermon-browser.po

    r57080 r58027  
    33"Project-Id-Version: Sermon Browser 0.34\n" 
    44"Report-Msgid-Bugs-To: \n" 
    5 "POT-Creation-Date: 2008-07-31 04:05-0000\n" 
     5"POT-Creation-Date: 2008-08-04 11:03-0000\n" 
    66"PO-Revision-Date: \n" 
    77"Last-Translator: Mark Barnes <mark@4-14.org.uk>\n" 
     
    1515"X-Poedit-SearchPath-0: ..\n" 
    1616 
    17 #: ../sermon.php:56 
    18 #: ../sermon.php:57 
    19 #: ../sermon.php:1349 
     17#: ../sermon.php:58 
     18#: ../sermon.php:59 
     19#: ../sermon.php:1379 
    2020#: ../sb-includes/widget.php:51 
    2121msgid "Sermons" 
    2222msgstr "" 
    2323 
    24 #: ../sermon.php:59 
     24#: ../sermon.php:61 
    2525msgid "Edit Sermon" 
    2626msgstr "" 
    2727 
    28 #: ../sermon.php:61 
     28#: ../sermon.php:63 
    2929msgid "Add Sermon" 
    3030msgstr "" 
    3131 
    32 #: ../sermon.php:63 
    33 #: ../sermon.php:726 
     32#: ../sermon.php:65 
     33#: ../sermon.php:755 
    3434msgid "Preachers" 
    3535msgstr "" 
    3636 
    37 #: ../sermon.php:64 
     37#: ../sermon.php:66 
    3838msgid "Series &amp; Services" 
    3939msgstr "" 
    4040 
    41 #: ../sermon.php:65 
     41#: ../sermon.php:67 
    4242msgid "Uploads" 
    4343msgstr "" 
    4444 
    45 #: ../sermon.php:66 
    46 #: ../sermon.php:454 
     45#: ../sermon.php:68 
     46#: ../sermon.php:483 
    4747msgid "Options" 
    4848msgstr "" 
    4949 
    50 #: ../sermon.php:67 
    51 #: ../sermon.php:559 
     50#: ../sermon.php:69 
     51#: ../sermon.php:588 
    5252msgid "Templates" 
    5353msgstr "" 
    5454 
    55 #: ../sermon.php:68 
     55#: ../sermon.php:70 
    5656msgid "Help" 
    5757msgstr "" 
    5858 
    59 #: ../sermon.php:272 
    60 #: ../sermon.php:744 
    61 #: ../sermon.php:910 
    62 #: ../sermon.php:920 
     59#: ../sermon.php:297 
     60#: ../sermon.php:773 
     61#: ../sermon.php:939 
     62#: ../sermon.php:949 
     63#: ../sermon.php:1191 
     64#: ../sermon.php:1235 
     65#: ../sermon.php:1408 
     66#: ../sermon.php:2270 
     67#: ../sermon.php:2313 
     68msgid "Delete" 
     69msgstr "" 
     70 
     71#: ../sermon.php:298 
     72msgid "Congratulations, you just completed the installation!" 
     73msgstr "" 
     74 
     75#: ../sermon.php:326 
     76msgid "You do not have the correct permissions to edit the Sermon Browser options" 
     77msgstr "" 
     78 
     79#: ../sermon.php:359 
     80#: ../sermon.php:368 
     81msgid "Upload is disabled. Please contact your administrator." 
     82msgstr "" 
     83 
     84#: ../sermon.php:361 
     85#: ../sermon.php:400 
     86msgid "Error: The upload folder is not writeable. You need to CHMOD the folder to 666 or 777." 
     87msgstr "" 
     88 
     89#: ../sermon.php:370 
     90#: ../sermon.php:405 
     91msgid "Error: The upload folder you have specified does not exist." 
     92msgstr "" 
     93 
     94#: ../sermon.php:376 
     95msgid "Default loaded successfully." 
     96msgstr "" 
     97 
     98#: ../sermon.php:410 
     99msgid "Options saved successfully." 
     100msgstr "" 
     101 
     102#: ../sermon.php:461 
     103msgid "All sermon data has been removed." 
     104msgstr "" 
     105 
     106#: ../sermon.php:463 
     107msgid "Uninstall completed. Please deactivate the plugin." 
     108msgstr "" 
     109 
     110#: ../sermon.php:469 
     111msgid "Error" 
     112msgstr "" 
     113 
     114#: ../sermon.php:475 
     115msgid "Warning" 
     116msgstr "" 
     117 
     118#: ../sermon.php:490 
     119msgid "Upload folder" 
     120msgstr "" 
     121 
     122#: ../sermon.php:501 
     123msgid "Public podcast feed" 
     124msgstr "" 
     125 
     126#: ../sermon.php:505 
     127msgid "Private podcast feed" 
     128msgstr "" 
     129 
     130#: ../sermon.php:509 
     131msgid "Sermons per page" 
     132msgstr "" 
     133 
     134#: ../sermon.php:516 
     135msgid "The upload folder is not writeable. You need to CHMOD the folder to 666 or 777." 
     136msgstr "" 
     137 
     138#: ../sermon.php:518 
     139msgid "The upload folder you have specified does not exist." 
     140msgstr "" 
     141 
     142#: ../sermon.php:525 
     143msgid "Your php.ini file does not allow uploads. Please change file_uploads in php.ini." 
     144msgstr "" 
     145 
     146#: ../sermon.php:526 
     147msgid "The maximum file size you can upload is only " 
     148msgstr "" 
     149 
     150#: ../sermon.php:526 
     151msgid "k. Please change upload_max_filesize to at least 15M in php.ini." 
     152msgstr "" 
     153 
     154#: ../sermon.php:527 
     155msgid "The maximum file size you send through the browser is only " 
     156msgstr "" 
     157 
     158#: ../sermon.php:527 
     159msgid "k. Please change post_max_size to at least 15M in php.ini." 
     160msgstr "" 
     161 
     162#: ../sermon.php:528 
     163msgid "The maximum time allowed for any script to run is only " 
     164msgstr "" 
     165 
     166#: ../sermon.php:528 
     167msgid " seconds. Please change max_execution_time to at least 600 in php.ini." 
     168msgstr "" 
     169 
     170#: ../sermon.php:529 
     171msgid "The maximum time allowed for an upload script to run is only " 
     172msgstr "" 
     173 
     174#: ../sermon.php:529 
     175msgid " seconds. Please change max_input_time to at least 600 in php.ini." 
     176msgstr "" 
     177 
     178#: ../sermon.php:530 
     179msgid "The maximum amount of memory allowed is only " 
     180msgstr "" 
     181 
     182#: ../sermon.php:530 
     183msgid "k. Please change memory_limit to at least 16M in php.ini." 
     184msgstr "" 
     185 
     186#: ../sermon.php:534 
     187#: ../sermon.php:610 
     188msgid "Reset to defaults" 
     189msgstr "" 
     190 
     191#: ../sermon.php:534 
     192#: ../sermon.php:610 
     193#: ../sermon.php:745 
     194#: ../sermon.php:1879 
     195msgid "Save" 
     196msgstr "" 
     197 
     198#: ../sermon.php:537 
     199msgid "Delete all data" 
     200msgstr "" 
     201 
     202#: ../sermon.php:537 
     203#: ../sermon.php:544 
     204msgid "Uninstall" 
     205msgstr "" 
     206 
     207#: ../sermon.php:541 
     208msgid "Remove all files" 
     209msgstr "" 
     210 
     211#: ../sermon.php:544 
     212msgid "Delete all" 
     213msgstr "" 
     214 
     215#: ../sermon.php:544 
     216msgid "Do you REALLY want to delete all data?" 
     217msgstr "" 
     218 
     219#: ../sermon.php:549 
     220msgid "Are you sure?" 
     221msgstr "" 
     222 
     223#: ../sermon.php:561 
     224msgid "You do not have the correct permissions to edit the Sermon Browser templates" 
     225msgstr "" 
     226 
     227#: ../sermon.php:580 
     228msgid "Templates saved successfully." 
     229msgstr "" 
     230 
     231#: ../sermon.php:592 
     232msgid "Search results page" 
     233msgstr "" 
     234 
     235#: ../sermon.php:598 
     236msgid "Sermon page" 
     237msgstr "" 
     238 
     239#: ../sermon.php:604 
     240msgid "Style" 
     241msgstr "" 
     242 
     243#: ../sermon.php:627 
     244msgid "You do not have the correct permissions to manage the preachers' database" 
     245msgstr "" 
     246 
     247#: ../sermon.php:629 
     248msgid "Preacher saved to database." 
     249msgstr "" 
     250 
     251#: ../sermon.php:653 
     252msgid "Could not save uploaded file. Please try again." 
     253msgstr "" 
     254 
     255#: ../sermon.php:658 
     256msgid "Could not upload file. Please check the Options page for any errors or warnings." 
     257msgstr "" 
     258 
     259#: ../sermon.php:681 
     260msgid "You can't delete this preacher." 
     261msgstr "" 
     262 
     263#: ../sermon.php:695 
     264msgid "Add" 
     265msgstr "" 
     266 
     267#: ../sermon.php:695 
     268#: ../sermon.php:773 
     269#: ../sermon.php:939 
     270#: ../sermon.php:1408 
     271#: ../sermon.php:2270 
     272msgid "Edit" 
     273msgstr "" 
     274 
     275#: ../sermon.php:695 
     276msgid "preacher" 
     277msgstr "" 
     278 
     279#: ../sermon.php:707 
     280msgid "The images folder is not writeable. You won't be able to upload images." 
     281msgstr "" 
     282 
     283#: ../sermon.php:716 
     284#: ../sermon.php:761 
     285#: ../sermon.php:923 
     286msgid "Name" 
     287msgstr "" 
     288 
     289#: ../sermon.php:724 
     290#: ../sermon.php:1772 
     291msgid "Description" 
     292msgstr "" 
     293 
     294#: ../sermon.php:736 
     295#: ../sermon.php:762 
     296msgid "Image" 
     297msgstr "" 
     298 
     299#: ../sermon.php:755 
     300#: ../sermon.php:917 
     301msgid "add new" 
     302msgstr "" 
     303 
     304#: ../sermon.php:760 
     305#: ../sermon.php:922 
     306#: ../sermon.php:1177 
     307#: ../sermon.php:1211 
     308#: ../sermon.php:1260 
     309#: ../sermon.php:1384 
     310msgid "ID" 
     311msgstr "" 
     312 
     313#: ../sermon.php:763 
     314#: ../sermon.php:925 
     315#: ../sermon.php:1180 
     316#: ../sermon.php:1215 
     317#: ../sermon.php:1264 
     318#: ../sermon.php:1391 
     319msgid "Actions" 
     320msgstr "" 
     321 
     322#: ../sermon.php:788 
     323msgid "You do not have the correct permissions to manage the series and services database" 
     324msgstr "" 
     325 
     326#: ../sermon.php:924 
     327msgid "Default time" 
     328msgstr "" 
     329 
     330#: ../sermon.php:939 
     331#: ../sermon.php:1191 
     332#: ../sermon.php:1235 
     333#: ../sermon.php:2313 
     334msgid "Rename" 
     335msgstr "" 
     336 
     337#: ../sermon.php:941 
     338msgid "Some sermons are currently assigned to that service. You can only delete services that are not used in the database." 
     339msgstr "" 
     340 
     341#: ../sermon.php:944 
     342msgid "Some sermons are currently in that series. You can only delete series that are empty." 
     343msgstr "" 
     344 
     345#: ../sermon.php:947 
     346msgid "That preacher has sermons in the database. You can only delete preachers who have no sermons in the database." 
     347msgstr "" 
     348 
     349#: ../sermon.php:969 
     350msgid "You do not have the correct permissions to upload sermons" 
     351msgstr "" 
     352 
     353#: ../sermon.php:997 
     354msgid "Files saved to database." 
     355msgstr "" 
     356 
     357#: ../sermon.php:1000 
     358#: ../sermon.php:1520 
     359msgid " already exists." 
     360msgstr "" 
     361 
     362#: ../sermon.php:1004 
     363#: ../sermon.php:1525 
     364msgid "You are not permitted to upload files of that type." 
     365msgstr "" 
     366 
     367#: ../sermon.php:1042 
     368msgid "New file name?" 
     369msgstr "" 
     370 
     371#: ../sermon.php:1055 
     372msgid "You are not permitted files with that extension." 
     373msgstr "" 
     374 
     375#: ../sermon.php:1057 
     376msgid "The script is unable to rename your file." 
     377msgstr "" 
     378 
     379#: ../sermon.php:1085 
     380msgid "The script is unable to delete your file." 
     381msgstr "" 
     382 
     383#: ../sermon.php:1096 
     384#: ../sermon.php:1115 
     385msgid "Previous" 
     386msgstr "" 
     387 
     388#: ../sermon.php:1102 
     389#: ../sermon.php:1121 
     390msgid "Next" 
     391msgstr "" 
     392 
     393#: ../sermon.php:1138 
     394msgid "Upload Files" 
     395msgstr "" 
     396 
     397#: ../sermon.php:1148 
     398msgid "File to upload" 
     399msgstr "" 
     400 
     401#: ../sermon.php:1153 
     402msgid "Upload" 
     403msgstr "" 
     404 
    63405#: ../sermon.php:1162 
     406msgid "Upload is disabled. Please contact your systems administrator." 
     407msgstr "" 
     408 
     409#: ../sermon.php:1166 
     410msgid "Upload is disabled. Please check your folder setting in Options." 
     411msgstr "" 
     412 
     413#: ../sermon.php:1172 
     414msgid "Unlinked files" 
     415msgstr "" 
     416 
     417#: ../sermon.php:1178 
     418#: ../sermon.php:1212 
     419#: ../sermon.php:1261 
     420msgid "File name" 
     421msgstr "" 
     422 
     423#: ../sermon.php:1179 
     424#: ../sermon.php:1213 
     425#: ../sermon.php:1262 
     426msgid "File type" 
     427msgstr "" 
     428 
    64429#: ../sermon.php:1206 
    65 #: ../sermon.php:1378 
    66 #: ../sermon.php:2236 
    67 #: ../sermon.php:2279 
    68 msgid "Delete" 
    69 msgstr "" 
    70  
    71 #: ../sermon.php:273 
    72 msgid "Congratulations, you just completed the installation!" 
    73 msgstr "" 
    74  
    75 #: ../sermon.php:299 
    76 msgid "You do not have the correct permissions to edit the Sermon Browser options" 
    77 msgstr "" 
    78  
    79 #: ../sermon.php:332 
    80 #: ../sermon.php:341 
    81 msgid "Upload is disabled. Please contact your administrator." 
    82 msgstr "" 
    83  
    84 #: ../sermon.php:334 
    85 #: ../sermon.php:373 
    86 msgid "Error: The upload folder is not writeable. You need to CHMOD the folder to 666 or 777." 
    87 msgstr "" 
    88  
    89 #: ../sermon.php:343 
    90 #: ../sermon.php:378 
    91 msgid "Error: The upload folder you have specified does not exist." 
    92 msgstr "" 
    93  
    94 #: ../sermon.php:349 
    95 msgid "Default loaded successfully." 
    96 msgstr "" 
    97  
    98 #: ../sermon.php:383 
    99 msgid "Options saved successfully." 
    100 msgstr "" 
    101  
    102 #: ../sermon.php:432 
    103 msgid "All sermon data has been removed." 
    104 msgstr "" 
    105  
    106 #: ../sermon.php:434 
    107 msgid "Uninstall completed. Please deactivate the plugin." 
    108 msgstr "" 
    109  
    110 #: ../sermon.php:440 
    111 msgid "Error" 
    112 msgstr "" 
    113  
    114 #: ../sermon.php:446 
    115 msgid "Warning" 
    116 msgstr "" 
    117  
    118 #: ../sermon.php:461 
    119 msgid "Upload folder" 
    120 msgstr "" 
    121  
    122 #: ../sermon.php:472 
    123 msgid "Public podcast feed" 
    124 msgstr "" 
    125  
    126 #: ../sermon.php:476 
    127 msgid "Private podcast feed" 
    128 msgstr "" 
    129  
    130 #: ../sermon.php:480 
    131 msgid "Sermons per page" 
    132 msgstr "" 
    133  
    134 #: ../sermon.php:487 
    135 msgid "The upload folder is not writeable. You need to CHMOD the folder to 666 or 777." 
    136 msgstr "" 
    137  
    138 #: ../sermon.php:489 
    139 msgid "The upload folder you have specified does not exist." 
    140 msgstr "" 
    141  
    142 #: ../sermon.php:496 
    143 msgid "Your php.ini file does not allow uploads. Please change file_uploads in php.ini." 
    144 msgstr "" 
    145  
    146 #: ../sermon.php:497 
    147 msgid "The maximum file size you can upload is only " 
    148 msgstr "" 
    149  
    150 #: ../sermon.php:497 
    151 msgid "k. Please change upload_max_filesize to at least 15M in php.ini." 
    152 msgstr "" 
    153  
    154 #: ../sermon.php:498 
    155 msgid "The maximum file size you send through the browser is only " 
    156 msgstr "" 
    157  
    158 #: ../sermon.php:498 
    159 msgid "k. Please change post_max_size to at least 15M in php.ini." 
    160 msgstr "" 
    161  
    162 #: ../sermon.php:499 
    163 msgid "The maximum time allowed for any script to run is only " 
    164 msgstr "" 
    165  
    166 #: ../sermon.php:499 
    167 msgid " seconds. Please change max_execution_time to at least 600 in php.ini." 
    168 msgstr "" 
    169  
    170 #: ../sermon.php:500 
    171 msgid "The maximum time allowed for an upload script to run is only " 
    172 msgstr "" 
    173  
    174 #: ../sermon.php:500 
    175 msgid " seconds. Please change max_input_time to at least 600 in php.ini." 
    176 msgstr "" 
    177  
    178 #: ../sermon.php:501 
    179 msgid "The maximum amount of memory allowed is only " 
    180 msgstr "" 
    181  
    182 #: ../sermon.php:501 
    183 msgid "k. Please change memory_limit to at least 16M in php.ini." 
    184 msgstr "" 
    185  
    186 #: ../sermon.php:505 
    187 #: ../sermon.php:581 
    188 msgid "Reset to defaults" 
    189 msgstr "" 
    190  
    191 #: ../sermon.php:505 
    192 #: ../sermon.php:581 
    193 #: ../sermon.php:716 
    194 #: ../sermon.php:1845 
    195 msgid "Save" 
    196 msgstr "" 
    197  
    198 #: ../sermon.php:508 
    199 msgid "Delete all data" 
    200 msgstr "" 
    201  
    202 #: ../sermon.php:508 
    203 #: ../sermon.php:515 
    204 msgid "Uninstall" 
    205 msgstr "" 
    206  
    207 #: ../sermon.php:512 
    208 msgid "Remove all files" 
    209 msgstr "" 
    210  
    211 #: ../sermon.php:515 
    212 msgid "Delete all" 
    213 msgstr "" 
    214  
    215 #: ../sermon.php:515 
    216 msgid "Do you REALLY want to delete all data?" 
    217 msgstr "" 
    218  
    219 #: ../sermon.php:520 
    220 msgid "Are you sure?" 
    221 msgstr "" 
    222  
    223 #: ../sermon.php:532 
    224 msgid "You do not have the correct permissions to edit the Sermon Browser templates" 
    225 msgstr "" 
    226  
    227 #: ../sermon.php:551 
    228 msgid "Templates saved successfully." 
    229 msgstr "" 
    230  
    231 #: ../sermon.php:563 
    232 msgid "Search results page" 
    233 msgstr "" 
    234  
    235 #: ../sermon.php:569 
    236 msgid "Sermon page" 
    237 msgstr "" 
    238  
    239 #: ../sermon.php:575 
    240 msgid "Style" 
    241 msgstr "" 
    242  
    243 #: ../sermon.php:598 
    244 msgid "You do not have the correct permissions to manage the preachers' database" 
    245 msgstr "" 
    246  
    247 #: ../sermon.php:600 
    248 msgid "Preacher saved to database." 
    249 msgstr "" 
    250  
    251 #: ../sermon.php:624 
    252 msgid "Could not save uploaded file. Please try again." 
    253 msgstr "" 
    254  
    255 #: ../sermon.php:629 
    256 msgid "Could not upload file. Please check the Options page for any errors or warnings." 
    257 msgstr "" 
    258  
    259 #: ../sermon.php:652 
    260 msgid "You can't delete this preacher." 
    261 msgstr "" 
    262  
    263 #: ../sermon.php:666 
    264 msgid "Add" 
    265 msgstr "" 
    266  
    267 #: ../sermon.php:666 
    268 #: ../sermon.php:744 
    269 #: ../sermon.php:910 
    270 #: ../sermon.php:1378 
    271 #: ../sermon.php:2236 
    272 msgid "Edit" 
    273 msgstr "" 
    274  
    275 #: ../sermon.php:666 
    276 msgid "preacher" 
    277 msgstr "" 
    278  
    279 #: ../sermon.php:678 
    280 msgid "The images folder is not writeable. You won't be able to upload images." 
    281 msgstr "" 
    282  
    283 #: ../sermon.php:687 
    284 #: ../sermon.php:732 
    285 #: ../sermon.php:894 
    286 msgid "Name" 
    287 msgstr "" 
    288  
    289 #: ../sermon.php:695 
    290 #: ../sermon.php:1738 
    291 msgid "Description" 
    292 msgstr "" 
    293  
    294 #: ../sermon.php:707 
    295 #: ../sermon.php:733 
    296 msgid "Image" 
    297 msgstr "" 
    298  
    299 #: ../sermon.php:726 
    300 #: ../sermon.php:888 
    301 msgid "add new" 
    302 msgstr "" 
    303  
    304 #: ../sermon.php:731 
    305 #: ../sermon.php:893 
    306 #: ../sermon.php:1148 
    307 #: ../sermon.php:1182 
    308 #: ../sermon.php:1231 
    309 #: ../sermon.php:1354 
    310 msgid "ID" 
    311 msgstr "" 
    312  
    313 #: ../sermon.php:734 
    314 #: ../sermon.php:896 
    315 #: ../sermon.php:1151 
    316 #: ../sermon.php:1186 
    317 #: ../sermon.php:1235 
    318 #: ../sermon.php:1361 
    319 msgid "Actions" 
    320 msgstr "" 
    321  
    322 #: ../sermon.php:759 
    323 msgid "You do not have the correct permissions to manage the series and services database" 
    324 msgstr "" 
    325  
    326 #: ../sermon.php:895 
    327 msgid "Default time" 
    328 msgstr "" 
    329  
    330 #: ../sermon.php:910 
    331 #: ../sermon.php:1162 
    332 #: ../sermon.php:1206 
    333 #: ../sermon.php:2279 
    334 msgid "Rename" 
    335 msgstr "" 
    336  
    337 #: ../sermon.php:912 
    338 msgid "Some sermons are currently assigned to that service. You can only delete services that are not used in the database." 
    339 msgstr "" 
    340  
    341 #: ../sermon.php:915 
    342 msgid "Some sermons are currently in that series. You can only delete series that are empty." 
    343 msgstr "" 
    344  
    345 #: ../sermon.php:918 
    346 msgid "That preacher has sermons in the database. You can only delete preachers who have no sermons in the database." 
    347 msgstr "" 
    348  
    349 #: ../sermon.php:940 
    350 msgid "You do not have the correct permissions to upload sermons" 
    351 msgstr "" 
    352  
    353 #: ../sermon.php:968 
    354 msgid "Files saved to database." 
    355 msgstr "" 
    356  
    357 #: ../sermon.php:971 
    358 #: ../sermon.php:1490 
    359 msgid " already exists." 
    360 msgstr "" 
    361  
    362 #: ../sermon.php:975 
    363 #: ../sermon.php:1495 
    364 msgid "You are not permitted to upload files of that type." 
    365 msgstr "" 
    366  
    367 #: ../sermon.php:1013 
    368 msgid "New file name?" 
    369 msgstr "" 
    370  
    371 #: ../sermon.php:1026 
    372 msgid "You are not permitted files with that extension." 
    373 msgstr "" 
    374  
    375 #: ../sermon.php:1028 
    376 msgid "The script is unable to rename your file." 
    377 msgstr "" 
    378  
    379 #: ../sermon.php:1056 
    380 msgid "The script is unable to delete your file." 
    381 msgstr "" 
    382  
    383 #: ../sermon.php:1067 
    384 #: ../sermon.php:1086 
    385 msgid "Previous" 
    386 msgstr "" 
    387  
    388 #: ../sermon.php:1073 
    389 #: ../sermon.php:1092 
    390 msgid "Next" 
    391 msgstr "" 
    392  
    393 #: ../sermon.php:1109 
    394 msgid "Upload Files" 
    395 msgstr "" 
    396  
    397 #: ../sermon.php:1119 
    398 msgid "File to upload" 
    399 msgstr "" 
    400  
    401 #: ../sermon.php:1124 
    402 msgid "Upload" 
    403 msgstr "" 
    404  
    405 #: ../sermon.php:1133 
    406 msgid "Upload is disabled. Please contact your systems administrator." 
    407 msgstr "" 
    408  
    409 #: ../sermon.php:1137 
    410 msgid "Upload is disabled. Please check your folder setting in Options." 
    411 msgstr "" 
    412  
    413 #: ../sermon.php:1143 
    414 msgid "Unlinked files" 
    415 msgstr "" 
    416  
    417 #: ../sermon.php:1149 
    418 #: ../sermon.php:1183 
    419 #: ../sermon.php:1232 
    420 msgid "File name" 
    421 msgstr "" 
    422  
    423 #: ../sermon.php:1150 
    424 #: ../sermon.php:1184 
    425 #: ../sermon.php:1233 
    426 msgid "File type" 
    427 msgstr "" 
    428  
    429 #: ../sermon.php:1177 
    430430msgid "Linked files" 
    431431msgstr "" 
    432432 
    433 #: ../sermon.php:1185 
    434 #: ../sermon.php:1234 
     433#: ../sermon.php:1214 
     434#: ../sermon.php:1263 
    435435#: ../sb-includes/widget.php:49 
    436436msgid "Sermon" 
    437437msgstr "" 
    438438 
    439 #: ../sermon.php:1221 
     439#: ../sermon.php:1250 
    440440msgid "Search for files" 
    441441msgstr "" 
    442442 
    443 #: ../sermon.php:1225 
     443#: ../sermon.php:1254 
    444444msgid "Search" 
    445445msgstr "" 
    446446 
    447 #: ../sermon.php:1240 
     447#: ../sermon.php:1269 
    448448msgid "Search results will appear here." 
    449449msgstr "" 
    450450 
    451 #: ../sermon.php:1258 
     451#: ../sermon.php:1287 
    452452msgid "Clean up" 
    453453msgstr "" 
    454454 
    455 #: ../sermon.php:1260 
     455#: ../sermon.php:1289 
    456456msgid "Pressing the button below scans every sermon in the database, and removes missing attachments. Use with caution!" 
    457457msgstr "" 
    458458 
    459 #: ../sermon.php:1261 
     459#: ../sermon.php:1290 
    460460msgid "Clean up missing files" 
    461461msgstr "" 
    462462 
    463 #: ../sermon.php:1273 
    464 #: ../sermon.php:1447 
     463#: ../sermon.php:1302 
     464#: ../sermon.php:1477 
    465465msgid "You do not have the correct permissions to edit sermons" 
    466466msgstr "" 
    467467 
    468 #: ../sermon.php:1276 
     468#: ../sermon.php:1305 
    469469msgid "Sermon saved to database." 
    470470msgstr "" 
    471471 
    472 #: ../sermon.php:1282 
     472#: ../sermon.php:1311 
    473473msgid "You do not have the correct permissions to delete sermons" 
    474474msgstr "" 
    475475 
    476 #: ../sermon.php:1289 
     476#: ../sermon.php:1319 
    477477msgid "Sermon removed from database." 
    478478msgstr "" 
    479479 
    480 #: ../sermon.php:1325 
    481480#: ../sermon.php:1355 
    482 #: ../sermon.php:1690 
     481#: ../sermon.php:1385 
     482#: ../sermon.php:1724 
    483483msgid "Title" 
    484484msgstr "" 
    485485 
    486 #: ../sermon.php:1329 
    487 #: ../sermon.php:1356 
    488 #: ../sermon.php:1704 
    489 #: ../sb-includes/frontend.php:843 
     486#: ../sermon.php:1359 
     487#: ../sermon.php:1386 
     488#: ../sermon.php:1738 
     489#: ../sb-includes/frontend.php:869 
    490490msgid "Preacher" 
    491491msgstr "" 
    492492 
    493 #: ../sermon.php:1338 
    494 #: ../sermon.php:1359 
    495 #: ../sermon.php:1717 
    496 #: ../sb-includes/frontend.php:869 
     493#: ../sermon.php:1368 
     494#: ../sermon.php:1389 
     495#: ../sermon.php:1751 
     496#: ../sb-includes/frontend.php:895 
    497497msgid "Series" 
    498498msgstr "" 
    499499 
    500 #: ../sermon.php:1346 
     500#: ../sermon.php:1376 
    501501msgid "Filter" 
    502502msgstr "" 
    503503 
    504 #: ../sermon.php:1357 
    505 #: ../sermon.php:1732 
     504#: ../sermon.php:1387 
     505#: ../sermon.php:1766 
    506506msgid "Date" 
    507507msgstr "" 
    508508 
    509 #: ../sermon.php:1358 
    510 #: ../sermon.php:1746 
     509#: ../sermon.php:1388 
     510#: ../sermon.php:1780 
    511511msgid "Service" 
    512512msgstr "" 
    513513 
    514 #: ../sermon.php:1360 
     514#: ../sermon.php:1390 
    515515msgid "Stats" 
    516516msgstr "" 
    517517 
    518 #: ../sermon.php:1405 
     518#: ../sermon.php:1435 
    519519msgid "You do not have the correct permissions to edit or create sermons" 
    520520msgstr "" 
    521521 
    522 #: ../sermon.php:1440 
     522#: ../sermon.php:1470 
    523523msgid "You do not have the correct permissions to create sermons" 
    524524msgstr "" 
    525525 
    526 #: ../sermon.php:1696 
     526#: ../sermon.php:1730 
    527527msgid "Tags (comma separated)" 
    528528msgstr "" 
    529529 
    530 #: ../sermon.php:1713 
     530#: ../sermon.php:1747 
    531531msgid "Create new preacher" 
    532532msgstr "" 
    533533 
    534 #: ../sermon.php:1726 
     534#: ../sermon.php:1760 
    535535msgid "Create new series" 
    536536msgstr "" 
    537537 
    538 #: ../sermon.php:1755 
     538#: ../sermon.php:1789 
    539539msgid "Create new service" 
    540540msgstr "" 
    541541 
    542 #: ../sermon.php:1761 
     542#: ../sermon.php:1795 
    543543msgid "Time" 
    544544msgstr "" 
    545545 
    546 #: ../sermon.php:1764 
     546#: ../sermon.php:1798 
    547547msgid "Override default time" 
    548548msgstr "" 
    549549 
    550 #: ../sermon.php:1770 
     550#: ../sermon.php:1804 
    551551msgid "Bible passage" 
    552552msgstr "" 
    553553 
    554 #: ../sermon.php:1770 
    555 #: ../sermon.php:1813 
     554#: ../sermon.php:1804 
     555#: ../sermon.php:1847 
    556556msgid "add more" 
    557557msgstr "" 
    558558 
    559 #: ../sermon.php:1774 
     559#: ../sermon.php:1808 
    560560msgid "From" 
    561561msgstr "" 
    562562 
    563 #: ../sermon.php:1775 
     563#: ../sermon.php:1809 
    564564msgid "To" 
    565565msgstr "" 
    566566 
    567 #: ../sermon.php:1813 
     567#: ../sermon.php:1847 
    568568msgid "Attachments" 
    569569msgstr "" 
    570570 
    571 #: ../sermon.php:1822 
     571#: ../sermon.php:1856 
    572572msgid "Choose existing file:" 
    573573msgstr "" 
    574574 
    575 #: ../sermon.php:1823 
     575#: ../sermon.php:1857 
    576576msgid "Upload a new one:" 
    577577msgstr "" 
    578578 
    579 #: ../sermon.php:1824 
     579#: ../sermon.php:1858 
    580580msgid "Enter an URL:" 
    581581msgstr "" 
    582582 
    583 #: ../sermon.php:1825 
     583#: ../sermon.php:1859 
    584584msgid "Enter embed code:" 
    585585msgstr "" 
    586586 
    587 #: ../sermon.php:1965 
     587#: ../sermon.php:1999 
    588588msgid "Help page" 
    589589msgstr "" 
    590590 
    591 #: ../sermon.php:2285 
     591#: ../sermon.php:2319 
    592592msgid "No results" 
    593593msgstr "" 
    594594 
    595 #: ../sermon.php:2299 
     595#: ../sermon.php:2333 
    596596msgid "You must create a post or preferably a page that includes the code [sermons] in order for your sermons to be displayed on your site." 
    597597msgstr "" 
    598598 
    599 #: ../sermon.php:2458 
     599#: ../sermon.php:2357 
     600msgid "You have" 
     601msgstr "" 
     602 
     603#: ../sermon.php:2361 
     604#: ../sermon.php:2369 
     605msgid "in" 
     606msgstr "" 
     607 
     608#: ../sermon.php:2365 
     609msgid "from" 
     610msgstr "" 
     611 
     612#: ../sermon.php:2370 
     613#, php-format 
     614msgid "%d series" 
     615msgstr "" 
     616 
     617#: ../sermon.php:2373 
     618msgid "using" 
     619msgstr "" 
     620 
     621#: ../sermon.php:2381 
     622#, php-format 
     623msgid "The most popular sermon is %s, which has been downloaded %s times" 
     624msgstr "" 
     625 
     626#: ../sermon.php:2544 
    600627msgid "Genesis" 
    601628msgstr "" 
    602629 
    603 #: ../sermon.php:2458 
     630#: ../sermon.php:2544 
    604631msgid "Exodus" 
    605632msgstr "" 
    606633 
    607 #: ../sermon.php:2458 
     634#: ../sermon.php:2544 
    608635msgid "Leviticus" 
    609636msgstr "" 
    610637 
    611 #: ../sermon.php:2458 
     638#: ../sermon.php:2544 
    612639msgid "Numbers" 
    613640msgstr "" 
    614641 
    615 #: ../sermon.php:2458 
     642#: ../sermon.php:2544 
    616643msgid "Deuteronomy" 
    617644msgstr "" 
    618645 
    619 #: ../sermon.php:2458 
     646#: ../sermon.php:2544 
    620647msgid "Joshua" 
    621648msgstr "" 
    622649 
    623 #: ../sermon.php:2458 
     650#: ../sermon.php:2544 
    624651msgid "Judges" 
    625652msgstr "" 
    626653 
    627 #: ../sermon.php:2458 
     654#: ../sermon.php:2544 
    628655msgid "Ruth" 
    629656msgstr "" 
    630657 
    631 #: ../sermon.php:2458 
     658#: ../sermon.php:2544 
    632659msgid "1 Samuel" 
    633660msgstr "" 
    634661 
    635 #: ../sermon.php:2458 
     662#: ../sermon.php:2544 
    636663msgid "2 Samuel" 
    637664msgstr "" 
    638665 
    639 #: ../sermon.php:2458 
     666#: ../sermon.php:2544 
    640667msgid "1 Kings" 
    641668msgstr "" 
    642669 
    643 #: ../sermon.php:2458 
     670#: ../sermon.php:2544 
    644671msgid "2 Kings" 
    645672msgstr "" 
    646673 
    647 #: ../sermon.php:2458 
     674#: ../sermon.php:2544 
    648675msgid "1 Chronicles" 
    649676msgstr "" 
    650677 
    651 #: ../sermon.php:2458 
     678#: ../sermon.php:2544 
    652679msgid "2 Chronicles" 
    653680msgstr "" 
    654681 
    655 #: ../sermon.php:2458 
     682#: ../sermon.php:2544 
    656683msgid "Ezra" 
    657684msgstr "" 
    658685 
    659 #: ../sermon.php:2458 
     686#: ../sermon.php:2544 
    660687msgid "Nehemiah" 
    661688msgstr "" 
    662689 
    663 #: ../sermon.php:2458 
     690#: ../sermon.php:2544 
    664691msgid "Esther" 
    665692msgstr "" 
    666693 
    667 #: ../sermon.php:2458 
     694#: ../sermon.php:2544 
    668695msgid "Job" 
    669696msgstr "" 
    670697 
    671 #: ../sermon.php:2458 
     698#: ../sermon.php:2544 
    672699msgid "Psalm" 
    673700msgstr "" 
    674701 
    675 #: ../sermon.php:2458 
     702#: ../sermon.php:2544 
    676703msgid "Proverbs" 
    677704msgstr "" 
    678705 
    679 #: ../sermon.php:2458 
     706#: ../sermon.php:2544 
    680707msgid "Ecclesiastes" 
    681708msgstr "" 
    682709 
    683 #: ../sermon.php:2458 
     710#: ../sermon.php:2544 
    684711msgid "Song of Solomon" 
    685712msgstr "" 
    686713 
    687 #: ../sermon.php:2458 
     714#: ../sermon.php:2544 
    688715msgid "Isaiah" 
    689716msgstr "" 
    690717 
    691 #: ../sermon.php:2458 
     718#: ../sermon.php:2544 
    692719msgid "Jeremiah" 
    693720msgstr "" 
    694721 
    695 #: ../sermon.php:2458 
     722#: ../sermon.php:2544 
    696723msgid "Lamentations" 
    697724msgstr "" 
    698725 
    699 #: ../sermon.php:2458 
     726#: ../sermon.php:2544 
    700727msgid "Ezekiel" 
    701728msgstr "" 
    702729 
    703 #: ../sermon.php:2458 
     730#: ../sermon.php:2544 
    704731msgid "Daniel" 
    705732msgstr "" 
    706733 
    707 #: ../sermon.php:2458 
     734#: ../sermon.php:2544 
    708735msgid "Hosea" 
    709736msgstr "" 
    710737 
    711 #: ../sermon.php:2458 
     738#: ../sermon.php:2544 
    712739msgid "Joel" 
    713740msgstr "" 
    714741 
    715 #: ../sermon.php:2458 
     742#: ../sermon.php:2544 
    716743msgid "Amos" 
    717744msgstr "" 
    718745 
    719 #: ../sermon.php:2458 
     746#: ../sermon.php:2544 
    720747msgid "Obadiah" 
    721748msgstr "" 
    722749 
    723 #: ../sermon.php:2458 
     750#: ../sermon.php:2544 
    724751msgid "Jonah" 
    725752msgstr "" 
    726753 
    727 #: ../sermon.php:2458 
     754#: ../sermon.php:2544 
    728755msgid "Micah" 
    729756msgstr "" 
    730757 
    731 #: ../sermon.php:2458 
     758#: ../sermon.php:2544 
    732759msgid "Nahum" 
    733760msgstr "" 
    734761 
    735 #: ../sermon.php:2458 
     762#: ../sermon.php:2544 
    736763msgid "Habakkuk" 
    737764msgstr "" 
    738765 
    739 #: ../sermon.php:2458 
     766#: ../sermon.php:2544 
    740767msgid "Zephaniah" 
    741768msgstr "" 
    742769 
    743 #: ../sermon.php:2458 
     770#: ../sermon.php:2544 
    744771msgid "Haggai" 
    745772msgstr "" 
    746773 
    747 #: ../sermon.php:2458 
     774#: ../sermon.php:2544 
    748775msgid "Zechariah" 
    749776msgstr "" 
    750777 
    751 #: ../sermon.php:2458 
     778#: ../sermon.php:2544 
    752779msgid "Malachi" 
    753780msgstr "" 
    754781 
    755 #: ../sermon.php:2458 
     782#: ../sermon.php:2544 
    756783msgid "Matthew" 
    757784msgstr "" 
    758785 
    759 #: ../sermon.php:2458 
     786#: ../sermon.php:2544 
    760787msgid "Mark" 
    761788msgstr "" 
    762789 
    763 #: ../sermon.php:2458 
     790#: ../sermon.php:2544 
    764791msgid "Luke" 
    765792msgstr "" 
    766793 
    767 #: ../sermon.php:2458 
     794#: ../sermon.php:2544 
    768795msgid "John" 
    769796msgstr "" 
    770797 
    771 #: ../sermon.php:2458 
     798#: ../sermon.php:2544 
    772799msgid "Acts" 
    773800msgstr "" 
    774801 
    775 #: ../sermon.php:2458 
     802#: ../sermon.php:2544 
    776803msgid "Romans" 
    777804msgstr "" 
    778805 
    779 #: ../sermon.php:2458 
     806#: ../sermon.php:2544 
    780807msgid "1 Corinthians" 
    781808msgstr "" 
    782809 
    783 #: ../sermon.php:2458 
     810#: ../sermon.php:2544 
    784811msgid "2 Corinthians" 
    785812msgstr "" 
    786813 
    787 #: ../sermon.php:2458 
     814#: ../sermon.php:2544 
    788815msgid "Galatians" 
    789816msgstr "" 
    790817 
    791 #: ../sermon.php:2458 
     818#: ../sermon.php:2544 
    792819msgid "Ephesians" 
    793820msgstr "" 
    794821 
    795 #: ../sermon.php:2458 
     822#: ../sermon.php:2544 
    796823msgid "Philippians" 
    797824msgstr "" 
    798825 
    799 #: ../sermon.php:2458 
     826#: ../sermon.php:2544 
    800827msgid "Colossians" 
    801828msgstr "" 
    802829 
    803 #: ../sermon.php:2458 
     830#: ../sermon.php:2544 
    804831msgid "1 Thessalonians" 
    805832msgstr "" 
    806833 
    807 #: ../sermon.php:2458 
     834#: ../sermon.php:2544 
    808835msgid "2 Thessalonians" 
    809836msgstr "" 
    810837 
    811 #: ../sermon.php:2458 
     838#: ../sermon.php:2544 
    812839msgid "1 Timothy" 
    813840msgstr "" 
    814841 
    815 #: ../sermon.php:2458 
     842#: ../sermon.php:2544 
    816843msgid "2 Timothy" 
    817844msgstr "" 
    818845 
    819 #: ../sermon.php:2458 
     846#: ../sermon.php:2544 
    820847msgid "Titus" 
    821848msgstr "" 
    822849 
    823 #: ../sermon.php:2458 
     850#: ../sermon.php:2544 
    824851msgid "Philemon" 
    825852msgstr "" 
    826853 
    827 #: ../sermon.php:2458 
     854#: ../sermon.php:2544 
    828855msgid "Hebrews" 
    829856msgstr "" 
    830857 
    831 #: ../sermon.php:2458 
     858#: ../sermon.php:2544 
    832859msgid "James" 
    833860msgstr "" 
    834861 
    835 #: ../sermon.php:2458 
     862#: ../sermon.php:2544 
    836863msgid "1 Peter" 
    837864msgstr "" 
    838865 
    839 #: ../sermon.php:2458 
     866#: ../sermon.php:2544 
    840867msgid "2 Peter" 
    841868msgstr "" 
    842869 
    843 #: ../sermon.php:2458 
     870#: ../sermon.php:2544 
    844871msgid "1 John" 
    845872msgstr "" 
    846873 
    847 #: ../sermon.php:2458 
     874#: ../sermon.php:2544 
    848875msgid "2 John" 
    849876msgstr "" 
    850877 
    851 #: ../sermon.php:2458 
     878#: ../sermon.php:2544 
    852879msgid "3 John" 
    853880msgstr "" 
    854881 
    855 #: ../sermon.php:2458 
     882#: ../sermon.php:2544 
    856883msgid "Jude" 
    857884msgstr "" 
    858885 
    859 #: ../sermon.php:2458 
     886#: ../sermon.php:2544 
    860887msgid "Revelation" 
    861888msgstr "" 
    862889 
    863 #: ../sb-includes/frontend.php:478 
     890#: ../sb-includes/frontend.php:504 
    864891msgid "Sermon podcast" 
    865892msgstr "" 
    866893 
    867 #: ../sb-includes/frontend.php:483 
     894#: ../sb-includes/frontend.php:509 
    868895msgid "Custom sermon podcast" 
    869896msgstr "" 
    870897 
    871 #: ../sb-includes/frontend.php:582 
     898#: ../sb-includes/frontend.php:608 
    872899msgid "Next page" 
    873900msgstr "" 
    874901 
    875 #: ../sb-includes/frontend.php:593 
     902#: ../sb-includes/frontend.php:619 
    876903msgid "Previous page" 
    877904msgstr "" 
    878905 
    879 #: ../sb-includes/frontend.php:648 
     906#: ../sb-includes/frontend.php:674 
    880907msgid "About" 
    881908msgstr "" 
    882909 
    883 #: ../sb-includes/frontend.php:684 
     910#: ../sb-includes/frontend.php:710 
    884911msgid "None" 
    885912msgstr "" 
    886913 
    887 #: ../sb-includes/frontend.php:845 
    888 #: ../sb-includes/frontend.php:853 
    889 #: ../sb-includes/frontend.php:863 
    890914#: ../sb-includes/frontend.php:871 
     915#: ../sb-includes/frontend.php:879 
     916#: ../sb-includes/frontend.php:889 
     917#: ../sb-includes/frontend.php:897 
    891918#: ../sb-includes/widget.php:209 
    892919#: ../sb-includes/widget.php:217 
     
    895922msgstr "" 
    896923 
    897 #: ../sb-includes/frontend.php:851 
     924#: ../sb-includes/frontend.php:877 
    898925msgid "Services" 
    899926msgstr "" 
    900927 
    901 #: ../sb-includes/frontend.php:861 
     928#: ../sb-includes/frontend.php:887 
    902929msgid "Book" 
    903930msgstr "" 
    904931 
    905 #: ../sb-includes/frontend.php:879 
     932#: ../sb-includes/frontend.php:905 
    906933msgid "Start date" 
    907934msgstr "" 
    908935 
    909 #: ../sb-includes/frontend.php:881 
     936#: ../sb-includes/frontend.php:907 
    910937msgid "End date" 
    911938msgstr "" 
    912939 
    913 #: ../sb-includes/frontend.php:885 
     940#: ../sb-includes/frontend.php:911 
    914941msgid "Keywords" 
    915942msgstr "" 
    916943 
    917 #: ../sb-includes/frontend.php:889 
     944#: ../sb-includes/frontend.php:915 
    918945msgid "Sort by" 
    919946msgstr "" 
    920947 
    921 #: ../sb-includes/frontend.php:896 
     948#: ../sb-includes/frontend.php:922 
    922949msgid "Direction" 
    923950msgstr "" 
    924951 
    925 #: ../sb-includes/frontend.php:906 
     952#: ../sb-includes/frontend.php:932 
    926953msgid "Filter &raquo;" 
    927954msgstr "" 
  • sermon-browser/trunk/sermon.php

    r57103 r58027  
    55Description: Add sermons to your Wordpress blog. Main coding by <a href="http://codeandmore.com/">Tien Do Xuan</a>. Design and additional coding 
    66Author: Mark Barnes 
    7 Version: 0.34 
     7Version: 0.35 
    88Author URI: http://www.4-14.org.uk/ 
    99 
     
    2828 ** Set up                            ** 
    2929 **************************************/ 
    30 define('SB_CURRENT_VERSION', '0.34'); 
     30define('SB_CURRENT_VERSION', '0.35'); 
     31define('SB_DATABASE_VERSION', '1.5'); 
    3132$directories = explode(DIRECTORY_SEPARATOR,dirname(__FILE__)); 
    3233if ($directories[count($directories)-1] == 'mu-plugins') { 
     
    5051add_action('admin_menu', 'sb_add_pages'); 
    5152sb_sermon_install(); 
     53add_action('rightnow_end', 'sb_rightnow'); 
    5254 
    5355// Add Sermons menu and sub-menus in admin 
     
    8385    if (ini_get('file_uploads')<>'1') ini_set('file_uploads', '1'); 
    8486    // Only proceed with install if necessary 
    85     if(get_option('sb_sermon_db_version') =='1.4') return; 
     87    $db_version = get_option('sb_sermon_db_version'); 
     88    if($db_version == SB_DATABASE_VERSION) return; 
    8689    global $wpdb; 
    8790    global $defaultMultiForm, $defaultSingleForm, $defaultStyle; 
    8891    require_once(ABSPATH . 'wp-includes/pluggable.php'); 
    8992    require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 
     93    // Create folders 
    9094    $sermonUploadDir = sb_get_default('sermon_path'); 
    91     if (!is_dir(sb_get_value('wordpress_path').$sermonUploadDir)) { 
    92         if (sb_mkdir(sb_get_value('wordpress_path').$sermonUploadDir)) { 
    93             @chmod(sb_get_value('wordpress_path').$sermonUploadDir, 0777);           
    94         } 
    95     } 
    96     if(!is_dir(sb_get_value('wordpress_path').$sermonUploadDir.'images') && sb_mkdir(sb_get_value('wordpress_path').$sermonUploadDir.'images')){ 
    97         @chmod(sb_get_value('wordpress_path').$sermonUploadDir.'images', 0777); 
    98     } 
    99     //Upgrade database from earlier versions 
     95    if (!is_dir(sb_get_value('wordpress_path').$sermonUploadDir)) 
     96        sb_mkdir(sb_get_value('wordpress_path').$sermonUploadDir); 
     97    if(!is_dir(sb_get_value('wordpress_path').$sermonUploadDir.'images')) 
     98        sb_mkdir(sb_get_value('wordpress_path').$sermonUploadDir.'images'); 
    10099    $books = sb_get_default('bible_books'); 
    101     switch (get_option('sb_sermon_db_version')) { 
    102         case '1.0': // Also moves files from old default folder to new default folder 
    103             $oldSermonPath = sb_get_value('plugin_path')."/files/"; 
    104             $files = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}sb_stuff WHERE type = 'file' ORDER BY name asc");  
    105             foreach ((array)$files as $file) { 
    106                 @chmod(sb_get_value('wordpress_path').$oldSermonPath.$file->name, 0777); 
    107                 @rename(sb_get_value('wordpress_path').$oldSermonPath.$file->name, sb_get_value('wordpress_path').$sermonUploadDir.$file->name); 
    108             } 
    109             $table_name = $wpdb->prefix . "sb_preachers"; 
    110             if($wpdb->get_var("show tables like '$table_name'") == $table_name) {             
    111                   $wpdb->query("ALTER TABLE " . $table_name . " ADD `description` TEXT NOT NULL, ADD `image` VARCHAR( 255 ) NOT NULL ;"); 
    112             } 
    113             update_option('sb_sermon_db_version', '1.1');        
    114         case '1.1': 
    115             add_option('sb_sermon_style', base64_encode($defaultStyle)); 
    116             if(!is_dir(sb_get_value('wordpress_path').$sermonUploadDir.'images') && sb_mkdir(sb_get_value('wordpress_path').$sermonUploadDir.'images')){ 
    117                 @chmod(sb_get_value('wordpress_path').$sermonUploadDir.'images', 0777); 
    118             } 
    119             update_option('sb_sermon_db_version', '1.2');    
    120         case '1.2': 
    121             $wpdb->query("ALTER TABLE ".$wpdb->prefix."sb_stuff ADD count INT(10) NOT NULL"); 
    122             $wpdb->query("ALTER TABLE ".$wpdb->prefix."sb_books_sermons ADD INDEX (sermon_id)"); 
    123             $wpdb->query("ALTER TABLE ".$wpdb->prefix."sb_sermons_tags ADD INDEX (sermon_id)"); 
    124             update_option('sb_sermon_db_version', '1.3'); 
    125         case '1.3': 
    126             $wpdb->query("ALTER TABLE ".$wpdb->prefix."sb_series ADD page_id INT(10) NOT NULL"); 
    127             $wpdb->query("ALTER TABLE ".$wpdb->prefix."sb_sermons ADD page_id INT(10) NOT NULL"); 
    128             add_option('sb_display_method', 'dynamic'); 
    129             add_option('sb_sermons_per_page', '15'); 
    130             add_option('sb_sermon_multi_output', base64_encode(strtr(sb_get_value('multi_form'), sb_search_results_dictionary()))); 
    131             add_option('sb_sermon_single_output', base64_encode(strtr(sb_get_value('single_form'), sb_sermon_page_dictionary()))); 
    132             add_option('sb_sermon_style_output', base64_encode(stripslashes(base64_decode(get_option('sb_sermon_style'))))); 
    133             add_option('sb_sermon_style_date_modified', strtotime('now')); 
    134             update_option('sb_sermon_db_version', '1.4'); 
    135         case '1.4' : 
    136             return; 
    137         default: 
    138             update_option('sb_sermon_db_version', '1.0'); 
    139     }        
    140  
    141     //Create default tables 
    142    $table_name = $wpdb->prefix . "sb_preachers"; 
    143    if($wpdb->get_var("show tables like '$table_name'") != $table_name) {             
    144       $sql = "CREATE TABLE " . $table_name . " ( 
    145         `id` INT( 10 ) NOT NULL AUTO_INCREMENT , 
    146         `name` VARCHAR( 30 ) NOT NULL , 
    147         `description` TEXT NOT NULL , 
    148         `image` VARCHAR( 255 ) NOT NULL, 
    149         PRIMARY KEY ( `id` ) 
    150         );"; 
    151       dbDelta($sql); 
    152       $sql = "INSERT INTO " . $table_name . "(name, description, image) VALUES ( 'C H Spurgeon', '', '' );"; 
    153       dbDelta($sql); 
    154       $sql = "INSERT INTO " . $table_name . "(name, description, image) VALUES ( 'Martyn Lloyd-Jones', '', '' );"; 
    155       dbDelta($sql); 
    156    } 
    157     
    158    $table_name = $wpdb->prefix . "sb_series"; 
    159    if($wpdb->get_var("show tables like '$table_name'") != $table_name) {       
    160       $sql = "CREATE TABLE " . $table_name . " ( 
    161         `id` INT( 10 ) NOT NULL AUTO_INCREMENT , 
    162         `name` VARCHAR( 255 ) NOT NULL , 
    163         `page_id` INT(10) NOT NULL, 
    164         PRIMARY KEY ( `id` ) 
    165         );"; 
    166       dbDelta($sql); 
    167       $sql = "INSERT INTO " . $table_name . "(name) VALUES ( 'Exposition of the Psalms' );"; 
    168       dbDelta($sql); 
    169       $sql = "INSERT INTO " . $table_name . "(name) VALUES ( 'Exposition of Romans' );"; 
    170       dbDelta($sql); 
    171    } 
    172     
    173    $table_name = $wpdb->prefix . "sb_services"; 
    174    if($wpdb->get_var("show tables like '$table_name'") != $table_name) {       
    175       $sql = "CREATE TABLE " . $table_name . " ( 
    176         `id` INT( 10 ) NOT NULL AUTO_INCREMENT , 
    177         `name` VARCHAR( 255 ) NOT NULL , 
    178         `time` VARCHAR( 5 ) NOT NULL ,  
    179         PRIMARY KEY ( `id` ) 
    180         );"; 
    181       dbDelta($sql); 
    182       $sql = "INSERT INTO " . $table_name . "(name, time) VALUES ( 'Sunday Morning', '10:30' );"; 
    183       dbDelta($sql); 
    184       $sql = "INSERT INTO " . $table_name . "(name, time) VALUES ( 'Sunday Evening', '18:00' );"; 
    185       dbDelta($sql); 
    186       $sql = "INSERT INTO " . $table_name . "(name, time) VALUES ( 'Midweek Meeting', '19:00' );"; 
    187       dbDelta($sql); 
    188       $sql = "INSERT INTO " . $table_name . "(name, time) VALUES ( 'Special event', '20:00' );"; 
    189       dbDelta($sql); 
    190    } 
    191     
    192    $table_name = $wpdb->prefix . "sb_sermons"; 
    193    if($wpdb->get_var("show tables like '$table_name'") != $table_name) {       
    194       $sql = "CREATE TABLE " . $table_name . " ( 
    195         `id` INT( 10 ) NOT NULL AUTO_INCREMENT , 
    196         `title` VARCHAR( 255 ) NOT NULL , 
    197         `preacher_id` INT( 10 ) NOT NULL , 
    198         `date` DATE NOT NULL , 
    199         `service_id` INT( 10 ) NOT NULL , 
    200         `series_id` INT( 10 ) NOT NULL , 
    201         `start` TEXT NOT NULL , 
    202         `end` TEXT NOT NULL , 
    203         `description` TEXT , 
    204         `time` VARCHAR ( 5 ),  
    205         `override` TINYINT ( 1 ) ,   
    206         `page_id` INT(10) NOT NULL, 
    207         PRIMARY KEY ( `id` ) 
    208         );"; 
    209       dbDelta($sql); 
    210    } 
    211  
    212     $table_name = $wpdb->prefix . "sb_books_sermons"; 
    213     if($wpdb->get_var("show tables like '$table_name'") != $table_name) {       
    214       $sql = "CREATE TABLE " . $table_name . " (         
    215         `id` INT(10) NOT NULL AUTO_INCREMENT, 
    216         `book_name` VARCHAR( 30 ) NOT NULL ,         
    217         `chapter` INT(10) NOT NULL, 
    218         `verse` INT(10) NOT NULL, 
    219         `order` INT(10) NOT NULL, 
    220         `type` VARCHAR ( 30 ),  
    221         `sermon_id` INT( 10 ) NOT NULL, 
    222         INDEX (`sermon_id`), 
    223         PRIMARY KEY ( `id` ) 
    224         );"; 
    225       dbDelta($sql); 
    226    } 
    227  
    228     $table_name = $wpdb->prefix . "sb_books"; 
    229     if($wpdb->get_var("show tables like '$table_name'") != $table_name) {       
    230       $sql = "CREATE TABLE " . $table_name . " (         
    231         `id` INT(10) NOT NULL AUTO_INCREMENT, 
    232         `name` VARCHAR( 30 ) NOT NULL , 
    233         PRIMARY KEY ( `id` ) 
    234         );"; 
    235       dbDelta($sql); 
    236    } 
    237     
    238    $table_name = $wpdb->prefix . "sb_stuff"; 
    239    if($wpdb->get_var("show tables like '$table_name'") != $table_name) {       
    240       $sql = "CREATE TABLE " . $table_name . " ( 
    241         `id` INT( 10 ) NOT NULL AUTO_INCREMENT , 
    242         `type` VARCHAR( 30 ) NOT NULL , 
    243         `name` TEXT NOT NULL , 
    244         `sermon_id` INT( 10 ) NOT NULL , 
    245         `count` INT( 10 ) NOT NULL , 
    246         PRIMARY KEY ( `id` ) 
    247         );"; 
    248       dbDelta($sql); 
    249    } 
    250  
    251     $table_name = $wpdb->prefix . "sb_tags"; 
     100     //Upgrade database from earlier versions 
     101    if ($db_version) { 
     102        switch ($db_version) { 
     103            case '1.0':  
     104                // Also moves files from old default folder to new default folder 
     105                $oldSermonPath = sb_get_value('plugin_path')."/files/"; 
     106                $files = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}sb_stuff WHERE type = 'file' ORDER BY name asc");  
     107                foreach ((array)$files as $file) { 
     108                    @chmod(sb_get_value('wordpress_path').$oldSermonPath.$file->name, 0777); 
     109                    @rename(sb_get_value('wordpress_path').$oldSermonPath.$file->name, sb_get_value('wordpress_path').$sermonUploadDir.$file->name); 
     110                } 
     111                $table_name = $wpdb->prefix . "sb_preachers"; 
     112                if($wpdb->get_var("show tables like '$table_name'") == $table_name) {             
     113                      $wpdb->query("ALTER TABLE " . $table_name . " ADD `description` TEXT NOT NULL, ADD `image` VARCHAR( 255 ) NOT NULL ;"); 
     114                } 
     115                update_option('sb_sermon_db_version', '1.1');        
     116            case '1.1': 
     117                add_option('sb_sermon_style', base64_encode($defaultStyle)); 
     118                if(!is_dir(sb_get_value('wordpress_path').$sermonUploadDir.'images') && sb_mkdir(sb_get_value('wordpress_path').$sermonUploadDir.'images')){ 
     119                    @chmod(sb_get_value('wordpress_path').$sermonUploadDir.'images', 0777); 
     120                } 
     121                update_option('sb_sermon_db_version', '1.2');    
     122            case '1.2': 
     123                $wpdb->query("ALTER TABLE ".$wpdb->prefix."sb_stuff ADD count INT(10) NOT NULL"); 
     124                $wpdb->query("ALTER TABLE ".$wpdb->prefix."sb_books_sermons ADD INDEX (sermon_id)"); 
     125                $wpdb->query("ALTER TABLE ".$wpdb->prefix."sb_sermons_tags ADD INDEX (sermon_id)"); 
     126                update_option('sb_sermon_db_version', '1.3'); 
     127            case '1.3': 
     128                $wpdb->query("ALTER TABLE ".$wpdb->prefix."sb_series ADD page_id INT(10) NOT NULL"); 
     129                $wpdb->query("ALTER TABLE ".$wpdb->prefix."sb_sermons ADD page_id INT(10) NOT NULL"); 
     130                add_option('sb_display_method', 'dynamic'); 
     131                add_option('sb_sermons_per_page', '15'); 
     132                add_option('sb_sermon_multi_output', base64_encode(strtr(sb_get_value('multi_form'), sb_search_results_dictionary()))); 
     133                add_option('sb_sermon_single_output', base64_encode(strtr(sb_get_value('single_form'), sb_sermon_page_dictionary()))); 
     134                add_option('sb_sermon_style_output', base64_encode(stripslashes(base64_decode(get_option('sb_sermon_style'))))); 
     135                add_option('sb_sermon_style_date_modified', strtotime('now')); 
     136                update_option('sb_sermon_db_version', '1.4'); 
     137            case '1.4' : 
     138                //Remove duplicate indexes added by a previous bug 
     139                $extra_indexes = $wpdb->get_results("SELECT index_name, table_name FROM INFORMATION_SCHEMA.STATISTICS WHERE table_schema = '".DB_NAME."' AND index_name LIKE 'sermon_id_%'"); 
     140                if (is_array($extra_indexes)) 
     141                    foreach ($extra_indexes as $extra_index) 
     142                        $wpdb->query("ALTER TABLE ".$extra_index->table_name." DROP INDEX {$extra_index->index_name}"); 
     143                //Remove duplicate tags added by a previous bug 
     144                $unique_tags = $wpdb->get_results("SELECT DISTINCT name FROM {$wpdb->prefix}sb_tags"); 
     145                if (is_array($unique_tags)) { 
     146                    foreach ($unique_tags as $tag) { 
     147                        $tag_ids = $wpdb->get_results("SELECT id FROM {$wpdb->prefix}sb_tags WHERE name='{$tag->name}'"); 
     148                        if (is_array($tag_ids)) { 
     149                            foreach ($tag_ids as $tag_id) { 
     150                                $wpdb->query("UPDATE {$wpdb->prefix}sb_sermons_tags SET tag_id='{$tag_ids[0]->id}' WHERE tag_id='{$tag_id->id}'"); 
     151                                if ($tag_ids[0]->id != $tag_id->id) 
     152                                    $wpdb->query("DELETE FROM {$wpdb->prefix}sb_tags WHERE id='{$tag_id->id}'"); 
     153                            } 
     154                        } 
     155                    } 
     156                } 
     157                sb_delete_unused_tags(); 
     158                $wpdb->query("ALTER TABLE {$wpdb->prefix}sb_tags CHANGE name name VARCHAR(255)"); 
     159                $wpdb->query("ALTER TABLE {$wpdb->prefix}sb_tags ADD UNIQUE (name)"); 
     160                update_option('sb_sermon_db_version', '1.5'); 
     161                return; 
     162            default: 
     163                update_option('sb_sermon_db_version', '1.0'); 
     164        }        
     165    } else { //Create default tables 
     166       $table_name = $wpdb->prefix . "sb_preachers"; 
     167       if($wpdb->get_var("show tables like '$table_name'") != $table_name) {             
     168          $sql = "CREATE TABLE " . $table_name . " ( 
     169            `id` INT( 10 ) NOT NULL AUTO_INCREMENT , 
     170            `name` VARCHAR( 30 ) NOT NULL , 
     171            `description` TEXT NOT NULL , 
     172            `image` VARCHAR( 255 ) NOT NULL, 
     173            PRIMARY KEY ( `id` ) 
     174            );"; 
     175          dbDelta($sql); 
     176          $sql = "INSERT INTO " . $table_name . "(name, description, image) VALUES ( 'C H Spurgeon', '', '' );"; 
     177          dbDelta($sql); 
     178          $sql = "INSERT INTO " . $table_name . "(name, description, image) VALUES ( 'Martyn Lloyd-Jones', '', '' );"; 
     179          dbDelta($sql); 
     180       } 
     181        
     182       $table_name = $wpdb->prefix . "sb_series"; 
    252183       if($wpdb->get_var("show tables like '$table_name'") != $table_name) {       
    253184          $sql = "CREATE TABLE " . $table_name . " ( 
    254185            `id` INT( 10 ) NOT NULL AUTO_INCREMENT , 
    255             `name` TEXT NOT NULL , 
     186            `name` VARCHAR( 255 ) NOT NULL , 
     187            `page_id` INT(10) NOT NULL, 
     188            PRIMARY KEY ( `id` ) 
     189            );"; 
     190          dbDelta($sql); 
     191          $sql = "INSERT INTO " . $table_name . "(name) VALUES ( 'Exposition of the Psalms' );"; 
     192          dbDelta($sql); 
     193          $sql = "INSERT INTO " . $table_name . "(name) VALUES ( 'Exposition of Romans' );"; 
     194          dbDelta($sql); 
     195       } 
     196        
     197       $table_name = $wpdb->prefix . "sb_services"; 
     198       if($wpdb->get_var("show tables like '$table_name'") != $table_name) {       
     199          $sql = "CREATE TABLE " . $table_name . " ( 
     200            `id` INT( 10 ) NOT NULL AUTO_INCREMENT , 
     201            `name` VARCHAR( 255 ) NOT NULL , 
     202            `time` VARCHAR( 5 ) NOT NULL ,  
     203            PRIMARY KEY ( `id` ) 
     204            );"; 
     205          dbDelta($sql); 
     206          $sql = "INSERT INTO " . $table_name . "(name, time) VALUES ( 'Sunday Morning', '10:30' );"; 
     207          dbDelta($sql); 
     208          $sql = "INSERT INTO " . $table_name . "(name, time) VALUES ( 'Sunday Evening', '18:00' );"; 
     209          dbDelta($sql); 
     210          $sql = "INSERT INTO " . $table_name . "(name, time) VALUES ( 'Midweek Meeting', '19:00' );"; 
     211          dbDelta($sql); 
     212          $sql = "INSERT INTO " . $table_name . "(name, time) VALUES ( 'Special event', '20:00' );"; 
     213          dbDelta($sql); 
     214       } 
     215        
     216       $table_name = $wpdb->prefix . "sb_sermons"; 
     217       if($wpdb->get_var("show tables like '$table_name'") != $table_name) {       
     218          $sql = "CREATE TABLE " . $table_name . " ( 
     219            `id` INT( 10 ) NOT NULL AUTO_INCREMENT , 
     220            `title` VARCHAR( 255 ) NOT NULL , 
     221            `preacher_id` INT( 10 ) NOT NULL , 
     222            `date` DATE NOT NULL , 
     223            `service_id` INT( 10 ) NOT NULL , 
     224            `series_id` INT( 10 ) NOT NULL , 
     225            `start` TEXT NOT NULL , 
     226            `end` TEXT NOT NULL , 
     227            `description` TEXT , 
     228            `time` VARCHAR ( 5 ),  
     229            `override` TINYINT ( 1 ) ,   
     230            `page_id` INT(10) NOT NULL, 
    256231            PRIMARY KEY ( `id` ) 
    257232            );"; 
    258233          dbDelta($sql); 
    259234       } 
    260      
    261     $table_name = $wpdb->prefix . "sb_sermons_tags"; 
    262        if($wpdb->get_var("show tables like '$table_name'") != $table_name) {       
    263           $sql = "CREATE TABLE " . $table_name . " ( 
    264             `id` INT( 10 ) NOT NULL AUTO_INCREMENT , 
    265             `sermon_id` INT( 10 ) NOT NULL , 
    266             `tag_id` INT( 10 ) NOT NULL , 
     235 
     236        $table_name = $wpdb->prefix . "sb_books_sermons"; 
     237        if($wpdb->get_var("show tables like '$table_name'") != $table_name) {       
     238          $sql = "CREATE TABLE " . $table_name . " (         
     239            `id` INT(10) NOT NULL AUTO_INCREMENT, 
     240            `book_name` VARCHAR( 30 ) NOT NULL ,         
     241            `chapter` INT(10) NOT NULL, 
     242            `verse` INT(10) NOT NULL, 
     243            `order` INT(10) NOT NULL, 
     244            `type` VARCHAR ( 30 ),  
     245            `sermon_id` INT( 10 ) NOT NULL, 
    267246            INDEX (`sermon_id`), 
    268247            PRIMARY KEY ( `id` ) 
     
    270249          dbDelta($sql); 
    271250       } 
    272     $welcome_name = __('Delete', $sermon_domain); 
    273     $welcome_text = __('Congratulations, you just completed the installation!', $sermon_domain);     
    274     add_option('sb_sermon_upload_dir', $sermonUploadDir); 
    275     add_option('sb_sermon_upload_url', sb_get_default('attachment_url')); 
    276     add_option('sb_podcast', sb_get_value('wordpress_url').'?podcast'); 
    277     add_option('sb_display_method', 'dynamic'); 
    278     add_option('sb_sermons_per_page', '15'); 
    279     delete_option('sb_sermon_multi_form'); 
    280     add_option('sb_sermon_multi_form', base64_encode(sb_default_multi_template())); 
    281     delete_option('sb_sermon_single_form'); 
    282     add_option('sb_sermon_single_form', base64_encode(sb_default_single_template())); 
    283     delete_option('sb_sermon_style'); 
    284     add_option('sb_sermon_style', base64_encode(sb_default_css())); 
    285     add_option('sb_sermon_multi_output', base64_encode(strtr(sb_default_multi_template(), sb_search_results_dictionary()))); 
    286     add_option('sb_sermon_single_output', base64_encode(strtr(sb_default_single_template(), sb_sermon_page_dictionary()))); 
    287     add_option('sb_sermon_style_output', base64_encode(sb_default_css())); 
    288     for ($i=0; $i < count($books); $i++) {  
    289         $wpdb->query("INSERT INTO {$wpdb->prefix}sb_books VALUES (null, '{$books[$i]}');"); 
     251 
     252        $table_name = $wpdb->prefix . "sb_books"; 
     253        if($wpdb->get_var("show tables like '$table_name'") != $table_name) {       
     254          $sql = "CREATE TABLE " . $table_name . " (         
     255            `id` INT(10) NOT NULL AUTO_INCREMENT, 
     256            `name` VARCHAR( 30 ) NOT NULL , 
     257            PRIMARY KEY ( `id` ) 
     258            );"; 
     259          dbDelta($sql); 
     260       } 
     261        
     262       $table_name = $wpdb->prefix . "sb_stuff"; 
     263       if($wpdb->get_var("show tables like '$table_name'") != $table_name) {       
     264          $sql = "CREATE TABLE " . $table_name . " ( 
     265            `id` INT( 10 ) NOT NULL AUTO_INCREMENT , 
     266            `type` VARCHAR( 30 ) NOT NULL , 
     267            `name` TEXT NOT NULL , 
     268            `sermon_id` INT( 10 ) NOT NULL , 
     269            `count` INT( 10 ) NOT NULL , 
     270            PRIMARY KEY ( `id` ) 
     271            );"; 
     272          dbDelta($sql); 
     273       } 
     274 
     275        $table_name = $wpdb->prefix . "sb_tags"; 
     276           if($wpdb->get_var("show tables like '$table_name'") != $table_name) {       
     277                $sql = "CREATE TABLE " . $table_name . " ( 
     278                    `id` int(10) NOT NULL auto_increment, 
     279                    `name` varchar(255) default NULL, 
     280                    PRIMARY KEY (`id`), 
     281                    UNIQUE KEY `name` (`name`) 
     282                    );"; 
     283              dbDelta($sql); 
     284           } 
     285         
     286        $table_name = $wpdb->prefix . "sb_sermons_tags"; 
     287           if($wpdb->get_var("show tables like '$table_name'") != $table_name) {       
     288              $sql = "CREATE TABLE " . $table_name . " ( 
     289                `id` INT( 10 ) NOT NULL AUTO_INCREMENT , 
     290                `sermon_id` INT( 10 ) NOT NULL , 
     291                `tag_id` INT( 10 ) NOT NULL , 
     292                INDEX (`sermon_id`), 
     293                PRIMARY KEY ( `id` ) 
     294                );"; 
     295              dbDelta($sql); 
     296           } 
     297        $welcome_name = __('Delete', $sermon_domain); 
     298        $welcome_text = __('Congratulations, you just completed the installation!', $sermon_domain);     
     299        add_option('sb_sermon_upload_dir', $sermonUploadDir); 
     300        add_option('sb_sermon_upload_url', sb_get_default('attachment_url')); 
     301        add_option('sb_podcast', sb_get_value('wordpress_url').'?podcast'); 
     302        add_option('sb_display_method', 'dynamic'); 
     303        add_option('sb_sermons_per_page', '15'); 
     304        delete_option('sb_sermon_multi_form'); 
     305        add_option('sb_sermon_multi_form', base64_encode(sb_default_multi_template())); 
     306        delete_option('sb_sermon_single_form'); 
     307        add_option('sb_sermon_single_form', base64_encode(sb_default_single_template())); 
     308        delete_option('sb_sermon_style'); 
     309        add_option('sb_sermon_style', base64_encode(sb_default_css())); 
     310        add_option('sb_sermon_style_date_modified', strtotime('now')); 
     311        add_option('sb_sermon_multi_output', base64_encode(strtr(sb_default_multi_template(), sb_search_results_dictionary()))); 
     312        add_option('sb_sermon_single_output', base64_encode(strtr(sb_default_single_template(), sb_sermon_page_dictionary()))); 
     313        add_option('sb_sermon_style_output', base64_encode(sb_default_css())); 
     314        for ($i=0; $i < count($books); $i++) {  
     315            $wpdb->query("INSERT INTO {$wpdb->prefix}sb_books VALUES (null, '{$books[$i]}');"); 
     316        } 
     317        add_option('sb_sermon_db_version', SB_DATABASE_VERSION); 
    290318    } 
    291     add_option('sb_sermon_db_version', '1.4'); 
    292319} 
    293320 
     
    12891316        $wpdb->query("UPDATE {$wpdb->prefix}sb_stuff SET sermon_id = 0 WHERE sermon_id = $mid AND type = 'file';"); 
    12901317        $wpdb->query("DELETE FROM {$wpdb->prefix}sb_stuff WHERE sermon_id = $mid AND type <> 'file';"); 
     1318        sb_delete_unused_tags(); 
    12911319        echo '<div id="message" class="updated fade"><p><b>'.__('Sermon removed from database.', $sermon_domain).'</b></div>'; 
    12921320    } 
     
    14591487        // deal with books 
    14601488        $wpdb->query("DELETE FROM {$wpdb->prefix}sb_books_sermons WHERE sermon_id = $id;");  
    1461         foreach ($startz as $i => $st) { 
     1489        if (isset($startz)) foreach ($startz as $i => $st) { 
    14621490            $wpdb->query("INSERT INTO {$wpdb->prefix}sb_books_sermons VALUES(null, '{$st['book']}', '{$st['chapter']}', '{$st['verse']}', $i, 'start', $id);"); 
    14631491        } 
    1464         foreach ($endz as $i => $ed) { 
     1492        if (isset($$endz)) foreach ($endz as $i => $ed) { 
    14651493            $wpdb->query("INSERT INTO {$wpdb->prefix}sb_books_sermons VALUES(null, '{$ed['book']}', '{$ed['chapter']}', '{$ed['verse']}', $i, 'end', $id);"); 
    14661494        } 
     
    15201548        foreach ($tags as $tag) { 
    15211549            $clean_tag = trim(mysql_real_escape_string($tag)); 
    1522             $wpdb->query("INSERT IGNORE INTO {$wpdb->prefix}sb_tags VALUES (null, '$clean_tag')"); 
    1523             $tag_id = $wpdb->insert_id; 
    1524             $wpdb->query("INSERT INTO {$wpdb->prefix}sb_sermons_tags VALUES (null, $id, $tag_id)"); 
    1525         } 
     1550            $existing_id = $wpdb->get_var("SELECT id FROM {$wpdb->prefix}sb_tags WHERE name='$clean_tag'"); 
     1551            if (is_null($existing_id)) { 
     1552                $wpdb->query("INSERT  INTO {$wpdb->prefix}sb_tags VALUES (null, '$clean_tag')"); 
     1553                $existing_id = $wpdb->insert_id; 
     1554            } 
     1555            $wpdb->query("INSERT INTO {$wpdb->prefix}sb_sermons_tags VALUES (null, $id, $existing_id)"); 
     1556        } 
     1557        sb_delete_unused_tags(); 
    15261558        // everything is fine, get out of here! 
    15271559        if(!$error) { 
     
    23102342} 
    23112343 
     2344// Displays stats in the dashboard 
     2345function sb_rightnow () { 
     2346    global $wpdb, $sermon_domain; 
     2347    $file_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."sb_stuff WHERE type='file'"); 
     2348    if ($file_count > 0) { 
     2349        $sermon_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."sb_sermons"); 
     2350        $preacher_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."sb_preachers"); 
     2351        $series_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."sb_series"); 
     2352        $tag_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."sb_tags WHERE name<>''"); 
     2353        $download_count = $wpdb->get_var("SELECT SUM(count) FROM ".$wpdb->prefix."sb_stuff"); 
     2354        $download_average = round($download_count/$sermon_count, 1); 
     2355        $most_popular = $wpdb->get_results("SELECT title, sermon_id, sum(count) AS c FROM ".$wpdb->prefix."sb_stuff LEFT JOIN ".$wpdb->prefix."sb_sermons ON ".$wpdb->prefix."sb_sermons.id = sermon_id GROUP BY sermon_id ORDER BY c DESC LIMIT 1"); 
     2356        $most_popular = $most_popular[0]; 
     2357        $output_string = '<p class="youhave">'.__("You have")." "; 
     2358        $output_string = $output_string.'<a href="'.sb_get_value('wordpress_url').'/wp-admin/admin.php?page=sermon-browser/uploads.php">'; 
     2359        $output_string = $output_string.sprintf(__ngettext('%d file', '%d files', $file_count), $file_count)."</a> "; 
     2360        if ($sermon_count > 0) { 
     2361            $output_string = $output_string.__("in")." ".'<a href="'.sb_get_value('admin_url').'sermon.php">'; 
     2362            $output_string = $output_string.sprintf(__ngettext('%d sermon', '%d sermons', $sermon_count), $sermon_count)."</a> "; 
     2363        } 
     2364        if ($preacher_count > 0) { 
     2365            $output_string = $output_string.__("from")." ".'<a href="'.sb_get_value('wordpress_url').'/wp-admin/admin.php?page=sermon-browser/preachers.php">'; 
     2366            $output_string = $output_string.sprintf(__ngettext('%d preacher', '%d preachers', $preacher_count), $preacher_count)."</a> "; 
     2367        } 
     2368        if ($series_count > 0) { 
     2369            $output_string = $output_string.__("in")." ".'<a href="'.sb_get_value('wordpress_url').'/wp-admin/admin.php?page=sermon-browser/manage.php">'; 
     2370            $output_string = $output_string.sprintf(__('%d series'), $series_count)."</a> "; 
     2371        } 
     2372        if ($tag_count > 0)  
     2373            $output_string = $output_string.__("using")." ".sprintf(__ngettext('%d tag', '%d tags', $tag_count), $tag_count)." "; 
     2374        if (substr($output_string, -1) == " ") 
     2375            $output_string = substr($output_string, 0, -1); 
     2376        if ($download_count > 0)  
     2377            $output_string = $output_string.". ".sprintf(__ngettext('Only one file has been downloaded', 'They have been downloaded a total of %d times', $download_count), $download_count); 
     2378        if ($download_count > 1) { 
     2379            $output_string = $output_string.", ".sprintf(__ngettext('an average of once per sermon', 'an average of %d times per sermon', $download_average), $download_average); 
     2380            $most_popular_title = '<a href="'.sb_get_value('wordpress_url').'/wp-admin/admin.php?page=sermon-browser/new_sermon.php&mid='.$most_popular->sermon_id.'">'.$most_popular->title.'</a>'; 
     2381            $output_string = $output_string.". ".sprintf(__('The most popular sermon is %s, which has been downloaded %s times'), $most_popular_title, $most_popular->c); 
     2382        } 
     2383        $output_string = $output_string.'.</p>'; 
     2384    } 
     2385    echo $output_string; 
     2386} 
     2387 
    23122388// Find new files uploaded by FTP 
    23132389function sb_scan_dir() { 
     
    23512427} 
    23522428 
    2353 // Recursive mkdir function for PHP < 5.0.0 
    2354 function sb_mkdir($pathname, $mode=0777) 
    2355 { 
     2429// Recursive mkdir function 
     2430function sb_mkdir($pathname, $mode=0777) { 
    23562431    is_dir(dirname($pathname)) || sb_mkdir(dirname($pathname), $mode); 
    23572432    @mkdir($pathname, $mode); 
    23582433    return @chmod($pathname, $mode); 
     2434} 
     2435 
     2436// Delete any unused tags 
     2437function sb_delete_unused_tags() { 
     2438    global $wpdb; 
     2439    $unused_tags = $wpdb->get_results("SELECT {$wpdb->prefix}sb_tags.id AS id, {$wpdb->prefix}sb_sermons_tags.id AS sid FROM {$wpdb->prefix}sb_tags LEFT JOIN {$wpdb->prefix}sb_sermons_tags ON {$wpdb->prefix}sb_tags.id = {$wpdb->prefix}sb_sermons_tags.tag_id WHERE {$wpdb->prefix}sb_sermons_tags.tag_id IS NULL"); 
     2440    if (is_array($unused_tags)) 
     2441        foreach ($unused_tags AS $unused_tag) 
     2442            $wpdb->query("DELETE FROM {$wpdb->prefix}sb_tags WHERE id='{$unused_tag->id}'"); 
    23592443} 
    23602444 
Note: See TracChangeset for help on using the changeset viewer.