function file_download_link($atts, $thing) { global $thisfile, $permlink_mode; extract(lAtts(array('filename' => '', 'id' => ''), $atts)); $from_form = false; if ($id) { $thisfile = fileDownloadFetchInfo('id = ' . intval($id)); } elseif ($filename) { $thisfile = fileDownloadFetchInfo("filename = '" . doSlash($filename) . "'"); } else { assert_file(); $from_form = true; } if ($thisfile) { $url = filedownloadurl($thisfile['id'], $thisfile['filename']); $out = $thing ? href(parse($thing), $url) : $url; // cleanup: this wasn't called from a form, // so we don't want this value remaining if (!$from_form) { $thisfile = ''; } return $out; } }
function file_download_link($atts, $thing) { global $permlink_mode, $thisfile; extract(lAtts(array('id' => '', 'filename' => ''), $atts)); $where = !empty($id) && $id != 0 ? "id='{$id}'" : (!empty($filename) ? "filename='{$filename}'" : ''); if (empty($thisfile)) { $thisfile = fileDownloadFetchInfo($where); } $out = $permlink_mode == 'messy' ? '<a href="' . hu . 'index.php?s=file_download&id=' . $thisfile['id'] . '">' . parse($thing) . '</a>' : '<a href="' . hu . gTxt('file_download') . '/' . $thisfile['id'] . '">' . parse($thing) . '</a>'; return $out; }
function fox_code_form($atts, $thing) { global $fox_code_prefs, $thisfile; extract(lAtts(array('fileid' => '', 'filename' => '', 'title' => '', 'height' => '400', 'language' => 'php', 'lines' => '1', 'startline' => '1', 'width' => '500', 'overallclass' => '', 'tabs' => '2', 'css' => '0', 'keywordslinks' => '0', 'encoding' => 'UTF-8', 'form' => 'fox_code_form', 'fromline' => '', 'toline' => ''), $atts)); if ($fileid || $filename || $thing) { if (empty($thisfile)) { if ($fileid) { $thisfile = fileDownloadFetchInfo('id = ' . intval($fileid)); $local_thisfile = true; } else { if ($filename) { $thisfile = fileDownloadFetchInfo("filename = '" . $filename . "'"); $local_thisfile = true; } } } $fox_code_prefs['fileid'] = $fileid; $fox_code_prefs['filename'] = $filename; $fox_code_prefs['title'] = $title; $fox_code_prefs['height'] = $height; $fox_code_prefs['language'] = $language; $fox_code_prefs['lines'] = $lines; $fox_code_prefs['startline'] = $startline; $fox_code_prefs['width'] = $width; $fox_code_prefs['overallclass'] = $overallclass; $fox_code_prefs['tabs'] = $tabs; $fox_code_prefs['css'] = $css; $fox_code_prefs['keywordslinks'] = $keywordslinks; $fox_code_prefs['encoding'] = $encoding; $fox_code_prefs['fromline'] = $fromline; $fox_code_prefs['toline'] = $toline; if (strlen($fileid) == 0 && strlen($filename) == 0) { $fox_code_prefs['code'] = $thing; } if (!empty($thisfile)) { $fox_code_prefs['filename'] = $thisfile['filename']; $fox_code_prefs['fileid'] = $thisfile['id']; } if (!$title) { $fox_code_prefs['title'] = $thisfile['filename'] != '' ? $thisfile['filename'] : $language; } $form = fetch_form($form); $out = parse($form); $thisfile = $fox_code_prefs = NULL; return $out; } }
function file_download_link($atts, $thing) { global $thisfile, $permlink_mode; extract(lAtts(array('filename' => '', 'id' => ''), $atts)); $from_form = true; if (empty($thisfile)) { $from_form = false; if ($id) { $thisfile = fileDownloadFetchInfo('id = ' . intval($id)); } elseif ($filename) { $thisfile = fileDownloadFetchInfo("filename = '" . doSlash($filename) . "'"); } } if ($thisfile) { $url = $permlink_mode == 'messy' ? hu . 'index.php?s=file_download' . a . 'id=' . $thisfile['id'] : hu . gTxt('file_download') . '/' . $thisfile['id']; $out = $thing ? href(parse($thing), $url) : $url; // cleanup: this wasn't called from a form, // so we don't want this value remaining if ($from_form == false) { unset($thisfile); } return $out; } }