├── .sandstorm ├── stack ├── build.sh ├── pgp-keyring ├── pgp-signature ├── screenshot1.png ├── screenshot2.png ├── .gitignore ├── .gitattributes ├── setup.sh ├── changeLog.md ├── description.md ├── launcher.sh ├── app-graphics │ ├── wordpress-150.svg │ ├── wordpress-24.svg │ └── wordpress-128.svg ├── global-setup.sh ├── sandstorm-pkgdef.capnp └── Vagrantfile ├── read-only-plugins ├── sqlite-integration │ ├── index.php │ ├── js │ │ ├── index.php │ │ ├── sqlite.min.js │ │ └── sqlite.js │ ├── styles │ │ ├── index.php │ │ ├── coffee.min.css │ │ ├── ocean.min.css │ │ ├── ectoplasm.min.css │ │ ├── sunrise.min.css │ │ ├── blue.min.css │ │ ├── midnight.min.css │ │ ├── light.min.css │ │ ├── coffee.css │ │ ├── ocean.css │ │ ├── sunrise.css │ │ ├── ectoplasm.css │ │ ├── blue.css │ │ ├── light.css │ │ ├── midnight.css │ │ ├── style.min.css │ │ └── style.css │ ├── languages │ │ ├── index.php │ │ ├── sqlite-integration-ja.mo │ │ └── sqlite-integration-es_ES.mo │ ├── utilities │ │ ├── index.php │ │ ├── documentation.php │ │ └── patch.php │ ├── ChangeLog │ ├── BUGS │ ├── install.php │ ├── schema.php │ ├── db.php │ ├── readme-ja.txt │ ├── pdodb.class.php │ ├── readme.txt │ ├── sqlite-integration.php │ └── query_create.class.php └── mu-plugins │ └── sandstorm.php ├── etc ├── passwd ├── hosts └── nginx │ ├── scgi_params │ ├── uwsgi_params │ ├── nginx.conf │ ├── fastcgi_params │ ├── fastcgi.conf │ ├── koi-win │ ├── koi-utf │ ├── win-utf │ └── mime.types ├── README.md ├── sandstorm-port-notes.txt ├── start.sh ├── sandstorm ├── Makefile └── getPublicId.c++ ├── continue.sh ├── publish-it.sh ├── Makefile ├── wp-config.php └── LICENSE /.sandstorm/stack: -------------------------------------------------------------------------------- 1 | diy 2 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/index.php: -------------------------------------------------------------------------------- 1 | /var/www/index.html <<__EOF__ 10 | 11 |

This WordPress site has been set up successfully, but no content has 12 | been published. Go click the "Rebuild Public Site" button!

