diff --git a/README.txt b/README.txt deleted file mode 100644 index 6e07abcf5..000000000 --- a/README.txt +++ /dev/null @@ -1,12 +0,0 @@ -How to Install -------------------------- -1. Create/locate a new mysql database to install open source point of sale into -2. Execute the file database/database.sql to create the tables needed -3. unzip and upload Open Source Point of Sale files to web server -4. Copy application/config/database.php.tmpl to application/config/database.php -5. Modify application/config/database.php to connect to your database -6. Go to your point of sale install via the browser -7. LOGIN using -username: admin -password:pointofsale -8. Enjoy \ No newline at end of file diff --git a/UPGRADE.txt b/UPGRADE.txt deleted file mode 100644 index af518e482..000000000 --- a/UPGRADE.txt +++ /dev/null @@ -1,4 +0,0 @@ -How to Upgrade -------------------------- -1. Replace all code from your point of sale installation with the code downloaded -2. Run the necessary database upgrades from the database folder \ No newline at end of file diff --git a/WHATS_NEW.txt b/WHATS_NEW.txt deleted file mode 100644 index 0f8c6402b..000000000 --- a/WHATS_NEW.txt +++ /dev/null @@ -1,5 +0,0 @@ -* E-Mail Receipt support -* Currency Symbol support -* Fixed a bug where comment would disappear after typing it and then doing something different in a sale. -* Fixed bug where Low Inventory items wouldn't display correct items -* Fixed bug where an item couldn't be imported with a location diff --git a/application/config/autoload.php b/application/config/autoload.php deleted file mode 100644 index ec86daf53..000000000 --- a/application/config/autoload.php +++ /dev/null @@ -1,127 +0,0 @@ - '', - 'function' => 'load_config', - 'filename' => 'load_config.php', - 'filepath' => 'hooks' - ); - - - -/* End of file hooks.php */ -/* Location: ./application/config/hooks.php */ \ No newline at end of file diff --git a/application/config/index.html b/application/config/index.html deleted file mode 100644 index 065d2da5e..000000000 --- a/application/config/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

Directory access is forbidden.

- - - \ No newline at end of file diff --git a/application/config/mimes.php b/application/config/mimes.php deleted file mode 100644 index b3cb74db2..000000000 --- a/application/config/mimes.php +++ /dev/null @@ -1,104 +0,0 @@ - 'application/mac-binhex40', - 'cpt' => 'application/mac-compactpro', - 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'), - 'bin' => 'application/macbinary', - 'dms' => 'application/octet-stream', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'exe' => 'application/octet-stream', - 'class' => 'application/octet-stream', - 'psd' => 'application/x-photoshop', - 'so' => 'application/octet-stream', - 'sea' => 'application/octet-stream', - 'dll' => 'application/octet-stream', - 'oda' => 'application/oda', - 'pdf' => array('application/pdf', 'application/x-download'), - 'ai' => 'application/postscript', - 'eps' => 'application/postscript', - 'ps' => 'application/postscript', - 'smi' => 'application/smil', - 'smil' => 'application/smil', - 'mif' => 'application/vnd.mif', - 'xls' => array('application/excel', 'application/vnd.ms-excel'), - 'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint'), - 'wbxml' => 'application/wbxml', - 'wmlc' => 'application/wmlc', - 'dcr' => 'application/x-director', - 'dir' => 'application/x-director', - 'dxr' => 'application/x-director', - 'dvi' => 'application/x-dvi', - 'gtar' => 'application/x-gtar', - 'gz' => 'application/x-gzip', - 'php' => 'application/x-httpd-php', - 'php4' => 'application/x-httpd-php', - 'php3' => 'application/x-httpd-php', - 'phtml' => 'application/x-httpd-php', - 'phps' => 'application/x-httpd-php-source', - 'js' => 'application/x-javascript', - 'swf' => 'application/x-shockwave-flash', - 'sit' => 'application/x-stuffit', - 'tar' => 'application/x-tar', - 'tgz' => 'application/x-tar', - 'xhtml' => 'application/xhtml+xml', - 'xht' => 'application/xhtml+xml', - 'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed'), - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mpga' => 'audio/mpeg', - 'mp2' => 'audio/mpeg', - 'mp3' => array('audio/mpeg', 'audio/mpg'), - 'aif' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'ram' => 'audio/x-pn-realaudio', - 'rm' => 'audio/x-pn-realaudio', - 'rpm' => 'audio/x-pn-realaudio-plugin', - 'ra' => 'audio/x-realaudio', - 'rv' => 'video/vnd.rn-realvideo', - 'wav' => 'audio/x-wav', - 'bmp' => 'image/bmp', - 'gif' => 'image/gif', - 'jpeg' => array('image/jpeg', 'image/pjpeg'), - 'jpg' => array('image/jpeg', 'image/pjpeg'), - 'jpe' => array('image/jpeg', 'image/pjpeg'), - 'png' => array('image/png', 'image/x-png'), - 'tiff' => 'image/tiff', - 'tif' => 'image/tiff', - 'css' => 'text/css', - 'html' => 'text/html', - 'htm' => 'text/html', - 'shtml' => 'text/html', - 'txt' => 'text/plain', - 'text' => 'text/plain', - 'log' => array('text/plain', 'text/x-log'), - 'rtx' => 'text/richtext', - 'rtf' => 'text/rtf', - 'xml' => 'text/xml', - 'xsl' => 'text/xml', - 'mpeg' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mpe' => 'video/mpeg', - 'qt' => 'video/quicktime', - 'mov' => 'video/quicktime', - 'avi' => 'video/x-msvideo', - 'movie' => 'video/x-sgi-movie', - 'doc' => 'application/msword', - 'word' => array('application/msword', 'application/octet-stream'), - 'xl' => 'application/excel', - 'eml' => 'message/rfc822' - ); - - - -/* End of file mimes.php */ -/* Location: ./application/config/mimes.php */ \ No newline at end of file diff --git a/application/config/routes.php b/application/config/routes.php deleted file mode 100644 index 8e4c35a78..000000000 --- a/application/config/routes.php +++ /dev/null @@ -1,64 +0,0 @@ - array('grin.gif', '19', '19', 'grin'), - ':lol:' => array('lol.gif', '19', '19', 'LOL'), - ':cheese:' => array('cheese.gif', '19', '19', 'cheese'), - ':)' => array('smile.gif', '19', '19', 'smile'), - ';-)' => array('wink.gif', '19', '19', 'wink'), - ';)' => array('wink.gif', '19', '19', 'wink'), - ':smirk:' => array('smirk.gif', '19', '19', 'smirk'), - ':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'), - ':-S' => array('confused.gif', '19', '19', 'confused'), - ':wow:' => array('surprise.gif', '19', '19', 'surprised'), - ':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'), - ':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'), - '%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'), - ';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'), - ':P' => array('rasberry.gif', '19', '19', 'rasberry'), - ':blank:' => array('blank.gif', '19', '19', 'blank stare'), - ':long:' => array('longface.gif', '19', '19', 'long face'), - ':ohh:' => array('ohh.gif', '19', '19', 'ohh'), - ':grrr:' => array('grrr.gif', '19', '19', 'grrr'), - ':gulp:' => array('gulp.gif', '19', '19', 'gulp'), - '8-/' => array('ohoh.gif', '19', '19', 'oh oh'), - ':down:' => array('downer.gif', '19', '19', 'downer'), - ':red:' => array('embarrassed.gif', '19', '19', 'red face'), - ':sick:' => array('sick.gif', '19', '19', 'sick'), - ':shut:' => array('shuteye.gif', '19', '19', 'shut eye'), - ':-/' => array('hmm.gif', '19', '19', 'hmmm'), - '>:(' => array('mad.gif', '19', '19', 'mad'), - ':mad:' => array('mad.gif', '19', '19', 'mad'), - '>:-(' => array('angry.gif', '19', '19', 'angry'), - ':angry:' => array('angry.gif', '19', '19', 'angry'), - ':zip:' => array('zip.gif', '19', '19', 'zipper'), - ':kiss:' => array('kiss.gif', '19', '19', 'kiss'), - ':ahhh:' => array('shock.gif', '19', '19', 'shock'), - ':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'), - ':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'), - ':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'), - ':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'), - ':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'), - ':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'), - ':vampire:' => array('vampire.gif', '19', '19', 'vampire'), - ':snake:' => array('snake.gif', '19', '19', 'snake'), - ':exclaim:' => array('exclaim.gif', '19', '19', 'excaim'), - ':question:' => array('question.gif', '19', '19', 'question') // no comma after last item - - ); - -/* End of file smileys.php */ -/* Location: ./application/config/smileys.php */ \ No newline at end of file diff --git a/application/config/user_agents.php b/application/config/user_agents.php deleted file mode 100644 index 1eecbf882..000000000 --- a/application/config/user_agents.php +++ /dev/null @@ -1,163 +0,0 @@ - 'Windows Longhorn', - 'windows nt 5.2' => 'Windows 2003', - 'windows nt 5.0' => 'Windows 2000', - 'windows nt 5.1' => 'Windows XP', - 'windows nt 4.0' => 'Windows NT 4.0', - 'winnt4.0' => 'Windows NT 4.0', - 'winnt 4.0' => 'Windows NT', - 'winnt' => 'Windows NT', - 'windows 98' => 'Windows 98', - 'win98' => 'Windows 98', - 'windows 95' => 'Windows 95', - 'win95' => 'Windows 95', - 'windows' => 'Unknown Windows OS', - 'os x' => 'Mac OS X', - 'ppc mac' => 'Power PC Mac', - 'freebsd' => 'FreeBSD', - 'ppc' => 'Macintosh', - 'linux' => 'Linux', - 'debian' => 'Debian', - 'sunos' => 'Sun Solaris', - 'beos' => 'BeOS', - 'apachebench' => 'ApacheBench', - 'aix' => 'AIX', - 'irix' => 'Irix', - 'osf' => 'DEC OSF', - 'hp-ux' => 'HP-UX', - 'netbsd' => 'NetBSD', - 'bsdi' => 'BSDi', - 'openbsd' => 'OpenBSD', - 'gnu' => 'GNU/Linux', - 'unix' => 'Unknown Unix OS' - ); - - -// The order of this array should NOT be changed. Many browsers return -// multiple browser types so we want to identify the sub-type first. -$browsers = array( - 'Opera' => 'Opera', - 'MSIE' => 'Internet Explorer', - 'Internet Explorer' => 'Internet Explorer', - 'Shiira' => 'Shiira', - 'Firefox' => 'Firefox', - 'Chimera' => 'Chimera', - 'Phoenix' => 'Phoenix', - 'Firebird' => 'Firebird', - 'Camino' => 'Camino', - 'Netscape' => 'Netscape', - 'OmniWeb' => 'OmniWeb', - 'Mozilla' => 'Mozilla', - 'Safari' => 'Safari', - 'Konqueror' => 'Konqueror', - 'icab' => 'iCab', - 'Lynx' => 'Lynx', - 'Links' => 'Links', - 'hotjava' => 'HotJava', - 'amaya' => 'Amaya', - 'IBrowse' => 'IBrowse' - ); - -$mobiles = array( - // legacy array, old values commented out - 'mobileexplorer' => 'Mobile Explorer', -// 'openwave' => 'Open Wave', -// 'opera mini' => 'Opera Mini', -// 'operamini' => 'Opera Mini', -// 'elaine' => 'Palm', - 'palmsource' => 'Palm', -// 'digital paths' => 'Palm', -// 'avantgo' => 'Avantgo', -// 'xiino' => 'Xiino', - 'palmscape' => 'Palmscape', -// 'nokia' => 'Nokia', -// 'ericsson' => 'Ericsson', -// 'blackberry' => 'BlackBerry', -// 'motorola' => 'Motorola' - - // Phones and Manufacturers - 'motorola' => "Motorola", - 'nokia' => "Nokia", - 'palm' => "Palm", - 'iphone' => "Apple iPhone", - 'ipod' => "Apple iPod Touch", - 'sony' => "Sony Ericsson", - 'ericsson' => "Sony Ericsson", - 'blackberry' => "BlackBerry", - 'cocoon' => "O2 Cocoon", - 'blazer' => "Treo", - 'lg' => "LG", - 'amoi' => "Amoi", - 'xda' => "XDA", - 'mda' => "MDA", - 'vario' => "Vario", - 'htc' => "HTC", - 'samsung' => "Samsung", - 'sharp' => "Sharp", - 'sie-' => "Siemens", - 'alcatel' => "Alcatel", - 'benq' => "BenQ", - 'ipaq' => "HP iPaq", - 'mot-' => "Motorola", - 'playstation portable' => "PlayStation Portable", - 'hiptop' => "Danger Hiptop", - 'nec-' => "NEC", - 'panasonic' => "Panasonic", - 'philips' => "Philips", - 'sagem' => "Sagem", - 'sanyo' => "Sanyo", - 'spv' => "SPV", - 'zte' => "ZTE", - 'sendo' => "Sendo", - - // Operating Systems - 'symbian' => "Symbian", - 'elaine' => "Palm", - 'palm' => "Palm", - 'series60' => "Symbian S60", - 'windows ce' => "Windows CE", - - // Browsers - 'obigo' => "Obigo", - 'netfront' => "Netfront Browser", - 'openwave' => "Openwave Browser", - 'mobilexplorer' => "Mobile Explorer", - 'operamini' => "Opera Mini", - 'opera mini' => "Opera Mini", - - // Other - 'digital paths' => "Digital Paths", - 'avantgo' => "AvantGo", - 'xiino' => "Xiino", - 'novarra' => "Novarra Transcoder", - 'vodafone' => "Vodafone", - 'docomo' => "NTT DoCoMo", - 'o2' => "O2", - - // Fallback - 'mobile' => "Generic Mobile", - 'wireless' => "Generic Mobile", - 'j2me' => "Generic Mobile", - 'midp' => "Generic Mobile", - 'cldc' => "Generic Mobile", - 'up.link' => "Generic Mobile", - 'up.browser' => "Generic Mobile", - 'smartphone' => "Generic Mobile", - 'cellphone' => "Generic Mobile" - ); - - -/* End of file user_agents.php */ -/* Location: ./application/config/user_agents.php */ \ No newline at end of file diff --git a/application/controllers/barcode.php b/application/controllers/barcode.php deleted file mode 100644 index 1c574de98..000000000 --- a/application/controllers/barcode.php +++ /dev/null @@ -1,14 +0,0 @@ -load->view('barcode'); - } -} -?> \ No newline at end of file diff --git a/application/controllers/config.php b/application/controllers/config.php deleted file mode 100644 index 57ce05b0f..000000000 --- a/application/controllers/config.php +++ /dev/null @@ -1,46 +0,0 @@ -load->view("config"); - } - - function save() - { - $batch_save_data=array( - 'company'=>$this->input->post('company'), - 'address'=>$this->input->post('address'), - 'phone'=>$this->input->post('phone'), - 'email'=>$this->input->post('email'), - 'fax'=>$this->input->post('fax'), - 'website'=>$this->input->post('website'), - 'default_tax_1_rate'=>$this->input->post('default_tax_1_rate'), - 'default_tax_1_name'=>$this->input->post('default_tax_1_name'), - 'default_tax_2_rate'=>$this->input->post('default_tax_2_rate'), - 'default_tax_2_name'=>$this->input->post('default_tax_2_name'), - 'currency_symbol'=>$this->input->post('currency_symbol'), - 'return_policy'=>$this->input->post('return_policy'), - 'language'=>$this->input->post('language'), - 'timezone'=>$this->input->post('timezone'), - 'print_after_sale'=>$this->input->post('print_after_sale') - ); - - if($_SERVER['HTTP_HOST'] !='ospos.pappastech.com' && $this->Appconfig->batch_save($batch_save_data)) - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('config_saved_successfully'))); - } - else - { - echo json_encode(array('success'=>false,'message'=>$this->lang->line('config_saved_unsuccessfully'))); - - } - } -} -?> \ No newline at end of file diff --git a/application/controllers/customers.php b/application/controllers/customers.php deleted file mode 100644 index a025d3ce2..000000000 --- a/application/controllers/customers.php +++ /dev/null @@ -1,200 +0,0 @@ -Customer->count_all(); - $config['per_page'] = '20'; - $this->pagination->initialize($config); - - $data['controller_name']=strtolower(get_class()); - $data['form_width']=$this->get_form_width(); - $data['manage_table']=get_people_manage_table($this->Customer->get_all($config['per_page'], $this->input->get('per_page')),$this); - $this->load->view('people/manage',$data); - } - - /* - Returns customer table data rows. This will be called with AJAX. - */ - function search() - { - $search=$this->input->post('search'); - $data_rows=get_people_manage_table_data_rows($this->Customer->search($search),$this); - echo $data_rows; - } - - /* - Gives search suggestions based on what is being searched for - */ - function suggest() - { - $suggestions = $this->Customer->get_search_suggestions($this->input->post('q'),$this->input->post('limit')); - echo implode("\n",$suggestions); - } - - /* - Loads the customer edit form - */ - function view($customer_id=-1) - { - $data['person_info']=$this->Customer->get_info($customer_id); - $this->load->view("customers/form",$data); - } - - /* - Inserts/updates a customer - */ - function save($customer_id=-1) - { - $person_data = array( - 'first_name'=>$this->input->post('first_name'), - 'last_name'=>$this->input->post('last_name'), - 'email'=>$this->input->post('email'), - 'phone_number'=>$this->input->post('phone_number'), - 'address_1'=>$this->input->post('address_1'), - 'address_2'=>$this->input->post('address_2'), - 'city'=>$this->input->post('city'), - 'state'=>$this->input->post('state'), - 'zip'=>$this->input->post('zip'), - 'country'=>$this->input->post('country'), - 'comments'=>$this->input->post('comments') - ); - $customer_data=array( - 'account_number'=>$this->input->post('account_number')=='' ? null:$this->input->post('account_number'), - 'taxable'=>$this->input->post('taxable')=='' ? 0:1, - ); - if($this->Customer->save($person_data,$customer_data,$customer_id)) - { - //New customer - if($customer_id==-1) - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('customers_successful_adding').' '. - $person_data['first_name'].' '.$person_data['last_name'],'person_id'=>$customer_data['person_id'])); - } - else //previous customer - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('customers_successful_updating').' '. - $person_data['first_name'].' '.$person_data['last_name'],'person_id'=>$customer_id)); - } - } - else//failure - { - echo json_encode(array('success'=>false,'message'=>$this->lang->line('customers_error_adding_updating').' '. - $person_data['first_name'].' '.$person_data['last_name'],'person_id'=>-1)); - } - } - - /* - This deletes customers from the customers table - */ - function delete() - { - $customers_to_delete=$this->input->post('ids'); - - if($this->Customer->delete_list($customers_to_delete)) - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('customers_successful_deleted').' '. - count($customers_to_delete).' '.$this->lang->line('customers_one_or_multiple'))); - } - else - { - echo json_encode(array('success'=>false,'message'=>$this->lang->line('customers_cannot_be_deleted'))); - } - } - - function excel() - { - $data = file_get_contents("import_customers.csv"); - $name = 'import_customers.csv'; - force_download($name, $data); - } - - function excel_import() - { - $this->load->view("customers/excel_import", null); - } - - function do_excel_import() - { - $msg = 'do_excel_import'; - $failCodes = array(); - if ($_FILES['file_path']['error']!=UPLOAD_ERR_OK) - { - $msg = $this->lang->line('items_excel_import_failed'); - echo json_encode( array('success'=>false,'message'=>$msg) ); - return; - } - else - { - if (($handle = fopen($_FILES['file_path']['tmp_name'], "r")) !== FALSE) - { - //Skip first row - fgetcsv($handle); - - $i=1; - while (($data = fgetcsv($handle)) !== FALSE) - { - $person_data = array( - 'first_name'=>$data[0], - 'last_name'=>$data[1], - 'email'=>$data[2], - 'phone_number'=>$data[3], - 'address_1'=>$data[4], - 'address_2'=>$data[5], - 'city'=>$data[6], - 'state'=>$data[7], - 'zip'=>$data[8], - 'country'=>$data[9], - 'comments'=>$data[10] - ); - - $customer_data=array( - 'account_number'=>$data[11]=='' ? null:$data[11], - 'taxable'=>$data[12]=='' ? 0:1, - ); - - if(!$this->Customer->save($person_data,$customer_data)) - { - $failCodes[] = $i; - } - - $i++; - } - } - else - { - echo json_encode( array('success'=>false,'message'=>'Your upload file has no data or not in supported format.') ); - return; - } - } - - $success = true; - if(count($failCodes) > 1) - { - $msg = "Most customers imported. But some were not, here is list of their CODE (" .count($failCodes) ."): ".implode(", ", $failCodes); - $success = false; - } - else - { - $msg = "Import Customers successful"; - } - - echo json_encode( array('success'=>$success,'message'=>$msg) ); - } - - /* - get the width for the add/edit form - */ - function get_form_width() - { - return 350; - } -} -?> \ No newline at end of file diff --git a/application/controllers/employees.php b/application/controllers/employees.php deleted file mode 100644 index 748dda0ca..000000000 --- a/application/controllers/employees.php +++ /dev/null @@ -1,142 +0,0 @@ -Employee->count_all(); - $config['per_page'] = '20'; - $this->pagination->initialize($config); - - $data['controller_name']=strtolower(get_class()); - $data['form_width']=$this->get_form_width(); - $data['manage_table']=get_people_manage_table($this->Employee->get_all($config['per_page'], $this->input->get('per_page')),$this); - $this->load->view('people/manage',$data); - } - - /* - Returns employee table data rows. This will be called with AJAX. - */ - function search() - { - $search=$this->input->post('search'); - $data_rows=get_people_manage_table_data_rows($this->Employee->search($search),$this); - echo $data_rows; - } - - /* - Gives search suggestions based on what is being searched for - */ - function suggest() - { - $suggestions = $this->Employee->get_search_suggestions($this->input->post('q'),$this->input->post('limit')); - echo implode("\n",$suggestions); - } - - /* - Loads the employee edit form - */ - function view($employee_id=-1) - { - $data['person_info']=$this->Employee->get_info($employee_id); - $data['all_modules']=$this->Module->get_all_modules(); - $this->load->view("employees/form",$data); - } - - /* - Inserts/updates an employee - */ - function save($employee_id=-1) - { - $person_data = array( - 'first_name'=>$this->input->post('first_name'), - 'last_name'=>$this->input->post('last_name'), - 'email'=>$this->input->post('email'), - 'phone_number'=>$this->input->post('phone_number'), - 'address_1'=>$this->input->post('address_1'), - 'address_2'=>$this->input->post('address_2'), - 'city'=>$this->input->post('city'), - 'state'=>$this->input->post('state'), - 'zip'=>$this->input->post('zip'), - 'country'=>$this->input->post('country'), - 'comments'=>$this->input->post('comments') - ); - $permission_data = $this->input->post("permissions")!=false ? $this->input->post("permissions"):array(); - - //Password has been changed OR first time password set - if($this->input->post('password')!='') - { - $employee_data=array( - 'username'=>$this->input->post('username'), - 'password'=>md5($this->input->post('password')) - ); - } - else //Password not changed - { - $employee_data=array('username'=>$this->input->post('username')); - } - - if ($_SERVER['HTTP_HOST'] == 'ospos.pappastech.com' && $employee_id == 1) - { - //failure - echo json_encode(array('success'=>false,'message'=>$this->lang->line('employees_error_updating_demo_admin').' '. - $person_data['first_name'].' '.$person_data['last_name'],'person_id'=>-1)); - } - elseif($this->Employee->save($person_data,$employee_data,$permission_data,$employee_id)) - { - //New employee - if($employee_id==-1) - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('employees_successful_adding').' '. - $person_data['first_name'].' '.$person_data['last_name'],'person_id'=>$employee_data['person_id'])); - } - else //previous employee - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('employees_successful_updating').' '. - $person_data['first_name'].' '.$person_data['last_name'],'person_id'=>$employee_id)); - } - } - else//failure - { - echo json_encode(array('success'=>false,'message'=>$this->lang->line('employees_error_adding_updating').' '. - $person_data['first_name'].' '.$person_data['last_name'],'person_id'=>-1)); - } - } - - /* - This deletes employees from the employees table - */ - function delete() - { - $employees_to_delete=$this->input->post('ids'); - - if ($_SERVER['HTTP_HOST'] == 'ospos.pappastech.com' && in_array(1,$employees_to_delete)) - { - //failure - echo json_encode(array('success'=>false,'message'=>$this->lang->line('employees_error_deleting_demo_admin'))); - } - elseif($this->Employee->delete_list($employees_to_delete)) - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('employees_successful_deleted').' '. - count($employees_to_delete).' '.$this->lang->line('employees_one_or_multiple'))); - } - else - { - echo json_encode(array('success'=>false,'message'=>$this->lang->line('employees_cannot_be_deleted'))); - } - } - /* - get the width for the add/edit form - */ - function get_form_width() - { - return 650; - } -} -?> \ No newline at end of file diff --git a/application/controllers/giftcards.php b/application/controllers/giftcards.php deleted file mode 100644 index b256eb91b..000000000 --- a/application/controllers/giftcards.php +++ /dev/null @@ -1,107 +0,0 @@ -Giftcard->count_all(); - $config['per_page'] = '20'; - $this->pagination->initialize($config); - - $data['controller_name']=strtolower(get_class()); - $data['form_width']=$this->get_form_width(); - $data['manage_table']=get_giftcards_manage_table($this->Giftcard->get_all($config['per_page'], $this->input->get('per_page')),$this); - $this->load->view('giftcards/manage',$data); - } - - function search() - { - $search=$this->input->post('search'); - $data_rows=get_giftcards_manage_table_data_rows($this->Giftcard->search($search),$this); - echo $data_rows; - } - - /* - Gives search suggestions based on what is being searched for - */ - function suggest() - { - $suggestions = $this->Giftcard->get_search_suggestions($this->input->post('q'),$this->input->post('limit')); - echo implode("\n",$suggestions); - } - - function get_row() - { - $giftcard_id = $this->input->post('row_id'); - $data_row=get_giftcard_data_row($this->Giftcard->get_info($giftcard_id),$this); - echo $data_row; - } - - function view($giftcard_id=-1) - { - $data['giftcard_info']=$this->Giftcard->get_info($giftcard_id); - - $this->load->view("giftcards/form",$data); - } - - function save($giftcard_id=-1) - { - $giftcard_data = array( - 'giftcard_number'=>$this->input->post('giftcard_number'), - 'value'=>$this->input->post('value') - ); - - if( $this->Giftcard->save( $giftcard_data, $giftcard_id ) ) - { - //New giftcard - if($giftcard_id==-1) - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('giftcards_successful_adding').' '. - $giftcard_data['giftcard_number'],'giftcard_id'=>$giftcard_data['giftcard_id'])); - $giftcard_id = $giftcard_data['giftcard_id']; - } - else //previous giftcard - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('giftcards_successful_updating').' '. - $giftcard_data['giftcard_number'],'giftcard_id'=>$giftcard_id)); - } - } - else//failure - { - echo json_encode(array('success'=>false,'message'=>$this->lang->line('giftcards_error_adding_updating').' '. - $giftcard_data['giftcard_number'],'giftcard_id'=>-1)); - } - - } - - function delete() - { - $giftcards_to_delete=$this->input->post('ids'); - - if($this->Giftcard->delete_list($giftcards_to_delete)) - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('giftcards_successful_deleted').' '. - count($giftcards_to_delete).' '.$this->lang->line('giftcards_one_or_multiple'))); - } - else - { - echo json_encode(array('success'=>false,'message'=>$this->lang->line('giftcards_cannot_be_deleted'))); - } - } - - /* - get the width for the add/edit form - */ - function get_form_width() - { - return 360; - } -} -?> \ No newline at end of file diff --git a/application/controllers/home.php b/application/controllers/home.php deleted file mode 100644 index a3d18a2d8..000000000 --- a/application/controllers/home.php +++ /dev/null @@ -1,20 +0,0 @@ -load->view("home"); - } - - function logout() - { - $this->Employee->logout(); - } -} -?> \ No newline at end of file diff --git a/application/controllers/index.html b/application/controllers/index.html deleted file mode 100644 index 065d2da5e..000000000 --- a/application/controllers/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

Directory access is forbidden.

- - - \ No newline at end of file diff --git a/application/controllers/interfaces/idata_controller.php b/application/controllers/interfaces/idata_controller.php deleted file mode 100644 index e05d493d0..000000000 --- a/application/controllers/interfaces/idata_controller.php +++ /dev/null @@ -1,17 +0,0 @@ - \ No newline at end of file diff --git a/application/controllers/interfaces/iperson_controller.php b/application/controllers/interfaces/iperson_controller.php deleted file mode 100644 index 92cdb1810..000000000 --- a/application/controllers/interfaces/iperson_controller.php +++ /dev/null @@ -1,11 +0,0 @@ - \ No newline at end of file diff --git a/application/controllers/item_kits.php b/application/controllers/item_kits.php deleted file mode 100644 index ddbc31575..000000000 --- a/application/controllers/item_kits.php +++ /dev/null @@ -1,137 +0,0 @@ -Item_kit->count_all(); - $config['per_page'] = '20'; - $this->pagination->initialize($config); - - $data['controller_name']=strtolower(get_class()); - $data['form_width']=$this->get_form_width(); - $data['manage_table']=get_item_kits_manage_table( $this->Item_kit->get_all($config['per_page'], $this->input->get('per_page')),$this); - $this->load->view('item_kits/manage',$data); - } - - function search() - { - $search=$this->input->post('search'); - $data_rows=get_item_kits_manage_table_data_rows($this->Item_kit->search($search),$this); - echo $data_rows; - } - - /* - Gives search suggestions based on what is being searched for - */ - function suggest() - { - $suggestions = $this->Item_kit->get_search_suggestions($this->input->post('q'),$this->input->post('limit')); - echo implode("\n",$suggestions); - } - - function get_row() - { - $item_kit_id = $this->input->post('row_id'); - $data_row=get_item_kit_data_row($this->Item_kit->get_info($item_kit_id),$this); - echo $data_row; - } - - function view($item_kit_id=-1) - { - $data['item_kit_info']=$this->Item_kit->get_info($item_kit_id); - $this->load->view("item_kits/form",$data); - } - - function save($item_kit_id=-1) - { - $item_kit_data = array( - 'name'=>$this->input->post('name'), - 'description'=>$this->input->post('description') - ); - - if($this->Item_kit->save($item_kit_data,$item_kit_id)) - { - //New item kit - if($item_kit_id==-1) - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('item_kits_successful_adding').' '. - $item_kit_data['name'],'item_kit_id'=>$item_kit_data['item_kit_id'])); - $item_kit_id = $item_kit_data['item_kit_id']; - } - else //previous item - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('item_kits_successful_updating').' '. - $item_kit_data['name'],'item_kit_id'=>$item_kit_id)); - } - - if ($this->input->post('item_kit_item')) - { - $item_kit_items = array(); - foreach($this->input->post('item_kit_item') as $item_id => $quantity) - { - $item_kit_items[] = array( - 'item_id' => $item_id, - 'quantity' => $quantity - ); - } - - $this->Item_kit_items->save($item_kit_items, $item_kit_id); - } - } - else//failure - { - echo json_encode(array('success'=>false,'message'=>$this->lang->line('item_kits_error_adding_updating').' '. - $item_kit_data['name'],'item_kit_id'=>-1)); - } - - } - - function delete() - { - $item_kits_to_delete=$this->input->post('ids'); - - if($this->Item_kit->delete_list($item_kits_to_delete)) - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('item_kits_successful_deleted').' '. - count($item_kits_to_delete).' '.$this->lang->line('item_kits_one_or_multiple'))); - } - else - { - echo json_encode(array('success'=>false,'message'=>$this->lang->line('item_kits_cannot_be_deleted'))); - } - } - - function generate_barcodes($item_kit_ids) - { - $result = array(); - - $item_kit_ids = explode(',', $item_kit_ids); - foreach ($item_kit_ids as $item_kid_id) - { - $item_kit_info = $this->Item_kit->get_info($item_kid_id); - - $result[] = array('name' =>$item_kit_info->name, 'id'=> 'KIT '.$item_kid_id); - } - - $data['items'] = $result; - $this->load->view("barcode_sheet", $data); - } - - - /* - get the width for the add/edit form - */ - function get_form_width() - { - return 360; - } -} -?> \ No newline at end of file diff --git a/application/controllers/items.php b/application/controllers/items.php deleted file mode 100644 index c90ff207b..000000000 --- a/application/controllers/items.php +++ /dev/null @@ -1,427 +0,0 @@ -Item->count_all(); - $config['per_page'] = '20'; - $this->pagination->initialize($config); - - $data['controller_name']=strtolower(get_class()); - $data['form_width']=$this->get_form_width(); - $data['manage_table']=get_items_manage_table($this->Item->get_all($config['per_page'], $this->input->get('per_page')),$this); - $this->load->view('items/manage',$data); - } - - function refresh() - { - $low_inventory=$this->input->post('low_inventory'); - $is_serialized=$this->input->post('is_serialized'); - $no_description=$this->input->post('no_description'); - - $data['search_section_state']=$this->input->post('search_section_state'); - $data['low_inventory']=$this->input->post('low_inventory'); - $data['is_serialized']=$this->input->post('is_serialized'); - $data['no_description']=$this->input->post('no_description'); - $data['controller_name']=strtolower(get_class()); - $data['form_width']=$this->get_form_width(); - $data['manage_table']=get_items_manage_table($this->Item->get_all_filtered($low_inventory,$is_serialized,$no_description),$this); - $this->load->view('items/manage',$data); - } - - function find_item_info() - { - $item_number=$this->input->post('scan_item_number'); - echo json_encode($this->Item->find_item_info($item_number)); - } - - function search() - { - $search=$this->input->post('search'); - $data_rows=get_items_manage_table_data_rows($this->Item->search($search),$this); - echo $data_rows; - } - - /* - Gives search suggestions based on what is being searched for - */ - function suggest() - { - $suggestions = $this->Item->get_search_suggestions($this->input->post('q'),$this->input->post('limit')); - echo implode("\n",$suggestions); - } - - function item_search() - { - $suggestions = $this->Item->get_item_search_suggestions($this->input->post('q'),$this->input->post('limit')); - echo implode("\n",$suggestions); - } - - /* - Gives search suggestions based on what is being searched for - */ - function suggest_category() - { - $suggestions = $this->Item->get_category_suggestions($this->input->post('q')); - echo implode("\n",$suggestions); - } - - function get_row() - { - $item_id = $this->input->post('row_id'); - $data_row=get_item_data_row($this->Item->get_info($item_id),$this); - echo $data_row; - } - - function view($item_id=-1) - { - $data['item_info']=$this->Item->get_info($item_id); - $data['item_tax_info']=$this->Item_taxes->get_info($item_id); - $suppliers = array('' => $this->lang->line('items_none')); - foreach($this->Supplier->get_all()->result_array() as $row) - { - $suppliers[$row['person_id']] = $row['company_name'] .' ('.$row['first_name'] .' '. $row['last_name'].')'; - } - - $data['suppliers']=$suppliers; - $data['selected_supplier'] = $this->Item->get_info($item_id)->supplier_id; - $data['default_tax_1_rate']=($item_id==-1) ? $this->Appconfig->get('default_tax_1_rate') : ''; - $data['default_tax_2_rate']=($item_id==-1) ? $this->Appconfig->get('default_tax_2_rate') : ''; - $this->load->view("items/form",$data); - } - - //Ramel Inventory Tracking - function inventory($item_id=-1) - { - $data['item_info']=$this->Item->get_info($item_id); - $this->load->view("items/inventory",$data); - } - - function count_details($item_id=-1) - { - $data['item_info']=$this->Item->get_info($item_id); - $this->load->view("items/count_details",$data); - } //------------------------------------------- Ramel - - function generate_barcodes($item_ids) - { - $result = array(); - - $item_ids = explode(',', $item_ids); - foreach ($item_ids as $item_id) - { - $item_info = $this->Item->get_info($item_id); - - $result[] = array('name' =>$item_info->name, 'id'=> $item_id); - } - - $data['items'] = $result; - $this->load->view("barcode_sheet", $data); - } - - function bulk_edit() - { - $data = array(); - $suppliers = array('' => $this->lang->line('items_none')); - foreach($this->Supplier->get_all()->result_array() as $row) - { - $suppliers[$row['person_id']] = $row['first_name'] .' '. $row['last_name']; - } - $data['suppliers'] = $suppliers; - $data['allow_alt_desciption_choices'] = array( - ''=>$this->lang->line('items_do_nothing'), - 1 =>$this->lang->line('items_change_all_to_allow_alt_desc'), - 0 =>$this->lang->line('items_change_all_to_not_allow_allow_desc')); - - $data['serialization_choices'] = array( - ''=>$this->lang->line('items_do_nothing'), - 1 =>$this->lang->line('items_change_all_to_serialized'), - 0 =>$this->lang->line('items_change_all_to_unserialized')); - $this->load->view("items/form_bulk", $data); - } - - function save($item_id=-1) - { - $item_data = array( - 'name'=>$this->input->post('name'), - 'description'=>$this->input->post('description'), - 'category'=>$this->input->post('category'), - 'supplier_id'=>$this->input->post('supplier_id')=='' ? null:$this->input->post('supplier_id'), - 'item_number'=>$this->input->post('item_number')=='' ? null:$this->input->post('item_number'), - 'cost_price'=>$this->input->post('cost_price'), - 'unit_price'=>$this->input->post('unit_price'), - 'quantity'=>$this->input->post('quantity'), - 'reorder_level'=>$this->input->post('reorder_level'), - 'location'=>$this->input->post('location'), - 'allow_alt_description'=>$this->input->post('allow_alt_description'), - 'is_serialized'=>$this->input->post('is_serialized') - ); - - $employee_id=$this->Employee->get_logged_in_employee_info()->person_id; - $cur_item_info = $this->Item->get_info($item_id); - - - if($this->Item->save($item_data,$item_id)) - { - //New item - if($item_id==-1) - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('items_successful_adding').' '. - $item_data['name'],'item_id'=>$item_data['item_id'])); - $item_id = $item_data['item_id']; - } - else //previous item - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('items_successful_updating').' '. - $item_data['name'],'item_id'=>$item_id)); - } - - $inv_data = array - ( - 'trans_date'=>date('Y-m-d H:i:s'), - 'trans_items'=>$item_id, - 'trans_user'=>$employee_id, - 'trans_comment'=>$this->lang->line('items_manually_editing_of_quantity'), - 'trans_inventory'=>$cur_item_info ? $this->input->post('quantity') - $cur_item_info->quantity : $this->input->post('quantity') - ); - $this->Inventory->insert($inv_data); - $items_taxes_data = array(); - $tax_names = $this->input->post('tax_names'); - $tax_percents = $this->input->post('tax_percents'); - for($k=0;$k$tax_names[$k], 'percent'=>$tax_percents[$k] ); - } - } - $this->Item_taxes->save($items_taxes_data, $item_id); - } - else//failure - { - echo json_encode(array('success'=>false,'message'=>$this->lang->line('items_error_adding_updating').' '. - $item_data['name'],'item_id'=>-1)); - } - - } - - //Ramel Inventory Tracking - function save_inventory($item_id=-1) - { - $employee_id=$this->Employee->get_logged_in_employee_info()->person_id; - $cur_item_info = $this->Item->get_info($item_id); - $inv_data = array - ( - 'trans_date'=>date('Y-m-d H:i:s'), - 'trans_items'=>$item_id, - 'trans_user'=>$employee_id, - 'trans_comment'=>$this->input->post('trans_comment'), - 'trans_inventory'=>$this->input->post('newquantity') - ); - $this->Inventory->insert($inv_data); - - //Update stock quantity - $item_data = array( - 'quantity'=>$cur_item_info->quantity + $this->input->post('newquantity') - ); - if($this->Item->save($item_data,$item_id)) - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('items_successful_updating').' '. - $cur_item_info->name,'item_id'=>$item_id)); - } - else//failure - { - echo json_encode(array('success'=>false,'message'=>$this->lang->line('items_error_adding_updating').' '. - $cur_item_info->name,'item_id'=>-1)); - } - - }//---------------------------------------------------------------------Ramel - - function bulk_update() - { - $items_to_update=$this->input->post('item_ids'); - $item_data = array(); - - foreach($_POST as $key=>$value) - { - //This field is nullable, so treat it differently - if ($key == 'supplier_id') - { - $item_data["$key"]=$value == '' ? null : $value; - } - elseif($value!='' and !(in_array($key, array('item_ids', 'tax_names', 'tax_percents')))) - { - $item_data["$key"]=$value; - } - } - - //Item data could be empty if tax information is being updated - if(empty($item_data) || $this->Item->update_multiple($item_data,$items_to_update)) - { - $items_taxes_data = array(); - $tax_names = $this->input->post('tax_names'); - $tax_percents = $this->input->post('tax_percents'); - for($k=0;$k$tax_names[$k], 'percent'=>$tax_percents[$k] ); - } - } - $this->Item_taxes->save_multiple($items_taxes_data, $items_to_update); - - echo json_encode(array('success'=>true,'message'=>$this->lang->line('items_successful_bulk_edit'))); - } - else - { - echo json_encode(array('success'=>false,'message'=>$this->lang->line('items_error_updating_multiple'))); - } - } - - function delete() - { - $items_to_delete=$this->input->post('ids'); - - if($this->Item->delete_list($items_to_delete)) - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('items_successful_deleted').' '. - count($items_to_delete).' '.$this->lang->line('items_one_or_multiple'))); - } - else - { - echo json_encode(array('success'=>false,'message'=>$this->lang->line('items_cannot_be_deleted'))); - } - } - - function excel() - { - $data = file_get_contents("import_items.csv"); - $name = 'import_items.csv'; - force_download($name, $data); - } - - function excel_import() - { - $this->load->view("items/excel_import", null); - } - - function do_excel_import() - { - $msg = 'do_excel_import'; - $failCodes = array(); - if ($_FILES['file_path']['error']!=UPLOAD_ERR_OK) - { - $msg = $this->lang->line('items_excel_import_failed'); - echo json_encode( array('success'=>false,'message'=>$msg) ); - return; - } - else - { - if (($handle = fopen($_FILES['file_path']['tmp_name'], "r")) !== FALSE) - { - //Skip first row - fgetcsv($handle); - - $i=1; - while (($data = fgetcsv($handle)) !== FALSE) - { - $item_data = array( - 'name' => $data[1], - 'description' => $data[13], - 'location' => $data[12], - 'category' => $data[2], - 'cost_price' => $data[4], - 'unit_price' => $data[5], - 'quantity' => $data[10], - 'reorder_level' => $data[11], - 'supplier_id' => $this->Supplier->exists($data[3]) ? $data[3] : null, - 'allow_alt_description'=> $data[14] != '' ? '1' : '0', - 'is_serialized'=>$data[15] != '' ? '1' : '0' - ); - $item_number = $data[0]; - - if ($item_number != "") - { - $item_data['item_number'] = $item_number; - } - - if($this->Item->save($item_data)) - { - $items_taxes_data = null; - //tax 1 - if( is_numeric($data[7]) && $data[6]!='' ) - { - $items_taxes_data[] = array('name'=>$data[6], 'percent'=>$data[7] ); - } - - //tax 2 - if( is_numeric($data[9]) && $data[8]!='' ) - { - $items_taxes_data[] = array('name'=>$data[8], 'percent'=>$data[9] ); - } - - // save tax values - if(count($items_taxes_data) > 0) - { - $this->Item_taxes->save($items_taxes_data, $item_data['item_id']); - } - - $employee_id=$this->Employee->get_logged_in_employee_info()->person_id; - $emp_info=$this->Employee->get_info($employee_id); - $comment ='Qty CSV Imported'; - $excel_data = array - ( - 'trans_items'=>$item_data['item_id'], - 'trans_user'=>$employee_id, - 'trans_comment'=>$comment, - 'trans_inventory'=>$data[10] - ); - $this->db->insert('inventory',$excel_data); - //------------------------------------------------Ramel - } - else//insert or update item failure - { - $failCodes[] = $i; - } - } - - $i++; - } - else - { - echo json_encode( array('success'=>false,'message'=>'Your upload file has no data or not in supported format.') ); - return; - } - } - - $success = true; - if(count($failCodes) > 1) - { - $msg = "Most items imported. But some were not, here is list of their CODE (" .count($failCodes) ."): ".implode(", ", $failCodes); - $success = false; - } - else - { - $msg = "Import items successful"; - } - - echo json_encode( array('success'=>$success,'message'=>$msg) ); - } - - /* - get the width for the add/edit form - */ - function get_form_width() - { - return 360; - } -} -?> \ No newline at end of file diff --git a/application/controllers/languagecheck.php b/application/controllers/languagecheck.php deleted file mode 100644 index 593f39e0d..000000000 --- a/application/controllers/languagecheck.php +++ /dev/null @@ -1,192 +0,0 @@ -load->helper('directory'); - - // for simplicity, we don't use views - $this->output('h1', 'Open Source Point of Sale - Language file checking and validation'); - - // determine the language file path - if ( ! is_dir($this->lang_path) ) - { - $this->lang_path = APPPATH . $this->lang_path; - - if ( ! is_dir($this->lang_path) ) - { - $this->output('h2', 'Defined language path "'.$this->lang_path.'" not found!', TRUE); - exit; - } - } - - // fetch the languages directory map - $languages = directory_map( $this->lang_path, TRUE ); - - // is our reference language present? - if ( ! in_array($this->reference, $languages ) ) - { - $this->output('h2', 'Reference language "'.$this->reference.'" not found!', TRUE); - exit; - } - - // load the list of language files for the reference language - $references = directory_map( $this->lang_path . '/' . $this->reference, TRUE ); - - // now process the list - foreach( $references as $reference ) - { - // skip non-language files in the language directory - if ( strpos($reference, '_lang'.EXT) === FALSE ) - { - continue; - } - - // process it - $this->output('h2', 'Processing '.$this->reference . ' » ' .$reference); - - // load the language file - include $this->lang_path . '/' . $this->reference . '/' . $reference; - - // did the file contain any language strings? - if ( empty($lang) ) - { - // language file was empty or not properly defined - $this->output('h3', 'Language file doesn\'t contain any language strings. Skipping file!', TRUE); - continue; - } - - // store the loaded language strings - $lang_ref = $lang; - unset($lang); - - // now loop through the available languages - foreach ( $languages as $language ) - { - // skip the reference language - if ( $language == $this->reference ) - { - continue; - } - - // language file to check - $file = $this->lang_path . '/' . $language . '/' . $reference; - - // check if the language file exists for this language - if ( ! file_exists( $file ) ) - { - // file not found - $this->output('h3', 'Language file doesn\'t exist for the language '.$language.'!', TRUE); - } - else - { - // load the file to compare - include $file; - - // did the file contain any language strings? - if ( empty($lang) ) - { - // language file was empty or not properly defined - $this->output('h3', 'Language file for the language '.$language.' doesn\'t contain any language strings!', TRUE); - } - else - { - // start comparing - $this->output('h3', 'Comparing with the '.$language.' version:'); - - // assume all goes well - $failures = 0; - - // start comparing language keys - foreach( $lang_ref as $key => $value ) - { - if ( ! isset($lang[$key]) ) - { - // report the missing key - $this->output('', 'Missing language string "'.$key.'"', TRUE); - - // increment the failure counter - $failures++; - } - } - - if ( ! $failures ) - { - $this->output('', 'The two language files have matching strings.'); - } - } - - // make sure the lang array is deleted before the next check - if ( isset($lang) ) - { - unset($lang); - } - } - } - - } - - $this->output('h2', 'Language file checking and validation completed'); - } - - // ----------------------------------------------------------------- - - private function output($type = '', $line = '', $highlight = FALSE) - { - switch ($type) - { - case 'h1': - $html = "

{line}

\n
\n"; - break; - - case 'h2': - $html = "

{line}

\n"; - break; - - case 'h3': - $html = "

   {line}

\n"; - break; - - default: - $html = "    » {line}
"; - break; - } - - if ( $highlight ) - { - $line = '' . $line . ''; - } - - echo str_replace('{line}', $line, $html); - } - // ----------------------------------------------------------------- - -} - -/* End of file languagecheck.php */ -/* Location: ./application/controllers/languagecheck.php */ diff --git a/application/controllers/login.php b/application/controllers/login.php deleted file mode 100644 index c440c7f8f..000000000 --- a/application/controllers/login.php +++ /dev/null @@ -1,43 +0,0 @@ -Employee->is_logged_in()) - { - redirect('home'); - } - else - { - $this->form_validation->set_rules('username', 'lang:login_undername', 'callback_login_check'); - $this->form_validation->set_error_delimiters('
', '
'); - - if($this->form_validation->run() == FALSE) - { - $this->load->view('login'); - } - else - { - redirect('home'); - } - } - } - - function login_check($username) - { - $password = $this->input->post("password"); - - if(!$this->Employee->login($username,$password)) - { - $this->form_validation->set_message('login_check', $this->lang->line('login_invalid_username_and_password')); - return false; - } - return true; - } -} -?> \ No newline at end of file diff --git a/application/controllers/no_access.php b/application/controllers/no_access.php deleted file mode 100644 index 726645405..000000000 --- a/application/controllers/no_access.php +++ /dev/null @@ -1,15 +0,0 @@ -Module->get_module_name($module_id); - $this->load->view('no_access',$data); - } -} -?> \ No newline at end of file diff --git a/application/controllers/person_controller.php b/application/controllers/person_controller.php deleted file mode 100644 index 1cdbd48cf..000000000 --- a/application/controllers/person_controller.php +++ /dev/null @@ -1,45 +0,0 @@ -input->post('ids'); - - if($people_to_email!=false) - { - $mailto_url='mailto:'; - foreach($this->Person->get_multiple_info($people_to_email)->result() as $person) - { - $mailto_url.=$person->email.','; - } - //remove last comma - $mailto_url=substr($mailto_url,0,strlen($mailto_url)-1); - - echo $mailto_url; - exit; - } - echo '#'; - } - - /* - Gets one row for a person manage table. This is called using AJAX to update one row. - */ - function get_row() - { - $person_id = $this->input->post('row_id'); - $data_row=get_person_data_row($this->Person->get_info($person_id),$this); - echo $data_row; - } - -} -?> \ No newline at end of file diff --git a/application/controllers/receivings.php b/application/controllers/receivings.php deleted file mode 100644 index 766fe1c02..000000000 --- a/application/controllers/receivings.php +++ /dev/null @@ -1,197 +0,0 @@ -load->library('receiving_lib'); - } - - function index() - { - $this->_reload(); - } - - function item_search() - { - $suggestions = $this->Item->get_item_search_suggestions($this->input->post('q'),$this->input->post('limit')); - $suggestions = array_merge($suggestions, $this->Item_kit->get_item_kit_search_suggestions($this->input->post('q'),$this->input->post('limit'))); - echo implode("\n",$suggestions); - } - - function supplier_search() - { - $suggestions = $this->Supplier->get_suppliers_search_suggestions($this->input->post('q'),$this->input->post('limit')); - echo implode("\n",$suggestions); - } - - function select_supplier() - { - $supplier_id = $this->input->post("supplier"); - $this->receiving_lib->set_supplier($supplier_id); - $this->_reload(); - } - - function change_mode() - { - $mode = $this->input->post("mode"); - $this->receiving_lib->set_mode($mode); - $this->_reload(); - } - - function add() - { - $data=array(); - $mode = $this->receiving_lib->get_mode(); - $item_id_or_number_or_item_kit_or_receipt = $this->input->post("item"); - $quantity = $mode=="receive" ? 1:-1; - - if($this->receiving_lib->is_valid_receipt($item_id_or_number_or_item_kit_or_receipt) && $mode=='return') - { - $this->receiving_lib->return_entire_receiving($item_id_or_number_or_item_kit_or_receipt); - } - elseif($this->receiving_lib->is_valid_item_kit($item_id_or_number_or_item_kit_or_receipt)) - { - $this->receiving_lib->add_item_kit($item_id_or_number_or_item_kit_or_receipt); - } - elseif(!$this->receiving_lib->add_item($item_id_or_number_or_item_kit_or_receipt,$quantity)) - { - $data['error']=$this->lang->line('recvs_unable_to_add_item'); - } - $this->_reload($data); - } - - function edit_item($item_id) - { - $data= array(); - - $this->form_validation->set_rules('price', 'lang:items_price', 'required|numeric'); - $this->form_validation->set_rules('quantity', 'lang:items_quantity', 'required|integer'); - $this->form_validation->set_rules('discount', 'lang:items_discount', 'required|integer'); - - $description = $this->input->post("description"); - $serialnumber = $this->input->post("serialnumber"); - $price = $this->input->post("price"); - $quantity = $this->input->post("quantity"); - $discount = $this->input->post("discount"); - - if ($this->form_validation->run() != FALSE) - { - $this->receiving_lib->edit_item($item_id,$description,$serialnumber,$quantity,$discount,$price); - } - else - { - $data['error']=$this->lang->line('recvs_error_editing_item'); - } - - $this->_reload($data); - } - - function delete_item($item_number) - { - $this->receiving_lib->delete_item($item_number); - $this->_reload(); - } - - function delete_supplier() - { - $this->receiving_lib->delete_supplier(); - $this->_reload(); - } - - function complete() - { - $data['cart']=$this->receiving_lib->get_cart(); - $data['total']=$this->receiving_lib->get_total(); - $data['receipt_title']=$this->lang->line('recvs_receipt'); - $data['transaction_time']= date('m/d/Y h:i:s a'); - $supplier_id=$this->receiving_lib->get_supplier(); - $employee_id=$this->Employee->get_logged_in_employee_info()->person_id; - $comment = $this->input->post('comment'); - $emp_info=$this->Employee->get_info($employee_id); - $payment_type = $this->input->post('payment_type'); - $data['payment_type']=$this->input->post('payment_type'); - - if ($this->input->post('amount_tendered')) - { - $data['amount_tendered'] = $this->input->post('amount_tendered'); - $data['amount_change'] = to_currency($data['amount_tendered'] - round($data['total'], 2)); - } - $data['employee']=$emp_info->first_name.' '.$emp_info->last_name; - - if($supplier_id!=-1) - { - $suppl_info=$this->Supplier->get_info($supplier_id); - $data['supplier']=$suppl_info->first_name.' '.$suppl_info->last_name; - } - - //SAVE receiving to database - $data['receiving_id']='RECV '.$this->Receiving->save($data['cart'], $supplier_id,$employee_id,$comment,$payment_type); - - if ($data['receiving_id'] == 'RECV -1') - { - $data['error_message'] = $this->lang->line('receivings_transaction_failed'); - } - - $this->load->view("receivings/receipt",$data); - $this->receiving_lib->clear_all(); - } - - function receipt($receiving_id) - { - $receiving_info = $this->Receiving->get_info($receiving_id)->row_array(); - $this->receiving_lib->copy_entire_receiving($receiving_id); - $data['cart']=$this->receiving_lib->get_cart(); - $data['total']=$this->receiving_lib->get_total(); - $data['receipt_title']=$this->lang->line('recvs_receipt'); - $data['transaction_time']= date('m/d/Y h:i:s a', strtotime($receiving_info['receiving_time'])); - $supplier_id=$this->receiving_lib->get_supplier(); - $emp_info=$this->Employee->get_info($receiving_info['employee_id']); - $data['payment_type']=$receiving_info['payment_type']; - - $data['employee']=$emp_info->first_name.' '.$emp_info->last_name; - - if($supplier_id!=-1) - { - $supplier_info=$this->Supplier->get_info($supplier_id); - $data['supplier']=$supplier_info->first_name.' '.$supplier_info->last_name; - } - $data['receiving_id']='RECV '.$receiving_id; - $this->load->view("receivings/receipt",$data); - $this->receiving_lib->clear_all(); - - } - - function _reload($data=array()) - { - $person_info = $this->Employee->get_logged_in_employee_info(); - $data['cart']=$this->receiving_lib->get_cart(); - $data['modes']=array('receive'=>$this->lang->line('recvs_receiving'),'return'=>$this->lang->line('recvs_return')); - $data['mode']=$this->receiving_lib->get_mode(); - $data['total']=$this->receiving_lib->get_total(); - $data['items_module_allowed'] = $this->Employee->has_permission('items', $person_info->person_id); - $data['payment_options']=array( - $this->lang->line('sales_cash') => $this->lang->line('sales_cash'), - $this->lang->line('sales_check') => $this->lang->line('sales_check'), - $this->lang->line('sales_debit') => $this->lang->line('sales_debit'), - $this->lang->line('sales_credit') => $this->lang->line('sales_credit') - ); - - $supplier_id=$this->receiving_lib->get_supplier(); - if($supplier_id!=-1) - { - $info=$this->Supplier->get_info($supplier_id); - $data['supplier']=$info->first_name.' '.$info->last_name; - } - $this->load->view("receivings/receiving",$data); - } - - function cancel_receiving() - { - $this->receiving_lib->clear_all(); - $this->_reload(); - } - -} -?> \ No newline at end of file diff --git a/application/controllers/reports.php b/application/controllers/reports.php deleted file mode 100644 index ed759f047..000000000 --- a/application/controllers/reports.php +++ /dev/null @@ -1,827 +0,0 @@ -load->helper('report'); - } - - //Initial report listing screen - function index() - { - $this->load->view("reports/listing",array()); - } - - function _get_common_report_data() - { - $data = array(); - $data['report_date_range_simple'] = get_simple_date_ranges(); - $data['months'] = get_months(); - $data['days'] = get_days(); - $data['years'] = get_years(); - $data['selected_month']=date('n'); - $data['selected_day']=date('d'); - $data['selected_year']=date('Y'); - - return $data; - } - - //Input for reports that require only a date range and an export to excel. (see routes.php to see that all summary reports route here) - function date_input_excel_export() - { - $data = $this->_get_common_report_data(); - $this->load->view("reports/date_input_excel_export",$data); - } - - //Summary sales report - function summary_sales($start_date, $end_date, $sale_type, $export_excel=0) - { - $this->load->model('reports/Summary_sales'); - $model = $this->Summary_sales; - $tabular_data = array(); - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - foreach($report_data as $row) - { - $tabular_data[] = array($row['sale_date'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit'])); - } - - $data = array( - "title" => $this->lang->line('reports_sales_summary_report'), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "headers" => $model->getDataColumns(), - "data" => $tabular_data, - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)), - "export_excel" => $export_excel - ); - - $this->load->view("reports/tabular",$data); - } - - //Summary categories report - function summary_categories($start_date, $end_date, $sale_type, $export_excel=0) - { - $this->load->model('reports/Summary_categories'); - $model = $this->Summary_categories; - $tabular_data = array(); - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - foreach($report_data as $row) - { - $tabular_data[] = array($row['category'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit'])); - } - - $data = array( - "title" => $this->lang->line('reports_categories_summary_report'), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "headers" => $model->getDataColumns(), - "data" => $tabular_data, - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)), - "export_excel" => $export_excel - ); - - $this->load->view("reports/tabular",$data); - } - - //Summary customers report - function summary_customers($start_date, $end_date, $sale_type, $export_excel=0) - { - $this->load->model('reports/Summary_customers'); - $model = $this->Summary_customers; - $tabular_data = array(); - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - foreach($report_data as $row) - { - $tabular_data[] = array($row['customer'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit'])); - } - - $data = array( - "title" => $this->lang->line('reports_customers_summary_report'), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "headers" => $model->getDataColumns(), - "data" => $tabular_data, - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)), - "export_excel" => $export_excel - ); - - $this->load->view("reports/tabular",$data); - } - - //Summary suppliers report - function summary_suppliers($start_date, $end_date, $sale_type, $export_excel=0) - { - $this->load->model('reports/Summary_suppliers'); - $model = $this->Summary_suppliers; - $tabular_data = array(); - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - foreach($report_data as $row) - { - $tabular_data[] = array($row['supplier'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit'])); - } - - $data = array( - "title" => $this->lang->line('reports_suppliers_summary_report'), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "headers" => $model->getDataColumns(), - "data" => $tabular_data, - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)), - "export_excel" => $export_excel - ); - - $this->load->view("reports/tabular",$data); - } - - //Summary items report - function summary_items($start_date, $end_date, $sale_type, $export_excel=0) - { - $this->load->model('reports/Summary_items'); - $model = $this->Summary_items; - $tabular_data = array(); - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - foreach($report_data as $row) - { - $tabular_data[] = array(character_limiter($row['name'], 16), $row['quantity_purchased'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit'])); - } - - $data = array( - "title" => $this->lang->line('reports_items_summary_report'), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "headers" => $model->getDataColumns(), - "data" => $tabular_data, - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)), - "export_excel" => $export_excel - ); - - $this->load->view("reports/tabular",$data); - } - - //Summary employees report - function summary_employees($start_date, $end_date, $sale_type, $export_excel=0) - { - $this->load->model('reports/Summary_employees'); - $model = $this->Summary_employees; - $tabular_data = array(); - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - foreach($report_data as $row) - { - $tabular_data[] = array($row['employee'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit'])); - } - - $data = array( - "title" => $this->lang->line('reports_employees_summary_report'), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "headers" => $model->getDataColumns(), - "data" => $tabular_data, - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)), - "export_excel" => $export_excel - ); - - $this->load->view("reports/tabular",$data); - } - - //Summary taxes report - function summary_taxes($start_date, $end_date, $sale_type, $export_excel=0) - { - $this->load->model('reports/Summary_taxes'); - $model = $this->Summary_taxes; - $tabular_data = array(); - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - foreach($report_data as $row) - { - $tabular_data[] = array($row['percent'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax'])); - } - - $data = array( - "title" => $this->lang->line('reports_taxes_summary_report'), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "headers" => $model->getDataColumns(), - "data" => $tabular_data, - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)), - "export_excel" => $export_excel - ); - - $this->load->view("reports/tabular",$data); - } - - //Summary discounts report - function summary_discounts($start_date, $end_date, $sale_type, $export_excel=0) - { - $this->load->model('reports/Summary_discounts'); - $model = $this->Summary_discounts; - $tabular_data = array(); - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - foreach($report_data as $row) - { - $tabular_data[] = array($row['discount_percent'],$row['count']); - } - - $data = array( - "title" => $this->lang->line('reports_discounts_summary_report'), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "headers" => $model->getDataColumns(), - "data" => $tabular_data, - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)), - "export_excel" => $export_excel - ); - - $this->load->view("reports/tabular",$data); - } - - function summary_payments($start_date, $end_date, $sale_type, $export_excel=0) - { - $this->load->model('reports/Summary_payments'); - $model = $this->Summary_payments; - $tabular_data = array(); - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - foreach($report_data as $row) - { - $tabular_data[] = array($row['payment_type'],to_currency($row['payment_amount'])); - } - - $data = array( - "title" => $this->lang->line('reports_payments_summary_report'), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "headers" => $model->getDataColumns(), - "data" => $tabular_data, - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)), - "export_excel" => $export_excel - ); - - $this->load->view("reports/tabular",$data); - } - - //Input for reports that require only a date range. (see routes.php to see that all graphical summary reports route here) - function date_input() - { - $data = $this->_get_common_report_data(); - $this->load->view("reports/date_input",$data); - } - - //Graphical summary sales report - function graphical_summary_sales($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_sales'); - $model = $this->Summary_sales; - - $data = array( - "title" => $this->lang->line('reports_sales_summary_report'), - "data_file" => site_url("reports/graphical_summary_sales_graph/$start_date/$end_date/$sale_type"), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)) - ); - - $this->load->view("reports/graphical",$data); - } - - //The actual graph data - function graphical_summary_sales_graph($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_sales'); - $model = $this->Summary_sales; - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - $graph_data = array(); - foreach($report_data as $row) - { - $graph_data[date('m/d/Y', strtotime($row['sale_date']))]= $row['total']; - } - - $data = array( - "title" => $this->lang->line('reports_sales_summary_report'), - "yaxis_label"=>$this->lang->line('reports_revenue'), - "xaxis_label"=>$this->lang->line('reports_date'), - "data" => $graph_data - ); - - $this->load->view("reports/graphs/line",$data); - - } - - //Graphical summary items report - function graphical_summary_items($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_items'); - $model = $this->Summary_items; - - $data = array( - "title" => $this->lang->line('reports_items_summary_report'), - "data_file" => site_url("reports/graphical_summary_items_graph/$start_date/$end_date/$sale_type"), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)) - ); - - $this->load->view("reports/graphical",$data); - } - - //The actual graph data - function graphical_summary_items_graph($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_items'); - $model = $this->Summary_items; - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - $graph_data = array(); - foreach($report_data as $row) - { - $graph_data[$row['name']] = $row['total']; - } - - $data = array( - "title" => $this->lang->line('reports_items_summary_report'), - "xaxis_label"=>$this->lang->line('reports_revenue'), - "yaxis_label"=>$this->lang->line('reports_items'), - "data" => $graph_data - ); - - $this->load->view("reports/graphs/hbar",$data); - } - - //Graphical summary customers report - function graphical_summary_categories($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_categories'); - $model = $this->Summary_categories; - - $data = array( - "title" => $this->lang->line('reports_categories_summary_report'), - "data_file" => site_url("reports/graphical_summary_categories_graph/$start_date/$end_date/$sale_type"), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)) - ); - - $this->load->view("reports/graphical",$data); - } - - //The actual graph data - function graphical_summary_categories_graph($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_categories'); - $model = $this->Summary_categories; - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - $graph_data = array(); - foreach($report_data as $row) - { - $graph_data[$row['category']] = $row['total']; - } - - $data = array( - "title" => $this->lang->line('reports_categories_summary_report'), - "data" => $graph_data - ); - - $this->load->view("reports/graphs/pie",$data); - } - - function graphical_summary_suppliers($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_suppliers'); - $model = $this->Summary_suppliers; - - $data = array( - "title" => $this->lang->line('reports_suppliers_summary_report'), - "data_file" => site_url("reports/graphical_summary_suppliers_graph/$start_date/$end_date/$sale_type"), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)) - ); - - $this->load->view("reports/graphical",$data); - } - - //The actual graph data - function graphical_summary_suppliers_graph($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_suppliers'); - $model = $this->Summary_suppliers; - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - $graph_data = array(); - foreach($report_data as $row) - { - $graph_data[$row['supplier']] = $row['total']; - } - - $data = array( - "title" => $this->lang->line('reports_suppliers_summary_report'), - "data" => $graph_data - ); - - $this->load->view("reports/graphs/pie",$data); - } - - function graphical_summary_employees($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_employees'); - $model = $this->Summary_employees; - - $data = array( - "title" => $this->lang->line('reports_employees_summary_report'), - "data_file" => site_url("reports/graphical_summary_employees_graph/$start_date/$end_date/$sale_type"), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)) - ); - - $this->load->view("reports/graphical",$data); - } - - //The actual graph data - function graphical_summary_employees_graph($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_employees'); - $model = $this->Summary_employees; - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - $graph_data = array(); - foreach($report_data as $row) - { - $graph_data[$row['employee']] = $row['total']; - } - - $data = array( - "title" => $this->lang->line('reports_employees_summary_report'), - "data" => $graph_data - ); - - $this->load->view("reports/graphs/pie",$data); - } - - function graphical_summary_taxes($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_taxes'); - $model = $this->Summary_taxes; - - $data = array( - "title" => $this->lang->line('reports_taxes_summary_report'), - "data_file" => site_url("reports/graphical_summary_taxes_graph/$start_date/$end_date/$sale_type"), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)) - ); - - $this->load->view("reports/graphical",$data); - } - - //The actual graph data - function graphical_summary_taxes_graph($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_taxes'); - $model = $this->Summary_taxes; - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - $graph_data = array(); - foreach($report_data as $row) - { - $graph_data[$row['percent']] = $row['total']; - } - - $data = array( - "title" => $this->lang->line('reports_taxes_summary_report'), - "data" => $graph_data - ); - - $this->load->view("reports/graphs/pie",$data); - } - - //Graphical summary customers report - function graphical_summary_customers($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_customers'); - $model = $this->Summary_customers; - - $data = array( - "title" => $this->lang->line('reports_customers_summary_report'), - "data_file" => site_url("reports/graphical_summary_customers_graph/$start_date/$end_date/$sale_type"), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)) - ); - - $this->load->view("reports/graphical",$data); - } - - //The actual graph data - function graphical_summary_customers_graph($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_customers'); - $model = $this->Summary_customers; - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - $graph_data = array(); - foreach($report_data as $row) - { - $graph_data[$row['customer']] = $row['total']; - } - - $data = array( - "title" => $this->lang->line('reports_customers_summary_report'), - "xaxis_label"=>$this->lang->line('reports_revenue'), - "yaxis_label"=>$this->lang->line('reports_customers'), - "data" => $graph_data - ); - - $this->load->view("reports/graphs/hbar",$data); - } - - //Graphical summary discounts report - function graphical_summary_discounts($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_discounts'); - $model = $this->Summary_discounts; - - $data = array( - "title" => $this->lang->line('reports_discounts_summary_report'), - "data_file" => site_url("reports/graphical_summary_discounts_graph/$start_date/$end_date/$sale_type"), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)) - ); - - $this->load->view("reports/graphical",$data); - } - - //The actual graph data - function graphical_summary_discounts_graph($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_discounts'); - $model = $this->Summary_discounts; - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - $graph_data = array(); - foreach($report_data as $row) - { - $graph_data[$row['discount_percent']] = $row['count']; - } - - $data = array( - "title" => $this->lang->line('reports_discounts_summary_report'), - "yaxis_label"=>$this->lang->line('reports_count'), - "xaxis_label"=>$this->lang->line('reports_discount_percent'), - "data" => $graph_data - ); - - $this->load->view("reports/graphs/bar",$data); - } - - function graphical_summary_payments($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_payments'); - $model = $this->Summary_payments; - - $data = array( - "title" => $this->lang->line('reports_payments_summary_report'), - "data_file" => site_url("reports/graphical_summary_payments_graph/$start_date/$end_date/$sale_type"), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)) - ); - - $this->load->view("reports/graphical",$data); - } - - //The actual graph data - function graphical_summary_payments_graph($start_date, $end_date, $sale_type) - { - $this->load->model('reports/Summary_payments'); - $model = $this->Summary_payments; - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - $graph_data = array(); - foreach($report_data as $row) - { - $graph_data[$row['payment_type']] = $row['payment_amount']; - } - - $data = array( - "title" => $this->lang->line('reports_payments_summary_report'), - "yaxis_label"=>$this->lang->line('reports_revenue'), - "xaxis_label"=>$this->lang->line('reports_payment_type'), - "data" => $graph_data - ); - - $this->load->view("reports/graphs/pie",$data); - } - function specific_customer_input() - { - $data = $this->_get_common_report_data(); - $data['specific_input_name'] = $this->lang->line('reports_customer'); - - $customers = array(); - foreach($this->Customer->get_all()->result() as $customer) - { - $customers[$customer->person_id] = $customer->first_name .' '.$customer->last_name; - } - $data['specific_input_data'] = $customers; - $this->load->view("reports/specific_input",$data); - } - - function specific_customer($start_date, $end_date, $customer_id, $sale_type, $export_excel=0) - { - $this->load->model('reports/Specific_customer'); - $model = $this->Specific_customer; - - $headers = $model->getDataColumns(); - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'customer_id' =>$customer_id, 'sale_type' => $sale_type)); - - $summary_data = array(); - $details_data = array(); - - foreach($report_data['summary'] as $key=>$row) - { - $summary_data[] = array(anchor('sales/edit/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target' => '_blank')), $row['sale_date'], $row['items_purchased'], $row['employee_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit']), $row['payment_type'], $row['comment']); - - foreach($report_data['details'][$key] as $drow) - { - $details_data[$key][] = array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], $drow['quantity_purchased'], to_currency($drow['subtotal']), to_currency($drow['total']), to_currency($drow['tax']),to_currency($drow['profit']), $drow['discount_percent'].'%'); - } - } - - $customer_info = $this->Customer->get_info($customer_id); - $data = array( - "title" => $customer_info->first_name .' '. $customer_info->last_name.' '.$this->lang->line('reports_report'), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "headers" => $model->getDataColumns(), - "summary_data" => $summary_data, - "details_data" => $details_data, - "overall_summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date,'customer_id' =>$customer_id, 'sale_type' => $sale_type)), - "export_excel" => $export_excel - ); - - $this->load->view("reports/tabular_details",$data); - } - - function specific_employee_input() - { - $data = $this->_get_common_report_data(); - $data['specific_input_name'] = $this->lang->line('reports_employee'); - - $employees = array(); - foreach($this->Employee->get_all()->result() as $employee) - { - $employees[$employee->person_id] = $employee->first_name .' '.$employee->last_name; - } - $data['specific_input_data'] = $employees; - $this->load->view("reports/specific_input",$data); - } - - function specific_employee($start_date, $end_date, $employee_id, $sale_type, $export_excel=0) - { - $this->load->model('reports/Specific_employee'); - $model = $this->Specific_employee; - - $headers = $model->getDataColumns(); - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'employee_id' =>$employee_id, 'sale_type' => $sale_type)); - - $summary_data = array(); - $details_data = array(); - - foreach($report_data['summary'] as $key=>$row) - { - $summary_data[] = array(anchor('sales/edit/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target' => '_blank')), $row['sale_date'], $row['items_purchased'], $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit']), $row['payment_type'], $row['comment']); - - foreach($report_data['details'][$key] as $drow) - { - $details_data[$key][] = array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], $drow['quantity_purchased'], to_currency($drow['subtotal']), to_currency($drow['total']), to_currency($drow['tax']),to_currency($drow['profit']), $drow['discount_percent'].'%'); - } - } - - $employee_info = $this->Employee->get_info($employee_id); - $data = array( - "title" => $employee_info->first_name .' '. $employee_info->last_name.' '.$this->lang->line('reports_report'), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "headers" => $model->getDataColumns(), - "summary_data" => $summary_data, - "details_data" => $details_data, - "overall_summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date,'employee_id' =>$employee_id, 'sale_type' => $sale_type)), - "export_excel" => $export_excel - ); - - $this->load->view("reports/tabular_details",$data); - } - - function detailed_sales($start_date, $end_date, $sale_type, $export_excel=0) - { - $this->load->model('reports/Detailed_sales'); - $model = $this->Detailed_sales; - - $headers = $model->getDataColumns(); - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - $summary_data = array(); - $details_data = array(); - - foreach($report_data['summary'] as $key=>$row) - { - $summary_data[] = array(anchor('sales/edit/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target' => '_blank')), $row['sale_date'], $row['items_purchased'], $row['employee_name'], $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit']), $row['payment_type'], $row['comment']); - - foreach($report_data['details'][$key] as $drow) - { - $details_data[$key][] = array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], $drow['quantity_purchased'], to_currency($drow['subtotal']), to_currency($drow['total']), to_currency($drow['tax']),to_currency($drow['profit']), $drow['discount_percent'].'%'); - } - } - - $data = array( - "title" =>$this->lang->line('reports_detailed_sales_report'), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "headers" => $model->getDataColumns(), - "summary_data" => $summary_data, - "details_data" => $details_data, - "overall_summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)), - "export_excel" => $export_excel - ); - - $this->load->view("reports/tabular_details",$data); - } - - function detailed_receivings($start_date, $end_date, $sale_type, $export_excel=0) - { - $this->load->model('reports/Detailed_receivings'); - $model = $this->Detailed_receivings; - - $headers = $model->getDataColumns(); - $report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)); - - $summary_data = array(); - $details_data = array(); - - foreach($report_data['summary'] as $key=>$row) - { - $summary_data[] = array(anchor('receivings/receipt/'.$row['receiving_id'], 'RECV '.$row['receiving_id'], array('target' => '_blank')), $row['receiving_date'], $row['items_purchased'], $row['employee_name'], $row['supplier_name'], to_currency($row['total']), $row['payment_type'], $row['comment']); - - foreach($report_data['details'][$key] as $drow) - { - $details_data[$key][] = array($drow['name'], $drow['category'], $drow['quantity_purchased'], to_currency($drow['total']), $drow['discount_percent'].'%'); - } - } - - $data = array( - "title" =>$this->lang->line('reports_detailed_receivings_report'), - "subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)), - "headers" => $model->getDataColumns(), - "summary_data" => $summary_data, - "details_data" => $details_data, - "overall_summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)), - "export_excel" => $export_excel - ); - - $this->load->view("reports/tabular_details",$data); - } - - function excel_export() - { - $this->load->view("reports/excel_export",array()); - } - - function inventory_low($export_excel=0) - { - $this->load->model('reports/Inventory_low'); - $model = $this->Inventory_low; - $tabular_data = array(); - $report_data = $model->getData(array()); - foreach($report_data as $row) - { - $tabular_data[] = array($row['name'], $row['item_number'], $row['description'], $row['quantity'], $row['reorder_level']); - } - - $data = array( - "title" => $this->lang->line('reports_low_inventory_report'), - "subtitle" => '', - "headers" => $model->getDataColumns(), - "data" => $tabular_data, - "summary_data" => $model->getSummaryData(array()), - "export_excel" => $export_excel - ); - - $this->load->view("reports/tabular",$data); - } - - function inventory_summary($export_excel=0) - { - $this->load->model('reports/Inventory_summary'); - $model = $this->Inventory_summary; - $tabular_data = array(); - $report_data = $model->getData(array()); - foreach($report_data as $row) - { - $tabular_data[] = array($row['name'], $row['item_number'], $row['description'], $row['quantity'], $row['reorder_level']); - } - - $data = array( - "title" => $this->lang->line('reports_inventory_summary_report'), - "subtitle" => '', - "headers" => $model->getDataColumns(), - "data" => $tabular_data, - "summary_data" => $model->getSummaryData(array()), - "export_excel" => $export_excel - ); - - $this->load->view("reports/tabular",$data); - } - -} -?> \ No newline at end of file diff --git a/application/controllers/sales.php b/application/controllers/sales.php deleted file mode 100644 index 45da72a40..000000000 --- a/application/controllers/sales.php +++ /dev/null @@ -1,430 +0,0 @@ -load->library('sale_lib'); - } - - function index() - { - $this->_reload(); - } - - function item_search() - { - $suggestions = $this->Item->get_item_search_suggestions($this->input->post('q'),$this->input->post('limit')); - $suggestions = array_merge($suggestions, $this->Item_kit->get_item_kit_search_suggestions($this->input->post('q'),$this->input->post('limit'))); - echo implode("\n",$suggestions); - } - - function customer_search() - { - $suggestions = $this->Customer->get_customer_search_suggestions($this->input->post('q'),$this->input->post('limit')); - echo implode("\n",$suggestions); - } - - function select_customer() - { - $customer_id = $this->input->post("customer"); - $this->sale_lib->set_customer($customer_id); - $this->_reload(); - } - - function change_mode() - { - $mode = $this->input->post("mode"); - $this->sale_lib->set_mode($mode); - $this->_reload(); - } - - function set_comment() - { - $this->sale_lib->set_comment($this->input->post('comment')); - } - - function set_email_receipt() - { - $this->sale_lib->set_email_receipt($this->input->post('email_receipt')); - } - - //Alain Multiple Payments - function add_payment() - { - $data=array(); - $this->form_validation->set_rules('amount_tendered', 'lang:sales_amount_tendered', 'numeric'); - - if ($this->form_validation->run() == FALSE) - { - if ( $this->input->post('payment_type') == $this->lang->line('sales_gift_card') ) - $data['error']=$this->lang->line('sales_must_enter_numeric_giftcard'); - else - $data['error']=$this->lang->line('sales_must_enter_numeric'); - - $this->_reload($data); - return; - } - - $payment_type=$this->input->post('payment_type'); - if ( $payment_type == $this->lang->line('sales_giftcard') ) - { - $payments = $this->sale_lib->get_payments(); - $payment_type=$this->input->post('payment_type').':'.$payment_amount=$this->input->post('amount_tendered'); - $current_payments_with_giftcard = isset($payments[$payment_type]) ? $payments[$payment_type]['payment_amount'] : 0; - $cur_giftcard_value = $this->Giftcard->get_giftcard_value( $this->input->post('amount_tendered') ) - $current_payments_with_giftcard; - if ( $cur_giftcard_value <= 0 ) - { - $data['error']='Giftcard balance is '.to_currency( $this->Giftcard->get_giftcard_value( $this->input->post('amount_tendered') ) ).' !'; - $this->_reload($data); - return; - } - elseif ( ( $this->Giftcard->get_giftcard_value( $this->input->post('amount_tendered') ) - $this->sale_lib->get_total() ) > 0 ) - { - $data['warning']='Giftcard balance is '.to_currency( $this->Giftcard->get_giftcard_value( $this->input->post('amount_tendered') ) - $this->sale_lib->get_total() ).' !'; - } - $payment_amount=min( $this->sale_lib->get_total(), $this->Giftcard->get_giftcard_value( $this->input->post('amount_tendered') ) ); - } - else - { - $payment_amount=$this->input->post('amount_tendered'); - } - - if( !$this->sale_lib->add_payment( $payment_type, $payment_amount ) ) - { - $data['error']='Unable to Add Payment! Please try again!'; - } - - $this->_reload($data); - } - - //Alain Multiple Payments - function delete_payment($payment_id) - { - $this->sale_lib->delete_payment($payment_id); - $this->_reload(); - } - - function add() - { - $data=array(); - $mode = $this->sale_lib->get_mode(); - $item_id_or_number_or_item_kit_or_receipt = $this->input->post("item"); - $quantity = $mode=="sale" ? 1:-1; - - if($this->sale_lib->is_valid_receipt($item_id_or_number_or_item_kit_or_receipt) && $mode=='return') - { - $this->sale_lib->return_entire_sale($item_id_or_number_or_item_kit_or_receipt); - } - elseif($this->sale_lib->is_valid_item_kit($item_id_or_number_or_item_kit_or_receipt)) - { - $this->sale_lib->add_item_kit($item_id_or_number_or_item_kit_or_receipt); - } - elseif(!$this->sale_lib->add_item($item_id_or_number_or_item_kit_or_receipt,$quantity)) - { - $data['error']=$this->lang->line('sales_unable_to_add_item'); - } - - if($this->sale_lib->out_of_stock($item_id_or_number_or_item_kit_or_receipt)) - { - $data['warning'] = $this->lang->line('sales_quantity_less_than_zero'); - } - $this->_reload($data); - } - - function edit_item($line) - { - $data= array(); - - $this->form_validation->set_rules('price', 'lang:items_price', 'required|numeric'); - $this->form_validation->set_rules('quantity', 'lang:items_quantity', 'required|numeric'); - - $description = $this->input->post("description"); - $serialnumber = $this->input->post("serialnumber"); - $price = $this->input->post("price"); - $quantity = $this->input->post("quantity"); - $discount = $this->input->post("discount"); - - - if ($this->form_validation->run() != FALSE) - { - $this->sale_lib->edit_item($line,$description,$serialnumber,$quantity,$discount,$price); - } - else - { - $data['error']=$this->lang->line('sales_error_editing_item'); - } - - if($this->sale_lib->out_of_stock($this->sale_lib->get_item_id($line))) - { - $data['warning'] = $this->lang->line('sales_quantity_less_than_zero'); - } - - - $this->_reload($data); - } - - function delete_item($item_number) - { - $this->sale_lib->delete_item($item_number); - $this->_reload(); - } - - function remove_customer() - { - $this->sale_lib->remove_customer(); - $this->_reload(); - } - - function complete() - { - $data['cart']=$this->sale_lib->get_cart(); - $data['subtotal']=$this->sale_lib->get_subtotal(); - $data['taxes']=$this->sale_lib->get_taxes(); - $data['total']=$this->sale_lib->get_total(); - $data['receipt_title']=$this->lang->line('sales_receipt'); - $data['transaction_time']= date('m/d/Y h:i:s a'); - $customer_id=$this->sale_lib->get_customer(); - $employee_id=$this->Employee->get_logged_in_employee_info()->person_id; - $comment = $this->sale_lib->get_comment(); - $emp_info=$this->Employee->get_info($employee_id); - $data['payments']=$this->sale_lib->get_payments(); - $data['amount_change']=to_currency($this->sale_lib->get_amount_due() * -1); - $data['employee']=$emp_info->first_name.' '.$emp_info->last_name; - - if($customer_id!=-1) - { - $cust_info=$this->Customer->get_info($customer_id); - $data['customer']=$cust_info->first_name.' '.$cust_info->last_name; - } - - //SAVE sale to database - $data['sale_id']='POS '.$this->Sale->save($data['cart'], $customer_id,$employee_id,$comment,$data['payments']); - if ($data['sale_id'] == 'POS -1') - { - $data['error_message'] = $this->lang->line('sales_transaction_failed'); - } - else - { - if ($this->sale_lib->get_email_receipt() && !empty($cust_info->email)) - { - $this->load->library('email'); - $config['mailtype'] = 'html'; - $this->email->initialize($config); - $this->email->from($this->config->item('email'), $this->config->item('company')); - $this->email->to($cust_info->email); - - $this->email->subject($this->lang->line('sales_receipt')); - $this->email->message($this->load->view("sales/receipt_email",$data, true)); - $this->email->send(); - } - } - $this->load->view("sales/receipt",$data); - $this->sale_lib->clear_all(); - } - - function receipt($sale_id) - { - $sale_info = $this->Sale->get_info($sale_id)->row_array(); - $this->sale_lib->copy_entire_sale($sale_id); - $data['cart']=$this->sale_lib->get_cart(); - $data['payments']=$this->sale_lib->get_payments(); - $data['subtotal']=$this->sale_lib->get_subtotal(); - $data['taxes']=$this->sale_lib->get_taxes(); - $data['total']=$this->sale_lib->get_total(); - $data['receipt_title']=$this->lang->line('sales_receipt'); - $data['transaction_time']= date('m/d/Y h:i:s a', strtotime($sale_info['sale_time'])); - $customer_id=$this->sale_lib->get_customer(); - $emp_info=$this->Employee->get_info($sale_info['employee_id']); - $data['payment_type']=$sale_info['payment_type']; - $data['amount_change']=to_currency($this->sale_lib->get_amount_due() * -1); - $data['employee']=$emp_info->first_name.' '.$emp_info->last_name; - - if($customer_id!=-1) - { - $cust_info=$this->Customer->get_info($customer_id); - $data['customer']=$cust_info->first_name.' '.$cust_info->last_name; - } - $data['sale_id']='POS '.$sale_id; - $this->load->view("sales/receipt",$data); - $this->sale_lib->clear_all(); - - } - - function edit($sale_id) - { - $data = array(); - - $data['customers'] = array('' => 'No Customer'); - foreach ($this->Customer->get_all()->result() as $customer) - { - $data['customers'][$customer->person_id] = $customer->first_name . ' '. $customer->last_name; - } - - $data['employees'] = array(); - foreach ($this->Employee->get_all()->result() as $employee) - { - $data['employees'][$employee->person_id] = $employee->first_name . ' '. $employee->last_name; - } - - $data['sale_info'] = $this->Sale->get_info($sale_id)->row_array(); - - - $this->load->view('sales/edit', $data); - } - - function delete($sale_id) - { - $data = array(); - - if ($this->Sale->delete($sale_id)) - { - $data['success'] = true; - } - else - { - $data['success'] = false; - } - - $this->load->view('sales/delete', $data); - - } - - function save($sale_id) - { - $sale_data = array( - 'sale_time' => date('Y-m-d', strtotime($this->input->post('date'))), - 'customer_id' => $this->input->post('customer_id') ? $this->input->post('customer_id') : null, - 'employee_id' => $this->input->post('employee_id'), - 'comment' => $this->input->post('comment') - ); - - if ($this->Sale->update($sale_data, $sale_id)) - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('sales_successfully_updated'))); - } - else - { - echo json_encode(array('success'=>false,'message'=>$this->lang->line('sales_unsuccessfully_updated'))); - } - } - - function _payments_cover_total() - { - $total_payments = 0; - - foreach($this->sale_lib->get_payments() as $payment) - { - $total_payments += $payment['payment_amount']; - } - - /* Changed the conditional to account for floating point rounding */ - if ( ( $this->sale_lib->get_mode() == 'sale' ) && ( ( to_currency_no_money( $this->sale_lib->get_total() ) - $total_payments ) > 1e-6 ) ) - { - return false; - } - - return true; - } - - function _reload($data=array()) - { - $person_info = $this->Employee->get_logged_in_employee_info(); - $data['cart']=$this->sale_lib->get_cart(); - $data['modes']=array('sale'=>$this->lang->line('sales_sale'),'return'=>$this->lang->line('sales_return')); - $data['mode']=$this->sale_lib->get_mode(); - $data['subtotal']=$this->sale_lib->get_subtotal(); - $data['taxes']=$this->sale_lib->get_taxes(); - $data['total']=$this->sale_lib->get_total(); - $data['items_module_allowed'] = $this->Employee->has_permission('items', $person_info->person_id); - $data['comment'] = $this->sale_lib->get_comment(); - $data['email_receipt'] = $this->sale_lib->get_email_receipt(); - $data['payments_total']=$this->sale_lib->get_payments_total(); - $data['amount_due']=$this->sale_lib->get_amount_due(); - $data['payments']=$this->sale_lib->get_payments(); - $data['payment_options']=array( - $this->lang->line('sales_cash') => $this->lang->line('sales_cash'), - $this->lang->line('sales_check') => $this->lang->line('sales_check'), - $this->lang->line('sales_giftcard') => $this->lang->line('sales_giftcard'), - $this->lang->line('sales_debit') => $this->lang->line('sales_debit'), - $this->lang->line('sales_credit') => $this->lang->line('sales_credit') - ); - - $customer_id=$this->sale_lib->get_customer(); - if($customer_id!=-1) - { - $info=$this->Customer->get_info($customer_id); - $data['customer']=$info->first_name.' '.$info->last_name; - $data['customer_email']=$info->email; - } - $data['payments_cover_total'] = $this->_payments_cover_total(); - $this->load->view("sales/register",$data); - } - - function cancel_sale() - { - $this->sale_lib->clear_all(); - $this->_reload(); - - } - - function suspend() - { - $data['cart']=$this->sale_lib->get_cart(); - $data['subtotal']=$this->sale_lib->get_subtotal(); - $data['taxes']=$this->sale_lib->get_taxes(); - $data['total']=$this->sale_lib->get_total(); - $data['receipt_title']=$this->lang->line('sales_receipt'); - $data['transaction_time']= date('m/d/Y h:i:s a'); - $customer_id=$this->sale_lib->get_customer(); - $employee_id=$this->Employee->get_logged_in_employee_info()->person_id; - $comment = $this->input->post('comment'); - $emp_info=$this->Employee->get_info($employee_id); - $payment_type = $this->input->post('payment_type'); - $data['payment_type']=$this->input->post('payment_type'); - //Alain Multiple payments - $data['payments']=$this->sale_lib->get_payments(); - $data['amount_change']=to_currency($this->sale_lib->get_amount_due() * -1); - $data['employee']=$emp_info->first_name.' '.$emp_info->last_name; - - if($customer_id!=-1) - { - $cust_info=$this->Customer->get_info($customer_id); - $data['customer']=$cust_info->first_name.' '.$cust_info->last_name; - } - - $total_payments = 0; - - foreach($data['payments'] as $payment) - { - $total_payments += $payment['payment_amount']; - } - - //SAVE sale to database - $data['sale_id']='POS '.$this->Sale_suspended->save($data['cart'], $customer_id,$employee_id,$comment,$data['payments']); - if ($data['sale_id'] == 'POS -1') - { - $data['error_message'] = $this->lang->line('sales_transaction_failed'); - } - $this->sale_lib->clear_all(); - $this->_reload(array('success' => $this->lang->line('sales_successfully_suspended_sale'))); - } - - function suspended() - { - $data = array(); - $data['suspended_sales'] = $this->Sale_suspended->get_all()->result_array(); - $this->load->view('sales/suspended', $data); - } - - function unsuspend() - { - $sale_id = $this->input->post('suspended_sale_id'); - $this->sale_lib->clear_all(); - $this->sale_lib->copy_entire_suspended_sale($sale_id); - $this->Sale_suspended->delete($sale_id); - $this->_reload(); - } -} -?> \ No newline at end of file diff --git a/application/controllers/secure_area.php b/application/controllers/secure_area.php deleted file mode 100644 index 7a9bd61f6..000000000 --- a/application/controllers/secure_area.php +++ /dev/null @@ -1,29 +0,0 @@ -load->model('Employee'); - if(!$this->Employee->is_logged_in()) - { - redirect('login'); - } - - if(!$this->Employee->has_permission($module_id,$this->Employee->get_logged_in_employee_info()->person_id)) - { - redirect('no_access/'.$module_id); - } - - //load up global data - $logged_in_employee_info=$this->Employee->get_logged_in_employee_info(); - $data['allowed_modules']=$this->Module->get_allowed_modules($logged_in_employee_info->person_id); - $data['user_info']=$logged_in_employee_info; - $this->load->vars($data); - } -} -?> \ No newline at end of file diff --git a/application/controllers/suppliers.php b/application/controllers/suppliers.php deleted file mode 100644 index eafcb9905..000000000 --- a/application/controllers/suppliers.php +++ /dev/null @@ -1,130 +0,0 @@ -Supplier->count_all(); - $config['per_page'] = '20'; - $this->pagination->initialize($config); - - $data['controller_name']=strtolower(get_class()); - $data['form_width']=$this->get_form_width(); - $data['manage_table']=get_supplier_manage_table($this->Supplier->get_all($config['per_page'], $this->input->get('per_page')),$this); - $this->load->view('suppliers/manage',$data); - } - - /* - Returns supplier table data rows. This will be called with AJAX. - */ - function search() - { - $search=$this->input->post('search'); - $data_rows=get_supplier_manage_table_data_rows($this->Supplier->search($search),$this); - echo $data_rows; - } - - /* - Gives search suggestions based on what is being searched for - */ - function suggest() - { - $suggestions = $this->Supplier->get_search_suggestions($this->input->post('q'),$this->input->post('limit')); - echo implode("\n",$suggestions); - } - - /* - Loads the supplier edit form - */ - function view($supplier_id=-1) - { - $data['person_info']=$this->Supplier->get_info($supplier_id); - $this->load->view("suppliers/form",$data); - } - - /* - Inserts/updates a supplier - */ - function save($supplier_id=-1) - { - $person_data = array( - 'first_name'=>$this->input->post('first_name'), - 'last_name'=>$this->input->post('last_name'), - 'email'=>$this->input->post('email'), - 'phone_number'=>$this->input->post('phone_number'), - 'address_1'=>$this->input->post('address_1'), - 'address_2'=>$this->input->post('address_2'), - 'city'=>$this->input->post('city'), - 'state'=>$this->input->post('state'), - 'zip'=>$this->input->post('zip'), - 'country'=>$this->input->post('country'), - 'comments'=>$this->input->post('comments') - ); - $supplier_data=array( - 'company_name'=>$this->input->post('company_name'), - 'account_number'=>$this->input->post('account_number')=='' ? null:$this->input->post('account_number'), - ); - if($this->Supplier->save($person_data,$supplier_data,$supplier_id)) - { - //New supplier - if($supplier_id==-1) - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('suppliers_successful_adding').' '. - $supplier_data['company_name'],'person_id'=>$supplier_data['person_id'])); - } - else //previous supplier - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('suppliers_successful_updating').' '. - $supplier_data['company_name'],'person_id'=>$supplier_id)); - } - } - else//failure - { - echo json_encode(array('success'=>false,'message'=>$this->lang->line('suppliers_error_adding_updating').' '. - $supplier_data['company_name'],'person_id'=>-1)); - } - } - - /* - This deletes suppliers from the suppliers table - */ - function delete() - { - $suppliers_to_delete=$this->input->post('ids'); - - if($this->Supplier->delete_list($suppliers_to_delete)) - { - echo json_encode(array('success'=>true,'message'=>$this->lang->line('suppliers_successful_deleted').' '. - count($suppliers_to_delete).' '.$this->lang->line('suppliers_one_or_multiple'))); - } - else - { - echo json_encode(array('success'=>false,'message'=>$this->lang->line('suppliers_cannot_be_deleted'))); - } - } - - /* - Gets one row for a supplier manage table. This is called using AJAX to update one row. - */ - function get_row() - { - $person_id = $this->input->post('row_id'); - $data_row=get_supplier_data_row($this->Supplier->get_info($person_id),$this); - echo $data_row; - } - - /* - get the width for the add/edit form - */ - function get_form_width() - { - return 360; - } -} -?> \ No newline at end of file diff --git a/application/errors/error_404.php b/application/errors/error_404.php deleted file mode 100644 index 1c513a205..000000000 --- a/application/errors/error_404.php +++ /dev/null @@ -1,34 +0,0 @@ - - -404 Page Not Found - - - -
-

- -
- - \ No newline at end of file diff --git a/application/errors/error_db.php b/application/errors/error_db.php deleted file mode 100644 index 1ce52dfc9..000000000 --- a/application/errors/error_db.php +++ /dev/null @@ -1,34 +0,0 @@ - - -Database Error - - - -
-

- -
- - \ No newline at end of file diff --git a/application/errors/error_general.php b/application/errors/error_general.php deleted file mode 100644 index d8610702b..000000000 --- a/application/errors/error_general.php +++ /dev/null @@ -1,34 +0,0 @@ - - -Error - - - -
-

- -
- - \ No newline at end of file diff --git a/application/errors/error_php.php b/application/errors/error_php.php deleted file mode 100644 index f085c2037..000000000 --- a/application/errors/error_php.php +++ /dev/null @@ -1,10 +0,0 @@ -
- -

A PHP Error was encountered

- -

Severity:

-

Message:

-

Filename:

-

Line Number:

- -
\ No newline at end of file diff --git a/application/errors/index.html b/application/errors/index.html deleted file mode 100644 index 065d2da5e..000000000 --- a/application/errors/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

Directory access is forbidden.

- - - \ No newline at end of file diff --git a/application/helpers/currency_helper.php b/application/helpers/currency_helper.php deleted file mode 100644 index d6808527d..000000000 --- a/application/helpers/currency_helper.php +++ /dev/null @@ -1,21 +0,0 @@ -config->item('currency_symbol') ? $CI->config->item('currency_symbol') : '$'; - if($number >= 0) - { - return $currency_symbol.number_format($number, 2, '.', ''); - } - else - { - return '-'.$currency_symbol.number_format(abs($number), 2, '.', ''); - } -} - - -function to_currency_no_money($number) -{ - return number_format($number, 2, '.', ''); -} -?> \ No newline at end of file diff --git a/application/helpers/index.html b/application/helpers/index.html deleted file mode 100644 index 065d2da5e..000000000 --- a/application/helpers/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

Directory access is forbidden.

- - - \ No newline at end of file diff --git a/application/helpers/report_helper.php b/application/helpers/report_helper.php deleted file mode 100644 index 2b380e316..000000000 --- a/application/helpers/report_helper.php +++ /dev/null @@ -1,87 +0,0 @@ -load->language('reports'); - $today = date('Y-m-d'); - $yesterday = date('Y-m-d', mktime(0,0,0,date("m"),date("d")-1,date("Y"))); - $six_days_ago = date('Y-m-d', mktime(0,0,0,date("m"),date("d")-6,date("Y"))); - $start_of_this_month = date('Y-m-d', mktime(0,0,0,date("m"),1,date("Y"))); - $end_of_this_month = date('Y-m-d',strtotime('-1 second',strtotime('+1 month',strtotime(date('m').'/01/'.date('Y').' 00:00:00')))); - $start_of_last_month = date('Y-m-d', mktime(0,0,0,date("m")-1,1,date("Y"))); - $end_of_last_month = date('Y-m-d',strtotime('-1 second',strtotime('+1 month',strtotime((date('m') - 1).'/01/'.date('Y').' 00:00:00')))); - $start_of_this_year = date('Y-m-d', mktime(0,0,0,1,1,date("Y"))); - $end_of_this_year = date('Y-m-d', mktime(0,0,0,12,31,date("Y"))); - $start_of_last_year = date('Y-m-d', mktime(0,0,0,1,1,date("Y")-1)); - $end_of_last_year = date('Y-m-d', mktime(0,0,0,12,31,date("Y")-1)); - $start_of_time = date('Y-m-d', 0); - - return array( - $today. '/' . $today => $CI->lang->line('reports_today'), - $yesterday. '/' . $yesterday => $CI->lang->line('reports_yesterday'), - $six_days_ago. '/' . $today => $CI->lang->line('reports_last_7'), - $start_of_this_month . '/' . $end_of_this_month => $CI->lang->line('reports_this_month'), - $start_of_last_month . '/' . $end_of_last_month => $CI->lang->line('reports_last_month'), - $start_of_this_year . '/' . $end_of_this_year => $CI->lang->line('reports_this_year'), - $start_of_last_year . '/' . $end_of_last_year => $CI->lang->line('reports_last_year'), - $start_of_time . '/' . $today => $CI->lang->line('reports_all_time'), - ); -} - -function get_months() -{ - $months = array(); - for($k=1;$k<=12;$k++) - { - $cur_month = mktime(0, 0, 0, $k, 1, 2000); - $months[date("m", $cur_month)] = date("M",$cur_month); - } - - return $months; -} - -function get_days() -{ - $days = array(); - - for($k=1;$k<=31;$k++) - { - $cur_day = mktime(0, 0, 0, 1, $k, 2000); - $days[date('d',$cur_day)] = date('j',$cur_day); - } - - return $days; -} - -function get_years() -{ - $years = array(); - for($k=0;$k<10;$k++) - { - $years[date("Y")-$k] = date("Y")-$k; - } - - return $years; -} - -function get_random_colors($how_many) -{ - $colors = array(); - - for($k=0;$k<$how_many;$k++) - { - $colors[] = '#'.random_color(); - } - - return $colors; -} - -function random_color() -{ - mt_srand((double)microtime()*1000000); - $c = ''; - while(strlen($c)<6){ - $c .= sprintf("%02X", mt_rand(0, 255)); - } - return $c; -} \ No newline at end of file diff --git a/application/helpers/sale_helper.php b/application/helpers/sale_helper.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/application/helpers/table_helper.php b/application/helpers/table_helper.php deleted file mode 100644 index 95f1412c0..000000000 --- a/application/helpers/table_helper.php +++ /dev/null @@ -1,344 +0,0 @@ -'; - - $headers = array('', - $CI->lang->line('common_last_name'), - $CI->lang->line('common_first_name'), - $CI->lang->line('common_email'), - $CI->lang->line('common_phone_number'), - ' '); - - $table.=''; - foreach($headers as $header) - { - $table.="$header"; - } - $table.=''; - $table.=get_people_manage_table_data_rows($people,$controller); - $table.=''; - return $table; -} - -/* -Gets the html data rows for the people. -*/ -function get_people_manage_table_data_rows($people,$controller) -{ - $CI =& get_instance(); - $table_data_rows=''; - - foreach($people->result() as $person) - { - $table_data_rows.=get_person_data_row($person,$controller); - } - - if($people->num_rows()==0) - { - $table_data_rows.="
".$CI->lang->line('common_no_persons_to_display')."
"; - } - - return $table_data_rows; -} - -function get_person_data_row($person,$controller) -{ - $CI =& get_instance(); - $controller_name=strtolower(get_class($CI)); - $width = $controller->get_form_width(); - - $table_data_row=''; - $table_data_row.=""; - $table_data_row.=''.character_limiter($person->last_name,13).''; - $table_data_row.=''.character_limiter($person->first_name,13).''; - $table_data_row.=''.mailto($person->email,character_limiter($person->email,22)).''; - $table_data_row.=''.character_limiter($person->phone_number,13).''; - $table_data_row.=''.anchor($controller_name."/view/$person->person_id/width:$width", $CI->lang->line('common_edit'),array('class'=>'thickbox','title'=>$CI->lang->line($controller_name.'_update'))).''; - $table_data_row.=''; - - return $table_data_row; -} - -/* -Gets the html table to manage suppliers. -*/ -function get_supplier_manage_table($suppliers,$controller) -{ - $CI =& get_instance(); - $table=''; - - $headers = array('', - $CI->lang->line('suppliers_company_name'), - $CI->lang->line('common_last_name'), - $CI->lang->line('common_first_name'), - $CI->lang->line('common_email'), - $CI->lang->line('common_phone_number'), - ' '); - - $table.=''; - foreach($headers as $header) - { - $table.=""; - } - $table.=''; - $table.=get_supplier_manage_table_data_rows($suppliers,$controller); - $table.='
$header
'; - return $table; -} - -/* -Gets the html data rows for the supplier. -*/ -function get_supplier_manage_table_data_rows($suppliers,$controller) -{ - $CI =& get_instance(); - $table_data_rows=''; - - foreach($suppliers->result() as $supplier) - { - $table_data_rows.=get_supplier_data_row($supplier,$controller); - } - - if($suppliers->num_rows()==0) - { - $table_data_rows.="
".$CI->lang->line('common_no_persons_to_display')."
"; - } - - return $table_data_rows; -} - -function get_supplier_data_row($supplier,$controller) -{ - $CI =& get_instance(); - $controller_name=strtolower(get_class($CI)); - $width = $controller->get_form_width(); - - $table_data_row=''; - $table_data_row.=""; - $table_data_row.=''.character_limiter($supplier->company_name,13).''; - $table_data_row.=''.character_limiter($supplier->last_name,13).''; - $table_data_row.=''.character_limiter($supplier->first_name,13).''; - $table_data_row.=''.mailto($supplier->email,character_limiter($supplier->email,22)).''; - $table_data_row.=''.character_limiter($supplier->phone_number,13).''; - $table_data_row.=''.anchor($controller_name."/view/$supplier->person_id/width:$width", $CI->lang->line('common_edit'),array('class'=>'thickbox','title'=>$CI->lang->line($controller_name.'_update'))).''; - $table_data_row.=''; - - return $table_data_row; -} - -/* -Gets the html table to manage items. -*/ -function get_items_manage_table($items,$controller) -{ - $CI =& get_instance(); - $table=''; - - $headers = array('', - $CI->lang->line('items_item_number'), - $CI->lang->line('items_name'), - $CI->lang->line('items_category'), - $CI->lang->line('items_cost_price'), - $CI->lang->line('items_unit_price'), - $CI->lang->line('items_tax_percents'), - $CI->lang->line('items_quantity'), - ' ', - $CI->lang->line('items_inventory') - ); - - $table.=''; - foreach($headers as $header) - { - $table.=""; - } - $table.=''; - $table.=get_items_manage_table_data_rows($items,$controller); - $table.='
$header
'; - return $table; -} - -/* -Gets the html data rows for the items. -*/ -function get_items_manage_table_data_rows($items,$controller) -{ - $CI =& get_instance(); - $table_data_rows=''; - - foreach($items->result() as $item) - { - $table_data_rows.=get_item_data_row($item,$controller); - } - - if($items->num_rows()==0) - { - $table_data_rows.="
".$CI->lang->line('items_no_items_to_display')."
"; - } - - return $table_data_rows; -} - -function get_item_data_row($item,$controller) -{ - $CI =& get_instance(); - $item_tax_info=$CI->Item_taxes->get_info($item->item_id); - $tax_percents = ''; - foreach($item_tax_info as $tax_info) - { - $tax_percents.=$tax_info['percent']. '%, '; - } - $tax_percents=substr($tax_percents, 0, -2); - $controller_name=strtolower(get_class($CI)); - $width = $controller->get_form_width(); - - $table_data_row=''; - $table_data_row.=""; - $table_data_row.=''.$item->item_number.''; - $table_data_row.=''.$item->name.''; - $table_data_row.=''.$item->category.''; - $table_data_row.=''.to_currency($item->cost_price).''; - $table_data_row.=''.to_currency($item->unit_price).''; - $table_data_row.=''.$tax_percents.''; - $table_data_row.=''.$item->quantity.''; - $table_data_row.=''.anchor($controller_name."/view/$item->item_id/width:$width", $CI->lang->line('common_edit'),array('class'=>'thickbox','title'=>$CI->lang->line($controller_name.'_update'))).''; - - //Ramel Inventory Tracking - $table_data_row.=''.anchor($controller_name."/inventory/$item->item_id/width:$width", $CI->lang->line('common_inv'),array('class'=>'thickbox','title'=>$CI->lang->line($controller_name.'_count')))./*'';//inventory count - $table_data_row.=''*/'    '.anchor($controller_name."/count_details/$item->item_id/width:$width", $CI->lang->line('common_det'),array('class'=>'thickbox','title'=>$CI->lang->line($controller_name.'_details_count'))).'';//inventory details - - $table_data_row.=''; - return $table_data_row; -} - -/* -Gets the html table to manage giftcards. -*/ -function get_giftcards_manage_table( $giftcards, $controller ) -{ - $CI =& get_instance(); - - $table=''; - - $headers = array('', - $CI->lang->line('giftcards_giftcard_number'), - $CI->lang->line('giftcards_card_value'), - ' ', - ); - - $table.=''; - foreach($headers as $header) - { - $table.=""; - } - $table.=''; - $table.=get_giftcards_manage_table_data_rows( $giftcards, $controller ); - $table.='
$header
'; - return $table; -} - -/* -Gets the html data rows for the giftcard. -*/ -function get_giftcards_manage_table_data_rows( $giftcards, $controller ) -{ - $CI =& get_instance(); - $table_data_rows=''; - - foreach($giftcards->result() as $giftcard) - { - $table_data_rows.=get_giftcard_data_row( $giftcard, $controller ); - } - - if($giftcards->num_rows()==0) - { - $table_data_rows.="
".$CI->lang->line('giftcards_no_giftcards_to_display')."
"; - } - - return $table_data_rows; -} - -function get_giftcard_data_row($giftcard,$controller) -{ - $CI =& get_instance(); - $controller_name=strtolower(get_class($CI)); - $width = $controller->get_form_width(); - - $table_data_row=''; - $table_data_row.=""; - $table_data_row.=''.$giftcard->giftcard_number.''; - $table_data_row.=''.to_currency($giftcard->value).''; - $table_data_row.=''.anchor($controller_name."/view/$giftcard->giftcard_id/width:$width", $CI->lang->line('common_edit'),array('class'=>'thickbox','title'=>$CI->lang->line($controller_name.'_update'))).''; - - $table_data_row.=''; - return $table_data_row; -} - -/* -Gets the html table to manage item kits. -*/ -function get_item_kits_manage_table( $item_kits, $controller ) -{ - $CI =& get_instance(); - - $table=''; - - $headers = array('', - $CI->lang->line('item_kits_name'), - $CI->lang->line('item_kits_description'), - ' ', - ); - - $table.=''; - foreach($headers as $header) - { - $table.=""; - } - $table.=''; - $table.=get_item_kits_manage_table_data_rows( $item_kits, $controller ); - $table.='
$header
'; - return $table; -} - -/* -Gets the html data rows for the item kits. -*/ -function get_item_kits_manage_table_data_rows( $item_kits, $controller ) -{ - $CI =& get_instance(); - $table_data_rows=''; - - foreach($item_kits->result() as $item_kit) - { - $table_data_rows.=get_item_kit_data_row( $item_kit, $controller ); - } - - if($item_kits->num_rows()==0) - { - $table_data_rows.="
".$CI->lang->line('item_kits_no_item_kits_to_display')."
"; - } - - return $table_data_rows; -} - -function get_item_kit_data_row($item_kit,$controller) -{ - $CI =& get_instance(); - $controller_name=strtolower(get_class($CI)); - $width = $controller->get_form_width(); - - $table_data_row=''; - $table_data_row.=""; - $table_data_row.=''.$item_kit->name.''; - $table_data_row.=''.character_limiter($item_kit->description, 25).''; - $table_data_row.=''.anchor($controller_name."/view/$item_kit->item_kit_id/width:$width", $CI->lang->line('common_edit'),array('class'=>'thickbox','title'=>$CI->lang->line($controller_name.'_update'))).''; - - $table_data_row.=''; - return $table_data_row; -} - -?> \ No newline at end of file diff --git a/application/hooks/index.html b/application/hooks/index.html deleted file mode 100644 index 065d2da5e..000000000 --- a/application/hooks/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

Directory access is forbidden.

- - - \ No newline at end of file diff --git a/application/hooks/load_config.php b/application/hooks/load_config.php deleted file mode 100644 index 83f47118e..000000000 --- a/application/hooks/load_config.php +++ /dev/null @@ -1,25 +0,0 @@ -Appconfig->get_all()->result() as $app_config) - { - $CI->config->set_item($app_config->key,$app_config->value); - } - - if ($CI->config->item('language')) - { - $CI->lang->switch_to($CI->config->item('language')); - } - - if ($CI->config->item('timezone')) - { - date_default_timezone_set($CI->config->item('timezone')); - } - else - { - date_default_timezone_set('America/New_York'); - } -} -?> \ No newline at end of file diff --git a/application/index.html b/application/index.html deleted file mode 100644 index 065d2da5e..000000000 --- a/application/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

Directory access is forbidden.

- - - \ No newline at end of file diff --git a/application/language/english/common_lang.php b/application/language/english/common_lang.php deleted file mode 100644 index 3ddf42837..000000000 --- a/application/language/english/common_lang.php +++ /dev/null @@ -1,41 +0,0 @@ - \ No newline at end of file diff --git a/application/language/english/config_lang.php b/application/language/english/config_lang.php deleted file mode 100644 index 079b9709d..000000000 --- a/application/language/english/config_lang.php +++ /dev/null @@ -1,24 +0,0 @@ - \ No newline at end of file diff --git a/application/language/english/customers_lang.php b/application/language/english/customers_lang.php deleted file mode 100644 index d6978d458..000000000 --- a/application/language/english/customers_lang.php +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/application/language/english/employees_lang.php b/application/language/english/employees_lang.php deleted file mode 100644 index a30c32b99..000000000 --- a/application/language/english/employees_lang.php +++ /dev/null @@ -1,27 +0,0 @@ - diff --git a/application/language/english/error_lang.php b/application/language/english/error_lang.php deleted file mode 100644 index cfcd2f0c9..000000000 --- a/application/language/english/error_lang.php +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/application/language/english/giftcards_lang.php b/application/language/english/giftcards_lang.php deleted file mode 100644 index 1a22f132f..000000000 --- a/application/language/english/giftcards_lang.php +++ /dev/null @@ -1,69 +0,0 @@ - diff --git a/application/language/english/index.html b/application/language/english/index.html deleted file mode 100644 index 0696be4eb..000000000 --- a/application/language/english/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

Directory access is forbidden.

- - - diff --git a/application/language/english/item_kits_lang.php b/application/language/english/item_kits_lang.php deleted file mode 100644 index 601fae62d..000000000 --- a/application/language/english/item_kits_lang.php +++ /dev/null @@ -1,20 +0,0 @@ - diff --git a/application/language/english/items_lang.php b/application/language/english/items_lang.php deleted file mode 100644 index e7f9a1aea..000000000 --- a/application/language/english/items_lang.php +++ /dev/null @@ -1,79 +0,0 @@ - diff --git a/application/language/english/login_lang.php b/application/language/english/login_lang.php deleted file mode 100644 index a5aa1bb26..000000000 --- a/application/language/english/login_lang.php +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/application/language/english/module_lang.php b/application/language/english/module_lang.php deleted file mode 100644 index 9e95a2d81..000000000 --- a/application/language/english/module_lang.php +++ /dev/null @@ -1,34 +0,0 @@ - diff --git a/application/language/english/receivings_lang.php b/application/language/english/receivings_lang.php deleted file mode 100644 index 2564d4d42..000000000 --- a/application/language/english/receivings_lang.php +++ /dev/null @@ -1,26 +0,0 @@ - diff --git a/application/language/english/reports_lang.php b/application/language/english/reports_lang.php deleted file mode 100644 index 12e1f3598..000000000 --- a/application/language/english/reports_lang.php +++ /dev/null @@ -1,87 +0,0 @@ - diff --git a/application/language/english/sales_lang.php b/application/language/english/sales_lang.php deleted file mode 100644 index 836446372..000000000 --- a/application/language/english/sales_lang.php +++ /dev/null @@ -1,79 +0,0 @@ - \ No newline at end of file diff --git a/application/language/english/suppliers_lang.php b/application/language/english/suppliers_lang.php deleted file mode 100644 index 97191a352..000000000 --- a/application/language/english/suppliers_lang.php +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/application/language/indonesia/common_lang.php b/application/language/indonesia/common_lang.php deleted file mode 100644 index 53e4e9c6d..000000000 --- a/application/language/indonesia/common_lang.php +++ /dev/null @@ -1,41 +0,0 @@ - diff --git a/application/language/indonesia/config_lang.php b/application/language/indonesia/config_lang.php deleted file mode 100644 index b28d95ff8..000000000 --- a/application/language/indonesia/config_lang.php +++ /dev/null @@ -1,24 +0,0 @@ - \ No newline at end of file diff --git a/application/language/indonesia/customers_lang.php b/application/language/indonesia/customers_lang.php deleted file mode 100644 index 4ce03c357..000000000 --- a/application/language/indonesia/customers_lang.php +++ /dev/null @@ -1,16 +0,0 @@ - \ No newline at end of file diff --git a/application/language/indonesia/employees_lang.php b/application/language/indonesia/employees_lang.php deleted file mode 100644 index 5f2fc811e..000000000 --- a/application/language/indonesia/employees_lang.php +++ /dev/null @@ -1,27 +0,0 @@ - \ No newline at end of file diff --git a/application/language/indonesia/error_lang.php b/application/language/indonesia/error_lang.php deleted file mode 100644 index 5fb55ba97..000000000 --- a/application/language/indonesia/error_lang.php +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/application/language/indonesia/giftcards_lang.php b/application/language/indonesia/giftcards_lang.php deleted file mode 100644 index c6ba2ebe1..000000000 --- a/application/language/indonesia/giftcards_lang.php +++ /dev/null @@ -1,71 +0,0 @@ - \ No newline at end of file diff --git a/application/language/indonesia/index.html b/application/language/indonesia/index.html deleted file mode 100644 index e553b61a7..000000000 --- a/application/language/indonesia/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Dilarang - - - -

Akses direktori dilarang.

- - - \ No newline at end of file diff --git a/application/language/indonesia/item_kits_lang.php b/application/language/indonesia/item_kits_lang.php deleted file mode 100644 index ebd06926b..000000000 --- a/application/language/indonesia/item_kits_lang.php +++ /dev/null @@ -1,20 +0,0 @@ - \ No newline at end of file diff --git a/application/language/indonesia/items_lang.php b/application/language/indonesia/items_lang.php deleted file mode 100644 index 2cc620e96..000000000 --- a/application/language/indonesia/items_lang.php +++ /dev/null @@ -1,78 +0,0 @@ - diff --git a/application/language/indonesia/login_lang.php b/application/language/indonesia/login_lang.php deleted file mode 100644 index 7b0150f00..000000000 --- a/application/language/indonesia/login_lang.php +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/application/language/indonesia/module_lang.php b/application/language/indonesia/module_lang.php deleted file mode 100644 index b45605a1f..000000000 --- a/application/language/indonesia/module_lang.php +++ /dev/null @@ -1,33 +0,0 @@ - diff --git a/application/language/indonesia/receivings_lang.php b/application/language/indonesia/receivings_lang.php deleted file mode 100644 index 6702394ef..000000000 --- a/application/language/indonesia/receivings_lang.php +++ /dev/null @@ -1,26 +0,0 @@ - \ No newline at end of file diff --git a/application/language/indonesia/reports_lang.php b/application/language/indonesia/reports_lang.php deleted file mode 100644 index a32b1bd22..000000000 --- a/application/language/indonesia/reports_lang.php +++ /dev/null @@ -1,85 +0,0 @@ - diff --git a/application/language/indonesia/sales_lang.php b/application/language/indonesia/sales_lang.php deleted file mode 100644 index 089c3ef23..000000000 --- a/application/language/indonesia/sales_lang.php +++ /dev/null @@ -1,78 +0,0 @@ - diff --git a/application/language/indonesia/suppliers_lang.php b/application/language/indonesia/suppliers_lang.php deleted file mode 100644 index a99265701..000000000 --- a/application/language/indonesia/suppliers_lang.php +++ /dev/null @@ -1,17 +0,0 @@ - \ No newline at end of file diff --git a/application/language/spanish/common_lang.php b/application/language/spanish/common_lang.php deleted file mode 100644 index 474db8325..000000000 --- a/application/language/spanish/common_lang.php +++ /dev/null @@ -1,40 +0,0 @@ - diff --git a/application/language/spanish/config_lang.php b/application/language/spanish/config_lang.php deleted file mode 100644 index a39aa873e..000000000 --- a/application/language/spanish/config_lang.php +++ /dev/null @@ -1,24 +0,0 @@ - diff --git a/application/language/spanish/customers_lang.php b/application/language/spanish/customers_lang.php deleted file mode 100644 index d36370d53..000000000 --- a/application/language/spanish/customers_lang.php +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/application/language/spanish/employees_lang.php b/application/language/spanish/employees_lang.php deleted file mode 100644 index 52be3d99c..000000000 --- a/application/language/spanish/employees_lang.php +++ /dev/null @@ -1,27 +0,0 @@ - diff --git a/application/language/spanish/error_lang.php b/application/language/spanish/error_lang.php deleted file mode 100644 index aef9e8c43..000000000 --- a/application/language/spanish/error_lang.php +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/application/language/spanish/giftcards_lang.php b/application/language/spanish/giftcards_lang.php deleted file mode 100644 index 4a358491c..000000000 --- a/application/language/spanish/giftcards_lang.php +++ /dev/null @@ -1,69 +0,0 @@ - diff --git a/application/language/spanish/index.html b/application/language/spanish/index.html deleted file mode 100644 index 9fe0435c2..000000000 --- a/application/language/spanish/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Prohibido - - - -

El acceso a los directorios está prohibido.

- - - diff --git a/application/language/spanish/item_kits_lang.php b/application/language/spanish/item_kits_lang.php deleted file mode 100644 index 2ffd7b807..000000000 --- a/application/language/spanish/item_kits_lang.php +++ /dev/null @@ -1,20 +0,0 @@ - diff --git a/application/language/spanish/items_lang.php b/application/language/spanish/items_lang.php deleted file mode 100644 index cc4f39bed..000000000 --- a/application/language/spanish/items_lang.php +++ /dev/null @@ -1,77 +0,0 @@ - diff --git a/application/language/spanish/login_lang.php b/application/language/spanish/login_lang.php deleted file mode 100644 index 8c60ff3a4..000000000 --- a/application/language/spanish/login_lang.php +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/application/language/spanish/module_lang.php b/application/language/spanish/module_lang.php deleted file mode 100644 index d00dc9862..000000000 --- a/application/language/spanish/module_lang.php +++ /dev/null @@ -1,33 +0,0 @@ - diff --git a/application/language/spanish/receivings_lang.php b/application/language/spanish/receivings_lang.php deleted file mode 100644 index e86080793..000000000 --- a/application/language/spanish/receivings_lang.php +++ /dev/null @@ -1,26 +0,0 @@ - diff --git a/application/language/spanish/reports_lang.php b/application/language/spanish/reports_lang.php deleted file mode 100644 index 94d67239c..000000000 --- a/application/language/spanish/reports_lang.php +++ /dev/null @@ -1,85 +0,0 @@ - diff --git a/application/language/spanish/sales_lang.php b/application/language/spanish/sales_lang.php deleted file mode 100644 index d1612d701..000000000 --- a/application/language/spanish/sales_lang.php +++ /dev/null @@ -1,78 +0,0 @@ - diff --git a/application/language/spanish/suppliers_lang.php b/application/language/spanish/suppliers_lang.php deleted file mode 100644 index c2a436b1e..000000000 --- a/application/language/spanish/suppliers_lang.php +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/application/libraries/MY_Language.php b/application/libraries/MY_Language.php deleted file mode 100644 index 226fbb9af..000000000 --- a/application/libraries/MY_Language.php +++ /dev/null @@ -1,26 +0,0 @@ -config->set_item('language',$idiom); - $loaded = $this->is_loaded; - $this->is_loaded = array(); - - foreach($loaded as $file) - { - $this->load(str_replace('_lang.php','',$file)); - } - } - } -} - -?> diff --git a/application/libraries/Receiving_lib.php b/application/libraries/Receiving_lib.php deleted file mode 100644 index 407293658..000000000 --- a/application/libraries/Receiving_lib.php +++ /dev/null @@ -1,251 +0,0 @@ -CI =& get_instance(); - } - - function get_cart() - { - if(!$this->CI->session->userdata('cartRecv')) - $this->set_cart(array()); - - return $this->CI->session->userdata('cartRecv'); - } - - function set_cart($cart_data) - { - $this->CI->session->set_userdata('cartRecv',$cart_data); - } - - function get_supplier() - { - if(!$this->CI->session->userdata('supplier')) - $this->set_supplier(-1); - - return $this->CI->session->userdata('supplier'); - } - - function set_supplier($supplier_id) - { - $this->CI->session->set_userdata('supplier',$supplier_id); - } - - function get_mode() - { - if(!$this->CI->session->userdata('recv_mode')) - $this->set_mode('receive'); - - return $this->CI->session->userdata('recv_mode'); - } - - function set_mode($mode) - { - $this->CI->session->set_userdata('recv_mode',$mode); - } - - function add_item($item_id,$quantity=1,$discount=0,$price=null,$description=null,$serialnumber=null) - { - //make sure item exists in database. - if(!$this->CI->Item->exists($item_id)) - { - //try to get item id given an item_number - $item_id = $this->CI->Item->get_item_id($item_id); - - if(!$item_id) - return false; - } - - //Get items in the receiving so far. - $items = $this->get_cart(); - - //We need to loop through all items in the cart. - //If the item is already there, get it's key($updatekey). - //We also need to get the next key that we are going to use in case we need to add the - //item to the list. Since items can be deleted, we can't use a count. we use the highest key + 1. - - $maxkey=0; //Highest key so far - $itemalreadyinsale=FALSE; //We did not find the item yet. - $insertkey=0; //Key to use for new entry. - $updatekey=0; //Key to use to update(quantity) - - foreach ($items as $item) - { - //We primed the loop so maxkey is 0 the first time. - //Also, we have stored the key in the element itself so we can compare. - //There is an array function to get the associated key for an element, but I like it better - //like that! - - if($maxkey <= $item['line']) - { - $maxkey = $item['line']; - } - - if($item['item_id']==$item_id) - { - $itemalreadyinsale=TRUE; - $updatekey=$item['line']; - } - } - - $insertkey=$maxkey+1; - - //array records are identified by $insertkey and item_id is just another field. - $item = array(($insertkey)=> - array( - 'item_id'=>$item_id, - 'line'=>$insertkey, - 'name'=>$this->CI->Item->get_info($item_id)->name, - 'description'=>$description!=null ? $description: $this->CI->Item->get_info($item_id)->description, - 'serialnumber'=>$serialnumber!=null ? $serialnumber: '', - 'allow_alt_description'=>$this->CI->Item->get_info($item_id)->allow_alt_description, - 'is_serialized'=>$this->CI->Item->get_info($item_id)->is_serialized, - 'quantity'=>$quantity, - 'discount'=>$discount, - 'price'=>$price!=null ? $price: $this->CI->Item->get_info($item_id)->cost_price - ) - ); - - //Item already exists - if($itemalreadyinsale) - { - $items[$updatekey]['quantity']+=$quantity; - } - else - { - //add to existing array - $items+=$item; - } - - $this->set_cart($items); - return true; - - } - - function edit_item($line,$description,$serialnumber,$quantity,$discount,$price) - { - $items = $this->get_cart(); - if(isset($items[$line])) - { - $items[$line]['description'] = $description; - $items[$line]['serialnumber'] = $serialnumber; - $items[$line]['quantity'] = $quantity; - $items[$line]['discount'] = $discount; - $items[$line]['price'] = $price; - $this->set_cart($items); - } - - return false; - } - - function is_valid_receipt($receipt_receiving_id) - { - //RECV # - $pieces = explode(' ',$receipt_receiving_id); - - if(count($pieces)==2) - { - return $this->CI->Receiving->exists($pieces[1]); - } - - return false; - } - - function is_valid_item_kit($item_kit_id) - { - //KIT # - $pieces = explode(' ',$item_kit_id); - - if(count($pieces)==2) - { - return $this->CI->Item_kit->exists($pieces[1]); - } - - return false; - } - - function return_entire_receiving($receipt_receiving_id) - { - //POS # - $pieces = explode(' ',$receipt_receiving_id); - $receiving_id = $pieces[1]; - - $this->empty_cart(); - $this->delete_supplier(); - - foreach($this->CI->Receiving->get_receiving_items($receiving_id)->result() as $row) - { - $this->add_item($row->item_id,-$row->quantity_purchased,$row->discount_percent,$row->item_unit_price,$row->description,$row->serialnumber); - } - $this->set_supplier($this->CI->Receiving->get_supplier($receiving_id)->person_id); - } - - function add_item_kit($external_item_kit_id) - { - //KIT # - $pieces = explode(' ',$external_item_kit_id); - $item_kit_id = $pieces[1]; - - foreach ($this->CI->Item_kit_items->get_info($item_kit_id) as $item_kit_item) - { - $this->add_item($item_kit_item['item_id'], $item_kit_item['quantity']); - } - } - - function copy_entire_receiving($receiving_id) - { - $this->empty_cart(); - $this->delete_supplier(); - - foreach($this->CI->Receiving->get_receiving_items($receiving_id)->result() as $row) - { - $this->add_item($row->item_id,$row->quantity_purchased,$row->discount_percent,$row->item_unit_price,$row->description,$row->serialnumber); - } - $this->set_supplier($this->CI->Receiving->get_supplier($receiving_id)->person_id); - - } - - function delete_item($line) - { - $items=$this->get_cart(); - unset($items[$line]); - $this->set_cart($items); - } - - function empty_cart() - { - $this->CI->session->unset_userdata('cartRecv'); - } - - function delete_supplier() - { - $this->CI->session->unset_userdata('supplier'); - } - - function clear_mode() - { - $this->CI->session->unset_userdata('receiving_mode'); - } - - function clear_all() - { - $this->clear_mode(); - $this->empty_cart(); - $this->delete_supplier(); - } - - function get_total() - { - $total = 0; - foreach($this->get_cart() as $item) - { - $total+=($item['price']*$item['quantity']-$item['price']*$item['quantity']*$item['discount']/100); - } - - return $total; - } -} -?> \ No newline at end of file diff --git a/application/libraries/Sale_lib.php b/application/libraries/Sale_lib.php deleted file mode 100644 index 8f83a5147..000000000 --- a/application/libraries/Sale_lib.php +++ /dev/null @@ -1,498 +0,0 @@ -CI =& get_instance(); - } - - function get_cart() - { - if(!$this->CI->session->userdata('cart')) - $this->set_cart(array()); - - return $this->CI->session->userdata('cart'); - } - - function set_cart($cart_data) - { - $this->CI->session->set_userdata('cart',$cart_data); - } - - //Alain Multiple Payments - function get_payments() - { - if(!$this->CI->session->userdata('payments')) - $this->set_payments(array()); - - return $this->CI->session->userdata('payments'); - } - - //Alain Multiple Payments - function set_payments($payments_data) - { - $this->CI->session->set_userdata('payments',$payments_data); - } - - function get_comment() - { - return $this->CI->session->userdata('comment'); - } - - function set_comment($comment) - { - $this->CI->session->set_userdata('comment', $comment); - } - - function clear_comment() - { - $this->CI->session->unset_userdata('comment'); - } - - function get_email_receipt() - { - return $this->CI->session->userdata('email_receipt'); - } - - function set_email_receipt($email_receipt) - { - $this->CI->session->set_userdata('email_receipt', $email_receipt); - } - - function clear_email_receipt() - { - $this->CI->session->unset_userdata('email_receipt'); - } - - function add_payment($payment_id,$payment_amount) - { - $payments=$this->get_payments(); - $payment = array($payment_id=> - array( - 'payment_type'=>$payment_id, - 'payment_amount'=>$payment_amount - ) - ); - - //payment_method already exists, add to payment_amount - if(isset($payments[$payment_id])) - { - $payments[$payment_id]['payment_amount']+=$payment_amount; - } - else - { - //add to existing array - $payments+=$payment; - } - - $this->set_payments($payments); - return true; - - } - - //Alain Multiple Payments - function edit_payment($payment_id,$payment_amount) - { - $payments = $this->get_payments(); - if(isset($payments[$payment_id])) - { - $payments[$payment_id]['payment_type'] = $payment_id; - $payments[$payment_id]['payment_amount'] = $payment_amount; - $this->set_payments($payment_id); - } - - return false; - } - - //Alain Multiple Payments - function delete_payment($payment_id) - { - $payments=$this->get_payments(); - unset($payments[$payment_id]); - $this->set_payments($payments); - } - - //Alain Multiple Payments - function empty_payments() - { - $this->CI->session->unset_userdata('payments'); - } - - //Alain Multiple Payments - function get_payments_total() - { - $subtotal = 0; - foreach($this->get_payments() as $payments) - { - $subtotal+=$payments['payment_amount']; - } - return to_currency_no_money($subtotal); - } - - //Alain Multiple Payments - function get_amount_due() - { - $amount_due=0; - $payment_total = $this->get_payments_total(); - $sales_total=$this->get_total(); - $amount_due=to_currency_no_money($sales_total - $payment_total); - return $amount_due; - } - - function get_customer() - { - if(!$this->CI->session->userdata('customer')) - $this->set_customer(-1); - - return $this->CI->session->userdata('customer'); - } - - function set_customer($customer_id) - { - $this->CI->session->set_userdata('customer',$customer_id); - } - - function get_mode() - { - if(!$this->CI->session->userdata('sale_mode')) - $this->set_mode('sale'); - - return $this->CI->session->userdata('sale_mode'); - } - - function set_mode($mode) - { - $this->CI->session->set_userdata('sale_mode',$mode); - } - - function add_item($item_id,$quantity=1,$discount=0,$price=null,$description=null,$serialnumber=null) - { - //make sure item exists - if(!$this->CI->Item->exists($item_id)) - { - //try to get item id given an item_number - $item_id = $this->CI->Item->get_item_id($item_id); - - if(!$item_id) - return false; - } - - - //Alain Serialization and Description - - //Get all items in the cart so far... - $items = $this->get_cart(); - - //We need to loop through all items in the cart. - //If the item is already there, get it's key($updatekey). - //We also need to get the next key that we are going to use in case we need to add the - //item to the cart. Since items can be deleted, we can't use a count. we use the highest key + 1. - - $maxkey=0; //Highest key so far - $itemalreadyinsale=FALSE; //We did not find the item yet. - $insertkey=0; //Key to use for new entry. - $updatekey=0; //Key to use to update(quantity) - - foreach ($items as $item) - { - //We primed the loop so maxkey is 0 the first time. - //Also, we have stored the key in the element itself so we can compare. - - if($maxkey <= $item['line']) - { - $maxkey = $item['line']; - } - - if($item['item_id']==$item_id) - { - $itemalreadyinsale=TRUE; - $updatekey=$item['line']; - } - } - - $insertkey=$maxkey+1; - - //array/cart records are identified by $insertkey and item_id is just another field. - $item = array(($insertkey)=> - array( - 'item_id'=>$item_id, - 'line'=>$insertkey, - 'name'=>$this->CI->Item->get_info($item_id)->name, - 'item_number'=>$this->CI->Item->get_info($item_id)->item_number, - 'description'=>$description!=null ? $description: $this->CI->Item->get_info($item_id)->description, - 'serialnumber'=>$serialnumber!=null ? $serialnumber: '', - 'allow_alt_description'=>$this->CI->Item->get_info($item_id)->allow_alt_description, - 'is_serialized'=>$this->CI->Item->get_info($item_id)->is_serialized, - 'quantity'=>$quantity, - 'discount'=>$discount, - 'price'=>$price!=null ? $price: $this->CI->Item->get_info($item_id)->unit_price - ) - ); - - //Item already exists and is not serialized, add to quantity - if($itemalreadyinsale && ($this->CI->Item->get_info($item_id)->is_serialized ==0) ) - { - $items[$updatekey]['quantity']+=$quantity; - } - else - { - //add to existing array - $items+=$item; - } - - $this->set_cart($items); - return true; - - } - - function out_of_stock($item_id) - { - //make sure item exists - if(!$this->CI->Item->exists($item_id)) - { - //try to get item id given an item_number - $item_id = $this->CI->Item->get_item_id($item_id); - - if(!$item_id) - return false; - } - - $item = $this->CI->Item->get_info($item_id); - $quanity_added = $this->get_quantity_already_added($item_id); - - if ($item->quantity - $quanity_added < 0) - { - return true; - } - - return false; - } - - function get_quantity_already_added($item_id) - { - $items = $this->get_cart(); - $quanity_already_added = 0; - foreach ($items as $item) - { - if($item['item_id']==$item_id) - { - $quanity_already_added+=$item['quantity']; - } - } - - return $quanity_already_added; - } - - function get_item_id($line_to_get) - { - $items = $this->get_cart(); - - foreach ($items as $line=>$item) - { - if($line==$line_to_get) - { - return $item['item_id']; - } - } - - return -1; - } - - function edit_item($line,$description,$serialnumber,$quantity,$discount,$price) - { - $items = $this->get_cart(); - if(isset($items[$line])) - { - $items[$line]['description'] = $description; - $items[$line]['serialnumber'] = $serialnumber; - $items[$line]['quantity'] = $quantity; - $items[$line]['discount'] = $discount; - $items[$line]['price'] = $price; - $this->set_cart($items); - } - - return false; - } - - function is_valid_receipt($receipt_sale_id) - { - //POS # - $pieces = explode(' ',$receipt_sale_id); - - if(count($pieces)==2) - { - return $this->CI->Sale->exists($pieces[1]); - } - - return false; - } - - function is_valid_item_kit($item_kit_id) - { - //KIT # - $pieces = explode(' ',$item_kit_id); - - if(count($pieces)==2) - { - return $this->CI->Item_kit->exists($pieces[1]); - } - - return false; - } - - function return_entire_sale($receipt_sale_id) - { - //POS # - $pieces = explode(' ',$receipt_sale_id); - $sale_id = $pieces[1]; - - $this->empty_cart(); - $this->remove_customer(); - - foreach($this->CI->Sale->get_sale_items($sale_id)->result() as $row) - { - $this->add_item($row->item_id,-$row->quantity_purchased,$row->discount_percent,$row->item_unit_price,$row->description,$row->serialnumber); - } - $this->set_customer($this->CI->Sale->get_customer($sale_id)->person_id); - } - - function add_item_kit($external_item_kit_id) - { - //KIT # - $pieces = explode(' ',$external_item_kit_id); - $item_kit_id = $pieces[1]; - - foreach ($this->CI->Item_kit_items->get_info($item_kit_id) as $item_kit_item) - { - $this->add_item($item_kit_item['item_id'], $item_kit_item['quantity']); - } - } - - function copy_entire_sale($sale_id) - { - $this->empty_cart(); - $this->remove_customer(); - - foreach($this->CI->Sale->get_sale_items($sale_id)->result() as $row) - { - $this->add_item($row->item_id,$row->quantity_purchased,$row->discount_percent,$row->item_unit_price,$row->description,$row->serialnumber); - } - foreach($this->CI->Sale->get_sale_payments($sale_id)->result() as $row) - { - $this->add_payment($row->payment_type,$row->payment_amount); - } - $this->set_customer($this->CI->Sale->get_customer($sale_id)->person_id); - - } - - function copy_entire_suspended_sale($sale_id) - { - $this->empty_cart(); - $this->remove_customer(); - - foreach($this->CI->Sale_suspended->get_sale_items($sale_id)->result() as $row) - { - $this->add_item($row->item_id,$row->quantity_purchased,$row->discount_percent,$row->item_unit_price,$row->description,$row->serialnumber); - } - foreach($this->CI->Sale_suspended->get_sale_payments($sale_id)->result() as $row) - { - $this->add_payment($row->payment_type,$row->payment_amount); - } - $this->set_customer($this->CI->Sale_suspended->get_customer($sale_id)->person_id); - $this->set_comment($this->CI->Sale_suspended->get_comment($sale_id)); - } - - function delete_item($line) - { - $items=$this->get_cart(); - unset($items[$line]); - $this->set_cart($items); - } - - function empty_cart() - { - $this->CI->session->unset_userdata('cart'); - } - - function remove_customer() - { - $this->CI->session->unset_userdata('customer'); - } - - function clear_mode() - { - $this->CI->session->unset_userdata('sale_mode'); - } - - function clear_all() - { - $this->clear_mode(); - $this->empty_cart(); - $this->clear_comment(); - $this->clear_email_receipt(); - $this->empty_payments(); - $this->remove_customer(); - } - - function get_taxes() - { - $customer_id = $this->get_customer(); - $customer = $this->CI->Customer->get_info($customer_id); - - //Do not charge sales tax if we have a customer that is not taxable - if (!$customer->taxable and $customer_id!=-1) - { - return array(); - } - - $taxes = array(); - foreach($this->get_cart() as $line=>$item) - { - $tax_info = $this->CI->Item_taxes->get_info($item['item_id']); - - foreach($tax_info as $tax) - { - $name = $tax['percent'].'% ' . $tax['name']; - $tax_amount=($item['price']*$item['quantity']-$item['price']*$item['quantity']*$item['discount']/100)*(($tax['percent'])/100); - - - if (!isset($taxes[$name])) - { - $taxes[$name] = 0; - } - $taxes[$name] += $tax_amount; - } - } - - return $taxes; - } - - function get_subtotal() - { - $subtotal = 0; - foreach($this->get_cart() as $item) - { - $subtotal+=($item['price']*$item['quantity']-$item['price']*$item['quantity']*$item['discount']/100); - } - return to_currency_no_money($subtotal); - } - - function get_total() - { - $total = 0; - foreach($this->get_cart() as $item) - { - $total+=($item['price']*$item['quantity']-$item['price']*$item['quantity']*$item['discount']/100); - } - - foreach($this->get_taxes() as $tax) - { - $total+=$tax; - } - - return to_currency_no_money($total); - } -} -?> \ No newline at end of file diff --git a/application/libraries/index.html b/application/libraries/index.html deleted file mode 100644 index 065d2da5e..000000000 --- a/application/libraries/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

Directory access is forbidden.

- - - \ No newline at end of file diff --git a/application/libraries/ofc-library/JSON.php b/application/libraries/ofc-library/JSON.php deleted file mode 100644 index 7260001a2..000000000 --- a/application/libraries/ofc-library/JSON.php +++ /dev/null @@ -1,806 +0,0 @@ - - * @author Matt Knapp - * @author Brett Stimmerman - * @copyright 2005 Michal Migurski - * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $ - * @license http://www.opensource.org/licenses/bsd-license.php - * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198 - */ - -/** - * Marker constant for Services_JSON::decode(), used to flag stack state - */ -define('SERVICES_JSON_SLICE', 1); - -/** - * Marker constant for Services_JSON::decode(), used to flag stack state - */ -define('SERVICES_JSON_IN_STR', 2); - -/** - * Marker constant for Services_JSON::decode(), used to flag stack state - */ -define('SERVICES_JSON_IN_ARR', 3); - -/** - * Marker constant for Services_JSON::decode(), used to flag stack state - */ -define('SERVICES_JSON_IN_OBJ', 4); - -/** - * Marker constant for Services_JSON::decode(), used to flag stack state - */ -define('SERVICES_JSON_IN_CMT', 5); - -/** - * Behavior switch for Services_JSON::decode() - */ -define('SERVICES_JSON_LOOSE_TYPE', 16); - -/** - * Behavior switch for Services_JSON::decode() - */ -define('SERVICES_JSON_SUPPRESS_ERRORS', 32); - -/** - * Converts to and from JSON format. - * - * Brief example of use: - * - * - * // create a new instance of Services_JSON - * $json = new Services_JSON(); - * - * // convert a complexe value to JSON notation, and send it to the browser - * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4))); - * $output = $json->encode($value); - * - * print($output); - * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]] - * - * // accept incoming POST data, assumed to be in JSON notation - * $input = file_get_contents('php://input', 1000000); - * $value = $json->decode($input); - * - */ -class Services_JSON -{ - /** - * constructs a new JSON instance - * - * @param int $use object behavior flags; combine with boolean-OR - * - * possible values: - * - SERVICES_JSON_LOOSE_TYPE: loose typing. - * "{...}" syntax creates associative arrays - * instead of objects in decode(). - * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression. - * Values which can't be encoded (e.g. resources) - * appear as NULL instead of throwing errors. - * By default, a deeply-nested resource will - * bubble up with an error, so all return values - * from encode() should be checked with isError() - */ - function Services_JSON($use = 0) - { - $this->use = $use; - } - - /** - * convert a string from one UTF-16 char to one UTF-8 char - * - * Normally should be handled by mb_convert_encoding, but - * provides a slower PHP-only method for installations - * that lack the multibye string extension. - * - * @param string $utf16 UTF-16 character - * @return string UTF-8 character - * @access private - */ - function utf162utf8($utf16) - { - // oh please oh please oh please oh please oh please - if(function_exists('mb_convert_encoding')) { - return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); - } - - $bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); - - switch(true) { - case ((0x7F & $bytes) == $bytes): - // this case should never be reached, because we are in ASCII range - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr(0x7F & $bytes); - - case (0x07FF & $bytes) == $bytes: - // return a 2-byte UTF-8 character - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr(0xC0 | (($bytes >> 6) & 0x1F)) - . chr(0x80 | ($bytes & 0x3F)); - - case (0xFFFF & $bytes) == $bytes: - // return a 3-byte UTF-8 character - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr(0xE0 | (($bytes >> 12) & 0x0F)) - . chr(0x80 | (($bytes >> 6) & 0x3F)) - . chr(0x80 | ($bytes & 0x3F)); - } - - // ignoring UTF-32 for now, sorry - return ''; - } - - /** - * convert a string from one UTF-8 char to one UTF-16 char - * - * Normally should be handled by mb_convert_encoding, but - * provides a slower PHP-only method for installations - * that lack the multibye string extension. - * - * @param string $utf8 UTF-8 character - * @return string UTF-16 character - * @access private - */ - function utf82utf16($utf8) - { - // oh please oh please oh please oh please oh please - if(function_exists('mb_convert_encoding')) { - return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); - } - - switch(strlen($utf8)) { - case 1: - // this case should never be reached, because we are in ASCII range - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return $utf8; - - case 2: - // return a UTF-16 character from a 2-byte UTF-8 char - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr(0x07 & (ord($utf8{0}) >> 2)) - . chr((0xC0 & (ord($utf8{0}) << 6)) - | (0x3F & ord($utf8{1}))); - - case 3: - // return a UTF-16 character from a 3-byte UTF-8 char - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr((0xF0 & (ord($utf8{0}) << 4)) - | (0x0F & (ord($utf8{1}) >> 2))) - . chr((0xC0 & (ord($utf8{1}) << 6)) - | (0x7F & ord($utf8{2}))); - } - - // ignoring UTF-32 for now, sorry - return ''; - } - - /** - * encodes an arbitrary variable into JSON format - * - * @param mixed $var any number, boolean, string, array, or object to be encoded. - * see argument 1 to Services_JSON() above for array-parsing behavior. - * if var is a strng, note that encode() always expects it - * to be in ASCII or UTF-8 format! - * - * @return mixed JSON string representation of input var or an error if a problem occurs - * @access public - */ - function encode($var) - { - switch (gettype($var)) { - case 'boolean': - return $var ? 'true' : 'false'; - - case 'NULL': - return 'null'; - - case 'integer': - return (int) $var; - - case 'double': - case 'float': - return (float) $var; - - case 'string': - // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT - $ascii = ''; - $strlen_var = strlen($var); - - /* - * Iterate over every character in the string, - * escaping with a slash or encoding to UTF-8 where necessary - */ - for ($c = 0; $c < $strlen_var; ++$c) { - - $ord_var_c = ord($var{$c}); - - switch (true) { - case $ord_var_c == 0x08: - $ascii .= '\b'; - break; - case $ord_var_c == 0x09: - $ascii .= '\t'; - break; - case $ord_var_c == 0x0A: - $ascii .= '\n'; - break; - case $ord_var_c == 0x0C: - $ascii .= '\f'; - break; - case $ord_var_c == 0x0D: - $ascii .= '\r'; - break; - - case $ord_var_c == 0x22: - case $ord_var_c == 0x2F: - case $ord_var_c == 0x5C: - // double quote, slash, slosh - $ascii .= '\\'.$var{$c}; - break; - - case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): - // characters U-00000000 - U-0000007F (same as ASCII) - $ascii .= $var{$c}; - break; - - case (($ord_var_c & 0xE0) == 0xC0): - // characters U-00000080 - U-000007FF, mask 110XXXXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, ord($var{$c + 1})); - $c += 1; - $utf16 = $this->utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xF0) == 0xE0): - // characters U-00000800 - U-0000FFFF, mask 1110XXXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2})); - $c += 2; - $utf16 = $this->utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xF8) == 0xF0): - // characters U-00010000 - U-001FFFFF, mask 11110XXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3})); - $c += 3; - $utf16 = $this->utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xFC) == 0xF8): - // characters U-00200000 - U-03FFFFFF, mask 111110XX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3}), - ord($var{$c + 4})); - $c += 4; - $utf16 = $this->utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xFE) == 0xFC): - // characters U-04000000 - U-7FFFFFFF, mask 1111110X - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3}), - ord($var{$c + 4}), - ord($var{$c + 5})); - $c += 5; - $utf16 = $this->utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - } - } - - return '"'.$ascii.'"'; - - case 'array': - /* - * As per JSON spec if any array key is not an integer - * we must treat the the whole array as an object. We - * also try to catch a sparsely populated associative - * array with numeric keys here because some JS engines - * will create an array with empty indexes up to - * max_index which can cause memory issues and because - * the keys, which may be relevant, will be remapped - * otherwise. - * - * As per the ECMA and JSON specification an object may - * have any string as a property. Unfortunately due to - * a hole in the ECMA specification if the key is a - * ECMA reserved word or starts with a digit the - * parameter is only accessible using ECMAScript's - * bracket notation. - */ - - // treat as a JSON object - if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { - $properties = array_map(array($this, 'name_value'), - array_keys($var), - array_values($var)); - - foreach($properties as $property) { - if(Services_JSON::isError($property)) { - return $property; - } - } - - return '{' . join(',', $properties) . '}'; - } - - // treat it like a regular array - $elements = array_map(array($this, 'encode'), $var); - - foreach($elements as $element) { - if(Services_JSON::isError($element)) { - return $element; - } - } - - return '[' . join(',', $elements) . ']'; - - case 'object': - $vars = get_object_vars($var); - - $properties = array_map(array($this, 'name_value'), - array_keys($vars), - array_values($vars)); - - foreach($properties as $property) { - if(Services_JSON::isError($property)) { - return $property; - } - } - - return '{' . join(',', $properties) . '}'; - - default: - return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) - ? 'null' - : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string"); - } - } - - /** - * array-walking function for use in generating JSON-formatted name-value pairs - * - * @param string $name name of key to use - * @param mixed $value reference to an array element to be encoded - * - * @return string JSON-formatted name-value pair, like '"name":value' - * @access private - */ - function name_value($name, $value) - { - $encoded_value = $this->encode($value); - - if(Services_JSON::isError($encoded_value)) { - return $encoded_value; - } - - return $this->encode(strval($name)) . ':' . $encoded_value; - } - - /** - * reduce a string by removing leading and trailing comments and whitespace - * - * @param $str string string value to strip of comments and whitespace - * - * @return string string value stripped of comments and whitespace - * @access private - */ - function reduce_string($str) - { - $str = preg_replace(array( - - // eliminate single line comments in '// ...' form - '#^\s*//(.+)$#m', - - // eliminate multi-line comments in '/* ... */' form, at start of string - '#^\s*/\*(.+)\*/#Us', - - // eliminate multi-line comments in '/* ... */' form, at end of string - '#/\*(.+)\*/\s*$#Us' - - ), '', $str); - - // eliminate extraneous space - return trim($str); - } - - /** - * decodes a JSON string into appropriate variable - * - * @param string $str JSON-formatted string - * - * @return mixed number, boolean, string, array, or object - * corresponding to given JSON input string. - * See argument 1 to Services_JSON() above for object-output behavior. - * Note that decode() always returns strings - * in ASCII or UTF-8 format! - * @access public - */ - function decode($str) - { - $str = $this->reduce_string($str); - - switch (strtolower($str)) { - case 'true': - return true; - - case 'false': - return false; - - case 'null': - return null; - - default: - $m = array(); - - if (is_numeric($str)) { - // Lookie-loo, it's a number - - // This would work on its own, but I'm trying to be - // good about returning integers where appropriate: - // return (float)$str; - - // Return float or int, as appropriate - return ((float)$str == (integer)$str) - ? (integer)$str - : (float)$str; - - } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) { - // STRINGS RETURNED IN UTF-8 FORMAT - $delim = substr($str, 0, 1); - $chrs = substr($str, 1, -1); - $utf8 = ''; - $strlen_chrs = strlen($chrs); - - for ($c = 0; $c < $strlen_chrs; ++$c) { - - $substr_chrs_c_2 = substr($chrs, $c, 2); - $ord_chrs_c = ord($chrs{$c}); - - switch (true) { - case $substr_chrs_c_2 == '\b': - $utf8 .= chr(0x08); - ++$c; - break; - case $substr_chrs_c_2 == '\t': - $utf8 .= chr(0x09); - ++$c; - break; - case $substr_chrs_c_2 == '\n': - $utf8 .= chr(0x0A); - ++$c; - break; - case $substr_chrs_c_2 == '\f': - $utf8 .= chr(0x0C); - ++$c; - break; - case $substr_chrs_c_2 == '\r': - $utf8 .= chr(0x0D); - ++$c; - break; - - case $substr_chrs_c_2 == '\\"': - case $substr_chrs_c_2 == '\\\'': - case $substr_chrs_c_2 == '\\\\': - case $substr_chrs_c_2 == '\\/': - if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || - ($delim == "'" && $substr_chrs_c_2 != '\\"')) { - $utf8 .= $chrs{++$c}; - } - break; - - case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)): - // single, escaped unicode character - $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2))) - . chr(hexdec(substr($chrs, ($c + 4), 2))); - $utf8 .= $this->utf162utf8($utf16); - $c += 5; - break; - - case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): - $utf8 .= $chrs{$c}; - break; - - case ($ord_chrs_c & 0xE0) == 0xC0: - // characters U-00000080 - U-000007FF, mask 110XXXXX - //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $utf8 .= substr($chrs, $c, 2); - ++$c; - break; - - case ($ord_chrs_c & 0xF0) == 0xE0: - // characters U-00000800 - U-0000FFFF, mask 1110XXXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $utf8 .= substr($chrs, $c, 3); - $c += 2; - break; - - case ($ord_chrs_c & 0xF8) == 0xF0: - // characters U-00010000 - U-001FFFFF, mask 11110XXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $utf8 .= substr($chrs, $c, 4); - $c += 3; - break; - - case ($ord_chrs_c & 0xFC) == 0xF8: - // characters U-00200000 - U-03FFFFFF, mask 111110XX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $utf8 .= substr($chrs, $c, 5); - $c += 4; - break; - - case ($ord_chrs_c & 0xFE) == 0xFC: - // characters U-04000000 - U-7FFFFFFF, mask 1111110X - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $utf8 .= substr($chrs, $c, 6); - $c += 5; - break; - - } - - } - - return $utf8; - - } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { - // array, or object notation - - if ($str{0} == '[') { - $stk = array(SERVICES_JSON_IN_ARR); - $arr = array(); - } else { - if ($this->use & SERVICES_JSON_LOOSE_TYPE) { - $stk = array(SERVICES_JSON_IN_OBJ); - $obj = array(); - } else { - $stk = array(SERVICES_JSON_IN_OBJ); - $obj = new stdClass(); - } - } - - array_push($stk, array('what' => SERVICES_JSON_SLICE, - 'where' => 0, - 'delim' => false)); - - $chrs = substr($str, 1, -1); - $chrs = $this->reduce_string($chrs); - - if ($chrs == '') { - if (reset($stk) == SERVICES_JSON_IN_ARR) { - return $arr; - - } else { - return $obj; - - } - } - - //print("\nparsing {$chrs}\n"); - - $strlen_chrs = strlen($chrs); - - for ($c = 0; $c <= $strlen_chrs; ++$c) { - - $top = end($stk); - $substr_chrs_c_2 = substr($chrs, $c, 2); - - if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { - // found a comma that is not inside a string, array, etc., - // OR we've reached the end of the character list - $slice = substr($chrs, $top['where'], ($c - $top['where'])); - array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false)); - //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); - - if (reset($stk) == SERVICES_JSON_IN_ARR) { - // we are in an array, so just push an element onto the stack - array_push($arr, $this->decode($slice)); - - } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { - // we are in an object, so figure - // out the property name and set an - // element in an associative array, - // for now - $parts = array(); - - if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { - // "name":value pair - $key = $this->decode($parts[1]); - $val = $this->decode($parts[2]); - - if ($this->use & SERVICES_JSON_LOOSE_TYPE) { - $obj[$key] = $val; - } else { - $obj->$key = $val; - } - } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { - // name:value pair, where name is unquoted - $key = $parts[1]; - $val = $this->decode($parts[2]); - - if ($this->use & SERVICES_JSON_LOOSE_TYPE) { - $obj[$key] = $val; - } else { - $obj->$key = $val; - } - } - - } - - } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { - // found a quote, and we are not inside a string - array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c})); - //print("Found start of string at {$c}\n"); - - } elseif (($chrs{$c} == $top['delim']) && - ($top['what'] == SERVICES_JSON_IN_STR) && - ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) { - // found a quote, we're in a string, and it's not escaped - // we know that it's not escaped becase there is _not_ an - // odd number of backslashes at the end of the string so far - array_pop($stk); - //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n"); - - } elseif (($chrs{$c} == '[') && - in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { - // found a left-bracket, and we are in an array, object, or slice - array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); - //print("Found start of array at {$c}\n"); - - } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { - // found a right-bracket, and we're in an array - array_pop($stk); - //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); - - } elseif (($chrs{$c} == '{') && - in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { - // found a left-brace, and we are in an array, object, or slice - array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); - //print("Found start of object at {$c}\n"); - - } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { - // found a right-brace, and we're in an object - array_pop($stk); - //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); - - } elseif (($substr_chrs_c_2 == '/*') && - in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { - // found a comment start, and we are in an array, object, or slice - array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false)); - $c++; - //print("Found start of comment at {$c}\n"); - - } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) { - // found a comment end, and we're in one now - array_pop($stk); - $c++; - - for ($i = $top['where']; $i <= $c; ++$i) - $chrs = substr_replace($chrs, ' ', $i, 1); - - //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); - - } - - } - - if (reset($stk) == SERVICES_JSON_IN_ARR) { - return $arr; - - } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { - return $obj; - - } - - } - } - } - - /** - * @todo Ultimately, this should just call PEAR::isError() - */ - function isError($data, $code = null) - { - if (class_exists('pear')) { - return PEAR::isError($data, $code); - } elseif (is_object($data) && (get_class($data) == 'services_json_error' || - is_subclass_of($data, 'services_json_error'))) { - return true; - } - - return false; - } -} - -if (class_exists('PEAR_Error')) { - - class Services_JSON_Error extends PEAR_Error - { - function Services_JSON_Error($message = 'unknown error', $code = null, - $mode = null, $options = null, $userinfo = null) - { - parent::PEAR_Error($message, $code, $mode, $options, $userinfo); - } - } - -} else { - - /** - * @todo Ultimately, this class shall be descended from PEAR_Error - */ - class Services_JSON_Error - { - function Services_JSON_Error($message = 'unknown error', $code = null, - $mode = null, $options = null, $userinfo = null) - { - - } - } - -} - -?> diff --git a/application/libraries/ofc-library/README.txt b/application/libraries/ofc-library/README.txt deleted file mode 100644 index 2d8b6297f..000000000 --- a/application/libraries/ofc-library/README.txt +++ /dev/null @@ -1,16 +0,0 @@ -Open Flash Chart - PHP libraries. These help create data files for Open Flash Chart. -Copyright (C) 2007 - -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. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA \ No newline at end of file diff --git a/application/libraries/ofc-library/dot_base.php b/application/libraries/ofc-library/dot_base.php deleted file mode 100644 index 843db7dc8..000000000 --- a/application/libraries/ofc-library/dot_base.php +++ /dev/null @@ -1,231 +0,0 @@ -type = $type; - if( isset( $value ) ) - $this->value( $value ); - } - - /** - * For line charts that only require a Y position - * for each point. - * @param $value as integer, the Y position - */ - function value( $value ) - { - $this->value = $value; - } - - /** - * For scatter charts that require an X and Y position for - * each point. - * - * @param $x as integer - * @param $y as integer - */ - function position( $x, $y ) - { - $this->x = $x; - $this->y = $y; - } - - /** - * @param $colour is a string, HEX colour, e.g. '#FF0000' red - */ - function colour($colour) - { - $this->colour = $colour; - return $this; - } - - /** - * The tooltip for this dot. - */ - function tooltip( $tip ) - { - $this->tip = $tip; - return $this; - } - - /** - * @param $size is an integer. Size of the dot. - */ - function size($size) - { - $tmp = 'dot-size'; - $this->$tmp = $size; - return $this; - } - - /** - * a private method - */ - function type( $type ) - { - $this->type = $type; - return $this; - } - - /** - * @param $size is an integer. The size of the hollow 'halo' around the dot that masks the line. - */ - function halo_size( $size ) - { - $tmp = 'halo-size'; - $this->$tmp = $size; - return $this; - } - - /** - * @param $do as string. One of three options (examples): - * - "http://example.com" - browse to this URL - * - "https://example.com" - browse to this URL - * - "trace:message" - print this message in the FlashDevelop debug pane - * - all other strings will be called as Javascript functions, so a string "hello_world" - * will call the JS function "hello_world(index)". It passes in the index of the - * point. - */ - function on_click( $do ) - { - $tmp = 'on-click'; - $this->$tmp = $do; - } -} - -/** - * Draw a hollow dot - */ -class hollow_dot extends dot_base -{ - function hollow_dot($value=null) - { - parent::dot_base( 'hollow-dot', $value ); - } -} - -/** - * Draw a star - */ -class star extends dot_base -{ - /** - * The constructor, takes an optional $value - */ - function star($value=null) - { - parent::dot_base( 'star', $value ); - } - - /** - * @param $angle is an integer. - */ - function rotation($angle) - { - $this->rotation = $angle; - return $this; - } - - /** - * @param $is_hollow is a boolean. - */ - function hollow($is_hollow) - { - $this->hollow = $is_hollow; - } -} - -/** - * Draw a 'bow tie' shape. - */ -class bow extends dot_base -{ - /** - * The constructor, takes an optional $value - */ - function bow($value=null) - { - parent::dot_base( 'bow', $value ); - } - - /** - * Rotate the anchor object. - * @param $angle is an integer. - */ - function rotation($angle) - { - $this->rotation = $angle; - return $this; - } -} - -/** - * An n sided shape. - */ -class anchor extends dot_base -{ - /** - * The constructor, takes an optional $value - */ - function anchor($value=null) - { - parent::dot_base( 'anchor', $value ); - } - - /** - * Rotate the anchor object. - * @param $angle is an integer. - */ - function rotation($angle) - { - $this->rotation = $angle; - return $this; - } - - /** - * @param $sides is an integer. Number of sides this shape has. - */ - function sides($sides) - { - $this->sides = $sides; - return $this; - } -} - -/** - * A simple dot - */ -class dot extends dot_base -{ - /** - * The constructor, takes an optional $value - */ - function dot($value=null) - { - parent::dot_base( 'dot', $value ); - } -} - -/** - * A simple dot - */ -class solid_dot extends dot_base -{ - /** - * The constructor, takes an optional $value - */ - function solid_dot($value=null) - { - parent::dot_base( 'solid-dot', $value ); - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/json_format.php b/application/libraries/ofc-library/json_format.php deleted file mode 100644 index 61a842ea1..000000000 --- a/application/libraries/ofc-library/json_format.php +++ /dev/null @@ -1,86 +0,0 @@ - 0 && $json[$c-1] != '\\') - { - $in_string = !$in_string; - } - default: - $new_json .= $char; - break; - } - } - - return $new_json; -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_area_base.php b/application/libraries/ofc-library/ofc_area_base.php deleted file mode 100644 index 2254935b8..000000000 --- a/application/libraries/ofc-library/ofc_area_base.php +++ /dev/null @@ -1,40 +0,0 @@ -type = "area"; - } - - /** - * the fill colour - */ - function set_fill_colour( $colour ) - { - $this->fill = $colour; - } - - /** - * sugar: see set_fill_colour - */ - function fill_colour( $colour ) - { - $this->set_fill_colour( $colour ); - return $this; - } - - function set_fill_alpha( $alpha ) - { - $tmp = "fill-alpha"; - $this->$tmp = $alpha; - } - - function set_loop() - { - $this->loop = true; - } -} diff --git a/application/libraries/ofc-library/ofc_area_hollow.php b/application/libraries/ofc-library/ofc_area_hollow.php deleted file mode 100644 index ba6c20461..000000000 --- a/application/libraries/ofc-library/ofc_area_hollow.php +++ /dev/null @@ -1,10 +0,0 @@ -type = "area_hollow"; - parent::area_base(); - } -} diff --git a/application/libraries/ofc-library/ofc_area_line.php b/application/libraries/ofc-library/ofc_area_line.php deleted file mode 100644 index c4b2b167e..000000000 --- a/application/libraries/ofc-library/ofc_area_line.php +++ /dev/null @@ -1,10 +0,0 @@ -type = "area_line"; - parent::area_base(); - } -} diff --git a/application/libraries/ofc-library/ofc_arrow.php b/application/libraries/ofc-library/ofc_arrow.php deleted file mode 100644 index 77671c87f..000000000 --- a/application/libraries/ofc-library/ofc_arrow.php +++ /dev/null @@ -1,27 +0,0 @@ -type = "arrow"; - $this->start = array("x"=>$x, "y"=>$y); - $this->end = array("x"=>$a, "y"=>$b); - $this->colour($colour); - $this->{"barb-length"} = $barb_length; - } - - function colour( $colour ) - { - $this->colour = $colour; - return $this; - } -} diff --git a/application/libraries/ofc-library/ofc_bar.php b/application/libraries/ofc-library/ofc_bar.php deleted file mode 100644 index 0666939ff..000000000 --- a/application/libraries/ofc-library/ofc_bar.php +++ /dev/null @@ -1,34 +0,0 @@ -top = $top; - - if( isset( $bottom ) ) - $this->bottom = $bottom; - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - function set_tooltip( $tip ) - { - $this->tip = $tip; - } -} - -class bar extends bar_base -{ - function bar() - { - $this->type = "bar"; - parent::bar_base(); - } -} - diff --git a/application/libraries/ofc-library/ofc_bar_3d.php b/application/libraries/ofc-library/ofc_bar_3d.php deleted file mode 100644 index b3c902b01..000000000 --- a/application/libraries/ofc-library/ofc_bar_3d.php +++ /dev/null @@ -1,22 +0,0 @@ -top = $top; - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - function set_tooltip( $tip ) - { - $this->tip = $tip; - } -} - diff --git a/application/libraries/ofc-library/ofc_bar_base.php b/application/libraries/ofc-library/ofc_bar_base.php deleted file mode 100644 index ee461063b..000000000 --- a/application/libraries/ofc-library/ofc_bar_base.php +++ /dev/null @@ -1,97 +0,0 @@ -text = $text; - $tmp = 'font-size'; - $this->$tmp = $size; - } - - /** - * syntatical sugar. - */ - function key( $text, $size ) - { - $this->set_key( $text, $size ); - } - - /** - * @param $v as an array, a mix of: - * - a bar_value class. You can use this to customise the paramters of each bar. - * - integer. This is the Y position of the top of the bar. - */ - function set_values( $v ) - { - $this->values = $v; - } - - /** - * see set_values - */ - function append_value( $v ) - { - $this->values[] = $v; - } - - /** - * @param $colour as string, a HEX colour, e.g. '#ff0000' red - */ - function set_colour( $colour ) - { - $this->colour = $colour; - } - - /** - *syntatical sugar - */ - function colour( $colour ) - { - $this->set_colour( $colour ); - } - - /** - * @param $alpha as real number (range 0 to 1), e.g. 0.5 is half transparent - */ - function set_alpha( $alpha ) - { - $this->alpha = $alpha; - } - - /** - * @param $tip as string, the tip to show. May contain various magic variables. - */ - function set_tooltip( $tip ) - { - $this->tip = $tip; - } - - /** - *@param $on_show as line_on_show object - */ - function set_on_show($on_show) - { - $this->{'on-show'} = $on_show; - } - - function set_on_click( $text ) - { - $tmp = 'on-click'; - $this->$tmp = $text; - } - - function attach_to_right_y_axis() - { - $this->axis = 'right'; - } -} - diff --git a/application/libraries/ofc-library/ofc_bar_filled.php b/application/libraries/ofc-library/ofc_bar_filled.php deleted file mode 100644 index 2008703cd..000000000 --- a/application/libraries/ofc-library/ofc_bar_filled.php +++ /dev/null @@ -1,39 +0,0 @@ -$tmp = $outline_colour; - } -} - -class bar_filled extends bar_base -{ - function bar_filled( $colour=null, $outline_colour=null ) - { - $this->type = "bar_filled"; - parent::bar_base(); - - if( isset( $colour ) ) - $this->set_colour( $colour ); - - if( isset( $outline_colour ) ) - $this->set_outline_colour( $outline_colour ); - } - - function set_outline_colour( $outline_colour ) - { - $tmp = 'outline-colour'; - $this->$tmp = $outline_colour; - } -} - diff --git a/application/libraries/ofc-library/ofc_bar_glass.php b/application/libraries/ofc-library/ofc_bar_glass.php deleted file mode 100644 index 2fd445fe2..000000000 --- a/application/libraries/ofc-library/ofc_bar_glass.php +++ /dev/null @@ -1,131 +0,0 @@ -type = $type; - $this->cascade = (float)$cascade; - $this->delay = (float)$delay; - } -} - -class bar_value -{ - /** - * @param $top as integer. The Y value of the top of the bar - * @param OPTIONAL $bottom as integer. The Y value of the bottom of the bar, defaults to Y min. - */ - function bar_value( $top, $bottom=null ) - { - $this->top = $top; - - if( isset( $bottom ) ) - $this->bottom = $bottom; - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - function set_tooltip( $tip ) - { - $this->tip = $tip; - } -} - -class bar extends bar_base -{ - function bar() - { - $this->type = "bar"; - parent::bar_base(); - } -} - -class bar_glass extends bar_base -{ - function bar_glass() - { - $this->type = "bar_glass"; - parent::bar_base(); - } -} - -class bar_cylinder extends bar_base -{ - function bar_cylinder() - { - $this->type = "bar_cylinder"; - parent::bar_base(); - } -} - -class bar_cylinder_outline extends bar_base -{ - function bar_cylinder_outline() - { - $this->type = "bar_cylinder_outline"; - parent::bar_base(); - } -} - -class bar_rounded_glass extends bar_base -{ - function bar_rounded_glass() - { - $this->type = "bar_round_glass"; - parent::bar_base(); - } -} - -class bar_round extends bar_base -{ - function bar_round() - { - $this->type = "bar_round"; - parent::bar_base(); - } -} - -class bar_dome extends bar_base -{ - function bar_dome() - { - $this->type = "bar_dome"; - parent::bar_base(); - } -} - -class bar_round3d extends bar_base -{ - function bar_round3d() - { - $this->type = "bar_round3d"; - parent::bar_base(); - } -} - -class bar_3d extends bar_base -{ - function bar_3d() - { - $this->type = "bar_3d"; - parent::bar_base(); - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_bar_sketch.php b/application/libraries/ofc-library/ofc_bar_sketch.php deleted file mode 100644 index 944d56898..000000000 --- a/application/libraries/ofc-library/ofc_bar_sketch.php +++ /dev/null @@ -1,29 +0,0 @@ -type = "bar_sketch"; - parent::bar_base(); - - $this->set_colour( $colour ); - $this->set_outline_colour( $outline_colour ); - $this->offset = $fun_factor; - } - - function set_outline_colour( $outline_colour ) - { - $tmp = 'outline-colour'; - $this->$tmp = $outline_colour; - } -} - diff --git a/application/libraries/ofc-library/ofc_bar_stack.php b/application/libraries/ofc-library/ofc_bar_stack.php deleted file mode 100644 index efba09d5b..000000000 --- a/application/libraries/ofc-library/ofc_bar_stack.php +++ /dev/null @@ -1,55 +0,0 @@ -type = "bar_stack"; - parent::bar_base(); - } - - function append_stack( $v ) - { - $this->append_value( $v ); - } - - // an array of HEX colours strings - // e.g. array( '#ff0000', '#00ff00' ); - function set_colours( $colours ) - { - $this->colours = $colours; - } - - // an array of bar_stack_value - function set_keys( $keys ) - { - $this->keys = $keys; - } -} - -class bar_stack_value -{ - function bar_stack_value( $val, $colour ) - { - $this->val = $val; - $this->colour = $colour; - } - - function set_tooltip( $tip ) - { - $this->tip = $tip; - } -} - -class bar_stack_key -{ - function bar_stack_key( $colour, $text, $font_size ) - { - $this->colour = $colour; - $this->text = $text; - $tmp = 'font-size'; - $this->$tmp = $font_size; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_candle.php b/application/libraries/ofc-library/ofc_candle.php deleted file mode 100644 index 5507efa9e..000000000 --- a/application/libraries/ofc-library/ofc_candle.php +++ /dev/null @@ -1,41 +0,0 @@ -high = $high; - $this->top = $open; - $this->bottom = $close; - $this->low = $low; - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - function set_tooltip( $tip ) - { - $this->tip = $tip; - } -} - -class candle extends bar_base -{ - function candle($colour, $negative_colour=null) - { - $this->type = "candle"; - parent::bar_base(); - - $this->set_colour( $colour ); - if(!is_null($negative_colour)) - $this->{'negative-colour'} = $negative_colour; - } -} - diff --git a/application/libraries/ofc-library/ofc_hbar.php b/application/libraries/ofc-library/ofc_hbar.php deleted file mode 100644 index a0fffbb55..000000000 --- a/application/libraries/ofc-library/ofc_hbar.php +++ /dev/null @@ -1,64 +0,0 @@ -left = $left; - $this->right = $right; - } - else - $this->right = $left; - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - function set_tooltip( $tip ) - { - $this->tip = $tip; - } -} - -class hbar -{ - function hbar( $colour ) - { - $this->type = "hbar"; - $this->values = array(); - $this->set_colour( $colour ); - } - - function append_value( $v ) - { - $this->values[] = $v; - } - - function set_values( $v ) - { - foreach( $v as $val ) - $this->append_value( new hbar_value( $val ) ); - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - function set_key( $text, $size ) - { - $this->text = $text; - $tmp = 'font-size'; - $this->$tmp = $size; - } - - function set_tooltip( $tip ) - { - $this->tip = $tip; - } -} - diff --git a/application/libraries/ofc-library/ofc_line.php b/application/libraries/ofc-library/ofc_line.php deleted file mode 100644 index d25c3fef0..000000000 --- a/application/libraries/ofc-library/ofc_line.php +++ /dev/null @@ -1,157 +0,0 @@ -type = $type; - $this->cascade = (float)$cascade; - $this->delay = (float)$delay; - } -} - -class line -{ - function line() - { - $this->type = "line"; - $this->values = array(); - } - - /** - * Set the default dot that all the real - * dots inherit their properties from. If you set the - * default dot to be red, all values in your chart that - * do not specify a colour will be red. Same for all the - * other attributes such as tooltip, on-click, size etc... - * - * @param $style as any class that inherits base_dot - */ - function set_default_dot_style( $style ) - { - $tmp = 'dot-style'; - $this->$tmp = $style; - } - - /** - * @param $v as array, can contain any combination of: - * - integer, Y position of the point - * - any class that inherits from dot_base - * - null - */ - function set_values( $v ) - { - $this->values = $v; - } - - /** - * Append a value to the line. - * - * @param mixed $v - */ - function append_value($v) - { - $this->values[] = $v; - } - - function set_width( $width ) - { - $this->width = $width; - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - /** - * sytnatical sugar for set_colour - */ - function colour( $colour ) - { - $this->set_colour( $colour ); - return $this; - } - - function set_halo_size( $size ) - { - $tmp = 'halo-size'; - $this->$tmp = $size; - } - - function set_key( $text, $font_size ) - { - $this->text = $text; - $tmp = 'font-size'; - $this->$tmp = $font_size; - } - - function set_tooltip( $tip ) - { - $this->tip = $tip; - } - - /** - * @param $text as string. A javascript function name as a string. The chart will - * try to call this function, it will pass the chart id as the only parameter into - * this function. E.g: - * - */ - function set_on_click( $text ) - { - $tmp = 'on-click'; - $this->$tmp = $text; - } - - function loop() - { - $this->loop = true; - } - - function line_style( $s ) - { - $tmp = "line-style"; - $this->$tmp = $s; - } - - /** - * Sets the text for the line. - * - * @param string $text - */ - function set_text($text) - { - $this->text = $text; - } - - function attach_to_right_y_axis() - { - $this->axis = 'right'; - } - - /** - *@param $on_show as line_on_show object - */ - function set_on_show($on_show) - { - $this->{'on-show'} = $on_show; - } - - function on_show($on_show) - { - $this->set_on_show($on_show); - return $this; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_line_base.php b/application/libraries/ofc-library/ofc_line_base.php deleted file mode 100644 index da58abedc..000000000 --- a/application/libraries/ofc-library/ofc_line_base.php +++ /dev/null @@ -1,92 +0,0 @@ -type = "line"; - $this->text = "Page views"; - $tmp = 'font-size'; - $this->$tmp = 10; - - $this->values = array(); - } - - function set_values( $v ) - { - $this->values = $v; - } - - /** - * Append a value to the line. - * - * @param mixed $v - */ - function append_value($v) - { - $this->values[] = $v; - } - - function set_width( $width ) - { - $this->width = $width; - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - function set_dot_size( $size ) - { - $tmp = 'dot-size'; - $this->$tmp = $size; - } - - function set_halo_size( $size ) - { - $tmp = 'halo-size'; - $this->$tmp = $size; - } - - function set_key( $text, $font_size ) - { - $this->text = $text; - $tmp = 'font-size'; - $this->$tmp = $font_size; - } - - function set_tooltip( $tip ) - { - $this->tip = $tip; - } - - function set_on_click( $text ) - { - $tmp = 'on-click'; - $this->$tmp = $text; - } - - function loop() - { - $this->loop = true; - } - - function line_style( $s ) - { - $tmp = "line-style"; - $this->$tmp = $s; - } - - /** - * Sets the text for the line. - * - * @param string $text - */ - function set_text($text) - { - $this->text = $text; - } - - -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_line_dot.php b/application/libraries/ofc-library/ofc_line_dot.php deleted file mode 100644 index 52f2ad0eb..000000000 --- a/application/libraries/ofc-library/ofc_line_dot.php +++ /dev/null @@ -1,33 +0,0 @@ -value = $value; - $this->colour = $colour; - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - function set_size( $size ) - { - $this->size = $size; - } - - function set_tooltip( $tip ) - { - $this->tip = $tip; - } -} - -class line_dot extends line_base -{ - function line_dot() - { - $this->type = "line_dot"; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_line_hollow.php b/application/libraries/ofc-library/ofc_line_hollow.php deleted file mode 100644 index 783fdf778..000000000 --- a/application/libraries/ofc-library/ofc_line_hollow.php +++ /dev/null @@ -1,9 +0,0 @@ -type = "line_hollow"; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_line_style.php b/application/libraries/ofc-library/ofc_line_style.php deleted file mode 100644 index 4ba5ff8b6..000000000 --- a/application/libraries/ofc-library/ofc_line_style.php +++ /dev/null @@ -1,11 +0,0 @@ -style = "dash"; - $this->on = $on; - $this->off = $off; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_menu.php b/application/libraries/ofc-library/ofc_menu.php deleted file mode 100644 index c44dd177a..000000000 --- a/application/libraries/ofc-library/ofc_menu.php +++ /dev/null @@ -1,56 +0,0 @@ -type = "text"; - $this->text = $text; - $tmp = 'javascript-function'; - $this->$tmp = $javascript_function_name; - } -} - -class ofc_menu_item_camera -{ - /** - * @param $text as string. The menu item text. - * @param $javascript_function_name as string. The javascript function name, the - * js function takes one parameter, the chart ID. So for example, our js function - * could look like this: - * - * function save_image( chart_id ) - * { - * alert( chart_id ); - * } - * - * to make a menu item call this: ofc_menu_item_camera('Save chart', 'save_image'); - */ - function ofc_menu_item_camera($text, $javascript_function_name) - { - $this->type = "camera-icon"; - $this->text = $text; - $tmp = 'javascript-function'; - $this->$tmp = $javascript_function_name; - } -} - -class ofc_menu -{ - function ofc_menu($colour, $outline_colour) - { - $this->colour = $colour; - $this->outline_colour = $outline_colour; - } - - function values($values) - { - $this->values = $values; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_pie.php b/application/libraries/ofc-library/ofc_pie.php deleted file mode 100644 index f3b9d3ed7..000000000 --- a/application/libraries/ofc-library/ofc_pie.php +++ /dev/null @@ -1,257 +0,0 @@ -value = $value; - $this->label = $label; - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - function set_label( $label, $label_colour, $font_size ) - { - $this->label = $label; - - $tmp = 'label-colour'; - $this->$tmp = $label_colour; - - $tmp = 'font-size'; - $this->$tmp = $font_size; - - } - - function set_tooltip( $tip ) - { - $this->tip = $tip; - } - - function on_click( $event ) - { - $tmp = 'on-click'; - $this->$tmp = $event; - } - - - /** - * An object that inherits from base_pie_animation - */ - function add_animation( $animation ) - { - if( !isset( $this->animate ) ) - $this->animate = array(); - - $this->animate[] = $animation; - - return $this; - } -} - -class base_pie_animation{} - -/** - * fade the pie slice from $alpha (pie set_alpha) to 100% opaque. - */ -class pie_fade extends base_pie_animation -{ - function pie_fade() - { - $this->type="fade"; - } -} - -/** - * Bounce the pie slice out a little - */ -class pie_bounce extends base_pie_animation -{ - /** - * @param $distance as integer, distance to bounce in pixels - */ - function pie_bounce( $distance ) - { - $this->type="bounce"; - $this->distance = $distance; - } -} - -/** - * Make a pie chart and fill it with pie slices - */ -class pie -{ - function pie() - { - $this->type = 'pie'; - } - - function set_colours( $colours ) - { - $this->colours = $colours; - } - - /** - * Sugar wrapped around set_colours - */ - function colours( $colours ) - { - $this->set_colours( $colours ); - return $this; - } - - /** - * @param $alpha as float (0-1) 0.75 = 3/4 visible - */ - function set_alpha( $alpha ) - { - $this->alpha = $alpha; - } - - /** - *sugar wrapped set_alpha - **/ - function alpha( $alpha ) - { - $this->set_alpha( $alpha ); - return $this; - } - - /** - * @param $v as array containing one of - * - null - * - real or integer number - * - a pie_value object - */ - function set_values( $v ) - { - $this->values = $v; - } - - /** - * sugar for set_values - */ - function values( $v ) - { - $this->set_values( $v ); - return $this; - } - - /** - * HACK to keep old code working. - */ - function set_animate( $bool ) - { - if( $bool ) - $this->add_animation( new pie_fade() ); - - } - - /** - * An object that inherits from base_pie_animation - */ - function add_animation( $animation ) - { - if( !isset( $this->animate ) ) - $this->animate = array(); - - $this->animate[] = $animation; - - return $this; - } - - /** - * @param $angle as real number - */ - function set_start_angle( $angle ) - { - $tmp = 'start-angle'; - $this->$tmp = $angle; - } - - /** - * sugar for set_start_angle - */ - function start_angle($angle) - { - $this->set_start_angle( $angle ); - return $this; - } - - /** - * @param $tip as string. The tooltip text. May contain magic varibles - */ - function set_tooltip( $tip ) - { - $this->tip = $tip; - } - - /** - * sugar for set_tooltip - */ - function tooltip( $tip ) - { - $this->set_tooltip( $tip ); - return $this; - } - - function set_gradient_fill() - { - $tmp = 'gradient-fill'; - $this->$tmp = true; - } - - function gradient_fill() - { - $this->set_gradient_fill(); - return $this; - } - - /** - * By default each label is the same colour as the slice, - * but you can ovveride that behaviour using this method. - * - * @param $label_colour as string HEX colour; - */ - function set_label_colour( $label_colour ) - { - $tmp = 'label-colour'; - $this->$tmp = $label_colour; - } - - function label_colour( $label_colour ) - { - $this->set_label_colour( $label_colour ); - return $this; - } - - /** - * Turn off the labels - */ - function set_no_labels() - { - $tmp = 'no-labels'; - $this->$tmp = true; - } - - function on_click( $event ) - { - $tmp = 'on-click'; - $this->$tmp = $event; - } - - /** - * Fix the radius of the pie chart. Take a look at the magic variable #radius# - * for helping figure out what radius to set it to. - * - * @param $radius as number - */ - function radius( $radius ) - { - $this->radius = $radius; - return $this; - } -} diff --git a/application/libraries/ofc-library/ofc_radar_axis.php b/application/libraries/ofc-library/ofc_radar_axis.php deleted file mode 100644 index 9c8d7885f..000000000 --- a/application/libraries/ofc-library/ofc_radar_axis.php +++ /dev/null @@ -1,47 +0,0 @@ -set_max( $max ); - } - - function set_max( $max ) - { - $this->max = $max; - } - - function set_steps( $steps ) - { - $this->steps = $steps; - } - - function set_stroke( $s ) - { - $this->stroke = $s; - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - function set_grid_colour( $colour ) - { - $tmp = 'grid-colour'; - $this->$tmp = $colour; - } - - function set_labels( $labels ) - { - $this->labels = $labels; - } - - function set_spoke_labels( $labels ) - { - $tmp = 'spoke-labels'; - $this->$tmp = $labels; - } -} - diff --git a/application/libraries/ofc-library/ofc_radar_axis_labels.php b/application/libraries/ofc-library/ofc_radar_axis_labels.php deleted file mode 100644 index 1c4321cce..000000000 --- a/application/libraries/ofc-library/ofc_radar_axis_labels.php +++ /dev/null @@ -1,15 +0,0 @@ -labels = $labels; - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_radar_spoke_labels.php b/application/libraries/ofc-library/ofc_radar_spoke_labels.php deleted file mode 100644 index 11b6682f1..000000000 --- a/application/libraries/ofc-library/ofc_radar_spoke_labels.php +++ /dev/null @@ -1,15 +0,0 @@ -labels = $labels; - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_scatter.php b/application/libraries/ofc-library/ofc_scatter.php deleted file mode 100644 index ab5f3ba01..000000000 --- a/application/libraries/ofc-library/ofc_scatter.php +++ /dev/null @@ -1,47 +0,0 @@ -x = $x; - $this->y = $y; - - if( $dot_size > 0 ) - { - $tmp = 'dot-size'; - $this->$tmp = $dot_size; - } - } -} - -class scatter -{ - function scatter( $colour ) - { - $this->type = "scatter"; - $this->set_colour( $colour ); - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - function set_default_dot_style( $style ) - { - $tmp = 'dot-style'; - $this->$tmp = $style; - } - - /** - * @param $v as array, can contain any combination of: - * - integer, Y position of the point - * - any class that inherits from scatter_value - * - null - */ - function set_values( $values ) - { - $this->values = $values; - } -} diff --git a/application/libraries/ofc-library/ofc_scatter_line.php b/application/libraries/ofc-library/ofc_scatter_line.php deleted file mode 100644 index c25401898..000000000 --- a/application/libraries/ofc-library/ofc_scatter_line.php +++ /dev/null @@ -1,49 +0,0 @@ -type = "scatter_line"; - $this->set_colour( $colour ); - $this->set_width( $width ); - } - - function set_default_dot_style( $style ) - { - $tmp = 'dot-style'; - $this->$tmp = $style; - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - function set_width( $width ) - { - $this->width = $width; - } - - function set_values( $values ) - { - $this->values = $values; - } - - function set_step_horizontal() - { - $this->stepgraph = 'horizontal'; - } - - function set_step_vertical() - { - $this->stepgraph = 'vertical'; - } - - function set_key( $text, $font_size ) - { - $this->text = $text; - $tmp = 'font-size'; - $this->$tmp = $font_size; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_shape.php b/application/libraries/ofc-library/ofc_shape.php deleted file mode 100644 index 3bab90790..000000000 --- a/application/libraries/ofc-library/ofc_shape.php +++ /dev/null @@ -1,25 +0,0 @@ -x = $x; - $this->y = $y; - } -} - -class shape -{ - function shape( $colour ) - { - $this->type = "shape"; - $this->colour = $colour; - $this->values = array(); - } - - function append_value( $p ) - { - $this->values[] = $p; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_sugar.php b/application/libraries/ofc-library/ofc_sugar.php deleted file mode 100644 index 242182a4c..000000000 --- a/application/libraries/ofc-library/ofc_sugar.php +++ /dev/null @@ -1,43 +0,0 @@ -colour($colour)->size($size); - } -} - -class s_box extends anchor -{ - /** - * I use this wrapper for default dot types, - * it just makes the code easier to read. - */ - function s_box($colour, $size) - { - parent::anchor(); - $this->colour($colour)->size($size)->rotation(45)->sides(4); - } -} - -class s_hollow_dot extends hollow_dot -{ - /** - * I use this wrapper for default dot types, - * it just makes the code easier to read. - */ - function s_hollow_dot($colour, $size) - { - parent::hollow_dot(); - $this->colour($colour)->size($size); - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_tags.php b/application/libraries/ofc-library/ofc_tags.php deleted file mode 100644 index e31f7d65c..000000000 --- a/application/libraries/ofc-library/ofc_tags.php +++ /dev/null @@ -1,133 +0,0 @@ -type = "tags"; - $this->values = array(); - } - - function colour( $colour ) - { - $this->colour = $colour; - return $this; - } - - /** - *@param $font as string. e.g. "Verdana" - *@param $size as integer. Size in px - */ - function font($font, $size) - { - $this->font = $font; - $this->{'font-size'} = $size; - return $this; - } - - /** - *@param $x as integer. Size of x padding in px - *@param $y as integer. Size of y padding in px - */ - function padding($x, $y) - { - $this->{"pad-x"} = $x; - $this->{"pad-y"} = $y; - return $this; - } - - function rotate($angle) - { - $this->rotate($angle); - return $this; - } - - function align_x_center() - { - $this->{"align-x"} = "center"; - return $this; - } - - function align_x_left() - { - $this->{"align-x"} = "left"; - return $this; - } - - function align_x_right() - { - $this->{"align-x"} = "right"; - return $this; - } - - function align_y_above() - { - $this->{"align-y"} = "above"; - return $this; - } - - function align_y_below() - { - $this->{"align-y"} = "below"; - return $this; - } - - function align_y_center() - { - $this->{"align-y"} = "center"; - return $this; - } - - /** - * This can contain some HTML, e.g: - * - "More info" - * - "ofc" - */ - function text($text) - { - $this->text = $text; - return $this; - } - - /** - * This works, but to get the mouse pointer to change - * to a little hand you need to use "stuff"-- see text() - */ - function on_click($on_click) - { - $this->{'on-click'} = $on_click; - return $this; - } - - /** - *@param $bold boolean. - *@param $underline boolean. - *@param $border boolean. - *@prarm $alpha real (0 to 1.0) - */ - function style($bold, $underline, $border, $alpha ) - { - $this->bold = $bold; - $this->border = $underline; - $this->underline = $border; - $this->alpha = $alpha; - return $this; - } - - /** - *@param $tag as ofc_tag - */ - function append_tag($tag) - { - $this->values[] = $tag; - } -} - -class ofc_tag extends ofc_tags -{ - function ofc_tag($x, $y) - { - $this->x = $x; - $this->y = $y; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_title.php b/application/libraries/ofc-library/ofc_title.php deleted file mode 100644 index 58d817a81..000000000 --- a/application/libraries/ofc-library/ofc_title.php +++ /dev/null @@ -1,39 +0,0 @@ -text = $text; - } - - /** - * A css string. Can optionally contain: - * - font-size - * - font-family - * - font-weight - * - color - * - background-color - * - text-align - * - margin - * - margin-left - * - margin-right - * - margin-top - * - margin-bottom - * - padding - * - padding-left - * - padding-right - * - padding-top - * - padding-bottom - * just like the css we use all the time :-) - */ - function set_style( $css ) - { - $this->style = $css; - //"{font-size: 20px; color:#0000ff; font-family: Verdana; text-align: center;}"; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_tooltip.php b/application/libraries/ofc-library/ofc_tooltip.php deleted file mode 100644 index 53ebb261a..000000000 --- a/application/libraries/ofc-library/ofc_tooltip.php +++ /dev/null @@ -1,67 +0,0 @@ -shadow = $shadow; - } - - /** - * @param $stroke as integer, border width in pixels (e.g. 5 ) - */ - function set_stroke( $stroke ) - { - $this->stroke = $stroke; - } - - /** - * @param $colour as string, HEX colour e.g. '#0000ff' - */ - function set_colour( $colour ) - { - $this->colour = $colour; - } - - /** - * @param $bg as string, HEX colour e.g. '#0000ff' - */ - function set_background_colour( $bg ) - { - $this->background = $bg; - } - - /** - * @param $style as string. A css style. - */ - function set_title_style( $style ) - { - $this->title = $style; - } - - /** - * @param $style as string. A css style. - */ - function set_body_style( $style ) - { - $this->body = $style; - } - - function set_proximity() - { - $this->mouse = 1; - } - - function set_hover() - { - $this->mouse = 2; - } -} - diff --git a/application/libraries/ofc-library/ofc_upload_image.php b/application/libraries/ofc-library/ofc_upload_image.php deleted file mode 100644 index 7c5483150..000000000 --- a/application/libraries/ofc-library/ofc_upload_image.php +++ /dev/null @@ -1,70 +0,0 @@ - save_image debug mode, you -// will see the 'echo' text in a new window. -// - -/* - -print_r( $_GET ); -print_r( $_POST ); -print_r( $_FILES ); - -print_r( $GLOBALS ); -print_r( $GLOBALS["HTTP_RAW_POST_DATA"] ); - -*/ - - -// default path for the image to be stored // -$default_path = '../tmp-upload-images/'; - -if (!file_exists($default_path)) mkdir($default_path, 0777, true); - -// full path to the saved image including filename // -$destination = $default_path . basename( $_GET[ 'name' ] ); - -echo 'Saving your image to: '. $destination; -// print_r( $_POST ); -// print_r( $_SERVER ); -// echo $HTTP_RAW_POST_DATA; - -// -// POST data is usually string data, but we are passing a RAW .png -// so PHP is a bit confused and $_POST is empty. But it has saved -// the raw bits into $HTTP_RAW_POST_DATA -// - -$jfh = fopen($destination, 'w') or die("can't open file"); -fwrite($jfh, $HTTP_RAW_POST_DATA); -fclose($jfh); - -// -// LOOK: -// -exit(); - - -// -// PHP5: -// - - -// default path for the image to be stored // -$default_path = 'tmp-upload-images/'; - -if (!file_exists($default_path)) mkdir($default_path, 0777, true); - -// full path to the saved image including filename // -$destination = $default_path . basename( $_FILES[ 'Filedata' ][ 'name' ] ); - -// move the image into the specified directory // -if (move_uploaded_file($_FILES[ 'Filedata' ][ 'tmp_name' ], $destination)) { - echo "The file " . basename( $_FILES[ 'Filedata' ][ 'name' ] ) . " has been uploaded;"; -} else { - echo "FILE UPLOAD FAILED"; -} - - -?> diff --git a/application/libraries/ofc-library/ofc_x_axis.php b/application/libraries/ofc-library/ofc_x_axis.php deleted file mode 100644 index 3bbaa676d..000000000 --- a/application/libraries/ofc-library/ofc_x_axis.php +++ /dev/null @@ -1,140 +0,0 @@ -stroke = $stroke; - } - - function stroke( $stroke ) - { - $this->set_stroke( $stroke ); - return $this; - } - - /** - *@param $colour as string HEX colour - *@param $grid_colour as string HEX colour - */ - function set_colours( $colour, $grid_colour ) - { - $this->set_colour( $colour ); - $this->set_grid_colour( $grid_colour ); - } - - /** - *@param $colour as string HEX colour - */ - function set_colour( $colour ) - { - $this->colour = $colour; - } - - function colour( $colour ) - { - $this->set_colour($colour); - return $this; - } - - function set_tick_height( $height ) - { - $tmp = 'tick-height'; - $this->$tmp = $height; - } - - function tick_height( $height ) - { - $this->set_tick_height($height); - return $this; - } - - function set_grid_colour( $colour ) - { - $tmp = 'grid-colour'; - $this->$tmp = $colour; - } - - function grid_colour( $colour ) - { - $this->set_grid_colour($colour); - return $this; - } - - /** - * @param $o is a boolean. If true, the X axis start half a step in - * This defaults to True - */ - function set_offset( $o ) - { - $this->offset = $o?true:false; - } - - function offset( $o ) - { - $this->set_offset($o); - return $this; - } - - /** - * @param $steps as integer. Which grid lines and ticks are visible. - */ - function set_steps( $steps ) - { - $this->steps = $steps; - } - - function steps( $steps ) - { - $this->set_steps($steps); - return $this; - } - - /** - * @param $val as an integer, the height in pixels of the 3D bar. Mostly - * used for the 3D bar chart. - */ - function set_3d( $val ) - { - $tmp = '3d'; - $this->$tmp = $val; - } - - /** - * @param $x_axis_labels as an x_axis_labels object - * Use this to customize the labels (colour, font, etc...) - */ - function set_labels( $x_axis_labels ) - { - //$this->labels = $v; - $this->labels = $x_axis_labels; - } - - /** - * Sugar syntax: helper function to make the examples simpler. - * @param $a is an array of labels - */ - function set_labels_from_array( $a ) - { - $x_axis_labels = new x_axis_labels(); - $x_axis_labels->set_labels( $a ); - $this->labels = $x_axis_labels; - - if( isset( $this->steps ) ) - $x_axis_labels->set_steps( $this->steps ); - } - - /** - * min and max. - */ - function set_range( $min, $max ) - { - $this->min = $min; - $this->max = $max; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_x_axis_label.php b/application/libraries/ofc-library/ofc_x_axis_label.php deleted file mode 100644 index 2dc1492da..000000000 --- a/application/libraries/ofc-library/ofc_x_axis_label.php +++ /dev/null @@ -1,45 +0,0 @@ -set_text( $text ); - $this->set_colour( $colour ); - $this->set_size( $size ); - $this->set_rotate( $rotate ); - } - - function set_text( $text ) - { - $this->text = $text; - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - function set_size( $size ) - { - $this->size = $size; - } - - function set_rotate( $rotate ) - { - $this->rotate = $rotate; - } - - function set_vertical() - { - $this->rotate = "vertical"; - } - - function set_visible() - { - $this->visible = true; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_x_axis_labels.php b/application/libraries/ofc-library/ofc_x_axis_labels.php deleted file mode 100644 index fb8e7d7db..000000000 --- a/application/libraries/ofc-library/ofc_x_axis_labels.php +++ /dev/null @@ -1,69 +0,0 @@ -steps = $steps; - } - - /** - * @param $steps as integer which labels are visible - */ - function visible_steps( $steps ) - { - $this->{"visible-steps"} = $steps; - return $this; - } - - /** - * - * @param $labels as an array of [x_axis_label or string] - */ - function set_labels( $labels ) - { - $this->labels = $labels; - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - /** - * font size in pixels - */ - function set_size( $size ) - { - $this->size = $size; - } - - /** - * rotate labels - */ - function set_vertical() - { - $this->rotate = 270; - } - - /** - * @param @angle as real. The angle of the text. - */ - function rotate( $angle ) - { - $this->rotate = $angle; - } - - /** - * @param $text as string. Replace and magic variables with actual x axis position. - */ - function text( $text ) - { - $this->text = $text; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_x_legend.php b/application/libraries/ofc-library/ofc_x_legend.php deleted file mode 100644 index f36c017f4..000000000 --- a/application/libraries/ofc-library/ofc_x_legend.php +++ /dev/null @@ -1,15 +0,0 @@ -text = $text; - } - - function set_style( $css ) - { - $this->style = $css; - //"{font-size: 20px; color:#0000ff; font-family: Verdana; text-align: center;}"; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_y_axis.php b/application/libraries/ofc-library/ofc_y_axis.php deleted file mode 100644 index 449bc295b..000000000 --- a/application/libraries/ofc-library/ofc_y_axis.php +++ /dev/null @@ -1,17 +0,0 @@ -$tmp = $colour; - } - -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_y_axis_base.php b/application/libraries/ofc-library/ofc_y_axis_base.php deleted file mode 100644 index b99519ec3..000000000 --- a/application/libraries/ofc-library/ofc_y_axis_base.php +++ /dev/null @@ -1,116 +0,0 @@ -stroke = $s; - } - - /** - * @param $val as integer. The length of the ticks in pixels - */ - function set_tick_length( $val ) - { - $tmp = 'tick-length'; - $this->$tmp = $val; - } - - function set_colours( $colour, $grid_colour ) - { - $this->set_colour( $colour ); - $this->set_grid_colour( $grid_colour ); - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - function set_grid_colour( $colour ) - { - $tmp = 'grid-colour'; - $this->$tmp = $colour; - } - - /** - * Set min and max values, also (optionally) set the steps value. - * You can reverse the chart by setting min larger than max, e.g. min = 10 - * and max = 0. - * - * @param $min as integer - * @param $max as integer - * @param $steps as integer. - */ - function set_range( $min, $max, $steps=1 ) - { - $this->min = $min; - $this->max = $max; - $this->set_steps( $steps ); - } - - /** - * Sugar for set_range - */ - function range( $min, $max, $steps=1 ) - { - $this->set_range( $min, $max, $steps ); - return $this; - } - - /** - * @param $off as Boolean. If true the Y axis is nudged up half a step. - */ - function set_offset( $off ) - { - $this->offset = $off?1:0; - } - - /** - * @param $y_axis_labels as an y_axis_labels object - * Use this to customize the labels (colour, font, etc...) - */ - function set_labels( $y_axis_labels ) - { - $this->labels = $y_axis_labels; - } - - /** - * Pass in some text for each label. This can contain magic variables "#val#" which - * will get replaced with the value for that Y axis label. Useful for: - * - "£#val#" - * - "#val#%" - * - "#val# million" - * - * @param $text as string. - */ - function set_label_text( $text ) - { - $tmp = new y_axis_labels(); - $tmp->set_text( $text ); - $this->labels = $tmp; - } - - /** - * @param $steps as integer. - * - * Only show every $steps label, e.g. every 10th - */ - function set_steps( $steps ) - { - $this->steps = $steps; - } - - /** - * Make the labels show vertical - */ - function set_vertical() - { - $this->rotate = "vertical"; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_y_axis_label.php b/application/libraries/ofc-library/ofc_y_axis_label.php deleted file mode 100644 index bded9b84e..000000000 --- a/application/libraries/ofc-library/ofc_y_axis_label.php +++ /dev/null @@ -1,38 +0,0 @@ -y = $y; - $this->set_text( $text ); - } - - function set_text( $text ) - { - $this->text = $text; - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - function set_size( $size ) - { - $this->size = $size; - } - - function set_rotate( $rotate ) - { - $this->rotate = $rotate; - } - - function set_vertical() - { - $this->rotate = "vertical"; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_y_axis_labels.php b/application/libraries/ofc-library/ofc_y_axis_labels.php deleted file mode 100644 index 75f777e53..000000000 --- a/application/libraries/ofc-library/ofc_y_axis_labels.php +++ /dev/null @@ -1,57 +0,0 @@ -steps = $steps; - } - - /** - * - * @param $labels as an array of [y_axis_label or string] - */ - function set_labels( $labels ) - { - $this->labels = $labels; - } - - function set_colour( $colour ) - { - $this->colour = $colour; - } - - /** - * font size in pixels - */ - function set_size( $size ) - { - $this->size = $size; - } - - /** - * rotate labels - */ - function set_vertical() - { - $this->rotate = 270; - } - - function rotate( $angle ) - { - $this->rotate = $angle; - } - - /** - * @param $text default text that all labels inherit - */ - function set_text( $text ) - { - $this->text = $text; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/ofc_y_axis_right.php b/application/libraries/ofc-library/ofc_y_axis_right.php deleted file mode 100644 index 1e0911194..000000000 --- a/application/libraries/ofc-library/ofc_y_axis_right.php +++ /dev/null @@ -1,6 +0,0 @@ -text = $text; - } - - function set_style( $css ) - { - $this->style = $css; - //"{font-size: 20px; color:#0000ff; font-family: Verdana; text-align: center;}"; - } -} \ No newline at end of file diff --git a/application/libraries/ofc-library/open-flash-chart-object.php b/application/libraries/ofc-library/open-flash-chart-object.php deleted file mode 100644 index d3b64aa48..000000000 --- a/application/libraries/ofc-library/open-flash-chart-object.php +++ /dev/null @@ -1,109 +0,0 @@ -'; - - if( !isset( $open_flash_chart_seqno ) ) - { - $open_flash_chart_seqno = 1; - $out[] = ''; - } - else - { - $open_flash_chart_seqno++; - $obj_id .= '_'. $open_flash_chart_seqno; - $div_name .= '_'. $open_flash_chart_seqno; - } - - if( $use_swfobject ) - { - // Using library for auto-enabling Flash object on IE, disabled-Javascript proof - $out[] = '
'; - $out[] = ''; - $out[] = ''; - } - - return implode("\n",$out); -} -?> \ No newline at end of file diff --git a/application/libraries/ofc-library/open-flash-chart.php b/application/libraries/ofc-library/open-flash-chart.php deleted file mode 100644 index 2a90eaffb..000000000 --- a/application/libraries/ofc-library/open-flash-chart.php +++ /dev/null @@ -1,178 +0,0 @@ -title = new title( "Many data lines" ); - $this->elements = array(); - } - - function set_title( $t ) - { - $this->title = $t; - } - - function set_x_axis( $x ) - { - $this->x_axis = $x; - } - - function set_y_axis( $y ) - { - $this->y_axis = $y; - } - - function add_y_axis( $y ) - { - $this->y_axis = $y; - } - - function set_y_axis_right( $y ) - { - $this->y_axis_right = $y; - } - - function add_element( $e ) - { - $this->elements[] = $e; - } - - function set_x_legend( $x ) - { - $this->x_legend = $x; - } - - function set_y_legend( $y ) - { - $this->y_legend = $y; - } - - function set_bg_colour( $colour ) - { - $this->bg_colour = $colour; - } - - function set_radar_axis( $radar ) - { - $this->radar_axis = $radar; - } - - function set_tooltip( $tooltip ) - { - $this->tooltip = $tooltip; - } - - /** - * This is a bit funky :( - * - * @param $num_decimals as integer. Truncate the decimals to $num_decimals, e.g. set it - * to 5 and 3.333333333 will display as 3.33333. 2.0 will display as 2 (or 2.00000 - see below) - * @param $is_fixed_num_decimals_forced as boolean. If true it will pad the decimals. - * @param $is_decimal_separator_comma as boolean - * @param $is_thousand_separator_disabled as boolean - * - * This needs a bit of love and attention - */ - function set_number_format($num_decimals, $is_fixed_num_decimals_forced, $is_decimal_separator_comma, $is_thousand_separator_disabled ) - { - $this->num_decimals = $num_decimals; - $this->is_fixed_num_decimals_forced = $is_fixed_num_decimals_forced; - $this->is_decimal_separator_comma = $is_decimal_separator_comma; - $this->is_thousand_separator_disabled = $is_thousand_separator_disabled; - } - - /** - * This is experimental and will change as we make it work - * - * @param $m as ofc_menu - */ - function set_menu($m) - { - $this->menu = $m; - } - - function toString() - { - if (function_exists('json_encode')) - { - return json_encode($this); - } - else - { - $json = new Services_JSON(); - return $json->encode( $this ); - } - } - - function toPrettyString() - { - return json_format( $this->toString() ); - } -} - - - -// -// there is no PHP end tag so we don't mess the headers up! -// \ No newline at end of file diff --git a/application/models/appconfig.php b/application/models/appconfig.php deleted file mode 100644 index 9dc004165..000000000 --- a/application/models/appconfig.php +++ /dev/null @@ -1,81 +0,0 @@ -db->from('app_config'); - $this->db->where('app_config.key',$key); - $query = $this->db->get(); - - return ($query->num_rows()==1); - } - - function get_all() - { - $this->db->from('app_config'); - $this->db->order_by("key", "asc"); - return $this->db->get(); - } - - function get($key) - { - $query = $this->db->get_where('app_config', array('key' => $key), 1); - - if($query->num_rows()==1) - { - return $query->row()->value; - } - - return ""; - - } - - function save($key,$value) - { - $config_data=array( - 'key'=>$key, - 'value'=>$value - ); - - if (!$this->exists($key)) - { - return $this->db->insert('app_config',$config_data); - } - - $this->db->where('key', $key); - return $this->db->update('app_config',$config_data); - } - - function batch_save($data) - { - $success=true; - - //Run these queries as a transaction, we want to make sure we do all or nothing - $this->db->trans_start(); - foreach($data as $key=>$value) - { - if(!$this->save($key,$value)) - { - $success=false; - break; - } - } - - $this->db->trans_complete(); - return $success; - - } - - function delete($key) - { - return $this->db->delete('app_config', array('key' => $key)); - } - - function delete_all() - { - return $this->db->empty_table('app_config'); - } -} - -?> \ No newline at end of file diff --git a/application/models/customer.php b/application/models/customer.php deleted file mode 100644 index 9c083ea5d..000000000 --- a/application/models/customer.php +++ /dev/null @@ -1,246 +0,0 @@ -db->from('customers'); - $this->db->join('people', 'people.person_id = customers.person_id'); - $this->db->where('customers.person_id',$person_id); - $query = $this->db->get(); - - return ($query->num_rows()==1); - } - - /* - Returns all the customers - */ - function get_all($limit=10000, $offset=0) - { - $this->db->from('customers'); - $this->db->join('people','customers.person_id=people.person_id'); - $this->db->where('deleted',0); - $this->db->order_by("last_name", "asc"); - $this->db->limit($limit); - $this->db->offset($offset); - return $this->db->get(); - } - - function count_all() - { - $this->db->from('customers'); - $this->db->where('deleted',0); - return $this->db->count_all_results(); - } - - /* - Gets information about a particular customer - */ - function get_info($customer_id) - { - $this->db->from('customers'); - $this->db->join('people', 'people.person_id = customers.person_id'); - $this->db->where('customers.person_id',$customer_id); - $query = $this->db->get(); - - if($query->num_rows()==1) - { - return $query->row(); - } - else - { - //Get empty base parent object, as $customer_id is NOT an customer - $person_obj=parent::get_info(-1); - - //Get all the fields from customer table - $fields = $this->db->list_fields('customers'); - - //append those fields to base parent object, we we have a complete empty object - foreach ($fields as $field) - { - $person_obj->$field=''; - } - - return $person_obj; - } - } - - /* - Gets information about multiple customers - */ - function get_multiple_info($customer_ids) - { - $this->db->from('customers'); - $this->db->join('people', 'people.person_id = customers.person_id'); - $this->db->where_in('customers.person_id',$customer_ids); - $this->db->order_by("last_name", "asc"); - return $this->db->get(); - } - - /* - Inserts or updates a customer - */ - function save(&$person_data, &$customer_data,$customer_id=false) - { - $success=false; - //Run these queries as a transaction, we want to make sure we do all or nothing - $this->db->trans_start(); - - if(parent::save($person_data,$customer_id)) - { - if (!$customer_id or !$this->exists($customer_id)) - { - $customer_data['person_id'] = $person_data['person_id']; - $success = $this->db->insert('customers',$customer_data); - } - else - { - $this->db->where('person_id', $customer_id); - $success = $this->db->update('customers',$customer_data); - } - - } - - $this->db->trans_complete(); - return $success; - } - - /* - Deletes one customer - */ - function delete($customer_id) - { - $this->db->where('person_id', $customer_id); - return $this->db->update('customers', array('deleted' => 1)); - } - - /* - Deletes a list of customers - */ - function delete_list($customer_ids) - { - $this->db->where_in('person_id',$customer_ids); - return $this->db->update('customers', array('deleted' => 1)); - } - - /* - Get search suggestions to find customers - */ - function get_search_suggestions($search,$limit=25) - { - $suggestions = array(); - - $this->db->from('customers'); - $this->db->join('people','customers.person_id=people.person_id'); - $this->db->where("(first_name LIKE '%".$this->db->escape_like_str($search)."%' or - last_name LIKE '%".$this->db->escape_like_str($search)."%' or - CONCAT(`first_name`,' ',`last_name`) LIKE '%".$this->db->escape_like_str($search)."%') and deleted=0"); - $this->db->order_by("last_name", "asc"); - $by_name = $this->db->get(); - foreach($by_name->result() as $row) - { - $suggestions[]=$row->first_name.' '.$row->last_name; - } - - $this->db->from('customers'); - $this->db->join('people','customers.person_id=people.person_id'); - $this->db->where('deleted',0); - $this->db->like("email",$search); - $this->db->order_by("email", "asc"); - $by_email = $this->db->get(); - foreach($by_email->result() as $row) - { - $suggestions[]=$row->email; - } - - $this->db->from('customers'); - $this->db->join('people','customers.person_id=people.person_id'); - $this->db->where('deleted',0); - $this->db->like("phone_number",$search); - $this->db->order_by("phone_number", "asc"); - $by_phone = $this->db->get(); - foreach($by_phone->result() as $row) - { - $suggestions[]=$row->phone_number; - } - - $this->db->from('customers'); - $this->db->join('people','customers.person_id=people.person_id'); - $this->db->where('deleted',0); - $this->db->like("account_number",$search); - $this->db->order_by("account_number", "asc"); - $by_account_number = $this->db->get(); - foreach($by_account_number->result() as $row) - { - $suggestions[]=$row->account_number; - } - - //only return $limit suggestions - if(count($suggestions > $limit)) - { - $suggestions = array_slice($suggestions, 0,$limit); - } - return $suggestions; - - } - - /* - Get search suggestions to find customers - */ - function get_customer_search_suggestions($search,$limit=25) - { - $suggestions = array(); - - $this->db->from('customers'); - $this->db->join('people','customers.person_id=people.person_id'); - $this->db->where("(first_name LIKE '%".$this->db->escape_like_str($search)."%' or - last_name LIKE '%".$this->db->escape_like_str($search)."%' or - CONCAT(`first_name`,' ',`last_name`) LIKE '%".$this->db->escape_like_str($search)."%') and deleted=0"); - $this->db->order_by("last_name", "asc"); - $by_name = $this->db->get(); - foreach($by_name->result() as $row) - { - $suggestions[]=$row->person_id.'|'.$row->first_name.' '.$row->last_name; - } - - $this->db->from('customers'); - $this->db->join('people','customers.person_id=people.person_id'); - $this->db->where('deleted',0); - $this->db->like("account_number",$search); - $this->db->order_by("account_number", "asc"); - $by_account_number = $this->db->get(); - foreach($by_account_number->result() as $row) - { - $suggestions[]=$row->person_id.'|'.$row->account_number; - } - - //only return $limit suggestions - if(count($suggestions > $limit)) - { - $suggestions = array_slice($suggestions, 0,$limit); - } - return $suggestions; - - } - /* - Preform a search on customers - */ - function search($search) - { - $this->db->from('customers'); - $this->db->join('people','customers.person_id=people.person_id'); - $this->db->where("(first_name LIKE '%".$this->db->escape_like_str($search)."%' or - last_name LIKE '%".$this->db->escape_like_str($search)."%' or - email LIKE '%".$this->db->escape_like_str($search)."%' or - phone_number LIKE '%".$this->db->escape_like_str($search)."%' or - account_number LIKE '%".$this->db->escape_like_str($search)."%' or - CONCAT(`first_name`,' ',`last_name`) LIKE '%".$this->db->escape_like_str($search)."%') and deleted=0"); - $this->db->order_by("last_name", "asc"); - - return $this->db->get(); - } - -} -?> diff --git a/application/models/employee.php b/application/models/employee.php deleted file mode 100644 index e0d0b3606..000000000 --- a/application/models/employee.php +++ /dev/null @@ -1,325 +0,0 @@ -db->from('employees'); - $this->db->join('people', 'people.person_id = employees.person_id'); - $this->db->where('employees.person_id',$person_id); - $query = $this->db->get(); - - return ($query->num_rows()==1); - } - - /* - Returns all the employees - */ - function get_all($limit=10000, $offset=0) - { - $this->db->from('employees'); - $this->db->where('deleted',0); - $this->db->join('people','employees.person_id=people.person_id'); - $this->db->order_by("last_name", "asc"); - $this->db->limit($limit); - $this->db->offset($offset); - return $this->db->get(); - } - - function count_all() - { - $this->db->from('employees'); - $this->db->where('deleted',0); - return $this->db->count_all_results(); - } - - /* - Gets information about a particular employee - */ - function get_info($employee_id) - { - $this->db->from('employees'); - $this->db->join('people', 'people.person_id = employees.person_id'); - $this->db->where('employees.person_id',$employee_id); - $query = $this->db->get(); - - if($query->num_rows()==1) - { - return $query->row(); - } - else - { - //Get empty base parent object, as $employee_id is NOT an employee - $person_obj=parent::get_info(-1); - - //Get all the fields from employee table - $fields = $this->db->list_fields('employees'); - - //append those fields to base parent object, we we have a complete empty object - foreach ($fields as $field) - { - $person_obj->$field=''; - } - - return $person_obj; - } - } - - /* - Gets information about multiple employees - */ - function get_multiple_info($employee_ids) - { - $this->db->from('employees'); - $this->db->join('people', 'people.person_id = employees.person_id'); - $this->db->where_in('employees.person_id',$employee_ids); - $this->db->order_by("last_name", "asc"); - return $this->db->get(); - } - - /* - Inserts or updates an employee - */ - function save(&$person_data, &$employee_data,&$permission_data,$employee_id=false) - { - $success=false; - - //Run these queries as a transaction, we want to make sure we do all or nothing - $this->db->trans_start(); - - if(parent::save($person_data,$employee_id)) - { - if (!$employee_id or !$this->exists($employee_id)) - { - $employee_data['person_id'] = $employee_id = $person_data['person_id']; - $success = $this->db->insert('employees',$employee_data); - } - else - { - $this->db->where('person_id', $employee_id); - $success = $this->db->update('employees',$employee_data); - } - - //We have either inserted or updated a new employee, now lets set permissions. - if($success) - { - //First lets clear out any permissions the employee currently has. - $success=$this->db->delete('permissions', array('person_id' => $employee_id)); - - //Now insert the new permissions - if($success) - { - foreach($permission_data as $allowed_module) - { - $success = $this->db->insert('permissions', - array( - 'module_id'=>$allowed_module, - 'person_id'=>$employee_id)); - } - } - } - - } - - $this->db->trans_complete(); - return $success; - } - - /* - Deletes one employee - */ - function delete($employee_id) - { - $success=false; - - //Don't let employee delete their self - if($employee_id==$this->get_logged_in_employee_info()->person_id) - return false; - - //Run these queries as a transaction, we want to make sure we do all or nothing - $this->db->trans_start(); - - //Delete permissions - if($this->db->delete('permissions', array('person_id' => $employee_id))) - { - $this->db->where('person_id', $employee_id); - $success = $this->db->update('employees', array('deleted' => 1)); - } - $this->db->trans_complete(); - return $success; - } - - /* - Deletes a list of employees - */ - function delete_list($employee_ids) - { - $success=false; - - //Don't let employee delete their self - if(in_array($this->get_logged_in_employee_info()->person_id,$employee_ids)) - return false; - - //Run these queries as a transaction, we want to make sure we do all or nothing - $this->db->trans_start(); - - $this->db->where_in('person_id',$employee_ids); - //Delete permissions - if ($this->db->delete('permissions')) - { - //delete from employee table - $this->db->where_in('person_id',$employee_ids); - $success = $this->db->update('employees', array('deleted' => 1)); - } - $this->db->trans_complete(); - return $success; - } - - /* - Get search suggestions to find employees - */ - function get_search_suggestions($search,$limit=5) - { - $suggestions = array(); - - $this->db->from('employees'); - $this->db->join('people','employees.person_id=people.person_id'); - $this->db->where("(first_name LIKE '%".$this->db->escape_like_str($search)."%' or - last_name LIKE '%".$this->db->escape_like_str($search)."%' or - CONCAT(`first_name`,' ',`last_name`) LIKE '%".$this->db->escape_like_str($search)."%') and deleted=0"); - $this->db->order_by("last_name", "asc"); - $by_name = $this->db->get(); - foreach($by_name->result() as $row) - { - $suggestions[]=$row->first_name.' '.$row->last_name; - } - - $this->db->from('employees'); - $this->db->join('people','employees.person_id=people.person_id'); - $this->db->where('deleted', 0); - $this->db->like("email",$search); - $this->db->order_by("email", "asc"); - $by_email = $this->db->get(); - foreach($by_email->result() as $row) - { - $suggestions[]=$row->email; - } - - $this->db->from('employees'); - $this->db->join('people','employees.person_id=people.person_id'); - $this->db->where('deleted', 0); - $this->db->like("username",$search); - $this->db->order_by("username", "asc"); - $by_username = $this->db->get(); - foreach($by_username->result() as $row) - { - $suggestions[]=$row->username; - } - - - $this->db->from('employees'); - $this->db->join('people','employees.person_id=people.person_id'); - $this->db->where('deleted', 0); - $this->db->like("phone_number",$search); - $this->db->order_by("phone_number", "asc"); - $by_phone = $this->db->get(); - foreach($by_phone->result() as $row) - { - $suggestions[]=$row->phone_number; - } - - - //only return $limit suggestions - if(count($suggestions > $limit)) - { - $suggestions = array_slice($suggestions, 0,$limit); - } - return $suggestions; - - } - - /* - Preform a search on employees - */ - function search($search) - { - $this->db->from('employees'); - $this->db->join('people','employees.person_id=people.person_id'); - $this->db->where("(first_name LIKE '%".$this->db->escape_like_str($search)."%' or - last_name LIKE '%".$this->db->escape_like_str($search)."%' or - email LIKE '%".$this->db->escape_like_str($search)."%' or - phone_number LIKE '%".$this->db->escape_like_str($search)."%' or - username LIKE '%".$this->db->escape_like_str($search)."%' or - CONCAT(`first_name`,' ',`last_name`) LIKE '%".$this->db->escape_like_str($search)."%') and deleted=0"); - $this->db->order_by("last_name", "asc"); - - return $this->db->get(); - } - - /* - Attempts to login employee and set session. Returns boolean based on outcome. - */ - function login($username, $password) - { - $query = $this->db->get_where('employees', array('username' => $username,'password'=>md5($password), 'deleted'=>0), 1); - if ($query->num_rows() ==1) - { - $row=$query->row(); - $this->session->set_userdata('person_id', $row->person_id); - return true; - } - return false; - } - - /* - Logs out a user by destorying all session data and redirect to login - */ - function logout() - { - $this->session->sess_destroy(); - redirect('login'); - } - - /* - Determins if a employee is logged in - */ - function is_logged_in() - { - return $this->session->userdata('person_id')!=false; - } - - /* - Gets information about the currently logged in employee. - */ - function get_logged_in_employee_info() - { - if($this->is_logged_in()) - { - return $this->get_info($this->session->userdata('person_id')); - } - - return false; - } - - /* - Determins whether the employee specified employee has access the specific module. - */ - function has_permission($module_id,$person_id) - { - //if no module_id is null, allow access - if($module_id==null) - { - return true; - } - - $query = $this->db->get_where('permissions', array('person_id' => $person_id,'module_id'=>$module_id), 1); - return $query->num_rows() == 1; - - - return false; - } - -} -?> diff --git a/application/models/giftcard.php b/application/models/giftcard.php deleted file mode 100644 index 159071dd8..000000000 --- a/application/models/giftcard.php +++ /dev/null @@ -1,199 +0,0 @@ -db->from('giftcards'); - $this->db->where('giftcard_id',$giftcard_id); - $this->db->where('deleted',0); - $query = $this->db->get(); - - return ($query->num_rows()==1); - } - - /* - Returns all the giftcards - */ - function get_all($limit=10000, $offset=0) - { - $this->db->from('giftcards'); - $this->db->where('deleted',0); - $this->db->order_by("giftcard_number", "asc"); - $this->db->limit($limit); - $this->db->offset($offset); - return $this->db->get(); - } - - function count_all() - { - $this->db->from('giftcards'); - $this->db->where('deleted',0); - return $this->db->count_all_results(); - } - - /* - Gets information about a particular giftcard - */ - function get_info($giftcard_id) - { - $this->db->from('giftcards'); - $this->db->where('giftcard_id',$giftcard_id); - $this->db->where('deleted',0); - - $query = $this->db->get(); - - if($query->num_rows()==1) - { - return $query->row(); - } - else - { - //Get empty base parent object, as $giftcard_id is NOT an giftcard - $giftcard_obj=new stdClass(); - - //Get all the fields from giftcards table - $fields = $this->db->list_fields('giftcards'); - - foreach ($fields as $field) - { - $giftcard_obj->$field=''; - } - - return $giftcard_obj; - } - } - - /* - Get an giftcard id given an giftcard number - */ - function get_giftcard_id($giftcard_number) - { - $this->db->from('giftcards'); - $this->db->where('giftcard_number',$giftcard_number); - $this->db->where('deleted',0); - - $query = $this->db->get(); - - if($query->num_rows()==1) - { - return $query->row()->giftcard_id; - } - - return false; - } - - /* - Gets information about multiple giftcards - */ - function get_multiple_info($giftcard_ids) - { - $this->db->from('giftcards'); - $this->db->where_in('giftcard_id',$giftcard_ids); - $this->db->where('deleted',0); - $this->db->order_by("giftcard_number", "asc"); - return $this->db->get(); - } - - /* - Inserts or updates a giftcard - */ - function save(&$giftcard_data,$giftcard_id=false) - { - if (!$giftcard_id or !$this->exists($giftcard_id)) - { - if($this->db->insert('giftcards',$giftcard_data)) - { - $giftcard_data['giftcard_id']=$this->db->insert_id(); - return true; - } - return false; - } - - $this->db->where('giftcard_id', $giftcard_id); - return $this->db->update('giftcards',$giftcard_data); - } - - /* - Updates multiple giftcards at once - */ - function update_multiple($giftcard_data,$giftcard_ids) - { - $this->db->where_in('giftcard_id',$giftcard_ids); - return $this->db->update('giftcards',$giftcard_data); - } - - /* - Deletes one giftcard - */ - function delete($giftcard_id) - { - $this->db->where('giftcard_id', $giftcard_id); - return $this->db->update('giftcards', array('deleted' => 1)); - } - - /* - Deletes a list of giftcards - */ - function delete_list($giftcard_ids) - { - $this->db->where_in('giftcard_id',$giftcard_ids); - return $this->db->update('giftcards', array('deleted' => 1)); - } - - /* - Get search suggestions to find giftcards - */ - function get_search_suggestions($search,$limit=25) - { - $suggestions = array(); - - $this->db->from('giftcards'); - $this->db->like('giftcard_number', $search); - $this->db->where('deleted',0); - $this->db->order_by("giftcard_number", "asc"); - $by_number = $this->db->get(); - foreach($by_number->result() as $row) - { - $suggestions[]=$row->giftcard_number; - } - - //only return $limit suggestions - if(count($suggestions > $limit)) - { - $suggestions = array_slice($suggestions, 0,$limit); - } - return $suggestions; - - } - - /* - Preform a search on giftcards - */ - function search($search) - { - $this->db->from('giftcards'); - $this->db->where("giftcard_number LIKE '%".$this->db->escape_like_str($search)."%' and deleted=0"); - $this->db->order_by("giftcard_number", "asc"); - return $this->db->get(); - } - - public function get_giftcard_value( $giftcard_number ) - { - if ( !$this->exists( $this->get_giftcard_id($giftcard_number))) - return 0; - - $this->db->from('giftcards'); - $this->db->where('giftcard_number',$giftcard_number); - return $this->db->get()->row()->value; - } - - function update_giftcard_value( $giftcard_number, $value ) - { - $this->db->where('giftcard_number', $giftcard_number); - $this->db->update('giftcards', array('value' => $value)); - } -} -?> diff --git a/application/models/index.html b/application/models/index.html deleted file mode 100644 index 065d2da5e..000000000 --- a/application/models/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

Directory access is forbidden.

- - - \ No newline at end of file diff --git a/application/models/inventory.php b/application/models/inventory.php deleted file mode 100644 index 6188cddd1..000000000 --- a/application/models/inventory.php +++ /dev/null @@ -1,18 +0,0 @@ -db->insert('inventory',$inventory_data); - } - - function get_inventory_data_for_item($item_id) - { - $this->db->from('inventory'); - $this->db->where('trans_items',$item_id); - $this->db->order_by("trans_date", "desc"); - return $this->db->get(); - } -} - -?> \ No newline at end of file diff --git a/application/models/item.php b/application/models/item.php deleted file mode 100644 index 2c56375af..000000000 --- a/application/models/item.php +++ /dev/null @@ -1,286 +0,0 @@ -db->from('items'); - $this->db->where('item_id',$item_id); - $query = $this->db->get(); - - return ($query->num_rows()==1); - } - - /* - Returns all the items - */ - function get_all($limit=10000, $offset=0) - { - $this->db->from('items'); - $this->db->where('deleted',0); - $this->db->order_by("name", "asc"); - $this->db->limit($limit); - $this->db->offset($offset); - return $this->db->get(); - } - - function count_all() - { - $this->db->from('items'); - $this->db->where('deleted',0); - return $this->db->count_all_results(); - } - - function get_all_filtered($low_inventory=0,$is_serialized=0,$no_description) - { - $this->db->from('items'); - if ($low_inventory !=0 ) - { - $this->db->where('quantity <=','reorder_level', false); - } - if ($is_serialized !=0 ) - { - $this->db->where('is_serialized',1); - } - if ($no_description!=0 ) - { - $this->db->where('description',''); - } - $this->db->where('deleted',0); - $this->db->order_by("name", "asc"); - return $this->db->get(); - } - - /* - Gets information about a particular item - */ - function get_info($item_id) - { - $this->db->from('items'); - $this->db->where('item_id',$item_id); - - $query = $this->db->get(); - - if($query->num_rows()==1) - { - return $query->row(); - } - else - { - //Get empty base parent object, as $item_id is NOT an item - $item_obj=new stdClass(); - - //Get all the fields from items table - $fields = $this->db->list_fields('items'); - - foreach ($fields as $field) - { - $item_obj->$field=''; - } - - return $item_obj; - } - } - - /* - Get an item id given an item number - */ - function get_item_id($item_number) - { - $this->db->from('items'); - $this->db->where('item_number',$item_number); - - $query = $this->db->get(); - - if($query->num_rows()==1) - { - return $query->row()->item_id; - } - - return false; - } - - /* - Gets information about multiple items - */ - function get_multiple_info($item_ids) - { - $this->db->from('items'); - $this->db->where_in('item_id',$item_ids); - $this->db->order_by("item", "asc"); - return $this->db->get(); - } - - /* - Inserts or updates a item - */ - function save(&$item_data,$item_id=false) - { - if (!$item_id or !$this->exists($item_id)) - { - if($this->db->insert('items',$item_data)) - { - $item_data['item_id']=$this->db->insert_id(); - return true; - } - return false; - } - - $this->db->where('item_id', $item_id); - return $this->db->update('items',$item_data); - } - - /* - Updates multiple items at once - */ - function update_multiple($item_data,$item_ids) - { - $this->db->where_in('item_id',$item_ids); - return $this->db->update('items',$item_data); - } - - /* - Deletes one item - */ - function delete($item_id) - { - $this->db->where('item_id', $item_id); - return $this->db->update('items', array('deleted' => 1)); - } - - /* - Deletes a list of items - */ - function delete_list($item_ids) - { - $this->db->where_in('item_id',$item_ids); - return $this->db->update('items', array('deleted' => 1)); - } - - /* - Get search suggestions to find items - */ - function get_search_suggestions($search,$limit=25) - { - $suggestions = array(); - - $this->db->from('items'); - $this->db->like('name', $search); - $this->db->where('deleted',0); - $this->db->order_by("name", "asc"); - $by_name = $this->db->get(); - foreach($by_name->result() as $row) - { - $suggestions[]=$row->name; - } - - $this->db->select('category'); - $this->db->from('items'); - $this->db->where('deleted',0); - $this->db->distinct(); - $this->db->like('category', $search); - $this->db->order_by("category", "asc"); - $by_category = $this->db->get(); - foreach($by_category->result() as $row) - { - $suggestions[]=$row->category; - } - - $this->db->from('items'); - $this->db->like('item_number', $search); - $this->db->where('deleted',0); - $this->db->order_by("item_number", "asc"); - $by_item_number = $this->db->get(); - foreach($by_item_number->result() as $row) - { - $suggestions[]=$row->item_number; - } - - - //only return $limit suggestions - if(count($suggestions > $limit)) - { - $suggestions = array_slice($suggestions, 0,$limit); - } - return $suggestions; - - } - - function get_item_search_suggestions($search,$limit=25) - { - $suggestions = array(); - - $this->db->from('items'); - $this->db->where('deleted',0); - $this->db->like('name', $search); - $this->db->order_by("name", "asc"); - $by_name = $this->db->get(); - foreach($by_name->result() as $row) - { - $suggestions[]=$row->item_id.'|'.$row->name; - } - - $this->db->from('items'); - $this->db->where('deleted',0); - $this->db->like('item_number', $search); - $this->db->order_by("item_number", "asc"); - $by_item_number = $this->db->get(); - foreach($by_item_number->result() as $row) - { - $suggestions[]=$row->item_id.'|'.$row->item_number; - } - - //only return $limit suggestions - if(count($suggestions > $limit)) - { - $suggestions = array_slice($suggestions, 0,$limit); - } - return $suggestions; - - } - - function get_category_suggestions($search) - { - $suggestions = array(); - $this->db->distinct(); - $this->db->select('category'); - $this->db->from('items'); - $this->db->like('category', $search); - $this->db->where('deleted', 0); - $this->db->order_by("category", "asc"); - $by_category = $this->db->get(); - foreach($by_category->result() as $row) - { - $suggestions[]=$row->category; - } - - return $suggestions; - } - - /* - Preform a search on items - */ - function search($search) - { - $this->db->from('items'); - $this->db->where("(name LIKE '%".$this->db->escape_like_str($search)."%' or - item_number LIKE '%".$this->db->escape_like_str($search)."%' or - category LIKE '%".$this->db->escape_like_str($search)."%') and deleted=0"); - $this->db->order_by("name", "asc"); - return $this->db->get(); - } - - function get_categories() - { - $this->db->select('category'); - $this->db->from('items'); - $this->db->where('deleted',0); - $this->db->distinct(); - $this->db->order_by("category", "asc"); - - return $this->db->get(); - } -} -?> diff --git a/application/models/item_kit.php b/application/models/item_kit.php deleted file mode 100644 index eb2f7fc67..000000000 --- a/application/models/item_kit.php +++ /dev/null @@ -1,171 +0,0 @@ -db->from('item_kits'); - $this->db->where('item_kit_id',$item_kit_id); - $query = $this->db->get(); - - return ($query->num_rows()==1); - } - - /* - Returns all the item kits - */ - function get_all($limit=10000, $offset=0) - { - $this->db->from('item_kits'); - $this->db->order_by("name", "asc"); - $this->db->limit($limit); - $this->db->offset($offset); - return $this->db->get(); - } - - function count_all() - { - $this->db->from('item_kits'); - return $this->db->count_all_results(); - } - - /* - Gets information about a particular item kit - */ - function get_info($item_kit_id) - { - $this->db->from('item_kits'); - $this->db->where('item_kit_id',$item_kit_id); - - $query = $this->db->get(); - - if($query->num_rows()==1) - { - return $query->row(); - } - else - { - //Get empty base parent object, as $item_kit_id is NOT an item kit - $item_obj=new stdClass(); - - //Get all the fields from items table - $fields = $this->db->list_fields('item_kits'); - - foreach ($fields as $field) - { - $item_obj->$field=''; - } - - return $item_obj; - } - } - - /* - Gets information about multiple item kits - */ - function get_multiple_info($item_kit_ids) - { - $this->db->from('item_kits'); - $this->db->where_in('item_kit_id',$item_kit_ids); - $this->db->order_by("name", "asc"); - return $this->db->get(); - } - - /* - Inserts or updates an item kit - */ - function save(&$item_kit_data,$item_kit_id=false) - { - if (!$item_kit_id or !$this->exists($item_kit_id)) - { - if($this->db->insert('item_kits',$item_kit_data)) - { - $item_kit_data['item_kit_id']=$this->db->insert_id(); - return true; - } - return false; - } - - $this->db->where('item_kit_id', $item_kit_id); - return $this->db->update('item_kits',$item_kit_data); - } - - /* - Deletes one item kit - */ - function delete($item_kit_id) - { - return $this->db->delete('item_kits', array('item_kit_id' => $id)); - } - - /* - Deletes a list of item kits - */ - function delete_list($item_kit_ids) - { - $this->db->where_in('item_kit_id',$item_kit_ids); - return $this->db->delete('item_kits'); - } - - /* - Get search suggestions to find kits - */ - function get_search_suggestions($search,$limit=25) - { - $suggestions = array(); - - $this->db->from('item_kits'); - $this->db->like('name', $search); - $this->db->order_by("name", "asc"); - $by_name = $this->db->get(); - foreach($by_name->result() as $row) - { - $suggestions[]=$row->name; - } - - //only return $limit suggestions - if(count($suggestions > $limit)) - { - $suggestions = array_slice($suggestions, 0,$limit); - } - return $suggestions; - - } - - function get_item_kit_search_suggestions($search, $limit=25) - { - $suggestions = array(); - - $this->db->from('item_kits'); - $this->db->like('name', $search); - $this->db->order_by("name", "asc"); - $by_name = $this->db->get(); - foreach($by_name->result() as $row) - { - $suggestions[]='KIT '.$row->item_kit_id.'|'.$row->name; - } - - //only return $limit suggestions - if(count($suggestions > $limit)) - { - $suggestions = array_slice($suggestions, 0,$limit); - } - return $suggestions; - - } - - /* - Preform a search on items - */ - function search($search) - { - $this->db->from('item_kits'); - $this->db->where("name LIKE '%".$this->db->escape_like_str($search)."%' or - description LIKE '%".$this->db->escape_like_str($search)."%'"); - $this->db->order_by("name", "asc"); - return $this->db->get(); - } -} -?> \ No newline at end of file diff --git a/application/models/item_kit_items.php b/application/models/item_kit_items.php deleted file mode 100644 index 5f0ca40ca..000000000 --- a/application/models/item_kit_items.php +++ /dev/null @@ -1,43 +0,0 @@ -db->from('item_kit_items'); - $this->db->where('item_kit_id',$item_kit_id); - //return an array of item kit items for an item - return $this->db->get()->result_array(); - } - - /* - Inserts or updates an item kit's items - */ - function save(&$item_kit_items_data, $item_kit_id) - { - //Run these queries as a transaction, we want to make sure we do all or nothing - $this->db->trans_start(); - - $this->delete($item_kit_id); - - foreach ($item_kit_items_data as $row) - { - $row['item_kit_id'] = $item_kit_id; - $this->db->insert('item_kit_items',$row); - } - - $this->db->trans_complete(); - return true; - } - - /* - Deletes item kit items given an item kit - */ - function delete($item_kit_id) - { - return $this->db->delete('item_kit_items', array('item_kit_id' => $item_kit_id)); - } -} -?> diff --git a/application/models/item_taxes.php b/application/models/item_taxes.php deleted file mode 100644 index bced72aa7..000000000 --- a/application/models/item_taxes.php +++ /dev/null @@ -1,51 +0,0 @@ -db->from('items_taxes'); - $this->db->where('item_id',$item_id); - //return an array of taxes for an item - return $this->db->get()->result_array(); - } - - /* - Inserts or updates an item's taxes - */ - function save(&$items_taxes_data, $item_id) - { - //Run these queries as a transaction, we want to make sure we do all or nothing - $this->db->trans_start(); - - $this->delete($item_id); - - foreach ($items_taxes_data as $row) - { - $row['item_id'] = $item_id; - $this->db->insert('items_taxes',$row); - } - - $this->db->trans_complete(); - return true; - } - - function save_multiple(&$items_taxes_data, $item_ids) - { - foreach($item_ids as $item_id) - { - $this->save($items_taxes_data, $item_id); - } - } - - /* - Deletes taxes given an item - */ - function delete($item_id) - { - return $this->db->delete('items_taxes', array('item_id' => $item_id)); - } -} -?> diff --git a/application/models/module.php b/application/models/module.php deleted file mode 100644 index 9790f4723..000000000 --- a/application/models/module.php +++ /dev/null @@ -1,50 +0,0 @@ -db->get_where('modules', array('module_id' => $module_id), 1); - - if ($query->num_rows() ==1) - { - $row = $query->row(); - return $this->lang->line($row->name_lang_key); - } - - return $this->lang->line('error_unknown'); - } - - function get_module_desc($module_id) - { - $query = $this->db->get_where('modules', array('module_id' => $module_id), 1); - if ($query->num_rows() ==1) - { - $row = $query->row(); - return $this->lang->line($row->desc_lang_key); - } - - return $this->lang->line('error_unknown'); - } - - function get_all_modules() - { - $this->db->from('modules'); - $this->db->order_by("sort", "asc"); - return $this->db->get(); - } - - function get_allowed_modules($person_id) - { - $this->db->from('modules'); - $this->db->join('permissions','permissions.module_id=modules.module_id'); - $this->db->where("permissions.person_id",$person_id); - $this->db->order_by("sort", "asc"); - return $this->db->get(); - } -} -?> diff --git a/application/models/person.php b/application/models/person.php deleted file mode 100644 index 99c0a3af5..000000000 --- a/application/models/person.php +++ /dev/null @@ -1,105 +0,0 @@ -db->from('people'); - $this->db->where('people.person_id',$person_id); - $query = $this->db->get(); - - return ($query->num_rows()==1); - } - - /*Gets all people*/ - function get_all($limit=10000, $offset=0) - { - $this->db->from('people'); - $this->db->order_by("last_name", "asc"); - $this->db->limit($limit); - $this->db->offset($offset); - return $this->db->get(); - } - - function count_all() - { - $this->db->from('people'); - $this->db->where('deleted',0); - return $this->db->count_all_results(); - } - - /* - Gets information about a person as an array. - */ - function get_info($person_id) - { - $query = $this->db->get_where('people', array('person_id' => $person_id), 1); - - if($query->num_rows()==1) - { - return $query->row(); - } - else - { - //create object with empty properties. - $fields = $this->db->list_fields('people'); - $person_obj = new stdClass; - - foreach ($fields as $field) - { - $person_obj->$field=''; - } - - return $person_obj; - } - } - - /* - Get people with specific ids - */ - function get_multiple_info($person_ids) - { - $this->db->from('people'); - $this->db->where_in('person_id',$person_ids); - $this->db->order_by("last_name", "asc"); - return $this->db->get(); - } - - /* - Inserts or updates a person - */ - function save(&$person_data,$person_id=false) - { - if (!$person_id or !$this->exists($person_id)) - { - if ($this->db->insert('people',$person_data)) - { - $person_data['person_id']=$this->db->insert_id(); - return true; - } - - return false; - } - - $this->db->where('person_id', $person_id); - return $this->db->update('people',$person_data); - } - - /* - Deletes one Person (doesn't actually do anything) - */ - function delete($person_id) - { - return true;; - } - - /* - Deletes a list of people (doesn't actually do anything) - */ - function delete_list($person_ids) - { - return true; - } - -} -?> diff --git a/application/models/receiving.php b/application/models/receiving.php deleted file mode 100644 index 615b05103..000000000 --- a/application/models/receiving.php +++ /dev/null @@ -1,118 +0,0 @@ -db->from('receivings'); - $this->db->where('receiving_id',$receiving_id); - return $this->db->get(); - } - - function exists($receiving_id) - { - $this->db->from('receivings'); - $this->db->where('receiving_id',$receiving_id); - $query = $this->db->get(); - - return ($query->num_rows()==1); - } - - function save ($items,$supplier_id,$employee_id,$comment,$payment_type,$receiving_id=false) - { - if(count($items)==0) - return -1; - - $receivings_data = array( - 'supplier_id'=> $this->Supplier->exists($supplier_id) ? $supplier_id : null, - 'employee_id'=>$employee_id, - 'payment_type'=>$payment_type, - 'comment'=>$comment - ); - - //Run these queries as a transaction, we want to make sure we do all or nothing - $this->db->trans_start(); - - $this->db->insert('receivings',$receivings_data); - $receiving_id = $this->db->insert_id(); - - - foreach($items as $line=>$item) - { - $cur_item_info = $this->Item->get_info($item['item_id']); - - $receivings_items_data = array - ( - 'receiving_id'=>$receiving_id, - 'item_id'=>$item['item_id'], - 'line'=>$item['line'], - 'description'=>$item['description'], - 'serialnumber'=>$item['serialnumber'], - 'quantity_purchased'=>$item['quantity'], - 'discount_percent'=>$item['discount'], - 'item_cost_price' => $cur_item_info->cost_price, - 'item_unit_price'=>$item['price'] - ); - - $this->db->insert('receivings_items',$receivings_items_data); - - //Update stock quantity - $item_data = array('quantity'=>$cur_item_info->quantity + $item['quantity']); - $this->Item->save($item_data,$item['item_id']); - - $qty_recv = $item['quantity']; - $recv_remarks ='RECV '.$receiving_id; - $inv_data = array - ( - 'trans_date'=>date('Y-m-d H:i:s'), - 'trans_items'=>$item['item_id'], - 'trans_user'=>$employee_id, - 'trans_comment'=>$recv_remarks, - 'trans_inventory'=>$qty_recv - ); - $this->Inventory->insert($inv_data); - - $supplier = $this->Supplier->get_info($supplier_id); - } - $this->db->trans_complete(); - - if ($this->db->trans_status() === FALSE) - { - return -1; - } - - return $receiving_id; - } - - function get_receiving_items($receiving_id) - { - $this->db->from('receivings_items'); - $this->db->where('receiving_id',$receiving_id); - return $this->db->get(); - } - - function get_supplier($receiving_id) - { - $this->db->from('receivings'); - $this->db->where('receiving_id',$receiving_id); - return $this->Supplier->get_info($this->db->get()->row()->supplier_id); - } - - //We create a temp table that allows us to do easy report/receiving queries - public function create_receivings_items_temp_table() - { - $this->db->query("CREATE TEMPORARY TABLE ".$this->db->dbprefix('receivings_items_temp')." - (SELECT date(receiving_time) as receiving_date, ".$this->db->dbprefix('receivings_items').".receiving_id, comment,payment_type, employee_id, - ".$this->db->dbprefix('items').".item_id, ".$this->db->dbprefix('receivings').".supplier_id, quantity_purchased, item_cost_price, item_unit_price, - discount_percent, (item_unit_price*quantity_purchased-item_unit_price*quantity_purchased*discount_percent/100) as subtotal, - ".$this->db->dbprefix('receivings_items').".line as line, serialnumber, ".$this->db->dbprefix('receivings_items').".description as description, - ROUND((item_unit_price*quantity_purchased-item_unit_price*quantity_purchased*discount_percent/100),2) as total, - (item_unit_price*quantity_purchased-item_unit_price*quantity_purchased*discount_percent/100) - (item_cost_price*quantity_purchased) as profit - FROM ".$this->db->dbprefix('receivings_items')." - INNER JOIN ".$this->db->dbprefix('receivings')." ON ".$this->db->dbprefix('receivings_items').'.receiving_id='.$this->db->dbprefix('receivings').'.receiving_id'." - INNER JOIN ".$this->db->dbprefix('items')." ON ".$this->db->dbprefix('receivings_items').'.item_id='.$this->db->dbprefix('items').'.item_id'." - GROUP BY receiving_id, item_id, line)"); - } - - -} -?> diff --git a/application/models/reports/detailed_receivings.php b/application/models/reports/detailed_receivings.php deleted file mode 100644 index 0af71d504..000000000 --- a/application/models/reports/detailed_receivings.php +++ /dev/null @@ -1,67 +0,0 @@ - array($this->lang->line('reports_receiving_id'), $this->lang->line('reports_date'), $this->lang->line('reports_items_received'), $this->lang->line('reports_received_by'), $this->lang->line('reports_supplied_by'), $this->lang->line('reports_total'), $this->lang->line('reports_payment_type'), $this->lang->line('reports_comments')), - 'details' => array($this->lang->line('reports_name'), $this->lang->line('reports_category'), $this->lang->line('reports_quantity_purchased'), $this->lang->line('reports_total'), $this->lang->line('reports_discount')) - ); - } - - public function getData(array $inputs) - { - $this->db->select('receiving_id, receiving_date, sum(quantity_purchased) as items_purchased, CONCAT(employee.first_name," ",employee.last_name) as employee_name, CONCAT(supplier.first_name," ",supplier.last_name) as supplier_name, sum(total) as total, sum(profit) as profit, payment_type, comment', false); - $this->db->from('receivings_items_temp'); - $this->db->join('people as employee', 'receivings_items_temp.employee_id = employee.person_id'); - $this->db->join('people as supplier', 'receivings_items_temp.supplier_id = supplier.person_id', 'left'); - $this->db->where('receiving_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - $this->db->group_by('receiving_id'); - $this->db->order_by('receiving_date'); - - $data = array(); - $data['summary'] = $this->db->get()->result_array(); - $data['details'] = array(); - - foreach($data['summary'] as $key=>$value) - { - $this->db->select('name, category, quantity_purchased, serialnumber,total, discount_percent'); - $this->db->from('receivings_items_temp'); - $this->db->join('items', 'receivings_items_temp.item_id = items.item_id'); - $this->db->where('receiving_id = '.$value['receiving_id']); - $data['details'][$key] = $this->db->get()->result_array(); - } - - return $data; - } - - public function getSummaryData(array $inputs) - { - $this->db->select('sum(total) as total'); - $this->db->from('receivings_items_temp'); - $this->db->where('receiving_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - return $this->db->get()->row_array(); - } -} -?> \ No newline at end of file diff --git a/application/models/reports/detailed_sales.php b/application/models/reports/detailed_sales.php deleted file mode 100644 index a1776c8fa..000000000 --- a/application/models/reports/detailed_sales.php +++ /dev/null @@ -1,68 +0,0 @@ - array($this->lang->line('reports_sale_id'), $this->lang->line('reports_date'), $this->lang->line('reports_items_purchased'), $this->lang->line('reports_sold_by'), $this->lang->line('reports_sold_to'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_profit'), $this->lang->line('reports_payment_type'), $this->lang->line('reports_comments')), - 'details' => array($this->lang->line('reports_name'), $this->lang->line('reports_category'), $this->lang->line('reports_serial_number'), $this->lang->line('reports_description'), $this->lang->line('reports_quantity_purchased'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_profit'),$this->lang->line('reports_discount')) - ); - } - - public function getData(array $inputs) - { - $this->db->select('sale_id, sale_date, sum(quantity_purchased) as items_purchased, CONCAT(employee.first_name," ",employee.last_name) as employee_name, CONCAT(customer.first_name," ",customer.last_name) as customer_name, sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit, payment_type, comment', false); - $this->db->from('sales_items_temp'); - $this->db->join('people as employee', 'sales_items_temp.employee_id = employee.person_id'); - $this->db->join('people as customer', 'sales_items_temp.customer_id = customer.person_id', 'left'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - $this->db->group_by('sale_id'); - $this->db->order_by('sale_date'); - - $data = array(); - $data['summary'] = $this->db->get()->result_array(); - $data['details'] = array(); - - foreach($data['summary'] as $key=>$value) - { - $this->db->select('name, category, quantity_purchased, serialnumber, sales_items_temp.description, subtotal,total, tax, profit, discount_percent'); - $this->db->from('sales_items_temp'); - $this->db->join('items', 'sales_items_temp.item_id = items.item_id'); - $this->db->where('sale_id = '.$value['sale_id']); - $data['details'][$key] = $this->db->get()->result_array(); - } - - return $data; - } - - public function getSummaryData(array $inputs) - { - $this->db->select('sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit'); - $this->db->from('sales_items_temp'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - - return $this->db->get()->row_array(); - } -} -?> \ No newline at end of file diff --git a/application/models/reports/inventory_low.php b/application/models/reports/inventory_low.php deleted file mode 100644 index 98652e6a7..000000000 --- a/application/models/reports/inventory_low.php +++ /dev/null @@ -1,31 +0,0 @@ -lang->line('reports_item_name'), $this->lang->line('reports_item_number'), $this->lang->line('reports_description'), $this->lang->line('reports_count'), $this->lang->line('reports_reorder_level')); - } - - public function getData(array $inputs) - { - $this->db->select('name, item_number, quantity, reorder_level, description'); - $this->db->from('items'); - $this->db->where('quantity <= reorder_level and deleted=0'); - $this->db->order_by('name'); - - return $this->db->get()->result_array(); - - } - - public function getSummaryData(array $inputs) - { - return array(); - } -} -?> \ No newline at end of file diff --git a/application/models/reports/inventory_summary.php b/application/models/reports/inventory_summary.php deleted file mode 100644 index a6130f891..000000000 --- a/application/models/reports/inventory_summary.php +++ /dev/null @@ -1,31 +0,0 @@ -lang->line('reports_item_name'), $this->lang->line('reports_item_number'), $this->lang->line('reports_description'), $this->lang->line('reports_count'), $this->lang->line('reports_reorder_level')); - } - - public function getData(array $inputs) - { - $this->db->select('name, item_number, quantity, reorder_level, description'); - $this->db->from('items'); - $this->db->where('deleted', 0); - $this->db->order_by('name'); - - return $this->db->get()->result_array(); - - } - - public function getSummaryData(array $inputs) - { - return array(); - } -} -?> \ No newline at end of file diff --git a/application/models/reports/report.php b/application/models/reports/report.php deleted file mode 100644 index 20abe2777..000000000 --- a/application/models/reports/report.php +++ /dev/null @@ -1,28 +0,0 @@ -output->set_header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); - $this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate"); - $this->output->set_header("Cache-Control: post-check=0, pre-check=0", false); - $this->output->set_header("Pragma: no-cache"); - - //Create our temp tables to work with the data in our report - $this->Sale->create_sales_items_temp_table(); - $this->Receiving->create_receivings_items_temp_table(); - } - - //Returns the column names used for the report - public abstract function getDataColumns(); - - //Returns all the data to be populated into the report - public abstract function getData(array $inputs); - - //Returns key=>value pairing of summary data for the report - public abstract function getSummaryData(array $inputs); -} -?> \ No newline at end of file diff --git a/application/models/reports/specific_customer.php b/application/models/reports/specific_customer.php deleted file mode 100644 index 0b2f8c342..000000000 --- a/application/models/reports/specific_customer.php +++ /dev/null @@ -1,66 +0,0 @@ - array($this->lang->line('reports_sale_id'), $this->lang->line('reports_date'), $this->lang->line('reports_items_purchased'), $this->lang->line('reports_sold_by'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_profit'), $this->lang->line('reports_payment_type'), $this->lang->line('reports_comments')), - 'details' => array($this->lang->line('reports_name'), $this->lang->line('reports_category'),$this->lang->line('reports_serial_number'), $this->lang->line('reports_description'), $this->lang->line('reports_quantity_purchased'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_profit'),$this->lang->line('reports_discount')) - ); - } - - public function getData(array $inputs) - { - $this->db->select('sale_id, sale_date, sum(quantity_purchased) as items_purchased, CONCAT(first_name," ",last_name) as employee_name, sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit, payment_type, comment', false); - $this->db->from('sales_items_temp'); - $this->db->join('people', 'sales_items_temp.employee_id = people.person_id'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'" and customer_id='.$inputs['customer_id']); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - $this->db->group_by('sale_id'); - $this->db->order_by('sale_date'); - - $data = array(); - $data['summary'] = $this->db->get()->result_array(); - $data['details'] = array(); - - foreach($data['summary'] as $key=>$value) - { - $this->db->select('name, category, serialnumber, sales_items_temp.description, quantity_purchased, subtotal,total, tax, profit, discount_percent'); - $this->db->from('sales_items_temp'); - $this->db->join('items', 'sales_items_temp.item_id = items.item_id'); - $this->db->where('sale_id = '.$value['sale_id']); - $data['details'][$key] = $this->db->get()->result_array(); - } - - return $data; - } - - public function getSummaryData(array $inputs) - { - $this->db->select('sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit'); - $this->db->from('sales_items_temp'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'" and customer_id='.$inputs['customer_id']); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - return $this->db->get()->row_array(); - } -} -?> \ No newline at end of file diff --git a/application/models/reports/specific_employee.php b/application/models/reports/specific_employee.php deleted file mode 100644 index 39fff80f9..000000000 --- a/application/models/reports/specific_employee.php +++ /dev/null @@ -1,68 +0,0 @@ - array($this->lang->line('reports_sale_id'), $this->lang->line('reports_date'), $this->lang->line('reports_items_purchased'), $this->lang->line('reports_sold_to'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_profit'), $this->lang->line('reports_payment_type'), $this->lang->line('reports_comments')), - 'details' => array($this->lang->line('reports_name'), $this->lang->line('reports_category'), $this->lang->line('reports_serial_number'), $this->lang->line('reports_description'), $this->lang->line('reports_quantity_purchased'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_profit'),$this->lang->line('reports_discount')) - ); - } - - public function getData(array $inputs) - { - $this->db->select('sale_id, sale_date, sum(quantity_purchased) as items_purchased, CONCAT(first_name," ",last_name) as customer_name, sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit, payment_type, comment', false); - $this->db->from('sales_items_temp'); - $this->db->join('people', 'sales_items_temp.customer_id = people.person_id', 'left'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'" and employee_id='.$inputs['employee_id']); - - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - - $this->db->group_by('sale_id'); - $this->db->order_by('sale_date'); - - $data = array(); - $data['summary'] = $this->db->get()->result_array(); - $data['details'] = array(); - - foreach($data['summary'] as $key=>$value) - { - $this->db->select('name, category, serialnumber, sales_items_temp.description, quantity_purchased, subtotal,total, tax, profit, discount_percent'); - $this->db->from('sales_items_temp'); - $this->db->join('items', 'sales_items_temp.item_id = items.item_id'); - $this->db->where('sale_id = '.$value['sale_id']); - $data['details'][$key] = $this->db->get()->result_array(); - } - - return $data; - } - - public function getSummaryData(array $inputs) - { - $this->db->select('sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit'); - $this->db->from('sales_items_temp'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'" and employee_id='.$inputs['employee_id']); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - return $this->db->get()->row_array(); - } -} -?> \ No newline at end of file diff --git a/application/models/reports/summary_categories.php b/application/models/reports/summary_categories.php deleted file mode 100644 index 27c30ae46..000000000 --- a/application/models/reports/summary_categories.php +++ /dev/null @@ -1,53 +0,0 @@ -lang->line('reports_category'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_profit')); - } - - public function getData(array $inputs) - { - $this->db->select('category, sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit'); - $this->db->from('sales_items_temp'); - $this->db->join('items', 'sales_items_temp.item_id = items.item_id'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - $this->db->group_by('category'); - $this->db->order_by('category'); - - return $this->db->get()->result_array(); - } - - public function getSummaryData(array $inputs) - { - $this->db->select('sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit'); - $this->db->from('sales_items_temp'); - $this->db->join('items', 'sales_items_temp.item_id = items.item_id'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - - return $this->db->get()->row_array(); - } -} -?> \ No newline at end of file diff --git a/application/models/reports/summary_customers.php b/application/models/reports/summary_customers.php deleted file mode 100644 index 1f8fa6aea..000000000 --- a/application/models/reports/summary_customers.php +++ /dev/null @@ -1,54 +0,0 @@ -lang->line('reports_customer'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_profit')); - } - - public function getData(array $inputs) - { - $this->db->select('CONCAT(first_name, " ",last_name) as customer, sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax,sum(profit) as profit', false); - $this->db->from('sales_items_temp'); - $this->db->join('customers', 'customers.person_id = sales_items_temp.customer_id'); - $this->db->join('people', 'customers.person_id = people.person_id'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - $this->db->group_by('customer_id'); - $this->db->order_by('last_name'); - - return $this->db->get()->result_array(); - } - - public function getSummaryData(array $inputs) - { - $this->db->select('sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit'); - $this->db->from('sales_items_temp'); - $this->db->join('customers', 'customers.person_id = sales_items_temp.customer_id'); - $this->db->join('people', 'customers.person_id = people.person_id'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - return $this->db->get()->row_array(); - } -} -?> \ No newline at end of file diff --git a/application/models/reports/summary_discounts.php b/application/models/reports/summary_discounts.php deleted file mode 100644 index 6b3949eb0..000000000 --- a/application/models/reports/summary_discounts.php +++ /dev/null @@ -1,49 +0,0 @@ -lang->line('reports_discount_percent'),$this->lang->line('reports_count')); - } - - public function getData(array $inputs) - { - $this->db->select('CONCAT(discount_percent, "%") as discount_percent, count(*) as count', false); - $this->db->from('sales_items_temp'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'" and discount_percent > 0'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - $this->db->group_by('sales_items_temp.discount_percent'); - $this->db->order_by('discount_percent'); - return $this->db->get()->result_array(); - } - - public function getSummaryData(array $inputs) - { - $this->db->select('sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax,sum(profit) as profit'); - $this->db->from('sales_items_temp'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - return $this->db->get()->row_array(); - } -} -?> \ No newline at end of file diff --git a/application/models/reports/summary_employees.php b/application/models/reports/summary_employees.php deleted file mode 100644 index 5308e8e95..000000000 --- a/application/models/reports/summary_employees.php +++ /dev/null @@ -1,55 +0,0 @@ -lang->line('reports_employee'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_profit')); - } - - public function getData(array $inputs) - { - $this->db->select('CONCAT(first_name, " ",last_name) as employee, sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit', false); - $this->db->from('sales_items_temp'); - $this->db->join('employees', 'employees.person_id = sales_items_temp.employee_id'); - $this->db->join('people', 'employees.person_id = people.person_id'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - $this->db->group_by('employee_id'); - $this->db->order_by('last_name'); - - return $this->db->get()->result_array(); - } - - public function getSummaryData(array $inputs) - { - $this->db->select('sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit'); - $this->db->from('sales_items_temp'); - $this->db->join('employees', 'employees.person_id = sales_items_temp.employee_id'); - $this->db->join('people', 'employees.person_id = people.person_id'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - - return $this->db->get()->row_array(); - } -} -?> \ No newline at end of file diff --git a/application/models/reports/summary_items.php b/application/models/reports/summary_items.php deleted file mode 100644 index 8aefb5475..000000000 --- a/application/models/reports/summary_items.php +++ /dev/null @@ -1,52 +0,0 @@ -lang->line('reports_item'),$this->lang->line('reports_quantity_purchased'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'),$this->lang->line('reports_profit')); - } - - public function getData(array $inputs) - { - $this->db->select('name, sum(quantity_purchased) as quantity_purchased, sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit'); - $this->db->from('sales_items_temp'); - $this->db->join('items', 'sales_items_temp.item_id = items.item_id'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - $this->db->group_by('items.item_id'); - $this->db->order_by('name'); - - return $this->db->get()->result_array(); - } - - public function getSummaryData(array $inputs) - { - $this->db->select('sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit'); - $this->db->from('sales_items_temp'); - $this->db->join('items', 'sales_items_temp.item_id = items.item_id'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - return $this->db->get()->row_array(); - } -} -?> \ No newline at end of file diff --git a/application/models/reports/summary_payments.php b/application/models/reports/summary_payments.php deleted file mode 100644 index 2c95ac69c..000000000 --- a/application/models/reports/summary_payments.php +++ /dev/null @@ -1,50 +0,0 @@ -lang->line('reports_payment_type'), $this->lang->line('reports_total')); - } - - public function getData(array $inputs) - { - $this->db->select('sales_payments.payment_type, SUM(payment_amount) as payment_amount', false); - $this->db->from('sales_payments'); - $this->db->join('sales', 'sales.sale_id=sales_payments.sale_id'); - $this->db->where('date(sale_time) BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('payment_amount > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('payment_amount < 0'); - } - $this->db->group_by("payment_type"); - return $this->db->get()->result_array(); - } - - public function getSummaryData(array $inputs) - { - $this->db->select('sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit'); - $this->db->from('sales_items_temp'); - $this->db->join('items', 'sales_items_temp.item_id = items.item_id'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - return $this->db->get()->row_array(); - } -} -?> \ No newline at end of file diff --git a/application/models/reports/summary_sales.php b/application/models/reports/summary_sales.php deleted file mode 100644 index e7914a9ee..000000000 --- a/application/models/reports/summary_sales.php +++ /dev/null @@ -1,51 +0,0 @@ -lang->line('reports_date'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_profit')); - } - - public function getData(array $inputs) - { - $this->db->select('sale_date, sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax,sum(profit) as profit'); - $this->db->from('sales_items_temp'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - - $this->db->group_by('sale_date'); - $this->db->having('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - $this->db->order_by('sale_date'); - return $this->db->get()->result_array(); - } - - public function getSummaryData(array $inputs) - { - $this->db->select('sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax,sum(profit) as profit'); - $this->db->from('sales_items_temp'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - return $this->db->get()->row_array(); - } - -} -?> \ No newline at end of file diff --git a/application/models/reports/summary_suppliers.php b/application/models/reports/summary_suppliers.php deleted file mode 100644 index 98566c343..000000000 --- a/application/models/reports/summary_suppliers.php +++ /dev/null @@ -1,55 +0,0 @@ -lang->line('reports_supplier'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_profit')); - } - - public function getData(array $inputs) - { - $this->db->select('CONCAT(first_name, " ",last_name) as supplier, sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax,sum(profit) as profit', false); - $this->db->from('sales_items_temp'); - $this->db->join('suppliers', 'suppliers.person_id = sales_items_temp.supplier_id'); - $this->db->join('people', 'suppliers.person_id = people.person_id'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - $this->db->group_by('supplier_id'); - $this->db->order_by('last_name'); - - return $this->db->get()->result_array(); - } - - public function getSummaryData(array $inputs) - { - $this->db->select('sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit'); - $this->db->from('sales_items_temp'); - $this->db->join('suppliers', 'suppliers.person_id = sales_items_temp.supplier_id'); - $this->db->join('people', 'suppliers.person_id = people.person_id'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - - return $this->db->get()->row_array(); - } -} -?> \ No newline at end of file diff --git a/application/models/reports/summary_taxes.php b/application/models/reports/summary_taxes.php deleted file mode 100644 index 824a72749..000000000 --- a/application/models/reports/summary_taxes.php +++ /dev/null @@ -1,66 +0,0 @@ -lang->line('reports_tax_percent'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax')); - } - - public function getData(array $inputs) - { - - $quanitity_cond = ''; - if ($inputs['sale_type'] == 'sales') - { - $quanitity_cond = 'and quantity_purchased > 0'; - } - elseif ($inputs['sale_type'] == 'returns') - { - $quanitity_cond = 'and quantity_purchased < 0'; - } - - $query = $this->db->query("SELECT percent, SUM(subtotal) as subtotal, sum(total) as total, sum(tax) as tax - FROM (SELECT name, CONCAT( percent, '%' ) AS percent, ( - item_unit_price * quantity_purchased - item_unit_price * quantity_purchased * discount_percent /100 - ) AS subtotal, ROUND( ( - item_unit_price * quantity_purchased - item_unit_price * quantity_purchased * discount_percent /100 - ) * ( 1 + ( percent /100 ) ) , 2 ) AS total, ROUND( ( - item_unit_price * quantity_purchased - item_unit_price * quantity_purchased * discount_percent /100 - ) * ( percent /100 ) , 2 ) AS tax - FROM ".$this->db->dbprefix('sales_items_taxes')." - JOIN ".$this->db->dbprefix('sales_items')." ON " - .$this->db->dbprefix('sales_items').'.sale_id='.$this->db->dbprefix('sales_items_taxes').'.sale_id'." and " - .$this->db->dbprefix('sales_items').'.item_id='.$this->db->dbprefix('sales_items_taxes').'.item_id'." and " - .$this->db->dbprefix('sales_items').'.line='.$this->db->dbprefix('sales_items_taxes').'.line' - ." JOIN ".$this->db->dbprefix('sales')." ON ".$this->db->dbprefix('sales_items_taxes').".sale_id=".$this->db->dbprefix('sales').".sale_id - WHERE date(sale_time) BETWEEN '".$inputs['start_date']."' and '".$inputs['end_date']."' $quanitity_cond) as temp_taxes - GROUP BY percent"); - return $query->result_array(); - } - - public function getSummaryData(array $inputs) - { - $this->db->select('sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit'); - $this->db->from('sales_items_temp'); - $this->db->join('items', 'sales_items_temp.item_id = items.item_id'); - $this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"'); - - if ($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif ($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } - - return $this->db->get()->row_array(); - } -} -?> \ No newline at end of file diff --git a/application/models/sale.php b/application/models/sale.php deleted file mode 100644 index 5e8ab9564..000000000 --- a/application/models/sale.php +++ /dev/null @@ -1,216 +0,0 @@ -db->from('sales'); - $this->db->where('sale_id',$sale_id); - return $this->db->get(); - } - - function exists($sale_id) - { - $this->db->from('sales'); - $this->db->where('sale_id',$sale_id); - $query = $this->db->get(); - - return ($query->num_rows()==1); - } - - function update($sale_data, $sale_id) - { - $this->db->where('sale_id', $sale_id); - $success = $this->db->update('sales',$sale_data); - - return $success; - } - - function save ($items,$customer_id,$employee_id,$comment,$payments,$sale_id=false) - { - if(count($items)==0) - return -1; - - //Alain Multiple payments - //Build payment types string - $payment_types=''; - foreach($payments as $payment_id=>$payment) - { - $payment_types=$payment_types.$payment['payment_type'].': '.to_currency($payment['payment_amount']).'
'; - } - - $sales_data = array( - 'sale_time' => date('Y-m-d H:i:s'), - 'customer_id'=> $this->Customer->exists($customer_id) ? $customer_id : null, - 'employee_id'=>$employee_id, - 'payment_type'=>$payment_types, - 'comment'=>$comment - ); - - //Run these queries as a transaction, we want to make sure we do all or nothing - $this->db->trans_start(); - - $this->db->insert('sales',$sales_data); - $sale_id = $this->db->insert_id(); - - foreach($payments as $payment_id=>$payment) - { - if ( substr( $payment['payment_type'], 0, strlen( $this->lang->line('sales_giftcard') ) ) == $this->lang->line('sales_giftcard') ) - { - /* We have a gift card and we have to deduct the used value from the total value of the card. */ - $splitpayment = explode( ':', $payment['payment_type'] ); - $cur_giftcard_value = $this->Giftcard->get_giftcard_value( $splitpayment[1] ); - $this->Giftcard->update_giftcard_value( $splitpayment[1], $cur_giftcard_value - $payment['payment_amount'] ); - } - - $sales_payments_data = array - ( - 'sale_id'=>$sale_id, - 'payment_type'=>$payment['payment_type'], - 'payment_amount'=>$payment['payment_amount'] - ); - $this->db->insert('sales_payments',$sales_payments_data); - } - - foreach($items as $line=>$item) - { - $cur_item_info = $this->Item->get_info($item['item_id']); - - $sales_items_data = array - ( - 'sale_id'=>$sale_id, - 'item_id'=>$item['item_id'], - 'line'=>$item['line'], - 'description'=>$item['description'], - 'serialnumber'=>$item['serialnumber'], - 'quantity_purchased'=>$item['quantity'], - 'discount_percent'=>$item['discount'], - 'item_cost_price' => $cur_item_info->cost_price, - 'item_unit_price'=>$item['price'] - ); - - $this->db->insert('sales_items',$sales_items_data); - - //Update stock quantity - $item_data = array('quantity'=>$cur_item_info->quantity - $item['quantity']); - $this->Item->save($item_data,$item['item_id']); - - //Ramel Inventory Tracking - //Inventory Count Details - $qty_buy = -$item['quantity']; - $sale_remarks ='POS '.$sale_id; - $inv_data = array - ( - 'trans_date'=>date('Y-m-d H:i:s'), - 'trans_items'=>$item['item_id'], - 'trans_user'=>$employee_id, - 'trans_comment'=>$sale_remarks, - 'trans_inventory'=>$qty_buy - ); - $this->Inventory->insert($inv_data); - //------------------------------------Ramel - - $customer = $this->Customer->get_info($customer_id); - if ($customer_id == -1 or $customer->taxable) - { - foreach($this->Item_taxes->get_info($item['item_id']) as $row) - { - $this->db->insert('sales_items_taxes', array( - 'sale_id' =>$sale_id, - 'item_id' =>$item['item_id'], - 'line' =>$item['line'], - 'name' =>$row['name'], - 'percent' =>$row['percent'] - )); - } - } - } - $this->db->trans_complete(); - - if ($this->db->trans_status() === FALSE) - { - return -1; - } - - return $sale_id; - } - - function delete($sale_id) - { - //Run these queries as a transaction, we want to make sure we do all or nothing - $this->db->trans_start(); - - $this->db->delete('sales_payments', array('sale_id' => $sale_id)); - $this->db->delete('sales_items_taxes', array('sale_id' => $sale_id)); - $this->db->delete('sales_items', array('sale_id' => $sale_id)); - $this->db->delete('sales', array('sale_id' => $sale_id)); - - $this->db->trans_complete(); - - return $this->db->trans_status(); - } - - function get_sale_items($sale_id) - { - $this->db->from('sales_items'); - $this->db->where('sale_id',$sale_id); - return $this->db->get(); - } - - function get_sale_payments($sale_id) - { - $this->db->from('sales_payments'); - $this->db->where('sale_id',$sale_id); - return $this->db->get(); - } - - function get_customer($sale_id) - { - $this->db->from('sales'); - $this->db->where('sale_id',$sale_id); - return $this->Customer->get_info($this->db->get()->row()->customer_id); - } - - //We create a temp table that allows us to do easy report/sales queries - public function create_sales_items_temp_table() - { - $this->db->query("CREATE TEMPORARY TABLE ".$this->db->dbprefix('sales_items_temp')." - (SELECT date(sale_time) as sale_date, ".$this->db->dbprefix('sales_items').".sale_id, comment,payment_type, customer_id, employee_id, - ".$this->db->dbprefix('items').".item_id, supplier_id, quantity_purchased, item_cost_price, item_unit_price, SUM(percent) as item_tax_percent, - discount_percent, (item_unit_price*quantity_purchased-item_unit_price*quantity_purchased*discount_percent/100) as subtotal, - ".$this->db->dbprefix('sales_items').".line as line, serialnumber, ".$this->db->dbprefix('sales_items').".description as description, - ROUND((item_unit_price*quantity_purchased-item_unit_price*quantity_purchased*discount_percent/100)*(1+(SUM(percent)/100)),2) as total, - ROUND((item_unit_price*quantity_purchased-item_unit_price*quantity_purchased*discount_percent/100)*(SUM(percent)/100),2) as tax, - (item_unit_price*quantity_purchased-item_unit_price*quantity_purchased*discount_percent/100) - (item_cost_price*quantity_purchased) as profit - FROM ".$this->db->dbprefix('sales_items')." - INNER JOIN ".$this->db->dbprefix('sales')." ON ".$this->db->dbprefix('sales_items').'.sale_id='.$this->db->dbprefix('sales').'.sale_id'." - INNER JOIN ".$this->db->dbprefix('items')." ON ".$this->db->dbprefix('sales_items').'.item_id='.$this->db->dbprefix('items').'.item_id'." - LEFT OUTER JOIN ".$this->db->dbprefix('suppliers')." ON ".$this->db->dbprefix('items').'.supplier_id='.$this->db->dbprefix('suppliers').'.person_id'." - LEFT OUTER JOIN ".$this->db->dbprefix('sales_items_taxes')." ON " - .$this->db->dbprefix('sales_items').'.sale_id='.$this->db->dbprefix('sales_items_taxes').'.sale_id'." and " - .$this->db->dbprefix('sales_items').'.item_id='.$this->db->dbprefix('sales_items_taxes').'.item_id'." and " - .$this->db->dbprefix('sales_items').'.line='.$this->db->dbprefix('sales_items_taxes').'.line'." - GROUP BY sale_id, item_id, line)"); - - //Update null item_tax_percents to be 0 instead of null - $this->db->where('item_tax_percent IS NULL'); - $this->db->update('sales_items_temp', array('item_tax_percent' => 0)); - - //Update null tax to be 0 instead of null - $this->db->where('tax IS NULL'); - $this->db->update('sales_items_temp', array('tax' => 0)); - - //Update null subtotals to be equal to the total as these don't have tax - $this->db->query('UPDATE '.$this->db->dbprefix('sales_items_temp'). ' SET total=subtotal WHERE total IS NULL'); - } - - public function get_giftcard_value( $giftcardNumber ) - { - if ( !$this->Giftcard->exists( $this->Giftcard->get_giftcard_id($giftcardNumber))) - return 0; - - $this->db->from('giftcards'); - $this->db->where('giftcard_number',$giftcardNumber); - return $this->db->get()->row()->value; - } -} -?> diff --git a/application/models/sale_suspended.php b/application/models/sale_suspended.php deleted file mode 100644 index 5d0abe870..000000000 --- a/application/models/sale_suspended.php +++ /dev/null @@ -1,160 +0,0 @@ -db->from('sales_suspended'); - $this->db->order_by('sale_id'); - return $this->db->get(); - } - - public function get_info($sale_id) - { - $this->db->from('sales_suspended'); - $this->db->where('sale_id',$sale_id); - return $this->db->get(); - } - - function exists($sale_id) - { - $this->db->from('sales_suspended'); - $this->db->where('sale_id',$sale_id); - $query = $this->db->get(); - - return ($query->num_rows()==1); - } - - function update($sale_data, $sale_id) - { - $this->db->where('sale_id', $sale_id); - $success = $this->db->update('sales_suspended',$sale_data); - - return $success; - } - - function save ($items,$customer_id,$employee_id,$comment,$payments,$sale_id=false) - { - if(count($items)==0) - return -1; - - //Alain Multiple payments - //Build payment types string - $payment_types=''; - foreach($payments as $payment_id=>$payment) - { - $payment_types=$payment_types.$payment['payment_type'].': '.to_currency($payment['payment_amount']).'
'; - } - - $sales_data = array( - 'sale_time' => date('Y-m-d H:i:s'), - 'customer_id'=> $this->Customer->exists($customer_id) ? $customer_id : null, - 'employee_id'=>$employee_id, - 'payment_type'=>$payment_types, - 'comment'=>$comment - ); - - //Run these queries as a transaction, we want to make sure we do all or nothing - $this->db->trans_start(); - - $this->db->insert('sales_suspended',$sales_data); - $sale_id = $this->db->insert_id(); - - foreach($payments as $payment_id=>$payment) - { - $sales_payments_data = array - ( - 'sale_id'=>$sale_id, - 'payment_type'=>$payment['payment_type'], - 'payment_amount'=>$payment['payment_amount'] - ); - $this->db->insert('sales_suspended_payments',$sales_payments_data); - } - - foreach($items as $line=>$item) - { - $cur_item_info = $this->Item->get_info($item['item_id']); - - $sales_items_data = array - ( - 'sale_id'=>$sale_id, - 'item_id'=>$item['item_id'], - 'line'=>$item['line'], - 'description'=>$item['description'], - 'serialnumber'=>$item['serialnumber'], - 'quantity_purchased'=>$item['quantity'], - 'discount_percent'=>$item['discount'], - 'item_cost_price' => $cur_item_info->cost_price, - 'item_unit_price'=>$item['price'] - ); - - $this->db->insert('sales_suspended_items',$sales_items_data); - - $customer = $this->Customer->get_info($customer_id); - if ($customer_id == -1 or $customer->taxable) - { - foreach($this->Item_taxes->get_info($item['item_id']) as $row) - { - $this->db->insert('sales_suspended_items_taxes', array( - 'sale_id' =>$sale_id, - 'item_id' =>$item['item_id'], - 'line' =>$item['line'], - 'name' =>$row['name'], - 'percent' =>$row['percent'] - )); - } - } - } - $this->db->trans_complete(); - - if ($this->db->trans_status() === FALSE) - { - return -1; - } - - return $sale_id; - } - - function delete($sale_id) - { - //Run these queries as a transaction, we want to make sure we do all or nothing - $this->db->trans_start(); - - $this->db->delete('sales_suspended_payments', array('sale_id' => $sale_id)); - $this->db->delete('sales_suspended_items_taxes', array('sale_id' => $sale_id)); - $this->db->delete('sales_suspended_items', array('sale_id' => $sale_id)); - $this->db->delete('sales_suspended', array('sale_id' => $sale_id)); - - $this->db->trans_complete(); - - return $this->db->trans_status(); - } - - function get_sale_items($sale_id) - { - $this->db->from('sales_suspended_items'); - $this->db->where('sale_id',$sale_id); - return $this->db->get(); - } - - function get_sale_payments($sale_id) - { - $this->db->from('sales_suspended_payments'); - $this->db->where('sale_id',$sale_id); - return $this->db->get(); - } - - function get_customer($sale_id) - { - $this->db->from('sales_suspended'); - $this->db->where('sale_id',$sale_id); - return $this->Customer->get_info($this->db->get()->row()->customer_id); - } - - function get_comment($sale_id) - { - $this->db->from('sales_suspended'); - $this->db->where('sale_id',$sale_id); - return $this->db->get()->row()->comment; - } -} -?> diff --git a/application/models/supplier.php b/application/models/supplier.php deleted file mode 100644 index f3b356d95..000000000 --- a/application/models/supplier.php +++ /dev/null @@ -1,260 +0,0 @@ -db->from('suppliers'); - $this->db->join('people', 'people.person_id = suppliers.person_id'); - $this->db->where('suppliers.person_id',$person_id); - $query = $this->db->get(); - - return ($query->num_rows()==1); - } - - /* - Returns all the suppliers - */ - function get_all($limit=10000, $offset=0) - { - $this->db->from('suppliers'); - $this->db->join('people','suppliers.person_id=people.person_id'); - $this->db->where('deleted', 0); - $this->db->order_by("last_name", "asc"); - $this->db->limit($limit); - $this->db->offset($offset); - return $this->db->get(); - } - - function count_all() - { - $this->db->from('suppliers'); - $this->db->where('deleted',0); - return $this->db->count_all_results(); - } - - /* - Gets information about a particular supplier - */ - function get_info($supplier_id) - { - $this->db->from('suppliers'); - $this->db->join('people', 'people.person_id = suppliers.person_id'); - $this->db->where('suppliers.person_id',$supplier_id); - $query = $this->db->get(); - - if($query->num_rows()==1) - { - return $query->row(); - } - else - { - //Get empty base parent object, as $supplier_id is NOT an supplier - $person_obj=parent::get_info(-1); - - //Get all the fields from supplier table - $fields = $this->db->list_fields('suppliers'); - - //append those fields to base parent object, we we have a complete empty object - foreach ($fields as $field) - { - $person_obj->$field=''; - } - - return $person_obj; - } - } - - /* - Gets information about multiple suppliers - */ - function get_multiple_info($suppliers_ids) - { - $this->db->from('suppliers'); - $this->db->join('people', 'people.person_id = suppliers.person_id'); - $this->db->where_in('suppliers.person_id',$suppliers_ids); - $this->db->order_by("last_name", "asc"); - return $this->db->get(); - } - - /* - Inserts or updates a suppliers - */ - function save(&$person_data, &$supplier_data,$supplier_id=false) - { - $success=false; - //Run these queries as a transaction, we want to make sure we do all or nothing - $this->db->trans_start(); - - if(parent::save($person_data,$supplier_id)) - { - if (!$supplier_id or !$this->exists($supplier_id)) - { - $supplier_data['person_id'] = $person_data['person_id']; - $success = $this->db->insert('suppliers',$supplier_data); - } - else - { - $this->db->where('person_id', $supplier_id); - $success = $this->db->update('suppliers',$supplier_data); - } - - } - - $this->db->trans_complete(); - return $success; - } - - /* - Deletes one supplier - */ - function delete($supplier_id) - { - $this->db->where('person_id', $supplier_id); - return $this->db->update('suppliers', array('deleted' => 1)); - } - - /* - Deletes a list of suppliers - */ - function delete_list($supplier_ids) - { - $this->db->where_in('person_id',$supplier_ids); - return $this->db->update('suppliers', array('deleted' => 1)); - } - - /* - Get search suggestions to find suppliers - */ - function get_search_suggestions($search,$limit=25) - { - $suggestions = array(); - - $this->db->from('suppliers'); - $this->db->join('people','suppliers.person_id=people.person_id'); - $this->db->where('deleted', 0); - $this->db->like("company_name",$search); - $this->db->order_by("company_name", "asc"); - $by_company_name = $this->db->get(); - foreach($by_company_name->result() as $row) - { - $suggestions[]=$row->company_name; - } - - - $this->db->from('suppliers'); - $this->db->join('people','suppliers.person_id=people.person_id'); - $this->db->where("(first_name LIKE '%".$this->db->escape_like_str($search)."%' or - last_name LIKE '%".$this->db->escape_like_str($search)."%' or - CONCAT(`first_name`,' ',`last_name`) LIKE '%".$this->db->escape_like_str($search)."%') and deleted=0"); - $this->db->order_by("last_name", "asc"); - $by_name = $this->db->get(); - foreach($by_name->result() as $row) - { - $suggestions[]=$row->first_name.' '.$row->last_name; - } - - $this->db->from('suppliers'); - $this->db->join('people','suppliers.person_id=people.person_id'); - $this->db->where('deleted', 0); - $this->db->like("email",$search); - $this->db->order_by("email", "asc"); - $by_email = $this->db->get(); - foreach($by_email->result() as $row) - { - $suggestions[]=$row->email; - } - - $this->db->from('suppliers'); - $this->db->join('people','suppliers.person_id=people.person_id'); - $this->db->where('deleted', 0); - $this->db->like("phone_number",$search); - $this->db->order_by("phone_number", "asc"); - $by_phone = $this->db->get(); - foreach($by_phone->result() as $row) - { - $suggestions[]=$row->phone_number; - } - - $this->db->from('suppliers'); - $this->db->join('people','suppliers.person_id=people.person_id'); - $this->db->where('deleted', 0); - $this->db->like("account_number",$search); - $this->db->order_by("account_number", "asc"); - $by_account_number = $this->db->get(); - foreach($by_account_number->result() as $row) - { - $suggestions[]=$row->account_number; - } - - //only return $limit suggestions - if(count($suggestions > $limit)) - { - $suggestions = array_slice($suggestions, 0,$limit); - } - return $suggestions; - - } - - /* - Get search suggestions to find suppliers - */ - function get_suppliers_search_suggestions($search,$limit=25) - { - $suggestions = array(); - - $this->db->from('suppliers'); - $this->db->join('people','suppliers.person_id=people.person_id'); - $this->db->where('deleted', 0); - $this->db->like("company_name",$search); - $this->db->order_by("company_name", "asc"); - $by_company_name = $this->db->get(); - foreach($by_company_name->result() as $row) - { - $suggestions[]=$row->person_id.'|'.$row->company_name; - } - - - $this->db->from('suppliers'); - $this->db->join('people','suppliers.person_id=people.person_id'); - $this->db->where("(first_name LIKE '%".$this->db->escape_like_str($search)."%' or - last_name LIKE '%".$this->db->escape_like_str($search)."%' or - CONCAT(`first_name`,' ',`last_name`) LIKE '%".$this->db->escape_like_str($search)."%') and deleted=0"); - $this->db->order_by("last_name", "asc"); - $by_name = $this->db->get(); - foreach($by_name->result() as $row) - { - $suggestions[]=$row->person_id.'|'.$row->first_name.' '.$row->last_name; - } - - //only return $limit suggestions - if(count($suggestions > $limit)) - { - $suggestions = array_slice($suggestions, 0,$limit); - } - return $suggestions; - - } - /* - Perform a search on suppliers - */ - function search($search) - { - $this->db->from('suppliers'); - $this->db->join('people','suppliers.person_id=people.person_id'); - $this->db->where("(first_name LIKE '%".$this->db->escape_like_str($search)."%' or - last_name LIKE '%".$this->db->escape_like_str($search)."%' or - company_name LIKE '%".$this->db->escape_like_str($search)."%' or - email LIKE '%".$this->db->escape_like_str($search)."%' or - phone_number LIKE '%".$this->db->escape_like_str($search)."%' or - account_number LIKE '%".$this->db->escape_like_str($search)."%' or - CONCAT(`first_name`,' ',`last_name`) LIKE '%".$this->db->escape_like_str($search)."%') and deleted=0"); - $this->db->order_by("last_name", "asc"); - - return $this->db->get(); - } - -} -?> diff --git a/application/views/barcode.php b/application/views/barcode.php deleted file mode 100644 index 26e8998b8..000000000 --- a/application/views/barcode.php +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - -*/ -/*=============================================================================*/ - - -//----------------------------------------------------------------------------- -// Startup code -//----------------------------------------------------------------------------- - - -if(isset($_GET["text"])) $text=$_GET["text"]; -if(isset($_GET["format"])) $format=$_GET["format"]; -if(isset($_GET["quality"])) $quality=$_GET["quality"]; -if(isset($_GET["width"])) $width=$_GET["width"]; -if(isset($_GET["height"])) $height=$_GET["height"]; -if(isset($_GET["type"])) $type=$_GET["type"]; -if(isset($_GET["barcode"])) $barcode=$_GET["barcode"]; - - - - -if (!isset ($text)) $text = ''; -if (!isset ($type)) $type = 1; -if (empty ($quality)) $quality = 100; -if (empty ($width)) $width = 160; -if (empty ($height)) $height = 80; -if (!empty ($format)) $format = strtoupper ($format); - else $format="PNG"; - - -switch ($type) -{ - default: - $type = 1; - case 1: - Barcode39 ($barcode, $width, $height, $quality, $format, $text); - break; -} - - -//----------------------------------------------------------------------------- -// Generate a Code 3 of 9 barcode -//----------------------------------------------------------------------------- -function Barcode39 ($barcode, $width, $height, $quality, $format, $text) -{ - switch ($format) - { - default: - $format = "JPEG"; - case "JPEG": - header ("Content-type: image/jpeg"); - break; - case "PNG": - header ("Content-type: image/png"); - break; - case "GIF": - header ("Content-type: image/gif"); - break; - } - - - $im = ImageCreate ($width, $height) - or die ("Cannot Initialize new GD image stream"); - $White = ImageColorAllocate ($im, 255, 255, 255); - $Black = ImageColorAllocate ($im, 0, 0, 0); - //ImageColorTransparent ($im, $White); - ImageInterLace ($im, 1); - - - - $NarrowRatio = 20; - $WideRatio = 55; - $QuietRatio = 35; - - - $nChars = (strlen($barcode)+2) * ((6 * $NarrowRatio) + (3 * $WideRatio) + ($QuietRatio)); - $Pixels = $width / $nChars; - $NarrowBar = (int)(20 * $Pixels); - $WideBar = (int)(55 * $Pixels); - $QuietBar = (int)(35 * $Pixels); - - - $ActualWidth = (($NarrowBar * 6) + ($WideBar*3) + $QuietBar) * (strlen ($barcode)+2); - - if (($NarrowBar == 0) || ($NarrowBar == $WideBar) || ($NarrowBar == $QuietBar) || ($WideBar == 0) || ($WideBar == $QuietBar) || ($QuietBar == 0)) - { - ImageString ($im, 1, 0, 0, "Image is too small!", $Black); - OutputImage ($im, $format, $quality); - exit; - } - - $CurrentBarX = (int)(($width - $ActualWidth) / 2); - $Color = $White; - $BarcodeFull = "*".strtoupper ($barcode)."*"; - settype ($BarcodeFull, "string"); - - $FontNum = 3; - $FontHeight = ImageFontHeight ($FontNum); - $FontWidth = ImageFontWidth ($FontNum); - - if ($text != '') - { - $CenterLoc = (int)(($width) / 2) - (int)(($FontWidth * strlen($text)) / 2); - ImageString ($im, $FontNum, $CenterLoc, $height-$FontHeight, "$text", $Black); - } - - - for ($i=0; $i \ No newline at end of file diff --git a/application/views/barcode_sheet.php b/application/views/barcode_sheet.php deleted file mode 100644 index 1930ef49a..000000000 --- a/application/views/barcode_sheet.php +++ /dev/null @@ -1,28 +0,0 @@ - - - - <?php echo $this->lang->line('items_generate_barcodes'); ?> - - - - -'; - } - echo ""; - $count++; -} -?> - -
- - diff --git a/application/views/config.php b/application/views/config.php deleted file mode 100644 index f4cf564d0..000000000 --- a/application/views/config.php +++ /dev/null @@ -1,324 +0,0 @@ -load->view("partial/header"); ?> -
lang->line('module_config'); ?>
-'config_form')); -?> -
-
-
lang->line('common_fields_required_message'); ?>
-
    -lang->line("config_info"); ?> - -
    -lang->line('config_company').':', 'company',array('class'=>'wide required')); ?> -
    - 'company', - 'id'=>'company', - 'value'=>$this->config->item('company')));?> -
    -
    - -
    -lang->line('config_address').':', 'address',array('class'=>'wide required')); ?> -
    - 'address', - 'id'=>'address', - 'rows'=>4, - 'cols'=>17, - 'value'=>$this->config->item('address')));?> -
    -
    - -
    -lang->line('config_phone').':', 'phone',array('class'=>'wide required')); ?> -
    - 'phone', - 'id'=>'phone', - 'value'=>$this->config->item('phone')));?> -
    -
    - -
    -lang->line('config_default_tax_rate_1').':', 'default_tax_1_rate',array('class'=>'wide required')); ?> -
    - 'default_tax_1_name', - 'id'=>'default_tax_1_name', - 'size'=>'10', - 'value'=>$this->config->item('default_tax_1_name')!==FALSE ? $this->config->item('default_tax_1_name') : $this->lang->line('items_sales_tax_1')));?> - - 'default_tax_1_rate', - 'id'=>'default_tax_1_rate', - 'size'=>'4', - 'value'=>$this->config->item('default_tax_1_rate')));?>% -
    -
    - -
    -lang->line('config_default_tax_rate_2').':', 'default_tax_1_rate',array('class'=>'wide')); ?> -
    - 'default_tax_2_name', - 'id'=>'default_tax_2_name', - 'size'=>'10', - 'value'=>$this->config->item('default_tax_2_name')!==FALSE ? $this->config->item('default_tax_2_name') : $this->lang->line('items_sales_tax_2')));?> - - 'default_tax_2_rate', - 'id'=>'default_tax_2_rate', - 'size'=>'4', - 'value'=>$this->config->item('default_tax_2_rate')));?>% -
    -
    - -
    -lang->line('config_currency_symbol').':', 'currency_symbol',array('class'=>'wide')); ?> -
    - 'currency_symbol', - 'id'=>'currency_symbol', - 'value'=>$this->config->item('currency_symbol')));?> -
    -
    - -
    -lang->line('common_email').':', 'email',array('class'=>'wide')); ?> -
    - 'email', - 'id'=>'email', - 'value'=>$this->config->item('email')));?> -
    -
    - - -
    -lang->line('config_fax').':', 'fax',array('class'=>'wide')); ?> -
    - 'fax', - 'id'=>'fax', - 'value'=>$this->config->item('fax')));?> -
    -
    - -
    -lang->line('config_website').':', 'website',array('class'=>'wide')); ?> -
    - 'website', - 'id'=>'website', - 'value'=>$this->config->item('website')));?> -
    -
    - -
    -lang->line('common_return_policy').':', 'return_policy',array('class'=>'wide required')); ?> -
    - 'return_policy', - 'id'=>'return_policy', - 'rows'=>'4', - 'cols'=>'17', - 'value'=>$this->config->item('return_policy')));?> -
    -
    - -
    -lang->line('config_language').':', 'language',array('class'=>'wide required')); ?> -
    - 'English', - 'indonesia' => 'Indonesia', - 'spanish' => 'Spanish'), $this->config->item('language')); - ?> -
    -
    - -
    -lang->line('config_timezone').':', 'timezone',array('class'=>'wide required')); ?> -
    - '(GMT-11:00) Midway Island, Samoa', - 'America/Adak'=>'(GMT-10:00) Hawaii-Aleutian', - 'Etc/GMT+10'=>'(GMT-10:00) Hawaii', - 'Pacific/Marquesas'=>'(GMT-09:30) Marquesas Islands', - 'Pacific/Gambier'=>'(GMT-09:00) Gambier Islands', - 'America/Anchorage'=>'(GMT-09:00) Alaska', - 'America/Ensenada'=>'(GMT-08:00) Tijuana, Baja California', - 'Etc/GMT+8'=>'(GMT-08:00) Pitcairn Islands', - 'America/Los_Angeles'=>'(GMT-08:00) Pacific Time (US & Canada)', - 'America/Denver'=>'(GMT-07:00) Mountain Time (US & Canada)', - 'America/Chihuahua'=>'(GMT-07:00) Chihuahua, La Paz, Mazatlan', - 'America/Dawson_Creek'=>'(GMT-07:00) Arizona', - 'America/Belize'=>'(GMT-06:00) Saskatchewan, Central America', - 'America/Cancun'=>'(GMT-06:00) Guadalajara, Mexico City, Monterrey', - 'Chile/EasterIsland'=>'(GMT-06:00) Easter Island', - 'America/Chicago'=>'(GMT-06:00) Central Time (US & Canada)', - 'America/New_York'=>'(GMT-05:00) Eastern Time (US & Canada)', - 'America/Havana'=>'(GMT-05:00) Cuba', - 'America/Bogota'=>'(GMT-05:00) Bogota, Lima, Quito, Rio Branco', - 'America/Caracas'=>'(GMT-04:30) Caracas', - 'America/Santiago'=>'(GMT-04:00) Santiago', - 'America/La_Paz'=>'(GMT-04:00) La Paz', - 'Atlantic/Stanley'=>'(GMT-04:00) Faukland Islands', - 'America/Campo_Grande'=>'(GMT-04:00) Brazil', - 'America/Goose_Bay'=>'(GMT-04:00) Atlantic Time (Goose Bay)', - 'America/Glace_Bay'=>'(GMT-04:00) Atlantic Time (Canada)', - 'America/St_Johns'=>'(GMT-03:30) Newfoundland', - 'America/Araguaina'=>'(GMT-03:00) UTC-3', - 'America/Montevideo'=>'(GMT-03:00) Montevideo', - 'America/Miquelon'=>'(GMT-03:00) Miquelon, St. Pierre', - 'America/Godthab'=>'(GMT-03:00) Greenland', - 'America/Argentina/Buenos_Aires'=>'(GMT-03:00) Buenos Aires', - 'America/Sao_Paulo'=>'(GMT-03:00) Brasilia', - 'America/Noronha'=>'(GMT-02:00) Mid-Atlantic', - 'Atlantic/Cape_Verde'=>'(GMT-01:00) Cape Verde Is.', - 'Atlantic/Azores'=>'(GMT-01:00) Azores', - 'Europe/Belfast'=>'(GMT) Greenwich Mean Time : Belfast', - 'Europe/Dublin'=>'(GMT) Greenwich Mean Time : Dublin', - 'Europe/Lisbon'=>'(GMT) Greenwich Mean Time : Lisbon', - 'Europe/London'=>'(GMT) Greenwich Mean Time : London', - 'Africa/Abidjan'=>'(GMT) Monrovia, Reykjavik', - 'Europe/Amsterdam'=>'(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna', - 'Europe/Belgrade'=>'(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague', - 'Europe/Brussels'=>'(GMT+01:00) Brussels, Copenhagen, Madrid, Paris', - 'Africa/Algiers'=>'(GMT+01:00) West Central Africa', - 'Africa/Windhoek'=>'(GMT+01:00) Windhoek', - 'Asia/Beirut'=>'(GMT+02:00) Beirut', - 'Africa/Cairo'=>'(GMT+02:00) Cairo', - 'Asia/Gaza'=>'(GMT+02:00) Gaza', - 'Africa/Blantyre'=>'(GMT+02:00) Harare, Pretoria', - 'Asia/Jerusalem'=>'(GMT+02:00) Jerusalem', - 'Europe/Minsk'=>'(GMT+02:00) Minsk', - 'Asia/Damascus'=>'(GMT+02:00) Syria', - 'Europe/Moscow'=>'(GMT+03:00) Moscow, St. Petersburg, Volgograd', - 'Africa/Addis_Ababa'=>'(GMT+03:00) Nairobi', - 'Asia/Tehran'=>'(GMT+03:30) Tehran', - 'Asia/Dubai'=>'(GMT+04:00) Abu Dhabi, Muscat', - 'Asia/Yerevan'=>'(GMT+04:00) Yerevan', - 'Asia/Kabul'=>'(GMT+04:30) Kabul', - 'Asia/Yekaterinburg'=>'(GMT+05:00) Ekaterinburg', - 'Asia/Tashkent'=>'(GMT+05:00) Tashkent', - 'Asia/Kolkata'=>'(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi', - 'Asia/Katmandu'=>'(GMT+05:45) Kathmandu', - 'Asia/Dhaka'=>'(GMT+06:00) Astana, Dhaka', - 'Asia/Novosibirsk'=>'(GMT+06:00) Novosibirsk', - 'Asia/Rangoon'=>'(GMT+06:30) Yangon (Rangoon)', - 'Asia/Bangkok'=>'(GMT+07:00) Bangkok, Hanoi, Jakarta', - 'Asia/Krasnoyarsk'=>'(GMT+07:00) Krasnoyarsk', - 'Asia/Hong_Kong'=>'(GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi', - 'Asia/Irkutsk'=>'(GMT+08:00) Irkutsk, Ulaan Bataar', - 'Australia/Perth'=>'(GMT+08:00) Perth', - 'Australia/Eucla'=>'(GMT+08:45) Eucla', - 'Asia/Tokyo'=>'(GMT+09:00) Osaka, Sapporo, Tokyo', - 'Asia/Seoul'=>'(GMT+09:00) Seoul', - 'Asia/Yakutsk'=>'(GMT+09:00) Yakutsk', - 'Australia/Adelaide'=>'(GMT+09:30) Adelaide', - 'Australia/Darwin'=>'(GMT+09:30) Darwin', - 'Australia/Brisbane'=>'(GMT+10:00) Brisbane', - 'Australia/Hobart'=>'(GMT+10:00) Hobart', - 'Asia/Vladivostok'=>'(GMT+10:00) Vladivostok', - 'Australia/Lord_Howe'=>'(GMT+10:30) Lord Howe Island', - 'Etc/GMT-11'=>'(GMT+11:00) Solomon Is., New Caledonia', - 'Asia/Magadan'=>'(GMT+11:00) Magadan', - 'Pacific/Norfolk'=>'(GMT+11:30) Norfolk Island', - 'Asia/Anadyr'=>'(GMT+12:00) Anadyr, Kamchatka', - 'Pacific/Auckland'=>'(GMT+12:00) Auckland, Wellington', - 'Etc/GMT-12'=>'(GMT+12:00) Fiji, Kamchatka, Marshall Is.', - 'Pacific/Chatham'=>'(GMT+12:45) Chatham Islands', - 'Pacific/Tongatapu'=>'(GMT+13:00) Nuku\'alofa', - 'Pacific/Kiritimati'=>'(GMT+14:00) Kiritimati' - ), $this->config->item('timezone') ? $this->config->item('timezone') : date_default_timezone_get()); - ?> -
    -
    - -
    -lang->line('config_print_after_sale').':', 'print_after_sale',array('class'=>'wide')); ?> -
    - 'print_after_sale', - 'id'=>'print_after_sale', - 'value'=>'print_after_sale', - 'checked'=>$this->config->item('print_after_sale')));?> -
    -
    - - -'submit', - 'id'=>'submit', - 'value'=>$this->lang->line('common_submit'), - 'class'=>'submit_button float_right') -); -?> -
    -
    - -
    - -load->view("partial/footer"); ?> diff --git a/application/views/customers/excel_import.php b/application/views/customers/excel_import.php deleted file mode 100644 index d46c54a2d..000000000 --- a/application/views/customers/excel_import.php +++ /dev/null @@ -1,63 +0,0 @@ -'item_form')); -?> -
    Import customers from Excel sheet
    -
      -Download Import Excel Template (CSV) -
      -Import - -
      -'wide')); ?> -
      - 'file_path', - 'id'=>'file_path', - 'value'=>'') - );?> -
      -
      - -'submitf', - 'id'=>'submitf', - 'value'=>$this->lang->line('common_submit'), - 'class'=>'submit_button float_right') -); -?> -
      - - \ No newline at end of file diff --git a/application/views/customers/form.php b/application/views/customers/form.php deleted file mode 100644 index 2a1906a7a..000000000 --- a/application/views/customers/form.php +++ /dev/null @@ -1,73 +0,0 @@ -person_id,array('id'=>'customer_form')); -?> -
      lang->line('common_fields_required_message'); ?>
      -
        -
        -lang->line("customers_basic_information"); ?> -load->view("people/form_basic_info"); ?> -
        -lang->line('customers_account_number').':', 'account_number'); ?> -
        - 'account_number', - 'id'=>'account_number', - 'value'=>$person_info->account_number) - );?> -
        -
        - -
        -lang->line('customers_taxable').':', 'taxable'); ?> -
        - taxable == '' ? TRUE : (boolean)$person_info->taxable);?> -
        -
        - -'submit', - 'id'=>'submit', - 'value'=>$this->lang->line('common_submit'), - 'class'=>'submit_button float_right') -); -?> -
        - - \ No newline at end of file diff --git a/application/views/employees/form.php b/application/views/employees/form.php deleted file mode 100644 index 389c04612..000000000 --- a/application/views/employees/form.php +++ /dev/null @@ -1,158 +0,0 @@ -person_id,array('id'=>'employee_form')); -?> -
        lang->line('common_fields_required_message'); ?>
        -
          -
          -lang->line("employees_basic_information"); ?> -load->view("people/form_basic_info"); ?> -
          - -
          -lang->line("employees_login_info"); ?> -
          -lang->line('employees_username').':', 'username',array('class'=>'required')); ?> -
          - 'username', - 'id'=>'username', - 'value'=>$person_info->username));?> -
          -
          - -person_id == "" ? array('class'=>'required'):array(); -?> - -
          -lang->line('employees_password').':', 'password',$password_label_attributes); ?> -
          - 'password', - 'id'=>'password' - ));?> -
          -
          - - -
          -lang->line('employees_repeat_password').':', 'repeat_password',$password_label_attributes); ?> -
          - 'repeat_password', - 'id'=>'repeat_password' - ));?> -
          -
          -
          - -
          -lang->line("employees_permission_info"); ?> -

          lang->line("employees_permission_desc"); ?>

          - -
            -result() as $module) -{ -?> -
          • -module_id,$this->Employee->has_permission($module->module_id,$person_info->person_id)); ?> -lang->line('module_'.$module->module_id);?>: -lang->line('module_'.$module->module_id.'_desc');?> -
          • - -
          -'submit', - 'id'=>'submit', - 'value'=>$this->lang->line('common_submit'), - 'class'=>'submit_button float_right') -); - -?> -
          - - \ No newline at end of file diff --git a/application/views/giftcards/form.php b/application/views/giftcards/form.php deleted file mode 100644 index e0444a289..000000000 --- a/application/views/giftcards/form.php +++ /dev/null @@ -1,93 +0,0 @@ -
          lang->line('common_fields_required_message'); ?>
          -
            -giftcard_id,array('id'=>'giftcard_form')); -?> -
            -lang->line("giftcards_basic_information"); ?> - -
            -lang->line('giftcards_giftcard_number').':', 'name',array('class'=>'required wide')); ?> -
            - 'giftcard_number', - 'size'=>'8', - 'id'=>'giftcard_number', - 'value'=>$giftcard_info->giftcard_number) - );?> -
            -
            - -
            -lang->line('giftcards_card_value').':', 'name',array('class'=>'required wide')); ?> -
            - 'value', - 'size'=>'8', - 'id'=>'value', - 'value'=>$giftcard_info->value) - );?> -
            -
            - -'submit', - 'id'=>'submit', - 'value'=>$this->lang->line('common_submit'), - 'class'=>'submit_button float_right') -); -?> -
            - - \ No newline at end of file diff --git a/application/views/giftcards/manage.php b/application/views/giftcards/manage.php deleted file mode 100644 index 0a3d49fe8..000000000 --- a/application/views/giftcards/manage.php +++ /dev/null @@ -1,86 +0,0 @@ -load->view("partial/header"); ?> - - -
            -
            lang->line('common_list_of').' '.$this->lang->line('module_'.$controller_name); ?>
            -
            - ".$this->lang->line($controller_name.'_new')."
            ", - array('class'=>'thickbox none','title'=>$this->lang->line($controller_name.'_new'))); - ?> -
            - -pagination->create_links();?> -
            -
              -
            • lang->line("common_delete"),array('id'=>'delete')); ?>
            • -
            • - spinner - 'search_form')); ?> - - -
            • -
            -
            - -
            - -
            -
            -load->view("partial/footer"); ?> \ No newline at end of file diff --git a/application/views/home.php b/application/views/home.php deleted file mode 100644 index caaccb417..000000000 --- a/application/views/home.php +++ /dev/null @@ -1,19 +0,0 @@ -load->view("partial/header"); ?> -
            -

            lang->line('common_welcome_message'); ?>

            -
            - result() as $module) - { - ?> -
            - module_id");?>"> - Menubar Image
            - module_id");?>">lang->line("module_".$module->module_id) ?> - - lang->line('module_'.$module->module_id.'_desc');?> -
            - -
            -load->view("partial/footer"); ?> \ No newline at end of file diff --git a/application/views/index.html b/application/views/index.html deleted file mode 100644 index 065d2da5e..000000000 --- a/application/views/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

            Directory access is forbidden.

            - - - \ No newline at end of file diff --git a/application/views/item_kits/form.php b/application/views/item_kits/form.php deleted file mode 100644 index f6fb20f37..000000000 --- a/application/views/item_kits/form.php +++ /dev/null @@ -1,138 +0,0 @@ -
            lang->line('common_fields_required_message'); ?>
            -
              -item_kit_id,array('id'=>'item_kit_form')); -?> -
              -lang->line("item_kits_info"); ?> - -
              -lang->line('item_kits_name').':', 'name',array('class'=>'wide required')); ?> -
              - 'name', - 'id'=>'name', - 'value'=>$item_kit_info->name) - );?> -
              -
              - -
              -lang->line('item_kits_description').':', 'description',array('class'=>'wide')); ?> -
              - 'description', - 'id'=>'description', - 'value'=>$item_kit_info->description, - 'rows'=>'5', - 'cols'=>'17') - );?> -
              -
              - - -
              -lang->line('item_kits_add_item').':', 'item',array('class'=>'wide')); ?> -
              - 'item', - 'id'=>'item' - ));?> -
              -
              - - - - - - - - - Item_kit_items->get_info($item_kit_info->item_kit_id) as $item_kit_item) {?> - - Item->get_info($item_kit_item['item_id']); - ?> - - - - - -
              lang->line('common_delete');?>lang->line('item_kits_item');?>lang->line('item_kits_quantity');?>
              Xname; ?>' type='text' size='3' name=item_kit_item[] value=''/>
              -'submit', - 'id'=>'submit', - 'value'=>$this->lang->line('common_submit'), - 'class'=>'submit_button float_right') -); -?> -
              - - \ No newline at end of file diff --git a/application/views/item_kits/manage.php b/application/views/item_kits/manage.php deleted file mode 100644 index a731a9263..000000000 --- a/application/views/item_kits/manage.php +++ /dev/null @@ -1,99 +0,0 @@ -load->view("partial/header"); ?> - - -
              -
              lang->line('common_list_of').' '.$this->lang->line('module_'.$controller_name); ?>
              -
              - ".$this->lang->line($controller_name.'_new')."
              ", - array('class'=>'thickbox none','title'=>$this->lang->line($controller_name.'_new'))); - ?> -
              - - -pagination->create_links();?> -
              -
                -
              • lang->line("common_delete"),array('id'=>'delete')); ?>
              • -
              • lang->line("items_generate_barcodes"),array('id'=>'generate_barcodes', 'target' =>'_blank','title'=>$this->lang->line('items_generate_barcodes'))); ?>
              • -
              • - spinner - 'search_form')); ?> - - -
              • -
              -
              - -
              - -
              -
              -load->view("partial/footer"); ?> \ No newline at end of file diff --git a/application/views/items/count_details.php b/application/views/items/count_details.php deleted file mode 100644 index 22b48115c..000000000 --- a/application/views/items/count_details.php +++ /dev/null @@ -1,114 +0,0 @@ -item_id,array('id'=>'item_form')); -?> -
              -lang->line("items_basic_information"); ?> - - -
              -
              - - - - - - - - - - - - - - - - -
              -lang->line('items_item_number').':', 'name',array('class'=>'wide')); ?> - - 'item_number', - 'id'=>'item_number', - 'value'=>$item_info->item_number, - 'style' => 'border:none', - 'readonly' => 'readonly' - ); - - echo form_input($inumber) - ?> -
              -lang->line('items_name').':', 'name',array('class'=>'wide')); ?> - - 'name', - 'id'=>'name', - 'value'=>$item_info->name, - 'style' => 'border:none', - 'readonly' => 'readonly' - ); - echo form_input($iname); - ?> -
              -lang->line('items_category').':', 'category',array('class'=>'wide')); ?> - - 'category', - 'id'=>'category', - 'value'=>$item_info->category, - 'style' => 'border:none', - 'readonly' => 'readonly' - ); - - echo form_input($cat); - ?> -
              -lang->line('items_current_quantity').':', 'quantity',array('class'=>'wide')); ?> - - 'quantity', - 'id'=>'quantity', - 'value'=>$item_info->quantity, - 'style' => 'border:none', - 'readonly' => 'readonly' - ); - - echo form_input($qty); - ?> -
              - -
              -
              -
              - -
              -
              -
              -
              - - - - -Inventory->get_inventory_data_for_item($item_info->item_id)->result_array() as $row) -{ -?> - - - - - - - - -
              Inventory Data Tracking
              DateEmployeeIn/Out QtyRemarks
              Employee->get_info($person_id); - echo $employee->first_name." ".$employee->last_name; - ?> -
              \ No newline at end of file diff --git a/application/views/items/excel_import.php b/application/views/items/excel_import.php deleted file mode 100644 index 2816cd04d..000000000 --- a/application/views/items/excel_import.php +++ /dev/null @@ -1,63 +0,0 @@ -'item_form')); -?> -
              Import items from Excel sheet
              -
                -Download Import Excel Template (CSV) -
                -Import - -
                -'wide')); ?> -
                - 'file_path', - 'id'=>'file_path', - 'value'=>'') - );?> -
                -
                - -'submitf', - 'id'=>'submitf', - 'value'=>$this->lang->line('common_submit'), - 'class'=>'submit_button float_right') -); -?> -
                - - \ No newline at end of file diff --git a/application/views/items/form.php b/application/views/items/form.php deleted file mode 100644 index 369e7240d..000000000 --- a/application/views/items/form.php +++ /dev/null @@ -1,292 +0,0 @@ -
                lang->line('common_fields_required_message'); ?>
                -
                  -item_id,array('id'=>'item_form')); -?> -
                  -lang->line("items_basic_information"); ?> - -
                  -lang->line('items_item_number').':', 'name',array('class'=>'wide')); ?> -
                  - 'item_number', - 'id'=>'item_number', - 'value'=>$item_info->item_number) - );?> -
                  -
                  - -
                  -lang->line('items_name').':', 'name',array('class'=>'required wide')); ?> -
                  - 'name', - 'id'=>'name', - 'value'=>$item_info->name) - );?> -
                  -
                  - -
                  -lang->line('items_category').':', 'category',array('class'=>'required wide')); ?> -
                  - 'category', - 'id'=>'category', - 'value'=>$item_info->category) - );?> -
                  -
                  - -
                  -lang->line('items_supplier').':', 'supplier',array('class'=>'required wide')); ?> -
                  - -
                  -
                  - -
                  -lang->line('items_cost_price').':', 'cost_price',array('class'=>'required wide')); ?> -
                  - 'cost_price', - 'size'=>'8', - 'id'=>'cost_price', - 'value'=>$item_info->cost_price) - );?> -
                  -
                  - -
                  -lang->line('items_unit_price').':', 'unit_price',array('class'=>'required wide')); ?> -
                  - 'unit_price', - 'size'=>'8', - 'id'=>'unit_price', - 'value'=>$item_info->unit_price) - );?> -
                  -
                  - -
                  -lang->line('items_tax_1').':', 'tax_percent_1',array('class'=>'wide')); ?> -
                  - 'tax_names[]', - 'id'=>'tax_name_1', - 'size'=>'8', - 'value'=> isset($item_tax_info[0]['name']) ? $item_tax_info[0]['name'] : $this->config->item('default_tax_1_name')) - );?> -
                  -
                  - 'tax_percents[]', - 'id'=>'tax_percent_name_1', - 'size'=>'3', - 'value'=> isset($item_tax_info[0]['percent']) ? $item_tax_info[0]['percent'] : $default_tax_1_rate) - );?> - % -
                  -
                  - -
                  -lang->line('items_tax_2').':', 'tax_percent_2',array('class'=>'wide')); ?> -
                  - 'tax_names[]', - 'id'=>'tax_name_2', - 'size'=>'8', - 'value'=> isset($item_tax_info[1]['name']) ? $item_tax_info[1]['name'] : $this->config->item('default_tax_2_name')) - );?> -
                  -
                  - 'tax_percents[]', - 'id'=>'tax_percent_name_2', - 'size'=>'3', - 'value'=> isset($item_tax_info[1]['percent']) ? $item_tax_info[1]['percent'] : $default_tax_2_rate) - );?> - % -
                  -
                  - - -
                  -lang->line('items_quantity').':', 'quantity',array('class'=>'required wide')); ?> -
                  - 'quantity', - 'id'=>'quantity', - 'value'=>$item_info->quantity) - );?> -
                  -
                  - -
                  -lang->line('items_reorder_level').':', 'reorder_level',array('class'=>'required wide')); ?> -
                  - 'reorder_level', - 'id'=>'reorder_level', - 'value'=>$item_info->reorder_level) - );?> -
                  -
                  - -
                  -lang->line('items_location').':', 'location',array('class'=>'wide')); ?> -
                  - 'location', - 'id'=>'location', - 'value'=>$item_info->location) - );?> -
                  -
                  - -
                  -lang->line('items_description').':', 'description',array('class'=>'wide')); ?> -
                  - 'description', - 'id'=>'description', - 'value'=>$item_info->description, - 'rows'=>'5', - 'cols'=>'17') - );?> -
                  -
                  - -
                  -lang->line('items_allow_alt_desciption').':', 'allow_alt_description',array('class'=>'wide')); ?> -
                  - 'allow_alt_description', - 'id'=>'allow_alt_description', - 'value'=>1, - 'checked'=>($item_info->allow_alt_description)? 1 :0) - );?> -
                  -
                  - -
                  -lang->line('items_is_serialized').':', 'is_serialized',array('class'=>'wide')); ?> -
                  - 'is_serialized', - 'id'=>'is_serialized', - 'value'=>1, - 'checked'=>($item_info->is_serialized)? 1 : 0) - );?> -
                  -
                  - -'submit', - 'id'=>'submit', - 'value'=>$this->lang->line('common_submit'), - 'class'=>'submit_button float_right') -); -?> -
                  - - \ No newline at end of file diff --git a/application/views/items/form_bulk.php b/application/views/items/form_bulk.php deleted file mode 100644 index 5bfedc9b2..000000000 --- a/application/views/items/form_bulk.php +++ /dev/null @@ -1,244 +0,0 @@ -
                  lang->line('items_edit_fields_you_want_to_update'); ?>
                  -
                    -'item_form')); -?> -
                    -lang->line("items_basic_information"); ?> - -
                    -lang->line('items_name').':', 'name',array('class'=>'wide')); ?> -
                    - 'name', - 'id'=>'name') - );?> -
                    -
                    - -
                    -lang->line('items_category').':', 'category',array('class'=>'wide')); ?> -
                    - 'category', - 'id'=>'category') - );?> -
                    -
                    - -
                    -lang->line('items_supplier').':', 'supplier',array('class'=>'wide')); ?> -
                    - -
                    -
                    - - -
                    -lang->line('items_cost_price').':', 'cost_price',array('class'=>'wide')); ?> -
                    - 'cost_price', - 'size'=>'8', - 'id'=>'cost_price') - );?> -
                    -
                    - -
                    -lang->line('items_unit_price').':', 'unit_price',array('class'=>'wide')); ?> -
                    - 'unit_price', - 'size'=>'8', - 'id'=>'unit_price') - );?> -
                    -
                    - -
                    -lang->line('items_tax_1').':', 'tax_percent_1',array('class'=>'wide')); ?> -
                    - 'tax_names[]', - 'id'=>'tax_name_1', - 'size'=>'8', - 'value'=> isset($item_tax_info[0]['name']) ? $item_tax_info[0]['name'] : $this->lang->line('items_sales_tax')) - );?> -
                    -
                    - 'tax_percents[]', - 'id'=>'tax_percent_name_1', - 'size'=>'3', - 'value'=> isset($item_tax_info[0]['percent']) ? $item_tax_info[0]['percent'] : '') - );?> - % -
                    -
                    - -
                    -lang->line('items_tax_2').':', 'tax_percent_2',array('class'=>'wide')); ?> -
                    - 'tax_names[]', - 'id'=>'tax_name_2', - 'size'=>'8', - 'value'=> isset($item_tax_info[1]['name']) ? $item_tax_info[1]['name'] : '') - );?> -
                    -
                    - 'tax_percents[]', - 'id'=>'tax_percent_name_2', - 'size'=>'3', - 'value'=> isset($item_tax_info[1]['percent']) ? $item_tax_info[1]['percent'] : '') - );?> - % -
                    -
                    -
                    -lang->line('items_reorder_level').':', 'reorder_level',array('class'=>'wide')); ?> -
                    - 'reorder_level', - 'id'=>'reorder_level') - );?> -
                    -
                    - -
                    -lang->line('items_location').':', 'location',array('class'=>'wide')); ?> -
                    - 'location', - 'id'=>'location') - );?> -
                    -
                    - -
                    -lang->line('items_description').':', 'description',array('class'=>'wide')); ?> -
                    - 'description', - 'id'=>'description', - 'rows'=>'5', - 'cols'=>'17') - );?> -
                    -
                    - -
                    - -lang->line('items_allow_alt_desciption').':', 'allow_alt_description',array('class'=>'wide')); ?> -
                    - - -
                    - -
                    - - - -
                    - -lang->line('items_is_serialized').':', 'is_serialized',array('class'=>'wide')); ?> -
                    - - -
                    - -
                    - -'submit', - 'id'=>'submit', - 'value'=>$this->lang->line('common_submit'), - 'class'=>'submit_button float_right') -); -?> -
                    - - \ No newline at end of file diff --git a/application/views/items/inventory.php b/application/views/items/inventory.php deleted file mode 100644 index 178c2d3b4..000000000 --- a/application/views/items/inventory.php +++ /dev/null @@ -1,157 +0,0 @@ -
                    lang->line('common_fields_required_message'); ?>
                    -
                      -item_id,array('id'=>'item_form')); -?> -
                      -lang->line("items_basic_information"); ?> - - -
                      -
                      - - - - - - - - - - - - - - - - -
                      -lang->line('items_item_number').':', 'name',array('class'=>'wide')); ?> - - 'item_number', - 'id'=>'item_number', - 'value'=>$item_info->item_number, - 'style' => 'border:none', - 'readonly' => 'readonly' - ); - - echo form_input($inumber) - ?> -
                      -lang->line('items_name').':', 'name',array('class'=>'wide')); ?> - - 'name', - 'id'=>'name', - 'value'=>$item_info->name, - 'style' => 'border:none', - 'readonly' => 'readonly' - ); - echo form_input($iname); - ?> -
                      -lang->line('items_category').':', 'category',array('class'=>'wide')); ?> - - 'category', - 'id'=>'category', - 'value'=>$item_info->category, - 'style' => 'border:none', - 'readonly' => 'readonly' - ); - - echo form_input($cat); - ?> -
                      -lang->line('items_current_quantity').':', 'quantity',array('class'=>'wide')); ?> - - 'quantity', - 'id'=>'quantity', - 'value'=>$item_info->quantity, - 'style' => 'border:none', - 'readonly' => 'readonly' - ); - - echo form_input($qty); - ?> -
                      - -
                      -lang->line('items_add_minus').':', 'quantity',array('class'=>'required wide')); ?> -
                      - 'newquantity', - 'id'=>'newquantity' - ) - );?> -
                      -
                      - -
                      -lang->line('items_inventory_comments').':', 'description',array('class'=>'wide')); ?> -
                      - 'trans_comment', - 'id'=>'trans_comment', - 'rows'=>'3', - 'cols'=>'17') - );?> -
                      -
                      -'submit', - 'id'=>'submit', - 'value'=>$this->lang->line('common_submit'), - 'class'=>'submit_button float_right') -); -?> -
                      - - \ No newline at end of file diff --git a/application/views/items/manage.php b/application/views/items/manage.php deleted file mode 100644 index e1afc2053..000000000 --- a/application/views/items/manage.php +++ /dev/null @@ -1,176 +0,0 @@ -load->view("partial/header"); ?> - - -
                      -
                      lang->line('common_list_of').' '.$this->lang->line('module_'.$controller_name); ?>
                      -
                      - ".$this->lang->line($controller_name.'_new')."
                      ", - array('class'=>'thickbox none','title'=>$this->lang->line($controller_name.'_new'))); - ?> - Excel Import
                      ", - array('class'=>'thickbox none','title'=>'Import Items from Excel')); - ?> - - - -
                      -
                      Search Options :
                      - - -
                      - -
                      - 'items_filter_form')); ?> - lang->line('items_low_inventory_items').' '.':', 'low_inventory');?> - 'low_inventory','id'=>'low_inventory','value'=>1,'checked'=> isset($low_inventory)? ( ($low_inventory)? 1 : 0) : 0)).' | ';?> - lang->line('items_serialized_items').' '.':', 'is_serialized');?> - 'is_serialized','id'=>'is_serialized','value'=>1,'checked'=> isset($is_serialized)? ( ($is_serialized)? 1 : 0) : 0)).' | ';?> - lang->line('items_no_description_items').' '.':', 'no_description');?> - 'no_description','id'=>'no_description','value'=>1,'checked'=> isset($no_description)? ( ($no_description)? 1 : 0) : 0)).' | ';?> - - -
                      -pagination->create_links();?> -
                      -
                        -
                      • lang->line("common_delete"),array('id'=>'delete')); ?>
                      • -
                      • lang->line("items_bulk_edit"),array('id'=>'bulk_edit','title'=>$this->lang->line('items_edit_multiple_items'))); ?>
                      • -
                      • lang->line("items_generate_barcodes"),array('id'=>'generate_barcodes', 'target' =>'_blank','title'=>$this->lang->line('items_generate_barcodes'))); ?>
                      • -
                      • - spinner - 'search_form')); ?> - - -
                      • -
                      -
                      - -
                      - -
                      -
                      -load->view("partial/footer"); ?> \ No newline at end of file diff --git a/application/views/login.php b/application/views/login.php deleted file mode 100644 index 049acbed0..000000000 --- a/application/views/login.php +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - -Open Source Point Of Sale <?php echo $this->lang->line('login_login'); ?> - - - - -

                      Open Source Point Of Sale config->item('application_version'); ?>

                      - -

                      Press login to continue

                      - - -
                      - -
                      - lang->line('login_login'); ?> -
                      -
                      -
                      - lang->line('login_welcome_message'); ?> -
                      - -
                      lang->line('login_username'); ?>:
                      -
                      - 'username', - 'value'=> $_SERVER['HTTP_HOST'] == 'ospos.pappastech.com' ? 'admin' : '', - 'size'=>'20')); ?> -
                      - -
                      lang->line('login_password'); ?>:
                      -
                      - 'password', - 'value'=>$_SERVER['HTTP_HOST'] == 'ospos.pappastech.com' ? 'pointofsale' : '', - 'size'=>'20')); ?> - -
                      - -
                      - -
                      -
                      -
                      - - - diff --git a/application/views/no_access.php b/application/views/no_access.php deleted file mode 100644 index bd0db7601..000000000 --- a/application/views/no_access.php +++ /dev/null @@ -1,3 +0,0 @@ -lang->line('error_no_permission_module').' '.$module_name; -?> \ No newline at end of file diff --git a/application/views/partial/footer.php b/application/views/partial/footer.php deleted file mode 100644 index 7683c1005..000000000 --- a/application/views/partial/footer.php +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/application/views/partial/footer_excel.php b/application/views/partial/footer_excel.php deleted file mode 100644 index 69fb64a9b..000000000 --- a/application/views/partial/footer_excel.php +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/views/partial/header.php b/application/views/partial/header.php deleted file mode 100644 index 722c5ac8a..000000000 --- a/application/views/partial/header.php +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - <?php echo $this->config->item('company').' -- '.$this->lang->line('common_powered_by').' Open Source Point Of Sale' ?> - - - - - - - - - - - - - - - - - - - - - - - - - -
                      -
                      diff --git a/application/views/partial/header_excel.php b/application/views/partial/header_excel.php deleted file mode 100644 index c60a36c20..000000000 --- a/application/views/partial/header_excel.php +++ /dev/null @@ -1,54 +0,0 @@ - - - - - <?php echo $this->config->item('company').' -- '.$this->lang->line('common_powered_by').' Open Source Point Of Sale' ?> - - - diff --git a/application/views/people/form_basic_info.php b/application/views/people/form_basic_info.php deleted file mode 100644 index 3e36f4889..000000000 --- a/application/views/people/form_basic_info.php +++ /dev/null @@ -1,114 +0,0 @@ -
                      -lang->line('common_first_name').':', 'first_name',array('class'=>'required')); ?> -
                      - 'first_name', - 'id'=>'first_name', - 'value'=>$person_info->first_name) - );?> -
                      -
                      -
                      -lang->line('common_last_name').':', 'last_name',array('class'=>'required')); ?> -
                      - 'last_name', - 'id'=>'last_name', - 'value'=>$person_info->last_name) - );?> -
                      -
                      - -
                      -lang->line('common_email').':', 'email'); ?> -
                      - 'email', - 'id'=>'email', - 'value'=>$person_info->email) - );?> -
                      -
                      - -
                      -lang->line('common_phone_number').':', 'phone_number'); ?> -
                      - 'phone_number', - 'id'=>'phone_number', - 'value'=>$person_info->phone_number));?> -
                      -
                      - -
                      -lang->line('common_address_1').':', 'address_1'); ?> -
                      - 'address_1', - 'id'=>'address_1', - 'value'=>$person_info->address_1));?> -
                      -
                      - -
                      -lang->line('common_address_2').':', 'address_2'); ?> -
                      - 'address_2', - 'id'=>'address_2', - 'value'=>$person_info->address_2));?> -
                      -
                      - -
                      -lang->line('common_city').':', 'city'); ?> -
                      - 'city', - 'id'=>'city', - 'value'=>$person_info->city));?> -
                      -
                      - -
                      -lang->line('common_state').':', 'state'); ?> -
                      - 'state', - 'id'=>'state', - 'value'=>$person_info->state));?> -
                      -
                      - -
                      -lang->line('common_zip').':', 'zip'); ?> -
                      - 'zip', - 'id'=>'zip', - 'value'=>$person_info->zip));?> -
                      -
                      - -
                      -lang->line('common_country').':', 'country'); ?> -
                      - 'country', - 'id'=>'country', - 'value'=>$person_info->country));?> -
                      -
                      - -
                      -lang->line('common_comments').':', 'comments'); ?> -
                      - 'comments', - 'id'=>'comments', - 'value'=>$person_info->comments, - 'rows'=>'5', - 'cols'=>'17') - );?> -
                      -
                      \ No newline at end of file diff --git a/application/views/people/manage.php b/application/views/people/manage.php deleted file mode 100644 index 8679a7c7a..000000000 --- a/application/views/people/manage.php +++ /dev/null @@ -1,91 +0,0 @@ -load->view("partial/header"); ?> - - -
                      -
                      lang->line('common_list_of').' '.$this->lang->line('module_'.$controller_name); ?>
                      -
                      - ".$this->lang->line($controller_name.'_new')."
                      ", - array('class'=>'thickbox none','title'=>$this->lang->line($controller_name.'_new'))); - ?> - - Excel Import
                      ", - array('class'=>'thickbox none','title'=>'Import Items from Excel')); - ?> - -
                      -
                      -pagination->create_links();?> -
                      - -
                      -
                      - -
                      -
                      -load->view("partial/footer"); ?> \ No newline at end of file diff --git a/application/views/receivings/receipt.php b/application/views/receivings/receipt.php deleted file mode 100644 index 8efc5f307..000000000 --- a/application/views/receivings/receipt.php +++ /dev/null @@ -1,104 +0,0 @@ -load->view("partial/header"); ?> -'.$error_message.''; - exit; -} -?> -
                      -
                      -
                      config->item('company'); ?>
                      -
                      config->item('address')); ?>
                      -
                      config->item('phone'); ?>
                      -
                      -
                      -
                      -
                      - -
                      lang->line('suppliers_supplier').": ".$supplier; ?>
                      - -
                      lang->line('recvs_id').": ".$receiving_id; ?>
                      -
                      lang->line('employees_employee').": ".$employee; ?>
                      -
                      - - - - - - - - - - $item) - { - ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                      lang->line('items_item'); ?>lang->line('common_price'); ?>lang->line('sales_quantity'); ?>lang->line('sales_discount'); ?>lang->line('sales_total'); ?>
                      lang->line('sales_total'); ?>
                      lang->line('sales_payment'); ?>
                      lang->line('sales_amount_tendered'); ?>
                      lang->line('sales_change_due'); ?>
                      - -
                      - config->item('return_policy')); ?> -
                      -
                      - "; ?> -
                      -
                      -load->view("partial/footer"); ?> - -Appconfig->get('print_after_sale')) -{ -?> - - \ No newline at end of file diff --git a/application/views/receivings/receiving.php b/application/views/receivings/receiving.php deleted file mode 100644 index 09912398f..000000000 --- a/application/views/receivings/receiving.php +++ /dev/null @@ -1,294 +0,0 @@ -load->view("partial/header"); ?> - -
                      lang->line('recvs_register'); ?>
                      - -".$error.""; -} -?> - - - -
                      - 'mode_form')); ?> - lang->line('recvs_mode') ?> - - - 'add_item_form')); ?> - -'item','id'=>'item','size'=>'40'));?> -
                      - ".$this->lang->line('sales_new_item')."
                      ", - array('class'=>'thickbox none','title'=>$this->lang->line('sales_new_item'))); - ?> -
                      - - - - - - - - - - - - - - - - - - - - - -$item) - { - echo form_open("receivings/edit_item/$line"); - ?> - - - - - - - - - - - - - - - - - - -
                      lang->line('common_delete'); ?>lang->line('recvs_item_name'); ?>lang->line('recvs_cost'); ?>lang->line('recvs_quantity'); ?>lang->line('recvs_discount'); ?>lang->line('recvs_total'); ?>lang->line('recvs_edit'); ?>
                      -
                      lang->line('sales_no_items_in_cart'); ?>
                      -
                      lang->line('common_delete').']');?>
                      - - -
                      - - - -
                      'price','value'=>$item['price'],'size'=>'6'));?> - 'quantity','value'=>$item['quantity'],'size'=>'2')); - ?> - 'discount','value'=>$item['discount'],'size'=>'3'));?>lang->line('sales_edit_item'));?>
                      - - - - -
                      - lang->line("recvs_supplier").': '.$supplier. '
                      '; - echo anchor("receivings/delete_supplier",'['.$this->lang->line('common_delete').' '.$this->lang->line('suppliers_supplier').']'); - } - else - { - echo form_open("receivings/select_supplier",array('id'=>'select_supplier_form')); ?> - - 'supplier','id'=>'supplier','size'=>'30','value'=>$this->lang->line('recvs_start_typing_supplier_name')));?> - -
                      -

                      lang->line('common_or'); ?>

                      - ".$this->lang->line('recvs_new_supplier')."
                      ", - array('class'=>'thickbox none','title'=>$this->lang->line('recvs_new_supplier'))); - ?> -
                      -
                       
                      - - -
                      -
                      lang->line('sales_total'); ?>:
                      -
                      -
                      - 0) - { - ?> -
                      - 'finish_sale_form')); ?> -
                      - - 'comment','value'=>'','rows'=>'4','cols'=>'23'));?> -

                      - - - - - - - -
                      - lang->line('sales_payment').': ';?> - - -
                      - lang->line('sales_amount_tendered').': ';?> - - 'amount_tendered','value'=>'','size'=>'10')); - ?> -
                      -
                      - ".$this->lang->line('recvs_complete_receiving')."
                      "; - ?> - - - - - 'cancel_sale_form')); ?> -
                      - Cancel -
                      - - - - - -
                       
                      - - -load->view("partial/footer"); ?> - - - \ No newline at end of file diff --git a/application/views/reports/date_input.php b/application/views/reports/date_input.php deleted file mode 100644 index 7e98c9bed..000000000 --- a/application/views/reports/date_input.php +++ /dev/null @@ -1,72 +0,0 @@ -load->view("partial/header"); ?> -
                      lang->line('reports_report_input'); ?>
                      -".$error.""; -} -?> - lang->line('reports_date_range'), 'report_date_range_label', array('class'=>'required')); ?> -
                      - - -
                      - -
                      - - - - - - - - - -
                      - - lang->line('reports_sale_type'), 'reports_sale_type_label', array('class'=>'required')); ?> -
                      - $this->lang->line('reports_all'), 'sales' => $this->lang->line('reports_sales'), 'returns' => $this->lang->line('reports_returns')), 'all', 'id="sale_type"'); ?> -
                      -'generate_report', - 'id'=>'generate_report', - 'content'=>$this->lang->line('common_submit'), - 'class'=>'submit_button') -); -?> - -load->view("partial/footer"); ?> - - \ No newline at end of file diff --git a/application/views/reports/date_input_excel_export.php b/application/views/reports/date_input_excel_export.php deleted file mode 100644 index 188e26b79..000000000 --- a/application/views/reports/date_input_excel_export.php +++ /dev/null @@ -1,83 +0,0 @@ -load->view("partial/header"); ?> -
                      lang->line('reports_report_input'); ?>
                      -".$error.""; -} -?> - lang->line('reports_date_range'), 'report_date_range_label', array('class'=>'required')); ?> -
                      - - -
                      - -
                      - - - - - - - - - -
                      - - lang->line('reports_sale_type'), 'reports_sale_type_label', array('class'=>'required')); ?> -
                      - $this->lang->line('reports_all'), 'sales' => $this->lang->line('reports_sales'), 'returns' => $this->lang->line('reports_returns')), 'all', 'id="sale_type"'); ?> -
                      - -
                      - Export to Excel: Yes - No -
                      - -'generate_report', - 'id'=>'generate_report', - 'content'=>$this->lang->line('common_submit'), - 'class'=>'submit_button') -); -?> - -load->view("partial/footer"); ?> - - \ No newline at end of file diff --git a/application/views/reports/excel_export.php b/application/views/reports/excel_export.php deleted file mode 100644 index ab628c26a..000000000 --- a/application/views/reports/excel_export.php +++ /dev/null @@ -1,39 +0,0 @@ -load->view("partial/header"); ?> -
                      lang->line('reports_report_input'); ?>
                      -".$error.""; -} -?> -
                      - Export to Excel: Yes - No -
                      - -'generate_report', - 'id'=>'generate_report', - 'content'=>$this->lang->line('common_submit'), - 'class'=>'submit_button') -); -?> - -load->view("partial/footer"); ?> - - \ No newline at end of file diff --git a/application/views/reports/graphical.php b/application/views/reports/graphical.php deleted file mode 100644 index cab02c029..000000000 --- a/application/views/reports/graphical.php +++ /dev/null @@ -1,27 +0,0 @@ -load->view("partial/header"); -?> -
                      -
                      -
                      - - - -
                      -
                      -
                      -
                      -
                      -$value) { ?> -
                      lang->line('reports_'.$name). ': '.to_currency($value); ?>
                      - -
                      -load->view("partial/footer"); -?> \ No newline at end of file diff --git a/application/views/reports/graphs/bar.php b/application/views/reports/graphs/bar.php deleted file mode 100644 index c42baf1cf..000000000 --- a/application/views/reports/graphs/bar.php +++ /dev/null @@ -1,46 +0,0 @@ -output->set_header("Cache-Control: no-store, no-cache, must-revalidate"); -$this->output->set_header("Pragma: public"); -$bar = new bar_filled( '#4386a1', '#577261' ); - -$bar_labels = array(); -$bar_values = array(); - -foreach($data as $label=>$value) -{ - $bar_labels[] = (string)$label; - $bar_values[] = (float)$value; -} - -$bar->set_values($bar_values); - -$chart = new open_flash_chart(); -$chart->set_title(new title($title)); -$x = new x_axis(); -$x->steps(1); -$x->set_labels_from_array($bar_labels); -$chart->set_x_axis( $x ); - -$y = new y_axis(); -$y->set_tick_length(7); -$y->set_range(0, (count($data) > 0 ? max($data) : 0) + 25, ((count($data) > 0 ? max($data) : 0)+25)/10); -$chart->set_y_axis( $y ); -$chart->set_bg_colour("#f3f3f3"); - -$chart->add_element($bar); - -if (isset($yaxis_label)) -{ - $y_legend = new y_legend($yaxis_label ); - $y_legend->set_style( '{font-size: 20px; color: #000000}' ); - $chart->set_y_legend( $y_legend ); -} - -if (isset($xaxis_label)) -{ - $x_legend = new x_legend($xaxis_label ); - $x_legend->set_style( '{font-size: 20px; color: #000000}' ); - $chart->set_x_legend( $x_legend ); -} -echo $chart->toPrettyString(); -?> \ No newline at end of file diff --git a/application/views/reports/graphs/hbar.php b/application/views/reports/graphs/hbar.php deleted file mode 100644 index 10463f5c4..000000000 --- a/application/views/reports/graphs/hbar.php +++ /dev/null @@ -1,61 +0,0 @@ -output->set_header("Cache-Control: no-store, no-cache, must-revalidate"); -$this->output->set_header("Pragma: public"); - -$title = new title($title); - -$hbar = new hbar( '#86BBEF' ); -$hbar->set_tooltip($this->lang->line('reports_revenue').': #val#' ); -$y_labels = array(); -$max_value = 0; -foreach($data as $label=>$value) -{ - if ($max_value < $value) - { - $max_value = $value; - } - $y_labels[] = (string)$label; - $hbar->append_value( new hbar_value(0,(float)$value) ); -} -$chart = new open_flash_chart(); -$chart->set_title( $title ); -$chart->add_element( $hbar ); - -$step_count = $max_value > 0 ? $max_value/10 : 1; -$x = new x_axis(); -$x->set_offset( false ); -$x->set_steps($max_value/10); - -$chart->set_x_axis( $x ); - -$y = new y_axis(); -$y->set_offset( true ); -$y->set_labels(array_reverse($y_labels)); -$chart->add_y_axis( $y ); - -if (isset($yaxis_label)) -{ - $y_legend = new y_legend($yaxis_label ); - $y_legend->set_style( '{font-size: 20px; color: #000000}' ); - $chart->set_y_legend( $y_legend ); -} - -if (isset($xaxis_label)) -{ - $x_legend = new x_legend($xaxis_label ); - $x_legend->set_style( '{font-size: 20px; color: #000000}' ); - $chart->set_x_legend( $x_legend ); -} - -$chart->set_bg_colour("#f3f3f3"); - -$tooltip = new tooltip(); -$tooltip->set_hover(); -$tooltip->set_stroke( 1 ); -$tooltip->set_colour( "#000000" ); -$tooltip->set_background_colour( "#ffffff" ); -$chart->set_tooltip( $tooltip ); - - -echo $chart->toPrettyString(); -?> \ No newline at end of file diff --git a/application/views/reports/graphs/line.php b/application/views/reports/graphs/line.php deleted file mode 100644 index 62fa570e6..000000000 --- a/application/views/reports/graphs/line.php +++ /dev/null @@ -1,49 +0,0 @@ -output->set_header("Cache-Control: no-store, no-cache, must-revalidate"); -$this->output->set_header("Pragma: public"); -$line_data = array(); -$labels = array(); -foreach($data as $label=>$value) -{ - $line_data[] = (float)$value; - $labels[] = (string)$label; -} - -$hol = new hollow_dot(); -$hol->size(3)->halo_size(1)->tooltip('#x_label#
                      #val#'); - -$line = new line(); -$line->set_default_dot_style($hol); -$line->set_values($line_data); - -$chart = new open_flash_chart(); -$chart->set_title(new title($title)); -$chart->add_element($line); - -$x = new x_axis(); -$x->steps(count($data) > 10 ? (int)(count($data)/4) : 1); -$x->set_labels_from_array($labels); -$chart->set_x_axis( $x ); - -$y = new y_axis(); -$y->set_tick_length(7); -$y->set_range(0, (count($data) > 0 ? max($data) : 0) + 25, ((count($data) > 0 ? max($data) : 0)+25)/10); -$chart->set_y_axis( $y ); -$chart->set_bg_colour("#f3f3f3"); - -if (isset($yaxis_label)) -{ - $y_legend = new y_legend($yaxis_label ); - $y_legend->set_style( '{font-size: 20px; color: #000000}' ); - $chart->set_y_legend( $y_legend ); -} - -if (isset($xaxis_label)) -{ - $x_legend = new x_legend($xaxis_label ); - $x_legend->set_style( '{font-size: 20px; color: #000000}' ); - $chart->set_x_legend( $x_legend ); -} - -echo $chart->toPrettyString(); -?> \ No newline at end of file diff --git a/application/views/reports/graphs/pie.php b/application/views/reports/graphs/pie.php deleted file mode 100644 index fda94d8b6..000000000 --- a/application/views/reports/graphs/pie.php +++ /dev/null @@ -1,25 +0,0 @@ -output->set_header("Cache-Control: no-store, no-cache, must-revalidate"); -$this->output->set_header("Pragma: public"); -$title = new title($title); - -$pie = new pie(); -$pie->set_alpha(0.6); -$pie->set_start_angle( 35 ); -$pie->add_animation( new pie_fade() ); -$pie->set_tooltip( '#val# of #total#
                      #percent# of 100%' ); -$pie->set_colours(get_random_colors(count($data))); - -$pie_values = array(); -foreach($data as $label=>$value) -{ - $pie_values[] = new pie_value((float)$value, (string)$label); -} -$pie->set_values($pie_values); -$chart = new open_flash_chart(); -$chart->set_title( $title ); -$chart->set_bg_colour("#f3f3f3"); -$chart->add_element( $pie ); -$chart->x_axis = null; -echo $chart->toPrettyString(); -?> \ No newline at end of file diff --git a/application/views/reports/listing.php b/application/views/reports/listing.php deleted file mode 100644 index 44728e8c6..000000000 --- a/application/views/reports/listing.php +++ /dev/null @@ -1,63 +0,0 @@ - -load->view("partial/header"); ?> -
                      lang->line('reports_reports'); ?>
                      -"; -} -?> -load->view("partial/footer"); ?> - - diff --git a/application/views/reports/specific_input.php b/application/views/reports/specific_input.php deleted file mode 100644 index 7bb1710ac..000000000 --- a/application/views/reports/specific_input.php +++ /dev/null @@ -1,90 +0,0 @@ -load->view("partial/header"); ?> -
                      lang->line('reports_report_input'); ?>
                      -".$error.""; -} -?> - lang->line('reports_date_range'), 'report_date_range_label', array('class'=>'required')); ?> -
                      - - -
                      - -
                      - - - - - - - - - -
                      - - 'required')); ?> - -
                      - -
                      - - lang->line('reports_sale_type'), 'reports_sale_type_label', array('class'=>'required')); ?> -
                      - $this->lang->line('reports_all'), 'sales' => $this->lang->line('reports_sales'), 'returns' => $this->lang->line('reports_returns')), 'all', 'id="sale_type"'); ?> -
                      - -
                      - Export to Excel: Yes - No -
                      - -'generate_report', - 'id'=>'generate_report', - 'content'=>$this->lang->line('common_submit'), - 'class'=>'submit_button') -); -?> - -load->view("partial/footer"); ?> - - \ No newline at end of file diff --git a/application/views/reports/tabular.php b/application/views/reports/tabular.php deleted file mode 100644 index 41643227b..000000000 --- a/application/views/reports/tabular.php +++ /dev/null @@ -1,70 +0,0 @@ -load->view("partial/header_excel"); -}else{ - $this->load->view("partial/header"); -} -?> -
                      -
                      -
                      - - - - - - - - - - - - - - - - - -
                      -
                      -
                      -$value) { ?> -
                      lang->line('reports_'.$name). ': '.to_currency($value); ?>
                      - -
                      -load->view("partial/footer_excel"); - $content = ob_end_flush(); - - $filename = trim($filename); - $filename = str_replace(array(' ', '/', '\\'), '', $title); - $filename .= "_Export.xls"; - header('Content-type: application/ms-excel'); - header('Content-Disposition: attachment; filename='.$filename); - echo $content; - die(); - -}else{ - $this->load->view("partial/footer"); -?> - - - \ No newline at end of file diff --git a/application/views/reports/tabular_details.php b/application/views/reports/tabular_details.php deleted file mode 100644 index 133a749a4..000000000 --- a/application/views/reports/tabular_details.php +++ /dev/null @@ -1,102 +0,0 @@ -load->view("partial/header_excel"); -}else{ - $this->load->view("partial/header"); -} -?> -
                      -
                      -
                      - - - - - - - - - - - $row) { ?> - - - - - - - - - - - -
                      +
                      +
                      - - - - - - - - - - - - - - - - - - - -
                      - -
                      -
                      -
                      -$value) { ?> -
                      lang->line('reports_'.$name). ': '.to_currency($value); ?>
                      - -
                      -load->view("partial/footer_excel"); - $content = ob_end_flush(); - - $filename = trim($filename); - $filename = str_replace(array(' ', '/', '\\'), '', $title); - $filename .= "_Export.xls"; - header('Content-type: application/ms-excel'); - header('Content-Disposition: attachment; filename='.$filename); - echo $content; - die(); - -}else{ - $this->load->view("partial/footer"); -?> - - \ No newline at end of file diff --git a/application/views/sales/delete.php b/application/views/sales/delete.php deleted file mode 100644 index 56d182282..000000000 --- a/application/views/sales/delete.php +++ /dev/null @@ -1,18 +0,0 @@ -load->view("partial/header"); ?> -
                      - -

                      lang->line('sales_delete_successful'); ?>

                      - -

                      lang->line('sales_delete_unsuccessful'); ?>

                      - -
                      -load->view("partial/footer"); ?> \ No newline at end of file diff --git a/application/views/sales/edit.php b/application/views/sales/edit.php deleted file mode 100644 index a93f7577f..000000000 --- a/application/views/sales/edit.php +++ /dev/null @@ -1,109 +0,0 @@ -load->view("partial/header"); ?> -
                      -

                      lang->line('sales_edit_sale'); ?> POS

                      - - 'sales_edit_form')); ?> -
                        - -
                        - lang->line('sales_receipt').':', 'customer'); ?> -
                        - '_blank'));?> -
                        -
                        - -
                        - lang->line('sales_date').':', 'date'); ?> -
                        - 'date','value'=>date('m/d/Y', strtotime($sale_info['sale_time'])), 'id'=>'date'));?> -
                        -
                        - -
                        - lang->line('sales_customer').':', 'customer'); ?> -
                        - -
                        -
                        - -
                        - lang->line('sales_employee').':', 'employee'); ?> -
                        - -
                        -
                        - -
                        - lang->line('sales_comment').':', 'comment'); ?> -
                        - 'comment','value'=>$sale_info['comment'],'rows'=>'4','cols'=>'23', 'id'=>'comment'));?> -
                        -
                        - - 'submit', - 'id'=>'submit', - 'value'=>$this->lang->line('common_submit'), - 'class'=>'submit_button float_left') - ); - ?> - - 'sales_delete_form')); ?> - 'submit', - 'id'=>'submit', - 'value'=>$this->lang->line('sales_delete_entire_sale'), - 'class'=>'delete_button float_right') - ); - ?> - - -
                        -
                        -load->view("partial/footer"); ?> - - \ No newline at end of file diff --git a/application/views/sales/receipt.php b/application/views/sales/receipt.php deleted file mode 100644 index e030f6602..000000000 --- a/application/views/sales/receipt.php +++ /dev/null @@ -1,120 +0,0 @@ -load->view("partial/header"); ?> -'.$error_message.''; - exit; -} -?> -
                        -
                        -
                        config->item('company'); ?>
                        -
                        config->item('address')); ?>
                        -
                        config->item('phone'); ?>
                        -
                        -
                        -
                        -
                        - -
                        lang->line('customers_customer').": ".$customer; ?>
                        - -
                        lang->line('sales_id').": ".$sale_id; ?>
                        -
                        lang->line('employees_employee').": ".$employee; ?>
                        -
                        - - - - - - - - - - - $item) - { - ?> - - - - - - - - - - - - - - - - - - - - - - $value) { ?> - - - - - - - - - - - - - - $payment) - { ?> - - - - - - - - - - - - - - -
                        lang->line('sales_item_number'); ?>lang->line('items_item'); ?>lang->line('common_price'); ?>lang->line('sales_quantity'); ?>lang->line('sales_discount'); ?>lang->line('sales_total'); ?>
                        lang->line('sales_sub_total'); ?>
                        :
                        lang->line('sales_total'); ?>
                         
                        lang->line('sales_payment'); ?>
                         
                        lang->line('sales_change_due'); ?>
                        - -
                        - config->item('return_policy')); ?> -
                        -
                        - "; ?> -
                        -
                        -load->view("partial/footer"); ?> - -Appconfig->get('print_after_sale')) -{ -?> - - \ No newline at end of file diff --git a/application/views/sales/receipt_email.php b/application/views/sales/receipt_email.php deleted file mode 100644 index 721fc976c..000000000 --- a/application/views/sales/receipt_email.php +++ /dev/null @@ -1,95 +0,0 @@ -
                        -
                        -
                        config->item('company'); ?>
                        -
                        config->item('address')); ?>
                        -
                        config->item('phone'); ?>
                        -
                        -
                        -
                        -
                        - -
                        lang->line('customers_customer').": ".$customer; ?>
                        - -
                        lang->line('sales_id').": ".$sale_id; ?>
                        -
                        lang->line('employees_employee').": ".$employee; ?>
                        -
                        - - - - - - - - - - - $item) - { - ?> - - - - - - - - - - - - - - - - - - - - - - $value) { ?> - - - - - - - - - - - - - - $payment) - { ?> - - - - - - - - - - - - - - -
                        lang->line('sales_item_number'); ?>lang->line('items_item'); ?>lang->line('common_price'); ?>lang->line('sales_quantity'); ?>lang->line('sales_discount'); ?>lang->line('sales_total'); ?>
                        lang->line('sales_sub_total'); ?>
                        :
                        lang->line('sales_total'); ?>
                         
                        lang->line('sales_payment'); ?>
                         
                        lang->line('sales_change_due'); ?>
                        - -
                        - config->item('return_policy')); ?> -
                        -
                        \ No newline at end of file diff --git a/application/views/sales/register.php b/application/views/sales/register.php deleted file mode 100644 index 1853117e8..000000000 --- a/application/views/sales/register.php +++ /dev/null @@ -1,494 +0,0 @@ -load->view("partial/header"); ?> -
                        lang->line('sales_register'); ?>
                        -".$error.""; -} - -if (isset($warning)) -{ - echo "
                        ".$warning."
                        "; -} - -if (isset($success)) -{ - echo "
                        ".$success."
                        "; -} -?> -
                        -'mode_form')); ?> - lang->line('sales_mode') ?> - -
                        - ".$this->lang->line('sales_suspended_sales')."
                        ", - array('class'=>'thickbox none','title'=>$this->lang->line('sales_suspended_sales'))); - ?> -
                        - -'add_item_form')); ?> - -'item','id'=>'item','size'=>'40'));?> -
                        - ".$this->lang->line('sales_new_item')."
                        ", - array('class'=>'thickbox none','title'=>$this->lang->line('sales_new_item'))); - ?> - - - - - - - - - - - - - - - - - - - -$item) - { - $cur_item_info = $this->Item->get_info($item['item_id']); - echo form_open("sales/edit_item/$line"); - ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                        lang->line('common_delete'); ?>lang->line('sales_item_number'); ?>lang->line('sales_item_name'); ?>lang->line('sales_price'); ?>lang->line('sales_quantity'); ?>lang->line('sales_discount'); ?>lang->line('sales_total'); ?>lang->line('sales_edit'); ?>
                        -
                        lang->line('sales_no_items_in_cart'); ?>
                        -
                        lang->line('common_delete').']');?>
                        [quantity; ?> in stock]
                        'price','value'=>$item['price'],'size'=>'6'));?> - 'quantity','value'=>$item['quantity'],'size'=>'2')); - } - ?> - 'discount','value'=>$item['discount'],'size'=>'3'));?>lang->line('sales_edit_item'));?>
                        lang->line('sales_description_abbrv').':';?> - - 'description','value'=>$item['description'],'size'=>'20')); - } - else - { - if ($item['description']!='') - { - echo $item['description']; - echo form_hidden('description',$item['description']); - } - else - { - echo 'None'; - echo form_hidden('description',''); - } - } - ?> -   - lang->line('sales_serial').':'; - } - ?> - - 'serialnumber','value'=>$item['serialnumber'],'size'=>'20')); - } - else - { - echo form_hidden('serialnumber', ''); - } - ?> -
                        - - - -
                        - lang->line("sales_customer").': '.$customer. '
                        '; - echo anchor("sales/remove_customer",'['.$this->lang->line('common_remove').' '.$this->lang->line('customers_customer').']'); - } - else - { - echo form_open("sales/select_customer",array('id'=>'select_customer_form')); ?> - - 'customer','id'=>'customer','size'=>'30','value'=>$this->lang->line('sales_start_typing_customer_name')));?> - -
                        -

                        lang->line('common_or'); ?>

                        - ".$this->lang->line('sales_new_customer')."
                        ", - array('class'=>'thickbox none','title'=>$this->lang->line('sales_new_customer'))); - ?> -
                        -
                         
                        - - -
                        -
                        lang->line('sales_sub_total'); ?>:
                        -
                        - - $value) { ?> -
                        :
                        -
                        - - -
                        lang->line('sales_total'); ?>:
                        -
                        -
                        - - - - - 0) - { - ?> - -
                        - 'cancel_sale_form')); ?> -
                        - lang->line('sales_cancel_sale'); ?> -
                        - -
                        -
                         
                        - 0) - { - ?> -
                        - 'finish_sale_form')); ?> - - 'comment', 'id' => 'comment', 'value'=>$comment,'rows'=>'4','cols'=>'23'));?> -

                        - - lang->line('sales_email_receipt'). ': '. form_checkbox(array( - 'name' => 'email_receipt', - 'id' => 'email_receipt', - 'value' => '1', - 'checked' => (boolean)$email_receipt, - )).'
                        ('.$customer_email.')
                        '; - } - - if ($payments_cover_total) - { - echo "
                        ".$this->lang->line('sales_complete_sale')."
                        "; - } - echo "
                        ".$this->lang->line('sales_suspend_sale')."
                        "; - ?> -
                        - - - - - - - - - - - - -
                        - -
                        - -
                        - - 'add_payment_form')); ?> - - - - - - - - - -
                        - lang->line('sales_payment').': ';?> - - -
                        - lang->line('sales_amount_tendered').': ';?> - - 'amount_tendered','id'=>'amount_tendered','value'=>to_currency_no_money($amount_due),'size'=>'10')); ?> -
                        -
                        - lang->line('sales_add_payment'); ?> -
                        -
                        - - - 0) - { - ?> - - - - - - - - - - - - $payment) - { - echo form_open("sales/edit_payment/$payment_id",array('id'=>'edit_payment_form'.$payment_id)); - ?> - - - - - - - - - - - - -
                        lang->line('common_delete'); ?>
                        lang->line('common_delete').']');?>
                        -
                        - - - - -
                        - - - -
                         
                        - - -load->view("partial/footer"); ?> - - diff --git a/application/views/sales/suspended.php b/application/views/sales/suspended.php deleted file mode 100644 index d84667cfe..000000000 --- a/application/views/sales/suspended.php +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -
                        lang->line('sales_suspended_sale_id'); ?>lang->line('sales_date'); ?>lang->line('sales_customer'); ?>lang->line('sales_comments'); ?>lang->line('sales_unsuspend_and_delete'); ?>
                        - Customer->get_info($suspended_sale['customer_id']); - echo $customer->first_name. ' '. $customer->last_name; - } - else - { - ?> -   - - - -
                        \ No newline at end of file diff --git a/application/views/suppliers/form.php b/application/views/suppliers/form.php deleted file mode 100644 index fb7bffff1..000000000 --- a/application/views/suppliers/form.php +++ /dev/null @@ -1,78 +0,0 @@ -person_id,array('id'=>'supplier_form')); -?> -
                        lang->line('common_fields_required_message'); ?>
                        -
                          -
                          -lang->line("suppliers_basic_information"); ?> - -
                          -lang->line('suppliers_company_name').':', 'company_name', array('class'=>'required')); ?> -
                          - 'company_name', - 'id'=>'company_name_input', - 'value'=>$person_info->company_name) - );?> -
                          -
                          - -load->view("people/form_basic_info"); ?> -
                          -lang->line('suppliers_account_number').':', 'account_number'); ?> -
                          - 'account_number', - 'id'=>'account_number', - 'value'=>$person_info->account_number) - );?> -
                          -
                          -'submit', - 'id'=>'submit', - 'value'=>$this->lang->line('common_submit'), - 'class'=>'submit_button float_right') -); -?> -
                          - - \ No newline at end of file diff --git a/application/views/suppliers/manage.php b/application/views/suppliers/manage.php deleted file mode 100644 index db3bb7d71..000000000 --- a/application/views/suppliers/manage.php +++ /dev/null @@ -1,85 +0,0 @@ -load->view("partial/header"); ?> - - -
                          -
                          lang->line('common_list_of').' '.$this->lang->line('module_'.$controller_name); ?>
                          -
                          - ".$this->lang->line($controller_name.'_new')."
                          ", - array('class'=>'thickbox none','title'=>$this->lang->line($controller_name.'_new'))); - ?> -
                          - -pagination->create_links();?> -
                          - -
                          -
                          - -
                          -
                          -load->view("partial/footer"); ?> \ No newline at end of file diff --git a/css/autocomplete.css b/css/autocomplete.css deleted file mode 100644 index a062d0410..000000000 --- a/css/autocomplete.css +++ /dev/null @@ -1,54 +0,0 @@ -.ac_results -{ - padding: 0px; - border: 1px solid black; - background-color: white; - overflow: hidden; - z-index: 99999; -} - -.ac_results ul -{ - width: 100%; - list-style-position: outside; - list-style: none; - padding: 0; - margin: 0; -} - -.ac_results li -{ - margin: 0px; - padding: 2px 5px; - cursor: default; - display: block; - /* - if width will be 100% horizontal scrollbar will apear - when scroll mode will be used - */ - /*width: 100%;*/ - font: menu; - font-size: 12px; - /* - it is very important, if line-height not setted or setted - in relative units scroll will be broken in firefox - */ - line-height: 16px; - overflow: hidden; -} - -.ac_loading -{ - background: white url('../images/spinner_small.gif') right center no-repeat; -} - -.ac_odd -{ - background-color: #eee; -} - -.ac_over -{ - background-color: #0A246A; - color: white; -} diff --git a/css/datepicker.css b/css/datepicker.css deleted file mode 100644 index 2b2a12805..000000000 --- a/css/datepicker.css +++ /dev/null @@ -1,153 +0,0 @@ -table.jCalendar { - border: 1px solid #000; - background: #aaa; - border-collapse: separate; - border-spacing: 2px; -} -table.jCalendar th { - background: #333; - color: #fff; - font-weight: bold; - padding: 3px 5px; -} - -table.jCalendar td { - background: #ccc; - color: #000; - padding: 3px 5px; - text-align: center; -} -table.jCalendar td.other-month { - background: #ddd; - color: #aaa; -} -table.jCalendar td.today { - background: #666; - color: #fff; -} -table.jCalendar td.selected { - background: #f66; - color: #fff; -} -table.jCalendar td.selected.dp-hover { - background: #f33; - color: #fff; -} -table.jCalendar td.dp-hover, -table.jCalendar tr.activeWeekHover td { - background: #fff; - color: #000; -} -table.jCalendar tr.selectedWeek td { - background: #f66; - color: #fff; -} -table.jCalendar td.disabled, table.jCalendar td.disabled.dp-hover { - background: #bbb; - color: #888; -} -table.jCalendar td.unselectable, -table.jCalendar td.unselectable:hover, -table.jCalendar td.unselectable.dp-hover { - background: #bbb; - color: #888; -} - -/* For the popup */ - -/* NOTE - you will probably want to style a.dp-choose-date - see how I did it in demo.css */ - -div.dp-popup { - position: relative; - background: #ccc; - font-size: 10px; - font-family: arial, sans-serif; - padding: 2px; - width: 171px; - line-height: 1.2em; -} -div#dp-popup { - position: absolute; - z-index: 199; -} -div.dp-popup h2 { - font-size: 12px; - text-align: center; - margin: 2px 0; - padding: 0; -} -a#dp-close { - font-size: 11px; - padding: 4px 0; - text-align: center; - display: block; -} -a#dp-close:hover { - text-decoration: underline; -} -div.dp-popup a { - color: #000; - text-decoration: none; - padding: 3px 2px 0; -} -div.dp-popup div.dp-nav-prev { - position: absolute; - top: 2px; - left: 4px; - width: 100px; -} -div.dp-popup div.dp-nav-prev a { - float: left; -} -/* Opera needs the rules to be this specific otherwise it doesn't change the cursor back to pointer after you have disabled and re-enabled a link */ -div.dp-popup div.dp-nav-prev a, div.dp-popup div.dp-nav-next a { - cursor: pointer; -} -div.dp-popup div.dp-nav-prev a.disabled, div.dp-popup div.dp-nav-next a.disabled { - cursor: default; -} -div.dp-popup div.dp-nav-next { - position: absolute; - top: 2px; - right: 4px; - width: 100px; -} -div.dp-popup div.dp-nav-next a { - float: right; -} -div.dp-popup a.disabled { - cursor: default; - color: #aaa; -} -div.dp-popup td { - cursor: pointer; -} -div.dp-popup td.disabled { - cursor: default; -} - -/* located in demo.css and creates a little calendar icon - * instead of a text link for "Choose date" - */ -a.dp-choose-date { - float: left; - width: 16px; - height: 16px; - padding: 0; - margin: 0px 3px 0; - display: block; - text-indent: -2000px; - overflow: hidden; - background: url(../images/calendar.png) no-repeat; -} -a.dp-choose-date.dp-disabled { - background-position: 0 -20px; - cursor: default; -} -/* makes the input field shorter once the date picker code - * has run (to allow space for the calendar icon - */ -input.dp-applied { - width: 100px; - float: left; -} \ No newline at end of file diff --git a/css/editsale.css b/css/editsale.css deleted file mode 100644 index 2ba8f43a9..000000000 --- a/css/editsale.css +++ /dev/null @@ -1,11 +0,0 @@ -#edit_sale_wrapper -{ - margin: 0 auto; - padding-bottom: 50px; - width: 60%; -} - -#edit_sale_wrapper h1 -{ - text-align: center; -} \ No newline at end of file diff --git a/css/general.css b/css/general.css deleted file mode 100644 index 6ec44889e..000000000 --- a/css/general.css +++ /dev/null @@ -1,154 +0,0 @@ -.field_row -{ - margin: 0 0 10px 0; -} - -.field_row label -{ - float:left; - width:100px; - text-align:left; - line-height:2.3; -} - -.field_row label.wide -{ - width:150px; -} - -label.required -{ - color:red; -} - -.form_field -{ - float:left; - padding: 3px; - background-color: #f2f2f2; -} - -.form_field input, .form_field textarea -{ - border: 1px solid #ccc; - padding: 4px; -} - -.submit_button -{ - padding: 5px; - color: #fff; - background-color: #0a6184; - border: 2px solid #ddd; -} - -.delete_button -{ - padding: 5px; - color: #fff; - background-color: #ea4729; - border: 2px solid #ddd; -} -.small_button -{ - position:relative; - width:95px; - height:30px; - background-image: url(../images/small_action_button.jpg); - background-repeat:no-repeat; - cursor:pointer; -} -.small_button span -{ - position:absolute; - width:100%; - top:30%; - left:0%; - color:#FFF; - font-size:11px; - font-weight:bold; - text-align:center; -} - -.float_left -{ - float:left; -} - -.float_right -{ - float:right; -} - -.big_button -{ - position:relative; - width:119px; - height:45px; - background-image: url(../images/big_action_button.jpg); - background-repeat:no-repeat; - cursor:pointer; -} - -.big_button span -{ - position:absolute; - width:100%; - top:35%; - color:#FFF; - font-size:13px; - font-weight:bold; - text-align:center; -} - - -.warning_message -{ - text-align:center; - background-color:#fffcdd; - border:1px solid #fff4aa; - font-weight:bold; -} - -.error_message -{ - text-align:center; - background-color:#f68383; - border:1px solid #da3232; - font-weight:bold; -} - -.warning_mesage -{ - text-align:center; - background-color:#FBEC5D; - border:1px solid #da3232; - font-weight:bold; -} - -.success_message -{ - text-align:center; - background-color:#e1ffdd; - border:1px solid #2ca71c; - font-weight:bold; -} - -input -{ - font-family:arial; - padding: 3px; -} - -.clearfix:after -{ - content: "."; - display: block; - clear: both; - visibility: hidden; - line-height: 0; - height: 0; -} -.clearfix { display: inline-block; } -html[xmlns] .clearfix { display: block; } -* html .clearfix { height: 1%; } diff --git a/css/login.css b/css/login.css deleted file mode 100644 index 30809f1cf..000000000 --- a/css/login.css +++ /dev/null @@ -1,84 +0,0 @@ -body -{ - text-align:center; -} -#container -{ - position:relative; - margin-left:auto; - margin-right:auto; - margin-top:20px; - width:360px; - -} - -#top -{ - position:relative; - width:100%; - height:20px; - padding:2px; - background-color:#005B7F; - text-align:center; - font-family:Verdana; - color:white; - font-size:12pt; -} - -#login_form -{ - position:relative; - width:100%; - height:230px; - padding:2px; - font-family:Verdana; - color:white; - font-size:10pt; - background-color:#A7A7A7; -} - -#welcome_message -{ - text-align:center; - margin-top:10px; - margin-bottom:20px; -} - -.error -{ - margin:0 auto; - border:3px solid #d3153b; - background-color:#fbe6f2; - padding:5px; - width:80%; - text-align:center; - font-size:18px; - margin-bottom:20px; - -} - -.form_field_label -{ - float:left; - margin-left:20px; - width:30%; -} - -.form_field -{ - float:left; - width:30%; -} - -#submit_button -{ - position:absolute; - bottom:60px; - right:60px; -} - -input -{ - font-family:Arial; -} - diff --git a/css/menubar.css b/css/menubar.css deleted file mode 100644 index fe2133d1f..000000000 --- a/css/menubar.css +++ /dev/null @@ -1,93 +0,0 @@ -#menubar -{ - position:relative; - margin:0px; - padding:0px; - background-image: url("../images/menubar/menubar_bg.gif"); - background-repeat: repeat-x; - width:100%; - height:100px; - color:#FFFFFF; - text-align:left; - text-align:center; -} - -#menubar_container -{ - position:relative; - margin:0 auto; - width:875px; - text-align:left; -} - -.menu_item -{ - float:left; - width:65px; - height:100%; - text-align:center; -} - - -#menubar a:link, #menubar a:visited, #menubar a -{ - color:#FFFFFF; - text-decoration:underline; -} - -#menubar a:hover -{ - color:#CCCCCC; - text-decoration:underline; -} - -.menu_item -{ - font-size:8pt; -} - -#menubar_company_info -{ - position:absolute; - left:0px; - top:18px; - width:250px; - height:55%; -} - -#company_title -{ - font-size:14pt; - font-weight:bold; -} - -#menubar_navigation -{ - position:relative; - width:75%; - left:200px; - top:8px; - height:45%; -} - -#menubar_footer -{ - position:absolute; - top:80px; - left:0px; - height:17%; - padding-top:3px; - font-size:8pt; - font-weight:bold; -} - -#menubar_date -{ - position:absolute; - top:80px; - right:0px; - height:17%; - padding-top:3px; - font-size:8pt; - font-weight:bold; -} \ No newline at end of file diff --git a/css/ospos.css b/css/ospos.css deleted file mode 100644 index 7cbf4c522..000000000 --- a/css/ospos.css +++ /dev/null @@ -1,149 +0,0 @@ -@import url(autocomplete.css); -@import url(menubar.css); -@import url(general.css); -@import url(popupbox.css); -@import url(register.css); -@import url(receipt.css); -@import url(reports.css); -@import url(tables.css); -@import url(thickbox.css); -@import url(datepicker.css); -@import url(editsale.css); - -body -{ - margin:0px; - padding:0px; - background-color:#f7f7f7; -} - -a.none -{ - text-decoration:none; -} - - -#content_area_wrapper -{ - position:relative; - width:100%; - background-color:#FFFFFF; - margin:0px; - padding:0px; - border-bottom:1px solid #CCCCCC; - text-align:center; - -} - -#content_area -{ - position:relative; - margin:0 auto; - width:875px; - text-align:left; - -} - -#title_bar -{ - position:relative; - margin-top:10px; - margin-bottom:10px; - width:100%; - height:50px; -} - -#title -{ - position:absolute; - bottom:0px; - left:0px; - font-size:30px; - font-weight:bold; - color:#000000; -} - -#page_title -{ - margin-top:8px; - font-size:30px; - font-weight:bold; - color:#000000; - text-align:center; - -} - -#page_subtitle -{ - margin-top:8px; - font-size:16px; - font-weight:bold; - color:#000000; - text-align:center; -} - -#new_button -{ - position:absolute; - bottom:-5px; - right:0px; -} - -#spinner -{ - position:absolute; - display:none; - right:21%; - top:5px; -} - -#feedback_bar -{ - position:fixed; - bottom:0; - left:0; - width:100%; - height:55px; - position:fixed; - opacity: 0; - filter: alpha(opacity=0); - z-index:1; - line-height:3.3; -} - -#home_module_list -{ - position: relative; -} - -.module_item -{ - padding: 10px; -} - -#config_wrapper -{ - text-align:center; -} - -#config_info -{ - width:70%; - margin:0 auto; - padding:10px; - margin-bottom:30px; - margin-top:10px; - text-align:left; -} - -#footer -{ - position:relative; - margin-top:25px; - margin-bottom:15px; - text-align:center; - font-size:11px; - color:#777777; - clear:both; - -} diff --git a/css/ospos_print.css b/css/ospos_print.css deleted file mode 100644 index 9e29b4149..000000000 --- a/css/ospos_print.css +++ /dev/null @@ -1,41 +0,0 @@ -body -{ - background-color:#FFFFFF; - font-size:75%; -} - -#menubar,#footer -{ - display:none; -} - -#content_area -{ - width:100%; -} - -#content_area_wrapper -{ - border:0px; -} - -#sale_return_policy -{ - width:100%; - text-align:center; -} - -.long_name -{ - display:none; -} - -.short_name -{ - display:inline; -} - -#receipt_items td -{ - white-space:nowrap; -} diff --git a/css/popupbox.css b/css/popupbox.css deleted file mode 100644 index 0d8c00438..000000000 --- a/css/popupbox.css +++ /dev/null @@ -1,101 +0,0 @@ -#required_fields_message -{ - width: 100%; - text-align: center; - margin-bottom: 3px; - font-style: italic; -} - -#customer_basic_info,#item_basic_info,#item_number_info,#supplier_basic_info -{ - padding:5px; - -} - -#scan_item_number.loading -{ - background-image: url(../images/spinner_small.gif); - background-position:center right; - background-repeat:no-repeat; - -} - -#info_provided_by -{ - display:none; - font-weight:bold; -} - -#employee_basic_info -{ - float:left; - width:47%; - padding:5px; -} - -#employee_login_info -{ - float:left; - width:47%; - margin-left:5px; - padding:5px; -} - -#permission_list -{ - list-style:none; -} - -#permission_list li -{ - padding:5px; -} - -#permission_list input -{ - top:3px; -} - -#employee_permission_info -{ - float:left; - width:47%; - margin-left:5px; - padding:5px; -} -#employee_permission_info p -{ - font-weight:bold; -} - -#employee_permission_info span.small -{ - font-style:italic; - font-size:80%; -} - -#error_message_box -{ - margin-bottom:7px; - margin-left:20px; - color:red; -} -#item_kit_items_title -{ - text-align: center; -} -#item_kit_items -{ - width: 100%; -} - -#item_kit_items th -{ - text-align: center; - font-weight: bold; -} - -#item_kit_items td -{ - text-align: center; -} \ No newline at end of file diff --git a/css/receipt.css b/css/receipt.css deleted file mode 100644 index d891460b4..000000000 --- a/css/receipt.css +++ /dev/null @@ -1,60 +0,0 @@ -#receipt_wrapper -{ - font-family:Arial; - width:100%; -} - -#receipt_header -{ - text-align:center; -} - -#company_name -{ - font-size:150%; - font-weight:bold; -} - -#company_phone -{ - margin-bottom:15px; - -} - -#sale_time -{ - margin-bottom:5px; -} - -#receipt_items -{ - position:relative; - border-collapse:collapse; - margin-top:15px; - margin-bottom:15px; - width:100%; -} - -#receipt_items td -{ - position:relative; - padding:3px; -} - -.short_name -{ - display:none; -} - -#sale_return_policy -{ - width:80%; - margin:0 auto; - text-align:center; -} - -#barcode -{ - margin-top:10px; - text-align:center; -} \ No newline at end of file diff --git a/css/register.css b/css/register.css deleted file mode 100644 index 090886586..000000000 --- a/css/register.css +++ /dev/null @@ -1,165 +0,0 @@ -#register_wrapper -{ - float:left; - width:70%; - font-family:Arial; - font-size:13px; -} -#mode_form -{ - position:relative; - background-color:#DDD; - padding: 8px 0px 8px 0px; -} - -#show_suspended_sales_button -{ - position:absolute; - top:3px; - right:4px; -} - -#mode_form span -{ - font-weight:bold; -} - -#add_item_form -{ - position:relative; - background-color:#BBBBBB; - width:100%; - padding: 8px 0px 8px 0px; - -} - -#new_item_button_register -{ - position:absolute; - top:3px; - right:4px; -} - -#add_item_form input -{ - border: 1px solid #ccc; - padding: 2px; - -} - -#item_label,#customer_label -{ - font-weight:bold; -} - -#add_item_form label -{ - margin: 0px 5px 0px 5px; -} - -#register -{ - position:relative; - width:100%; - padding:0px; - border-collapse:collapse; -} - -#register th -{ - background-color:#4386a1; - padding:5px; - text-align:center; - color:#FFFFFF; -} - -#register td -{ - background-color:#EEEEEE; - padding:3px; - text-align:center; -} - -#overall_sale -{ - float:left; - margin-left:4px; - background-color:#BBBBBB; - width:28%; - padding:5px; - font-family:Arial; - font-size:13px; - -} - -#sale_details -{ - position:relative; - width:100%; - margin-top:5px; - border-top:2px solid #000; -} - -#finish_sale -{ - position:relative; -} - -#Payment_Types -{ - float:left; - width:100%; - margin-top:5px; - border-top:2px solid #000; - background-color:#DDD; - margin-bottom:0px; - clear:both; -} - -#Cancel_sale -{ - float:left; - width:100%; - margin-top:5px; - clear:both; -} -#suspended_sales_table th -{ - text-align:center; -} - -#suspended_sales_table td -{ - padding: 7px; -} - -#credit_card_form fieldset -{ - overflow: auto; - border: 0; - margin: 0; - padding: 0; -} - -#credit_card_form fieldset div -{ - float: left; -} - -#credit_card_form fieldset.centered div -{ - text-align: center; -} - -#credit_card_form label -{ - display: block; - margin-bottom: 5px; -} - -#credit_card_form input.text -{ - border: 1px solid #bfbab4; - margin: 0 4px 8px 0; -} - diff --git a/css/reports.css b/css/reports.css deleted file mode 100644 index 088071ab3..000000000 --- a/css/reports.css +++ /dev/null @@ -1,26 +0,0 @@ -#report_list li ul li -{ - margin-left: 35px; -} -#report_date_range_simple -{ - margin-bottom: 3px; -} -.report -{ - font-size: .85em; -} -#report_summary -{ - margin: 0 auto; - text-align: center; -} - -#report_summary .summary_row -{ -} - -#chart_wrapper -{ - text-align: center; -} \ No newline at end of file diff --git a/css/tables.css b/css/tables.css deleted file mode 100644 index d734ab881..000000000 --- a/css/tables.css +++ /dev/null @@ -1,126 +0,0 @@ -#table_action_header -{ - position:relative; - width:100%; - background-color:#EEEEEE; - background-image:url(../images/checkbox_arrow.gif); - height:20px; - border-top:1px solid #CCCCCC; - background-position:5px 10px; - background-repeat:no-repeat; - padding:3px 0px 3px 0px; -} - -#table_action_header ul -{ - list-style:none; - padding:0px; - margin:0px; - margin-left:15px; -} - -#table_action_header ul li -{ - margin-left:8px; - margin-right:4px; - -} - -#table_action_header ul li span -{ - background-color:#0a6184; - border:2px solid #DDDDDD; - font-size:14px; - padding:2px 5px 2px 5px; - -} - -#table_action_header a -{ - text-decoration:none; - color:#FFF; -} - -#table_holder -{ - position:relative; - margin-bottom:50px; -} - -table.tablesorter -{ - position:relative; - width:100%; - border-top:3px solid #0a6184; - border-collapse:collapse; -} - -table.tablesorter thead tr th, table.tablesorter tfoot tr th -{ - color:#FFFFFF; - text-align:left; - background-color:#4386a1; - padding: 0px 5px 0px 5px; -} - -table.tablesorter thead tr .header -{ - background-image: url(../images/tables/bg.gif); - background-repeat: no-repeat; - background-position: center right; - cursor: pointer; -} - -table.tablesorter tbody td -{ - color: #3D3D3D; - background-color: #FFF; - vertical-align: top; - padding: 0px 5px 0px 5px; - -} - -table.tablesorter tbody td -{ - border-bottom:1px solid #DDDDDD; -} - -table.tablesorter tbody td.over -{ - background-color:#CCCCCC; -} - -table.tablesorter tbody td.selected -{ - background-color:#BBBBBB; -} - -table.tablesorter thead tr .headerSortUp -{ - background-image: url(../images/tables/asc.gif); -} - -table.tablesorter thead tr .headerSortDown -{ - background-image: url(../images/tables/desc.gif); -} - -table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp -{ - background-color: #8dbdd8; -} - -table.innertable -{ - display: none; -} - -table.innertable thead tr th -{ - background-color: #0a6184; -} - -table.innertable tbody tr td -{ - background-color: #DDD; -} \ No newline at end of file diff --git a/css/thickbox.css b/css/thickbox.css deleted file mode 100644 index 57242c5d4..000000000 --- a/css/thickbox.css +++ /dev/null @@ -1,165 +0,0 @@ -/* ----------------------------------------------------------------------------------------------------------------*/ -/* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/ -/* ----------------------------------------------------------------------------------------------------------------*/ -*{padding: 0; margin: 0;} - -/* ----------------------------------------------------------------------------------------------------------------*/ -/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/ -/* ----------------------------------------------------------------------------------------------------------------*/ -#TB_window { - font: 12px Arial, Helvetica, sans-serif; - color: #333333; -} - -#TB_secondLine { - font: 10px Arial, Helvetica, sans-serif; - color:#666666; -} - -#TB_window a:link {color: #666666;} -#TB_window a:visited {color: #666666;} -#TB_window a:hover {color: #000;} -#TB_window a:active {color: #666666;} -#TB_window a:focus{color: #666666;} - -/* ----------------------------------------------------------------------------------------------------------------*/ -/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/ -/* ----------------------------------------------------------------------------------------------------------------*/ -#TB_overlay { - position: fixed; - z-index:100; - top: 0px; - left: 0px; - height:100%; - width:100%; -} - -.TB_overlayMacFFBGHack {background: url(macFFBgHack.png) repeat;} -.TB_overlayBG { - background-color:#000; - filter:alpha(opacity=75); - -moz-opacity: 0.75; - opacity: 0.75; -} - -* html #TB_overlay { /* ie6 hack */ - position: absolute; - height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); -} - -#TB_window { - position: fixed; - background: #ffffff; - z-index: 102; - color:#000000; - display:none; - border: 4px solid #525252; - text-align:left; - bottom:10%; - left:50%; -} - -* html #TB_window { /* ie6 hack */ -position: absolute; -margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); -} - -#TB_window img#TB_Image { - display:block; - margin: 15px 0 0 15px; - border-right: 1px solid #ccc; - border-bottom: 1px solid #ccc; - border-top: 1px solid #666; - border-left: 1px solid #666; -} - -#TB_caption{ - height:25px; - padding:7px 30px 10px 25px; - float:left; -} - -#TB_closeWindow{ - height:25px; - padding:11px 25px 10px 0; - float:right; -} - -#TB_closeAjaxWindow{ - padding:7px 10px 5px 0; - margin-bottom:1px; - text-align:right; - float:right; -} - -#TB_ajaxWindowTitle{ - float:left; - padding:7px 0 5px 10px; - margin-bottom:1px; -} - -#TB_title{ - background-color:#e8e8e8; - font-size:1.25em; - font-weight:bold; - height:27px; -} - -#TB_ajaxContent{ - clear:both; - padding:2px 15px 15px 15px; - overflow:auto; - text-align:left; - line-height:1.4em; -} - -#TB_ajaxContent.TB_modal{ - padding:15px; -} - -#TB_ajaxContent p{ - padding:5px 0px 5px 0px; -} - -#TB_load{ - position: fixed; - display:none; - height:13px; - width:208px; - z-index:103; - top: 50%; - left: 50%; - margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */ -} - -* html #TB_load { /* ie6 hack */ -position: absolute; -margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); -} - -#TB_HideSelect{ - z-index:99; - position:fixed; - top: 0; - left: 0; - background-color:#fff; - border:none; - filter:alpha(opacity=0); - -moz-opacity: 0; - opacity: 0; - height:100%; - width:100%; -} - -* html #TB_HideSelect { /* ie6 hack */ - position: absolute; - height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); -} - -#TB_iframeContent{ - clear:both; - border:none; - margin-bottom:-1px; - margin-top:1px; - _margin-bottom:1px; -} diff --git a/database/database.sql b/database/database.sql deleted file mode 100644 index c1c06d6a1..000000000 --- a/database/database.sql +++ /dev/null @@ -1,685 +0,0 @@ --- phpMyAdmin SQL Dump --- version 3.3.9 --- http://www.phpmyadmin.net --- --- Host: localhost --- Generation Time: Apr 08, 2011 at 04:27 PM --- Server version: 5.1.54 --- PHP Version: 5.3.3 - --- --- Database: `pos` --- - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_app_config` --- - -CREATE TABLE `ospos_app_config` ( - `key` varchar(255) NOT NULL, - `value` varchar(255) NOT NULL, - PRIMARY KEY (`key`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Dumping data for table `ospos_app_config` --- - -INSERT INTO `ospos_app_config` (`key`, `value`) VALUES -('address', '123 Nowhere street'), -('company', 'Open Source Point of Sale'), -('default_tax_rate', '8'), -('email', 'admin@pappastech.com'), -('fax', ''), -('phone', '555-555-5555'), -('return_policy', 'Test'), -('timezone', 'America/New_York'), -('website', ''); - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_customers` --- - -CREATE TABLE `ospos_customers` ( - `person_id` int(10) NOT NULL, - `account_number` varchar(255) DEFAULT NULL, - `taxable` int(1) NOT NULL DEFAULT '1', - `deleted` int(1) NOT NULL DEFAULT '0', - UNIQUE KEY `account_number` (`account_number`), - KEY `person_id` (`person_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Dumping data for table `ospos_customers` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_employees` --- - -CREATE TABLE `ospos_employees` ( - `username` varchar(255) NOT NULL, - `password` varchar(255) NOT NULL, - `person_id` int(10) NOT NULL, - `deleted` int(1) NOT NULL DEFAULT '0', - UNIQUE KEY `username` (`username`), - KEY `person_id` (`person_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Dumping data for table `ospos_employees` --- - -INSERT INTO `ospos_employees` (`username`, `password`, `person_id`, `deleted`) VALUES -('admin', '439a6de57d475c1a0ba9bcb1c39f0af6', 1, 0); - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_giftcards` --- - -CREATE TABLE `ospos_giftcards` ( - `giftcard_id` int(11) NOT NULL AUTO_INCREMENT, - `giftcard_number` varchar(25) COLLATE utf8_unicode_ci NOT NULL, - `value` double(15,2) NOT NULL, - `deleted` int(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`giftcard_id`), - UNIQUE KEY `giftcard_number` (`giftcard_number`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=48 ; - --- --- Dumping data for table `ospos_giftcards` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_inventory` --- - -CREATE TABLE `ospos_inventory` ( - `trans_id` int(11) NOT NULL AUTO_INCREMENT, - `trans_items` int(11) NOT NULL DEFAULT '0', - `trans_user` int(11) NOT NULL DEFAULT '0', - `trans_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `trans_comment` text NOT NULL, - `trans_inventory` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`trans_id`), - KEY `ospos_inventory_ibfk_1` (`trans_items`), - KEY `ospos_inventory_ibfk_2` (`trans_user`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; - --- --- Dumping data for table `ospos_inventory` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_items` --- - -CREATE TABLE `ospos_items` ( - `name` varchar(255) NOT NULL, - `category` varchar(255) NOT NULL, - `supplier_id` int(11) DEFAULT NULL, - `item_number` varchar(255) DEFAULT NULL, - `description` varchar(255) NOT NULL, - `cost_price` double(15,2) NOT NULL, - `unit_price` double(15,2) NOT NULL, - `quantity` double(15,2) NOT NULL DEFAULT '0.00', - `reorder_level` double(15,2) NOT NULL DEFAULT '0.00', - `location` varchar(255) NOT NULL, - `item_id` int(10) NOT NULL AUTO_INCREMENT, - `allow_alt_description` tinyint(1) NOT NULL, - `is_serialized` tinyint(1) NOT NULL, - `deleted` int(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`item_id`), - UNIQUE KEY `item_number` (`item_number`), - KEY `ospos_items_ibfk_1` (`supplier_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; - --- --- Dumping data for table `ospos_items` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_items_taxes` --- - -CREATE TABLE `ospos_items_taxes` ( - `item_id` int(10) NOT NULL, - `name` varchar(255) NOT NULL, - `percent` double(15,2) NOT NULL, - PRIMARY KEY (`item_id`,`name`,`percent`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Dumping data for table `ospos_items_taxes` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_item_kits` --- - -CREATE TABLE `ospos_item_kits` ( - `item_kit_id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL, - `description` varchar(255) NOT NULL, - PRIMARY KEY (`item_kit_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; - --- --- Dumping data for table `ospos_item_kits` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_item_kit_items` --- - -CREATE TABLE `ospos_item_kit_items` ( - `item_kit_id` int(11) NOT NULL, - `item_id` int(11) NOT NULL, - `quantity` double(15,2) NOT NULL, - PRIMARY KEY (`item_kit_id`,`item_id`,`quantity`), - KEY `ospos_item_kit_items_ibfk_2` (`item_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Dumping data for table `ospos_item_kit_items` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_modules` --- - -CREATE TABLE `ospos_modules` ( - `name_lang_key` varchar(255) NOT NULL, - `desc_lang_key` varchar(255) NOT NULL, - `sort` int(10) NOT NULL, - `module_id` varchar(255) NOT NULL, - PRIMARY KEY (`module_id`), - UNIQUE KEY `desc_lang_key` (`desc_lang_key`), - UNIQUE KEY `name_lang_key` (`name_lang_key`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Dumping data for table `ospos_modules` --- - -INSERT INTO `ospos_modules` (`name_lang_key`, `desc_lang_key`, `sort`, `module_id`) VALUES -('module_config', 'module_config_desc', 100, 'config'), -('module_customers', 'module_customers_desc', 10, 'customers'), -('module_employees', 'module_employees_desc', 80, 'employees'), -('module_giftcards', 'module_giftcards_desc', 90, 'giftcards'), -('module_items', 'module_items_desc', 20, 'items'), -('module_item_kits', 'module_item_kits_desc', 30, 'item_kits'), -('module_receivings', 'module_receivings_desc', 60, 'receivings'), -('module_reports', 'module_reports_desc', 50, 'reports'), -('module_sales', 'module_sales_desc', 70, 'sales'), -('module_suppliers', 'module_suppliers_desc', 40, 'suppliers'); - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_people` --- - -CREATE TABLE `ospos_people` ( - `first_name` varchar(255) NOT NULL, - `last_name` varchar(255) NOT NULL, - `phone_number` varchar(255) NOT NULL, - `email` varchar(255) NOT NULL, - `address_1` varchar(255) NOT NULL, - `address_2` varchar(255) NOT NULL, - `city` varchar(255) NOT NULL, - `state` varchar(255) NOT NULL, - `zip` varchar(255) NOT NULL, - `country` varchar(255) NOT NULL, - `comments` text NOT NULL, - `person_id` int(10) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`person_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; - --- --- Dumping data for table `ospos_people` --- - -INSERT INTO `ospos_people` (`first_name`, `last_name`, `phone_number`, `email`, `address_1`, `address_2`, `city`, `state`, `zip`, `country`, `comments`, `person_id`) VALUES -('John', 'Doe', '555-555-5555', 'admin@pappastech.com', 'Address 1', '', '', '', '', '', '', 1); - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_permissions` --- - -CREATE TABLE `ospos_permissions` ( - `module_id` varchar(255) NOT NULL, - `person_id` int(10) NOT NULL, - PRIMARY KEY (`module_id`,`person_id`), - KEY `person_id` (`person_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Dumping data for table `ospos_permissions` --- - -INSERT INTO `ospos_permissions` (`module_id`, `person_id`) VALUES -('config', 1), -('customers', 1), -('employees', 1), -('giftcards', 1), -('items', 1), -('item_kits', 1), -('receivings', 1), -('reports', 1), -('sales', 1), -('suppliers', 1); - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_receivings` --- - -CREATE TABLE `ospos_receivings` ( - `receiving_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `supplier_id` int(10) DEFAULT NULL, - `employee_id` int(10) NOT NULL DEFAULT '0', - `comment` text NOT NULL, - `receiving_id` int(10) NOT NULL AUTO_INCREMENT, - `payment_type` varchar(20) DEFAULT NULL, - PRIMARY KEY (`receiving_id`), - KEY `supplier_id` (`supplier_id`), - KEY `employee_id` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; - --- --- Dumping data for table `ospos_receivings` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_receivings_items` --- - -CREATE TABLE `ospos_receivings_items` ( - `receiving_id` int(10) NOT NULL DEFAULT '0', - `item_id` int(10) NOT NULL DEFAULT '0', - `description` varchar(30) DEFAULT NULL, - `serialnumber` varchar(30) DEFAULT NULL, - `line` int(3) NOT NULL, - `quantity_purchased` int(10) NOT NULL DEFAULT '0', - `item_cost_price` decimal(15,2) NOT NULL, - `item_unit_price` double(15,2) NOT NULL, - `discount_percent` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`receiving_id`,`item_id`,`line`), - KEY `item_id` (`item_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Dumping data for table `ospos_receivings_items` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_sales` --- - -CREATE TABLE `ospos_sales` ( - `sale_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `customer_id` int(10) DEFAULT NULL, - `employee_id` int(10) NOT NULL DEFAULT '0', - `comment` text NOT NULL, - `sale_id` int(10) NOT NULL AUTO_INCREMENT, - `payment_type` varchar(512) DEFAULT NULL, - PRIMARY KEY (`sale_id`), - KEY `customer_id` (`customer_id`), - KEY `employee_id` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; - --- --- Dumping data for table `ospos_sales` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_sales_items` --- - -CREATE TABLE `ospos_sales_items` ( - `sale_id` int(10) NOT NULL DEFAULT '0', - `item_id` int(10) NOT NULL DEFAULT '0', - `description` varchar(30) DEFAULT NULL, - `serialnumber` varchar(30) DEFAULT NULL, - `line` int(3) NOT NULL DEFAULT '0', - `quantity_purchased` double(15,2) NOT NULL DEFAULT '0.00', - `item_cost_price` decimal(15,2) NOT NULL, - `item_unit_price` double(15,2) NOT NULL, - `discount_percent` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`sale_id`,`item_id`,`line`), - KEY `item_id` (`item_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Dumping data for table `ospos_sales_items` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_sales_items_taxes` --- - -CREATE TABLE `ospos_sales_items_taxes` ( - `sale_id` int(10) NOT NULL, - `item_id` int(10) NOT NULL, - `line` int(3) NOT NULL DEFAULT '0', - `name` varchar(255) NOT NULL, - `percent` double(15,2) NOT NULL, - PRIMARY KEY (`sale_id`,`item_id`,`line`,`name`,`percent`), - KEY `item_id` (`item_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Dumping data for table `ospos_sales_items_taxes` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_sales_payments` --- - -CREATE TABLE `ospos_sales_payments` ( - `sale_id` int(10) NOT NULL, - `payment_type` varchar(40) NOT NULL, - `payment_amount` decimal(15,2) NOT NULL, - PRIMARY KEY (`sale_id`,`payment_type`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Dumping data for table `ospos_sales_payments` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_sales_suspended` --- - -CREATE TABLE `ospos_sales_suspended` ( - `sale_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `customer_id` int(10) DEFAULT NULL, - `employee_id` int(10) NOT NULL DEFAULT '0', - `comment` text NOT NULL, - `sale_id` int(10) NOT NULL AUTO_INCREMENT, - `payment_type` varchar(512) DEFAULT NULL, - PRIMARY KEY (`sale_id`), - KEY `customer_id` (`customer_id`), - KEY `employee_id` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; - --- --- Dumping data for table `ospos_sales_suspended` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_sales_suspended_items` --- - -CREATE TABLE `ospos_sales_suspended_items` ( - `sale_id` int(10) NOT NULL DEFAULT '0', - `item_id` int(10) NOT NULL DEFAULT '0', - `description` varchar(30) DEFAULT NULL, - `serialnumber` varchar(30) DEFAULT NULL, - `line` int(3) NOT NULL DEFAULT '0', - `quantity_purchased` double(15,2) NOT NULL DEFAULT '0.00', - `item_cost_price` decimal(15,2) NOT NULL, - `item_unit_price` double(15,2) NOT NULL, - `discount_percent` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`sale_id`,`item_id`,`line`), - KEY `item_id` (`item_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Dumping data for table `ospos_sales_suspended_items` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_sales_suspended_items_taxes` --- - -CREATE TABLE `ospos_sales_suspended_items_taxes` ( - `sale_id` int(10) NOT NULL, - `item_id` int(10) NOT NULL, - `line` int(3) NOT NULL DEFAULT '0', - `name` varchar(255) NOT NULL, - `percent` double(15,2) NOT NULL, - PRIMARY KEY (`sale_id`,`item_id`,`line`,`name`,`percent`), - KEY `item_id` (`item_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Dumping data for table `ospos_sales_suspended_items_taxes` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_sales_suspended_payments` --- - -CREATE TABLE `ospos_sales_suspended_payments` ( - `sale_id` int(10) NOT NULL, - `payment_type` varchar(40) NOT NULL, - `payment_amount` decimal(15,2) NOT NULL, - PRIMARY KEY (`sale_id`,`payment_type`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Dumping data for table `ospos_sales_suspended_payments` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_sessions` --- - -CREATE TABLE `ospos_sessions` ( - `session_id` varchar(40) NOT NULL DEFAULT '0', - `ip_address` varchar(16) NOT NULL DEFAULT '0', - `user_agent` varchar(50) NOT NULL, - `last_activity` int(10) unsigned NOT NULL DEFAULT '0', - `user_data` text, - PRIMARY KEY (`session_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Dumping data for table `ospos_sessions` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `ospos_suppliers` --- - -CREATE TABLE `ospos_suppliers` ( - `person_id` int(10) NOT NULL, - `company_name` varchar(255) NOT NULL, - `account_number` varchar(255) DEFAULT NULL, - `deleted` int(1) NOT NULL DEFAULT '0', - UNIQUE KEY `account_number` (`account_number`), - KEY `person_id` (`person_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Dumping data for table `ospos_suppliers` --- - - --- --- Constraints for dumped tables --- - --- --- Constraints for table `ospos_customers` --- -ALTER TABLE `ospos_customers` - ADD CONSTRAINT `ospos_customers_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_people` (`person_id`); - --- --- Constraints for table `ospos_employees` --- -ALTER TABLE `ospos_employees` - ADD CONSTRAINT `ospos_employees_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_people` (`person_id`); - --- --- Constraints for table `ospos_inventory` --- -ALTER TABLE `ospos_inventory` - ADD CONSTRAINT `ospos_inventory_ibfk_1` FOREIGN KEY (`trans_items`) REFERENCES `ospos_items` (`item_id`), - ADD CONSTRAINT `ospos_inventory_ibfk_2` FOREIGN KEY (`trans_user`) REFERENCES `ospos_employees` (`person_id`); - --- --- Constraints for table `ospos_items` --- -ALTER TABLE `ospos_items` - ADD CONSTRAINT `ospos_items_ibfk_1` FOREIGN KEY (`supplier_id`) REFERENCES `ospos_suppliers` (`person_id`); - --- --- Constraints for table `ospos_items_taxes` --- -ALTER TABLE `ospos_items_taxes` - ADD CONSTRAINT `ospos_items_taxes_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`) ON DELETE CASCADE; - --- --- Constraints for table `ospos_item_kit_items` --- -ALTER TABLE `ospos_item_kit_items` - ADD CONSTRAINT `ospos_item_kit_items_ibfk_1` FOREIGN KEY (`item_kit_id`) REFERENCES `ospos_item_kits` (`item_kit_id`) ON DELETE CASCADE, - ADD CONSTRAINT `ospos_item_kit_items_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`) ON DELETE CASCADE; - --- --- Constraints for table `ospos_permissions` --- -ALTER TABLE `ospos_permissions` - ADD CONSTRAINT `ospos_permissions_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_employees` (`person_id`), - ADD CONSTRAINT `ospos_permissions_ibfk_2` FOREIGN KEY (`module_id`) REFERENCES `ospos_modules` (`module_id`); - --- --- Constraints for table `ospos_receivings` --- -ALTER TABLE `ospos_receivings` - ADD CONSTRAINT `ospos_receivings_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `ospos_employees` (`person_id`), - ADD CONSTRAINT `ospos_receivings_ibfk_2` FOREIGN KEY (`supplier_id`) REFERENCES `ospos_suppliers` (`person_id`); - --- --- Constraints for table `ospos_receivings_items` --- -ALTER TABLE `ospos_receivings_items` - ADD CONSTRAINT `ospos_receivings_items_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`), - ADD CONSTRAINT `ospos_receivings_items_ibfk_2` FOREIGN KEY (`receiving_id`) REFERENCES `ospos_receivings` (`receiving_id`); - --- --- Constraints for table `ospos_sales` --- -ALTER TABLE `ospos_sales` - ADD CONSTRAINT `ospos_sales_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `ospos_employees` (`person_id`), - ADD CONSTRAINT `ospos_sales_ibfk_2` FOREIGN KEY (`customer_id`) REFERENCES `ospos_customers` (`person_id`); - --- --- Constraints for table `ospos_sales_items` --- -ALTER TABLE `ospos_sales_items` - ADD CONSTRAINT `ospos_sales_items_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`), - ADD CONSTRAINT `ospos_sales_items_ibfk_2` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales` (`sale_id`); - --- --- Constraints for table `ospos_sales_items_taxes` --- -ALTER TABLE `ospos_sales_items_taxes` - ADD CONSTRAINT `ospos_sales_items_taxes_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_items` (`sale_id`), - ADD CONSTRAINT `ospos_sales_items_taxes_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`); - --- --- Constraints for table `ospos_sales_payments` --- -ALTER TABLE `ospos_sales_payments` - ADD CONSTRAINT `ospos_sales_payments_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales` (`sale_id`); - --- --- Constraints for table `ospos_sales_suspended` --- -ALTER TABLE `ospos_sales_suspended` - ADD CONSTRAINT `ospos_sales_suspended_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `ospos_employees` (`person_id`), - ADD CONSTRAINT `ospos_sales_suspended_ibfk_2` FOREIGN KEY (`customer_id`) REFERENCES `ospos_customers` (`person_id`); - --- --- Constraints for table `ospos_sales_suspended_items` --- -ALTER TABLE `ospos_sales_suspended_items` - ADD CONSTRAINT `ospos_sales_suspended_items_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`), - ADD CONSTRAINT `ospos_sales_suspended_items_ibfk_2` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_suspended` (`sale_id`); - --- --- Constraints for table `ospos_sales_suspended_items_taxes` --- -ALTER TABLE `ospos_sales_suspended_items_taxes` - ADD CONSTRAINT `ospos_sales_suspended_items_taxes_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_suspended_items` (`sale_id`), - ADD CONSTRAINT `ospos_sales_suspended_items_taxes_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`); - --- --- Constraints for table `ospos_sales_suspended_payments` --- -ALTER TABLE `ospos_sales_suspended_payments` - ADD CONSTRAINT `ospos_sales_suspended_payments_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_suspended` (`sale_id`); - --- --- Constraints for table `ospos_suppliers` --- -ALTER TABLE `ospos_suppliers` - ADD CONSTRAINT `ospos_suppliers_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_people` (`person_id`); diff --git a/images/big_action_button.jpg b/images/big_action_button.jpg deleted file mode 100644 index 830332960..000000000 Binary files a/images/big_action_button.jpg and /dev/null differ diff --git a/images/calendar.png b/images/calendar.png deleted file mode 100644 index 94e66d4ba..000000000 Binary files a/images/calendar.png and /dev/null differ diff --git a/images/checkbox_arrow.gif b/images/checkbox_arrow.gif deleted file mode 100644 index 5a9ff8314..000000000 Binary files a/images/checkbox_arrow.gif and /dev/null differ diff --git a/images/loading_animation.gif b/images/loading_animation.gif deleted file mode 100644 index 82290f483..000000000 Binary files a/images/loading_animation.gif and /dev/null differ diff --git a/images/menubar/config.png b/images/menubar/config.png deleted file mode 100644 index 49fcee265..000000000 Binary files a/images/menubar/config.png and /dev/null differ diff --git a/images/menubar/customers.png b/images/menubar/customers.png deleted file mode 100644 index 5b8e6deb9..000000000 Binary files a/images/menubar/customers.png and /dev/null differ diff --git a/images/menubar/employees.png b/images/menubar/employees.png deleted file mode 100644 index 9e9ba4d97..000000000 Binary files a/images/menubar/employees.png and /dev/null differ diff --git a/images/menubar/giftcards.png b/images/menubar/giftcards.png deleted file mode 100644 index 8b11c9564..000000000 Binary files a/images/menubar/giftcards.png and /dev/null differ diff --git a/images/menubar/home.png b/images/menubar/home.png deleted file mode 100644 index 327dc7535..000000000 Binary files a/images/menubar/home.png and /dev/null differ diff --git a/images/menubar/item_kits.png b/images/menubar/item_kits.png deleted file mode 100644 index d6266204d..000000000 Binary files a/images/menubar/item_kits.png and /dev/null differ diff --git a/images/menubar/items.png b/images/menubar/items.png deleted file mode 100644 index 948db99ff..000000000 Binary files a/images/menubar/items.png and /dev/null differ diff --git a/images/menubar/menubar_bg.gif b/images/menubar/menubar_bg.gif deleted file mode 100644 index 225df46f4..000000000 Binary files a/images/menubar/menubar_bg.gif and /dev/null differ diff --git a/images/menubar/receivings.png b/images/menubar/receivings.png deleted file mode 100644 index f3b1130af..000000000 Binary files a/images/menubar/receivings.png and /dev/null differ diff --git a/images/menubar/reports.png b/images/menubar/reports.png deleted file mode 100644 index 7e1da8961..000000000 Binary files a/images/menubar/reports.png and /dev/null differ diff --git a/images/menubar/sales.png b/images/menubar/sales.png deleted file mode 100644 index afc7e21f9..000000000 Binary files a/images/menubar/sales.png and /dev/null differ diff --git a/images/menubar/suppliers.png b/images/menubar/suppliers.png deleted file mode 100644 index 5ae04c3a7..000000000 Binary files a/images/menubar/suppliers.png and /dev/null differ diff --git a/images/menubar/thumb_clock.png b/images/menubar/thumb_clock.png deleted file mode 100644 index 40c969bfb..000000000 Binary files a/images/menubar/thumb_clock.png and /dev/null differ diff --git a/images/menubar/thumb_colorscheme.png b/images/menubar/thumb_colorscheme.png deleted file mode 100644 index acb711ae7..000000000 Binary files a/images/menubar/thumb_colorscheme.png and /dev/null differ diff --git a/images/minus.png b/images/minus.png deleted file mode 100644 index 1281cd22c..000000000 Binary files a/images/minus.png and /dev/null differ diff --git a/images/plus.png b/images/plus.png deleted file mode 100644 index 34baa374e..000000000 Binary files a/images/plus.png and /dev/null differ diff --git a/images/psds/big_action_button.psd b/images/psds/big_action_button.psd deleted file mode 100644 index 3ef5f3b83..000000000 Binary files a/images/psds/big_action_button.psd and /dev/null differ diff --git a/images/psds/small_action_button.psd b/images/psds/small_action_button.psd deleted file mode 100644 index 5c17e3b9b..000000000 Binary files a/images/psds/small_action_button.psd and /dev/null differ diff --git a/images/small_action_button.jpg b/images/small_action_button.jpg deleted file mode 100644 index 105913f73..000000000 Binary files a/images/small_action_button.jpg and /dev/null differ diff --git a/images/spinner_small.gif b/images/spinner_small.gif deleted file mode 100644 index f0ea9efae..000000000 Binary files a/images/spinner_small.gif and /dev/null differ diff --git a/images/tables/asc.gif b/images/tables/asc.gif deleted file mode 100644 index 74157867f..000000000 Binary files a/images/tables/asc.gif and /dev/null differ diff --git a/images/tables/bg.gif b/images/tables/bg.gif deleted file mode 100644 index fac668fcf..000000000 Binary files a/images/tables/bg.gif and /dev/null differ diff --git a/images/tables/desc.gif b/images/tables/desc.gif deleted file mode 100644 index 3b30b3c58..000000000 Binary files a/images/tables/desc.gif and /dev/null differ diff --git a/import_customers.csv b/import_customers.csv deleted file mode 100644 index b71db6096..000000000 --- a/import_customers.csv +++ /dev/null @@ -1,2 +0,0 @@ -First Name,Last Name,E-Mail,Phone Number,Address 1,Address2,City,State,Zip,Country,Comments,Account Number,Taxable -Bob,Smith,bsmith@nowhere.com,585-555-1111,123 Nowhere Street,Apt 4,Awesome,NY,11111,USA,Awesome guy,,y \ No newline at end of file diff --git a/import_items.csv b/import_items.csv deleted file mode 100644 index e9cdf60d4..000000000 --- a/import_items.csv +++ /dev/null @@ -1 +0,0 @@ -UPC/EAN/ISBN,Item Name,Category,Supplier ID,Cost Price,Unit Price,Tax 1 Name,Tax 1 Percent,Tax 2 Name ,Tax 2 Percent,Quantity,Reorder Level,Location,Description,Allow Alt Description,Item has Serial Number 33333333,Apple iMac,Computers,,800,1200,Tax 1,8,Tax 2,10,10,1,Earth,Best Computer ever,y, \ No newline at end of file diff --git a/index.php b/index.php deleted file mode 100644 index 08a5210fe..000000000 --- a/index.php +++ /dev/null @@ -1,127 +0,0 @@ - this.getDate()) - this.addDays(-this.getDate()); - - return this; - }); - - /** - * Add a number of days to the date object. - * - * @example var dtm = new Date("01/12/2008"); - * dtm.addDays(1); - * dtm.toString(); - * @result 'Sun Jan 13 2008 00:00:00' - * - * @name addDays - * @type Date - * @cat Plugins/Methods/Date - */ - add("addDays", function(num) { - //this.setDate(this.getDate() + num); - this.setTime(this.getTime() + (num*86400000) ); - return this; - }); - - /** - * Add a number of hours to the date object. - * - * @example var dtm = new Date("01/12/2008"); - * dtm.addHours(24); - * dtm.toString(); - * @result 'Sun Jan 13 2008 00:00:00' - * - * @name addHours - * @type Date - * @cat Plugins/Methods/Date - */ - add("addHours", function(num) { - this.setHours(this.getHours() + num); - return this; - }); - - /** - * Add a number of minutes to the date object. - * - * @example var dtm = new Date("01/12/2008"); - * dtm.addMinutes(60); - * dtm.toString(); - * @result 'Sat Jan 12 2008 01:00:00' - * - * @name addMinutes - * @type Date - * @cat Plugins/Methods/Date - */ - add("addMinutes", function(num) { - this.setMinutes(this.getMinutes() + num); - return this; - }); - - /** - * Add a number of seconds to the date object. - * - * @example var dtm = new Date("01/12/2008"); - * dtm.addSeconds(60); - * dtm.toString(); - * @result 'Sat Jan 12 2008 00:01:00' - * - * @name addSeconds - * @type Date - * @cat Plugins/Methods/Date - */ - add("addSeconds", function(num) { - this.setSeconds(this.getSeconds() + num); - return this; - }); - - /** - * Sets the time component of this Date to zero for cleaner, easier comparison of dates where time is not relevant. - * - * @example var dtm = new Date(); - * dtm.zeroTime(); - * dtm.toString(); - * @result 'Sat Jan 12 2008 00:01:00' - * - * @name zeroTime - * @type Date - * @cat Plugins/Methods/Date - * @author Kelvin Luck - */ - add("zeroTime", function() { - this.setMilliseconds(0); - this.setSeconds(0); - this.setMinutes(0); - this.setHours(0); - return this; - }); - - /** - * Returns a string representation of the date object according to Date.format. - * (Date.toString may be used in other places so I purposefully didn't overwrite it) - * - * @example var dtm = new Date("01/12/2008"); - * dtm.asString(); - * @result '12/01/2008' // (where Date.format == 'dd/mm/yyyy' - * - * @name asString - * @type Date - * @cat Plugins/Methods/Date - * @author Kelvin Luck - */ - add("asString", function(format) { - var r = format || Date.format; - return r - .split('yyyy').join(this.getFullYear()) - .split('yy').join((this.getFullYear() + '').substring(2)) - .split('mmmm').join(this.getMonthName(false)) - .split('mmm').join(this.getMonthName(true)) - .split('mm').join(_zeroPad(this.getMonth()+1)) - .split('dd').join(_zeroPad(this.getDate())) - .split('hh').join(_zeroPad(this.getHours())) - .split('min').join(_zeroPad(this.getMinutes())) - .split('ss').join(_zeroPad(this.getSeconds())); - }); - - /** - * Returns a new date object created from the passed String according to Date.format or false if the attempt to do this results in an invalid date object - * (We can't simple use Date.parse as it's not aware of locale and I chose not to overwrite it incase it's functionality is being relied on elsewhere) - * - * @example var dtm = Date.fromString("12/01/2008"); - * dtm.toString(); - * @result 'Sat Jan 12 2008 00:00:00' // (where Date.format == 'dd/mm/yyyy' - * - * @name fromString - * @type Date - * @cat Plugins/Methods/Date - * @author Kelvin Luck - */ - Date.fromString = function(s, format) - { - var f = format || Date.format; - var d = new Date('01/01/1977'); - - var mLength = 0; - - var iM = f.indexOf('mmmm'); - if (iM > -1) { - for (var i=0; i -1) { - var mStr = s.substr(iM, 3); - for (var i=0; i -1) { - if (iM < iY) - { - iY += mLength; - } - d.setFullYear(Number(s.substr(iY, 4))); - } else { - if (iM < iY) - { - iY += mLength; - } - // TODO - this doesn't work very well - are there any rules for what is meant by a two digit year? - d.setFullYear(Number(Date.fullYearStart + s.substr(f.indexOf('yy'), 2))); - } - var iD = f.indexOf('dd'); - if (iM < iD) - { - iD += mLength; - } - d.setDate(Number(s.substr(iD, 2))); - if (isNaN(d.getTime())) { - return false; - } - return d; - }; - - // utility method - var _zeroPad = function(num) { - var s = '0'+num; - return s.substring(s.length-2) - //return ('0'+num).substring(-2); // doesn't work on IE :( - }; - -})(); \ No newline at end of file diff --git a/js/datepicker.js b/js/datepicker.js deleted file mode 100644 index 5b19e6893..000000000 --- a/js/datepicker.js +++ /dev/null @@ -1,1216 +0,0 @@ -/** - * Copyright (c) 2008 Kelvin Luck (http://www.kelvinluck.com/) - * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) - * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. - * . - * $Id: jquery.datePicker.js 102 2010-09-13 14:00:54Z kelvin.luck $ - **/ - -(function($){ - - $.fn.extend({ -/** - * Render a calendar table into any matched elements. - * - * @param Object s (optional) Customize your calendars. - * @option Number month The month to render (NOTE that months are zero based). Default is today's month. - * @option Number year The year to render. Default is today's year. - * @option Function renderCallback A reference to a function that is called as each cell is rendered and which can add classes and event listeners to the created nodes. Default is no callback. - * @option Number showHeader Whether or not to show the header row, possible values are: $.dpConst.SHOW_HEADER_NONE (no header), $.dpConst.SHOW_HEADER_SHORT (first letter of each day) and $.dpConst.SHOW_HEADER_LONG (full name of each day). Default is $.dpConst.SHOW_HEADER_SHORT. - * @option String hoverClass The class to attach to each cell when you hover over it (to allow you to use hover effects in IE6 which doesn't support the :hover pseudo-class on elements other than links). Default is dp-hover. Pass false if you don't want a hover class. - * @type jQuery - * @name renderCalendar - * @cat plugins/datePicker - * @author Kelvin Luck (http://www.kelvinluck.com/) - * - * @example $('#calendar-me').renderCalendar({month:0, year:2007}); - * @desc Renders a calendar displaying January 2007 into the element with an id of calendar-me. - * - * @example - * var testCallback = function($td, thisDate, month, year) - * { - * if ($td.is('.current-month') && thisDate.getDay() == 4) { - * var d = thisDate.getDate(); - * $td.bind( - * 'click', - * function() - * { - * alert('You clicked on ' + d + '/' + (Number(month)+1) + '/' + year); - * } - * ).addClass('thursday'); - * } else if (thisDate.getDay() == 5) { - * $td.html('Friday the ' + $td.html() + 'th'); - * } - * } - * $('#calendar-me').renderCalendar({month:0, year:2007, renderCallback:testCallback}); - * - * @desc Renders a calendar displaying January 2007 into the element with an id of calendar-me. Every Thursday in the current month has a class of "thursday" applied to it, is clickable and shows an alert when clicked. Every Friday on the calendar has the number inside replaced with text. - **/ - renderCalendar : function(s) - { - var dc = function(a) - { - return document.createElement(a); - }; - - s = $.extend({}, $.fn.datePicker.defaults, s); - - if (s.showHeader != $.dpConst.SHOW_HEADER_NONE) { - var headRow = $(dc('tr')); - for (var i=Date.firstDayOfWeek; i 1) firstDayOffset -= 7; - var weeksToDraw = Math.ceil(( (-1*firstDayOffset+1) + currentDate.getDaysInMonth() ) /7); - currentDate.addDays(firstDayOffset-1); - - var doHover = function(firstDayInBounds) - { - return function() - { - if (s.hoverClass) { - var $this = $(this); - if (!s.selectWeek) { - $this.addClass(s.hoverClass); - } else if (firstDayInBounds && !$this.is('.disabled')) { - $this.parent().addClass('activeWeekHover'); - } - } - } - }; - var unHover = function() - { - if (s.hoverClass) { - var $this = $(this); - $this.removeClass(s.hoverClass); - $this.parent().removeClass('activeWeekHover'); - } - }; - - var w = 0; - while (w++ s.dpController.startDate : false; - for (var i=0; i<7; i++) { - var thisMonth = currentDate.getMonth() == month; - var d = $(dc('td')) - .text(currentDate.getDate() + '') - .addClass((thisMonth ? 'current-month ' : 'other-month ') + - (currentDate.isWeekend() ? 'weekend ' : 'weekday ') + - (thisMonth && currentDate.getTime() == today.getTime() ? 'today ' : '') - ) - .data('datePickerDate', currentDate.asString()) - .hover(doHover(firstDayInBounds), unHover) - ; - r.append(d); - if (s.renderCallback) { - s.renderCallback(d, currentDate, month, year); - } - // addDays(1) fails in some locales due to daylight savings. See issue 39. - //currentDate.addDays(1); - // set the time to midday to avoid any weird timezone issues?? - currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()+1, 12, 0, 0); - } - tbody.append(r); - } - calendarTable.append(tbody); - - return this.each( - function() - { - $(this).empty().append(calendarTable); - } - ); - }, -/** - * Create a datePicker associated with each of the matched elements. - * - * The matched element will receive a few custom events with the following signatures: - * - * dateSelected(event, date, $td, status) - * Triggered when a date is selected. event is a reference to the event, date is the Date selected, $td is a jquery object wrapped around the TD that was clicked on and status is whether the date was selected (true) or deselected (false) - * - * dpClosed(event, selected) - * Triggered when the date picker is closed. event is a reference to the event and selected is an Array containing Date objects. - * - * dpMonthChanged(event, displayedMonth, displayedYear) - * Triggered when the month of the popped up calendar is changed. event is a reference to the event, displayedMonth is the number of the month now displayed (zero based) and displayedYear is the year of the month. - * - * dpDisplayed(event, $datePickerDiv) - * Triggered when the date picker is created. $datePickerDiv is the div containing the date picker. Use this event to add custom content/ listeners to the popped up date picker. - * - * @param Object s (optional) Customize your date pickers. - * @option Number month The month to render when the date picker is opened (NOTE that months are zero based). Default is today's month. - * @option Number year The year to render when the date picker is opened. Default is today's year. - * @option String startDate The first date date can be selected. - * @option String endDate The last date that can be selected. - * @option Boolean inline Whether to create the datePicker as inline (e.g. always on the page) or as a model popup. Default is false (== modal popup) - * @option Boolean createButton Whether to create a .dp-choose-date anchor directly after the matched element which when clicked will trigger the showing of the date picker. Default is true. - * @option Boolean showYearNavigation Whether to display buttons which allow the user to navigate through the months a year at a time. Default is true. - * @option Boolean closeOnSelect Whether to close the date picker when a date is selected. Default is true. - * @option Boolean displayClose Whether to create a "Close" button within the date picker popup. Default is false. - * @option Boolean selectMultiple Whether a user should be able to select multiple dates with this date picker. Default is false. - * @option Number numSelectable The maximum number of dates that can be selected where selectMultiple is true. Default is a very high number. - * @option Boolean clickInput If the matched element is an input type="text" and this option is true then clicking on the input will cause the date picker to appear. - * @option Boolean rememberViewedMonth Whether the datePicker should remember the last viewed month and open on it. If false then the date picker will always open with the month for the first selected date visible. - * @option Boolean selectWeek Whether to select a complete week at a time... - * @option Number verticalPosition The vertical alignment of the popped up date picker to the matched element. One of $.dpConst.POS_TOP and $.dpConst.POS_BOTTOM. Default is $.dpConst.POS_TOP. - * @option Number horizontalPosition The horizontal alignment of the popped up date picker to the matched element. One of $.dpConst.POS_LEFT and $.dpConst.POS_RIGHT. - * @option Number verticalOffset The number of pixels offset from the defined verticalPosition of this date picker that it should pop up in. Default in 0. - * @option Number horizontalOffset The number of pixels offset from the defined horizontalPosition of this date picker that it should pop up in. Default in 0. - * @option (Function|Array) renderCallback A reference to a function (or an array of separate functions) that is called as each cell is rendered and which can add classes and event listeners to the created nodes. Each callback function will receive four arguments; a jquery object wrapping the created TD, a Date object containing the date this TD represents, a number giving the currently rendered month and a number giving the currently rendered year. Default is no callback. - * @option String hoverClass The class to attach to each cell when you hover over it (to allow you to use hover effects in IE6 which doesn't support the :hover pseudo-class on elements other than links). Default is dp-hover. Pass false if you don't want a hover class. - * @option String autoFocusNextInput Whether focus should be passed onto the next input in the form (true) or remain on this input (false) when a date is selected and the calendar closes - * @type jQuery - * @name datePicker - * @cat plugins/datePicker - * @author Kelvin Luck (http://www.kelvinluck.com/) - * - * @example $('input.date-picker').datePicker(); - * @desc Creates a date picker button next to all matched input elements. When the button is clicked on the value of the selected date will be placed in the corresponding input (formatted according to Date.format). - * - * @example demo/index.html - * @desc See the projects homepage for many more complex examples... - **/ - datePicker : function(s) - { - if (!$.event._dpCache) $.event._dpCache = []; - - // initialise the date picker controller with the relevant settings... - s = $.extend({}, $.fn.datePicker.defaults, s); - - return this.each( - function() - { - var $this = $(this); - var alreadyExists = true; - - if (!this._dpId) { - this._dpId = $.event.guid++; - $.event._dpCache[this._dpId] = new DatePicker(this); - alreadyExists = false; - } - - if (s.inline) { - s.createButton = false; - s.displayClose = false; - s.closeOnSelect = false; - $this.empty(); - } - - var controller = $.event._dpCache[this._dpId]; - - controller.init(s); - - if (!alreadyExists && s.createButton) { - // create it! - controller.button = $('' + $.dpText.TEXT_CHOOSE_DATE + '') - .bind( - 'click', - function() - { - $this.dpDisplay(this); - this.blur(); - return false; - } - ); - $this.after(controller.button); - } - - if (!alreadyExists && $this.is(':text')) { - $this - .bind( - 'dateSelected', - function(e, selectedDate, $td) - { - this.value = selectedDate.asString(); - } - ).bind( - 'change', - function() - { - if (this.value == '') { - controller.clearSelected(); - } else { - var d = Date.fromString(this.value); - if (d) { - controller.setSelected(d, true, true); - } - } - } - ); - if (s.clickInput) { - $this.bind( - 'click', - function() - { - // The change event doesn't happen until the input loses focus so we need to manually trigger it... - $this.trigger('change'); - $this.dpDisplay(); - } - ); - } - var d = Date.fromString(this.value); - if (this.value != '' && d) { - controller.setSelected(d, true, true); - } - } - - $this.addClass('dp-applied'); - - } - ) - }, -/** - * Disables or enables this date picker - * - * @param Boolean s Whether to disable (true) or enable (false) this datePicker - * @type jQuery - * @name dpSetDisabled - * @cat plugins/datePicker - * @author Kelvin Luck (http://www.kelvinluck.com/) - * - * @example $('.date-picker').datePicker(); - * $('.date-picker').dpSetDisabled(true); - * @desc Prevents this date picker from displaying and adds a class of dp-disabled to it (and it's associated button if it has one) for styling purposes. If the matched element is an input field then it will also set the disabled attribute to stop people directly editing the field. - **/ - dpSetDisabled : function(s) - { - return _w.call(this, 'setDisabled', s); - }, -/** - * Updates the first selectable date for any date pickers on any matched elements. - * - * @param String d A string representing the first selectable date (formatted according to Date.format). - * @type jQuery - * @name dpSetStartDate - * @cat plugins/datePicker - * @author Kelvin Luck (http://www.kelvinluck.com/) - * - * @example $('.date-picker').datePicker(); - * $('.date-picker').dpSetStartDate('01/01/2000'); - * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the first selectable date for each of these to the first day of the millenium. - **/ - dpSetStartDate : function(d) - { - return _w.call(this, 'setStartDate', d); - }, -/** - * Updates the last selectable date for any date pickers on any matched elements. - * - * @param String d A string representing the last selectable date (formatted according to Date.format). - * @type jQuery - * @name dpSetEndDate - * @cat plugins/datePicker - * @author Kelvin Luck (http://www.kelvinluck.com/) - * - * @example $('.date-picker').datePicker(); - * $('.date-picker').dpSetEndDate('01/01/2010'); - * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the last selectable date for each of these to the first Janurary 2010. - **/ - dpSetEndDate : function(d) - { - return _w.call(this, 'setEndDate', d); - }, -/** - * Gets a list of Dates currently selected by this datePicker. This will be an empty array if no dates are currently selected or NULL if there is no datePicker associated with the matched element. - * - * @type Array - * @name dpGetSelected - * @cat plugins/datePicker - * @author Kelvin Luck (http://www.kelvinluck.com/) - * - * @example $('.date-picker').datePicker(); - * alert($('.date-picker').dpGetSelected()); - * @desc Will alert an empty array (as nothing is selected yet) - **/ - dpGetSelected : function() - { - var c = _getController(this[0]); - if (c) { - return c.getSelected(); - } - return null; - }, -/** - * Selects or deselects a date on any matched element's date pickers. Deselcting is only useful on date pickers where selectMultiple==true. Selecting will only work if the passed date is within the startDate and endDate boundries for a given date picker. - * - * @param String d A string representing the date you want to select (formatted according to Date.format). - * @param Boolean v Whether you want to select (true) or deselect (false) this date. Optional - default = true. - * @param Boolean m Whether you want the date picker to open up on the month of this date when it is next opened. Optional - default = true. - * @param Boolean e Whether you want the date picker to dispatch events related to this change of selection. Optional - default = true. - * @type jQuery - * @name dpSetSelected - * @cat plugins/datePicker - * @author Kelvin Luck (http://www.kelvinluck.com/) - * - * @example $('.date-picker').datePicker(); - * $('.date-picker').dpSetSelected('01/01/2010'); - * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the selected date on these date pickers to the first Janurary 2010. When the date picker is next opened it will display Janurary 2010. - **/ - dpSetSelected : function(d, v, m, e) - { - if (v == undefined) v=true; - if (m == undefined) m=true; - if (e == undefined) e=true; - return _w.call(this, 'setSelected', Date.fromString(d), v, m, e); - }, -/** - * Sets the month that will be displayed when the date picker is next opened. If the passed month is before startDate then the month containing startDate will be displayed instead. If the passed month is after endDate then the month containing the endDate will be displayed instead. - * - * @param Number m The month you want the date picker to display. Optional - defaults to the currently displayed month. - * @param Number y The year you want the date picker to display. Optional - defaults to the currently displayed year. - * @type jQuery - * @name dpSetDisplayedMonth - * @cat plugins/datePicker - * @author Kelvin Luck (http://www.kelvinluck.com/) - * - * @example $('.date-picker').datePicker(); - * $('.date-picker').dpSetDisplayedMonth(10, 2008); - * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the selected date on these date pickers to the first Janurary 2010. When the date picker is next opened it will display Janurary 2010. - **/ - dpSetDisplayedMonth : function(m, y) - { - return _w.call(this, 'setDisplayedMonth', Number(m), Number(y), true); - }, -/** - * Displays the date picker associated with the matched elements. Since only one date picker can be displayed at once then the date picker associated with the last matched element will be the one that is displayed. - * - * @param HTMLElement e An element that you want the date picker to pop up relative in position to. Optional - default behaviour is to pop up next to the element associated with this date picker. - * @type jQuery - * @name dpDisplay - * @cat plugins/datePicker - * @author Kelvin Luck (http://www.kelvinluck.com/) - * - * @example $('#date-picker').datePicker(); - * $('#date-picker').dpDisplay(); - * @desc Creates a date picker associated with the element with an id of date-picker and then causes it to pop up. - **/ - dpDisplay : function(e) - { - return _w.call(this, 'display', e); - }, -/** - * Sets a function or array of functions that is called when each TD of the date picker popup is rendered to the page - * - * @param (Function|Array) a A function or an array of functions that are called when each td is rendered. Each function will receive four arguments; a jquery object wrapping the created TD, a Date object containing the date this TD represents, a number giving the currently rendered month and a number giving the currently rendered year. - * @type jQuery - * @name dpSetRenderCallback - * @cat plugins/datePicker - * @author Kelvin Luck (http://www.kelvinluck.com/) - * - * @example $('#date-picker').datePicker(); - * $('#date-picker').dpSetRenderCallback(function($td, thisDate, month, year) - * { - * // do stuff as each td is rendered dependant on the date in the td and the displayed month and year - * }); - * @desc Creates a date picker associated with the element with an id of date-picker and then creates a function which is called as each td is rendered when this date picker is displayed. - **/ - dpSetRenderCallback : function(a) - { - return _w.call(this, 'setRenderCallback', a); - }, -/** - * Sets the position that the datePicker will pop up (relative to it's associated element) - * - * @param Number v The vertical alignment of the created date picker to it's associated element. Possible values are $.dpConst.POS_TOP and $.dpConst.POS_BOTTOM - * @param Number h The horizontal alignment of the created date picker to it's associated element. Possible values are $.dpConst.POS_LEFT and $.dpConst.POS_RIGHT - * @type jQuery - * @name dpSetPosition - * @cat plugins/datePicker - * @author Kelvin Luck (http://www.kelvinluck.com/) - * - * @example $('#date-picker').datePicker(); - * $('#date-picker').dpSetPosition($.dpConst.POS_BOTTOM, $.dpConst.POS_RIGHT); - * @desc Creates a date picker associated with the element with an id of date-picker and makes it so that when this date picker pops up it will be bottom and right aligned to the #date-picker element. - **/ - dpSetPosition : function(v, h) - { - return _w.call(this, 'setPosition', v, h); - }, -/** - * Sets the offset that the popped up date picker will have from it's default position relative to it's associated element (as set by dpSetPosition) - * - * @param Number v The vertical offset of the created date picker. - * @param Number h The horizontal offset of the created date picker. - * @type jQuery - * @name dpSetOffset - * @cat plugins/datePicker - * @author Kelvin Luck (http://www.kelvinluck.com/) - * - * @example $('#date-picker').datePicker(); - * $('#date-picker').dpSetOffset(-20, 200); - * @desc Creates a date picker associated with the element with an id of date-picker and makes it so that when this date picker pops up it will be 20 pixels above and 200 pixels to the right of it's default position. - **/ - dpSetOffset : function(v, h) - { - return _w.call(this, 'setOffset', v, h); - }, -/** - * Closes the open date picker associated with this element. - * - * @type jQuery - * @name dpClose - * @cat plugins/datePicker - * @author Kelvin Luck (http://www.kelvinluck.com/) - * - * @example $('.date-pick') - * .datePicker() - * .bind( - * 'focus', - * function() - * { - * $(this).dpDisplay(); - * } - * ).bind( - * 'blur', - * function() - * { - * $(this).dpClose(); - * } - * ); - **/ - dpClose : function() - { - return _w.call(this, '_closeCalendar', false, this[0]); - }, -/** - * Rerenders the date picker's current month (for use with inline calendars and renderCallbacks). - * - * @type jQuery - * @name dpRerenderCalendar - * @cat plugins/datePicker - * @author Kelvin Luck (http://www.kelvinluck.com/) - * - **/ - dpRerenderCalendar : function() - { - return _w.call(this, '_rerenderCalendar'); - }, - // private function called on unload to clean up any expandos etc and prevent memory links... - _dpDestroy : function() - { - // TODO - implement this? - } - }); - - // private internal function to cut down on the amount of code needed where we forward - // dp* methods on the jQuery object on to the relevant DatePicker controllers... - var _w = function(f, a1, a2, a3, a4) - { - return this.each( - function() - { - var c = _getController(this); - if (c) { - c[f](a1, a2, a3, a4); - } - } - ); - }; - - function DatePicker(ele) - { - this.ele = ele; - - // initial values... - this.displayedMonth = null; - this.displayedYear = null; - this.startDate = null; - this.endDate = null; - this.showYearNavigation = null; - this.closeOnSelect = null; - this.displayClose = null; - this.rememberViewedMonth= null; - this.selectMultiple = null; - this.numSelectable = null; - this.numSelected = null; - this.verticalPosition = null; - this.horizontalPosition = null; - this.verticalOffset = null; - this.horizontalOffset = null; - this.button = null; - this.renderCallback = []; - this.selectedDates = {}; - this.inline = null; - this.context = '#dp-popup'; - this.settings = {}; - }; - $.extend( - DatePicker.prototype, - { - init : function(s) - { - this.setStartDate(s.startDate); - this.setEndDate(s.endDate); - this.setDisplayedMonth(Number(s.month), Number(s.year)); - this.setRenderCallback(s.renderCallback); - this.showYearNavigation = s.showYearNavigation; - this.closeOnSelect = s.closeOnSelect; - this.displayClose = s.displayClose; - this.rememberViewedMonth = s.rememberViewedMonth; - this.selectMultiple = s.selectMultiple; - this.numSelectable = s.selectMultiple ? s.numSelectable : 1; - this.numSelected = 0; - this.verticalPosition = s.verticalPosition; - this.horizontalPosition = s.horizontalPosition; - this.hoverClass = s.hoverClass; - this.setOffset(s.verticalOffset, s.horizontalOffset); - this.inline = s.inline; - this.settings = s; - if (this.inline) { - this.context = this.ele; - this.display(); - } - }, - setStartDate : function(d) - { - if (d) { - this.startDate = Date.fromString(d); - } - if (!this.startDate) { - this.startDate = (new Date()).zeroTime(); - } - this.setDisplayedMonth(this.displayedMonth, this.displayedYear); - }, - setEndDate : function(d) - { - if (d) { - this.endDate = Date.fromString(d); - } - if (!this.endDate) { - this.endDate = (new Date('12/31/2999')); // using the JS Date.parse function which expects mm/dd/yyyy - } - if (this.endDate.getTime() < this.startDate.getTime()) { - this.endDate = this.startDate; - } - this.setDisplayedMonth(this.displayedMonth, this.displayedYear); - }, - setPosition : function(v, h) - { - this.verticalPosition = v; - this.horizontalPosition = h; - }, - setOffset : function(v, h) - { - this.verticalOffset = parseInt(v) || 0; - this.horizontalOffset = parseInt(h) || 0; - }, - setDisabled : function(s) - { - $e = $(this.ele); - $e[s ? 'addClass' : 'removeClass']('dp-disabled'); - if (this.button) { - $but = $(this.button); - $but[s ? 'addClass' : 'removeClass']('dp-disabled'); - $but.attr('title', s ? '' : $.dpText.TEXT_CHOOSE_DATE); - } - if ($e.is(':text')) { - $e.attr('disabled', s ? 'disabled' : ''); - } - }, - setDisplayedMonth : function(m, y, rerender) - { - if (this.startDate == undefined || this.endDate == undefined) { - return; - } - var s = new Date(this.startDate.getTime()); - s.setDate(1); - var e = new Date(this.endDate.getTime()); - e.setDate(1); - - var t; - if ((!m && !y) || (isNaN(m) && isNaN(y))) { - // no month or year passed - default to current month - t = new Date().zeroTime(); - t.setDate(1); - } else if (isNaN(m)) { - // just year passed in - presume we want the displayedMonth - t = new Date(y, this.displayedMonth, 1); - } else if (isNaN(y)) { - // just month passed in - presume we want the displayedYear - t = new Date(this.displayedYear, m, 1); - } else { - // year and month passed in - that's the date we want! - t = new Date(y, m, 1) - } - // check if the desired date is within the range of our defined startDate and endDate - if (t.getTime() < s.getTime()) { - t = s; - } else if (t.getTime() > e.getTime()) { - t = e; - } - var oldMonth = this.displayedMonth; - var oldYear = this.displayedYear; - this.displayedMonth = t.getMonth(); - this.displayedYear = t.getFullYear(); - - if (rerender && (this.displayedMonth != oldMonth || this.displayedYear != oldYear)) - { - this._rerenderCalendar(); - $(this.ele).trigger('dpMonthChanged', [this.displayedMonth, this.displayedYear]); - } - }, - setSelected : function(d, v, moveToMonth, dispatchEvents) - { - if (d < this.startDate || d.zeroTime() > this.endDate.zeroTime()) { - // Don't allow people to select dates outside range... - return; - } - var s = this.settings; - if (s.selectWeek) - { - d = d.addDays(- (d.getDay() - Date.firstDayOfWeek + 7) % 7); - if (d < this.startDate) // The first day of this week is before the start date so is unselectable... - { - return; - } - } - if (v == this.isSelected(d)) // this date is already un/selected - { - return; - } - if (this.selectMultiple == false) { - this.clearSelected(); - } else if (v && this.numSelected == this.numSelectable) { - // can't select any more dates... - return; - } - if (moveToMonth && (this.displayedMonth != d.getMonth() || this.displayedYear != d.getFullYear())) { - this.setDisplayedMonth(d.getMonth(), d.getFullYear(), true); - } - this.selectedDates[d.asString()] = v; - this.numSelected += v ? 1 : -1; - var selectorString = 'td.' + (d.getMonth() == this.displayedMonth ? 'current-month' : 'other-month'); - var $td; - $(selectorString, this.context).each( - function() - { - if ($(this).data('datePickerDate') == d.asString()) { - $td = $(this); - if (s.selectWeek) - { - $td.parent()[v ? 'addClass' : 'removeClass']('selectedWeek'); - } - $td[v ? 'addClass' : 'removeClass']('selected'); - } - } - ); - $('td', this.context).not('.selected')[this.selectMultiple && this.numSelected == this.numSelectable ? 'addClass' : 'removeClass']('unselectable'); - - if (dispatchEvents) - { - var s = this.isSelected(d); - $e = $(this.ele); - var dClone = Date.fromString(d.asString()); - $e.trigger('dateSelected', [dClone, $td, s]); - $e.trigger('change'); - } - }, - isSelected : function(d) - { - return this.selectedDates[d.asString()]; - }, - getSelected : function() - { - var r = []; - for(var s in this.selectedDates) { - if (this.selectedDates[s] == true) { - r.push(Date.fromString(s)); - } - } - return r; - }, - clearSelected : function() - { - this.selectedDates = {}; - this.numSelected = 0; - $('td.selected', this.context).removeClass('selected').parent().removeClass('selectedWeek'); - }, - display : function(eleAlignTo) - { - if ($(this.ele).is('.dp-disabled')) return; - - eleAlignTo = eleAlignTo || this.ele; - var c = this; - var $ele = $(eleAlignTo); - var eleOffset = $ele.offset(); - - var $createIn; - var attrs; - var attrsCalendarHolder; - var cssRules; - - if (c.inline) { - $createIn = $(this.ele); - attrs = { - 'id' : 'calendar-' + this.ele._dpId, - 'class' : 'dp-popup dp-popup-inline' - }; - - $('.dp-popup', $createIn).remove(); - cssRules = { - }; - } else { - $createIn = $('body'); - attrs = { - 'id' : 'dp-popup', - 'class' : 'dp-popup' - }; - cssRules = { - 'top' : eleOffset.top + c.verticalOffset, - 'left' : eleOffset.left + c.horizontalOffset - }; - - var _checkMouse = function(e) - { - var el = e.target; - var cal = $('#dp-popup')[0]; - - while (true){ - if (el == cal) { - return true; - } else if (el == document) { - c._closeCalendar(); - return false; - } else { - el = $(el).parent()[0]; - } - } - }; - this._checkMouse = _checkMouse; - - c._closeCalendar(true); - $(document).bind( - 'keydown.datepicker', - function(event) - { - if (event.keyCode == 27) { - c._closeCalendar(); - } - } - ); - } - - if (!c.rememberViewedMonth) - { - var selectedDate = this.getSelected()[0]; - if (selectedDate) { - selectedDate = new Date(selectedDate); - this.setDisplayedMonth(selectedDate.getMonth(), selectedDate.getFullYear(), false); - } - } - - $createIn - .append( - $('
                          ') - .attr(attrs) - .css(cssRules) - .append( -// $('aaa'), - $('

                          '), - $('
                          ') - .append( - $('<<') - .bind( - 'click', - function() - { - return c._displayNewMonth.call(c, this, 0, -1); - } - ), - $('<') - .bind( - 'click', - function() - { - return c._displayNewMonth.call(c, this, -1, 0); - } - ) - ), - $('
                          ') - .append( - $('>>') - .bind( - 'click', - function() - { - return c._displayNewMonth.call(c, this, 0, 1); - } - ), - $('>') - .bind( - 'click', - function() - { - return c._displayNewMonth.call(c, this, 1, 0); - } - ) - ), - $('
                          ') - ) - .bgIframe() - ); - - var $pop = this.inline ? $('.dp-popup', this.context) : $('#dp-popup'); - - if (this.showYearNavigation == false) { - $('.dp-nav-prev-year, .dp-nav-next-year', c.context).css('display', 'none'); - } - if (this.displayClose) { - $pop.append( - $('' + $.dpText.TEXT_CLOSE + '') - .bind( - 'click', - function() - { - c._closeCalendar(); - return false; - } - ) - ); - } - c._renderCalendar(); - - $(this.ele).trigger('dpDisplayed', $pop); - - if (!c.inline) { - if (this.verticalPosition == $.dpConst.POS_BOTTOM) { - $pop.css('top', eleOffset.top + $ele.height() - $pop.height() + c.verticalOffset); - } - if (this.horizontalPosition == $.dpConst.POS_RIGHT) { - $pop.css('left', eleOffset.left + $ele.width() - $pop.width() + c.horizontalOffset); - } -// $('.selectee', this.context).focus(); - $(document).bind('mousedown.datepicker', this._checkMouse); - } - - }, - setRenderCallback : function(a) - { - if (a == null) return; - if (a && typeof(a) == 'function') { - a = [a]; - } - this.renderCallback = this.renderCallback.concat(a); - }, - cellRender : function ($td, thisDate, month, year) { - var c = this.dpController; - var d = new Date(thisDate.getTime()); - - // add our click handlers to deal with it when the days are clicked... - - $td.bind( - 'click', - function() - { - var $this = $(this); - if (!$this.is('.disabled')) { - c.setSelected(d, !$this.is('.selected') || !c.selectMultiple, false, true); - if (c.closeOnSelect) { - // Focus the next input in the form… - if (c.settings.autoFocusNextInput) { - var ele = c.ele; - var found = false; - $(':input', ele.form).each( - function() - { - if (found) { - $(this).focus(); - return false; - } - if (this == ele) { - found = true; - } - } - ); - } else { - c.ele.focus(); - } - c._closeCalendar(); - } - } - } - ); - if (c.isSelected(d)) { - $td.addClass('selected'); - if (c.settings.selectWeek) - { - $td.parent().addClass('selectedWeek'); - } - } else if (c.selectMultiple && c.numSelected == c.numSelectable) { - $td.addClass('unselectable'); - } - - }, - _applyRenderCallbacks : function() - { - var c = this; - $('td', this.context).each( - function() - { - for (var i=0; i 20) { - $this.addClass('disabled'); - } - } - ); - var d = this.startDate.getDate(); - $('.dp-calendar td.current-month', this.context).each( - function() - { - var $this = $(this); - if (Number($this.text()) < d) { - $this.addClass('disabled'); - } - } - ); - } else { - $('.dp-nav-prev-year', this.context).removeClass('disabled'); - $('.dp-nav-prev-month', this.context).removeClass('disabled'); - var d = this.startDate.getDate(); - if (d > 20) { - // check if the startDate is last month as we might need to add some disabled classes... - var st = this.startDate.getTime(); - var sd = new Date(st); - sd.addMonths(1); - if (this.displayedYear == sd.getFullYear() && this.displayedMonth == sd.getMonth()) { - $('.dp-calendar td.other-month', this.context).each( - function() - { - var $this = $(this); - if (Date.fromString($this.data('datePickerDate')).getTime() < st) { - $this.addClass('disabled'); - } - } - ); - } - } - } - if (this.displayedYear == this.endDate.getFullYear() && this.displayedMonth == this.endDate.getMonth()) { - $('.dp-nav-next-year', this.context).addClass('disabled'); - $('.dp-nav-next-month', this.context).addClass('disabled'); - $('.dp-calendar td.other-month', this.context).each( - function() - { - var $this = $(this); - if (Number($this.text()) < 14) { - $this.addClass('disabled'); - } - } - ); - var d = this.endDate.getDate(); - $('.dp-calendar td.current-month', this.context).each( - function() - { - var $this = $(this); - if (Number($this.text()) > d) { - $this.addClass('disabled'); - } - } - ); - } else { - $('.dp-nav-next-year', this.context).removeClass('disabled'); - $('.dp-nav-next-month', this.context).removeClass('disabled'); - var d = this.endDate.getDate(); - if (d < 13) { - // check if the endDate is next month as we might need to add some disabled classes... - var ed = new Date(this.endDate.getTime()); - ed.addMonths(-1); - if (this.displayedYear == ed.getFullYear() && this.displayedMonth == ed.getMonth()) { - $('.dp-calendar td.other-month', this.context).each( - function() - { - var $this = $(this); - var cellDay = Number($this.text()); - if (cellDay < 13 && cellDay > d) { - $this.addClass('disabled'); - } - } - ); - } - } - } - this._applyRenderCallbacks(); - }, - _closeCalendar : function(programatic, ele) - { - if (!ele || ele == this.ele) - { - $(document).unbind('mousedown.datepicker'); - $(document).unbind('keydown.datepicker'); - this._clearCalendar(); - $('#dp-popup a').unbind(); - $('#dp-popup').empty().remove(); - if (!programatic) { - $(this.ele).trigger('dpClosed', [this.getSelected()]); - } - } - }, - // empties the current dp-calendar div and makes sure that all events are unbound - // and expandos removed to avoid memory leaks... - _clearCalendar : function() - { - // TODO. - $('.dp-calendar td', this.context).unbind(); - $('.dp-calendar', this.context).empty(); - } - } - ); - - // static constants - $.dpConst = { - SHOW_HEADER_NONE : 0, - SHOW_HEADER_SHORT : 1, - SHOW_HEADER_LONG : 2, - POS_TOP : 0, - POS_BOTTOM : 1, - POS_LEFT : 0, - POS_RIGHT : 1, - DP_INTERNAL_FOCUS : 'dpInternalFocusTrigger' - }; - // localisable text - $.dpText = { - TEXT_PREV_YEAR : 'Previous year', - TEXT_PREV_MONTH : 'Previous month', - TEXT_NEXT_YEAR : 'Next year', - TEXT_NEXT_MONTH : 'Next month', - TEXT_CLOSE : 'Close', - TEXT_CHOOSE_DATE : 'Choose date', - HEADER_FORMAT : 'mmmm yyyy' - }; - // version - $.dpVersion = '$Id: jquery.datePicker.js 102 2010-09-13 14:00:54Z kelvin.luck $'; - - $.fn.datePicker.defaults = { - month : undefined, - year : undefined, - showHeader : $.dpConst.SHOW_HEADER_SHORT, - startDate : undefined, - endDate : undefined, - inline : false, - renderCallback : null, - createButton : true, - showYearNavigation : true, - closeOnSelect : true, - displayClose : false, - selectMultiple : false, - numSelectable : Number.MAX_VALUE, - clickInput : false, - rememberViewedMonth : true, - selectWeek : false, - verticalPosition : $.dpConst.POS_TOP, - horizontalPosition : $.dpConst.POS_LEFT, - verticalOffset : 0, - horizontalOffset : 0, - hoverClass : 'dp-hover', - autoFocusNextInput : false - }; - - function _getController(ele) - { - if (ele._dpId) return $.event._dpCache[ele._dpId]; - return false; - }; - - // make it so that no error is thrown if bgIframe plugin isn't included (allows you to use conditional - // comments to only include bgIframe where it is needed in IE without breaking this plugin). - if ($.fn.bgIframe == undefined) { - $.fn.bgIframe = function() {return this; }; - }; - - - // clean-up - $(window) - .bind('unload', function() { - var els = $.event._dpCache || []; - for (var i in els) { - $(els[i].ele)._dpDestroy(); - } - }); - - -})(jQuery); \ No newline at end of file diff --git a/js/jquery-1.2.6.min.js b/js/jquery-1.2.6.min.js deleted file mode 100644 index 82b98e1d7..000000000 --- a/js/jquery-1.2.6.min.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * jQuery 1.2.6 - New Wave Javascript - * - * Copyright (c) 2008 John Resig (jquery.com) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. - * - * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $ - * $Rev: 5685 $ - */ -(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else -return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else -return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else -selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else -this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else -return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else -jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else -jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("",""]||!tags.indexOf("",""]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
                          "]||!tags.indexOf("",""]||(!tags.indexOf("",""]||!tags.indexOf("",""]||jQuery.browser.msie&&[1,"div
                          ","
                          "]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf(""&&tags.indexOf("=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else -ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&¬xml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&¬xml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else -while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return im[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else -for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("
                          ").append(res.responseText.replace(//g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else -xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else -jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else -for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else -s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else -e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;ithis.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})(); \ No newline at end of file diff --git a/js/jquery.ajax_queue.js b/js/jquery.ajax_queue.js deleted file mode 100644 index bdd2e4f82..000000000 --- a/js/jquery.ajax_queue.js +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Ajax Queue Plugin - * - * Homepage: http://jquery.com/plugins/project/ajaxqueue - * Documentation: http://docs.jquery.com/AjaxQueue - */ - -/** - - -
                            - - */ -/* - * Queued Ajax requests. - * A new Ajax request won't be started until the previous queued - * request has finished. - */ - -/* - * Synced Ajax requests. - * The Ajax request will happen as soon as you call this method, but - * the callbacks (success/error/complete) won't fire until all previous - * synced requests have been completed. - */ - - -(function($) { - - var ajax = $.ajax; - - var pendingRequests = {}; - - var synced = []; - var syncedData = []; - - $.ajax = function(settings) { - // create settings for compatibility with ajaxSetup - settings = jQuery.extend(settings, jQuery.extend({}, jQuery.ajaxSettings, settings)); - - var port = settings.port; - - switch(settings.mode) { - case "abort": - if ( pendingRequests[port] ) { - pendingRequests[port].abort(); - } - return pendingRequests[port] = ajax.apply(this, arguments); - case "queue": - var _old = settings.complete; - settings.complete = function(){ - if ( _old ) - _old.apply( this, arguments ); - jQuery([ajax]).dequeue("ajax" + port );; - }; - - jQuery([ ajax ]).queue("ajax" + port, function(){ - ajax( settings ); - }); - return; - case "sync": - var pos = synced.length; - - synced[ pos ] = { - error: settings.error, - success: settings.success, - complete: settings.complete, - done: false - }; - - syncedData[ pos ] = { - error: [], - success: [], - complete: [] - }; - - settings.error = function(){ syncedData[ pos ].error = arguments; }; - settings.success = function(){ syncedData[ pos ].success = arguments; }; - settings.complete = function(){ - syncedData[ pos ].complete = arguments; - synced[ pos ].done = true; - - if ( pos == 0 || !synced[ pos-1 ] ) - for ( var i = pos; i < synced.length && synced[i].done; i++ ) { - if ( synced[i].error ) synced[i].error.apply( jQuery, syncedData[i].error ); - if ( synced[i].success ) synced[i].success.apply( jQuery, syncedData[i].success ); - if ( synced[i].complete ) synced[i].complete.apply( jQuery, syncedData[i].complete ); - - synced[i] = null; - syncedData[i] = null; - } - }; - } - return ajax.apply(this, arguments); - }; - -})(jQuery); \ No newline at end of file diff --git a/js/jquery.autocomplete.js b/js/jquery.autocomplete.js deleted file mode 100644 index e884e1d2a..000000000 --- a/js/jquery.autocomplete.js +++ /dev/null @@ -1,760 +0,0 @@ -/* - * Autocomplete - jQuery plugin 1.0.2 - * - * Copyright (c) 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer - * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * Revision: $Id: jquery.autocomplete.js 5747 2008-06-25 18:30:55Z joern.zaefferer $ - * - */ - -;(function($) { - -$.fn.extend({ - autocomplete: function(urlOrData, options) { - var isUrl = typeof urlOrData == "string"; - options = $.extend({}, $.Autocompleter.defaults, { - url: isUrl ? urlOrData : null, - data: isUrl ? null : urlOrData, - delay: isUrl ? $.Autocompleter.defaults.delay : 10, - max: options && !options.scroll ? 10 : 150 - }, options); - - // if highlight is set to false, replace it with a do-nothing function - options.highlight = options.highlight || function(value) { return value; }; - - // if the formatMatch option is not specified, then use formatItem for backwards compatibility - options.formatMatch = options.formatMatch || options.formatItem; - - return this.each(function() { - new $.Autocompleter(this, options); - }); - }, - result: function(handler) { - return this.bind("result", handler); - }, - search: function(handler) { - return this.trigger("search", [handler]); - }, - flushCache: function() { - return this.trigger("flushCache"); - }, - setOptions: function(options){ - return this.trigger("setOptions", [options]); - }, - unautocomplete: function() { - return this.trigger("unautocomplete"); - } -}); - -$.Autocompleter = function(input, options) { - - var KEY = { - UP: 38, - DOWN: 40, - DEL: 46, - TAB: 9, - RETURN: 13, - ESC: 27, - COMMA: 188, - PAGEUP: 33, - PAGEDOWN: 34, - BACKSPACE: 8 - }; - - // Create $ object for input element - var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass); - - var timeout; - var previousValue = ""; - var cache = $.Autocompleter.Cache(options); - var hasFocus = 0; - var lastKeyPressCode; - var config = { - mouseDownOnSelect: false - }; - var select = $.Autocompleter.Select(options, input, selectCurrent, config); - - var blockSubmit; - - // prevent form submit in opera when selecting with return key - $.browser.opera && $(input.form).bind("submit.autocomplete", function() { - if (blockSubmit) { - blockSubmit = false; - return false; - } - }); - - // only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all - $input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) { - // track last key pressed - lastKeyPressCode = event.keyCode; - switch(event.keyCode) { - - case KEY.UP: - event.preventDefault(); - if ( select.visible() ) { - select.prev(); - } else { - onChange(0, true); - } - break; - - case KEY.DOWN: - event.preventDefault(); - if ( select.visible() ) { - select.next(); - } else { - onChange(0, true); - } - break; - - case KEY.PAGEUP: - event.preventDefault(); - if ( select.visible() ) { - select.pageUp(); - } else { - onChange(0, true); - } - break; - - case KEY.PAGEDOWN: - event.preventDefault(); - if ( select.visible() ) { - select.pageDown(); - } else { - onChange(0, true); - } - break; - - // matches also semicolon - case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA: - case KEY.TAB: - case KEY.RETURN: - if( selectCurrent() ) { - // stop default to prevent a form submit, Opera needs special handling - event.preventDefault(); - blockSubmit = true; - return false; - } - break; - - case KEY.ESC: - select.hide(); - break; - - default: - clearTimeout(timeout); - timeout = setTimeout(onChange, options.delay); - break; - } - }).focus(function(){ - // track whether the field has focus, we shouldn't process any - // results if the field no longer has focus - hasFocus++; - }).blur(function() { - hasFocus = 0; - if (!config.mouseDownOnSelect) { - hideResults(); - } - }).click(function() { - // show select when clicking in a focused field - if ( hasFocus++ > 1 && !select.visible() ) { - onChange(0, true); - } - }).bind("search", function() { - // TODO why not just specifying both arguments? - var fn = (arguments.length > 1) ? arguments[1] : null; - function findValueCallback(q, data) { - var result; - if( data && data.length ) { - for (var i=0; i < data.length; i++) { - if( data[i].result.toLowerCase() == q.toLowerCase() ) { - result = data[i]; - break; - } - } - } - if( typeof fn == "function" ) fn(result); - else $input.trigger("result", result && [result.data, result.value]); - } - $.each(trimWords($input.val()), function(i, value) { - request(value, findValueCallback, findValueCallback); - }); - }).bind("flushCache", function() { - cache.flush(); - }).bind("setOptions", function() { - $.extend(options, arguments[1]); - // if we've updated the data, repopulate - if ( "data" in arguments[1] ) - cache.populate(); - }).bind("unautocomplete", function() { - select.unbind(); - $input.unbind(); - $(input.form).unbind(".autocomplete"); - }); - - - function selectCurrent() { - var selected = select.selected(); - if( !selected ) - return false; - - var v = selected.result; - previousValue = v; - - if ( options.multiple ) { - var words = trimWords($input.val()); - if ( words.length > 1 ) { - v = words.slice(0, words.length - 1).join( options.multipleSeparator ) + options.multipleSeparator + v; - } - v += options.multipleSeparator; - } - - $input.val(v); - hideResultsNow(); - $input.trigger("result", [selected.data, selected.value]); - return true; - } - - function onChange(crap, skipPrevCheck) { - if( lastKeyPressCode == KEY.DEL ) { - select.hide(); - return; - } - - var currentValue = $input.val(); - - if ( !skipPrevCheck && currentValue == previousValue ) - return; - - previousValue = currentValue; - - currentValue = lastWord(currentValue); - if ( currentValue.length >= options.minChars) { - $input.addClass(options.loadingClass); - if (!options.matchCase) - currentValue = currentValue.toLowerCase(); - request(currentValue, receiveData, hideResultsNow); - } else { - stopLoading(); - select.hide(); - } - }; - - function trimWords(value) { - if ( !value ) { - return [""]; - } - var words = value.split( options.multipleSeparator ); - var result = []; - $.each(words, function(i, value) { - if ( $.trim(value) ) - result[i] = $.trim(value); - }); - return result; - } - - function lastWord(value) { - if ( !options.multiple ) - return value; - var words = trimWords(value); - return words[words.length - 1]; - } - - // fills in the input box w/the first match (assumed to be the best match) - // q: the term entered - // sValue: the first matching result - function autoFill(q, sValue){ - // autofill in the complete box w/the first match as long as the user hasn't entered in more data - // if the last user key pressed was backspace, don't autofill - if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) { - // fill in the value (keep the case the user has typed) - $input.val($input.val() + sValue.substring(lastWord(previousValue).length)); - // select the portion of the value not typed by the user (so the next character will erase) - $.Autocompleter.Selection(input, previousValue.length, previousValue.length + sValue.length); - } - }; - - function hideResults() { - clearTimeout(timeout); - timeout = setTimeout(hideResultsNow, 200); - }; - - function hideResultsNow() { - var wasVisible = select.visible(); - select.hide(); - clearTimeout(timeout); - stopLoading(); - if (options.mustMatch) { - // call search and run callback - $input.search( - function (result){ - // if no value found, clear the input box - if( !result ) { - if (options.multiple) { - var words = trimWords($input.val()).slice(0, -1); - $input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") ); - } - else - $input.val( "" ); - } - } - ); - } - if (wasVisible) - // position cursor at end of input field - $.Autocompleter.Selection(input, input.value.length, input.value.length); - }; - - function receiveData(q, data) { - if ( data && data.length && hasFocus ) { - stopLoading(); - select.display(data, q); - autoFill(q, data[0].value); - select.show(); - } else { - hideResultsNow(); - } - }; - - function request(term, success, failure) { - if (!options.matchCase) - term = term.toLowerCase(); - var data = cache.load(term); - // recieve the cached data - if (data && data.length) { - success(term, data); - // if an AJAX url has been supplied, try loading the data now - } else if( (typeof options.url == "string") && (options.url.length > 0) ){ - - var extraParams = { - timestamp: +new Date() - }; - $.each(options.extraParams, function(key, param) { - extraParams[key] = typeof param == "function" ? param() : param; - }); - - $.ajax({ - // try to leverage ajaxQueue plugin to abort previous requests - mode: "abort", - // limit abortion to this input - port: "autocomplete" + input.name, - dataType: options.dataType, - url: options.url, - type:"POST", - data: $.extend({ - q: lastWord(term), - limit: options.max - }, extraParams), - success: function(data) { - var parsed = options.parse && options.parse(data) || parse(data); - cache.add(term, parsed); - success(term, parsed); - } - }); - } else { - // if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match - select.emptyList(); - failure(term); - } - }; - - function parse(data) { - var parsed = []; - var rows = data.split("\n"); - for (var i=0; i < rows.length; i++) { - var row = $.trim(rows[i]); - if (row) { - row = row.split("|"); - parsed[parsed.length] = { - data: row, - value: row[0], - result: options.formatResult && options.formatResult(row, row[0]) || row[0] - }; - } - } - return parsed; - }; - - function stopLoading() { - $input.removeClass(options.loadingClass); - }; - -}; - -$.Autocompleter.defaults = { - inputClass: "ac_input", - resultsClass: "ac_results", - loadingClass: "ac_loading", - minChars: 1, - delay: 400, - matchCase: false, - matchSubset: true, - matchContains: false, - cacheLength: 10, - max: 100, - mustMatch: false, - extraParams: {}, - selectFirst: true, - formatItem: function(row) { return row[0]; }, - formatMatch: null, - autoFill: false, - width: 0, - multiple: false, - multipleSeparator: ", ", - highlight: function(value, term) { - return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "$1"); - }, - scroll: true, - scrollHeight: 180 -}; - -$.Autocompleter.Cache = function(options) { - - var data = {}; - var length = 0; - - function matchSubset(s, sub) { - if (!options.matchCase) - s = s.toLowerCase(); - var i = s.indexOf(sub); - if (i == -1) return false; - return i == 0 || options.matchContains; - }; - - function add(q, value) { - if (length > options.cacheLength){ - flush(); - } - if (!data[q]){ - length++; - } - data[q] = value; - } - - function populate(){ - if( !options.data ) return false; - // track the matches - var stMatchSets = {}, - nullData = 0; - - // no url was specified, we need to adjust the cache length to make sure it fits the local data store - if( !options.url ) options.cacheLength = 1; - - // track all options for minChars = 0 - stMatchSets[""] = []; - - // loop through the array and create a lookup structure - for ( var i = 0, ol = options.data.length; i < ol; i++ ) { - var rawValue = options.data[i]; - // if rawValue is a string, make an array otherwise just reference the array - rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue; - - var value = options.formatMatch(rawValue, i+1, options.data.length); - if ( value === false ) - continue; - - var firstChar = value.charAt(0).toLowerCase(); - // if no lookup array for this character exists, look it up now - if( !stMatchSets[firstChar] ) - stMatchSets[firstChar] = []; - - // if the match is a string - var row = { - value: value, - data: rawValue, - result: options.formatResult && options.formatResult(rawValue) || value - }; - - // push the current match into the set list - stMatchSets[firstChar].push(row); - - // keep track of minChars zero items - if ( nullData++ < options.max ) { - stMatchSets[""].push(row); - } - }; - - // add the data items to the cache - $.each(stMatchSets, function(i, value) { - // increase the cache size - options.cacheLength++; - // add to the cache - add(i, value); - }); - } - - // populate any existing data - setTimeout(populate, 25); - - function flush(){ - data = {}; - length = 0; - } - - return { - flush: flush, - add: add, - populate: populate, - load: function(q) { - if (!options.cacheLength || !length) - return null; - /* - * if dealing w/local data and matchContains than we must make sure - * to loop through all the data collections looking for matches - */ - if( !options.url && options.matchContains ){ - // track all matches - var csub = []; - // loop through all the data grids for matches - for( var k in data ){ - // don't search through the stMatchSets[""] (minChars: 0) cache - // this prevents duplicates - if( k.length > 0 ){ - var c = data[k]; - $.each(c, function(i, x) { - // if we've got a match, add it to the array - if (matchSubset(x.value, q)) { - csub.push(x); - } - }); - } - } - return csub; - } else - // if the exact item exists, use it - if (data[q]){ - return data[q]; - } else - if (options.matchSubset) { - for (var i = q.length - 1; i >= options.minChars; i--) { - var c = data[q.substr(0, i)]; - if (c) { - var csub = []; - $.each(c, function(i, x) { - if (matchSubset(x.value, q)) { - csub[csub.length] = x; - } - }); - return csub; - } - } - } - return null; - } - }; -}; - -$.Autocompleter.Select = function (options, input, select, config) { - var CLASSES = { - ACTIVE: "ac_over" - }; - - var listItems, - active = -1, - data, - term = "", - needsInit = true, - element, - list; - - // Create results - function init() { - if (!needsInit) - return; - element = $("
                            ") - .hide() - .addClass(options.resultsClass) - .css("position", "absolute") - .appendTo(document.body); - - list = $("
                              ").appendTo(element).mouseover( function(event) { - if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') { - active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event)); - $(target(event)).addClass(CLASSES.ACTIVE); - } - }).click(function(event) { - $(target(event)).addClass(CLASSES.ACTIVE); - select(); - // TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus - input.focus(); - return false; - }).mousedown(function() { - config.mouseDownOnSelect = true; - }).mouseup(function() { - config.mouseDownOnSelect = false; - }); - - if( options.width > 0 ) - element.css("width", options.width); - - needsInit = false; - } - - function target(event) { - var element = event.target; - while(element && element.tagName != "LI") - element = element.parentNode; - // more fun with IE, sometimes event.target is empty, just ignore it then - if(!element) - return []; - return element; - } - - function moveSelect(step) { - listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE); - movePosition(step); - var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE); - if(options.scroll) { - var offset = 0; - listItems.slice(0, active).each(function() { - offset += this.offsetHeight; - }); - if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) { - list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight()); - } else if(offset < list.scrollTop()) { - list.scrollTop(offset); - } - } - }; - - function movePosition(step) { - active += step; - if (active < 0) { - active = listItems.size() - 1; - } else if (active >= listItems.size()) { - active = 0; - } - } - - function limitNumberOfItems(available) { - return options.max && options.max < available - ? options.max - : available; - } - - function fillList() { - list.empty(); - var max = limitNumberOfItems(data.length); - for (var i=0; i < max; i++) { - if (!data[i]) - continue; - var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term); - if ( formatted === false ) - continue; - var li = $("
                            • ").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0]; - $.data(li, "ac_data", data[i]); - } - listItems = list.find("li"); - if ( options.selectFirst ) { - listItems.slice(0, 1).addClass(CLASSES.ACTIVE); - active = 0; - } - // apply bgiframe if available - if ( $.fn.bgiframe ) - list.bgiframe(); - } - - return { - display: function(d, q) { - init(); - data = d; - term = q; - fillList(); - }, - next: function() { - moveSelect(1); - }, - prev: function() { - moveSelect(-1); - }, - pageUp: function() { - if (active != 0 && active - 8 < 0) { - moveSelect( -active ); - } else { - moveSelect(-8); - } - }, - pageDown: function() { - if (active != listItems.size() - 1 && active + 8 > listItems.size()) { - moveSelect( listItems.size() - 1 - active ); - } else { - moveSelect(8); - } - }, - hide: function() { - element && element.hide(); - listItems && listItems.removeClass(CLASSES.ACTIVE); - active = -1; - }, - visible : function() { - return element && element.is(":visible"); - }, - current: function() { - return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]); - }, - show: function() { - var offset = $(input).offset(); - element.css({ - width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(), - top: offset.top + input.offsetHeight, - left: offset.left - }).show(); - if(options.scroll) { - list.scrollTop(0); - list.css({ - maxHeight: options.scrollHeight, - overflow: 'auto' - }); - - if($.browser.msie && typeof document.body.style.maxHeight === "undefined") { - var listHeight = 0; - listItems.each(function() { - listHeight += this.offsetHeight; - }); - var scrollbarsVisible = listHeight > options.scrollHeight; - list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight ); - if (!scrollbarsVisible) { - // IE doesn't recalculate width when scrollbar disappears - listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) ); - } - } - - } - }, - selected: function() { - var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE); - return selected && selected.length && $.data(selected[0], "ac_data"); - }, - emptyList: function (){ - list && list.empty(); - }, - unbind: function() { - element && element.remove(); - } - }; -}; - -$.Autocompleter.Selection = function(field, start, end) { - if( field.createTextRange ){ - var selRange = field.createTextRange(); - selRange.collapse(true); - selRange.moveStart("character", start); - selRange.moveEnd("character", end); - selRange.select(); - } else if( field.setSelectionRange ){ - field.setSelectionRange(start, end); - } else { - if( field.selectionStart ){ - field.selectionStart = start; - field.selectionEnd = end; - } - } - field.focus(); -}; - -})(jQuery); \ No newline at end of file diff --git a/js/jquery.bgiframe.min.js b/js/jquery.bgiframe.min.js deleted file mode 100644 index 7faef4b33..000000000 --- a/js/jquery.bgiframe.min.js +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net) - * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) - * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. - * - * $LastChangedDate: 2007-07-22 01:45:56 +0200 (Son, 22 Jul 2007) $ - * $Rev: 2447 $ - * - * Version 2.1.1 - */ -(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='
                              "); - $("#TB_overlay").click(tb_remove); - } - }else{//all others - if(document.getElementById("TB_overlay") === null){ - $("body").append("
                              "); - $("#TB_overlay").click(tb_remove); - } - } - - if(tb_detectMacXFF()){ - $("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash - }else{ - $("#TB_overlay").addClass("TB_overlayBG");//use background and opacity - } - - if(caption===null){caption="";} - $("body").append("
                              ");//add loader to the page - $('#TB_load').show();//show loader - - var baseURL; - if(url.indexOf("?")!==-1){ //ff there is a query string involved - baseURL = url.substr(0, url.indexOf("?")); - }else{ - baseURL = url; - } - - var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/; - var urlType = baseURL.toLowerCase().match(urlString); - - if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images - - TB_PrevCaption = ""; - TB_PrevURL = ""; - TB_PrevHTML = ""; - TB_NextCaption = ""; - TB_NextURL = ""; - TB_NextHTML = ""; - TB_imageCount = ""; - TB_FoundURL = false; - if(imageGroup){ - TB_TempArray = $("a[@rel="+imageGroup+"]").get(); - for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) { - var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString); - if (!(TB_TempArray[TB_Counter].href == url)) { - if (TB_FoundURL) { - TB_NextCaption = TB_TempArray[TB_Counter].title; - TB_NextURL = TB_TempArray[TB_Counter].href; - TB_NextHTML = "  Next >"; - } else { - TB_PrevCaption = TB_TempArray[TB_Counter].title; - TB_PrevURL = TB_TempArray[TB_Counter].href; - TB_PrevHTML = "  < Prev"; - } - } else { - TB_FoundURL = true; - TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length); - } - } - } - - imgPreloader = new Image(); - imgPreloader.onload = function(){ - imgPreloader.onload = null; - - // Resizing large images - orginal by Christian Montoya edited by me. - var pagesize = tb_getPageSize(); - var x = pagesize[0] - 150; - var y = pagesize[1] - 150; - var imageWidth = imgPreloader.width; - var imageHeight = imgPreloader.height; - if (imageWidth > x) { - imageHeight = imageHeight * (x / imageWidth); - imageWidth = x; - if (imageHeight > y) { - imageWidth = imageWidth * (y / imageHeight); - imageHeight = y; - } - } else if (imageHeight > y) { - imageWidth = imageWidth * (y / imageHeight); - imageHeight = y; - if (imageWidth > x) { - imageHeight = imageHeight * (x / imageWidth); - imageWidth = x; - } - } - // End Resizing - - TB_WIDTH = imageWidth + 30; - TB_HEIGHT = imageHeight + 60; - $("#TB_window").append(""+caption+"" + "
                              "+caption+"
                              " + TB_imageCount + TB_PrevHTML + TB_NextHTML + "
                              "); - - $("#TB_closeWindowButton").click(tb_remove); - - if (!(TB_PrevHTML === "")) { - function goPrev(){ - if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);} - $("#TB_window").remove(); - $("body").append("
                              "); - tb_show(TB_PrevCaption, TB_PrevURL, imageGroup); - return false; - } - $("#TB_prev").click(goPrev); - } - - if (!(TB_NextHTML === "")) { - function goNext(){ - $("#TB_window").remove(); - $("body").append("
                              "); - tb_show(TB_NextCaption, TB_NextURL, imageGroup); - return false; - } - $("#TB_next").click(goNext); - - } - - document.onkeydown = function(e){ - if (e == null) { // ie - keycode = event.keyCode; - } else { // mozilla - keycode = e.which; - } - if(keycode == 27){ // close - tb_remove(); - } else if(keycode == 190){ // display previous image - if(!(TB_NextHTML == "")){ - document.onkeydown = ""; - goNext(); - } - } else if(keycode == 188){ // display next image - if(!(TB_PrevHTML == "")){ - document.onkeydown = ""; - goPrev(); - } - } - }; - - tb_position(); - $("#TB_load").remove(); - $("#TB_ImageOff").click(tb_remove); - $("#TB_window").css({display:"block"}); //for safari using css instead of show - }; - - imgPreloader.src = url; - }else{//code to show html - var params = tb_parseUrl(url); - var dims = get_dimensions(); - TB_WIDTH = (params['width']*1) + 30 || dims.width*.6;//default to 60% of window width - TB_HEIGHT = (params['height']*1) + 40 || dims.height*.85;//default to 85% of window height - ajaxContentW = TB_WIDTH - 30; - ajaxContentH = TB_HEIGHT - 45; - - if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window - urlNoQuery = url.split('TB_'); - $("#TB_iframeContent").remove(); - if(params['modal'] != "true"){//iframe no modal - $("#TB_window").append("
                              "+caption+"
                              "); - }else{//iframe modal - $("#TB_overlay").unbind(); - $("#TB_window").append(""); - } - }else{// not an iframe, ajax - if($("#TB_window").css("display") != "block"){ - if(params['modal'] != "true"){//ajax no modal - $("#TB_window").append("
                              "+caption+"
                              "); - }else{//ajax modal - $("#TB_overlay").unbind(); - $("#TB_window").append("
                              "); - } - }else{//this means the window is already up, we are just loading new content via ajax - $("#TB_ajaxContent")[0].style.width = ajaxContentW +"px"; - $("#TB_ajaxContent")[0].style.height = ajaxContentH +"px"; - $("#TB_ajaxContent")[0].scrollTop = 0; - $("#TB_ajaxWindowTitle").html(caption); - } - } - - $("#TB_closeWindowButton").click(tb_remove); - - if(url.indexOf('TB_inline') != -1){ - $("#TB_ajaxContent").append($('#' + params['inlineId']).children()); - $("#TB_window").unload(function () { - $('#' + params['inlineId']).append( $("#TB_ajaxContent").children() ); // move elements back when you're finished - }); - tb_position(); - $("#TB_load").remove(); - $("#TB_window").css({display:"block"}); - }else if(url.indexOf('TB_iframe') != -1){ - tb_position(); - if($.browser.safari){//safari needs help because it will not fire iframe onload - $("#TB_load").remove(); - $("#TB_window").css({display:"block"}); - } - }else{ - $("#TB_ajaxContent").load(url += "/random:" + (new Date().getTime()),function(){//to do a post change this load method - tb_position(); - $("#TB_load").remove(); - tb_init("#TB_ajaxContent a.thickbox"); - $("#TB_window").css({display:"block"}); - }); - } - - } - - if(!params['modal']){ - document.onkeyup = function(e){ - if (e == null) { // ie - keycode = event.keyCode; - } else { // mozilla - keycode = e.which; - } - if(keycode == 27){ // close - tb_remove(); - } - }; - } - - } catch(e) { - //nothing here - } -} - -//helper functions below -function tb_showIframe(){ - $("#TB_load").remove(); - $("#TB_window").css({display:"block"}); -} - -function tb_remove() { - $("#TB_imageOff").unbind("click"); - $("#TB_closeWindowButton").unbind("click"); - $("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();}); - $("#TB_load").remove(); - if (typeof document.body.style.maxHeight == "undefined") {//if IE 6 - $("body","html").css({height: "auto", width: "auto"}); - $("html").css("overflow",""); - } - document.onkeydown = ""; - document.onkeyup = ""; - return false; -} - -function tb_position() { -$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'}); - if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6 - $("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'}); - } -} - -function tb_parseQuery ( query ) { - var Params = {}; - if ( ! query ) {return Params;}// return empty object - var Pairs = query.split(/[;&]/); - for ( var i = 0; i < Pairs.length; i++ ) { - var KeyVal = Pairs[i].split('='); - if ( ! KeyVal || KeyVal.length != 2 ) {continue;} - var key = unescape( KeyVal[0] ); - var val = unescape( KeyVal[1] ); - val = val.replace(/\+/g, ' '); - Params[key] = val; - } - return Params; -} - -function tb_parseUrl( url ) { - var Params = {} - if( !url) {return Params;} - var Pairs = url.match(/[a-z 0-9~%.:_\-]+:[a-z 0-9~%.:_\-]+/ig); - if(Pairs==null){return Params;} - for ( var i = 0; i < Pairs.length; i++ ) { - var KeyVal = Pairs[i].split(':'); - if ( ! KeyVal || KeyVal.length != 2 ) {continue;} - var key = unescape( KeyVal[0] ); - var val = unescape( KeyVal[1] ); - val = val.replace(/\+/g, ' '); - Params[key] = val; - } - return Params; - -} - -function tb_getPageSize(){ - var de = document.documentElement; - var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; - var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; - arrayPageSize = [w,h]; - return arrayPageSize; -} - -function tb_detectMacXFF() { - var userAgent = navigator.userAgent.toLowerCase(); - if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) { - return true; - } -} - - diff --git a/license/codeigniter_license.txt b/license/codeigniter_license.txt deleted file mode 100644 index e93f3f553..000000000 --- a/license/codeigniter_license.txt +++ /dev/null @@ -1,52 +0,0 @@ -Copyright (c) 2006, EllisLab, Inc. -All rights reserved. - -This license is a legal agreement between you and EllisLab Inc. for the use -of CodeIgniter Software (the "Software"). By obtaining the Software you -agree to comply with the terms and conditions of this license. - -PERMITTED USE -You are permitted to use, copy, modify, and distribute the Software and its -documentation, with or without modification, for any purpose, provided that -the following conditions are met: - -1. A copy of this license agreement must be included with the distribution. - -2. Redistributions of source code must retain the above copyright notice in - all source code files. - -3. Redistributions in binary form must reproduce the above copyright notice - in the documentation and/or other materials provided with the distribution. - -4. Any files that have been modified must carry notices stating the nature - of the change and the names of those who changed them. - -5. Products derived from the Software must include an acknowledgment that - they are derived from CodeIgniter in their documentation and/or other - materials provided with the distribution. - -6. Products derived from the Software may not be called "CodeIgniter", - nor may "CodeIgniter" appear in their name, without prior written - permission from EllisLab, Inc. - - -INDEMNITY -You agree to indemnify and hold harmless the authors of the Software and -any contributors for any direct, indirect, incidental, or consequential -third-party claims, actions or suits, as well as any related expenses, -liabilities, damages, settlements or fees arising from your use or misuse -of the Software, or a violation of any terms of this license. - -DISCLAIMER OF WARRANTY -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR -IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF QUALITY, PERFORMANCE, -NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. - -LIMITATIONS OF LIABILITY -YOU ASSUME ALL RISK ASSOCIATED WITH THE INSTALLATION AND USE OF THE SOFTWARE. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS OF THE SOFTWARE BE LIABLE -FOR CLAIMS, DAMAGES OR OTHER LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION -WITH THE SOFTWARE. LICENSE HOLDERS ARE SOLELY RESPONSIBLE FOR DETERMINING THE -APPROPRIATENESS OF USE AND ASSUME ALL RISKS ASSOCIATED WITH ITS USE, INCLUDING -BUT NOT LIMITED TO THE RISKS OF PROGRAM ERRORS, DAMAGE TO EQUIPMENT, LOSS OF -DATA OR SOFTWARE PROGRAMS, OR UNAVAILABILITY OR INTERRUPTION OF OPERATIONS. diff --git a/license/codeigniter_version.txt b/license/codeigniter_version.txt deleted file mode 100644 index bbf649f61..000000000 --- a/license/codeigniter_version.txt +++ /dev/null @@ -1 +0,0 @@ -1.7.3 \ No newline at end of file diff --git a/license/license.txt b/license/license.txt deleted file mode 100644 index 7af154728..000000000 --- a/license/license.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (C) 2011 by Pappas Technologies, LLC - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/open-flash-chart.swf b/open-flash-chart.swf deleted file mode 100644 index 3a01e52ae..000000000 Binary files a/open-flash-chart.swf and /dev/null differ diff --git a/system/cache/index.html b/system/cache/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/cache/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

                              Directory access is forbidden.

                              - - - \ No newline at end of file diff --git a/system/codeigniter/Base4.php b/system/codeigniter/Base4.php deleted file mode 100644 index 3561c2564..000000000 --- a/system/codeigniter/Base4.php +++ /dev/null @@ -1,69 +0,0 @@ -load->library('email') to instantiate - * classes that can then be used within controllers as $this->email->send() - * - * PHP 4 also has trouble referencing the CI super object within application - * constructors since objects do not exist until the class is fully - * instantiated. Basically PHP 4 sucks... - * - * Since PHP 5 doesn't suffer from this problem so we load one of - * two files based on the version of PHP being run. - * - * @package CodeIgniter - * @subpackage codeigniter - * @category front-controller - * @author ExpressionEngine Dev Team - * @link http://codeigniter.com/user_guide/ - */ - class CI_Base extends CI_Loader { - - function CI_Base() - { - // This allows syntax like $this->load->foo() to work - parent::CI_Loader(); - $this->load =& $this; - - // This allows resources used within controller constructors to work - global $OBJ; - $OBJ = $this->load; // Do NOT use a reference. - } -} - -function &get_instance() -{ - global $CI, $OBJ; - - if (is_object($CI)) - { - return $CI; - } - - return $OBJ->load; -} - - -/* End of file Base4.php */ -/* Location: ./system/codeigniter/Base4.php */ \ No newline at end of file diff --git a/system/codeigniter/Base5.php b/system/codeigniter/Base5.php deleted file mode 100644 index 5d944ae5a..000000000 --- a/system/codeigniter/Base5.php +++ /dev/null @@ -1,56 +0,0 @@ -mark('total_execution_time_start'); -$BM->mark('loading_time_base_classes_start'); - -/* - * ------------------------------------------------------ - * Instantiate the hooks class - * ------------------------------------------------------ - */ - -$EXT =& load_class('Hooks'); - -/* - * ------------------------------------------------------ - * Is there a "pre_system" hook? - * ------------------------------------------------------ - */ -$EXT->_call_hook('pre_system'); - -/* - * ------------------------------------------------------ - * Instantiate the base classes - * ------------------------------------------------------ - */ - -$CFG =& load_class('Config'); -$URI =& load_class('URI'); -$RTR =& load_class('Router'); -$OUT =& load_class('Output'); - -/* - * ------------------------------------------------------ - * Is there a valid cache file? If so, we're done... - * ------------------------------------------------------ - */ - -if ($EXT->_call_hook('cache_override') === FALSE) -{ - if ($OUT->_display_cache($CFG, $URI) == TRUE) - { - exit; - } -} - -/* - * ------------------------------------------------------ - * Load the remaining base classes - * ------------------------------------------------------ - */ - -$IN =& load_class('Input'); -$LANG =& load_class('Language'); - -/* - * ------------------------------------------------------ - * Load the app controller and local controller - * ------------------------------------------------------ - * - * Note: Due to the poor object handling in PHP 4 we'll - * conditionally load different versions of the base - * class. Retaining PHP 4 compatibility requires a bit of a hack. - * - * Note: The Loader class needs to be included first - * - */ -if ( ! is_php('5.0.0')) -{ - load_class('Loader', FALSE); - require(BASEPATH.'codeigniter/Base4'.EXT); -} -else -{ - require(BASEPATH.'codeigniter/Base5'.EXT); -} - -// Load the base controller class -load_class('Controller', FALSE); - -// Load the local application controller -// Note: The Router class automatically validates the controller path. If this include fails it -// means that the default controller in the Routes.php file is not resolving to something valid. -if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT)) -{ - show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.'); -} - -include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT); - -// Set a mark point for benchmarking -$BM->mark('loading_time_base_classes_end'); - - -/* - * ------------------------------------------------------ - * Security check - * ------------------------------------------------------ - * - * None of the functions in the app controller or the - * loader class can be called via the URI, nor can - * controller functions that begin with an underscore - */ -$class = $RTR->fetch_class(); -$method = $RTR->fetch_method(); - -if ( ! class_exists($class) - OR $method == 'controller' - OR strncmp($method, '_', 1) == 0 - OR in_array(strtolower($method), array_map('strtolower', get_class_methods('Controller'))) - ) -{ - show_404("{$class}/{$method}"); -} - -/* - * ------------------------------------------------------ - * Is there a "pre_controller" hook? - * ------------------------------------------------------ - */ -$EXT->_call_hook('pre_controller'); - -/* - * ------------------------------------------------------ - * Instantiate the controller and call requested method - * ------------------------------------------------------ - */ - -// Mark a start point so we can benchmark the controller -$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start'); - -$CI = new $class(); - -// Is this a scaffolding request? -if ($RTR->scaffolding_request === TRUE) -{ - if ($EXT->_call_hook('scaffolding_override') === FALSE) - { - $CI->_ci_scaffolding(); - } -} -else -{ - /* - * ------------------------------------------------------ - * Is there a "post_controller_constructor" hook? - * ------------------------------------------------------ - */ - $EXT->_call_hook('post_controller_constructor'); - - // Is there a "remap" function? - if (method_exists($CI, '_remap')) - { - $CI->_remap($method); - } - else - { - // is_callable() returns TRUE on some versions of PHP 5 for private and protected - // methods, so we'll use this workaround for consistent behavior - if ( ! in_array(strtolower($method), array_map('strtolower', get_class_methods($CI)))) - { - show_404("{$class}/{$method}"); - } - - // Call the requested method. - // Any URI segments present (besides the class/function) will be passed to the method for convenience - call_user_func_array(array(&$CI, $method), array_slice($URI->rsegments, 2)); - } -} - -// Mark a benchmark end point -$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end'); - -/* - * ------------------------------------------------------ - * Is there a "post_controller" hook? - * ------------------------------------------------------ - */ -$EXT->_call_hook('post_controller'); - -/* - * ------------------------------------------------------ - * Send the final rendered output to the browser - * ------------------------------------------------------ - */ - -if ($EXT->_call_hook('display_override') === FALSE) -{ - $OUT->_display(); -} - -/* - * ------------------------------------------------------ - * Is there a "post_system" hook? - * ------------------------------------------------------ - */ -$EXT->_call_hook('post_system'); - -/* - * ------------------------------------------------------ - * Close the DB connection if one exists - * ------------------------------------------------------ - */ -if (class_exists('CI_DB') AND isset($CI->db)) -{ - $CI->db->close(); -} - - -/* End of file CodeIgniter.php */ -/* Location: ./system/codeigniter/CodeIgniter.php */ \ No newline at end of file diff --git a/system/codeigniter/Common.php b/system/codeigniter/Common.php deleted file mode 100644 index 3b84ffcc1..000000000 --- a/system/codeigniter/Common.php +++ /dev/null @@ -1,421 +0,0 @@ - 5 -* we'll set a static variable. -* -* @access public -* @param string -* @return bool -*/ -function is_php($version = '5.0.0') -{ - static $_is_php; - $version = (string)$version; - - if ( ! isset($_is_php[$version])) - { - $_is_php[$version] = (version_compare(PHP_VERSION, $version) < 0) ? FALSE : TRUE; - } - - return $_is_php[$version]; -} - -// ------------------------------------------------------------------------ - -/** - * Tests for file writability - * - * is_writable() returns TRUE on Windows servers when you really can't write to - * the file, based on the read-only attribute. is_writable() is also unreliable - * on Unix servers if safe_mode is on. - * - * @access private - * @return void - */ -function is_really_writable($file) -{ - // If we're on a Unix server with safe_mode off we call is_writable - if (DIRECTORY_SEPARATOR == '/' AND @ini_get("safe_mode") == FALSE) - { - return is_writable($file); - } - - // For windows servers and safe_mode "on" installations we'll actually - // write a file then read it. Bah... - if (is_dir($file)) - { - $file = rtrim($file, '/').'/'.md5(rand(1,100)); - - if (($fp = @fopen($file, FOPEN_WRITE_CREATE)) === FALSE) - { - return FALSE; - } - - fclose($fp); - @chmod($file, DIR_WRITE_MODE); - @unlink($file); - return TRUE; - } - elseif (($fp = @fopen($file, FOPEN_WRITE_CREATE)) === FALSE) - { - return FALSE; - } - - fclose($fp); - return TRUE; -} - -// ------------------------------------------------------------------------ - -/** -* Class registry -* -* This function acts as a singleton. If the requested class does not -* exist it is instantiated and set to a static variable. If it has -* previously been instantiated the variable is returned. -* -* @access public -* @param string the class name being requested -* @param bool optional flag that lets classes get loaded but not instantiated -* @return object -*/ -function &load_class($class, $instantiate = TRUE) -{ - static $objects = array(); - - // Does the class exist? If so, we're done... - if (isset($objects[$class])) - { - return $objects[$class]; - } - - // If the requested class does not exist in the application/libraries - // folder we'll load the native class from the system/libraries folder. - if (file_exists(APPPATH.'libraries/'.config_item('subclass_prefix').$class.EXT)) - { - require(BASEPATH.'libraries/'.$class.EXT); - require(APPPATH.'libraries/'.config_item('subclass_prefix').$class.EXT); - $is_subclass = TRUE; - } - else - { - if (file_exists(APPPATH.'libraries/'.$class.EXT)) - { - require(APPPATH.'libraries/'.$class.EXT); - $is_subclass = FALSE; - } - else - { - require(BASEPATH.'libraries/'.$class.EXT); - $is_subclass = FALSE; - } - } - - if ($instantiate == FALSE) - { - $objects[$class] = TRUE; - return $objects[$class]; - } - - if ($is_subclass == TRUE) - { - $name = config_item('subclass_prefix').$class; - - $objects[$class] =& instantiate_class(new $name()); - return $objects[$class]; - } - - $name = ($class != 'Controller') ? 'CI_'.$class : $class; - - $objects[$class] =& instantiate_class(new $name()); - return $objects[$class]; -} - -/** - * Instantiate Class - * - * Returns a new class object by reference, used by load_class() and the DB class. - * Required to retain PHP 4 compatibility and also not make PHP 5.3 cry. - * - * Use: $obj =& instantiate_class(new Foo()); - * - * @access public - * @param object - * @return object - */ -function &instantiate_class(&$class_object) -{ - return $class_object; -} - -/** -* Loads the main config.php file -* -* @access private -* @return array -*/ -function &get_config() -{ - static $main_conf; - - if ( ! isset($main_conf)) - { - if ( ! file_exists(APPPATH.'config/config'.EXT)) - { - exit('The configuration file config'.EXT.' does not exist.'); - } - - require(APPPATH.'config/config'.EXT); - - if ( ! isset($config) OR ! is_array($config)) - { - exit('Your config file does not appear to be formatted correctly.'); - } - - $main_conf[0] =& $config; - } - return $main_conf[0]; -} - -/** -* Gets a config item -* -* @access public -* @return mixed -*/ -function config_item($item) -{ - static $config_item = array(); - - if ( ! isset($config_item[$item])) - { - $config =& get_config(); - - if ( ! isset($config[$item])) - { - return FALSE; - } - $config_item[$item] = $config[$item]; - } - - return $config_item[$item]; -} - - -/** -* Error Handler -* -* This function lets us invoke the exception class and -* display errors using the standard error template located -* in application/errors/errors.php -* This function will send the error page directly to the -* browser and exit. -* -* @access public -* @return void -*/ -function show_error($message, $status_code = 500) -{ - $error =& load_class('Exceptions'); - echo $error->show_error('An Error Was Encountered', $message, 'error_general', $status_code); - exit; -} - - -/** -* 404 Page Handler -* -* This function is similar to the show_error() function above -* However, instead of the standard error template it displays -* 404 errors. -* -* @access public -* @return void -*/ -function show_404($page = '') -{ - $error =& load_class('Exceptions'); - $error->show_404($page); - exit; -} - - -/** -* Error Logging Interface -* -* We use this as a simple mechanism to access the logging -* class and send messages to be logged. -* -* @access public -* @return void -*/ -function log_message($level = 'error', $message, $php_error = FALSE) -{ - static $LOG; - - $config =& get_config(); - if ($config['log_threshold'] == 0) - { - return; - } - - $LOG =& load_class('Log'); - $LOG->write_log($level, $message, $php_error); -} - - -/** - * Set HTTP Status Header - * - * @access public - * @param int the status code - * @param string - * @return void - */ -function set_status_header($code = 200, $text = '') -{ - $stati = array( - 200 => 'OK', - 201 => 'Created', - 202 => 'Accepted', - 203 => 'Non-Authoritative Information', - 204 => 'No Content', - 205 => 'Reset Content', - 206 => 'Partial Content', - - 300 => 'Multiple Choices', - 301 => 'Moved Permanently', - 302 => 'Found', - 304 => 'Not Modified', - 305 => 'Use Proxy', - 307 => 'Temporary Redirect', - - 400 => 'Bad Request', - 401 => 'Unauthorized', - 403 => 'Forbidden', - 404 => 'Not Found', - 405 => 'Method Not Allowed', - 406 => 'Not Acceptable', - 407 => 'Proxy Authentication Required', - 408 => 'Request Timeout', - 409 => 'Conflict', - 410 => 'Gone', - 411 => 'Length Required', - 412 => 'Precondition Failed', - 413 => 'Request Entity Too Large', - 414 => 'Request-URI Too Long', - 415 => 'Unsupported Media Type', - 416 => 'Requested Range Not Satisfiable', - 417 => 'Expectation Failed', - - 500 => 'Internal Server Error', - 501 => 'Not Implemented', - 502 => 'Bad Gateway', - 503 => 'Service Unavailable', - 504 => 'Gateway Timeout', - 505 => 'HTTP Version Not Supported' - ); - - if ($code == '' OR ! is_numeric($code)) - { - show_error('Status codes must be numeric', 500); - } - - if (isset($stati[$code]) AND $text == '') - { - $text = $stati[$code]; - } - - if ($text == '') - { - show_error('No status text available. Please check your status code number or supply your own message text.', 500); - } - - $server_protocol = (isset($_SERVER['SERVER_PROTOCOL'])) ? $_SERVER['SERVER_PROTOCOL'] : FALSE; - - if (substr(php_sapi_name(), 0, 3) == 'cgi') - { - header("Status: {$code} {$text}", TRUE); - } - elseif ($server_protocol == 'HTTP/1.1' OR $server_protocol == 'HTTP/1.0') - { - header($server_protocol." {$code} {$text}", TRUE, $code); - } - else - { - header("HTTP/1.1 {$code} {$text}", TRUE, $code); - } -} - - -/** -* Exception Handler -* -* This is the custom exception handler that is declaired at the top -* of Codeigniter.php. The main reason we use this is permit -* PHP errors to be logged in our own log files since we may -* not have access to server logs. Since this function -* effectively intercepts PHP errors, however, we also need -* to display errors based on the current error_reporting level. -* We do that with the use of a PHP error template. -* -* @access private -* @return void -*/ -function _exception_handler($severity, $message, $filepath, $line) -{ - // We don't bother with "strict" notices since they will fill up - // the log file with information that isn't normally very - // helpful. For example, if you are running PHP 5 and you - // use version 4 style class functions (without prefixes - // like "public", "private", etc.) you'll get notices telling - // you that these have been deprecated. - - if ($severity == E_STRICT) - { - return; - } - - $error =& load_class('Exceptions'); - - // Should we display the error? - // We'll get the current error_reporting level and add its bits - // with the severity bits to find out. - - if (($severity & error_reporting()) == $severity) - { - $error->show_php_error($severity, $message, $filepath, $line); - } - - // Should we log the error? No? We're done... - $config =& get_config(); - if ($config['log_threshold'] == 0) - { - return; - } - - $error->log_exception($severity, $message, $filepath, $line); -} - - - -/* End of file Common.php */ -/* Location: ./system/codeigniter/Common.php */ \ No newline at end of file diff --git a/system/codeigniter/Compat.php b/system/codeigniter/Compat.php deleted file mode 100644 index 40017a93b..000000000 --- a/system/codeigniter/Compat.php +++ /dev/null @@ -1,93 +0,0 @@ - - - 403 Forbidden - - - -

                              Directory access is forbidden.

                              - - - \ No newline at end of file diff --git a/system/database/DB.php b/system/database/DB.php deleted file mode 100644 index f174687ca..000000000 --- a/system/database/DB.php +++ /dev/null @@ -1,146 +0,0 @@ - $dns['scheme'], - 'hostname' => (isset($dns['host'])) ? rawurldecode($dns['host']) : '', - 'username' => (isset($dns['user'])) ? rawurldecode($dns['user']) : '', - 'password' => (isset($dns['pass'])) ? rawurldecode($dns['pass']) : '', - 'database' => (isset($dns['path'])) ? rawurldecode(substr($dns['path'], 1)) : '' - ); - - // were additional config items set? - if (isset($dns['query'])) - { - parse_str($dns['query'], $extra); - - foreach($extra as $key => $val) - { - // booleans please - if (strtoupper($val) == "TRUE") - { - $val = TRUE; - } - elseif (strtoupper($val) == "FALSE") - { - $val = FALSE; - } - - $params[$key] = $val; - } - } - } - - // No DB specified yet? Beat them senseless... - if ( ! isset($params['dbdriver']) OR $params['dbdriver'] == '') - { - show_error('You have not selected a database type to connect to.'); - } - - // Load the DB classes. Note: Since the active record class is optional - // we need to dynamically create a class that extends proper parent class - // based on whether we're using the active record class or not. - // Kudos to Paul for discovering this clever use of eval() - - if ($active_record_override == TRUE) - { - $active_record = TRUE; - } - - require_once(BASEPATH.'database/DB_driver'.EXT); - - if ( ! isset($active_record) OR $active_record == TRUE) - { - require_once(BASEPATH.'database/DB_active_rec'.EXT); - - if ( ! class_exists('CI_DB')) - { - eval('class CI_DB extends CI_DB_active_record { }'); - } - } - else - { - if ( ! class_exists('CI_DB')) - { - eval('class CI_DB extends CI_DB_driver { }'); - } - } - - require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver'.EXT); - - // Instantiate the DB adapter - $driver = 'CI_DB_'.$params['dbdriver'].'_driver'; - $DB =& instantiate_class(new $driver($params)); - - if ($DB->autoinit == TRUE) - { - $DB->initialize(); - } - - return $DB; -} - - - -/* End of file DB.php */ -/* Location: ./system/database/DB.php */ \ No newline at end of file diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php deleted file mode 100644 index bf4d5117e..000000000 --- a/system/database/DB_active_rec.php +++ /dev/null @@ -1,1820 +0,0 @@ -_protect_identifiers = $escape; - } - - if (is_string($select)) - { - $select = explode(',', $select); - } - - foreach ($select as $val) - { - $val = trim($val); - - if ($val != '') - { - $this->ar_select[] = $val; - - if ($this->ar_caching === TRUE) - { - $this->ar_cache_select[] = $val; - $this->ar_cache_exists[] = 'select'; - } - } - } - return $this; - } - - // -------------------------------------------------------------------- - - /** - * Select Max - * - * Generates a SELECT MAX(field) portion of a query - * - * @access public - * @param string the field - * @param string an alias - * @return object - */ - function select_max($select = '', $alias = '') - { - return $this->_max_min_avg_sum($select, $alias, 'MAX'); - } - - // -------------------------------------------------------------------- - - /** - * Select Min - * - * Generates a SELECT MIN(field) portion of a query - * - * @access public - * @param string the field - * @param string an alias - * @return object - */ - function select_min($select = '', $alias = '') - { - return $this->_max_min_avg_sum($select, $alias, 'MIN'); - } - - // -------------------------------------------------------------------- - - /** - * Select Average - * - * Generates a SELECT AVG(field) portion of a query - * - * @access public - * @param string the field - * @param string an alias - * @return object - */ - function select_avg($select = '', $alias = '') - { - return $this->_max_min_avg_sum($select, $alias, 'AVG'); - } - - // -------------------------------------------------------------------- - - /** - * Select Sum - * - * Generates a SELECT SUM(field) portion of a query - * - * @access public - * @param string the field - * @param string an alias - * @return object - */ - function select_sum($select = '', $alias = '') - { - return $this->_max_min_avg_sum($select, $alias, 'SUM'); - } - - // -------------------------------------------------------------------- - - /** - * Processing Function for the four functions above: - * - * select_max() - * select_min() - * select_avg() - * select_sum() - * - * @access public - * @param string the field - * @param string an alias - * @return object - */ - function _max_min_avg_sum($select = '', $alias = '', $type = 'MAX') - { - if ( ! is_string($select) OR $select == '') - { - $this->display_error('db_invalid_query'); - } - - $type = strtoupper($type); - - if ( ! in_array($type, array('MAX', 'MIN', 'AVG', 'SUM'))) - { - show_error('Invalid function type: '.$type); - } - - if ($alias == '') - { - $alias = $this->_create_alias_from_table(trim($select)); - } - - $sql = $type.'('.$this->_protect_identifiers(trim($select)).') AS '.$alias; - - $this->ar_select[] = $sql; - - if ($this->ar_caching === TRUE) - { - $this->ar_cache_select[] = $sql; - $this->ar_cache_exists[] = 'select'; - } - - return $this; - } - - // -------------------------------------------------------------------- - - /** - * Determines the alias name based on the table - * - * @access private - * @param string - * @return string - */ - function _create_alias_from_table($item) - { - if (strpos($item, '.') !== FALSE) - { - return end(explode('.', $item)); - } - - return $item; - } - - // -------------------------------------------------------------------- - - /** - * DISTINCT - * - * Sets a flag which tells the query string compiler to add DISTINCT - * - * @access public - * @param bool - * @return object - */ - function distinct($val = TRUE) - { - $this->ar_distinct = (is_bool($val)) ? $val : TRUE; - return $this; - } - - // -------------------------------------------------------------------- - - /** - * From - * - * Generates the FROM portion of the query - * - * @access public - * @param mixed can be a string or array - * @return object - */ - function from($from) - { - foreach ((array)$from as $val) - { - if (strpos($val, ',') !== FALSE) - { - foreach (explode(',', $val) as $v) - { - $v = trim($v); - $this->_track_aliases($v); - - $this->ar_from[] = $this->_protect_identifiers($v, TRUE, NULL, FALSE); - - if ($this->ar_caching === TRUE) - { - $this->ar_cache_from[] = $this->_protect_identifiers($v, TRUE, NULL, FALSE); - $this->ar_cache_exists[] = 'from'; - } - } - - } - else - { - $val = trim($val); - - // Extract any aliases that might exist. We use this information - // in the _protect_identifiers to know whether to add a table prefix - $this->_track_aliases($val); - - $this->ar_from[] = $this->_protect_identifiers($val, TRUE, NULL, FALSE); - - if ($this->ar_caching === TRUE) - { - $this->ar_cache_from[] = $this->_protect_identifiers($val, TRUE, NULL, FALSE); - $this->ar_cache_exists[] = 'from'; - } - } - } - - return $this; - } - - // -------------------------------------------------------------------- - - /** - * Join - * - * Generates the JOIN portion of the query - * - * @access public - * @param string - * @param string the join condition - * @param string the type of join - * @return object - */ - function join($table, $cond, $type = '') - { - if ($type != '') - { - $type = strtoupper(trim($type)); - - if ( ! in_array($type, array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER'))) - { - $type = ''; - } - else - { - $type .= ' '; - } - } - - // Extract any aliases that might exist. We use this information - // in the _protect_identifiers to know whether to add a table prefix - $this->_track_aliases($table); - - // Strip apart the condition and protect the identifiers - if (preg_match('/([\w\.]+)([\W\s]+)(.+)/', $cond, $match)) - { - $match[1] = $this->_protect_identifiers($match[1]); - $match[3] = $this->_protect_identifiers($match[3]); - - $cond = $match[1].$match[2].$match[3]; - } - - // Assemble the JOIN statement - $join = $type.'JOIN '.$this->_protect_identifiers($table, TRUE, NULL, FALSE).' ON '.$cond; - - $this->ar_join[] = $join; - if ($this->ar_caching === TRUE) - { - $this->ar_cache_join[] = $join; - $this->ar_cache_exists[] = 'join'; - } - - return $this; - } - - // -------------------------------------------------------------------- - - /** - * Where - * - * Generates the WHERE portion of the query. Separates - * multiple calls with AND - * - * @access public - * @param mixed - * @param mixed - * @return object - */ - function where($key, $value = NULL, $escape = TRUE) - { - return $this->_where($key, $value, 'AND ', $escape); - } - - // -------------------------------------------------------------------- - - /** - * OR Where - * - * Generates the WHERE portion of the query. Separates - * multiple calls with OR - * - * @access public - * @param mixed - * @param mixed - * @return object - */ - function or_where($key, $value = NULL, $escape = TRUE) - { - return $this->_where($key, $value, 'OR ', $escape); - } - - // -------------------------------------------------------------------- - - /** - * orwhere() is an alias of or_where() - * this function is here for backwards compatibility, as - * orwhere() has been deprecated - */ - function orwhere($key, $value = NULL, $escape = TRUE) - { - return $this->or_where($key, $value, $escape); - } - - // -------------------------------------------------------------------- - - /** - * Where - * - * Called by where() or orwhere() - * - * @access private - * @param mixed - * @param mixed - * @param string - * @return object - */ - function _where($key, $value = NULL, $type = 'AND ', $escape = NULL) - { - if ( ! is_array($key)) - { - $key = array($key => $value); - } - - // If the escape value was not set will will base it on the global setting - if ( ! is_bool($escape)) - { - $escape = $this->_protect_identifiers; - } - - foreach ($key as $k => $v) - { - $prefix = (count($this->ar_where) == 0 AND count($this->ar_cache_where) == 0) ? '' : $type; - - if (is_null($v) && ! $this->_has_operator($k)) - { - // value appears not to have been set, assign the test to IS NULL - $k .= ' IS NULL'; - } - - if ( ! is_null($v)) - { - if ($escape === TRUE) - { - $k = $this->_protect_identifiers($k, FALSE, $escape); - - $v = ' '.$this->escape($v); - } - - if ( ! $this->_has_operator($k)) - { - $k .= ' ='; - } - } - else - { - $k = $this->_protect_identifiers($k, FALSE, $escape); - } - - $this->ar_where[] = $prefix.$k.$v; - - if ($this->ar_caching === TRUE) - { - $this->ar_cache_where[] = $prefix.$k.$v; - $this->ar_cache_exists[] = 'where'; - } - - } - - return $this; - } - - // -------------------------------------------------------------------- - - /** - * Where_in - * - * Generates a WHERE field IN ('item', 'item') SQL query joined with - * AND if appropriate - * - * @access public - * @param string The field to search - * @param array The values searched on - * @return object - */ - function where_in($key = NULL, $values = NULL) - { - return $this->_where_in($key, $values); - } - - // -------------------------------------------------------------------- - - /** - * Where_in_or - * - * Generates a WHERE field IN ('item', 'item') SQL query joined with - * OR if appropriate - * - * @access public - * @param string The field to search - * @param array The values searched on - * @return object - */ - function or_where_in($key = NULL, $values = NULL) - { - return $this->_where_in($key, $values, FALSE, 'OR '); - } - - // -------------------------------------------------------------------- - - /** - * Where_not_in - * - * Generates a WHERE field NOT IN ('item', 'item') SQL query joined - * with AND if appropriate - * - * @access public - * @param string The field to search - * @param array The values searched on - * @return object - */ - function where_not_in($key = NULL, $values = NULL) - { - return $this->_where_in($key, $values, TRUE); - } - - // -------------------------------------------------------------------- - - /** - * Where_not_in_or - * - * Generates a WHERE field NOT IN ('item', 'item') SQL query joined - * with OR if appropriate - * - * @access public - * @param string The field to search - * @param array The values searched on - * @return object - */ - function or_where_not_in($key = NULL, $values = NULL) - { - return $this->_where_in($key, $values, TRUE, 'OR '); - } - - // -------------------------------------------------------------------- - - /** - * Where_in - * - * Called by where_in, where_in_or, where_not_in, where_not_in_or - * - * @access public - * @param string The field to search - * @param array The values searched on - * @param boolean If the statement would be IN or NOT IN - * @param string - * @return object - */ - function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ') - { - if ($key === NULL OR $values === NULL) - { - return; - } - - if ( ! is_array($values)) - { - $values = array($values); - } - - $not = ($not) ? ' NOT' : ''; - - foreach ($values as $value) - { - $this->ar_wherein[] = $this->escape($value); - } - - $prefix = (count($this->ar_where) == 0) ? '' : $type; - - $where_in = $prefix . $this->_protect_identifiers($key) . $not . " IN (" . implode(", ", $this->ar_wherein) . ") "; - - $this->ar_where[] = $where_in; - if ($this->ar_caching === TRUE) - { - $this->ar_cache_where[] = $where_in; - $this->ar_cache_exists[] = 'where'; - } - - // reset the array for multiple calls - $this->ar_wherein = array(); - return $this; - } - - // -------------------------------------------------------------------- - - /** - * Like - * - * Generates a %LIKE% portion of the query. Separates - * multiple calls with AND - * - * @access public - * @param mixed - * @param mixed - * @return object - */ - function like($field, $match = '', $side = 'both') - { - return $this->_like($field, $match, 'AND ', $side); - } - - // -------------------------------------------------------------------- - - /** - * Not Like - * - * Generates a NOT LIKE portion of the query. Separates - * multiple calls with AND - * - * @access public - * @param mixed - * @param mixed - * @return object - */ - function not_like($field, $match = '', $side = 'both') - { - return $this->_like($field, $match, 'AND ', $side, 'NOT'); - } - - // -------------------------------------------------------------------- - - /** - * OR Like - * - * Generates a %LIKE% portion of the query. Separates - * multiple calls with OR - * - * @access public - * @param mixed - * @param mixed - * @return object - */ - function or_like($field, $match = '', $side = 'both') - { - return $this->_like($field, $match, 'OR ', $side); - } - - // -------------------------------------------------------------------- - - /** - * OR Not Like - * - * Generates a NOT LIKE portion of the query. Separates - * multiple calls with OR - * - * @access public - * @param mixed - * @param mixed - * @return object - */ - function or_not_like($field, $match = '', $side = 'both') - { - return $this->_like($field, $match, 'OR ', $side, 'NOT'); - } - - // -------------------------------------------------------------------- - - /** - * orlike() is an alias of or_like() - * this function is here for backwards compatibility, as - * orlike() has been deprecated - */ - function orlike($field, $match = '', $side = 'both') - { - return $this->or_like($field, $match, $side); - } - - // -------------------------------------------------------------------- - - /** - * Like - * - * Called by like() or orlike() - * - * @access private - * @param mixed - * @param mixed - * @param string - * @return object - */ - function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '') - { - if ( ! is_array($field)) - { - $field = array($field => $match); - } - - foreach ($field as $k => $v) - { - $k = $this->_protect_identifiers($k); - - $prefix = (count($this->ar_like) == 0) ? '' : $type; - - $v = $this->escape_like_str($v); - - if ($side == 'before') - { - $like_statement = $prefix." $k $not LIKE '%{$v}'"; - } - elseif ($side == 'after') - { - $like_statement = $prefix." $k $not LIKE '{$v}%'"; - } - else - { - $like_statement = $prefix." $k $not LIKE '%{$v}%'"; - } - - // some platforms require an escape sequence definition for LIKE wildcards - if ($this->_like_escape_str != '') - { - $like_statement = $like_statement.sprintf($this->_like_escape_str, $this->_like_escape_char); - } - - $this->ar_like[] = $like_statement; - if ($this->ar_caching === TRUE) - { - $this->ar_cache_like[] = $like_statement; - $this->ar_cache_exists[] = 'like'; - } - - } - return $this; - } - - // -------------------------------------------------------------------- - - /** - * GROUP BY - * - * @access public - * @param string - * @return object - */ - function group_by($by) - { - if (is_string($by)) - { - $by = explode(',', $by); - } - - foreach ($by as $val) - { - $val = trim($val); - - if ($val != '') - { - $this->ar_groupby[] = $this->_protect_identifiers($val); - - if ($this->ar_caching === TRUE) - { - $this->ar_cache_groupby[] = $this->_protect_identifiers($val); - $this->ar_cache_exists[] = 'groupby'; - } - } - } - return $this; - } - - // -------------------------------------------------------------------- - - /** - * groupby() is an alias of group_by() - * this function is here for backwards compatibility, as - * groupby() has been deprecated - */ - function groupby($by) - { - return $this->group_by($by); - } - - // -------------------------------------------------------------------- - - /** - * Sets the HAVING value - * - * Separates multiple calls with AND - * - * @access public - * @param string - * @param string - * @return object - */ - function having($key, $value = '', $escape = TRUE) - { - return $this->_having($key, $value, 'AND ', $escape); - } - - // -------------------------------------------------------------------- - - /** - * orhaving() is an alias of or_having() - * this function is here for backwards compatibility, as - * orhaving() has been deprecated - */ - - function orhaving($key, $value = '', $escape = TRUE) - { - return $this->or_having($key, $value, $escape); - } - // -------------------------------------------------------------------- - - /** - * Sets the OR HAVING value - * - * Separates multiple calls with OR - * - * @access public - * @param string - * @param string - * @return object - */ - function or_having($key, $value = '', $escape = TRUE) - { - return $this->_having($key, $value, 'OR ', $escape); - } - - // -------------------------------------------------------------------- - - /** - * Sets the HAVING values - * - * Called by having() or or_having() - * - * @access private - * @param string - * @param string - * @return object - */ - function _having($key, $value = '', $type = 'AND ', $escape = TRUE) - { - if ( ! is_array($key)) - { - $key = array($key => $value); - } - - foreach ($key as $k => $v) - { - $prefix = (count($this->ar_having) == 0) ? '' : $type; - - if ($escape === TRUE) - { - $k = $this->_protect_identifiers($k); - } - - if ( ! $this->_has_operator($k)) - { - $k .= ' = '; - } - - if ($v != '') - { - $v = ' '.$this->escape_str($v); - } - - $this->ar_having[] = $prefix.$k.$v; - if ($this->ar_caching === TRUE) - { - $this->ar_cache_having[] = $prefix.$k.$v; - $this->ar_cache_exists[] = 'having'; - } - } - - return $this; - } - - // -------------------------------------------------------------------- - - /** - * Sets the ORDER BY value - * - * @access public - * @param string - * @param string direction: asc or desc - * @return object - */ - function order_by($orderby, $direction = '') - { - if (strtolower($direction) == 'random') - { - $orderby = ''; // Random results want or don't need a field name - $direction = $this->_random_keyword; - } - elseif (trim($direction) != '') - { - $direction = (in_array(strtoupper(trim($direction)), array('ASC', 'DESC'), TRUE)) ? ' '.$direction : ' ASC'; - } - - - if (strpos($orderby, ',') !== FALSE) - { - $temp = array(); - foreach (explode(',', $orderby) as $part) - { - $part = trim($part); - if ( ! in_array($part, $this->ar_aliased_tables)) - { - $part = $this->_protect_identifiers(trim($part)); - } - - $temp[] = $part; - } - - $orderby = implode(', ', $temp); - } - else if ($direction != $this->_random_keyword) - { - $orderby = $this->_protect_identifiers($orderby); - } - - $orderby_statement = $orderby.$direction; - - $this->ar_orderby[] = $orderby_statement; - if ($this->ar_caching === TRUE) - { - $this->ar_cache_orderby[] = $orderby_statement; - $this->ar_cache_exists[] = 'orderby'; - } - - return $this; - } - - // -------------------------------------------------------------------- - - /** - * orderby() is an alias of order_by() - * this function is here for backwards compatibility, as - * orderby() has been deprecated - */ - function orderby($orderby, $direction = '') - { - return $this->order_by($orderby, $direction); - } - - // -------------------------------------------------------------------- - - /** - * Sets the LIMIT value - * - * @access public - * @param integer the limit value - * @param integer the offset value - * @return object - */ - function limit($value, $offset = '') - { - $this->ar_limit = $value; - - if ($offset != '') - { - $this->ar_offset = $offset; - } - - return $this; - } - - // -------------------------------------------------------------------- - - /** - * Sets the OFFSET value - * - * @access public - * @param integer the offset value - * @return object - */ - function offset($offset) - { - $this->ar_offset = $offset; - return $this; - } - - // -------------------------------------------------------------------- - - /** - * The "set" function. Allows key/value pairs to be set for inserting or updating - * - * @access public - * @param mixed - * @param string - * @param boolean - * @return object - */ - function set($key, $value = '', $escape = TRUE) - { - $key = $this->_object_to_array($key); - - if ( ! is_array($key)) - { - $key = array($key => $value); - } - - foreach ($key as $k => $v) - { - if ($escape === FALSE) - { - $this->ar_set[$this->_protect_identifiers($k)] = $v; - } - else - { - $this->ar_set[$this->_protect_identifiers($k)] = $this->escape($v); - } - } - - return $this; - } - - // -------------------------------------------------------------------- - - /** - * Get - * - * Compiles the select statement based on the other functions called - * and runs the query - * - * @access public - * @param string the table - * @param string the limit clause - * @param string the offset clause - * @return object - */ - function get($table = '', $limit = null, $offset = null) - { - if ($table != '') - { - $this->_track_aliases($table); - $this->from($table); - } - - if ( ! is_null($limit)) - { - $this->limit($limit, $offset); - } - - $sql = $this->_compile_select(); - - $result = $this->query($sql); - $this->_reset_select(); - return $result; - } - - /** - * "Count All Results" query - * - * Generates a platform-specific query string that counts all records - * returned by an Active Record query. - * - * @access public - * @param string - * @return string - */ - function count_all_results($table = '') - { - if ($table != '') - { - $this->_track_aliases($table); - $this->from($table); - } - - $sql = $this->_compile_select($this->_count_string . $this->_protect_identifiers('numrows')); - - $query = $this->query($sql); - $this->_reset_select(); - - if ($query->num_rows() == 0) - { - return '0'; - } - - $row = $query->row(); - return $row->numrows; - } - - // -------------------------------------------------------------------- - - /** - * Get_Where - * - * Allows the where clause, limit and offset to be added directly - * - * @access public - * @param string the where clause - * @param string the limit clause - * @param string the offset clause - * @return object - */ - function get_where($table = '', $where = null, $limit = null, $offset = null) - { - if ($table != '') - { - $this->from($table); - } - - if ( ! is_null($where)) - { - $this->where($where); - } - - if ( ! is_null($limit)) - { - $this->limit($limit, $offset); - } - - $sql = $this->_compile_select(); - - $result = $this->query($sql); - $this->_reset_select(); - return $result; - } - - // -------------------------------------------------------------------- - - /** - * getwhere() is an alias of get_where() - * this function is here for backwards compatibility, as - * getwhere() has been deprecated - */ - function getwhere($table = '', $where = null, $limit = null, $offset = null) - { - return $this->get_where($table, $where, $limit, $offset); - } - - // -------------------------------------------------------------------- - - /** - * Insert - * - * Compiles an insert string and runs the query - * - * @access public - * @param string the table to retrieve the results from - * @param array an associative array of insert values - * @return object - */ - function insert($table = '', $set = NULL) - { - if ( ! is_null($set)) - { - $this->set($set); - } - - if (count($this->ar_set) == 0) - { - if ($this->db_debug) - { - return $this->display_error('db_must_use_set'); - } - return FALSE; - } - - if ($table == '') - { - if ( ! isset($this->ar_from[0])) - { - if ($this->db_debug) - { - return $this->display_error('db_must_set_table'); - } - return FALSE; - } - - $table = $this->ar_from[0]; - } - - $sql = $this->_insert($this->_protect_identifiers($table, TRUE, NULL, FALSE), array_keys($this->ar_set), array_values($this->ar_set)); - - $this->_reset_write(); - return $this->query($sql); - } - - // -------------------------------------------------------------------- - - /** - * Update - * - * Compiles an update string and runs the query - * - * @access public - * @param string the table to retrieve the results from - * @param array an associative array of update values - * @param mixed the where clause - * @return object - */ - function update($table = '', $set = NULL, $where = NULL, $limit = NULL) - { - // Combine any cached components with the current statements - $this->_merge_cache(); - - if ( ! is_null($set)) - { - $this->set($set); - } - - if (count($this->ar_set) == 0) - { - if ($this->db_debug) - { - return $this->display_error('db_must_use_set'); - } - return FALSE; - } - - if ($table == '') - { - if ( ! isset($this->ar_from[0])) - { - if ($this->db_debug) - { - return $this->display_error('db_must_set_table'); - } - return FALSE; - } - - $table = $this->ar_from[0]; - } - - if ($where != NULL) - { - $this->where($where); - } - - if ($limit != NULL) - { - $this->limit($limit); - } - - $sql = $this->_update($this->_protect_identifiers($table, TRUE, NULL, FALSE), $this->ar_set, $this->ar_where, $this->ar_orderby, $this->ar_limit); - - $this->_reset_write(); - return $this->query($sql); - } - - // -------------------------------------------------------------------- - - /** - * Empty Table - * - * Compiles a delete string and runs "DELETE FROM table" - * - * @access public - * @param string the table to empty - * @return object - */ - function empty_table($table = '') - { - if ($table == '') - { - if ( ! isset($this->ar_from[0])) - { - if ($this->db_debug) - { - return $this->display_error('db_must_set_table'); - } - return FALSE; - } - - $table = $this->ar_from[0]; - } - else - { - $table = $this->_protect_identifiers($table, TRUE, NULL, FALSE); - } - - $sql = $this->_delete($table); - - $this->_reset_write(); - - return $this->query($sql); - } - - // -------------------------------------------------------------------- - - /** - * Truncate - * - * Compiles a truncate string and runs the query - * If the database does not support the truncate() command - * This function maps to "DELETE FROM table" - * - * @access public - * @param string the table to truncate - * @return object - */ - function truncate($table = '') - { - if ($table == '') - { - if ( ! isset($this->ar_from[0])) - { - if ($this->db_debug) - { - return $this->display_error('db_must_set_table'); - } - return FALSE; - } - - $table = $this->ar_from[0]; - } - else - { - $table = $this->_protect_identifiers($table, TRUE, NULL, FALSE); - } - - $sql = $this->_truncate($table); - - $this->_reset_write(); - - return $this->query($sql); - } - - // -------------------------------------------------------------------- - - /** - * Delete - * - * Compiles a delete string and runs the query - * - * @access public - * @param mixed the table(s) to delete from. String or array - * @param mixed the where clause - * @param mixed the limit clause - * @param boolean - * @return object - */ - function delete($table = '', $where = '', $limit = NULL, $reset_data = TRUE) - { - // Combine any cached components with the current statements - $this->_merge_cache(); - - if ($table == '') - { - if ( ! isset($this->ar_from[0])) - { - if ($this->db_debug) - { - return $this->display_error('db_must_set_table'); - } - return FALSE; - } - - $table = $this->ar_from[0]; - } - elseif (is_array($table)) - { - foreach($table as $single_table) - { - $this->delete($single_table, $where, $limit, FALSE); - } - - $this->_reset_write(); - return; - } - else - { - $table = $this->_protect_identifiers($table, TRUE, NULL, FALSE); - } - - if ($where != '') - { - $this->where($where); - } - - if ($limit != NULL) - { - $this->limit($limit); - } - - if (count($this->ar_where) == 0 && count($this->ar_wherein) == 0 && count($this->ar_like) == 0) - { - if ($this->db_debug) - { - return $this->display_error('db_del_must_use_where'); - } - - return FALSE; - } - - $sql = $this->_delete($table, $this->ar_where, $this->ar_like, $this->ar_limit); - - if ($reset_data) - { - $this->_reset_write(); - } - - return $this->query($sql); - } - - // -------------------------------------------------------------------- - - /** - * DB Prefix - * - * Prepends a database prefix if one exists in configuration - * - * @access public - * @param string the table - * @return string - */ - function dbprefix($table = '') - { - if ($table == '') - { - $this->display_error('db_table_name_required'); - } - - return $this->dbprefix.$table; - } - - // -------------------------------------------------------------------- - - /** - * Track Aliases - * - * Used to track SQL statements written with aliased tables. - * - * @access private - * @param string The table to inspect - * @return string - */ - function _track_aliases($table) - { - if (is_array($table)) - { - foreach ($table as $t) - { - $this->_track_aliases($t); - } - return; - } - - // Does the string contain a comma? If so, we need to separate - // the string into discreet statements - if (strpos($table, ',') !== FALSE) - { - return $this->_track_aliases(explode(',', $table)); - } - - // if a table alias is used we can recognize it by a space - if (strpos($table, " ") !== FALSE) - { - // if the alias is written with the AS keyword, remove it - $table = preg_replace('/ AS /i', ' ', $table); - - // Grab the alias - $table = trim(strrchr($table, " ")); - - // Store the alias, if it doesn't already exist - if ( ! in_array($table, $this->ar_aliased_tables)) - { - $this->ar_aliased_tables[] = $table; - } - } - } - - // -------------------------------------------------------------------- - - /** - * Compile the SELECT statement - * - * Generates a query string based on which functions were used. - * Should not be called directly. The get() function calls it. - * - * @access private - * @return string - */ - function _compile_select($select_override = FALSE) - { - // Combine any cached components with the current statements - $this->_merge_cache(); - - // ---------------------------------------------------------------- - - // Write the "select" portion of the query - - if ($select_override !== FALSE) - { - $sql = $select_override; - } - else - { - $sql = ( ! $this->ar_distinct) ? 'SELECT ' : 'SELECT DISTINCT '; - - if (count($this->ar_select) == 0) - { - $sql .= '*'; - } - else - { - // Cycle through the "select" portion of the query and prep each column name. - // The reason we protect identifiers here rather then in the select() function - // is because until the user calls the from() function we don't know if there are aliases - foreach ($this->ar_select as $key => $val) - { - $this->ar_select[$key] = $this->_protect_identifiers($val); - } - - $sql .= implode(', ', $this->ar_select); - } - } - - // ---------------------------------------------------------------- - - // Write the "FROM" portion of the query - - if (count($this->ar_from) > 0) - { - $sql .= "\nFROM "; - - $sql .= $this->_from_tables($this->ar_from); - } - - // ---------------------------------------------------------------- - - // Write the "JOIN" portion of the query - - if (count($this->ar_join) > 0) - { - $sql .= "\n"; - - $sql .= implode("\n", $this->ar_join); - } - - // ---------------------------------------------------------------- - - // Write the "WHERE" portion of the query - - if (count($this->ar_where) > 0 OR count($this->ar_like) > 0) - { - $sql .= "\n"; - - $sql .= "WHERE "; - } - - $sql .= implode("\n", $this->ar_where); - - // ---------------------------------------------------------------- - - // Write the "LIKE" portion of the query - - if (count($this->ar_like) > 0) - { - if (count($this->ar_where) > 0) - { - $sql .= "\nAND "; - } - - $sql .= implode("\n", $this->ar_like); - } - - // ---------------------------------------------------------------- - - // Write the "GROUP BY" portion of the query - - if (count($this->ar_groupby) > 0) - { - $sql .= "\nGROUP BY "; - - $sql .= implode(', ', $this->ar_groupby); - } - - // ---------------------------------------------------------------- - - // Write the "HAVING" portion of the query - - if (count($this->ar_having) > 0) - { - $sql .= "\nHAVING "; - $sql .= implode("\n", $this->ar_having); - } - - // ---------------------------------------------------------------- - - // Write the "ORDER BY" portion of the query - - if (count($this->ar_orderby) > 0) - { - $sql .= "\nORDER BY "; - $sql .= implode(', ', $this->ar_orderby); - - if ($this->ar_order !== FALSE) - { - $sql .= ($this->ar_order == 'desc') ? ' DESC' : ' ASC'; - } - } - - // ---------------------------------------------------------------- - - // Write the "LIMIT" portion of the query - - if (is_numeric($this->ar_limit)) - { - $sql .= "\n"; - $sql = $this->_limit($sql, $this->ar_limit, $this->ar_offset); - } - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Object to Array - * - * Takes an object as input and converts the class variables to array key/vals - * - * @access public - * @param object - * @return array - */ - function _object_to_array($object) - { - if ( ! is_object($object)) - { - return $object; - } - - $array = array(); - foreach (get_object_vars($object) as $key => $val) - { - // There are some built in keys we need to ignore for this conversion - if ( ! is_object($val) && ! is_array($val) && $key != '_parent_name' && $key != '_ci_scaffolding' && $key != '_ci_scaff_table') - { - $array[$key] = $val; - } - } - - return $array; - } - - // -------------------------------------------------------------------- - - /** - * Start Cache - * - * Starts AR caching - * - * @access public - * @return void - */ - function start_cache() - { - $this->ar_caching = TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Stop Cache - * - * Stops AR caching - * - * @access public - * @return void - */ - function stop_cache() - { - $this->ar_caching = FALSE; - } - - // -------------------------------------------------------------------- - - /** - * Flush Cache - * - * Empties the AR cache - * - * @access public - * @return void - */ - function flush_cache() - { - $this->_reset_run( - array( - 'ar_cache_select' => array(), - 'ar_cache_from' => array(), - 'ar_cache_join' => array(), - 'ar_cache_where' => array(), - 'ar_cache_like' => array(), - 'ar_cache_groupby' => array(), - 'ar_cache_having' => array(), - 'ar_cache_orderby' => array(), - 'ar_cache_set' => array(), - 'ar_cache_exists' => array() - ) - ); - } - - // -------------------------------------------------------------------- - - /** - * Merge Cache - * - * When called, this function merges any cached AR arrays with - * locally called ones. - * - * @access private - * @return void - */ - function _merge_cache() - { - if (count($this->ar_cache_exists) == 0) - { - return; - } - - foreach ($this->ar_cache_exists as $val) - { - $ar_variable = 'ar_'.$val; - $ar_cache_var = 'ar_cache_'.$val; - - if (count($this->$ar_cache_var) == 0) - { - continue; - } - - $this->$ar_variable = array_unique(array_merge($this->$ar_cache_var, $this->$ar_variable)); - } - - // If we are "protecting identifiers" we need to examine the "from" - // portion of the query to determine if there are any aliases - if ($this->_protect_identifiers === TRUE AND count($this->ar_cache_from) > 0) - { - $this->_track_aliases($this->ar_from); - } - } - - // -------------------------------------------------------------------- - - /** - * Resets the active record values. Called by the get() function - * - * @access private - * @param array An array of fields to reset - * @return void - */ - function _reset_run($ar_reset_items) - { - foreach ($ar_reset_items as $item => $default_value) - { - if ( ! in_array($item, $this->ar_store_array)) - { - $this->$item = $default_value; - } - } - } - - // -------------------------------------------------------------------- - - /** - * Resets the active record values. Called by the get() function - * - * @access private - * @return void - */ - function _reset_select() - { - $ar_reset_items = array( - 'ar_select' => array(), - 'ar_from' => array(), - 'ar_join' => array(), - 'ar_where' => array(), - 'ar_like' => array(), - 'ar_groupby' => array(), - 'ar_having' => array(), - 'ar_orderby' => array(), - 'ar_wherein' => array(), - 'ar_aliased_tables' => array(), - 'ar_distinct' => FALSE, - 'ar_limit' => FALSE, - 'ar_offset' => FALSE, - 'ar_order' => FALSE, - ); - - $this->_reset_run($ar_reset_items); - } - - // -------------------------------------------------------------------- - - /** - * Resets the active record "write" values. - * - * Called by the insert() update() and delete() functions - * - * @access private - * @return void - */ - function _reset_write() - { - $ar_reset_items = array( - 'ar_set' => array(), - 'ar_from' => array(), - 'ar_where' => array(), - 'ar_like' => array(), - 'ar_orderby' => array(), - 'ar_limit' => FALSE, - 'ar_order' => FALSE - ); - - $this->_reset_run($ar_reset_items); - } - -} - -/* End of file DB_active_rec.php */ -/* Location: ./system/database/DB_active_rec.php */ \ No newline at end of file diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php deleted file mode 100644 index d3968b315..000000000 --- a/system/database/DB_cache.php +++ /dev/null @@ -1,195 +0,0 @@ -CI - // and load the file helper since we use it a lot - $this->CI =& get_instance(); - $this->db =& $db; - $this->CI->load->helper('file'); - } - - // -------------------------------------------------------------------- - - /** - * Set Cache Directory Path - * - * @access public - * @param string the path to the cache directory - * @return bool - */ - function check_path($path = '') - { - if ($path == '') - { - if ($this->db->cachedir == '') - { - return $this->db->cache_off(); - } - - $path = $this->db->cachedir; - } - - // Add a trailing slash to the path if needed - $path = preg_replace("/(.+?)\/*$/", "\\1/", $path); - - if ( ! is_dir($path) OR ! is_really_writable($path)) - { - // If the path is wrong we'll turn off caching - return $this->db->cache_off(); - } - - $this->db->cachedir = $path; - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Retrieve a cached query - * - * The URI being requested will become the name of the cache sub-folder. - * An MD5 hash of the SQL statement will become the cache file name - * - * @access public - * @return string - */ - function read($sql) - { - if ( ! $this->check_path()) - { - return $this->db->cache_off(); - } - - $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); - - $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); - - $filepath = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql); - - if (FALSE === ($cachedata = read_file($filepath))) - { - return FALSE; - } - - return unserialize($cachedata); - } - - // -------------------------------------------------------------------- - - /** - * Write a query to a cache file - * - * @access public - * @return bool - */ - function write($sql, $object) - { - if ( ! $this->check_path()) - { - return $this->db->cache_off(); - } - - $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); - - $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); - - $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; - - $filename = md5($sql); - - if ( ! @is_dir($dir_path)) - { - if ( ! @mkdir($dir_path, DIR_WRITE_MODE)) - { - return FALSE; - } - - @chmod($dir_path, DIR_WRITE_MODE); - } - - if (write_file($dir_path.$filename, serialize($object)) === FALSE) - { - return FALSE; - } - - @chmod($dir_path.$filename, DIR_WRITE_MODE); - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Delete cache files within a particular directory - * - * @access public - * @return bool - */ - function delete($segment_one = '', $segment_two = '') - { - if ($segment_one == '') - { - $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); - } - - if ($segment_two == '') - { - $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); - } - - $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; - - delete_files($dir_path, TRUE); - } - - // -------------------------------------------------------------------- - - /** - * Delete all existing cache files - * - * @access public - * @return bool - */ - function delete_all() - { - delete_files($this->db->cachedir, TRUE); - } - -} - - -/* End of file DB_cache.php */ -/* Location: ./system/database/DB_cache.php */ \ No newline at end of file diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php deleted file mode 100644 index b2a3c2ebd..000000000 --- a/system/database/DB_driver.php +++ /dev/null @@ -1,1366 +0,0 @@ - $val) - { - $this->$key = $val; - } - } - - log_message('debug', 'Database Driver Class Initialized'); - } - - // -------------------------------------------------------------------- - - /** - * Initialize Database Settings - * - * @access private Called by the constructor - * @param mixed - * @return void - */ - function initialize() - { - // If an existing connection resource is available - // there is no need to connect and select the database - if (is_resource($this->conn_id) OR is_object($this->conn_id)) - { - return TRUE; - } - - // ---------------------------------------------------------------- - - // Connect to the database and set the connection ID - $this->conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect(); - - // No connection resource? Throw an error - if ( ! $this->conn_id) - { - log_message('error', 'Unable to connect to the database'); - - if ($this->db_debug) - { - $this->display_error('db_unable_to_connect'); - } - return FALSE; - } - - // ---------------------------------------------------------------- - - // Select the DB... assuming a database name is specified in the config file - if ($this->database != '') - { - if ( ! $this->db_select()) - { - log_message('error', 'Unable to select database: '.$this->database); - - if ($this->db_debug) - { - $this->display_error('db_unable_to_select', $this->database); - } - return FALSE; - } - else - { - // We've selected the DB. Now we set the character set - if ( ! $this->db_set_charset($this->char_set, $this->dbcollat)) - { - return FALSE; - } - - return TRUE; - } - } - - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Set client character set - * - * @access public - * @param string - * @param string - * @return resource - */ - function db_set_charset($charset, $collation) - { - if ( ! $this->_db_set_charset($this->char_set, $this->dbcollat)) - { - log_message('error', 'Unable to set database connection charset: '.$this->char_set); - - if ($this->db_debug) - { - $this->display_error('db_unable_to_set_charset', $this->char_set); - } - - return FALSE; - } - - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * The name of the platform in use (mysql, mssql, etc...) - * - * @access public - * @return string - */ - function platform() - { - return $this->dbdriver; - } - - // -------------------------------------------------------------------- - - /** - * Database Version Number. Returns a string containing the - * version of the database being used - * - * @access public - * @return string - */ - function version() - { - if (FALSE === ($sql = $this->_version())) - { - if ($this->db_debug) - { - return $this->display_error('db_unsupported_function'); - } - return FALSE; - } - - if ($this->dbdriver == 'oci8') - { - return $sql; - } - - $query = $this->query($sql); - return $query->row('ver'); - } - - // -------------------------------------------------------------------- - - /** - * Execute the query - * - * Accepts an SQL string as input and returns a result object upon - * successful execution of a "read" type query. Returns boolean TRUE - * upon successful execution of a "write" type query. Returns boolean - * FALSE upon failure, and if the $db_debug variable is set to TRUE - * will raise an error. - * - * @access public - * @param string An SQL query string - * @param array An array of binding data - * @return mixed - */ - function query($sql, $binds = FALSE, $return_object = TRUE) - { - if ($sql == '') - { - if ($this->db_debug) - { - log_message('error', 'Invalid query: '.$sql); - return $this->display_error('db_invalid_query'); - } - return FALSE; - } - - // Verify table prefix and replace if necessary - if ( ($this->dbprefix != '' AND $this->swap_pre != '') AND ($this->dbprefix != $this->swap_pre) ) - { - $sql = preg_replace("/(\W)".$this->swap_pre."(\S+?)/", "\\1".$this->dbprefix."\\2", $sql); - } - - // Is query caching enabled? If the query is a "read type" - // we will load the caching class and return the previously - // cached query if it exists - if ($this->cache_on == TRUE AND stristr($sql, 'SELECT')) - { - if ($this->_cache_init()) - { - $this->load_rdriver(); - if (FALSE !== ($cache = $this->CACHE->read($sql))) - { - return $cache; - } - } - } - - // Compile binds if needed - if ($binds !== FALSE) - { - $sql = $this->compile_binds($sql, $binds); - } - - // Save the query for debugging - if ($this->save_queries == TRUE) - { - $this->queries[] = $sql; - } - - // Start the Query Timer - $time_start = list($sm, $ss) = explode(' ', microtime()); - - // Run the Query - if (FALSE === ($this->result_id = $this->simple_query($sql))) - { - if ($this->save_queries == TRUE) - { - $this->query_times[] = 0; - } - - // This will trigger a rollback if transactions are being used - $this->_trans_status = FALSE; - - if ($this->db_debug) - { - // grab the error number and message now, as we might run some - // additional queries before displaying the error - $error_no = $this->_error_number(); - $error_msg = $this->_error_message(); - - // We call this function in order to roll-back queries - // if transactions are enabled. If we don't call this here - // the error message will trigger an exit, causing the - // transactions to remain in limbo. - $this->trans_complete(); - - // Log and display errors - log_message('error', 'Query error: '.$error_msg); - return $this->display_error( - array( - 'Error Number: '.$error_no, - $error_msg, - $sql - ) - ); - } - - return FALSE; - } - - // Stop and aggregate the query time results - $time_end = list($em, $es) = explode(' ', microtime()); - $this->benchmark += ($em + $es) - ($sm + $ss); - - if ($this->save_queries == TRUE) - { - $this->query_times[] = ($em + $es) - ($sm + $ss); - } - - // Increment the query counter - $this->query_count++; - - // Was the query a "write" type? - // If so we'll simply return true - if ($this->is_write_type($sql) === TRUE) - { - // If caching is enabled we'll auto-cleanup any - // existing files related to this particular URI - if ($this->cache_on == TRUE AND $this->cache_autodel == TRUE AND $this->_cache_init()) - { - $this->CACHE->delete(); - } - - return TRUE; - } - - // Return TRUE if we don't need to create a result object - // Currently only the Oracle driver uses this when stored - // procedures are used - if ($return_object !== TRUE) - { - return TRUE; - } - - // Load and instantiate the result driver - - $driver = $this->load_rdriver(); - $RES = new $driver(); - $RES->conn_id = $this->conn_id; - $RES->result_id = $this->result_id; - - if ($this->dbdriver == 'oci8') - { - $RES->stmt_id = $this->stmt_id; - $RES->curs_id = NULL; - $RES->limit_used = $this->limit_used; - $this->stmt_id = FALSE; - } - - // oci8 vars must be set before calling this - $RES->num_rows = $RES->num_rows(); - - // Is query caching enabled? If so, we'll serialize the - // result object and save it to a cache file. - if ($this->cache_on == TRUE AND $this->_cache_init()) - { - // We'll create a new instance of the result object - // only without the platform specific driver since - // we can't use it with cached data (the query result - // resource ID won't be any good once we've cached the - // result object, so we'll have to compile the data - // and save it) - $CR = new CI_DB_result(); - $CR->num_rows = $RES->num_rows(); - $CR->result_object = $RES->result_object(); - $CR->result_array = $RES->result_array(); - - // Reset these since cached objects can not utilize resource IDs. - $CR->conn_id = NULL; - $CR->result_id = NULL; - - $this->CACHE->write($sql, $CR); - } - - return $RES; - } - - // -------------------------------------------------------------------- - - /** - * Load the result drivers - * - * @access public - * @return string the name of the result class - */ - function load_rdriver() - { - $driver = 'CI_DB_'.$this->dbdriver.'_result'; - - if ( ! class_exists($driver)) - { - include_once(BASEPATH.'database/DB_result'.EXT); - include_once(BASEPATH.'database/drivers/'.$this->dbdriver.'/'.$this->dbdriver.'_result'.EXT); - } - - return $driver; - } - - // -------------------------------------------------------------------- - - /** - * Simple Query - * This is a simplified version of the query() function. Internally - * we only use it when running transaction commands since they do - * not require all the features of the main query() function. - * - * @access public - * @param string the sql query - * @return mixed - */ - function simple_query($sql) - { - if ( ! $this->conn_id) - { - $this->initialize(); - } - - return $this->_execute($sql); - } - - // -------------------------------------------------------------------- - - /** - * Disable Transactions - * This permits transactions to be disabled at run-time. - * - * @access public - * @return void - */ - function trans_off() - { - $this->trans_enabled = FALSE; - } - - // -------------------------------------------------------------------- - - /** - * Enable/disable Transaction Strict Mode - * When strict mode is enabled, if you are running multiple groups of - * transactions, if one group fails all groups will be rolled back. - * If strict mode is disabled, each group is treated autonomously, meaning - * a failure of one group will not affect any others - * - * @access public - * @return void - */ - function trans_strict($mode = TRUE) - { - $this->trans_strict = is_bool($mode) ? $mode : TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Start Transaction - * - * @access public - * @return void - */ - function trans_start($test_mode = FALSE) - { - if ( ! $this->trans_enabled) - { - return FALSE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - $this->_trans_depth += 1; - return; - } - - $this->trans_begin($test_mode); - } - - // -------------------------------------------------------------------- - - /** - * Complete Transaction - * - * @access public - * @return bool - */ - function trans_complete() - { - if ( ! $this->trans_enabled) - { - return FALSE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 1) - { - $this->_trans_depth -= 1; - return TRUE; - } - - // The query() function will set this flag to FALSE in the event that a query failed - if ($this->_trans_status === FALSE) - { - $this->trans_rollback(); - - // If we are NOT running in strict mode, we will reset - // the _trans_status flag so that subsequent groups of transactions - // will be permitted. - if ($this->trans_strict === FALSE) - { - $this->_trans_status = TRUE; - } - - log_message('debug', 'DB Transaction Failure'); - return FALSE; - } - - $this->trans_commit(); - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Lets you retrieve the transaction flag to determine if it has failed - * - * @access public - * @return bool - */ - function trans_status() - { - return $this->_trans_status; - } - - // -------------------------------------------------------------------- - - /** - * Compile Bindings - * - * @access public - * @param string the sql statement - * @param array an array of bind data - * @return string - */ - function compile_binds($sql, $binds) - { - if (strpos($sql, $this->bind_marker) === FALSE) - { - return $sql; - } - - if ( ! is_array($binds)) - { - $binds = array($binds); - } - - // Get the sql segments around the bind markers - $segments = explode($this->bind_marker, $sql); - - // The count of bind should be 1 less then the count of segments - // If there are more bind arguments trim it down - if (count($binds) >= count($segments)) { - $binds = array_slice($binds, 0, count($segments)-1); - } - - // Construct the binded query - $result = $segments[0]; - $i = 0; - foreach ($binds as $bind) - { - $result .= $this->escape($bind); - $result .= $segments[++$i]; - } - - return $result; - } - - // -------------------------------------------------------------------- - - /** - * Determines if a query is a "write" type. - * - * @access public - * @param string An SQL query string - * @return boolean - */ - function is_write_type($sql) - { - if ( ! preg_match('/^\s*"?(SET|INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|TRUNCATE|LOAD DATA|COPY|ALTER|GRANT|REVOKE|LOCK|UNLOCK)\s+/i', $sql)) - { - return FALSE; - } - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Calculate the aggregate query elapsed time - * - * @access public - * @param integer The number of decimal places - * @return integer - */ - function elapsed_time($decimals = 6) - { - return number_format($this->benchmark, $decimals); - } - - // -------------------------------------------------------------------- - - /** - * Returns the total number of queries - * - * @access public - * @return integer - */ - function total_queries() - { - return $this->query_count; - } - - // -------------------------------------------------------------------- - - /** - * Returns the last query that was executed - * - * @access public - * @return void - */ - function last_query() - { - return end($this->queries); - } - - // -------------------------------------------------------------------- - - /** - * "Smart" Escape String - * - * Escapes data based on type - * Sets boolean and null types - * - * @access public - * @param string - * @return mixed - */ - function escape($str) - { - if (is_string($str)) - { - $str = "'".$this->escape_str($str)."'"; - } - elseif (is_bool($str)) - { - $str = ($str === FALSE) ? 0 : 1; - } - elseif (is_null($str)) - { - $str = 'NULL'; - } - - return $str; - } - - // -------------------------------------------------------------------- - - /** - * Escape LIKE String - * - * Calls the individual driver for platform - * specific escaping for LIKE conditions - * - * @access public - * @param string - * @return mixed - */ - function escape_like_str($str) - { - return $this->escape_str($str, TRUE); - } - - // -------------------------------------------------------------------- - - /** - * Primary - * - * Retrieves the primary key. It assumes that the row in the first - * position is the primary key - * - * @access public - * @param string the table name - * @return string - */ - function primary($table = '') - { - $fields = $this->list_fields($table); - - if ( ! is_array($fields)) - { - return FALSE; - } - - return current($fields); - } - - // -------------------------------------------------------------------- - - /** - * Returns an array of table names - * - * @access public - * @return array - */ - function list_tables($constrain_by_prefix = FALSE) - { - // Is there a cached result? - if (isset($this->data_cache['table_names'])) - { - return $this->data_cache['table_names']; - } - - if (FALSE === ($sql = $this->_list_tables($constrain_by_prefix))) - { - if ($this->db_debug) - { - return $this->display_error('db_unsupported_function'); - } - return FALSE; - } - - $retval = array(); - $query = $this->query($sql); - - if ($query->num_rows() > 0) - { - foreach($query->result_array() as $row) - { - if (isset($row['TABLE_NAME'])) - { - $retval[] = $row['TABLE_NAME']; - } - else - { - $retval[] = array_shift($row); - } - } - } - - $this->data_cache['table_names'] = $retval; - return $this->data_cache['table_names']; - } - - // -------------------------------------------------------------------- - - /** - * Determine if a particular table exists - * @access public - * @return boolean - */ - function table_exists($table_name) - { - return ( ! in_array($this->_protect_identifiers($table_name, TRUE, FALSE, FALSE), $this->list_tables())) ? FALSE : TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Fetch MySQL Field Names - * - * @access public - * @param string the table name - * @return array - */ - function list_fields($table = '') - { - // Is there a cached result? - if (isset($this->data_cache['field_names'][$table])) - { - return $this->data_cache['field_names'][$table]; - } - - if ($table == '') - { - if ($this->db_debug) - { - return $this->display_error('db_field_param_missing'); - } - return FALSE; - } - - if (FALSE === ($sql = $this->_list_columns($this->_protect_identifiers($table, TRUE, NULL, FALSE)))) - { - if ($this->db_debug) - { - return $this->display_error('db_unsupported_function'); - } - return FALSE; - } - - $query = $this->query($sql); - - $retval = array(); - foreach($query->result_array() as $row) - { - if (isset($row['COLUMN_NAME'])) - { - $retval[] = $row['COLUMN_NAME']; - } - else - { - $retval[] = current($row); - } - } - - $this->data_cache['field_names'][$table] = $retval; - return $this->data_cache['field_names'][$table]; - } - - // -------------------------------------------------------------------- - - /** - * Determine if a particular field exists - * @access public - * @param string - * @param string - * @return boolean - */ - function field_exists($field_name, $table_name) - { - return ( ! in_array($field_name, $this->list_fields($table_name))) ? FALSE : TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Returns an object with field data - * - * @access public - * @param string the table name - * @return object - */ - function field_data($table = '') - { - if ($table == '') - { - if ($this->db_debug) - { - return $this->display_error('db_field_param_missing'); - } - return FALSE; - } - - $query = $this->query($this->_field_data($this->_protect_identifiers($table, TRUE, NULL, FALSE))); - - return $query->field_data(); - } - - // -------------------------------------------------------------------- - - /** - * Generate an insert string - * - * @access public - * @param string the table upon which the query will be performed - * @param array an associative array data of key/values - * @return string - */ - function insert_string($table, $data) - { - $fields = array(); - $values = array(); - - foreach($data as $key => $val) - { - $fields[] = $this->_escape_identifiers($key); - $values[] = $this->escape($val); - } - - return $this->_insert($this->_protect_identifiers($table, TRUE, NULL, FALSE), $fields, $values); - } - - // -------------------------------------------------------------------- - - /** - * Generate an update string - * - * @access public - * @param string the table upon which the query will be performed - * @param array an associative array data of key/values - * @param mixed the "where" statement - * @return string - */ - function update_string($table, $data, $where) - { - if ($where == '') - { - return false; - } - - $fields = array(); - foreach($data as $key => $val) - { - $fields[$this->_protect_identifiers($key)] = $this->escape($val); - } - - if ( ! is_array($where)) - { - $dest = array($where); - } - else - { - $dest = array(); - foreach ($where as $key => $val) - { - $prefix = (count($dest) == 0) ? '' : ' AND '; - - if ($val !== '') - { - if ( ! $this->_has_operator($key)) - { - $key .= ' ='; - } - - $val = ' '.$this->escape($val); - } - - $dest[] = $prefix.$key.$val; - } - } - - return $this->_update($this->_protect_identifiers($table, TRUE, NULL, FALSE), $fields, $dest); - } - - // -------------------------------------------------------------------- - - /** - * Tests whether the string has an SQL operator - * - * @access private - * @param string - * @return bool - */ - function _has_operator($str) - { - $str = trim($str); - if ( ! preg_match("/(\s|<|>|!|=|is null|is not null)/i", $str)) - { - return FALSE; - } - - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Enables a native PHP function to be run, using a platform agnostic wrapper. - * - * @access public - * @param string the function name - * @param mixed any parameters needed by the function - * @return mixed - */ - function call_function($function) - { - $driver = ($this->dbdriver == 'postgre') ? 'pg_' : $this->dbdriver.'_'; - - if (FALSE === strpos($driver, $function)) - { - $function = $driver.$function; - } - - if ( ! function_exists($function)) - { - if ($this->db_debug) - { - return $this->display_error('db_unsupported_function'); - } - return FALSE; - } - else - { - $args = (func_num_args() > 1) ? array_splice(func_get_args(), 1) : null; - - return call_user_func_array($function, $args); - } - } - - // -------------------------------------------------------------------- - - /** - * Set Cache Directory Path - * - * @access public - * @param string the path to the cache directory - * @return void - */ - function cache_set_path($path = '') - { - $this->cachedir = $path; - } - - // -------------------------------------------------------------------- - - /** - * Enable Query Caching - * - * @access public - * @return void - */ - function cache_on() - { - $this->cache_on = TRUE; - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Disable Query Caching - * - * @access public - * @return void - */ - function cache_off() - { - $this->cache_on = FALSE; - return FALSE; - } - - - // -------------------------------------------------------------------- - - /** - * Delete the cache files associated with a particular URI - * - * @access public - * @return void - */ - function cache_delete($segment_one = '', $segment_two = '') - { - if ( ! $this->_cache_init()) - { - return FALSE; - } - return $this->CACHE->delete($segment_one, $segment_two); - } - - // -------------------------------------------------------------------- - - /** - * Delete All cache files - * - * @access public - * @return void - */ - function cache_delete_all() - { - if ( ! $this->_cache_init()) - { - return FALSE; - } - - return $this->CACHE->delete_all(); - } - - // -------------------------------------------------------------------- - - /** - * Initialize the Cache Class - * - * @access private - * @return void - */ - function _cache_init() - { - if (is_object($this->CACHE) AND class_exists('CI_DB_Cache')) - { - return TRUE; - } - - if ( ! class_exists('CI_DB_Cache')) - { - if ( ! @include(BASEPATH.'database/DB_cache'.EXT)) - { - return $this->cache_off(); - } - } - - $this->CACHE = new CI_DB_Cache($this); // pass db object to support multiple db connections and returned db objects - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Close DB Connection - * - * @access public - * @return void - */ - function close() - { - if (is_resource($this->conn_id) OR is_object($this->conn_id)) - { - $this->_close($this->conn_id); - } - $this->conn_id = FALSE; - } - - // -------------------------------------------------------------------- - - /** - * Display an error message - * - * @access public - * @param string the error message - * @param string any "swap" values - * @param boolean whether to localize the message - * @return string sends the application/error_db.php template - */ - function display_error($error = '', $swap = '', $native = FALSE) - { - $LANG =& load_class('Language'); - $LANG->load('db'); - - $heading = $LANG->line('db_error_heading'); - - if ($native == TRUE) - { - $message = $error; - } - else - { - $message = ( ! is_array($error)) ? array(str_replace('%s', $swap, $LANG->line($error))) : $error; - } - - $error =& load_class('Exceptions'); - echo $error->show_error($heading, $message, 'error_db'); - exit; - } - - // -------------------------------------------------------------------- - - /** - * Protect Identifiers - * - * This function adds backticks if appropriate based on db type - * - * @access private - * @param mixed the item to escape - * @return mixed the item with backticks - */ - function protect_identifiers($item, $prefix_single = FALSE) - { - return $this->_protect_identifiers($item, $prefix_single); - } - - // -------------------------------------------------------------------- - - /** - * Protect Identifiers - * - * This function is used extensively by the Active Record class, and by - * a couple functions in this class. - * It takes a column or table name (optionally with an alias) and inserts - * the table prefix onto it. Some logic is necessary in order to deal with - * column names that include the path. Consider a query like this: - * - * SELECT * FROM hostname.database.table.column AS c FROM hostname.database.table - * - * Or a query with aliasing: - * - * SELECT m.member_id, m.member_name FROM members AS m - * - * Since the column name can include up to four segments (host, DB, table, column) - * or also have an alias prefix, we need to do a bit of work to figure this out and - * insert the table prefix (if it exists) in the proper position, and escape only - * the correct identifiers. - * - * @access private - * @param string - * @param bool - * @param mixed - * @param bool - * @return string - */ - function _protect_identifiers($item, $prefix_single = FALSE, $protect_identifiers = NULL, $field_exists = TRUE) - { - if ( ! is_bool($protect_identifiers)) - { - $protect_identifiers = $this->_protect_identifiers; - } - - if (is_array($item)) - { - $escaped_array = array(); - - foreach($item as $k => $v) - { - $escaped_array[$this->_protect_identifiers($k)] = $this->_protect_identifiers($v); - } - - return $escaped_array; - } - - // Convert tabs or multiple spaces into single spaces - $item = preg_replace('/[\t ]+/', ' ', $item); - - // If the item has an alias declaration we remove it and set it aside. - // Basically we remove everything to the right of the first space - $alias = ''; - if (strpos($item, ' ') !== FALSE) - { - $alias = strstr($item, " "); - $item = substr($item, 0, - strlen($alias)); - } - - // This is basically a bug fix for queries that use MAX, MIN, etc. - // If a parenthesis is found we know that we do not need to - // escape the data or add a prefix. There's probably a more graceful - // way to deal with this, but I'm not thinking of it -- Rick - if (strpos($item, '(') !== FALSE) - { - return $item.$alias; - } - - // Break the string apart if it contains periods, then insert the table prefix - // in the correct location, assuming the period doesn't indicate that we're dealing - // with an alias. While we're at it, we will escape the components - if (strpos($item, '.') !== FALSE) - { - $parts = explode('.', $item); - - // Does the first segment of the exploded item match - // one of the aliases previously identified? If so, - // we have nothing more to do other than escape the item - if (in_array($parts[0], $this->ar_aliased_tables)) - { - if ($protect_identifiers === TRUE) - { - foreach ($parts as $key => $val) - { - if ( ! in_array($val, $this->_reserved_identifiers)) - { - $parts[$key] = $this->_escape_identifiers($val); - } - } - - $item = implode('.', $parts); - } - return $item.$alias; - } - - // Is there a table prefix defined in the config file? If not, no need to do anything - if ($this->dbprefix != '') - { - // We now add the table prefix based on some logic. - // Do we have 4 segments (hostname.database.table.column)? - // If so, we add the table prefix to the column name in the 3rd segment. - if (isset($parts[3])) - { - $i = 2; - } - // Do we have 3 segments (database.table.column)? - // If so, we add the table prefix to the column name in 2nd position - elseif (isset($parts[2])) - { - $i = 1; - } - // Do we have 2 segments (table.column)? - // If so, we add the table prefix to the column name in 1st segment - else - { - $i = 0; - } - - // This flag is set when the supplied $item does not contain a field name. - // This can happen when this function is being called from a JOIN. - if ($field_exists == FALSE) - { - $i++; - } - - // Verify table prefix and replace if necessary - if ($this->swap_pre != '' && strncmp($parts[$i], $this->swap_pre, strlen($this->swap_pre)) === 0) - { - $parts[$i] = preg_replace("/^".$this->swap_pre."(\S+?)/", $this->dbprefix."\\1", $parts[$i]); - } - - // We only add the table prefix if it does not already exist - if (substr($parts[$i], 0, strlen($this->dbprefix)) != $this->dbprefix) - { - $parts[$i] = $this->dbprefix.$parts[$i]; - } - - // Put the parts back together - $item = implode('.', $parts); - } - - if ($protect_identifiers === TRUE) - { - $item = $this->_escape_identifiers($item); - } - - return $item.$alias; - } - - // Is there a table prefix? If not, no need to insert it - if ($this->dbprefix != '') - { - // Verify table prefix and replace if necessary - if ($this->swap_pre != '' && strncmp($item, $this->swap_pre, strlen($this->swap_pre)) === 0) - { - $item = preg_replace("/^".$this->swap_pre."(\S+?)/", $this->dbprefix."\\1", $item); - } - - // Do we prefix an item with no segments? - if ($prefix_single == TRUE AND substr($item, 0, strlen($this->dbprefix)) != $this->dbprefix) - { - $item = $this->dbprefix.$item; - } - } - - if ($protect_identifiers === TRUE AND ! in_array($item, $this->_reserved_identifiers)) - { - $item = $this->_escape_identifiers($item); - } - - return $item.$alias; - } - - -} - - -/* End of file DB_driver.php */ -/* Location: ./system/database/DB_driver.php */ \ No newline at end of file diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php deleted file mode 100644 index c5931db27..000000000 --- a/system/database/DB_forge.php +++ /dev/null @@ -1,375 +0,0 @@ -db - $CI =& get_instance(); - $this->db =& $CI->db; - log_message('debug', "Database Forge Class Initialized"); - } - - // -------------------------------------------------------------------- - - /** - * Create database - * - * @access public - * @param string the database name - * @return bool - */ - function create_database($db_name) - { - $sql = $this->_create_database($db_name); - - if (is_bool($sql)) - { - return $sql; - } - - return $this->db->query($sql); - } - - // -------------------------------------------------------------------- - - /** - * Drop database - * - * @access public - * @param string the database name - * @return bool - */ - function drop_database($db_name) - { - $sql = $this->_drop_database($db_name); - - if (is_bool($sql)) - { - return $sql; - } - - return $this->db->query($sql); - } - - // -------------------------------------------------------------------- - - /** - * Add Key - * - * @access public - * @param string key - * @param string type - * @return void - */ - function add_key($key = '', $primary = FALSE) - { - if (is_array($key)) - { - foreach($key as $one) - { - $this->add_key($one, $primary); - } - - return; - } - - if ($key == '') - { - show_error('Key information is required for that operation.'); - } - - if ($primary === TRUE) - { - $this->primary_keys[] = $key; - } - else - { - $this->keys[] = $key; - } - } - - // -------------------------------------------------------------------- - - /** - * Add Field - * - * @access public - * @param string collation - * @return void - */ - function add_field($field = '') - { - if ($field == '') - { - show_error('Field information is required.'); - } - - if (is_string($field)) - { - if ($field == 'id') - { - $this->add_field(array( - 'id' => array( - 'type' => 'INT', - 'constraint' => 9, - 'auto_increment' => TRUE - ) - )); - $this->add_key('id', TRUE); - } - else - { - if (strpos($field, ' ') === FALSE) - { - show_error('Field information is required for that operation.'); - } - - $this->fields[] = $field; - } - } - - if (is_array($field)) - { - $this->fields = array_merge($this->fields, $field); - } - - } - - // -------------------------------------------------------------------- - - /** - * Create Table - * - * @access public - * @param string the table name - * @return bool - */ - function create_table($table = '', $if_not_exists = FALSE) - { - if ($table == '') - { - show_error('A table name is required for that operation.'); - } - - if (count($this->fields) == 0) - { - show_error('Field information is required.'); - } - - $sql = $this->_create_table($this->db->dbprefix.$table, $this->fields, $this->primary_keys, $this->keys, $if_not_exists); - - $this->_reset(); - return $this->db->query($sql); - } - - // -------------------------------------------------------------------- - - /** - * Drop Table - * - * @access public - * @param string the table name - * @return bool - */ - function drop_table($table_name) - { - $sql = $this->_drop_table($this->db->dbprefix.$table_name); - - if (is_bool($sql)) - { - return $sql; - } - - return $this->db->query($sql); - } - - // -------------------------------------------------------------------- - - /** - * Rename Table - * - * @access public - * @param string the old table name - * @param string the new table name - * @return bool - */ - function rename_table($table_name, $new_table_name) - { - if ($table_name == '' OR $new_table_name == '') - { - show_error('A table name is required for that operation.'); - } - - $sql = $this->_rename_table($table_name, $new_table_name); - return $this->db->query($sql); - } - - // -------------------------------------------------------------------- - - /** - * Column Add - * - * @access public - * @param string the table name - * @param string the column name - * @param string the column definition - * @return bool - */ - function add_column($table = '', $field = array(), $after_field = '') - { - if ($table == '') - { - show_error('A table name is required for that operation.'); - } - - // add field info into field array, but we can only do one at a time - // so we cycle through - - foreach ($field as $k => $v) - { - $this->add_field(array($k => $field[$k])); - - if (count($this->fields) == 0) - { - show_error('Field information is required.'); - } - - $sql = $this->_alter_table('ADD', $this->db->dbprefix.$table, $this->fields, $after_field); - - $this->_reset(); - - if ($this->db->query($sql) === FALSE) - { - return FALSE; - } - } - - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Column Drop - * - * @access public - * @param string the table name - * @param string the column name - * @return bool - */ - function drop_column($table = '', $column_name = '') - { - - if ($table == '') - { - show_error('A table name is required for that operation.'); - } - - if ($column_name == '') - { - show_error('A column name is required for that operation.'); - } - - $sql = $this->_alter_table('DROP', $this->db->dbprefix.$table, $column_name); - - return $this->db->query($sql); - } - - // -------------------------------------------------------------------- - - /** - * Column Modify - * - * @access public - * @param string the table name - * @param string the column name - * @param string the column definition - * @return bool - */ - function modify_column($table = '', $field = array()) - { - if ($table == '') - { - show_error('A table name is required for that operation.'); - } - - // add field info into field array, but we can only do one at a time - // so we cycle through - - foreach ($field as $k => $v) - { - $this->add_field(array($k => $field[$k])); - - if (count($this->fields) == 0) - { - show_error('Field information is required.'); - } - - $sql = $this->_alter_table('CHANGE', $this->db->dbprefix.$table, $this->fields); - - $this->_reset(); - - if ($this->db->query($sql) === FALSE) - { - return FALSE; - } - } - - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Reset - * - * Resets table creation vars - * - * @access private - * @return void - */ - function _reset() - { - $this->fields = array(); - $this->keys = array(); - $this->primary_keys = array(); - } - -} - -/* End of file DB_forge.php */ -/* Location: ./system/database/DB_forge.php */ \ No newline at end of file diff --git a/system/database/DB_result.php b/system/database/DB_result.php deleted file mode 100644 index b9e64feeb..000000000 --- a/system/database/DB_result.php +++ /dev/null @@ -1,342 +0,0 @@ -result_object() : $this->result_array(); - } - - // -------------------------------------------------------------------- - - /** - * Query result. "object" version. - * - * @access public - * @return object - */ - function result_object() - { - if (count($this->result_object) > 0) - { - return $this->result_object; - } - - // In the event that query caching is on the result_id variable - // will return FALSE since there isn't a valid SQL resource so - // we'll simply return an empty array. - if ($this->result_id === FALSE OR $this->num_rows() == 0) - { - return array(); - } - - $this->_data_seek(0); - while ($row = $this->_fetch_object()) - { - $this->result_object[] = $row; - } - - return $this->result_object; - } - - // -------------------------------------------------------------------- - - /** - * Query result. "array" version. - * - * @access public - * @return array - */ - function result_array() - { - if (count($this->result_array) > 0) - { - return $this->result_array; - } - - // In the event that query caching is on the result_id variable - // will return FALSE since there isn't a valid SQL resource so - // we'll simply return an empty array. - if ($this->result_id === FALSE OR $this->num_rows() == 0) - { - return array(); - } - - $this->_data_seek(0); - while ($row = $this->_fetch_assoc()) - { - $this->result_array[] = $row; - } - - return $this->result_array; - } - - // -------------------------------------------------------------------- - - /** - * Query result. Acts as a wrapper function for the following functions. - * - * @access public - * @param string - * @param string can be "object" or "array" - * @return mixed either a result object or array - */ - function row($n = 0, $type = 'object') - { - if ( ! is_numeric($n)) - { - // We cache the row data for subsequent uses - if ( ! is_array($this->row_data)) - { - $this->row_data = $this->row_array(0); - } - - // array_key_exists() instead of isset() to allow for MySQL NULL values - if (array_key_exists($n, $this->row_data)) - { - return $this->row_data[$n]; - } - // reset the $n variable if the result was not achieved - $n = 0; - } - - return ($type == 'object') ? $this->row_object($n) : $this->row_array($n); - } - - // -------------------------------------------------------------------- - - /** - * Assigns an item into a particular column slot - * - * @access public - * @return object - */ - function set_row($key, $value = NULL) - { - // We cache the row data for subsequent uses - if ( ! is_array($this->row_data)) - { - $this->row_data = $this->row_array(0); - } - - if (is_array($key)) - { - foreach ($key as $k => $v) - { - $this->row_data[$k] = $v; - } - - return; - } - - if ($key != '' AND ! is_null($value)) - { - $this->row_data[$key] = $value; - } - } - - // -------------------------------------------------------------------- - - /** - * Returns a single result row - object version - * - * @access public - * @return object - */ - function row_object($n = 0) - { - $result = $this->result_object(); - - if (count($result) == 0) - { - return $result; - } - - if ($n != $this->current_row AND isset($result[$n])) - { - $this->current_row = $n; - } - - return $result[$this->current_row]; - } - - // -------------------------------------------------------------------- - - /** - * Returns a single result row - array version - * - * @access public - * @return array - */ - function row_array($n = 0) - { - $result = $this->result_array(); - - if (count($result) == 0) - { - return $result; - } - - if ($n != $this->current_row AND isset($result[$n])) - { - $this->current_row = $n; - } - - return $result[$this->current_row]; - } - - - // -------------------------------------------------------------------- - - /** - * Returns the "first" row - * - * @access public - * @return object - */ - function first_row($type = 'object') - { - $result = $this->result($type); - - if (count($result) == 0) - { - return $result; - } - return $result[0]; - } - - // -------------------------------------------------------------------- - - /** - * Returns the "last" row - * - * @access public - * @return object - */ - function last_row($type = 'object') - { - $result = $this->result($type); - - if (count($result) == 0) - { - return $result; - } - return $result[count($result) -1]; - } - - // -------------------------------------------------------------------- - - /** - * Returns the "next" row - * - * @access public - * @return object - */ - function next_row($type = 'object') - { - $result = $this->result($type); - - if (count($result) == 0) - { - return $result; - } - - if (isset($result[$this->current_row + 1])) - { - ++$this->current_row; - } - - return $result[$this->current_row]; - } - - // -------------------------------------------------------------------- - - /** - * Returns the "previous" row - * - * @access public - * @return object - */ - function previous_row($type = 'object') - { - $result = $this->result($type); - - if (count($result) == 0) - { - return $result; - } - - if (isset($result[$this->current_row - 1])) - { - --$this->current_row; - } - return $result[$this->current_row]; - } - - // -------------------------------------------------------------------- - - /** - * The following functions are normally overloaded by the identically named - * methods in the platform-specific driver -- except when query caching - * is used. When caching is enabled we do not load the other driver. - * These functions are primarily here to prevent undefined function errors - * when a cached result object is in use. They are not otherwise fully - * operational due to the unavailability of the database resource IDs with - * cached results. - */ - function num_rows() { return $this->num_rows; } - function num_fields() { return 0; } - function list_fields() { return array(); } - function field_data() { return array(); } - function free_result() { return TRUE; } - function _data_seek() { return TRUE; } - function _fetch_assoc() { return array(); } - function _fetch_object() { return array(); } - -} -// END DB_result class - -/* End of file DB_result.php */ -/* Location: ./system/database/DB_result.php */ \ No newline at end of file diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php deleted file mode 100644 index 94e7a0bda..000000000 --- a/system/database/DB_utility.php +++ /dev/null @@ -1,389 +0,0 @@ -db - $CI =& get_instance(); - $this->db =& $CI->db; - - log_message('debug', "Database Utility Class Initialized"); - } - - // -------------------------------------------------------------------- - - /** - * List databases - * - * @access public - * @return bool - */ - function list_databases() - { - // Is there a cached result? - if (isset($this->data_cache['db_names'])) - { - return $this->data_cache['db_names']; - } - - $query = $this->db->query($this->_list_databases()); - $dbs = array(); - if ($query->num_rows() > 0) - { - foreach ($query->result_array() as $row) - { - $dbs[] = current($row); - } - } - - $this->data_cache['db_names'] = $dbs; - return $this->data_cache['db_names']; - } - - // -------------------------------------------------------------------- - - /** - * Optimize Table - * - * @access public - * @param string the table name - * @return bool - */ - function optimize_table($table_name) - { - $sql = $this->_optimize_table($table_name); - - if (is_bool($sql)) - { - show_error('db_must_use_set'); - } - - $query = $this->db->query($sql); - $res = $query->result_array(); - - // Note: Due to a bug in current() that affects some versions - // of PHP we can not pass function call directly into it - return current($res); - } - - // -------------------------------------------------------------------- - - /** - * Optimize Database - * - * @access public - * @return array - */ - function optimize_database() - { - $result = array(); - foreach ($this->db->list_tables() as $table_name) - { - $sql = $this->_optimize_table($table_name); - - if (is_bool($sql)) - { - return $sql; - } - - $query = $this->db->query($sql); - - // Build the result array... - // Note: Due to a bug in current() that affects some versions - // of PHP we can not pass function call directly into it - $res = $query->result_array(); - $res = current($res); - $key = str_replace($this->db->database.'.', '', current($res)); - $keys = array_keys($res); - unset($res[$keys[0]]); - - $result[$key] = $res; - } - - return $result; - } - - // -------------------------------------------------------------------- - - /** - * Repair Table - * - * @access public - * @param string the table name - * @return bool - */ - function repair_table($table_name) - { - $sql = $this->_repair_table($table_name); - - if (is_bool($sql)) - { - return $sql; - } - - $query = $this->db->query($sql); - - // Note: Due to a bug in current() that affects some versions - // of PHP we can not pass function call directly into it - $res = $query->result_array(); - return current($res); - } - - // -------------------------------------------------------------------- - - /** - * Generate CSV from a query result object - * - * @access public - * @param object The query result object - * @param string The delimiter - comma by default - * @param string The newline character - \n by default - * @param string The enclosure - double quote by default - * @return string - */ - function csv_from_result($query, $delim = ",", $newline = "\n", $enclosure = '"') - { - if ( ! is_object($query) OR ! method_exists($query, 'list_fields')) - { - show_error('You must submit a valid result object'); - } - - $out = ''; - - // First generate the headings from the table column names - foreach ($query->list_fields() as $name) - { - $out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $name).$enclosure.$delim; - } - - $out = rtrim($out); - $out .= $newline; - - // Next blast through the result array and build out the rows - foreach ($query->result_array() as $row) - { - foreach ($row as $item) - { - $out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $item).$enclosure.$delim; - } - $out = rtrim($out); - $out .= $newline; - } - - return $out; - } - - // -------------------------------------------------------------------- - - /** - * Generate XML data from a query result object - * - * @access public - * @param object The query result object - * @param array Any preferences - * @return string - */ - function xml_from_result($query, $params = array()) - { - if ( ! is_object($query) OR ! method_exists($query, 'list_fields')) - { - show_error('You must submit a valid result object'); - } - - // Set our default values - foreach (array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t") as $key => $val) - { - if ( ! isset($params[$key])) - { - $params[$key] = $val; - } - } - - // Create variables for convenience - extract($params); - - // Load the xml helper - $CI =& get_instance(); - $CI->load->helper('xml'); - - // Generate the result - $xml = "<{$root}>".$newline; - foreach ($query->result_array() as $row) - { - $xml .= $tab."<{$element}>".$newline; - - foreach ($row as $key => $val) - { - $xml .= $tab.$tab."<{$key}>".xml_convert($val)."".$newline; - } - $xml .= $tab."".$newline; - } - $xml .= "".$newline; - - return $xml; - } - - // -------------------------------------------------------------------- - - /** - * Database Backup - * - * @access public - * @return void - */ - function backup($params = array()) - { - // If the parameters have not been submitted as an - // array then we know that it is simply the table - // name, which is a valid short cut. - if (is_string($params)) - { - $params = array('tables' => $params); - } - - // ------------------------------------------------------ - - // Set up our default preferences - $prefs = array( - 'tables' => array(), - 'ignore' => array(), - 'filename' => '', - 'format' => 'gzip', // gzip, zip, txt - 'add_drop' => TRUE, - 'add_insert' => TRUE, - 'newline' => "\n" - ); - - // Did the user submit any preferences? If so set them.... - if (count($params) > 0) - { - foreach ($prefs as $key => $val) - { - if (isset($params[$key])) - { - $prefs[$key] = $params[$key]; - } - } - } - - // ------------------------------------------------------ - - // Are we backing up a complete database or individual tables? - // If no table names were submitted we'll fetch the entire table list - if (count($prefs['tables']) == 0) - { - $prefs['tables'] = $this->db->list_tables(); - } - - // ------------------------------------------------------ - - // Validate the format - if ( ! in_array($prefs['format'], array('gzip', 'zip', 'txt'), TRUE)) - { - $prefs['format'] = 'txt'; - } - - // ------------------------------------------------------ - - // Is the encoder supported? If not, we'll either issue an - // error or use plain text depending on the debug settings - if (($prefs['format'] == 'gzip' AND ! @function_exists('gzencode')) - OR ($prefs['format'] == 'zip' AND ! @function_exists('gzcompress'))) - { - if ($this->db->db_debug) - { - return $this->db->display_error('db_unsuported_compression'); - } - - $prefs['format'] = 'txt'; - } - - // ------------------------------------------------------ - - // Set the filename if not provided - Only needed with Zip files - if ($prefs['filename'] == '' AND $prefs['format'] == 'zip') - { - $prefs['filename'] = (count($prefs['tables']) == 1) ? $prefs['tables'] : $this->db->database; - $prefs['filename'] .= '_'.date('Y-m-d_H-i', time()); - } - - // ------------------------------------------------------ - - // Was a Gzip file requested? - if ($prefs['format'] == 'gzip') - { - return gzencode($this->_backup($prefs)); - } - - // ------------------------------------------------------ - - // Was a text file requested? - if ($prefs['format'] == 'txt') - { - return $this->_backup($prefs); - } - - // ------------------------------------------------------ - - // Was a Zip file requested? - if ($prefs['format'] == 'zip') - { - // If they included the .zip file extension we'll remove it - if (preg_match("|.+?\.zip$|", $prefs['filename'])) - { - $prefs['filename'] = str_replace('.zip', '', $prefs['filename']); - } - - // Tack on the ".sql" file extension if needed - if ( ! preg_match("|.+?\.sql$|", $prefs['filename'])) - { - $prefs['filename'] .= '.sql'; - } - - // Load the Zip class and output it - - $CI =& get_instance(); - $CI->load->library('zip'); - $CI->zip->add_data($prefs['filename'], $this->_backup($prefs)); - return $CI->zip->get_zip(); - } - - } - -} - - -/* End of file DB_utility.php */ -/* Location: ./system/database/DB_utility.php */ \ No newline at end of file diff --git a/system/database/drivers/index.html b/system/database/drivers/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/database/drivers/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

                              Directory access is forbidden.

                              - - - \ No newline at end of file diff --git a/system/database/drivers/mssql/index.html b/system/database/drivers/mssql/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/database/drivers/mssql/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

                              Directory access is forbidden.

                              - - - \ No newline at end of file diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php deleted file mode 100644 index f301ba533..000000000 --- a/system/database/drivers/mssql/mssql_driver.php +++ /dev/null @@ -1,667 +0,0 @@ -port != '') - { - $this->hostname .= ','.$this->port; - } - - return @mssql_connect($this->hostname, $this->username, $this->password); - } - - // -------------------------------------------------------------------- - - /** - * Persistent database connection - * - * @access private called by the base class - * @return resource - */ - function db_pconnect() - { - if ($this->port != '') - { - $this->hostname .= ','.$this->port; - } - - return @mssql_pconnect($this->hostname, $this->username, $this->password); - } - - // -------------------------------------------------------------------- - - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @access public - * @return void - */ - function reconnect() - { - // not implemented in MSSQL - } - - // -------------------------------------------------------------------- - - /** - * Select the database - * - * @access private called by the base class - * @return resource - */ - function db_select() - { - // Note: The brackets are required in the event that the DB name - // contains reserved characters - return @mssql_select_db('['.$this->database.']', $this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * Set client character set - * - * @access public - * @param string - * @param string - * @return resource - */ - function db_set_charset($charset, $collation) - { - // @todo - add support if needed - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Execute the query - * - * @access private called by the base class - * @param string an SQL query - * @return resource - */ - function _execute($sql) - { - $sql = $this->_prep_query($sql); - return @mssql_query($sql, $this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * Prep the query - * - * If needed, each database adapter can prep the query string - * - * @access private called by execute() - * @param string an SQL query - * @return string - */ - function _prep_query($sql) - { - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Begin Transaction - * - * @access public - * @return bool - */ - function trans_begin($test_mode = FALSE) - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - // Reset the transaction failure flag. - // If the $test_mode flag is set to TRUE transactions will be rolled back - // even if the queries produce a successful result. - $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; - - $this->simple_query('BEGIN TRAN'); - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Commit Transaction - * - * @access public - * @return bool - */ - function trans_commit() - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - $this->simple_query('COMMIT TRAN'); - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Rollback Transaction - * - * @access public - * @return bool - */ - function trans_rollback() - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - $this->simple_query('ROLLBACK TRAN'); - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Escape String - * - * @access public - * @param string - * @param bool whether or not the string will be used in a LIKE condition - * @return string - */ - function escape_str($str, $like = FALSE) - { - if (is_array($str)) - { - foreach($str as $key => $val) - { - $str[$key] = $this->escape_str($val, $like); - } - - return $str; - } - - // Access the CI object - $CI =& get_instance(); - - // Escape single quotes - $str = str_replace("'", "''", $CI->input->_remove_invisible_characters($str)); - - // escape LIKE condition wildcards - if ($like === TRUE) - { - $str = str_replace( array('%', '_', $this->_like_escape_chr), - array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), - $str); - } - - return $str; - } - - // -------------------------------------------------------------------- - - /** - * Affected Rows - * - * @access public - * @return integer - */ - function affected_rows() - { - return @mssql_rows_affected($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * Insert ID - * - * Returns the last id created in the Identity column. - * - * @access public - * @return integer - */ - function insert_id() - { - $ver = self::_parse_major_version($this->version()); - $sql = ($ver >= 8 ? "SELECT SCOPE_IDENTITY() AS last_id" : "SELECT @@IDENTITY AS last_id"); - $query = $this->query($sql); - $row = $query->row(); - return $row->last_id; - } - - // -------------------------------------------------------------------- - - /** - * Parse major version - * - * Grabs the major version number from the - * database server version string passed in. - * - * @access private - * @param string $version - * @return int16 major version number - */ - function _parse_major_version($version) - { - preg_match('/([0-9]+)\.([0-9]+)\.([0-9]+)/', $version, $ver_info); - return $ver_info[1]; // return the major version b/c that's all we're interested in. - } - - // -------------------------------------------------------------------- - - /** - * Version number query string - * - * @access public - * @return string - */ - function _version() - { - return "SELECT @@VERSION AS ver"; - } - - // -------------------------------------------------------------------- - - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @access public - * @param string - * @return string - */ - function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); - - if ($query->num_rows() == 0) - { - return 0; - } - - $row = $query->row(); - return (int) $row->numrows; - } - - // -------------------------------------------------------------------- - - /** - * List table query - * - * Generates a platform-specific query string so that the table names can be fetched - * - * @access private - * @param boolean - * @return string - */ - function _list_tables($prefix_limit = FALSE) - { - $sql = "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name"; - - // for future compatibility - if ($prefix_limit !== FALSE AND $this->dbprefix != '') - { - //$sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_char); - return FALSE; // not currently supported - } - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * List column query - * - * Generates a platform-specific query string so that the column names can be fetched - * - * @access private - * @param string the table name - * @return string - */ - function _list_columns($table = '') - { - return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$table."'"; - } - - // -------------------------------------------------------------------- - - /** - * Field data query - * - * Generates a platform-specific query so that the column data can be retrieved - * - * @access public - * @param string the table name - * @return object - */ - function _field_data($table) - { - return "SELECT TOP 1 * FROM ".$table; - } - - // -------------------------------------------------------------------- - - /** - * The error message string - * - * @access private - * @return string - */ - function _error_message() - { - return mssql_get_last_message(); - } - - // -------------------------------------------------------------------- - - /** - * The error message number - * - * @access private - * @return integer - */ - function _error_number() - { - // Are error numbers supported? - return ''; - } - - // -------------------------------------------------------------------- - - /** - * Escape the SQL Identifiers - * - * This function escapes column and table names - * - * @access private - * @param string - * @return string - */ - function _escape_identifiers($item) - { - if ($this->_escape_char == '') - { - return $item; - } - - foreach ($this->_reserved_identifiers as $id) - { - if (strpos($item, '.'.$id) !== FALSE) - { - $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); - - // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); - } - } - - if (strpos($item, '.') !== FALSE) - { - $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; - } - else - { - $str = $this->_escape_char.$item.$this->_escape_char; - } - - // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); - } - - // -------------------------------------------------------------------- - - /** - * From Tables - * - * This function implicitly groups FROM tables so there is no confusion - * about operator precedence in harmony with SQL standards - * - * @access public - * @param type - * @return type - */ - function _from_tables($tables) - { - if ( ! is_array($tables)) - { - $tables = array($tables); - } - - return implode(', ', $tables); - } - - // -------------------------------------------------------------------- - - /** - * Insert statement - * - * Generates a platform-specific insert string from the supplied data - * - * @access public - * @param string the table name - * @param array the insert keys - * @param array the insert values - * @return string - */ - function _insert($table, $keys, $values) - { - return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; - } - - // -------------------------------------------------------------------- - - /** - * Update statement - * - * Generates a platform-specific update string from the supplied data - * - * @access public - * @param string the table name - * @param array the update data - * @param array the where clause - * @param array the orderby clause - * @param array the limit clause - * @return string - */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) - { - foreach($values as $key => $val) - { - $valstr[] = $key." = ".$val; - } - - $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - - $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; - - $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); - - $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; - - $sql .= $orderby.$limit; - - return $sql; - } - - - // -------------------------------------------------------------------- - - /** - * Truncate statement - * - * Generates a platform-specific truncate string from the supplied data - * If the database does not support the truncate() command - * This function maps to "DELETE FROM table" - * - * @access public - * @param string the table name - * @return string - */ - function _truncate($table) - { - return "TRUNCATE ".$table; - } - - // -------------------------------------------------------------------- - - /** - * Delete statement - * - * Generates a platform-specific delete string from the supplied data - * - * @access public - * @param string the table name - * @param array the where clause - * @param string the limit clause - * @return string - */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) - { - $conditions = ''; - - if (count($where) > 0 OR count($like) > 0) - { - $conditions = "\nWHERE "; - $conditions .= implode("\n", $this->ar_where); - - if (count($where) > 0 && count($like) > 0) - { - $conditions .= " AND "; - } - $conditions .= implode("\n", $like); - } - - $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - - return "DELETE FROM ".$table.$conditions.$limit; - } - - // -------------------------------------------------------------------- - - /** - * Limit string - * - * Generates a platform-specific LIMIT clause - * - * @access public - * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value - * @return string - */ - function _limit($sql, $limit, $offset) - { - $i = $limit + $offset; - - return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.$i.' ', $sql); - } - - // -------------------------------------------------------------------- - - /** - * Close DB Connection - * - * @access public - * @param resource - * @return void - */ - function _close($conn_id) - { - @mssql_close($conn_id); - } - -} - - - -/* End of file mssql_driver.php */ -/* Location: ./system/database/drivers/mssql/mssql_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php deleted file mode 100644 index f6a17811f..000000000 --- a/system/database/drivers/mssql/mssql_forge.php +++ /dev/null @@ -1,248 +0,0 @@ -db->_escape_identifiers($table); - } - - // -------------------------------------------------------------------- - - /** - * Create Table - * - * @access private - * @param string the table name - * @param array the fields - * @param mixed primary key(s) - * @param mixed key(s) - * @param boolean should 'IF NOT EXISTS' be added to the SQL - * @return bool - */ - function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) - { - $sql = 'CREATE TABLE '; - - if ($if_not_exists === TRUE) - { - $sql .= 'IF NOT EXISTS '; - } - - $sql .= $this->db->_escape_identifiers($table)." ("; - $current_field_count = 0; - - foreach ($fields as $field=>$attributes) - { - // Numeric field names aren't allowed in databases, so if the key is - // numeric, we know it was assigned by PHP and the developer manually - // entered the field information, so we'll simply add it to the list - if (is_numeric($field)) - { - $sql .= "\n\t$attributes"; - } - else - { - $attributes = array_change_key_case($attributes, CASE_UPPER); - - $sql .= "\n\t".$this->db->_protect_identifiers($field); - - $sql .= ' '.$attributes['TYPE']; - - if (array_key_exists('CONSTRAINT', $attributes)) - { - $sql .= '('.$attributes['CONSTRAINT'].')'; - } - - if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE) - { - $sql .= ' UNSIGNED'; - } - - if (array_key_exists('DEFAULT', $attributes)) - { - $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\''; - } - - if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE) - { - $sql .= ' NULL'; - } - else - { - $sql .= ' NOT NULL'; - } - - if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE) - { - $sql .= ' AUTO_INCREMENT'; - } - } - - // don't add a comma on the end of the last field - if (++$current_field_count < count($fields)) - { - $sql .= ','; - } - } - - if (count($primary_keys) > 0) - { - $primary_keys = $this->db->_protect_identifiers($primary_keys); - $sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")"; - } - - if (is_array($keys) && count($keys) > 0) - { - foreach ($keys as $key) - { - if (is_array($key)) - { - $key = $this->db->_protect_identifiers($key); - } - else - { - $key = array($this->db->_protect_identifiers($key)); - } - - $sql .= ",\n\tFOREIGN KEY (" . implode(', ', $key) . ")"; - } - } - - $sql .= "\n)"; - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Alter table query - * - * Generates a platform-specific query so that a table can be altered - * Called by add_column(), drop_column(), and column_alter(), - * - * @access private - * @param string the ALTER type (ADD, DROP, CHANGE) - * @param string the column name - * @param string the table name - * @param string the column definition - * @param string the default value - * @param boolean should 'NOT NULL' be added - * @param string the field after which we should add the new field - * @return object - */ - function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') - { - $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table)." $alter_type ".$this->db->_protect_identifiers($column_name); - - // DROP has everything it needs now. - if ($alter_type == 'DROP') - { - return $sql; - } - - $sql .= " $column_definition"; - - if ($default_value != '') - { - $sql .= " DEFAULT \"$default_value\""; - } - - if ($null === NULL) - { - $sql .= ' NULL'; - } - else - { - $sql .= ' NOT NULL'; - } - - if ($after_field != '') - { - $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); - } - - return $sql; - - } - - // -------------------------------------------------------------------- - - /** - * Rename a table - * - * Generates a platform-specific query so that a table can be renamed - * - * @access private - * @param string the old table name - * @param string the new table name - * @return string - */ - function _rename_table($table_name, $new_table_name) - { - // I think this syntax will work, but can find little documentation on renaming tables in MSSQL - $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table_name)." RENAME TO ".$this->db->_protect_identifiers($new_table_name); - return $sql; - } - -} - -/* End of file mssql_forge.php */ -/* Location: ./system/database/drivers/mssql/mssql_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php deleted file mode 100644 index e7b338045..000000000 --- a/system/database/drivers/mssql/mssql_result.php +++ /dev/null @@ -1,169 +0,0 @@ -result_id); - } - - // -------------------------------------------------------------------- - - /** - * Number of fields in the result set - * - * @access public - * @return integer - */ - function num_fields() - { - return @mssql_num_fields($this->result_id); - } - - // -------------------------------------------------------------------- - - /** - * Fetch Field Names - * - * Generates an array of column names - * - * @access public - * @return array - */ - function list_fields() - { - $field_names = array(); - while ($field = mssql_fetch_field($this->result_id)) - { - $field_names[] = $field->name; - } - - return $field_names; - } - - // -------------------------------------------------------------------- - - /** - * Field data - * - * Generates an array of objects containing field meta-data - * - * @access public - * @return array - */ - function field_data() - { - $retval = array(); - while ($field = mssql_fetch_field($this->result_id)) - { - $F = new stdClass(); - $F->name = $field->name; - $F->type = $field->type; - $F->max_length = $field->max_length; - $F->primary_key = 0; - $F->default = ''; - - $retval[] = $F; - } - - return $retval; - } - - // -------------------------------------------------------------------- - - /** - * Free the result - * - * @return null - */ - function free_result() - { - if (is_resource($this->result_id)) - { - mssql_free_result($this->result_id); - $this->result_id = FALSE; - } - } - - // -------------------------------------------------------------------- - - /** - * Data Seek - * - * Moves the internal pointer to the desired offset. We call - * this internally before fetching results to make sure the - * result set starts at zero - * - * @access private - * @return array - */ - function _data_seek($n = 0) - { - return mssql_data_seek($this->result_id, $n); - } - - // -------------------------------------------------------------------- - - /** - * Result - associative array - * - * Returns the result set as an array - * - * @access private - * @return array - */ - function _fetch_assoc() - { - return mssql_fetch_assoc($this->result_id); - } - - // -------------------------------------------------------------------- - - /** - * Result - object - * - * Returns the result set as an object - * - * @access private - * @return object - */ - function _fetch_object() - { - return mssql_fetch_object($this->result_id); - } - -} - - -/* End of file mssql_result.php */ -/* Location: ./system/database/drivers/mssql/mssql_result.php */ \ No newline at end of file diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php deleted file mode 100644 index da887b815..000000000 --- a/system/database/drivers/mssql/mssql_utility.php +++ /dev/null @@ -1,123 +0,0 @@ -db->display_error('db_unsuported_feature'); - } - - /** - * - * The functions below have been deprecated as of 1.6, and are only here for backwards - * compatibility. They now reside in dbforge(). The use of dbutils for database manipulation - * is STRONGLY discouraged in favour if using dbforge. - * - */ - - /** - * Create database - * - * @access private - * @param string the database name - * @return bool - */ - function _create_database($name) - { - return "CREATE DATABASE ".$name; - } - - // -------------------------------------------------------------------- - - /** - * Drop database - * - * @access private - * @param string the database name - * @return bool - */ - function _drop_database($name) - { - return "DROP DATABASE ".$name; - } - -} - - -/* End of file mssql_utility.php */ -/* Location: ./system/database/drivers/mssql/mssql_utility.php */ \ No newline at end of file diff --git a/system/database/drivers/mysql/index.html b/system/database/drivers/mysql/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/database/drivers/mysql/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

                              Directory access is forbidden.

                              - - - \ No newline at end of file diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php deleted file mode 100644 index 85a6ef4a0..000000000 --- a/system/database/drivers/mysql/mysql_driver.php +++ /dev/null @@ -1,670 +0,0 @@ -port != '') - { - $this->hostname .= ':'.$this->port; - } - - return @mysql_connect($this->hostname, $this->username, $this->password, TRUE); - } - - // -------------------------------------------------------------------- - - /** - * Persistent database connection - * - * @access private called by the base class - * @return resource - */ - function db_pconnect() - { - if ($this->port != '') - { - $this->hostname .= ':'.$this->port; - } - - return @mysql_pconnect($this->hostname, $this->username, $this->password); - } - - // -------------------------------------------------------------------- - - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @access public - * @return void - */ - function reconnect() - { - if (mysql_ping($this->conn_id) === FALSE) - { - $this->conn_id = FALSE; - } - } - - // -------------------------------------------------------------------- - - /** - * Select the database - * - * @access private called by the base class - * @return resource - */ - function db_select() - { - return @mysql_select_db($this->database, $this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * Set client character set - * - * @access public - * @param string - * @param string - * @return resource - */ - function db_set_charset($charset, $collation) - { - return @mysql_query("SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'", $this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * Version number query string - * - * @access public - * @return string - */ - function _version() - { - return "SELECT version() AS ver"; - } - - // -------------------------------------------------------------------- - - /** - * Execute the query - * - * @access private called by the base class - * @param string an SQL query - * @return resource - */ - function _execute($sql) - { - $sql = $this->_prep_query($sql); - return @mysql_query($sql, $this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * Prep the query - * - * If needed, each database adapter can prep the query string - * - * @access private called by execute() - * @param string an SQL query - * @return string - */ - function _prep_query($sql) - { - // "DELETE FROM TABLE" returns 0 affected rows This hack modifies - // the query so that it returns the number of affected rows - if ($this->delete_hack === TRUE) - { - if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $sql)) - { - $sql = preg_replace("/^\s*DELETE\s+FROM\s+(\S+)\s*$/", "DELETE FROM \\1 WHERE 1=1", $sql); - } - } - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Begin Transaction - * - * @access public - * @return bool - */ - function trans_begin($test_mode = FALSE) - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - // Reset the transaction failure flag. - // If the $test_mode flag is set to TRUE transactions will be rolled back - // even if the queries produce a successful result. - $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; - - $this->simple_query('SET AUTOCOMMIT=0'); - $this->simple_query('START TRANSACTION'); // can also be BEGIN or BEGIN WORK - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Commit Transaction - * - * @access public - * @return bool - */ - function trans_commit() - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - $this->simple_query('COMMIT'); - $this->simple_query('SET AUTOCOMMIT=1'); - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Rollback Transaction - * - * @access public - * @return bool - */ - function trans_rollback() - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - $this->simple_query('ROLLBACK'); - $this->simple_query('SET AUTOCOMMIT=1'); - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Escape String - * - * @access public - * @param string - * @param bool whether or not the string will be used in a LIKE condition - * @return string - */ - function escape_str($str, $like = FALSE) - { - if (is_array($str)) - { - foreach($str as $key => $val) - { - $str[$key] = $this->escape_str($val, $like); - } - - return $str; - } - - if (function_exists('mysql_real_escape_string') AND is_resource($this->conn_id)) - { - $str = mysql_real_escape_string($str, $this->conn_id); - } - elseif (function_exists('mysql_escape_string')) - { - $str = mysql_escape_string($str); - } - else - { - $str = addslashes($str); - } - - // escape LIKE condition wildcards - if ($like === TRUE) - { - $str = str_replace(array('%', '_'), array('\\%', '\\_'), $str); - } - - return $str; - } - - // -------------------------------------------------------------------- - - /** - * Affected Rows - * - * @access public - * @return integer - */ - function affected_rows() - { - return @mysql_affected_rows($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * Insert ID - * - * @access public - * @return integer - */ - function insert_id() - { - return @mysql_insert_id($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @access public - * @param string - * @return string - */ - function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); - - if ($query->num_rows() == 0) - { - return 0; - } - - $row = $query->row(); - return (int) $row->numrows; - } - - // -------------------------------------------------------------------- - - /** - * List table query - * - * Generates a platform-specific query string so that the table names can be fetched - * - * @access private - * @param boolean - * @return string - */ - function _list_tables($prefix_limit = FALSE) - { - $sql = "SHOW TABLES FROM ".$this->_escape_char.$this->database.$this->_escape_char; - - if ($prefix_limit !== FALSE AND $this->dbprefix != '') - { - $sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%'"; - } - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Show column query - * - * Generates a platform-specific query string so that the column names can be fetched - * - * @access public - * @param string the table name - * @return string - */ - function _list_columns($table = '') - { - return "SHOW COLUMNS FROM ".$table; - } - - // -------------------------------------------------------------------- - - /** - * Field data query - * - * Generates a platform-specific query so that the column data can be retrieved - * - * @access public - * @param string the table name - * @return object - */ - function _field_data($table) - { - return "SELECT * FROM ".$table." LIMIT 1"; - } - - // -------------------------------------------------------------------- - - /** - * The error message string - * - * @access private - * @return string - */ - function _error_message() - { - return mysql_error($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * The error message number - * - * @access private - * @return integer - */ - function _error_number() - { - return mysql_errno($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * Escape the SQL Identifiers - * - * This function escapes column and table names - * - * @access private - * @param string - * @return string - */ - function _escape_identifiers($item) - { - if ($this->_escape_char == '') - { - return $item; - } - - foreach ($this->_reserved_identifiers as $id) - { - if (strpos($item, '.'.$id) !== FALSE) - { - $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); - - // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); - } - } - - if (strpos($item, '.') !== FALSE) - { - $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; - } - else - { - $str = $this->_escape_char.$item.$this->_escape_char; - } - - // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); - } - - // -------------------------------------------------------------------- - - /** - * From Tables - * - * This function implicitly groups FROM tables so there is no confusion - * about operator precedence in harmony with SQL standards - * - * @access public - * @param type - * @return type - */ - function _from_tables($tables) - { - if ( ! is_array($tables)) - { - $tables = array($tables); - } - - return '('.implode(', ', $tables).')'; - } - - // -------------------------------------------------------------------- - - /** - * Insert statement - * - * Generates a platform-specific insert string from the supplied data - * - * @access public - * @param string the table name - * @param array the insert keys - * @param array the insert values - * @return string - */ - function _insert($table, $keys, $values) - { - return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; - } - - // -------------------------------------------------------------------- - - /** - * Update statement - * - * Generates a platform-specific update string from the supplied data - * - * @access public - * @param string the table name - * @param array the update data - * @param array the where clause - * @param array the orderby clause - * @param array the limit clause - * @return string - */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) - { - foreach($values as $key => $val) - { - $valstr[] = $key." = ".$val; - } - - $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - - $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; - - $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); - - $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; - - $sql .= $orderby.$limit; - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Truncate statement - * - * Generates a platform-specific truncate string from the supplied data - * If the database does not support the truncate() command - * This function maps to "DELETE FROM table" - * - * @access public - * @param string the table name - * @return string - */ - function _truncate($table) - { - return "TRUNCATE ".$table; - } - - // -------------------------------------------------------------------- - - /** - * Delete statement - * - * Generates a platform-specific delete string from the supplied data - * - * @access public - * @param string the table name - * @param array the where clause - * @param string the limit clause - * @return string - */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) - { - $conditions = ''; - - if (count($where) > 0 OR count($like) > 0) - { - $conditions = "\nWHERE "; - $conditions .= implode("\n", $this->ar_where); - - if (count($where) > 0 && count($like) > 0) - { - $conditions .= " AND "; - } - $conditions .= implode("\n", $like); - } - - $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - - return "DELETE FROM ".$table.$conditions.$limit; - } - - // -------------------------------------------------------------------- - - /** - * Limit string - * - * Generates a platform-specific LIMIT clause - * - * @access public - * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value - * @return string - */ - function _limit($sql, $limit, $offset) - { - if ($offset == 0) - { - $offset = ''; - } - else - { - $offset .= ", "; - } - - return $sql."LIMIT ".$offset.$limit; - } - - // -------------------------------------------------------------------- - - /** - * Close DB Connection - * - * @access public - * @param resource - * @return void - */ - function _close($conn_id) - { - @mysql_close($conn_id); - } - -} - - -/* End of file mysql_driver.php */ -/* Location: ./system/database/drivers/mysql/mysql_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php deleted file mode 100644 index ccacf99f8..000000000 --- a/system/database/drivers/mysql/mysql_forge.php +++ /dev/null @@ -1,254 +0,0 @@ -$attributes) - { - // Numeric field names aren't allowed in databases, so if the key is - // numeric, we know it was assigned by PHP and the developer manually - // entered the field information, so we'll simply add it to the list - if (is_numeric($field)) - { - $sql .= "\n\t$attributes"; - } - else - { - $attributes = array_change_key_case($attributes, CASE_UPPER); - - $sql .= "\n\t".$this->db->_protect_identifiers($field); - - if (array_key_exists('NAME', $attributes)) - { - $sql .= ' '.$this->db->_protect_identifiers($attributes['NAME']).' '; - } - - if (array_key_exists('TYPE', $attributes)) - { - $sql .= ' '.$attributes['TYPE']; - } - - if (array_key_exists('CONSTRAINT', $attributes)) - { - $sql .= '('.$attributes['CONSTRAINT'].')'; - } - - if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE) - { - $sql .= ' UNSIGNED'; - } - - if (array_key_exists('DEFAULT', $attributes)) - { - $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\''; - } - - if (array_key_exists('NULL', $attributes)) - { - $sql .= ($attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL'; - } - - if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE) - { - $sql .= ' AUTO_INCREMENT'; - } - } - - // don't add a comma on the end of the last field - if (++$current_field_count < count($fields)) - { - $sql .= ','; - } - } - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Create Table - * - * @access private - * @param string the table name - * @param mixed the fields - * @param mixed primary key(s) - * @param mixed key(s) - * @param boolean should 'IF NOT EXISTS' be added to the SQL - * @return bool - */ - function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) - { - $sql = 'CREATE TABLE '; - - if ($if_not_exists === TRUE) - { - $sql .= 'IF NOT EXISTS '; - } - - $sql .= $this->db->_escape_identifiers($table)." ("; - - $sql .= $this->_process_fields($fields); - - if (count($primary_keys) > 0) - { - $key_name = $this->db->_protect_identifiers(implode('_', $primary_keys)); - $primary_keys = $this->db->_protect_identifiers($primary_keys); - $sql .= ",\n\tPRIMARY KEY ".$key_name." (" . implode(', ', $primary_keys) . ")"; - } - - if (is_array($keys) && count($keys) > 0) - { - foreach ($keys as $key) - { - if (is_array($key)) - { - $key_name = $this->db->_protect_identifiers(implode('_', $key)); - $key = $this->db->_protect_identifiers($key); - } - else - { - $key_name = $this->db->_protect_identifiers($key); - $key = array($key_name); - } - - $sql .= ",\n\tKEY {$key_name} (" . implode(', ', $key) . ")"; - } - } - - $sql .= "\n) DEFAULT CHARACTER SET {$this->db->char_set} COLLATE {$this->db->dbcollat};"; - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Drop Table - * - * @access private - * @return string - */ - function _drop_table($table) - { - return "DROP TABLE IF EXISTS ".$this->db->_escape_identifiers($table); - } - - // -------------------------------------------------------------------- - - /** - * Alter table query - * - * Generates a platform-specific query so that a table can be altered - * Called by add_column(), drop_column(), and column_alter(), - * - * @access private - * @param string the ALTER type (ADD, DROP, CHANGE) - * @param string the column name - * @param array fields - * @param string the field after which we should add the new field - * @return object - */ - function _alter_table($alter_type, $table, $fields, $after_field = '') - { - $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table)." $alter_type "; - - // DROP has everything it needs now. - if ($alter_type == 'DROP') - { - return $sql.$this->db->_protect_identifiers($fields); - } - - $sql .= $this->_process_fields($fields); - - if ($after_field != '') - { - $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); - } - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Rename a table - * - * Generates a platform-specific query so that a table can be renamed - * - * @access private - * @param string the old table name - * @param string the new table name - * @return string - */ - function _rename_table($table_name, $new_table_name) - { - $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table_name)." RENAME TO ".$this->db->_protect_identifiers($new_table_name); - return $sql; - } - -} - -/* End of file mysql_forge.php */ -/* Location: ./system/database/drivers/mysql/mysql_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php deleted file mode 100644 index acc586626..000000000 --- a/system/database/drivers/mysql/mysql_result.php +++ /dev/null @@ -1,169 +0,0 @@ -result_id); - } - - // -------------------------------------------------------------------- - - /** - * Number of fields in the result set - * - * @access public - * @return integer - */ - function num_fields() - { - return @mysql_num_fields($this->result_id); - } - - // -------------------------------------------------------------------- - - /** - * Fetch Field Names - * - * Generates an array of column names - * - * @access public - * @return array - */ - function list_fields() - { - $field_names = array(); - while ($field = mysql_fetch_field($this->result_id)) - { - $field_names[] = $field->name; - } - - return $field_names; - } - - // -------------------------------------------------------------------- - - /** - * Field data - * - * Generates an array of objects containing field meta-data - * - * @access public - * @return array - */ - function field_data() - { - $retval = array(); - while ($field = mysql_fetch_field($this->result_id)) - { - $F = new stdClass(); - $F->name = $field->name; - $F->type = $field->type; - $F->default = $field->def; - $F->max_length = $field->max_length; - $F->primary_key = $field->primary_key; - - $retval[] = $F; - } - - return $retval; - } - - // -------------------------------------------------------------------- - - /** - * Free the result - * - * @return null - */ - function free_result() - { - if (is_resource($this->result_id)) - { - mysql_free_result($this->result_id); - $this->result_id = FALSE; - } - } - - // -------------------------------------------------------------------- - - /** - * Data Seek - * - * Moves the internal pointer to the desired offset. We call - * this internally before fetching results to make sure the - * result set starts at zero - * - * @access private - * @return array - */ - function _data_seek($n = 0) - { - return mysql_data_seek($this->result_id, $n); - } - - // -------------------------------------------------------------------- - - /** - * Result - associative array - * - * Returns the result set as an array - * - * @access private - * @return array - */ - function _fetch_assoc() - { - return mysql_fetch_assoc($this->result_id); - } - - // -------------------------------------------------------------------- - - /** - * Result - object - * - * Returns the result set as an object - * - * @access private - * @return object - */ - function _fetch_object() - { - return mysql_fetch_object($this->result_id); - } - -} - - -/* End of file mysql_result.php */ -/* Location: ./system/database/drivers/mysql/mysql_result.php */ \ No newline at end of file diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php deleted file mode 100644 index 3277b0ff7..000000000 --- a/system/database/drivers/mysql/mysql_utility.php +++ /dev/null @@ -1,245 +0,0 @@ -db->_escape_identifiers($table); - } - - // -------------------------------------------------------------------- - - /** - * Repair table query - * - * Generates a platform-specific query so that a table can be repaired - * - * @access private - * @param string the table name - * @return object - */ - function _repair_table($table) - { - return "REPAIR TABLE ".$this->db->_escape_identifiers($table); - } - - // -------------------------------------------------------------------- - /** - * MySQL Export - * - * @access private - * @param array Preferences - * @return mixed - */ - function _backup($params = array()) - { - if (count($params) == 0) - { - return FALSE; - } - - // Extract the prefs for simplicity - extract($params); - - // Build the output - $output = ''; - foreach ((array)$tables as $table) - { - // Is the table in the "ignore" list? - if (in_array($table, (array)$ignore, TRUE)) - { - continue; - } - - // Get the table schema - $query = $this->db->query("SHOW CREATE TABLE `".$this->db->database.'`.'.$table); - - // No result means the table name was invalid - if ($query === FALSE) - { - continue; - } - - // Write out the table schema - $output .= '#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline; - - if ($add_drop == TRUE) - { - $output .= 'DROP TABLE IF EXISTS '.$table.';'.$newline.$newline; - } - - $i = 0; - $result = $query->result_array(); - foreach ($result[0] as $val) - { - if ($i++ % 2) - { - $output .= $val.';'.$newline.$newline; - } - } - - // If inserts are not needed we're done... - if ($add_insert == FALSE) - { - continue; - } - - // Grab all the data from the current table - $query = $this->db->query("SELECT * FROM $table"); - - if ($query->num_rows() == 0) - { - continue; - } - - // Fetch the field names and determine if the field is an - // integer type. We use this info to decide whether to - // surround the data with quotes or not - - $i = 0; - $field_str = ''; - $is_int = array(); - while ($field = mysql_fetch_field($query->result_id)) - { - // Most versions of MySQL store timestamp as a string - $is_int[$i] = (in_array( - strtolower(mysql_field_type($query->result_id, $i)), - array('tinyint', 'smallint', 'mediumint', 'int', 'bigint'), //, 'timestamp'), - TRUE) - ) ? TRUE : FALSE; - - // Create a string of field names - $field_str .= '`'.$field->name.'`, '; - $i++; - } - - // Trim off the end comma - $field_str = preg_replace( "/, $/" , "" , $field_str); - - - // Build the insert string - foreach ($query->result_array() as $row) - { - $val_str = ''; - - $i = 0; - foreach ($row as $v) - { - // Is the value NULL? - if ($v === NULL) - { - $val_str .= 'NULL'; - } - else - { - // Escape the data if it's not an integer - if ($is_int[$i] == FALSE) - { - $val_str .= $this->db->escape($v); - } - else - { - $val_str .= $v; - } - } - - // Append a comma - $val_str .= ', '; - $i++; - } - - // Remove the comma at the end of the string - $val_str = preg_replace( "/, $/" , "" , $val_str); - - // Build the INSERT string - $output .= 'INSERT INTO '.$table.' ('.$field_str.') VALUES ('.$val_str.');'.$newline; - } - - $output .= $newline.$newline; - } - - return $output; - } - - /** - * - * The functions below have been deprecated as of 1.6, and are only here for backwards - * compatibility. They now reside in dbforge(). The use of dbutils for database manipulation - * is STRONGLY discouraged in favour if using dbforge. - * - */ - - /** - * Create database - * - * @access private - * @param string the database name - * @return bool - */ - function _create_database($name) - { - return "CREATE DATABASE ".$name; - } - - // -------------------------------------------------------------------- - - /** - * Drop database - * - * @access private - * @param string the database name - * @return bool - */ - function _drop_database($name) - { - return "DROP DATABASE ".$name; - } - -} - -/* End of file mysql_utility.php */ -/* Location: ./system/database/drivers/mysql/mysql_utility.php */ \ No newline at end of file diff --git a/system/database/drivers/mysqli/index.html b/system/database/drivers/mysqli/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/database/drivers/mysqli/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

                              Directory access is forbidden.

                              - - - \ No newline at end of file diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php deleted file mode 100644 index 5d7200fbd..000000000 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ /dev/null @@ -1,671 +0,0 @@ -port != '') - { - return @mysqli_connect($this->hostname, $this->username, $this->password, $this->database, $this->port); - } - else - { - return @mysqli_connect($this->hostname, $this->username, $this->password, $this->database); - } - - } - - // -------------------------------------------------------------------- - - /** - * Persistent database connection - * - * @access private called by the base class - * @return resource - */ - function db_pconnect() - { - return $this->db_connect(); - } - - // -------------------------------------------------------------------- - - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @access public - * @return void - */ - function reconnect() - { - if (mysqli_ping($this->conn_id) === FALSE) - { - $this->conn_id = FALSE; - } - } - - // -------------------------------------------------------------------- - - /** - * Select the database - * - * @access private called by the base class - * @return resource - */ - function db_select() - { - return @mysqli_select_db($this->conn_id, $this->database); - } - - // -------------------------------------------------------------------- - - /** - * Set client character set - * - * @access private - * @param string - * @param string - * @return resource - */ - function _db_set_charset($charset, $collation) - { - return @mysqli_query($this->conn_id, "SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'"); - } - - // -------------------------------------------------------------------- - - /** - * Version number query string - * - * @access public - * @return string - */ - function _version() - { - return "SELECT version() AS ver"; - } - - // -------------------------------------------------------------------- - - /** - * Execute the query - * - * @access private called by the base class - * @param string an SQL query - * @return resource - */ - function _execute($sql) - { - $sql = $this->_prep_query($sql); - $result = @mysqli_query($this->conn_id, $sql); - return $result; - } - - // -------------------------------------------------------------------- - - /** - * Prep the query - * - * If needed, each database adapter can prep the query string - * - * @access private called by execute() - * @param string an SQL query - * @return string - */ - function _prep_query($sql) - { - // "DELETE FROM TABLE" returns 0 affected rows This hack modifies - // the query so that it returns the number of affected rows - if ($this->delete_hack === TRUE) - { - if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $sql)) - { - $sql = preg_replace("/^\s*DELETE\s+FROM\s+(\S+)\s*$/", "DELETE FROM \\1 WHERE 1=1", $sql); - } - } - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Begin Transaction - * - * @access public - * @return bool - */ - function trans_begin($test_mode = FALSE) - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - // Reset the transaction failure flag. - // If the $test_mode flag is set to TRUE transactions will be rolled back - // even if the queries produce a successful result. - $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; - - $this->simple_query('SET AUTOCOMMIT=0'); - $this->simple_query('START TRANSACTION'); // can also be BEGIN or BEGIN WORK - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Commit Transaction - * - * @access public - * @return bool - */ - function trans_commit() - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - $this->simple_query('COMMIT'); - $this->simple_query('SET AUTOCOMMIT=1'); - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Rollback Transaction - * - * @access public - * @return bool - */ - function trans_rollback() - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - $this->simple_query('ROLLBACK'); - $this->simple_query('SET AUTOCOMMIT=1'); - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Escape String - * - * @access public - * @param string - * @param bool whether or not the string will be used in a LIKE condition - * @return string - */ - function escape_str($str, $like = FALSE) - { - if (is_array($str)) - { - foreach($str as $key => $val) - { - $str[$key] = $this->escape_str($val, $like); - } - - return $str; - } - - if (function_exists('mysqli_real_escape_string') AND is_object($this->conn_id)) - { - $str = mysqli_real_escape_string($this->conn_id, $str); - } - elseif (function_exists('mysql_escape_string')) - { - $str = mysql_escape_string($str); - } - else - { - $str = addslashes($str); - } - - // escape LIKE condition wildcards - if ($like === TRUE) - { - $str = str_replace(array('%', '_'), array('\\%', '\\_'), $str); - } - - return $str; - } - - // -------------------------------------------------------------------- - - /** - * Affected Rows - * - * @access public - * @return integer - */ - function affected_rows() - { - return @mysqli_affected_rows($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * Insert ID - * - * @access public - * @return integer - */ - function insert_id() - { - return @mysqli_insert_id($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @access public - * @param string - * @return string - */ - function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); - - if ($query->num_rows() == 0) - { - return 0; - } - - $row = $query->row(); - return (int) $row->numrows; - } - - // -------------------------------------------------------------------- - - /** - * List table query - * - * Generates a platform-specific query string so that the table names can be fetched - * - * @access private - * @param boolean - * @return string - */ - function _list_tables($prefix_limit = FALSE) - { - $sql = "SHOW TABLES FROM ".$this->_escape_char.$this->database.$this->_escape_char; - - if ($prefix_limit !== FALSE AND $this->dbprefix != '') - { - $sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%'"; - } - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Show column query - * - * Generates a platform-specific query string so that the column names can be fetched - * - * @access public - * @param string the table name - * @return string - */ - function _list_columns($table = '') - { - return "SHOW COLUMNS FROM ".$table; - } - - // -------------------------------------------------------------------- - - /** - * Field data query - * - * Generates a platform-specific query so that the column data can be retrieved - * - * @access public - * @param string the table name - * @return object - */ - function _field_data($table) - { - return "SELECT * FROM ".$table." LIMIT 1"; - } - - // -------------------------------------------------------------------- - - /** - * The error message string - * - * @access private - * @return string - */ - function _error_message() - { - return mysqli_error($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * The error message number - * - * @access private - * @return integer - */ - function _error_number() - { - return mysqli_errno($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * Escape the SQL Identifiers - * - * This function escapes column and table names - * - * @access private - * @param string - * @return string - */ - function _escape_identifiers($item) - { - if ($this->_escape_char == '') - { - return $item; - } - - foreach ($this->_reserved_identifiers as $id) - { - if (strpos($item, '.'.$id) !== FALSE) - { - $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); - - // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); - } - } - - if (strpos($item, '.') !== FALSE) - { - $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; - } - else - { - $str = $this->_escape_char.$item.$this->_escape_char; - } - - // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); - } - - // -------------------------------------------------------------------- - - /** - * From Tables - * - * This function implicitly groups FROM tables so there is no confusion - * about operator precedence in harmony with SQL standards - * - * @access public - * @param type - * @return type - */ - function _from_tables($tables) - { - if ( ! is_array($tables)) - { - $tables = array($tables); - } - - return '('.implode(', ', $tables).')'; - } - - // -------------------------------------------------------------------- - - /** - * Insert statement - * - * Generates a platform-specific insert string from the supplied data - * - * @access public - * @param string the table name - * @param array the insert keys - * @param array the insert values - * @return string - */ - function _insert($table, $keys, $values) - { - return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; - } - - // -------------------------------------------------------------------- - - /** - * Update statement - * - * Generates a platform-specific update string from the supplied data - * - * @access public - * @param string the table name - * @param array the update data - * @param array the where clause - * @param array the orderby clause - * @param array the limit clause - * @return string - */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) - { - foreach($values as $key => $val) - { - $valstr[] = $key." = ".$val; - } - - $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - - $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; - - $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); - - $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; - - $sql .= $orderby.$limit; - - return $sql; - } - - - // -------------------------------------------------------------------- - - /** - * Truncate statement - * - * Generates a platform-specific truncate string from the supplied data - * If the database does not support the truncate() command - * This function maps to "DELETE FROM table" - * - * @access public - * @param string the table name - * @return string - */ - function _truncate($table) - { - return "TRUNCATE ".$table; - } - - // -------------------------------------------------------------------- - - /** - * Delete statement - * - * Generates a platform-specific delete string from the supplied data - * - * @access public - * @param string the table name - * @param array the where clause - * @param string the limit clause - * @return string - */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) - { - $conditions = ''; - - if (count($where) > 0 OR count($like) > 0) - { - $conditions = "\nWHERE "; - $conditions .= implode("\n", $this->ar_where); - - if (count($where) > 0 && count($like) > 0) - { - $conditions .= " AND "; - } - $conditions .= implode("\n", $like); - } - - $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - - return "DELETE FROM ".$table.$conditions.$limit; - } - - // -------------------------------------------------------------------- - - /** - * Limit string - * - * Generates a platform-specific LIMIT clause - * - * @access public - * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value - * @return string - */ - function _limit($sql, $limit, $offset) - { - $sql .= "LIMIT ".$limit; - - if ($offset > 0) - { - $sql .= " OFFSET ".$offset; - } - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Close DB Connection - * - * @access public - * @param resource - * @return void - */ - function _close($conn_id) - { - @mysqli_close($conn_id); - } - - -} - - -/* End of file mysqli_driver.php */ -/* Location: ./system/database/drivers/mysqli/mysqli_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php deleted file mode 100644 index 262d491ed..000000000 --- a/system/database/drivers/mysqli/mysqli_forge.php +++ /dev/null @@ -1,254 +0,0 @@ -$attributes) - { - // Numeric field names aren't allowed in databases, so if the key is - // numeric, we know it was assigned by PHP and the developer manually - // entered the field information, so we'll simply add it to the list - if (is_numeric($field)) - { - $sql .= "\n\t$attributes"; - } - else - { - $attributes = array_change_key_case($attributes, CASE_UPPER); - - $sql .= "\n\t".$this->db->_protect_identifiers($field); - - if (array_key_exists('NAME', $attributes)) - { - $sql .= ' '.$this->db->_protect_identifiers($attributes['NAME']).' '; - } - - if (array_key_exists('TYPE', $attributes)) - { - $sql .= ' '.$attributes['TYPE']; - } - - if (array_key_exists('CONSTRAINT', $attributes)) - { - $sql .= '('.$attributes['CONSTRAINT'].')'; - } - - if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE) - { - $sql .= ' UNSIGNED'; - } - - if (array_key_exists('DEFAULT', $attributes)) - { - $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\''; - } - - if (array_key_exists('NULL', $attributes)) - { - $sql .= ($attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL'; - } - - if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE) - { - $sql .= ' AUTO_INCREMENT'; - } - } - - // don't add a comma on the end of the last field - if (++$current_field_count < count($fields)) - { - $sql .= ','; - } - } - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Create Table - * - * @access private - * @param string the table name - * @param mixed the fields - * @param mixed primary key(s) - * @param mixed key(s) - * @param boolean should 'IF NOT EXISTS' be added to the SQL - * @return bool - */ - function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) - { - $sql = 'CREATE TABLE '; - - if ($if_not_exists === TRUE) - { - $sql .= 'IF NOT EXISTS '; - } - - $sql .= $this->db->_escape_identifiers($table)." ("; - - $sql .= $this->_process_fields($fields); - - if (count($primary_keys) > 0) - { - $key_name = $this->db->_protect_identifiers(implode('_', $primary_keys)); - $primary_keys = $this->db->_protect_identifiers($primary_keys); - $sql .= ",\n\tPRIMARY KEY ".$key_name." (" . implode(', ', $primary_keys) . ")"; - } - - if (is_array($keys) && count($keys) > 0) - { - foreach ($keys as $key) - { - if (is_array($key)) - { - $key_name = $this->db->_protect_identifiers(implode('_', $key)); - $key = $this->db->_protect_identifiers($key); - } - else - { - $key_name = $this->db->_protect_identifiers($key); - $key = array($key_name); - } - - $sql .= ",\n\tKEY {$key_name} (" . implode(', ', $key) . ")"; - } - } - - $sql .= "\n) DEFAULT CHARACTER SET {$this->db->char_set} COLLATE {$this->db->dbcollat};"; - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Drop Table - * - * @access private - * @return string - */ - function _drop_table($table) - { - return "DROP TABLE IF EXISTS ".$this->db->_escape_identifiers($table); - } - - // -------------------------------------------------------------------- - - /** - * Alter table query - * - * Generates a platform-specific query so that a table can be altered - * Called by add_column(), drop_column(), and column_alter(), - * - * @access private - * @param string the ALTER type (ADD, DROP, CHANGE) - * @param string the column name - * @param array fields - * @param string the field after which we should add the new field - * @return object - */ - function _alter_table($alter_type, $table, $fields, $after_field = '') - { - $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table)." $alter_type "; - - // DROP has everything it needs now. - if ($alter_type == 'DROP') - { - return $sql.$this->db->_protect_identifiers($fields); - } - - $sql .= $this->_process_fields($fields); - - if ($after_field != '') - { - $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); - } - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Rename a table - * - * Generates a platform-specific query so that a table can be renamed - * - * @access private - * @param string the old table name - * @param string the new table name - * @return string - */ - function _rename_table($table_name, $new_table_name) - { - $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table_name)." RENAME TO ".$this->db->_protect_identifiers($new_table_name); - return $sql; - } - -} - -/* End of file mysqli_forge.php */ -/* Location: ./system/database/drivers/mysqli/mysqli_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php deleted file mode 100644 index 81d22cc9c..000000000 --- a/system/database/drivers/mysqli/mysqli_result.php +++ /dev/null @@ -1,169 +0,0 @@ -result_id); - } - - // -------------------------------------------------------------------- - - /** - * Number of fields in the result set - * - * @access public - * @return integer - */ - function num_fields() - { - return @mysqli_num_fields($this->result_id); - } - - // -------------------------------------------------------------------- - - /** - * Fetch Field Names - * - * Generates an array of column names - * - * @access public - * @return array - */ - function list_fields() - { - $field_names = array(); - while ($field = mysqli_fetch_field($this->result_id)) - { - $field_names[] = $field->name; - } - - return $field_names; - } - - // -------------------------------------------------------------------- - - /** - * Field data - * - * Generates an array of objects containing field meta-data - * - * @access public - * @return array - */ - function field_data() - { - $retval = array(); - while ($field = mysqli_fetch_field($this->result_id)) - { - $F = new stdClass(); - $F->name = $field->name; - $F->type = $field->type; - $F->default = $field->def; - $F->max_length = $field->max_length; - $F->primary_key = ($field->flags & MYSQLI_PRI_KEY_FLAG) ? 1 : 0; - - $retval[] = $F; - } - - return $retval; - } - - // -------------------------------------------------------------------- - - /** - * Free the result - * - * @return null - */ - function free_result() - { - if (is_object($this->result_id)) - { - mysqli_free_result($this->result_id); - $this->result_id = FALSE; - } - } - - // -------------------------------------------------------------------- - - /** - * Data Seek - * - * Moves the internal pointer to the desired offset. We call - * this internally before fetching results to make sure the - * result set starts at zero - * - * @access private - * @return array - */ - function _data_seek($n = 0) - { - return mysqli_data_seek($this->result_id, $n); - } - - // -------------------------------------------------------------------- - - /** - * Result - associative array - * - * Returns the result set as an array - * - * @access private - * @return array - */ - function _fetch_assoc() - { - return mysqli_fetch_assoc($this->result_id); - } - - // -------------------------------------------------------------------- - - /** - * Result - object - * - * Returns the result set as an object - * - * @access private - * @return object - */ - function _fetch_object() - { - return mysqli_fetch_object($this->result_id); - } - -} - - -/* End of file mysqli_result.php */ -/* Location: ./system/database/drivers/mysqli/mysqli_result.php */ \ No newline at end of file diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php deleted file mode 100644 index 44fd0f7aa..000000000 --- a/system/database/drivers/mysqli/mysqli_utility.php +++ /dev/null @@ -1,123 +0,0 @@ -db->_escape_identifiers($table); - } - - // -------------------------------------------------------------------- - - /** - * Repair table query - * - * Generates a platform-specific query so that a table can be repaired - * - * @access private - * @param string the table name - * @return object - */ - function _repair_table($table) - { - return "REPAIR TABLE ".$this->db->_escape_identifiers($table); - } - - // -------------------------------------------------------------------- - - /** - * MySQLi Export - * - * @access private - * @param array Preferences - * @return mixed - */ - function _backup($params = array()) - { - // Currently unsupported - return $this->db->display_error('db_unsuported_feature'); - } - - - /** - * - * The functions below have been deprecated as of 1.6, and are only here for backwards - * compatibility. They now reside in dbforge(). The use of dbutils for database manipulation - * is STRONGLY discouraged in favour if using dbforge. - * - */ - - /** - * Create database - * - * @access private - * @param string the database name - * @return bool - */ - function _create_database($name) - { - return "CREATE DATABASE ".$name; - } - - // -------------------------------------------------------------------- - - /** - * Drop database - * - * @access private - * @param string the database name - * @return bool - */ - function _drop_database($name) - { - return "DROP DATABASE ".$name; - } - -} - -/* End of file mysqli_utility.php */ -/* Location: ./system/database/drivers/mysqli/mysqli_utility.php */ \ No newline at end of file diff --git a/system/database/drivers/oci8/index.html b/system/database/drivers/oci8/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/database/drivers/oci8/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

                              Directory access is forbidden.

                              - - - \ No newline at end of file diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php deleted file mode 100644 index 758192358..000000000 --- a/system/database/drivers/oci8/oci8_driver.php +++ /dev/null @@ -1,780 +0,0 @@ -username, $this->password, $this->hostname); - } - - // -------------------------------------------------------------------- - - /** - * Persistent database connection - * - * @access private called by the base class - * @return resource - */ - function db_pconnect() - { - return @ociplogon($this->username, $this->password, $this->hostname); - } - - // -------------------------------------------------------------------- - - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @access public - * @return void - */ - function reconnect() - { - // not implemented in oracle - } - - // -------------------------------------------------------------------- - - /** - * Select the database - * - * @access private called by the base class - * @return resource - */ - function db_select() - { - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Set client character set - * - * @access public - * @param string - * @param string - * @return resource - */ - function db_set_charset($charset, $collation) - { - // @todo - add support if needed - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Version number query string - * - * @access public - * @return string - */ - function _version() - { - return ociserverversion($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * Execute the query - * - * @access private called by the base class - * @param string an SQL query - * @return resource - */ - function _execute($sql) - { - // oracle must parse the query before it is run. All of the actions with - // the query are based on the statement id returned by ociparse - $this->stmt_id = FALSE; - $this->_set_stmt_id($sql); - ocisetprefetch($this->stmt_id, 1000); - return @ociexecute($this->stmt_id, $this->_commit); - } - - /** - * Generate a statement ID - * - * @access private - * @param string an SQL query - * @return none - */ - function _set_stmt_id($sql) - { - if ( ! is_resource($this->stmt_id)) - { - $this->stmt_id = ociparse($this->conn_id, $this->_prep_query($sql)); - } - } - - // -------------------------------------------------------------------- - - /** - * Prep the query - * - * If needed, each database adapter can prep the query string - * - * @access private called by execute() - * @param string an SQL query - * @return string - */ - function _prep_query($sql) - { - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * getCursor. Returns a cursor from the datbase - * - * @access public - * @return cursor id - */ - function get_cursor() - { - $this->curs_id = ocinewcursor($this->conn_id); - return $this->curs_id; - } - - // -------------------------------------------------------------------- - - /** - * Stored Procedure. Executes a stored procedure - * - * @access public - * @param package package stored procedure is in - * @param procedure stored procedure to execute - * @param params array of parameters - * @return array - * - * params array keys - * - * KEY OPTIONAL NOTES - * name no the name of the parameter should be in : format - * value no the value of the parameter. If this is an OUT or IN OUT parameter, - * this should be a reference to a variable - * type yes the type of the parameter - * length yes the max size of the parameter - */ - function stored_procedure($package, $procedure, $params) - { - if ($package == '' OR $procedure == '' OR ! is_array($params)) - { - if ($this->db_debug) - { - log_message('error', 'Invalid query: '.$package.'.'.$procedure); - return $this->display_error('db_invalid_query'); - } - return FALSE; - } - - // build the query string - $sql = "begin $package.$procedure("; - - $have_cursor = FALSE; - foreach($params as $param) - { - $sql .= $param['name'] . ","; - - if (array_key_exists('type', $param) && ($param['type'] == OCI_B_CURSOR)) - { - $have_cursor = TRUE; - } - } - $sql = trim($sql, ",") . "); end;"; - - $this->stmt_id = FALSE; - $this->_set_stmt_id($sql); - $this->_bind_params($params); - $this->query($sql, FALSE, $have_cursor); - } - - // -------------------------------------------------------------------- - - /** - * Bind parameters - * - * @access private - * @return none - */ - function _bind_params($params) - { - if ( ! is_array($params) OR ! is_resource($this->stmt_id)) - { - return; - } - - foreach ($params as $param) - { - foreach (array('name', 'value', 'type', 'length') as $val) - { - if ( ! isset($param[$val])) - { - $param[$val] = ''; - } - } - - ocibindbyname($this->stmt_id, $param['name'], $param['value'], $param['length'], $param['type']); - } - } - - // -------------------------------------------------------------------- - - /** - * Begin Transaction - * - * @access public - * @return bool - */ - function trans_begin($test_mode = FALSE) - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - // Reset the transaction failure flag. - // If the $test_mode flag is set to TRUE transactions will be rolled back - // even if the queries produce a successful result. - $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; - - $this->_commit = OCI_DEFAULT; - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Commit Transaction - * - * @access public - * @return bool - */ - function trans_commit() - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - $ret = OCIcommit($this->conn_id); - $this->_commit = OCI_COMMIT_ON_SUCCESS; - return $ret; - } - - // -------------------------------------------------------------------- - - /** - * Rollback Transaction - * - * @access public - * @return bool - */ - function trans_rollback() - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - $ret = OCIrollback($this->conn_id); - $this->_commit = OCI_COMMIT_ON_SUCCESS; - return $ret; - } - - // -------------------------------------------------------------------- - - /** - * Escape String - * - * @access public - * @param string - * @param bool whether or not the string will be used in a LIKE condition - * @return string - */ - function escape_str($str, $like = FALSE) - { - if (is_array($str)) - { - foreach($str as $key => $val) - { - $str[$key] = $this->escape_str($val, $like); - } - - return $str; - } - - // Access the CI object - $CI =& get_instance(); - - $str = $CI->input->_remove_invisible_characters($str); - - // escape LIKE condition wildcards - if ($like === TRUE) - { - $str = str_replace( array('%', '_', $this->_like_escape_chr), - array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), - $str); - } - - return $str; - } - - // -------------------------------------------------------------------- - - /** - * Affected Rows - * - * @access public - * @return integer - */ - function affected_rows() - { - return @ocirowcount($this->stmt_id); - } - - // -------------------------------------------------------------------- - - /** - * Insert ID - * - * @access public - * @return integer - */ - function insert_id() - { - // not supported in oracle - return $this->display_error('db_unsupported_function'); - } - - // -------------------------------------------------------------------- - - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @access public - * @param string - * @return string - */ - function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); - - if ($query == FALSE) - { - return 0; - } - - $row = $query->row(); - return (int) $row->numrows; - } - - // -------------------------------------------------------------------- - - /** - * Show table query - * - * Generates a platform-specific query string so that the table names can be fetched - * - * @access private - * @param boolean - * @return string - */ - function _list_tables($prefix_limit = FALSE) - { - $sql = "SELECT TABLE_NAME FROM ALL_TABLES"; - - if ($prefix_limit !== FALSE AND $this->dbprefix != '') - { - $sql .= " WHERE TABLE_NAME LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_char); - } - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Show column query - * - * Generates a platform-specific query string so that the column names can be fetched - * - * @access public - * @param string the table name - * @return string - */ - function _list_columns($table = '') - { - return "SELECT COLUMN_NAME FROM all_tab_columns WHERE table_name = '$table'"; - } - - // -------------------------------------------------------------------- - - /** - * Field data query - * - * Generates a platform-specific query so that the column data can be retrieved - * - * @access public - * @param string the table name - * @return object - */ - function _field_data($table) - { - return "SELECT * FROM ".$table." where rownum = 1"; - } - - // -------------------------------------------------------------------- - - /** - * The error message string - * - * @access private - * @return string - */ - function _error_message() - { - $error = ocierror($this->conn_id); - return $error['message']; - } - - // -------------------------------------------------------------------- - - /** - * The error message number - * - * @access private - * @return integer - */ - function _error_number() - { - $error = ocierror($this->conn_id); - return $error['code']; - } - - // -------------------------------------------------------------------- - - /** - * Escape the SQL Identifiers - * - * This function escapes column and table names - * - * @access private - * @param string - * @return string - */ - function _escape_identifiers($item) - { - if ($this->_escape_char == '') - { - return $item; - } - - foreach ($this->_reserved_identifiers as $id) - { - if (strpos($item, '.'.$id) !== FALSE) - { - $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); - - // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); - } - } - - if (strpos($item, '.') !== FALSE) - { - $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; - } - else - { - $str = $this->_escape_char.$item.$this->_escape_char; - } - - // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); - } - - // -------------------------------------------------------------------- - - /** - * From Tables - * - * This function implicitly groups FROM tables so there is no confusion - * about operator precedence in harmony with SQL standards - * - * @access public - * @param type - * @return type - */ - function _from_tables($tables) - { - if ( ! is_array($tables)) - { - $tables = array($tables); - } - - return implode(', ', $tables); - } - - // -------------------------------------------------------------------- - - /** - * Insert statement - * - * Generates a platform-specific insert string from the supplied data - * - * @access public - * @param string the table name - * @param array the insert keys - * @param array the insert values - * @return string - */ - function _insert($table, $keys, $values) - { - return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; - } - - // -------------------------------------------------------------------- - - /** - * Update statement - * - * Generates a platform-specific update string from the supplied data - * - * @access public - * @param string the table name - * @param array the update data - * @param array the where clause - * @param array the orderby clause - * @param array the limit clause - * @return string - */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) - { - foreach($values as $key => $val) - { - $valstr[] = $key." = ".$val; - } - - $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - - $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; - - $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); - - $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; - - $sql .= $orderby.$limit; - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Truncate statement - * - * Generates a platform-specific truncate string from the supplied data - * If the database does not support the truncate() command - * This function maps to "DELETE FROM table" - * - * @access public - * @param string the table name - * @return string - */ - function _truncate($table) - { - return "TRUNCATE TABLE ".$table; - } - - // -------------------------------------------------------------------- - - /** - * Delete statement - * - * Generates a platform-specific delete string from the supplied data - * - * @access public - * @param string the table name - * @param array the where clause - * @param string the limit clause - * @return string - */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) - { - $conditions = ''; - - if (count($where) > 0 OR count($like) > 0) - { - $conditions = "\nWHERE "; - $conditions .= implode("\n", $this->ar_where); - - if (count($where) > 0 && count($like) > 0) - { - $conditions .= " AND "; - } - $conditions .= implode("\n", $like); - } - - $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - - return "DELETE FROM ".$table.$conditions.$limit; - } - - // -------------------------------------------------------------------- - - /** - * Limit string - * - * Generates a platform-specific LIMIT clause - * - * @access public - * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value - * @return string - */ - function _limit($sql, $limit, $offset) - { - $limit = $offset + $limit; - $newsql = "SELECT * FROM (select inner_query.*, rownum rnum FROM ($sql) inner_query WHERE rownum < $limit)"; - - if ($offset != 0) - { - $newsql .= " WHERE rnum >= $offset"; - } - - // remember that we used limits - $this->limit_used = TRUE; - - return $newsql; - } - - // -------------------------------------------------------------------- - - /** - * Close DB Connection - * - * @access public - * @param resource - * @return void - */ - function _close($conn_id) - { - @ocilogoff($conn_id); - } - - -} - - - -/* End of file oci8_driver.php */ -/* Location: ./system/database/drivers/oci8/oci8_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php deleted file mode 100644 index d77ed8de6..000000000 --- a/system/database/drivers/oci8/oci8_forge.php +++ /dev/null @@ -1,248 +0,0 @@ -db->_escape_identifiers($table)." ("; - $current_field_count = 0; - - foreach ($fields as $field=>$attributes) - { - // Numeric field names aren't allowed in databases, so if the key is - // numeric, we know it was assigned by PHP and the developer manually - // entered the field information, so we'll simply add it to the list - if (is_numeric($field)) - { - $sql .= "\n\t$attributes"; - } - else - { - $attributes = array_change_key_case($attributes, CASE_UPPER); - - $sql .= "\n\t".$this->db->_protect_identifiers($field); - - $sql .= ' '.$attributes['TYPE']; - - if (array_key_exists('CONSTRAINT', $attributes)) - { - $sql .= '('.$attributes['CONSTRAINT'].')'; - } - - if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE) - { - $sql .= ' UNSIGNED'; - } - - if (array_key_exists('DEFAULT', $attributes)) - { - $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\''; - } - - if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE) - { - $sql .= ' NULL'; - } - else - { - $sql .= ' NOT NULL'; - } - - if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE) - { - $sql .= ' AUTO_INCREMENT'; - } - } - - // don't add a comma on the end of the last field - if (++$current_field_count < count($fields)) - { - $sql .= ','; - } - } - - if (count($primary_keys) > 0) - { - $primary_keys = $this->db->_protect_identifiers($primary_keys); - $sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")"; - } - - if (is_array($keys) && count($keys) > 0) - { - foreach ($keys as $key) - { - if (is_array($key)) - { - $key = $this->db->_protect_identifiers($key); - } - else - { - $key = array($this->db->_protect_identifiers($key)); - } - - $sql .= ",\n\tUNIQUE COLUMNS (" . implode(', ', $key) . ")"; - } - } - - $sql .= "\n)"; - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Drop Table - * - * @access private - * @return bool - */ - function _drop_table($table) - { - return FALSE; - } - - // -------------------------------------------------------------------- - - /** - * Alter table query - * - * Generates a platform-specific query so that a table can be altered - * Called by add_column(), drop_column(), and column_alter(), - * - * @access private - * @param string the ALTER type (ADD, DROP, CHANGE) - * @param string the column name - * @param string the table name - * @param string the column definition - * @param string the default value - * @param boolean should 'NOT NULL' be added - * @param string the field after which we should add the new field - * @return object - */ - function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') - { - $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table)." $alter_type ".$this->db->_protect_identifiers($column_name); - - // DROP has everything it needs now. - if ($alter_type == 'DROP') - { - return $sql; - } - - $sql .= " $column_definition"; - - if ($default_value != '') - { - $sql .= " DEFAULT \"$default_value\""; - } - - if ($null === NULL) - { - $sql .= ' NULL'; - } - else - { - $sql .= ' NOT NULL'; - } - - if ($after_field != '') - { - $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); - } - - return $sql; - - } - - // -------------------------------------------------------------------- - - /** - * Rename a table - * - * Generates a platform-specific query so that a table can be renamed - * - * @access private - * @param string the old table name - * @param string the new table name - * @return string - */ - function _rename_table($table_name, $new_table_name) - { - $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table_name)." RENAME TO ".$this->db->_protect_identifiers($new_table_name); - return $sql; - } - - -} - -/* End of file oci8_forge.php */ -/* Location: ./system/database/drivers/oci8/oci8_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php deleted file mode 100644 index cab538e21..000000000 --- a/system/database/drivers/oci8/oci8_result.php +++ /dev/null @@ -1,249 +0,0 @@ -result_array()); - @ociexecute($this->stmt_id); - - if ($this->curs_id) - { - @ociexecute($this->curs_id); - } - - return $rowcount; - } - - // -------------------------------------------------------------------- - - /** - * Number of fields in the result set - * - * @access public - * @return integer - */ - function num_fields() - { - $count = @ocinumcols($this->stmt_id); - - // if we used a limit we subtract it - if ($this->limit_used) - { - $count = $count - 1; - } - - return $count; - } - - // -------------------------------------------------------------------- - - /** - * Fetch Field Names - * - * Generates an array of column names - * - * @access public - * @return array - */ - function list_fields() - { - $field_names = array(); - $fieldCount = $this->num_fields(); - for ($c = 1; $c <= $fieldCount; $c++) - { - $field_names[] = ocicolumnname($this->stmt_id, $c); - } - return $field_names; - } - - // -------------------------------------------------------------------- - - /** - * Field data - * - * Generates an array of objects containing field meta-data - * - * @access public - * @return array - */ - function field_data() - { - $retval = array(); - $fieldCount = $this->num_fields(); - for ($c = 1; $c <= $fieldCount; $c++) - { - $F = new stdClass(); - $F->name = ocicolumnname($this->stmt_id, $c); - $F->type = ocicolumntype($this->stmt_id, $c); - $F->max_length = ocicolumnsize($this->stmt_id, $c); - - $retval[] = $F; - } - - return $retval; - } - - // -------------------------------------------------------------------- - - /** - * Free the result - * - * @return null - */ - function free_result() - { - if (is_resource($this->result_id)) - { - ocifreestatement($this->result_id); - $this->result_id = FALSE; - } - } - - // -------------------------------------------------------------------- - - /** - * Result - associative array - * - * Returns the result set as an array - * - * @access private - * @return array - */ - function _fetch_assoc(&$row) - { - $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id; - - return ocifetchinto($id, $row, OCI_ASSOC + OCI_RETURN_NULLS); - } - - // -------------------------------------------------------------------- - - /** - * Result - object - * - * Returns the result set as an object - * - * @access private - * @return object - */ - function _fetch_object() - { - $result = array(); - - // If PHP 5 is being used we can fetch an result object - if (function_exists('oci_fetch_object')) - { - $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id; - - return @oci_fetch_object($id); - } - - // If PHP 4 is being used we have to build our own result - foreach ($this->result_array() as $key => $val) - { - $obj = new stdClass(); - if (is_array($val)) - { - foreach ($val as $k => $v) - { - $obj->$k = $v; - } - } - else - { - $obj->$key = $val; - } - - $result[] = $obj; - } - - return $result; - } - - // -------------------------------------------------------------------- - - /** - * Query result. "array" version. - * - * @access public - * @return array - */ - function result_array() - { - if (count($this->result_array) > 0) - { - return $this->result_array; - } - - // oracle's fetch functions do not return arrays. - // The information is returned in reference parameters - $row = NULL; - while ($this->_fetch_assoc($row)) - { - $this->result_array[] = $row; - } - - return $this->result_array; - } - - // -------------------------------------------------------------------- - - /** - * Data Seek - * - * Moves the internal pointer to the desired offset. We call - * this internally before fetching results to make sure the - * result set starts at zero - * - * @access private - * @return array - */ - function _data_seek($n = 0) - { - return FALSE; // Not needed - } - -} - - -/* End of file oci8_result.php */ -/* Location: ./system/database/drivers/oci8/oci8_result.php */ \ No newline at end of file diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php deleted file mode 100644 index 74670eaab..000000000 --- a/system/database/drivers/oci8/oci8_utility.php +++ /dev/null @@ -1,122 +0,0 @@ -db->display_error('db_unsuported_feature'); - } - - /** - * - * The functions below have been deprecated as of 1.6, and are only here for backwards - * compatibility. They now reside in dbforge(). The use of dbutils for database manipulation - * is STRONGLY discouraged in favour if using dbforge. - * - */ - - /** - * Create database - * - * @access public - * @param string the database name - * @return bool - */ - function _create_database($name) - { - return FALSE; - } - - // -------------------------------------------------------------------- - - /** - * Drop database - * - * @access private - * @param string the database name - * @return bool - */ - function _drop_database($name) - { - return FALSE; - } - -} - -/* End of file oci8_utility.php */ -/* Location: ./system/database/drivers/oci8/oci8_utility.php */ \ No newline at end of file diff --git a/system/database/drivers/odbc/index.html b/system/database/drivers/odbc/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/database/drivers/odbc/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

                              Directory access is forbidden.

                              - - - \ No newline at end of file diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php deleted file mode 100644 index 6cb3080d4..000000000 --- a/system/database/drivers/odbc/odbc_driver.php +++ /dev/null @@ -1,639 +0,0 @@ -_random_keyword = ' RND('.time().')'; // database specific random keyword - } - - /** - * Non-persistent database connection - * - * @access private called by the base class - * @return resource - */ - function db_connect() - { - return @odbc_connect($this->hostname, $this->username, $this->password); - } - - // -------------------------------------------------------------------- - - /** - * Persistent database connection - * - * @access private called by the base class - * @return resource - */ - function db_pconnect() - { - return @odbc_pconnect($this->hostname, $this->username, $this->password); - } - - // -------------------------------------------------------------------- - - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @access public - * @return void - */ - function reconnect() - { - // not implemented in odbc - } - - // -------------------------------------------------------------------- - - /** - * Select the database - * - * @access private called by the base class - * @return resource - */ - function db_select() - { - // Not needed for ODBC - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Set client character set - * - * @access public - * @param string - * @param string - * @return resource - */ - function db_set_charset($charset, $collation) - { - // @todo - add support if needed - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Version number query string - * - * @access public - * @return string - */ - function _version() - { - return "SELECT version() AS ver"; - } - - // -------------------------------------------------------------------- - - /** - * Execute the query - * - * @access private called by the base class - * @param string an SQL query - * @return resource - */ - function _execute($sql) - { - $sql = $this->_prep_query($sql); - return @odbc_exec($this->conn_id, $sql); - } - - // -------------------------------------------------------------------- - - /** - * Prep the query - * - * If needed, each database adapter can prep the query string - * - * @access private called by execute() - * @param string an SQL query - * @return string - */ - function _prep_query($sql) - { - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Begin Transaction - * - * @access public - * @return bool - */ - function trans_begin($test_mode = FALSE) - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - // Reset the transaction failure flag. - // If the $test_mode flag is set to TRUE transactions will be rolled back - // even if the queries produce a successful result. - $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; - - return odbc_autocommit($this->conn_id, FALSE); - } - - // -------------------------------------------------------------------- - - /** - * Commit Transaction - * - * @access public - * @return bool - */ - function trans_commit() - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - $ret = odbc_commit($this->conn_id); - odbc_autocommit($this->conn_id, TRUE); - return $ret; - } - - // -------------------------------------------------------------------- - - /** - * Rollback Transaction - * - * @access public - * @return bool - */ - function trans_rollback() - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - $ret = odbc_rollback($this->conn_id); - odbc_autocommit($this->conn_id, TRUE); - return $ret; - } - - // -------------------------------------------------------------------- - - /** - * Escape String - * - * @access public - * @param string - * @param bool whether or not the string will be used in a LIKE condition - * @return string - */ - function escape_str($str, $like = FALSE) - { - if (is_array($str)) - { - foreach($str as $key => $val) - { - $str[$key] = $this->escape_str($val, $like); - } - - return $str; - } - - // Access the CI object - $CI =& get_instance(); - - // ODBC doesn't require escaping - $str = $CI->input->_remove_invisible_characters($str); - - // escape LIKE condition wildcards - if ($like === TRUE) - { - $str = str_replace( array('%', '_', $this->_like_escape_chr), - array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), - $str); - } - - return $str; - } - - // -------------------------------------------------------------------- - - /** - * Affected Rows - * - * @access public - * @return integer - */ - function affected_rows() - { - return @odbc_num_rows($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * Insert ID - * - * @access public - * @return integer - */ - function insert_id() - { - return @odbc_insert_id($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @access public - * @param string - * @return string - */ - function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); - - if ($query->num_rows() == 0) - { - return 0; - } - - $row = $query->row(); - return (int) $row->numrows; - } - - // -------------------------------------------------------------------- - - /** - * Show table query - * - * Generates a platform-specific query string so that the table names can be fetched - * - * @access private - * @param boolean - * @return string - */ - function _list_tables($prefix_limit = FALSE) - { - $sql = "SHOW TABLES FROM `".$this->database."`"; - - if ($prefix_limit !== FALSE AND $this->dbprefix != '') - { - //$sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_char); - return FALSE; // not currently supported - } - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Show column query - * - * Generates a platform-specific query string so that the column names can be fetched - * - * @access public - * @param string the table name - * @return string - */ - function _list_columns($table = '') - { - return "SHOW COLUMNS FROM ".$table; - } - - // -------------------------------------------------------------------- - - /** - * Field data query - * - * Generates a platform-specific query so that the column data can be retrieved - * - * @access public - * @param string the table name - * @return object - */ - function _field_data($table) - { - return "SELECT TOP 1 FROM ".$table; - } - - // -------------------------------------------------------------------- - - /** - * The error message string - * - * @access private - * @return string - */ - function _error_message() - { - return odbc_errormsg($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * The error message number - * - * @access private - * @return integer - */ - function _error_number() - { - return odbc_error($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * Escape the SQL Identifiers - * - * This function escapes column and table names - * - * @access private - * @param string - * @return string - */ - function _escape_identifiers($item) - { - if ($this->_escape_char == '') - { - return $item; - } - - foreach ($this->_reserved_identifiers as $id) - { - if (strpos($item, '.'.$id) !== FALSE) - { - $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); - - // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); - } - } - - if (strpos($item, '.') !== FALSE) - { - $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; - } - else - { - $str = $this->_escape_char.$item.$this->_escape_char; - } - - // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); - } - - // -------------------------------------------------------------------- - - /** - * From Tables - * - * This function implicitly groups FROM tables so there is no confusion - * about operator precedence in harmony with SQL standards - * - * @access public - * @param type - * @return type - */ - function _from_tables($tables) - { - if ( ! is_array($tables)) - { - $tables = array($tables); - } - - return '('.implode(', ', $tables).')'; - } - - // -------------------------------------------------------------------- - - /** - * Insert statement - * - * Generates a platform-specific insert string from the supplied data - * - * @access public - * @param string the table name - * @param array the insert keys - * @param array the insert values - * @return string - */ - function _insert($table, $keys, $values) - { - return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; - } - - // -------------------------------------------------------------------- - - /** - * Update statement - * - * Generates a platform-specific update string from the supplied data - * - * @access public - * @param string the table name - * @param array the update data - * @param array the where clause - * @param array the orderby clause - * @param array the limit clause - * @return string - */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) - { - foreach($values as $key => $val) - { - $valstr[] = $key." = ".$val; - } - - $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - - $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; - - $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); - - $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; - - $sql .= $orderby.$limit; - - return $sql; - } - - - // -------------------------------------------------------------------- - - /** - * Truncate statement - * - * Generates a platform-specific truncate string from the supplied data - * If the database does not support the truncate() command - * This function maps to "DELETE FROM table" - * - * @access public - * @param string the table name - * @return string - */ - function _truncate($table) - { - return $this->_delete($table); - } - - // -------------------------------------------------------------------- - - /** - * Delete statement - * - * Generates a platform-specific delete string from the supplied data - * - * @access public - * @param string the table name - * @param array the where clause - * @param string the limit clause - * @return string - */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) - { - $conditions = ''; - - if (count($where) > 0 OR count($like) > 0) - { - $conditions = "\nWHERE "; - $conditions .= implode("\n", $this->ar_where); - - if (count($where) > 0 && count($like) > 0) - { - $conditions .= " AND "; - } - $conditions .= implode("\n", $like); - } - - $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - - return "DELETE FROM ".$table.$conditions.$limit; - } - - // -------------------------------------------------------------------- - - /** - * Limit string - * - * Generates a platform-specific LIMIT clause - * - * @access public - * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value - * @return string - */ - function _limit($sql, $limit, $offset) - { - // Does ODBC doesn't use the LIMIT clause? - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Close DB Connection - * - * @access public - * @param resource - * @return void - */ - function _close($conn_id) - { - @odbc_close($conn_id); - } - - -} - - - -/* End of file odbc_driver.php */ -/* Location: ./system/database/drivers/odbc/odbc_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php deleted file mode 100644 index 1ae559b6e..000000000 --- a/system/database/drivers/odbc/odbc_forge.php +++ /dev/null @@ -1,266 +0,0 @@ -db->db_debug) - { - return $this->db->display_error('db_unsuported_feature'); - } - return FALSE; - } - - // -------------------------------------------------------------------- - - /** - * Drop database - * - * @access private - * @param string the database name - * @return bool - */ - function _drop_database($name) - { - // ODBC has no "drop database" command since it's - // designed to connect to an existing database - if ($this->db->db_debug) - { - return $this->db->display_error('db_unsuported_feature'); - } - return FALSE; - } - - // -------------------------------------------------------------------- - - /** - * Create Table - * - * @access private - * @param string the table name - * @param array the fields - * @param mixed primary key(s) - * @param mixed key(s) - * @param boolean should 'IF NOT EXISTS' be added to the SQL - * @return bool - */ - function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) - { - $sql = 'CREATE TABLE '; - - if ($if_not_exists === TRUE) - { - $sql .= 'IF NOT EXISTS '; - } - - $sql .= $this->db->_escape_identifiers($table)." ("; - $current_field_count = 0; - - foreach ($fields as $field=>$attributes) - { - // Numeric field names aren't allowed in databases, so if the key is - // numeric, we know it was assigned by PHP and the developer manually - // entered the field information, so we'll simply add it to the list - if (is_numeric($field)) - { - $sql .= "\n\t$attributes"; - } - else - { - $attributes = array_change_key_case($attributes, CASE_UPPER); - - $sql .= "\n\t".$this->db->_protect_identifiers($field); - - $sql .= ' '.$attributes['TYPE']; - - if (array_key_exists('CONSTRAINT', $attributes)) - { - $sql .= '('.$attributes['CONSTRAINT'].')'; - } - - if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE) - { - $sql .= ' UNSIGNED'; - } - - if (array_key_exists('DEFAULT', $attributes)) - { - $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\''; - } - - if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE) - { - $sql .= ' NULL'; - } - else - { - $sql .= ' NOT NULL'; - } - - if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE) - { - $sql .= ' AUTO_INCREMENT'; - } - } - - // don't add a comma on the end of the last field - if (++$current_field_count < count($fields)) - { - $sql .= ','; - } - } - - if (count($primary_keys) > 0) - { - $primary_keys = $this->db->_protect_identifiers($primary_keys); - $sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")"; - } - - if (is_array($keys) && count($keys) > 0) - { - foreach ($keys as $key) - { - if (is_array($key)) - { - $key = $this->db->_protect_identifiers($key); - } - else - { - $key = array($this->db->_protect_identifiers($key)); - } - - $sql .= ",\n\tFOREIGN KEY (" . implode(', ', $key) . ")"; - } - } - - $sql .= "\n)"; - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Drop Table - * - * @access private - * @return bool - */ - function _drop_table($table) - { - // Not a supported ODBC feature - if ($this->db->db_debug) - { - return $this->db->display_error('db_unsuported_feature'); - } - return FALSE; - } - - // -------------------------------------------------------------------- - - /** - * Alter table query - * - * Generates a platform-specific query so that a table can be altered - * Called by add_column(), drop_column(), and column_alter(), - * - * @access private - * @param string the ALTER type (ADD, DROP, CHANGE) - * @param string the column name - * @param string the table name - * @param string the column definition - * @param string the default value - * @param boolean should 'NOT NULL' be added - * @param string the field after which we should add the new field - * @return object - */ - function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') - { - $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table)." $alter_type ".$this->db->_protect_identifiers($column_name); - - // DROP has everything it needs now. - if ($alter_type == 'DROP') - { - return $sql; - } - - $sql .= " $column_definition"; - - if ($default_value != '') - { - $sql .= " DEFAULT \"$default_value\""; - } - - if ($null === NULL) - { - $sql .= ' NULL'; - } - else - { - $sql .= ' NOT NULL'; - } - - if ($after_field != '') - { - $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); - } - - return $sql; - - } - - - // -------------------------------------------------------------------- - - /** - * Rename a table - * - * Generates a platform-specific query so that a table can be renamed - * - * @access private - * @param string the old table name - * @param string the new table name - * @return string - */ - function _rename_table($table_name, $new_table_name) - { - $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table_name)." RENAME TO ".$this->db->_protect_identifiers($new_table_name); - return $sql; - } - - -} - -/* End of file odbc_forge.php */ -/* Location: ./system/database/drivers/odbc/odbc_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php deleted file mode 100644 index 5ae46df62..000000000 --- a/system/database/drivers/odbc/odbc_result.php +++ /dev/null @@ -1,228 +0,0 @@ -result_id); - } - - // -------------------------------------------------------------------- - - /** - * Number of fields in the result set - * - * @access public - * @return integer - */ - function num_fields() - { - return @odbc_num_fields($this->result_id); - } - - // -------------------------------------------------------------------- - - /** - * Fetch Field Names - * - * Generates an array of column names - * - * @access public - * @return array - */ - function list_fields() - { - $field_names = array(); - for ($i = 0; $i < $this->num_fields(); $i++) - { - $field_names[] = odbc_field_name($this->result_id, $i); - } - - return $field_names; - } - - // -------------------------------------------------------------------- - - /** - * Field data - * - * Generates an array of objects containing field meta-data - * - * @access public - * @return array - */ - function field_data() - { - $retval = array(); - for ($i = 0; $i < $this->num_fields(); $i++) - { - $F = new stdClass(); - $F->name = odbc_field_name($this->result_id, $i); - $F->type = odbc_field_type($this->result_id, $i); - $F->max_length = odbc_field_len($this->result_id, $i); - $F->primary_key = 0; - $F->default = ''; - - $retval[] = $F; - } - - return $retval; - } - - // -------------------------------------------------------------------- - - /** - * Free the result - * - * @return null - */ - function free_result() - { - if (is_resource($this->result_id)) - { - odbc_free_result($this->result_id); - $this->result_id = FALSE; - } - } - - // -------------------------------------------------------------------- - - /** - * Data Seek - * - * Moves the internal pointer to the desired offset. We call - * this internally before fetching results to make sure the - * result set starts at zero - * - * @access private - * @return array - */ - function _data_seek($n = 0) - { - return FALSE; - } - - // -------------------------------------------------------------------- - - /** - * Result - associative array - * - * Returns the result set as an array - * - * @access private - * @return array - */ - function _fetch_assoc() - { - if (function_exists('odbc_fetch_object')) - { - return odbc_fetch_array($this->result_id); - } - else - { - return $this->_odbc_fetch_array($this->result_id); - } - } - - // -------------------------------------------------------------------- - - /** - * Result - object - * - * Returns the result set as an object - * - * @access private - * @return object - */ - function _fetch_object() - { - if (function_exists('odbc_fetch_object')) - { - return odbc_fetch_object($this->result_id); - } - else - { - return $this->_odbc_fetch_object($this->result_id); - } - } - - - /** - * Result - object - * - * subsititutes the odbc_fetch_object function when - * not available (odbc_fetch_object requires unixODBC) - * - * @access private - * @return object - */ - function _odbc_fetch_object(& $odbc_result) { - $rs = array(); - $rs_obj = false; - if (odbc_fetch_into($odbc_result, $rs)) { - foreach ($rs as $k=>$v) { - $field_name= odbc_field_name($odbc_result, $k+1); - $rs_obj->$field_name = $v; - } - } - return $rs_obj; - } - - - /** - * Result - array - * - * subsititutes the odbc_fetch_array function when - * not available (odbc_fetch_array requires unixODBC) - * - * @access private - * @return array - */ - function _odbc_fetch_array(& $odbc_result) { - $rs = array(); - $rs_assoc = false; - if (odbc_fetch_into($odbc_result, $rs)) { - $rs_assoc=array(); - foreach ($rs as $k=>$v) { - $field_name= odbc_field_name($odbc_result, $k+1); - $rs_assoc[$field_name] = $v; - } - } - return $rs_assoc; - } - -} - - -/* End of file odbc_result.php */ -/* Location: ./system/database/drivers/odbc/odbc_result.php */ \ No newline at end of file diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php deleted file mode 100644 index 4e6848e82..000000000 --- a/system/database/drivers/odbc/odbc_utility.php +++ /dev/null @@ -1,148 +0,0 @@ -db->db_debug) - { - return $this->db->display_error('db_unsuported_feature'); - } - return FALSE; - } - - // -------------------------------------------------------------------- - - /** - * Optimize table query - * - * Generates a platform-specific query so that a table can be optimized - * - * @access private - * @param string the table name - * @return object - */ - function _optimize_table($table) - { - // Not a supported ODBC feature - if ($this->db->db_debug) - { - return $this->db->display_error('db_unsuported_feature'); - } - return FALSE; - } - - // -------------------------------------------------------------------- - - /** - * Repair table query - * - * Generates a platform-specific query so that a table can be repaired - * - * @access private - * @param string the table name - * @return object - */ - function _repair_table($table) - { - // Not a supported ODBC feature - if ($this->db->db_debug) - { - return $this->db->display_error('db_unsuported_feature'); - } - return FALSE; - } - - // -------------------------------------------------------------------- - - /** - * ODBC Export - * - * @access private - * @param array Preferences - * @return mixed - */ - function _backup($params = array()) - { - // Currently unsupported - return $this->db->display_error('db_unsuported_feature'); - } - - /** - * - * The functions below have been deprecated as of 1.6, and are only here for backwards - * compatibility. They now reside in dbforge(). The use of dbutils for database manipulation - * is STRONGLY discouraged in favour if using dbforge. - * - */ - - /** - * Create database - * - * @access private - * @param string the database name - * @return bool - */ - function _create_database() - { - // ODBC has no "create database" command since it's - // designed to connect to an existing database - if ($this->db->db_debug) - { - return $this->db->display_error('db_unsuported_feature'); - } - return FALSE; - } - - // -------------------------------------------------------------------- - - /** - * Drop database - * - * @access private - * @param string the database name - * @return bool - */ - function _drop_database($name) - { - // ODBC has no "drop database" command since it's - // designed to connect to an existing database - if ($this->db->db_debug) - { - return $this->db->display_error('db_unsuported_feature'); - } - return FALSE; - } -} - -/* End of file odbc_utility.php */ -/* Location: ./system/database/drivers/odbc/odbc_utility.php */ \ No newline at end of file diff --git a/system/database/drivers/postgre/index.html b/system/database/drivers/postgre/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/database/drivers/postgre/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

                              Directory access is forbidden.

                              - - - \ No newline at end of file diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php deleted file mode 100644 index bac179d40..000000000 --- a/system/database/drivers/postgre/postgre_driver.php +++ /dev/null @@ -1,684 +0,0 @@ - 'host', - 'port' => 'port', - 'database' => 'dbname', - 'username' => 'user', - 'password' => 'password' - ); - - $connect_string = ""; - foreach ($components as $key => $val) - { - if (isset($this->$key) && $this->$key != '') - { - $connect_string .= " $val=".$this->$key; - } - } - return trim($connect_string); - } - - // -------------------------------------------------------------------- - - /** - * Non-persistent database connection - * - * @access private called by the base class - * @return resource - */ - function db_connect() - { - return @pg_connect($this->_connect_string()); - } - - // -------------------------------------------------------------------- - - /** - * Persistent database connection - * - * @access private called by the base class - * @return resource - */ - function db_pconnect() - { - return @pg_pconnect($this->_connect_string()); - } - - // -------------------------------------------------------------------- - - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @access public - * @return void - */ - function reconnect() - { - if (pg_ping($this->conn_id) === FALSE) - { - $this->conn_id = FALSE; - } - } - - // -------------------------------------------------------------------- - - /** - * Select the database - * - * @access private called by the base class - * @return resource - */ - function db_select() - { - // Not needed for Postgre so we'll return TRUE - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Set client character set - * - * @access public - * @param string - * @param string - * @return resource - */ - function db_set_charset($charset, $collation) - { - // @todo - add support if needed - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Version number query string - * - * @access public - * @return string - */ - function _version() - { - return "SELECT version() AS ver"; - } - - // -------------------------------------------------------------------- - - /** - * Execute the query - * - * @access private called by the base class - * @param string an SQL query - * @return resource - */ - function _execute($sql) - { - $sql = $this->_prep_query($sql); - return @pg_query($this->conn_id, $sql); - } - - // -------------------------------------------------------------------- - - /** - * Prep the query - * - * If needed, each database adapter can prep the query string - * - * @access private called by execute() - * @param string an SQL query - * @return string - */ - function _prep_query($sql) - { - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Begin Transaction - * - * @access public - * @return bool - */ - function trans_begin($test_mode = FALSE) - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - // Reset the transaction failure flag. - // If the $test_mode flag is set to TRUE transactions will be rolled back - // even if the queries produce a successful result. - $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; - - return @pg_exec($this->conn_id, "begin"); - } - - // -------------------------------------------------------------------- - - /** - * Commit Transaction - * - * @access public - * @return bool - */ - function trans_commit() - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - return @pg_exec($this->conn_id, "commit"); - } - - // -------------------------------------------------------------------- - - /** - * Rollback Transaction - * - * @access public - * @return bool - */ - function trans_rollback() - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - return @pg_exec($this->conn_id, "rollback"); - } - - // -------------------------------------------------------------------- - - /** - * Escape String - * - * @access public - * @param string - * @param bool whether or not the string will be used in a LIKE condition - * @return string - */ - function escape_str($str, $like = FALSE) - { - if (is_array($str)) - { - foreach($str as $key => $val) - { - $str[$key] = $this->escape_str($val, $like); - } - - return $str; - } - - $str = pg_escape_string($str); - - // escape LIKE condition wildcards - if ($like === TRUE) - { - $str = str_replace( array('%', '_', $this->_like_escape_chr), - array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), - $str); - } - - return $str; - } - - // -------------------------------------------------------------------- - - /** - * Affected Rows - * - * @access public - * @return integer - */ - function affected_rows() - { - return @pg_affected_rows($this->result_id); - } - - // -------------------------------------------------------------------- - - /** - * Insert ID - * - * @access public - * @return integer - */ - function insert_id() - { - $v = $this->_version(); - $v = $v['server']; - - $table = func_num_args() > 0 ? func_get_arg(0) : null; - $column = func_num_args() > 1 ? func_get_arg(1) : null; - - if ($table == null && $v >= '8.1') - { - $sql='SELECT LASTVAL() as ins_id'; - } - elseif ($table != null && $column != null && $v >= '8.0') - { - $sql = sprintf("SELECT pg_get_serial_sequence('%s','%s') as seq", $table, $column); - $query = $this->query($sql); - $row = $query->row(); - $sql = sprintf("SELECT CURRVAL('%s') as ins_id", $row->seq); - } - elseif ($table != null) - { - // seq_name passed in table parameter - $sql = sprintf("SELECT CURRVAL('%s') as ins_id", $table); - } - else - { - return pg_last_oid($this->result_id); - } - $query = $this->query($sql); - $row = $query->row(); - return $row->ins_id; - } - - // -------------------------------------------------------------------- - - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @access public - * @param string - * @return string - */ - function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); - - if ($query->num_rows() == 0) - { - return 0; - } - - $row = $query->row(); - return (int) $row->numrows; - } - - // -------------------------------------------------------------------- - - /** - * Show table query - * - * Generates a platform-specific query string so that the table names can be fetched - * - * @access private - * @param boolean - * @return string - */ - function _list_tables($prefix_limit = FALSE) - { - $sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'"; - - if ($prefix_limit !== FALSE AND $this->dbprefix != '') - { - $sql .= " AND table_name LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_char); - } - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Show column query - * - * Generates a platform-specific query string so that the column names can be fetched - * - * @access public - * @param string the table name - * @return string - */ - function _list_columns($table = '') - { - return "SELECT column_name FROM information_schema.columns WHERE table_name ='".$table."'"; - } - - // -------------------------------------------------------------------- - - /** - * Field data query - * - * Generates a platform-specific query so that the column data can be retrieved - * - * @access public - * @param string the table name - * @return object - */ - function _field_data($table) - { - return "SELECT * FROM ".$table." LIMIT 1"; - } - - // -------------------------------------------------------------------- - - /** - * The error message string - * - * @access private - * @return string - */ - function _error_message() - { - return pg_last_error($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * The error message number - * - * @access private - * @return integer - */ - function _error_number() - { - return ''; - } - - // -------------------------------------------------------------------- - - /** - * Escape the SQL Identifiers - * - * This function escapes column and table names - * - * @access private - * @param string - * @return string - */ - function _escape_identifiers($item) - { - if ($this->_escape_char == '') - { - return $item; - } - - foreach ($this->_reserved_identifiers as $id) - { - if (strpos($item, '.'.$id) !== FALSE) - { - $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); - - // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); - } - } - - if (strpos($item, '.') !== FALSE) - { - $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; - } - else - { - $str = $this->_escape_char.$item.$this->_escape_char; - } - - // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); - } - - // -------------------------------------------------------------------- - - /** - * From Tables - * - * This function implicitly groups FROM tables so there is no confusion - * about operator precedence in harmony with SQL standards - * - * @access public - * @param type - * @return type - */ - function _from_tables($tables) - { - if ( ! is_array($tables)) - { - $tables = array($tables); - } - - return implode(', ', $tables); - } - - // -------------------------------------------------------------------- - - /** - * Insert statement - * - * Generates a platform-specific insert string from the supplied data - * - * @access public - * @param string the table name - * @param array the insert keys - * @param array the insert values - * @return string - */ - function _insert($table, $keys, $values) - { - return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; - } - - // -------------------------------------------------------------------- - - /** - * Update statement - * - * Generates a platform-specific update string from the supplied data - * - * @access public - * @param string the table name - * @param array the update data - * @param array the where clause - * @param array the orderby clause - * @param array the limit clause - * @return string - */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) - { - foreach($values as $key => $val) - { - $valstr[] = $key." = ".$val; - } - - $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - - $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; - - $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); - - $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; - - $sql .= $orderby.$limit; - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Truncate statement - * - * Generates a platform-specific truncate string from the supplied data - * If the database does not support the truncate() command - * This function maps to "DELETE FROM table" - * - * @access public - * @param string the table name - * @return string - */ - function _truncate($table) - { - return "TRUNCATE ".$table; - } - - // -------------------------------------------------------------------- - - /** - * Delete statement - * - * Generates a platform-specific delete string from the supplied data - * - * @access public - * @param string the table name - * @param array the where clause - * @param string the limit clause - * @return string - */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) - { - $conditions = ''; - - if (count($where) > 0 OR count($like) > 0) - { - $conditions = "\nWHERE "; - $conditions .= implode("\n", $this->ar_where); - - if (count($where) > 0 && count($like) > 0) - { - $conditions .= " AND "; - } - $conditions .= implode("\n", $like); - } - - $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - - return "DELETE FROM ".$table.$conditions.$limit; - } - - // -------------------------------------------------------------------- - /** - * Limit string - * - * Generates a platform-specific LIMIT clause - * - * @access public - * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value - * @return string - */ - function _limit($sql, $limit, $offset) - { - $sql .= "LIMIT ".$limit; - - if ($offset > 0) - { - $sql .= " OFFSET ".$offset; - } - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Close DB Connection - * - * @access public - * @param resource - * @return void - */ - function _close($conn_id) - { - @pg_close($conn_id); - } - - -} - - -/* End of file postgre_driver.php */ -/* Location: ./system/database/drivers/postgre/postgre_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php deleted file mode 100644 index c98ef425d..000000000 --- a/system/database/drivers/postgre/postgre_forge.php +++ /dev/null @@ -1,248 +0,0 @@ -db->_escape_identifiers($table)." ("; - $current_field_count = 0; - - foreach ($fields as $field=>$attributes) - { - // Numeric field names aren't allowed in databases, so if the key is - // numeric, we know it was assigned by PHP and the developer manually - // entered the field information, so we'll simply add it to the list - if (is_numeric($field)) - { - $sql .= "\n\t$attributes"; - } - else - { - $attributes = array_change_key_case($attributes, CASE_UPPER); - - $sql .= "\n\t".$this->db->_protect_identifiers($field); - - $sql .= ' '.$attributes['TYPE']; - - if (array_key_exists('CONSTRAINT', $attributes)) - { - $sql .= '('.$attributes['CONSTRAINT'].')'; - } - - if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE) - { - $sql .= ' UNSIGNED'; - } - - if (array_key_exists('DEFAULT', $attributes)) - { - $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\''; - } - - if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE) - { - $sql .= ' NULL'; - } - else - { - $sql .= ' NOT NULL'; - } - - if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE) - { - $sql .= ' AUTO_INCREMENT'; - } - } - - // don't add a comma on the end of the last field - if (++$current_field_count < count($fields)) - { - $sql .= ','; - } - } - - if (count($primary_keys) > 0) - { - $primary_keys = $this->db->_protect_identifiers($primary_keys); - $sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")"; - } - - if (is_array($keys) && count($keys) > 0) - { - foreach ($keys as $key) - { - if (is_array($key)) - { - $key = $this->db->_protect_identifiers($key); - } - else - { - $key = array($this->db->_protect_identifiers($key)); - } - - $sql .= ",\n\tFOREIGN KEY (" . implode(', ', $key) . ")"; - } - } - - $sql .= "\n);"; - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Drop Table - * - * @access private - * @return bool - */ - function _drop_table($table) - { - return "DROP TABLE ".$this->db->_escape_identifiers($table)." CASCADE"; - } - - // -------------------------------------------------------------------- - - /** - * Alter table query - * - * Generates a platform-specific query so that a table can be altered - * Called by add_column(), drop_column(), and column_alter(), - * - * @access private - * @param string the ALTER type (ADD, DROP, CHANGE) - * @param string the column name - * @param string the table name - * @param string the column definition - * @param string the default value - * @param boolean should 'NOT NULL' be added - * @param string the field after which we should add the new field - * @return object - */ - function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') - { - $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table)." $alter_type ".$this->db->_protect_identifiers($column_name); - - // DROP has everything it needs now. - if ($alter_type == 'DROP') - { - return $sql; - } - - $sql .= " $column_definition"; - - if ($default_value != '') - { - $sql .= " DEFAULT \"$default_value\""; - } - - if ($null === NULL) - { - $sql .= ' NULL'; - } - else - { - $sql .= ' NOT NULL'; - } - - if ($after_field != '') - { - $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); - } - - return $sql; - - } - - // -------------------------------------------------------------------- - - /** - * Rename a table - * - * Generates a platform-specific query so that a table can be renamed - * - * @access private - * @param string the old table name - * @param string the new table name - * @return string - */ - function _rename_table($table_name, $new_table_name) - { - $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table_name)." RENAME TO ".$this->db->_protect_identifiers($new_table_name); - return $sql; - } - - -} - -/* End of file postgre_forge.php */ -/* Location: ./system/database/drivers/postgre/postgre_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php deleted file mode 100644 index 545f413e8..000000000 --- a/system/database/drivers/postgre/postgre_result.php +++ /dev/null @@ -1,169 +0,0 @@ -result_id); - } - - // -------------------------------------------------------------------- - - /** - * Number of fields in the result set - * - * @access public - * @return integer - */ - function num_fields() - { - return @pg_num_fields($this->result_id); - } - - // -------------------------------------------------------------------- - - /** - * Fetch Field Names - * - * Generates an array of column names - * - * @access public - * @return array - */ - function list_fields() - { - $field_names = array(); - for ($i = 0; $i < $this->num_fields(); $i++) - { - $field_names[] = pg_field_name($this->result_id, $i); - } - - return $field_names; - } - - // -------------------------------------------------------------------- - - /** - * Field data - * - * Generates an array of objects containing field meta-data - * - * @access public - * @return array - */ - function field_data() - { - $retval = array(); - for ($i = 0; $i < $this->num_fields(); $i++) - { - $F = new stdClass(); - $F->name = pg_field_name($this->result_id, $i); - $F->type = pg_field_type($this->result_id, $i); - $F->max_length = pg_field_size($this->result_id, $i); - $F->primary_key = 0; - $F->default = ''; - - $retval[] = $F; - } - - return $retval; - } - - // -------------------------------------------------------------------- - - /** - * Free the result - * - * @return null - */ - function free_result() - { - if (is_resource($this->result_id)) - { - pg_free_result($this->result_id); - $this->result_id = FALSE; - } - } - - // -------------------------------------------------------------------- - - /** - * Data Seek - * - * Moves the internal pointer to the desired offset. We call - * this internally before fetching results to make sure the - * result set starts at zero - * - * @access private - * @return array - */ - function _data_seek($n = 0) - { - return pg_result_seek($this->result_id, $n); - } - - // -------------------------------------------------------------------- - - /** - * Result - associative array - * - * Returns the result set as an array - * - * @access private - * @return array - */ - function _fetch_assoc() - { - return pg_fetch_assoc($this->result_id); - } - - // -------------------------------------------------------------------- - - /** - * Result - object - * - * Returns the result set as an object - * - * @access private - * @return object - */ - function _fetch_object() - { - return pg_fetch_object($this->result_id); - } - -} - - -/* End of file postgre_result.php */ -/* Location: ./system/database/drivers/postgre/postgre_result.php */ \ No newline at end of file diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php deleted file mode 100644 index dda22ddb0..000000000 --- a/system/database/drivers/postgre/postgre_utility.php +++ /dev/null @@ -1,124 +0,0 @@ -db->display_error('db_unsuported_feature'); - } - - /** - * - * The functions below have been deprecated as of 1.6, and are only here for backwards - * compatibility. They now reside in dbforge(). The use of dbutils for database manipulation - * is STRONGLY discouraged in favour if using dbforge. - * - */ - - /** - * Create database - * - * @access private - * @param string the database name - * @return bool - */ - function _create_database($name) - { - return "CREATE DATABASE ".$name; - } - - // -------------------------------------------------------------------- - - /** - * Drop database - * - * @access private - * @param string the database name - * @return bool - */ - function _drop_database($name) - { - return "DROP DATABASE ".$name; - } - - -} - - -/* End of file postgre_utility.php */ -/* Location: ./system/database/drivers/postgre/postgre_utility.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlite/index.html b/system/database/drivers/sqlite/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/database/drivers/sqlite/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

                              Directory access is forbidden.

                              - - - \ No newline at end of file diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php deleted file mode 100644 index 05e38848a..000000000 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ /dev/null @@ -1,657 +0,0 @@ -database, FILE_WRITE_MODE, $error)) - { - log_message('error', $error); - - if ($this->db_debug) - { - $this->display_error($error, '', TRUE); - } - - return FALSE; - } - - return $conn_id; - } - - // -------------------------------------------------------------------- - - /** - * Persistent database connection - * - * @access private called by the base class - * @return resource - */ - function db_pconnect() - { - if ( ! $conn_id = @sqlite_popen($this->database, FILE_WRITE_MODE, $error)) - { - log_message('error', $error); - - if ($this->db_debug) - { - $this->display_error($error, '', TRUE); - } - - return FALSE; - } - - return $conn_id; - } - - // -------------------------------------------------------------------- - - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @access public - * @return void - */ - function reconnect() - { - // not implemented in SQLite - } - - // -------------------------------------------------------------------- - - /** - * Select the database - * - * @access private called by the base class - * @return resource - */ - function db_select() - { - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Set client character set - * - * @access public - * @param string - * @param string - * @return resource - */ - function db_set_charset($charset, $collation) - { - // @todo - add support if needed - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Version number query string - * - * @access public - * @return string - */ - function _version() - { - return sqlite_libversion(); - } - - // -------------------------------------------------------------------- - - /** - * Execute the query - * - * @access private called by the base class - * @param string an SQL query - * @return resource - */ - function _execute($sql) - { - $sql = $this->_prep_query($sql); - return @sqlite_query($this->conn_id, $sql); - } - - // -------------------------------------------------------------------- - - /** - * Prep the query - * - * If needed, each database adapter can prep the query string - * - * @access private called by execute() - * @param string an SQL query - * @return string - */ - function _prep_query($sql) - { - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Begin Transaction - * - * @access public - * @return bool - */ - function trans_begin($test_mode = FALSE) - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - // Reset the transaction failure flag. - // If the $test_mode flag is set to TRUE transactions will be rolled back - // even if the queries produce a successful result. - $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; - - $this->simple_query('BEGIN TRANSACTION'); - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Commit Transaction - * - * @access public - * @return bool - */ - function trans_commit() - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - $this->simple_query('COMMIT'); - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Rollback Transaction - * - * @access public - * @return bool - */ - function trans_rollback() - { - if ( ! $this->trans_enabled) - { - return TRUE; - } - - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) - { - return TRUE; - } - - $this->simple_query('ROLLBACK'); - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Escape String - * - * @access public - * @param string - * @param bool whether or not the string will be used in a LIKE condition - * @return string - */ - function escape_str($str, $like = FALSE) - { - if (is_array($str)) - { - foreach($str as $key => $val) - { - $str[$key] = $this->escape_str($val, $like); - } - - return $str; - } - - $str = sqlite_escape_string($str); - - // escape LIKE condition wildcards - if ($like === TRUE) - { - $str = str_replace( array('%', '_', $this->_like_escape_chr), - array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), - $str); - } - - return $str; - } - - // -------------------------------------------------------------------- - - /** - * Affected Rows - * - * @access public - * @return integer - */ - function affected_rows() - { - return sqlite_changes($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * Insert ID - * - * @access public - * @return integer - */ - function insert_id() - { - return @sqlite_last_insert_rowid($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @access public - * @param string - * @return string - */ - function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); - - if ($query->num_rows() == 0) - { - return 0; - } - - $row = $query->row(); - return (int) $row->numrows; - } - - // -------------------------------------------------------------------- - - /** - * List table query - * - * Generates a platform-specific query string so that the table names can be fetched - * - * @access private - * @param boolean - * @return string - */ - function _list_tables($prefix_limit = FALSE) - { - $sql = "SELECT name from sqlite_master WHERE type='table'"; - - if ($prefix_limit !== FALSE AND $this->dbprefix != '') - { - $sql .= " AND 'name' LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_char); - } - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Show column query - * - * Generates a platform-specific query string so that the column names can be fetched - * - * @access public - * @param string the table name - * @return string - */ - function _list_columns($table = '') - { - // Not supported - return FALSE; - } - - // -------------------------------------------------------------------- - - /** - * Field data query - * - * Generates a platform-specific query so that the column data can be retrieved - * - * @access public - * @param string the table name - * @return object - */ - function _field_data($table) - { - return "SELECT * FROM ".$table." LIMIT 1"; - } - - // -------------------------------------------------------------------- - - /** - * The error message string - * - * @access private - * @return string - */ - function _error_message() - { - return sqlite_error_string(sqlite_last_error($this->conn_id)); - } - - // -------------------------------------------------------------------- - - /** - * The error message number - * - * @access private - * @return integer - */ - function _error_number() - { - return sqlite_last_error($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * Escape the SQL Identifiers - * - * This function escapes column and table names - * - * @access private - * @param string - * @return string - */ - function _escape_identifiers($item) - { - if ($this->_escape_char == '') - { - return $item; - } - - foreach ($this->_reserved_identifiers as $id) - { - if (strpos($item, '.'.$id) !== FALSE) - { - $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); - - // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); - } - } - - if (strpos($item, '.') !== FALSE) - { - $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; - } - else - { - $str = $this->_escape_char.$item.$this->_escape_char; - } - - // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); - } - - // -------------------------------------------------------------------- - - /** - * From Tables - * - * This function implicitly groups FROM tables so there is no confusion - * about operator precedence in harmony with SQL standards - * - * @access public - * @param type - * @return type - */ - function _from_tables($tables) - { - if ( ! is_array($tables)) - { - $tables = array($tables); - } - - return '('.implode(', ', $tables).')'; - } - - // -------------------------------------------------------------------- - - /** - * Insert statement - * - * Generates a platform-specific insert string from the supplied data - * - * @access public - * @param string the table name - * @param array the insert keys - * @param array the insert values - * @return string - */ - function _insert($table, $keys, $values) - { - return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; - } - - // -------------------------------------------------------------------- - - /** - * Update statement - * - * Generates a platform-specific update string from the supplied data - * - * @access public - * @param string the table name - * @param array the update data - * @param array the where clause - * @param array the orderby clause - * @param array the limit clause - * @return string - */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) - { - foreach($values as $key => $val) - { - $valstr[] = $key." = ".$val; - } - - $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - - $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; - - $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); - - $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; - - $sql .= $orderby.$limit; - - return $sql; - } - - - // -------------------------------------------------------------------- - - /** - * Truncate statement - * - * Generates a platform-specific truncate string from the supplied data - * If the database does not support the truncate() command - * This function maps to "DELETE FROM table" - * - * @access public - * @param string the table name - * @return string - */ - function _truncate($table) - { - return $this->_delete($table); - } - - // -------------------------------------------------------------------- - - /** - * Delete statement - * - * Generates a platform-specific delete string from the supplied data - * - * @access public - * @param string the table name - * @param array the where clause - * @param string the limit clause - * @return string - */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) - { - $conditions = ''; - - if (count($where) > 0 OR count($like) > 0) - { - $conditions = "\nWHERE "; - $conditions .= implode("\n", $this->ar_where); - - if (count($where) > 0 && count($like) > 0) - { - $conditions .= " AND "; - } - $conditions .= implode("\n", $like); - } - - $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - - return "DELETE FROM ".$table.$conditions.$limit; - } - - // -------------------------------------------------------------------- - - /** - * Limit string - * - * Generates a platform-specific LIMIT clause - * - * @access public - * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value - * @return string - */ - function _limit($sql, $limit, $offset) - { - if ($offset == 0) - { - $offset = ''; - } - else - { - $offset .= ", "; - } - - return $sql."LIMIT ".$offset.$limit; - } - - // -------------------------------------------------------------------- - - /** - * Close DB Connection - * - * @access public - * @param resource - * @return void - */ - function _close($conn_id) - { - @sqlite_close($conn_id); - } - - -} - - -/* End of file sqlite_driver.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php deleted file mode 100644 index b7d25e755..000000000 --- a/system/database/drivers/sqlite/sqlite_forge.php +++ /dev/null @@ -1,265 +0,0 @@ -db->database) OR ! @unlink($this->db->database)) - { - if ($this->db->db_debug) - { - return $this->db->display_error('db_unable_to_drop'); - } - return FALSE; - } - return TRUE; - } - // -------------------------------------------------------------------- - - /** - * Create Table - * - * @access private - * @param string the table name - * @param array the fields - * @param mixed primary key(s) - * @param mixed key(s) - * @param boolean should 'IF NOT EXISTS' be added to the SQL - * @return bool - */ - function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) - { - $sql = 'CREATE TABLE '; - - // IF NOT EXISTS added to SQLite in 3.3.0 - if ($if_not_exists === TRUE && version_compare($this->_version(), '3.3.0', '>=') === TRUE) - { - $sql .= 'IF NOT EXISTS '; - } - - $sql .= $this->db->_escape_identifiers($table)."("; - $current_field_count = 0; - - foreach ($fields as $field=>$attributes) - { - // Numeric field names aren't allowed in databases, so if the key is - // numeric, we know it was assigned by PHP and the developer manually - // entered the field information, so we'll simply add it to the list - if (is_numeric($field)) - { - $sql .= "\n\t$attributes"; - } - else - { - $attributes = array_change_key_case($attributes, CASE_UPPER); - - $sql .= "\n\t".$this->db->_protect_identifiers($field); - - $sql .= ' '.$attributes['TYPE']; - - if (array_key_exists('CONSTRAINT', $attributes)) - { - $sql .= '('.$attributes['CONSTRAINT'].')'; - } - - if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE) - { - $sql .= ' UNSIGNED'; - } - - if (array_key_exists('DEFAULT', $attributes)) - { - $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\''; - } - - if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE) - { - $sql .= ' NULL'; - } - else - { - $sql .= ' NOT NULL'; - } - - if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE) - { - $sql .= ' AUTO_INCREMENT'; - } - } - - // don't add a comma on the end of the last field - if (++$current_field_count < count($fields)) - { - $sql .= ','; - } - } - - if (count($primary_keys) > 0) - { - $primary_keys = $this->db->_protect_identifiers($primary_keys); - $sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")"; - } - - if (is_array($keys) && count($keys) > 0) - { - foreach ($keys as $key) - { - if (is_array($key)) - { - $key = $this->db->_protect_identifiers($key); - } - else - { - $key = array($this->db->_protect_identifiers($key)); - } - - $sql .= ",\n\tUNIQUE (" . implode(', ', $key) . ")"; - } - } - - $sql .= "\n)"; - - return $sql; - } - - // -------------------------------------------------------------------- - - /** - * Drop Table - * - * Unsupported feature in SQLite - * - * @access private - * @return bool - */ - function _drop_table($table) - { - if ($this->db->db_debug) - { - return $this->db->display_error('db_unsuported_feature'); - } - return array(); - } - - // -------------------------------------------------------------------- - - /** - * Alter table query - * - * Generates a platform-specific query so that a table can be altered - * Called by add_column(), drop_column(), and column_alter(), - * - * @access private - * @param string the ALTER type (ADD, DROP, CHANGE) - * @param string the column name - * @param string the table name - * @param string the column definition - * @param string the default value - * @param boolean should 'NOT NULL' be added - * @param string the field after which we should add the new field - * @return object - */ - function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') - { - $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table)." $alter_type ".$this->db->_protect_identifiers($column_name); - - // DROP has everything it needs now. - if ($alter_type == 'DROP') - { - // SQLite does not support dropping columns - // http://www.sqlite.org/omitted.html - // http://www.sqlite.org/faq.html#q11 - return FALSE; - } - - $sql .= " $column_definition"; - - if ($default_value != '') - { - $sql .= " DEFAULT \"$default_value\""; - } - - if ($null === NULL) - { - $sql .= ' NULL'; - } - else - { - $sql .= ' NOT NULL'; - } - - if ($after_field != '') - { - $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); - } - - return $sql; - - } - - // -------------------------------------------------------------------- - - /** - * Rename a table - * - * Generates a platform-specific query so that a table can be renamed - * - * @access private - * @param string the old table name - * @param string the new table name - * @return string - */ - function _rename_table($table_name, $new_table_name) - { - $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table_name)." RENAME TO ".$this->db->_protect_identifiers($new_table_name); - return $sql; - } -} - -/* End of file sqlite_forge.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php deleted file mode 100644 index 7b0631221..000000000 --- a/system/database/drivers/sqlite/sqlite_result.php +++ /dev/null @@ -1,179 +0,0 @@ -result_id); - } - - // -------------------------------------------------------------------- - - /** - * Number of fields in the result set - * - * @access public - * @return integer - */ - function num_fields() - { - return @sqlite_num_fields($this->result_id); - } - - // -------------------------------------------------------------------- - - /** - * Fetch Field Names - * - * Generates an array of column names - * - * @access public - * @return array - */ - function list_fields() - { - $field_names = array(); - for ($i = 0; $i < $this->num_fields(); $i++) - { - $field_names[] = sqlite_field_name($this->result_id, $i); - } - - return $field_names; - } - - // -------------------------------------------------------------------- - - /** - * Field data - * - * Generates an array of objects containing field meta-data - * - * @access public - * @return array - */ - function field_data() - { - $retval = array(); - for ($i = 0; $i < $this->num_fields(); $i++) - { - $F = new stdClass(); - $F->name = sqlite_field_name($this->result_id, $i); - $F->type = 'varchar'; - $F->max_length = 0; - $F->primary_key = 0; - $F->default = ''; - - $retval[] = $F; - } - - return $retval; - } - - // -------------------------------------------------------------------- - - /** - * Free the result - * - * @return null - */ - function free_result() - { - // Not implemented in SQLite - } - - // -------------------------------------------------------------------- - - /** - * Data Seek - * - * Moves the internal pointer to the desired offset. We call - * this internally before fetching results to make sure the - * result set starts at zero - * - * @access private - * @return array - */ - function _data_seek($n = 0) - { - return sqlite_seek($this->result_id, $n); - } - - // -------------------------------------------------------------------- - - /** - * Result - associative array - * - * Returns the result set as an array - * - * @access private - * @return array - */ - function _fetch_assoc() - { - return sqlite_fetch_array($this->result_id); - } - - // -------------------------------------------------------------------- - - /** - * Result - object - * - * Returns the result set as an object - * - * @access private - * @return object - */ - function _fetch_object() - { - if (function_exists('sqlite_fetch_object')) - { - return sqlite_fetch_object($this->result_id); - } - else - { - $arr = sqlite_fetch_array($this->result_id, SQLITE_ASSOC); - if (is_array($arr)) - { - $obj = (object) $arr; - return $obj; - } else { - return NULL; - } - } - } - -} - - -/* End of file sqlite_result.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_result.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php deleted file mode 100644 index 5629dac99..000000000 --- a/system/database/drivers/sqlite/sqlite_utility.php +++ /dev/null @@ -1,141 +0,0 @@ -db_debug) - { - return $this->display_error('db_unsuported_feature'); - } - return array(); - } - - // -------------------------------------------------------------------- - - /** - * Optimize table query - * - * Is optimization even supported in SQLite? - * - * @access private - * @param string the table name - * @return object - */ - function _optimize_table($table) - { - return FALSE; - } - - // -------------------------------------------------------------------- - - /** - * Repair table query - * - * Are table repairs even supported in SQLite? - * - * @access private - * @param string the table name - * @return object - */ - function _repair_table($table) - { - return FALSE; - } - - // -------------------------------------------------------------------- - - /** - * SQLite Export - * - * @access private - * @param array Preferences - * @return mixed - */ - function _backup($params = array()) - { - // Currently unsupported - return $this->db->display_error('db_unsuported_feature'); - } - - /** - * - * The functions below have been deprecated as of 1.6, and are only here for backwards - * compatibility. They now reside in dbforge(). The use of dbutils for database manipulation - * is STRONGLY discouraged in favour if using dbforge. - * - */ - - /** - * Create database - * - * @access public - * @param string the database name - * @return bool - */ - function _create_database() - { - // In SQLite, a database is created when you connect to the database. - // We'll return TRUE so that an error isn't generated - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Drop database - * - * @access private - * @param string the database name - * @return bool - */ - function _drop_database($name) - { - if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database)) - { - if ($this->db->db_debug) - { - return $this->db->display_error('db_unable_to_drop'); - } - return FALSE; - } - return TRUE; - } - -} - -/* End of file sqlite_utility.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_utility.php */ \ No newline at end of file diff --git a/system/database/index.html b/system/database/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/database/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

                              Directory access is forbidden.

                              - - - \ No newline at end of file diff --git a/system/fonts/index.html b/system/fonts/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/fonts/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

                              Directory access is forbidden.

                              - - - \ No newline at end of file diff --git a/system/fonts/texb.ttf b/system/fonts/texb.ttf deleted file mode 100644 index a7aa6469a..000000000 Binary files a/system/fonts/texb.ttf and /dev/null differ diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php deleted file mode 100644 index b7289900f..000000000 --- a/system/helpers/array_helper.php +++ /dev/null @@ -1,78 +0,0 @@ - 0) // 8 = FILE_APPEND flag - { - $mode = FOPEN_WRITE_CREATE; - } - else - { - $mode = FOPEN_WRITE_CREATE_DESTRUCTIVE; - } - - // Check if we're using the include path - if (($flags & 1) > 0) // 1 = FILE_USE_INCLUDE_PATH flag - { - $use_include_path = TRUE; - } - else - { - $use_include_path = FALSE; - } - - $fp = @fopen($filename, $mode, $use_include_path); - - if ($fp === FALSE) - { - $backtrace = debug_backtrace(); - _exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') failed to open stream', $backtrace[0]['file'], $backtrace[0]['line']); - return FALSE; - } - - if (($flags & LOCK_EX) > 0) - { - if ( ! flock($fp, LOCK_EX)) - { - $backtrace = debug_backtrace(); - _exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') unable to acquire an exclusive lock on file', $backtrace[0]['file'], $backtrace[0]['line']); - return FALSE; - } - } - - // write it - if (($written = @fwrite($fp, $data)) === FALSE) - { - $backtrace = debug_backtrace(); - _exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') failed to write to '.htmlentities($filename), $backtrace[0]['file'], $backtrace[0]['line']); - } - - // Close the handle - @fclose($fp); - - // Return length - return $written; - } -} - -// ------------------------------------------------------------------------ - -/** - * fputcsv() - * - * Format line as CSV and write to file pointer - * http://us.php.net/manual/en/function.fputcsv.php - * - * @access public - * @param resource file pointer - * @param array data to be written - * @param string delimiter - * @param string enclosure - * @return int length of written string - */ -if ( ! function_exists('fputcsv')) -{ - function fputcsv($handle, $fields, $delimiter = ',', $enclosure = '"') - { - // Checking for a handle resource - if ( ! is_resource($handle)) - { - $backtrace = debug_backtrace(); - _exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 1 to be stream resource, '.gettype($handle).' given', $backtrace[0]['file'], $backtrace[0]['line']); - return FALSE; - } - - // OK, it is a resource, but is it a stream? - if (get_resource_type($handle) !== 'stream') - { - $backtrace = debug_backtrace(); - _exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 1 to be stream resource, '.get_resource_type($handle).' given', $backtrace[0]['file'], $backtrace[0]['line']); - return FALSE; - } - - // Checking for an array of fields - if ( ! is_array($fields)) - { - $backtrace = debug_backtrace(); - _exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 2 to be array, '.gettype($fields).' given', $backtrace[0]['file'], $backtrace[0]['line']); - return FALSE; - } - - // validate delimiter - if (strlen($delimiter) > 1) - { - $delimiter = substr($delimiter, 0, 1); - $backtrace = debug_backtrace(); - _exception_handler(E_NOTICE, 'fputcsv() delimiter must be one character long, "'.htmlentities($delimiter).'" used', $backtrace[0]['file'], $backtrace[0]['line']); - } - - // validate enclosure - if (strlen($enclosure) > 1) - { - $enclosure = substr($enclosure, 0, 1); - $backtrace = debug_backtrace(); - _exception_handler(E_NOTICE, 'fputcsv() enclosure must be one character long, "'.htmlentities($enclosure).'" used', $backtrace[0]['file'], $backtrace[0]['line']); - - } - - $out = ''; - - foreach ($fields as $cell) - { - $cell = str_replace($enclosure, $enclosure.$enclosure, $cell); - - if (strpos($cell, $delimiter) !== FALSE OR strpos($cell, $enclosure) !== FALSE OR strpos($cell, "\n") !== FALSE) - { - $out .= $enclosure.$cell.$enclosure.$delimiter; - } - else - { - $out .= $cell.$delimiter; - } - } - - $length = @fwrite($handle, substr($out, 0, -1)."\n"); - - return $length; - } -} - -// ------------------------------------------------------------------------ - -/** - * stripos() - * - * Find position of first occurrence of a case-insensitive string - * http://us.php.net/manual/en/function.stripos.php - * - * @access public - * @param string haystack - * @param string needle - * @param int offset - * @return int numeric position of the first occurrence of needle in the haystack - */ -if ( ! function_exists('stripos')) -{ - function stripos($haystack, $needle, $offset = NULL) - { - // Cast non string scalar values - if (is_scalar($haystack)) - { - settype($haystack, 'STRING'); - } - - if ( ! is_string($haystack)) - { - $backtrace = debug_backtrace(); - _exception_handler(E_USER_WARNING, 'stripos() expects parameter 1 to be string, '.gettype($haystack).' given', $backtrace[0]['file'], $backtrace[0]['line']); - return FALSE; - } - - if ( ! is_scalar($needle)) - { - $backtrace = debug_backtrace(); - _exception_handler(E_USER_WARNING, 'stripos() needle is not a string or an integer in '.$backtrace[0]['file'], $backtrace[0]['line']); - return FALSE; - } - - if (is_float($offset)) - { - $offset = (int)$offset; - } - - if ( ! is_int($offset) && ! is_bool($offset) && ! is_null($offset)) - { - $backtrace = debug_backtrace(); - _exception_handler(E_USER_WARNING, 'stripos() expects parameter 3 to be long, '.gettype($offset).' given', $backtrace[0]['file'], $backtrace[0]['line']); - return NULL; - } - - return strpos(strtolower($haystack), strtolower($needle), $offset); - } -} - -// ------------------------------------------------------------------------ - -/** - * str_ireplace() - * - * Find position of first occurrence of a case-insensitive string - * http://us.php.net/manual/en/function.str-ireplace.php - * (parameter 4, $count, is not supported as to do so in PHP 4 would make - * it a required parameter) - * - * @access public - * @param mixed search - * @param mixed replace - * @param mixed subject - * @return int numeric position of the first occurrence of needle in the haystack - */ -if ( ! function_exists('str_ireplace')) -{ - function str_ireplace($search, $replace, $subject) - { - // Nothing to do here - if ($search === NULL OR $subject === NULL) - { - return $subject; - } - - // Crazy arguments - if (is_scalar($search) && is_array($replace)) - { - $backtrace = debug_backtrace(); - - if (is_object($replace)) - { - show_error('Object of class '.get_class($replace).' could not be converted to string in '.$backtrace[0]['file'].' on line '.$backtrace[0]['line']); - } - else - { - _exception_handler(E_USER_NOTICE, 'Array to string conversion in '.$backtrace[0]['file'], $backtrace[0]['line']); - } - } - - // Searching for an array - if (is_array($search)) - { - // Replacing with an array - if (is_array($replace)) - { - $search = array_values($search); - $replace = array_values($replace); - - if (count($search) >= count($replace)) - { - $replace = array_pad($replace, count($search), ''); - } - else - { - $replace = array_slice($replace, 0, count($search)); - } - } - else - { - // Replacing with a string all positions - $replace = array_fill(0, count($search), $replace); - } - } - else - { - //Searching for a string and replacing with a string. - $search = array((string)$search); - $replace = array((string)$replace); - } - - // Prepare the search array - foreach ($search as $search_key => $search_value) - { - $search[$search_key] = '/'.preg_quote($search_value, '/').'/i'; - } - - // Prepare the replace array (escape backreferences) - foreach ($replace as $k => $v) - { - $replace[$k] = str_replace(array(chr(92), '$'), array(chr(92).chr(92), '\$'), $v); - } - - // do the replacement - $result = preg_replace($search, $replace, (array)$subject); - - // Check if subject was initially a string and return it as a string - if ( ! is_array($subject)) - { - return current($result); - } - - // Otherwise, just return the array - return $result; - } -} - -// ------------------------------------------------------------------------ - -/** - * http_build_query() - * - * Generate URL-encoded query string - * http://us.php.net/manual/en/function.http-build-query.php - * - * @access public - * @param array form data - * @param string numeric prefix - * @param string argument separator - * @return string URL-encoded string - */ -if ( ! function_exists('http_build_query')) -{ - function http_build_query($formdata, $numeric_prefix = NULL, $separator = NULL) - { - // Check the data - if ( ! is_array($formdata) && ! is_object($formdata)) - { - $backtrace = debug_backtrace(); - _exception_handler(E_USER_WARNING, 'http_build_query() Parameter 1 expected to be Array or Object. Incorrect value given', $backtrace[0]['file'], $backtrace[0]['line']); - return FALSE; - } - - // Cast it as array - if (is_object($formdata)) - { - $formdata = get_object_vars($formdata); - } - - // If the array is empty, return NULL - if (empty($formdata)) - { - return NULL; - } - - // Argument separator - if ($separator === NULL) - { - $separator = ini_get('arg_separator.output'); - - if (strlen($separator) == 0) - { - $separator = '&'; - } - } - - // Start building the query - $tmp = array(); - - foreach ($formdata as $key => $val) - { - if ($val === NULL) - { - continue; - } - - if (is_integer($key) && $numeric_prefix != NULL) - { - $key = $numeric_prefix.$key; - } - - if (is_resource($val)) - { - return NULL; - } - - // hand it off to a recursive parser - $tmp[] = _http_build_query_helper($key, $val, $separator); - } - - return implode($separator, $tmp); - } - - - // Helper helper. Remind anyone of college? - // Required to handle recursion in nested arrays. - // - // You could shave fractions of fractions of a second by moving where - // the urlencoding takes place, but it's much less intuitive, and if - // your application has 10,000 form fields, well, you have other problems ;) - function _http_build_query_helper($key, $val, $separator = '&') - { - if (is_scalar($val)) - { - return urlencode($key).'='.urlencode($val); - } - else - { - // arrays please - if (is_object($val)) - { - $val = get_object_vars($val); - } - - foreach ($val as $k => $v) - { - $tmp[] = _http_build_query_helper($key.'['.$k.']', $v, $separator); - } - } - - return implode($separator, $tmp); - } -} - - -/* End of file compatibility_helper.php */ -/* Location: ./system/helpers/compatibility_helper.php */ \ No newline at end of file diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php deleted file mode 100644 index 40afadb57..000000000 --- a/system/helpers/cookie_helper.php +++ /dev/null @@ -1,144 +0,0 @@ -config->item('cookie_prefix') != '') - { - $prefix = $CI->config->item('cookie_prefix'); - } - if ($domain == '' AND $CI->config->item('cookie_domain') != '') - { - $domain = $CI->config->item('cookie_domain'); - } - if ($path == '/' AND $CI->config->item('cookie_path') != '/') - { - $path = $CI->config->item('cookie_path'); - } - - if ( ! is_numeric($expire)) - { - $expire = time() - 86500; - } - else - { - if ($expire > 0) - { - $expire = time() + $expire; - } - else - { - $expire = 0; - } - } - - setcookie($prefix.$name, $value, $expire, $path, $domain, 0); - } -} - -// -------------------------------------------------------------------- - -/** - * Fetch an item from the COOKIE array - * - * @access public - * @param string - * @param bool - * @return mixed - */ -if ( ! function_exists('get_cookie')) -{ - function get_cookie($index = '', $xss_clean = FALSE) - { - $CI =& get_instance(); - - $prefix = ''; - - if ( ! isset($_COOKIE[$index]) && config_item('cookie_prefix') != '') - { - $prefix = config_item('cookie_prefix'); - } - - return $CI->input->cookie($prefix.$index, $xss_clean); - } -} - -// -------------------------------------------------------------------- - -/** - * Delete a COOKIE - * - * @param mixed - * @param string the cookie domain. Usually: .yourdomain.com - * @param string the cookie path - * @param string the cookie prefix - * @return void - */ -if ( ! function_exists('delete_cookie')) -{ - function delete_cookie($name = '', $domain = '', $path = '/', $prefix = '') - { - set_cookie($name, '', '', $domain, $path, $prefix); - } -} - - -/* End of file cookie_helper.php */ -/* Location: ./system/helpers/cookie_helper.php */ \ No newline at end of file diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php deleted file mode 100644 index 0e9781666..000000000 --- a/system/helpers/date_helper.php +++ /dev/null @@ -1,611 +0,0 @@ -config->item('time_reference')) == 'gmt') - { - $now = time(); - $system_time = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now)); - - if (strlen($system_time) < 10) - { - $system_time = time(); - log_message('error', 'The Date class could not set a proper GMT timestamp so the local time() value was used.'); - } - - return $system_time; - } - else - { - return time(); - } - } -} - -// ------------------------------------------------------------------------ - -/** - * Convert MySQL Style Datecodes - * - * This function is identical to PHPs date() function, - * except that it allows date codes to be formatted using - * the MySQL style, where each code letter is preceded - * with a percent sign: %Y %m %d etc... - * - * The benefit of doing dates this way is that you don't - * have to worry about escaping your text letters that - * match the date codes. - * - * @access public - * @param string - * @param integer - * @return integer - */ -if ( ! function_exists('mdate')) -{ - function mdate($datestr = '', $time = '') - { - if ($datestr == '') - return ''; - - if ($time == '') - $time = now(); - - $datestr = str_replace('%\\', '', preg_replace("/([a-z]+?){1}/i", "\\\\\\1", $datestr)); - return date($datestr, $time); - } -} - -// ------------------------------------------------------------------------ - -/** - * Standard Date - * - * Returns a date formatted according to the submitted standard. - * - * @access public - * @param string the chosen format - * @param integer Unix timestamp - * @return string - */ -if ( ! function_exists('standard_date')) -{ - function standard_date($fmt = 'DATE_RFC822', $time = '') - { - $formats = array( - 'DATE_ATOM' => '%Y-%m-%dT%H:%i:%s%Q', - 'DATE_COOKIE' => '%l, %d-%M-%y %H:%i:%s UTC', - 'DATE_ISO8601' => '%Y-%m-%dT%H:%i:%s%O', - 'DATE_RFC822' => '%D, %d %M %y %H:%i:%s %O', - 'DATE_RFC850' => '%l, %d-%M-%y %H:%m:%i UTC', - 'DATE_RFC1036' => '%D, %d %M %y %H:%i:%s %O', - 'DATE_RFC1123' => '%D, %d %M %Y %H:%i:%s %O', - 'DATE_RSS' => '%D, %d %M %Y %H:%i:%s %O', - 'DATE_W3C' => '%Y-%m-%dT%H:%i:%s%Q' - ); - - if ( ! isset($formats[$fmt])) - { - return FALSE; - } - - return mdate($formats[$fmt], $time); - } -} - -// ------------------------------------------------------------------------ - -/** - * Timespan - * - * Returns a span of seconds in this format: - * 10 days 14 hours 36 minutes 47 seconds - * - * @access public - * @param integer a number of seconds - * @param integer Unix timestamp - * @return integer - */ -if ( ! function_exists('timespan')) -{ - function timespan($seconds = 1, $time = '') - { - $CI =& get_instance(); - $CI->lang->load('date'); - - if ( ! is_numeric($seconds)) - { - $seconds = 1; - } - - if ( ! is_numeric($time)) - { - $time = time(); - } - - if ($time <= $seconds) - { - $seconds = 1; - } - else - { - $seconds = $time - $seconds; - } - - $str = ''; - $years = floor($seconds / 31536000); - - if ($years > 0) - { - $str .= $years.' '.$CI->lang->line((($years > 1) ? 'date_years' : 'date_year')).', '; - } - - $seconds -= $years * 31536000; - $months = floor($seconds / 2628000); - - if ($years > 0 OR $months > 0) - { - if ($months > 0) - { - $str .= $months.' '.$CI->lang->line((($months > 1) ? 'date_months' : 'date_month')).', '; - } - - $seconds -= $months * 2628000; - } - - $weeks = floor($seconds / 604800); - - if ($years > 0 OR $months > 0 OR $weeks > 0) - { - if ($weeks > 0) - { - $str .= $weeks.' '.$CI->lang->line((($weeks > 1) ? 'date_weeks' : 'date_week')).', '; - } - - $seconds -= $weeks * 604800; - } - - $days = floor($seconds / 86400); - - if ($months > 0 OR $weeks > 0 OR $days > 0) - { - if ($days > 0) - { - $str .= $days.' '.$CI->lang->line((($days > 1) ? 'date_days' : 'date_day')).', '; - } - - $seconds -= $days * 86400; - } - - $hours = floor($seconds / 3600); - - if ($days > 0 OR $hours > 0) - { - if ($hours > 0) - { - $str .= $hours.' '.$CI->lang->line((($hours > 1) ? 'date_hours' : 'date_hour')).', '; - } - - $seconds -= $hours * 3600; - } - - $minutes = floor($seconds / 60); - - if ($days > 0 OR $hours > 0 OR $minutes > 0) - { - if ($minutes > 0) - { - $str .= $minutes.' '.$CI->lang->line((($minutes > 1) ? 'date_minutes' : 'date_minute')).', '; - } - - $seconds -= $minutes * 60; - } - - if ($str == '') - { - $str .= $seconds.' '.$CI->lang->line((($seconds > 1) ? 'date_seconds' : 'date_second')).', '; - } - - return substr(trim($str), 0, -1); - } -} - -// ------------------------------------------------------------------------ - -/** - * Number of days in a month - * - * Takes a month/year as input and returns the number of days - * for the given month/year. Takes leap years into consideration. - * - * @access public - * @param integer a numeric month - * @param integer a numeric year - * @return integer - */ -if ( ! function_exists('days_in_month')) -{ - function days_in_month($month = 0, $year = '') - { - if ($month < 1 OR $month > 12) - { - return 0; - } - - if ( ! is_numeric($year) OR strlen($year) != 4) - { - $year = date('Y'); - } - - if ($month == 2) - { - if ($year % 400 == 0 OR ($year % 4 == 0 AND $year % 100 != 0)) - { - return 29; - } - } - - $days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); - return $days_in_month[$month - 1]; - } -} - -// ------------------------------------------------------------------------ - -/** - * Converts a local Unix timestamp to GMT - * - * @access public - * @param integer Unix timestamp - * @return integer - */ -if ( ! function_exists('local_to_gmt')) -{ - function local_to_gmt($time = '') - { - if ($time == '') - $time = time(); - - return mktime( gmdate("H", $time), gmdate("i", $time), gmdate("s", $time), gmdate("m", $time), gmdate("d", $time), gmdate("Y", $time)); - } -} - -// ------------------------------------------------------------------------ - -/** - * Converts GMT time to a localized value - * - * Takes a Unix timestamp (in GMT) as input, and returns - * at the local value based on the timezone and DST setting - * submitted - * - * @access public - * @param integer Unix timestamp - * @param string timezone - * @param bool whether DST is active - * @return integer - */ -if ( ! function_exists('gmt_to_local')) -{ - function gmt_to_local($time = '', $timezone = 'UTC', $dst = FALSE) - { - if ($time == '') - { - return now(); - } - - $time += timezones($timezone) * 3600; - - if ($dst == TRUE) - { - $time += 3600; - } - - return $time; - } -} - -// ------------------------------------------------------------------------ - -/** - * Converts a MySQL Timestamp to Unix - * - * @access public - * @param integer Unix timestamp - * @return integer - */ -if ( ! function_exists('mysql_to_unix')) -{ - function mysql_to_unix($time = '') - { - // We'll remove certain characters for backward compatibility - // since the formatting changed with MySQL 4.1 - // YYYY-MM-DD HH:MM:SS - - $time = str_replace('-', '', $time); - $time = str_replace(':', '', $time); - $time = str_replace(' ', '', $time); - - // YYYYMMDDHHMMSS - return mktime( - substr($time, 8, 2), - substr($time, 10, 2), - substr($time, 12, 2), - substr($time, 4, 2), - substr($time, 6, 2), - substr($time, 0, 4) - ); - } -} - -// ------------------------------------------------------------------------ - -/** - * Unix to "Human" - * - * Formats Unix timestamp to the following prototype: 2006-08-21 11:35 PM - * - * @access public - * @param integer Unix timestamp - * @param bool whether to show seconds - * @param string format: us or euro - * @return string - */ -if ( ! function_exists('unix_to_human')) -{ - function unix_to_human($time = '', $seconds = FALSE, $fmt = 'us') - { - $r = date('Y', $time).'-'.date('m', $time).'-'.date('d', $time).' '; - - if ($fmt == 'us') - { - $r .= date('h', $time).':'.date('i', $time); - } - else - { - $r .= date('H', $time).':'.date('i', $time); - } - - if ($seconds) - { - $r .= ':'.date('s', $time); - } - - if ($fmt == 'us') - { - $r .= ' '.date('A', $time); - } - - return $r; - } -} - -// ------------------------------------------------------------------------ - -/** - * Convert "human" date to GMT - * - * Reverses the above process - * - * @access public - * @param string format: us or euro - * @return integer - */ -if ( ! function_exists('human_to_unix')) -{ - function human_to_unix($datestr = '') - { - if ($datestr == '') - { - return FALSE; - } - - $datestr = trim($datestr); - $datestr = preg_replace("/\040+/", "\040", $datestr); - - if ( ! preg_match('/^[0-9]{2,4}\-[0-9]{1,2}\-[0-9]{1,2}\s[0-9]{1,2}:[0-9]{1,2}(?::[0-9]{1,2})?(?:\s[AP]M)?$/i', $datestr)) - { - return FALSE; - } - - $split = preg_split("/\040/", $datestr); - - $ex = explode("-", $split['0']); - - $year = (strlen($ex['0']) == 2) ? '20'.$ex['0'] : $ex['0']; - $month = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1']; - $day = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2']; - - $ex = explode(":", $split['1']); - - $hour = (strlen($ex['0']) == 1) ? '0'.$ex['0'] : $ex['0']; - $min = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1']; - - if (isset($ex['2']) && preg_match('/[0-9]{1,2}/', $ex['2'])) - { - $sec = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2']; - } - else - { - // Unless specified, seconds get set to zero. - $sec = '00'; - } - - if (isset($split['2'])) - { - $ampm = strtolower($split['2']); - - if (substr($ampm, 0, 1) == 'p' AND $hour < 12) - $hour = $hour + 12; - - if (substr($ampm, 0, 1) == 'a' AND $hour == 12) - $hour = '00'; - - if (strlen($hour) == 1) - $hour = '0'.$hour; - } - - return mktime($hour, $min, $sec, $month, $day, $year); - } -} - -// ------------------------------------------------------------------------ - -/** - * Timezone Menu - * - * Generates a drop-down menu of timezones. - * - * @access public - * @param string timezone - * @param string classname - * @param string menu name - * @return string - */ -if ( ! function_exists('timezone_menu')) -{ - function timezone_menu($default = 'UTC', $class = "", $name = 'timezones') - { - $CI =& get_instance(); - $CI->lang->load('date'); - - if ($default == 'GMT') - $default = 'UTC'; - - $menu = '"; - - return $menu; - } -} - -// ------------------------------------------------------------------------ - -/** - * Timezones - * - * Returns an array of timezones. This is a helper function - * for various other ones in this library - * - * @access public - * @param string timezone - * @return string - */ -if ( ! function_exists('timezones')) -{ - function timezones($tz = '') - { - // Note: Don't change the order of these even though - // some items appear to be in the wrong order - - $zones = array( - 'UM12' => -12, - 'UM11' => -11, - 'UM10' => -10, - 'UM95' => -9.5, - 'UM9' => -9, - 'UM8' => -8, - 'UM7' => -7, - 'UM6' => -6, - 'UM5' => -5, - 'UM45' => -4.5, - 'UM4' => -4, - 'UM35' => -3.5, - 'UM3' => -3, - 'UM2' => -2, - 'UM1' => -1, - 'UTC' => 0, - 'UP1' => +1, - 'UP2' => +2, - 'UP3' => +3, - 'UP35' => +3.5, - 'UP4' => +4, - 'UP45' => +4.5, - 'UP5' => +5, - 'UP55' => +5.5, - 'UP575' => +5.75, - 'UP6' => +6, - 'UP65' => +6.5, - 'UP7' => +7, - 'UP8' => +8, - 'UP875' => +8.75, - 'UP9' => +9, - 'UP95' => +9.5, - 'UP10' => +10, - 'UP105' => +10.5, - 'UP11' => +11, - 'UP115' => +11.5, - 'UP12' => +12, - 'UP1275' => +12.75, - 'UP13' => +13, - 'UP14' => +14 - ); - - if ($tz == '') - { - return $zones; - } - - if ($tz == 'GMT') - $tz = 'UTC'; - - return ( ! isset($zones[$tz])) ? 0 : $zones[$tz]; - } -} - - -/* End of file date_helper.php */ -/* Location: ./system/helpers/date_helper.php */ \ No newline at end of file diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php deleted file mode 100644 index 791cf0d10..000000000 --- a/system/helpers/directory_helper.php +++ /dev/null @@ -1,84 +0,0 @@ - 0) - { - $data =& fread($fp, filesize($file)); - } - - flock($fp, LOCK_UN); - fclose($fp); - - return $data; - } -} - -// ------------------------------------------------------------------------ - -/** - * Write File - * - * Writes data to the file specified in the path. - * Creates a new file if non-existent. - * - * @access public - * @param string path to file - * @param string file data - * @return bool - */ -if ( ! function_exists('write_file')) -{ - function write_file($path, $data, $mode = FOPEN_WRITE_CREATE_DESTRUCTIVE) - { - if ( ! $fp = @fopen($path, $mode)) - { - return FALSE; - } - - flock($fp, LOCK_EX); - fwrite($fp, $data); - flock($fp, LOCK_UN); - fclose($fp); - - return TRUE; - } -} - -// ------------------------------------------------------------------------ - -/** - * Delete Files - * - * Deletes all files contained in the supplied directory path. - * Files must be writable or owned by the system in order to be deleted. - * If the second parameter is set to TRUE, any directories contained - * within the supplied base directory will be nuked as well. - * - * @access public - * @param string path to file - * @param bool whether to delete any directories found in the path - * @return bool - */ -if ( ! function_exists('delete_files')) -{ - function delete_files($path, $del_dir = FALSE, $level = 0) - { - // Trim the trailing slash - $path = rtrim($path, DIRECTORY_SEPARATOR); - - if ( ! $current_dir = @opendir($path)) - return; - - while(FALSE !== ($filename = @readdir($current_dir))) - { - if ($filename != "." and $filename != "..") - { - if (is_dir($path.DIRECTORY_SEPARATOR.$filename)) - { - // Ignore empty folders - if (substr($filename, 0, 1) != '.') - { - delete_files($path.DIRECTORY_SEPARATOR.$filename, $del_dir, $level + 1); - } - } - else - { - unlink($path.DIRECTORY_SEPARATOR.$filename); - } - } - } - @closedir($current_dir); - - if ($del_dir == TRUE AND $level > 0) - { - @rmdir($path); - } - } -} - -// ------------------------------------------------------------------------ - -/** - * Get Filenames - * - * Reads the specified directory and builds an array containing the filenames. - * Any sub-folders contained within the specified path are read as well. - * - * @access public - * @param string path to source - * @param bool whether to include the path as part of the filename - * @param bool internal variable to determine recursion status - do not use in calls - * @return array - */ -if ( ! function_exists('get_filenames')) -{ - function get_filenames($source_dir, $include_path = FALSE, $_recursion = FALSE) - { - static $_filedata = array(); - - if ($fp = @opendir($source_dir)) - { - // reset the array and make sure $source_dir has a trailing slash on the initial call - if ($_recursion === FALSE) - { - $_filedata = array(); - $source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; - } - - while (FALSE !== ($file = readdir($fp))) - { - if (@is_dir($source_dir.$file) && strncmp($file, '.', 1) !== 0) - { - get_filenames($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE); - } - elseif (strncmp($file, '.', 1) !== 0) - { - $_filedata[] = ($include_path == TRUE) ? $source_dir.$file : $file; - } - } - return $_filedata; - } - else - { - return FALSE; - } - } -} - -// -------------------------------------------------------------------- - -/** - * Get Directory File Information - * - * Reads the specified directory and builds an array containing the filenames, - * filesize, dates, and permissions - * - * Any sub-folders contained within the specified path are read as well. - * - * @access public - * @param string path to source - * @param bool whether to include the path as part of the filename - * @param bool internal variable to determine recursion status - do not use in calls - * @return array - */ -if ( ! function_exists('get_dir_file_info')) -{ - function get_dir_file_info($source_dir, $include_path = FALSE, $_recursion = FALSE) - { - static $_filedata = array(); - $relative_path = $source_dir; - - if ($fp = @opendir($source_dir)) - { - // reset the array and make sure $source_dir has a trailing slash on the initial call - if ($_recursion === FALSE) - { - $_filedata = array(); - $source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; - } - - while (FALSE !== ($file = readdir($fp))) - { - if (@is_dir($source_dir.$file) && strncmp($file, '.', 1) !== 0) - { - get_dir_file_info($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE); - } - elseif (strncmp($file, '.', 1) !== 0) - { - $_filedata[$file] = get_file_info($source_dir.$file); - $_filedata[$file]['relative_path'] = $relative_path; - } - } - return $_filedata; - } - else - { - return FALSE; - } - } -} - -// -------------------------------------------------------------------- - -/** -* Get File Info -* -* Given a file and path, returns the name, path, size, date modified -* Second parameter allows you to explicitly declare what information you want returned -* Options are: name, server_path, size, date, readable, writable, executable, fileperms -* Returns FALSE if the file cannot be found. -* -* @access public -* @param string path to file -* @param mixed array or comma separated string of information returned -* @return array -*/ -if ( ! function_exists('get_file_info')) -{ - function get_file_info($file, $returned_values = array('name', 'server_path', 'size', 'date')) - { - - if ( ! file_exists($file)) - { - return FALSE; - } - - if (is_string($returned_values)) - { - $returned_values = explode(',', $returned_values); - } - - foreach ($returned_values as $key) - { - switch ($key) - { - case 'name': - $fileinfo['name'] = substr(strrchr($file, DIRECTORY_SEPARATOR), 1); - break; - case 'server_path': - $fileinfo['server_path'] = $file; - break; - case 'size': - $fileinfo['size'] = filesize($file); - break; - case 'date': - $fileinfo['date'] = filectime($file); - break; - case 'readable': - $fileinfo['readable'] = is_readable($file); - break; - case 'writable': - // There are known problems using is_weritable on IIS. It may not be reliable - consider fileperms() - $fileinfo['writable'] = is_writable($file); - break; - case 'executable': - $fileinfo['executable'] = is_executable($file); - break; - case 'fileperms': - $fileinfo['fileperms'] = fileperms($file); - break; - } - } - - return $fileinfo; - } -} - -// -------------------------------------------------------------------- - -/** - * Get Mime by Extension - * - * Translates a file extension into a mime type based on config/mimes.php. - * Returns FALSE if it can't determine the type, or open the mime config file - * - * Note: this is NOT an accurate way of determining file mime types, and is here strictly as a convenience - * It should NOT be trusted, and should certainly NOT be used for security - * - * @access public - * @param string path to file - * @return mixed - */ -if ( ! function_exists('get_mime_by_extension')) -{ - function get_mime_by_extension($file) - { - $extension = substr(strrchr($file, '.'), 1); - - global $mimes; - - if ( ! is_array($mimes)) - { - if ( ! require_once(APPPATH.'config/mimes.php')) - { - return FALSE; - } - } - - if (array_key_exists($extension, $mimes)) - { - if (is_array($mimes[$extension])) - { - // Multiple mime types, just give the first one - return current($mimes[$extension]); - } - else - { - return $mimes[$extension]; - } - } - else - { - return FALSE; - } - } -} - -// -------------------------------------------------------------------- - -/** - * Symbolic Permissions - * - * Takes a numeric value representing a file's permissions and returns - * standard symbolic notation representing that value - * - * @access public - * @param int - * @return string - */ -if ( ! function_exists('symbolic_permissions')) -{ - function symbolic_permissions($perms) - { - if (($perms & 0xC000) == 0xC000) - { - $symbolic = 's'; // Socket - } - elseif (($perms & 0xA000) == 0xA000) - { - $symbolic = 'l'; // Symbolic Link - } - elseif (($perms & 0x8000) == 0x8000) - { - $symbolic = '-'; // Regular - } - elseif (($perms & 0x6000) == 0x6000) - { - $symbolic = 'b'; // Block special - } - elseif (($perms & 0x4000) == 0x4000) - { - $symbolic = 'd'; // Directory - } - elseif (($perms & 0x2000) == 0x2000) - { - $symbolic = 'c'; // Character special - } - elseif (($perms & 0x1000) == 0x1000) - { - $symbolic = 'p'; // FIFO pipe - } - else - { - $symbolic = 'u'; // Unknown - } - - // Owner - $symbolic .= (($perms & 0x0100) ? 'r' : '-'); - $symbolic .= (($perms & 0x0080) ? 'w' : '-'); - $symbolic .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-')); - - // Group - $symbolic .= (($perms & 0x0020) ? 'r' : '-'); - $symbolic .= (($perms & 0x0010) ? 'w' : '-'); - $symbolic .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-')); - - // World - $symbolic .= (($perms & 0x0004) ? 'r' : '-'); - $symbolic .= (($perms & 0x0002) ? 'w' : '-'); - $symbolic .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-')); - - return $symbolic; - } -} - -// -------------------------------------------------------------------- - -/** - * Octal Permissions - * - * Takes a numeric value representing a file's permissions and returns - * a three character string representing the file's octal permissions - * - * @access public - * @param int - * @return string - */ -if ( ! function_exists('octal_permissions')) -{ - function octal_permissions($perms) - { - return substr(sprintf('%o', $perms), -3); - } -} - - -/* End of file file_helper.php */ -/* Location: ./system/helpers/file_helper.php */ \ No newline at end of file diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php deleted file mode 100644 index 31b36efd0..000000000 --- a/system/helpers/form_helper.php +++ /dev/null @@ -1,1025 +0,0 @@ -config->site_url($action) : $action; - - $form = '
                              0) - { - $form .= form_hidden($hidden); - } - - return $form; - } -} - -// ------------------------------------------------------------------------ - -/** - * Form Declaration - Multipart type - * - * Creates the opening portion of the form, but with "multipart/form-data". - * - * @access public - * @param string the URI segments of the form destination - * @param array a key/value pair of attributes - * @param array a key/value pair hidden data - * @return string - */ -if ( ! function_exists('form_open_multipart')) -{ - function form_open_multipart($action, $attributes = array(), $hidden = array()) - { - $attributes['enctype'] = 'multipart/form-data'; - return form_open($action, $attributes, $hidden); - } -} - -// ------------------------------------------------------------------------ - -/** - * Hidden Input Field - * - * Generates hidden fields. You can pass a simple key/value string or an associative - * array with multiple values. - * - * @access public - * @param mixed - * @param string - * @return string - */ -if ( ! function_exists('form_hidden')) -{ - function form_hidden($name, $value = '', $recursing = FALSE) - { - static $form; - - if ($recursing === FALSE) - { - $form = "\n"; - } - - if (is_array($name)) - { - foreach ($name as $key => $val) - { - form_hidden($key, $val, TRUE); - } - return $form; - } - - if ( ! is_array($value)) - { - $form .= ''."\n"; - } - else - { - foreach ($value as $k => $v) - { - $k = (is_int($k)) ? '' : $k; - form_hidden($name.'['.$k.']', $v, TRUE); - } - } - - return $form; - } -} - -// ------------------------------------------------------------------------ - -/** - * Text Input Field - * - * @access public - * @param mixed - * @param string - * @param string - * @return string - */ -if ( ! function_exists('form_input')) -{ - function form_input($data = '', $value = '', $extra = '') - { - $defaults = array('type' => 'text', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); - - return ""; - } -} - -// ------------------------------------------------------------------------ - -/** - * Password Field - * - * Identical to the input function but adds the "password" type - * - * @access public - * @param mixed - * @param string - * @param string - * @return string - */ -if ( ! function_exists('form_password')) -{ - function form_password($data = '', $value = '', $extra = '') - { - if ( ! is_array($data)) - { - $data = array('name' => $data); - } - - $data['type'] = 'password'; - return form_input($data, $value, $extra); - } -} - -// ------------------------------------------------------------------------ - -/** - * Upload Field - * - * Identical to the input function but adds the "file" type - * - * @access public - * @param mixed - * @param string - * @param string - * @return string - */ -if ( ! function_exists('form_upload')) -{ - function form_upload($data = '', $value = '', $extra = '') - { - if ( ! is_array($data)) - { - $data = array('name' => $data); - } - - $data['type'] = 'file'; - return form_input($data, $value, $extra); - } -} - -// ------------------------------------------------------------------------ - -/** - * Textarea field - * - * @access public - * @param mixed - * @param string - * @param string - * @return string - */ -if ( ! function_exists('form_textarea')) -{ - function form_textarea($data = '', $value = '', $extra = '') - { - $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'cols' => '90', 'rows' => '12'); - - if ( ! is_array($data) OR ! isset($data['value'])) - { - $val = $value; - } - else - { - $val = $data['value']; - unset($data['value']); // textareas don't use the value attribute - } - - $name = (is_array($data)) ? $data['name'] : $data; - return ""; - } -} - -// ------------------------------------------------------------------------ - -/** - * Multi-select menu - * - * @access public - * @param string - * @param array - * @param mixed - * @param string - * @return type - */ -if (! function_exists('form_multiselect')) -{ - function form_multiselect($name = '', $options = array(), $selected = array(), $extra = '') - { - if ( ! strpos($extra, 'multiple')) - { - $extra .= ' multiple="multiple"'; - } - - return form_dropdown($name, $options, $selected, $extra); - } -} - -// -------------------------------------------------------------------- - -/** - * Drop-down Menu - * - * @access public - * @param string - * @param array - * @param string - * @param string - * @return string - */ -if ( ! function_exists('form_dropdown')) -{ - function form_dropdown($name = '', $options = array(), $selected = array(), $extra = '') - { - if ( ! is_array($selected)) - { - $selected = array($selected); - } - - // If no selected state was submitted we will attempt to set it automatically - if (count($selected) === 0) - { - // If the form name appears in the $_POST array we have a winner! - if (isset($_POST[$name])) - { - $selected = array($_POST[$name]); - } - } - - if ($extra != '') $extra = ' '.$extra; - - $multiple = (count($selected) > 1 && strpos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : ''; - - $form = ''; - - return $form; - } -} - -// ------------------------------------------------------------------------ - -/** - * Checkbox Field - * - * @access public - * @param mixed - * @param string - * @param bool - * @param string - * @return string - */ -if ( ! function_exists('form_checkbox')) -{ - function form_checkbox($data = '', $value = '', $checked = FALSE, $extra = '') - { - $defaults = array('type' => 'checkbox', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); - - if (is_array($data) AND array_key_exists('checked', $data)) - { - $checked = $data['checked']; - - if ($checked == FALSE) - { - unset($data['checked']); - } - else - { - $data['checked'] = 'checked'; - } - } - - if ($checked == TRUE) - { - $defaults['checked'] = 'checked'; - } - else - { - unset($defaults['checked']); - } - - return ""; - } -} - -// ------------------------------------------------------------------------ - -/** - * Radio Button - * - * @access public - * @param mixed - * @param string - * @param bool - * @param string - * @return string - */ -if ( ! function_exists('form_radio')) -{ - function form_radio($data = '', $value = '', $checked = FALSE, $extra = '') - { - if ( ! is_array($data)) - { - $data = array('name' => $data); - } - - $data['type'] = 'radio'; - return form_checkbox($data, $value, $checked, $extra); - } -} - -// ------------------------------------------------------------------------ - -/** - * Submit Button - * - * @access public - * @param mixed - * @param string - * @param string - * @return string - */ -if ( ! function_exists('form_submit')) -{ - function form_submit($data = '', $value = '', $extra = '') - { - $defaults = array('type' => 'submit', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); - - return ""; - } -} - -// ------------------------------------------------------------------------ - -/** - * Reset Button - * - * @access public - * @param mixed - * @param string - * @param string - * @return string - */ -if ( ! function_exists('form_reset')) -{ - function form_reset($data = '', $value = '', $extra = '') - { - $defaults = array('type' => 'reset', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); - - return ""; - } -} - -// ------------------------------------------------------------------------ - -/** - * Form Button - * - * @access public - * @param mixed - * @param string - * @param string - * @return string - */ -if ( ! function_exists('form_button')) -{ - function form_button($data = '', $content = '', $extra = '') - { - $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'type' => 'button'); - - if ( is_array($data) AND isset($data['content'])) - { - $content = $data['content']; - unset($data['content']); // content is not an attribute - } - - return ""; - } -} - -// ------------------------------------------------------------------------ - -/** - * Form Label Tag - * - * @access public - * @param string The text to appear onscreen - * @param string The id the label applies to - * @param string Additional attributes - * @return string - */ -if ( ! function_exists('form_label')) -{ - function form_label($label_text = '', $id = '', $attributes = array()) - { - - $label = ' 0) - { - foreach ($attributes as $key => $val) - { - $label .= ' '.$key.'="'.$val.'"'; - } - } - - $label .= ">$label_text"; - - return $label; - } -} - -// ------------------------------------------------------------------------ -/** - * Fieldset Tag - * - * Used to produce
                              text. To close fieldset - * use form_fieldset_close() - * - * @access public - * @param string The legend text - * @param string Additional attributes - * @return string - */ -if ( ! function_exists('form_fieldset')) -{ - function form_fieldset($legend_text = '', $attributes = array()) - { - $fieldset = "".$extra; - } -} - -// ------------------------------------------------------------------------ - -/** - * Form Close Tag - * - * @access public - * @param string - * @return string - */ -if ( ! function_exists('form_close')) -{ - function form_close($extra = '') - { - return "".$extra; - } -} - -// ------------------------------------------------------------------------ - -/** - * Form Prep - * - * Formats text so that it can be safely placed in a form field in the event it has HTML tags. - * - * @access public - * @param string - * @return string - */ -if ( ! function_exists('form_prep')) -{ - function form_prep($str = '', $field_name = '') - { - static $prepped_fields = array(); - - // if the field name is an array we do this recursively - if (is_array($str)) - { - foreach ($str as $key => $val) - { - $str[$key] = form_prep($val); - } - - return $str; - } - - if ($str === '') - { - return ''; - } - - // we've already prepped a field with this name - // @todo need to figure out a way to namespace this so - // that we know the *exact* field and not just one with - // the same name - if (isset($prepped_fields[$field_name])) - { - return $str; - } - - $str = htmlspecialchars($str); - - // In case htmlspecialchars misses these. - $str = str_replace(array("'", '"'), array("'", """), $str); - - if ($field_name != '') - { - $prepped_fields[$field_name] = $str; - } - - return $str; - } -} - -// ------------------------------------------------------------------------ - -/** - * Form Value - * - * Grabs a value from the POST array for the specified field so you can - * re-populate an input field or textarea. If Form Validation - * is active it retrieves the info from the validation class - * - * @access public - * @param string - * @return mixed - */ -if ( ! function_exists('set_value')) -{ - function set_value($field = '', $default = '') - { - if (FALSE === ($OBJ =& _get_validation_object())) - { - if ( ! isset($_POST[$field])) - { - return $default; - } - - return form_prep($_POST[$field], $field); - } - - return form_prep($OBJ->set_value($field, $default), $field); - } -} - -// ------------------------------------------------------------------------ - -/** - * Set Select - * - * Let's you set the selected value of a '; - - -Then, on the page that accepts the submission you'll have something like this: - - // First, delete old captchas - $expiration = time()-7200; // Two hour limit - $DB->query("DELETE FROM captcha WHERE captcha_time < ".$expiration); - - // Then see if a captcha exists: - $sql = "SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND date > ?"; - $binds = array($_POST['captcha'], $this->input->ip_address(), $expiration); - $query = $this->db->query($sql, $binds); - $row = $query->row(); - - if ($row->count == 0) - { - echo "You must submit the word that appears in the image"; - } - -*/ - - - -/** -|========================================================== -| Create Captcha -|========================================================== -| -*/ -function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = '') -{ - $defaults = array('word' => '', 'img_path' => '', 'img_url' => '', 'img_width' => '150', 'img_height' => '30', 'font_path' => '', 'expiration' => 7200); - - foreach ($defaults as $key => $val) - { - if ( ! is_array($data)) - { - if ( ! isset($$key) OR $$key == '') - { - $$key = $val; - } - } - else - { - $$key = ( ! isset($data[$key])) ? $val : $data[$key]; - } - } - - if ($img_path == '' OR $img_url == '') - { - return FALSE; - } - - if ( ! @is_dir($img_path)) - { - return FALSE; - } - - if ( ! is_really_writable($img_path)) - { - return FALSE; - } - - if ( ! extension_loaded('gd')) - { - return FALSE; - } - - // ----------------------------------- - // Remove old images - // ----------------------------------- - - list($usec, $sec) = explode(" ", microtime()); - $now = ((float)$usec + (float)$sec); - - $current_dir = @opendir($img_path); - - while($filename = @readdir($current_dir)) - { - if ($filename != "." and $filename != ".." and $filename != "index.html") - { - $name = str_replace(".jpg", "", $filename); - - if (($name + $expiration) < $now) - { - @unlink($img_path.$filename); - } - } - } - - @closedir($current_dir); - - // ----------------------------------- - // Do we have a "word" yet? - // ----------------------------------- - - if ($word == '') - { - $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; - - $str = ''; - for ($i = 0; $i < 8; $i++) - { - $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1); - } - - $word = $str; - } - - // ----------------------------------- - // Determine angle and position - // ----------------------------------- - - $length = strlen($word); - $angle = ($length >= 6) ? rand(-($length-6), ($length-6)) : 0; - $x_axis = rand(6, (360/$length)-16); - $y_axis = ($angle >= 0 ) ? rand($img_height, $img_width) : rand(6, $img_height); - - // ----------------------------------- - // Create image - // ----------------------------------- - - // PHP.net recommends imagecreatetruecolor(), but it isn't always available - if (function_exists('imagecreatetruecolor')) - { - $im = imagecreatetruecolor($img_width, $img_height); - } - else - { - $im = imagecreate($img_width, $img_height); - } - - // ----------------------------------- - // Assign colors - // ----------------------------------- - - $bg_color = imagecolorallocate ($im, 255, 255, 255); - $border_color = imagecolorallocate ($im, 153, 102, 102); - $text_color = imagecolorallocate ($im, 204, 153, 153); - $grid_color = imagecolorallocate($im, 255, 182, 182); - $shadow_color = imagecolorallocate($im, 255, 240, 240); - - // ----------------------------------- - // Create the rectangle - // ----------------------------------- - - ImageFilledRectangle($im, 0, 0, $img_width, $img_height, $bg_color); - - // ----------------------------------- - // Create the spiral pattern - // ----------------------------------- - - $theta = 1; - $thetac = 7; - $radius = 16; - $circles = 20; - $points = 32; - - for ($i = 0; $i < ($circles * $points) - 1; $i++) - { - $theta = $theta + $thetac; - $rad = $radius * ($i / $points ); - $x = ($rad * cos($theta)) + $x_axis; - $y = ($rad * sin($theta)) + $y_axis; - $theta = $theta + $thetac; - $rad1 = $radius * (($i + 1) / $points); - $x1 = ($rad1 * cos($theta)) + $x_axis; - $y1 = ($rad1 * sin($theta )) + $y_axis; - imageline($im, $x, $y, $x1, $y1, $grid_color); - $theta = $theta - $thetac; - } - - // ----------------------------------- - // Write the text - // ----------------------------------- - - $use_font = ($font_path != '' AND file_exists($font_path) AND function_exists('imagettftext')) ? TRUE : FALSE; - - if ($use_font == FALSE) - { - $font_size = 5; - $x = rand(0, $img_width/($length/3)); - $y = 0; - } - else - { - $font_size = 16; - $x = rand(0, $img_width/($length/1.5)); - $y = $font_size+2; - } - - for ($i = 0; $i < strlen($word); $i++) - { - if ($use_font == FALSE) - { - $y = rand(0 , $img_height/2); - imagestring($im, $font_size, $x, $y, substr($word, $i, 1), $text_color); - $x += ($font_size*2); - } - else - { - $y = rand($img_height/2, $img_height-3); - imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, substr($word, $i, 1)); - $x += $font_size; - } - } - - - // ----------------------------------- - // Create the border - // ----------------------------------- - - imagerectangle($im, 0, 0, $img_width-1, $img_height-1, $border_color); - - // ----------------------------------- - // Generate the image - // ----------------------------------- - - $img_name = $now.'.jpg'; - - ImageJPEG($im, $img_path.$img_name); - - $img = "\""; - - ImageDestroy($im); - - return array('word' => $word, 'time' => $now, 'image' => $img); -} - - -/* End of file captcha_pi.php */ -/* Location: ./system/plugins/captcha_pi.php */ \ No newline at end of file diff --git a/system/plugins/index.html b/system/plugins/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/plugins/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

                              Directory access is forbidden.

                              - - - \ No newline at end of file diff --git a/system/plugins/js_calendar_pi.php b/system/plugins/js_calendar_pi.php deleted file mode 100644 index 3c304fd17..000000000 --- a/system/plugins/js_calendar_pi.php +++ /dev/null @@ -1,629 +0,0 @@ -load->plugin('js_calendar'); - -Once loaded you'll add the calendar script to the of your page like this: - - - -The above function will be passed the name of your form. - -Then to show the actual calendar you'll do this: - - -
                              - -

                              Today

                              -
                              - - -Note: The first parameter is the name of the field containing your date, the second parameter contains the "now" time, -and the third tells the calendar whether to highlight the current day or not. - -Lastly, you'll need some CSS for your calendar: - -.calendar { - border: 1px #6975A3 solid; - background-color: transparent; -} -.calheading { - background-color: #7C8BC0; - color: #fff; - font-family: Lucida Grande, Verdana, Geneva, Sans-serif; - font-size: 11px; - font-weight: bold; - text-align: center; -} -.calnavleft { - background-color: #7C8BC0; - font-family: Lucida Grande, Verdana, Geneva, Sans-serif; - font-size: 10px; - font-weight: bold; - color: #fff; - padding: 4px; - cursor: pointer; -} -.calnavright { - background-color: #7C8BC0; - font-family: Lucida Grande, Verdana, Geneva, Sans-serif; - font-size: 10px; - font-weight: bold; - color: #fff; - text-align: right; - padding: 4px; - cursor: pointer; -} -.caldayheading { - background-color: #000; - color: #fff; - font-family: Lucida Grande, Verdana, Geneva, Sans-serif; - font-size: 10px; - text-align: center; - padding: 6px 2px 6px 2px; -} -.caldaycells{ - color: #000; - background-color: #D1D7E6; - font-family: Lucida Grande, Verdana, Geneva, Sans-serif; - font-size: 11px; - text-align: center; - padding: 4px; - border: 1px #E0E5F1 solid; - cursor: pointer; -} -.caldaycellhover{ - color: #fff; - background-color: #B3BCD4; - font-family: Lucida Grande, Verdana, Geneva, Sans-serif; - font-size: 11px; - text-align: center; - padding: 4px; - border: 1px #B3BCD4 solid; - cursor: pointer; -} -.caldayselected{ - background-color: #737FAC; - color: #fff; - font-family: Lucida Grande, Verdana, Geneva, Sans-serif; - font-size: 11px; - font-weight: bold; - text-align: center; - border: 1px #566188 solid; - padding: 3px; - cursor: pointer; -} -.calblanktop { - background-color: #fff; - padding: 4px; -} -.calblankbot { - background-color: #fff; - padding: 4px; -} - - -*/ - -function js_calendar_script($form_name = 'entryform') -{ -$CI =& get_instance(); -$CI->load->language('calendar'); -ob_start(); -?> - - - var '.$field_id.' = new calendar("'.$field_id.'", '.$time.', '.(($highlight == TRUE) ? 'true' : 'false').'); - document.write('.$field_id.'.write()); - '; -} - - -/* End of file js_calendar_pi.php */ -/* Location: ./system/plugins/js_calendar_pi.php */ \ No newline at end of file diff --git a/system/scaffolding/Scaffolding.php b/system/scaffolding/Scaffolding.php deleted file mode 100644 index d110626b1..000000000 --- a/system/scaffolding/Scaffolding.php +++ /dev/null @@ -1,291 +0,0 @@ -CI =& get_instance(); - - $this->CI->load->database("", FALSE, TRUE); - $this->CI->load->library('pagination'); - - // Turn off caching - $this->CI->db->cache_off(); - - /** - * Set the current table name - * This is done when initializing scaffolding: - * $this->load->scaffolding('table_name') - * - */ - $this->current_table = $db_table; - - /** - * Set the path to the "view" files - * We'll manually override the "view" path so that - * the load->view function knows where to look. - */ - - $this->CI->load->_ci_view_path = BASEPATH.'scaffolding/views/'; - - // Set the base URL - $this->base_url = $this->CI->config->site_url().'/'.$this->CI->uri->segment(1).$this->CI->uri->slash_segment(2, 'both'); - $this->base_uri = $this->CI->uri->segment(1).$this->CI->uri->slash_segment(2, 'leading'); - - // Set a few globals - $data = array( - 'image_url' => $this->CI->config->system_url().'scaffolding/images/', - 'base_uri' => $this->base_uri, - 'base_url' => $this->base_url, - 'title' => $this->current_table - ); - - $this->CI->load->vars($data); - - // Load the language file and create variables - $this->lang = $this->CI->load->scaffold_language('scaffolding', '', TRUE); - $this->CI->load->vars($this->lang); - - // Load the helper files we plan to use - $this->CI->load->helper(array('url', 'form')); - - - log_message('debug', 'Scaffolding Class Initialized'); - } - - // -------------------------------------------------------------------- - - /** - * "Add" Page - * - * Shows a form representing the currently selected DB - * so that data can be inserted - * - * @access public - * @return string the HTML "add" page - */ - function add() - { - $data = array( - 'title' => ( ! isset($this->lang['scaff_add'])) ? 'Add Data' : $this->lang['scaff_add'], - 'fields' => $this->CI->db->field_data($this->current_table), - 'action' => $this->base_uri.'/insert' - ); - - $this->CI->load->view('add', $data); - } - - // -------------------------------------------------------------------- - - /** - * Insert the data - * - * @access public - * @return void redirects to the view page - */ - function insert() - { - if ($this->CI->db->insert($this->current_table, $_POST) === FALSE) - { - $this->add(); - } - else - { - redirect($this->base_uri.'/view/'); - } - } - - // -------------------------------------------------------------------- - - /** - * "View" Page - * - * Shows a table containing the data in the currently - * selected DB - * - * @access public - * @return string the HTML "view" page - */ - function view() - { - // Fetch the total number of DB rows - $total_rows = $this->CI->db->count_all($this->current_table); - - if ($total_rows < 1) - { - return $this->CI->load->view('no_data'); - } - - // Set the query limit/offset - $per_page = 20; - $offset = $this->CI->uri->segment(4, 0); - - // Run the query - $query = $this->CI->db->get($this->current_table, $per_page, $offset); - - // Now let's get the field names - $fields = $this->CI->db->list_fields($this->current_table); - - // We assume that the column in the first position is the primary field. - $primary = current($fields); - - // Pagination! - $this->CI->pagination->initialize( - array( - 'base_url' => $this->base_url.'/view', - 'total_rows' => $total_rows, - 'per_page' => $per_page, - 'uri_segment' => 4, - 'full_tag_open' => '

                              ', - 'full_tag_close' => '

                              ' - ) - ); - - $data = array( - 'title' => ( ! isset($this->lang['scaff_view'])) ? 'View Data' : $this->lang['scaff_view'], - 'query' => $query, - 'fields' => $fields, - 'primary' => $primary, - 'paginate' => $this->CI->pagination->create_links() - ); - - $this->CI->load->view('view', $data); - } - - // -------------------------------------------------------------------- - - /** - * "Edit" Page - * - * Shows a form representing the currently selected DB - * so that data can be edited - * - * @access public - * @return string the HTML "edit" page - */ - function edit() - { - if (FALSE === ($id = $this->CI->uri->segment(4))) - { - return $this->view(); - } - - // Fetch the primary field name - $primary = $this->CI->db->primary($this->current_table); - - // Run the query - $query = $this->CI->db->get_where($this->current_table, array($primary => $id)); - - $data = array( - 'title' => ( ! isset($this->lang['scaff_edit'])) ? 'Edit Data' : $this->lang['scaff_edit'], - 'fields' => $query->field_data(), - 'query' => $query->row(), - 'action' => $this->base_uri.'/update/'.$this->CI->uri->segment(4) - ); - - $this->CI->load->view('edit', $data); - } - - // -------------------------------------------------------------------- - - /** - * Update - * - * @access public - * @return void redirects to the view page - */ - function update() - { - // Fetch the primary key - $primary = $this->CI->db->primary($this->current_table); - - // Now do the query - $this->CI->db->update($this->current_table, $_POST, array($primary => $this->CI->uri->segment(4))); - - redirect($this->base_uri.'/view/'); - } - - // -------------------------------------------------------------------- - - /** - * Delete Confirmation - * - * @access public - * @return string the HTML "delete confirm" page - */ - function delete() - { - if ( ! isset($this->lang['scaff_del_confirm'])) - { - $message = 'Are you sure you want to delete the following row: '.$this->CI->uri->segment(4); - } - else - { - $message = $this->lang['scaff_del_confirm'].' '.$this->CI->uri->segment(4); - } - - $data = array( - 'title' => ( ! isset($this->lang['scaff_delete'])) ? 'Delete Data' : $this->lang['scaff_delete'], - 'message' => $message, - 'no' => anchor(array($this->base_uri, 'view'), ( ! isset($this->lang['scaff_no'])) ? 'No' : $this->lang['scaff_no']), - 'yes' => anchor(array($this->base_uri, 'do_delete', $this->CI->uri->segment(4)), ( ! isset($this->lang['scaff_yes'])) ? 'Yes' : $this->lang['scaff_yes']) - ); - - $this->CI->load->view('delete', $data); - } - - // -------------------------------------------------------------------- - - /** - * Delete - * - * @access public - * @return void redirects to the view page - */ - function do_delete() - { - // Fetch the primary key - $primary = $this->CI->db->primary($this->current_table); - - // Now do the query - $this->CI->db->where($primary, $this->CI->uri->segment(4)); - $this->CI->db->delete($this->current_table); - - header("Refresh:0;url=".site_url(array($this->base_uri, 'view'))); - exit; - } - -} - -/* End of file Scaffolding.php */ -/* Location: ./system/scaffolding/Scaffolding.php */ \ No newline at end of file diff --git a/system/scaffolding/images/background.jpg b/system/scaffolding/images/background.jpg deleted file mode 100644 index 9d5bdcea1..000000000 Binary files a/system/scaffolding/images/background.jpg and /dev/null differ diff --git a/system/scaffolding/images/index.html b/system/scaffolding/images/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/scaffolding/images/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

                              Directory access is forbidden.

                              - - - \ No newline at end of file diff --git a/system/scaffolding/images/logo.jpg b/system/scaffolding/images/logo.jpg deleted file mode 100644 index d6cc9a76d..000000000 Binary files a/system/scaffolding/images/logo.jpg and /dev/null differ diff --git a/system/scaffolding/index.html b/system/scaffolding/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/scaffolding/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

                              Directory access is forbidden.

                              - - - \ No newline at end of file diff --git a/system/scaffolding/views/add.php b/system/scaffolding/views/add.php deleted file mode 100644 index cbb12f6fb..000000000 --- a/system/scaffolding/views/add.php +++ /dev/null @@ -1,32 +0,0 @@ -load->view('header'); ?> - -

                              - - - - - - - -primary_key == 1) continue; ?> - - - - - type == 'blob'): ?> - - - - - - - -
                              name; echo ' '.$field->default; ?>
                              - - - - - -load->view('footer'); -/* End of file add.php */ -/* Location: ./system/scaffolding/views/add.php */ diff --git a/system/scaffolding/views/delete.php b/system/scaffolding/views/delete.php deleted file mode 100644 index d19542195..000000000 --- a/system/scaffolding/views/delete.php +++ /dev/null @@ -1,9 +0,0 @@ -load->view('header'); ?> - -

                              - -

                                |   - -load->view('footer'); -/* End of file delete.php */ -/* Location: ./system/scaffolding/views/delete.php */ diff --git a/system/scaffolding/views/edit.php b/system/scaffolding/views/edit.php deleted file mode 100644 index fe553e591..000000000 --- a/system/scaffolding/views/edit.php +++ /dev/null @@ -1,33 +0,0 @@ -load->view('header'); ?> - - -

                              - - - - - - - -primary_key == 1) continue; ?> - - - - - type == 'blob'): ?> - - - - - - - -
                              name; ?>
                              - - - - - -load->view('footer'); -/* End of file edit.php */ -/* Location: ./system/scaffolding/views/edit.php */ \ No newline at end of file diff --git a/system/scaffolding/views/footer.php b/system/scaffolding/views/footer.php deleted file mode 100644 index 0e71401c9..000000000 --- a/system/scaffolding/views/footer.php +++ /dev/null @@ -1,10 +0,0 @@ - -
                            - - - - - \ No newline at end of file diff --git a/system/scaffolding/views/header.php b/system/scaffolding/views/header.php deleted file mode 100644 index 50f234a49..000000000 --- a/system/scaffolding/views/header.php +++ /dev/null @@ -1,29 +0,0 @@ - - - - -<?php echo $title; ?> - - - - - - - - - - - - -
                            -
                            \ No newline at end of file diff --git a/system/scaffolding/views/index.html b/system/scaffolding/views/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/scaffolding/views/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

                            Directory access is forbidden.

                            - - - \ No newline at end of file diff --git a/system/scaffolding/views/no_data.php b/system/scaffolding/views/no_data.php deleted file mode 100644 index bc81e7480..000000000 --- a/system/scaffolding/views/no_data.php +++ /dev/null @@ -1,8 +0,0 @@ -load->view('header'); ?> - -

                            -

                            - -load->view('footer'); -/* End of file no_data.php */ -/* Location: ./system/scaffolding/views/no_data.php */ \ No newline at end of file diff --git a/system/scaffolding/views/stylesheet.css b/system/scaffolding/views/stylesheet.css deleted file mode 100644 index 3f487dd0b..000000000 --- a/system/scaffolding/views/stylesheet.css +++ /dev/null @@ -1,143 +0,0 @@ -body { - margin: 0; - padding: 0; - font-family: Lucida Grande, Verdana, Geneva, Sans-serif; - font-size: 11px; - color: #4F5155; - background: #fff url(background.jpg) repeat-x left top; -} - -a { - color: #8B0D00; - background-color: transparent; - text-decoration: none; - font-weight: bold; -} - -a:visited { - color: #8B0D00; - background-color: transparent; - text-decoration: none; -} - -a:hover { - color: #000; - text-decoration: none; - background-color: transparent; -} - - -#header { - margin: 0; - padding: 0; -} - -#header_left { - background-color: transparent; - float: left; - padding: 21px 0 0 32px; - margin: 0 -} - -#header_right { - background-color: transparent; - float: right; - text-align: right; - padding: 35px 50px 20px 0; - margin: 0 -} - -#footer { - margin: 20px 0 15px 0; - padding: 0; -} - -#footer p { - font-size: 10px; - color: #999; - text-align: center; -} - -#outer { - margin: 30px 40px 0 40px; -} - -img { - padding:0; - border: 0; - margin: 0; -} - -.nopad { - padding:0; - border: 0; - margin: 0; -} - -table { - background-color: #efefef; -} - -th { - background-color: #eee; - font-weight: bold; - padding: 6px; - text-align: left; -} - -td { - background-color: #fff; - padding: 6px; -} - - -form { - margin: 0; - padding: 0; -} - -.input { - font-family: Lucida Grande, Verdana, Geneva, Sans-serif; - font-size: 11px; - width: 600px; - color: #333; - border: 1px solid #B3B4BD; - font-size: 11px; - height: 2em; - padding: 0; - margin: 0; -} - -.textarea { - font-family: Lucida Grande, Verdana, Geneva, Sans-serif; - font-size: 12px; - width: 600px; - color: #333; - border: 1px solid #B3B4BD; - padding: 0; - margin: 0; -} - -.select { - background-color: #fff; - font-size: 11px; - font-weight: normal; - color: #333; - padding: 0; - margin: 0 0 3px 0; -} - -.checkbox { - background-color: transparent; - padding: 0; - border: 0; -} - -.submit { - background-color: #8B0D00; - color: #FFF; - font-weight: normal; - border: 1px solid #000; - margin: 6px 0 0 0; - padding: 1px 5px 1px 5px; -} diff --git a/system/scaffolding/views/view.php b/system/scaffolding/views/view.php deleted file mode 100644 index a81241d39..000000000 --- a/system/scaffolding/views/view.php +++ /dev/null @@ -1,27 +0,0 @@ -load->view('header'); ?> - - - - - - - - - - -result() as $row): ?> - - - - - - - - -
                            EditDelete
                             $primary), $scaff_edit); ?> $primary), $scaff_delete); ?>$field);?>
                            - - - -load->view('footer'); -/* End of file view.php */ -/* Location: ./system/scaffolding/views/view.php */ \ No newline at end of file