From b4a95460e65dbadaf074a414a9e3d9367e109f19 Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Sun, 6 Jan 2013 19:34:54 -0700 Subject: fix show-stopping bugs --- mod/events.php | 4 ++-- mod/fbrowser.php | 4 ++-- mod/message.php | 8 ++++---- mod/photos.php | 14 +++++++------- mod/setup.php | 18 ++++++++++++++++++ 5 files changed, 33 insertions(+), 15 deletions(-) (limited to 'mod') diff --git a/mod/events.php b/mod/events.php index e6ee19c47..7886f27c0 100755 --- a/mod/events.php +++ b/mod/events.php @@ -261,7 +261,7 @@ function events_content(&$a) { $links = array(); - if(count($r)) { + if($r) { $r = sort_by_date($r); foreach($r as $rr) { $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); @@ -276,7 +276,7 @@ function events_content(&$a) { $last_date = ''; $fmt = t('l, F j'); - if(count($r)) { + if($r) { $r = sort_by_date($r); foreach($r as $rr) { diff --git a/mod/fbrowser.php b/mod/fbrowser.php index 81f47e39d..d10d8021b 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -56,7 +56,7 @@ function fbrowser_content($a){ $types = Photo::supportedTypes(); $ext = $types[$rr['type']]; - if($a->theme['template_engine'] === 'internal') { + if($a->get_template_engine() === 'internal') { $filename_e = template_escape($rr['filename']); } else { @@ -93,7 +93,7 @@ function fbrowser_content($a){ list($m1,$m2) = explode("/",$rr['filetype']); $filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip"); - if($a->theme['template_engine'] === 'internal') { + if($a->get_template_engine() === 'internal') { $filename_e = template_escape($rr['filename']); } else { diff --git a/mod/message.php b/mod/message.php index 1a1ce4813..9e5e09e99 100644 --- a/mod/message.php +++ b/mod/message.php @@ -362,7 +362,7 @@ function message_content(&$a) { $rr['to'] = find_xchan_in_array($rr['to_xchan'],$c); $rr['seen'] = (($rr['mail_flags'] & MAIL_SEEN) ? 1 : ""); - if($a->theme['template_engine'] === 'internal') { + if($a->get_template_engine() === 'internal') { $from_name_e = template_escape($rr['from']['xchan_name']); $subject_e = template_escape((($rr['seen']) ? $rr['title'] : '' . $rr['title'] . '')); $body_e = template_escape($rr['body']); @@ -449,7 +449,7 @@ function message_content(&$a) { $a->page['htmlhead'] .= replace_macros($tpl, array( '$nickname' => $channel['channel_addr'], - '$baseurl' => $a->get_baseurl(true) + '$baseurl' => $a->get_baseurl(true), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$linkurl' => t('Please enter a link URL:') )); @@ -470,7 +470,7 @@ logger('message: ' . print_r($message,true)); // if($extracted['images']) // $message['body'] = item_redir_and_replace_images($extracted['body'], $extracted['images'], $message['contact-id']); - if($a->theme['template_engine'] === 'internal') { + if($a->get_template_engine() === 'internal') { $from_name_e = template_escape($message['from']['xchan_name']); $subject_e = template_escape($message['title']); $body_e = template_escape(smilies(bbcode($message['body']))); @@ -508,7 +508,7 @@ logger('message: ' . print_r($message,true)); $select = $message[$recp]['xchan_name'] . ''; $parent = ''; - if($a->theme['template_engine'] === 'internal') { + if($a->get_template_engine() === 'internal') { $subjtxt_e = template_escape($message['title']); } else { diff --git a/mod/photos.php b/mod/photos.php index 2cd2646d5..90f436699 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1063,7 +1063,7 @@ function photos_content(&$a) { } - if($a->theme['template_engine'] === 'internal') { + if($a->get_template_engine() === 'internal') { $albumselect_e = template_escape($albumselect); $aclselect_e = (($visitor) ? '' : template_escape(populate_acl($a->user, $celeb))); } @@ -1125,7 +1125,7 @@ function photos_content(&$a) { if($cmd === 'edit') { if(($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { if($can_post) { - if($a->theme['template_engine'] === 'internal') { + if($a->get_template_engine() === 'internal') { $album_e = template_escape($album); } else { @@ -1176,7 +1176,7 @@ function photos_content(&$a) { $ext = $phototypes[$rr['type']]; - if($a->theme['template_engine'] === 'internal') { + if($a->get_template_engine() === 'internal') { $imgalt_e = template_escape($rr['filename']); $desc_e = template_escape($rr['desc']); } @@ -1390,7 +1390,7 @@ function photos_content(&$a) { $edit = Null; if(($cmd === 'edit') && ($can_post)) { - if($a->theme['template_engine'] === 'internal') { + if($a->get_template_engine() === 'internal') { $album_e = template_escape($ph[0]['album']); $caption_e = template_escape($ph[0]['desc']); $aclselect_e = template_escape(populate_acl($ph[0])); @@ -1552,7 +1552,7 @@ function photos_content(&$a) { $drop = replace_macros(get_markup_template('photo_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete'))); - if($a->theme['template_engine'] === 'internal') { + if($a->get_template_engine() === 'internal') { $name_e = template_escape($profile_name); $title_e = template_escape($item['title']); $body_e = template_escape(bbcode($item['body'])); @@ -1582,7 +1582,7 @@ function photos_content(&$a) { $paginate = paginate($a); } - if($a->theme['template_engine'] === 'internal') { + if($a->get_template_engine() === 'internal') { $album_e = array($album_link,template_escape($ph[0]['album'])); $tags_e = template_escape($tags); $like_e = template_escape($like); @@ -1653,7 +1653,7 @@ function photos_content(&$a) { $twist = 'rotright'; $ext = $phototypes[$rr['type']]; - if($a->theme['template_engine'] === 'internal') { + if($a->get_template_engine() === 'internal') { $alt_e = template_escape($rr['filename']); $name_e = template_escape($rr['album']); } diff --git a/mod/setup.php b/mod/setup.php index b3649ca40..4fa5152ea 100755 --- a/mod/setup.php +++ b/mod/setup.php @@ -183,6 +183,8 @@ function setup_content(&$a) { check_htconfig($checks); + check_smarty3($checks); + check_keys($checks); if(x($_POST,'phpath')) @@ -439,6 +441,22 @@ function check_htconfig(&$checks) { } +function check_smarty3(&$checks) { + $status = true; + $help = ""; + if( !is_writable('view/tpl/smarty3') ) { + + $status=false; + $help = t('Friendica uses the Smarty3 template engine to render its web views. Smarty3 compiles templates to PHP to speed up rendering.') .EOL; + $help .= t('In order to store these compiled templates, the web server needs to have write access to the directory view/tpl/smarty3/ under the Friendica top level folder.').EOL; + $help .= t('Please ensure that the user that your web server runs as (e.g. www-data) has write access to this folder.').EOL; + $help .= t('Note: as a security measure, you should give the web server write access to view/tpl/smarty3/ only--not the template files (.tpl) that it contains.').EOL; + } + + check_add($checks, t('view/tpl/smarty3 is writable'), $status, true, $help); + +} + function check_htaccess(&$checks) { $a = get_app(); $status = true; -- cgit v1.2.3