13 | 14 | __EOF__ 15 | 16 | cp -r /wordpress-read-only/wp-content-read-only/* /var/wordpress/wp-content 17 | 18 | ./continue.sh 19 | 20 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/styles/coffee.min.css: -------------------------------------------------------------------------------- 1 | @import url('./style.min.css');@CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#59524c;color:#fff;padding-left:5px}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#59524c;color:#fff;line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;background:#c7a589;color:#fff}.menu-item a{text-decoration:none;color:#fff} -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/styles/ocean.min.css: -------------------------------------------------------------------------------- 1 | @import url('./style.min.css');@CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#738e96;color:#fff;padding-left:5px}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#738e96;color:#fff;line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;background:#9ebaa0;color:#fff}.menu-item a{text-decoration:none;color:#fff} -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/styles/ectoplasm.min.css: -------------------------------------------------------------------------------- 1 | @import url('./style.min.css');@CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#523f6d;color:#fff;padding-left:5px}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#523f6d;color:#fff;line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;background:#a3b745;color:#fff}.menu-item a{text-decoration:none;color:#fff} -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/styles/sunrise.min.css: -------------------------------------------------------------------------------- 1 | @import url('./style.min.css');@CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#cf4944;color:#fff;padding-left:5px}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#cf4944;color:#fff;line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;background:#dd823b;color:#100100100}.menu-item a{text-decoration:none;color:#fff} -------------------------------------------------------------------------------- /.sandstorm/changeLog.md: -------------------------------------------------------------------------------- 1 | ### v2016.06.07 (4.4.2) 2 | - Fix bug where image uploads would fail to show up in the published site. 3 | ### v2016.04.11 (4.4.2) 4 | - Update to upstream version 4.4.2. 5 | - Use X-Sandstorm-User-Picture for avatars. 6 | ### v2015.10.21 (4.3.2-alpha) 7 | - Update to upstream version 4.3.2-alpha. 8 | - Metadata: adjust action title and noun phrase to avoid repeitition. 9 | ### v2015.08.23 (4.3) 10 | - Add to the description a paragraph about static publishing. 11 | ### v2015.08.22 (4.3) 12 | - Add metadata. 13 | - Update to upstream version 4.3. 14 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/styles/blue.min.css: -------------------------------------------------------------------------------- 1 | @import url('./style.min.css');@CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#4796b3;color:#fff;padding-left:5px}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#4796b3;color:(255,255,255);line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#096484;color:#fff}.menu-item a{text-decoration:none;color:#fff} -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/styles/midnight.min.css: -------------------------------------------------------------------------------- 1 | @import url('./style.min.css');@CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#363b3f;color:#fff;padding-left:5px}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#363b3f;color:#fff;line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;background:#e14d43;color:#fff}.menu-item a{text-decoration:none;color:#fff}.menu-item{background:#363b3f;color:#fff} -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/styles/light.min.css: -------------------------------------------------------------------------------- 1 | @import url('./style.min.css');@CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#e5e5e5;color:#373737;padding-left:5px}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#e5e5e5;color:#373737;border-bottom-color:whitesmoke;line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;background:#888;color:#fff;border-bottom-color:whitesmoke}.menu-item a{text-decoration:none;color:#373737} -------------------------------------------------------------------------------- /etc/nginx/scgi_params: -------------------------------------------------------------------------------- 1 | 2 | scgi_param REQUEST_METHOD $request_method; 3 | scgi_param REQUEST_URI $request_uri; 4 | scgi_param QUERY_STRING $query_string; 5 | scgi_param CONTENT_TYPE $content_type; 6 | 7 | scgi_param DOCUMENT_URI $document_uri; 8 | scgi_param DOCUMENT_ROOT $document_root; 9 | scgi_param SCGI 1; 10 | scgi_param SERVER_PROTOCOL $server_protocol; 11 | scgi_param HTTPS $https if_not_empty; 12 | 13 | scgi_param REMOTE_ADDR $remote_addr; 14 | scgi_param REMOTE_PORT $remote_port; 15 | scgi_param SERVER_PORT $server_port; 16 | scgi_param SERVER_NAME $server_name; 17 | -------------------------------------------------------------------------------- /etc/nginx/uwsgi_params: -------------------------------------------------------------------------------- 1 | 2 | uwsgi_param QUERY_STRING $query_string; 3 | uwsgi_param REQUEST_METHOD $request_method; 4 | uwsgi_param CONTENT_TYPE $content_type; 5 | uwsgi_param CONTENT_LENGTH $content_length; 6 | 7 | uwsgi_param REQUEST_URI $request_uri; 8 | uwsgi_param PATH_INFO $document_uri; 9 | uwsgi_param DOCUMENT_ROOT $document_root; 10 | uwsgi_param SERVER_PROTOCOL $server_protocol; 11 | uwsgi_param HTTPS $https if_not_empty; 12 | 13 | uwsgi_param REMOTE_ADDR $remote_addr; 14 | uwsgi_param REMOTE_PORT $remote_port; 15 | uwsgi_param SERVER_PORT $server_port; 16 | uwsgi_param SERVER_NAME $server_name; 17 | -------------------------------------------------------------------------------- /sandstorm/Makefile: -------------------------------------------------------------------------------- 1 | # You may override the following vars on the command line to suit 2 | # your config. 3 | CXX=clang++ 4 | CXXFLAGS=-O2 -Wall 5 | 6 | # You generally should not modify these. 7 | CXXFLAGS2=-std=c++1y -Itmp $(CXXFLAGS) 8 | 9 | .PHONY: all clean 10 | 11 | all: bin/getPublicId 12 | 13 | clean: 14 | rm -rf bin tmp 15 | 16 | bin/getPublicId: tmp/genfiles getPublicId.c++ 17 | mkdir -p bin 18 | $(CXX) getPublicId.c++ tmp/sandstorm/*.capnp.c++ -o bin/getPublicId -static $(CXXFLAGS2) `pkg-config capnp-rpc --cflags --libs` 19 | 20 | tmp/genfiles: /opt/sandstorm/latest/usr/include/sandstorm/*.capnp 21 | mkdir -p tmp 22 | capnp compile --src-prefix=/opt/sandstorm/latest/usr/include -oc++:tmp /opt/sandstorm/latest/usr/include/sandstorm/*.capnp 23 | touch tmp/genfiles 24 | -------------------------------------------------------------------------------- /continue.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | /usr/sbin/php5-fpm --fpm-config /etc/php/php-fpm.conf -c /etc/php/php.ini 4 | echo "started php-fpm. status code:" $? 5 | 6 | CGICONF=/var/fastcgi.conf 7 | rm -f $CGICONF; 8 | fastcgi_param () { 9 | echo "fastcgi_param $1 `base64 /dev/urandom | head -c 60`;" >> $CGICONF 10 | } 11 | 12 | fastcgi_param WORDPRESS_AUTH_KEY; 13 | fastcgi_param WORDPRESS_SECURE_AUTH_KEY; 14 | fastcgi_param WORDPRESS_LOGGED_IN_KEY; 15 | fastcgi_param WORDPRESS_NONCE_KEY; 16 | fastcgi_param WORDPRESS_AUTH_SALT; 17 | fastcgi_param WORDPRESS_SECURE_AUTH_SALT; 18 | fastcgi_param WORDPRESS_LOGGED_IN_SALT; 19 | fastcgi_param WORDPRESS_NONCE_SALT; 20 | 21 | 22 | /usr/sbin/nginx -g "pid /var/run/nginx.pid;" 23 | echo "started nginx. status code:" $? 24 | 25 | 26 | sleep infinity 27 | 28 | -------------------------------------------------------------------------------- /etc/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | #user html; 3 | worker_processes 4; 4 | 5 | events { 6 | worker_connections 1024; 7 | } 8 | 9 | http { 10 | include mime.types; 11 | default_type application/octet-stream; 12 | 13 | access_log off; 14 | 15 | sendfile on; 16 | #tcp_nopush on; 17 | 18 | keepalive_timeout 65; 19 | 20 | 21 | server { 22 | listen 10000; 23 | 24 | root /wordpress-read-only; 25 | 26 | location / { 27 | index index.html index.htm index.php; 28 | 29 | try_files $uri $uri/ /index.php; 30 | } 31 | 32 | location /wp-content/database/ { 33 | deny all; 34 | } 35 | 36 | location ~ \.php$ { 37 | try_files $uri = 404; 38 | fastcgi_pass 127.0.0.1:9000; 39 | fastcgi_index index.php; 40 | fastcgi_read_timeout 5m; 41 | include fastcgi.conf; 42 | include /var/fastcgi.conf; 43 | } 44 | 45 | client_max_body_size 1000M; 46 | } 47 | 48 | 49 | } 50 | 51 | 52 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/styles/coffee.css: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is a part of SQLite Integration. 3 | * 4 | * @package SQLite Integration 5 | * @author Kojima Toshiyasu 6 | */ 7 | @import url('./style.min.css'); 8 | @CHARSET "UTF-8"; 9 | #sqlite-admin-wrap h2, 10 | #sqlite-admin-side-wrap h2 { 11 | background: #59524c; 12 | color: rgb(255, 255, 255); 13 | padding-left: 5px; 14 | } 15 | .menu-item { 16 | font-size: 20px; 17 | display: inline; 18 | min-width: 150px; 19 | height: 50px; 20 | margin-left: 0; 21 | margin-right: 10px; 22 | padding: 5px; 23 | border: .5px solit #000; 24 | background: #59524c; 25 | color: rgb(255, 255, 255); 26 | line-height: 40px; 27 | } 28 | .menu-selected { 29 | font-size: 20px; 30 | display: inline; 31 | min-width: 150px; 32 | height: 50px; 33 | margin-left: 0; 34 | margin-right: 10px; 35 | padding: 5px; 36 | background: #c7a589; 37 | color: rgb(255, 255, 255); 38 | } 39 | .menu-item a { 40 | text-decoration: none; 41 | color: rgb(255, 255, 255); 42 | } 43 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/styles/ocean.css: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is a part of SQLite Integration. 3 | * 4 | * @package SQLite Integration 5 | * @author Kojima Toshiyasu 6 | */ 7 | @import url('./style.min.css'); 8 | @CHARSET "UTF-8"; 9 | #sqlite-admin-wrap h2, 10 | #sqlite-admin-side-wrap h2 { 11 | background: #738e96; 12 | color: rgb(255, 255, 255); 13 | padding-left: 5px; 14 | } 15 | .menu-item { 16 | font-size: 20px; 17 | display: inline; 18 | min-width: 150px; 19 | height: 50px; 20 | margin-left: 0; 21 | margin-right: 10px; 22 | padding: 5px; 23 | border: .5px solit #000; 24 | background: #738e96; 25 | color: rgb(255, 255, 255); 26 | line-height: 40px; 27 | } 28 | .menu-selected { 29 | font-size: 20px; 30 | display: inline; 31 | min-width: 150px; 32 | height: 50px; 33 | margin-left: 0; 34 | margin-right: 10px; 35 | padding: 5px; 36 | background: #9ebaa0; 37 | color: rgb(255, 255, 255); 38 | } 39 | .menu-item a { 40 | text-decoration: none; 41 | color: rgb(255, 255, 255); 42 | } 43 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/styles/sunrise.css: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is a part of SQLite Integration. 3 | * 4 | * @package SQLite Integration 5 | * @author Kojima Toshiyasu 6 | */ 7 | @import url('./style.min.css'); 8 | @CHARSET "UTF-8"; 9 | #sqlite-admin-wrap h2, 10 | #sqlite-admin-side-wrap h2 { 11 | background: #cf4944; 12 | color: rgb(255, 255, 255); 13 | padding-left: 5px; 14 | } 15 | .menu-item { 16 | font-size: 20px; 17 | display: inline; 18 | min-width: 150px; 19 | height: 50px; 20 | margin-left: 0; 21 | margin-right: 10px; 22 | padding: 5px; 23 | border: .5px solit #000; 24 | background: #cf4944; 25 | color: rgb(255, 255, 255); 26 | line-height: 40px; 27 | } 28 | .menu-selected { 29 | font-size: 20px; 30 | display: inline; 31 | min-width: 150px; 32 | height: 50px; 33 | margin-left: 0; 34 | margin-right: 10px; 35 | padding: 5px; 36 | background: #dd823b; 37 | color: rgb(256, 256, 256); 38 | } 39 | .menu-item a { 40 | text-decoration: none; 41 | color: rgb(255, 255, 255); 42 | } 43 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/styles/ectoplasm.css: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is a part of SQLite Integration. 3 | * 4 | * @package SQLite Integration 5 | * @author Kojima Toshiyasu 6 | */ 7 | @import url('./style.min.css'); 8 | @CHARSET "UTF-8"; 9 | #sqlite-admin-wrap h2, 10 | #sqlite-admin-side-wrap h2 { 11 | background: #523f6d; 12 | color: rgb(255, 255, 255); 13 | padding-left: 5px; 14 | } 15 | .menu-item { 16 | font-size: 20px; 17 | display: inline; 18 | min-width: 150px; 19 | height: 50px; 20 | margin-left: 0; 21 | margin-right: 10px; 22 | padding: 5px; 23 | border: .5px solit #000; 24 | background: #523f6d; 25 | color: rgb(255, 255, 255); 26 | line-height: 40px; 27 | } 28 | .menu-selected { 29 | font-size: 20px; 30 | display: inline; 31 | min-width: 150px; 32 | height: 50px; 33 | margin-left: 0; 34 | margin-right: 10px; 35 | padding: 5px; 36 | background: #a3b745; 37 | color: rgb(255, 255, 255); 38 | } 39 | .menu-item a { 40 | text-decoration: none; 41 | color: rgb(255, 255, 255); 42 | } 43 | -------------------------------------------------------------------------------- /publish-it.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | STATICDIR=/var/www 3 | TMPDIR=/var/www_`date +%s%N` 4 | URL=http://this_will_be_replaced_by_sandstorm:10000 5 | REPLACE_URL=$URL 6 | 7 | rm -rf $TMPDIR 8 | wget --mirror -p --convert-links -np -nH -e robots=off -X /wp-admin/ -P $TMPDIR $URL 9 | for q in `find $TMPDIR -name '*\?*'`; do 10 | if [ -f ${q%\?*} ]; then 11 | echo 'removing $q'; 12 | rm $q; 13 | else 14 | echo 'renaming $q'; 15 | mv $q ${q%\?*}; 16 | fi; 17 | done 18 | 19 | # make anying relative that wget failed to clean up 20 | find $TMPDIR -type f -exec sed -i "s|${REPLACE_URL}/|/|g" {} \; 21 | find $TMPDIR -type f -exec sed -i "s|${REPLACE_URL}|/|g" {} \; # URLs without a trailing / need to be changed to point the index 22 | 23 | # Make sure to copy over all of the uploads. This is necessary because the current release of wget 24 | # does not yet support srcset in img tags. 25 | cp -r /var/wordpress/wp-content/uploads $TMPDIR/wp-content/ 26 | 27 | mv $STATICDIR ${STATICDIR}_tmp 28 | mv $TMPDIR $STATICDIR 29 | rm -rf ${STATICDIR}_tmp 30 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/styles/blue.css: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is a part of SQLite Integration. 3 | * 4 | * @package SQLite Integration 5 | * @author Kojima Toshiyasu 6 | */ 7 | @import url('./style.min.css'); 8 | @CHARSET "UTF-8"; 9 | #sqlite-admin-wrap h2, 10 | #sqlite-admin-side-wrap h2 { 11 | background: #4796b3; 12 | color: rgb(255, 255, 255); 13 | padding-left: 5px; 14 | } 15 | .menu-item { 16 | font-size: 20px; 17 | display: inline; 18 | min-width: 150px; 19 | height: 50px; 20 | margin-left: 0; 21 | margin-right: 10px; 22 | padding: 5px; 23 | border: .5px solit #000; 24 | background: #4796b3; 25 | color: (255, 255, 255); 26 | line-height: 40px; 27 | } 28 | .menu-selected { 29 | font-size: 20px; 30 | display: inline; 31 | min-width: 150px; 32 | height: 50px; 33 | margin-left: 0; 34 | margin-right: 10px; 35 | padding: 5px; 36 | border: .5px solit #000; 37 | background: #096484; 38 | color: rgb(255, 255, 255); 39 | } 40 | .menu-item a { 41 | text-decoration: none; 42 | color: rgb(255, 255, 255); 43 | } 44 | -------------------------------------------------------------------------------- /etc/nginx/fastcgi_params: -------------------------------------------------------------------------------- 1 | 2 | fastcgi_param QUERY_STRING $query_string; 3 | fastcgi_param REQUEST_METHOD $request_method; 4 | fastcgi_param CONTENT_TYPE $content_type; 5 | fastcgi_param CONTENT_LENGTH $content_length; 6 | 7 | fastcgi_param SCRIPT_NAME $fastcgi_script_name; 8 | fastcgi_param REQUEST_URI $request_uri; 9 | fastcgi_param DOCUMENT_URI $document_uri; 10 | fastcgi_param DOCUMENT_ROOT $document_root; 11 | fastcgi_param SERVER_PROTOCOL $server_protocol; 12 | fastcgi_param HTTPS $https if_not_empty; 13 | 14 | fastcgi_param GATEWAY_INTERFACE CGI/1.1; 15 | fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; 16 | 17 | fastcgi_param REMOTE_ADDR $remote_addr; 18 | fastcgi_param REMOTE_PORT $remote_port; 19 | fastcgi_param SERVER_ADDR $server_addr; 20 | fastcgi_param SERVER_PORT $server_port; 21 | fastcgi_param SERVER_NAME $server_name; 22 | 23 | # PHP only, required if PHP was built with --enable-force-cgi-redirect 24 | fastcgi_param REDIRECT_STATUS 200; 25 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/styles/light.css: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is a part of SQLite Integration. 3 | * 4 | * @package SQLite Integration 5 | * @author Kojima Toshiyasu 6 | */ 7 | @import url('./style.min.css'); 8 | @CHARSET "UTF-8"; 9 | #sqlite-admin-wrap h2, 10 | #sqlite-admin-side-wrap h2 { 11 | background: #e5e5e5; 12 | color: rgb(55, 55, 55); 13 | padding-left: 5px; 14 | } 15 | .menu-item { 16 | font-size: 20px; 17 | display: inline; 18 | min-width: 150px; 19 | height: 50px; 20 | margin-left: 0; 21 | margin-right: 10px; 22 | padding: 5px; 23 | border: .5px solit #000; 24 | background: #e5e5e5; 25 | color: rgb(55, 55, 55); 26 | border-bottom-color: whitesmoke; 27 | line-height: 40px; 28 | } 29 | .menu-selected { 30 | font-size: 20px; 31 | display: inline; 32 | min-width: 150px; 33 | height: 50px; 34 | margin-left: 0; 35 | margin-right: 10px; 36 | padding: 5px; 37 | background: #888888; 38 | color: rgb(255, 255, 255); 39 | border-bottom-color: whitesmoke; 40 | } 41 | .menu-item a { 42 | text-decoration: none; 43 | color: rgb(55, 55, 55); 44 | } 45 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/styles/midnight.css: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is a part of SQLite Integration. 3 | * 4 | * @package SQLite Integration 5 | * @author Kojima Toshiyasu 6 | */ 7 | @import url('./style.min.css'); 8 | @CHARSET "UTF-8"; 9 | #sqlite-admin-wrap h2, 10 | #sqlite-admin-side-wrap h2 { 11 | background: #363b3f; 12 | color: rgb(255, 255, 255); 13 | padding-left: 5px; 14 | } 15 | .menu-item { 16 | font-size: 20px; 17 | display: inline; 18 | min-width: 150px; 19 | height: 50px; 20 | margin-left: 0; 21 | margin-right: 10px; 22 | padding: 5px; 23 | border: .5px solit #000; 24 | background: #363b3f; 25 | color: rgb(255, 255, 255); 26 | line-height: 40px; 27 | } 28 | .menu-selected { 29 | font-size: 20px; 30 | display: inline; 31 | min-width: 150px; 32 | height: 50px; 33 | margin-left: 0; 34 | margin-right: 10px; 35 | padding: 5px; 36 | background: #e14d43; 37 | color: rgb(255, 255, 255); 38 | } 39 | .menu-item a { 40 | text-decoration: none; 41 | color: rgb(255, 255, 255); 42 | } 43 | .menu-item { 44 | background: #363b3f; 45 | color: rgb(255, 255, 255); 46 | } 47 | -------------------------------------------------------------------------------- /etc/nginx/fastcgi.conf: -------------------------------------------------------------------------------- 1 | 2 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 3 | fastcgi_param QUERY_STRING $query_string; 4 | fastcgi_param REQUEST_METHOD $request_method; 5 | fastcgi_param CONTENT_TYPE $content_type; 6 | fastcgi_param CONTENT_LENGTH $content_length; 7 | 8 | fastcgi_param SCRIPT_NAME $fastcgi_script_name; 9 | fastcgi_param REQUEST_URI $request_uri; 10 | fastcgi_param DOCUMENT_URI $document_uri; 11 | fastcgi_param DOCUMENT_ROOT $document_root; 12 | fastcgi_param SERVER_PROTOCOL $server_protocol; 13 | fastcgi_param HTTPS $https if_not_empty; 14 | 15 | fastcgi_param GATEWAY_INTERFACE CGI/1.1; 16 | fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; 17 | 18 | fastcgi_param REMOTE_ADDR $remote_addr; 19 | fastcgi_param REMOTE_PORT $remote_port; 20 | fastcgi_param SERVER_ADDR $server_addr; 21 | fastcgi_param SERVER_PORT $server_port; 22 | fastcgi_param SERVER_NAME $server_name; 23 | 24 | # PHP only, required if PHP was built with --enable-force-cgi-redirect 25 | fastcgi_param REDIRECT_STATUS 200; 26 | -------------------------------------------------------------------------------- /.sandstorm/description.md: -------------------------------------------------------------------------------- 1 | The popular WordPress blogging platform, adapted as a Sandstorm app. 2 | 3 | Publish content to any domain you control, 4 | add collaborators through Sandstorm's 5 | [sharing interface](https://blog.sandstorm.io/news/2015-05-05-delegation-is-the-cornerstone-of-civilization.html), 6 | install arbitrary themes and plugins, 7 | and rest assured that Sandstorm's 8 | [security features](https://docs.sandstorm.io/en/latest/using/security-practices/) 9 | seriously limit the damage that an evil person or plugin could cause. 10 | 11 | This app has a few quirks that distinguish it from a standard WordPress install. 12 | Probably the first you'll notice is that it only publishes *static* content. 13 | Unlike a standard WordPress setup, where the published content and the admin panel 14 | get served from the same domain by the same server, in this app 15 | published content can only be static and gets served by Sandstorm's web publishing feature, 16 | while the WordPress admin panel is only accessible to authorized users through the Sandstorm shell. 17 | This has advantages for your site's speed and security, though it does mean that WordPress's Comments feature 18 | will not work on your published site. 19 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | wordpress_repo = https://github.com/dwrensha/wordpress.git 2 | wordpress_repo_branch = sandstorm-app 3 | git_repo_dir = /home/vagrant 4 | 5 | 6 | .PHONY: all clean 7 | 8 | all: wordpress-read-only sandstorm/bin/getPublicId 9 | 10 | clean: 11 | rm -rf wordpress-read-only 12 | 13 | $(git_repo_dir)/wordpress/.git: 14 | git clone ${wordpress_repo} $(git_repo_dir)/wordpress && cd $(git_repo_dir)/wordpress && git checkout ${wordpress_repo_branch} 15 | 16 | wordpress-read-only: $(git_repo_dir)/wordpress/.git 17 | cp -r $(git_repo_dir)/wordpress wordpress-read-only 18 | rm -rf wordpress-read-only/.git 19 | cp wp-config.php wordpress-read-only/ 20 | mv wordpress-read-only/wp-content wordpress-read-only/wp-content-read-only 21 | ln -s /var/wordpress/wp-content wordpress-read-only/wp-content 22 | cp read-only-plugins/sqlite-integration/db.php wordpress-read-only/wp-content-read-only/ 23 | 24 | 25 | sandstorm/bin/getPublicId: /usr/local/bin/capnp 26 | (cd sandstorm && make CXX=g++) 27 | 28 | $(git_repo_dir)/capnproto/.git: 29 | git clone https://github.com/sandstorm-io/capnproto $(git_repo_dir)/capnproto 30 | 31 | /usr/local/bin/capnp: $(git_repo_dir)/capnproto/.git 32 | (cd $(git_repo_dir)/capnproto/c++ && autoreconf -i && ./configure && make && sudo make install) 33 | -------------------------------------------------------------------------------- /.sandstorm/launcher.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | # This script is run every time an instance of our app - aka grain - starts up. 4 | # This is the entry point for your application both when a grain is first launched 5 | # and when a grain resumes after being previously shut down. 6 | # 7 | # This script is responsible for launching everything your app needs to run. The 8 | # thing it should do *last* is: 9 | # 10 | # * Start a process in the foreground listening on port 8000 for HTTP requests. 11 | # 12 | # This is how you indicate to the platform that your application is up and 13 | # ready to receive requests. Often, this will be something like nginx serving 14 | # static files and reverse proxying for some other dynamic backend service. 15 | # 16 | # Other things you probably want to do in this script include: 17 | # 18 | # * Building folder structures in /var. /var is the only non-tmpfs folder 19 | # mounted read-write in the sandbox, and when a grain is first launched, it 20 | # will start out empty. It will persist between runs of the same grain, but 21 | # be unique per app instance. That is, two instances of the same app have 22 | # separate instances of /var. 23 | # * Preparing a database and running migrations. As your package changes 24 | # over time and you release updates, you will need to deal with migrating 25 | # data from previous schema versions to new ones, since users should not have 26 | # to think about such things. 27 | # * Launching other daemons your app needs (e.g. mysqld, redis-server, etc.) 28 | 29 | # By default, this script does nothing. You'll have to modify it as 30 | # appropriate for your application. 31 | cd /opt/app 32 | exit 0 33 | -------------------------------------------------------------------------------- /.sandstorm/app-graphics/wordpress-150.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 9 | 10 | 13 | 20 | 22 | 23 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /.sandstorm/global-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | # Set options for curl. Since we only want to show errors from these curl commands, we also use 5 | # 'cat' to buffer the output; for more information: 6 | # https://github.com/sandstorm-io/vagrant-spk/issues/158 7 | 8 | CURL_OPTS="--silent --show-error" 9 | echo localhost > /etc/hostname 10 | hostname localhost 11 | 12 | # The following line copies stderr through stderr to cat without accidentally leaving it in the 13 | # output file. Be careful when changing. See: https://github.com/sandstorm-io/vagrant-spk/pull/159 14 | curl $CURL_OPTS https://install.sandstorm.io/ 2>&1 > /host-dot-sandstorm/caches/install.sh | cat 15 | 16 | SANDSTORM_CURRENT_VERSION=$(curl $CURL_OPTS -f "https://install.sandstorm.io/dev?from=0&type=install") 17 | SANDSTORM_PACKAGE="sandstorm-$SANDSTORM_CURRENT_VERSION.tar.xz" 18 | if [[ ! -f /host-dot-sandstorm/caches/$SANDSTORM_PACKAGE ]] ; then 19 | echo -n "Downloading Sandstorm version ${SANDSTORM_CURRENT_VERSION}..." 20 | curl $CURL_OPTS --output "/host-dot-sandstorm/caches/$SANDSTORM_PACKAGE.partial" "https://dl.sandstorm.io/$SANDSTORM_PACKAGE" 2>&1 | cat 21 | mv "/host-dot-sandstorm/caches/$SANDSTORM_PACKAGE.partial" "/host-dot-sandstorm/caches/$SANDSTORM_PACKAGE" 22 | echo "...done." 23 | fi 24 | if [ ! -e /opt/sandstorm/latest/sandstorm ] ; then 25 | echo -n "Installing Sandstorm version ${SANDSTORM_CURRENT_VERSION}..." 26 | bash /host-dot-sandstorm/caches/install.sh -d -e "/host-dot-sandstorm/caches/$SANDSTORM_PACKAGE" >/dev/null 27 | echo "...done." 28 | fi 29 | modprobe ip_tables 30 | # Make the vagrant user part of the sandstorm group so that commands like 31 | # `spk dev` work. 32 | usermod -a -G 'sandstorm' 'vagrant' 33 | # Bind to all addresses, so the vagrant port-forward works. 34 | sudo sed --in-place='' \ 35 | --expression='s/^BIND_IP=.*/BIND_IP=0.0.0.0/' \ 36 | /opt/sandstorm/sandstorm.conf 37 | sudo service sandstorm restart 38 | # Enable apt-cacher-ng proxy to make things faster if one appears to be running on the gateway IP 39 | GATEWAY_IP=$(ip route | grep ^default | cut -d ' ' -f 3) 40 | if nc -z "$GATEWAY_IP" 3142 ; then 41 | echo "Acquire::http::Proxy \"http://$GATEWAY_IP:3142\";" > /etc/apt/apt.conf.d/80httpproxy 42 | fi 43 | # Configure apt to retry fetching things that fail to download. 44 | echo "APT::Acquire::Retries \"10\";" > /etc/apt/apt.conf.d/80sandstorm-retry 45 | -------------------------------------------------------------------------------- /.sandstorm/app-graphics/wordpress-24.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 22 | 29 | 31 | 32 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/js/sqlite.min.js: -------------------------------------------------------------------------------- 1 | jQuery(document).ready(function($){function stripe(arg){$(arg).find("tr.alt").removeClass("alt");var $args=arg+" tbody";$($args).each(function(){$(this).children(":visible").has("td").filter(function(index){return 1==index%2}).addClass("alt")})}var $table=null,$headers=null;null!=document.getElementById("sqlite-table")?($table=$("#sqlite-table"),$headers=$table.find("thead th").slice(0,2)):null!=document.getElementById("plugins-table")?($table=$("#plugins-table"),$headers=$table.find("thead th").slice(0)):null!=document.getElementById("patch-files")?($table=$("#patch-files"),$headers=$table.find("thead th").slice(1)):null!=document.getElementById("backup-files")&&($table=$("#backup-files"),$headers=$table.find("thead th").slice(1)),$headers.wrapInner('').addClass("sort");var rows=$table.find("tbody > tr").get();$headers.bind("click",function(event){event.preventDefault();var $header=$(this),sortKey=$header.data("sort").key,sortDirection=1;$header.hasClass("sorted-asc")&&(sortDirection=-1),rows.sort(function(a,b){var keyA=$(a).data("table")[sortKey],keyB=$(b).data("table")[sortKey];return keyB>keyA?-sortDirection:keyA>keyB?sortDirection:0}),$headers.removeClass("sorted-asc sortd-desc"),$headers.addClass(1==sortDirection?"sorted-asc":"sorted-desc"),$.each(rows,function(index,row){$table.children("tbody").append(row)}),stripe("#plugins-table"),stripe("#sqlite-table"),stripe("#patch-files")}),stripe("#plugins-table"),stripe("#sys-info"),stripe("#sqlite-table"),stripe("#status"),stripe("#patch-files")}),jQuery(document).ready(function($){function stripe(arg){$(arg).find("tr.alt").removeClass("alt");var $args=arg+" tbody";$($args).each(function(){$(this).children(":visible").has("td").filter(function(index){return 1==index%2}).addClass("alt")})}var $table=$("#plugins-info"),$headers=$table.find("thead th").slice(0);$headers.wrapInner('').addClass("sort");var rows=$table.find("tbody > tr").get();$headers.bind("click",function(event){event.preventDefault();var $header=$(this),sortKey=$header.data("sort").key,sortDirection=1;$header.hasClass("sorted-asc")&&(sortDirection=-1),rows.sort(function(a,b){var keyA=$(a).data("table")[sortKey],keyB=$(b).data("table")[sortKey];return keyB>keyA?-sortDirection:keyA>keyB?sortDirection:0}),$headers.removeClass("sorted-asc sortd-desc"),$headers.addClass(1==sortDirection?"sorted-asc":"sorted-desc"),$.each(rows,function(index,row){$table.children("tbody").append(row)}),stripe("#plugins-info")}),stripe("#plugins-info")}); -------------------------------------------------------------------------------- /.sandstorm/app-graphics/wordpress-128.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 11 | 13 | 15 | 16 | 17 | 18 | 21 | 27 | 29 | 30 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /etc/nginx/koi-win: -------------------------------------------------------------------------------- 1 | 2 | charset_map koi8-r windows-1251 { 3 | 4 | 80 88 ; # euro 5 | 6 | 95 95 ; # bullet 7 | 8 | 9A A0 ; #   9 | 10 | 9E B7 ; # · 11 | 12 | A3 B8 ; # small yo 13 | A4 BA ; # small Ukrainian ye 14 | 15 | A6 B3 ; # small Ukrainian i 16 | A7 BF ; # small Ukrainian yi 17 | 18 | AD B4 ; # small Ukrainian soft g 19 | AE A2 ; # small Byelorussian short u 20 | 21 | B0 B0 ; # ° 22 | 23 | B3 A8 ; # capital YO 24 | B4 AA ; # capital Ukrainian YE 25 | 26 | B6 B2 ; # capital Ukrainian I 27 | B7 AF ; # capital Ukrainian YI 28 | 29 | B9 B9 ; # numero sign 30 | 31 | BD A5 ; # capital Ukrainian soft G 32 | BE A1 ; # capital Byelorussian short U 33 | 34 | BF A9 ; # (C) 35 | 36 | C0 FE ; # small yu 37 | C1 E0 ; # small a 38 | C2 E1 ; # small b 39 | C3 F6 ; # small ts 40 | C4 E4 ; # small d 41 | C5 E5 ; # small ye 42 | C6 F4 ; # small f 43 | C7 E3 ; # small g 44 | C8 F5 ; # small kh 45 | C9 E8 ; # small i 46 | CA E9 ; # small j 47 | CB EA ; # small k 48 | CC EB ; # small l 49 | CD EC ; # small m 50 | CE ED ; # small n 51 | CF EE ; # small o 52 | 53 | D0 EF ; # small p 54 | D1 FF ; # small ya 55 | D2 F0 ; # small r 56 | D3 F1 ; # small s 57 | D4 F2 ; # small t 58 | D5 F3 ; # small u 59 | D6 E6 ; # small zh 60 | D7 E2 ; # small v 61 | D8 FC ; # small soft sign 62 | D9 FB ; # small y 63 | DA E7 ; # small z 64 | DB F8 ; # small sh 65 | DC FD ; # small e 66 | DD F9 ; # small shch 67 | DE F7 ; # small ch 68 | DF FA ; # small hard sign 69 | 70 | E0 DE ; # capital YU 71 | E1 C0 ; # capital A 72 | E2 C1 ; # capital B 73 | E3 D6 ; # capital TS 74 | E4 C4 ; # capital D 75 | E5 C5 ; # capital YE 76 | E6 D4 ; # capital F 77 | E7 C3 ; # capital G 78 | E8 D5 ; # capital KH 79 | E9 C8 ; # capital I 80 | EA C9 ; # capital J 81 | EB CA ; # capital K 82 | EC CB ; # capital L 83 | ED CC ; # capital M 84 | EE CD ; # capital N 85 | EF CE ; # capital O 86 | 87 | F0 CF ; # capital P 88 | F1 DF ; # capital YA 89 | F2 D0 ; # capital R 90 | F3 D1 ; # capital S 91 | F4 D2 ; # capital T 92 | F5 D3 ; # capital U 93 | F6 C6 ; # capital ZH 94 | F7 C2 ; # capital V 95 | F8 DC ; # capital soft sign 96 | F9 DB ; # capital Y 97 | FA C7 ; # capital Z 98 | FB D8 ; # capital SH 99 | FC DD ; # capital E 100 | FD D9 ; # capital SHCH 101 | FE D7 ; # capital CH 102 | FF DA ; # capital hard sign 103 | } 104 | -------------------------------------------------------------------------------- /sandstorm/getPublicId.c++: -------------------------------------------------------------------------------- 1 | // Sandstorm - Personal Cloud Sandbox 2 | // Copyright (c) 2014 Sandstorm Development Group, Inc. and contributors 3 | // 4 | 5 | // Hack around stdlib bug with C++14. 6 | #include // force libstdc++ to include its config 7 | #undef _GLIBCXX_HAVE_GETS // correct broken config 8 | // End hack. 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | namespace sandstorm { 24 | 25 | class GetPublicIdMain { 26 | public: 27 | GetPublicIdMain(kj::ProcessContext& context): context(context) { } 28 | 29 | kj::MainFunc getMain() { 30 | return kj::MainBuilder(context, "GetPublicId version: 0.0.2", 31 | "Runs the getPublicId command from hack-session.capnp. " 32 | "Outputs the return arguments as separate lines on stdout.") 33 | .expectArg("", KJ_BIND_METHOD(*this, setSessionId)) 34 | .callAfterParsing(KJ_BIND_METHOD(*this, run)) 35 | .build(); 36 | } 37 | 38 | kj::MainBuilder::Validity setSessionId(kj::StringPtr id) { 39 | sessionId = kj::heapString(id); 40 | return true; 41 | } 42 | 43 | kj::MainBuilder::Validity run() { 44 | capnp::EzRpcClient client("unix:/tmp/sandstorm-api"); 45 | SandstormHttpBridge::Client restorer = client.getMain(); 46 | 47 | auto request = restorer.getSessionContextRequest(); 48 | request.setId(sessionId); 49 | auto session = request.send().getContext().castAs(); 50 | 51 | kj::Promise promise = session.getPublicIdRequest().send().then([](auto result) -> void { 52 | auto publicId = result.getPublicId(); 53 | auto hostname = result.getHostname(); 54 | auto autoUrl = result.getAutoUrl(); 55 | auto isDemoUser = result.getIsDemoUser(); 56 | kj::String msg = kj::str(publicId, "\n", hostname, "\n", autoUrl, "\n", 57 | isDemoUser ? "true" : "false", "\n"); 58 | kj::FdOutputStream(STDOUT_FILENO).write(msg.begin(), msg.size()); 59 | }, [] (auto e) { 60 | auto desc = e.getDescription(); 61 | kj::FdOutputStream(STDOUT_FILENO).write(desc.begin(), desc.size()); 62 | }); 63 | 64 | promise.wait(client.getWaitScope()); 65 | return true; 66 | } 67 | 68 | private: 69 | kj::ProcessContext& context; 70 | kj::String sessionId; 71 | }; 72 | 73 | } // namespace sandstorm 74 | 75 | KJ_MAIN(sandstorm::GetPublicIdMain) 76 | 77 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/install.php: -------------------------------------------------------------------------------- 1 | Note that password carefully! It is a random password that was generated just for you.'); 48 | $user_id = wp_create_user($user_name, $user_password, $user_email); 49 | update_user_option($user_id, 'default_password_nag', true, true); 50 | $email_password = true; 51 | } else if (!$user_id) { 52 | $message = ''.__('Your chosen password.').''; 53 | $user_id = wp_create_user($user_name, $user_password, $user_email); 54 | } 55 | 56 | $user = new WP_User($user_id); 57 | $user->set_role('administrator'); 58 | 59 | wp_install_defaults($user_id); 60 | 61 | flush_rewrite_rules(); 62 | 63 | wp_new_blog_notification($blog_title, $guessurl, $user_id, ($email_password ? $user_password : __('The password you chose during the install.'))); 64 | 65 | wp_cache_flush(); 66 | 67 | if (isset($_SERVER['SERVER_SOFTWARE']) && stripos($_SERVER['SERVER_SOFTWARE'], 'apache') !== false || isset($_SERVER['SERVER_SIGNATURE']) && stripos($_SERVER['SERVER_SIGNATURE'], 'apache') !== false) { 68 | ;// Your server is Apache. Nothing to do more. 69 | } else { 70 | $server_message = sprintf('Your webserver doesn\'t seem to be Apache. So the database directory access restriction by the .htaccess file may not function. We strongly recommend that you should restrict the access to the directory %s in some other way.', FQDBDIR); 71 | echo '

'; 72 | echo $server_message; 73 | echo '

