Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
complex
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chanaka
complex
Commits
68574d69
Commit
68574d69
authored
Dec 06, 2017
by
Niklas Mähler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use central config file for credentials
parent
354d4c14
Changes
25
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
6170 additions
and
4 deletions
+6170
-4
.gitignore
.gitignore
+1
-2
config.php
config.php
+17
-0
db.php
db.php
+7
-2
mysql.php
service/ActiveRecords/mysql.php
+323
-0
mysql2.php
service/ActiveRecords/mysql2.php
+332
-0
mysqli.php
service/ActiveRecords/mysqli.php
+312
-0
Datatables.php
service/Datatables.php
+540
-0
Datatables2.php
service/Datatables2.php
+889
-0
array_column.php
service/array_column.php
+121
-0
getgenelist.php
service/atgenie/getgenelist.php
+380
-0
koneksi.php
service/atgenie/koneksi.php
+12
-0
basket.php
service/basket.php
+59
-0
comparative_functions.php
service/comparative_functions.php
+1342
-0
final_post.php
service/final_post.php
+299
-0
final_post2.php
service/final_post2.php
+216
-0
getgenelist.php
service/getgenelist.php
+91
-0
getthepvalue.php
service/getthepvalue.php
+44
-0
index.php
service/index.php
+0
-0
getgenelist.php
service/poplar/getgenelist.php
+385
-0
koneksi.php
service/poplar/koneksi.php
+12
-0
post.php
service/post.php
+294
-0
process.php
service/process.php
+19
-0
search.php
service/search.php
+116
-0
getgenelist.php
service/spruce/getgenelist.php
+347
-0
koneksi.php
service/spruce/koneksi.php
+12
-0
No files found.
.gitignore
View file @
68574d69
service
service/*
junk
junk/*
local_config.php
config.php
0 → 100644
View file @
68574d69
<?php
$config
=
array
();
$config
[
"db"
][
"host"
]
=
null
;
$config
[
"db"
][
"user"
]
=
null
;
$config
[
"db"
][
"password"
]
=
null
;
$config
[
"db"
][
"database"
]
=
null
;
$config
[
"basket_db"
][
"host"
]
=
null
;
$config
[
"basket_db"
][
"user"
]
=
null
;
$config
[
"basket_db"
][
"password"
]
=
null
;
$config
[
"basket_db"
][
"database"
]
=
null
;
require_once
(
"local_config.php"
);
?>
db.php
View file @
68574d69
<?php
require_once
(
"config.php"
);
//$dbConn = mysql_connect($data[0],$data[1],$ps[$i])or die("Could not connect");
$dbConn
=
mysql_connect
(
"localhost"
,
"popuser"
,
"poppass"
)
or
die
(
"Could not connect"
);
$db
=
mysql_select_db
(
"plazacomplex"
,
$dbConn
)
or
die
(
"Could not select DB"
);
$dbConn
=
mysql_connect
(
$config
[
"db"
][
"host"
],
$config
[
"db"
][
"user"
],
$config
[
"db"
][
"password"
]
)
or
die
(
"Could not connect"
);
$db
=
mysql_select_db
(
"plaza_complex"
,
$dbConn
)
or
die
(
"Could not select DB"
);
$spNames
=
array
(
"pt"
=>
"P. Triocharpa"
,
"at"
=>
"A. Thaliana"
,
"os"
=>
"O. Sativa"
);
...
...
service/ActiveRecords/mysql.php
0 → 100755
View file @
68574d69
<?php
/**
* Ignited Datatables ActiveRecords library for MySql
*
* @subpackage libraries
* @category library
* @version 0.1
* @author Yusuf Ozdemir <yusuf@ozdemir.be>
*/
class
ActiveRecords
{
/**
* Variables
*
*/
var
$ar_select
=
array
();
var
$ar_from
=
array
();
var
$ar_join
=
array
();
var
$ar_where
=
array
();
var
$ar_orderby
=
array
();
var
$ar_limit
=
FALSE
;
var
$ar_offset
=
FALSE
;
var
$ar_order
=
FALSE
;
var
$_escape_char
=
'`'
;
var
$_count_string
=
'SELECT COUNT(*) AS '
;
var
$username
=
'root'
;
var
$password
=
''
;
var
$database
=
''
;
var
$hostname
=
'localhost'
;
var
$port
=
''
;
var
$db
;
var
$_result
;
/**
* Construct function
*
*/
public
function
connect
(
$config
)
{
foreach
(
$config
as
$key
=>
$val
)
if
(
in_array
(
$key
,
array
(
'hostname'
,
'username'
,
'password'
,
'database'
,
'port'
)))
$this
->
$key
=
$val
;
$this
->
db_connect
();
$this
->
db_select
();
}
/**
* DB connection
*
*/
protected
function
db_connect
()
{
if
(
$this
->
port
!=
''
)
$this
->
hostname
.=
':'
.
$this
->
port
;
$this
->
db
=
@
mysql_connect
(
$this
->
hostname
,
$this
->
username
,
$this
->
password
,
TRUE
);
}
/**
* DB Select
*
*/
protected
function
db_select
()
{
@
mysql_select_db
(
$this
->
database
,
$this
->
db
)
or
die
(
'Could not select database '
.
$this
->
database
);
}
/**
* Generates the SELECT portion of the query
*
*/
public
function
select
(
$columns
,
$backtick_protect
=
TRUE
)
{
foreach
(
$columns
as
$column
)
$this
->
ar_select
[]
=
(
$backtick_protect
==
TRUE
)
?
$this
->
_protect_identifiers
(
trim
(
$column
))
:
trim
(
$column
);
return
$this
;
}
/**
* Generates the FROM portion of the query
*
*/
public
function
from
(
$from
)
{
foreach
((
array
)
$from
as
$f
)
$this
->
ar_from
[]
=
$this
->
_protect_identifiers
(
trim
(
$f
));
return
$this
;
}
/**
* Generates the JOIN portion of the query
*
*/
public
function
join
(
$table
,
$cond
,
$type
=
''
)
{
if
(
$type
!=
''
)
{
$type
=
strtoupper
(
trim
(
$type
));
$type
=
(
!
in_array
(
$type
,
array
(
'LEFT'
,
'RIGHT'
,
'OUTER'
,
'INNER'
,
'LEFT OUTER'
,
'RIGHT OUTER'
)))
?
''
:
$type
.
' '
;
}
$join
=
$type
.
'JOIN '
.
$this
->
_protect_identifiers
(
$table
)
.
' ON '
.
$this
->
_protect_identifiers
(
$cond
);
$this
->
ar_join
[]
=
$join
;
return
$this
;
}
/**
* Generates the WHERE portion of the query
*
*/
public
function
where
(
$key
,
$value
=
NULL
,
$escape
=
TRUE
,
$type
=
'AND '
)
{
if
(
!
is_array
(
$key
))
$key
=
array
(
$key
=>
$value
);
foreach
(
$key
as
$k
=>
$v
)
{
$prefix
=
(
count
(
$this
->
ar_where
)
==
0
)
?
''
:
$type
;
if
(
$v
!=
NULL
)
{
$k
=
(
$this
->
_has_operator
(
$k
)
==
TRUE
)
?
$k
:
$k
.
' ='
;
$v
=
(
$escape
==
TRUE
)
?
" '"
.
$v
.
"'"
:
$v
;
}
$this
->
ar_where
[]
=
$prefix
.
((
$escape
==
TRUE
)
?
$this
->
_protect_identifiers
(
$k
.
$v
)
:
$k
.
$v
);
}
return
$this
;
}
/**
* Generates the LIMIT portion of the query
*
*/
public
function
limit
(
$value
,
$offset
=
''
)
{
$this
->
ar_limit
=
$value
;
if
(
$offset
!=
''
)
$this
->
ar_offset
=
$offset
;
return
$this
;
}
/**
* Generates the ORDER BY portion of the query
*
*/
public
function
order_by
(
$orderby
,
$direction
=
''
)
{
$direction
=
(
in_array
(
strtoupper
(
trim
(
$direction
)),
array
(
'ASC'
,
'DESC'
),
TRUE
))
?
' '
.
$direction
:
' ASC'
;
$this
->
ar_orderby
[]
=
$orderby
.
$direction
;
return
$this
;
}
/**
* Runs the Query
*
*/
public
function
get
()
{
$result
=
mysql_query
(
$this
->
_compile_select
(),
$this
->
db
)
or
die
(
mysql_error
());
$this
->
_reset_select
();
$this
->
_result
=
$result
;
return
$this
;
}
/**
* Results as object
*
*/
public
function
result
()
{
$aData
=
array
();
while
(
$aRow
=
mysql_fetch_object
(
$this
->
_result
))
$aData
[]
=
$aRow
;
return
$aData
;
}
/**
* Results as array
*
*/
public
function
result_array
()
{
$aData
=
array
();
while
(
$aRow
=
mysql_fetch_array
(
$this
->
_result
,
MYSQL_ASSOC
))
$aData
[]
=
$aRow
;
return
$aData
;
}
/**
* Count Results
*
*/
public
function
count_all_results
(
$table
=
''
)
{
if
(
$table
!=
''
)
$this
->
from
(
$table
);
$sql
=
$this
->
_compile_select
(
$this
->
_count_string
.
'numrows'
);
$query
=
mysql_query
(
$sql
)
or
die
(
mysql_error
());
$this
->
_reset_select
();
$row
=
mysql_fetch_object
(
$query
);
return
(
int
)
$row
->
numrows
;
}
/**
* Escape
*
*/
public
function
escape_db
(
$text
=
""
)
{
return
mysql_real_escape_string
(
$text
);
}
/**
* Compile sql string
*
*/
protected
function
_compile_select
(
$q
=
NULL
)
{
$sql
=
(
$q
==
NULL
)
?
'SELECT '
:
$q
;
$sql
.=
implode
(
','
,
$this
->
ar_select
);
if
(
count
(
$this
->
ar_from
)
>
0
)
$sql
.=
"
\n
FROM ("
.
implode
(
','
,
$this
->
ar_from
)
.
")"
;
if
(
count
(
$this
->
ar_join
)
>
0
)
$sql
.=
"
\n
"
.
implode
(
"
\n
"
,
$this
->
ar_join
);
if
(
count
(
$this
->
ar_where
)
>
0
)
$sql
.=
"
\n
WHERE "
.
implode
(
"
\n
"
,
$this
->
ar_where
);
if
(
count
(
$this
->
ar_orderby
)
>
0
)
// check
{
$sql
.=
"
\n
ORDER BY "
.
implode
(
', '
,
$this
->
ar_orderby
);
if
(
$this
->
ar_order
!==
FALSE
)
$sql
.=
(
$this
->
ar_order
==
'desc'
)
?
' DESC'
:
' ASC'
;
}
if
(
is_numeric
(
$this
->
ar_limit
))
$sql
.=
"
\n
LIMIT "
.
((
$this
->
ar_offset
==
0
)
?
''
:
$this
->
ar_offset
.
', '
)
.
$this
->
ar_limit
;
return
$sql
;
}
/**
* Protect identifiers
*
*/
protected
function
_protect_identifiers
(
$text
)
{
$_pattern
=
'/\b(?<!"|\')(\w+)(?!\\1)\b/i'
;
$item
=
preg_replace
(
'/[\t ]+/'
,
' '
,
$text
);
$alias
=
''
;
if
(
strpos
(
$item
,
' '
)
!==
FALSE
)
{
$alias
=
strstr
(
$item
,
" "
);
$item
=
substr
(
$item
,
0
,
-
strlen
(
$alias
));
}
if
(
strpos
(
$item
,
'('
)
!==
FALSE
)
return
$item
.
$alias
;
return
preg_replace
(
$_pattern
,
$this
->
_escape
(
'$1'
),
$item
)
.
$alias
;
}
/**
* Test Operator
*
*/
protected
function
_has_operator
(
$str
)
{
return
(
!
preg_match
(
"/(\s|<|>|!|=|is null|is not null)/i"
,
trim
(
$str
)))
?
FALSE
:
TRUE
;
}
/**
* Escape
*
*/
protected
function
_escape
(
$text
)
{
return
$this
->
_escape_char
.
$text
.
$this
->
_escape_char
;
}
/**
* Reset arrays
*
*/
protected
function
_reset_select
()
{
$ar_reset_items
=
array
(
'ar_select'
=>
array
(),
'ar_from'
=>
array
(),
'ar_join'
=>
array
(),
'ar_where'
=>
array
(),
'ar_orderby'
=>
array
(),
'ar_limit'
=>
FALSE
,
'ar_offset'
=>
FALSE
,
'ar_order'
=>
FALSE
);
foreach
(
$ar_reset_items
as
$item
=>
$default_value
)
$this
->
$item
=
$default_value
;
}
}
/* End of file ActiveRecords.php */
\ No newline at end of file
service/ActiveRecords/mysql2.php
0 → 100755
View file @
68574d69
<?php
/**
* Ignited Datatables ActiveRecords library for MySql
*
* @subpackage libraries
* @category library
* @version 0.1
* @author Yusuf Ozdemir <yusuf@ozdemir.be>
*/
class
ActiveRecords
{
/**
* Variables
*
*/
var
$ar_select
=
array
();
var
$ar_from
=
array
();
var
$ar_join
=
array
();
var
$ar_where
=
array
();
var
$ar_orderby
=
array
();
var
$ar_limit
=
FALSE
;
var
$ar_offset
=
FALSE
;
var
$ar_order
=
FALSE
;
var
$_escape_char
=
'`'
;
var
$_count_string
=
'SELECT COUNT(*) AS '
;
var
$username
=
'root'
;
var
$password
=
''
;
var
$database
=
''
;
var
$hostname
=
'localhost'
;
var
$port
=
''
;
var
$db
;
var
$_result
;
/**
* Construct function
*
*/
public
function
connect
(
$config
)
{
foreach
(
$config
as
$key
=>
$val
)
if
(
in_array
(
$key
,
array
(
'hostname'
,
'username'
,
'password'
,
'database'
,
'port'
)))
$this
->
$key
=
$val
;
$this
->
db_connect
();
$this
->
db_select
();
}
/**
* DB connection
*
*/
protected
function
db_connect
()
{
if
(
$this
->
port
!=
''
)
$this
->
hostname
.=
':'
.
$this
->
port
;
$this
->
db
=
@
mysql_connect
(
$this
->
hostname
,
$this
->
username
,
$this
->
password
,
TRUE
);
}
/**
* DB Select
*
*/
protected
function
db_select
()
{
@
mysql_select_db
(
$this
->
database
,
$this
->
db
)
or
die
(
'Could not select database '
.
$this
->
database
);
}
/**
* Generates the SELECT portion of the query
*
*/
public
function
select
(
$columns
,
$backtick_protect
=
TRUE
)
{
foreach
(
$columns
as
$column
)
$this
->
ar_select
[]
=
(
$backtick_protect
==
TRUE
)
?
$this
->
_protect_identifiers
(
trim
(
$column
))
:
trim
(
$column
);
return
$this
;
}
/**
* Generates the FROM portion of the query
*
*/
public
function
from
(
$from
)
{
foreach
((
array
)
$from
as
$f
)
$this
->
ar_from
[]
=
$this
->
_protect_identifiers
(
trim
(
$f
));
return
$this
;
}
/**
* Generates the JOIN portion of the query
*
*/
public
function
join
(
$table
,
$cond
,
$type
=
''
)
{
if
(
$type
!=
''
)
{
$type
=
strtoupper
(
trim
(
$type
));
$type
=
(
!
in_array
(
$type
,
array
(
'LEFT'
,
'RIGHT'
,
'OUTER'
,
'INNER'
,
'LEFT OUTER'
,
'RIGHT OUTER'
)))
?
''
:
$type
.
' '
;
}
$join
=
$type
.
'JOIN '
.
$this
->
_protect_identifiers
(
$table
)
.
' ON '
.
$this
->
_protect_identifiers
(
$cond
);
$this
->
ar_join
[]
=
$join
;
return
$this
;
}
/**
* Generates the WHERE portion of the query
*
*/
public
function
where
(
$key
,
$value
=
NULL
,
$escape
=
TRUE
,
$type
=
'AND '
)
{
if
(
!
is_array
(
$key
))
$key
=
array
(
$key
=>
$value
);
foreach
(
$key
as
$k
=>
$v
)
{
$prefix
=
(
count
(
$this
->
ar_where
)
==
0
)
?
''
:
$type
;
if
(
$v
!=
NULL
)
{
if
(
$k
==
"genelist_pfam.genelist_pfam_id like"
||
$k
==
"syno2.field2 like"
||
$k
==
"description like"
||
$k
==
"name_space like"
||
$k
==
"genelist_panther.genelist_panther_id like"
){
$k
=
(
$this
->
_has_operator
(
$k
)
==
TRUE
)
?
$k
:
$k
.
' ='
;
$v
=
(
$escape
==
TRUE
)
?
' "'
.
$v
.
'" '
:
$v
;
}
else
{
$k
=
(
$this
->
_has_operator
(
$k
)
==
TRUE
)
?
$k
:
$k
.
' ='
;
$v
=
(
$escape
==
TRUE
)
?
' ("'
.
$v
.
'")'
:
$v
;
}
}
$this
->
ar_where
[]
=
$prefix
.
((
$escape
==
TRUE
)
?
$this
->
_protect_identifiers
(
$k
.
$v
)
:
$k
.
$v
);
}
return
$this
;
}
/**
* Generates the LIMIT portion of the query
*
*/
public
function
limit
(
$value
,
$offset
=
''
)
{
$this
->
ar_limit
=
$value
;
if
(
$offset
!=
''
)
$this
->
ar_offset
=
$offset
;
return
$this
;
}
/**
* Generates the ORDER BY portion of the query
*
*/
public
function
order_by
(
$orderby
,
$direction
=
''
)
{
$direction
=
(
in_array
(
strtoupper
(
trim
(
$direction
)),
array
(
'ASC'
,
'DESC'
),
TRUE
))
?
' '
.
$direction
:
' ASC'
;
$this
->
ar_orderby
[]
=
$orderby
.
$direction
;
return
$this
;
}
/**
* Runs the Query
*
*/
public
function
get
()
{
$result
=
mysql_query
(
$this
->
_compile_select
(),
$this
->
db
)
or
die
(
mysql_error
());
$this
->
_reset_select
();
$this
->
_result
=
$result
;
return
$this
;
}
/**
* Results as object
*
*/
public
function
result
()
{
$aData
=
array
();
while
(
$aRow
=
mysql_fetch_object
(
$this
->
_result
))
$aData
[]
=
$aRow
;
return
$aData
;
}
/**
* Results as array
*
*/
public
function
result_array
()
{
$aData
=
array
();
while
(
$aRow
=
mysql_fetch_array
(
$this
->
_result
,
MYSQL_ASSOC
))
$aData
[]
=
$aRow
;
return
$aData
;
}
/**
* Count Results
*
*/
public
function
count_all_results
(
$table
=
''
)
{
if
(
$table
!=
''
)
$this
->
from
(
$table
);
$sql
=
$this
->
_compile_select
(
$this
->
_count_string
.
'numrows'
);
$query
=
mysql_query
(
$sql
)
or
die
(
mysql_error
());
$this
->
_reset_select
();
$row
=
mysql_fetch_object
(
$query
);
return
(
int
)
$row
->
numrows
;
}
/**
* Escape
*
*/
public
function
escape_db
(
$text
=
""
)
{
return
mysql_real_escape_string
(
$text
);
}
/**
* Compile sql string
*
*/
protected
function
_compile_select
(
$q
=
NULL
)
{
$sql
=
(
$q
==
NULL
)
?
'SELECT '
:
$q
;
$sql
.=
implode
(
','
,
$this
->
ar_select
);
if
(
count
(
$this
->
ar_from
)
>
0
)
$sql
.=
"
\n
FROM ("
.
implode
(
','
,
$this
->
ar_from
)
.
")"
;
if
(
count
(
$this
->
ar_join
)
>
0
)
$sql
.=
"
\n
"
.
implode
(
"
\n
"
,
$this
->
ar_join
);
if
(
count
(
$this
->
ar_where
)
>
0
)
$sql
.=
"
\n
WHERE "
.
implode
(
"
\n
"
,
$this
->
ar_where
);
if
(
count
(
$this
->
ar_orderby
)
>
0
)
// check
{
$sql
.=
"
\n
ORDER BY "
.
implode
(
', '
,
$this
->
ar_orderby
);
if
(
$this
->
ar_order
!==
FALSE
)
$sql
.=
(
$this
->
ar_order
==
'desc'
)
?
' DESC'
:
' ASC'
;
}
if
(
is_numeric
(
$this
->
ar_limit
))
$sql
.=
"
\n
LIMIT "
.
((
$this
->
ar_offset
==
0
)
?
''
:
$this
->
ar_offset
.
', '
)
.
$this
->
ar_limit
;
//echo $sql;
return
$sql
;
}
/**
* Protect identifiers
*
*/
protected
function
_protect_identifiers
(
$text
)
{
$_pattern
=
'/\b(?<!"|\')(\w+)(?!\\1)\b/i'
;
$item
=
preg_replace
(
'/[\t ]+/'
,
' '
,
$text
);
$alias
=
''
;
if
(
strpos
(
$item
,
' '
)
!==
FALSE
)
{
$alias
=
strstr
(
$item
,
" "
);
$item
=
substr
(
$item
,
0
,
-
strlen
(
$alias
));
}
if
(
strpos
(
$item
,
'('
)
!==
FALSE
)
return
$item
.
$alias
;
return
preg_replace
(
$_pattern
,
$this
->
_escape
(
'$1'
),
$item
)
.
$alias
;
}
/**
* Test Operator
*
*/
protected
function
_has_operator
(
$str
)
{
return
(
!
preg_match
(
"/(\s|<|>|!|=|is null|is not null)/i"
,
trim
(
$str
)))
?
FALSE
:
TRUE
;
}
/**
* Escape
*
*/
protected
function
_escape
(
$text
)
{
return
$this
->
_escape_char
.
$text
.
$this
->
_escape_char
;
}
/**
* Reset arrays
*
*/
protected
function
_reset_select
()
{
$ar_reset_items
=
array
(
'ar_select'
=>
array
(),
'ar_from'
=>
array
(),
'ar_join'
=>
array
(),
'ar_where'
=>
array
(),
'ar_orderby'
=>
array
(),
'ar_limit'
=>
FALSE
,
'ar_offset'
=>
FALSE
,
'ar_order'
=>
FALSE
);
foreach
(
$ar_reset_items
as
$item
=>
$default_value
)
$this
->
$item
=
$default_value
;
}
}
/* End of file ActiveRecords.php */
\ No newline at end of file
service/ActiveRecords/mysqli.php
0 → 100755
View file @
68574d69
<?php
/**
* Ignited Datatables ActiveRecords library for MySqli
*
* @subpackage libraries
* @category library
* @version 0.1
* @author Yusuf Ozdemir <yusuf@ozdemir.be>
*/
class
ActiveRecords
{
/**
* Variables
*
*/
var
$ar_select
=
array
();
var
$ar_from
=
array
();
var
$ar_join
=
array
();
var
$ar_where
=
array
();
var
$ar_orderby
=
array
();
var
$ar_limit
=
FALSE
;
var
$ar_offset
=
FALSE
;
var
$ar_order
=
FALSE
;
var
$_escape_char
=
'`'
;
var
$_count_string
=
'SELECT COUNT(*) AS '
;