\n"; // echo "${$name}"; } function hide_post() { global $HTTP_POST_VARS; reset($HTTP_POST_VARS); while (list($key, $val) = each($HTTP_POST_VARS)) { hide_var ("$key"); } } function mkdirr($pathname, $mode = null) { // Check if directory already exists if (is_dir($pathname) || empty($pathname)) { return true; } // Ensure a file does not already exist with the same name if (is_file($pathname)) { trigger_error('mkdirr() File exists', E_USER_WARNING); return false; } // Crawl up the directory tree $next_pathname = substr($pathname, 0, strrpos($pathname, DIRECTORY_SEPARATOR)); if (mkdirr($next_pathname, $mode)) { if (!file_exists($pathname)) { return mkdir($pathname, $mode); } } return false; } function rmdirr($dirname) { // Sanity check if (!file_exists($dirname)) { return false; } // Simple delete for a file if (is_file($dirname)) { return unlink($dirname); } // Loop through the folder $dir = dir($dirname); while (false !== $entry = $dir->read()) { // Skip pointers if ($entry == '.' || $entry == '..') { continue; } // Recurse rmdirr("$dirname/$entry"); } // Clean up $dir->close(); return rmdir($dirname); } function makeRandomCheck() { $salt = "abchefghjkmnpqrstuvwxyz0123456789"; srand((double)microtime()*1000000); $i = 0; while ($i <= 15) { $num = rand() % 33; $tmp = substr($salt, $num, 1); $check = $check . $tmp; $i++; } return $check; } function checkPaper($paperID, $paperTitle, $lastname) { if (strlen($paperTitle) > 0) { $query="select id, trim(title), author.check, status from author where id = $paperID and trim(title) = trim('$paperTitle') and concat(name, ' ', co_authors) like '%$lastname%' and status in ('oral', 'poster')"; } else { $query="select id, trim(title), author.check, status from author where id = $paperID and concat(name, ' ', co_authors) like '%$lastname%' and status in ('oral', 'poster')"; } $result = mysql_query($query); return mysql_fetch_row($result); } function latex_replace($from, $to, $where) { $to = latexQuote($to); return str_replace($from, $to, $where); } function latex_replace_title($from, $to, $where) { $to = latexQuoteTitle($to); return str_replace($from, $to, $where); } function latexQuote($string) { $string = str_replace('\\', '$\\backslash$', $string); $string = str_replace('#', '\\#', $string); $string = str_replace('$', '\\$', $string); $string = str_replace('%', '\\%', $string); $string = str_replace('&', '\\&', $string); $string = str_replace('{', '\\{', $string); $string = str_replace('}', '\\}', $string); $string = str_replace('~', '\\~{}', $string); $string = str_replace('^', '\\^{}', $string); $string = str_replace('\$\\backslash\$', '$\\backslash$', $string); return $string; } function latexQuoteTitle($string) { $string = str_replace('%', '\%', $string); $string = str_replace('&', '\&', $string); return $string; } function htmlQuote($string) { return str_replace("\n", '
', htmlspecialchars($string, ENT_QUOTES)); } function myscandir($dir, $exp, $how='name', $desc=0) { $r = array(); $dh = @opendir($dir); if ($dh) { while (($fname = readdir($dh)) !== false) { if (preg_match('/^\.$/', $fname)) continue; if (preg_match('/^\.\.$/', $fname)) continue; if (preg_match($exp, $fname)) { $stat = stat("$dir/$fname"); $r[$fname] = ($how == 'name')? $fname: $stat[$how]; } } closedir($dh); if ($desc) { arsort($r); } else { asort($r); } } return(array_keys($r)); } function myscandirModified($dir, $exp, $how='name', $desc=0, $modifiedSince) { $files = myscandir($dir, $exp, $how, $desc); $tmpcnt = $files; if ($modifiedSince != '') { foreach ($files as $i => $value) { $file = $dir . "/" . $files[$i]; $stats = stat($file); $modified = $stats[9]; if ($modified < $modifiedSince) { unset($tmpcnt[$i]); } } } return $tmpcnt; } # retrieves the mapping of table key (usually, primary key) to a given # column/expression and returns it as associative map function mysql_fetch_as_mapping($query, $key, $val) { $arr = array(); $result = mysql_query($query); if (!$result) { echo "Error: $query: " . mysql_error(); } else { while ($row = mysql_fetch_row($result)) { $arr[$row[0]] = $row[1]; } return $arr; } } function mysql_fetch_as_array($query) { $arr = array(); $result = mysql_query($query); while ($row = mysql_fetch_row($result)) { array_push($arr, $row[0]); } return $arr; } function mysql_fetch_first_row($query) { $result = mysql_query($query); if (!$result) { echo "Error: $query: " . mysql_error(); } else { return mysql_fetch_array($result); } } function mysql_fetch_first_value($query) { $result = mysql_query($query); if (!$result) { echo "Error: $query: " . mysql_error(); } else { $row = mysql_fetch_row($result); return $row[0]; } } function reformat_time($stime='') { if ($stime == '') $time = time(); else $time = strtotime($stime); return date("D M d, g:ia", $time); } function format_time($time) { return date("D M d, g:ia", $time); } function read_iccs_properties($prefix = '') { global $iccs_global_properties; if ($prefix) { $iccs_global_properties = mysql_fetch_as_mapping( "select name, value from properties order by name", "name", "value"); } else { $iccs_global_properties = mysql_fetch_as_mapping( "select name, value from properties where key like '$prefix%' order by name", "name", "value"); } } function get_iccs_property($name, $default='') { global $iccs_global_properties; $val = $iccs_global_properties[$name]; if (!$val) $val = $default; return $val; } function open_popup($url, $width=700, $height=250) { echo "window.open($url, 'anycontent','toolbar=0,location=0,status=0,menubar=0,scrollbars=0,top='" . "+Math.floor(screen.height/2-$height/2)+',left='+Math.floor(screen.width/2-$width/2)+" . "',resizable=1,width='+$width+',height='+$height);"; } # ICCS-related functions function showPaperFiles($dir, $exp, $how='name', $desc=0, $modifiedSince, $hideOlderFiles) { $files = myscandir($dir, $exp, $how, $desc); echo ""; foreach ($files as $i => $value) { $file = $dir . "/" . $files[$i]; $stats = stat($file); $size = $stats[7]; $ino = $stats[1]; $modified = $stats[9]; $fgcolorStart = ""; $fgcolorEnd = ""; if ($modifiedSince != '' && $modified < $modifiedSince) { if ($hideOlderFiles == '') { $fgcolorStart = ""; $fgcolorEnd = ""; } else { continue; } } echo ""; echo ""; echo ""; echo ""; $result = mysql_query("select page_count, errors from paper_files where inode=$ino"); $row = mysql_fetch_row($result); $pages = $row[0]; $error = $row[1]; if($error!=null) { $list=split("\n",$error); $error=$list[0]; } if($pages==null) { echo ""; } else { echo ""; } echo ""; } echo "
 " . $fgcolorStart . $files[$i] . $fgcolorEnd . "  $fgcolorStart" . date("Y-m-d H:i", $modified) . "$fgcolorEnd$fgcolorStart" . round($size/1024) . " KB$fgcolorEnd$error$fgcolorStart" . $pages . " pages$fgcolorEnd

