<?php

/*********************************************************************************************
 *
 * HOOKS
 *
 ********************************************************************************************/
/**
 * Implementation of hook_menu
 */
function scratchpads_legacy_menu(){
  $items = array();
  $items['Publications/%'] = array(
    'access callback' => TRUE,
    'page callback' => 'scratchpads_legacy_redirect_publications',
    'page arguments' => array(
      1,
    ),
    'type' => MENU_CALLBACK,
  );
  return $items;
}

function scratchpads_legacy_redirect_publications($file_name){
  $file_path = variable_get('file_public_path', conf_path() . '/files');
  $file_uri= join('/', array($file_path, $file_name));

  if (file_exists($file_uri)) {
    drupal_goto($file_uri);
  }
  return drupal_not_found();
}
