$filename = $_POST['filename']; // if the filename contains slashes get the part after the slashes $p = strrpos($filename, '/'); if (is_int($p)) { $filename = substr($filename, $p); } $_SESSION['filename'] = $filename ? $filename : 'user.pl'; $_SESSION['annerror'] = ''; $_SESSION['logging'] = ''; $_SESSION['editerror'] = ''; $_SESSION['annfile'] = ''; $_SESSION['filter'] = ''; $_SESSION['filter_prop'] = ''; $_SESSION['annmethod'] = ''; $_SESSION['norm'] = ''; $_SESSION['watch'] = ''; $_SESSION['goal'] = ''; $_SESSION['stock'] = $_POST['stockfile']; $_SESSION['stock_annfile'] = false; $_SESSION['stage'] = 2; if ($_SESSION['stock'] == "true") { $_SESSION['annmethod'] = 'stock'; } if (isset($_POST['save'])) { redirect('get_pl.php'); } else { redirect('upload.php'); } } else { file_upload_error('Source', 'index.html', $_FILES['userfile']['error']); }
function save_bib() { if (isset($_FILES['bib_m_file'])) { if (file_upload_error('bib_m_file')) { $name = $_FILES['bib_m_file']['name']; move_uploaded_file($_FILES['bib_m_file']['tmp_name'], 'publication/my/' . $name); $_SESSION['my_bib_php_content'] = "<?php\n echo \"<DIV id='main_content'>\";\n \$_GET['bib']='publication/my/" . $name . "';\n \$_GET['all']=1;\n include('bibtexbrowser.php');\n echo '</DIV>';\n ?>\n"; } } if (isset($_FILES['bib_p_file'])) { if (file_upload_error('bib_p_file')) { $name = $_FILES['bib_p_file']['name']; move_uploaded_file($_FILES['bib_p_file']['tmp_name'], 'publication/my/' . $name); $_SESSION['my_bib_php_content'] = "<?php\n echo \"<DIV id='main_content'>\";\n \$_GET['bib']='publication/my/" . $name . "';\n \$_GET['all']=1;\n include('bibtexbrowser.php');\n echo '</DIV>';\n ?>\n"; } } if (isset($_FILES['bib_r_file'])) { if (file_upload_error('bib_r_file')) { $name = $_FILES['bib_r_file']['name']; move_uploaded_file($_FILES['bib_r_file']['tmp_name'], 'publication/reco/' . $name); $_SESSION['res_bib_php_content'] = "<?php\n echo \"<DIV id='main_content'>\";\n \$_GET['bib']='publication/reco/" . $name . "';\n \$_GET['all']=1;\n include('bibtexbrowser.php');\n echo '</DIV>';\n ?>\n"; } } }
} // Check file exists and is readable $fullname = "{$frontend_dir}/examples/{$filename}"; if (!is_readable($fullname)) { return false; } return $fullname; } if (isset($_FILES['annfile']) && is_uploaded_file($_FILES['annfile']['tmp_name'])) { $_SESSION['annfile'] = file_get_contents($_FILES['annfile']['tmp_name']); $_SESSION['annmethod'] = 'upload'; $_SESSION['editerror'] = ''; $_SESSION['stage'] = 3; redirect('upload_annfile.php'); } elseif ($_SESSION['stock'] == "true" && isset($_POST['annfile'])) { $annfile = $_POST['annfile']; $stock_file = stock_annfile($annfile, $_SESSION['filename']); if ($stock_file !== false) { $_SESSION['annfile'] = file_get_contents($stock_file); $_SESSION['stock_annfile'] = $annfile; $_SESSION['annmethod'] = 'stock'; $_SESSION['editerror'] = ''; $_SESSION['goal'] = ''; $_SESSION['stage'] = 3; redirect('upload_annfile.php'); } else { stock_file_error('Annotation'); } } else { file_upload_error('Annotation', 'upload.php', $_FILES['annfile']['error']); }