"; } function showPaperDetails($id, $basedir) { $author = mysql_fetch_first_row("select id, name, co_authors, title, abstract, status, email, author.check, id_workshop, notes, presenter from author where id = $id"); echo "

Paper info

"; if ($author['notes'] == '') $author['notes'] = "None"; echo "ID: " . $author['id'] . "
"; echo "Author: " . $author['name'] . "
"; echo "E-mail: " . $author['email'] . "
"; echo "Co-authors: " . $author['co_authors'] . "
"; echo "Title: " . $author['title'] . ""; if ($id_workshop == 0) { $track = "Main track"; } else { $workshop_title = mysql_fetch_first_value("select title from workshop where id = " . $author['id_workshop']); $track = "Workshop $id_workshop: " . $workshop_title; } echo "

Abstract: " . $author['abstract'] . "

"; $parsed = parse_status($author['status']); echo "

Track: $track

"; echo "Status: $parsed"; if ($author['status'] == 'oral' || $author['status'] == 'poster' || $author['status'] == 'invited') { echo "

Presenter: " . $author['presenter'] . "

"; $regular_session_id = mysql_fetch_first_value('select id from session_type where title="Regular"'); if ($author['status'] == 'oral') { $sessions = mysql_fetch_as_mapping("select id, concat(code, ': ', title) as label from session where id_type = $regular_session_id and id_workshop = " . $author['id_workshop'] . " order by code", "id", "label"); } else if ($author['status'] == 'poster') { $poster_session_id = mysql_fetch_first_value('select id from session_type where title="Poster"'); $sessions = mysql_fetch_as_mapping("select id, concat(code, ': ', title) as label from session where (id_type = $regular_session_id and id_workshop = " . $author['id_workshop'] . ") or (id_type = $poster_session_id) order by code", "id", "label"); } else if ($author['status'] == 'invited') { $sessions = mysql_fetch_as_mapping("select id, concat(code, ': ', title) as label from session order by code", "id", "label"); } $current_session_id = mysql_fetch_first_value("select id_session from session_schedule_regular where id_author=$id"); echo "
"; echo "

