id; $term = pick ( 'term', $that -> term ); $definition = pick ( 'definition', $that -> definition ); $rarticle = pick ( 'rarticle', $that -> rarticle ); $rartwork = pick ( 'rartwork', $that -> rartwork ); $rartist = pick ( 'rartist', $that -> rartist ); $rwebsite = pick ( 'rwebsite', $that -> rwebsite ); $reference = pick ( 'reference', $that -> reference ); $language = pick ( 'language', $that -> language ); $author = pick ( 'author', $that -> author ); $email = pick ( 'email', $that -> email ); $filetype = ''; $code = pick ('code', false); $file = pick_image ( 'file', false); $newterm = pick ('newterm', ''); if ( form_submitted () ) { $errors = Array(); if ( !is_email ( $email ) ) $errors [ 'email' ] = 'Please provide a valid email address'; if ( trim ( $author ) == '' ) $errors [ 'author' ] = 'Please enter your name'; //if ( trim ( $newterm ) == '' ) // $errors [ 'newterm' ] = 'Please enter the term for definition'; if ( !isset ( $_SESSION [ 'code_accepted' ] ) || $_SESSION [ 'code_accepted' ] != TRUE ) { if ( !$code || $code != $_SESSION [ 'code' ] ) $errors [ 'code' ] = 'Validation code is incorrect'; else { // session_register ( 'code_accepted' ); $_SESSION [ 'code_accepted' ] = TRUE; } } if ( !count ( $errors ) ) { if ( $file ) { $ftype = $_FILES['file']['type']; $file_types = array( 'application/x-troff-msvideo' => 'avi', 'application/x-shockwave-flash' => 'swf', 'application/octet-stream' => 'mpg', 'application/octet-stream' => 'mov', 'application/msword' => 'doc', 'application/x-zip-compressed' => 'zip', 'application/x-compressed' => 'zip', 'application/zip' => 'zip', 'audio/mpeg' => 'mp3', 'audio/mp3' => 'mp3', 'audio/x-mpeg-3' => 'mp3', 'audio/x-mp3' => 'mp3', 'audio/m3u' => 'mp3', 'audio/x-m3u' => 'mp3', 'audio/mpeg3' => 'mp3', 'application/pdf' => 'pdf', 'audio/x-ms-wma' => 'wma', 'audio/x-pn-realaudio' => 'ra', 'image/pjpeg' => 'jpg', 'image/jpeg' => 'jpg', 'image/gif' => 'gif', 'image/tiff' => 'tif', 'image/bmp' => 'bmp', 'image/x-windows' => 'bmp', 'image/x-png' => 'png', 'image/x-dwg'=> 'dwg' , 'multipart/x-zip' => 'zip', 'video/mpeg' => 'mpg', 'video/x-mpeg' => 'mpg', 'video/mpeg' => 'mpg', 'video/avi' => 'avi', 'video/x-pn-realvideo' => 'rm', 'video/msvideo' => 'avi', 'video/x-msvideo' => 'avi', 'video/quicktime' => 'mov', 'text/rtf' => 'rtf', 'text/plain' => 'txt', 'text/html' => 'html' ); $ext = $file_types [$ftype]; $fname = ($ext) ? 'akw_' . time() . '.' . $ext : '0'; if ($ext) { $cmd = 'cp ' . $file . ' ' . TEXTS_IMAGES . '/' . $fname; system ( $cmd, $err ); } $file = $fname; $filetype = ($ext) ? $ext : 'form'; } if ( trim ( $newterm ) != '' ) { $trm = new terms (); if ( $trm -> load ( '', 0, 0, '', '', 'title="' . trim ( $newterm ) . '"' ) == DB_ERR_SUCCESS ) { $term = $trm -> id; } else { $trm -> title = $newterm; if ( $trm -> valid () ) if ( $trm -> store () != DB_ERR_SUCCESS ) { header ( 'Location: error.php' ); exit; } $term = $trm -> id; } } $that -> id = $id; $that -> term = $term; $that -> definition = $definition; $that -> rarticle = $rarticle; $that -> rartwork = $rartwork; $that -> file = $file; $that -> filetype = $filetype; $that -> rartist = $rartist; $that -> rwebsite = $rwebsite; $that -> reference = $reference; $that -> language = $language; $that -> author = $author; $that -> email = $email; if ( $that -> store () != DB_ERR_SUCCESS ) { header ( 'Location: error.php' ); exit; } else { $ip = $_SERVER [ 'REMOTE_ADDR' ]; $lng = new languages ($that -> language); $headers = 'Content-Type: text/plain; charset=utf-8' . "\n" . 'Return-Path: postmaster@' . SITE_DOMAIN . "\n" . 'From: ' . SITE_DOMAIN . ' \n" . 'Reply-To: ' . $that -> author . ' <' . $that -> email . '>'; $subject = '[ AKW ] entry by ' . $that -> author; $mbody = 'Entry ID: ' . $that -> id . "\n" . 'Term: ' . $trm -> title . "\n" . 'Author: ' . $that -> author . "\n" . 'Language: ' . $lng -> name . "\n" . 'Media: http://no-org.net/simages/' . $that -> file . "\n\n" . "------------------------------------------------------------\n\n" . 'Textual definition:' . "\n" . "------------------------------------------------------------\n" . $that -> definition . "\n\n" . 'Related Texts:' . "\n" . "------------------------------------------------------------\n" . $that -> rarticle . "\n\n" . 'Related Artworks:' . "\n" . "------------------------------------------------------------\n" . $that -> rartwork . "\n\n" . 'Related Artists:' . "\n" . "------------------------------------------------------------\n" . $that -> rartist . "\n\n" . 'Related Websites:' . "\n" . "------------------------------------------------------------\n" . $that -> rwebsite . "\n\n" . 'References:' . "\n" . "------------------------------------------------------------\n" . $that -> reference . "\n\n" . "------------------------------------------------------------\n\n" . 'GMT: ' . gmdate ( 'Y-m-d H:m:s' ) . "\n" . 'User-Agent: ' . $_SERVER [ 'HTTP_USER_AGENT' ] . "\n" . 'User-IP: ' . $ip . "\n" . 'Hostname: ' . gethostbyaddr ( $ip ) . "\n"; mail ( 'review@' . SITE_DOMAIN, $subject, $mbody, $headers ); header ( 'Location: thankyou.php?r=texts' ); exit; } } } ?> Art Keywords Project [no-org.net] - Jerusalem Independent Art Network