Skip to content

Commit

Permalink
Cleanup with Coder
Browse files Browse the repository at this point in the history
  • Loading branch information
nhck committed Apr 6, 2012
1 parent ebe97ce commit 63aa892
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
4 changes: 2 additions & 2 deletions modules/webfm_ipfolder/webfm_ipfolder.install
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ function webfm_ipfolder_update_6200() {

switch ($db_type) {
case 'pgsql':
db_change_column($ret, 'webfm_ipfolder', 'ip1', 'ip1', 'BIGINT', array('not null' => TRUE,));
db_change_column($ret, 'webfm_ipfolder', 'ip2', 'ip2', 'BIGINT', array('not null' => TRUE,));
db_change_column($ret, 'webfm_ipfolder', 'ip1', 'ip1', 'BIGINT', array('not null' => TRUE));
db_change_column($ret, 'webfm_ipfolder', 'ip2', 'ip2', 'BIGINT', array('not null' => TRUE));
break;

case 'mysql':
Expand Down
2 changes: 1 addition & 1 deletion webfm.admin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ function webfm_admin_settings_style() {
$node_types = array_map('check_plain', node_get_types('names'));
$form['attach']['webfm_attachments_links'] = array(
'#type' => 'checkboxes',
'#title' => t('Display list of attached files in links instead of counter '),
'#title' => t('Display list of attached files in links instead of counter.'),
'#required' => FALSE,
'#default_value' => variable_get('webfm_attachments_links', array()),
'#options' => $node_types,
Expand Down
25 changes: 13 additions & 12 deletions webfm.module
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ function webfm_link($type, $node = NULL, $teaser = FALSE) {
if ($teaser && variable_get('webfm_attach_body', FALSE) && $type == 'node' && isset($node->webfm_files) && user_access('view webfm attachments')) {
if ($num_files = count($node->webfm_files)) {
$available_types = array_keys(array_filter(variable_get('webfm_attachments_links', array())));
if(in_array($node->type, $available_types)) {
if (in_array($node->type, $available_types)) {
$links['webfm_attachments'] = array(
'html' => TRUE,
'title' => theme('webfm_attachments_link',$node->webfm_files),
'title' => theme('webfm_attachments_link', $node->webfm_files),
);
}
else {
Expand Down Expand Up @@ -735,7 +735,8 @@ function webfm_attach_attached_form($node) {
array_walk($attachlist, 'intval');//Don't trust your Inputs. Forcing all values to int.
$attachlist = implode(',', $attachlist);
$form['new']['attachlist']['#default_value'] = $attachlist;
} elseif (isset($node->attachlist) and empty($node->attachlist)) {
}
elseif (isset($node->attachlist) and empty($node->attachlist)) {
// this case applies when we are previewing but no attachments are left in the list
// we then set this to a space because the value get reset to the original value
// if the default_value is empty
Expand Down Expand Up @@ -1972,7 +1973,7 @@ function theme_webfm_upload_form($form) {
function webfm_inline_js($base_url, $base_path, $clean_url, $uid) {
$js = 'function getBaseUrl(){return '. drupal_to_js($base_url) .';} ';
$js .= 'function getWebfmIconDir(){return ';
$js .= drupal_to_js($base_url .'/'. variable_get('webfm_icon_dir', drupal_get_path('module', 'webfm').'/image/icon'));
$js .= drupal_to_js($base_url .'/'. variable_get('webfm_icon_dir', drupal_get_path('module', 'webfm') .'/image/icon'));
$js .= ';} ';
$js .= 'function getWebfmCleanUrl(){return ';
$js .= drupal_to_js($clean_url);
Expand Down Expand Up @@ -2234,7 +2235,7 @@ class webfm_build_dir_list {

$path_start = drupal_substr($path, 0, 1);
if ($path_start == DIRECTORY_SEPARATOR && $path_start != '/') {
$path = ltrim($path,DIRECTORY_SEPARATOR);
$path = ltrim($path, DIRECTORY_SEPARATOR);
$path = '/'. $path;
}
elseif ($path_start != DIRECTORY_SEPARATOR && $path_start != '/') {
Expand All @@ -2259,7 +2260,7 @@ class webfm_build_dir_list {
$webfm_roots = webfm_get_root_dirs();
foreach ($webfm_roots as $key => $sub_root) {
// The read path must be contained within a legitimate role root dir for this user
if ($sub_root && webfm_check_path(realpath($full_path), realpath($root.$sub_root))) {
if ($sub_root && webfm_check_path(realpath($full_path), realpath($root . $sub_root))) {
$perm_flag = TRUE;
break;
}
Expand All @@ -2269,7 +2270,7 @@ class webfm_build_dir_list {
$webfm_group_roots = webfm_get_group_root_dirs();
foreach ($webfm_group_roots as $key => $sub_root) {
// The read path must be contained within a legitimate group root dir for this user
if ($sub_root && webfm_check_path(realpath($full_path), realpath($root.$sub_root))) {
if ($sub_root && webfm_check_path(realpath($full_path), realpath($root . $sub_root))) {
$perm_flag = TRUE;
break;
}
Expand Down Expand Up @@ -2585,7 +2586,7 @@ class webfm_searchFiles {
}

function searchFilesRecur($root_dir, $dir, $searchpattern) {
$dir = rtrim($dir, DIRECTORY_SEPARATOR.' / \\');
$dir = rtrim($dir, DIRECTORY_SEPARATOR .' / \\');
//hide filesys root by not returning full path
$full_dir = $root_dir . $dir;
$handle = @opendir($full_dir);
Expand Down Expand Up @@ -2680,7 +2681,7 @@ function _webfm_force_download($status = NULL) {
static $webfm_force_download = NULL;

if (is_null($webfm_force_download)) {
if(variable_get('webfm_attach_new_window', 0) == 2) {
if (variable_get('webfm_attach_new_window', 0) == 2) {
$webfm_force_download = TRUE;
}
else {
Expand All @@ -2689,7 +2690,7 @@ function _webfm_force_download($status = NULL) {
}

if (!is_null($status)) {
if(!$status) {
if (!$status) {
$webfm_force_download = FALSE;
}
else {
Expand Down Expand Up @@ -2727,7 +2728,7 @@ function _webfm_check_access($filepath = NULL, $f = NULL) {
}

//If it is the users own file: Allow.
if($f->uid === $user->uid) {
if ($f->uid === $user->uid) {
return TRUE;
}

Expand Down Expand Up @@ -3070,7 +3071,7 @@ function webfm_enum_validate($file, &$err_msg) {
static $finfohandle = FALSE;
if ($finfohandle || $finfohandle = @finfo_open(FILEINFO_MIME)) {
$mimetype = finfo_file($finfohandle, $file->filepath);
$mimetype = explode(";",$mimetype);
$mimetype = explode(";", $mimetype);
$mimetype = $mimetype[0];
}
}
Expand Down
6 changes: 3 additions & 3 deletions webfm_theme.inc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function theme_webfm_attachments($files) {
}

$href = array(
'data' => l('<img src="'. $icon_path .'" alt="'.t('File').'" title="'.t('Download !filename',array('!filename' => $filename)).'" /> ', 'webfm_send/'. $file->id .'/1', array('attributes' => array('title' => 'Download '. $filename, 'target' => $target), 'html' => TRUE)) . l($filename, 'webfm_send/'. $file->id, array('attributes' => array('title' => t('Open @filename', array('@filename' => $filename)), 'target' => $target))) . $description,
'data' => l('<img src="'. $icon_path .'" alt="'. t('File') .'" title="'. t('Download !filename', array('!filename' => $filename)) .'" /> ', 'webfm_send/'. $file->id .'/1', array('attributes' => array('title' => 'Download '. $filename, 'target' => $target), 'html' => TRUE)) . l($filename, 'webfm_send/'. $file->id, array('attributes' => array('title' => t('Open @filename', array('@filename' => $filename)), 'target' => $target))) . $description,
'class' => 'att-title'
);

Expand Down Expand Up @@ -89,12 +89,12 @@ function theme_webfm_attachments_link($files) {
$item = array();
$icon_path = $base_url .'/'. variable_get('webfm_icon_dir', drupal_get_path('module', 'webfm') .'/image/icon') .'/'. _webfm_get_icon($file->e);
$filename = $file->ftitle ? $file->ftitle : $file->n;
$item['title'] = '<img src="'. $icon_path .'" alt="'.t('File').'" title="'.t('Download !filename',array('!filename' => $filename)).'" /> '.$filename;
$item['title'] = '<img src="'. $icon_path .'" alt="'. t('File') .'" title="'. t('Download !filename', array('!filename' => $filename)) .'" /> '. $filename;
$item['href'] = 'webfm_send/'. $file->id;
$item['html'] = TRUE;
$item['attributes'] = array('target' => $target);
$list[] = $item;
}

return theme('links',$list,array('class' => 'webfm_attachments_links'));
return theme('links', $list, array('class' => 'webfm_attachments_links'));
}

0 comments on commit 63aa892

Please sign in to comment.