Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117756156
sample-insert-options.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
sample-insert-options.php
View Options
#!/usr/bin/php
<?php
if
(
isset
(
$_SERVER
[
"REQUEST_METHOD"
])
||
!
empty
(
$_SERVER
[
"REQUEST_METHOD"
]))
{
die
(
"Not for execution through webserver"
);
}
require_once
(
'lib/functions.php'
);
$db
=
SQL
::
get_instance
();
$db
->
query
(
"TRUNCATE `options`"
);
exec
(
"locale -a | cut -d'.' -f 1 | cut -d'@' -f1 | grep -E
\"
^([a-zA-Z_]*)
\$\"
| sort -u"
,
$output
);
// var_dump($output);
$json
=
json_encode
(
$output
);
// var_dump($json);
unset
(
$output
);
$result
=
$db
->
query
(
'INSERT INTO `options` (`attribute`, `option_values`) VALUES ('
.
'
\'
preferredlanguage
\'
,
\'
'
.
$json
.
'
\'
)'
);
var_dump
(
$result
);
/*
exec('cat ./iso3166-countrycodes.txt | sed -r -e \'s/(.*)\s+([A-Z]{2})\s+([A-Z]{3})\s+([0-9]{3})\s*$/\2/g\' -e \'/^[A-Z]{2}$/!d\'', $output);
var_dump($output);
sort($output);
$json = json_encode($output);
// var_dump($json);
$result = $db->query('INSERT INTO `options` (`attribute`, `option_values`) VALUES ('.
'\'c\', \'' . $json . '\')');
var_dump($result);
*/
?>
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Apr 4, 8:30 AM (2 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c4/66/b6e9dc4e2b99c11c48d546733cbd
Default Alt Text
sample-insert-options.php (1 KB)
Attached To
Mode
rWAP webadmin
Attached
Detach File
Event Timeline