setBasedir($tmpldir); return true; } function Template() { global $template; return $template; } function FilteringInit() { global $filter; $filter = new InputFilter(); return true; } function Filtering() { global $filter; return $filter; } function InputFilter($input="") { $filter = Polerio::Filtering(); $ret = $filter->process($input); return $ret; } function DBInit() { // Get database parameters global $config; $dbtype = $config['dbtype']; $dbhost = $config['dbhost']; $dbname = $config['dbname']; $dbuname = $config['dbuname']; $dbpass = $config['dbpass']; // Database connection is a global (for now) global $dbconn; // Start connection $dbconn = ADONewConnection($dbtype); $dbh = $dbconn->PConnect($dbhost, $dbuname, $dbpass, $dbname); if (!$dbh) { $dbpass = ""; die("$dbtype://$dbuname:$dbpass@$dbhost/$dbname failed to connect" . $dbconn->ErrorMsg()); } global $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_NUM; // force oracle to a consistent date format for comparison methods later on if (strcmp($dbtype, 'oci8') == 0) { $dbconn->Execute("alter session set NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'"); } return true; } /** * get a list of database connections * @returns array * @redturn array of database connections */ function DBGetConn() { global $dbconn; return array($dbconn); } function DBGetTables() { global $table; return $table; } function PhpMyLibrary() { global $site_footer; $some = ""; return $site_footer[1]."

"; } function Mail($recipient="", $subject="", $body="", $headers="") { mail($recipient, $subject, $body, $headers); } function GetBrowser() { /* Get the Browser data */ if((ereg("Nav", getenv("HTTP_USER_AGENT"))) || (ereg("Gold", getenv("HTTP_USER_AGENT"))) || (ereg("X11", getenv("HTTP_USER_AGENT"))) || (ereg("Mozilla", getenv("HTTP_USER_AGENT"))) || (ereg("Netscape", getenv("HTTP_USER_AGENT"))) AND (!ereg("MSIE", getenv("HTTP_USER_AGENT"))) AND (!ereg("Konqueror", getenv("HTTP_USER_AGENT")))) $browser = "Netscape"; // Opera needs to be above MSIE as it pretends to be an MSIE clone elseif(ereg("Opera", getenv("HTTP_USER_AGENT"))) $browser = "Opera"; elseif(ereg("MSIE", getenv("HTTP_USER_AGENT"))) $browser = "MSIE"; elseif(ereg("Lynx", getenv("HTTP_USER_AGENT"))) $browser = "Lynx"; elseif(ereg("WebTV", getenv("HTTP_USER_AGENT"))) $browser = "WebTV"; elseif(ereg("Konqueror", getenv("HTTP_USER_AGENT"))) $browser = "Konqueror"; elseif((eregi("bot", getenv("HTTP_USER_AGENT"))) || (ereg("Google", getenv("HTTP_USER_AGENT"))) || (ereg("Slurp", getenv("HTTP_USER_AGENT"))) || (ereg("Scooter", getenv("HTTP_USER_AGENT"))) || (eregi("Spider", getenv("HTTP_USER_AGENT"))) || (eregi("Infoseek", getenv("HTTP_USER_AGENT")))) $browser = "Bot"; else $browser = "Other"; return $browser; } function GetOS() { /* Get the Operating System data */ if(ereg("Win", getenv("HTTP_USER_AGENT"))) $os = "Windows"; elseif((ereg("Mac", getenv("HTTP_USER_AGENT"))) || (ereg("PPC", getenv("HTTP_USER_AGENT")))) $os = "Mac"; elseif(ereg("Linux", getenv("HTTP_USER_AGENT"))) $os = "Linux"; elseif(ereg("FreeBSD", getenv("HTTP_USER_AGENT"))) $os = "FreeBSD"; elseif(ereg("SunOS", getenv("HTTP_USER_AGENT"))) $os = "SunOS"; elseif(ereg("IRIX", getenv("HTTP_USER_AGENT"))) $os = "IRIX"; elseif(ereg("BeOS", getenv("HTTP_USER_AGENT"))) $os = "BeOS"; elseif(ereg("OS/2", getenv("HTTP_USER_AGENT"))) $os = "OS/2"; elseif(ereg("AIX", getenv("HTTP_USER_AGENT"))) $os = "AIX"; else $os = "Other"; return $os; } /* * I've read about microtime() * I think it is more useful than calling the random * The purpose of this is just to make distinct number * Advantage, fixed distance in microtime. rand is not. * srand((double)microtime()*1000000); * return time().rand(); * */ function TimeAndRandom() { $tim = microtime(); $mtime = substr($tim,11,10).substr($tim,2,8); return $mtime; } function CheckEmailPassed($email="") { if (!eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+\\.)+[a-z]{2,4}$", $email)) die ("Invalid Email"); return; } /** * Get a session variable * * @param name $ name of the session variable to get */ function SessionGetVar($name) { if(isset($name) && isset($_SESSION['PMLV' . $name])) { return $_SESSION['PMLV' . $name]; } return false; } /** * Set a session variable * * @param name $ name of the session variable to set * @param value $ value to set the named session variable */ function SessionSetVar($name, $value='') { if (!isset($name)) { return false; } $_SESSION['PMLV' . $name] = $value; return true; } /** * Delete a session variable * * @param name $ name of the session variable to delete * @return success or error */ function SessionDelVar($name) { // if empty or not set in both globals, return if (empty($name) || !(isset($_SESSION['PMLV' . $name]) || !isset($GLOBALS['PMLV' . $name]))){ return false; } // Unset the session var unset($_SESSION['PMLV' . $name]); // This unsets the variable if register globals are on unset($GLOBALS['PMLV' . $name]); return true; } function VarPrepForStore() { $resarray = array(); foreach (func_get_args() as $ourvar) { // Prepare var if (!get_magic_quotes_runtime()) { $ourvar = addslashes($ourvar); } // Add to array array_push($resarray, $ourvar); } // Return vars if (func_num_args() == 1) { return $resarray[0]; } else { return $resarray; } } function Redirect($redirecturl) { if (preg_match('!^http!', $redirecturl)) { // Absolute URL - simple redirect Header("Location: $redirecturl"); return; } else { // Removing leading slashes from redirect url $redirecturl = preg_replace('!^/*!', '', $redirecturl); // Get base URL $baseurl = Polerio::GetBaseURL(); Header("Location: $baseurl$redirecturl"); } } /* * Added sep 24, 2002 for use in selecting color * returns array bgcolor */ function SelectColor() { global $pmlconfig; if($pmlconfig['PnThOver']!=0) { $bgcolor[3] = $pmlconfig['bgcolor3']; $bgcolor[2] = $pmlconfig['bgcolor2']; $bgcolor[1] = $pmlconfig['bgcolor1']; } else { global $bgcolor1,$bgcolor2,$bgcolor3; $bgcolor[3] = $bgcolor3; $bgcolor[2] = $bgcolor2; $bgcolor[1] = $bgcolor1; } return $bgcolor; } /** * clean user input *
* Gets a global variable, cleaning it up to try to ensure that * hack attacks don't work * @param var name of variable to get * @param ... * @returns string/array * @return prepared variable if only one variable passed * in, otherwise an array of prepared variables */ function VarCleanFromInput() { $search = array('||si', '||si', '||si', '||si', '||si', '||si', '||si', '|STYLE\s*=\s*"[^"]*"|si'); $replace = array(''); $resarray = array(); foreach (func_get_args() as $var) { // Get var global $$var; if (empty($var)) { return; } $ourvar = $$var; if (!isset($ourvar)) { array_push($resarray, NULL); continue; } if (empty($ourvar)) { array_push($resarray, $ourvar); continue; } // Add to result array array_push($resarray, $ourvar); } // Return vars if (func_num_args() == 1) { return $resarray[0]; } else { return $resarray; } } /* Added some security scripts do elimiante simultaneous send error which * cause to much delete, update, or insert */ /** * generate an authorisation key *
* The authorisation key is used to confirm that actions requested by a * particular user have followed the correct path. Any stage that an * action could be made (e.g. a form or a 'delete' button) this function * must be called and the resultant string passed to the client as either * a GET or POST variable. When the action then takes place it first calls * pnSecConfirmAuthKey() to ensure that the operation has * indeed been manually requested by the user and that the key is valid * * @public * @param modname the module this authorisation key is for (optional) * @returns string * @return an encrypted key for use in authorisation of operations */ function SecGenAuthKey($modname='') { if (empty($modname)) { $modname = Polerio::VarCleanFromInput('module'); } // Date gives extra security but leave it out for now // $key = pnSessionGetVar('rand') . $modname . date ('YmdGi'); $key = Polerio::SessionGetVar('rand') . $modname; // Encrypt key $authid = md5($key); // Return encrypted key return $authid; } /** * confirm an authorisation key is valid *
* See description of pnSecGenAuthKey for information on * this function * @public * @returns bool * @return true if the key is valid, false if it is not */ function SecConfirmAuthKey($authid='') { // Regenerate static part of key $partkey = Polerio::SessionGetVar('rand'); // Not using time-sensitive keys for the moment // // Key life is 5 minutes, so search backwards and forwards 5 // // minutes to see if there is a match anywhere // for ($i=-5; $i<=5; $i++) { // $testdate = mktime(date('G'), date('i')+$i, 0, date('m') , date('d'), date('Y')); // // $testauthid = md5($partkey . date('YmdGi', $testdate)); // if ($testauthid == $authid) { // // Match // // // We've used up the current random // // number, make up a new one // srand((double)microtime()*1000000); // pnSessionSetVar('rand', rand()); // // return true; // } // } if ((md5($partkey)) == $authid) { // Match - generate new random number for next key and leave happy srand((double)microtime()*1000000); Polerio::SessionSetVar('rand', rand()); return true; } // Not found, assume invalid return false; } /** * To activate multi-admin capability * the program should get his/her gid or group id * The uid resides in the session */ function SelectGID() { $id = Polerio::SessionGetVar('uid'); if(empty($id)) $id = 0; $table = Polerio::DBGetTables(); $users = $table['users']; $users_col = $table['users_column']; list($dbconn) = Polerio::DBGetConn(); $sql="select $users_col[gid] from $users where $users_col[uid]=$id"; $result = $dbconn->Execute($sql); list($gid) = $result->fields; return $gid; } function SelectUNAME() { $id = Polerio::SessionGetVar('uid'); if(empty($id)) $id = 0; $table = Polerio::DBGetTables(); $users = $table['users']; $users_col = $table['users_column']; list($dbconn) = Polerio::DBGetConn(); $sql="select $users_col[uname] from $users where $users_col[uid]=$id"; $result = $dbconn->Execute($sql); list($gid) = $result->fields; return $gid; } // ham lay ho va ten cua thu thu function GetHoTen() { $id = Polerio::SessionGetVar('uid'); if(empty($id)) $id = 0; $table = Polerio::DBGetTables(); $users = $table['users']; $users_col = $table['users_column']; list($dbconn) = Polerio::DBGetConn(); $sql="select fname,lname from $users where $users_col[uid]=$id"; $result = $dbconn->Execute($sql); if(!empty($result)) { $hoten = $result->fields[0]." ".$result->fields[1]; } else { $hoten=""; } return $hoten; } function GetUid() { $id = Polerio::SessionGetVar('uid'); return $id; } // taken from php.net // function _make_seed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); } function makePass() { define('_SYLLABELS', "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789"); define('_MAKEPASS_LEN', 8); define('_MAKEPASS_BOX', 5000); // init some $result = ''; mt_srand(Polerio::_make_seed()); $syllabels = _SYLLABELS; $len = strlen($syllabels) - 1; $box = ""; // create box for($i = 0; $i < _MAKEPASS_BOX; $i++) { $ch = $syllabels[mt_rand(0, $len)]; // about 20% upper case letters if (mt_rand(0, $len) % 5 == 1) { $ch = strtoupper($ch); } // filling up the box with random chars $box .= $ch; } // now collect password from box for($i = 0; $i < _MAKEPASS_LEN; $i++) { $result .= $box[mt_rand(0, (_MAKEPASS_BOX - 1))]; } return $result; } // function makePass //================globals.php /** * @version $Id: globals.php 1145 2005-11-20 22:57:55Z Jinx $ * @package Joomla * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * Joomla! is free software and parts of it may contain or be derived from the * GNU General Public License or other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ /** * Use 1 to emulate register_globals = on * * Use 0 to emulate regsiter_globals = off */ /** * Adds an array to the GLOBALS array and checks that the GLOBALS variable is * not being attacked * @param array * @param boolean True if the array is to be added to the GLOBALS */ function checkInputArray( &$array, $globalise=false ) { static $banned = array( '_files', '_env', '_get', '_post', '_cookie', '_server', '_session', 'globals' ); foreach ($array as $key => $value) { if (in_array( strtolower( $key ), $banned ) ) { die( 'Illegal variable ' . implode( ' or ', $banned ) . ' passed to script.' ); } if ($globalise) { $GLOBALS[$key] = $value; } } } /** * Emulates register globals = off */ function unregisterGlobals () { Polerio::checkInputArray( $_FILES ); Polerio::checkInputArray( $_ENV ); Polerio::checkInputArray( $_GET ); Polerio::checkInputArray( $_POST ); Polerio::checkInputArray( $_COOKIE ); Polerio::checkInputArray( $_SERVER ); if (isset( $_SESSION )) { Polerio::checkInputArray( $_SESSION ); } $REQUEST = $_REQUEST; $GET = $_GET; $POST = $_POST; $COOKIE = $_COOKIE; if (isset ( $_SESSION )) { $SESSION = $_SESSION; } $FILES = $_FILES; $ENV = $_ENV; $SERVER = $_SERVER; foreach ($GLOBALS as $key => $value) { if ( $key != 'GLOBALS' ) { unset ( $GLOBALS [ $key ] ); } } $_REQUEST = $REQUEST; $_GET = $GET; $_POST = $POST; $_COOKIE = $COOKIE; if (isset ( $SESSION )) { $_SESSION = $SESSION; } $_FILES = $FILES; $_ENV = $ENV; $_SERVER = $SERVER; } /** * Emulates register globals = on */ function registerGlobals() { Polerio::checkInputArray( $_FILES, true ); Polerio::checkInputArray( $_ENV, true ); Polerio::checkInputArray( $_GET, true ); Polerio::checkInputArray( $_POST, true ); Polerio::checkInputArray( $_COOKIE, true ); Polerio::checkInputArray( $_SERVER, true ); if (isset( $_SESSION )) { Polerio::checkInputArray( $_SESSION, true ); } foreach ($_FILES as $key => $value){ $GLOBALS[$key] = $_FILES[$key]['tmp_name']; foreach ($value as $ext => $value2){ $key2 = $key . '_' . $ext; $GLOBALS[$key2] = $value2; } } } //================pnAPI.php postnuke 02212006 /** * Functions */ /** * get a configuration variable * * @param name $ the name of the variable * @return mixed value of the variable, or false on failure */ function ConfigGetVar($name) { if (!isset($name)) { return null; } if (isset($GLOBALS['polerioconfig'][$name])) { $result = $GLOBALS['polerioconfig'][$name]; } if (!isset($result)) { return null; } return $result; } /** * set a configuration variable * * @param name $ the name of the variable * @param value $ the value of the variable * @return bool true on success, false on failure */ function ConfigSetVar($name, $value='') { $name = isset($name) ? (string)$name : ''; // The database parameter are not allowed to change if (empty($name) || ($name == 'dbtype') || ($name == 'dbhost') || ($name == 'dbuname') || ($name == 'dbpass') || ($name == 'dbname') || ($name == 'system') || ($name == 'prefix') || ($name == 'encoded')) { return false; } // set the variable $GLOBALS['polerioconfig'][$name] = $value; return true; } /** * delete a configuration variable * * @param name $ the name of the variable * @return bool true on success, false on failure */ function ConfigDelVar($name) { if (!isset($name)) { return false; } // The database parameter are not allowed to be deleted if (empty($name) || ($name == 'dbtype') || ($name == 'dbhost') || ($name == 'dbuname') || ($name == 'dbpass') || ($name == 'dbname') || ($name == 'system') || ($name == 'prefix') || ($name == 'encoded')) { return false; } // Update my vars unset($GLOBALS['polerioconfig'][$name]); // success return true; } /** * Gets a server variable * * Returns the value of $name from $_SERVER array. * Accepted values for $name are exactly the ones described by the * {@link http://www.php.net/manual/en/reserved.variables.html#reserved.variables.server PHP manual}. * If the server variable doesn't exist void is returned. * * @author Marco Canini , Michel Dalle * @access public * @param name string the name of the variable * @return mixed value of the variable */ function ServerGetVar($name) { // Check the relevant superglobals if (!empty($name) && isset($_SERVER[$name])) { return $_SERVER[$name]; } return null; // we found nothing here } // Ham lay gia tri udc1 function GetUdc1($id) { $table = Polerio::DBGetTables(); list($dbconn) = Polerio::DBGetConn(); $sql="select udc1 from udc1 where id=".$id; $result = $dbconn->Execute($sql); if(!empty($result)) { $udc1 = $result->fields[0]; } else { $udc1=""; } return $udc1; } // Ham lay udc2 function GetUdc2($id) { $table = Polerio::DBGetTables(); list($dbconn) = Polerio::DBGetConn(); $sql="select udc2 from udc2 where id=".$id; $result = $dbconn->Execute($sql); if(!empty($result)) { $udc2 = $result->fields[0]; } else { $udc2=""; } return $udc2; } // ham lay udc3 function GetUdc3($id) { $table = Polerio::DBGetTables(); list($dbconn) = Polerio::DBGetConn(); $sql="select udc3 from udc3 where id=".$id; $result = $dbconn->Execute($sql); if(!empty($result)) { $udc3 = $result->fields[0]; } else { $udc3=""; } return $udc3; } // Ham sinh so dang ky ca biet ngau nhien function SinhSDKCB($n,$loaisach) { $table = Polerio::DBGetTables(); list($dbconn) = Polerio::DBGetConn(); //$sql = "select substr(sdkcabiet,6) as maso from quanlysach order by length(sdkcabiet) desc, id desc limit 0,1"; $sql ="SELECT substr(sdkcabiet, 6) AS maso FROM quanlysach WHERE length(sdkcabiet)=12 AND substr(sdkcabiet, 1, 2) IN ('GK', 'TK', 'NV') and masotailieu like '".$loaisach."%' ORDER BY substr(sdkcabiet, 6) DESC,id desc LIMIT 0 , 1 "; $result = $dbconn->Execute($sql); $sdkcb=""; if(!empty($result)) { $maso = $result->fields[0]; $maso = intval($maso); $nam = date("y"); for($i=1;$i<=$n;$i++) { $str = $maso +$i; if($str <10) { $code = "000000".$str; } elseif ($str<100) { $code = "00000".$str; } elseif ($str<1000) { $code = "0000".$str; } elseif ($str<10000) { $code = "000".$str; } elseif ($str<100000) { $code = "00".$str; } elseif ($str<1000000) { $code = "0".$str; } else { $code = $str; } $sdkcb .=$loaisach.$nam.".".$code.","; } } else { $nam = date("YY"); for($i=1;$i<=$n;$i++) { $str = $i; if($str <10) { $code = "000000".$str; } elseif ($str<100) { $code = "00000".$str; } elseif ($str<1000) { $code = "0000".$str; } elseif ($str<10000) { $code = "000".$str; } elseif ($str<100000) { $code = "00".$str; } elseif ($str<1000000) { $code = "0".$str; } else { $code = $str; } $sdkcb .=$loaisach.$nam.".".$code.","; } } return $sdkcb; } // Ham lay so dang ky va hien thi SDKCB o dang rut gon function getSDKCB($bookid) { $table = Polerio::DBGetTables(); list($dbconn) = Polerio::DBGetConn(); $sql = "select sdkcabiet from quanlysach where damuon=0 and bookid=$bookid order by id asc "; //echo $sql; $result = $dbconn->Execute($sql); $k=0; while (!$result->EOF) { // mang b la mang luu tru cac so dang ky ca biet $b[$k]=$result->fields[0]; //echo $b[$k]; $k++; $result->MoveNext(); } $a=array(); $i=0; $j=0; // n luu tong so phan tu sdk ca biet $n= count($b); $pre =""; $found_dau = 0; $found_cuoi =0; $dau =""; $cuoi=""; $sdkcbphu=""; // sua ngay 01/07/2007 if($n>1) { for($i=0; $i<$n; $i++) { // xu ly neu ko phai la sdkcb do may sinh ra if(strlen($b[$i])==12) { // echo "phan tu thu". $i." la :".$b[$i]; $pre_temp = substr($b[$i],0,4); $dau_temp = substr($b[$i],5); if($found_dau==0) { // print " da tim thay phan tu dau tien "; $dau=$dau_temp; $pre = $pre_temp; } // echo "pre la: ".$pre."dau la ".$dau; // echo "dau la:".$dau; if(strcmp($pre_temp,substr($b[$i+1],0,4))==0) { //echo "pre bang nhau"; if((intval(substr($b[$i],5))+1)==intval(substr($b[$i+1],5))) { $found_dau=1; } else { //echo "khong lien tiep"; $cuoi = substr($b[$i],5); $found_cuoi =1; } } else { // pre khac nhau $found_cuoi=1; $cuoi = substr($b[$i],5); } // Kiem tra neu la phan tu cuoi cung thi ket thuc tim kiem if($i==$n-1) { $cuoi = substr($b[$i],5); $found_cuoi=1; } //echo "cuoi la:".$cuoi; if($found_cuoi==1||$i==$n-1) { //echo "da tim thay phan tu ket thuc cua chuoi"; $a[$j]["pre"]=$pre; $a[$j]["dau"]=$dau; $a[$j]["cuoi"]=$cuoi; $j++; $found_cuoi=0; $found_dau=0; } } else { // luu tru cac sdk ca biet do thu thu go vao $sdkcbphu .=$b[$i].", "; } } // Xu ly ket qua hien thi sdkcb //echo "Bat dau view ket qua ra"; $sdkcb=""; $n = count($a); //echo $n; $pre=""; $found=0; for($i=0; $i<$n;$i++) { //echo "dau la: ".$a[$i]["dau"]; if($found==0) { $pre = $a[$i]["pre"]; if(strcmp($a[$i]["dau"],$a[$i]["cuoi"])==0) { $sdkcb.=$pre.".(".$a[$i]["dau"]; } else { $sdkcb.=$a[$i]["pre"].".(".$a[$i]["dau"]."...".$a[$i]["cuoi"]; } } if($found==1) { if(strcmp($a[$i]["dau"],$a[$i]["cuoi"])==0) { $sdkcb.=", ".$a[$i]["dau"]; } else { $sdkcb.=", ".$a[$i]["dau"]."...".$a[$i]["cuoi"]; } } if(strcmp($a[$i]["pre"],$a[$i+1]["pre"])==0) { $found=1; } else { $sdkcb.="), "; $found=0; } } $sdkcb = substr($sdkcb,0,strlen($sdkcb)-2); if(strlen($sdkcbphu)>=2) { $sdkcbphu =substr($sdkcbphu,0,strlen($sdkcbphu)-2); if(strlen($sdkcb)>1) { $sdkcb = $sdkcb.", ".$sdkcbphu; } else { $sdkcb = $sdkcbphu; } } //echo $sdkcb; } else { $sdkcb = $b[0]; } return $sdkcb; } // A ngay 30/06/2007 Ham lay so dang ky ca biet de hien thi het khong hien thi dang rut gon function getSDKCB_1($bookid) { $table = Polerio::DBGetTables(); list($dbconn) = Polerio::DBGetConn(); $sql = "select sdkcabiet from quanlysach where damuon=0 and bookid=$bookid order by id asc "; //echo $sql; $rs = $dbconn->Execute($sql); $sdkcabiet=""; if($rs) { while (!$rs->EOF) { $sdkcabiet .=$rs->fields[0].", "; $rs->MoveNext(); } } if($sdkcabiet!="") { $sdkcabiet = substr($sdkcabiet,0,strlen($sdkcabiet)-2); } return $sdkcabiet; } // Ham thong ke so luong sach hien dang co trong thu vien function TKSLSach($bookid) { $table = Polerio::DBGetTables(); list($dbconn) = Polerio::DBGetConn(); $sql = "select count(*) as soluong from quanlysach where damuon=0 and bookid=$bookid order by id asc "; //echo $sql; $rs = $dbconn->Execute($sql); $sl=0; if($rs) { $sl = $rs->fields[0]; } return $sl; } // Them ngay 01/07/2007 function GetTenUdc1($id) { $table = Polerio::DBGetTables(); list($dbconn) = Polerio::DBGetConn(); $sql="select mota from udc1 where udc1=".$id; $result = $dbconn->Execute($sql); if(!empty($result)) { $tenudc1 = $result->fields[0]; } else { $tenudc1=""; } return $tenudc1; } function GetTenUdc2($id) { $table = Polerio::DBGetTables(); list($dbconn) = Polerio::DBGetConn(); $sql="select mota from udc2 where udc2=".$id; $result = $dbconn->Execute($sql); if(!empty($result)) { $tenudc2 = $result->fields[0]; } else { $tenudc2=""; } return $tenudc2; } function GetTenUdc3($id) { $table = Polerio::DBGetTables(); list($dbconn) = Polerio::DBGetConn(); $sql="select mota from udc3 where udc3=".$id; $result = $dbconn->Execute($sql); if(!empty($result)) { $tenudc3 = $result->fields[0]; } else { $tenudc3=""; } return $tenudc3; } // ham kiem tra trung sdkcb function TrungDKCB($sdkcb) { $table = Polerio::DBGetTables(); $sdkcb = trim($sdkcb); list($dbconn) = Polerio::DBGetConn(); $sql="select sdkcabiet from quanlysach where sdkcabiet='".$sdkcb."'"; //echo $sql; $result = $dbconn->Execute($sql); $found = 0; if(!empty($result)) { $count = $result->RecordCount(); } else { $count=0; } if($count>0) { $found= 1; } else { $found = 0; } return $found; } } //end class Polerio ?> ","Polerio",$beforeloop); $start_pos=0;$end_pos=(count($RowValue)); for($i=$start_pos;$i<$end_pos;$i++) { $thisline = "$listloop\r\n"; $s_pos=0;$e_pos=count($RowName); for($j=$s_pos;$j<$e_pos;$j++) { $thisline = str_replace($RowName[$j],@$RowValue[$i][$j],$thisline); } $msglist .= $thisline; } // end for $msglist .= $afterloop; $tcontent = substr($tcontent,0,$startlist).$msglist.substr($tcontent,$endlist,strlen($tcontent)); // end loopings return $tcontent; } function ConverToSpace($LoadTemplate="", $varStatic="") { $startvarStatic = "pol::".$varStatic; $endvarStatic = "qol::".$varStatic; $startnolist = strpos($LoadTemplate,$startvarStatic); $endnolist = strpos($LoadTemplate,$endvarStatic)+strlen($startvarStatic); $nomessageslinetoreplace = substr($LoadTemplate,$startnolist,$endnolist+strlen($startvarStatic)); $LoadTemplate = str_replace($nomessageslinetoreplace,"",$LoadTemplate); return $LoadTemplate; } // Internal Time computation function polMicrotime() { $mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = (double)($mtime[1]) + (double)($mtime[0]); return ($mtime); } } ?> ".$file_error[$int].": ".$var; return; } } ?>offset = ""; } function HeaderOpen() { $Header = ""; } function Login() { ?>
 Pi
Tài khoản : 
Mật khẩu : 
Lưu thông tin
   PhpMyLibrary 1.0.4b "; return; } function print_query($file="") { global $pmlconfig; global $searchableflds; if($pmlconfig['PnThOver']!=0) { $pmlbgcolor3 = $pmlconfig['bgcolor3']; $pmlbgcolor2 = $pmlconfig['bgcolor2']; $pmlbgcolor1 = $pmlconfig['bgcolor1']; } else { global $bgcolor1,$bgcolor2,$bgcolor3; $pmlbgcolor3 = $bgcolor3; $pmlbgcolor2 = $bgcolor2; $pmlbgcolor1 = $bgcolor1; } $getmoduleurl = Polerio::GetModuleURL(); $pmlsearchquery = _PMLSEARCHQUERY; $pmlany = _PMLANY; $pmlauthor = $searchableflds[1][0]; // if you want to translate this, go to polerio/module/config/conf.php $pmltitle = $searchableflds[2][0]; $pmlsubject = $searchableflds[3][0]; $pmlpublisher = $searchableflds[4][0]; $pmlnotes = $searchableflds[5][0]; $pmlabstract = ''.@$searchableflds[6][0].'  '; if (empty($searchableflds[6][0])) $pmlabstract = ''; $pmlsearch = _PMLSEARCH; $pmlsearchfor = _PMLSEARCHFOR; $pmlclearsearch = _PMLCLEARSEARCH; $pmlmediatype = _PMLMEDIATYPE; $pmlbooks = _PMLBOOKS; $pmlserials = _PMLSERIALS; $pmlmaps = _PMLMAPS; $pmlmusic = _PMLMUSIC; $pmlvisualmaterial = _PMLVISUALMATERIAL; $pmlcomputerfiles = _PMLCOMPUTERFILES; $pmlmixedmaterial = _PMLMIXEDMATERIAL; $pmlthesis = _PMLTHESIS; $pmllogical = _PMLLOGICAL; $pmland = _PMLAND; $pmlor = _PMLOR; $pmlnot = _PMLNOT; $pmllimit = _PMLLIMIT; global $library_type; $data = array(); $sel = ''; while (list($key1, $value1) = each ($library_type)) { while (list($key2, $value2) = each ($value1)) { $a = 1; } $sel = $sel.''; } $selectbranch = '  '; $authid = Polerio::SecGenAuthKey(); $template = polTemplate::LoadTemplate(Polerio::GetModuleURI().'templates/search.html'); $vars = array("pol::getmoduleurl","pol::pmlsearchquery","pol::pmlany","pol::pmlauthor", "pol::pmltitle","pol::pmlsubject","pol::pmlpublisher","pol::pmlnotes","pol::pmlabstract", "pol::pmlsearch","pol::pmlsearchfor","pol::pmlsearchfor","pol::pmlclearsearch", "pol::pmlbooks","pol::pmlserials","pol::pmlmaps","pol::pmlmusic", "pol::pmlvisualmaterial","pol::pmlcomputerfiles","pol::pmlmixedmaterial","pol::pmlthesis", "pol::pmlmediatype","pol::pmllogical","pol::pmland","pol::pmlor","pol::pmlnot","pol::pmllimit", "pol::pmlbgcolor1","pol::pmlbgcolor2","pol::pmlbgcolor3","pol::authid" ); $vals = array("$getmoduleurl","$pmlsearchquery","$pmlany","$pmlauthor", "$pmltitle","$pmlsubject","$pmlpublisher","$pmlnotes","$pmlabstract", "$pmlsearch","$pmlsearchfor","$pmlsearchfor","$pmlclearsearch", "$pmlbooks","$pmlserials","$pmlmaps","$pmlmusic", "$pmlvisualmaterial","$pmlcomputerfiles ","$pmlmixedmaterial","$pmlthesis", "$pmlmediatype","$pmllogical","$pmland","$pmlor","$pmlnot","$pmllimit", "$pmlbgcolor1","$pmlbgcolor2","$pmlbgcolor3","$authid" ); $template = polTemplate::ReplaceStatic($template, $vars, $vals); return $template; } function sql_generator ($keywords="",$Media="",$Heading="",$Operator="",$offset="",$limit="",$mode="") { global $conf; global $pmlconfig; global $encodingtype; list($dbconn) = Polerio::DBGetConn(); $table = Polerio::DBGetTables(); if($Operator=="NOT") $NOT = "NOT"; else $NOT=''; //print"sql_gen key $keywords, med $Media, hea $Heading, ope $Operator, off $offset, lim $limit"; // Heading evaluation to produce tbl to search start if($Heading==0) { $tablea= $table['tblanyindex']; $tableb = $table['tblanybibrelation']; $tablea_col= &$table['tblanyindex_column']; $tableb_col = &$table['tblanybibrelation_column']; } elseif($Heading==1) { $tablea= $table['tblauthorindex']; $tableb = $table['tblauthorbibrelation']; $tablea_col= &$table['tblauthorindex_column']; $tableb_col = &$table['tblauthorbibrelation_column']; } elseif($Heading==2) { $tablea= $table['tbltitleindex']; $tableb = $table['tbltitlebibrelation']; $tablea_col= &$table['tbltitleindex_column']; $tableb_col = &$table['tbltitlebibrelation_column']; } elseif($Heading==3) { $tablea= $table['tblsubjectindex']; $tableb = $table['tblsubjectbibrelation']; $tablea_col= &$table['tblsubjectindex_column']; $tableb_col = &$table['tblsubjectbibrelation_column']; } elseif($Heading==4) { $tablea= $table['tblpublisherindex']; $tableb = $table['tblpublisherbibrelation']; $tablea_col= &$table['tblpublisherindex_column']; $tableb_col = &$table['tblpublisherbibrelation_column']; } elseif($Heading==5) { $tablea= $table['tblnotesindex']; $tableb = $table['tblnotesbibrelation']; $tablea_col= &$table['tblnotesindex_column']; $tableb_col = &$table['tblnotesbibrelation_column']; } elseif($Heading==6) { $tablea= $table['tblabstractindex']; $tableb = $table['tblabstractbibrelation']; $tablea_col= &$table['tblabstractindex_column']; $tableb_col = &$table['tblabstractbibrelation_column']; } $tablec = $table['tblbib']; $tablec_col = $table['tblbib_column']; // Heading evaluation to produce tbl to search end // Media evaluation to produce what category i.e book to search start if($Media==0) { $catid="0"; } elseif($Media==1) { $catid="1"; } elseif($Media==2) { $catid="2"; } elseif($Media==3) { $catid="3"; } elseif($Media==4) { $catid="4"; } elseif($Media==5) { $catid="5"; } elseif($Media==6) { $catid="6"; } elseif($Media==7) { $catid="7"; } elseif($Media==8) { $catid="8"; } elseif($Media==9) { $catid="9"; } // Media evaluation to produce what category i.e book to search stop $limits = "LIMIT $offset,$limit"; $tblbib = $conf['table']['marc']; $catid = "= $Media"; //print"current mode is $mode"; if($Media > 0) $webpac_total_cat_id = "AND catid = $Media"; if($mode=="catalog_stats") { $sql = "SELECT * FROM $tblbib WHERE (approved = 1) AND catid $catid "; } elseif($mode=="webpac_total") { $sql = "SELECT id FROM $table WHERE (approved = 1) $webpac_total_cat_id ORDER BY id "; } elseif($mode=="catalog_browse") { $sql = "SELECT id, marc, catid, approved FROM $tblbib WHERE (approved = 1) AND catid $catid ORDER BY id $limits"; } elseif($mode=="catalog_total") { $sql = "SELECT id FROM $table WHERE (approved = 1) AND catid $catid"; } elseif($mode=="catalog_search") { //print"this is $offset "; if(empty($offset)) { $limits = "LIMIT 0,$limit"; } else { $limits = "LIMIT $offset,$limit"; } if(empty($limit)) { $limits=""; } $DEBUG = "\n"; // set DEBUG == "\n" to see this query $keywordsforabstracts = $keywords; $keywords = trim(urldecode($keywords)); $keywords = ereg_replace("([ ]+)"," ",$keywords); if(!ereg(" ",$keywords)) { // Only 1 keyword $KeyWords[0] = "$keywords"; } else { $KeyWords = explode(" ",$keywords); } if($Media==0) { $Med = "($tablec_col[approved] = 1) "; if(Phpmylibrary::IsLoggedIn()) $Med = "($tablec_col[approved] = '0' OR $tablec_col[approved] = '1') "; } else { $Med = "($tablec_col[approved] = 1) AND ($tablec_col[catid] = $Media)"; if(Phpmylibrary::IsLoggedIn()) $Med = "($tablec_col[approved] = 1 OR $tablec_col[approved] = 0) AND ($tablec_col[catid] = $Media)"; } $sql = "SELECT DISTINCT $tablec_col[id], $tablec_col[marc], $tablec_col[catid], $tablec_col[accessid], $tablec_col[approved] FROM $tablea, $tableb, $tablec WHERE $DEBUG ( "; $count = count($KeyWords); if( $count == 1 && $Heading!=5) { $single = $KeyWords[0]; // discard if keyword length is < 4 if(strlen($single) < $pmlconfig['keyword_length']) { return false; } $sql .= " ( $tablea_col[any] $NOT LIKE '%$single%') AND ($tableb_col[anyid]=$tablea_col[id]) AND ($tablec_col[id]=$tableb_col[bibid]) AND $Med ) ORDER by $tablec_col[id] $limits $DEBUG "; } elseif( $Heading== 6 ) // meaning this is abstract { $single = $keywordsforabstracts; // discard if keyword length is < 4 if(strlen($single) < $pmlconfig['keyword_length']) { return false; } $sql .= " ( MATCH $tablea_col[any] AGAINST ('$single')) AND ($tableb_col[anyid]=$tablea_col[id]) AND ($tablec_col[id]=$tableb_col[bibid]) AND $Med ) ORDER by $tablec_col[id] $limits $DEBUG "; } else { $ticker = 0; while ( list ($key,$word) = each ($KeyWords) ) { if($Operator=="NOT") { $Operator = "AND NOT"; } $ticker++; if(!empty($word)) { if($ticker != $count) { if(strlen($word) < $pmlconfig[keyword_length]) { return false; } $sql .= "($tablea_col[any] LIKE '%$word%' ) AND ($tableb_col[anyid]=$tablea_col[id]) AND ($tablec_col[id]=$tableb_col[bibid]) $Operator $DEBUG "; } else { // Last condition, omit the trailing OR $sql .= " ($tablea_col[any] LIKE '%$word%') AND ($tableb_col[anyid]=$tablea_col[id]) AND ($tablec_col[id]=$tableb_col[bibid]) $DEBUG "; } } } $sql .= " ) AND $Med ORDER BY $tablec_col[id] $limits $DEBUG"; } /*if(!empty($DEBUG)) { echo "