'; 74 | } 75 | 76 | return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message); 77 | } 78 | ?> -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/schema.php: -------------------------------------------------------------------------------- 1 | PDO::ERRMODE_EXCEPTION)); 31 | } catch (PDOException $err) { 32 | $err_data = $err->errorInfo; 33 | $message = 'Database connection error!
'; 34 | $message .= sprintf("Error message is: %s", $err_data[2]); 35 | wp_die($message, 'Database Error!'); 36 | } 37 | 38 | try { 39 | $pdo->beginTransaction(); 40 | foreach ($queries as $query) { 41 | $query = trim($query); 42 | if (empty($query)) 43 | continue; 44 | $rewritten_query = $query_parser->rewrite_query($query); 45 | if (is_array($rewritten_query)) { 46 | $table_query = array_shift($rewritten_query); 47 | $index_queries = $rewritten_query; 48 | $table_query = trim($table_query); 49 | $pdo->exec($table_query); 50 | //foreach($rewritten_query as $single_query) { 51 | // $single_query = trim($single_query); 52 | // $pdo->exec($single_query); 53 | //} 54 | } else { 55 | $rewritten_query = trim($rewritten_query); 56 | $pdo->exec($rewritten_query); 57 | } 58 | } 59 | $pdo->commit(); 60 | if ($index_queries) { 61 | // $query_parser rewrites KEY to INDEX, so we don't need KEY pattern 62 | $pattern = '/CREATE\\s*(UNIQUE\\s*INDEX|INDEX)\\s*IF\\s*NOT\\s*EXISTS\\s*(\\w+)?\\s*.*/im'; 63 | $pdo->beginTransaction(); 64 | foreach ($index_queries as $index_query) { 65 | preg_match($pattern, $index_query, $match); 66 | $index_name = trim($match[2]); 67 | if (in_array($index_name, $index_array)) { 68 | $r = rand(0, 50); 69 | $replacement = $index_name . "_$r"; 70 | $index_query = str_ireplace('EXISTS '.$index_name, 'EXISTS '.$replacement, $index_query); 71 | } else { 72 | $index_array[] = $index_name; 73 | } 74 | $pdo->exec($index_query); 75 | } 76 | $pdo->commit(); 77 | } 78 | } catch (PDOException $err) { 79 | $err_data = $err->errorInfo; 80 | $err_code = $err_data[1]; 81 | if (5 == $err_code || 6 == $err_code) { 82 | // if the database is locked, commit again 83 | $pdo->commit(); 84 | } else { 85 | $pdo->rollBack(); 86 | $message = sprintf("Error occured while creating tables or indexes...
Query was: %s
", var_export($rewritten_query, true)); 87 | $message .= sprintf("Error message is: %s", $err_data[2]); 88 | wp_die($message, 'Database Error!'); 89 | } 90 | } 91 | 92 | $query_parser = null; 93 | $pdo = null; 94 | return true; 95 | } 96 | ?> -------------------------------------------------------------------------------- /etc/nginx/koi-utf: -------------------------------------------------------------------------------- 1 | 2 | # This map is not a full koi8-r <> utf8 map: it does not contain 3 | # box-drawing and some other characters. Besides this map contains 4 | # several koi8-u and Byelorussian letters which are not in koi8-r. 5 | # If you need a full and standard map, use contrib/unicode2nginx/koi-utf 6 | # map instead. 7 | 8 | charset_map koi8-r utf-8 { 9 | 10 | 80 E282AC ; # euro 11 | 12 | 95 E280A2 ; # bullet 13 | 14 | 9A C2A0 ; #   15 | 16 | 9E C2B7 ; # · 17 | 18 | A3 D191 ; # small yo 19 | A4 D194 ; # small Ukrainian ye 20 | 21 | A6 D196 ; # small Ukrainian i 22 | A7 D197 ; # small Ukrainian yi 23 | 24 | AD D291 ; # small Ukrainian soft g 25 | AE D19E ; # small Byelorussian short u 26 | 27 | B0 C2B0 ; # ° 28 | 29 | B3 D081 ; # capital YO 30 | B4 D084 ; # capital Ukrainian YE 31 | 32 | B6 D086 ; # capital Ukrainian I 33 | B7 D087 ; # capital Ukrainian YI 34 | 35 | B9 E28496 ; # numero sign 36 | 37 | BD D290 ; # capital Ukrainian soft G 38 | BE D18E ; # capital Byelorussian short U 39 | 40 | BF C2A9 ; # (C) 41 | 42 | C0 D18E ; # small yu 43 | C1 D0B0 ; # small a 44 | C2 D0B1 ; # small b 45 | C3 D186 ; # small ts 46 | C4 D0B4 ; # small d 47 | C5 D0B5 ; # small ye 48 | C6 D184 ; # small f 49 | C7 D0B3 ; # small g 50 | C8 D185 ; # small kh 51 | C9 D0B8 ; # small i 52 | CA D0B9 ; # small j 53 | CB D0BA ; # small k 54 | CC D0BB ; # small l 55 | CD D0BC ; # small m 56 | CE D0BD ; # small n 57 | CF D0BE ; # small o 58 | 59 | D0 D0BF ; # small p 60 | D1 D18F ; # small ya 61 | D2 D180 ; # small r 62 | D3 D181 ; # small s 63 | D4 D182 ; # small t 64 | D5 D183 ; # small u 65 | D6 D0B6 ; # small zh 66 | D7 D0B2 ; # small v 67 | D8 D18C ; # small soft sign 68 | D9 D18B ; # small y 69 | DA D0B7 ; # small z 70 | DB D188 ; # small sh 71 | DC D18D ; # small e 72 | DD D189 ; # small shch 73 | DE D187 ; # small ch 74 | DF D18A ; # small hard sign 75 | 76 | E0 D0AE ; # capital YU 77 | E1 D090 ; # capital A 78 | E2 D091 ; # capital B 79 | E3 D0A6 ; # capital TS 80 | E4 D094 ; # capital D 81 | E5 D095 ; # capital YE 82 | E6 D0A4 ; # capital F 83 | E7 D093 ; # capital G 84 | E8 D0A5 ; # capital KH 85 | E9 D098 ; # capital I 86 | EA D099 ; # capital J 87 | EB D09A ; # capital K 88 | EC D09B ; # capital L 89 | ED D09C ; # capital M 90 | EE D09D ; # capital N 91 | EF D09E ; # capital O 92 | 93 | F0 D09F ; # capital P 94 | F1 D0AF ; # capital YA 95 | F2 D0A0 ; # capital R 96 | F3 D0A1 ; # capital S 97 | F4 D0A2 ; # capital T 98 | F5 D0A3 ; # capital U 99 | F6 D096 ; # capital ZH 100 | F7 D092 ; # capital V 101 | F8 D0AC ; # capital soft sign 102 | F9 D0AB ; # capital Y 103 | FA D097 ; # capital Z 104 | FB D0A8 ; # capital SH 105 | FC D0AD ; # capital E 106 | FD D0A9 ; # capital SHCH 107 | FE D0A7 ; # capital CH 108 | FF D0AA ; # capital hard sign 109 | } 110 | -------------------------------------------------------------------------------- /wp-config.php: -------------------------------------------------------------------------------- 1 | $value) { 6 | if (substr($key,0,5)=="HTTP_") { 7 | $key=str_replace(" ","-",ucwords(strtolower(str_replace("_"," ",substr($key,5))))); 8 | $out[$key]=$value; 9 | }else{ 10 | $out[$key]=$value; 11 | } 12 | } 13 | return $out; 14 | } 15 | } 16 | 17 | $headers = apache_request_headers(); 18 | 19 | $sandstorm_base_path = 'http://' . $_SERVER['HTTP_HOST']; 20 | 21 | if (isset($headers['X-Sandstorm-Base-Path'])) { 22 | $sandstorm_base_path = $headers['X-Sandstorm-Base-Path']; 23 | } 24 | 25 | if ('https' == substr($sandstorm_base_path, 0, 5)) { 26 | $_SERVER['HTTPS'] = 'on'; 27 | } 28 | 29 | // On Blackrock, package storage and grain storage are owned by different UIDs; 30 | // without the following line, WordPress will try to fall back to FTP for theme 31 | // and plugin uploads. 32 | define('FS_METHOD', 'direct'); 33 | 34 | /**#@+ 35 | * Authentication Unique Keys and Salts. 36 | * 37 | * Change these to different unique phrases! 38 | * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service} 39 | * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again. 40 | * 41 | * @since 2.6.0 42 | * 43 | */ 44 | 45 | define('AUTH_KEY', $_SERVER['WORDPRESS_AUTH_KEY']); 46 | define('SECURE_AUTH_KEY', $_SERVER['WORDPRESS_SECURE_AUTH_KEY']); 47 | define('LOGGED_IN_KEY', $_SERVER['WORDPRESS_LOGGED_IN_KEY']); 48 | define('NONCE_KEY', $_SERVER['WORDPRESS_NONCE_KEY']); 49 | define('AUTH_SALT', $_SERVER['WORDPRESS_AUTH_SALT']); 50 | define('SECURE_AUTH_SALT', $_SERVER['WORDPRESS_SECURE_AUTH_SALT']); 51 | define('LOGGED_IN_SALT', $_SERVER['WORDPRESS_LOGGED_IN_SALT']); 52 | define('NONCE_SALT', $_SERVER['WORDPRESS_NONCE_SALT']); 53 | 54 | /**#@-*/ 55 | 56 | /** 57 | * WordPress Database Table prefix. 58 | * 59 | * You can have multiple installations in one database if you give each a unique 60 | * prefix. Only numbers, letters, and underscores please! 61 | */ 62 | $table_prefix = 'wp_'; 63 | 64 | /** 65 | * WordPress Localized Language, defaults to English. 66 | * 67 | * Change this to localize WordPress. A corresponding MO file for the chosen 68 | * language must be installed to wp-content/languages. For example, install 69 | * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German 70 | * language support. 71 | */ 72 | define('WPLANG', ''); 73 | 74 | /** 75 | * For developers: WordPress debugging mode. 76 | * 77 | * Change this to true to enable the display of notices during development. 78 | * It is strongly recommended that plugin and theme developers use WP_DEBUG 79 | * in their development environments. 80 | */ 81 | define('WP_DEBUG', false); 82 | 83 | define('WP_HOME', $sandstorm_base_path); 84 | define('WP_SITEURL', $sandstorm_base_path); 85 | define('WP_CONTENT_URL', '/wp-content'); 86 | define('WP_CONTENT_DIR', '/var/wordpress/wp-content'); 87 | define('WP_PLUGIN_DIR', '/var/wordpress/wp-content/plugins'); 88 | define('WPMU_PLUGIN_DIR', '/var/wordpress/wp-content/mu-plugins'); 89 | define('DOMAIN_CURRENT_SITE', $_SERVER['HTTP_HOST']); 90 | 91 | /* That's all, stop editing! Happy blogging. */ 92 | 93 | /** Absolute path to the WordPress directory. */ 94 | if ( !defined('ABSPATH') ) 95 | define('ABSPATH', dirname(__FILE__) . '/'); 96 | 97 | /** Sets up WordPress vars and included files. */ 98 | require_once(ABSPATH . 'wp-settings.php'); 99 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/js/sqlite.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This is a part of SQLite Integration. 3 | * 4 | * This script is only included on the documentation and utility page. 5 | * 6 | * @package SQLite Integration 7 | * @author Kojima Toshiyasu 8 | */ 9 | jQuery(document).ready(function($) { 10 | var $table = null; 11 | var $headers = null; 12 | if (document.getElementById("sqlite-table") != null) { 13 | $table = $('#sqlite-table'); 14 | $headers = $table.find('thead th').slice(0,2); 15 | } else if (document.getElementById("plugins-table") != null) { 16 | $table = $('#plugins-table'); 17 | $headers = $table.find('thead th').slice(0); 18 | } else if (document.getElementById("patch-files") != null) { 19 | $table = $('#patch-files'); 20 | $headers = $table.find('thead th').slice(1); 21 | } else if (document.getElementById("backup-files") != null) { 22 | $table = $('#backup-files'); 23 | $headers = $table.find('thead th').slice(1); 24 | } 25 | $headers 26 | .wrapInner('') 27 | .addClass('sort'); 28 | var rows = $table.find('tbody > tr').get(); 29 | $headers.bind('click', function(event) { 30 | event.preventDefault(); 31 | var $header = $(this), 32 | sortKey = $header.data('sort').key, 33 | sortDirection = 1; 34 | if ($header.hasClass('sorted-asc')) { 35 | sortDirection = -1; 36 | } 37 | rows.sort(function(a, b) { 38 | var keyA = $(a).data('table')[sortKey]; 39 | var keyB = $(b).data('table')[sortKey]; 40 | if (keyA < keyB) return -sortDirection; 41 | if (keyA > keyB) return sortDirection; 42 | return 0; 43 | }); 44 | $headers.removeClass('sorted-asc sortd-desc'); 45 | $headers.addClass(sortDirection == 1 ? 'sorted-asc' : 'sorted-desc'); 46 | $.each(rows, function(index, row) { 47 | $table.children('tbody').append(row); 48 | }); 49 | stripe('#plugins-table'); 50 | stripe('#sqlite-table'); 51 | stripe('#patch-files'); 52 | }); 53 | function stripe(arg) { 54 | $(arg).find('tr.alt').removeClass('alt'); 55 | var $args = arg + ' tbody'; 56 | $($args).each(function() { 57 | $(this).children(':visible').has('td').filter(function(index) { 58 | return (index % 2) == 1; 59 | }).addClass('alt'); 60 | }); 61 | } 62 | stripe('#plugins-table'); 63 | stripe('#sys-info'); 64 | stripe('#sqlite-table'); 65 | stripe('#status'); 66 | stripe('#patch-files'); 67 | }); 68 | 69 | jQuery(document).ready(function($) { 70 | var $table = $('#plugins-info'); 71 | var $headers = $table.find('thead th').slice(0); 72 | $headers 73 | .wrapInner('') 74 | .addClass('sort'); 75 | var rows = $table.find('tbody > tr').get(); 76 | $headers.bind('click', function(event) { 77 | event.preventDefault(); 78 | var $header = $(this), 79 | sortKey = $header.data('sort').key, 80 | sortDirection = 1; 81 | if ($header.hasClass('sorted-asc')) { 82 | sortDirection = -1; 83 | } 84 | rows.sort(function(a, b) { 85 | var keyA = $(a).data('table')[sortKey]; 86 | var keyB = $(b).data('table')[sortKey]; 87 | if (keyA < keyB) return -sortDirection; 88 | if (keyA > keyB) return sortDirection; 89 | return 0; 90 | }); 91 | $headers.removeClass('sorted-asc sortd-desc'); 92 | $headers.addClass(sortDirection == 1 ? 'sorted-asc' : 'sorted-desc'); 93 | $.each(rows, function(index, row) { 94 | $table.children('tbody').append(row); 95 | }); 96 | stripe('#plugins-info'); 97 | }); 98 | function stripe(arg) { 99 | $(arg).find('tr.alt').removeClass('alt'); 100 | var $args = arg + ' tbody'; 101 | $($args).each(function() { 102 | $(this).children(':visible').has('td').filter(function(index) { 103 | return (index % 2) == 1; 104 | }).addClass('alt'); 105 | }); 106 | } 107 | stripe('#plugins-info'); 108 | }); 109 | -------------------------------------------------------------------------------- /etc/nginx/win-utf: -------------------------------------------------------------------------------- 1 | 2 | # This map is not a full windows-1251 <> utf8 map: it does not 3 | # contain Serbian and Macedonian letters. If you need a full map, 4 | # use contrib/unicode2nginx/win-utf map instead. 5 | 6 | charset_map windows-1251 utf-8 { 7 | 8 | 82 E2809A ; # single low-9 quotation mark 9 | 10 | 84 E2809E ; # double low-9 quotation mark 11 | 85 E280A6 ; # ellipsis 12 | 86 E280A0 ; # dagger 13 | 87 E280A1 ; # double dagger 14 | 88 E282AC ; # euro 15 | 89 E280B0 ; # per mille 16 | 17 | 91 E28098 ; # left single quotation mark 18 | 92 E28099 ; # right single quotation mark 19 | 93 E2809C ; # left double quotation mark 20 | 94 E2809D ; # right double quotation mark 21 | 95 E280A2 ; # bullet 22 | 96 E28093 ; # en dash 23 | 97 E28094 ; # em dash 24 | 25 | 99 E284A2 ; # trade mark sign 26 | 27 | A0 C2A0 ; #   28 | A1 D18E ; # capital Byelorussian short U 29 | A2 D19E ; # small Byelorussian short u 30 | 31 | A4 C2A4 ; # currency sign 32 | A5 D290 ; # capital Ukrainian soft G 33 | A6 C2A6 ; # borken bar 34 | A7 C2A7 ; # section sign 35 | A8 D081 ; # capital YO 36 | A9 C2A9 ; # (C) 37 | AA D084 ; # capital Ukrainian YE 38 | AB C2AB ; # left-pointing double angle quotation mark 39 | AC C2AC ; # not sign 40 | AD C2AD ; # soft hypen 41 | AE C2AE ; # (R) 42 | AF D087 ; # capital Ukrainian YI 43 | 44 | B0 C2B0 ; # ° 45 | B1 C2B1 ; # plus-minus sign 46 | B2 D086 ; # capital Ukrainian I 47 | B3 D196 ; # small Ukrainian i 48 | B4 D291 ; # small Ukrainian soft g 49 | B5 C2B5 ; # micro sign 50 | B6 C2B6 ; # pilcrow sign 51 | B7 C2B7 ; # · 52 | B8 D191 ; # small yo 53 | B9 E28496 ; # numero sign 54 | BA D194 ; # small Ukrainian ye 55 | BB C2BB ; # right-pointing double angle quotation mark 56 | 57 | BF D197 ; # small Ukrainian yi 58 | 59 | C0 D090 ; # capital A 60 | C1 D091 ; # capital B 61 | C2 D092 ; # capital V 62 | C3 D093 ; # capital G 63 | C4 D094 ; # capital D 64 | C5 D095 ; # capital YE 65 | C6 D096 ; # capital ZH 66 | C7 D097 ; # capital Z 67 | C8 D098 ; # capital I 68 | C9 D099 ; # capital J 69 | CA D09A ; # capital K 70 | CB D09B ; # capital L 71 | CC D09C ; # capital M 72 | CD D09D ; # capital N 73 | CE D09E ; # capital O 74 | CF D09F ; # capital P 75 | 76 | D0 D0A0 ; # capital R 77 | D1 D0A1 ; # capital S 78 | D2 D0A2 ; # capital T 79 | D3 D0A3 ; # capital U 80 | D4 D0A4 ; # capital F 81 | D5 D0A5 ; # capital KH 82 | D6 D0A6 ; # capital TS 83 | D7 D0A7 ; # capital CH 84 | D8 D0A8 ; # capital SH 85 | D9 D0A9 ; # capital SHCH 86 | DA D0AA ; # capital hard sign 87 | DB D0AB ; # capital Y 88 | DC D0AC ; # capital soft sign 89 | DD D0AD ; # capital E 90 | DE D0AE ; # capital YU 91 | DF D0AF ; # capital YA 92 | 93 | E0 D0B0 ; # small a 94 | E1 D0B1 ; # small b 95 | E2 D0B2 ; # small v 96 | E3 D0B3 ; # small g 97 | E4 D0B4 ; # small d 98 | E5 D0B5 ; # small ye 99 | E6 D0B6 ; # small zh 100 | E7 D0B7 ; # small z 101 | E8 D0B8 ; # small i 102 | E9 D0B9 ; # small j 103 | EA D0BA ; # small k 104 | EB D0BB ; # small l 105 | EC D0BC ; # small m 106 | ED D0BD ; # small n 107 | EE D0BE ; # small o 108 | EF D0BF ; # small p 109 | 110 | F0 D180 ; # small r 111 | F1 D181 ; # small s 112 | F2 D182 ; # small t 113 | F3 D183 ; # small u 114 | F4 D184 ; # small f 115 | F5 D185 ; # small kh 116 | F6 D186 ; # small ts 117 | F7 D187 ; # small ch 118 | F8 D188 ; # small sh 119 | F9 D189 ; # small shch 120 | FA D18A ; # small hard sign 121 | FB D18B ; # small y 122 | FC D18C ; # small soft sign 123 | FD D18D ; # small e 124 | FE D18E ; # small yu 125 | FF D18F ; # small ya 126 | } 127 | -------------------------------------------------------------------------------- /etc/nginx/mime.types: -------------------------------------------------------------------------------- 1 | 2 | types { 3 | text/html html htm shtml; 4 | text/css css; 5 | text/xml xml; 6 | image/gif gif; 7 | image/jpeg jpeg jpg; 8 | application/javascript js; 9 | application/atom+xml atom; 10 | application/rss+xml rss; 11 | 12 | text/mathml mml; 13 | text/plain txt; 14 | text/vnd.sun.j2me.app-descriptor jad; 15 | text/vnd.wap.wml wml; 16 | text/x-component htc; 17 | 18 | image/png png; 19 | image/tiff tif tiff; 20 | image/vnd.wap.wbmp wbmp; 21 | image/x-icon ico; 22 | image/x-jng jng; 23 | image/x-ms-bmp bmp; 24 | image/svg+xml svg svgz; 25 | image/webp webp; 26 | 27 | application/font-woff woff; 28 | application/java-archive jar war ear; 29 | application/json json; 30 | application/mac-binhex40 hqx; 31 | application/msword doc; 32 | application/pdf pdf; 33 | application/postscript ps eps ai; 34 | application/rtf rtf; 35 | application/vnd.apple.mpegurl m3u8; 36 | application/vnd.ms-excel xls; 37 | application/vnd.ms-fontobject eot; 38 | application/vnd.ms-powerpoint ppt; 39 | application/vnd.wap.wmlc wmlc; 40 | application/vnd.google-earth.kml+xml kml; 41 | application/vnd.google-earth.kmz kmz; 42 | application/x-7z-compressed 7z; 43 | application/x-cocoa cco; 44 | application/x-java-archive-diff jardiff; 45 | application/x-java-jnlp-file jnlp; 46 | application/x-makeself run; 47 | application/x-perl pl pm; 48 | application/x-pilot prc pdb; 49 | application/x-rar-compressed rar; 50 | application/x-redhat-package-manager rpm; 51 | application/x-sea sea; 52 | application/x-shockwave-flash swf; 53 | application/x-stuffit sit; 54 | application/x-tcl tcl tk; 55 | application/x-x509-ca-cert der pem crt; 56 | application/x-xpinstall xpi; 57 | application/xhtml+xml xhtml; 58 | application/xspf+xml xspf; 59 | application/zip zip; 60 | 61 | application/octet-stream bin exe dll; 62 | application/octet-stream deb; 63 | application/octet-stream dmg; 64 | application/octet-stream iso img; 65 | application/octet-stream msi msp msm; 66 | 67 | application/vnd.openxmlformats-officedocument.wordprocessingml.document docx; 68 | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx; 69 | application/vnd.openxmlformats-officedocument.presentationml.presentation pptx; 70 | 71 | audio/midi mid midi kar; 72 | audio/mpeg mp3; 73 | audio/ogg ogg; 74 | audio/x-m4a m4a; 75 | audio/x-realaudio ra; 76 | 77 | video/3gpp 3gpp 3gp; 78 | video/mp2t ts; 79 | video/mp4 mp4; 80 | video/mpeg mpeg mpg; 81 | video/quicktime mov; 82 | video/webm webm; 83 | video/x-flv flv; 84 | video/x-m4v m4v; 85 | video/x-mng mng; 86 | video/x-ms-asf asx asf; 87 | video/x-ms-wmv wmv; 88 | video/x-msvideo avi; 89 | } 90 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/styles/style.min.css: -------------------------------------------------------------------------------- 1 | @CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#222;color:#fff;padding-left:5px}h3{clear:both}.navigation{display:block;margin-top:0;margin-bottom:0;min-height:20px}.navi-menu{margin-left:0}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#333;color:(255,255,255);line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#2ea2cc;color:#fff}.menu-item a{text-decoration:none;color:#fff}#sqlite-admin-wrap{color:#1d1d1d;font-size:11pt;border:1px solid #ddd;background:#fff;-webkit-border-bottom-right-radius:6px;-webkit-border-bottom-left-radius:6px;-moz-border-radius-bottomright:6px;-moz-border-radius-bottomleft:6px;border-bottom-right-radius:6px;border-bottom-left-radius:6px;-webkit-border-top-right-radius:6px;-webkit-border-top-left-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-topleft:6px;border-top-right-radius:6px;border-top-left-radius:6px;display:block;float:left;min-height:100%;position:relative;width:58%;margin-top:10px;padding:5px;box-shadow:5px 5px 5px #eee;z-index:1}#wpbody-content>.single{width:95%}#sqlite-admin-side-wrap{color:#1d1d1d;font-size:11pt;border:1px solid #ddd;background:#fff;-webkit-border-bottom-right-radius:6px;-webkit-border-bottom-left-radius:6px;-moz-border-radius-bottomright:6px;-moz-border-radius-bottomleft:6px;border-bottom-right-radius:6px;border-bottom-left-radius:6px;-webkit-border-top-right-radius:6px;-webkit-border-top-left-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-topleft:6px;border-top-right-radius:6px;border-top-left-radius:6px;display:block;float:left;min-height:100%;position:relative;width:35%;margin-top:10px;padding:5px 5px 5px 5px;box-shadow:5px 5px 5px #eee;z-index:1}p{text-indent:15px;line-height:160%;font-size:11pt;margin-left:10px;margin-right:10px}li{line-height:130%}table#sys-info{width:80%}table#status{width:100%}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}td.system{color:#900}td.user{color:#00f}td.menu-title{width:95px}table.statement{width:500px}ul.in-body-list{margin-left:20px}ol{margin-left:40px}pre.code{padding:5px 5px 5px 5px;margin-left:15px;margin-right:10px;background:#eee;white-space:pre-wrap;word-wrap:break-word;overflow:auto}tr.incompatible{background:#fbe5dd}tr.workaround{background:#d9e8ed}th.active-plugins{width:20%}th.compatible{width:30%}input.button-primary{display:block;clear:both;width:100px}.alt{background:#f7feec}.em{font-weight:bold;text-transform:capitalize}table#patch-files .item,table#backup-files .item{width:150px}.alert{color:#f00}div.alert{display:block;width:95%;text-align:center;margin:0 auto;color:#f00;text-transform:capitalize}blockquote.caution{display:block;width:95%;border:3px double #000;margin:0 auto;padding:5px}blockquote.caution>p{margin:5px;padding:0}#errorlog,#dbfile{width:100%}@media screen and (max-width:600px){#sqlite-admin-wrap{width:95%}#sqlite-admin-side-wrap{width:95%}#sqlite-admin-wrap>table#sys-info{width:100%}table#sys-info th.item{width:50%}#sqlite-admin-wrap>table#status{width:100%}table#status th{width:50%}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}#sqlite-admin-side-wrap table#plugins-info{width:100%}th.installed-plugins{width:50%}th.active-plugins{width:20%}th.compatible{width:30%}#sqlite-admin-side-wrap>table#plugins-table{width:100%}#sqlite-admin-side-wrap>table#plugins-table th.item{width:30%}#sqlite-admin-side-wrap>table#plugins-table th.compat{width:20%}#sqlite-admin-side-wrap>table#plugins-table th.reason{width:50%}}@media screen and (max-width:782px){#sqlite-admin-wrap{width:95%}#sqlite-admin-side-wrap{width:95%}table#plugins-info{width:480px}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}#plugins-table{width:500px}}@media screen and (max-width:900px){#sqlite-admin-wrap{width:95%}#sqlite-admin-side-wrap{width:95%}table#plugins-info{width:480px}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}#plugins-table{width:500px}}@media screen and (max-width:1169px){#sqlite-admin-wrap{width:95%}#sqlite-admin-side-wrap{width:95%}table#plugins-info{width:480px}table#sys-info{width:460px}table#status{width:460px}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}#plugins-table{width:500px}} -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/db.php: -------------------------------------------------------------------------------- 1 | 24 | * define('USE_MYSQL', true); 25 | * 26 | * 27 | * If you want to use SQLite, the line below will do. Or simply removing the line will 28 | * be enough. 29 | * 30 | * 31 | * define('USE_MYSQL', false); 32 | * 33 | */ 34 | if (defined('USE_MYSQL') && USE_MYSQL) return; 35 | 36 | function pdo_log_error($message, $data = null) { 37 | if (strpos($_SERVER['SCRIPT_NAME'], 'wp-admin') !== false) { 38 | $admin_dir = ''; 39 | } else { 40 | $admin_dir = 'wp-admin/'; 41 | } 42 | die(<< 45 | 46 | 47 | WordPress › Error 48 | 49 | 50 | 51 | 52 |

WordPress

53 |

$message

54 |

$data

55 | 56 | 57 | 58 | HTML 59 | ); 60 | } 61 | 62 | if (version_compare( PHP_VERSION, '5.2.4', '<')) { 63 | pdo_log_error('PHP version on this server is too old.', sprinf("Your server is running PHP version %d but this version of WordPress requires at least 5.2.4", phpversion())); 64 | } 65 | 66 | if (!extension_loaded('pdo')) { 67 | pdo_log_error('PHP PDO Extension is not loaded.', 'Your PHP installation appears to be missing the PDO extension which is required for this version of WordPress.'); 68 | } 69 | 70 | if (!extension_loaded('pdo_sqlite')) { 71 | pdo_log_error('PDO Driver for SQLite is missing.', 'Your PHP installtion appears not to have the right PDO drivers loaded. These are required for this version of WordPress and the type of database you have specified.'); 72 | } 73 | 74 | /* 75 | * Notice: 76 | * Your scripts have the permission to create directories or files on your server. 77 | * If you write in your wp-config.php like below, we take these definitions. 78 | * define('DB_DIR', '/full_path_to_the_database_directory/'); 79 | * define('DB_FILE', 'database_file_name'); 80 | */ 81 | 82 | /* 83 | * PDODIR is SQLite Integration installed directory. 84 | */ 85 | if (defined('WP_PLUGIN_DIR')) { 86 | define('PDODIR', WP_PLUGIN_DIR . '/sqlite-integration/'); 87 | } else { 88 | if (defined('WP_CONTENT_DIR')) { 89 | define('PDODIR', WP_CONTENT_DIR . '/plugins/sqlite-integration/'); 90 | } else { 91 | define('PDODIR', ABSPATH . 'wp-content/plugins/sqlite-integration/'); 92 | } 93 | } 94 | /* 95 | * FQDBDIR is a directory where the sqlite database file is placed. 96 | * If DB_DIR is defined, it is used as FQDBDIR. 97 | */ 98 | if (defined('DB_DIR')) { 99 | if (substr(DB_DIR, -1, 1) != '/') { 100 | define('FQDBDIR', DB_DIR . '/'); 101 | } else { 102 | define('FQDBDIR', DB_DIR); 103 | } 104 | } else { 105 | if (defined('WP_CONTENT_DIR')) { 106 | define('FQDBDIR', WP_CONTENT_DIR . '/database/'); 107 | } else { 108 | define('FQDBDIR', ABSPATH . 'wp-content/database/'); 109 | } 110 | } 111 | /* 112 | * FQDB is a database file name. If DB_FILE is defined, it is used 113 | * as FQDB. 114 | */ 115 | if ( defined('DB_FILE' )) { 116 | define('FQDB', FQDBDIR . DB_FILE); 117 | } else { 118 | define('FQDB', FQDBDIR . '.ht.sqlite'); 119 | } 120 | /* 121 | * UDF_FILE is a file that contains user defined functions. 122 | */ 123 | if (version_compare(PHP_VERSION, '5.3', '<')) { 124 | define('UDF_FILE', PDODIR . 'functions-5-2.php'); 125 | } elseif (version_compare(PHP_VERSION, '5.3', '>=')) { 126 | define('UDF_FILE', PDODIR . 'functions.php'); 127 | } 128 | 129 | require_once PDODIR . 'pdodb.class.php'; 130 | ?> -------------------------------------------------------------------------------- /.sandstorm/sandstorm-pkgdef.capnp: -------------------------------------------------------------------------------- 1 | @0xaecd42915acc793f; 2 | 3 | using Spk = import "/sandstorm/package.capnp"; 4 | 5 | const pkgdef :Spk.PackageDefinition = ( 6 | id = "aax9j672p6z8n7nyupzvj2nmumeqd4upa0f7mgu8gprwmy53x04h", 7 | 8 | manifest = ( 9 | appTitle = (defaultText = "WordPress"), 10 | appVersion = 10, 11 | appMarketingVersion = (defaultText = "2016.06.07 (4.4.2)"), 12 | 13 | metadata = ( 14 | icons = ( 15 | appGrid = (svg = embed "app-graphics/wordpress-128.svg"), 16 | grain = (svg = embed "app-graphics/wordpress-24.svg"), 17 | market = (svg = embed "app-graphics/wordpress-150.svg"), 18 | ), 19 | website = "https://wordpress.org/", 20 | codeUrl = "https://github.com/dwrensha/wordpress-sandstorm", 21 | license = (openSource = gpl2), 22 | categories = [webPublishing,], 23 | author = ( 24 | upstreamAuthor = "WordPress Project", 25 | contactEmail = "david@sandstorm.io", 26 | pgpSignature = embed "pgp-signature", 27 | ), 28 | pgpKeyring = embed "pgp-keyring", 29 | description = (defaultText = embed "description.md"), 30 | shortDescription = (defaultText = "Content management"), 31 | screenshots = [(width = 448, height = 346, png = embed "screenshot1.png"), 32 | (width = 448, height = 348, png = embed "screenshot2.png")], 33 | changeLog = (defaultText = embed "changeLog.md"), 34 | ), 35 | 36 | 37 | 38 | actions = [ 39 | ( title = (defaultText = "New site"), 40 | nounPhrase = (defaultText = "site"), 41 | command = .startCommand 42 | ) 43 | ], 44 | 45 | continueCommand = .continueCommand 46 | ), 47 | 48 | sourceMap = ( 49 | searchPath = [ 50 | ( sourcePath = "."), # Search this directory first. 51 | ( sourcePath = "/opt/app" ), 52 | ( sourcePath = "/", # Then search the system root directory. 53 | hidePaths = [ "home", "proc", "sys", 54 | "etc/nsswitch.conf", "etc/localtime", 55 | "etc/host.conf", "etc/resolv.conf"] 56 | ) 57 | ] 58 | ), 59 | 60 | fileList = "sandstorm-files.list", 61 | 62 | alwaysInclude = ["wordpress-read-only", "read-only-plugins"], 63 | 64 | bridgeConfig = ( 65 | viewInfo = ( 66 | permissions = [(name = "admin", title = (defaultText = "admin"), 67 | description = (defaultText = "allows administrative actions")), 68 | (name = "editor", title = (defaultText = "editor"), 69 | description = (defaultText = "allows publishing of posts of others")), 70 | (name = "author", title = (defaultText = "author"), 71 | description = (defaultText = "allows publishing of own posts")), 72 | (name = "contributor", title = (defaultText = "contributor"), 73 | description = (defaultText = "allows writing of posts")), 74 | (name = "subscriber", title = (defaultText = "subscriber"), 75 | description = (defaultText = "allows profile customization"))], 76 | roles = [(title = (defaultText = "admin"), 77 | permissions = [true, true, true, true, true], 78 | verbPhrase = (defaultText = "can do anything")), 79 | (title = (defaultText = "editor"), 80 | permissions = [false, true, true, true, true], 81 | verbPhrase = (defaultText = "can publish posts of others")), 82 | (title = (defaultText = "author"), 83 | permissions = [false, false, true, true, true], 84 | verbPhrase = (defaultText = "can publish own posts")), 85 | (title = (defaultText = "contributor"), 86 | permissions = [false, false, false, true, true], 87 | verbPhrase = (defaultText = "can write posts"), 88 | default = true), 89 | (title = (defaultText = "subscriber"), 90 | permissions = [false, false, false, false, true], 91 | verbPhrase = (defaultText = "can customize profile"))] 92 | ) 93 | ) 94 | ); 95 | 96 | const startCommand :Spk.Manifest.Command = ( 97 | # Here we define the command used to start up your server. 98 | argv = ["/sandstorm-http-bridge", "10000", "--", "/start.sh"], 99 | environ = [ 100 | # Note that this defines the *entire* environment seen by your app. 101 | (key = "PATH", value = "/usr/local/bin:/usr/bin:/bin") 102 | ] 103 | ); 104 | 105 | const continueCommand :Spk.Manifest.Command = ( 106 | argv = ["/sandstorm-http-bridge", "10000", "--", "/continue.sh"], 107 | environ = [ 108 | (key = "PATH", value = "/usr/local/bin:/usr/bin:/bin") 109 | ] 110 | ); 111 | -------------------------------------------------------------------------------- /.sandstorm/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Guess at a reasonable name for the VM based on the folder vagrant-spk is 5 | # run from. The timestamp is there to avoid conflicts if you have multiple 6 | # folders with the same name. 7 | VM_NAME = File.basename(File.dirname(File.dirname(__FILE__))) + "_sandstorm_#{Time.now.utc.to_i}" 8 | 9 | # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! 10 | VAGRANTFILE_API_VERSION = "2" 11 | 12 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 13 | # Base on the Sandstorm snapshots of the official Debian 8 (jessie) box. 14 | config.vm.box = "sandstorm/debian-jessie64" 15 | 16 | if Vagrant.has_plugin?("vagrant-vbguest") then 17 | # vagrant-vbguest is a Vagrant plugin that upgrades 18 | # the version of VirtualBox Guest Additions within each 19 | # guest. If you have the vagrant-vbguest plugin, then it 20 | # needs to know how to compile kernel modules, etc., and so 21 | # we give it this hint about operating system type. 22 | config.vm.guest = "debian" 23 | end 24 | 25 | # We forward port 6080, the Sandstorm web port, so that developers can 26 | # visit their sandstorm app from their browser as local.sandstorm.io:6080 27 | # (aka 127.0.0.1:6080). 28 | config.vm.network :forwarded_port, guest: 6080, host: 6080 29 | 30 | # Use a shell script to "provision" the box. This installs Sandstorm using 31 | # the bundled installer. 32 | config.vm.provision "shell", inline: "sudo bash /opt/app/.sandstorm/global-setup.sh", keep_color: true 33 | # Then, do stack-specific and app-specific setup. 34 | config.vm.provision "shell", inline: "sudo bash /opt/app/.sandstorm/setup.sh", keep_color: true 35 | 36 | # Shared folders are configured per-provider since vboxsf can't handle >4096 open files, 37 | # NFS requires privilege escalation every time you bring a VM up, 38 | # and 9p is only available on libvirt. 39 | 40 | # Calculate the number of CPUs and the amount of RAM the system has, 41 | # in a platform-dependent way; further logic below. 42 | cpus = nil 43 | total_kB_ram = nil 44 | 45 | host = RbConfig::CONFIG['host_os'] 46 | if host =~ /darwin/ 47 | cpus = `sysctl -n hw.ncpu`.to_i 48 | total_kB_ram = `sysctl -n hw.memsize`.to_i / 1024 49 | elsif host =~ /linux/ 50 | cpus = `nproc`.to_i 51 | total_kB_ram = `grep MemTotal /proc/meminfo | awk '{print $2}'`.to_i 52 | elsif host =~ /mingw/ 53 | # powershell may not be available on Windows XP and Vista, so wrap this in a rescue block 54 | begin 55 | cpus = `powershell -Command "(Get-WmiObject Win32_Processor -Property NumberOfLogicalProcessors | Select-Object -Property NumberOfLogicalProcessors | Measure-Object NumberOfLogicalProcessors -Sum).Sum"`.to_i 56 | total_kB_ram = `powershell -Command "Get-CimInstance -class cim_physicalmemory | % $_.Capacity}"`.to_i / 1024 57 | rescue 58 | end 59 | end 60 | # Use the same number of CPUs within Vagrant as the system, with 1 61 | # as a default. 62 | # 63 | # Use at least 512MB of RAM, and if the system has more than 2GB of 64 | # RAM, use 1/4 of the system RAM. This seems a reasonable compromise 65 | # between having the Vagrant guest operating system not run out of 66 | # RAM entirely (which it basically would if we went much lower than 67 | # 512MB) and also allowing it to use up a healthily large amount of 68 | # RAM so it can run faster on systems that can afford it. 69 | if cpus.nil? or cpus.zero? 70 | cpus = 1 71 | end 72 | if total_kB_ram.nil? or total_kB_ram < 2048000 73 | assign_ram_mb = 512 74 | else 75 | assign_ram_mb = (total_kB_ram / 1024 / 4) 76 | end 77 | # Actually apply these CPU/memory values to the providers. 78 | config.vm.provider :virtualbox do |vb, override| 79 | vb.cpus = cpus 80 | vb.memory = assign_ram_mb 81 | vb.name = VM_NAME 82 | vb.customize ["modifyvm", :id, "--nictype1", "Am79C973"] 83 | 84 | # /opt/app and /host-dot-sandstorm are used by vagrant-spk 85 | override.vm.synced_folder "..", "/opt/app" 86 | override.vm.synced_folder ENV["HOME"] + "/.sandstorm", "/host-dot-sandstorm" 87 | # /vagrant is not used by vagrant-spk; we need this line so it gets disabled; if we removed the 88 | # line, vagrant would automatically insert a synced folder in /vagrant, which is not what we want. 89 | override.vm.synced_folder "..", "/vagrant", disabled: true 90 | end 91 | config.vm.provider :libvirt do |libvirt, override| 92 | libvirt.cpus = cpus 93 | libvirt.memory = assign_ram_mb 94 | libvirt.default_prefix = VM_NAME 95 | 96 | # /opt/app and /host-dot-sandstorm are used by vagrant-spk 97 | override.vm.synced_folder "..", "/opt/app", type: "9p", accessmode: "passthrough" 98 | override.vm.synced_folder ENV["HOME"] + "/.sandstorm", "/host-dot-sandstorm", type: "9p", accessmode: "passthrough" 99 | # /vagrant is not used by vagrant-spk; we need this line so it gets disabled; if we removed the 100 | # line, vagrant would automatically insert a synced folder in /vagrant, which is not what we want. 101 | override.vm.synced_folder "..", "/vagrant", type: "9p", accessmode: "passthrough", disabled: true 102 | end 103 | end 104 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/styles/style.css: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is a part of SQLite Integration. 3 | * 4 | * @package SQLite Integration 5 | * @author Kojima Toshiyasu 6 | */ 7 | @CHARSET "UTF-8"; 8 | #sqlite-admin-wrap h2, 9 | #sqlite-admin-side-wrap h2 { 10 | background: rgb(34, 34, 34); 11 | color: rgb(255, 255, 255); 12 | padding-left: 5px; 13 | } 14 | h3 { 15 | clear: both; 16 | } 17 | .navigation { 18 | display: block; 19 | margin-top: 0; 20 | margin-bottom: 0; 21 | min-height: 20px; 22 | } 23 | .navi-menu { 24 | margin-left: 0; 25 | } 26 | .menu-item { 27 | font-size: 20px; 28 | display: inline; 29 | min-width: 150px; 30 | height: 50px; 31 | margin-left: 0; 32 | margin-right: 10px; 33 | padding: 5px; 34 | border: .5px solit #000; 35 | background: rgb(51, 51, 51); 36 | color: (255, 255, 255); 37 | line-height: 40px; 38 | } 39 | .menu-selected { 40 | font-size: 20px; 41 | display: inline; 42 | min-width: 150px; 43 | height: 50px; 44 | margin-left: 0; 45 | margin-right: 10px; 46 | padding: 5px; 47 | border: .5px solit #000; 48 | background: rgb(46, 162, 204); 49 | color: rgb(255, 255, 255); 50 | } 51 | .menu-item a { 52 | text-decoration: none; 53 | color: rgb(255, 255, 255); 54 | } 55 | #sqlite-admin-wrap { 56 | color: #1d1d1d; 57 | font-size: 11pt; 58 | border: 1px solid #ddd; 59 | background: rgb(255, 255, 255); 60 | -webkit-border-bottom-right-radius: 6px; 61 | -webkit-border-bottom-left-radius: 6px; 62 | -moz-border-radius-bottomright: 6px; 63 | -moz-border-radius-bottomleft: 6px; 64 | border-bottom-right-radius: 6px; 65 | border-bottom-left-radius: 6px; 66 | -webkit-border-top-right-radius: 6px; 67 | -webkit-border-top-left-radius: 6px; 68 | -moz-border-radius-topright: 6px; 69 | -moz-border-radius-topleft: 6px; 70 | border-top-right-radius: 6px; 71 | border-top-left-radius: 6px; 72 | display: block; 73 | float: left; 74 | min-height: 100%; 75 | position: relative; 76 | width: 58%; 77 | margin-top: 10px; 78 | padding: 5px; 79 | box-shadow: 5px 5px 5px #eee; 80 | z-index: 1; 81 | } 82 | #wpbody-content > .single { 83 | width: 95%; 84 | } 85 | #sqlite-admin-side-wrap { 86 | color: #1d1d1d; 87 | font-size: 11pt; 88 | border: 1px solid #ddd; 89 | background: rgb(255, 255, 255); 90 | /* border-top: 0; */ 91 | -webkit-border-bottom-right-radius: 6px; 92 | -webkit-border-bottom-left-radius: 6px; 93 | -moz-border-radius-bottomright: 6px; 94 | -moz-border-radius-bottomleft: 6px; 95 | border-bottom-right-radius: 6px; 96 | border-bottom-left-radius: 6px; 97 | -webkit-border-top-right-radius: 6px; 98 | -webkit-border-top-left-radius: 6px; 99 | -moz-border-radius-topright: 6px; 100 | -moz-border-radius-topleft: 6px; 101 | border-top-right-radius: 6px; 102 | border-top-left-radius: 6px; 103 | display: block; 104 | float: left; 105 | min-height: 100%; 106 | position: relative; 107 | width: 35%; 108 | margin-top: 10px; 109 | padding: 5px 5px 5px 5px; 110 | box-shadow: 5px 5px 5px #eee; 111 | z-index: 1; 112 | } 113 | p { 114 | text-indent: 15px; 115 | line-height: 160%; 116 | font-size: 11pt; 117 | margin-left: 10px; 118 | margin-right: 10px; 119 | } 120 | li { 121 | line-height: 130%; 122 | } 123 | table#sys-info{ 124 | /* width: 600px; */ 125 | width: 80%; 126 | } 127 | table#status { 128 | width: 100%; 129 | } 130 | table#sqlite-table { 131 | /* width: 700px; */ 132 | width: 100%; 133 | } 134 | th.tbl-name { 135 | width: 25%; 136 | } 137 | th.tbl_owner { 138 | width: 25%; 139 | } 140 | th.tbl_index { 141 | width: 50%; 142 | } 143 | td.system { 144 | color: rgb(153, 0, 0); 145 | } 146 | td.user { 147 | color: rgb(0, 0, 255); 148 | } 149 | td.menu-title { 150 | width: 95px; 151 | } 152 | table.statement { 153 | width: 500px; 154 | } 155 | ul.in-body-list { 156 | margin-left: 20px; 157 | } 158 | ol { 159 | margin-left: 40px; 160 | } 161 | pre.code { 162 | padding: 5px 5px 5px 5px; 163 | margin-left: 15px; 164 | margin-right: 10px; 165 | background: #eee; 166 | white-space: pre-wrap; 167 | word-wrap: break-word; 168 | overflow: auto; 169 | } 170 | tr.incompatible { 171 | background: rgb(251, 229, 221); 172 | } 173 | tr.workaround { 174 | background: rgb(217, 232, 237); 175 | } 176 | tr.compatible { 177 | } 178 | th.active-plugins { 179 | width: 20%; 180 | } 181 | th.compatible { 182 | width: 30%; 183 | } 184 | input.button-primary { 185 | display: block; 186 | clear: both; 187 | width: 100px; 188 | } 189 | .alt { 190 | background: rgb(247, 254, 236); 191 | } 192 | .em { 193 | font-weight: bold; 194 | text-transform: capitalize; 195 | } 196 | table#patch-files .item, 197 | table#backup-files .item { 198 | width: 150px; 199 | } 200 | .alert { 201 | color: rgb(255, 0, 0); 202 | } 203 | div.alert { 204 | display: block; 205 | width: 95%; 206 | text-align: center; 207 | margin: 0 auto; 208 | color: rgb(255, 0, 0); 209 | text-transform: capitalize; 210 | } 211 | blockquote.caution { 212 | display: block; 213 | width: 95%; 214 | border: 3px double rgb(0, 0, 0); 215 | margin: 0 auto; 216 | padding: 5px; 217 | } 218 | blockquote.caution > p { 219 | margin: 5px; 220 | padding: 0; 221 | } 222 | #errorlog, 223 | #dbfile { 224 | width: 100%; 225 | } 226 | /* 227 | * Media Query 228 | */ 229 | @media screen and (max-width: 600px) { 230 | #sqlite-admin-wrap { 231 | width: 95%; 232 | } 233 | #sqlite-admin-side-wrap { 234 | width: 95%; 235 | } 236 | #sqlite-admin-wrap > table#sys-info{ 237 | width: 100%; 238 | } 239 | table#sys-info th.item { 240 | width: 50% 241 | } 242 | #sqlite-admin-wrap > table#status { 243 | width: 100%; 244 | } 245 | table#status th { 246 | width: 50%; 247 | } 248 | table#sqlite-table { 249 | width: 100%; 250 | } 251 | th.tbl-name { 252 | width: 25%; 253 | } 254 | th.tbl_owner { 255 | width: 25%; 256 | } 257 | th.tbl_index { 258 | width: 50%; 259 | } 260 | #sqlite-admin-side-wrap table#plugins-info { 261 | width: 100%; 262 | } 263 | th.installed-plugins { 264 | width: 50%; 265 | } 266 | th.active-plugins { 267 | width: 20%; 268 | } 269 | th.compatible { 270 | width: 30%; 271 | } 272 | #sqlite-admin-side-wrap > table#plugins-table { 273 | width: 100%; 274 | } 275 | #sqlite-admin-side-wrap > table#plugins-table th.item { 276 | width: 30%; 277 | } 278 | #sqlite-admin-side-wrap > table#plugins-table th.compat { 279 | width: 20%; 280 | } 281 | #sqlite-admin-side-wrap > table#plugins-table th.reason { 282 | width: 50%; 283 | } 284 | } 285 | @media screen and (max-width: 782px) { 286 | #sqlite-admin-wrap { 287 | width: 95%; 288 | } 289 | #sqlite-admin-side-wrap { 290 | width: 95%; 291 | } 292 | table#plugins-info { 293 | width: 480px; 294 | } 295 | table#sqlite-table { 296 | width: 100%; 297 | } 298 | th.tbl-name { 299 | width: 25%; 300 | } 301 | th.tbl_owner { 302 | width: 25%; 303 | } 304 | th.tbl_index { 305 | width: 50%; 306 | } 307 | #plugins-table { 308 | width: 500px; 309 | } 310 | } 311 | @media screen and (max-width: 900px) { 312 | #sqlite-admin-wrap { 313 | width: 95%; 314 | } 315 | #sqlite-admin-side-wrap { 316 | width: 95%; 317 | } 318 | table#plugins-info { 319 | width: 480px; 320 | } 321 | table#sqlite-table { 322 | width: 100%; 323 | } 324 | th.tbl-name { 325 | width: 25%; 326 | } 327 | th.tbl_owner { 328 | width: 25%; 329 | } 330 | th.tbl_index { 331 | width: 50%; 332 | } 333 | #plugins-table { 334 | width: 500px; 335 | } 336 | } 337 | @media screen and (max-width: 1169px) { 338 | #sqlite-admin-wrap { 339 | width: 95%; 340 | } 341 | #sqlite-admin-side-wrap { 342 | width: 95%; 343 | } 344 | table#plugins-info { 345 | width: 480px; 346 | } 347 | table#sys-info { 348 | width: 460px; 349 | } 350 | table#status { 351 | width: 460px; 352 | } 353 | table#sqlite-table { 354 | width: 100%; 355 | } 356 | th.tbl-name { 357 | width: 25%; 358 | } 359 | th.tbl_owner { 360 | width: 25%; 361 | } 362 | th.tbl_index { 363 | width: 50%; 364 | } 365 | #plugins-table { 366 | width: 500px; 367 | } 368 | } -------------------------------------------------------------------------------- /read-only-plugins/mu-plugins/sandstorm.php: -------------------------------------------------------------------------------- 1 | $sandstorm_user_id, 34 | 'user_pass' => 'garply', 35 | 'nickname' => $username, 36 | 'display_name' => $username, 37 | 'role' => get_option('default_role'), 38 | 'user_email' => ($sandstorm_user_id . '@example.com'))); 39 | } else { 40 | $user_id = $user->ID; 41 | } 42 | 43 | $user_role=''; 44 | if (in_array('admin', $permissionsArray)) { 45 | $user_role = 'administrator'; 46 | } else if (in_array('editor', $permissionsArray)) { 47 | $user_role = 'editor'; 48 | } else if (in_array('author', $permissionsArray)) { 49 | $user_role = 'author'; 50 | } else if (in_array('contributor', $permissionsArray)) { 51 | $user_role = 'contributor'; 52 | } else if (in_array('subscriber', $permissionsArray)) { 53 | $user_role = 'subscriber'; 54 | } 55 | 56 | if ($user_role) { 57 | wp_update_user( array( 'ID' => $user_id, 58 | 'role' => $user_role)); 59 | } 60 | 61 | if ($headers['X-Sandstorm-User-Picture']) { 62 | update_user_meta( $user_id, 'sandstorm_user_picture', $headers['X-Sandstorm-User-Picture']); 63 | } 64 | 65 | wp_set_current_user($user_id, $sandstorm_user_id); 66 | wp_set_auth_cookie($user_id); 67 | do_action('wp_login', $sandstorm_user_id); 68 | } 69 | } 70 | } 71 | add_action('init', 'auto_login'); 72 | 73 | function sandstorm_refuse_login() { 74 | wp_redirect(wp_guess_url() . '/index.php'); 75 | die(); 76 | } 77 | 78 | add_action('login_init', 'sandstorm_refuse_login'); 79 | 80 | function sandstorm_publish() { 81 | $result = shell_exec('/publish-it.sh'); 82 | } 83 | 84 | 85 | function sandstorm_publishing_info() { 86 | $headers = apache_request_headers(); 87 | $lines = array(); 88 | $result = exec('/sandstorm/bin/getPublicId ' . $headers['X-Sandstorm-Session-Id'], $lines); 89 | 90 | echo "

Your public site is available at: $lines[2]

"; 91 | 92 | ?> 93 | 94 |

95 | To rebuild your public site, click the below button. 96 | Note that you must click this button after making any changes 97 | in order for those changes to become visible on the public site. 98 |

99 | 100 |
101 |

102 | 103 | 104 | 105 |
106 |

107 |
108 | 109 | 110 | If you weren't using a demo account, you could additionally publish the site to an arbitrary domain you control.

"; 114 | return; 115 | } 116 | 117 | ?> 118 | 119 |

To set up your domain to point at your public site, 120 | add the following DNS records to your domain. Replace host.example.com with your site's hostname. 121 |

122 |
123 | host.example.com IN CNAME $cname
"; 127 | echo "sandstorm-www.host.example.com IN TXT $lines[0] "; 128 | ?> 129 |

130 |

131 | Note: If your site may get a lot of traffic, consider putting it behind a CDN. 132 | CloudFlare, for example, can do this for free. 133 |

134 | 135 | '. 191 | ''. 192 | ''. 193 | ''. 194 | ''; 197 | return $form; 198 | } 199 | } 200 | 201 | add_filter('editable_roles', 'sandstorm_editable_roles'); 202 | function sandstorm_editable_roles($orig) { 203 | // None should be editable because Sandstorm handles role assignment. 204 | return array(); 205 | } 206 | 207 | 208 | add_filter('get_avatar', 'sandstorm_get_avatar', 1, 5); 209 | function sandstorm_get_avatar($avatar, $id_or_email, $size, $default, $alt) { 210 | if (is_numeric($id_or_email)) { 211 | $avatar_url = get_user_meta($id_or_email, 'sandstorm_user_picture', True); 212 | if ($avatar_url) { 213 | $avatar = "{$alt}"; 214 | } 215 | } 216 | return $avatar; 217 | } 218 | 219 | // Remove a bunch of things we don't want. 220 | remove_action('wp_head', 'rsd_link'); 221 | remove_action('wp_head', 'wlwmanifest_link'); 222 | remove_action('wp_head', 'wp_generator'); 223 | remove_action('wp_head', 'wp_shortlink_wp_head'); 224 | remove_action( 'wp_head', 'feed_links_extra', 3 ); 225 | 226 | # Feeds mostly work, but they get published at feed/index.html. 227 | #remove_action( 'wp_head', 'feed_links', 2 ); 228 | 229 | 230 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/readme-ja.txt: -------------------------------------------------------------------------------- 1 | === SQLite Integration === 2 | Contributors: kjmtsh 3 | Plugin Name: SQLite Integration 4 | Plugin URI: http://dogwood.skr.jp/wordpress/sqlite-integration-ja/ 5 | Tags: database, SQLite, PDO 6 | Author: Kojima Toshiyasu 7 | Author URI: http://dogwood.skr.jp/ 8 | Requires at least: 3.3 9 | Tested up to: 4.0 10 | Stable tag: 1.7 11 | License: GPLv2 12 | License URI: http://www.gnu.org/licenses/gpl-2.0.html 13 | 14 | SQLite IntegrationはSQLiteでWordPressを使えるようにするプラグインです。 15 | 16 | == Description == 17 | 18 | このプラグインを使うと、MySQL データベースサーバがなくても WordPress のサイトを作ることができます。必要なものは、Apache か、同等のウェブサーバと、PDO エクステンションが使える PHP だけです。WordPress のアーカイブとこのプラグインがあれば、それだけで WordPress サイトを試すことができます。 19 | 20 | SQLite Integration は [PDO for WordPress](http://wordpress.org/extend/plugins/pdo-for-wordpress) プラグインの後継です。後者は残念なことに、もうメンテナンスされていないようです。SQLite IntegrationはPDO for WordPressの基本的なアイディアと構造を借りて、より多くの機能とユーティリティを追加しました。 21 | 22 | = 特徴 = 23 | 24 | SQLite Integration はデータベースアクセスを制御するためのプログラムです。だから、他のプラグインとは違います。WordPress をインストールするときに使わなければなりません。インストールのセクションを参照してください。[SQLite Integration(ja)](http://dogwood.skr.jp/wordpress/sqlite-integration-ja/)をご覧になると、もっと詳しい説明を読むことができます。 25 | 26 | インストールに成功したら、MySQL を使う他の WordPress と同じように使うことができます。オプションとして、一時的に MySQL を使い、また SQLite に戻るというような使い方ができます。開発のときに、MySQL のないローカルマシンでサイトのテストをすることもできるでしょう。 27 | 28 | インストールが終わったら、このプラグインを有効化することができます(必須ではありませんが、お勧めします)。そうすると、サーバやインストールされたプラグインについての情報を見ることができるようになります。 29 | 30 | = システム要件 = 31 | 32 | * PHP 5.2 以上で PDO extension が必要です(PHP 5.3 以上をお勧めします)。 33 | * PDO SQLite ドライバがロードされている必要があります。 34 | 35 | = 後方互換性 = 36 | 37 | 現在[PDO for WordPress](http://wordpress.org/extend/plugins/pdo-for-wordpress)をお使いの場合は、データベースを移行することができます。インストールのセクションをご覧ください。 38 | 39 | = サポート = 40 | 41 | 下の方法でコンタクトを取ってください。 42 | 43 | 1. [Support Forum](http://wordpress.org/support/plugin/sqlite-integration)にポストする。 44 | 2. [SQLite Integration(ja)のページ](http://dogwood.skr.jp/wordpress/sqlite-integration-ja/)でメッセージを残す。 45 | 46 | = サポートについての注意 = 47 | 48 | WordPress.org は MySQL 以外のデータベースを正式にサポートしていません。だから、WordPress.org からのサポートは得られません。フォーラムに投稿しても、回答を得ることはまずないでしょう。また、パッチをあてたプラグインを使う場合は、そのプラグインの作者からのサポートはないものと思ってください。できるだけご協力はしますが、自分でリスクを負う必要があります。 49 | 50 | = 翻訳 = 51 | 52 | ドキュメントは英語で書かれています。もしあなたの言語に翻訳をしたら、知らせてください。 53 | 54 | * 日本語(kjmtsh) 55 | * スペイン語(Pablo Laguna) 56 | 57 | == インストール == 58 | 59 | より詳細な情報は、[SQLite Integration(ja)](http://dogwood.skr.jp/wordpress/sqlite-integration-ja/)をご覧ください。 60 | 61 | = 準備 = 62 | 63 | 1. 最新の WordPress アーカイブとこのプラグインをダウンロードして、ローカルマシンに展開します。 64 | 2. sqlite-integration フォルダを wordpress/wp-content/plugins フォルダに移動します。 65 | 3. sqlite-integration フォルダの中にある db.php ファイルを wordpress/wp-content フォルダにコピーします。 66 | 4. wordpress/wp-config-sample.php ファイルを wordpress/wp-config.php とリネームします。 67 | 68 | = 基本的な設定 = 69 | 70 | wp-config.php ファイルを開き、下のセクションを編集します。 71 | 72 | * 認証用ユニークキー 73 | * WordPressデータベーステーブルの接頭辞 74 | * ローカル言語(日本語版では、jaがすでに設定されています) 75 | 76 | Codex の[wp-config.php の編集](http://wpdocs.sourceforge.jp/wp-config.php_%E3%81%AE%E7%B7%A8%E9%9B%86)を参照してください。 77 | 78 | = 5 分もかからないインストール = 79 | 80 | wordpress フォルダをサーバにアップロードして、ブラウザでアクセスすると、インストールが始まります。ブログ名などを入力してインストールすれば終了です。ブログをお楽しみください。 81 | 82 | = オプション設定 = 83 | 84 | wp-config.php に設定を書き込むと、デフォルトの設定を変更することができます。SQLite データベースファイル名を変更したい場合は(デフォルトは .ht.sqlite です)、下の 1 行を加えてください。 85 | 86 | `define('DB_FILE', 'your_database_name');` 87 | 88 | SQLite データベースファイルが置かれるディレクトリを変更したい場合は、次の行を追加してください。 89 | 90 | `define('DB_DIR', '/home/youraccount/database_directory/');` 91 | 92 | どちらか片方だけでも、両方でも変更できます。 93 | 94 | = このプラグインを削除せずに MySQL を使う = 95 | 96 | MySQL を使いたいときは、次の行を wp-config.php に追加してください。 97 | 98 | `define('USE_MYSQL', true);` 99 | 100 | もちろん、これだけでは足りません。データベースサーバやユーザ名、パスワードなども設定してください。この行を追加して、最初にサイトにアクセスすると、WordPress のインストールが始まります。MySQL でのインストールを終えてください。おわかりのように、SQLite のデータは自動的に MySQL に引き継がれることはありません。 101 | 102 | SQLite に戻りたいときには、この行を次のように変更するか、この行を削除してください。 103 | 104 | `define('USE_MYSQL', false);` 105 | 106 | = PDO for WordPress から SQLite Integration にデータベースを移行する = 107 | 108 | 現在、PDO for WordPress をお使いなら、データベースを SQLite Integration に移行することができます。お勧めは下のようにすることです。より詳細な情報については、[SQLite Integration(ja)](http://dogwood.skr.jp/wordpress/sqlite-integration-ja/)を参照してください。 109 | 110 | 1. 現在のデータをエクスポートする。 111 | 2. 最新のWordPressを、SQLite Integrationを使って新規インストールする。 112 | 3. WordPress Importerを使って以前のデータをインポートする。 113 | 114 | 何らかの理由で、データがエクスポートできない場合は、上のサイトをご覧ください。別の方法を読むことができます。 115 | 116 | == よくある質問 == 117 | 118 | = 「データベース接続エラー」でインストールが止まります = 119 | 120 | wp-config.php を手動で作成することが必要です。WordPress に作らせようとすると、途中でインストールが止まります。 121 | 122 | = データベース・ファイルが作られません = 123 | 124 | ディレクトリやファイルを作るのに失敗するのは、多くの場合、PHPにその権限がないことが原因です。サーバの設定を確認するか、管理者に聞いてみてください。 125 | 126 | = あれこれのプラグインが有効化できません、あるいはちゃんと動作しません = 127 | 128 | ある種のプラグイン、特にキャッシュ系のプラグインやデータベース管理系のプラグインはこのプラグインと一緒に使えません。SQLite Integrationを有効化して、ドキュメントの「プラグイン互換性」のセクションをご覧ください。あるいは、[SQLite Integration Plugin Page](http://dogwood.skr.jp/wordpress/plugins/)をご覧ください。 129 | 130 | = 管理画面のドキュメントは必要ないのですが = 131 | 132 | 無効化すればすぐに消えます。有効化と無効化は管理画面の表示・非表示だけで、本体には影響を与えません。プラグインを削除したい場合は、単に削除すれば消えます。 133 | 134 | == Screenshots == 135 | 136 | 1. システム情報の画面ではデータベースの状態やプラグインの対応状況を見ることができます。 137 | 138 | == Known Limitations == 139 | 140 | 多くのプラグインはちゃんと動作するはずです。が、中にはそうでないものもあります。一般的には、WordPressの関数を通さず、PHPのMysqlあるいはMysqliライブラリの関数を使ってデータベースを操作しようとするプラグインは問題を起こすでしょう。 141 | 142 | 他には下のようなものがあります。 143 | 144 | これらのプラグインを使うことはできません。SQLite Integrationと同じファイルを使おうとするからです。 145 | 146 | * W3 Total Cache 147 | * DB Cache Reloaded Fix 148 | * HyperDB 149 | 150 | 'WP Super Cache'や'Quick Cache'のようなプラグインなら使えるかもしれません。お勧めはしませんし、何も保証しませんが。 151 | 152 | これらのプラグインも使えません。SQLite Integration がエミュレートできない MySQL 独自の拡張機能を使っているからです。 153 | 154 | * Yet Another Related Posts 155 | * Better Related Posts 156 | 157 | 'WordPress Related Posts'や'Related Posts'のようなプラグインなら使うことができるかもしれません。 158 | 159 | たぶん、もっとあるでしょう。動作しないプラグインを見つけたら、お知らせいただけると助かります。 160 | 161 | 非互換のプラグインの中には、少し修正をすると、使えるようになるものがあります。[Plugins(ja)](http://dogwood.skr.jp/wordpress/plugins-ja/)で情報を公開していますので、参照してください。 162 | 163 | このプラグインは、'WP_PLUGIN_URL' 定数をサポートしません。 164 | 165 | == Upgrade Notice == 166 | 167 | WordPress 4.0 での動作チェックをして、いくつかのバグを修正しました。アップグレードをお勧めします。自動アップグレードで失敗するようなら、FTPを使っての手動アップグレードを試してみてください。 168 | 169 | == Changelog == 170 | 171 | = 1.7 (2014-09-05) = 172 | * エディタ画面で、添付ファイルの並べ替えができなかったのを修正しました。 173 | * CREATE クエリのバグを修正しました。 174 | * 128x128 アイコンと 256x256 アイコンを追加しました。 175 | * pcre.backtrack_limit が大きな値に設定されている場合、それを使うようにしました。 176 | * メタクエリの BETWEEN の扱いを変更しました。 177 | * WordPress 4.0 での動作チェックをしました。 178 | 179 | = 1.6.3 (2014-05-10) = 180 | * BETWEEN 比較をするメタクエリのバグを修正しました。 181 | * スペイン語カタログを追加しました。 182 | * WordPress 3.9.1 での動作チェックをしました。 183 | 184 | = 1.6.2 (2014-05-05) = 185 | * 正規表現に関するバグを修正しました。 186 | * 管理画面のドキュメント(表示されていなかった)を修正しました。 187 | 188 | = 1.6.1 (2014-04-22) = 189 | * WP Slimstat を使うために、いくつかのバグを修正しました。 190 | * 古い db.php を使い続けている場合は、ダッシュボードに注意を表示するようにしました(必要な場合のみ)。 191 | * 古い db.php を新しいものを置き換えるユーティリティを追加しました。 192 | * 日本語カタログファイルをアップデートしました。 193 | 194 | = 1.6 (2014-04-17) = 195 | * 未対応のクエリに対するエラーメッセージのコントロールができていないのを修正しました。 196 | * SQL_CALC_FOUND_ROW ステートメントのバグを修正しました。メインクエリと WP_Query、WP_Meta_Query などのページング情報に関連したものです。 197 | * コメント本文からバッククォートが削除されるバグを修正しました。 198 | * バックアップファイルをローカルにダウンロードできるようにしました。 199 | * PHP documentor で使えるように、ソースコードのドキュメントを書き直しました。 200 | * このドキュメントを変えました。 201 | * マイナーな変更、修正がいくつかありました。 202 | * WordPress 3.8.2 と 3.9 alpha でインストールテストをしました。 203 | * プラグイン互換リストを増補しました。 204 | * これまで使えなくしていた wp-db.php の関数を使えるようにしました。 205 | * いくつかのユーザ定義関数を追加しました。 206 | 207 | = 1.5 (2013-12-17) = 208 | * WordPress 3.8 でのインストールと動作テストをしました。 209 | * SQLite と MySQL を交互に使えるようにしました。 210 | * readme-ja.txt のインストールの説明をかえました。 211 | * SQLite のコンパイルオプション'ENABLE_UPDATE_DELETE_LIMIT'をチェックするようにしました。 212 | * WordPress 3.8 の管理画面に合わせて sytle を変更しました。 213 | * グローバルで動くファイルへのダイレクトアクセスを制限するようにしました。 214 | 215 | = 1.4.2 (2013-11-06) = 216 | * ダッシュボードに表示される情報についてのバグを修正しました。 217 | * スクリーンショットを変更しました。 218 | * WordPress 3.7.1 でのインストールテストを行いました。 219 | 220 | = 1.4.1 (2013-09-27) = 221 | * BETWEEN関数の書き換え方を修正しました。致命的なバグです。新規投稿に'between A and B'というフレーズが含まれていると、公開されず、投稿自体も消えます。 222 | * MP6を使っているときに、管理画面のレイアウトが崩れるのを修正しました。 223 | * 日本語が一部表示されないのを直しました。 224 | * SELECT version()がダミーデータを返すようにしました。 225 | * WP_DEBUGが有効の時に、WordPressのテーブルからカラム情報を読んで表示できるようにしました。 226 | 227 | = 1.4 (2013-09-12) = 228 | * アップグレードしたWordPressで期待通り動作しないのを修正するために、データベース管理ユーティリティを追加しました。 229 | * SHOW INDEXクエリにWHERE句がある場合の処理を変更しました。 230 | * ALTER TABLEクエリのバグを修正しました。 231 | 232 | = 1.3 (2013-09-04) = 233 | * データベースファイルのスナップショットをzipアーカイブとしてバックアップするユーティリティを追加しました。 234 | * ダッシュボードのスタイルをMP6プラグインに合わせたものに変えました。 235 | * 言語カタログが読み込まれていないときのエラーメッセージの出力方法を一部変更しました。 236 | * query_create.class.phpの_rewrite_field_types()を変更しました。dbDelta()関数が意図したとおりに実行されます。 237 | * BETWEENステートメントが使えるようになりました。 238 | * クエリからインデックスヒントを全て削除して実行するようにしました。 239 | * New StatPressプラグインが使えるように、ALTER TABLE CHANGE COLUMNの扱いを修正しました。 240 | * いくつかの小さなバグを修正しました。 241 | 242 | = 1.2.1 (2013-08-04) = 243 | * wp-db.phpの変更にともなって、wpdb::real_escapeプロパティを削除しました。WordPress 3.6 との互換性を保つための変更です。 244 | 245 | = 1.2 (2013-08-03) = 246 | * カレンダー・ウィジェットでの不具合に対応するため、日付フォーマットとそのクオートを修正しました。 247 | * Windows マシンでパッチファイルが削除できなかったのを修正しました。 248 | * パッチファイルをアップロードするときに textdomain のエラーが出るのを修正しました。 249 | * ON DUPLICATE KEY UPDATEをともなったクエリの処理を変更しました。 250 | * readme.txt と readme-ja.txt の間違いを直しました。 251 | 252 | = 1.1 (2013-07-24) = 253 | * DROP INDEX 単独のクエリが動作していなかったのを修正しました。 254 | * shutdown_hook で destruct() を実行していたのをやめました。 255 | * LOCATE() 関数を使えるようにしました。 256 | 257 | = 1.0 (2013-07-07) = 258 | * 最初のリリース。 259 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/utilities/documentation.php: -------------------------------------------------------------------------------- 1 | text_domain; 22 | if (is_multisite() && !current_user_can('manage_network_options')) { 23 | die(__('You are not allowed to access this page!', $domain)); 24 | } elseif (!current_user_can('manage_options')) { 25 | die(__('You are not allowed to access this page!', $domain)); 26 | } 27 | if (isset($_GET['page']) && $_GET['page'] == 'doc') :?> 28 | 37 |
38 |

39 |

40 | SQLite Integration page.', $domain);?> 41 |

42 |

43 | 44 |

45 | 46 |

47 |

48 | PDO for WordPress, which enabled WordPress to use SQLite for its database. But PDO for WordPress doesn\'t seem to be maintained any more only to be outdated. SQLite Integration makes use of the basic ideas and framework of PDO for WordPress, adds some new features and updates it to be able to work with the newest version of WordPress(3.8.1).', $domain); ?> 49 |

50 |

51 | SQLite Web Page says — SQLite is a "software library that implements selfcontained, serverless, zero-configuration, transactional SQL database engine". It is "a good choice for small to medium size websites". It\'s small and portable, and you don\'t need any database server system.', $domain); ?> 52 |

53 |

54 | 55 |

56 |

57 | 58 |

59 |
    60 |
  1. 61 |
  2. 62 |
  3. 63 |
  4. 64 |
  5. 65 |
  6. 66 |
67 |

68 | 69 |

70 | 71 |

72 |

73 | 74 |

75 |
    76 |
  1. ', $domain);?> 77 |
  2. 78 |
  3. ', $domain);?> 79 | Patch Utility. See also the SQLite Integration Page for more details.', $domain), $utils->show_parent());?>
  4. 80 |
