From ed82241fc31b8355721a28ce5bda28f1ef0113fa Mon Sep 17 00:00:00 2001 From: olevole Date: Sun, 24 Nov 2024 16:25:39 +0300 Subject: [PATCH] fix link; improve bhyve vm create form --- README.markdown | 2 +- php/clonos.php | 63 +- php/config.php | 25 +- php/localization.php | 137 + public/css/styles.css | 9 + public/dialogs/bhyve-new.php | 2 - public/dialogs/bhyve-obtain.php | 15 +- public/index.php | 2 +- public/js/clonos.js | 85 +- .../__pycache__/__init__.cpython-311.pyc | Bin 0 -> 275 bytes .../__pycache__/__main__.cpython-311.pyc | Bin 0 -> 372 bytes .../__pycache__/auth_plugins.cpython-311.pyc | Bin 0 -> 6514 bytes .../__pycache__/websocket.cpython-311.pyc | Bin 0 -> 35367 bytes .../websocketproxy.cpython-311.pyc | Bin 0 -> 39428 bytes .../websocketserver.cpython-311.pyc | Bin 0 -> 6039 bytes .../websockifyserver.cpython-311.pyc | Bin 0 -> 43408 bytes public/pages/overview/en.index.php | 2 +- public/pages/overview/index.php | 46 + public/pages/overview/orig.index.php | 46 + public/pages/overview/ru.index.php | 2 +- .../translate.cache/!dont.touch.files | 1 + public/phpliteadmin.config.php | 85 + public/phpliteadmin.php | 6264 +++++++++++++++++ version | 2 +- 24 files changed, 6749 insertions(+), 39 deletions(-) create mode 100644 public/novnc/utils/websockify/websockify/__pycache__/__init__.cpython-311.pyc create mode 100644 public/novnc/utils/websockify/websockify/__pycache__/__main__.cpython-311.pyc create mode 100644 public/novnc/utils/websockify/websockify/__pycache__/auth_plugins.cpython-311.pyc create mode 100644 public/novnc/utils/websockify/websockify/__pycache__/websocket.cpython-311.pyc create mode 100644 public/novnc/utils/websockify/websockify/__pycache__/websocketproxy.cpython-311.pyc create mode 100644 public/novnc/utils/websockify/websockify/__pycache__/websocketserver.cpython-311.pyc create mode 100644 public/novnc/utils/websockify/websockify/__pycache__/websockifyserver.cpython-311.pyc create mode 100644 public/pages/overview/index.php create mode 100644 public/pages/overview/orig.index.php create mode 100644 public/pages/overview/translate.cache/!dont.touch.files create mode 100644 public/phpliteadmin.config.php create mode 100644 public/phpliteadmin.php diff --git a/README.markdown b/README.markdown index fdad2c1d..98ade1e1 100644 --- a/README.markdown +++ b/README.markdown @@ -17,7 +17,7 @@ ClonOS is a free open-source FreeBSD-based platform for virtual environments cre + https://man.freebsd.org/vale/4 :: vale(4) as Virtual Ethernet Switch + http://man.freebsd.org/jail/8 :: jail(8) as container engine -- https://www.bsdstore.ru/en/ :: CBSD Project as management tools +- https://github.com/cbsd/cbsd :: CBSD Project as management tools - https://puppet.com/ :: Puppet as configuration management diff --git a/php/clonos.php b/php/clonos.php index ee2b929f..fde6254a 100644 --- a/php/clonos.php +++ b/php/clonos.php @@ -94,7 +94,8 @@ class ClonOS { $this->config=new Config(); $this->_locale = new Localization($this->realpath_public); - + $this->_translate = new Translate($this->_locale,$this->realpath_page); + $this->_client_ip=$_SERVER['REMOTE_ADDR']; if(isset($this->_vars['path'])){ @@ -103,12 +104,23 @@ class ClonOS { $this->json_name=$this->realpath_page.'a.json.php'; //echo $this->realpath_page; }else if($_SERVER['REQUEST_URI']){ + + if($this->uri_chunks[0]=='overview1') + { + $this->uri_chunks[0]='overview'; + $this->realpath_page=$this->realpath_public.'pages/'.$this->uri_chunks[0].'/'; + $this->_translate->translate($this->realpath_page,'index.php'); + //break 1; + } + //$this->realpath_page=$this->realpath_public.'pages/'.trim($_SERVER['REQUEST_URI'],'/').'/'; if(isset($this->uri_chunks[0])){ $this->realpath_page=$this->realpath_public.'pages/'.$this->uri_chunks[0].'/'; } } + + if(isset($this->_vars['hash'])) $this->url_hash=preg_replace('/^#/','',$this->_vars['hash']); // $this->json_name=$this->realpath_php.'pages' @@ -1614,7 +1626,7 @@ class ClonOS { $res=$db->selectOne("SELECT * FROM media WHERE idx=?", array([(int)$this->form['media_id'], PDO::PARAM_INT])); if($res===false || empty($res)) return array('error'=>true,'res'=>print_r($res,true)); - //if($res['jname']=='-') // если медиа отвязана, то про + //if($res['jname']=='-') // если медиа отвязана, то про $res=CBSD::run( 'media mode=remove name="%s" path="%s" jname="%s" type="%s"', //.$res['name'] @@ -2353,31 +2365,33 @@ class ClonOS { $html=str_replace('#sel#',' selected="selected"',$html); } - $form_items=$this->getBhyve_formItems(); + $form_items=$this->getBhyveFormItems(); return array('iso_list'=>$html,'form_items'=>$form_items); } - function getBhyve_formItems($os_name='') + + function ccmd_vmOsInfo() //getVMOSListInfo { + return array('form_items'=>$this->getBhyveFormItems($this->form['vmOsProfile'],$this->form['obtain'])); + } + + function getBhyveFormItems($os_name='',$obtain='') + { + $jname='undefined'; if($os_name!='') { - $res=array(); + $arr=$this->config->os_types_getOne($os_name,$obtain); }else{ - $arr=$this->config->os_types_getOne('first'); -//return $res;exit; - $jname='undefined'; - $jres=$this->ccmd_getFreeJname(false,$arr['default_jname']); - if(!$jres['error']) - { - $jname=$jres['freejname']; - } - //print_r($jres);exit; - //$res['jname']=$jname; - //var_dump($res);exit; - + $arr=$this->config->os_types_getOne('first',$obtain); } - + + $jres=$this->ccmd_getFreeJname(false,$arr['default_jname']); + if(!$jres['error']) + { + $jname=$jres['freejname']; + } + $res=array( 'jname'=>$jname, //$arr['jname'], 'imgsize'=>array( @@ -2395,10 +2409,21 @@ class ClonOS { 'max'=>intval($arr['vm_ram_max']), 'cur'=>intval($arr['vm_ram']) ), + 'obtain'=>$obtain, ); return $res; } + + function ccmd_getObtainFormItems($os_name='') + { + $res=array('form_items'=>$this->getBhyveFormItems($os_name,'obtain')); + return $res; + } + + + + function get_interfaces_html(){ $if=$this->config->os_interfaces; @@ -2501,7 +2526,7 @@ class ClonOS { if($db->isConnected()) { $res=$db->selectOne("SELECT username FROM auth_user WHERE username=?", array([$user_info['username']])); if(!empty($res)){ - $res['user_exsts']=true; + $res['user_exists']=true; // было user_exsts, похоже была опечатка return $res; } diff --git a/php/config.php b/php/config.php index 8358a9ba..728effce 100644 --- a/php/config.php +++ b/php/config.php @@ -320,17 +320,32 @@ class Config } return $html; } - function os_types_getOne($name='first') + function os_types_getOne($name='first',$obtain='') { $res=array(); - $info=$this->os_types; - if($name='first') + if($obtain=='obtain') + { + $info=$this->os_types_obtain; + }else{ + $info=$this->os_types; + } + + if($name=='first') { $res=current($info)['items'][0]; }else{ - + foreach($info as $type) + { + foreach($type['items'] as $arr) + { + if($arr['name']==$name) + { + $res=$arr; + break 2; + } + } + } } - return $res; } diff --git a/php/localization.php b/php/localization.php index d601eaab..629aa75f 100644 --- a/php/localization.php +++ b/php/localization.php @@ -22,4 +22,141 @@ class Localization { return (isset($this->translate_arr[$phrase])) ? $this->translate_arr[$phrase] : $phrase; } +} + + + +class Translate +{ + private $locale=''; + private $language=''; + private $realpath=''; + + function __construct($locale,$realpath) + { + + $this->locale=$locale; + $this->language=$this->locale->get_lang(); + $this->realpath=$realpath; + } + + public function translate($path,$file_name) + { + $file=$path.$file_name; + $db=new Db('clonos'); + if(!$db->isConnected()) return array('error'=>true,'error_message'=>'db connection lost!'); + //$status=(new Db('base','cbsdtaskd'))->selectOne("SELECT status,logfile,errcode + // FROM taskd WHERE id=?", array([$task_id]); + + if(file_exists($file)) + { + $is_changed=false; + $txt=file_get_contents($file); + preg_match_all('#]*)>(.*)#',$txt,$res,PREG_SET_ORDER); +// var_dump($res);exit; + + foreach($res as $item) + { + $id=-1; + //$text=''; + $update=false; + $params=[]; + $tag=$item[0]; + $attrs=$item[1]; + $text=$item[2]; + + if($attrs!='') + { + //$txt=$item[2]; + //echo '
'.$txt;
+					preg_match_all('#((id)="?([\d]+)"?|update)#',$attrs,$params,PREG_SET_ORDER);
+					if(is_array($params) && $this->language!='en')
+					{
+						// если у пользователя язык интерфейса не английский, то переводим
+						foreach($params as $p)
+						{
+							if(isset($p[2]) && $p[2]=='id')
+							{
+								if(is_numeric($p[3]))
+								{
+									$id=$p[3];
+									$dbres=$db->selectOne("select text from lang_en where id=?",[[$id,PDO::PARAM_INT]]);
+									if(!empty($dbres))
+									{
+										var_dump($dbres);exit;
+									}else{
+										echo 'no data';
+									}
+									
+									
+								}else{
+								}
+							}
+							
+							if($p[0]=='update' && $id>0)
+							{
+								echo "\tupdate id: ",$id,"\n";
+							}
+
+							
+			//echo "\tupdate: ",var_dump($update),"\n";
+						}
+						
+					}else{
+						
+					}
+					//print_r($params);
+				}else{
+					
+
+/*
+delete FROM "lang_en";
+VACUUM;
+UPDATE SQLITE_SEQUENCE SET seq = 0 WHERE name = 'lang_en'
+*/
+					
+					$dbres=$db->selectOne("select id from lang_en where text=?",[[$text, PDO::PARAM_STR]]);	//,[[$text, PDO::PARAM_STR]]);
+					if(isset($dbres['error']) && $dbres['error'])
+					{
+						echo 'error db: ',$dbres['info'];
+						exit;
+					}
+					if(is_numeric($dbres['id']))
+					{
+						// если фраза есть в базе, то вписываем её ID в тэг
+						$new_text=''.$text."";
+						$txt=str_replace($tag,$new_text,$txt);
+						$is_changed=true;
+					}else{
+						if($dbres===false)
+						{
+							// если фразы нет в базе, то добавляем её туда и вписываем новый ID в тэг
+							$dbres=$db->insert("insert into lang_en (text) values (?)",[[$text, PDO::PARAM_STR]]);
+							
+							if($dbres['error'])
+								return array('error'=>true,'error_message'=>$dbres['info']);
+							
+							$new_text=''.$text."";
+							$txt=str_replace($tag,$new_text,$txt);
+							$is_changed=true;
+						}
+					}
+				}
+			}
+			
+			if($is_changed)
+			{
+				rename($path.$file_name,$path.'orig.'.$file_name);
+				file_put_contents($path.$file_name,$txt);
+			}
+			echo $txt;
+			exit;
+		}else{
+			
+		}
+
+		/*
+			]*)>(.*)
+		*/
+	}
 }
\ No newline at end of file
diff --git a/public/css/styles.css b/public/css/styles.css
index 50689876..d3b16ed0 100644
--- a/public/css/styles.css
+++ b/public/css/styles.css
@@ -920,6 +920,15 @@ dialog.fullscreen #vnc-iframe {
 .window-box .mrow.installed small {
 	color:silver;
 }