$sql\nTicker [$ticker]\nCount [$count]
\n"; }*/ } //$results = $this->select($sql); //print"$sql"; return $sql; } function Marc($selected_tbl="") { $table = Polerio::DBGetTables(); list($dbconn) = Polerio::DBGetConn(); $tblbib = $table['tblbib']; $tblbib_col = $table['tblbib_column']; $i=0; $zipmarc = ""; while($i <= (count($selected_tbl)-1)) { $query = "SELECT * FROM $tblbib WHERE $tblbib_col[id]=$selected_tbl[$i]"; $recordSet = $dbconn->Execute($query); $row = $recordSet->fields; $zipmarc .= $row[1].chr(29); $i++; } return $zipmarc; } function View($selected_tbl="") { $table = Polerio::DBGetTables(); list($dbconn) = Polerio::DBGetConn(); $tblbib = $table['tblbib']; $tblbib_col = $table['tblbib_column']; include_once Polerio::GetModuleURI().'/lib/marcdefs.php'; $total = count($selected_tbl); $j=0; $viewmarc = ""; $row = array(); while($j <= (count($selected_tbl)-1)) { $query = "SELECT * FROM $tblbib WHERE $tblbib_col[id]=$selected_tbl[$j]"; $recordSet = $dbconn->Execute($query); list($id, $content, $catid, $approved ) = $recordSet->fields; $marc_field_explode = explode(chr(30),$content); $marc_field_explode_count = count($marc_field_explode); $i = 1; $tags_i = 1; $marc_fields_count = ((strlen($marc_field_explode[0])-24)/12); $rj = 0; $_j = 0; while ( $i <= $marc_fields_count) { $tags = substr($marc_field_explode[0],23,strlen($marc_field_explode[0])); $tags = substr($tags,$tags_i,3); $tag_value = $marc_field_explode[$i]; $tag_value = ereg_replace(31,"$",$tag_value); $tags_i = $tags_i + 12; $ktag[$rj] = $tags; $tag_names[$i] = @$tag_name[$ktag[$rj]]; $tag_content[$i] = Phpmylibrary::convertit($tag_value); $tag_name_marc[$i] = $tags; $tag_content_marc[$i] = $tag_value; $i++; } $_j = $_j+1; $viewmarc .= ""._PMLRECORDNO.". $_j "._PMLOF." $total
"; $viewmarc .= ''; $total_fields = count($tag_names); $i=1; while($i <= $total_fields) { $bcolor = "ffffff"; if($tag_names[$i]) $viewmarc .= ""; $i++; } $viewmarc .= "
$tag_names[$i]    $tag_content[$i]