81 |

82 | Support Forum.', $domain);?> 83 |

84 |

85 |

86 | 87 |

88 |

89 | 90 |

91 | 92 |

93 |

94 | 95 |

96 | 100 |

101 | 102 |

103 |
104 | 105 | 106 |
107 |

108 |

109 | 110 |

111 |

112 | System Info page. To see more details, please visit the Plugin Page.', $domain), $utils->show_parent());?> 113 |

114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 126 | 130 | compat, array('No', 'Probably No', 'Needs Patch'))) :?> 131 | 132 | 133 | compat, 'patch') !== false) :?> 134 | 135 | compat, 'probably no')) :?> 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 |
name;?>reason;?>
147 |
148 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/pdodb.class.php: -------------------------------------------------------------------------------- 1 | show_errors(); 51 | 52 | $this->init_charset(); 53 | 54 | $this->db_connect(); 55 | } 56 | /** 57 | * Desctructor 58 | * 59 | * This overrides wpdb::__destruct(), but does nothing but return true. 60 | * 61 | * @see wpdb::__destruct() 62 | */ 63 | public function __destruct() { 64 | return true; 65 | } 66 | 67 | /** 68 | * Method to set character set for the database. 69 | * 70 | * This overrides wpdb::set_charset(), only to dummy out the MySQL function. 71 | * 72 | * @see wpdb::set_charset() 73 | */ 74 | public function set_charset($dbh, $charset = null, $collate = null) { 75 | if ( ! isset( $charset ) ) 76 | $charset = $this->charset; 77 | if ( ! isset( $collate ) ) 78 | $collate = $this->collate; 79 | } 80 | /** 81 | * Method to dummy out wpdb::set_sql_mode() 82 | * 83 | * @see wpdb::set_sql_mode() 84 | */ 85 | public function set_sql_mode($modes = array()) { 86 | unset($modes); 87 | return; 88 | } 89 | /** 90 | * Method to select the database connection. 91 | * 92 | * This overrides wpdb::select(), only to dummy out the MySQL function. 93 | * 94 | * @see wpdb::select() 95 | */ 96 | public function select($db, $dbh = null) { 97 | if (is_null($dbh)) 98 | $dbh = $this->dbh; 99 | $this->ready = true; 100 | return; 101 | } 102 | /** 103 | * Method to dummy out wpdb::_weak_escape() 104 | * 105 | */ 106 | function _weak_escape($string) { 107 | return addslashes($string); 108 | } 109 | /** 110 | * Method to escape characters. 111 | * 112 | * This overrides wpdb::_real_escape() to avoid using mysql_real_escape_string(). 113 | * 114 | * @see wpdb::_real_escape() 115 | */ 116 | function _real_escape($string) { 117 | return addslashes($string); 118 | } 119 | /** 120 | * Method to dummy out wpdb::esc_like() function. 121 | * 122 | * WordPress 4.0.0 introduced esc_like() function that adds backslashes to %, 123 | * underscore and backslash, which is not interpreted as escape character 124 | * by SQLite. So we override it and dummy out this function. 125 | * 126 | * @see wpdb::esc_like() 127 | */ 128 | public function esc_like($text) { 129 | return $text; 130 | } 131 | /** 132 | * Method to put out the error message. 133 | * 134 | * This overrides wpdb::print_error(), for we can't use the parent class method. 135 | * 136 | * @see wpdb::print_error() 137 | */ 138 | public function print_error($str = '') { 139 | global $EZSQL_ERROR; 140 | 141 | if (!$str) { 142 | $err = $this->dbh->get_error_message() ? $this->dbh->get_error_message() : ''; 143 | if (!empty($err)) $str = $err[2]; else $str = ''; 144 | } 145 | $EZSQL_ERROR[] = array('query' => $this->last_query, 'error_str' => $str); 146 | 147 | if ($this->suppress_errors) 148 | return false; 149 | 150 | wp_load_translations_early(); 151 | 152 | if ($caller = $this->get_caller()) 153 | $error_str = sprintf(__('WordPress database error %1$s for query %2$s made by %3$s'), $str, $this->last_query, $caller); 154 | else 155 | $error_str = sprintf(__('WordPress database error %1$s for query %2$s'), $str, $this->last_query); 156 | 157 | error_log($error_str); 158 | 159 | if (!$this->show_errors) 160 | return false; 161 | 162 | if (is_multisite()) { 163 | $msg = "WordPress database error: [$str]\n{$this->last_query}\n"; 164 | if (defined('ERRORLOGFILE')) 165 | error_log($msg, 3, ERRORLOGFILE); 166 | if (defined('DIEONDBERROR')) 167 | wp_die($msg); 168 | } else { 169 | $str = htmlspecialchars($str, ENT_QUOTES); 170 | $query = htmlspecialchars($this->last_query, ENT_QUOTES); 171 | 172 | print "
173 |

WordPress database error: [$str]
174 | $query

175 |
"; 176 | } 177 | } 178 | /** 179 | * Method to flush cached data. 180 | * 181 | * This overrides wpdb::flush(). This is not necessarily overridden, because 182 | * $result will never be resource. 183 | * 184 | * @see wpdb::flush 185 | */ 186 | public function flush() { 187 | $this->last_result = array(); 188 | $this->col_info = null; 189 | $this->last_query = null; 190 | $this->rows_affected = $this->num_rows = 0; 191 | $this->last_error = ''; 192 | $this->result = null; 193 | } 194 | /** 195 | * Method to do the database connection. 196 | * 197 | * This overrides wpdb::db_connect() to avoid using MySQL function. 198 | * 199 | * @see wpdb::db_connect() 200 | */ 201 | public function db_connect($allow_bail=true) { 202 | if (WP_DEBUG) { 203 | $this->dbh = new PDOEngine(); 204 | } else { 205 | // WP_DEBUG or not, we don't use @ which causes the slow execution 206 | // PDOEngine class will take the Exception handling. 207 | $this->dbh = new PDOEngine(); 208 | } 209 | if (!$this->dbh) { 210 | wp_load_translations_early();//probably there's no translations 211 | $this->bail(sprintf(__("

Error establlishing a database connection

We have been unable to connect to the specified database.
The error message received was %s"), $this->dbh->errorInfo())); 212 | return; 213 | } 214 | $is_enabled_foreign_keys = @$this->get_var('PRAGMA foreign_keys'); 215 | if ($is_enabled_foreign_keys == '0') @$this->query('PRAGMA foreign_keys = ON'); 216 | $this->has_connected = true; 217 | $this->ready = true; 218 | } 219 | /** 220 | * Method to dummy out wpdb::check_connection() 221 | * 222 | */ 223 | public function check_connection($allow_bail=true) { 224 | return true; 225 | } 226 | /** 227 | * Method to execute the query. 228 | * 229 | * This overrides wpdb::query(). In fact, this method does all the database 230 | * access jobs. 231 | * 232 | * @see wpdb::query() 233 | */ 234 | public function query($query) { 235 | if (!$this->ready) 236 | return false; 237 | 238 | $query = apply_filters('query', $query); 239 | 240 | $return_val = 0; 241 | $this->flush(); 242 | 243 | $this->func_call = "\$db->query(\"$query\")"; 244 | 245 | $this->last_query = $query; 246 | 247 | if (defined('SAVEQUERIES') && SAVEQUERIES) 248 | $this->timer_start(); 249 | 250 | $this->result = $this->dbh->query($query); 251 | $this->num_queries++; 252 | 253 | if (defined('SAVEQUERIES') && SAVEQUERIES) 254 | $this->queries[] = array($query, $this->timer_stop(), $this->get_caller()); 255 | 256 | if ($this->last_error = $this->dbh->get_error_message()) { 257 | if (defined('WP_INSTALLING') && WP_INSTALLING) { 258 | //$this->suppress_errors(); 259 | } else { 260 | $this->print_error($this->last_error); 261 | return false; 262 | } 263 | } 264 | 265 | if (preg_match('/^\\s*(create|alter|truncate|drop|optimize)\\s*/i', $query)) { 266 | //$return_val = $this->result; 267 | $return_val = $this->dbh->get_return_value(); 268 | } elseif (preg_match('/^\\s*(insert|delete|update|replace)\s/i', $query)) { 269 | $this->rows_affected = $this->dbh->get_affected_rows(); 270 | if (preg_match('/^\s*(insert|replace)\s/i', $query)) { 271 | $this->insert_id = $this->dbh->get_insert_id(); 272 | } 273 | $return_val = $this->rows_affected; 274 | } else { 275 | $this->last_result = $this->dbh->get_query_results(); 276 | $this->num_rows = $this->dbh->get_num_rows(); 277 | $return_val = $this->num_rows; 278 | } 279 | return $return_val; 280 | } 281 | /** 282 | * Method for future use? 283 | * 284 | * WordPress 3.9 separated the method to execute real query from query() function. 285 | * This is for the restoration from the case that nothing returns from database. 286 | * But this is necessary because we aleady did error manipulations in 287 | * pdoengine.class.php. So we don't use this function. 288 | * 289 | * @access private 290 | */ 291 | private function _do_query($query) { 292 | if (defined('SAVEQUERIES') && SAVEQUERIES) { 293 | $this->timer_start(); 294 | } 295 | $this->result = $this->dbh->query($query); 296 | $this->num_queries++; 297 | if (defined('SAVEQUERIES') && SAVEQUERIES) { 298 | $this->queries[] = array($query, $this->timer_stop(), $this->get_caller()); 299 | } 300 | } 301 | /** 302 | * Method to set the class variable $col_info. 303 | * 304 | * This overrides wpdb::load_col_info(), which uses a mysql function. 305 | * 306 | * @see wpdb::load_col_info() 307 | * @access protected 308 | */ 309 | protected function load_col_info() { 310 | if ($this->col_info) 311 | return; 312 | $this->col_info = $this->dbh->get_columns(); 313 | } 314 | 315 | /** 316 | * Method to return what the database can do. 317 | * 318 | * This overrides wpdb::has_cap() to avoid using MySQL functions. 319 | * SQLite supports subqueries, but not support collation, group_concat and set_charset. 320 | * 321 | * @see wpdb::has_cap() 322 | */ 323 | public function has_cap($db_cap) { 324 | switch(strtolower($db_cap)) { 325 | case 'collation': 326 | case 'group_concat': 327 | case 'set_charset': 328 | return false; 329 | case 'subqueries': 330 | return true; 331 | default: 332 | return false; 333 | } 334 | } 335 | /** 336 | * Method to return database version number. 337 | * 338 | * This overrides wpdb::db_version() to avoid using MySQL function. 339 | * It returns mysql version number, but it means nothing for SQLite. 340 | * So it return the newest mysql version. 341 | * 342 | * @see wpdb::db_version() 343 | */ 344 | public function db_version() { 345 | //global $required_mysql_version; 346 | //return $required_mysql_version; 347 | return '5.5'; 348 | } 349 | } 350 | 351 | /* 352 | * Initialize $wpdb with PDODB class 353 | */ 354 | if (!isset($wpdb)) { 355 | global $wpdb; 356 | $wpdb = new PDODB(); 357 | } 358 | ?> -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/readme.txt: -------------------------------------------------------------------------------- 1 | === SQLite Integration === 2 | Contributors: kjmtsh 3 | Plugin Name: SQLite Integration 4 | Plugin URI: http://dogwood.skr.jp/wordpress/sqlite-integration/ 5 | Tags: database, SQLite, PDO 6 | Author: Kojima Toshiyasu 7 | Author URI: http://dogwood.skr.jp/ 8 | Requires at least: 3.3 9 | Tested up to: 4.0 10 | Stable tag: 1.7 11 | License: GPLv2 12 | License URI: http://www.gnu.org/licenses/gpl-2.0.html 13 | 14 | SQLite Integration is the plugin that enables WordPress to use SQLite. If you want to build a WordPress website with it, this plugin is for you. 15 | 16 | == Description == 17 | 18 | This plugin enables you to create WordPress based web sites without MySQL database server. All you've got to prepare is the Apache web server or the like and PHP with PDO extension. WordPress archive and this plugin in hand, you can build a WordPress web site out of the box. 19 | 20 | SQLite Integration is a successor to [PDO for WordPress](http://wordpress.org/extend/plugins/pdo-for-wordpress) plugin, which unfortunately enough, doesn't seem to be maintained any more. SQLite Integration uses the basic idea and structures of that plugin and adds some utilities with more features. 21 | 22 | = Features = 23 | 24 | SQLite Integration is a database access engine program. So it's not like the other plugins. It must be used to install WordPress. Please read the install section. And see more detailed instruction in the [SQLite Integration Page](http://dogwood.skr.jp/wordpress/sqlite-integration/). 25 | 26 | Once you succeed in installing WordPress, you can use it just like the other systems using MySQL. Optionally, this plugin provides the feature to temporarily change the database to MySQL and come back to SQLite, which may help developers test their sites on the local machines without MySQL. 27 | 28 | After you finish installing, you can activate this plugin (this is optional but I recommend you to). And you can see some instructions and useful information on your server or your installed plugins. 29 | 30 | = System Requirements = 31 | 32 | * PHP 5.2 or newer with PDO extension (PHP 5.3 or newer is better). 33 | * PDO SQLite driver must be loaded. 34 | 35 | = Backward Compatibility = 36 | 37 | If you are using 'PDO for WordPress', you can migrate your database to this plugin. Please check the install section. 38 | 39 | = Support = 40 | 41 | Please contact us with the methods below: 42 | 43 | 1. Post to [Support Forum](http://wordpress.org/support/plugin/sqlite-integration/). 44 | 2. Visit the [SQLite Integration Page](http://dogwood.skr.jp/wordpress/sqlite-integration/)(in English) or [SQLite Integration(ja) Page](http://dogwood.skr.jp/wordpress/sqlite-integration-ja/)(in Japanese) and leave a message there. 45 | 46 | = Notes about Support = 47 | 48 | WordPress.org doesn't officially support using any other database than MySQL. So you will have no supports from WordPress.org. Even if you post to the general Forum, you'll have few chances to get the answer. And if you use patched plugins, you will have no support from the plugin author(s), eithter. I will help you as much as I can, but take your own risk, please. 49 | 50 | = Translation = 51 | 52 | Documentation is written in English. If you translate it into your language, please let me know. 53 | 54 | * Japanese (kjmtsh) 55 | * Spanish (Pablo Laguna) 56 | 57 | == Installation == 58 | 59 | For more detailed instruction, please visit [SQLite Integration](http://dogwood.skr.jp/wordpress/sqlite-integration/). 60 | 61 | = Preparation = 62 | 63 | 1. Download the latest WordPress archive and this plugin. And expand them on your machine. 64 | 2. Move sqlite-integration folder to wordpress/wp-content/plugins folder. 65 | 3. Copy db.php file in sqlite-integratin folder to wordpress/wp-content folder. 66 | 4. Rename wordpress/wp-config-sample.php to wordpress/wp-config.php. 67 | 68 | = Basic settings = 69 | 70 | Open wp-config.php and edit the section below: 71 | 72 | * Authentication Unique keys and Salts 73 | * WordPress Database Table prefix 74 | * WordPress Localized Language 75 | 76 | See also [Editing wp-config.php](http://codex.wordpress.org/Editing_wp-config.php) in the Codex. Note that you don't have to write your database server, user name, user password or etc... 77 | 78 | = Less than 5 minutes installation = 79 | 80 | Upload everything (keeping the directory structure) to your server and access the wp-admin/install.php with your favorite browser, and WordPress installation process will begin. Enjoy your blogging! 81 | 82 | = Optional settings = 83 | 84 | You can change some default settings with the directives in wp-config.php.If you change the SQLite database file name (default is .ht.sqlite) to others, add the next line in your wp-config.php. 85 | 86 | `define('DB_FILE', 'your_database_name');` 87 | 88 | If you change the directory where the SQLite database is put, add the next line in your wp-config.php. 89 | 90 | `define('DB_DIR', '/home/youraccount/database_directory/');` 91 | 92 | You can change either of them or both of them. 93 | 94 | = Use MySQL without uninstalling this plugins = 95 | 96 | If you want to use MySQL, add the next line in your wp-config.php. 97 | 98 | `define('USE_MYSQL', true);` 99 | 100 | Of course, this is not enough. You must give your database server address, user name, passowrd or etc... in the same file. After you add that line and access your web site for the first time, WordPress installer will begin. Then you must finish setting MySQL database. As you know, data in the SQLite database is not automatically migrated to MySQL. 101 | 102 | If you want to use SQLite again, change the line in wp-config.php as below or just remove this line. 103 | 104 | `define('USE_MYSQL', false);` 105 | 106 | = For PDO for WordPress users = 107 | 108 | If you are using PDO for WordPress now, you can migrate your database to SQLite Integration. I recommend the way below. See more detailed instruction [SQLite Integration](http://dogwood.skr.jp/wordpress/sqlite-integration/). 109 | 110 | 1. Export your data from current database. 111 | 2. Install latest WordPress with SQLite Integration. 112 | 3. Import the old data. 113 | 114 | If export or import fails for some reason, please visit our site and try another way described there. 115 | 116 | == Frequently Asked Questions == 117 | 118 | = Install stops with 'Error establishing a database connection' = 119 | 120 | It is required that you should prepare wp-config.php manually. If you try to make WordPress create wp-config.php, you'll get that message and can't continue install process. 121 | 122 | = Database file is not created = 123 | 124 | The reason of failure in creating directory or files is often that PHP is not allowed to craete them. Please check your server setting or ask the administrator. 125 | 126 | = Such and such plugins can't be activated or doesn't seem to work properly = 127 | 128 | Some of the plugins, especially cache plugins or database maintenace plugins, are not compatible with this plugin. Please activate SQLite Integration and see the known limitations section in this document or visit the [SQLite Integration](http://dogwood.skr.jp/wordpress/sqlite-integration/) for more detailed information. 129 | 130 | = I don't want the admin menu and documentation = 131 | 132 | Just deactivate the plugin, and you can remove them. Activation and deactivation affect only admin menu. If you want to remove all the plugin files, just delete it. 133 | 134 | == Screenshots == 135 | 136 | 1. System Information tells you your database status and installed plugins compatibility. 137 | 138 | == Known Limitations == 139 | 140 | Many of the other plugins will work fine with this plugin. But there are some you can't use. Generally speaking, the plugins that manipulate database not with WordPress' APIs but with MySQL or MySQLi native drivers from PHP might cause the problem. 141 | 142 | These are some examples: 143 | 144 | You can't use these plugins because they create the same file that this plugin uses. 145 | 146 | * W3 Total Cache 147 | * DB Cache Reloaded Fix 148 | * HyperDB 149 | 150 | You may be able to use 'WP Super Cache' or 'Quick Cache' instead of them. I don't mean to recommend them and give no warranty at all. 151 | 152 | You can't use these plugins, because they are using MySQL specific features that SQLite Integration can't emulate. 153 | 154 | * Yet Another Related Posts 155 | * Better Related Posts 156 | 157 | You may be able to use 'WordPress Related Posts' or 'Related Posts' instead of them. Probably there are more, I'm afraid. If you find one, please let me know. 158 | 159 | There are some among the incompatible plugins, which work fine by rewriting some codes. I give information about them and provide the patch files on [Plugins](http://dogwood.skr.jp/wordpress/plugins/). 160 | 161 | This plugin doesn't support 'WP_PLUGIN_URL' constant. 162 | 163 | == Upgrade Notice == 164 | 165 | WordPress 4.0 compatibility is checked and some bugs are fixed. Upgrade is recommended. When auto upgrading fails, please try manual upgrade via FTP. 166 | 167 | == Changelog == 168 | 169 | = 1.7 (2014-09-05) = 170 | * Fixed the bug about changing the order of the attachment file in the editor screen. 171 | * Fixed the bug about the manipulation of CREATE query. 172 | * Added an 128x128 icon and 256x256 icon. 173 | * Change for checking the user defined value of pcre.backtrack_limit and using it. 174 | * WordPress 4.0 compatibilitiy checked. 175 | 176 | = 1.6.3 (2014-05-10) = 177 | * Fixed the bug about manipulating meta query with BETWEEN comparison. 178 | * Added the Spanish langugae support. 179 | * WordPress 3.9.1 compatibility checked. 180 | 181 | = 1.6.2 (2014-05-05) = 182 | * Fixed some bugs for the regular expression. 183 | * Fixed the documents on the admin dashboard. 184 | 185 | = 1.6.1 (2014-04-22) = 186 | * Fixed some bugs for using with WP Slimstat plugin. 187 | * Display admin notice when not replacing the old db.php with the new one (when necessary). 188 | * Add the feature for replacing the old db.php file with the button click. 189 | * Fixed the Japanese translation catalog file. 190 | 191 | = 1.6 (2014-04-17) = 192 | * Fixed the bug of error messaging control for the unknown query. 193 | * Fixed the bug for 'SQL_CALC_FOUND_ROW' statement. This is for the main query, WP_Query class and WP_Meta_Query concerning paging information. 194 | * Fixed the bug that the back quote in the comments was removed. 195 | * Added the feature to download a backup file to a local machine. 196 | * Revised all the doc strings in the sourcse code for PHP documentor. 197 | * Changed the documentation. 198 | * Fixed minor bugs and typos. 199 | * Tested to install WordPress 3.8.2 and 3.9 beta. 200 | * Augumented the plugin compatibility list. 201 | * Some functions in wp-db.php, which was disabled by the plugin, is enabled and can be used. 202 | * Some more user defined functions are added. 203 | 204 | = 1.5 (2013-12-17) = 205 | * Tested WordPress 3.8 installation and compatibility. 206 | * Add the optional feature to change the database from SQLite to MySQL. 207 | * Changed the install instruction in the readme.txt. 208 | * Add the code to check if the SQLite library was compiled with the option 'ENABLE_UPDATE_DELETE_LIMIT'. 209 | * Changed the admin panel style to fit for WordPress 3.8. 210 | * Restricted the direct access to the files that works in the global namespace. 211 | 212 | = 1.4.2 (2013-11-06) = 213 | * Fixed some minor bugs about the information in the dashboard. 214 | * Changed the screenshot. 215 | * Tested WordPress 3.7.1 installation. 216 | 217 | = 1.4.1 (2013-09-27) = 218 | * Fixed the rewriting process of BETWEEN function. This is a critical bug. When your newly created post contains 'between A and B' phrase, it is not published and disappears. 219 | * Fixed the admin dashboard display when using MP6. 220 | * Fixed the Japanese catalog. 221 | * Added the procedure for returning the dummy data when using SELECT version(). 222 | * Added the procedure for displaying column informatin of WordPress tables when WP_DEBUG enabled. 223 | 224 | = 1.4 (2013-09-12) = 225 | * Added the database maintenance utility for fixing the database malfunction of the upgraded WordPress installation. 226 | * Changed the manipulation of SHOW INDEX query with WHERE clause. 227 | * Fixed the bug of the manipulation of ALTER TABLE query. 228 | 229 | = 1.3 (2013-09-04) = 230 | * Added the backup utility that creates the zipped archive of the current snapshot of the database file. 231 | * Changed the dashboard style to match MP6 plugin. 232 | * Changed the way of putting out the error messages when language catalogs are not loaded. 233 | * Modified the _rewrite_field_types() in query_create.class.php for the dbDelta() function to work properly. 234 | * Added the support for BETWEEN statement. 235 | * Changed the regular expression to remove all the index hints from the query string. 236 | * Fixed the manipulation of ALTER TABLE CHANGE COLUMN query for NewStatPress plugin to work. 237 | * Fixed minor bugs. 238 | 239 | = 1.2.1 (2013-08-04) = 240 | * Removed wpdb::real_escape property following the change of the wpdb.php file which makes the plugin compatible with Wordpress 3.6. 241 | 242 | = 1.2 (2013-08-03) = 243 | * Fixed the date string format and its quotation for calendar widget. 244 | * Fixed the patch utility program for using on the Windows machine. 245 | * Fixed the textdomain error in utilities/patch.php file when uploading the patch file. 246 | * Changed the manipulation of the query with ON DUPLICATE KEY UPDATE. 247 | * Fixed the typos in readme.txt and readme-ja.txt. 248 | 249 | = 1.1 (2013-07-24) = 250 | * Fixed the manipulation of DROP INDEX query. 251 | * Removed destruct() from shutdown_hook. 252 | * Enabled LOCATE() function in the query string. 253 | 254 | = 1.0 (2013-07-07) = 255 | * First release version of the plugin. 256 | -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/sqlite-integration.php: -------------------------------------------------------------------------------- 1 | blogid; 142 | $blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs"); 143 | foreach ($blog_ids as $blog_id) { 144 | switch_to_blog($blog_id); 145 | $this->_install(); 146 | } 147 | switch_to_blog($old_blog); 148 | return; 149 | } else { 150 | $this->_install(); 151 | return; 152 | } 153 | } 154 | 155 | /** 156 | * Method to install something. 157 | * 158 | * We have nothing to do for now. 159 | * We show menu and documents only to the network administrator. 160 | * 161 | * @param no parameter is provided. 162 | * @return no return values. 163 | */ 164 | function _install() { 165 | } 166 | 167 | /** 168 | * Method to uninstall plugin. 169 | * 170 | * This will remove wp-content/db.php and wp-content/patches direcotry. 171 | * If you migrate the site to the sever with MySQL, you have only to 172 | * migrate the data in the database. 173 | * 174 | * @param no parameter is provided. 175 | * @return no return values. 176 | */ 177 | function uninstall() { 178 | // remove patch files and patch directory 179 | if (file_exists(SQLitePatchDir) && is_dir(SQLitePatchDir)) { 180 | $dir_handle = opendir(SQLitePatchDir); 181 | while (($file_name = readdir($dir_handle)) !== false) { 182 | if ($file_name != '.' && $file_name != '..') { 183 | unlink(SQLitePatchDir.'/'.$file_name); 184 | } 185 | } 186 | rmdir(SQLitePatchDir); 187 | } 188 | // remove wp-content/db.php 189 | if (defined('WP_CONTENT_DIR')) { 190 | $target = WP_CONTENT_DIR . 'db.php'; 191 | } else { 192 | $target = ABSPATH . 'wp-content/db.php'; 193 | } 194 | if (file_exists($target)) { 195 | unlink($target); 196 | } 197 | } 198 | 199 | /** 200 | * Method to manipulate the admin panel, stylesheet and JavaScript. 201 | * 202 | * We use class method to show pages and want to load style files and script 203 | * files only in our plugin documents, so we need add_submenu_page with parent 204 | * slug set to null. This means that menu items are added but hidden from the 205 | * users. 206 | * 207 | * @param no parameter is provided. 208 | * @return no return values. 209 | */ 210 | function add_pages() { 211 | global $utils, $doc, $patch_utils, $maintenance; 212 | if (function_exists('add_options_page')) { 213 | $welcome_page = add_options_page(__('SQLite Integration'), __('SQLite Integration'), 'manage_options', 'sqlite-integration', array($utils, 'welcome')); 214 | $util_page = add_submenu_page(null, 'System Info', 'System Info', 'manage_options', 'sys-info', array($utils, 'show_utils')); 215 | $edit_db = add_submenu_page(null, 'Setting File', 'Setting File', 'manage_options', 'setting-file', array($utils, 'edit_db_file')); 216 | $doc_page = add_submenu_page(null, 'Documentation', 'Documentation', 'manage_options', 'doc', array($doc, 'show_doc')); 217 | $patch_page = add_submenu_page(null, 'Patch Utility', 'Patch Utility', 'manage_options', 'patch', array($patch_utils, 'show_patch_page')); 218 | $maintenance_page = add_submenu_page(null, 'DB Maintenance', 'DB Maintenance', 'manage_options', 'maintenance', array($maintenance, 'show_maintenance_page')); 219 | add_action('admin_print_styles-'.$welcome_page, array($this, 'add_style_sheet')); 220 | add_action('admin_print_styles-'.$util_page, array($this, 'add_style_sheet')); 221 | add_action('admin_print_styles-'.$edit_db, array($this, 'add_style_sheet')); 222 | add_action('admin_print_styles-'.$doc_page, array($this, 'add_style_sheet')); 223 | add_action('admin_print_styles-'.$patch_page, array($this, 'add_style_sheet')); 224 | add_action('admin_print_scripts-'.$util_page, array($this, 'add_sqlite_script')); 225 | add_action('admin_print_scripts-'.$doc_page, array($this, 'add_sqlite_script')); 226 | add_action('admin_print_scripts-'.$patch_page, array($this, 'add_sqlite_script')); 227 | add_action('admin_print_scripts-'.$edit_db, array($this, 'add_sqlite_script')); 228 | add_action('admin_print_styles-'.$maintenance_page, array($this, 'add_style_sheet')); 229 | } 230 | } 231 | 232 | /** 233 | * Method to manipulate network admin panel. 234 | * 235 | * Capability is set to manage_network_options. 236 | * 237 | * @param no parameter is provided. 238 | * @return no return values. 239 | */ 240 | function add_network_pages() { 241 | global $utils, $doc, $patch_utils, $maintenance; 242 | if (function_exists('add_options_page')) { 243 | $welcome_page = add_submenu_page('settings.php', __('SQLite Integration'), __('SQLite Integration'), 'manage_network_options', 'sqlite-integration', array($utils, 'welcome')); 244 | $util_page = add_submenu_page(null, 'System Info', 'System Info', 'manage_network_options', 'sys-info', array($utils, 'show_utils')); 245 | $edit_db = add_submenu_page(null, 'Setting File', 'Setting File', 'manage_network_options', 'setting-file', array($utils, 'edit_db_file')); 246 | $doc_page = add_submenu_page(null, 'Documentation', 'Documentation', 'manage_network_options', 'doc', array($doc, 'show_doc')); 247 | $patch_page = add_submenu_page(null, 'Patch Utility', 'Patch Utility', 'manage_network_options', 'patch', array($patch_utils, 'show_patch_page')); 248 | $maintenance_page = add_submenu_page(null, 'DB Maintenance', 'DB Maintenance', 'manage_network_options', 'maintenance', array($maintenance, 'show_maintenance_page')); 249 | add_action('admin_print_styles-'.$welcome_page, array($this, 'add_style_sheet')); 250 | add_action('admin_print_styles-'.$util_page, array($this, 'add_style_sheet')); 251 | add_action('admin_print_styles-'.$edit_db, array($this, 'add_style_sheet')); 252 | add_action('admin_print_styles-'.$doc_page, array($this, 'add_style_sheet')); 253 | add_action('admin_print_styles-'.$patch_page, array($this, 'add_style_sheet')); 254 | add_action('admin_print_scripts-'.$util_page, array($this, 'add_sqlite_script')); 255 | add_action('admin_print_scripts-'.$doc_page, array($this, 'add_sqlite_script')); 256 | add_action('admin_print_scripts-'.$patch_page, array($this, 'add_sqlite_script')); 257 | add_action('admin_print_scripts-'.$edit_db, array($this, 'add_sqlite_script')); 258 | add_action('admin_print_styles-'.$maintenance_page, array($this, 'add_style_sheet')); 259 | } 260 | } 261 | 262 | /** 263 | * Method to initialize textdomain. 264 | * 265 | * Japanese catalog is only available. 266 | * 267 | * @param no parameter is provided. 268 | * @return no return values. 269 | */ 270 | function textdomain_init() { 271 | global $utils; 272 | //$current_locale = get_locale(); 273 | //if (!empty($current_locale)) { 274 | // $moFile = dirname(__FILE__) . "/languages/sqlite-wordpress-" . $current_locale . ".mo"; 275 | // if(@file_exists($moFile) && is_readable($moFile)) load_textdomain('sqlite-wordpress', $moFile); 276 | //} 277 | load_plugin_textdomain($utils->text_domain, false, SQLiteDir.'/languages/'); 278 | } 279 | 280 | /** 281 | * Method to initialize stylesheet on the admin panel. 282 | * 283 | * This determines which stylesheet to use depending on the users' choice 284 | * of admin_color. Each stylesheet imports style.css and change the color 285 | * of the admin dashboard. 286 | * 287 | * @param no parameter is provided. 288 | * @return no return values. 289 | */ 290 | function add_style_sheet() { 291 | global $current_user; 292 | get_currentuserinfo(); 293 | $admin_color = get_user_meta($current_user->ID, 'admin_color', true); 294 | if ($admin_color == 'fresh') { 295 | $stylesheet_file = 'style.min.css'; 296 | } else { 297 | $stylesheet_file = $admin_color . '.min.css'; 298 | } 299 | $style_url = SQLiteUrl . '/styles/' . $stylesheet_file; 300 | $style_file = SQLiteFilePath . '/styles/' . $stylesheet_file; 301 | if (file_exists($style_file)) { 302 | wp_enqueue_style('sqlite_integration_stylesheet', $style_url); 303 | } 304 | } 305 | /** 306 | * Method to register the JavaScript file. 307 | * 308 | * To register the JavaScript file. It's only for the admin dashboard. 309 | * It won't included in web pages. 310 | * 311 | * @param no parameter is provided. 312 | * @return no return value. 313 | */ 314 | function add_sqlite_script() { 315 | $script_url = SQLiteUrl . '/js/sqlite.min.js'; 316 | $script_file = SQLiteFilePath . '/js/sqlite.min.js'; 317 | if (file_exists($script_file)) { 318 | wp_enqueue_script('sqlite-integration', $script_url, 'jquery'); 319 | } 320 | } 321 | } 322 | 323 | /* this is enough for initialization */ 324 | new SQLiteIntegration; 325 | ?> -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/query_create.class.php: -------------------------------------------------------------------------------- 1 | _query = $query; 59 | $this->_errors [] = ''; 60 | if (preg_match('/^CREATE\\s*(UNIQUE|FULLTEXT|)\\s*INDEX/ims', $this->_query, $match)) { 61 | // we manipulate CREATE INDEX query in PDOEngine.class.php 62 | // FULLTEXT index creation is simply ignored. 63 | if (isset($match[1]) && stripos($match[1], 'fulltext') !== false) { 64 | return 'SELECT 1=1'; 65 | } else { 66 | return $this->_query; 67 | } 68 | } elseif (preg_match('/^CREATE\\s*(TEMP|TEMPORARY|)\\s*TRIGGER\\s*/im', $this->_query)) { 69 | // if WordPress comes to use foreign key constraint, trigger will be needed. 70 | // we don't use it for now. 71 | return $this->_query; 72 | } 73 | $this->strip_backticks(); 74 | $this->get_table_name(); 75 | $this->rewrite_comments(); 76 | $this->rewrite_field_types(); 77 | $this->rewrite_character_set(); 78 | $this->rewrite_engine_info(); 79 | $this->rewrite_unsigned(); 80 | $this->rewrite_autoincrement(); 81 | $this->rewrite_primary_key(); 82 | $this->rewrite_foreign_key(); 83 | $this->rewrite_unique_key(); 84 | $this->rewrite_enum(); 85 | $this->rewrite_set(); 86 | $this->rewrite_key(); 87 | $this->add_if_not_exists(); 88 | 89 | return $this->post_process(); 90 | } 91 | /** 92 | * Method to get table name from the query string. 93 | * 94 | * 'IF NOT EXISTS' clause is removed for the easy regular expression usage. 95 | * It will be added at the end of the process. 96 | * 97 | * @access private 98 | */ 99 | private function get_table_name(){ 100 | // $pattern = '/^\\s*CREATE\\s*(TEMP|TEMPORARY)?\\s*TABLE\\s*(IF NOT EXISTS)?\\s*([^\(]*)/imsx'; 101 | $pattern = '/^\\s*CREATE\\s*(?:TEMP|TEMPORARY)?\\s*TABLE\\s*(?:IF\\s*NOT\\s*EXISTS)?\\s*([^\(]*)/imsx'; 102 | if (preg_match($pattern, $this->_query, $matches)) { 103 | $this->table_name = trim($matches[1]); 104 | } 105 | } 106 | /** 107 | * Method to change the MySQL field types to SQLite compatible types. 108 | * 109 | * Order of the key value is important. Don't change it. 110 | * 111 | * @access private 112 | */ 113 | private function rewrite_field_types(){ 114 | $array_types = array ( 115 | 'bit' => 'integer', 'bool' => 'integer', 116 | 'boolean' => 'integer', 'tinyint' => 'integer', 117 | 'smallint' => 'integer', 'mediumint' => 'integer', 118 | 'int' => 'integer', 'integer' => 'integer', 119 | 'bigint' => 'integer', 'float' => 'real', 120 | 'double' => 'real', 'decimal' => 'real', 121 | 'dec' => 'real', 'numeric' => 'real', 122 | 'fixed' => 'real', 'date' => 'text', 123 | 'datetime' => 'text', 'timestamp' => 'text', 124 | 'time' => 'text', 'year' => 'text', 125 | 'char' => 'text', 'varchar' => 'text', 126 | 'binary' => 'integer', 'varbinary' => 'blob', 127 | 'tinyblob' => 'blob', 'tinytext' => 'text', 128 | 'blob' => 'blob', 'text' => 'text', 129 | 'mediumblob' => 'blob', 'mediumtext' => 'text', 130 | 'longblob' => 'blob', 'longtext' => 'text' 131 | ); 132 | foreach ($array_types as $o=>$r){ 133 | $pattern = "/\\b(?_query)) { 135 | ; 136 | } else { 137 | $this->_query = preg_replace($pattern, " $r ", $this->_query); 138 | } 139 | } 140 | } 141 | /** 142 | * Method for stripping the comments from the SQL statement. 143 | * 144 | * @access private 145 | */ 146 | private function rewrite_comments(){ 147 | $this->_query = preg_replace("/# --------------------------------------------------------/","-- ******************************************************",$this->_query); 148 | $this->_query = preg_replace("/#/","--",$this->_query); 149 | } 150 | /** 151 | * Method for stripping the engine and other stuffs. 152 | * 153 | * TYPE, ENGINE and AUTO_INCREMENT are removed here. 154 | * @access private 155 | */ 156 | private function rewrite_engine_info(){ 157 | $this->_query = preg_replace("/\\s*(TYPE|ENGINE)\\s*=\\s*.*(?_query); 158 | $this->_query = preg_replace("/ AUTO_INCREMENT\\s*=\\s*[0-9]*/ims",'',$this->_query); 159 | } 160 | /** 161 | * Method for stripping unsigned. 162 | * 163 | * SQLite doesn't have unsigned int data type. So UNSIGNED INT(EGER) is converted 164 | * to INTEGER here. 165 | * 166 | * @access private 167 | */ 168 | private function rewrite_unsigned(){ 169 | $this->_query = preg_replace('/\\bunsigned\\b/ims', ' ', $this->_query); 170 | } 171 | /** 172 | * Method for rewriting primary key auto_increment. 173 | * 174 | * If the field type is 'INTEGER PRIMARY KEY', it is automatically autoincremented 175 | * by SQLite. There's a little difference between PRIMARY KEY and AUTOINCREMENT, so 176 | * we may well convert to PRIMARY KEY only. 177 | * 178 | * @access private 179 | */ 180 | private function rewrite_autoincrement(){ 181 | $this->_query = preg_replace('/\\bauto_increment\\s*primary\\s*key\\s*(,)?/ims', ' PRIMARY KEY AUTOINCREMENT \\1', $this->_query, -1, $count); 182 | $this->_query = preg_replace('/\\bauto_increment\\b\\s*(,)?/ims', ' PRIMARY KEY AUTOINCREMENT $1', $this->_query, -1, $count); 183 | if ($count > 0){ 184 | $this->has_primary_key = true; 185 | } 186 | } 187 | /** 188 | * Method for rewriting primary key. 189 | * 190 | * @access private 191 | */ 192 | private function rewrite_primary_key(){ 193 | if ($this->has_primary_key) { 194 | $this->_query = preg_replace('/\\s*primary key\\s*.*?\([^\)]*\)\\s*(,|)/i', ' ', $this->_query); 195 | } else { 196 | // If primary key has an index name, we remove that name. 197 | $this->_query = preg_replace('/\\bprimary\\s*key\\s*.*?\\s*(\(.*?\))/im', 'PRIMARY KEY \\1', $this->_query); 198 | } 199 | } 200 | /** 201 | * Method for rewriting foreign key. 202 | * 203 | * @access private 204 | */ 205 | private function rewrite_foreign_key() { 206 | $pattern = '/\\s*foreign\\s*key\\s*(|.*?)\([^\)]+?\)\\s*references\\s*.*/i'; 207 | if (preg_match_all($pattern, $this->_query, $match)) { 208 | if (isset($match[1])) { 209 | $this->_query = str_ireplace($match[1], '', $this->_query); 210 | } 211 | } 212 | } 213 | /** 214 | * Method for rewriting unique key. 215 | * 216 | * @access private 217 | */ 218 | private function rewrite_unique_key(){ 219 | $this->_query = preg_replace_callback('/\\bunique key\\b([^\(]*)(\(.*\))/im', array($this, '_rewrite_unique_key'), $this->_query); 220 | } 221 | /** 222 | * Callback method for rewrite_unique_key. 223 | * 224 | * @param array $matches an array of matches from the Regex 225 | * @access private 226 | */ 227 | private function _rewrite_unique_key($matches){ 228 | $index_name = trim($matches[1]); 229 | $col_name = trim($matches[2]); 230 | $tbl_name = $this->table_name; 231 | if (preg_match('/\(\\d+?\)/', $col_name)) { 232 | $col_name = preg_replace('/\(\\d+?\)/', '', $col_name); 233 | } 234 | $_wpdb = new PDODB(); 235 | $results = $_wpdb->get_results("SELECT name FROM sqlite_master WHERE type='index'"); 236 | $_wpdb = null; 237 | if ($results) { 238 | foreach ($results as $result) { 239 | if ($result->name == $index_name) { 240 | $r = rand(0, 50); 241 | $index_name = $index_name . "_$r"; 242 | break; 243 | } 244 | } 245 | } 246 | $index_name = str_replace(' ', '', $index_name); 247 | $this->index_queries[] = "CREATE UNIQUE INDEX $index_name ON " . $tbl_name .$col_name; 248 | return ''; 249 | } 250 | /** 251 | * Method for handling ENUM fields. 252 | * 253 | * SQLite doesn't support enum, so we change it to check constraint. 254 | * 255 | * @access private 256 | */ 257 | private function rewrite_enum(){ 258 | $pattern = '/(,|\))([^,]*)enum\((.*?)\)([^,\)]*)/ims'; 259 | $this->_query = preg_replace_callback($pattern, array($this, '_rewrite_enum'), $this->_query); 260 | } 261 | /** 262 | * Call back method for rewrite_enum() and rewrite_set(). 263 | * 264 | * @access private 265 | */ 266 | private function _rewrite_enum($matches){ 267 | $output = $matches[1] . ' ' . $matches[2]. ' TEXT '. $matches[4].' CHECK ('.$matches[2].' IN ('.$matches[3].')) '; 268 | return $output; 269 | } 270 | /** 271 | * Method for rewriting usage of set. 272 | * 273 | * It is similar but not identical to enum. SQLite does not support either. 274 | * 275 | * @access private 276 | */ 277 | private function rewrite_set(){ 278 | $pattern = '/\b(\w)*\bset\\s*\((.*?)\)\\s*(.*?)(,)*/ims'; 279 | $this->_query = preg_replace_callback($pattern, array($this, '_rewrite_enum'), $this->_query); 280 | } 281 | /** 282 | * Method for rewriting usage of key to create an index. 283 | * 284 | * SQLite cannot create non-unique indices as part of the create query, 285 | * so we need to create an index by hand and append it to the create query. 286 | * 287 | * @access private 288 | */ 289 | private function rewrite_key(){ 290 | $this->_query = preg_replace_callback('/,\\s*(KEY|INDEX)\\s*(\\w+)?\\s*(\(.*(?_query); 291 | } 292 | /** 293 | * Callback method for rewrite_key. 294 | * 295 | * @param array $matches an array of matches from the Regex 296 | * @access private 297 | */ 298 | private function _rewrite_key($matches){ 299 | $index_name = trim($matches[2]); 300 | $col_name = trim($matches[3]); 301 | if (preg_match('/\([0-9]+?\)/', $col_name, $match)) { 302 | $col_name = preg_replace_callback('/\([0-9]+?\)/', array($this, '_remove_length'), $col_name); 303 | } 304 | $tbl_name = $this->table_name; 305 | $_wpdb = new PDODB(); 306 | $results = $_wpdb->get_results("SELECT name FROM sqlite_master WHERE type='index'"); 307 | $_wpdb = null; 308 | if ($results) { 309 | foreach ($results as $result) { 310 | if ($result->name == $index_name) { 311 | $r = rand(0, 50); 312 | $index_name = $index_name . "_$r"; 313 | break; 314 | } 315 | } 316 | } 317 | $this->index_queries[] = 'CREATE INDEX '. $index_name . ' ON ' . $tbl_name . $col_name ; 318 | return ''; 319 | } 320 | /** 321 | * Call back method to remove unnecessary string. 322 | * 323 | * This method is deprecated. 324 | * 325 | * @param string $match 326 | * @return string whose length is zero 327 | * @access private 328 | */ 329 | private function _remove_length($match) { 330 | return ''; 331 | } 332 | /** 333 | * Method to assemble the main query and index queries into an array. 334 | * 335 | * It return the array of the queries to be executed separately. 336 | * 337 | * @return array 338 | * @access private 339 | */ 340 | private function post_process() { 341 | $mainquery = $this->_query; 342 | do{ 343 | $count = 0; 344 | $mainquery = preg_replace('/,\\s*\)/imsx',')', $mainquery, -1, $count); 345 | } while ($count > 0); 346 | do { 347 | $count = 0; 348 | $mainquery = preg_replace('/\(\\s*?,/imsx', '(', $mainquery, -1, $count); 349 | } while ($count > 0); 350 | $return_val[] = $mainquery; 351 | $return_val = array_merge($return_val, $this->index_queries); 352 | return $return_val; 353 | } 354 | /** 355 | * Method to add IF NOT EXISTS to query string. 356 | * 357 | * This adds IF NOT EXISTS to every query string, which prevent the exception 358 | * from being thrown. 359 | * 360 | * @access private 361 | */ 362 | private function add_if_not_exists(){ 363 | $pattern_table = '/^\\s*CREATE\\s*(TEMP|TEMPORARY)?\\s*TABLE\\s*(IF NOT EXISTS)?\\s*/ims'; 364 | $this->_query = preg_replace($pattern_table, 'CREATE $1 TABLE IF NOT EXISTS ', $this->_query); 365 | $pattern_index = '/^\\s*CREATE\\s*(UNIQUE)?\\s*INDEX\\s*(IF NOT EXISTS)?\\s*/ims'; 366 | for ($i = 0; $i < count($this->index_queries); $i++) { 367 | $this->index_queries[$i] = preg_replace($pattern_index, 'CREATE $1 INDEX IF NOT EXISTS ', $this->index_queries[$i]); 368 | } 369 | } 370 | /** 371 | * Method to strip back quotes. 372 | * 373 | * @access private 374 | */ 375 | private function strip_backticks(){ 376 | $this->_query = str_replace('`', '', $this->_query); 377 | foreach ($this->index_queries as &$query) { 378 | $query = str_replace('`', '', $query); 379 | } 380 | } 381 | /** 382 | * Method to remove the character set information from within mysql queries. 383 | * 384 | * This removes DEFAULT CHAR(ACTER) SET and COLLATE, which is meaningless for 385 | * SQLite. 386 | * 387 | * @access private 388 | */ 389 | private function rewrite_character_set(){ 390 | $pattern_charset = '/\\b(default\\s*character\\s*set|default\\s*charset|character\\s*set)\\s*(?_query = preg_replace($patterns, '', $this->_query); 395 | } 396 | } 397 | ?> -------------------------------------------------------------------------------- /read-only-plugins/sqlite-integration/utilities/patch.php: -------------------------------------------------------------------------------- 1 | text_domain; 50 | $installed_plugins = array(); 51 | $file_names = array(); 52 | $output = array(); 53 | $retval = 0; 54 | $patch_results = array(); 55 | $message = ''; 56 | if (isset($_POST['plugin_checked'])) { 57 | $file_names = $_POST['plugin_checked']; 58 | } else { 59 | return false; 60 | } 61 | if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { 62 | exec('where patch 2>&1', $out, $val); 63 | } else { 64 | exec('which patch 2>&1', $out, $val); 65 | } 66 | if ($val != 0) { 67 | $patch_results['error'] = __('Patch command is not found', $domain); 68 | return $patch_results; 69 | } elseif (!is_executable(trim($out[0]))) { 70 | $patch_results['error'] = __('Patch command is not executable', $domain); 71 | return $patch_results; 72 | } else { 73 | $patch_command = trim($out[0]) . ' -s -N -p1'; 74 | } 75 | $installed_plugins = get_plugins(); 76 | foreach ($file_names as $file) { 77 | if (preg_match('/_(.*)\.patch/i', $file, $match)) { 78 | $plugin_version = trim($match[1]); 79 | $plugin_basename = preg_replace('/_.*\.patch$/i', '', $file); 80 | foreach (array_keys($installed_plugins) as $key) { 81 | if (stripos($key, $plugin_basename) !== false) { 82 | $installed_plugin_version = $installed_plugins[$key]['Version']; 83 | break; 84 | } 85 | } 86 | } else { 87 | $patch_results['error'] = __('Patch file name is invalid', $domain); 88 | break; 89 | } 90 | if (version_compare($installed_plugin_version, $plugin_version, '!=')) { 91 | $patch_results['error'] = __('Patch file version does not match with that of your plugin.', $domain); 92 | break; 93 | } 94 | $plugin_dir = WP_PLUGIN_DIR.'/'.$plugin_basename; 95 | $patch_file = SQLitePatchDir.'/'.$file; 96 | $command = $patch_command.' <'.$patch_file.' 2>&1'; 97 | if (chdir($plugin_dir)) { 98 | exec("$command", $output, $retval); 99 | } else { 100 | $patch_results[$file] = __('Error! Plugin directory is not accessible.', $domain); 101 | } 102 | if ($retval == 0) { 103 | $patch_results[$file] = __('is patched successfully.', $domain); 104 | } else { 105 | foreach ($output as $val) { 106 | $message .= $val.'
'; 107 | } 108 | $patch_results[$file] = sprintf(__('Error! Messages: %s', $domain), $message); 109 | } 110 | } 111 | return $patch_results; 112 | } 113 | /** 114 | * Method to remove patch file(s) from the server. 115 | * 116 | * It deletes uploaded patch file(s). 117 | * If patch file(s) is not selected, returns false. 118 | * Or else returns array contains messages. 119 | * 120 | * @return boolean|array 121 | * @access private 122 | */ 123 | private function delete_patch_files() { 124 | global $utils; 125 | $domain = $utils->text_domain; 126 | $file_names = array(); 127 | $rm_results = array(); 128 | if (isset($_POST['plugin_checked'])) { 129 | $file_names = $_POST['plugin_checked']; 130 | } else { 131 | return false; 132 | } 133 | if (chdir(SQLitePatchDir)) { 134 | foreach ($file_names as $file) { 135 | if (unlink($file)) { 136 | $rm_results[$file] = sprintf(__('File %s is deleted.', $domain), $file); 137 | } else { 138 | $rm_results[$file] = sprintf(__('Error! File %s is not deleted.', $domain), $file); 139 | } 140 | } 141 | } else { 142 | $rm_results[$file] = __('Error!: patches directory is not accessible.', $domain); 143 | } 144 | return $rm_results; 145 | } 146 | /** 147 | * Method to upload patch file(s) to the server. 148 | * 149 | * It uploads a patch file to the server. You must have the permission to write to the 150 | * temporary directory. If there isn't SQLitePatchDir, this method will create it and 151 | * set the permission to 0707. 152 | * 153 | * No return values. 154 | * 155 | * @return boolean 156 | * @access private 157 | */ 158 | private function upload_file() { 159 | global $utils; 160 | $domain = $utils->text_domain; 161 | if (!file_exists(SQLitePatchDir) || !is_dir(SQLitePatchDir)) { 162 | if (!mkdir(SQLitePatchDir, 0707, true)) { 163 | $message = __('Unable to create a patch directory.', $domain); 164 | echo '

'.$message.'
'; 165 | return false; 166 | } 167 | } 168 | if (!is_file(SQLitePatchDir . '/.htaccess')) { 169 | $fp = fopen(SQLitePatchDir . '/.htaccess', 'w'); 170 | if (!$fp) { 171 | $message = __('Unable to create a .htaccess file.', $domain); 172 | echo '
'.$message.'
'; 173 | return false; 174 | } 175 | fwrite($fp, 'DENY FROM ALL'); 176 | fclose($fp); 177 | } 178 | if (!isset($_FILES['upfile']['error']) || !is_int($_FILES['upfile']['error'])) { 179 | $message = __('Invalid operation.', $domain); 180 | echo '
'.$message.'
'; 181 | return false; 182 | } elseif ($_FILES['upfile']['error'] != UPLOAD_ERR_OK) { 183 | switch ($_FILES['upfile']['error']) { 184 | case UPLOAD_ERR_FORM_SIZE: 185 | $message = __('File is too large to upload.', $domain); 186 | echo '
'.$message.'
'; 187 | break; 188 | case UPLOAD_ERR_PARTIAL: 189 | $message = __('File upload is not complete.', $domain); 190 | echo '
'.$message.'
'; 191 | break; 192 | case UPLOAD_ERR_NO_FILE: 193 | $message = __('File is not uploaded.', $domain); 194 | echo '
'.$message.'
'; 195 | break; 196 | case UPLOAD_ERR_NO_TMP_DIR: 197 | $message = __('Temporary directory is not writable.', $domain); 198 | echo '
'.$message.'
'; 199 | break; 200 | case UPLOAD_ERR_CANT_WRITE: 201 | $message = __('File cannot be written on the disk.', $domain); 202 | echo '
'.$message.'
'; 203 | break; 204 | default: 205 | $message = __('Unknown error.', $domain); 206 | break; 207 | } 208 | return false; 209 | } 210 | if (is_uploaded_file($_FILES['upfile']['tmp_name'])) { 211 | $file_full_path = SQLitePatchDir . '/' . $_FILES['upfile']['name']; 212 | if (move_uploaded_file($_FILES['upfile']['tmp_name'], $file_full_path)) { 213 | $message = __('File is successfully uploaded.', $domain); 214 | echo '
'.$message.'
'; 215 | chmod(SQLitePatchDir.'/'.$_FILES['upfile']['name'], 0606); 216 | } else { 217 | $message = __('File upload failed. Possible file upload attack.', $domain); 218 | echo '
'.$message.'
'; 219 | return false; 220 | } 221 | } else { 222 | $message = __('File is not selected', $domain); 223 | echo '
'.$message.'
'; 224 | return false; 225 | } 226 | return true; 227 | } 228 | /** 229 | * Method to display the patch utility page on the admin panel. 230 | * 231 | */ 232 | function show_patch_page() { 233 | global $utils; 234 | $domain = $utils->text_domain; 235 | if (is_multisite() && !current_user_can('manage_network_options')) { 236 | die(__('You are not allowed to access this page!', $domain)); 237 | } elseif (!current_user_can('manage_options')) { 238 | die(__('You are not allowed to access this page!', $domain)); 239 | } 240 | if (isset($_POST['apply_patch'])) { 241 | check_admin_referer('sqlitewordpress-plugin-manip-stats'); 242 | if (is_multisite() && !current_user_can('manage_network_options')) { 243 | die(__('You are not allowed to do this operation!', $domain)); 244 | } elseif (!current_user_can('manage_options')) { 245 | die(__('You are not allowed to do this operation!', $domain)); 246 | } 247 | $result = $this->apply_patches(); 248 | if ($result === false) { 249 | $message = __('Please select patch file(s)', $domain); 250 | echo '
'.$message.'
'; 251 | } elseif (is_array($result) && count($result) > 0) { 252 | echo '
'; 253 | foreach ($result as $key => $val) { 254 | echo $key.' => '.$val.'
'; 255 | } 256 | echo '
'; 257 | } else { 258 | $message = __('None of the patches is applied!'); 259 | echo '
'.$message.'
'; 260 | } 261 | } 262 | if (isset($_POST['patch_file_delete'])) { 263 | check_admin_referer('sqlitewordpress-plugin-manip-stats'); 264 | if (is_multisite() && !current_user_can('manage_network_options')) { 265 | die(__('You are not allowed to do this operation!', $domain)); 266 | } elseif (!current_user_can('manage_options')) { 267 | die(__('You are not allowed to do this operation!', $domain)); 268 | } 269 | $result = $this->delete_patch_files(); 270 | if ($result === false) { 271 | $message = __('Please select patch file(s)', $domain); 272 | echo '
'.$message.'
'; 273 | } elseif (is_array($result) && count($result) > 0) { 274 | echo '
'; 275 | foreach ($result as $key => $val) { 276 | echo $key.' => '.$val.'
'; 277 | } 278 | echo '
'; 279 | } else { 280 | $message = __('Error! Please remove files manually', $domain); 281 | echo '
'.$message.'
'; 282 | } 283 | } 284 | if (isset($_POST['upload'])) { 285 | check_admin_referer('sqlitewordpress-plugin-patch-file-stats'); 286 | if (is_multisite() && !current_user_can('manage_network_options')) { 287 | die(__('You are not allowed to do this operation!', $domain)); 288 | } elseif (!current_user_can('manage_options')) { 289 | die(__('You are not allowed to do this operation!', $domain)); 290 | } 291 | $result = $this->upload_file(); 292 | } 293 | if (isset($_GET['page']) && $_GET['page'] == 'patch') : ?> 294 | 303 |
304 |

305 |

306 |

307 | Plugin Page about how to apply a patch file to the plugin. But the command line interface sometimes embarrasses some people, especially newbies.', $domain);?> 308 |

309 |

310 | 311 |

312 |
    313 |
  1. Plugin Directory for the substitutes?', $domain)?>
  2. 314 |
  3. 315 |
  4. 316 |
  5. 317 |
318 |

319 | 320 |

321 |

322 | 323 |

324 |
    325 |
  1. 326 |
  2. 327 |
  3. 328 |
  4. 329 |
330 |

331 | 332 |

333 | 334 |

335 |
    336 |
  1. 337 |
  2. 338 |
  3. 339 |
340 |

341 |

342 | 343 |

344 |
    345 |
  1. 346 |
  2. 347 |
  3. 348 |
  4. 349 |
350 |

351 |

352 | 353 | 354 | 355 | 356 | 368 | 369 | 370 | 371 | 403 | 404 | 405 |
357 |
358 | 362 | 363 |
364 | 365 | 366 |
367 |
372 |
373 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | get_patch_files(); 387 | if (!empty($files)) : ?> 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 |
397 |

398 | 399 | 400 |

401 |
402 |
406 |
407 | 408 |
409 |
410 | 411 |
412 |
413 |

414 | 415 |

416 |
417 |
418 | --------------------------------------------------------------------------------