+
+form.loading {
+	pointer-events: none;
+}
+form.loading input,
+form.loading select {
+	color:#AAA;
+	background:#F5F5F5;
+}
 form.win .field-name {
 	display:block;
 	text-transform:uppercase;
diff --git a/public/dialogs/bhyve-new.php b/public/dialogs/bhyve-new.php
index 69f64639..f1ed6b82 100644
--- a/public/dialogs/bhyve-new.php
+++ b/public/dialogs/bhyve-new.php
@@ -47,7 +47,6 @@ err_messages.add({
 				
 					
 					
-					
 				
 			

@@ -56,7 +55,6 @@ err_messages.add({ -

diff --git a/public/dialogs/bhyve-obtain.php b/public/dialogs/bhyve-obtain.php index d08589cc..704a9f38 100644 --- a/public/dialogs/bhyve-obtain.php +++ b/public/dialogs/bhyve-obtain.php @@ -5,7 +5,7 @@

translate('VM OS profile');?>: - config->os_types_create('obtain'); ?>

@@ -29,11 +29,20 @@

translate('VM RAM');?>: - + + + + + +

translate('VM Image size');?>: - + + + + +

translate('IP address');?>: diff --git a/public/index.php b/public/index.php index 46d108ea..8a9aa367 100644 --- a/public/index.php +++ b/public/index.php @@ -140,7 +140,7 @@ echo $menu->html;

- translate('DONATE'); ?> + translate('DONATE'); ?> translate('VERSION'),': ',file_get_contents($clonos->realpath.'version'); ?> diff --git a/public/js/clonos.js b/public/js/clonos.js index dac87609..aac81c13 100644 --- a/public/js/clonos.js +++ b/public/js/clonos.js @@ -226,6 +226,7 @@ var clonos={ } if(id=='bhyve-obtain') { + this.getObtainFormItems(); // Берём с сервера свободное имя виртуалки и min/max ram/cpus if(typeof this.vm_packages_obtain_min_id!='undefined') $('#bhyveObtSettings select[name="vm_packages"]').val(this.vm_packages_obtain_min_id).change(); } @@ -869,6 +870,7 @@ var clonos={ }, updateBhyveISO:function() { + this.formDisable($('form#bhyveSettings')); this.loadData('updateBhyveISO',$.proxy(this.onUpdateBhyveISO,this)); }, onUpdateBhyveISO:function(data) @@ -892,14 +894,15 @@ var clonos={ 'min':fi.vm_ram.min, 'max':fi.vm_ram.max }).val(fi.vm_ram.cur); - $('#bhyveSettings input[name="vm_ram_show"]').val(fi.vm_ram.cur); + $('#bhyveSettings input[name="vm_ram_show"]').val(fi.vm_ram.cur+'g'); $('#bhyveSettings input[name="vm_imgsize"]').prop({ 'min':fi.imgsize.min, 'max':fi.imgsize.max }).val(fi.imgsize.cur); - $('#bhyveSettings input[name="vm_imgsize_show"]').val(fi.imgsize.cur); + $('#bhyveSettings input[name="vm_imgsize_show"]').val(fi.imgsize.cur+'g'); } + this.formEnable($('form#bhyveSettings')); }, getFreeJname:function() { @@ -991,6 +994,39 @@ var clonos={ this.wssReload(); this.dataReload(); }, + getObtainFormItems:function() + { + this.formDisable($('form#bhyveObtSettings')); + this.loadData('getObtainFormItems',$.proxy(this.onGetObtainFormItems,this)); + }, + onGetObtainFormItems:function(data) + { + //#bhyveObtSettings + if(typeof data.form_items!='undefined') + { + var fi=data.form_items; + $('#bhyveObtSettings input[name="vm_name"]').val(fi.jname); + + $('#bhyveObtSettings input[name="vm_cpus"]').prop({ + 'min':fi.vm_cpus.min, + 'max':fi.vm_cpus.max + }).val(fi.vm_cpus.cur); + $('#bhyveObtSettings input[name="vm_cpus_show"]').val(fi.vm_cpus.cur); + + $('#bhyveObtSettings input[name="vm_ram"]').prop({ + 'min':fi.vm_ram.min, + 'max':fi.vm_ram.max + }).val(fi.vm_ram.cur); + $('#bhyveObtSettings input[name="vm_ram_show"]').val(fi.vm_ram.cur+'g'); + + $('#bhyveObtSettings input[name="vm_size"]').prop({ + 'min':fi.imgsize.min, + 'max':fi.imgsize.max + }).val(fi.imgsize.cur); + $('#bhyveObtSettings input[name="vm_imgsize_show"]').val(fi.imgsize.cur+'g'); + } + this.formEnable($('form#bhyveObtSettings')); + }, loadData:function(mode,return_func,arr,spinner) { @@ -2184,9 +2220,39 @@ var clonos={ }, onChangeOsProfile:function(obj,event) { - var a=event.target; - var i=a.selectedIndex; - debugger; + var frm=$(obj).closest('form'); + this.formDisable(frm); + var val=$(obj).val(); + var txt=$("option:selected",obj).text(); + + var obtain=''; + if($(frm).attr('id')=='bhyveObtSettings') obtain='obtain'; + var posts=[{'name':'vmOsProfile','value':txt},{'name':'obtain','value':obtain}]; + this.loadData('vmOsInfo',$.proxy(this.onVmOsInfoLoad,this),posts); + }, + onVmOsInfoLoad:function(data) + { + var fi=data.form_items; + if(fi.obtain=='obtain') return this.onGetObtainFormItems(data); + var obj=$('form#bhyveSettings'); + $('input[name="vm_name"]',obj).val(fi.jname); + + $('input[name="vm_cpus"]',obj) + .attr('min',fi.vm_cpus.min) + .attr('max',fi.vm_cpus.max) + .val(fi.vm_cpus.cur); + $('input[name="vm_cpus_show"]',obj).val(fi.vm_cpus.cur); + $('input[name="vm_ram"]',obj) + .attr('min',fi.vm_ram.min) + .attr('max',fi.vm_ram.max) + .val(parseInt(fi.vm_ram.cur)); + $('input[name="vm_ram_show"]',obj).val(fi.vm_ram.cur+'g'); + $('input[name="vm_imgsize"]',obj) + .attr('min',fi.imgsize.min) + .attr('max',fi.imgsize.max) + .val(parseInt(fi.imgsize.cur)); + $('input[name="vm_imgsize_show"]',obj).val(fi.imgsize.cur+'g'); + this.formEnable($('form#bhyveSettings')); }, loginAction:function(event) @@ -2503,6 +2569,15 @@ var clonos={ }, + formEnable(form) + { + $(form).removeClass('loading'); + }, + formDisable(form) + { + $(form).addClass('loading'); + }, + userEdit:function(user_id,tblid) { var mode='userEditInfo'; diff --git a/public/novnc/utils/websockify/websockify/__pycache__/__init__.cpython-311.pyc b/public/novnc/utils/websockify/websockify/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..70205440d48a269eccc44cbe47af096fe67277e6 GIT binary patch literal 275 zcmZ3^%ge<81U+jOr+EYE#~=<2FhLog#ej_I3@HpLj5!P;5SkH4GX*nfGQR{V(qz2F zsO6{0bW5Z>HK{m1IXg40QV+^ZEx9F$O|+mWzoK#_!)K8GUtap9#YOr#`N@en`sL;2 z`pG%@dHKcq1*J(jnaTQj`DJ;@`lThAImP-2qmY^L@tJv4 zBO~Jt2Ehw3^njVWqv{f~1Y41Hi`V37hUDdGg0 F0RYpCV*UUC literal 0 HcmV?d00001 diff --git a/public/novnc/utils/websockify/websockify/__pycache__/auth_plugins.cpython-311.pyc b/public/novnc/utils/websockify/websockify/__pycache__/auth_plugins.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c6b89b31d29ce142935792d12d676aa2df0febaa GIT binary patch literal 6514 zcmcgwOKcm*8Qv!!BB=*y>t$J5%d#BC4<)u7%W;y{mS1X8<{>3cR3uw!cO@~VNOhKq zY=SP-z(twDXw?*j(xyQPv~Xou2OWCwp@$~D^hgQ>L@Z#yK+%J56r_XUQ~!UKT<(%G zVE52j?$4e1XaD(U_WK_*e+>kh7$~>b{yhDypJD!um1+?y58HR(VTIwC%Z$q0VpR4H z$1wNcHp`^R;ef+y>>VC>a94O7eMNqad zKhA^$N_A-buj;tn1C&%8Br>$1lc9K0 ziN=Q(7Z-<=cruaHhvpZi;xT0?k^C&73@xN$aeZh}o6?iYwb=9x`(tz=H7n0k-Sp%0 zHw=#~#}cuWET=;?t&dk5aZo(~WQi%YcV&g!zARkZsIMX*trQmi>BL;{umaz9oFVwl z?=p7<;(-UlJ*!1kjp&9i6(uuTN}f&XDXTJ{Bq<#QN>B*m$nc}4S|SxwqA4xiVN=e| zz(I635Kz$L&k6*PR~cHwxh0}=nk*YlvOJem7vlKrm*t-ukR*vb`YmXwRILof;xqjs%kc0!c7@4scCcl5sNu|L z$p}!hfSO^KxQuX$5q zu)9~5m3UOwWm!j1BCw<-3N0!=-LuO&TDV69=syJV7;v@c007@x>NpI4{!*w9{yYzT z!R+@+?fu!y|M3LAaNl-sdO9~eow*Bt8Oy=7y12TS?>b%Zj1)a1`Rb1%;jT#bf?(2) zqyq^;&wssMS(Od8qH+i}mCtZMg>S?)(dp7FuyaMy%@su@Q`7WeXI;8N-PEhn z#q0B$lG0Qunb4%F^WwaF`Fp2=uKLCOl?E`QYJw2uU2l2n#0m@QWINue1 zICwlao10yC;Z^3@y(49j@pf%7y!XrwlCqPSus8(r$zdGH2E{NoB0(VQBS36WEOTxI z;Ik2P5EP}rZ50c9C!om|Y%$P!z$1b$R0RmQqACJ)sSx-l-Kra?N9DjvdW`_Yi3iAr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z;dC0Lw{QqlA z>_~e&&`XeS$B2hy>5z9NQhsNPY~Q=P?qy0f2F|+Kofy*6Ox76@w5WMi7=> z9(`-ax@O8zyTv0u|rF!~k7K@YiR5c{bm1 zWObt8J5ltVxIggsBYEFN_&o?7S|7~^M+(7_VsIqy9|7R|FR{R>As^1loB@Q4qh7cH z*!67lV`L!t5#0LgKx#%&5@zzkOj&SR1vL^shdcX5Vk(02B4IZ@Gc~*yuPfR-?h5Fc z6+JDW@rl|Z9lOp_pLkv~k7(Z@Qy>YQn!Xn(gin?&b0Q1ps*Pj|+jeSj{#ce+K}ckJ9x*d`Wz$nJEDw(r=voj%m1k!)ex K&MpkP;{OF~XK8o< literal 0 HcmV?d00001 diff --git a/public/novnc/utils/websockify/websockify/__pycache__/websocket.cpython-311.pyc b/public/novnc/utils/websockify/websockify/__pycache__/websocket.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..db0ca2521fd2b82cf733f368d289992cce7da75d GIT binary patch literal 35367 zcmeHw3vgW5dEP#O1$Kd50E=C`aq$L70wloqQw9OPL=vP#QW9w^@B(*1ED7vFcNZi9 z0W#&doh6IJph8=)BgKd#%TOd|nAX$CiR02vTRTac+>72RH{0P1W-@BRw8_9#+`62} zwBLX3djUvP635e-UV>-uJ@>rNfBy6T-}%qE-z+LBwBee2?>9!q1)J^9=|Q{P>dlAE zcAM>W8*jU0eg<tH{(7C;%u<+dE#6&_!CApEr z*jVCvEPk1r5E7}xaAHhLAi1xQ!_~=+rcx98wr))&5@X4(STr@#l@Km(9ZijoZRLf? zNUD?kI!C95Vx6hc==JDOl2uMiuXEe(f24%Ew|#sbu2L)8QXgO`t_~DV~KboxpiW4 zXe>62(qD@YZ=FoV#*$mrmXD20t#cbqb%Dh4ks@;%ar2=c&Q1Ma#^t%$FBEAZK0!sp zmWn5uoMhxFcc5m0v<#6QXyXm*UMvoUh?rixJ7&s++w~MuAleA4e$ZD zC433oQoa;!8D9oB$hYz3NVOclA^e8;cD@3?Vfx?C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p;)?4jcBv{Wo#9q^)F*<5Uqc(Pqvq2T!EXXlz%_XKFQTDyZS{J>G3y@&_9^;+i6vBwa{)az$jSbES!^Ty8#~93xFMHZ(aJG;YW81 s!*bpB+`xHO%ZyYqQJW^ev>gZD{N(Ehb+zwP&`dn=vaudu`YznpEqYybcN literal 0 HcmV?d00001 diff --git a/public/novnc/utils/websockify/websockify/__pycache__/websocketproxy.cpython-311.pyc b/public/novnc/utils/websockify/websockify/__pycache__/websocketproxy.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2a25b6c4ba4096900da1eb432fd33b3e5ab6cb13 GIT binary patch literal 39428 zcmeIb3ve7)x*j%9pa(Mm2EYKs8%;bp1o0xl7eG*i0Pu+imxNxFv?CBbAVC5%P|tuA zhXXBFk?%q>eHUVJL##|$_Ukz3V870DPWGE~E{FZ*p37yw z+&PZ@y3V=SZ{E2)_Uk_9#;<+GGn;=d-%5EnW(sBt&lR#~+l=>|7k^XO)bhhkV+3dD++pHFw<(Ng_-n9s>VDY7Ly&|95Eta3+U%k#%FsM90xdBzF z`)5H_37&T?=cGzg7V_^p&NT`J zsC$!82)CKFmKUv66wD76e(FG5;$OYawFGwv#g~B}7K`YyS%S@<;_0VqAYAm2?JWEE zmrT59wOI1{`Imy{&xR*22cvv6%#RP8<|FFcoEU!V8h>>p&6OFGgo)8mM&BQ`3_Z(O@Jm@7L7eqke0uVEm#OoDfjPk?FTigy55R ze0==$*`SCfz?=7K@H{p5^whP8?&q19k6sMS&CFkz4n_R76gM{^MuLGiBPniPoMA7M zMu)OKRo}kq!S5YQ&;oK`AyNP`U;_!T18JOs18$Dsgqthmz~zKoxGox;81}BS7Jpu< zc8*rpz7bg!JkLDqtg>JEc`mf8=nv_0O$00EZ}fPKm^&So|KvfO`fKt4rLUr=J>cR*FxlZMZ-xZ5v>% zmy98spmJ=u%)@rj@_N;4$ZNs2VBadAxGiqa&gW(|p!I3Pl!rNekOd1cz&;xD41_~b z^k>`nwYgx-6%D=>?H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9b3g9(&8u7Hv}6 zB0Ux}_iSh?A`L?~QHP*kvlbu>XZv9I+Mk9HO5(Yjoj$l(8pj6|qsDnL)X+FX7k8TV zBB6KLmQK-}8b#+k%c`&@aMP-d|G4tQ%EZWn-Eze~rD7k} zQx$cZSGQboK&d#8_8M9NRJ&5qzGz3(hUVo9YN}d{6D#v_#a^XiFVcogdE1@JTb0Yl z6X)e3zf$A}OX4mfR(f}O&DAVdb}5xzuyA`y&-Ua4r&bcIo064O&O&_C=1%Xe-Vgei z(Oef3D#KkIcXiibY83o zt6ceVYvQ_8u}9jQmV-bPf?GATVoamJ8k!vG{i_)`Z1TsqI4~9l9!NDtTt^zc}3c3SZ#a#w0)?tsD_ko221xSz|i>?NkCj5NQh2EC{h z;(t%C{~AuF=`Lae887%78nM(zD1`oJGTpTcg1APA!@k8Gwc1IH|8x#3JM(5f! zAL<_Q3ORSlAudeJA&1VQr9AT@EG(UGSNHRXc~QR@T&{7((1bbzt=V8Cs%^-sjeLp# zm&y4PN+oCPbfABDI8}K1%-HzYz}RpATl-gb?@754Fgm8bWxg08P#e9{mC9Ga*bA(B znO=8`e@6MxJ~G>RW38ulKh4Q%iOTA>i*DU!r*xzQrt&+ubC(W-$=(^*3b}K{*o4ZowPNj0- zOBVXuOql1n1uI3{+?7h3l+t})ve4gV!W?nft&klXPJzW+ax(@?g^+V5&fW{ih20M# zKmVRwh&{#JcgJAE%IjNuVra6g0;_of-0{?a$(?P=&R&XhXg!}Rw5`J^m+gjo-B)PE zR;A(8&pE8M>y`|6%GGJbVBY8~eK&FLOY;A1I&jKrad;MEtM&@XUXgT^+!&J`rHZ3e P(r-u{9F+)TIQoAB657~S literal 0 HcmV?d00001 diff --git a/public/novnc/utils/websockify/websockify/__pycache__/websocketserver.cpython-311.pyc b/public/novnc/utils/websockify/websockify/__pycache__/websocketserver.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..015b9deea447f9f4150d2a6a9cb1fb5eaa9e70ea GIT binary patch literal 6039 z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#Tns+v*3kO?%~h_M?=RAg$(Y1#1hjX zdTW=*r=XS4d^%{Uf|jafvr5Sf=E(DbC83dsh=zq?%2f5T4lhiWOBPI0wINGjhOSc! zBs+7cyx+^Qg$7kl#URLNSr<%aQ4vG)qE)%wFC+j^!oB|!9x!&cJ9vnKVOyvVPzY_b z5Skg{q{EkvNVs*m4wz_q}V21$dD zSSHCZUa%HbUY#BlD+k!GRJkKi z0V@MzdF=plD)@Uy^kDgg{ZWosI>3(@Ai%S?JjkBNCEb(}T2OIroRuZc{;2JY$o+x`izPx&QLwR{!dAY6(HW>V*vXcV^dxgYgJV5uyU7DFDNZfpiVqcNJZF2ok;uA;sQq z2lk8gc@bFavG>JxVg2{WTCz(GsOa1V7+|4os9AfTo!aK&6K>jfRBk48PPr5thOP{= zJ~!>hXEzRMvzs*S1xR0a`HSoKWf+CqBXld3>$J81^b0f(!^|zPA;jr_>gBd_UCT zg#)(;se=fh=#wqAy&w2azbl5>&pZZSn(JRqq>V^o^`!nz3YN|E6-l_W@I1{PxRpU%ydT#v004OiAWAIy(R}K{7!0tIOA#2_<=^Np>KI<>X+Kgrx64 zQf-ouX7XO1jyTi5hz7|ffOCW%qM}pr*yfkqfpO94G?ihQsH8!@$ z^?D17$5Xclzu)D(4^%7;H7tSEeLh&=i&j3w4ND>)_ZY)y=ON=HK8cy5><+cQli%>p z{%^7?z(vFJUZBmmBuULwQc5%ll3hgVSDnT{seS*|Oze{2oZe0DUww+T z&s(gQ#w7`0von1v>YulBZ^dF#rb)U9N6$Tt1Lt{*Elb$Co7}(s6lL;wH) literal 0 HcmV?d00001 diff --git a/public/novnc/utils/websockify/websockify/__pycache__/websockifyserver.cpython-311.pyc b/public/novnc/utils/websockify/websockify/__pycache__/websockifyserver.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..706c25715af987a2af961882273ec2b086d9d17d GIT binary patch literal 43408 zcmdVDd2kz7nkR^p1PFix@0(2C1Swv+MNtPu@zO!b5@nZZmr)P_N{}dk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!9BJc*h50ao%~_39^%=zevmf9H6o?$5i+@bMRxeiuIeawmQKm94+-OqT9Hb#SqB&vY5ZBKi=E$wTZgkV{v;8BXha$mu^j`Z;_^9r|w^)JdKFecz}v{%sq5 z{B3(F{2v+mtKbx^F~BLx>B(MaBzq%yM-P@iUu68dA~Wo(jpvka$X2=Z<6AO;s>HOi`mI_Z-PXiU(BOsMQF^$$8(=zb(J!1uhNzjY>> zUv=xm*SQ)=y(B4dT@u-rM*;Y>mniA>9gH4279BYiZQT*wdoWs389j15dSoDa_(-&C z*H)ohZw91IGfx=w=TsEi;-?N zQVrbn1hG-oz-JqM#*LgDb3VYZVw4%_dLz|9V9jSKT{fi}J9EsH6gO^^oi~^PPcobG z0HI;ws%B$Y)?7f0AO2fpussahSF!O)n;*uVXWONi?Q%Fg(xfuEokzL{K}ShklkFc8e9= zkZ<3Cuw7@|>I?HkT;hq#8>`6VA1@e5BlG_Y88$LVmQ@x9(oPYmWRrEr9p>LdHSy{~ zzl8}{tJiO3<>*alRTyPD{UJfu_Ye0*btQuGMs?kS_QkBs$2yXwmyJIdxizp@xMeb# zd!ywID;1G}w`=d!E@m%gzh+&sE;qb}9m12S4I(xMGh!$PWQ~%;L@ka*^P+h*M1N}o zYXd^=e$jG3vK$bU7s!RVmljKl&XoPVzU6)E#tOk$v1w`)ly_5iR><^5bpwL--7;nA zQKWQ3sMsr29Q&Mnev|Mn=r`$saA!7!+JnNO3!gLJ-z0|_u}oX^82Xvb&zbvgw((_m W(*CTZ-){KW-q63({Be&S=Kl{J!@iXO literal 0 HcmV?d00001 diff --git a/public/pages/overview/en.index.php b/public/pages/overview/en.index.php index b80e0676..5e8651de 100644 --- a/public/pages/overview/en.index.php +++ b/public/pages/overview/en.index.php @@ -33,7 +33,7 @@

It is an open source and free product which powered by other project (major importance list):

    -
  • CBSD Project — — FreeBSD OS virtual environment management framework
  • +
  • CBSD Project — — FreeBSD OS virtual environment management framework
  • FreeBSD Project — FreeBSD is a free and open source Unix-like operating system descended from Research Unix created in University of California, Berkeley, U.S.
  • Puppet — Puppet is an open-source configuration management tool.
  • and many other..
  • diff --git a/public/pages/overview/index.php b/public/pages/overview/index.php new file mode 100644 index 00000000..2236ffa0 --- /dev/null +++ b/public/pages/overview/index.php @@ -0,0 +1,46 @@ +
    +
    +

    Summary statistics for cloud:

    + + + + + + + + + + + + + + + + + + + +
    ParamValues
    Num of nodes:
    Online nodes:
    Offline nodes:
    Num of jails:
    Num of cores:
    Average freq. Mhz:
    Summary RAM:
    Summary storage size:
    +
    +
    +

    Current node CPU usage:

    +
    + +

    Current node RAM usage:

    +
    +
    +
    + +

    It is an open source and free product which powered by other project (major importance list):

    + + + diff --git a/public/pages/overview/orig.index.php b/public/pages/overview/orig.index.php new file mode 100644 index 00000000..fcdb10dd --- /dev/null +++ b/public/pages/overview/orig.index.php @@ -0,0 +1,46 @@ +
    +
    +

    Summary statistics for cloud:

    + + + + + + + + + + + + + + + + + + + +
    ParamValues
    Num of nodes:
    Online nodes:
    Offline nodes:
    Num of jails:
    Num of cores:
    Average freq. Mhz:
    Summary RAM:
    Summary storage size:
    +
    +
    +

    Current node CPU usage:

    +
    + +

    Current node RAM usage:

    +
    +
    +
    + +

    It is an open source and free product which powered by other project (major importance list):

    + + + diff --git a/public/pages/overview/ru.index.php b/public/pages/overview/ru.index.php index 43e5845a..565c0d7a 100644 --- a/public/pages/overview/ru.index.php +++ b/public/pages/overview/ru.index.php @@ -33,7 +33,7 @@

    Это открытый и свободный проект, использующий в своей работе такие проекты, как (наиболее значимые):

      -
    • CBSD Project — Фреймворк для управления виртуальными окружениями FreeBSD ОС
    • +
    • CBSD Project — Фреймворк для управления виртуальными окружениями FreeBSD ОС
    • FreeBSD Project — свободная Unix-подобная операционная система, потомок AT&T Unix по линии BSD, созданной в Калифорнийском университете Беркли, США
    • Puppet — Система управления конфигурациями
    • и много остального..
    • diff --git a/public/pages/overview/translate.cache/!dont.touch.files b/public/pages/overview/translate.cache/!dont.touch.files new file mode 100644 index 00000000..51e3e4e2 --- /dev/null +++ b/public/pages/overview/translate.cache/!dont.touch.files @@ -0,0 +1 @@ +This files is cache of translated pages, do not translate it! \ No newline at end of file diff --git a/public/phpliteadmin.config.php b/public/phpliteadmin.config.php new file mode 100644 index 00000000..9e5268cf --- /dev/null +++ b/public/phpliteadmin.config.php @@ -0,0 +1,85 @@ + '/var/db/clonos/clonos.sqlite', + 'name'=> 'ClonOS DB' + ), + array( + 'path'=> '/usr/jails/var/db/local.sqlite', + 'name'=> 'CBSD Global DB' + ), +); + + +/* ---- Interface settings ---- */ + +// Theme! If you want to change theme, save the CSS file in same folder of phpliteadmin or in folder "themes" +$theme = 'phpliteadmin.css'; + +// the default language! If you want to change it, save the language file in same folder of phpliteadmin or in folder "languages" +// More about localizations (downloads, how to translate etc.): https://bitbucket.org/phpliteadmin/public/wiki/Localization +$language = 'en'; + +// set default number of rows. You need to relog after changing the number +$rowsNum = 30; + +// reduce string characters by a number bigger than 10 +$charsNum = 300; + +// maximum number of SQL queries to save in the history +$maxSavedQueries = 10; + +/* ---- Custom functions ---- */ + +//a list of custom functions that can be applied to columns in the databases +//make sure to define every function below if it is not a core PHP function +$custom_functions = array( + 'md5', 'sha1', 'strtotime', + // add the names of your custom functions to this array + /* 'leet_text', */ +); + +// define your custom functions here +/* +function leet_text($value) +{ + return strtr($value, 'eaAsSOl', '344zZ01'); +} +*/ + + +/* ---- Advanced options ---- */ + +//changing the following variable allows multiple phpLiteAdmin installs to work under the same domain. +$cookie_name = 'pla3412'; + +//whether or not to put the app in debug mode where errors are outputted +$debug = false; + +// the user is allowed to create databases with only these extensions +$allowed_extensions = array('db','db3','sqlite','sqlite3'); + +// BLOBs are displayed and edited as hex string +$hexblobs = false; diff --git a/public/phpliteadmin.php b/public/phpliteadmin.php new file mode 100644 index 00000000..5cac3900 --- /dev/null +++ b/public/phpliteadmin.php @@ -0,0 +1,6264 @@ +. +// +// //////////////////////////////////////////////////////////////////////// +// +// Please report any bugs you may encounter to our issue tracker here: +// https://bitbucket.org/phpliteadmin/public/issues?status=new&status=open + +// +// This is sample configuration file +// +// You can configure phpliteadmin in one of 2 ways: +// 1. Rename phpliteadmin.config.sample.php to phpliteadmin.config.php and change parameters in there. +// You can set only your custom settings in phpliteadmin.config.php. All other settings will be set to defaults. +// 2. Change parameters directly in main phpliteadmin.php file +// +// Please see https://bitbucket.org/phpliteadmin/public/wiki/Configuration for more details + +//password to gain access (set an empty password to disable authentication completely) +$password = 'admin'; + +//directory relative to this file to search for databases (if false, manually list databases in the $databases variable) +$directory = '.'; + +//whether or not to scan the subdirectories of the above directory infinitely deep +$subdirectories = false; + +//if the above $directory variable is set to false, you must specify the databases manually in an array as the next variable +//if any of the databases do not exist as they are referenced by their path, they will be created automatically +$databases = array( + array( + 'path'=> 'database1.sqlite', + 'name'=> 'Database 1' + ), + array( + 'path'=> 'database2.sqlite', + 'name'=> 'Database 2' + ), +); + + +/* ---- Interface settings ---- */ + +// Theme! If you want to change theme, save the CSS file in same folder of phpliteadmin or in folder "themes" +$theme = 'phpliteadmin.css'; + +// the default language! If you want to change it, save the language file in same folder of phpliteadmin or in folder "languages" +// More about localizations (downloads, how to translate etc.): https://bitbucket.org/phpliteadmin/public/wiki/Localization +$language = 'en'; + +// set default number of rows. You need to relog after changing the number +$rowsNum = 30; + +// reduce string characters by a number bigger than 10 +$charsNum = 300; + +// maximum number of SQL queries to save in the history +$maxSavedQueries = 10; + +/* ---- Custom functions ---- */ + +//a list of custom functions that can be applied to columns in the databases +//make sure to define every function below if it is not a core PHP function +$custom_functions = array( + 'md5', 'sha1', 'strtotime', + // add the names of your custom functions to this array + /* 'leet_text', */ +); + +// define your custom functions here +/* +function leet_text($value) +{ + return strtr($value, 'eaAsSOl', '344zZ01'); +} +*/ + + +/* ---- Advanced options ---- */ + +//changing the following variable allows multiple phpLiteAdmin installs to work under the same domain. +$cookie_name = 'pla3412'; + +//whether or not to put the app in debug mode where errors are outputted +$debug = false; + +// the user is allowed to create databases with only these extensions +$allowed_extensions = array('db','db3','sqlite','sqlite3'); + +// BLOBs are displayed and edited as hex string +$hexblobs = false; + +// English language-texts. +// Read our wiki on how to translate: https://bitbucket.org/phpliteadmin/public/wiki/Localization +$lang = array( + "direction" => "LTR", + "date_format" => 'g:ia \o\n F j, Y (T)', // see http://php.net/manual/en/function.date.php for what the letters stand for + "ver" => "version", + "for" => "for", + "to" => "to", + "go" => "Go", + "yes" => "Yes", + "no" => "No", + "sql" => "SQL", + "csv" => "CSV", + "csv_tbl" => "Table that CSV pertains to", + "srch" => "Search", + "srch_again" => "Do Another Search", + "login" => "Log In", + "logout" => "Logout", + "view" => "View", // here, the noun SQL view is meant, not the verb "to view" + "confirm" => "Confirm", + "cancel" => "Cancel", + "save_as" => "Save As", + "options" => "Options", + "no_opt" => "No options", + "help" => "Help", + "installed" => "installed", + "not_installed" => "not installed", + "done" => "done", + "insert" => "Insert", + "export" => "Export", + "import" => "Import", + "rename" => "Rename", + "empty" => "Empty", + "drop" => "Drop", + "tbl" => "Table", + "chart" => "Chart", + "err" => "ERROR", + "act" => "Action", + "rec" => "Records", + "col" => "Column", + "cols" => "Columns", + "rows" => "row(s)", + "edit" => "Edit", + "del" => "Delete", + "add" => "Add", + "backup" => "Backup database file", + "before" => "Before", + "after" => "After", + "passwd" => "Password", + "passwd_incorrect" => "Incorrect password.", + "chk_ext" => "Checking supported SQLite PHP extensions", + "autoincrement" => "Autoincrement", + "not_null" => "Not NULL", + "attention" => "Attention", + "none" => "None", + "as_defined" => "As defined", + "expression" => "Expression", + "download" => "Download", + "open_in_browser" => "Open in browser", + + "sqlite_ext" => "SQLite extension", + "sqlite_ext_support" => "It appears that none of the supported SQLite library extensions are available in your installation of PHP. You may not use %s until you install at least one of them.", + "sqlite_v" => "SQLite version", + "sqlite_v_error" => "It appears that your database is of SQLite version %s but your installation of PHP does not contain the necessary extensions to handle this version. To fix the problem, either delete the database and allow %s to create it automatically or recreate it manually as SQLite version %s.", + "report_issue" => "The problem cannot be diagnosed properly. Please file an issue report at", + "sqlite_limit" => "Due to the limitations of SQLite, only the field name and data type can be modified.", + + "php_v" => "PHP version", + "new_version" => "There is a new version!", + + "db_dump" => "database dump", + "db_f" => "database file", + "db_ch" => "Change Database", + "db_event" => "Database Event", + "db_name" => "Database name", + "db_rename" => "Rename Database", + "db_renamed" => "Database '%s' has been renamed to", + "db_del" => "Delete Database", + "db_path" => "Path to database", + "db_size" => "Size of database", + "db_mod" => "Database last modified", + "db_create" => "Create New Database", + "db_vac" => "The database, '%s', has been VACUUMed.", + "db_not_writeable" => "The database, '%s', does not exist and cannot be created because the containing directory, '%s', is not writable. The application is unusable until you make it writable.", + "db_setup" => "There was a problem setting up your database, %s. An attempt will be made to find out what's going on so you can fix the problem more easily", + "db_exists" => "A database, other file or directory of the name '%s' already exists.", + "db_blank" => "The database name cannot be blank.", + + "exported" => "Exported", + "struct" => "Structure", + "struct_for" => "structure for", + "on_tbl" => "on table", + "data_dump" => "Data dump for", + "backup_hint" => "Hint: To backup your database, the easiest way is to %s.", + "backup_hint_linktext" => "download the database-file", + "total_rows" => "a total of %s rows", + "total" => "Total", + "not_dir" => "The directory you specified to scan for databases does not exist or is not a directory.", + "bad_php_directive" => "It appears that the PHP directive, 'register_globals' is enabled. This is bad. You need to disable it before continuing.", + "page_gen" => "Page generated in %s seconds.", + "powered" => "Powered by", + "free_software" => "This is free software.", + "please_donate" => "Please donate.", + "remember" => "Remember me", + "no_db" => "Welcome to %s. It appears that you have selected to scan a directory for databases to manage. However, %s could not find any valid SQLite databases. You may use the form below to create your first database.", + "no_db2" => "The directory you specified does not contain any existing databases to manage, and the directory is not writable. This means you can't create any new databases using %s. Either make the directory writable or manually upload databases to the directory.", + "dir_not_executable" => "The directory you specified cannot be scanned for databases as %s has no execute permissions on it. On Linux, use 'chmod +x %s' to fix this.", + "filesystem_permission_denied" => "Permission denied. Check file system permissions.", + + "create" => "Create", + "created" => "has been created", + "create_tbl" => "Create new table", + "create_tbl_db" => "Create new table on database", + "create_trigger" => "Creating new trigger on table", + "create_index" => "Creating new index on table", + "create_index1" => "Create Index", + "create_view" => "Create new view on database", + + "trigger" => "Trigger", + "triggers" => "Triggers", + "trigger_name" => "Trigger name", + "trigger_act" => "Trigger Action", + "trigger_step" => "Trigger Steps (semicolon terminated)", + "when_exp" => "WHEN expression (type expression without 'WHEN')", + "index" => "Index", + "indexes" => "Indexes", + "index_name" => "Index name", + "name" => "Name", + "unique" => "Unique", + "seq_no" => "Seq. No.", + "emptied" => "has been emptied", + "dropped" => "has been dropped", + "renamed" => "has been renamed to", + "altered" => "has been altered successfully", + "inserted" => "inserted", + "deleted" => "deleted", + "affected" => "affected", + "blank_index" => "Index name must not be blank.", + "one_index" => "You must specify at least one index column.", + "docu" => "Documentation", + "license" => "License", + "proj_site" => "Project Site", + "bug_report" => "This may be a bug that needs to be reported at", + "return" => "Return", + "browse" => "Browse", + "fld" => "Field", + "fld_num" => "Number of Fields", + "fields" => "Fields", + "type" => "Type", + "operator" => "Operator", + "val" => "Value", + "update" => "Update", + "comments" => "Comments", + + "specify_fields" => "You must specify the number of table fields.", + "specify_tbl" => "You must specify a table name.", + "specify_col" => "You must specify a column.", + + "tbl_exists" => "Table of the same name already exists.", + "show" => "Show", + "show_rows" => "Showing %s row(s). ", + "showing" => "Showing", + "showing_rows" => "Showing rows", + "query_time" => "(Query took %s sec)", + "syntax_err" => "There is a problem with the syntax of your query (Query was not executed)", + "run_sql" => "Run SQL query/queries on database '%s'", + "recent_queries" => "Recent Queries", + "full_texts" => "Show full texts", + "no_full_texts" => "Shorten long texts", + + "ques_table_empty" => "Are you sure you want to empty the table(s) '%s'?", + "ques_table_drop" => "Are you sure you want to drop the table(s) / view(s) '%s'?", + "ques_row_delete" => "Are you sure you want to delete row(s) %s from table '%s'?", + "ques_database_delete" => "Are you sure you want to delete the database '%s'?", + "ques_column_delete" => "Are you sure you want to delete column(s) %s from table '%s'?", + "ques_index_delete" => "Are you sure you want to delete index '%s'?", + "ques_trigger_delete" => "Are you sure you want to delete trigger '%s'?", + "ques_primarykey_add" => "Are you sure you want to add a primary key for the column(s) %s in table '%s'?", + + "export_struct" => "Export with structure", + "export_data" => "Export with data", + "add_drop" => "Add DROP TABLE", + "add_transact" => "Add TRANSACTION", + "fld_terminated" => "Fields terminated by", + "fld_enclosed" => "Fields enclosed by", + "fld_escaped" => "Fields escaped by", + "fld_names" => "Field names in first row", + "rep_null" => "Replace NULL by", + "rem_crlf" => "Remove CRLF characters within fields", + "put_fld" => "Put field names in first row", + "null_represent" => "NULL represented by", + "import_suc" => "Import was successful.", + "import_into" => "Import into", + "import_f" => "File to import", + "max_file_size" => "Maximum file size", + "rename_tbl" => "Rename table '%s' to", + + "rows_records" => "row(s) starting from record # ", + "rows_aff" => "row(s) affected. ", + + "as_a" => "as a", + "readonly_tbl" => "'%s' is a view, which means it is a SELECT statement treated as a read-only table. You may not edit or insert records.", + "chk_all" => "Check All", + "unchk_all" => "Uncheck All", + "with_sel" => "With Selected", + + "no_tbl" => "No table in database.", + "no_chart" => "If you can read this, it means the chart could not be generated. The data you are trying to view may not be appropriate for a chart.", + "no_rows" => "There are no rows in the table for the range you selected.", + "no_sel" => "You did not select anything.", + + "chart_type" => "Chart Type", + "chart_bar" => "Bar Chart", + "chart_pie" => "Pie Chart", + "chart_line" => "Line Chart", + "lbl" => "Labels", + "empty_tbl" => "This table is empty.", + "click" => "Click here", + "insert_rows" => "to insert rows.", + "restart_insert" => "Restart insertion with ", + "ignore" => "Ignore", + "func" => "Function", + "new_insert" => "Insert As New Row", + "save_ch" => "Save Changes", + "def_val" => "Default Value", + "prim_key" => "Primary Key", + "tbl_end" => "field(s) at end of table", + "query_used_table" => "Query used to create this table", + "query_used_view" => "Query used to create this view", + "create_index2" => "Create an index on", + "create_trigger2" => "Create a new trigger", + "new_fld" => "Adding new field(s) to table '%s'", + "add_flds" => "Add Fields", + "edit_col" => "Editing column '%s'", + "vac" => "Vacuum", + "vac_desc" => "Large databases sometimes need to be VACUUMed to reduce their footprint on the server. Click the button below to VACUUM the database '%s'.", + "vac_on_empty"=>"Rebuild database file to recover unused space (Vacuum)", + "event" => "Event", + "each_row" => "For Each Row", + "define_index" => "Define index properties", + "dup_val" => "Duplicate values", + "allow" => "Allowed", + "not_allow" => "Not Allowed", + "asc" => "Ascending", + "desc" => "Descending", + "warn0" => "You have been warned.", + "warn_passwd" => "You are using the default password, which can be dangerous. You can change it easily at the top of %s.", + "warn_mbstring" =>"The mbstring extension is not installed or not enabled in your PHP. As long as you stick to ASCII characters, everything will work, but you may experience strange bugs with multibyte characters. Better install and enable mbstring!", + "counting_skipped" => "Counting of records has been skipped for some tables because your database is comparably big and some tables don't have primary keys assigned to them so counting might be slow. Add a primary key to these tables or %sforce counting%s.", + "sel_state" => "Select Statement", + "delimit" => "Delimiter", + "back_top" => "Back to Top", + "choose_f" => "Choose File", + "instead" => "Instead of", + "define_in_col" => "Define index column(s)", + + "delete_only_managed" => "You can only delete databases managed by this tool!", + "rename_only_managed" => "You can only rename databases managed by this tool!", + "db_moved_outside" => "You either tried to move the database into a directory where it cannot be managed anylonger, or the check if you did this failed because of missing rights.", + "extension_not_allowed" => "The extension you provided is not within the list of allowed extensions. Please use one of the following extensions", + "add_allowed_extension" => "You can add extensions to this list by adding your extension to \$allowed_extensions in the configuration.", + "database_not_writable" => "The database-file is not writable, so its content cannot be changed in any way.", + "directory_not_writable" => "The database-file itself is writable, but to write into it, the containing directory needs to be writable as well. This is because SQLite puts temporary files in there for locking.", + "tbl_inexistent" => "Table %s does not exist", + "col_inexistent" => "Column %s does not exist", + + // errors that can happen when ALTER TABLE fails. You don't necessarily have to translate these. + "alter_failed" => "Altering of Table %s failed", + "alter_tbl_name_not_replacable" => "could not replace the table name with the temporary one", + "alter_no_def" => "no ALTER definition", + "alter_parse_failed" =>"failed to parse ALTER definition", + "alter_action_not_recognized" => "ALTER action could not be recognized", + "alter_no_add_col" => "no column to add detected in ALTER statement", + "alter_pattern_mismatch"=>"Pattern did not match on your original CREATE TABLE statement", + "alter_col_not_recognized" => "could not recognize new or old column name", + "alter_unknown_operation" => "Unknown ALTER operation!", + + /* Help documentation */ + "help_doc" => "Help Documentation", + "help1" => "SQLite Library Extensions", + "help1_x" => "%s uses PHP library extensions that allow interaction with SQLite databases. Currently, %s supports PDO, SQLite3, and SQLiteDatabase. Both PDO and SQLite3 deal with version 3 of SQLite, while SQLiteDatabase deals with version 2. So, if your PHP installation includes more than one SQLite library extension, PDO and SQLite3 will take precedence to make use of the better technology. However, if you have existing databases that are of version 2 of SQLite, %s will be forced to use SQLiteDatabase for only those databases. Not all databases need to be of the same version. During the database creation, however, the most advanced extension will be used.", + "help2" => "Creating a New Database", + "help2_x" => "When you create a new database, the name you entered will be appended with the appropriate file extension (.db, .db3, .sqlite, etc.) if you do not include it yourself. The database will be created in the directory you specified as the \$directory variable.", + "help3" => "Tables vs. Views", + "help3_x" => "On the main database page, there is a list of tables and views. Since views are read-only, certain operations will be disabled. These disabled operations will be apparent by their omission in the location where they should appear on the row for a view. If you want to change the data for a view, you need to drop that view and create a new view with the appropriate SELECT statement that queries other existing tables. For more information, see http://en.wikipedia.org/wiki/View_(database)", + "help4" => "Writing a Select Statement for a New View", + "help4_x" => "When you create a new view, you must write an SQL SELECT statement that it will use as its data. A view is simply a read-only table that can be accessed and queried like a regular table, except it cannot be modified through insertion, column editing, or row editing. It is only used for conveniently fetching data.", + "help5" => "Export Structure to SQL File", + "help5_x" => "During the process for exporting to an SQL file, you may choose to include the queries that create the table and columns.", + "help6" => "Export Data to SQL File", + "help6_x" => "During the process for exporting to an SQL file, you may choose to include the queries that populate the table(s) with the current records of the table(s).", + "help7" => "Add Drop Table to Exported SQL File", + "help7_x" => "During the process for exporting to an SQL file, you may choose to include queries to DROP the existing tables before adding them so that problems do not occur when trying to create tables that already exist.", + "help8" => "Add Transaction to Exported SQL File", + "help8_x" => "During the process for exporting to an SQL file, you may choose to wrap the queries around a TRANSACTION so that if an error occurs at any time during the importation process using the exported file, the database can be reverted to its previous state, preventing partially updated data from populating the database.", + "help9" => "Add Comments to Exported SQL File", + "help9_x" => "During the process for exporting to an SQL file, you may choose to include comments that explain each step of the process so that a human can better understand what is happening.", + "help10" => "Partial Indexes", + "help10_x" => "Partial indexes are indexes over a subset of the rows of a table specified by a WHERE clause. Note this requires at least SQLite 3.8.0 and database files with partial indexes won't be readable or writable by older versions. See the SQLite documentation.", + "help11" => "Maximum size of file uploads", + "help11_x" => "The maximum size of file uploads is determined by three PHP settings: upload_max_filesize, post_max_size and memory_limit. The smallest of these three limits the maximum size for file uploads. To upload larger files, adjust these values in your php.ini file." + +); + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// there is no reason for the average user to edit anything below this comment +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +// Authorization class +// Maintains user's logged-in state and security of application +// + +class Authorization +{ + private $authorized; + private $login_failed; + private $system_password_encrypted; + + public function __construct() + { + // first, make sure a CSRF token is generated + $this->generateToken(); + // second, check for possible CSRF attacks. to protect logins, this is done before checking login + $this->checkToken(); + + // the salt and password encrypting is probably unnecessary protection but is done just + // for the sake of being very secure + if(!isset($_SESSION[COOKIENAME.'_salt']) && !isset($_COOKIE[COOKIENAME.'_salt'])) + { + // create a random salt for this session if a cookie doesn't already exist for it + $_SESSION[COOKIENAME.'_salt'] = self::generateSalt(22); + } + else if(!isset($_SESSION[COOKIENAME.'_salt']) && isset($_COOKIE[COOKIENAME.'_salt'])) + { + // session doesn't exist, but cookie does so grab it + $_SESSION[COOKIENAME.'_salt'] = $_COOKIE[COOKIENAME.'_salt']; + } + + // salted and encrypted password used for checking + $this->system_password_encrypted = md5(SYSTEMPASSWORD."_".$_SESSION[COOKIENAME.'_salt']); + + $this->authorized = + // no password + SYSTEMPASSWORD == '' + // correct password stored in session + || isset($_SESSION[COOKIENAME.'password']) && hash_equals($_SESSION[COOKIENAME.'password'], $this->system_password_encrypted) + // correct password stored in cookie + || isset($_COOKIE[COOKIENAME]) && isset($_COOKIE[COOKIENAME.'_salt']) && hash_equals(md5(SYSTEMPASSWORD."_".$_COOKIE[COOKIENAME.'_salt']), $_COOKIE[COOKIENAME]); + } + + public function attemptGrant($password, $remember) + { + $hashed_password = crypt(SYSTEMPASSWORD, '$2a$07$'.self::generateSalt(22).'$'); + if (hash_equals($hashed_password, crypt($password, $hashed_password))) { + if ($remember) { + // user wants to be remembered, so set a cookie + $expire = time()+60*60*24*30; //set expiration to 1 month from now + setcookie(COOKIENAME, $this->system_password_encrypted, $expire, null, null, null, true); + setcookie(COOKIENAME."_salt", $_SESSION[COOKIENAME.'_salt'], $expire, null, null, null, true); + } else { + // user does not want to be remembered, so destroy any potential cookies + setcookie(COOKIENAME, "", time()-86400, null, null, null, true); + setcookie(COOKIENAME."_salt", "", time()-86400, null, null, null, true); + unset($_COOKIE[COOKIENAME]); + unset($_COOKIE[COOKIENAME.'_salt']); + } + + $_SESSION[COOKIENAME.'password'] = $this->system_password_encrypted; + $this->authorized = true; + return true; + } + + $this->login_failed = true; + return false; + } + + public function revoke() + { + //destroy everything - cookies and session vars + setcookie(COOKIENAME, "", time()-86400, null, null, null, true); + setcookie(COOKIENAME."_salt", "", time()-86400, null, null, null, true); + unset($_COOKIE[COOKIENAME]); + unset($_COOKIE[COOKIENAME.'_salt']); + session_unset(); + session_destroy(); + $this->authorized = false; + // start a new session and generate a new CSRF token for the login form + session_start(); + $this->generateToken(); + } + + public function isAuthorized() + { + return $this->authorized; + } + + public function isFailedLogin() + { + return $this->login_failed; + } + + public function isPasswordDefault() + { + return SYSTEMPASSWORD == 'admin'; + } + + private static function generateSalt($saltSize) + { + $set = 'ABCDEFGHiJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + $setLast = strlen($set) - 1; + $salt = ''; + while ($saltSize-- > 0) { + $salt .= $set[mt_rand(0, $setLast)]; + } + return $salt; + } + + private function generateToken() + { + // generate CSRF token + if (empty($_SESSION[COOKIENAME.'token'])) + { + if (function_exists('random_bytes')) // introduced in PHP 7.0 + { + $_SESSION[COOKIENAME.'token'] = bin2hex(random_bytes(32)); + } + elseif (function_exists('openssl_random_pseudo_bytes')) // introduced in PHP 5.3.0 + { + $_SESSION[COOKIENAME.'token'] = bin2hex(openssl_random_pseudo_bytes(32)); + } + else + { + // For PHP 5.2.x - This case can be removed once we drop support for 5.2.x + $_SESSION[COOKIENAME.'token'] = bin2hex(mcrypt_create_iv(32, MCRYPT_DEV_URANDOM)); + } + } + } + + private function checkToken() + { + // checking CSRF token + if($_SERVER['REQUEST_METHOD'] === 'POST' || isset($_GET['download'])) // all POST forms need tokens! downloads are protected as well + { + if($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['token'])) + $check_token=$_POST['token']; + elseif($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['token'])) + $check_token=$_GET['token']; + + if (!isset($check_token)) + { + die("CSRF token missing"); + } + elseif(!hash_equals($_SESSION[COOKIENAME.'token'], $check_token)) + { + die("CSRF token is wrong - please try to login again"); + } + } + } + +} +// Database class +// Generic database abstraction class to manage interaction with database without worrying about SQLite vs. PHP versions +// +class Database +{ + protected $db; //reference to the DB object + protected $type; //the extension for PHP that handles SQLite + protected $data; + protected $lastResult; + protected $alterError; + protected $debugOutput =''; + + public function __construct($data) + { + global $lang, $params; + $this->data = $data; + try + { + if(!file_exists($this->data["path"]) && !is_writable(dirname($this->data["path"]))) //make sure the containing directory is writable if the database does not exist + { + echo "
      "; + printf($lang['db_not_writeable'], htmlencode($this->data["path"]), htmlencode(dirname($this->data["path"]))); + echo $params->getForm(); + echo ""; + echo ""; + echo "

      "; + exit(); + } + + $ver = $this->getVersion(); + + switch(true) + { + case ((!isset($data['type']) || $data['type']!=2) && (FORCETYPE=="PDO" || (FORCETYPE==false && class_exists("PDO") && in_array("sqlite", PDO::getAvailableDrivers()) && ($ver==-1 || $ver==3)))): + $this->db = new PDO("sqlite:".$this->data['path']); + if($this->db!=NULL) + { + $this->type = "PDO"; + break; + } + case ((!isset($data['type']) || $data['type']!=2) && (FORCETYPE=="SQLite3" || (FORCETYPE==false && class_exists("SQLite3") && ($ver==-1 || $ver==3)))): + $this->db = new SQLite3($this->data['path']); + if($this->db!=NULL) + { + $this->type = "SQLite3"; + break; + } + case (FORCETYPE=="SQLiteDatabase" || (FORCETYPE==false && class_exists("SQLiteDatabase") && ($ver==-1 || $ver==2))): + $this->db = new SQLiteDatabase($this->data['path']); + if($this->db!=NULL) + { + $this->type = "SQLiteDatabase"; + break; + } + default: + $this->showError(); + exit(); + } + $this->query("PRAGMA foreign_keys = ON"); + } + catch(Exception $e) + { + $this->showError(); + exit(); + } + } + + public function registerUserFunction($ids) + { + // in case a single function id was passed + if (is_string($ids)) + $ids = array($ids); + + if ($this->type == 'PDO') { + foreach ($ids as $id) { + $this->db->sqliteCreateFunction($id, $id, -1); + } + } else { // type is Sqlite3 or SQLiteDatabase + foreach ($ids as $id) { + $this->db->createFunction($id, $id, -1); + } + } + } + + public function getError($complete_msg = false) + { + global $lang, $debug; + $error = "unknown"; + + if($this->alterError!='') + { + $error = $this->alterError; + $this->alterError = ""; + } + else if($this->type=="PDO") + { + $e = $this->db->errorInfo(); + $error = $e[2]; + } + else if($this->type=="SQLite3") + { + $error = $this->db->lastErrorMsg(); + } + else + { + $error = sqlite_error_string($this->db->lastError()); + } + + if($complete_msg) + { + $error = $lang['err'].": ".htmlencode($error); + // do not suggest to report a bug when constraints fail + if(strpos($error, 'constraint failed')===false) + $error.="
      ".$lang['bug_report'].' '.PROJECT_BUGTRACKER_LINK; + } + + if($debug) + $error .= $this->getDebugOutput(); + + return $error; + } + + function getDebugOutput() + { + return ($this->debugOutput != "" ? "
      DEBUG:
      ".$this->debugOutput : $this->debugOutput); + } + + public function showError() + { + global $lang; + $classPDO = class_exists("PDO"); + $classSQLite3 = class_exists("SQLite3"); + $classSQLiteDatabase = class_exists("SQLiteDatabase"); + if($classPDO) // PDO is there, check if the SQLite driver for PDO is missing + $PDOSqliteDriver = (in_array("sqlite", PDO::getAvailableDrivers() )); + else + $PDOSqliteDriver = false; + echo "
      "; + printf($lang['db_setup'], $this->getPath()); + echo ".

      ".$lang['chk_ext']."...

      "; + echo "PDO: ".($classPDO ? $lang['installed'] : $lang['not_installed'])."
      "; + echo "PDO SQLite Driver: ".($PDOSqliteDriver ? $lang['installed'] : $lang['not_installed'])."
      "; + echo "SQLite3: ".($classSQLite3 ? $lang['installed'] : $lang['not_installed'])."
      "; + echo "SQLiteDatabase: ".($classSQLiteDatabase ? $lang['installed'] : $lang['not_installed'])."
      "; + echo "
      ...".$lang['done'].".


      "; + if(!$classPDO && !$classSQLite3 && !$classSQLiteDatabase) + printf($lang['sqlite_ext_support'], PROJECT); + else + { + if(!$PDOSqliteDriver && !$classSQLite3 && $this->getVersion()==3) + printf($lang['sqlite_v_error'], 3, PROJECT, 2); + else if(!$classSQLiteDatabase && $this->getVersion()==2) + printf($lang['sqlite_v_error'], 2, PROJECT, 3); + else + { + if(!file_exists($this->getPath())) + { + if(touch($this->getPath())) + { + echo $lang['report_issue'].' '.PROJECT_BUGTRACKER_LINK.'.'; + } + else + { + echo "".$lang['filesystem_permission_denied'].""; + } + } + } + } + echo "

      See ".PROJECT_INSTALL_LINK." for help.

      "; + + $this->print_db_list(); + + echo "
      "; + } + + // print the list of databases + public function print_db_list() + { + global $databases, $lang, $params, $currentDB; + echo "
      ".$lang['db_ch'].""; + if(sizeof($databases)<10) //if there aren't a lot of databases, just show them as a list of links instead of drop down menu + { + $i=0; + foreach($databases as $database) + { + $i++; + $name = $database['name']; + if(mb_strlen($name)>25) + $name = "...".mb_substr($name, mb_strlen($name)-22, 22); + echo '[' . ($database['readable'] ? 'r':' ' ) . ($database['writable'] && $database['writable_dir'] ? 'w':' ' ) . '] '; + + echo $params->getLink(array('database'=>$database['path'], 'table'=>null), htmlencode($name), ($database == $currentDB? 'active_db': '') ); + echo "  "; + echo $params->getLink(array('download'=>$database['path'], 'table'=>null, 'token'=>$_SESSION[COOKIENAME.'token']), '[↓]', '', $lang['backup']); + + if($i"; + } + } + else //there are a lot of databases - show a drop down menu + { + echo $params->getForm(array('table'=>null), 'get'); + echo ""; + echo ""; + echo ""; + } + echo "
      "; + } + + public function __destruct() + { + if($this->db) + $this->close(); + } + + //get the exact PHP extension being used for SQLite + public function getType() + { + return $this->type; + } + + // get the version of the SQLite library + public function getSQLiteVersion() + { + $queryVersion = $this->select("SELECT sqlite_version() AS sqlite_version"); + return $queryVersion['sqlite_version']; + } + + //get the name of the database + public function getName() + { + return $this->data["name"]; + } + + //get the filename of the database + public function getPath() + { + return $this->data["path"]; + } + + //is the db-file writable? + public function isWritable() + { + return $this->data["writable"]; + } + + //is the db-folder writable? + public function isDirWritable() + { + return $this->data["writable_dir"]; + } + + //get the version of the database + public function getVersion() + { + if(file_exists($this->data['path'])) //make sure file exists before getting its contents + { + $content = strtolower(file_get_contents($this->data['path'], NULL, NULL, 0, 40)); //get the first 40 characters of the database file + $p = strpos($content, "** this file contains an sqlite 2"); //this text is at the beginning of every SQLite2 database + if($p!==false) //the text is found - this is version 2 + return 2; + else + return 3; + } + else //return -1 to indicate that it does not exist and needs to be created + { + return -1; + } + } + + //get the size of the database (in KiB) + public function getSize() + { + return round(filesize($this->data["path"])*0.0009765625, 1); + } + + //get the last modified time of database + public function getDate() + { + global $lang; + return date($lang['date_format'], filemtime($this->data['path'])); + } + + //get number of affected rows from last query + public function getAffectedRows() + { + if($this->type=="PDO") + if(!is_object($this->lastResult)) + // in case it was an alter table statement, there is no lastResult object + return 0; + else + return $this->lastResult->rowCount(); + else if($this->type=="SQLite3") + return $this->db->changes(); + else if($this->type=="SQLiteDatabase") + return $this->db->changes(); + } + + public function getTypeOfTable($table) + { + $result = $this->select("SELECT `type` FROM `sqlite_master` WHERE `name`=" . $this->quote($table), 'assoc'); + return $result['type']; + } + + public function getTableInfo($table) + { + return $this->selectArray("PRAGMA table_info(".$this->quote_id($table).")"); + } + + // returns the list of tables (opt. incl. views) as + // array( Tablename => tableType ) with tableType being 'view' or 'table' + public function getTables($alsoViews=true, $alsoInternal=false, $orderBy='name', $orderDirection='ASC') + { + $query = "SELECT name, type FROM sqlite_master " + . "WHERE (type='table'".($alsoViews?" OR type='view'":"").") " + . "AND name!='' ".($alsoInternal? "":" AND name NOT LIKE 'sqlite_%' ") + . "ORDER BY ".$this->quote_id($orderBy)." ".$orderDirection; + $result = $this->selectArray($query); + $list = array(); + for($i=0; $i array(columName) ) + public function getTableDefinitions() + { + $tables = $this->getTables(true, true); + $result = array(); + foreach ($tables as $tableName => $tableType) + { + $tableInfo = $this->getTableInfo($tableName); + $columns = array(); + foreach($tableInfo as $column) + $columns[] = $column['name']; + $result[$tableName] = $columns; + } + return $result; + } + + public function close() + { + if($this->type=="PDO") + $this->db = NULL; + else if($this->type=="SQLite3") + $this->db->close(); + else if($this->type=="SQLiteDatabase") + $this->db = NULL; + } + + public function beginTransaction() + { + $this->query("BEGIN"); + } + + public function commitTransaction() + { + $this->query("COMMIT"); + } + + public function rollbackTransaction() + { + $this->query("ROLLBACK"); + } + + //generic query wrapper + //returns false on error and the query result on success + public function query($query, $ignoreAlterCase=false) + { + global $debug; + if(strtolower(substr(ltrim($query),0,5))=='alter' && $ignoreAlterCase==false) //this query is an ALTER query - call the necessary function + { + preg_match("/^\s*ALTER\s+TABLE\s+(".$this->sqlite_surroundings_preg("+",false,",' \"\[`").")\s+(.*)$/i",$query,$matches); + if(!isset($matches[1]) || !isset($matches[2])) + { + if($debug) echo "SQL?
      "; + return false; + } + $tablename = $this->sqliteUnquote($matches[1]); + $alterdefs = $matches[2]; + if($debug) echo "ALTER TABLE QUERY=(".htmlencode($query)."), tablename=($tablename), alterdefs=($alterdefs)
      "; + $result = $this->alterTable($tablename, $alterdefs); + } + else //this query is normal - proceed as normal + { + $result = $this->db->query($query); + if($debug) echo "SQL?
      "; + } + if($result===false) + return false; + $this->lastResult = $result; + return $result; + } + + //wrapper for an INSERT and returns the ID of the inserted row + public function insert($query) + { + $result = $this->query($query); + if($this->type=="PDO") + return $this->db->lastInsertId(); + else if($this->type=="SQLite3") + return $this->db->lastInsertRowID(); + else if($this->type=="SQLiteDatabase") + return $this->db->lastInsertRowid(); + } + + //returns an array for SELECT + public function select($query, $mode="both") + { + $result = $this->query($query); + if(!$result) //make sure the result is valid + return NULL; + if($this->type=="PDO") + { + if($mode=="assoc") + $mode = PDO::FETCH_ASSOC; + else if($mode=="num") + $mode = PDO::FETCH_NUM; + else + $mode = PDO::FETCH_BOTH; + $ret = $result->fetch($mode); + $result->closeCursor(); + return $ret; + } + else if($this->type=="SQLite3") + { + if($mode=="assoc") + $mode = SQLITE3_ASSOC; + else if($mode=="num") + $mode = SQLITE3_NUM; + else + $mode = SQLITE3_BOTH; + $ret = $result->fetchArray($mode); + $result->finalize(); + return $ret; + } + else if($this->type=="SQLiteDatabase") + { + if($mode=="assoc") + $mode = SQLITE_ASSOC; + else if($mode=="num") + $mode = SQLITE_NUM; + else + $mode = SQLITE_BOTH; + return $result->fetch($mode); + } + } + + //returns an array of arrays after doing a SELECT + public function selectArray($query, $mode="both") + { + $result = $this->query($query); + //make sure the result is valid + if($result=== false || $result===NULL) + return NULL; // error + if(!is_object($result)) // no rows returned + return array(); + if($this->type=="PDO") + { + if($mode=="assoc") + $mode = PDO::FETCH_ASSOC; + else if($mode=="num") + $mode = PDO::FETCH_NUM; + else + $mode = PDO::FETCH_BOTH; + $ret = $result->fetchAll($mode); + $result->closeCursor(); + return $ret; + } + else if($this->type=="SQLite3") + { + if($mode=="assoc") + $mode = SQLITE3_ASSOC; + else if($mode=="num") + $mode = SQLITE3_NUM; + else + $mode = SQLITE3_BOTH; + $arr = array(); + $i = 0; + while($res = $result->fetchArray($mode)) + { + $arr[$i] = $res; + $i++; + } + $result->finalize(); + return $arr; + } + else if($this->type=="SQLiteDatabase") + { + if($mode=="assoc") + $mode = SQLITE_ASSOC; + else if($mode=="num") + $mode = SQLITE_NUM; + else + $mode = SQLITE_BOTH; + return $result->fetchAll($mode); + } + } + + //returns an array of the next row in $result + public function fetch($result, $mode="both") + { + //make sure the result is valid + if($result=== false || $result===NULL) + return NULL; // error + if(!is_object($result)) // no rows returned + return array(); + if($this->type=="PDO") + { + if($mode=="assoc") + $mode = PDO::FETCH_ASSOC; + else if($mode=="num") + $mode = PDO::FETCH_NUM; + else + $mode = PDO::FETCH_BOTH; + return $result->fetch($mode); + } + else if($this->type=="SQLite3") + { + if($result->numColumns() === 0) { + return array(); + } + if($mode=="assoc") + $mode = SQLITE3_ASSOC; + else if($mode=="num") + $mode = SQLITE3_NUM; + else + $mode = SQLITE3_BOTH; + return $result->fetchArray($mode); + } + else if($this->type=="SQLiteDatabase") + { + if($mode=="assoc") + $mode = SQLITE_ASSOC; + else if($mode=="num") + $mode = SQLITE_NUM; + else + $mode = SQLITE_BOTH; + return $result->fetch($mode); + } + } + + public function getColumnName($result, $colNum) + { + //make sure the result is valid + if($result=== false || $result===NULL || !is_object($result)) + return ""; // error or no rows returned + if($this->type=="PDO") + { + $meta = $result->getColumnMeta($colNum); + return $meta['name']; + } + else if($this->type=="SQLite3") + { + return $result->columnName($colNum); + } + else if($this->type=="SQLiteDatabase") + { + return $result->fieldName($colNum); + } + } + + + // SQlite supports multiple ways of surrounding names in quotes: + // single-quotes, double-quotes, backticks, square brackets. + // As sqlite does not keep this strict, we also need to be flexible here. + // This function generates a regex that matches any of the possibilities. + private function sqlite_surroundings_preg($name,$preg_quote=true,$notAllowedCharsIfNone="'\"",$notAllowedName=false) + { + if($name=="*" || $name=="+") + { + if($notAllowedName!==false && $preg_quote) + $notAllowedName = preg_quote($notAllowedName,"/"); + // use possesive quantifiers to save memory + // (There is a bug in PCRE starting in 8.13 and fixed in PCRE 8.36 + // why we can't use posesive quantifiers - See issue #310). + if(version_compare(strstr(constant('PCRE_VERSION'), ' ', true), '8.36', '>=') || + version_compare(strstr(constant('PCRE_VERSION'), ' ', true), '8.12', '<=')) + $posessive='+'; + else + $posessive=''; + + $nameSingle = ($notAllowedName!==false?"(?!".$notAllowedName."')":"")."(?:[^']$name+|'')$name".$posessive; + $nameDouble = ($notAllowedName!==false?"(?!".$notAllowedName."\")":"")."(?:[^\"]$name+|\"\")$name".$posessive; + $nameBacktick = ($notAllowedName!==false?"(?!".$notAllowedName."`)":"")."(?:[^`]$name+|``)$name".$posessive; + $nameSquare = ($notAllowedName!==false?"(?!".$notAllowedName."\])":"")."(?:[^\]]$name+|\]\])$name".$posessive; + $nameNo = ($notAllowedName!==false?"(?!".$notAllowedName."\s)":"")."[^".$notAllowedCharsIfNone."]$name"; + } + else + { + if($preg_quote) $name = preg_quote($name,"/"); + + $nameSingle = str_replace("'","''",$name); + $nameDouble = str_replace('"','""',$name); + $nameBacktick = str_replace('`','``',$name); + $nameSquare = str_replace(']',']]',$name); + $nameNo = $name; + } + + $preg = "(?:'".$nameSingle."'|". // single-quote surrounded or not in quotes (correct SQL for values/new names) + $nameNo."|". // not surrounded (correct SQL if not containing reserved words, spaces or some special chars) + "\"".$nameDouble."\"|". // double-quote surrounded (correct SQL for identifiers) + "`".$nameBacktick."`|". // backtick surrounded (MySQL-Style) + "\[".$nameSquare."\])"; // square-bracket surrounded (MS Access/SQL server-Style) + return $preg; + } + + private function sqliteUnquote($quotedName) + { + $firstChar = $quotedName[0]; + $withoutFirstAndLastChar = substr($quotedName,1,-1); + switch($firstChar) + { + case "'": + case '"': + case '`': + $name = str_replace($firstChar.$firstChar,$firstChar,$withoutFirstAndLastChar); + break; + case '[': + $name = str_replace("]]","]",$withoutFirstAndLastChar); + break; + default: + $name = $quotedName; + } + return $name; + } + + // Returns the last PREG error as a string, '' if no error occured + private function getPregError() + { + $error = preg_last_error(); + switch ($error) + { + case PREG_NO_ERROR: return 'No error'; + case PREG_INTERNAL_ERROR: return 'There is an internal error!'; + case PREG_BACKTRACK_LIMIT_ERROR: return 'Backtrack limit was exhausted!'; + case PREG_RECURSION_LIMIT_ERROR: return 'Recursion limit was exhausted!'; + case PREG_BAD_UTF8_ERROR: return 'Bad UTF8 error!'; + // PREG_BAD_UTF8_OFFSET_ERROR is introduced in PHP 5.3.0, which is not yet required by PLA, so we use its value 5 instead so long + case 5: return 'Bad UTF8 offset error!'; + default: return 'Unknown Error'; + } + } + + // function that is called for an alter table statement in a query + // code borrowed with permission from http://code.jenseng.com/db/ + // this has been completely debugged / rewritten by Christopher Kramer + public function alterTable($table, $alterdefs) + { + global $debug, $lang; + $this->alterError=""; + $errormsg = sprintf($lang['alter_failed'],htmlencode($table)).' - '; + if($debug) $this->debugOutput .= "ALTER TABLE: table=($table), alterdefs=($alterdefs), PCRE version=(".PCRE_VERSION.")

      "; + if($alterdefs != '') + { + $recreateQueries = array(); + $resultArr = $this->selectArray("SELECT sql,name,type FROM sqlite_master WHERE tbl_name = ".$this->quote($table)); + if(sizeof($resultArr)<1) + { + $this->alterError = $errormsg . sprintf($lang['tbl_inexistent'], htmlencode($table)); + if($debug) $this->debugOutput .= "ERROR: unknown table

      "; + return false; + } + for($i=0; $idebugOutput .= "recreate=(".$row['sql'].";)
      "; + } + } + elseif($row['type']=='view') // workaround to rename views + { + $origsql = $row['sql']; + $preg_remove_create_view = "/^\s*+CREATE\s++VIEW\s++".$this->sqlite_surroundings_preg($table)."\s*+(AS\s++SELECT\s++.*+)$/is"; + $origsql_no_create = preg_replace($preg_remove_create_view, '$1', $origsql, 1); + if($debug) $this->debugOutput .= "origsql=($origsql)
      preg_remove_create_table=($preg_remove_create_view)
      "; + preg_match("/RENAME\s++TO\s++(?:\"((?:[^\"]|\"\")+)\"|'((?:[^']|'')+)')/is", $alterdefs, $matches); + if(isset($matches[1]) && $matches[1]!='') + $newname = $matches[1]; + elseif(isset($matches[2]) && $matches[2]!='') + $newname = $matches[2]; + else + { + $this->alterError = $errormsg . ' could not detect new view name. It needs to be in single or double quotes.'; + if($debug) $this->debugOutput .= "ERROR: could not detect new view name
      "; + return false; + } + $dropoldSQL = 'DROP VIEW '.$this->quote_id($table); + $createnewSQL = 'CREATE VIEW '.$this->quote_id($newname).' '.$origsql_no_create; + $alter_transaction = 'BEGIN; ' . $dropoldSQL .'; '. $createnewSQL . '; ' . 'COMMIT;'; + if($debug) $this->debugOutput .= $alter_transaction; + return $this->multiQuery($alter_transaction); + } + else + { + // ALTER the table + $tmpname = 't'.time(); + $origsql = $row['sql']; + $preg_remove_create_table = "/^\s*+CREATE\s++TABLE\s++".$this->sqlite_surroundings_preg($table)."\s*+(\(.*+)$/is"; + $origsql_no_create = preg_replace($preg_remove_create_table, '$1', $origsql, 1); + if($debug) $this->debugOutput .= "origsql=($origsql)
      preg_remove_create_table=($preg_remove_create_table)
      "; + if($origsql_no_create == $origsql) + { + $this->alterError = $errormsg . $lang['alter_tbl_name_not_replacable']; + if($debug) $this->debugOutput .= "ERROR: could not get rid of CREATE TABLE
      "; + return false; + } + $createtemptableSQL = "CREATE TABLE ".$this->quote($tmpname)." ".$origsql_no_create; + if($debug) $this->debugOutput .= "createtemptableSQL=($createtemptableSQL)
      "; + $createindexsql = array(); + $preg_alter_part = "/(?:DROP(?! PRIMARY KEY)(?: COLUMN)?|ADD(?! PRIMARY KEY)(?: COLUMN)?|CHANGE(?: COLUMN)?|RENAME TO|ADD PRIMARY KEY|DROP PRIMARY KEY)" // the ALTER command + ."(?:" + ."\s+\(".$this->sqlite_surroundings_preg("+",false,"\"'\[`)")."+\)" // stuff in brackets (in case of ADD PRIMARY KEY) + ."|" // or + ."\s+".$this->sqlite_surroundings_preg("+",false,",'\"\[`") // column names and stuff like this + .")*/i"; + if($debug) + $this->debugOutput .= "preg_alter_part=(".$preg_alter_part.")
      "; + preg_match_all($preg_alter_part,$alterdefs,$matches); + $defs = $matches[0]; + + $result_oldcols = $this->getTableInfo($table); + $newcols = array(); + $coltypes = array(); + $primarykey = array(); + foreach($result_oldcols as $column_info) + { + $newcols[$column_info['name']] = $column_info['name']; + $coltypes[$column_info['name']] = $column_info['type']; + if($column_info['pk']) + $primarykey[] = $column_info['name']; + } + $newcolumns = ''; + $oldcolumns = ''; + reset($newcols); + foreach($newcols as $key => $val) + { + $newcolumns .= ($newcolumns?', ':'').$this->quote_id($val); + $oldcolumns .= ($oldcolumns?', ':'').$this->quote_id($key); + } + $copytotempsql = 'INSERT INTO '.$this->quote_id($tmpname).'('.$newcolumns.') SELECT '.$oldcolumns.' FROM '.$this->quote_id($table); + $dropoldsql = 'DROP TABLE '.$this->quote_id($table); + $createtesttableSQL = $createtemptableSQL; + if(count($defs)<1) + { + $this->alterError = $errormsg . $lang['alter_no_def']; + if($debug) $this->debugOutput .= "ERROR: defs<1

      "; + return false; + } + foreach($defs as $def) + { + if($debug) $this->debugOutput .= "
      def=$def
      "; + $preg_parse_def = + "/^(DROP(?! PRIMARY KEY)(?: COLUMN)?|ADD(?! PRIMARY KEY)(?: COLUMN)?|CHANGE(?: COLUMN)?|RENAME TO|ADD PRIMARY KEY|DROP PRIMARY KEY)" // $matches[1]: command + ."(?:" // this is either + ."(?:\s+\((.+)\)\s*$)" // anything in brackets (for ADD PRIMARY KEY) + // then $matches[2] is what there is in brackets + ."|" // OR: + ."\s+(".$this->sqlite_surroundings_preg("+",false," \"'\[`").")"// $matches[3]: (first) column name, possibly including quotes + // (may be quoted in any type of quotes) + // in case of RENAME TO, it is the new a table name + ."(" // $matches[4]: anything after the column name + ."(?:\s+(".$this->sqlite_surroundings_preg("+",false," \"'\[`")."))?" // $matches[5] (optional): a second column name possibly including quotes + // (may be quoted in any type of quotes) + ."\s*" + ."((?:[A-Z]+\s*)+(?:\(\s*[+-]?\s*[0-9]+(?:\s*,\s*[+-]?\s*[0-9]+)?\s*\))?)?\s*" // $matches[6] (optional): a type name + .".*". + ")" + ."?\s*$" + .")?\s*$/i"; // in case of DROP PRIMARY KEY, there is nothing after the command + if($debug) $this->debugOutput .= "preg_parse_def=$preg_parse_def
      "; + $parse_def = preg_match($preg_parse_def,$def,$matches); + if($parse_def===false) + { + $this->alterError = $errormsg . $lang['alter_parse_failed']; + if($debug) $this->debugOutput .= "ERROR: !parse_def

      "; + return false; + } + if(!isset($matches[1])) + { + $this->alterError = $errormsg . $lang['alter_action_not_recognized']; + if($debug) $this->debugOutput .= "ERROR: !isset(matches[1])

      "; + return false; + } + $action = str_replace(' column','',strtolower($matches[1])); + if($action == 'add primary key' && isset($matches[2]) && $matches[2]!='') + $column = $matches[2]; + elseif($action == 'drop primary key') + $column = ''; // DROP PRIMARY KEY has no column definition + elseif(isset($matches[3]) && $matches[3]!='') + $column = $this->sqliteUnquote($matches[3]); + else + $column = ''; + + $column_escaped = str_replace("'","''",$column); + + if($debug) $this->debugOutput .= "action=($action), column=($column), column_escaped=($column_escaped)
      "; + + /* we build a regex that devides the CREATE TABLE statement parts: + Part example Group Explanation + 1. CREATE TABLE t... ( $1 + 2. 'col1' ..., 'col2' ..., 'colN' ..., $3 (with col1-colN being columns that are not changed and listed before the col to change) + 3. 'colX' ..., (with colX being the column to change/drop) + 4. 'colX+1' ..., ..., 'colK') $5 (with colX+1-colK being columns after the column to change/drop) + */ + $preg_create_table = "\s*+(CREATE\s++TABLE\s++".preg_quote($this->quote($tmpname),"/")."\s*+\()"; // This is group $1 (keep unchanged) + $preg_column_definiton = "\s*+".$this->sqlite_surroundings_preg("+",true," '\"\[`,",$column)."(?:\s*+".$this->sqlite_surroundings_preg("*",false,"'\",`\[ ").")++"; // catches a complete column definition, even if it is + // 'column' TEXT NOT NULL DEFAULT 'we have a comma, here and a double ''quote!' + // this definition does NOT match columns with the column name $column + if($debug) $this->debugOutput .= "preg_column_definition=(".$preg_column_definiton.")
      "; + $preg_columns_before = // columns before the one changed/dropped (keep) + "(?:". + "(". // group $2. Keep this one unchanged! + "(?:". + "$preg_column_definiton,\s*+". // column definition + comma + ")*". // there might be any number of such columns here + $preg_column_definiton. // last column definition + ")". // end of group $2 + ",\s*+" // the last comma of the last column before the column to change. Do not keep it! + .")?"; // there might be no columns before + if($debug) $this->debugOutput .= "preg_columns_before=(".$preg_columns_before.")
      "; + $preg_columns_after = "(,\s*(.+))?"; // the columns after the column to drop. This is group $3 (drop) or $4(change) (keep!) + // we could remove the comma using $6 instead of $5, but then we might have no comma at all. + // Keeping it leaves a problem if we drop the first column, so we fix that case in another regex. + $table_new = $table; + + switch($action) + { + case 'add': + if($column=='') + { + $this->alterError = $errormsg . ' (add) - '. $lang['alter_no_add_col']; + return false; + } + $new_col_definition = "'$column_escaped' ".(isset($matches[4])?$matches[4]:''); + $preg_pattern_add = "/^".$preg_create_table. // the CREATE TABLE statement ($1) + "((?:(?!,\s*(?:PRIMARY\s+KEY\s*\(|CONSTRAINT\s|UNIQUE\s*\(|CHECK\s*\(|FOREIGN\s+KEY\s*\()).)*)". // column definitions ($2) + "(.*)\\)\s*$/si"; // table-constraints like PRIMARY KEY(a,b) ($3) and the closing bracket + // append the column definiton in the CREATE TABLE statement + $newSQL = preg_replace($preg_pattern_add, '$1$2, '.strtr($new_col_definition, array('\\' => '\\\\', '$' => '\$')).' $3', $createtesttableSQL).')'; + $preg_error = $this->getPregError(); + if($debug) + { + $this->debugOutput .= $createtesttableSQL."

      "; + $this->debugOutput .= $newSQL."

      "; + $this->debugOutput .= $preg_pattern_add."

      "; + } + if($newSQL==$createtesttableSQL) // pattern did not match, so column adding did not succed + { + $this->alterError = $errormsg . ' (add) - '.$lang['alter_pattern_mismatch'].'. PREG ERROR: '.$preg_error; + return false; + } + $createtesttableSQL = $newSQL; + break; + case 'change': + if(!isset($matches[5])) + { + $this->alterError = $errormsg . ' (change) - '.$lang['alter_col_not_recognized']; + return false; + } + $new_col_name = $matches[5]; + if(!isset($matches[6])) + $new_col_type = ''; + else + $new_col_type = $matches[6]; + $new_col_definition = "$new_col_name $new_col_type"; + $preg_column_to_change = "\s*".$this->sqlite_surroundings_preg($column)."(?:\s+".preg_quote($coltypes[$column]).")?(\s+(?:".$this->sqlite_surroundings_preg("*",false,",'\"`\[").")+)?"; + // replace this part (we want to change this column) + // group $3 contains the column constraints (keep!). the name & data type is replaced. + $preg_pattern_change = "/^".$preg_create_table.$preg_columns_before.$preg_column_to_change.$preg_columns_after."\s*\\)\s*$/s"; + + // replace the column definiton in the CREATE TABLE statement + $newSQL = preg_replace($preg_pattern_change, '$1$2,'.strtr($new_col_definition, array('\\' => '\\\\', '$' => '\$')).'$3$4)', $createtesttableSQL); + $preg_error = $this->getPregError(); + // remove comma at the beginning if the first column is changed + // probably somebody is able to put this into the first regex (using lookahead probably). + $newSQL = preg_replace("/^\s*(CREATE\s+TABLE\s+".preg_quote($this->quote($tmpname),"/")."\s+\(),\s*/",'$1',$newSQL); + if($debug) + { + $this->debugOutput .= "new_col_name=(".$new_col_name."), new_col_type=(".$new_col_type."), preg_column_to_change=(".$preg_column_to_change.")

      "; + $this->debugOutput .= $createtesttableSQL."

      "; + $this->debugOutput .= $newSQL."

      "; + + $this->debugOutput .= $preg_pattern_change."

      "; + } + if($newSQL==$createtesttableSQL || $newSQL=="") // pattern did not match, so column removal did not succed + { + $this->alterError = $errormsg . ' (change) - '.$lang['alter_pattern_mismatch'].'. PREG ERROR: '.$preg_error; + return false; + } + $createtesttableSQL = $newSQL; + $newcols[$column] = $this->sqliteUnquote($new_col_name); + break; + case 'drop': + $preg_column_to_drop = "\s*".$this->sqlite_surroundings_preg($column)."\s+(?:".$this->sqlite_surroundings_preg("*",false,",'\"\[`").")+"; // delete this part (we want to drop this column) + $preg_pattern_drop = "/^".$preg_create_table.$preg_columns_before.$preg_column_to_drop.$preg_columns_after."\s*\\)\s*$/s"; + + // remove the column out of the CREATE TABLE statement + $newSQL = preg_replace($preg_pattern_drop, '$1$2$3)', $createtesttableSQL); + $preg_error = $this->getPregError(); + // remove comma at the beginning if the first column is removed + // probably somebody is able to put this into the first regex (using lookahead probably). + $newSQL = preg_replace("/^\s*(CREATE\s+TABLE\s+".preg_quote($this->quote($tmpname),"/")."\s+\(),\s*/",'$1',$newSQL); + if($debug) + { + $this->debugOutput .= $createtesttableSQL."

      "; + $this->debugOutput .= $newSQL."

      "; + $this->debugOutput .= $preg_pattern_drop."

      "; + } + if($newSQL==$createtesttableSQL || $newSQL=="") // pattern did not match, so column removal did not succed + { + $this->alterError = $errormsg . ' (drop) - '.$lang['alter_pattern_mismatch'].'. PREG ERROR: '.$preg_error; + return false; + } + $createtesttableSQL = $newSQL; + unset($newcols[$column]); + break; + case 'rename to': + // don't change column definition at all + $newSQL = $createtesttableSQL; + // only change the name of the table + $table_new = $column; + break; + case 'add primary key': + // we want to add a primary key for the column(s) stored in $column + $newSQL = preg_replace("/\)\s*$/", ", PRIMARY KEY (".$column.") )", $createtesttableSQL); + $createtesttableSQL = $newSQL; + break; + case 'drop primary key': + // we want to drop the primary key + if($debug) $this->debugOutput .= "DROP"; + if(sizeof($primarykey)==1) + { + // if not compound primary key, might be a column constraint -> try removal + $column = $primarykey[0]; + if($debug) $this->debugOutput .= "
      Trying to drop column constraint for column $column
      "; + /* + TODO: This does not work yet: + CREATE TABLE 't12' ('t1' INTEGER CONSTRAINT "bla" NOT NULL CONSTRAINT 'pk' PRIMARY KEY ); ALTER TABLE "t12" DROP PRIMARY KEY + This does: ! ! + CREATE TABLE 't12' ('t1' INTEGER CONSTRAINT bla NOT NULL CONSTRAINT 'pk' PRIMARY KEY ); ALTER TABLE "t12" DROP PRIMARY KEY + */ + $preg_column_to_change = "(\s*".$this->sqlite_surroundings_preg($column).")". // column ($3) + "(?:". // opt. type and column constraints + "(\s+(?:".$this->sqlite_surroundings_preg("(?:[^PC,'\"`\[]|P(?!RIMARY\s+KEY)|". + "C(?!ONSTRAINT\s+".$this->sqlite_surroundings_preg("+",false," ,'\"\[`")."\s+PRIMARY\s+KEY))",false,",'\"`\[").")*)". // column constraints before PRIMARY KEY ($3) + // primary key constraint (remove this!): + "(?:CONSTRAINT\s+".$this->sqlite_surroundings_preg("+",false," ,'\"\[`")."\s+)?". + "PRIMARY\s+KEY". + "(?:\s+(?:ASC|DESC))?". + "(?:\s+ON\s+CONFLICT\s+(?:ROLLBACK|ABORT|FAIL|IGNORE|REPLACE))?". + "(?:\s+AUTOINCREMENT)?". + "((?:".$this->sqlite_surroundings_preg("*",false,",'\"`\[").")*)". // column constraints after PRIMARY KEY ($4) + ")"; + // replace this part (we want to change this column) + // group $3 (column) $4 (constraints before) and $5 (constraints after) contain the part to keep + $preg_pattern_change = "/^".$preg_create_table.$preg_columns_before.$preg_column_to_change.$preg_columns_after."\s*\\)\s*$/si"; + + // replace the column definiton in the CREATE TABLE statement + $newSQL = preg_replace($preg_pattern_change, '$1$2,$3$4$5$6)', $createtesttableSQL); + // remove comma at the beginning if the first column is changed + // probably somebody is able to put this into the first regex (using lookahead probably). + $newSQL = preg_replace("/^\s*(CREATE\s+TABLE\s+".preg_quote($this->quote($tmpname),"/")."\s+\(),\s*/",'$1',$newSQL); + if($debug) + { + $this->debugOutput .= "preg_column_to_change=(".$preg_column_to_change.")

      "; + $this->debugOutput .= $createtesttableSQL."

      "; + $this->debugOutput .= $newSQL."

      "; + + $this->debugOutput .= $preg_pattern_change."

      "; + } + if($newSQL!=$createtesttableSQL && $newSQL!="") // pattern did match, so PRIMARY KEY constraint removed :) + { + $createtesttableSQL = $newSQL; + if($debug) $this->debugOutput .= "
      SUCCEEDED
      "; + } + else + { + if($debug) $this->debugOutput .= "NO LUCK"; + // TODO: try removing table constraint + return false; + } + $createtesttableSQL = $newSQL; + } else + // TODO: Try removing table constraint + return false; + + break; + default: + if($debug) $this->debugOutput .= 'ERROR: unknown alter operation!

      '; + $this->alterError = $errormsg . $lang['alter_unknown_operation']; + return false; + } + } + $droptempsql = 'DROP TABLE '.$this->quote_id($tmpname); + + $createnewtableSQL = "CREATE TABLE ".$this->quote($table_new)." ".preg_replace("/^\s*CREATE\s+TABLE\s+'?".str_replace("'","''",preg_quote($tmpname,"/"))."'?\s+(.*)$/is", '$1', $createtesttableSQL, 1); + + $newcolumns = ''; + $oldcolumns = ''; + reset($newcols); + foreach($newcols as $key => $val) + { + $newcolumns .= ($newcolumns?', ':'').$this->quote_id($val); + $oldcolumns .= ($oldcolumns?', ':'').$this->quote_id($key); + } + $copytonewsql = 'INSERT INTO '.$this->quote_id($table_new).'('.$newcolumns.') SELECT '.$oldcolumns.' FROM '.$this->quote_id($tmpname); + } + } + $alter_transaction = 'BEGIN; '; + $alter_transaction .= $createtemptableSQL.'; '; //create temp table + $alter_transaction .= $copytotempsql.'; '; //copy to table + $alter_transaction .= $dropoldsql.'; '; //drop old table + $alter_transaction .= $createnewtableSQL.'; '; //recreate original table + $alter_transaction .= $copytonewsql.'; '; //copy back to original table + $alter_transaction .= $droptempsql.'; '; //drop temp table + + $preg_index="/^\s*(CREATE\s+(?:UNIQUE\s+)?INDEX\s+(?:".$this->sqlite_surroundings_preg("+",false," '\"\[`")."\s*)*ON\s+)(".$this->sqlite_surroundings_preg($table).")(\s*\((?:".$this->sqlite_surroundings_preg("+",false," '\"\[`")."\s*)*\)\s*)\s*$/i"; + foreach($recreateQueries as $recreate_query) + { + if($recreate_query['type']=='index') + { + // this is an index. We need to make sure the index is not on a column that we drop. If it is, we drop the index as well. + $indexInfos = $this->selectArray('PRAGMA index_info('.$this->quote_id($recreate_query['name']).')'); + foreach($indexInfos as $indexInfo) + { + if(!isset($newcols[$indexInfo['name']])) + { + if($debug) $this->debugOutput .= 'Not recreating the following index:

      '.htmlencode($recreate_query['sql']).'

      '; + // Index on a column that was dropped. Skip recreation. + continue 2; + } + } + } + // TODO: In case we renamed a column on which there is an index, we need to recreate the index with the column name adjusted. + + // recreate triggers / indexes + if($table == $table_new) + { + // we had no RENAME TO, so we can recreate indexes/triggers just like the original ones + $alter_transaction .= $recreate_query['sql'].';'; + } else + { + // we had a RENAME TO, so we need to exchange the table-name in the CREATE-SQL of triggers & indexes + switch ($recreate_query['type']) + { + case 'index': + $recreate_queryIndex = preg_replace($preg_index, '$1'.$this->quote_id(strtr($table_new, array('\\' => '\\\\', '$' => '\$'))).'$3 ', $recreate_query['sql']); + if($recreate_queryIndex!=$recreate_query['sql'] && $recreate_queryIndex != NULL) + $alter_transaction .= $recreate_queryIndex.';'; + else + { + // the CREATE INDEX regex did not match. this normally should not happen + if($debug) $this->debugOutput .= 'ERROR: CREATE INDEX regex did not match!?

      '; + // just try to recreate the index originally (will fail most likely) + $alter_transaction .= $recreate_query['sql'].';'; + } + break; + + case 'trigger': + // TODO: IMPLEMENT + $alter_transaction .= $recreate_query['sql'].';'; + break; + default: + if($debug) $this->debugOutput .= 'ERROR: Unknown type '.htmlencode($recreate_query['type']).'

      '; + $alter_transaction .= $recreate_query['sql'].';'; + } + } + } + $alter_transaction .= 'COMMIT;'; + if($debug) $this->debugOutput .= $alter_transaction; + return $this->multiQuery($alter_transaction); + } + } + + //multiple query execution + //returns true on success, false otherwise. Use getError() to fetch the error. + public function multiQuery($query) + { + if($this->type=="PDO") + $success = $this->db->exec($query); + else if($this->type=="SQLite3") + $success = $this->db->exec($query); + else + $success = $this->db->queryExec($query, $error); + return $success; + } + + + // checks whether a table has a primary key + public function hasPrimaryKey($table) + { + $table_info = $this->getTableInfo($table); + foreach($table_info as $row_id => $row_data) + { + if($row_data['pk']) + { + return true; + } + + } + return false; + } + + // Returns an array of columns by which rows can be uniquely adressed. + // For tables with a rowid column, this is always array('rowid') + // for tables without rowid, this is an array of the primary key columns. + public function getPrimaryKey($table) + { + $primary_key = array(); + // check if this table has a rowid + $getRowID = $this->select('SELECT ROWID FROM '.$this->quote_id($table).' LIMIT 0,1'); + if(isset($getRowID[0])) + // it has, so we prefer addressing rows by rowid + return array('rowid'); + else + { + // the table is without rowid, so use the primary key + $table_info = $this->getTableInfo($table); + if(is_array($table_info)) + { + foreach($table_info as $row_id => $row_data) + { + if($row_data['pk']) + $primary_key[] = $row_data['name']; + } + } + } + return $primary_key; + } + + // selects a row by a given key $pk, which is an array of values + // for the columns by which a row can be adressed (rowid or primary key) + public function wherePK($table, $pk) + { + $where = ""; + $primary_key = $this->getPrimaryKey($table); + foreach($primary_key as $pk_index => $column) + { + if($where!="") + $where .= " AND "; + $where .= $this->quote_id($column) . ' = '; + if(is_int($pk[$pk_index]) || is_float($pk[$pk_index])) + $where .= $pk[$pk_index]; + else + $where .= $this->quote($pk[$pk_index]); + } + return $where; + } + + //get number of rows in table + public function numRows($table, $dontTakeLong = false) + { + // as Count(*) can be slow on huge tables without PK, + // if $dontTakeLong is set and the size is > 2MB only count() if there is a PK + if(!$dontTakeLong || $this->getSize() <= 2000 || $this->hasPrimaryKey($table)) + { + $result = $this->select("SELECT Count(*) FROM ".$this->quote_id($table)); + return $result[0]; + } else + { + return '?'; + } + } + + //correctly escape a string to be injected into an SQL query + public function quote($value) + { + if($this->type=="PDO") + { + // PDO quote() escapes and adds quotes + return $this->db->quote($value); + } + else if($this->type=="SQLite3") + { + return "'".$this->db->escapeString($value)."'"; + } + else + { + return "'".sqlite_escape_string($value)."'"; + } + } + + //correctly escape an identifier (column / table / trigger / index name) to be injected into an SQL query + public function quote_id($value) + { + // double-quotes need to be escaped by doubling them + $value = str_replace('"','""',$value); + return '"'.$value.'"'; + } + + + //import sql + //returns true on success, error message otherwise + public function import_sql($query) + { + $import = $this->multiQuery($query); + if(!$import) + return $this->getError(); + else + return true; + } + + public function prepareQuery($query) + { + if($this->type=='PDO' || $this->type=='SQLite3') + return $this->db->prepare($query); + else + { + // here we are in trouble, SQLiteDatabase cannot prepare statements. + // we need to emulate prepare as best as we can + # todo: implement this + return null; + } + } + + public function bindValue($handle, $parameter, $value, $type) + { + if($this->type=='SQLite3') + { + $types = array( + 'bool'=>SQLITE3_INTEGER, + 'int'=>SQLITE3_INTEGER, + 'float'=>SQLITE3_FLOAT, + 'text'=>SQLITE3_TEXT, + 'blob'=>SQLITE3_BLOB, + 'null'=>SQLITE3_NULL); + if(!isset($types[$type])) + $type = 'text'; + // there is no SQLITE_BOOL, so check value and make sure it is 0/1 + if($type=='bool') + { + if($value===1 || $value===true) + $value=1; + elseif($value===0 || $value===false) + $value=0; + else + return false; + } + return $handle->bindValue($parameter, $value, $types[$type]); + } + if($this->type=='PDO') + { + $types = array( + 'bool'=>PDO::PARAM_BOOL, + 'int'=>PDO::PARAM_INT, + 'float'=>PDO::PARAM_STR, + 'text'=>PDO::PARAM_STR, + 'blob'=>PDO::PARAM_LOB, + 'null'=>PDO::PARAM_NULL); + if(!isset($types[$type])) + $type = 'text'; + // there is no PDO::PARAM_FLOAT, so we check it ourself + if($type=='float') + { + if(is_numeric($value)) + $value = (float) $value; + else + return false; + } + return $handle->bindValue($parameter, $value, $types[$type]); + } + else + # todo: workaround + return false; + + } + + public function executePrepared($handle, $fetchResult=false) + { + if($this->type=='PDO') + { + $ok=$handle->execute(); + if($fetchResult && $ok) + { + $res = $handle->fetchAll(); + $handle->closeCursor(); + return $res; + } + else + { + if($ok) + $handle->closeCursor(); + return $ok; + } + } + elseif($this->type=='SQLite3') + { + $resultset=$handle->execute(); + if($fetchResult && $resultset!==false) + { + $res = $resultset->fetchArray(); + $resultset->finalize(); + return $res; + } + else + { + if($resultset!==false) + $resultset->finalize(); + if($resultset===false) + return false; + else + return true; + } + } + else + { + #todo. + return false; + } + } + + //import csv + //returns true on success, error message otherwise + public function import_csv($filename, $table, $field_terminate, $field_enclosed, $field_escaped, $null, $fields_in_first_row) + { + @set_time_limit(-1); + $csv_handle = fopen($filename,'r'); + $csv_insert = "BEGIN;\n"; + $csv_number_of_rows = 0; + // PHP requires enclosure defined, but has no problem if it was not used + if($field_enclosed=="") $field_enclosed='"'; + // PHP requires escaper defined + if($field_escaped=="") $field_escaped='\\'; + // support tab delimiters + if($field_terminate=='\t') $field_terminate = "\t"; + while($csv_handle!==false && !feof($csv_handle)) + { + $csv_data = fgetcsv($csv_handle, 0, $field_terminate, $field_enclosed, $field_escaped); + if(is_array($csv_data) && ($csv_data[0] != NULL || count($csv_data)>1)) + { + $csv_number_of_rows++; + if($csv_number_of_rows==1) + { + if($this->getTypeOfTable($table)!="table") + { + // First,Create a new table + $csv_insert .="CREATE TABLE ".$this->quote($table)." ("; + $number_of_cols = count($csv_data); + foreach($csv_data as $csv_col => $csv_cell) + { + if($fields_in_first_row) + $csv_insert .= $this->quote($csv_cell); + else + $csv_insert.= $this->quote("col{$csv_col}"); + if($csv_col < $number_of_cols-1) + $csv_insert .= ", "; + } + $csv_insert .=");"; + + } else { + $number_of_cols = count($this->getTableInfo($table)); + } + if($fields_in_first_row) + continue; + } + $csv_insert .= "INSERT INTO ".$this->quote_id($table)." VALUES ("; + for($csv_col = 0; $csv_col < $number_of_cols; $csv_col++) + { + if(isset($csv_data[$csv_col])) + $csv_cell = $csv_data[$csv_col]; + else + $csv_cell = $null; + if($csv_cell == $null) + $csv_insert .= "NULL"; + else + $csv_insert.= $this->quote($csv_cell); + if($csv_col < $number_of_cols-1) + $csv_insert .= ","; + } + $csv_insert .= ");\n"; + + if($csv_number_of_rows % 5000 == 0) + { + $csv_insert .= "COMMIT;\nBEGIN;\n"; + } + } + } + if($csv_handle === false) + return "Error reading CSV file"; + else + { + $csv_insert .= "COMMIT;"; + fclose($csv_handle); + $import = $this->multiQuery($csv_insert); + if(!$import) + return $this->getError(); + else + return true; + } + } + + //export csv + public function export_csv($tables, $field_terminate, $field_enclosed, $field_escaped, $null, $crlf, $fields_in_first_row) + { + @set_time_limit(-1); + // we use \r\n if the _client_ OS is windows (as the exported file is downloaded to the client), \n otherwise + $crlf = (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Win')!==false ? "\r\n" : "\n"); + + $query = "SELECT * FROM sqlite_master WHERE type='table' or type='view' ORDER BY type DESC"; + $result = $this->selectArray($query); + for($i=0; $igetTableInfo($result[$i]['tbl_name']); + $cols = array(); + for($z=0; $zquote_id($result[$i]['tbl_name']); + $table_result = $this->query($query); + $firstRow=true; + while($row = $this->fetch($table_result, "assoc")) + { + if(!$firstRow) + echo $crlf; + else + $firstRow=false; + + for($y=0; $ygetPath().$crlf; + echo "----".$crlf; + } + $query = "SELECT * FROM sqlite_master WHERE type='table' OR type='index' OR type='view' OR type='trigger' ORDER BY type='trigger', type='index', type='view', type='table'"; + $result = $this->selectArray($query); + + if($transaction) + echo "BEGIN TRANSACTION;".$crlf; + + //iterate through each table + for($i=0; $iquote_id($result[$i]['name']).";".$crlf; + } + if($structure) + { + if($comments) + { + echo "\r\n----".$crlf; + if($result[$i]['type']=="table" || $result[$i]['type']=="view") + echo "-- ".ucfirst($result[$i]['type'])." ".$lang['struct_for']." ".$result[$i]['tbl_name'].$crlf; + else // index or trigger + echo "-- ".$lang['struct_for']." ".$result[$i]['type']." ".$result[$i]['name']." ".$lang['on_tbl']." ".$result[$i]['tbl_name'].$crlf; + echo "----".$crlf; + } + echo $result[$i]['sql'].";".$crlf; + } + if($data && $result[$i]['type']=="table") + { + $query = "SELECT * FROM ".$this->quote_id($result[$i]['tbl_name']); + $table_result = $this->query($query, "assoc"); + + if($comments) + { + $numRows = $this->numRows($result[$i]['tbl_name']); + echo "\r\n----".$crlf; + echo "-- ".$lang['data_dump']." ".$result[$i]['tbl_name'].", ".sprintf($lang['total_rows'], $numRows).$crlf; + echo "----".$crlf; + } + $temp = $this->getTableInfo($result[$i]['tbl_name']); + $cols = array(); + $cols_quoted = array(); + for($z=0; $zquote_id($temp[$z][1]); + } + while($row = $this->fetch($table_result)) + { + $vals = array(); + for($y=0; $yquote($row[$cols[$y]]); + } + echo "INSERT INTO ".$this->quote_id($result[$i]['tbl_name'])." (".implode(",", $cols_quoted).") VALUES (".implode(",", $vals).");".$crlf; + } + } + } + } + if($transaction) + echo "COMMIT;".$crlf; + + if(!$echo) { + $o = ob_get_contents(); + ob_end_clean(); + return $o; + } + + } +} +class GetParameters +{ + private $_fields; + + public function __construct(array $defaults = array()) + { + $this->_fields = $defaults; + } + + public function __set($key, $value) + { + $this->_fields[$key] = $value; + } + + public function __isset($key) + { + return isset($this->_fields[$key]); + } + + public function __unset($key) + { + unset($this->_fields[$key]); + } + + public function __get($key) + { + return $this->_fields[$key]; + } + + public function getURL(array $assoc = array(), $html = true, $prefix='?') + { + $arg_sep = ($html?'&':'&'); + return $prefix . http_build_query(array_merge($this->_fields, $assoc), '', $arg_sep); + } + + public function getLink(array $assoc = array(), $content = '[ link ]', $class = '', $title = '', $target='') + { + return '' . $content . ''; + } + + public function getForm(array $assoc = array(), $method = 'post', $upload = false, $name = '', $csrf = true) + { + $hidden = ''; + if($method == 'get') + { + $url = ''; + foreach(array_merge($this->_fields, $assoc) as $key => $value) + { + if(!is_null($value)) + $hidden .= ' '; + } + } + else + $url = $this->getURL($assoc); + + if($csrf && $method == 'post') + $hidden .= ''; + + return "
      " . + $hidden; + } + + public function redirect(array $assoc = array(), $message="") + { + if($message!="") + { + $_SESSION[COOKIENAME.'messages'][md5($message)] = $message; + $url = $this->getURL(array_merge($assoc, array('message'=>md5($message))), false); + } + else + $url = $this->getURL($assoc, false); + + $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http'); + + header("Location: ".$protocol."://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].$url, true, 302); + exit; + } +}// class MicroTimer (issue #146) +// wraps calls to microtime(), calculating the elapsed time and rounding output +// +class MicroTimer { + + private $startTime, $stopTime; + + // creates and starts a timer + function __construct() + { + $this->startTime = microtime(true); + } + + // stops a timer + public function stop() + { + $this->stopTime = microtime(true); + } + + // returns the number of seconds from the timer's creation, or elapsed + // between creation and call to ->stop() + public function elapsed() + { + if ($this->stopTime) + return round($this->stopTime - $this->startTime, 4); + + return round(microtime(true) - $this->startTime, 4); + } + + // called when using a MicroTimer object as a string + public function __toString() + { + return (string) $this->elapsed(); + } + +} +// class Resources (issue #157) +// outputs secondary files, such as css and javascript +// data is stored gzipped (gzencode) and encoded (base64_encode) +// +class Resources { + + // set this to the file containing getInternalResource; + // currently unused in split mode; set to __FILE__ for built PLA. + public static $embedding_file = __FILE__; + + private static $_resources = array( + 'css' => array( + 'mime' => 'text/css', + 'data' => 'resources/phpliteadmin.css', + ), + 'javascript' => array( + 'mime' => 'text/javascript', + 'data' => 'resources/phpliteadmin.js', + ), + 'favicon' => array( + 'mime' => 'image/x-icon', + 'data' => 'resources/favicon.ico', + 'base64' => 'true', + ), + ); + + // outputs the specified resource, if defined in this class. + // the main script should do no further output after calling this function. + public static function output($resource) + { + if (isset(self::$_resources[$resource])) { + $res =& self::$_resources[$resource]; + + if (function_exists('getInternalResource') && $data = getInternalResource($res['data'])) { + $filename = self::$embedding_file; + } else { + $filename = $res['data']; + } + + // use last-modified time as etag; etag must be quoted + $etag = '"' . filemtime($filename) . '"'; + + // check headers for matching etag; if etag hasn't changed, use the cached version + if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $etag) { + header('HTTP/1.0 304 Not Modified'); + return; + } + + header('Etag: ' . $etag); + + // cache file for at most 30 days + header('Cache-control: max-age=2592000'); + + // output resource + header('Content-type: ' . $res['mime']); + + if (isset($data)) { + if (isset($res['base64'])) { + echo base64_decode($data); + } else { + echo $data; + } + } else { + readfile($filename); + } + } + } + +} + +if (version_compare(phpversion(), '5.2.4', '<')) { + die('Your PHP version is PHP '.phpversion().', which is too old. You need at least PHP 5.2.4.'); +} + +if(strpos(ini_get('variables_order'),'G') === false || strpos(ini_get('variables_order'),'P') === false || + strpos(ini_get('variables_order'),'C') === false || strpos(ini_get('variables_order'),'S') === false) { + die('The php configuration variables_order needs to include G, P, C and S. The current value is "'.ini_get('variables_order').'". Please check the php configuration (php.ini).'); +} + +//- Initialization + +// load optional configuration file +$config_filename = './phpliteadmin.config.php'; +if (is_readable($config_filename)) +{ + include_once $config_filename; +} + +//constants 1 +define("PROJECT", "phpLiteAdmin"); +define("VERSION", "1.9.9-dev"); +define("FORCETYPE", false); //force the extension that will be used (set to false in almost all circumstances except debugging, possible values: false, "PDO", "SQLite3", "SQLiteDatabase") +define("SYSTEMPASSWORD", $password); // Makes things easier. +define('PROJECT_URL','https://www.phpliteadmin.org/'); +define('DONATE_URL','https://www.phpliteadmin.org/donate/'); +define('VERSION_CHECK_URL','https://www.phpliteadmin.org/current_version.php'); +define('PROJECT_BUGTRACKER_LINK','https://bitbucket.org/phpliteadmin/public/issues?status=new&status=open'); +define('PROJECT_INSTALL_LINK','https://bitbucket.org/phpliteadmin/public/wiki/Installation'); + +// up here, we don't output anything. debug output might appear here which is catched by ob and thrown later +ob_start(); + +// Resource output (css and javascript files) +// we get out of the main code as soon as possible, without inizializing the session +if (isset($_GET['resource'])) +{ + Resources::output($_GET['resource']); + exit(); +} + +// don't mess with this - required for the login session +ini_set('session.cookie_httponly', '1'); +if(!session_start()) +{ + die("Could not start a new session. Check your php setup regarding sessions."); +} + +// version-number added so after updating, old session-data is not used anylonger +// cookies names cannot contain symbols, except underscores +define("COOKIENAME", preg_replace('/[^a-zA-Z0-9_]/', '_', $cookie_name . '_' . VERSION) ); + +$params = new GetParameters(); + +if($debug==true) +{ + ini_set("display_errors", 1); + error_reporting(E_STRICT | E_ALL); +} else +{ + @ini_set("display_errors", 0); +} + +// start the timer to record page load time +$pageTimer = new MicroTimer(); + +// load language file +if($language != 'en') { + $temp_lang=$lang; + if(is_file('languages/lang_'.$language.'.php')) + include('languages/lang_'.$language.'.php'); + elseif(is_file('lang_'.$language.'.php')) + include('lang_'.$language.'.php'); + $lang = array_merge($temp_lang, $lang); + unset($temp_lang); +} + +// stripslashes if MAGIC QUOTES is turned on +// This is only a workaround. Please better turn off magic quotes! +// This code is from http://php.net/manual/en/security.magicquotes.disabling.php +if (is_callable('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { + $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); + foreach($process as $key => $val) { + foreach ($val as $k => $v) { + unset($process[$key][$k]); + if (is_array($v)) { + $process[$key][stripslashes($k)] = $v; + $process[] = &$process[$key][stripslashes($k)]; + } else { + $process[$key][stripslashes($k)] = stripslashes($v); + } + } + } + unset($process); +} + + +//data types array +$sqlite_datatypes = array("INTEGER", "REAL", "TEXT", "BLOB","NUMERIC","BOOLEAN","DATETIME"); + +//available SQLite functions array (don't add anything here or there will be problems) +$sqlite_functions = array("abs", "hex", "length", "lower", "ltrim", "random", "round", "rtrim", "trim", "typeof", "upper"); + +//- Support functions + +// for php < 5.6.0 +if(!function_exists('hash_equals')) +{ + function hash_equals($str1, $str2) + { + if(strlen($str1) != strlen($str2)) + return false; + else { + $res = $str1 ^ $str2; + $ret = 0; + for($i = strlen($res) - 1; $i >= 0; $i--) + $ret |= ord($res[$i]); + return !$ret; + } + } +} + +// workaround if mbsting extension is missing. Sure this means no multibyte support. +if(!function_exists('mb_strlen')) +{ + function mb_strlen($s) + { + return strlen($s); + } +} +if(!function_exists('mb_substr')) +{ + function mb_substr($s, $start, $length=null, $encoding=null) + { + return substr($s, $start, null === $length ? 2147483647 : $length); + } +} +// no other mbstring functions used so far + +//function that allows SQL delimiter to be ignored inside comments or strings +function explode_sql($delimiter, $sql) +{ + $ign = array('"' => '"', "'" => "'", "/*" => "*/", "--" => "\n"); // Ignore sequences. + $out = array(); + $last = 0; + $slen = strlen($sql); + $dlen = strlen($delimiter); + $i = 0; + while($i < $slen) + { + // Split on delimiter + if($slen - $i >= $dlen && substr($sql, $i, $dlen) == $delimiter) + { + array_push($out, substr($sql, $last, $i - $last)); + $last = $i + $dlen; + $i += $dlen; + continue; + } + // Eat comments and string literals + foreach($ign as $start => $end) + { + $ilen = strlen($start); + if($slen - $i >= $ilen && substr($sql, $i, $ilen) == $start) + { + $i+=strlen($start); + $elen = strlen($end); + while($i < $slen) + { + if($slen - $i >= $elen && substr($sql, $i, $elen) == $end) + { + // SQL comment characters can be escaped by doubling the character. This recognizes and skips those. + if($start == $end && $slen - $i >= $elen*2 && substr($sql, $i, $elen*2) == $end.$end) + { + $i += $elen * 2; + continue; + } + else + { + $i += $elen; + continue 3; + } + } + $i++; + } + continue 2; + } + } + $i++; + } + if($last < $slen) + array_push($out, substr($sql, $last, $slen - $last)); + return $out; +} + +//function to scan entire directory tree and subdirectories +function dir_tree($dir) +{ + $path = array(); + $stack = array($dir); + while($stack) + { + $thisdir = array_pop($stack); + if($dircont = scandir($thisdir)) + { + $i=0; + while(isset($dircont[$i])) + { + if($dircont[$i] !== '.' && $dircont[$i] !== '..') + { + $current_file = $thisdir.DIRECTORY_SEPARATOR.$dircont[$i]; + if(is_file($current_file)) + { + $path[] = $thisdir.DIRECTORY_SEPARATOR.$dircont[$i]; + } + elseif (is_dir($current_file)) + { + $path[] = $thisdir.DIRECTORY_SEPARATOR.$dircont[$i]; + $stack[] = $current_file; + } + } + $i++; + } + } + } + return $path; +} + +//the function echo the help [?] links to the documentation +function helpLink($name) +{ + global $lang; + return "[?]"; +} + +// function to encode value into HTML just like htmlentities, but with adjusted default settings +function htmlencode($value, $flags=ENT_QUOTES, $encoding ="UTF-8") +{ + return htmlentities($value, $flags, $encoding); +} + +// reduce string chars +function subString($str) +{ + global $charsNum, $params; + if($charsNum > 10 && (!isset($params->fulltexts) || !$params->fulltexts) && mb_strlen($str)>$charsNum) + { + $str = mb_substr($str, 0, $charsNum).'...'; + } + return $str; +} + +// marks searchwords and htmlencodes correctly +function markSearchWords($input, $field, $search) +{ + $output = htmlencode($input); + if(isset($search['values'][$field]) && is_array($search['values'][$field])) + { + // build one regex that matches (all) search words + $regex = '/'; + $vali=0; + foreach($search['values'][$field] as $searchValue) + { + if($search['operators'][$field] =='LIKE' || $search['operators'][$field] == 'LIKE%') + $regex .= '(?:'.($searchValue[0]=='%'?'':'^'); // does the searchvalue have to occur at the start? + $regex .= preg_quote(trim($searchValue,'%'),'/'); // the search value + if($search['operators'][$field] =='LIKE' || $search['operators'][$field] == 'LIKE%') + $regex .= (substr($searchValue,-1)=='%'?'':'$').')'; // does the searchvalue have to occur at the end? + if($vali++ $betweenPart) + { + $output .= htmlencode($betweenPart); // part that does not match (might be empty) + if(isset($fldFoundParts[0][$index])) + $output .= ''.htmlencode($fldFoundParts[0][$index]).''; // the part that matched + } + } + return $output; +} + +// checks the (new) name of a database file +function checkDbName($name) +{ + global $allowed_extensions; + $info = pathinfo($name); + if(isset($info['extension']) && !in_array($info['extension'], $allowed_extensions)) + { + return false; + } else + { + return (!is_file($name) && !is_dir($name)); + } + +} + +// check whether a path is a db managed by this tool +// requires that $databases is already filled! +// returns the key of the db if managed, false otherwise. +function isManagedDB($path) +{ + global $databases; + foreach($databases as $db_key => $database) + { + if($path === $database['path']) + { + // a db we manage. Thats okay. + // return the key. + return $db_key; + } + } + // not a db we manage! + return false; +} + +// from a typename of a colun, get the type of the column's affinty +// see https://www.sqlite.org/datatype3.html section 2.1 for rules +function get_type_affinity($type) +{ + if (preg_match("/INT/i", $type)) + return "INTEGER"; + else if (preg_match("/(?:CHAR|CLOB|TEXT)/i", $type)) + return "TEXT"; + else if (preg_match("/BLOB/i", $type) || $type=="") + return "NONE"; + else if (preg_match("/(?:REAL|FLOA|DOUB)/i", $type)) + return "REAL"; + else + return "NUMERIC"; +} + + +// Returns a file size limit in bytes based on the PHP upload_max_filesize +// post_max_size and memory_limit. Returns -1 in case of no limit. +function fileUploadMaxSize() +{ + $max1 = parseSize(ini_get('post_max_size')); + $max2 = parseSize(ini_get('upload_max_filesize')); + $max3 = parseSize(ini_get('memory_limit')); + if($max1>0 && ($max1<=$max2 || $max2==0) && ($max1<=$max3 || $max3==-1)) + return $max1; + elseif($max2>0 && ($max2<=$max1 || $max1==0) && ($max2<=$max3 || $max3==-1)) + return $max2; + elseif($max3>-1 && ($max3<=$max1 || $max1==0) && ($max3<=$max2 || $max2==0)) + return $max3; + else + return -1; // no limit +} + +// Parses given size string like "12M" into number of bytes +// based on https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Component%21Utility%21Bytes.php/function/Bytes%3A%3AtoInt/8.2.x +function parseSize($size) +{ + // Remove the non-unit characters from the size. + $unit = preg_replace('/[^bkmgtpezy]/i', '', $size); + // Remove the non-numeric characters from the size. + $size = preg_replace('/[^0-9\.]/', '', $size); + if ($unit) + { + // Find the position of the unit in the ordered string which is the power + // of magnitude to multiply a kilobyte by. + return round($size * pow(1024, stripos('bkmgtpezy', $unit[0]))); + } + else { + return round($size); + } +} + + +//- Check user authentication, login and logout +$auth = new Authorization(); //create authorization object + +// check if user has attempted to log out +if (isset($_GET['logout'])) + $auth->revoke(); +// check if user has attempted to log in +else if (isset($_POST['login']) && isset($_POST['password'])) +{ + $attempt = $auth->attemptGrant($_POST['password'], isset($_POST['remember'])); + $params->redirect( $attempt ? array():array('failed'=>'1') ); +} + +//- Actions on database files and bulk data +if ($auth->isAuthorized()) +{ + + //- Create a new database + if(isset($_POST['new_dbname'])) + { + if($_POST['new_dbname']=='') + $params->redirect(array('table'=>null), $lang['err'].': '.$lang['db_blank']); + else + { + $str = preg_replace('@[^\w\-.]@u','', $_POST['new_dbname']); + $dbname = $str; + $dbpath = $str; + if(checkDbName($dbname)) + { + $tdata = array(); + $tdata['name'] = $dbname; + $tdata['path'] = $directory.DIRECTORY_SEPARATOR.$dbpath; + if(isset($_POST['new_dbtype'])) + $tdata['type'] = $_POST['new_dbtype']; + else + $tdata['type'] = 3; + $td = new Database($tdata); + $td->query("VACUUM"); + } else + { + if(is_file($dbname) || is_dir($dbname)) + $params->redirect(array('view'=>'structure'),$lang['err'].': '.sprintf($lang['db_exists'], htmlencode($dbname))); + else + $params->redirect(array('view'=>'structure'),$lang['extension_not_allowed'].': '.implode(', ', array_map('htmlencode', $allowed_extensions)).'
      '.$lang['add_allowed_extension']); + } + } + } + + //- Scan a directory for databases + if($directory!==false) + { + if($directory[strlen($directory)-1]==DIRECTORY_SEPARATOR) //if user has a trailing slash in the directory, remove it + $directory = substr($directory, 0, strlen($directory)-1); + + if(is_dir($directory)) //make sure the directory is valid + { + if($subdirectories===true) + $arr = dir_tree($directory); + else + $arr = scandir($directory); + $databases = array(); + $j = 0; + for($i=0; $i $database) + { + if($database['path'] === $tdata['path']) + { + $currentDB = $database; + $params->database = $database['path']; + break; + } + } + } + } + else //the directory is not valid - display error and exit + { + echo "
      ".$lang['not_dir']."
      "; + exit(); + } + } + else + { + for($i=0; $idatabase = $databases[$db_key]['path']; + } + } + + //- Delete an existing database + if(isset($_GET['database_delete'])) + { + $dbpath = $_POST['database_delete']; + // check whether $dbpath really is a db we manage + $checkDB = isManagedDB($dbpath); + if($checkDB !== false) + { + unlink($dbpath); + unset($params->database); + unset($currentDB); + unset($databases[$checkDB]); + } else die($lang['err'].': '.$lang['delete_only_managed']); + } + + //- Rename an existing database + if(isset($_GET['database_rename'])) + { + $oldpath = $_POST['oldname']; + $newpath = $_POST['newname']; + $oldpath_parts = pathinfo($oldpath); + $newpath_parts = pathinfo($newpath); + // only rename? + $newpath = $oldpath_parts['dirname'].DIRECTORY_SEPARATOR.basename($_POST['newname']); + if($newpath != $_POST['newname'] && $subdirectories) + { + // it seems that the file should not only be renamed but additionally moved. + // we need to make sure it stays within $directory... + $new_realpath = realpath($newpath_parts['dirname']).DIRECTORY_SEPARATOR; + $directory_realpath = realpath($directory).DIRECTORY_SEPARATOR; + if(strpos($new_realpath, $directory_realpath)===0) + { + // its okay, the new directory is within $directory + $newpath = $_POST['newname']; + } + else $params->redirect(array('view'=>'rename'), $lang['err'].': '.$lang['db_moved_outside']); + } + + if(checkDbName($newpath)) + { + $checkDB = isManagedDB($oldpath); + if($checkDB !==false ) + { + rename($oldpath, $newpath); + $databases[$checkDB]['path'] = $newpath; + $databases[$checkDB]['name'] = basename($newpath); + $currentDB = $databases[$checkDB]; + $params->database = $databases[$checkDB]['path']; + $params->redirect(array('view'=>'rename'), sprintf($lang['db_renamed'], htmlencode($oldpath))." '".htmlencode($newpath)."'."); + } + else $params->redirect(array('view'=>'rename'), $lang['err'].': '.$lang['rename_only_managed']); + } + else + { + if(is_file($newpath) || is_dir($newpath)) + $params->redirect(array('view'=>'rename'), $lang['err'].": " . sprintf($lang['db_exists'], htmlencode($newpath))); + else + $params->redirect(array('view'=>'rename'), $lang['err'].": " . $lang['extension_not_allowed'].': '.implode(', ', array_map('htmlencode', $allowed_extensions)).'
      '.$lang['add_allowed_extension']); + } + } + + + //- Export (download a dump) an existing database + if(isset($_POST['export'])) + { + ob_end_clean(); + $export_filename = str_replace(array("\r", "\n"), '',$_POST['filename']); // against http header injection (php < 5.1.2 only) + if($_POST['export_type']=="sql") + { + header('Content-Type: text/sql'); + header('Content-Disposition: attachment; filename="'.$export_filename.'.'.$_POST['export_type'].'";'); + if(isset($_POST['tables'])) + $tables = $_POST['tables']; + else + { + $tables = array(); + $tables[0] = $_POST['single_table']; + } + $drop = isset($_POST['drop']); + $structure = isset($_POST['structure']); + $data = isset($_POST['data']); + $transaction = isset($_POST['transaction']); + $comments = isset($_POST['comments']); + $db = new Database($currentDB); + $db->export_sql($tables, $drop, $structure, $data, $transaction, $comments); + } + else if($_POST['export_type']=="csv") + { + header("Content-type: application/csv"); + header('Content-Disposition: attachment; filename="'.$export_filename.'.'.$_POST['export_type'].'";'); + header("Pragma: no-cache"); + header("Expires: 0"); + if(isset($_POST['tables'])) + $tables = $_POST['tables']; + else + { + $tables = array(); + $tables[0] = $_POST['single_table']; + } + $field_terminate = $_POST['export_csv_fieldsterminated']; + $field_enclosed = $_POST['export_csv_fieldsenclosed']; + $field_escaped = $_POST['export_csv_fieldsescaped']; + $null = $_POST['export_csv_replacenull']; + $crlf = isset($_POST['export_csv_crlf']); + $fields_in_first_row = isset($_POST['export_csv_fieldnames']); + $db = new Database($currentDB); + $db->export_csv($tables, $field_terminate, $field_enclosed, $field_escaped, $null, $crlf, $fields_in_first_row); + } + exit(); + } + + //- Import a file into an existing database + if(isset($_POST['import'])) + { + $db = new Database($currentDB); + $db->registerUserFunction($custom_functions); + if($_POST['import_type']=="sql") + { + $data = file_get_contents($_FILES["file"]["tmp_name"]); + $importSuccess = $db->import_sql($data); + } + else + { + $field_terminate = $_POST['import_csv_fieldsterminated']; + $field_enclosed = $_POST['import_csv_fieldsenclosed']; + $field_escaped = $_POST['import_csv_fieldsescaped']; + $null = $_POST['import_csv_replacenull']; + $fields_in_first_row = isset($_POST['import_csv_fieldnames']); + if(isset($_POST['single_table']) && $_POST['single_table']!='') + $table = $_POST['single_table']; + else + { + $table = basename($_FILES["file"]["name"],".csv"); + $i=""; + while($db->getTypeOfTable($table.$i)!="") + { + if($i=="") + $i=2; + else + $i++; + } + $table = $table.$i; + } + $importSuccess = $db->import_csv($_FILES["file"]["tmp_name"], $table, $field_terminate, $field_enclosed, $field_escaped, $null, $fields_in_first_row); + } + } + //- Download (backup) a database file (as SQLite file, not as dump) + if(isset($_GET['download']) && isManagedDB($_GET['download'])!==false) + { + ob_end_clean(); + header("Content-type: application/octet-stream"); + header('Content-Disposition: attachment; filename="'.basename($_GET['download']).'";'); + header("Pragma: no-cache"); + header("Expires: 0"); + readfile($_GET['download']); + exit; + } + + //- Select database (from session or first available) + if(!isset($currentDB) && count($databases)>0) + { + //set the current database to the first existing one in the array (default) + $currentDB = reset($databases); + $params->database = $currentDB['path']; + } + + if(isset($currentDB)) + { + //- Open database (creates a Database object) + $db = new Database($currentDB); //create the Database object + $db->registerUserFunction($custom_functions); + } + + // collect parameters early, just once + $target_table = isset($_GET['table']) ? $_GET['table'] : null; + // are we working on a view? let's check once here + $target_table_type = !is_null($target_table) ? $db->getTypeOfTable($target_table) : null; + if(is_null($target_table_type) && !is_null($target_table)) + $params->redirect(array('table'=>null), $lang['err'].': '.sprintf($lang['tbl_inexistent'], htmlencode($target_table))); + $params->table = $target_table; + + // initialize / change fulltexts and numrows parameter + if(isset($_GET['fulltexts'])) + $params->fulltexts = ($_GET['fulltexts'] ? 1 : 0); + else + $params->fulltexts = 0; + + if(isset($_GET['numRows']) && intval($_GET['numRows'])>0) + $params->numRows = intval($_GET['numRows']); + else + $params->numRows = $rowsNum; + + //- Switch on $_GET['action'] for operations without output + if(isset($_GET['action']) && isset($_GET['confirm'])) + { + switch($_GET['action']) + { + //- Table actions + + //- Create table (=table_create) + case "table_create": + $num = intval($_POST['rows']); + $name = $_POST['tablename']; + $primary_keys = array(); + for($i=0; $i<$num; $i++) + { + if($_POST[$i.'_field']!="" && isset($_POST[$i.'_primarykey'])) + { + $primary_keys[] = $_POST[$i.'_field']; + } + } + $query = "CREATE TABLE ".$db->quote($name)." ("; + for($i=0; $i<$num; $i++) + { + if($_POST[$i.'_field']!="") + { + $query .= $db->quote($_POST[$i.'_field'])." "; + $query .= $_POST[$i.'_type']." "; + if(isset($_POST[$i.'_primarykey'])) + { + if(count($primary_keys)==1) + { + $query .= "PRIMARY KEY "; + if(isset($_POST[$i.'_autoincrement']) && $db->getType() != "SQLiteDatabase") + $query .= "AUTOINCREMENT "; + } + $query .= "NOT NULL "; + } + if(!isset($_POST[$i.'_primarykey']) && isset($_POST[$i.'_notnull'])) + $query .= "NOT NULL "; + if($_POST[$i.'_defaultoption']!='defined' && $_POST[$i.'_defaultoption']!='none' && $_POST[$i.'_defaultoption']!='expr') + $query .= "DEFAULT ".$_POST[$i.'_defaultoption']." "; + elseif($_POST[$i.'_defaultoption']=='expr') + $query .= "DEFAULT (".$_POST[$i.'_defaultvalue'].") "; + elseif(isset($_POST[$i.'_defaultvalue']) && $_POST[$i.'_defaultoption']=='defined') + { + $typeAffinity = get_type_affinity($_POST[$i.'_type']); + if(($typeAffinity=="INTEGER" || $typeAffinity=="REAL" || $typeAffinity=="NUMERIC") && is_numeric($_POST[$i.'_defaultvalue'])) + $query .= "DEFAULT ".$_POST[$i.'_defaultvalue']." "; + else + $query .= "DEFAULT ".$db->quote($_POST[$i.'_defaultvalue'])." "; + } + $query = substr($query, 0, -1); + $query .= ", "; + } + } + if (count($primary_keys)>1) + { + $compound_key = ""; + foreach ($primary_keys as $primary_key) + { + $compound_key .= ($compound_key=="" ? "" : ", ") . $db->quote($primary_key); + } + $query .= "PRIMARY KEY (".$compound_key."), "; + } + $query = substr($query, 0, -2); + $query .= ")"; + $result = $db->query($query); + if($result === false) + $completed = $db->getError(true); + else + $completed = $lang['tbl']." '".htmlencode($_POST['tablename'])."' ".$lang['created'].".
      ".htmlencode($query).""; + $params->redirect(($result===false ? array() : array('action'=>'column_view', 'table'=>$name) ), $completed); + break; + + //- Empty table (=table_empty) + case "table_empty": + if(isset($_GET['pk'])) + $tables = json_decode($_GET['pk']); + else + $tables=array($_GET['table']); + $query1 = "BEGIN; "; + foreach($tables as $table) + { + if($db->getTypeOfTable($table)=='table') + $query1 .= "DELETE FROM ".$db->quote_id($table)."; "; + } + $query1 .= "COMMIT; "; + $result1=$db->multiQuery($query1); + if($result1 === false) + $completed = $db->getError(true); + if(isset($_POST['vacuum']) && $_POST['vacuum']) + { + $query2 = "VACUUM;"; + $result2 = $db->query($query2); + } + else + $query2 = ""; + if($result1 !== false) + $completed = $lang['tbl']." '".htmlencode(implode(', ',$tables))."' ".$lang['emptied'].".
      ".htmlencode($query1)."
      ".htmlencode($query2)."
      "; + if(count($tables)==1) + $action = array('action'=>'row_view'); + else + $action = array(); + $params->redirect(($result1===false ? array() : $action ), $completed); + break; + + //- Create view (=view_create) + case "view_create": + $query = "CREATE VIEW ".$db->quote($_POST['viewname'])." AS ".$_POST['select']; + $result = $db->query($query); + if($result === false) + $completed = $db->getError(true); + else + $completed = $lang['view']." '".htmlencode($_POST['viewname'])."' ".$lang['created'].".
      ".htmlencode($query).""; + $params->redirect(($result===false ? array() : array('action'=>'column_view', 'table'=>$_POST['viewname']) ), $completed); + break; + + //- Drop table (or view) (=table_drop) + case "table_drop": + if(isset($_GET['pk'])) + $tables = json_decode($_GET['pk']); + else + $tables=array($_GET['table']); + $query1 = "BEGIN; "; + foreach($tables as $table) + { + if($db->getTypeOfTable($table)=='table') + $query1 .= "DROP TABLE ".$db->quote_id($table)."; "; + else + $query1 .= "DROP VIEW ".$db->quote_id($table)."; "; + } + $query1 .= "COMMIT; "; + $result1=$db->multiQuery($query1); + if($result1 === false) + $completed = $db->getError(true); + if(isset($_POST['vacuum']) && $_POST['vacuum']) + { + $query2 = "VACUUM;"; + $result2 = $db->query($query2); + } + else + $query2 = ""; + if($result1 !== false) + { + $target_table = null; + $completed = $lang['tbl'].' / '.$lang['view']." '".htmlencode(implode(', ',$tables))."' ".$lang['dropped'].".
      ".htmlencode($query1)."
      ".htmlencode($query2)."
      ";; + } + $params->redirect(array('table'=>null), $completed); + break; + + //- Rename table (=table_rename) + case "table_rename": + $query = "ALTER TABLE ".$db->quote_id($_GET['table'])." RENAME TO ".$db->quote($_POST['newname']); + $type = $db->getTypeOfTable($_GET['table']); + if($db->getVersion()==3 && $type=='table' // SQLite 3 can rename tables, not views + // In SQL(ite) table names are case-insensitve, so changing is not supported by SQLite. + // But table names are stored and displayed case sensitive, so we use the workaround for case sensitive renaming. + && !($_GET['table'] !== $_POST['newname'] && strtolower($_GET['table']) === strtolower($_POST['newname'])) + ) + $result = $db->query($query, true); + else + // Workaround can rename tables of sqlite2 and views of both sqlite versions. Can also do case sensitive renames. + $result = $db->query($query, false); + if($result === false) + $completed = $db->getError(true); + else + { + $completed = $lang['tbl']." '".htmlencode($_GET['table'])."' ".$lang['renamed']." '".htmlencode($_POST['newname'])."'.
      ".htmlencode($query).""; + $target_table = $_POST['newname']; + } + $params->redirect(array('action'=>'row_view', 'table'=>$_POST['newname']), $completed); + break; + + //- Search table (=table_search) + case "table_search": + $searchValues = array(); + $searchOperators = array(); + + $tableInfo = $db->getTableInfo($target_table); + $j = 0; + $whereExpr = array(); + for($i=0; $iquote_id($field)." ".$operator; + else{ + if($operator == "LIKE%"){ + $operator = "LIKE"; + if(!preg_match('/(^%)|(%$)/', $value)) $value = '%'.$value.'%'; + $searchValues[$field] = array($value); + $valueQuoted = $db->quote($value); + } + elseif($operator == 'IN' || $operator == 'NOT IN') + { + $value = trim($value, '() '); + $values = explode(',',$value); + $values = array_map('trim', $values, array_fill(0,count($values),' \'"')); + if($operator == 'IN') + $searchValues[$field] = $values; + $values = array_map(array($db, 'quote'), $values); + $valueQuoted = '(' .implode(', ', $values) . ')'; + } + else + { + $searchValues[$field] = array($value); + $valueQuoted = $db->quote($value); + } + $whereExpr[$j] = $db->quote_id($field)." ".$operator." ".$valueQuoted; + } + $j++; + } + } + $searchWhere = ''; + if(sizeof($whereExpr)>0) + { + $searchWhere .= " WHERE ".$whereExpr[0]; + for($i=1; $i $searchWhere, + 'values' => $searchValues, + 'operators' => $searchOperators + ); + $params->redirect(array('action'=>'table_search','search'=>$searchID)); + break; + + //- Row actions + + //- Create row (=row_create) + case "row_create": + $completed = ""; + $num = $_POST['newRows']; + $z = 0; + $error = false; + + $tableInfo = $db->getTableInfo($target_table); + + for($i=0; $i<$num; $i++) + { + if(!isset($_POST[$i.":ignore"])) + { + $query_cols = ""; + $query_vals = ""; + $all_default = true; + for($j=0; $jquote_id($tableInfo[$j]['name']).","; + + $function = $_POST["function_".$j][$i]; + if($function!="") + $query_vals .= $function."("; + if(preg_match('/^BLOB/', $type) && !$hexblobs) + $query_vals .= ':blobval'.$j; + elseif(preg_match('/^BLOB/', $type) && $hexblobs) + $query_vals .= 'X'.$db->quote($value); + elseif(($typeAffinity=="TEXT" || $typeAffinity=="NONE") && !$null) + $query_vals .= $db->quote($value); + elseif(($typeAffinity=="INTEGER" || $typeAffinity=="REAL"|| $typeAffinity=="NUMERIC") && $value=="") + $query_vals .= "NULL"; + elseif($null) + $query_vals .= "NULL"; + else + $query_vals .= $db->quote($value); + if($function!="") + $query_vals .= ")"; + $query_vals .= ","; + } + $query = "INSERT INTO ".$db->quote_id($target_table); + if(!$all_default) + { + $query_cols = substr($query_cols, 0, strlen($query_cols)-1); + $query_vals = substr($query_vals, 0, strlen($query_vals)-1); + + $query.=" (". $query_cols . ") VALUES (". $query_vals. ")"; + } else { + $query .= " DEFAULT VALUES"; + } + if(isset($blobFiles)) + { + // blob files need to be done using a prepared statement because the query size would be too large + $handle = $db->prepareQuery($query); + foreach($blobFiles as $j=>$filename) + $db->bindValue($handle, ':blobval'.$j, file_get_contents($filename), 'blob'); + + $result1 = $db->executePrepared($handle, false); + } + else + $result1 = $db->query($query); + if($result1===false) + $error = true; + $completed .= "".htmlencode($query)."
      "; + $z++; + } + } + if($error) + $completed = $db->getError(true) . $completed; + else + $completed = $z." ".$lang['rows']." ".$lang['inserted'].".

      ".$completed; + $params->redirect(array('action'=>'row_view'), $completed); + break; + + //- Delete row (=row_delete) + case "row_delete": + $pks = json_decode($_GET['pk']); + + $query = "DELETE FROM ".$db->quote_id($target_table)." WHERE (".$db->wherePK($target_table,json_decode($pks[0])).")"; + for($i=1; $iwherePK($target_table,json_decode($pks[$i])).")"; + } + $result = $db->query($query); + if($result === false) + $completed = $db->getError(true); + else + $completed = sizeof($pks)." ".$lang['rows']." ".$lang['deleted'].".
      ".htmlencode($query).""; + $params->redirect(array('action'=>'row_view'), $completed); + break; + + //- Edit row (=row_edit) + case "row_edit": + $pks = json_decode($_GET['pk']); + $z = 0; + + $tableInfo = $db->getTableInfo($target_table); + + if(isset($_POST['new_row'])) + $completed = ""; + else + $completed = sizeof($pks)." ".$lang['rows']." ".$lang['affected'].".

      "; + + for($i=0; $iquote_id($tableInfo[$j]['name']).' AS \'blob\' FROM '.$db->quote_id($target_table).' WHERE '.$db->wherePK($target_table, json_decode($pks[$i])); + $bl = $db->select($select); + $blobFiles[$j] = $bl['blob']; + unset($bl); + } + else + { + if($_FILES[$i.":".$j]["error"] == UPLOAD_ERR_OK && is_file($_FILES[$i.":".$j]["tmp_name"])) + $blobFiles[$j] = file_get_contents($_FILES[$i.":".$j]["tmp_name"]); + else + $blobFiles[$j] = null; + } + } + else + $value = $_POST[$j][$i]; + } + else + $value = ""; + if(!preg_match('/^BLOB/', $type) && $value===$tableInfo[$j]['dflt_value']) + { + // if the value is the default value, skip it + continue; + } + $all_default = false; + $query_cols .= $db->quote_id($tableInfo[$j]['name']).","; + + $function = $_POST["function_".$j][$i]; + if($function!="") + $query_vals .= $function."("; + if(preg_match('/^BLOB/', $type) && !$hexblobs) + $query_vals .= ':blobval'.$j; + elseif(preg_match('/^BLOB/', $type) && $hexblobs) + $query_vals .= 'X'.$db->quote($value); + elseif(($typeAffinity=="TEXT" || $typeAffinity=="NONE") && !$null) + $query_vals .= $db->quote($value); + elseif(($typeAffinity=="INTEGER" || $typeAffinity=="REAL"|| $typeAffinity=="NUMERIC") && $value=="") + $query_vals .= "NULL"; + elseif($null) + $query_vals .= "NULL"; + else + $query_vals .= $db->quote($value); + if($function!="") + $query_vals .= ")"; + $query_vals .= ","; + } + $query = "INSERT INTO ".$db->quote_id($target_table); + if(!$all_default) + { + $query_cols = substr($query_cols, 0, strlen($query_cols)-1); + $query_vals = substr($query_vals, 0, strlen($query_vals)-1); + + $query.=" (". $query_cols . ") VALUES (". $query_vals. ")"; + } else { + $query .= " DEFAULT VALUES"; + } + + if(isset($blobFiles)) + { + // blob files need to be done using a prepared statement because the query size would be too large + $handle = $db->prepareQuery($query); + foreach($blobFiles as $j=>$blobval) + $db->bindValue($handle, ':blobval'.$j, $blobval, 'blob'); + + $result1 = $db->executePrepared($handle, false); + } + else + $result1 = $db->query($query); + if($result1===false) + $error = true; + $z++; + } + else + { + $query = "UPDATE ".$db->quote_id($target_table)." SET "; + for($j=0; $jquote_id($tableInfo[$j]['name'])."="; + if($function!="") + $query .= $function."("; + if($null) + $query .= "NULL"; + else + { + if(preg_match('/^BLOB/', $type) && !$hexblobs) + $query .= ':blobval'.$j; + elseif(preg_match('/^BLOB/', $type) && $hexblobs) + $query .= 'X'.$db->quote($_POST[$j][$i]); + else + $query .= $db->quote($_POST[$j][$i]); + } + if($function!="") + $query .= ")"; + $query .= ", "; + } + $query = substr($query, 0, -2); + $query .= " WHERE ".$db->wherePK($target_table, json_decode($pks[$i])); + if(isset($blobFiles)) + { + // blob files need to be done using a prepared statement because the query size would be too large + $handle = $db->prepareQuery($query); + foreach($blobFiles as $j=>$filename) + $db->bindValue($handle, ':blobval'.$j, file_get_contents($filename), 'blob'); + + $result1 = $db->executePrepared($handle, false); + } + else + $result1 = $db->query($query); + if($result1===false) + { + $error = true; + } + } + $completed .= "".htmlencode($query)."
      "; + } + if($error) + $completed = $db->getError(true) . $completed; + elseif(isset($_POST['new_row'])) + $completed = $z." ".$lang['rows']." ".$lang['inserted'].".

      ".$completed; + $params->redirect(array('action'=>'row_view'), $completed); + break; + + + case "row_get_blob": + $blobVal = $db->select("SELECT ".$db->quote_id($_GET['column'])." AS 'blob' FROM ".$db->quote_id($target_table)." WHERE ".$db->wherePK($target_table, json_decode($_GET['pk']))); + $filename = 'download'; + if(function_exists('getimagesizefromstring')) // introduced in PHP 5.4.0 + $imagesize = getimagesizefromstring($blobVal['blob']); + if(isset($imagesize) && $imagesize!==false && isset($imagesize['mime'])) + $mimetype = $imagesize['mime']; + elseif(class_exists('finfo')) // included since php 5.3.0, but might be disabled on Windows + { + $finfo = new finfo(FILEINFO_MIME); + $mimetype = $finfo->buffer($blobVal['blob']); + } + else + $mimetype = "application/octet-stream"; + + if(isset($imagesize) && $imagesize!==false && isset($imagesize[2])) + $extension = image_type_to_extension($imagesize[2]); + else + $extension = '.blob'; + ob_end_clean(); + header('Content-Length: '.strlen($blobVal['blob'])); + header("Content-type: ".$mimetype); + if(isset($_GET['download_blob']) && $_GET['download_blob']) + header('Content-Disposition: attachment; filename="'.$filename.$extension.'";'); + header("Pragma: no-cache"); + header("Expires: 0"); + echo $blobVal['blob']; + exit; + break; + + + //- Column actions + + //- Create column (=column_create) + case "column_create": + $num = intval($_POST['rows']); + for($i=0; $i<$num; $i++) + { + if($_POST[$i.'_field']!="") + { + $query = "ALTER TABLE ".$db->quote_id($target_table)." ADD ".$db->quote($_POST[$i.'_field'])." "; + $query .= $_POST[$i.'_type']." "; + if(isset($_POST[$i.'_primarykey'])) + $query .= "PRIMARY KEY "; + if(isset($_POST[$i.'_notnull'])) + $query .= "NOT NULL "; + if($_POST[$i.'_defaultoption']!='defined' && $_POST[$i.'_defaultoption']!='none' && $_POST[$i.'_defaultoption']!='expr') + $query .= "DEFAULT ".$_POST[$i.'_defaultoption']." "; + elseif($_POST[$i.'_defaultoption']=='expr') + $query .= "DEFAULT (".$_POST[$i.'_defaultvalue'].") "; + elseif(isset($_POST[$i.'_defaultvalue']) && $_POST[$i.'_defaultoption']=='defined') + { + $typeAffinity = get_type_affinity($_POST[$i.'_type']); + if(($typeAffinity=="INTEGER" || $typeAffinity=="REAL" || $typeAffinity=="NUMERIC") && is_numeric($_POST[$i.'_defaultvalue'])) + $query .= "DEFAULT ".$_POST[$i.'_defaultvalue']." "; + else + $query .= "DEFAULT ".$db->quote($_POST[$i.'_defaultvalue'])." "; + } + if($db->getVersion()==3 && + ($_POST[$i.'_defaultoption']=='defined' || $_POST[$i.'_defaultoption']=='none' || $_POST[$i.'_defaultoption']=='NULL') + // Sqlite3 cannot add columns with default values that are not constant + && !isset($_POST[$i.'_primarykey']) + // sqlite3 cannot add primary key columns + && (!isset($_POST[$i.'_notnull']) || $_POST[$i.'_defaultoption']!='none') + // SQLite3 cannot add NOT NULL columns without DEFAULT even if the table is empty + ) + // use SQLITE3 ALTER TABLE ADD COLUMN + $result = $db->query($query, true); + else + // use ALTER TABLE workaround + $result = $db->query($query, false); + if($result===false) + $error = true; + } + } + if($error) + $completed = $db->getError(true); + else + $completed = $lang['tbl']." '".htmlencode($target_table)."' ".$lang['altered']."."; + $params->redirect(array('action'=>'column_view'), $completed); + break; + + //- Delete column (=column_delete) + case "column_delete": + $pks = explode(":", $_GET['pk']); + $query = "ALTER TABLE ".$db->quote_id($target_table).' DROP '.$db->quote_id($pks[0]); + for($i=1; $iquote_id($pks[$i]); + } + $result = $db->query($query); + if($result === false) + $completed = $db->getError(true); + else + $completed = $lang['tbl']." '".htmlencode($target_table)."' ".$lang['altered']."."; + $params->redirect(array('action'=>'column_view'), $completed); + break; + + //- Add a primary key (=primarykey_add) + case "primarykey_add": + $pks = explode(":", $_GET['pk']); + $query = "ALTER TABLE ".$db->quote_id($target_table).' ADD PRIMARY KEY ('.$db->quote_id($pks[0]); + for($i=1; $iquote_id($pks[$i]); + } + $query .= ")"; + $result = $db->query($query); + if($result === false) + $completed = $db->getError(true); + else + $completed = $lang['tbl']." '".htmlencode($target_table)."' ".$lang['altered']."."; + $params->redirect(array('action'=>'column_view'), $completed); + break; + + //- Edit column (=column_edit) + case "column_edit": + $query = "ALTER TABLE ".$db->quote_id($target_table).' CHANGE '.$db->quote_id($_POST['oldvalue'])." ".$db->quote($_POST['0_field'])." ".$_POST['0_type']; + $result = $db->query($query); + if($result === false) + $completed = $db->getError(true); + else + $completed = $lang['tbl']." '".htmlencode($target_table)."' ".$lang['altered']."."; + $params->redirect(array('action'=>'column_view'), $completed); + break; + + //- Delete trigger (=trigger_delete) + case "trigger_delete": + $query = "DROP TRIGGER ".$db->quote_id($_GET['pk']); + $result = $db->query($query); + if($result === false) + $completed = $db->getError(true); + else + $completed = $lang['trigger']." '".htmlencode($_GET['pk'])."' ".$lang['deleted'].".
      ".htmlencode($query).""; + $params->redirect(array('action'=>'column_view'), $completed); + break; + + //- Delete index (=index_delete) + case "index_delete": + $query = "DROP INDEX ".$db->quote_id($_GET['pk']); + $result = $db->query($query); + if($result === false) + $completed = $db->getError(true); + else + $completed = $lang['index']." '".htmlencode($_GET['pk'])."' ".$lang['deleted'].".
      ".htmlencode($query).""; + $params->redirect(array('action'=>'column_view'), $completed); + break; + + //- Create trigger (=trigger_create) + case "trigger_create": + $str = "CREATE TRIGGER ".$db->quote($_POST['trigger_name']); + if($_POST['beforeafter']!="") + $str .= " ".$_POST['beforeafter']; + $str .= " ".$_POST['event']." ON ".$db->quote_id($target_table); + if(isset($_POST['foreachrow'])) + $str .= " FOR EACH ROW"; + if($_POST['whenexpression']!="") + $str .= " WHEN ".$_POST['whenexpression']; + $str .= " BEGIN"; + $str .= " ".$_POST['triggersteps']; + $str .= " END"; + $query = $str; + $result = $db->query($query); + if($result === false) + $completed = $db->getError(true); + else + $completed = $lang['trigger']." ".$lang['created'].".
      ".htmlencode($query).""; + $params->redirect(array('action'=>'column_view'), $completed); + break; + + //- Create index (=index_create) + case "index_create": + $num = $_POST['num']; + if($_POST['name']=="") + { + $completed = $lang['blank_index']; + } + else if($_POST['0_field']=="") + { + $completed = $lang['one_index']; + } + else + { + $str = "CREATE "; + if($_POST['duplicate']=="no") + $str .= "UNIQUE "; + $str .= "INDEX ".$db->quote($_POST['name'])." ON ".$db->quote_id($target_table)." ("; + $str .= $db->quote_id($_POST['0_field']).$_POST['0_order']; + for($i=1; $i<$num; $i++) + { + if($_POST[$i.'_field']!="") + $str .= ", ".$db->quote_id($_POST[$i.'_field']).$_POST[$i.'_order']; + } + $str .= ")"; + if(isset($_POST['where']) && $_POST['where']!='') + $str.=" WHERE ".$_POST['where']; + $query = $str; + $result = $db->query($query); + if($result === false) + $completed = $db->getError(true); + else + $completed = $lang['index']." ".$lang['created'].".
      ".htmlencode($query).""; + } + $params->redirect(array('action'=>'column_view'), $completed); + break; + } + } +} + +// if not in debug mode, destroy all output until here +if($debug) + $bufferedOutput = ob_get_contents(); +ob_end_clean(); + +//- HTML: output starts here +header('Content-Type: text/html; charset=utf-8'); +?> + + + + + + +<?php echo PROJECT ?> + +", PHP_EOL; +else + // only use the default stylesheet if an external one does not exist + echo "", PHP_EOL; + +// HTML: output help text, then exit +if(isset($_GET['help'])) +{ + //help section array + $help = array($lang['help1'] => sprintf($lang['help1_x'], PROJECT, PROJECT, PROJECT)); + for($i=2; isset($lang['help'.$i]); $i++) + $help[$lang['help'.$i]]=$lang['help'.$i.'_x']; + ?> + + +
      + "; + echo "".PROJECT." v".VERSION." ".$lang['help_doc']."

      "; + foreach((array)$help as $key => $val) + { + echo "".$key."
      "; + } + echo "
      "; + echo "

      "; + foreach((array)$help as $key => $val) + { + echo "
      "; + echo "".$key.""; + echo "
      "; + echo $val; + echo "
      "; + echo "".$lang['back_top'].""; + echo "
      "; + } + ?> +
+ + + isAuthorized()) +{ + //- Javascript include + ?> + + + + + + + + + + + + + + +".$lang['bad_php_directive']."
"; + echo ""; + exit(); +} + +//- HTML: login screen if not authorized, exit +if(!$auth->isAuthorized()) +{ + echo "
"; + echo "

v".VERSION."

"; + echo "
"; + if (isset($_GET['failed'])) + echo "".$lang['passwd_incorrect']."

"; + echo $params->getForm(); + echo $lang['passwd'].":
"; + echo "

"; + echo ""; + echo ""; + echo ""; + echo "
"; + echo "
"; + echo "
"; + echo "
"; + echo "".$lang['powered']." ".PROJECT." | "; + printf($lang['page_gen'], $pageTimer); + echo "
"; + echo ""; + exit(); +} + +//- User is authorized, display the main application + +if(count($databases)==0) // the database array is empty, offer to create a new database +{ + //- HTML: form to create a new database, exit + if($directory!==false && is_writable($directory) && (is_executable($directory) || DIRECTORY_SEPARATOR === '\\')) + { + echo "
"; + printf($lang['no_db'], PROJECT, PROJECT); + echo "
"; + //if the user has performed some action, show the resulting message + if(isset($_GET['message']) && isset($_SESSION[COOKIENAME.'messages'][$_GET['message']])) + { + echo "
"; + echo $_SESSION[COOKIENAME.'messages'][$_GET['message']]; + echo "

"; + unset($_SESSION[COOKIENAME.'messages'][$_GET['message']]); + } + echo "
".$lang['db_create'].""; + echo $params->getForm(array('table'=>null), 'post', false, 'create_database'); + echo " "; + if(class_exists('SQLiteDatabase') && (class_exists('SQLite3') || class_exists('PDO'))) + { + echo ""; + } + echo ""; + echo ""; + echo "
"; + } + elseif($directory!==false && !is_executable($directory) && DIRECTORY_SEPARATOR === '/') + { + echo "
"; + echo $lang['err'].": ".sprintf($lang['dir_not_executable'], PROJECT, $directory); + echo "

"; + } + else + { + echo "
"; + echo $lang['err'].": ".sprintf($lang['no_db2'], PROJECT); + echo "

"; + } + exit(); +} + +//- HTML: sidebar +echo '
'; +echo "
"; +echo "

"; +echo " v".VERSION.""; +echo "

"; +echo ""; + +//- HTML: database list +$db->print_db_list(); +echo "
"; +echo "null))."'"; +if (!$target_table) + echo " class='active_table'"; +$name = $currentDB['name']; +if(strlen($name)>25) + $name = "...".substr($name, strlen($name)-22, 22); +echo ">".htmlencode($name).""; +echo ""; + +//- HTML: table list +$tables = $db->getTables(true, false); +foreach($tables as $tableName => $tableType) +{ + echo ""; + echo $params->getLink(array('action'=>'column_view', 'table'=>$tableName), "[".$lang[$tableType=='table'?'tbl':'view']."]"); + echo " "; + echo $params->getLink(array('action'=>'row_view', 'table'=>$tableName), htmlencode($tableName), + ($target_table == $tableName ? 'active_table' : '') ); + echo "
"; +} +if(count($tables)==0) + echo $lang['no_tbl']; +echo "
"; + +//- HTML: form to create a new database +if($directory!==false && is_writable($directory)) +{ + echo "
".$lang['db_create']." ".helpLink($lang['help2']).""; + echo $params->getForm(array('table'=>null), 'post', false, 'create_database'); + echo ""; + if(class_exists('SQLiteDatabase') && (class_exists('SQLite3') || class_exists('PDO'))) + { + echo ""; + } + echo ""; + echo ""; + echo "
"; +} + +echo "
"; +echo $params->getForm(array(),'get'); +echo ""; +echo ""; +echo "
"; +echo "
"; +echo '
'; + +//- HTML: breadcrumb navigation +echo $params->getLink(array('table'=>null), htmlencode($currentDB['name'])); +if ($target_table) + echo " → ".$params->getLink(array('action'=>'row_view'), htmlencode($target_table)); +echo "

"; + +//- Show the various tab views for a table +if($target_table) +{ + //- HTML: tabs + echo $params->getLink(array('action'=>'row_view'), $lang['browse'], + (in_array($_GET['action'], array('row_view', 'row_editordelete') ) ? 'tab_pressed' : 'tab')); + + echo $params->getLink(array('action'=>'column_view'), $lang['struct'], + (in_array($_GET['action'], array('column_view', 'column_edit', 'column_confirm', 'primarykey_add', 'column_create', 'index_create', 'index_delete', 'trigger_create', 'trigger_delete') ) ? 'tab_pressed' : 'tab')); + + echo $params->getLink(array('action'=>'table_sql'), $lang['sql'], + ($_GET['action']=="table_sql" ? 'tab_pressed' : 'tab')); + + echo $params->getLink(array( + 'action' => 'table_search', + 'oldSearch' => (isset($_GET['search'])?$_GET['search']:null) + ), $lang['srch'], ($_GET['action']=="table_search" ? 'tab_pressed' : 'tab')); + + if($target_table_type == 'table' && $db->isWritable() && $db->isDirWritable()) + echo $params->getLink(array('action'=>'row_create'), $lang['insert'], + ($_GET['action']=="row_create" ? 'tab_pressed' : 'tab')); + + echo $params->getLink(array('action'=>'table_export'), $lang['export'], + ($_GET['action']=="table_export" ? 'tab_pressed' : 'tab')); + + if($target_table_type == 'table' && $db->isWritable() && $db->isDirWritable()) + echo $params->getLink(array('action'=>'table_import'), $lang['import'], + ($_GET['action']=="table_import" ? 'tab_pressed' : 'tab')); + + if($db->isWritable() && $db->isDirWritable()) + echo $params->getLink(array('action'=>'table_rename'), $lang['rename'], + ($_GET['action']=="table_rename" ? 'tab_pressed' : 'tab')); + + if($target_table_type == 'table' && $db->isWritable() && $db->isDirWritable()) + { + echo $params->getLink(array('action'=>'table_confirm','action2'=>'table_empty'), $lang['empty'], + (isset($_GET['action2']) && $_GET['action2']=="table_empty" ? 'tab_pressed empty' : 'tab empty')); + + echo $params->getLink(array('action'=>'table_confirm','action2'=>'table_drop'), $lang['drop'], + (isset($_GET['action2']) && $_GET['action2']=="table_drop" ? 'tab_pressed drop' : 'tab drop')); + } elseif($db->isWritable() && $db->isDirWritable()) { + echo $params->getLink(array('action'=>'table_confirm','action2'=>'table_drop'), $lang['drop'], + (isset($_GET['action2']) && $_GET['action2']=="table_drop" ? 'tab_pressed drop' : 'tab drop')); + } +} +else +//- Show the various tab views for a database +{ + $view = isset($_GET['view']) ? $_GET['view'] : 'structure'; + + echo $params->getLink(array('view'=>'structure'), $lang['struct'], ($view=="structure" ? 'tab_pressed': 'tab') ); + + echo $params->getLink(array('view'=>'sql'), $lang['sql'], ($view=="sql" ? 'tab_pressed': 'tab') ); + + echo $params->getLink(array('view'=>'export'), $lang['export'], ($view=="export" ? 'tab_pressed': 'tab') ); + + if($db->isWritable() && $db->isDirWritable()) + echo $params->getLink(array('view'=>'import'), $lang['import'], ($view=="import" ? 'tab_pressed': 'tab') ); + + if($db->isWritable() && $db->isDirWritable()) + echo $params->getLink(array('view'=>'vacuum'), $lang['vac'], ($view=="vacuum" ? 'tab_pressed': 'tab') ); + + if($directory!==false && is_writable($directory)) + { + + echo $params->getLink(array('view'=>'rename'), $lang['db_rename'], ($view=="rename" ? 'tab_pressed': 'tab') ); + + echo $params->getLink(array('view'=>'delete'), "".$lang['db_del']."", ($view=="delete" ? 'tab_pressed delete_db': 'tab delete_db') ); + } +} + +echo "
"; +echo "
"; + +//- HTML: confirmation panel +//if the user has performed some action, show the resulting message +if(isset($_GET['message']) && isset($_SESSION[COOKIENAME.'messages'][$_GET['message']])) +{ + echo "
"; + echo $_SESSION[COOKIENAME.'messages'][$_GET['message']]; + echo "

"; + unset($_SESSION[COOKIENAME.'messages'][$_GET['message']]); +} + + +//- Switch on $_GET['action'] for operations with output +if(isset($_GET['action']) && !isset($_GET['confirm'])) +{ + switch($_GET['action']) + { + //- Table actions + + //- Confirm table action (=table_confirm) + case "table_confirm": + if(isset($_GET['check'])) + $pks = $_GET['check']; + elseif(isset($_GET['table'])) + $pks = array($_GET['table']); + else $pks = array(); + + if(sizeof($pks)==0) //nothing was selected so show an error + { + echo "
"; + echo $lang['err'].": ".$lang['no_sel']; + echo "
"; + echo "

"; + echo $params->getLink(array(), $lang['return']); + } + else + { + echo $params->getForm(array('action'=>$_GET['action2'], 'confirm'=>'1', 'pk'=>json_encode($pks))); + echo "
"; + printf($lang['ques_'.$_GET['action2']], htmlencode(implode(', ',$pks)), htmlencode($target_table)); + echo "

"; + echo " ".$lang['vac_on_empty']."

"; + echo " "; + if(count($pks)==1) + $action = array('action'=>'row_view'); + else + $action = array('table'=>null); + echo $params->getLink($action, $lang['cancel']); + echo "
"; + } + break; + + //- Create table (=table_create) + case "table_create": + $query = "SELECT name FROM sqlite_master WHERE type='table' AND name=".$db->quote($_GET['tablename']); + $results = $db->selectArray($query); + if(sizeof($results)>0) + $exists = true; + else + $exists = false; + echo "

".$lang['create_tbl'].": '".htmlencode($_GET['tablename'])."'

"; + if($_GET['tablefields']=="" || intval($_GET['tablefields'])<=0) + echo $lang['specify_fields']; + else if($_GET['tablename']=="") + echo $lang['specify_tbl']; + else if($exists) + echo $lang['tbl_exists']; + else + { + $num = intval($_GET['tablefields']); + $name = $_GET['tablename']; + echo $params->getForm(array('action'=>'table_create', 'confirm'=>'1')); + echo ""; + echo ""; + echo ""; + echo ""; + $headings = array($lang['fld'], $lang['type'], $lang['prim_key']); + if($db->getType() != "SQLiteDatabase") $headings[] = $lang['autoincrement']; + $headings[] = $lang['not_null']; + $headings[] = $lang['def_val']; + for($k=0; $k" . $headings[$k] . ""; + echo ""; + + for($i=0; $i<$num; $i++) + { + $tdWithClass = ""; + echo $tdWithClass; + echo ""; + echo ""; + echo $tdWithClass; + echo ""; + echo ""; + echo $tdWithClass; + echo ""; + echo ""; + if($db->getType() != "SQLiteDatabase") + { + echo $tdWithClass; + echo ""; + echo ""; + } + echo $tdWithClass; + echo ""; + echo ""; + echo $tdWithClass; + echo ""; + echo ""; + echo ""; + echo ""; + } + echo ""; + echo ""; + echo ""; + echo "
"; + echo "
"; + echo " "; + echo $params->getLink(array(), $lang['cancel']); + echo "
"; + echo ""; + if($db->getType() != "SQLiteDatabase") echo ""; + } + break; + + //- Perform SQL query on table (=table_sql) + case "table_sql": + if(isset($_POST['query']) && $_POST['query']!="") + { + $delimiter = $_POST['delimiter']; + $queryStr = $_POST['queryval']; + //save the queries in history if necessary + if($maxSavedQueries!=0 && $maxSavedQueries!=false) + { + if(!isset($_SESSION[COOKIENAME.'query_history'])) + $_SESSION[COOKIENAME.'query_history'] = array(); + $_SESSION[COOKIENAME.'query_history'][md5(strtolower($queryStr))] = $queryStr; + if(sizeof($_SESSION[COOKIENAME.'query_history']) > $maxSavedQueries) + array_shift($_SESSION[COOKIENAME.'query_history']); + } + $query = explode_sql($delimiter, $queryStr); //explode the query string into individual queries based on the delimiter + + for($i=0; $iquery($query[$i]); + + echo "
"; + echo "".htmlencode($query[$i]).""; + if($table_result === NULL || $table_result === false) + { + echo "
".$lang['err'].": ".htmlencode($db->getError())."
"; + } + echo "

"; + if($row = $db->fetch($table_result, 'num')) + { + for($j=0; $jgetColumnName($table_result,$j); + echo ""; + echo ""; + for($j=0; $j"; + echo htmlencode($headers[$j]); + echo ""; + } + echo ""; + $rowCount = 0; + for(; $rowCount==0 || $row = $db->fetch($table_result, 'num'); $rowCount++) + { + $tdWithClass = ""; + for($z=0; $zNULL"; + else + echo htmlencode(subString($row[$z])); + echo ""; + } + echo ""; + } + $queryTimer->stop(); + echo "
"; + echo "


"; + + + if($table_result !== NULL && $table_result !== false) + { + echo "
"; + if($rowCount>0 || $db->getAffectedRows()==0) + { + printf($lang['show_rows'], $rowCount); + } + if($db->getAffectedRows()>0 || $rowCount==0) + { + echo $db->getAffectedRows()." ".$lang['rows_aff']." "; + } + printf($lang['query_time'], $queryTimer); + echo "
"; + } + + + } + } + } + } + else + { + $delimiter = ";"; + $queryStr = "SELECT * FROM ".$db->quote_id($target_table)." WHERE 1"; + } + + echo "
"; + echo "".sprintf($lang['run_sql'],htmlencode($db->getName())).""; + echo $params->getForm(array('action'=>'table_sql')); + if(isset($_SESSION[COOKIENAME.'query_history']) && sizeof($_SESSION[COOKIENAME.'query_history'])>0) + { + echo "".$lang['recent_queries']."
    "; + foreach($_SESSION[COOKIENAME.'query_history'] as $key => $value) + echo "
  • ".htmlencode($value)."
  • "; + echo "


"; + } + echo "
"; + echo ""; + echo ""; + echo "
"; + echo "
"; + echo $lang['fields']."
"; + echo ""; + echo ""; + echo "
"; + echo "
"; + echo $lang['delimit']." "; + echo ""; + echo ""; + echo "
"; + break; + + //- Export table (=table_export) + case "table_export": + echo $params->getForm(); + echo "
".$lang['export'].""; + echo ""; + echo ""; + echo "
"; + echo "
"; + + echo "
".$lang['options'].""; + echo " ".helpLink($lang['help5'])."
"; + echo " ".helpLink($lang['help6'])."
"; + echo " ".helpLink($lang['help7'])."
"; + echo " ".helpLink($lang['help8'])."
"; + echo " ".helpLink($lang['help9'])."
"; + echo "
"; + + echo ""; + + echo "
"; + echo "

"; + echo "
".$lang['save_as'].""; + $file = pathinfo($db->getPath()); + $name = $file['filename']; + echo " "; + echo "
"; + echo ""; + echo "
".sprintf($lang['backup_hint'], + $params->getLink(array('download' => $currentDB['path'], 'token' => $_SESSION[COOKIENAME.'token']), $lang["backup_hint_linktext"], '', $lang['backup']))."
"; + break; + + //- Import table (=table_import) + case "table_import": + if(isset($_POST['import'])) + { + echo "
"; + if($importSuccess===true) + echo $lang['import_suc']; + else + echo $lang['err'].': '.htmlencode($importSuccess); + echo "

"; + } + echo $params->getForm(array('action' => 'table_import'), 'post', true); + echo "
".$lang['import_into']." ".htmlencode($target_table).""; + echo ""; + echo "
"; + echo "
"; + + echo "
".$lang['options'].""; + echo $lang['no_opt']; + echo "
"; + + echo ""; + + echo "
"; + echo "

"; + + echo "
".$lang['import_f'].""; + echo "".$lang['max_file_size'].": ".number_format(fileUploadMaxSize()/1024/1024)." MiB ".helpLink($lang['help11'])."
"; + echo ""; + echo ""; + echo "
"; + break; + + //- Rename table (=table_rename) + case "table_rename": + echo $params->getForm(array('action'=>'table_rename', 'confirm'=>'1')); + printf($lang['rename_tbl'], htmlencode($target_table)); + echo " "; + echo ""; + break; + + //- Search table (=table_search) + case "table_search": + if(!isset($_GET['search'])) + { + $tableInfo = $db->getTableInfo($target_table); + + echo $params->getForm(array('action'=>'table_search', 'confirm'=>'1')); + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + for($i=0; $i"; + $tdWithClassLeft = ""; + echo $tdWithClassLeft; + echo htmlencode($field); + echo ""; + echo $tdWithClassLeft; + echo htmlencode($type); + echo ""; + echo $tdWithClassLeft; + echo ""; + echo ""; + echo $tdWithClassLeft; + if($typeAffinity=="INTEGER" || $typeAffinity=="REAL" || $typeAffinity=="NUMERIC") + echo ""; + else + echo ""; + echo ""; + echo ""; + } + echo ""; + echo ""; + echo ""; + echo "
".$lang['fld']."".$lang['type']."".$lang['operator']."".$lang['val']."
"; + if(isset($_GET['oldSearch']) && isset($_SESSION[COOKIENAME.'search'][$_GET['oldSearch']]['values'][$field])) + $value = implode($_SESSION[COOKIENAME.'search'][$_GET['oldSearch']]['values'][$field], ","); + else + $value = ''; + if(isset($_GET['oldSearch']) && isset($_SESSION[COOKIENAME.'search'][$_GET['oldSearch']]['operators'][$field])) + $operator = $_SESSION[COOKIENAME.'search'][$_GET['oldSearch']]['operators'][$field]; + elseif($typeAffinity=="TEXT" || $typeAffinity=="NONE") + $operator = 'LIKE'; + else + $operator = '='; + + echo "
"; + echo ""; + echo "
"; + echo ""; + + break; + } + elseif(isset($_SESSION[COOKIENAME.'search'][$_GET['search']])) + { + $params->search = $_GET['search']; + $search = $_SESSION[COOKIENAME.'search'][$_GET['search']]; + // NOTICE: we do not break here!! we just do the same now like row_view-action does + } + + //- Row actions + + //- View row (=row_view) + case "row_view": + if(!isset($_GET['startRow'])) + $_GET['startRow'] = 0; + + if(isset($_SESSION[COOKIENAME.'currentTable']) && $_SESSION[COOKIENAME.'currentTable']!=$target_table) + { + unset($_SESSION[COOKIENAME.'sortRows']); + unset($_SESSION[COOKIENAME.'orderRows']); + } + if(isset($_GET['viewtype'])) + { + $_SESSION[COOKIENAME.'viewtype'] = $_GET['viewtype']; + } + + //- Query execution + if(!isset($_GET['sort'])) + $_GET['sort'] = NULL; + if(!isset($_GET['order'])) + $_GET['order'] = NULL; + + $numRows = $params->numRows; + $startRow = $_GET['startRow']; + if(isset($_GET['sort'])) + { + $_SESSION[COOKIENAME.'sortRows'] = $_GET['sort']; + $_SESSION[COOKIENAME.'currentTable'] = $target_table; + } + if(isset($_GET['order'])) + { + $_SESSION[COOKIENAME.'orderRows'] = $_GET['order']; + $_SESSION[COOKIENAME.'currentTable'] = $target_table; + } + $query = "SELECT * "; + // select the primary key column(s) last (ROWID if there is no PK). + // this will be used to identify rows, e.g. when editing/deleting rows + $primary_key = $db->getPrimaryKey($target_table); + foreach($primary_key as $pk) + { + $query.= ', '.$db->quote_id($pk); + $query.= ', typeof('.$db->quote_id($pk).')'; + } + $query .= " FROM ".$db->quote_id($target_table); + $queryDisp = "SELECT * FROM ".$db->quote_id($target_table); + $queryCount = "SELECT COUNT(*) AS count FROM ".$db->quote_id($target_table); + $queryAdd = ""; + if(isset($search) && isset($search['where'])) + { + $queryAdd = $search['where']; + $queryCount .= $search['where']; + } + if(isset($_SESSION[COOKIENAME.'sortRows'])) + $queryAdd .= " ORDER BY ".$db->quote_id($_SESSION[COOKIENAME.'sortRows']); + if(isset($_SESSION[COOKIENAME.'orderRows'])) + $queryAdd .= " ".$_SESSION[COOKIENAME.'orderRows']; + $queryAdd .= " LIMIT ".$startRow.", ".$numRows; + $query .= $queryAdd; + $queryDisp .= $queryAdd; + + $resultRows = $db->select($queryCount); + $totalRows = $resultRows['count']; + $shownRows = min($resultRows['count']-$startRow, $numRows); + + //- HTML: pagination buttons + $lastPage = intval($totalRows / $params->numRows); + $remainder = intval($totalRows % $params->numRows); + if($remainder==0) + $remainder = $params->numRows; + + echo "
"; + //previous button + if($_GET['startRow']>0) + { + echo "
"; + echo $params->getForm(array('action'=>$_GET['action']),'get'); + echo ""; + echo " "; + echo ""; + echo "
"; + echo "
"; + echo $params->getForm(array('action'=>$_GET['action']),'get'); + echo "numRows))."'/>"; + echo " "; + echo ""; + echo "
"; + } + + //show certain number buttons + echo "
"; + echo $params->getForm(array('action'=>$_GET['action'], 'numRows'=>null),'get'); + echo " "; + echo " "; + echo $lang['rows_records']; + + if(intval($_GET['startRow']+$params->numRows) < $totalRows) + echo "numRows)."'/>"; + else + echo " "; + echo $lang['as_a']; + echo " "; + echo ""; + echo "
"; + + //next button + if(intval($_GET['startRow']+$params->numRows)<$totalRows) + { + echo "
"; + echo $params->getForm(array('action'=>$_GET['action']),'get'); + echo "numRows)."'/>"; + echo " "; + echo ""; + echo "
"; + echo "
"; + echo $params->getForm(array('action'=>$_GET['action']),'get'); + echo ""; + echo " "; + echo ""; + echo "
"; + } + echo "
"; + echo "
"; + + + //- Show results + if($shownRows>0) + { + $queryTimer = new MicroTimer(); + $table_result = $db->query($query); + $queryTimer->stop(); + + + echo "
"; + echo "".$lang['showing_rows']." ".$startRow." - ".($startRow + $shownRows-1).", ".$lang['total'].": ".$totalRows." "; + printf($lang['query_time'], $queryTimer); + echo "
"; + echo "".htmlencode($queryDisp).""; + echo "

"; + + if($target_table_type == 'view') + { + echo sprintf($lang['readonly_tbl'], htmlencode($target_table))." https://en.wikipedia.org/wiki/View_(SQL)"; + echo "

"; + } + + $tableInfo = $db->getTableInfo($target_table); + $pkFirstCol = sizeof($tableInfo)+1; + //- Table view + if(!isset($_SESSION[COOKIENAME.'viewtype']) || $_SESSION[COOKIENAME.'viewtype']=="table") + { + echo $params->getForm(array('action'=>'row_editordelete'), 'post', false, 'checkForm'); + echo ""; + echo ""; + echo ""; + + for($i=0; $i"; + if(isset($_SESSION[COOKIENAME.'sortRows'])) + $orderTag = ($_SESSION[COOKIENAME.'sortRows']==$tableInfo[$i]['name'] && $_SESSION[COOKIENAME.'orderRows']=="ASC") ? "DESC" : "ASC"; + else + $orderTag = "ASC"; + echo $params->getLink(array('action'=>$_GET['action'], 'sort'=>$tableInfo[$i]['name'], 'order'=>$orderTag ), htmlencode($tableInfo[$i]['name'])); + if(isset($_SESSION[COOKIENAME.'sortRows']) && $_SESSION[COOKIENAME.'sortRows']==$tableInfo[$i]['name']) + echo (($_SESSION[COOKIENAME.'orderRows']=="ASC") ? " " : " "); + echo ""; + } + echo ""; + + for($i=0; $row = $db->fetch($table_result, 'num'); $i++) + { + // -g-> $pk will always be the last columns in each row of the array because we are doing "SELECT *, PK_1, typeof(PK_1), PK2, typeof(PK_2), ... FROM ..." + $pk_arr = array(); + for($col = $pkFirstCol; array_key_exists($col, $row); $col=$col+2) + { + // in $col we have the type and in $col-1 the value + if($row[$col]=='integer' || $row[$col]=='real') + // json encode as int or float, not string + $pk_arr[] = $row[$col-1]+0; + else + // encode as json string + $pk_arr[] = $row[$col-1]; + } + $pk = json_encode($pk_arr); + $tdWithClass = ""; + if($target_table_type == 'table' && $db->isWritable() && $db->isDirWritable()) + { + echo $tdWithClass; + echo ""; + echo ""; + echo $tdWithClass; + // -g-> Here, we need to put the PK in as the link for both the edit and delete. + echo $params->getLink(array('action'=>'row_editordelete', 'pk'=>$pk, 'type'=>'edit'),"".$lang['edit']."",'edit', $lang['edit']); + echo ""; + echo $tdWithClass; + echo $params->getLink(array('action'=>'row_editordelete', 'pk'=>$pk, 'type'=>'delete'),"".$lang['del']."",'delete', $lang['del']); + echo ""; + } else { + echo ""; + } + for($j=0; $jNULL"; + elseif(preg_match('/^BLOB/i', $tableInfo[$j]['type']) && !$hexblobs) + { + echo "
"; + echo $params->getLink(array('action'=>'row_get_blob', 'confirm'=>1, 'pk'=>$pk, 'column'=>$tableInfo[$j]['name'], 'download_blob'=>1),$lang["download"]).' | '; + echo $params->getLink(array('action'=>'row_get_blob', 'confirm'=>1, 'pk'=>$pk, 'column'=>$tableInfo[$j]['name'], 'download_blob'=>0),$lang["open_in_browser"],'','','_blank'); + echo "
"; + echo 'Size: '.number_format(strlen($row[$j])).' Bytes'; + echo "
"; + } + elseif(preg_match('/^BLOB/i', $tableInfo[$j]['type']) && $hexblobs) + { + echo htmlencode(subString(bin2hex($row[$j]))); + } + elseif(isset($search)) + echo markSearchWords(subString($row[$j]),$tableInfo[$j]['name'], $search); + else + echo htmlencode(subString($row[$j])); + echo ""; + } + echo "
"; + } + echo "
"; + echo "$_GET['action'], 'fulltexts'=>($params->fulltexts?0:1) ))."' title='".$lang[($params->fulltexts?'no_full_texts':'full_texts')]."'>"; + echo "&".($params->fulltexts?'r':'l')."arr; T &".($params->fulltexts?'l':'r')."arr;"; + echo "
"; + $tdWithClassLeft = ""; + echo "
"; + if($target_table_type == 'table' && $db->isWritable() && $db->isDirWritable()) + { + echo "".$lang['chk_all']." / ".$lang['unchk_all']." ".$lang['with_sel'].": "; + echo " "; + echo ""; + } + echo ""; + } + else + //- Chart view + { + if(!isset($_SESSION[COOKIENAME.$target_table.'chartlabels'])) + { + // No label-column set. Try to pick a text-column as label-column. + for($i=0; $i + + +
+ Chart Settings"; + echo $params->getForm(array('action'=>$_GET['action'])); + echo $lang['chart_type'].": "; + echo "

"; + echo $lang['lbl'].": "; + echo "

"; + echo $lang['val'].": "; + echo "

"; + echo ""; + echo ""; + echo ""; + echo "
"; + //end chart view + } + } + else //no rows - do nothing + { + echo "
"; + if(isset($search) || $totalRows>0) + echo $lang['no_rows']."

"; + elseif($target_table_type == 'table') + echo $lang['empty_tbl']." ".$params->getLink(array('action'=>'row_create'), $lang['click']) ." ".$lang['insert_rows'].'

'; + echo "".htmlencode($queryDisp).""; + echo "

"; + } + + if(isset($search)) + echo "

".$params->getLink(array('action'=>'table_search','search'=>null,'oldSearch' => (isset($_GET['search'])?$_GET['search']:null)), $lang['srch_again']); + + break; + + //- Create new row (=row_create) + case "row_create": + echo $params->getForm(array('action'=>'row_create'), 'get'); + echo $lang['restart_insert']; + echo " "; + echo $lang['rows']; + echo " "; + echo ""; + echo "
"; + echo $params->getForm(array('action'=>'row_create','confirm'=>'1'), 'post', true); + $tableInfo = $db->getTableInfo($target_table); + if(isset($_GET['newRows'])) + $num = $_GET['newRows']; + else + $num = 1; + echo ""; + for($j=0; $j<$num; $j++) + { + if($j>0) + echo "
"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + for($i=0; $i"; + echo ""; + echo $tdWithClassLeft; + echo htmlencode($field); + echo ""; + echo $tdWithClassLeft; + echo htmlencode($type); + echo ""; + echo $tdWithClassLeft; + echo ""; + echo ""; + echo $tdWithClassLeft; + if($tableInfo[$i]['notnull']==0) + { + if($value===NULL) + echo ""; + else + echo ""; + } + echo ""; + echo $tdWithClassLeft; + + if($typeAffinity=="INTEGER" || $typeAffinity=="REAL" || $typeAffinity=="NUMERIC") + echo ""; + elseif(preg_match('/^BLOB/', $type) && !$hexblobs) + echo ""; + else + echo ""; + echo ""; + echo ""; + } + echo ""; + echo ""; + echo ""; + echo "
".$lang['fld']."".$lang['type']."".$lang['func']."Null".$lang['val']."
"; + echo ""; + echo "

"; + } + echo ""; + break; + + //- Edit or delete row (=row_editordelete) + case "row_editordelete": + if(isset($_POST['check'])) + $pks = $_POST['check']; + else if(isset($_GET['pk'])) + $pks = array($_GET['pk']); + else $pks[0] = ""; + $str = implode(', ', $pks); + if($str=="") //nothing was selected so show an error + { + echo "
"; + echo $lang['err'].": ".$lang['no_sel']; + echo "
"; + echo "

".$params->getLink(array('action'=>'row_view'),$lang['return']); + } + else + { + if((isset($_POST['type']) && $_POST['type']=="edit") || (isset($_GET['type']) && $_GET['type']=="edit")) //edit + { + echo $params->getForm(array('action'=>'row_edit', 'confirm'=>'1', 'pk'=>json_encode($pks)),'post',true); + $tableInfo = $db->getTableInfo($target_table); + $primary_key = $db->getPrimaryKey($target_table); + + for($j=0; $jquote_id($target_table)." WHERE " . $db->wherePK($target_table, json_decode($pks[$j])); + $result1 = $db->select($query, 'num'); + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + for($i=0; $i"; + echo ""; + echo $tdWithClassLeft; + echo htmlencode($field); + echo ""; + echo $tdWithClassLeft; + echo htmlencode($type); + echo ""; + echo $tdWithClassLeft; + echo ""; + echo ""; + echo $tdWithClassLeft; + if($tableInfo[$i]['notnull']==0) + { + if($value===NULL) + echo ""; + else + echo ""; + } + echo ""; + echo $tdWithClassLeft; + if($typeAffinity=="INTEGER" || $typeAffinity=="REAL" || $typeAffinity=="NUMERIC") + echo ""; + elseif(preg_match('/^BLOB/', $type) && !$hexblobs) + { + if($value!==NULL) + { + echo ""; + echo $params->getLink(array('action'=>'row_get_blob', 'confirm'=>1, 'pk'=>$pks[$j], 'column'=>$field, 'download_blob'=>1),$lang["download"]).' | '; + echo $params->getLink(array('action'=>'row_get_blob', 'confirm'=>1, 'pk'=>$pks[$j], 'column'=>$field, 'download_blob'=>0),$lang["open_in_browser"],'','','_blank').'
'; + echo ""; + } + echo ""; + } + else + echo ""; + echo ""; + echo ""; + } + echo ""; + echo ""; + echo ""; + echo "
".$lang['fld']."".$lang['type']."".$lang['func']."Null".$lang['val']."
"; + // Note: the 'Save changes' button must be first in the code so it is the one used when submitting the form with the Enter key (issue #215) + echo " "; + echo " "; + echo $params->getLink(array('action'=>'row_view'), $lang['cancel']); + echo "
"; + echo "
"; + } + echo ""; + } + else //delete + { + echo $params->getForm(array('action'=>'row_delete', 'confirm'=>'1', 'pk'=>json_encode($pks))); + echo "
"; + printf($lang['ques_row_delete'], htmlencode($str), htmlencode($target_table)); + echo "

"; + echo " "; + echo $params->getLink(array('action'=>'row_view'), $lang['cancel']); + echo "
"; + } + } + break; + + //- Column actions + + //- View table structure (=column_view) + case "column_view": + $tableInfo = $db->getTableInfo($target_table); + + echo $params->getForm(array('action'=>'column_confirm'), 'get', false, 'checkForm'); + echo ""; + echo ""; + if($target_table_type == 'table' && $db->isWritable() && $db->isDirWritable()) + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + $noPrimaryKey = true; + + for($i=0; $i"; + $tdWithClassLeft = ""; + if($target_table_type == 'table' && $db->isWritable() && $db->isDirWritable()) + { + echo $tdWithClass; + echo ""; + echo ""; + echo $tdWithClass; + echo $params->getLink(array('action'=>'column_edit', 'pk'=>$fieldVal),"".$lang['edit']."",'edit', $lang['edit']); + echo ""; + echo $tdWithClass; + echo $params->getLink(array('action'=>'column_confirm', 'action2'=>'column_delete', 'pk'=>$fieldVal),"".$lang['del']."",'delete', $lang['del']); + echo ""; + } + echo $tdWithClass; + echo htmlencode($colVal); + echo ""; + echo $tdWithClassLeft; + echo htmlencode($fieldVal); + echo ""; + echo $tdWithClassLeft; + echo htmlencode($typeVal); + echo ""; + echo $tdWithClassLeft; + echo htmlencode($notnullVal); + echo ""; + echo $tdWithClassLeft; + if($defaultVal===NULL) + echo "".$lang['none'].""; + elseif($defaultVal==="NULL") + echo "NULL"; + else + echo htmlencode($defaultVal); + echo ""; + echo $tdWithClassLeft; + echo htmlencode($primarykeyVal); + echo ""; + echo ""; + } + + echo "
".$lang['col']." #".$lang['fld']."".$lang['type']."".$lang['not_null']."".$lang['def_val']."".$lang['prim_key']."
"; + echo "
"; + if($target_table_type == 'table' && $db->isWritable() && $db->isDirWritable()) + { + echo "".$lang['chk_all']." / ".$lang['unchk_all']." ".$lang['with_sel'].": "; + echo " "; + echo ""; + } + echo ""; + if($target_table_type == 'table' && $db->isWritable() && $db->isDirWritable()) + { + echo "
"; + echo $params->getForm(array('action'=>'column_create'), 'get'); + echo $lang['add']." ".$lang['tbl_end']." "; + echo ""; + } + + echo "
"; + echo "
"; + echo "
"; + echo "".$lang['query_used_'.$target_table_type]."
"; + echo ""; + echo nl2br(htmlencode($db->export_sql(array($target_table),false,true,false,false,false,false))); + echo ""; + echo "
"; + echo "
"; + if($target_table_type != 'view') + { + echo "


"; + $query = "PRAGMA index_list(".$db->quote_id($target_table).")"; + $result = $db->selectArray($query); + if(sizeof($result)>0) + { + echo "

".$lang['indexes'].":

"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + for($i=0; $iquote_id($result[$i]['name']).")"; + $info = $db->selectArray($query); + $span = sizeof($info); + + $tdWithClass = ""; + echo $tdWithClassSpan; + echo $params->getLink(array('action'=>'index_delete', 'pk'=>$result[$i]['name']), "".$lang['del']."", 'delete', $lang['del']); + echo ""; + echo $tdWithClassLeftSpan; + echo $result[$i]['name']; + echo ""; + echo $tdWithClassLeftSpan; + echo $unique; + echo ""; + for($j=0; $j<$span; $j++) + { + if($j!=0) + echo ""; + echo $tdWithClassLeft; + echo htmlencode($info[$j]['seqno']); + echo ""; + echo $tdWithClassLeft; + echo htmlencode($info[$j]['cid']); + echo ""; + echo $tdWithClassLeft; + echo htmlencode($info[$j]['name']); + echo ""; + echo ""; + } + } + echo "
"; + echo "".$lang['name']."".$lang['unique']."".$lang['seq_no']."".$lang['col']." #".$lang['fld']."
"; + $tdWithClassLeft = ""; + $tdWithClassSpan = ""; + $tdWithClassLeftSpan = ""; + echo "


"; + } + + $query = "SELECT * FROM sqlite_master WHERE type='trigger' AND tbl_name=".$db->quote($target_table)." ORDER BY name"; + $result = $db->selectArray($query); + //print_r($result); + if(sizeof($result)>0) + { + echo "

".$lang['triggers'].":

"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + for($i=0; $i"; + echo ""; + echo $tdWithClass; + echo $params->getLink(array('action'=>'trigger_delete', 'pk'=>$result[$i]['name']), "".$lang['del']."", 'delete', $lang['del']); + echo ""; + echo $tdWithClass; + echo htmlencode($result[$i]['name']); + echo ""; + echo $tdWithClass; + echo htmlencode($result[$i]['sql']); + echo ""; + } + echo "
"; + echo "".$lang['name']."".$lang['sql']."


"; + } + + if($db->isWritable() && $db->isDirWritable()) + { + echo $params->getForm(array('action'=>'index_create'),'get'); + echo "
"; + echo $lang['create_index2']." ".$lang['cols']." "; + echo "
"; + echo ""; + + echo $params->getForm(array('action'=>'trigger_create'),'get'); + echo "
"; + echo $lang['create_trigger2']." "; + echo "
"; + echo ""; + } + } + break; + + //- Create column (=column_create) + case "column_create": + echo "

".sprintf($lang['new_fld'],htmlencode($_GET['table']))."

"; + if($_GET['tablefields']=="" || intval($_GET['tablefields'])<=0) + echo $lang['specify_fields']; + else if($_GET['table']=="") + echo $lang['specify_tbl']; + else + { + $num = intval($_GET['tablefields']); + $name = $_GET['table']; + echo $params->getForm(array('action'=>'column_create', 'confirm'=>'1')); + echo ""; + echo ""; + echo ""; + $headings = array($lang["fld"], $lang["type"], $lang["prim_key"]); + if($db->getType() != "SQLiteDatabase") $headings[] = $lang["autoincrement"]; + $headings[] = $lang["not_null"]; + $headings[] = $lang["def_val"]; + + for($k=0; $k" . $headings[$k] . ""; + echo ""; + + for($i=0; $i<$num; $i++) + { + $tdWithClass = ""; + echo $tdWithClass; + echo ""; + echo ""; + echo $tdWithClass; + echo ""; + echo ""; + echo $tdWithClass; + echo ""; + echo ""; + if($db->getType() != "SQLiteDatabase") + { + echo $tdWithClass; + echo ""; + echo ""; + } + echo $tdWithClass; + echo ""; + echo ""; + echo $tdWithClass; + echo ""; + echo ""; + echo ""; + echo ""; + } + echo ""; + echo ""; + echo ""; + echo "
"; + echo "
"; + echo " "; + echo $params->getLink(array('action'=>'column_view'), $lang['cancel']); + echo "
"; + echo ""; + } + break; + + //- Confirm column action (=column_confirm) + case "column_confirm": + if(isset($_GET['check'])) + $pks = $_GET['check']; + elseif(isset($_GET['pk'])) + $pks = array($_GET['pk']); + else $pks = array(); + + if(sizeof($pks)==0) //nothing was selected so show an error + { + echo "
"; + echo $lang['err'].": ".$lang['no_sel']; + echo "
"; + echo "

"; + echo $params->getLink(array('action'=>'column_view'), $lang['return']); + } + else + { + $str = $pks[0]; + $pkVal = $pks[0]; + for($i=1; $igetForm(array('action'=>$_GET['action2'], 'confirm'=>'1', 'pk'=>$pkVal)); + echo "
"; + printf($lang['ques_'.$_GET['action2']], htmlencode($str), htmlencode($target_table)); + echo "

"; + echo " "; + echo $params->getLink(array('action'=>'column_view'), $lang['cancel']); + echo "
"; + } + break; + + //- Edit column (=column_edit) + case "column_edit": + echo "

".sprintf($lang['edit_col'], htmlencode($_GET['pk']))." ".$lang['on_tbl']." '".htmlencode($target_table)."'

"; + echo $lang['sqlite_limit']."

"; + if(!isset($_GET['pk'])) + echo $lang['specify_col']; + else if (!$target_table) + echo $lang['specify_tbl']; + else + { + $tableInfo = $db->getTableInfo($target_table); + + for($i=0; $i".$lang['err'].": ".sprintf($lang['col_inexistent'], htmlencode($_GET['pk'])).""; + } + else + { + $name = $target_table; + echo $params->getForm(array('action'=>'column_edit', 'confirm'=>'1')); + echo ""; + echo ""; + echo ""; + //$headings = array("Field", "Type", "Primary Key", "Autoincrement", "Not NULL", "Default Value"); + $headings = array($lang["fld"], $lang["type"]); + for($k=0; $k".$headings[$k].""; + echo ""; + + $i = 0; + $tdWithClass = ""; + echo $tdWithClass; + echo ""; + echo ""; + echo $tdWithClass; + echo ""; + echo ""; + /* + echo $tdWithClass; + if($primarykeyVal) + echo " Yes"; + else + echo " Yes"; + echo ""; + echo $tdWithClass; + if(1==2) + echo " Yes"; + else + echo " Yes"; + echo ""; + echo $tdWithClass; + if($notnullVal) + echo " Yes"; + else + echo " Yes"; + echo ""; + echo $tdWithClass; + echo ""; + echo ""; + */ + echo ""; + + echo ""; + echo ""; + echo ""; + echo "
"; + echo "
"; + echo " "; + echo $params->getLink(array('action'=>'column_view'), $lang['cancel']); + echo "
"; + echo ""; + } + } + break; + + //- Delete index (=index_delete) + case "index_delete": + echo $params->getForm(array('action'=>'index_delete', 'pk'=>$_GET['pk'], 'confirm'=>'1')); + echo "
"; + echo sprintf($lang['ques_index_delete'], htmlencode($_GET['pk']))."

"; + echo " "; + echo $params->getLink(array('action'=>'column_view'), $lang['cancel']); + echo "
"; + echo ""; + break; + + //- Delete trigger (=trigger_delete) + case "trigger_delete": + echo $params->getForm(array('action'=>'trigger_delete', 'pk'=>$_GET['pk'], 'confirm'=>'1')); + echo "
"; + echo sprintf($lang['ques_trigger_delete'], htmlencode($_GET['pk']))."

"; + echo " "; + echo $params->getLink(array('action'=>'column_view'), $lang['cancel']); + echo "
"; + echo ""; + break; + + //- Create trigger (=trigger_create) + case "trigger_create": + echo "

".$lang['create_trigger']." '".htmlencode($_GET['table'])."'

"; + if($_GET['table']=="") + echo $lang['specify_tbl']; + else + { + echo $params->getForm(array('action'=>'trigger_create', 'confirm'=>'1')); + echo $lang['trigger_name'].":

"; + echo "
".$lang['db_event'].""; + echo $lang['before']."/".$lang['after'].": "; + echo ""; + echo "

"; + echo $lang['event'].": "; + echo ""; + echo "


"; + echo "
".$lang['trigger_act'].""; + echo "

"; + echo $lang['when_exp'].":
"; + echo ""; + echo "

"; + echo $lang['trigger_step'].":
"; + echo ""; + echo "


"; + echo " "; + echo $params->getLink(array('action'=>'column_view'), $lang['cancel']); + echo ""; + } + break; + + //- Create index (=index_create) + case "index_create": + echo "

".$lang['create_index']." '".htmlencode($_GET['table'])."'

"; + if($_GET['numcolumns']=="" || intval($_GET['numcolumns'])<=0) + echo $lang['specify_fields']; + else if($_GET['table']=="") + echo $lang['specify_tbl']; + else + { + echo $params->getForm(array('action'=>'index_create', 'confirm'=>'1')); + $num = intval($_GET['numcolumns']); + $tableInfo = $db->getTableInfo($_GET['table']); + echo "
".$lang['define_index'].""; + echo "
"; + echo ""; + echo "
"; + if(version_compare($db->getSQLiteVersion(),'3.8.0')>=0) + echo " ".helpLink($lang['help10']); + echo "
"; + echo "
"; + echo "
".$lang['define_in_col'].""; + for($i=0; $i<$num; $i++) + { + echo " "; + echo "
"; + } + echo "
"; + echo "

"; + echo ""; + echo " "; + echo $params->getLink(array('action'=>'column_view'), $lang['cancel']); + echo ""; + } + break; + } + echo ""; +} + +//- HMTL: views for databases +if(!$target_table && !isset($_GET['confirm']) && (!isset($_GET['action']) || (isset($_GET['action']) && $_GET['action']!="table_create" && $_GET['action']!="table_confirm"))) //the absence of these fields means we are viewing the database homepage +{ + //- Switch on $view (actually a series of if-else) + + if($view=="structure") + { + //- Database structure, shows all the tables (=structure) + + if($db->isWritable() && !$db->isDirWritable()) + { + echo "
"; + echo $lang['attention'].': '.$lang['directory_not_writable']; + echo "

"; + } + elseif(!$db->isWritable()) + { + echo "
"; + echo $lang['attention'].': '.$lang['database_not_writable']; + echo "

"; + } + + if ($auth->isPasswordDefault()) + { + echo "
"; + echo sprintf($lang['warn_passwd'],(is_readable('phpliteadmin.config.php')?'phpliteadmin.config.php':basename(__FILE__)))."
".$lang['warn0']; + echo "
"; + } + + if (!extension_loaded('mbstring')) + { + echo "
"; + echo $lang['warn_mbstring']; + echo "
"; + } + echo "".$lang['db_name'].": ".htmlencode($db->getName())."
"; + echo "".$lang['db_path'].": ".htmlencode($db->getPath())."
"; + echo "".$lang['db_size'].": ".number_format($db->getSize())." KiB
"; + echo "".$lang['db_mod'].": ".$db->getDate()."
"; + echo "".$lang['sqlite_v'].": ".$db->getSQLiteVersion()."
"; + echo "".$lang['sqlite_ext']." ".helpLink($lang['help1']).": ".$db->getType()."
"; + echo "".$lang['php_v'].": ".phpversion()."
"; + echo "".PROJECT." ".$lang["ver"].": ".VERSION; + echo "

"; + echo ""; + + if(isset($_GET['sort']) && ($_GET['sort']=='type' || $_GET['sort']=='name')) + $_SESSION[COOKIENAME.'sortTables'] = $_GET['sort']; + if(isset($_GET['order']) && ($_GET['order']=='ASC' || $_GET['order']=='DESC')) + $_SESSION[COOKIENAME.'orderTables'] = $_GET['order']; + + if(!isset($_SESSION[COOKIENAME.'sortTables'])) + $_SESSION[COOKIENAME.'sortTables'] = 'name'; + + if(!isset($_SESSION[COOKIENAME.'orderTables'])) + $_SESSION[COOKIENAME.'orderTables'] = 'ASC'; + + $tables = $db->getTables(true, false, $_SESSION[COOKIENAME.'sortTables'], $_SESSION[COOKIENAME.'orderTables']); + + if(sizeof($tables)==0) + echo $lang['no_tbl']."

"; + else + { + echo $params->getForm(array('action'=>'table_confirm',), 'get', false, 'checkForm'); + echo ""; + echo ""; + + echo ""; + + echo ""; + + echo ""; + echo ""; + echo ""; + + $totalRecords = 0; + $skippedTables = false; + $tableId = 0; + foreach($tables as $tableName => $tableType) + { + $records = $db->numRows($tableName, (!isset($_GET['forceCount']))); + if($records == '?') + { + $skippedTables = true; + $records = $params->getLink(array('forceCount'=>'1'), '?'); + } + else + $totalRecords += $records; + $tdWithClass = ""; + echo $tdWithClass; + echo ""; + echo ""; + echo $tdWithClassLeft; + echo $params->getLink(array('table'=>$tableName, 'action'=>'row_view'), htmlencode($tableName)); + echo ""; + echo $tdWithClassLeft; + echo ($tableType=="table"? $lang['tbl'] : $lang['view']); + echo ""; + echo $tdWithClass; + echo $params->getLink(array('table'=>$tableName, 'action'=>'row_view'), $lang['browse']); + echo ""; + echo $tdWithClass; + echo $params->getLink(array('table'=>$tableName, 'action'=>'column_view'), $lang['struct']); + echo ""; + echo $tdWithClass; + echo $params->getLink(array('table'=>$tableName, 'action'=>'table_sql'), $lang['sql']); + echo ""; + echo $tdWithClass; + echo $params->getLink(array('table'=>$tableName, 'action'=>'table_search'), $lang['srch']); + echo ""; + echo $tdWithClass; + if($tableType=="table" && $db->isWritable() && $db->isDirWritable()) + echo $params->getLink(array('table'=>$tableName, 'action'=>'row_create'), $lang['insert']); + else + echo $lang['insert']; + echo ""; + echo $tdWithClass; + echo $params->getLink(array('table'=>$tableName, 'action'=>'table_export'), $lang['export']); + echo ""; + echo $tdWithClass; + if($tableType=="table" && $db->isWritable() && $db->isDirWritable()) + echo $params->getLink(array('table'=>$tableName, 'action'=>'table_import'), $lang['import']); + else + echo $lang['import']; + echo ""; + echo $tdWithClass; + if($db->isWritable() && $db->isDirWritable()) + echo $params->getLink(array('table'=>$tableName, 'action'=>'table_rename'), $lang['rename']); + else + echo $lang['rename']; + echo ""; + echo $tdWithClass; + if($tableType=="table" && $db->isWritable() && $db->isDirWritable()) + echo $params->getLink(array('table'=>$tableName, 'action'=>'table_confirm', 'action2'=>'table_empty'), $lang['empty'], 'empty'); + else + echo $lang['empty']; + echo ""; + echo $tdWithClass; + if($db->isWritable() && $db->isDirWritable()) + echo $params->getLink(array('table'=>$tableName,'action'=>'table_confirm', 'action2'=>'table_drop'), $lang['drop'], 'drop'); + else + echo $lang['drop']; + echo ""; + echo $tdWithClass; + echo $records; + echo ""; + echo ""; + $tableId++; + } + echo ""; + echo ""; + echo ""; + echo ""; + echo "
"; + if(isset($_SESSION[COOKIENAME.'sortTables'])) + $orderTag = ($_SESSION[COOKIENAME.'sortTables']=="name" && $_SESSION[COOKIENAME.'orderTables']=="ASC") ? "DESC" : "ASC"; + else + $orderTag = "ASC"; + echo $params->getLink(array('sort'=>'name', 'order'=>$orderTag), $lang['name']); + if(isset($_SESSION[COOKIENAME.'sortTables']) && $_SESSION[COOKIENAME.'sortTables']=="name") + echo (($_SESSION[COOKIENAME.'orderTables']=="ASC") ? " " : " "); + echo ""; + if(isset($_SESSION[COOKIENAME.'sortTables'])) + $orderTag = ($_SESSION[COOKIENAME.'sortTables']=="type" && $_SESSION[COOKIENAME.'orderTables']=="ASC") ? "DESC" : "ASC"; + else + $orderTag = "ASC"; + echo $params->getLink(array('sort'=>'type', 'order'=>$orderTag), $lang['type']); + echo helpLink($lang['help3']); + if(isset($_SESSION[COOKIENAME.'sortTables']) && $_SESSION[COOKIENAME.'sortTables']=="type") + echo (($_SESSION[COOKIENAME.'orderTables']=="ASC") ? " " : " "); + echo "".$lang['act']."".$lang['rec']."
"; + $tdWithClassLeft = ""; + + echo "
".sizeof($tables)." ".$lang['total']."".$totalRecords.($skippedTables?" ".$params->getLink(array('forceCount'=>'1'),'+ ?'):"")."
"; + echo "".$lang['chk_all']." / ".$lang['unchk_all']." ".$lang['with_sel'].": "; + echo " "; + echo ""; + echo ""; + echo "
"; + if($skippedTables) + echo "
".sprintf($lang["counting_skipped"],"'1'))."'>","")."
"; + } + if($db->isWritable() && $db->isDirWritable()) + { + echo "
"; + echo "".$lang['create_tbl_db']." '".htmlencode($db->getName())."'"; + echo $params->getForm(array('action'=>'table_create'), 'get'); + echo $lang['name'].": "; + echo $lang['fld_num'].": "; + echo ""; + echo ""; + echo "
"; + echo "
"; + echo "
"; + echo "".$lang['create_view']." '".htmlencode($db->getName())."'"; + echo $params->getForm(array('action'=>'view_create', 'confirm'=>'1')); + echo $lang['name'].": "; + echo $lang['sel_state']." ".helpLink($lang['help4']).": "; + echo ""; + echo ""; + echo "
"; + } + } + else if($view=="sql") + { + //- Database SQL editor (=sql) + if(isset($_POST['query']) && $_POST['query']!="") + { + $delimiter = $_POST['delimiter']; + $queryStr = $_POST['queryval']; + //save the queries in history if necessary + if($maxSavedQueries!=0 && $maxSavedQueries!=false) + { + if(!isset($_SESSION[COOKIENAME.'query_history'])) + $_SESSION[COOKIENAME.'query_history'] = array(); + $_SESSION[COOKIENAME.'query_history'][md5(strtolower($queryStr))] = $queryStr; + if(sizeof($_SESSION[COOKIENAME.'query_history']) > $maxSavedQueries) + array_shift($_SESSION[COOKIENAME.'query_history']); + } + $query = explode_sql($delimiter, $queryStr); //explode the query string into individual queries based on the delimiter + + for($i=0; $iquery($query[$i]); + + echo "
"; + echo "".htmlencode($query[$i]).""; + if($table_result === NULL || $table_result === false) + { + echo "
".$lang['err'].": ".htmlencode($db->getError())."
"; + } + echo "
"; + if($row = $db->fetch($table_result, 'num')) + { + for($j=0; $jgetColumnName($table_result,$j); + echo ""; + echo ""; + for($j=0; $j"; + echo htmlencode($headers[$j]); + echo ""; + } + echo ""; + $rowCount = 0; + for(; $rowCount==0 || $row = $db->fetch($table_result, 'num'); $rowCount++) + { + $tdWithClass = ""; + for($z=0; $zNULL"; + else + echo htmlencode(subString($row[$z])); + echo ""; + } + echo ""; + } + $queryTimer->stop(); + echo "
"; + echo "


"; + + + if($table_result !== NULL && $table_result !== false) + { + echo "
"; + if($rowCount>0 || $db->getAffectedRows()==0) + { + printf($lang['show_rows'], $rowCount); + } + if($db->getAffectedRows()>0 || $rowCount==0) + { + echo $db->getAffectedRows()." ".$lang['rows_aff']." "; + } + printf($lang['query_time'], $queryTimer); + echo "
"; + } + + + } + } + } + } + else + { + $delimiter = ";"; + $queryStr = ""; + } + + echo "
"; + echo "".sprintf($lang['run_sql'],htmlencode($db->getName())).""; + echo $params->getForm(array('view'=>'sql')); + if(isset($_SESSION[COOKIENAME.'query_history']) && sizeof($_SESSION[COOKIENAME.'query_history'])>0) + { + echo "".$lang['recent_queries']."
    "; + foreach($_SESSION[COOKIENAME.'query_history'] as $key => $value) + { + echo "
  • ".htmlencode($value)."
  • "; + } + echo "


"; + } + echo ""; + echo ""; + echo $lang['delimit']." "; + echo ""; + echo ""; + echo "
"; + } + else if($view=="vacuum") + { + //- Vacuum database confirmation (=vacuum) + if(isset($_POST['vacuum'])) + { + $query = "VACUUM"; + $db->query($query); + echo "
"; + printf($lang['db_vac'], htmlencode($db->getName())); + echo "

"; + } + echo $params->getForm(array('view'=>'vacuum')); + printf($lang['vac_desc'],htmlencode($db->getName())); + echo "

"; + echo ""; + echo ""; + } + else if($view=="export") + { + //- Export view (=export) + echo $params->getForm(array('view'=>'export')); + echo "
".$lang['export'].""; + echo ""; + echo "

"; + echo ""; + echo "
"; + echo "
"; + + echo "
".$lang['options'].""; + echo " ".helpLink($lang['help5'])."
"; + echo " ".helpLink($lang['help6'])."
"; + echo " ".helpLink($lang['help7'])."
"; + echo " ".helpLink($lang['help8'])."
"; + echo " ".helpLink($lang['help9'])."
"; + echo "
"; + + echo ""; + + echo "
"; + echo "

"; + echo "
".$lang['save_as'].""; + $file = pathinfo($db->getPath()); + $name = $file['filename']; + echo " "; + echo "
"; + echo ""; + echo "
".sprintf($lang['backup_hint'], + $params->getLink(array('download'=>$currentDB['path'], 'token'=>$_SESSION[COOKIENAME.'token']), $lang["backup_hint_linktext"], '', $lang['backup']) + )."
"; + } + else if($view=="import") + { + //- Import view (=import) + if(isset($_POST['import'])) + { + echo "
"; + if($importSuccess===true) + echo $lang['import_suc']; + else + echo $importSuccess; + echo "

"; + } + + echo $params->getForm(array('view'=>'import'), 'post', true); + echo "
".$lang['import'].""; + echo ""; + echo "
"; + echo "
"; + + echo "
".$lang['options'].""; + echo $lang['no_opt']; + echo "
"; + + echo ""; + + echo "
"; + echo "

"; + + echo "
".$lang['import_f'].""; + echo "".$lang['max_file_size'].": ".number_format(fileUploadMaxSize()/1024/1024)." MiB ".helpLink($lang['help11'])."
"; + echo ""; + echo ""; + echo "
"; + } + else if($view=="rename") + { + //- Rename database confirmation (=rename) + echo $params->getForm(array('view'=>'rename', 'database_rename'=>'1')); + echo ""; + echo $lang['db_rename']." '".htmlencode($db->getPath())."' ".$lang['to']." "; + echo ""; + } + else if($view=="delete") + { + //- Delete database confirmation (=delete) + echo $params->getForm(array('database_delete'=>'1')); + echo "
"; + echo sprintf($lang['ques_database_delete'],htmlencode($db->getPath()))."

"; + echo ""; + echo " "; + echo $params->getLink(array(), $lang['cancel']); + echo "
"; + echo ""; + } + + echo ""; +} +echo ""; + +//- HTML: page footer +echo "
"; +echo "".$lang['powered']." ".PROJECT." | "; +echo $lang['free_software']." ".$lang['please_donate']." | "; +printf($lang['page_gen'], $pageTimer); +echo ""; +echo "
"; +$db->close(); //close the database +echo ""; +echo ""; + +//- End of main code + + +// returns data from internal resources, available in single-file mode +function getInternalResource($res) { + $resources = array('resources/phpliteadmin.css'=>array(0=>0,1=>4059,),'resources/phpliteadmin.js'=>array(0=>4059,1=>4454,),'resources/favicon.ico'=>array(0=>8513,1=>1448,),); + + if (isset($resources[$res]) && $f = fopen(__FILE__, 'r')) { + fseek($f, __COMPILER_HALT_OFFSET__ + $resources[$res][0]); + $data = fread($f, $resources[$res][1]); + fclose($f); + return $data; + } + return false; +} + +// resources embedded below, do not edit! +__halt_compiler() ?>body{margin:0px;padding:0px;font-family:Arial,Helvetica,sans-serif;font-size:14px;color:#000;background-color:#e0ebf6;overflow:auto}.body_tbl td{padding:9px 2px 9px 9px}.left_td{width:100px}a{color:#03F;text-decoration:none;cursor:pointer}a:hover{color:#06F}hr{height:1px;border:0;color:#bbb;background-color:#bbb;width:100%}h1{margin:0px;padding:5px;font-size:24px;background-color:#f3cece;text-align:center;color:#000;border-top-left-radius:5px;border-top-right-radius:5px;-moz-border-radius-topleft:5px;-moz-border-radius-topright:5px}#headerlinks{text-align:center;margin-bottom:10px;padding:5px 15px;border-color:#03F;border-width:1px;border-style:solid;border-left-style:none;border-right-style:none;font-size:12px;background-color:#e0ebf6;font-weight:bold}h1 #version{color:#000;font-size:16px}h1 #logo{color:#000}h2{margin:0px;padding:0px;font-size:14px;margin-bottom:20px}input,select,textarea,.CodeMirror{font-family:Arial,Helvetica,sans-serif;background-color:#eaeaea;color:#03F;border-color:#03F;border-style:solid;border-width:1px;margin:5px;border-radius:5px;-moz-border-radius:5px;padding:3px}input.btn{cursor:pointer}input.btn:hover{background-color:#ccc}fieldset label{min-width:200px;display:block;float:left}fieldset{padding:15px;border-color:#03F;border-width:1px;border-style:solid;border-radius:5px;-moz-border-radius:5px;background-color:#f9f9f9}#container{padding:10px}#leftNav{min-width:250px;padding:0px;border-color:#03F;border-width:1px;border-style:solid;background-color:#FFF;padding-bottom:15px;border-radius:5px;-moz-border-radius:5px}.databaseList select{max-width:200px}.viewTable tr td{padding:1px}#loginBox{width:500px;margin-left:auto;margin-right:auto;margin-top:50px;border-color:#03F;border-width:1px;border-style:solid;background-color:#FFF;border-radius:5px;-moz-border-radius:5px}#main{border-color:#03F;border-width:1px;border-style:solid;padding:15px;background-color:#FFF;border-bottom-left-radius:5px;border-bottom-right-radius:5px;border-top-right-radius:5px;-moz-border-radius-bottomleft:5px;-moz-border-radius-bottomright:5px;-moz-border-radius-topright:5px}.td1{background-color:#f9e3e3;text-align:right;font-size:12px;padding-left:10px;padding-right:10px}.td2{background-color:#f3cece;text-align:right;font-size:12px;padding-left:10px;padding-right:10px}.tdheader{border-color:#03F;border-width:1px;border-style:solid;font-weight:bold;font-size:12px;padding-left:10px;padding-right:10px;background-color:#e0ebf6;border-radius:5px;-moz-border-radius:5px}.confirm{border-color:#03F;border-width:1px;border-style:dashed;padding:15px;background-color:#e0ebf6}.tab{display:block;padding:5px;padding-right:8px;padding-left:8px;border-color:#03F;border-width:1px;border-style:solid;margin-right:5px;float:left;border-bottom-style:none;position:relative;top:1px;padding-bottom:4px;background-color:#eaeaea;border-top-left-radius:5px;border-top-right-radius:5px;-moz-border-radius-topleft:5px;-moz-border-radius-topright:5px}.tab_pressed{display:block;padding:5px;padding-right:8px;padding-left:8px;border-color:#03F;border-width:1px;border-style:solid;margin-right:5px;float:left;border-bottom-style:none;position:relative;top:1px;background-color:#FFF;cursor:default;border-top-left-radius:5px;border-top-right-radius:5px;-moz-border-radius-topleft:5px;-moz-border-radius-topright:5px}.helpq{font-size:11px;font-weight:normal}#help_container{padding:0px;font-size:12px;margin-left:auto;margin-right:auto;background-color:#fff}.help_outer{background-color:#FFF;padding:0px;height:300px;position:relative}.help_list{padding:10px;height:auto}.headd{font-size:14px;font-weight:bold;display:block;padding:10px;background-color:#e0ebf6;border-color:#03F;border-width:1px;border-style:solid;border-left-style:none;border-right-style:none}.help_inner{padding:10px}.help_top{display:block;position:absolute;right:10px;bottom:10px}.warning,.delete,.empty,.drop,.delete_db{color:red}.sidebar_table{font-size:11px}.active_table,.active_db{text-decoration:underline}.null{color:#888}.found{background:#FF0;text-decoration:none}function initAutoincrement(){var i=0;while(document.getElementById('i'+i+'_autoincrement')!=undefined){document.getElementById('i'+i+'_autoincrement').disabled=true;i++;}} +function toggleAutoincrement(i){var type=document.getElementById('i'+i+'_type');var primarykey=document.getElementById('i'+i+'_primarykey');var autoincrement=document.getElementById('i'+i+'_autoincrement');if(!autoincrement)return false;if(type.value=='INTEGER'&&primarykey.checked) +autoincrement.disabled=false;else{autoincrement.disabled=true;autoincrement.checked=false;}} +function toggleNull(i){var pk=document.getElementById('i'+i+'_primarykey');var notnull=document.getElementById('i'+i+'_notnull');if(pk.checked){notnull.disabled=true;notnull.checked=true;} +else{notnull.disabled=false;}} +function checkAll(){var i=0;while(document.getElementById('check_'+i)!=undefined){document.getElementById('check_'+i).checked=true;i++;}} +function uncheckAll(){var i=0;while(document.getElementById('check_'+i)!=undefined){document.getElementById('check_'+i).checked=false;i++;}} +function changeIgnore(area,e,u){if(area.value!=""){if(document.getElementById(e)!=undefined) +document.getElementById(e).checked=false;if(document.getElementById(u)!=undefined) +document.getElementById(u).checked=false;}} +function moveFields(){var fields=document.getElementById("fieldcontainer");var selected=[];for(var i=0;i0){CodeMirror.commands.autocomplete(instance);}} +function checkFileSize(input){if(input.files&&input.files.length==1){if(input.files[0].size>fileUploadMaxSize){alert(fileUploadMaxSizeErrorMsg+": "+(fileUploadMaxSize/1024/1024)+" MiB");return false;}} +return true;}AAABAAEAEBAAAAEAIAAoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADwoKZQAAABMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEMDJMAAAAdAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASDg7BAAAASAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAETDw9CCQkJ1QUFBb4AAABjAAAAAQAAAAA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