"; $j++; } return $viewmarc; } function convertit2($text="") { $x = $text; $ptext = substr($text,2,strlen($text)-2); $etext = explode('^',$ptext); $ctext = count($etext); $i = 0; $text2 = " "; while ($i < $ctext) { $text2 = $text2.' '.substr($etext[$i],1,strlen($etext[$i])-1); $i++; } return substr($text2, 3, strlen($text2)); } function ViewPrintPreview($selected_tbl="") { $table = Polerio::DBGetTables(); list($dbconn) = Polerio::DBGetConn(); $tblbib = $table['tblbib']; $tblbib_col = $table['tblbib_column']; include_once Polerio::GetModuleURI().'/lib/marcdefs.php'; $total = count($selected_tbl); $j=0; $viewmarc = ""; $row = array(); $data = array(); while($j <= (count($selected_tbl)-1)) { $query = "SELECT * FROM $tblbib WHERE $tblbib_col[id]=$selected_tbl[$j]"; $recordSet = $dbconn->Execute($query); list($id, $content, $catid, $approved ) = $recordSet->fields; $marc_field_explode = explode(chr(30),$content); $marc_field_explode_count = count($marc_field_explode); $i = 1; $tags_i = 1; $marc_fields_count = ((strlen($marc_field_explode[0])-24)/12); $rj = 0; $_j = 0; $accno = ''; while ( $i <= $marc_fields_count) { $tags = substr($marc_field_explode[0],23,strlen($marc_field_explode[0])); $tags = substr($tags,$tags_i,3); $mytags = $tags; $tag_value = $marc_field_explode[$i]; $tag_value = ereg_replace(31,"$",$tag_value); $tags_i = $tags_i + 12; $ktag[$rj] = $tags; $tag_names[$i] = @$tag_name[$ktag[$rj]]; $tag_content[$i] = Phpmylibrary::convertit($tag_value); $tag_name_marc[$i] = $tags; $tag_content_marc[$i] = $tag_value; $tagtag[$mytags] = $tag_value; $i++; $author = Phpmylibrary::convertit2($tagtag['100']); $title = Phpmylibrary::convertit2($tagtag['245']); if ($tags=='949') $accno = $accno.' '.Phpmylibrary::convertit2($tagtag['949']); $calln = Phpmylibrary::convertit2($tagtag['082']); $subject = Phpmylibrary::convertit2($tagtag['650']); //$subject1 = $subject1."\n".$subject; } $authtitle = "$author $title"; $newar = array('no'=>$j+1,'accno'=>$accno,'calln'=>$calln,'author'=>$author,'authtitle'=>$authtitle,'subject'=>$subject); array_push($data, $newar); $_j = $_j+1; $j++; } return $data; } function ViewCatalogPreview($selected_tbl="") { $table = Polerio::DBGetTables(); list($dbconn) = Polerio::DBGetConn(); $tblbib = $table['tblbib']; $tblbib_col = $table['tblbib_column']; include_once Polerio::GetModuleURI().'/lib/marcdefs.php'; $total = count($selected_tbl); $j=0; $viewmarc = ""; $row = array(); while($j <= (count($selected_tbl)-1)) { $query = "SELECT * FROM $tblbib WHERE $tblbib_col[id]=$selected_tbl[$j]"; $recordSet = $dbconn->Execute($query); list($id, $content, $catid, $approved ) = $recordSet->fields; $marc_field_explode = explode(chr(30),$content); $marc_field_explode_count = count($marc_field_explode); $i = 1; $tags_i = 1; $marc_fields_count = ((strlen($marc_field_explode[0])-24)/12); $rj = 0; $_j = 0; while ( $i <= $marc_fields_count) { $tags = substr($marc_field_explode[0],23,strlen($marc_field_explode[0])); $tags = substr($tags,$tags_i,3); $tag_value = $marc_field_explode[$i]; $tag_value = ereg_replace(31,"$",$tag_value); $tags_i = $tags_i + 12; $ktag[$rj] = $tags; $tag_names[$i] = @$tag_name[$ktag[$rj]]; $tag_content[$i] = Phpmylibrary::convertit($tag_value); $tag_name_marc[$i] = $tags; $tag_content_marc[$i] = $tag_value; $i++; } $_j = $_j+1; $viewmarc .= ""._PMLRECORDNO.". $_j "._PMLOF." $total
"; $viewmarc .= ''; $total_fields = count($tag_names); $i=1; while($i <= $total_fields) { $bcolor = "ffffff"; if($tag_names[$i]) $viewmarc .= ""; $i++; } $viewmarc .= "
$tag_names[$i]    $tag_content[$i]


