DocMGR 0.40

Table of Contents

Installation
  • Requirements
  • Optional Features
  • Procedure

    APIs
  • Search

    Operation
  • This section is not complete yet.

    Installation

    Requirements

    DocMGR was written and tested under PHP 4.3.0 (Apache webserver) and PostgreSQL 7.3.1 on a Slackware box. As far as the OS goes, any linux OS should do nicely. Since the security flaw in PHP was discovered in version 4.0.6, I recommend you run PHP version 4.1.2 or later. As of version .35, DocMGR only works with PostgreSQL as the database backend. Because of the javascript code used in DocMGR is fairly new, the client will need at least IE 5.5 SP2 or Netscape 6.2/Mozilla .99 for DocMGR to work correctly.

    Optional Requirements

    The latest version of DocMGR has several additional features which require outside software to be installed. The features and their required software are listed below. I apologize for the large amount of outside requirements, but this software is needed to allow DocMGR to function more as a complete Document Management System. Again, the additional features are optional.

    Image OCR: If you want the content of your images to be indexed so you can look up a scanned page (or whatever) by its content, then you will need this. This requires GOCR at http://jocr.sourceforge.net and ImageMagick http://www.imagemagick.org to work properly. You probably already have imagemagick installed on your system. Drop to a command prompt and type 'convert' and see what you get. If you don't have it, you can download it from the url above. These are both simple installs. Simply give them the ol' ./configure,make,make install, and make sure the binary is in your path.
    PDF Indexing: This will allow your pdf file content to be indexed. Also, your search results will point to the page of the PDF file containing the matching content. I highly recommend this feature, especially if you use the PDF format for a majority of your scanned documentation. This requires ghostscript 6.52 or higher. Make sure you have this version. If not, you can download it from http://www.ghostscript.com
    Note: This bad boy requires zlib, libpng, and jpeg-6b to compile. You can download them from the "3rdparty" directory of the ghostscript ftp site. Just untar them in the top level directory of the ghostscript source, and rename the directories to zlib, libpng, and jpeg, respectively.

    All of these above features are optional. Just make sure you comment them out in the config.inc.php file. I highly recommend them for more efficient search-and-retrieval capabilities in your Document Management System.

    Procedure

    To install DocMGR:
  • Install the above optional programs and make sure they are in the path used by apache. If you're not sure what path apache can see, create a new php file containg "phpinfo();" and check the PATH variable.
  • Untar the DocMGR archive.
  • Make sure a data/ and temp/ directory were created in your DocMGR directory.
  • Setup the config.inc.php file in the include directory. The file is self explanatory. Make sure you set any variables in the REQUIRED section.
  • Make sure your apache version is set to run under a specific user and group (I created a new user and group for this purpose) and that user can write to the data and temp directories in DocMGR.
  • SECURITY NOTE: If you do not perform this step, you will be leaving your system open to a huge security risk. In your apache httpd.conf file, add the following lines:

    <Files "*.docmgr">
      Order allow,deny
      Deny from all
    </Files>

    This prevents anyone from pointing their browser to your "data/" directory and freely downloading files from the application.
  • Make sure the import directory you designated in the config.inc.php file has been created.
  • Installing Fresh:
    Next create your directory structure using the provided "docmgr.pgsql" file. You may accomplish this by transferring this file to your sql server, then logging in as your primary database user. Change to the pgsql/bin directory. First, we create the database by issuing a "./createdb $your_db_name". Next, we insert the content by issuing a "./psql -d $your_db_name -f /path/to/docmgr.pgsql". This will create your new postgresql database.

    That's it! You can login now with the username/password combo admin/admin
  • Upgrading:
    These upgrades only work for the .35 and .36 versions of DocMGR. If there's a high demand for earlier versions, I will modify the scripts to be compliant. Simply set the variables in the beginning of the transfer.php file, then point your browser to that file. This script worked for me, but I make no promises. BACK UP YOUR DATABASE, DAMMIT!!!

    There is also an upgrade for those of you that used the .40 Beta version of DocMGR. In this case, you will want to use the transferbeta.php file instead.
  • That's it. Remember, if you are upgrading from a previous version of DocMGR, backup your data! This is a significant upgrade to all previous versions, and requires changes to the database structure. If you're a new user, you can login to DocMGR with the username/password combination admin/admin.


    APIs

    Search

    This api is untested outside of its use in DocMGR. I've provided directions on how to use it below. However, I can make no guarantees of its security or even working outside of DocMGR. I do plan on using this in my own intranet one day, but haven't gotten around to it yet. One thing I can think of which you do want to double-check, is that you hard code the userid,groupid,and level values you pass to the search api. DocMGR uses a separate include file which prevents anyone from passing these values from the web browser. If you do not hard code this, someone may be able to pass a phony id and achieve higher than desired access to DocMGR. You've been warned!!!

    The functions exist in the include/function_search.inc.php file. The "dmSearch();" function you call will return an array with the results of the search. The format of the returned array is described below, along with the parameters for the function. If you wish to ses an example of how this array may be formatted into results, view the displayResults() function and the loop which calls it in the index.php file of DocMGR.

    If calling the function_search.inc.php file alone (i.e., from another program which is not DocMGR) you will need to include the config.inc.php file and the postgresql.inc.php file. If you wish, you may simply append the required elements of the config.inc.php file to the beginning of this file (you can skip the optional settings), along with the functions in the postgresql.inc.php file.


    Calling Function:
    dmSearch(  
     $action,browsing category or searching for a string :
    "search" or "cat_browse"
     $site_url,url of your site :
    "http://www.somedomain.com/"
     $category_value,id of the category (in the dm_category table) you want to browse the files in
     $string,string you're searching for
     $string_option,searching for any word or all words :
    "any" or "all".
     $userid,userid of the user you're searching with
     $groupid,groupid of the user you're searching with
     $level,level of the user you're searching with
     $denyQuickview,the array in the config file listing file extensions you don't want to allow to quickview
     $altDateFormat,Display the dates in alternate format? (in config file)
    ---- All Below Optional ---- Can set to null and will still work ------------
     $mod_option,file modify option from advanced search :
    "last" = last_modified, "date" = date entered in system
     $date_option,date option from advanced search :
    "any","single","period","before","after"
    ---- All dates can be in any format like description in advanced search on DocMGR ----
     $single_date,date if searching for files on a date
     $period_begin_date,beginning date if searching for files between dates
     $period_end_date,end date if searching for files between dates
     $before_date,beginning date if searching for files after a date
     $after_dateend date if searching for files before a date
    )


    Return Format:
    $resultArray = a multidimensional array. The first level contains each group of results. The rest contains the actual search results. When looping through the array, use the first key as your number of returns, then start the loop at 1 to display the rest.

    $resultArray[0]number of matching results
    Note: $i must be >= 1
    $resultArray[$i][0] file id
    $resultArray[$i][1] file name. This is the actual link which leads to the file properties in DocMGR.
    $resultArray[$i][2] file summary
    $resultArray[$i][3] checked out status (checked in, checked out)
    $resultArray[$i][4] file version
    $resultArray[$i][5] file owner (original uploader or importer)
    $resultArray[$i][6] date file was created. This is an array.
    $date[0] = The date the file was created.
    $date[1] = The time the file was created.
    $resultArray[$i][7] owner of file modification (update or checkout)
    $resultArray[$i][8] date file was updated/checked out. This is an array
    $date[0] = The date the file was updated/checked out.
    $date[1] = The time the file was updated/checked out.
    $resultArray[$i][9] page array of matching pages. This contains the actual quickview links of pages which match the search string. If no pages are found, or to-the-page matches aren't available, a quickview link for the entire file is shown.