Session: " . "

\n"; echo "
"; } $themes = mysql_fetch_as_array("select theme.theme from theme, theme_input where theme.id = theme_input.id_theme and theme_input.id_author = $id"); echo "

Themes:

"; echo "

"; foreach ($themes as $theme) { echo "$theme
"; } echo "

"; echo "

Notes: " . $author['notes'] . "

"; echo "

Paper files

"; showPaperFiles("$basedir/$id", '/.*/', 'mtime', TRUE, strtotime("13 February 2005"),''); echo "

Reviews

"; echo ""; $query="select review.id, reviewer.contactname, readability, originality, significance, relevance, overall, recommendation, poster, author_comments, committee_comments, concat('http://www.iccs-meeting.org/papers/review.php?id=', review.id, '&check=', review.check) as url from review, reviewer where review.id_reviewer = reviewer.id and id_author = $id and recommendation > 0"; $result = mysql_query($query); $j=true; echo ""; while ($row = mysql_fetch_array($result)) { $recomm = parse_recomm($row); $j = !$j; echo ""; for ($i=1;$i"; } if (!$j){ echo ""; } } echo "
RevieverRea.Ori.Sig.Rel.Ove.Recomm.Comments for the authorComments for the committee
"; } if ($i == 7) { echo "" . $recomm . ""; } else if ($i == 9 || $i == 10) { echo htmlQuote($row[$i]); } else if ($i == 11) { echo "Original review..."; } else { echo $row[$i]; } echo "
"; return $author; } function parse_status($status) { if ($status == 'review') return "review"; else if ($status == 'rejected') return "Rejected"; else if ($status == 'oral') return "Oral"; else if ($status == 'poster') return "Poster"; else if ($status == 'denied') return "Denied"; else return "$status"; } function parse_recomm($review) { $nr = $review['Recommendation']; if ($nr == 1) $recomm = 'Reject'; elseif ($nr == 2) $recomm = 'Marginal'; elseif ($nr == 3) $recomm = 'Accept'; elseif ($nr == 4) $recomm = 'Strong Accept'; if ($review['poster'] == 'yes') $recomm .= ' (poster)'; } function makeUnbreakable($string) { return str_replace(" ", " ", $string); } /* CLASS OpenSSL A wrapper class for a simple subset of the PHP OpenSSL functions. Use for public key encryption jobs. === Includes source code from many contributors to the PHP.net manual === ....usage examples below.... Alex Poole 2004 php ~at~ wwwcrm.com */ //DEFINE("OPEN_SSL_CONF_PATH", "ssl/openssl.cnf");//point to your config file DEFINE("OPEN_SSL_CERT_DAYS_VALID", 365);//1 year DEFINE("OPEN_SSL_IS_FILE", 1); class OpenSSL{ var $privatekey; //resource or string private key var $publickey; //ditto public var $plaintext; var $crypttext; var $ekey; //ekey - set by encryption, required by decryption var $privkeypass; //password for private key var $csr; //certificate signing request string generated with keys var $config; function OpenSSL(){ //$this->config = array("config" => OPEN_SSL_CONF_PATH); } function readf($path){ //return file contents $fp=fopen($path,"r"); $ret=fread($fp,8192); fclose($fp); return $ret; } //privatekey can be text or file path function set_privatekey($privatekey, $isFile=0, $key_password=""){ if ($key_password) $this->privkeypass=$key_password; if ($isFile)$privatekey=$this->readf($privatekey); $this->privatekey=openssl_get_privatekey($privatekey, $this->privkeypass); } //publickey can be text or file path function set_publickey($publickey, $isFile=0){ if ($isFile)$publickey=$this->readf($publickey); $this->publickey=openssl_get_publickey($publickey); } function set_ekey($ekey){ $this->ekey=$ekey; } function set_privkeypass($pass){ $this->privkeypass=$pass; } function set_plain($txt){ $this->plaintext=$txt; } function set_crypttext($txt){ $this->crypttext=$txt; } function encrypt($plain=""){ if ($plain) $this->plaintext=$plain; openssl_seal($this->plaintext, $this->crypttext, $ekey, array($this->publickey)); $this->ekey=$ekey[0]; } function decrypt($crypt="", $ekey=""){ if ($crypt)$this->crypttext=$crypt; if ($ekey)$this->ekey=$ekey; openssl_open($this->crypttext, $this->plaintext, $this->ekey, $this->privatekey); } function get_plain(){ return $this->plaintext; } function get_crypt(){ return $this->crypttext; } function get_ekey(){ return $this->ekey; } function get_privatekey(){ return $this->privatekey; } function get_privkeypass(){ return $this->privkeypass; } function get_publickey(){ return $this->publickey; } } /* Script Name: Simple 'if' PHP Browser detection Author: Harald Hope, Website: http://TechPatterns.com/ Script Source URI: http://TechPatterns.com/downloads/php_browser_detection.php Version 2.0.0 Copyright (C) 23 March 2004 Special thanks to Tapio Markula, for his ideas of creating a useable php browser detector. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. Lesser GPL license text: http://www.gnu.org/licenses/lgpl.txt Coding conventions: http://cvs.sourceforge.net/viewcvs.py/phpbb/phpBB2/docs/codingstandards.htm?rev=1.3 */ /* the order is important, because opera must be tested first, and ie4 tested for before ie general same for konqueror, then safari, then gecko, since safari navigator user agent id's with 'gecko' in string. note that $dom_browser is set for all modern dom browsers, this gives you a default to use, unfortunately we haven't figured out a way to do this with actual method testing, which would be much better and reliable. Please note: you have to call the function in order to get access to the variables, you call it by this: browser_detection('browser'); then put you code that you want to use the variables with after that. */ function browser_detection( $which_test ) { // initialize the variables $browser = ''; $dom_browser = ''; // set to lower case to avoid errors $navigator_user_agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); // run through the main browser possibilities, assign them to the main $browser variable if (stristr($navigator_user_agent, "opera")) { $browser = 'opera'; $dom_browser = true; } elseif (stristr($navigator_user_agent, "msie 4")) { $browser = 'msie4'; $dom_browser = false; } elseif (stristr($navigator_user_agent, "msie")) { $browser = 'msie'; $dom_browser = true; } elseif ((stristr($navigator_user_agent, "konqueror")) || (stristr($navigator_user_agent, "safari"))) { $browser = 'safari'; $dom_browser = true; } elseif (stristr($navigator_user_agent, "gecko")) { $browser = 'mozilla'; $dom_browser = true; } elseif (stristr($navigator_user_agent, "mozilla/4")) { $browser = 'ns4'; $dom_browser = false; } else { $dom_browser = false; $browser = false; } // return the test result you want if ( $which_test == 'browser' ) { return $browser; } elseif ( $which_test == 'dom' ) { return $dom_browser; // note: $dom_browser is a boolean value, true/false, so you can just test if // it's true or not. } } ?>