"; $j++; } return $viewmarc; } function Viewnohtml($selected_tbl="") { $table = Polerio::DBGetTables(); $tblbib = $table['tblbib']; $tblbib_col = $table['tblbib_column']; include_once Polerio::GetModuleURI().'/lib/marcdefs.php'; list($dbconn) = Polerio::DBGetConn(); $total = count($selected_tbl); $j=0; $viewmarc .= "\r\n"; $viewmarc .= "\r\n"; $viewmarc .= "\r\n"; $viewmarc .= "\r\n"; $viewmarc .= "--------------------------------------"; $viewmarc .= "--------------------------------------"; $viewmarc .= "\r\n"; $viewmarc .= "\r\n"; while($j <= (count($selected_tbl)-1)) { $query = "SELECT * FROM $tblbib WHERE $tblbib_col[id]=$selected_tbl[$j]"; $recordSet = $dbconn->Execute($query); $row = $recordSet->fields; $id = $row[0]; $content = $row[1]; $catid = $row[2]; $approved = $row[3]; $marc_field_explode = explode(chr(30),$content); $marc_field_explode_count = count($marc_field_explode); $i = 1; $tags_i = 1; $marc_fields_count = ((strlen($marc_field_explode[0])-24)/12); $rj = 0; while ( $i <= $marc_fields_count) { $bib = $bibid; $tags = substr($marc_field_explode[0],23,strlen($marc_field_explode[0])); $tags = substr($tags,$tags_i,3); $tag_value = $marc_field_explode[$i]; $tag_value = ereg_replace(31,"$",$tag_value); $tags_i = $tags_i + 12; $ktag[$rj] = $tags; $tag_names[$i] = $tag_name[$ktag[$rj]]; //$tag_name[$i] = Phpmylibrary::get_tag_name($tags); $tag_content[$i] = Phpmylibrary::convertit($tag_value); $tag_name_marc[$i] = $tags; $tag_content_marc[$i] = $tag_value; $i++; } $_j = $_j+1; $viewmarc .= "\r\n"; $viewmarc .= ""._PMLRECORDNO.". $id "._PMLRESULT." $_j "._PMLOF." $total\r\n\r\n"; $total_fields = count($tag_names); $i=1; while($i <= $total_fields) { $bcolor = Polerio::useColora(); if($tag_names[$i]) $viewmarc .= "$tag_names[$i]: $tag_content[$i]\r\n\r\n"; $i++; } $viewmarc .= "\r\n"; $viewmarc .= "--------------------------------------"; $viewmarc .= "--------------------------------------"; $viewmarc .= "\r\n"; $j++; } $viewmarc .= "\r\n"; $viewmarc .= "Polerio::PhpMyLibrary "; $viewmarc .= "\r\n"; $viewmarc .= "\r\n"; return $viewmarc; } // function to convert $a's with space start function convertit($text="") { $x = $text; $ptext = substr($text,2,strlen($text)-2); $etext = explode("^",$ptext); $ctext = count($etext); $i = 0; $text2 = " "; while ($i < $ctext) { $text2 = $text2.' '.substr($etext[$i],1,strlen($etext[$i])-1); $i++; } return $text2; } function IsLoggedIn($msg="") { global $pmlconfig; if(Polerio::SessionGetVar('uid') >= 2 ) { if(empty($msg)) { return Polerio::SessionGetVar('uid'); } else { //$stress = "$msg : "._PMLYOUMUSTLOGINFIRST."!."; //$stress = "$msg : Bạn không có quyền sử dụng chức năng này!."; $stress =""; $res = "

$stress
"; return $res; } } else { //$stress = "$msg : "._PMLYOUMUSTLOGINFIRST."!."; // $stress = "$msg : Bạn không có quyền sử dụng chức năng này!."; $stress =""; $res = "

$stress
"; return $res; } } function ToSearchAll() { global $pmlconfig; $tosearchall = ''; if($pmlconfig['note_lkeywords'] == 1) { $c=$pmlconfig['keyword_length']; $i=1; $h=""; while($i <= $c) { $h = $h."%"; $i++; } if(empty($h)) $h='%%%'; $tosearchall = "
"._PMLTYPE." $h "._PMLTOBROWSEALLRECORDS."!
"; } return $tosearchall; } function Message($msg="") { $msg = "

$msg

"; return $msg; } function bgcolor1() { if(Phpmylibrary::PnThOver()) { global $bgcolor1; } else { global $pmlconfig; $bgcolor1 = $pmlconfig['bgcolor1']; } return $bgcolor1; } function bgcolor2() { if(Phpmylibrary::PnThOver()) { global $bgcolor2; } else { global $pmlconfig; $bgcolor2 = $pmlconfig['bgcolor2']; } return $bgcolor2; } function bgcolor3() { if(Phpmylibrary::PnThOver()) { global $bgcolor3; } else { global $pmlconfig; $bgcolor3 = $pmlconfig['bgcolor3']; } return $bgcolor3; } function MouseOver() { global $pmlconfig; $MouseOver = $pmlconfig['mouseover']; return $MouseOver; } /** * to generate static color * @returns static color */ function useColora() { global $pmlconfig; if($pmlconfig['PnThOver']!=0) { $bcolor2 = $pmlconfig['bgcolor1']; $bcolor1 = $pmlconfig['bgcolor3']; } else { global $bgcolor1,$bgcolor2,$bgcolor3; $bcolor2 = $bgcolor1; $bcolor1 = $bgcolor3; } static $ColorValue; if($ColorValue==$bcolor2) $ColorValue=$bcolor1; else $ColorValue=$bcolor2; return($ColorValue); } function PnThOver() { global $pmlconfig; if($pmlconfig['PnThOver']==0) return true; } function BackToDecoder($bakto="") { $temp = explode("~",$bakto); for($i=0;$i $value) { if($i==$c-1) $tl = ''; $tm = $tm.$key.'^'.$value.$tl; $i++; } //echo $bakto; return $tm; } function BackToEncoder($bakto="") { $bakto = ereg_replace("=","^",$bakto); $bakto = ereg_replace("&","~",$bakto); return $bakto; } } ?>