diff --git a/DatabaseRegister.java b/DatabaseRegister.java
new file mode 100644
index 0000000..d81452e
--- /dev/null
+++ b/DatabaseRegister.java
@@ -0,0 +1,111 @@
+//同じディレクトリにmysqlのドライバ(mysql-connector-java-5.1.36)を置くこと
+import java.io.*;
+import java.sql.*;
+import java.text.*;
+
+//データベースへの位置情報登録を実行する
+public class DatabaseRegister{
+ //ここはメソッドで適宜変更
+ private String domain = "localhost";
+ private int port = 3306;
+ private String dbname = "enPiT2015_ITW";
+ private String user_name = "hoge";
+ private String password = "piyo";
+ private Connection conn = null;
+
+ DatabaseRegister(){//デフォルトコンストラクタ
+
+ }
+
+ //アドレス、ポート番号、データベース名を設定
+ public void setDatabaseInfo(String domain, int port, String dbname){
+ this.domain = domain;
+ this.port = port;
+ this.dbname = dbname;
+ }
+
+ //ユーザID、パスワードを指定
+ public void setDatabaseUserInfo(String user_name, String password){
+ this.user_name = user_name;
+ this.password = password;
+ }
+
+ public boolean connectDB(){
+ try{
+ Class.forName("com.mysql.jdbc.Driver").newInstance();
+ String url = "jdbc:mysql://" + this.domain + ":" + this.port + "/" + dbname;
+ this.conn = DriverManager.getConnection(url, this.user_name, this.password);
+ //System.out.println("接続に成功しました");
+ return true;
+ }
+ catch (Exception e){
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ //ユーザIDの存在を確認
+ public boolean exists(int user_id){
+ try{
+ Statement stmt = this.conn.createStatement();
+ String sql = "SELECT * FROM positions WHERE user_id = " + user_id;
+ ResultSet rs = stmt.executeQuery(sql);
+ if(rs.next()){
+ return true;
+ }
+ else{
+ return false;
+ }
+ }catch(Exception e){
+ e.printStackTrace();
+ return false;
+ }
+
+ }
+
+ //位置情報データを登録
+ public boolean insertPositions(int user_id, double latitude, double longitude, Timestamp date){//データベースのidはどうする?
+ try{
+ Statement stmt = this.conn.createStatement();
+ String sql = "INSERT INTO positions (user_id, latitude, longitude, date) values (\'" + user_id + "\',\'" + latitude + "\',\'" + longitude + "\',\'" + date + "\')";
+ int num = stmt.executeUpdate(sql);
+ return true;
+ }catch(Exception e){
+ e.printStackTrace();
+ return false;
+ }
+
+ }
+
+ //位置情報データを更新
+ public boolean updatePositions(int user_id, double latitude, double longitude, Timestamp date){
+ try{
+ Statement stmt = this.conn.createStatement();
+ String sql = "UPDATE positions SET latitude = " + latitude + ", longitude = " + longitude + ", date = \'" + date + "\' WHERE user_id = " + user_id;
+ int num = stmt.executeUpdate(sql);
+ return true;
+ }catch(Exception e){
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ public boolean closeDB(){
+ try{
+ if(conn != null){
+ conn.close();
+ // System.out.println("データベース切断に成功しました");
+ return true;
+ }
+ else{
+ //System.out.println("コネクションがありません");
+ return false;
+ }
+ }
+ catch (SQLException e){
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+}
diff --git a/DatabaseTest2.java b/DatabaseTest2.java
new file mode 100644
index 0000000..bd23ec4
--- /dev/null
+++ b/DatabaseTest2.java
@@ -0,0 +1,39 @@
+import java.sql.Timestamp;
+import java.text.*;
+
+class DatabaseTest2{
+ //このmain関数を参考にサーバへ組み込む
+ public static void main(String args[]){
+ DatabaseRegister dr = new DatabaseRegister();
+ //データベースに接続
+ if(!dr.connectDB()){
+ System.out.println("データベース接続に失敗");
+ }
+ else{
+ //入力データは,区切りのStringと仮定
+ String dummy = "12,35.689521,139.691704,2015/09/21 17:09:00";
+ String[] positions = dummy.split(",", 0);
+ int user_id = Integer.parseInt(positions[0]);
+ double lat = Double.parseDouble(positions[1]);
+ double lon = Double.parseDouble(positions[2]);
+ Timestamp date = null;
+ try{
+ Long dateTimeLong = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").parse(positions[3]).getTime();
+ date = new Timestamp(dateTimeLong);
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+
+ System.out.println(user_id + " " + lat + " " + lon + " " + date);
+
+ if(dr.exists(user_id)){
+ dr.updatePositions(user_id, lat, lon, date);
+ }
+ else{
+ dr.insertPositions(user_id, lat, lon, date);
+ }
+ //データベースを閉じる
+ dr.closeDB();
+ }
+ }
+}
diff --git a/MIClient/.gitignore b/MIClient/.gitignore
new file mode 100644
index 0000000..9c4de58
--- /dev/null
+++ b/MIClient/.gitignore
@@ -0,0 +1,7 @@
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
diff --git a/MIClient/.idea/.name b/MIClient/.idea/.name
new file mode 100644
index 0000000..66a673c
--- /dev/null
+++ b/MIClient/.idea/.name
@@ -0,0 +1 @@
+MIClient
\ No newline at end of file
diff --git a/MIClient/.idea/compiler.xml b/MIClient/.idea/compiler.xml
new file mode 100644
index 0000000..734b743
--- /dev/null
+++ b/MIClient/.idea/compiler.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MIClient/.idea/copyright/profiles_settings.xml b/MIClient/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/MIClient/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/MIClient/.idea/encodings.xml b/MIClient/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/MIClient/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MIClient/.idea/gradle.xml b/MIClient/.idea/gradle.xml
new file mode 100644
index 0000000..7d80135
--- /dev/null
+++ b/MIClient/.idea/gradle.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MIClient/.idea/misc.xml b/MIClient/.idea/misc.xml
new file mode 100644
index 0000000..22b2cf0
--- /dev/null
+++ b/MIClient/.idea/misc.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.7
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MIClient/.idea/modules.xml b/MIClient/.idea/modules.xml
new file mode 100644
index 0000000..7207924
--- /dev/null
+++ b/MIClient/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MIClient/.idea/runConfigurations.xml b/MIClient/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/MIClient/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MIClient/.idea/vcs.xml b/MIClient/.idea/vcs.xml
new file mode 100644
index 0000000..6564d52
--- /dev/null
+++ b/MIClient/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MIClient/MIClient.iml b/MIClient/MIClient.iml
new file mode 100644
index 0000000..77b191d
--- /dev/null
+++ b/MIClient/MIClient.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MIClient/app/.gitignore b/MIClient/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/MIClient/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/MIClient/app/app.iml b/MIClient/app/app.iml
new file mode 100644
index 0000000..877afb8
--- /dev/null
+++ b/MIClient/app/app.iml
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ generateDebugAndroidTestSources
+ generateDebugSources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MIClient/app/build.gradle b/MIClient/app/build.gradle
new file mode 100644
index 0000000..e4aa9e4
--- /dev/null
+++ b/MIClient/app/build.gradle
@@ -0,0 +1,37 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 19
+ buildToolsVersion "23.0.1"
+
+ defaultConfig {
+ applicationId "com.example.enpit_itw.miclient"
+ minSdkVersion 10
+ targetSdkVersion 10
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+repositories {
+ mavenCentral();
+ maven{
+ url "http://dl.bintray.com/journeyapps/maven"
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ testCompile 'junit:junit:4.12'
+ compile 'com.android.support:appcompat-v7:19.1.0'
+// compile 'com.android.support:support-v4:+'
+
+ compile 'com.journeyapps:zxing-android-embedded:3.0.1@aar'
+ compile 'com.google.zxing:core:3.2.0'
+}
diff --git a/MIClient/app/proguard-rules.pro b/MIClient/app/proguard-rules.pro
new file mode 100644
index 0000000..ca1e92a
--- /dev/null
+++ b/MIClient/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\yoshikawa\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/MIClient/app/src/androidTest/java/com/example/enpit_itw/miclient/ApplicationTest.java b/MIClient/app/src/androidTest/java/com/example/enpit_itw/miclient/ApplicationTest.java
new file mode 100644
index 0000000..9a237a8
--- /dev/null
+++ b/MIClient/app/src/androidTest/java/com/example/enpit_itw/miclient/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.example.enpit_itw.miclient;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/MIClient/app/src/main/AndroidManifest.xml b/MIClient/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..bf6d653
--- /dev/null
+++ b/MIClient/app/src/main/AndroidManifest.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MIClient/app/src/main/java/com/example/enpit_itw/miclient/CaptureActivityAnyOrientation.java b/MIClient/app/src/main/java/com/example/enpit_itw/miclient/CaptureActivityAnyOrientation.java
new file mode 100644
index 0000000..3de4d52
--- /dev/null
+++ b/MIClient/app/src/main/java/com/example/enpit_itw/miclient/CaptureActivityAnyOrientation.java
@@ -0,0 +1,6 @@
+package com.example.enpit_itw.miclient;
+
+import com.journeyapps.barcodescanner.CaptureActivity;
+
+public class CaptureActivityAnyOrientation extends CaptureActivity{
+}
diff --git a/MIClient/app/src/main/java/com/example/enpit_itw/miclient/GetId.java b/MIClient/app/src/main/java/com/example/enpit_itw/miclient/GetId.java
new file mode 100644
index 0000000..c9013e2
--- /dev/null
+++ b/MIClient/app/src/main/java/com/example/enpit_itw/miclient/GetId.java
@@ -0,0 +1,104 @@
+package com.example.enpit_itw.miclient;
+
+import android.content.DialogInterface;
+import android.os.AsyncTask;
+import android.util.Log;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.util.EntityUtils;
+
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+public class GetId extends AsyncTask implements DialogInterface.OnCancelListener{
+ final String TAG = "GetId";
+
+ List nameValuePair;
+ HttpResponse response;
+ ByteArrayOutputStream byteArrayOutputStream;
+ HttpResponse res = null;
+ Integer user_id = null;
+
+ private static final String url = "http://192.168.1.58/getid.php";
+
+ //RegFriendsへのコールバック用interface
+ public interface AsyncTaskCallback{
+ void postExecute(String result);
+ }
+ private AsyncTaskCallback callback = null;
+ public GetId(AsyncTaskCallback _callback){
+ this.callback = _callback;
+ }
+
+ @Override
+ protected void onPreExecute(){
+ Log.d(TAG, "onPreExecute");
+ }
+
+ @Override
+ protected Integer doInBackground(String... contents){
+ ArrayList params = new ArrayList();
+ DefaultHttpClient httpClient = new DefaultHttpClient();
+ HttpPost post;
+ post = new HttpPost(url);
+ SessionSync.user_idHttpClient(httpClient);
+
+ try{
+ res = httpClient.execute(post);
+
+ byteArrayOutputStream = new ByteArrayOutputStream();
+ res.getEntity().writeTo(byteArrayOutputStream);
+ }catch (Exception e){
+ Log.v("MyAsyncTask", e.toString());
+ return -1;
+ }
+
+ return Integer.valueOf(res.getStatusLine().getStatusCode());
+ }
+
+ @Override
+ protected void onProgressUpdate(Integer... values){
+ Log.d(TAG, "onProgressUpdate - " + values[0]);
+ }
+
+ @Override
+ protected void onCancelled(){
+ Log.d(TAG, "onCancelled");
+ }
+
+ @Override
+ protected void onPostExecute(Integer result) {
+ Log.d(TAG, "onPostExecute - " + result);
+
+ if(result == -1){
+ //通信に失敗
+ Log.d(TAG, "communication error");
+ return;
+ }else{
+ Log.d(TAG, "Status : " + res.getStatusLine().getStatusCode());
+ }
+ //サーバーからの応答を取得
+ if(res.getStatusLine().getStatusCode() == HttpStatus.SC_OK){
+ try{
+ Log.d(TAG, "サーバからの応答 : " + EntityUtils.toString(res.getEntity()));
+ }catch(Exception e){
+ Log.d(TAG, "Entityが空");
+ }
+ String UserId = byteArrayOutputStream.toString();
+ callback.postExecute(UserId);
+ }else{
+ Log.v(TAG, "サーバからの応答がありませんでした。");
+ }
+ }
+
+ @Override
+ public void onCancel(DialogInterface dialog){
+ Log.d(TAG, "Dialog onCancel... calling cancel(true)");
+ this.cancel(true);
+ }
+}
diff --git a/MIClient/app/src/main/java/com/example/enpit_itw/miclient/LocationSendingService.java b/MIClient/app/src/main/java/com/example/enpit_itw/miclient/LocationSendingService.java
new file mode 100644
index 0000000..2ff222c
--- /dev/null
+++ b/MIClient/app/src/main/java/com/example/enpit_itw/miclient/LocationSendingService.java
@@ -0,0 +1,97 @@
+package com.example.enpit_itw.miclient;
+
+import android.Manifest;
+import android.app.Service;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.location.Criteria;
+import android.location.Location;
+import android.location.LocationListener;
+import android.location.LocationManager;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.support.v4.content.ContextCompat;
+import android.text.format.Time;
+import android.util.Log;
+import android.widget.Toast;
+
+import java.text.DecimalFormat;
+
+/**
+ * Created by yoshikawa on 2015/11/18.
+ */
+public class LocationSendingService extends Service implements LocationListener{
+ private final String TAG = "SimpleService";
+ LocationManager loc;
+ MyAsyncTask task;
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ Log.i(TAG, "onCreate");
+ Criteria criteria = new Criteria();
+ criteria.setAccuracy(Criteria.ACCURACY_FINE);
+
+ //LocationManagerインスタンスの生成
+ loc = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId){
+ Log.i(TAG, "onStartCommand");
+ if(loc != null){
+ loc.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 100, this);
+ Log.d("位置情報設定","True");
+
+ }
+ return START_STICKY;
+ }
+
+ @Override
+ public IBinder onBind(Intent intent){
+ return null;
+ }
+
+ @Override
+ public void onDestroy(){
+ super.onDestroy();
+ Log.i(TAG, "onDestroy");
+ if(loc != null) {
+ loc.removeUpdates(this);
+ }
+
+ }
+
+ public void onLocationChanged(Location location){
+ //小数点以下の桁数を揃える
+ DecimalFormat df=new DecimalFormat();
+ df.setMaximumFractionDigits(14);
+ df.setMinimumFractionDigits(14);
+
+ //緯度を取得
+ double latitude = location.getLatitude();
+ String Lat = df.format(new Double(latitude));
+
+ //経度を取得
+ double longitude = location.getLongitude();
+ String Lon = df.format(new Double(longitude));
+
+ //時間を取得
+ Time time = new Time("Asia/Tokyo");
+ time.setToNow();
+ String date = time.year + "-" + (time.month+1) + "-" + time.monthDay + " " + time.hour + ":" + time.minute + ":" + time.second;
+ //Toast.makeText(this, Lat + " ," + Lon, Toast.LENGTH_SHORT).show();
+
+ task= new MyAsyncTask();
+ task.execute("position", Lat, Lon, date);
+
+ Log.v("ReceiverActivity", "経度 : " + Lat + " 緯度 : " + Lon + " 取得時間 : " + date);
+ }
+
+ public void onProviderDisabled(String provider){}
+
+ public void onProviderEnabled(String provider){}
+
+ public void onStatusChanged(String provider, int status, Bundle extras){}
+
+}
diff --git a/MIClient/app/src/main/java/com/example/enpit_itw/miclient/MainActivity.java b/MIClient/app/src/main/java/com/example/enpit_itw/miclient/MainActivity.java
new file mode 100644
index 0000000..5329acb
--- /dev/null
+++ b/MIClient/app/src/main/java/com/example/enpit_itw/miclient/MainActivity.java
@@ -0,0 +1,142 @@
+package com.example.enpit_itw.miclient;
+
+import android.app.Activity;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.location.Criteria;
+import android.location.LocationManager;
+import android.os.Bundle;
+import android.os.Message;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.webkit.WebChromeClient;
+import android.webkit.WebSettings;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+import android.widget.ImageView;
+import android.widget.ShareActionProvider;
+
+import java.io.BufferedWriter;
+import java.net.Socket;
+
+public class MainActivity extends Activity{
+
+ MyAsyncTask task;
+ LocationManager loc;
+ WebView webview;
+ ImageView image;
+ PendingIntent pendingintent;
+ Context context;
+ Socket connection;
+ BufferedWriter writer;
+ String user_id;
+ private ShareActionProvider mShareActionProvider;
+ final String url = "http://192.168.1.58/cakephp/Users/login";
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ //WebViewインスタンスを生成
+ webview = (WebView) findViewById(R.id.webview);
+
+ //JavaScriptを有効にする
+ webview.getSettings().setJavaScriptEnabled(true);
+
+ //新しいタブ・ウィンドウをWebviewないで立ち上げられるようにする
+ webview.getSettings().setSupportMultipleWindows(true);
+
+ //あたらしいWindowやタブをChromeを立ち上げずにWebView内で立ち上げる
+ webview.setWebViewClient(new WebViewClient() {
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url) {
+ return false;
+ }
+ /*
+ @Override
+ public void onPageFinished(WebView view, String url){
+ super.onPageFinished(view, url);
+ if(!SessionSync.user_idHttpClient().equals("Fault")){
+ user_id = SessionSync.user_idHttpClient();
+ }
+ }
+ */
+ });
+
+ //ネットワークに接続していないときはキャッシュを表示する
+ webview.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
+
+ //指定したURLをWebビューに設定する
+ webview.loadUrl(url);
+
+
+ //位置情報取得時に実行するインテントを生成
+ //Intent intent = new Intent(this, ReceiverActivity.class);
+ //pendingintent = PendingIntent.getActivity(this, 0, intent, 0);
+
+ //精度を設定
+ // Criteria criteria = new Criteria();
+ // criteria.setAccuracy(Criteria.ACCURACY_FINE);
+
+ //LocationManagerインスタンスの生成
+ // loc = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
+ Intent i = new Intent(this, com.example.enpit_itw.miclient.LocationSendingService.class);
+ startService(i);
+
+
+ }
+
+ //バーにボタンを追加する
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ //「action_bar_menu2.xml」で定義したメニュー項目を適用する
+ getMenuInflater().inflate(R.menu.action_bar_menu2, menu);
+ //return super.onCreateOptionsMenu(menu);
+ return true;
+ }
+
+ //バーのボタンを押されたとき
+ @Override
+ public boolean onMenuItemSelected(int featureId, MenuItem item){
+ switch(item.getItemId()) {
+ case R.id.menu_reg:
+ // 編集画面への遷移処理
+ Intent edit_intent = new Intent(MainActivity.this, RegFriends.class);
+ startActivity(edit_intent);
+ break;
+ default:
+ break;
+ }
+ return super.onMenuItemSelected(featureId, item);
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ //位置情報更新の設定(更新時間:50秒、更新距離:1m)
+
+ }
+
+ //位置情報が更新された時
+
+ public void onStartClick(View view) {
+ Intent i = new Intent(this, com.example.enpit_itw.miclient.LocationSendingService.class);
+ startService(i);
+ }
+
+ public void onStopClick(View view) {
+ Intent i = new Intent(this, com.example.enpit_itw.miclient.LocationSendingService.class);
+ stopService(i);
+ }
+
+ @Override
+ protected void onDestroy(){
+ Intent i = new Intent(this, com.example.enpit_itw.miclient.LocationSendingService.class);
+ stopService(i);
+ super.onDestroy();
+
+
+ }
+}
diff --git a/MIClient/app/src/main/java/com/example/enpit_itw/miclient/MyAsyncTask.java b/MIClient/app/src/main/java/com/example/enpit_itw/miclient/MyAsyncTask.java
new file mode 100644
index 0000000..d8ca29a
--- /dev/null
+++ b/MIClient/app/src/main/java/com/example/enpit_itw/miclient/MyAsyncTask.java
@@ -0,0 +1,152 @@
+package com.example.enpit_itw.miclient;
+
+import android.app.Activity;
+import android.content.DialogInterface;
+import android.os.AsyncTask;
+import android.util.Log;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by yoshikawa on 2015/11/01.
+ */
+public class MyAsyncTask extends AsyncTask implements DialogInterface.OnCancelListener {
+ final String TAG = "MyAsyncTask";
+
+ private Activity m_Activity;
+
+ private static final String url = "http://192.168.1.58/position_registor.php";
+ private static final String urlF = "http://192.168.1.58/friend_registor.php";
+ private static final String urlP = "http://192.168.1.58/parent_registor.php";
+
+
+ List nameValuePair;
+ HttpResponse response;
+ ByteArrayOutputStream byteArrayOutputStream;
+ HttpResponse res = null;
+
+ /*public MyAsyncTask(Activity activity) {
+ this.m_Activity = activity;
+ }*/
+
+
+ @Override
+ protected void onPreExecute() {
+ Log.d(TAG, "onPreExecute");
+ }
+
+ @Override
+ protected Integer doInBackground(String... contents) {
+ ArrayList params = new ArrayList();
+ DefaultHttpClient httpClient = new DefaultHttpClient();
+ HttpPost post;
+
+
+ if(contents[0] == "friends") {
+ Log.d(TAG, "doInBackground - " + contents[1]);
+ post = new HttpPost(urlF);
+
+ params.add(new BasicNameValuePair("friend_id", contents[1]));
+ params.add(new BasicNameValuePair("user_id", contents[2]));
+ }else if(contents[0] == "position"){
+ Log.d(TAG, "doInBackground - " + contents[1] + contents[2]);
+ post = new HttpPost(url);
+ // SessionSync.webView2HttpClient(httpClient);
+
+ params.add(new BasicNameValuePair("lat", contents[1]));
+ params.add(new BasicNameValuePair("lon", contents[2]));
+ params.add(new BasicNameValuePair("date", contents[3]));
+ //params.add(new BasicNameValuePair("user_id", contents[4]));
+ }else if(contents[0] == "parent"){
+ Log.d(TAG, "doInBackground - " + contents[1]);
+ post = new HttpPost(urlP);
+
+ params.add(new BasicNameValuePair("parent_id", contents[1]));
+ params.add(new BasicNameValuePair("user_id", contents[2]));
+ }else{
+ Log.v(TAG, "contents error!");
+ return -1;
+ }
+
+ try {
+ SessionSync.webView2HttpClient(httpClient);
+ post.setEntity(new UrlEncodedFormEntity(params, "utf-8"));
+ res = httpClient.execute(post);
+
+ byteArrayOutputStream = new ByteArrayOutputStream();
+ res.getEntity().writeTo(byteArrayOutputStream);
+ }
+ catch(Exception e){
+ Log.v("MyAsyncTask", e.toString());
+ return -1;
+ }
+
+ return Integer.valueOf(res.getStatusLine().getStatusCode());
+
+ }
+
+ @Override
+ protected void onProgressUpdate(Integer... values) {
+ Log.d(TAG, "onProgressUpdate - " + values[0]);
+
+ }
+
+ @Override
+ protected void onCancelled() {
+ Log.d(TAG, "onCancelled");
+
+ }
+
+ @Override
+ protected void onPostExecute(Integer result) {
+ Log.d(TAG, "onPostExecute - " + result);
+
+ if(result == -1) {//通信に失敗
+ Log.d(TAG, "communication error");
+ return;
+ }
+ else{
+ Log.d(TAG,"Status : " + res.getStatusLine().getStatusCode());
+ }
+ //サーバーからの応答を取得
+ if(res.getStatusLine().getStatusCode() == HttpStatus.SC_OK)
+ {
+ try {
+ Log.d(TAG, "サーバからの応答 : " + EntityUtils.toString(res.getEntity()));
+ }
+ catch(Exception e){
+ Log.d(TAG, "Entityが空");
+ }
+ /*
+ if(byteArrayOutputStream.toString().equals("1")){
+ Toast.makeText(this.m_Activity, "[ここには処理1] ", Toast.LENGTH_LONG).show();
+ }else{
+ Toast.makeText(this.m_Activity, "[ここには処理2] ", Toast.LENGTH_LONG).show();
+ }
+ */
+ }
+ else
+ {
+ Log.d(TAG, "error(connection?)");
+ //Toast.makeText(this.m_Activity, "[error]: "+response.getStatusLine(), Toast.LENGTH_LONG).show();
+ }
+ }
+
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ Log.d(TAG, "Dialog onCancel... calling cancel(true)");
+ this.cancel(true);
+ }
+}
diff --git a/MIClient/app/src/main/java/com/example/enpit_itw/miclient/QRCodeCreate.java b/MIClient/app/src/main/java/com/example/enpit_itw/miclient/QRCodeCreate.java
new file mode 100644
index 0000000..efbbf52
--- /dev/null
+++ b/MIClient/app/src/main/java/com/example/enpit_itw/miclient/QRCodeCreate.java
@@ -0,0 +1,70 @@
+package com.example.enpit_itw.miclient;
+
+import android.os.Bundle;
+import android.support.v7.app.ActionBarActivity;
+
+/*
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.WriterException;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.qrcode.QRCodeWriter;
+*/
+public class QRCodeCreate extends ActionBarActivity {
+ @Override
+ public void onCreate(Bundle savedInstanceState){
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.qrcodecreate);
+ /*
+ //受け取ったインテントを取得
+ Intent intent = getIntent();
+ showIntentData(intent);
+ */
+ }
+
+ /*
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu){
+ getMenuInflater().inflate(R.menu.qr, menu);
+ return true;
+ }
+ */
+
+ /*
+ private void showIntentData(Intent intent){
+ //QRコードの作成
+ try {
+ //インテントからBundleを取得
+ Bundle bundle = intent.getExtras();
+
+ //ユーザIDオブジェクトを取得
+ String number = (String) bundle.get("userID");
+
+ QRCodeWriter writer = new QRCodeWriter();
+ //エンコード
+ BitMatrix bm = null;
+ bm = writer.encode(number, BarcodeFormat.QR_CODE, 100, 100);
+ //ピクセルを作る
+ int width = bm.getWidth();
+ int height = bm.getHeight();
+ int[] pixels = new int[width * height];
+ //データがあるところだけ黒にする
+ for(int y=0; y 1){friend_id = friend_id.substring(1);}
+ }
+ task = new MyAsyncTask();
+ checkbox = (CheckBox) findViewById(R.id.parent_check);
+ if(checkbox.isChecked() == true){
+ task.execute("parent", friend_id, String.valueOf(user_id));
+ }
+ else{
+ task.execute("friends", friend_id, String.valueOf(user_id));
+ }
+ }
+ });
+
+ Button qr_reader = (Button)findViewById(R.id.qr_reader);
+ qr_reader.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ //処理を書く
+ Log.v("event", "open reader!");
+ //Toast.makeText(this, "リーダーが開きます", Toast.LENGTH_SHORT).show();
+
+ IntentIntegrator integrator = new IntentIntegrator(RegFriends.this);
+ integrator.setCaptureActivity(CaptureActivityAnyOrientation.class);
+ integrator.setOrientationLocked(false);
+ integrator.initiateScan();
+ }
+ });
+
+ createQRcode();
+ }
+
+ public void postExecute(String result){
+ TextView idText = (TextView) this.findViewById(R.id.idText);
+ user_id = Integer.parseInt(result);//実際はここに取得した自分のIDが入る
+ USERID = String.format("%1$09d", user_id);//9桁にそろえる(先頭0埋め)
+ idText.setText(USERID.substring(0,3) + " " + USERID.substring(3,6) + " " + USERID.substring(6,9));
+ createQRcode();
+ }
+
+ //バーにボタンを追加する
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ //「reg.xml」で定義したメニュー項目を適用する
+ getMenuInflater().inflate(R.menu.reg, menu);
+ //return super.onCreateOptionsMenu(menu);
+ return true;
+ }
+
+ //バーのボタンを押されたとき
+ @Override
+ public boolean onMenuItemSelected(int featureId, MenuItem item){
+ switch(item.getItemId()) {
+ case R.id.action_del:
+ // メイン画面に戻る
+ this.finish();
+ break;
+ default:
+ break;
+ }
+ return super.onMenuItemSelected(featureId, item);
+ }
+
+ //ボタンを押したとき
+ @Override
+ public void onClick(View v){}
+
+ private void createQRcode() {
+ Bitmap qr = null;
+ try{
+ qr = createQRCodeByZxing("####################"+USERID, 600);
+ }catch (WriterException e){
+ Log.d("createQRCode", "error:", e);
+ }
+
+ //QRコードの表示
+ ImageView QRCodeImage = (ImageView)findViewById(R.id.qr_image);
+ QRCodeImage.setImageBitmap(qr);
+
+ try{
+ File root = Environment.getExternalStorageDirectory();
+
+ //日付でファイル名を作成
+ Date mDate = new Date();
+ SimpleDateFormat fileName = new SimpleDateFormat("yyyyMMdd_HHmmSS");
+
+ //保存処理開始
+ FileOutputStream fos = null;
+ fos = new FileOutputStream(new File(root, fileName.format(mDate)+".jpg"));
+
+ //jpegで保存
+ qr.compress(Bitmap.CompressFormat.JPEG, 100, fos);
+
+ //保存処理終了
+ fos.close();
+ } catch (FileNotFoundException e) {
+ Log.e("Error", ""+e.toString());
+ } catch (IOException e) {
+ Log.e("Error", "" + e.toString());
+ }
+ }
+
+ //contentsは変換する文字列、sizeは出力するQRコードの大きさ
+ public Bitmap createQRCodeByZxing(String contents, int size) throws WriterException{
+ //QRコードをエンコードするクラス
+ QRCodeWriter writer = new QRCodeWriter();
+
+ //異なる型のあたいを入れるためgenericは使えない
+ Hashtable encodeHint = new Hashtable();
+
+ //日本語を扱うためにシフトJISを指定
+ encodeHint.put(EncodeHintType.CHARACTER_SET, "shiftjis");
+ //エラー修復レベルを指定
+ encodeHint.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
+
+ BitMatrix qrCodeData = writer.encode(contents, BarcodeFormat.QR_CODE, size, size, encodeHint);
+
+ //QRコードのbitmap画像を作成
+ Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
+ bitmap.eraseColor(Color.argb(255, 255, 255, 255));
+ for(int x=0; x cookies = store.getCookies();
+ CookieManager cookieManager = CookieManager.getInstance();
+ for (Cookie cookie : cookies) {
+ if ( cookie.getDomain().indexOf(COOKIE_DOMAIN) < 0){
+ continue;
+ }
+ if (!SESSID.equals(cookie.getName())) {
+ continue;
+ }
+ // ここで削除するとsyncしたタイミングでsetしたcookieも
+ // 消える場合があるので削除は見合わせ
+ // cookieManager.removeSessionCookie();
+ String cookieStr = cookie.getName() + "=" + cookie.getValue();
+ cookieManager.setCookie(COOKIE_DOMAIN, cookieStr);
+ CookieSyncManager.getInstance().sync();
+ }
+ }
+
+ /**
+ * WebView側のセッションIDをHttpClientに同期します
+ *
+ * @param httpClient セッションを同期するHttpClient
+ */
+ public static void webView2HttpClient(DefaultHttpClient httpClient) {
+ String cookie = CookieManager.getInstance().getCookie(COOKIE_URL);
+ Log.v("cookie : ", cookie);
+ String[] cookies = cookie.split(";");
+ for (String keyValue : cookies) {
+ keyValue = keyValue.trim();
+ String[] cookieSet = keyValue.split("=");
+ String key = cookieSet[0];
+ String value = cookieSet[1];
+ Log.v("SessionSync", "session cookie name : " + key + " <> " + value);
+ if (!SESSID.equals(key)) {
+ continue;
+ }
+ BasicClientCookie bCookie = new BasicClientCookie(key, value);
+ bCookie.setDomain(COOKIE_DOMAIN);
+ bCookie.setPath("/");
+ CookieStore store = httpClient.getCookieStore();
+ store.addCookie(bCookie);
+ }
+ }
+
+ //友達登録画面にユーザIDを表示させるためだけに作成
+ public static void user_idHttpClient(DefaultHttpClient httpClient){
+ String cookie = CookieManager.getInstance().getCookie(COOKIE_URL);
+ Log.v("cookie : ", cookie);
+ String[] cookies = cookie.split(";");
+ for (String keyValue : cookies) {
+ keyValue = keyValue.trim();
+ String[] cookieSet = keyValue.split("=");
+ String key = cookieSet[0];
+ String value = cookieSet[1];
+ Log.v("SessionSync", "session cookie name : " + key + " <> " + value);
+ if (!SESSID.equals(key)) {
+ continue;
+ }
+ BasicClientCookie bCookie = new BasicClientCookie(key, value);
+ bCookie.setDomain(COOKIE_DOMAIN);
+ bCookie.setPath("/");
+ CookieStore store = httpClient.getCookieStore();
+ store.addCookie(bCookie);
+ }
+ }
+}
\ No newline at end of file
diff --git a/MIClient/app/src/main/res/layout/activity_main.xml b/MIClient/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..b6191e0
--- /dev/null
+++ b/MIClient/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/MIClient/app/src/main/res/layout/qrcodecreate.xml b/MIClient/app/src/main/res/layout/qrcodecreate.xml
new file mode 100644
index 0000000..df17a33
--- /dev/null
+++ b/MIClient/app/src/main/res/layout/qrcodecreate.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+ //android:hint="@string/zxing_button_ok" />
+
\ No newline at end of file
diff --git a/MIClient/app/src/main/res/layout/regfriends.xml b/MIClient/app/src/main/res/layout/regfriends.xml
new file mode 100644
index 0000000..72007bc
--- /dev/null
+++ b/MIClient/app/src/main/res/layout/regfriends.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MIClient/app/src/main/res/menu/action_bar_menu2.xml b/MIClient/app/src/main/res/menu/action_bar_menu2.xml
new file mode 100644
index 0000000..a51ddad
--- /dev/null
+++ b/MIClient/app/src/main/res/menu/action_bar_menu2.xml
@@ -0,0 +1,10 @@
+
+
diff --git a/MIClient/app/src/main/res/menu/qr.xml b/MIClient/app/src/main/res/menu/qr.xml
new file mode 100644
index 0000000..fe187c0
--- /dev/null
+++ b/MIClient/app/src/main/res/menu/qr.xml
@@ -0,0 +1,4 @@
+
+
\ No newline at end of file
diff --git a/MIClient/app/src/main/res/menu/reg.xml b/MIClient/app/src/main/res/menu/reg.xml
new file mode 100644
index 0000000..2a029a3
--- /dev/null
+++ b/MIClient/app/src/main/res/menu/reg.xml
@@ -0,0 +1,10 @@
+
+
diff --git a/MIClient/app/src/main/res/mipmap-hdpi/ic_launcher.png b/MIClient/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
Binary files /dev/null and b/MIClient/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/MIClient/app/src/main/res/mipmap-mdpi/ic_launcher.png b/MIClient/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
Binary files /dev/null and b/MIClient/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/MIClient/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/MIClient/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
Binary files /dev/null and b/MIClient/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/MIClient/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/MIClient/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
Binary files /dev/null and b/MIClient/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/MIClient/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/MIClient/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..aee44e1
Binary files /dev/null and b/MIClient/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/MIClient/app/src/main/res/values/colors.xml b/MIClient/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..3ab3e9c
--- /dev/null
+++ b/MIClient/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #3F51B5
+ #303F9F
+ #FF4081
+
diff --git a/MIClient/app/src/main/res/values/dimens.xml b/MIClient/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..255da07
--- /dev/null
+++ b/MIClient/app/src/main/res/values/dimens.xml
@@ -0,0 +1,7 @@
+
+
+
+ 16dp
+ 16dp
+ 16dp
+
\ No newline at end of file
diff --git a/MIClient/app/src/main/res/values/strings.xml b/MIClient/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..5038251
--- /dev/null
+++ b/MIClient/app/src/main/res/values/strings.xml
@@ -0,0 +1,6 @@
+
+ MIClient
+ Settings
+ ユーザIDを入力してください
+ OK
+
diff --git a/MIClient/app/src/main/res/values/styles.xml b/MIClient/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..bafe107
--- /dev/null
+++ b/MIClient/app/src/main/res/values/styles.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
diff --git a/MIClient/app/src/test/java/com/example/enpit_itw/miclient/ExampleUnitTest.java b/MIClient/app/src/test/java/com/example/enpit_itw/miclient/ExampleUnitTest.java
new file mode 100644
index 0000000..3fffc21
--- /dev/null
+++ b/MIClient/app/src/test/java/com/example/enpit_itw/miclient/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package com.example.enpit_itw.miclient;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/MIClient/build.gradle b/MIClient/build.gradle
new file mode 100644
index 0000000..be515a8
--- /dev/null
+++ b/MIClient/build.gradle
@@ -0,0 +1,23 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.3.0'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/MIClient/gradle.properties b/MIClient/gradle.properties
new file mode 100644
index 0000000..1d3591c
--- /dev/null
+++ b/MIClient/gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
\ No newline at end of file
diff --git a/MIClient/gradle/wrapper/gradle-wrapper.jar b/MIClient/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..8c0fb64
Binary files /dev/null and b/MIClient/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/MIClient/gradle/wrapper/gradle-wrapper.properties b/MIClient/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..9297f49
--- /dev/null
+++ b/MIClient/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Nov 18 18:55:54 JST 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
diff --git a/MIClient/gradlew b/MIClient/gradlew
new file mode 100644
index 0000000..91a7e26
--- /dev/null
+++ b/MIClient/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/MIClient/gradlew.bat b/MIClient/gradlew.bat
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/MIClient/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/MIClient/settings.gradle b/MIClient/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/MIClient/settings.gradle
@@ -0,0 +1 @@
+include ':app'
diff --git a/MainActivity b/MainActivity
new file mode 100644
index 0000000..afbac6b
--- /dev/null
+++ b/MainActivity
@@ -0,0 +1,257 @@
+package com.example.enpit_itw_esaka.myapplication2;
+
+import android.Manifest;
+import android.app.Activity;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.graphics.Bitmap;
+import android.graphics.Color;
+import android.location.Criteria;
+import android.location.Location;
+import android.location.LocationListener;
+import android.location.LocationManager;
+import android.app.Activity;
+import android.os.Bundle;
+import android.os.NetworkOnMainThreadException;
+import android.provider.Settings;
+import android.text.format.Time;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.webkit.WebSettings;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+import android.widget.ImageView;
+import android.widget.ShareActionProvider;
+import android.widget.Toast;
+
+import com.example.enpit_itw_esaka.myapplication2.R;
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.WriterException;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.qrcode.QRCodeWriter;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.text.DecimalFormat;
+import java.util.Enumeration;
+
+public class MainActivity extends Activity implements LocationListener{
+
+ LocationManager loc;
+ WebView webview;
+ ImageView image;
+ PendingIntent pendingintent;
+ Context context;
+ Socket connection;
+ BufferedWriter writer;
+ private ShareActionProvider mShareActionProvider;
+ private int mode;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+/*
+ //QRコードの作成
+ String number = "111111";
+ int width = 100;
+ int height = 100;
+ try {
+ QRCodeWriter writer = new QRCodeWriter();
+ //エンコード
+ BitMatrix bm = null;
+ bm = writer.encode(number, BarcodeFormat.QR_CODE, width, height);
+ //ピクセルを作る
+ Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+ //データがあるところだけ黒にする
+ for (int y = 0; y < height; y++) {
+ for (int x = 0; x < width; x++) {
+ bitmap.setPixel(x, y, bm.get(x, y) ? Color.BLACK : Color.WHITE);
+ }
+ }
+
+ //QRコードを表示する
+ if(bitmap==null){
+ //エンコード失敗
+ Log.v("Error", "エンコード失敗");
+ }else {
+ image = (ImageView) findViewById(R.id.image_qr);
+ image.setImageBitmap(bitmap);
+ setContentView(image);
+ //image.setVisibility(View.GONE);
+ }
+ } catch (WriterException e) {
+ e.printStackTrace();
+ }
+*/
+
+ //WebViewインスタンスを生成
+ webview = new WebView(this);
+
+ //JavaScriptを有効にする
+ webview.getSettings().setJavaScriptEnabled(true);
+
+ //setContentViewに作成したWebビューを設定する
+ setContentView(webview);
+
+ //読み込み時にページ幅を画面幅に合わせる
+ webview.getSettings().setUseWideViewPort(true);
+ webview.getSettings().setLoadWithOverviewMode(true);
+
+ //ネットワークに接続していないときはキャッシュを表示する
+ webview.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
+
+ //指定したURLをWebビューに設定する
+ webview.loadUrl("https://www.google.co.jp/");
+
+
+ //位置情報取得時に実行するインテントを生成
+ //Intent intent = new Intent(this, ReceiverActivity.class);
+ //pendingintent = PendingIntent.getActivity(this, 0, intent, 0);
+
+ //精度を設定
+ Criteria criteria = new Criteria();
+ criteria.setAccuracy(Criteria.ACCURACY_FINE);
+
+ //LocationManagerインスタンスの生成
+ loc = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
+
+ mode=0;
+/*
+ //サーバへ接続
+ connection = null;
+ writer = null;
+ try{
+ connection = new Socket("192.168.128.103", 1000);//サーバのホスト名とポート番号を書く
+ }catch(UnknownHostException e){
+ e.printStackTrace();
+ Log.v("Error", e.toString());
+ Log.v("Server connection", "サーバとの接続に失敗しました");
+ }catch(IOException e){
+ e.printStackTrace();
+ Log.v("Error", e.toString());
+ Log.v("Server connection", "サーバとの接続に失敗しました");
+ }
+*/
+ }
+/*
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu){
+ //「action_bar_menu.xml」で定義したメニュー項目を適用する
+ getMenuInflater().inflate(R.menu.action_bar_menu, menu);
+
+ //「ShareActionProvider」インスタンスを取得する
+ mShareActionProvider = (ShareActionProvider)menu.findItem(R.id.menu_share).getActionProvider();
+
+ //テキストを共有するためのインテントを生成
+ Intent shareIntent = new Intent(Intent.ACTION_SEND);
+ shareIntent.setType("text/plain");
+
+ //「サンプルテキスト」という文字列を共有するテキストとして指定
+ shareIntent.putExtra(Intent.EXTRA_TEXT, "サンプルテキスト");
+
+ //共有ボタン押下時の共有インテントをセットする
+ mShareActionProvider.setShareIntent(shareIntent);
+
+ return true;
+ }
+*/
+
+ //バーにボタンを追加する
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ //「action_bar_menu2.xml」で定義したメニュー項目を適用する
+ getMenuInflater().inflate(R.menu.action_bar_menu2, menu);
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ //ボタンを押されたとき
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item){
+ if(mode==0) {//ON
+ webview.setVisibility(View.GONE);
+ image.setVisibility(View.VISIBLE);
+ mode=1;
+ }else if(mode==1){//OFF
+ image.setVisibility(View.GONE);
+ webview.setVisibility(View.VISIBLE);
+ mode=0;
+ }
+ return true;
+ }
+
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ //位置情報更新の設定(更新時間:5秒、更新距離:1m)
+ loc.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 5000, 1, this);
+ }
+
+ //位置情報が更新された時
+ public void onLocationChanged(Location location){
+ //小数点以下の桁数を揃える
+ DecimalFormat df=new DecimalFormat();
+ df.setMaximumFractionDigits(7);
+ df.setMinimumFractionDigits(7);
+
+ //緯度を取得
+ double latitude = location.getLatitude();
+ String Lat = df.format(new Double(latitude));
+
+ //経度を取得
+ double longitude = location.getLongitude();
+ String Lon = df.format(new Double(longitude));
+
+ //時間を取得
+ Time time = new Time("Asia/Tokyo");
+ time.setToNow();
+ String date = time.year + "年" + (time.month+1) + "月" + time.monthDay + "日" + time.hour + "時" + time.minute + "分" + time.second + "秒";
+
+ Log.v("ReceiverActivity", "経度" + Lat + " 緯度" + Lon + " 取得時間" + date);
+/*
+ //位置情報をサーバに送る
+ String msg = "Location" + " " + String.valueOf(longitude) + " " + String.valueOf(latitude);
+ try{
+ writer = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream()));
+ writer.write(msg);
+ writer.flush();
+ }catch(IOException e){
+ e.printStackTrace();
+ }finally{
+ try{
+ writer.close();
+ }catch(IOException e){
+ e.printStackTrace();
+ Log.v("Error", e.toString());
+ Log.v("Server Message", "サーバとの接続に失敗しました");
+ }
+ }
+ */
+ }
+
+ public void onProviderDisabled(String provider){}
+
+ public void onProviderEnabled(String porvider){}
+
+ public void onStatusChanged(String provider, int status, Bundle extras){}
+
+ @Override
+ protected void onDestroy(){
+ super.onDestroy();
+ //位置情報更新の解除
+ loc.removeUpdates(this);
+ }
+}
diff --git a/MyApplication2/.gitignore b/MyApplication2/.gitignore
new file mode 100644
index 0000000..9c4de58
--- /dev/null
+++ b/MyApplication2/.gitignore
@@ -0,0 +1,7 @@
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
diff --git a/MyApplication2/.idea/.name b/MyApplication2/.idea/.name
new file mode 100644
index 0000000..c4b4927
--- /dev/null
+++ b/MyApplication2/.idea/.name
@@ -0,0 +1 @@
+MyApplication2
\ No newline at end of file
diff --git a/MyApplication2/.idea/compiler.xml b/MyApplication2/.idea/compiler.xml
new file mode 100644
index 0000000..96cc43e
--- /dev/null
+++ b/MyApplication2/.idea/compiler.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication2/.idea/copyright/profiles_settings.xml b/MyApplication2/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/MyApplication2/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/MyApplication2/.idea/encodings.xml b/MyApplication2/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/MyApplication2/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication2/.idea/gradle.xml b/MyApplication2/.idea/gradle.xml
new file mode 100644
index 0000000..7d80135
--- /dev/null
+++ b/MyApplication2/.idea/gradle.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication2/.idea/misc.xml b/MyApplication2/.idea/misc.xml
new file mode 100644
index 0000000..c60d22d
--- /dev/null
+++ b/MyApplication2/.idea/misc.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.7
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication2/.idea/modules.xml b/MyApplication2/.idea/modules.xml
new file mode 100644
index 0000000..7ffac15
--- /dev/null
+++ b/MyApplication2/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication2/.idea/runConfigurations.xml b/MyApplication2/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/MyApplication2/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication2/.idea/vcs.xml b/MyApplication2/.idea/vcs.xml
new file mode 100644
index 0000000..6564d52
--- /dev/null
+++ b/MyApplication2/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication2/MyApplication2.iml b/MyApplication2/MyApplication2.iml
new file mode 100644
index 0000000..04a387c
--- /dev/null
+++ b/MyApplication2/MyApplication2.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication2/app/.gitignore b/MyApplication2/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/MyApplication2/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/MyApplication2/app/app.iml b/MyApplication2/app/app.iml
new file mode 100644
index 0000000..0a9d76b
--- /dev/null
+++ b/MyApplication2/app/app.iml
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ generateDebugAndroidTestSources
+ generateDebugSources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication2/app/build.gradle b/MyApplication2/app/build.gradle
new file mode 100644
index 0000000..669c92d
--- /dev/null
+++ b/MyApplication2/app/build.gradle
@@ -0,0 +1,28 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 23
+ buildToolsVersion "23.0.1"
+ useLibrary 'org.apache.http.legacy'
+
+ defaultConfig {
+ applicationId "com.example.enpit_itw_esaka.myapplication2"
+ minSdkVersion 19
+ targetSdkVersion 23
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ testCompile 'junit:junit:4.12'
+ compile 'com.android.support:appcompat-v7:23.0.1'
+ compile 'com.android.support:design:23.0.1'
+}
diff --git a/MyApplication2/app/proguard-rules.pro b/MyApplication2/app/proguard-rules.pro
new file mode 100644
index 0000000..ca1e92a
--- /dev/null
+++ b/MyApplication2/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\yoshikawa\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/MyApplication2/app/src/androidTest/java/com/example/enpit_itw_esaka/myapplication2/ApplicationTest.java b/MyApplication2/app/src/androidTest/java/com/example/enpit_itw_esaka/myapplication2/ApplicationTest.java
new file mode 100644
index 0000000..0d59cce
--- /dev/null
+++ b/MyApplication2/app/src/androidTest/java/com/example/enpit_itw_esaka/myapplication2/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.example.enpit_itw_esaka.myapplication2;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/MyApplication2/app/src/main/AndroidManifest.xml b/MyApplication2/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..bf03ccb
--- /dev/null
+++ b/MyApplication2/app/src/main/AndroidManifest.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MyApplication2/app/src/main/build.gradle b/MyApplication2/app/src/main/build.gradle
new file mode 100644
index 0000000..282d52d
--- /dev/null
+++ b/MyApplication2/app/src/main/build.gradle
@@ -0,0 +1,37 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 19
+ buildToolsVersion "23.0.0"
+
+ defaultConfig {
+ applicationId "com.example.enpit_itw_esaka.myapplication2"
+ minSdkVersion 19
+ targetSdkVersion 19
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+repositories {
+ mavenCentral();
+ maven{
+ url "http://dl.bintray.com/journeyapps/maven"
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.android.support:appcompat-v7:19.0.0'
+
+ compile 'com.journeyapps:zxing-android-embedded:3.0.1@aar'
+ compile 'com.journeyapps:zxing-android-legacy:2.0.1@aar'
+ compile 'com.journeyapps:zxing-android-integration:2.0.1@aar'
+ compile 'com.google.zxing:core:3.2.0'
+}
diff --git a/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/.MainActivity.java.un~ b/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/.MainActivity.java.un~
new file mode 100644
index 0000000..92c12d0
Binary files /dev/null and b/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/.MainActivity.java.un~ differ
diff --git a/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/CaptureActivityAnyOrientation.java b/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/CaptureActivityAnyOrientation.java
new file mode 100644
index 0000000..d2f51cd
--- /dev/null
+++ b/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/CaptureActivityAnyOrientation.java
@@ -0,0 +1,5 @@
+package com.example.enpit_itw_esaka.myapplication2;
+
+import com.journeyapps.barcodescanner.CaptureActivity;
+public class CaptureActivityAnyOrientation extends CaptureActivity{
+}
diff --git a/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/MainActivity.java b/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/MainActivity.java
new file mode 100644
index 0000000..85e5fc4
--- /dev/null
+++ b/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/MainActivity.java
@@ -0,0 +1,180 @@
+package com.example.enpit_itw_esaka.myapplication2;
+
+import android.Manifest;
+import android.app.Activity;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.graphics.Bitmap;
+import android.graphics.Color;
+import android.location.Criteria;
+import android.location.Location;
+import android.location.LocationListener;
+import android.location.LocationManager;
+import android.app.Activity;
+import android.os.Bundle;
+import android.os.NetworkOnMainThreadException;
+import android.provider.Settings;
+import android.support.v4.content.ContextCompat;
+import android.text.format.Time;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.webkit.WebSettings;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+import android.widget.ImageView;
+import android.widget.ShareActionProvider;
+import android.widget.Toast;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.text.DecimalFormat;
+import java.util.Enumeration;
+
+public class MainActivity extends Activity implements LocationListener{
+
+ MyAsyncTask task;
+ LocationManager loc;
+ WebView webview;
+ ImageView image;
+ PendingIntent pendingintent;
+ Context context;
+ Socket connection;
+ BufferedWriter writer;
+ private ShareActionProvider mShareActionProvider;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ //WebViewインスタンスを生成
+ webview = new WebView(this);
+
+ //JavaScriptを有効にする
+ webview.getSettings().setJavaScriptEnabled(true);
+
+ //setContentViewに作成したWebビューを設定する
+ setContentView(webview);
+
+ //読み込み時にページ幅を画面幅に合わせる
+ webview.getSettings().setUseWideViewPort(true);
+ webview.getSettings().setLoadWithOverviewMode(true);
+
+ //ネットワークに接続していないときはキャッシュを表示する
+ webview.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
+
+ //指定したURLをWebビューに設定する
+ webview.loadUrl("https://www.google.co.jp/");
+
+
+ //位置情報取得時に実行するインテントを生成
+ //Intent intent = new Intent(this, ReceiverActivity.class);
+ //pendingintent = PendingIntent.getActivity(this, 0, intent, 0);
+
+ //精度を設定
+ Criteria criteria = new Criteria();
+ criteria.setAccuracy(Criteria.ACCURACY_FINE);
+
+ //LocationManagerインスタンスの生成
+ loc = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
+
+ }
+
+ //バーにボタンを追加する
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ //「action_bar_menu2.xml」で定義したメニュー項目を適用する
+ getMenuInflater().inflate(R.menu.action_bar_menu2, menu);
+ //return super.onCreateOptionsMenu(menu);
+ return true;
+ }
+
+ //バーのボタンを押されたとき
+ @Override
+ public boolean onMenuItemSelected(int featureId, MenuItem item){
+ switch(item.getItemId()) {
+ case R.id.menu_reg:
+ // 編集画面への遷移処理
+ Intent edit_intent = new Intent(MainActivity.this, RegFriends.class);
+ startActivity(edit_intent);
+ break;
+ default:
+ break;
+ }
+ return super.onMenuItemSelected(featureId, item);
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ //位置情報更新の設定(更新時間:5秒、更新距離:1m)
+ if(loc != null){
+ if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
+ || ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)== PackageManager.PERMISSION_GRANTED){
+ //許可されているならばここを実行
+ loc.requestLocationUpdates(LocationManager.GPS_PROVIDER, 50000, 1, this);
+ //Toast.makeText(this, "位置情報を設定しました", Toast.LENGTH_LONG).show();
+ Log.d("位置情報設定","True");
+ }
+ else{
+ Log.d("位置情報設定", "False");
+ //Toast.makeText(this, "位置情報の許可がありません!", Toast.LENGTH_LONG).show();
+ }
+ }
+ }
+
+ //位置情報が更新された時
+ public void onLocationChanged(Location location){
+ //小数点以下の桁数を揃える
+ DecimalFormat df=new DecimalFormat();
+ df.setMaximumFractionDigits(7);
+ df.setMinimumFractionDigits(7);
+
+ //緯度を取得
+ double latitude = location.getLatitude();
+ String Lat = df.format(new Double(latitude));
+
+ //経度を取得
+ double longitude = location.getLongitude();
+ String Lon = df.format(new Double(longitude));
+
+ //時間を取得
+ Time time = new Time("Asia/Tokyo");
+ time.setToNow();
+ String date = time.year + "-" + (time.month+1) + "-" + time.monthDay + " " + time.hour + ":" + time.minute + ":" + time.second;
+ int dummy_user_id = 4;
+ //Toast.makeText(this, Lat, Toast.LENGTH_SHORT).show();
+ task= new MyAsyncTask(this);
+ task.execute(Lat, Lon, date, Integer.toString(dummy_user_id));
+ Log.v("ReceiverActivity", "経度 : " + Lat + " 緯度 : " + Lon + " 取得時間 : " + date);
+ }
+
+ public void onProviderDisabled(String provider){}
+
+ public void onProviderEnabled(String provider){}
+
+ public void onStatusChanged(String provider, int status, Bundle extras){}
+
+ @Override
+ protected void onDestroy(){
+ super.onDestroy();
+ //位置情報更新の解除
+ if(loc != null) {
+ if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
+ || ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
+ loc.removeUpdates(this);
+ }
+ }
+ }
+}
diff --git a/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/MainActivity.java~ b/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/MainActivity.java~
new file mode 100644
index 0000000..39b985d
--- /dev/null
+++ b/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/MainActivity.java~
@@ -0,0 +1,280 @@
+package com.example.enpit_itw_esaka.myapplication2;
+
+import android.Manifest;
+import android.app.Activity;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.graphics.Bitmap;
+import android.graphics.Color;
+import android.location.Criteria;
+import android.location.Location;
+import android.location.LocationListener;
+import android.location.LocationManager;
+import android.app.Activity;
+import android.os.Bundle;
+import android.os.NetworkOnMainThreadException;
+import android.provider.Settings;
+<<<<<<< HEAD
+import android.support.v4.content.ContextCompat;
+=======
+>>>>>>> 7306bed0bbff04e9289837fa94e2e582a6c57d60
+import android.text.format.Time;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.webkit.WebSettings;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+import android.widget.ImageView;
+import android.widget.ShareActionProvider;
+import android.widget.Toast;
+
+import com.example.enpit_itw_esaka.myapplication2.R;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.text.DecimalFormat;
+import java.util.Enumeration;
+
+public class MainActivity extends Activity implements LocationListener{
+
+ LocationManager loc;
+ WebView webview;
+ ImageView image;
+ PendingIntent pendingintent;
+ Context context;
+ Socket connection;
+ BufferedWriter writer;
+ private ShareActionProvider mShareActionProvider;
+ private int mode;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+/*
+ //QRコードの作成
+ String number = "111111";
+ int width = 100;
+ int height = 100;
+ try {
+ QRCodeWriter writer = new QRCodeWriter();
+ //エンコード
+ BitMatrix bm = null;
+ bm = writer.encode(number, BarcodeFormat.QR_CODE, width, height);
+ //ピクセルを作る
+ Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+ //データがあるところだけ黒にする
+ for (int y = 0; y < height; y++) {
+ for (int x = 0; x < width; x++) {
+ bitmap.setPixel(x, y, bm.get(x, y) ? Color.BLACK : Color.WHITE);
+ }
+ }
+
+ //QRコードを表示する
+ if(bitmap==null){
+ //エンコード失敗
+ Log.v("Error", "エンコード失敗");
+ }else {
+ image = (ImageView) findViewById(R.id.image_qr);
+ image.setImageBitmap(bitmap);
+ setContentView(image);
+ //image.setVisibility(View.GONE);
+ }
+ } catch (WriterException e) {
+ e.printStackTrace();
+ }
+*/
+
+ //WebViewインスタンスを生成
+ webview = new WebView(this);
+
+ //JavaScriptを有効にする
+ webview.getSettings().setJavaScriptEnabled(true);
+
+ //setContentViewに作成したWebビューを設定する
+ setContentView(webview);
+
+ //読み込み時にページ幅を画面幅に合わせる
+ webview.getSettings().setUseWideViewPort(true);
+ webview.getSettings().setLoadWithOverviewMode(true);
+
+ //ネットワークに接続していないときはキャッシュを表示する
+ webview.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
+
+ //指定したURLをWebビューに設定する
+ webview.loadUrl("https://www.google.co.jp/");
+
+
+ //位置情報取得時に実行するインテントを生成
+ //Intent intent = new Intent(this, ReceiverActivity.class);
+ //pendingintent = PendingIntent.getActivity(this, 0, intent, 0);
+
+ //精度を設定
+ Criteria criteria = new Criteria();
+ criteria.setAccuracy(Criteria.ACCURACY_FINE);
+
+ //LocationManagerインスタンスの生成
+ loc = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
+
+ mode=0;
+/*
+ //サーバへ接続
+ connection = null;
+ writer = null;
+ try{
+ connection = new Socket("192.168.128.103", 1000);//サーバのホスト名とポート番号を書く
+ }catch(UnknownHostException e){
+ e.printStackTrace();
+ Log.v("Error", e.toString());
+ Log.v("Server connection", "サーバとの接続に失敗しました");
+ }catch(IOException e){
+ e.printStackTrace();
+ Log.v("Error", e.toString());
+ Log.v("Server connection", "サーバとの接続に失敗しました");
+ }
+*/
+ }
+/*
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu){
+ //「action_bar_menu.xml」で定義したメニュー項目を適用する
+ getMenuInflater().inflate(R.menu.action_bar_menu, menu);
+
+ //「ShareActionProvider」インスタンスを取得する
+ mShareActionProvider = (ShareActionProvider)menu.findItem(R.id.menu_share).getActionProvider();
+
+ //テキストを共有するためのインテントを生成
+ Intent shareIntent = new Intent(Intent.ACTION_SEND);
+ shareIntent.setType("text/plain");
+
+ //「サンプルテキスト」という文字列を共有するテキストとして指定
+ shareIntent.putExtra(Intent.EXTRA_TEXT, "サンプルテキスト");
+
+ //共有ボタン押下時の共有インテントをセットする
+ mShareActionProvider.setShareIntent(shareIntent);
+
+ return true;
+ }
+*/
+
+ //バーにボタンを追加する
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ //「action_bar_menu2.xml」で定義したメニュー項目を適用する
+ getMenuInflater().inflate(R.menu.action_var_menu2, menu);
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ //ボタンを押されたとき
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item){
+ if(mode==0) {//ON
+ webview.setVisibility(View.GONE);
+ image.setVisibility(View.VISIBLE);
+ mode=1;
+ }else if(mode==1){//OFF
+ image.setVisibility(View.GONE);
+ webview.setVisibility(View.VISIBLE);
+ mode=0;
+ }
+ return true;
+ }
+
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ //位置情報更新の設定(更新時間:5秒、更新距離:1m)
+ if(loc != null){
+ if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
+ || ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)== PackageManager.PERMISSION_GRANTED){
+ //許可されているならばここを実行
+ loc.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 1, this);
+ //Toast.makeText(this, "位置情報を設定しました", Toast.LENGTH_LONG).show();
+ Log.d("位置情報設定","True");
+ }
+ else{
+ Log.d("位置情報設定", "False");
+ //Toast.makeText(this, "位置情報の許可がありません!", Toast.LENGTH_LONG).show();
+ }
+ }
+
+
+
+ }
+
+
+
+ //位置情報が更新された時
+ public void onLocationChanged(Location location){
+ //小数点以下の桁数を揃える
+ DecimalFormat df=new DecimalFormat();
+ df.setMaximumFractionDigits(7);
+ df.setMinimumFractionDigits(7);
+
+ //緯度を取得
+ double latitude = location.getLatitude();
+ String Lat = df.format(new Double(latitude));
+
+ //経度を取得
+ double longitude = location.getLongitude();
+ String Lon = df.format(new Double(longitude));
+
+ //時間を取得
+ Time time = new Time("Asia/Tokyo");
+ time.setToNow();
+ String date = time.year + "年" + (time.month+1) + "月" + time.monthDay + "日" + time.hour + "時" + time.minute + "分" + time.second + "秒";
+
+ Toast.makeText(this, Lat, Toast.LENGTH_SHORT).show();
+ Log.v("ReceiverActivity", "経度" + Lat + " 緯度" + Lon + " 取得時間" + date);
+/*
+ //位置情報をサーバに送る
+ String msg = "Location" + " " + String.valueOf(longitude) + " " + String.valueOf(latitude);
+ try{
+ writer = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream()));
+ writer.write(msg);
+ writer.flush();
+ }catch(IOException e){
+ e.printStackTrace();
+ }finally{
+ try{
+ writer.close();
+ }catch(IOException e){
+ e.printStackTrace();
+ Log.v("Error", e.toString());
+ Log.v("Server Message", "サーバとの接続に失敗しました");
+ }
+ }
+ */
+ }
+
+ public void onProviderDisabled(String provider){}
+
+ public void onProviderEnabled(String provider){}
+
+ public void onStatusChanged(String provider, int status, Bundle extras){}
+
+ @Override
+ protected void onDestroy(){
+ super.onDestroy();
+ //位置情報更新の解除
+ if(loc != null) {
+ if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
+ || ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
+ loc.removeUpdates(this);
+ }
+ }
+ }
+}
diff --git a/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/MyAsyncTask.java b/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/MyAsyncTask.java
new file mode 100644
index 0000000..a10189f
--- /dev/null
+++ b/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/MyAsyncTask.java
@@ -0,0 +1,151 @@
+package com.example.enpit_itw_esaka.myapplication2;
+
+import android.app.Activity;
+import android.content.DialogInterface;
+import android.os.AsyncTask;
+import android.util.Log;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicNameValuePair;
+
+import java.awt.font.TextAttribute;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class MyAsyncTask extends AsyncTask implements DialogInterface.OnCancelListener{
+ final String TAG = "MyAsyncTask";
+
+ private Activity m_Activity;
+
+ private static final String url = "http://192.168.1.52/position_registor.php";
+ private static final String urlF = "http://192.168.1.52/friend_registor.php";
+
+ //クライアント設定
+ HttpClient httpclient = new DefaultHttpClient();
+ HttpPost httppost = new HttpPost(url);
+
+ List nameValuePair;
+ HttpResponse response;
+ ByteArrayOutputStream byteArrayOutputStream;
+ HttpResponse res = null;
+
+ public MyAsyncTask(Activity activity){
+ this.m_Activity = activity;
+ }
+
+ @Override
+ protected void onPreExecute(){
+ Log.d(TAG, "onPreExecute");
+ }
+
+ @Override
+ protected Integer doInBackground(String... contents){
+ if(contents.length == 2) {
+ Log.d(TAG, "doInBackground - " + contents[0] + contents[1]);
+ HttpClient httpClient = new DefaultHttpClient();
+ HttpPost post = new HttpPost(urlF);
+
+ ArrayList params = new ArrayList();
+ params.add(new BasicNameValuePair("friend_id", contents[0]));
+ params.add(new BasicNameValuePair("user_id", contents[1]));
+
+ try{
+ post.setEntity(new UrlEncodedFormEntity(params, "utf-8"));
+ res = httpClient.execute(post);
+
+ byteArrayOutputStream = new ByteArrayOutputStream();
+ res.getEntity().writeTo(byteArrayOutputStream);
+ }catch (Exception e){
+ Log.v("MyAsyncTask", e.toString());
+ return -1;
+ }
+ }else if(contents.length == 4){
+ Log.d(TAG, "doInBackground - " + contents[0] + contents[1]);
+ HttpClient httpClient = new DefaultHttpClient();
+ HttpPost post = new HttpPost(url);
+
+ ArrayList params = new ArrayList();
+ params.add(new BasicNameValuePair("lat", contents[0]));
+ params.add(new BasicNameValuePair("lon", contents[1]));
+ params.add(new BasicNameValuePair("date", contents[2]));
+ params.add(new BasicNameValuePair("user_id", contents[3]));
+
+ try{
+ post.setEntity(new UrlEncodedFormEntity(params, "utf-8"));
+ res = httpClient.execute(post);
+
+ byteArrayOutputStream = new ByteArrayOutputStream();
+ res.getEntity().writeTo(byteArrayOutputStream);
+ }catch (Exception e){
+ Log.v("MyAsyncTask", e.toString());
+ return -1;
+ }
+ }else{
+ Log.e("Error", "情報数エラーです。");
+ return -1;
+ }
+
+ return Integer.valueOf(res.getStatusLine().getStatusCode());
+ }
+
+ @Override
+ protected void onProgressUpdate(Integer... values){
+ Log.d(TAG, "onProgressUpdate - " + values[0]);
+ }
+
+ @Override
+ protected void onCancelled(){
+ Log.d(TAG, "onCancelled");
+ }
+
+ @Override
+ protected void onPostExecute(Integer result){
+ Log.d(TAG, "onPostExecute - " + result);
+
+ if(result == -1){
+ //通信に失敗
+ Log.d(TAG, "communication error");
+ return;
+ }else{
+ Log.d(TAG, "Status : " + res.getStatusLine().getStatusCode());
+ }
+ //サーバーからの応答を取得
+ if(res.getStatusLine().getStatusCode() == HttpStatus.SC_OK){
+ //デバッグ用にリザルトコードをTextViewに表示させておく
+ /*
+ TextView tv = (TextView) this.m_Activity.findViewById(R.id.textView1);
+ tv.setText("" + result);
+ tv.setText(result + "\n" + byteArrayOutputStream.toString());
+ */
+ //サーバーから受け取った文字列の処理
+ //Toast.makeText(this.m_Activity, "結果 : " + byteArrayOutputStream.toString(), Toast.LENGTH_LONG).show();
+ Log.d("TAG", "サーバからの応答 : " + byteArrayOutputStream.toString());
+ /*
+ if(byteArrayOutputStream.toString().equals("1")){
+ Toast.makeText(this.m_Activity, "[ここには処理1]", Toast.LENGTH_LONG).show();
+ }else{
+ Toast.makeText(this.m_Activity, "[ここには処理2]", Toast.LENGTH_LONG).show();
+ }
+ */
+ }else{
+ Toast.makeText(this.m_Activity, "[error]: " + response.getStatusLine(), Toast.LENGTH_LONG).show();
+ }
+ }
+
+ @Override
+ public void onCancel(DialogInterface dialog){
+ Log.d(TAG, "Dialog onCancel... calling cancel(true)");
+ this.cancel(true);
+ }
+}
diff --git a/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/QRCodeCreate.java b/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/QRCodeCreate.java
new file mode 100644
index 0000000..f5dbc14
--- /dev/null
+++ b/MyApplication2/app/src/main/java/com/example/enpit_itw_esaka/myapplication2/QRCodeCreate.java
@@ -0,0 +1,75 @@
+package com.example.enpit_itw_esaka.myapplication2;
+
+import android.app.Activity;
+import android.support.v7.app.ActionBarActivity;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.view.Menu;
+import android.widget.ImageView;
+/*
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.WriterException;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.qrcode.QRCodeWriter;
+*/
+public class QRCodeCreate extends ActionBarActivity {
+ @Override
+ public void onCreate(Bundle savedInstanceState){
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.qrcodecreate);
+ /*
+ //受け取ったインテントを取得
+ Intent intent = getIntent();
+ showIntentData(intent);
+ */
+ }
+
+ /*
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu){
+ getMenuInflater().inflate(R.menu.qr, menu);
+ return true;
+ }
+ */
+
+ /*
+ private void showIntentData(Intent intent){
+ //QRコードの作成
+ try {
+ //インテントからBundleを取得
+ Bundle bundle = intent.getExtras();
+
+ //ユーザIDオブジェクトを取得
+ String number = (String) bundle.get("userID");
+
+ QRCodeWriter writer = new QRCodeWriter();
+ //エンコード
+ BitMatrix bm = null;
+ bm = writer.encode(number, BarcodeFormat.QR_CODE, 100, 100);
+ //ピクセルを作る
+ int width = bm.getWidth();
+ int height = bm.getHeight();
+ int[] pixels = new int[width * height];
+ //データがあるところだけ黒にする
+ for(int y=0; y
+
+
+
+
diff --git a/MyApplication2/app/src/main/res/layout/backup/activity_main.xml b/MyApplication2/app/src/main/res/layout/backup/activity_main.xml
new file mode 100644
index 0000000..18bc94c
--- /dev/null
+++ b/MyApplication2/app/src/main/res/layout/backup/activity_main.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MyApplication2/app/src/main/res/layout/backup/content_main.xml b/MyApplication2/app/src/main/res/layout/backup/content_main.xml
new file mode 100644
index 0000000..c795559
--- /dev/null
+++ b/MyApplication2/app/src/main/res/layout/backup/content_main.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
diff --git a/MyApplication2/app/src/main/res/layout/content_main.xml b/MyApplication2/app/src/main/res/layout/content_main.xml
new file mode 100644
index 0000000..c795559
--- /dev/null
+++ b/MyApplication2/app/src/main/res/layout/content_main.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
diff --git a/MyApplication2/app/src/main/res/layout/qrcodecreate.xml b/MyApplication2/app/src/main/res/layout/qrcodecreate.xml
new file mode 100644
index 0000000..df17a33
--- /dev/null
+++ b/MyApplication2/app/src/main/res/layout/qrcodecreate.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+ //android:hint="@string/zxing_button_ok" />
+
\ No newline at end of file
diff --git a/MyApplication2/app/src/main/res/layout/regfriends.xml b/MyApplication2/app/src/main/res/layout/regfriends.xml
new file mode 100644
index 0000000..817233e
--- /dev/null
+++ b/MyApplication2/app/src/main/res/layout/regfriends.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MyApplication2/app/src/main/res/layout/sample_action_provider.xml b/MyApplication2/app/src/main/res/layout/sample_action_provider.xml
new file mode 100644
index 0000000..ed42f2c
--- /dev/null
+++ b/MyApplication2/app/src/main/res/layout/sample_action_provider.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/MyApplication2/app/src/main/res/menu/action_bar_menu.xml b/MyApplication2/app/src/main/res/menu/action_bar_menu.xml
new file mode 100644
index 0000000..581841a
--- /dev/null
+++ b/MyApplication2/app/src/main/res/menu/action_bar_menu.xml
@@ -0,0 +1,7 @@
+
+
\ No newline at end of file
diff --git a/MyApplication2/app/src/main/res/menu/action_var_menu2.xml b/MyApplication2/app/src/main/res/menu/action_var_menu2.xml
new file mode 100644
index 0000000..a51ddad
--- /dev/null
+++ b/MyApplication2/app/src/main/res/menu/action_var_menu2.xml
@@ -0,0 +1,10 @@
+
+
diff --git a/MyApplication2/app/src/main/res/menu/menu_main.xml b/MyApplication2/app/src/main/res/menu/menu_main.xml
new file mode 100644
index 0000000..b1cb908
--- /dev/null
+++ b/MyApplication2/app/src/main/res/menu/menu_main.xml
@@ -0,0 +1,6 @@
+
diff --git a/MyApplication2/app/src/main/res/menu/qr.xml b/MyApplication2/app/src/main/res/menu/qr.xml
new file mode 100644
index 0000000..fe187c0
--- /dev/null
+++ b/MyApplication2/app/src/main/res/menu/qr.xml
@@ -0,0 +1,4 @@
+
+
\ No newline at end of file
diff --git a/MyApplication2/app/src/main/res/menu/reg.xml b/MyApplication2/app/src/main/res/menu/reg.xml
new file mode 100644
index 0000000..2a029a3
--- /dev/null
+++ b/MyApplication2/app/src/main/res/menu/reg.xml
@@ -0,0 +1,10 @@
+
+
diff --git a/MyApplication2/app/src/main/res/mipmap-hdpi/ic_launcher.png b/MyApplication2/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
Binary files /dev/null and b/MyApplication2/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/MyApplication2/app/src/main/res/mipmap-mdpi/ic_launcher.png b/MyApplication2/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
Binary files /dev/null and b/MyApplication2/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/MyApplication2/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/MyApplication2/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
Binary files /dev/null and b/MyApplication2/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/MyApplication2/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/MyApplication2/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
Binary files /dev/null and b/MyApplication2/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/MyApplication2/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/MyApplication2/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..aee44e1
Binary files /dev/null and b/MyApplication2/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/MyApplication2/app/src/main/res/values-v21/styles.xml b/MyApplication2/app/src/main/res/values-v21/styles.xml
new file mode 100644
index 0000000..65d0c39
--- /dev/null
+++ b/MyApplication2/app/src/main/res/values-v21/styles.xml
@@ -0,0 +1,8 @@
+>
+
+
diff --git a/MyApplication2/app/src/main/res/values-w820dp/dimens.xml b/MyApplication2/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/MyApplication2/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/MyApplication2/app/src/main/res/values/colors.xml b/MyApplication2/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..3ab3e9c
--- /dev/null
+++ b/MyApplication2/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #3F51B5
+ #303F9F
+ #FF4081
+
diff --git a/MyApplication2/app/src/main/res/values/dimens.xml b/MyApplication2/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..812cb7b
--- /dev/null
+++ b/MyApplication2/app/src/main/res/values/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 16dp
+ 16dp
+ 16dp
+
diff --git a/MyApplication2/app/src/main/res/values/strings.xml b/MyApplication2/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..fd2ffa3
--- /dev/null
+++ b/MyApplication2/app/src/main/res/values/strings.xml
@@ -0,0 +1,6 @@
+
+ Hello world!
+ My Application2
+ Settings
+ ユーザIDを入力してください
+
diff --git a/MyApplication2/app/src/main/res/values/styles.xml b/MyApplication2/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..44f664f
--- /dev/null
+++ b/MyApplication2/app/src/main/res/values/styles.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
diff --git a/MyApplication2/app/src/test/java/com/example/enpit_itw_esaka/myapplication2/ExampleUnitTest.java b/MyApplication2/app/src/test/java/com/example/enpit_itw_esaka/myapplication2/ExampleUnitTest.java
new file mode 100644
index 0000000..6317a85
--- /dev/null
+++ b/MyApplication2/app/src/test/java/com/example/enpit_itw_esaka/myapplication2/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package com.example.enpit_itw_esaka.myapplication2;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/MyApplication2/build.gradle b/MyApplication2/build.gradle
new file mode 100644
index 0000000..be515a8
--- /dev/null
+++ b/MyApplication2/build.gradle
@@ -0,0 +1,23 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.3.0'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/MyApplication2/friend_registor.php b/MyApplication2/friend_registor.php
new file mode 100644
index 0000000..e767f8a
--- /dev/null
+++ b/MyApplication2/friend_registor.php
@@ -0,0 +1,30 @@
+setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
+ $sql = 'INSERT INTO friends (user_id, friendsid) VALUES (:user_id, :friend_id)';
+ $stmt = $dbh->prepare($sql);
+ $stmt->bindValue(':friend_id', $friend_id, PDO::PARAM_INT);
+ $stmt->bindValue(':user_id', $user_id, PDO::PARAM_INT);
+
+ $stmt->execute(array($_POST["user_id"], $_POST["friend_id"]));
+ echo 1;
+ }
+ }catch (PDOException $e){
+ //print('Connection failed : ' .$e->getMessage());
+ echo -1;
+ die();
+ }
+?>
diff --git a/MyApplication2/gradle.properties b/MyApplication2/gradle.properties
new file mode 100644
index 0000000..1d3591c
--- /dev/null
+++ b/MyApplication2/gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
\ No newline at end of file
diff --git a/MyApplication2/gradle/wrapper/gradle-wrapper.jar b/MyApplication2/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..8c0fb64
Binary files /dev/null and b/MyApplication2/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/MyApplication2/gradle/wrapper/gradle-wrapper.properties b/MyApplication2/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..70eef2a
--- /dev/null
+++ b/MyApplication2/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Oct 07 16:28:46 JST 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
diff --git a/MyApplication2/gradlew b/MyApplication2/gradlew
new file mode 100644
index 0000000..91a7e26
--- /dev/null
+++ b/MyApplication2/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/MyApplication2/gradlew.bat b/MyApplication2/gradlew.bat
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/MyApplication2/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/MyApplication2/settings.gradle b/MyApplication2/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/MyApplication2/settings.gradle
@@ -0,0 +1 @@
+include ':app'
diff --git a/SampleActionProvider b/SampleActionProvider
new file mode 100644
index 0000000..0fe7262
--- /dev/null
+++ b/SampleActionProvider
@@ -0,0 +1,102 @@
+package com.example.enpit_itw_esaka.myapplication2;
+
+import android.app.Activity;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Color;
+import android.view.ActionProvider;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.WriterException;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.qrcode.QRCodeWriter;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.WriteAbortedException;
+import java.util.Hashtable;
+
+import static android.support.v4.app.ActivityCompat.startActivity;
+
+//「ActionProvider」クラスを継承したクラスを作成する
+public class SampleActionProvider extends ActionProvider implements OnClickListener{
+ private Context mContext;
+ private Button btn;
+ private LinearLayout linearLayout;
+ private PendingIntent pendingintent;
+
+ //コンストラクタ
+ public SampleActionProvider(Context context){
+ super(context);
+ //コンテキストを保持する
+ mContext = context;
+ }
+
+ //アクションビュー生成時に呼ばれる
+ @Override
+ public View onCreateActionView() {
+ //「LayoutInflater」インスタンスを取得する
+ LayoutInflater layoutInflater = LayoutInflater.from(mContext);
+
+ //レイアウトファイル「sample_action_provider.xml」をインスタンス化する
+ View view = layoutInflater.inflate(R.layout.sample_action_provider, null);
+
+ // Buttonインスタンスを取得する
+ btn = (Button) view.findViewById(R.id.button);
+
+ //クイックリスナーをセットする
+ btn.setOnClickListener(this);
+ return view;
+ }
+
+ @Override
+ public void onClick(View v){
+/*
+ //QRコード作成時に実行するインテントを生成
+ Intent intent = new Intent(mContext, QRcodeCreate.class);
+ intent.putExtra("userID", 111111);
+ startActivity(intent);
+ */
+/*
+ //QRコードの作成
+ try {
+ String number = "111111";
+
+ QRCodeWriter writer = new QRCodeWriter();
+ //エンコード
+ BitMatrix bm = null;
+ bm = writer.encode(number, BarcodeFormat.QR_CODE, 100, 100);
+ //ピクセルを作る
+ int width = bm.getWidth();
+ int height = bm.getHeight();
+ int[] pixels = new int[width * height];
+ //データがあるところだけ黒にする
+ for(int y=0; y
+
diff --git a/cakephp/.editorconfig b/cakephp/.editorconfig
new file mode 100644
index 0000000..74a1d63
--- /dev/null
+++ b/cakephp/.editorconfig
@@ -0,0 +1,17 @@
+; This file is for unifying the coding style for different editors and IDEs.
+; More information at http://editorconfig.org
+
+root = true
+
+[*]
+indent_style = tab
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.bat]
+end_of_line = crlf
+
+[*.yml]
+indent_style = space
+indent_size = 2
diff --git a/cakephp/.gitattributes b/cakephp/.gitattributes
new file mode 100644
index 0000000..3c21bde
--- /dev/null
+++ b/cakephp/.gitattributes
@@ -0,0 +1,38 @@
+# Define the line ending behavior of the different file extensions
+# Set default behaviour, in case users don't have core.autocrlf set.
+* text=auto
+* text eol=lf
+
+# Explicitly declare text files we want to always be normalized and converted
+# to native line endings on checkout.
+*.php text
+*.default text
+*.ctp text
+*.sql text
+*.md text
+*.po text
+*.js text
+*.css text
+*.ini text
+*.properties text
+*.txt text
+*.xml text
+*.yml text
+.htaccess text
+
+# Declare files that will always have CRLF line endings on checkout.
+*.bat eol=crlf
+
+# Declare files that will always have LF line endings on checkout.
+*.pem eol=lf
+
+# Denote all files that are truly binary and should not be modified.
+*.png binary
+*.jpg binary
+*.gif binary
+*.ico binary
+*.mo binary
+*.pdf binary
+*.woff binary
+*.ttf binary
+*.eot binary
diff --git a/cakephp/.gitignore b/cakephp/.gitignore
new file mode 100644
index 0000000..3499030
--- /dev/null
+++ b/cakephp/.gitignore
@@ -0,0 +1,27 @@
+# User specific & automatically generated files #
+#################################################
+/app/Config/database.php
+/app/tmp
+/lib/Cake/Console/Templates/skel/tmp/
+/plugins
+/vendors
+/build
+/dist
+/tags
+*.mo
+
+# IDE and editor specific files #
+#################################
+/nbproject
+.idea
+
+# OS generated files #
+######################
+.DS_Store
+.DS_Store?
+._*
+.Spotlight-V100
+.Trashes
+Icon?
+ehthumbs.db
+Thumbs.db
diff --git a/cakephp/.htaccess b/cakephp/.htaccess
new file mode 100644
index 0000000..2ac5e0e
--- /dev/null
+++ b/cakephp/.htaccess
@@ -0,0 +1,5 @@
+
+ RewriteEngine on
+ RewriteRule ^$ app/webroot/ [L]
+ RewriteRule (.*) app/webroot/$1 [L]
+
\ No newline at end of file
diff --git a/cakephp/.travis.yml b/cakephp/.travis.yml
new file mode 100644
index 0000000..8276195
--- /dev/null
+++ b/cakephp/.travis.yml
@@ -0,0 +1,129 @@
+language: php
+
+php:
+ - 5.3
+ - 5.4
+ - 5.5
+ - 5.6
+
+env:
+ - DB=mysql
+
+services:
+ - memcached
+
+matrix:
+ fast_finish: true
+ include:
+ - php: 5.4
+ env: DB=pgsql
+
+ - php: 5.4
+ env: DB=sqlite
+
+ - php: 5.4
+ env: PHPCS=1
+
+
+before_script:
+ - sh -c "composer global require 'phpunit/phpunit=3.7.33'"
+ - sh -c "ln -s ~/.composer/vendor/phpunit/phpunit/PHPUnit ./vendors/PHPUnit"
+ - sudo locale-gen de_DE
+ - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi"
+ - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test2;'; fi"
+ - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test3;'; fi"
+ - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi"
+ - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA test2;' -U postgres -d cakephp_test; fi"
+ - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA test3;' -U postgres -d cakephp_test; fi"
+ - chmod -R 777 ./app/tmp
+ - sudo apt-get install lighttpd
+ - sh -c "if [ '$PHPCS' = '1' ]; then composer global require 'cakephp/cakephp-codesniffer:1.*'; fi"
+ - sh -c "if [ '$PHPCS' = '1' ]; then ~/.composer/vendor/bin/phpcs --config-set installed_paths ~/.composer/vendor/cakephp/cakephp-codesniffer; fi"
+ - echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
+ - phpenv rehash
+ - set +H
+ - echo " array(
+ 'datasource' => 'Database/Mysql',
+ 'host' => '0.0.0.0',
+ 'login' => 'travis'
+ ),
+ 'pgsql' => array(
+ 'datasource' => 'Database/Postgres',
+ 'host' => '127.0.0.1',
+ 'login' => 'postgres',
+ 'database' => 'cakephp_test',
+ 'schema' => array(
+ 'default' => 'public',
+ 'test' => 'public',
+ 'test2' => 'test2',
+ 'test_database_three' => 'test3'
+ )
+ ),
+ 'sqlite' => array(
+ 'datasource' => 'Database/Sqlite',
+ 'database' => array(
+ 'default' => ':memory:',
+ 'test' => ':memory:',
+ 'test2' => '/tmp/cakephp_test2.db',
+ 'test_database_three' => '/tmp/cakephp_test3.db'
+ ),
+ )
+ );
+ public \$default = array(
+ 'persistent' => false,
+ 'host' => '',
+ 'login' => '',
+ 'password' => '',
+ 'database' => 'cakephp_test',
+ 'prefix' => ''
+ );
+ public \$test = array(
+ 'persistent' => false,
+ 'host' => '',
+ 'login' => '',
+ 'password' => '',
+ 'database' => 'cakephp_test',
+ 'prefix' => ''
+ );
+ public \$test2 = array(
+ 'persistent' => false,
+ 'host' => '',
+ 'login' => '',
+ 'password' => '',
+ 'database' => 'cakephp_test2',
+ 'prefix' => ''
+ );
+ public \$test_database_three = array(
+ 'persistent' => false,
+ 'host' => '',
+ 'login' => '',
+ 'password' => '',
+ 'database' => 'cakephp_test3',
+ 'prefix' => ''
+ );
+ public function __construct() {
+ \$db = 'mysql';
+ if (!empty(\$_SERVER['DB'])) {
+ \$db = \$_SERVER['DB'];
+ }
+ foreach (array('default', 'test', 'test2', 'test_database_three') as \$source) {
+ \$config = array_merge(\$this->{\$source}, \$this->identities[\$db]);
+ if (is_array(\$config['database'])) {
+ \$config['database'] = \$config['database'][\$source];
+ }
+ if (!empty(\$config['schema']) && is_array(\$config['schema'])) {
+ \$config['schema'] = \$config['schema'][\$source];
+ }
+ \$this->{\$source} = \$config;
+ }
+ }
+ }" > app/Config/database.php
+script:
+ - sh -c "if [ '$PHPCS' != '1' ]; then ./lib/Cake/Console/cake test core AllTests --stderr; fi"
+ - sh -c "if [ '$PHPCS' = '1' ]; then ~/.composer/vendor/bin/phpcs -p --extensions=php --standard=CakePHP ./lib/Cake; fi;"
+
+notifications:
+ email: false
diff --git a/cakephp/CONTRIBUTING.md b/cakephp/CONTRIBUTING.md
new file mode 100644
index 0000000..c991e24
--- /dev/null
+++ b/cakephp/CONTRIBUTING.md
@@ -0,0 +1,77 @@
+# How to contribute
+
+CakePHP loves to welcome your contributions. There are several ways to help out:
+* Create an [issue](https://github.com/cakephp/cakephp/issues) on GitHub, if you have found a bug
+* Write test cases for open bug issues
+* Write patches for open bug/feature issues, preferably with test cases included
+* Contribute to the [documentation](https://github.com/cakephp/docs)
+
+There are a few guidelines that we need contributors to follow so that we have a
+chance of keeping on top of things.
+
+## Getting Started
+
+* Make sure you have a [GitHub account](https://github.com/signup/free).
+* Submit an [issue](https://github.com/cakephp/cakephp/issues), assuming one does not already exist.
+ * Clearly describe the issue including steps to reproduce when it is a bug.
+ * Make sure you fill in the earliest version that you know has the issue.
+* Fork the repository on GitHub.
+
+## Making Changes
+
+* Create a topic branch from where you want to base your work.
+ * This is usually the master branch.
+ * Only target release branches if you are certain your fix must be on that
+ branch.
+ * To quickly create a topic branch based on master; `git branch
+ master/my_contribution master` then checkout the new branch with `git
+ checkout master/my_contribution`. Better avoid working directly on the
+ `master` branch, to avoid conflicts if you pull in updates from origin.
+* Make commits of logical units.
+* Check for unnecessary whitespace with `git diff --check` before committing.
+* Use descriptive commit messages and reference the #issue number.
+* Core test cases should continue to pass. You can run tests locally or enable
+ [travis-ci](https://travis-ci.org/) for your fork, so all tests and codesniffs
+ will be executed.
+* Your work should apply the [CakePHP coding standards](http://book.cakephp.org/2.0/en/contributing/cakephp-coding-conventions.html).
+
+## Which branch to base the work
+
+* Bugfix branches will be based on master.
+* New features that are backwards compatible will be based on next minor release
+ branch.
+* New features or other non backwards compatible changes will go in the next major release branch.
+
+## Submitting Changes
+
+* Push your changes to a topic branch in your fork of the repository.
+* Submit a pull request to the repository in the cakephp organization, with the
+ correct target branch.
+
+## Test cases and codesniffer
+
+CakePHP tests requires [PHPUnit](http://www.phpunit.de/manual/current/en/installation.html)
+3.7, version 4 is not compatible. To run the test cases locally use the following command:
+
+ ./lib/Cake/Console/cake test core AllTests --stderr
+
+To run the sniffs for CakePHP coding standards:
+
+ phpcs -p --extensions=php --standard=CakePHP ./lib/Cake
+
+Check the [cakephp-codesniffer](https://github.com/cakephp/cakephp-codesniffer)
+repository to setup the CakePHP standard. The [README](https://github.com/cakephp/cakephp-codesniffer/blob/master/README.md) contains installation info
+for the sniff and phpcs.
+
+## Reporting a Security Issue
+
+If you've found a security related issue in CakePHP, please don't open an issue in GitHub. Instead contact us at security@cakephp.org. For more information on how we handle security issues, [see the CakePHP Security Issue Process](http://book.cakephp.org/2.0/en/contributing/tickets.html#reporting-security-issues).
+
+# Additional Resources
+
+* [CakePHP coding standards](http://book.cakephp.org/2.0/en/contributing/cakephp-coding-conventions.html)
+* [Existing issues](https://github.com/cakephp/cakephp/issues)
+* [Development Roadmaps](https://github.com/cakephp/cakephp/wiki#roadmaps)
+* [General GitHub documentation](https://help.github.com/)
+* [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
+* #cakephp IRC channel on freenode.org
diff --git a/cakephp/README.md b/cakephp/README.md
new file mode 100644
index 0000000..d427d60
--- /dev/null
+++ b/cakephp/README.md
@@ -0,0 +1,50 @@
+# CakePHP
+
+[](https://packagist.org/packages/cakephp/cakephp)
+[](https://packagist.org/packages/cakephp/cakephp)
+[](http://travis-ci.org/cakephp/cakephp)
+[](http://squizlabs.github.io/PHP_CodeSniffer/analysis/cakephp/cakephp/)
+
+[](http://www.cakephp.org)
+
+CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Active Record, Association Data Mapping, Front Controller and MVC.
+Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility.
+
+
+## Some Handy Links
+
+[CakePHP](http://www.cakephp.org) - The rapid development PHP framework
+
+[CookBook](http://book.cakephp.org) - THE CakePHP user documentation; start learning here!
+
+[API](http://api.cakephp.org) - A reference to CakePHP's classes
+
+[Plugins](http://plugins.cakephp.org/) - A repository of extensions to the framework
+
+[The Bakery](http://bakery.cakephp.org) - Tips, tutorials and articles
+
+[Community Center](http://community.cakephp.org) - A source for everything community related
+
+[Training](http://training.cakephp.org) - Join a live session and get skilled with the framework
+
+[CakeFest](http://cakefest.org) - Don't miss our annual CakePHP conference
+
+[Cake Software Foundation](http://cakefoundation.org) - Promoting development related to CakePHP
+
+
+## Get Support!
+
+[#cakephp](http://webchat.freenode.net/?channels=#cakephp) on irc.freenode.net - Come chat with us, we have cake
+
+[Google Group](https://groups.google.com/group/cake-php) - Community mailing list and forum
+
+[GitHub Issues](https://github.com/cakephp/cakephp/issues) - Got issues? Please tell us!
+
+[Roadmaps](https://github.com/cakephp/cakephp/wiki#roadmaps) - Want to contribute? Get involved!
+
+
+## Contributing
+
+[CONTRIBUTING.md](CONTRIBUTING.md) - Quick pointers for contributing to the CakePHP project
+
+[CookBook "Contributing" Section (2.x)](http://book.cakephp.org/2.0/en/contributing.html) [(3.0)](http://book.cakephp.org/3.0/en/contributing.html) - Version-specific details about contributing to the project
diff --git a/cakephp/app/.htaccess b/cakephp/app/.htaccess
new file mode 100644
index 0000000..128e787
--- /dev/null
+++ b/cakephp/app/.htaccess
@@ -0,0 +1,5 @@
+
+ RewriteEngine on
+ RewriteRule ^$ webroot/ [L]
+ RewriteRule (.*) webroot/$1 [L]
+
\ No newline at end of file
diff --git a/cakephp/app/Config/Schema/db_acl.php b/cakephp/app/Config/Schema/db_acl.php
new file mode 100644
index 0000000..967abbe
--- /dev/null
+++ b/cakephp/app/Config/Schema/db_acl.php
@@ -0,0 +1,102 @@
+ array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
+ 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+ 'model' => array('type' => 'string', 'null' => true),
+ 'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+ 'alias' => array('type' => 'string', 'null' => true),
+ 'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+ 'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+ 'indexes' => array(
+ 'PRIMARY' => array('column' => 'id', 'unique' => 1),
+ 'idx_acos_lft_rght' => array('column' => array('lft', 'rght'), 'unique' => 0),
+ 'idx_acos_alias' => array('column' => 'alias', 'unique' => 0)
+ )
+ );
+
+/**
+ * ARO - Access Request Object - Something that wants something
+ */
+ public $aros = array(
+ 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
+ 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+ 'model' => array('type' => 'string', 'null' => true),
+ 'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+ 'alias' => array('type' => 'string', 'null' => true),
+ 'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+ 'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+ 'indexes' => array(
+ 'PRIMARY' => array('column' => 'id', 'unique' => 1),
+ 'idx_aros_lft_rght' => array('column' => array('lft', 'rght'), 'unique' => 0),
+ 'idx_aros_alias' => array('column' => 'alias', 'unique' => 0)
+ )
+ );
+
+/**
+ * Used by the Cake::Model:Permission class.
+ * Checks if the given $aro has access to action $action in $aco.
+ */
+ public $aros_acos = array(
+ 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
+ 'aro_id' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
+ 'aco_id' => array('type' => 'integer', 'null' => false, 'length' => 10),
+ '_create' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
+ '_read' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
+ '_update' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
+ '_delete' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
+ 'indexes' => array(
+ 'PRIMARY' => array('column' => 'id', 'unique' => 1),
+ 'ARO_ACO_KEY' => array('column' => array('aro_id', 'aco_id'), 'unique' => 1),
+ 'idx_aco_id' => array('column' => 'aco_id', 'unique' => 0)
+ )
+ );
+
+}
diff --git a/cakephp/app/Config/Schema/db_acl.sql b/cakephp/app/Config/Schema/db_acl.sql
new file mode 100644
index 0000000..0bf3f76
--- /dev/null
+++ b/cakephp/app/Config/Schema/db_acl.sql
@@ -0,0 +1,52 @@
+# $Id$
+#
+# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
+#
+# Licensed under The MIT License
+# For full copyright and license information, please see the LICENSE.txt
+# Redistributions of files must retain the above copyright notice.
+# MIT License (http://www.opensource.org/licenses/mit-license.php)
+
+CREATE TABLE acos (
+ id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ parent_id INTEGER(10) DEFAULT NULL,
+ model VARCHAR(255) DEFAULT '',
+ foreign_key INTEGER(10) UNSIGNED DEFAULT NULL,
+ alias VARCHAR(255) DEFAULT '',
+ lft INTEGER(10) DEFAULT NULL,
+ rght INTEGER(10) DEFAULT NULL,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE aros_acos (
+ id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ aro_id INTEGER(10) UNSIGNED NOT NULL,
+ aco_id INTEGER(10) UNSIGNED NOT NULL,
+ _create CHAR(2) NOT NULL DEFAULT 0,
+ _read CHAR(2) NOT NULL DEFAULT 0,
+ _update CHAR(2) NOT NULL DEFAULT 0,
+ _delete CHAR(2) NOT NULL DEFAULT 0,
+ PRIMARY KEY(id)
+);
+
+CREATE TABLE aros (
+ id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ parent_id INTEGER(10) DEFAULT NULL,
+ model VARCHAR(255) DEFAULT '',
+ foreign_key INTEGER(10) UNSIGNED DEFAULT NULL,
+ alias VARCHAR(255) DEFAULT '',
+ lft INTEGER(10) DEFAULT NULL,
+ rght INTEGER(10) DEFAULT NULL,
+ PRIMARY KEY (id)
+);
+
+/* this indexes will improve acl perfomance */
+CREATE INDEX idx_acos_lft_rght ON `acos` (`lft`, `rght`);
+
+CREATE INDEX idx_acos_alias ON `acos` (`alias`);
+
+CREATE INDEX idx_aros_lft_rght ON `aros` (`lft`, `rght`);
+
+CREATE INDEX idx_aros_alias ON `aros` (`alias`);
+
+CREATE INDEX idx_aco_id ON `aros_acos` (`aco_id`);
diff --git a/cakephp/app/Config/Schema/i18n.php b/cakephp/app/Config/Schema/i18n.php
new file mode 100644
index 0000000..15a446b
--- /dev/null
+++ b/cakephp/app/Config/Schema/i18n.php
@@ -0,0 +1,61 @@
+ array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
+ 'locale' => array('type' => 'string', 'null' => false, 'length' => 6, 'key' => 'index'),
+ 'model' => array('type' => 'string', 'null' => false, 'key' => 'index'),
+ 'foreign_key' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
+ 'field' => array('type' => 'string', 'null' => false, 'key' => 'index'),
+ 'content' => array('type' => 'text', 'null' => true, 'default' => null),
+ 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'locale' => array('column' => 'locale', 'unique' => 0), 'model' => array('column' => 'model', 'unique' => 0), 'row_id' => array('column' => 'foreign_key', 'unique' => 0), 'field' => array('column' => 'field', 'unique' => 0))
+ );
+
+}
diff --git a/cakephp/app/Config/Schema/i18n.sql b/cakephp/app/Config/Schema/i18n.sql
new file mode 100644
index 0000000..66a42bd
--- /dev/null
+++ b/cakephp/app/Config/Schema/i18n.sql
@@ -0,0 +1,27 @@
+# $Id$
+#
+# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
+#
+# Licensed under The MIT License
+# For full copyright and license information, please see the LICENSE.txt
+# Redistributions of files must retain the above copyright notice.
+# MIT License (http://www.opensource.org/licenses/mit-license.php)
+
+CREATE TABLE i18n (
+ id int(10) NOT NULL auto_increment,
+ locale varchar(6) NOT NULL,
+ model varchar(255) NOT NULL,
+ foreign_key int(10) NOT NULL,
+ field varchar(255) NOT NULL,
+ content mediumtext,
+ PRIMARY KEY (id),
+# UNIQUE INDEX I18N_LOCALE_FIELD(locale, model, foreign_key, field),
+# INDEX I18N_LOCALE_ROW(locale, model, foreign_key),
+# INDEX I18N_LOCALE_MODEL(locale, model),
+# INDEX I18N_FIELD(model, foreign_key, field),
+# INDEX I18N_ROW(model, foreign_key),
+ INDEX locale (locale),
+ INDEX model (model),
+ INDEX row_id (foreign_key),
+ INDEX field (field)
+);
\ No newline at end of file
diff --git a/cakephp/app/Config/Schema/sessions.php b/cakephp/app/Config/Schema/sessions.php
new file mode 100644
index 0000000..27f76d0
--- /dev/null
+++ b/cakephp/app/Config/Schema/sessions.php
@@ -0,0 +1,57 @@
+ array('type' => 'string', 'null' => false, 'key' => 'primary'),
+ 'data' => array('type' => 'text', 'null' => true, 'default' => null),
+ 'expires' => array('type' => 'integer', 'null' => true, 'default' => null),
+ 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
+ );
+
+}
diff --git a/cakephp/app/Config/Schema/sessions.sql b/cakephp/app/Config/Schema/sessions.sql
new file mode 100644
index 0000000..76845bd
--- /dev/null
+++ b/cakephp/app/Config/Schema/sessions.sql
@@ -0,0 +1,17 @@
+# $Id$
+#
+# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
+# 1785 E. Sahara Avenue, Suite 490-204
+# Las Vegas, Nevada 89104
+#
+# Licensed under The MIT License
+# For full copyright and license information, please see the LICENSE.txt
+# Redistributions of files must retain the above copyright notice.
+# MIT License (http://www.opensource.org/licenses/mit-license.php)
+
+CREATE TABLE cake_sessions (
+ id varchar(255) NOT NULL default '',
+ data text,
+ expires int(11) default NULL,
+ PRIMARY KEY (id)
+);
\ No newline at end of file
diff --git a/cakephp/app/Config/acl.ini.php b/cakephp/app/Config/acl.ini.php
new file mode 100644
index 0000000..9a46721
--- /dev/null
+++ b/cakephp/app/Config/acl.ini.php
@@ -0,0 +1,65 @@
+;
+;/**
+; * ACL Configuration
+; *
+; * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+; * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
+; *
+; * Licensed under The MIT License
+; * Redistributions of files must retain the above copyright notice.
+; *
+; * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
+; * @link http://cakephp.org CakePHP(tm) Project
+; * @package app.Config
+; * @since CakePHP(tm) v 0.10.0.1076
+; * @license http://www.opensource.org/licenses/mit-license.php MIT License
+; */
+
+; acl.ini.php - Cake ACL Configuration
+; ---------------------------------------------------------------------
+; Use this file to specify user permissions.
+; aco = access control object (something in your application)
+; aro = access request object (something requesting access)
+;
+; User records are added as follows:
+;
+; [uid]
+; groups = group1, group2, group3
+; allow = aco1, aco2, aco3
+; deny = aco4, aco5, aco6
+;
+; Group records are added in a similar manner:
+;
+; [gid]
+; allow = aco1, aco2, aco3
+; deny = aco4, aco5, aco6
+;
+; The allow, deny, and groups sections are all optional.
+; NOTE: groups names *cannot* ever be the same as usernames!
+;
+; ACL permissions are checked in the following order:
+; 1. Check for user denies (and DENY if specified)
+; 2. Check for user allows (and ALLOW if specified)
+; 3. Gather user's groups
+; 4. Check group denies (and DENY if specified)
+; 5. Check group allows (and ALLOW if specified)
+; 6. If no aro, aco, or group information is found, DENY
+;
+; ---------------------------------------------------------------------
+
+;-------------------------------------
+;Users
+;-------------------------------------
+
+[username-goes-here]
+groups = group1, group2
+deny = aco1, aco2
+allow = aco3, aco4
+
+;-------------------------------------
+;Groups
+;-------------------------------------
+
+[groupname-goes-here]
+deny = aco5, aco6
+allow = aco7, aco8
diff --git a/cakephp/app/Config/acl.php b/cakephp/app/Config/acl.php
new file mode 100644
index 0000000..bfdce6f
--- /dev/null
+++ b/cakephp/app/Config/acl.php
@@ -0,0 +1,145 @@
+Auth->authorize = array('Actions' => array('actionPath' => 'controllers/'),...)
+ *
+ * Now, when a user (i.e. jeff) authenticates successfully and requests a controller action (i.e. /invoices/delete)
+ * that is not allowed by default (e.g. via $this->Auth->allow('edit') in the Invoices controller) then AuthComponent
+ * will ask the configured ACL interface if access is granted. Under the assumptions 1. and 2. this will be
+ * done via a call to Acl->check() with
+ *
+ * ```
+ * array('User' => array('username' => 'jeff', 'group_id' => 4, ...))
+ * ```
+ *
+ * as ARO and
+ *
+ * ```
+ * '/controllers/invoices/delete'
+ * ```
+ *
+ * as ACO.
+ *
+ * If the configured map looks like
+ *
+ * ```
+ * $config['map'] = array(
+ * 'User' => 'User/username',
+ * 'Role' => 'User/group_id',
+ * );
+ * ```
+ *
+ * then PhpAcl will lookup if we defined a role like User/jeff. If that role is not found, PhpAcl will try to
+ * find a definition for Role/4. If the definition isn't found then a default role (Role/default) will be used to
+ * check rules for the given ACO. The search can be expanded by defining aliases in the alias configuration.
+ * E.g. if you want to use a more readable name than Role/4 in your definitions you can define an alias like
+ *
+ * ```
+ * $config['alias'] = array(
+ * 'Role/4' => 'Role/editor',
+ * );
+ * ```
+ *
+ * In the roles configuration you can define roles on the lhs and inherited roles on the rhs:
+ *
+ * ```
+ * $config['roles'] = array(
+ * 'Role/admin' => null,
+ * 'Role/accountant' => null,
+ * 'Role/editor' => null,
+ * 'Role/manager' => 'Role/editor, Role/accountant',
+ * 'User/jeff' => 'Role/manager',
+ * );
+ * ```
+ *
+ * In this example manager inherits all rules from editor and accountant. Role/admin doesn't inherit from any role.
+ * Lets define some rules:
+ *
+ * ```
+ * $config['rules'] = array(
+ * 'allow' => array(
+ * '*' => 'Role/admin',
+ * 'controllers/users/(dashboard|profile)' => 'Role/default',
+ * 'controllers/invoices/*' => 'Role/accountant',
+ * 'controllers/articles/*' => 'Role/editor',
+ * 'controllers/users/*' => 'Role/manager',
+ * 'controllers/invoices/delete' => 'Role/manager',
+ * ),
+ * 'deny' => array(
+ * 'controllers/invoices/delete' => 'Role/accountant, User/jeff',
+ * 'controllers/articles/(delete|publish)' => 'Role/editor',
+ * ),
+ * );
+ * ```
+ *
+ * Ok, so as jeff inherits from Role/manager he's matched every rule that references User/jeff, Role/manager,
+ * Role/editor, and Role/accountant. However, for jeff, rules for User/jeff are more specific than
+ * rules for Role/manager, rules for Role/manager are more specific than rules for Role/editor and so on.
+ * This is important when allow and deny rules match for a role. E.g. Role/accountant is allowed
+ * controllers/invoices/* but at the same time controllers/invoices/delete is denied. But there is a more
+ * specific rule defined for Role/manager which is allowed controllers/invoices/delete. However, the most specific
+ * rule denies access to the delete action explicitly for User/jeff, so he'll be denied access to the resource.
+ *
+ * If we would remove the role definition for User/jeff, then jeff would be granted access as he would be resolved
+ * to Role/manager and Role/manager has an allow rule.
+ */
+
+/**
+ * The role map defines how to resolve the user record from your application
+ * to the roles you defined in the roles configuration.
+ */
+$config['map'] = array(
+ 'User' => 'User/username',
+ 'Role' => 'User/group_id',
+);
+
+/**
+ * define aliases to map your model information to
+ * the roles defined in your role configuration.
+ */
+$config['alias'] = array(
+ 'Role/4' => 'Role/editor',
+);
+
+/**
+ * role configuration
+ */
+$config['roles'] = array(
+ 'Role/admin' => null,
+);
+
+/**
+ * rule configuration
+ */
+$config['rules'] = array(
+ 'allow' => array(
+ '*' => 'Role/admin',
+ ),
+ 'deny' => array(),
+);
diff --git a/cakephp/app/Config/bootstrap.php b/cakephp/app/Config/bootstrap.php
new file mode 100644
index 0000000..7334cf9
--- /dev/null
+++ b/cakephp/app/Config/bootstrap.php
@@ -0,0 +1,115 @@
+ 'File'));
+CakePlugin::load('TwitterBootstrap');
+CakePlugin::load('BoostCake');
+/**
+ * The settings below can be used to set additional paths to models, views and controllers.
+ *
+ * App::build(array(
+ * 'Model' => array('/path/to/models/', '/next/path/to/models/'),
+ * 'Model/Behavior' => array('/path/to/behaviors/', '/next/path/to/behaviors/'),
+ * 'Model/Datasource' => array('/path/to/datasources/', '/next/path/to/datasources/'),
+ * 'Model/Datasource/Database' => array('/path/to/databases/', '/next/path/to/database/'),
+ * 'Model/Datasource/Session' => array('/path/to/sessions/', '/next/path/to/sessions/'),
+ * 'Controller' => array('/path/to/controllers/', '/next/path/to/controllers/'),
+ * 'Controller/Component' => array('/path/to/components/', '/next/path/to/components/'),
+ * 'Controller/Component/Auth' => array('/path/to/auths/', '/next/path/to/auths/'),
+ * 'Controller/Component/Acl' => array('/path/to/acls/', '/next/path/to/acls/'),
+ * 'View' => array('/path/to/views/', '/next/path/to/views/'),
+ * 'View/Helper' => array('/path/to/helpers/', '/next/path/to/helpers/'),
+ * 'Console' => array('/path/to/consoles/', '/next/path/to/consoles/'),
+ * 'Console/Command' => array('/path/to/commands/', '/next/path/to/commands/'),
+ * 'Console/Command/Task' => array('/path/to/tasks/', '/next/path/to/tasks/'),
+ * 'Lib' => array('/path/to/libs/', '/next/path/to/libs/'),
+ * 'Locale' => array('/path/to/locales/', '/next/path/to/locales/'),
+ * 'Vendor' => array('/path/to/vendors/', '/next/path/to/vendors/'),
+ * 'Plugin' => array('/path/to/plugins/', '/next/path/to/plugins/'),
+ * ));
+ *
+ */
+
+/**
+ * Custom Inflector rules can be set to correctly pluralize or singularize table, model, controller names or whatever other
+ * string is passed to the inflection functions
+ *
+ * Inflector::rules('singular', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
+ * Inflector::rules('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
+ *
+ */
+
+/**
+ * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
+ * Uncomment one of the lines below, as you need. Make sure you read the documentation on CakePlugin to use more
+ * advanced ways of loading plugins
+ *
+ * CakePlugin::loadAll(); // Loads all plugins at once
+ * CakePlugin::load('DebugKit'); //Loads a single plugin named DebugKit
+ *
+ */
+CakePlugin::load('DebugKit'); //Loads a single plugin named DebugKit
+/**
+ * To prefer app translation over plugin translation, you can set
+ *
+ * Configure::write('I18n.preferApp', true);
+ */
+
+/**
+ * You can attach event listeners to the request lifecycle as Dispatcher Filter. By default CakePHP bundles two filters:
+ *
+ * - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins
+ * - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers
+ *
+ * Feel free to remove or add filters as you see fit for your application. A few examples:
+ *
+ * Configure::write('Dispatcher.filters', array(
+ * 'MyCacheFilter', // will use MyCacheFilter class from the Routing/Filter package in your app.
+ * 'MyCacheFilter' => array('prefix' => 'my_cache_'), // will use MyCacheFilter class from the Routing/Filter package in your app with settings array.
+ * 'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin.
+ * array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch
+ * array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch
+ *
+ * ));
+ */
+Configure::write('Dispatcher.filters', array(
+ 'AssetDispatcher',
+ 'CacheDispatcher'
+));
+
+/**
+ * Configures default file logging options
+ */
+App::uses('CakeLog', 'Log');
+CakeLog::config('debug', array(
+ 'engine' => 'File',
+ 'types' => array('notice', 'info', 'debug'),
+ 'file' => 'debug',
+));
+CakeLog::config('error', array(
+ 'engine' => 'File',
+ 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'),
+ 'file' => 'error',
+));
diff --git a/cakephp/app/Config/core.php b/cakephp/app/Config/core.php
new file mode 100644
index 0000000..3ed2123
--- /dev/null
+++ b/cakephp/app/Config/core.php
@@ -0,0 +1,386 @@
+ 0
+ * and log errors with CakeLog when debug = 0.
+ *
+ * Options:
+ *
+ * - `handler` - callback - The callback to handle errors. You can set this to any callable type,
+ * including anonymous functions.
+ * Make sure you add App::uses('MyHandler', 'Error'); when using a custom handler class
+ * - `level` - integer - The level of errors you are interested in capturing.
+ * - `trace` - boolean - Include stack traces for errors in log files.
+ *
+ * @see ErrorHandler for more information on error handling and configuration.
+ */
+ Configure::write('Error', array(
+ 'handler' => 'ErrorHandler::handleError',
+ 'level' => E_ALL & ~E_DEPRECATED,
+ 'trace' => true
+ ));
+
+/**
+ * Configure the Exception handler used for uncaught exceptions. By default,
+ * ErrorHandler::handleException() is used. It will display a HTML page for the exception, and
+ * while debug > 0, framework errors like Missing Controller will be displayed. When debug = 0,
+ * framework errors will be coerced into generic HTTP errors.
+ *
+ * Options:
+ *
+ * - `handler` - callback - The callback to handle exceptions. You can set this to any callback type,
+ * including anonymous functions.
+ * Make sure you add App::uses('MyHandler', 'Error'); when using a custom handler class
+ * - `renderer` - string - The class responsible for rendering uncaught exceptions. If you choose a custom class you
+ * should place the file for that class in app/Lib/Error. This class needs to implement a render method.
+ * - `log` - boolean - Should Exceptions be logged?
+ * - `skipLog` - array - list of exceptions to skip for logging. Exceptions that
+ * extend one of the listed exceptions will also be skipped for logging.
+ * Example: `'skipLog' => array('NotFoundException', 'UnauthorizedException')`
+ *
+ * @see ErrorHandler for more information on exception handling and configuration.
+ */
+ Configure::write('Exception', array(
+ 'handler' => 'ErrorHandler::handleException',
+ 'renderer' => 'ExceptionRenderer',
+ 'log' => true
+ ));
+
+/**
+ * Application wide charset encoding
+ */
+ Configure::write('App.encoding', 'UTF-8');
+
+/**
+ * To configure CakePHP *not* to use mod_rewrite and to
+ * use CakePHP pretty URLs, remove these .htaccess
+ * files:
+ *
+ * /.htaccess
+ * /app/.htaccess
+ * /app/webroot/.htaccess
+ *
+ * And uncomment the App.baseUrl below. But keep in mind
+ * that plugin assets such as images, CSS and JavaScript files
+ * will not work without URL rewriting!
+ * To work around this issue you should either symlink or copy
+ * the plugin assets into you app's webroot directory. This is
+ * recommended even when you are using mod_rewrite. Handling static
+ * assets through the Dispatcher is incredibly inefficient and
+ * included primarily as a development convenience - and
+ * thus not recommended for production applications.
+ */
+ //Configure::write('App.baseUrl', env('SCRIPT_NAME'));
+
+/**
+ * To configure CakePHP to use a particular domain URL
+ * for any URL generation inside the application, set the following
+ * configuration variable to the http(s) address to your domain. This
+ * will override the automatic detection of full base URL and can be
+ * useful when generating links from the CLI (e.g. sending emails)
+ */
+ //Configure::write('App.fullBaseUrl', 'http://example.com');
+
+/**
+ * Web path to the public images directory under webroot.
+ * If not set defaults to 'img/'
+ */
+ //Configure::write('App.imageBaseUrl', 'img/');
+
+/**
+ * Web path to the CSS files directory under webroot.
+ * If not set defaults to 'css/'
+ */
+ //Configure::write('App.cssBaseUrl', 'css/');
+
+/**
+ * Web path to the js files directory under webroot.
+ * If not set defaults to 'js/'
+ */
+ //Configure::write('App.jsBaseUrl', 'js/');
+
+/**
+ * Uncomment the define below to use CakePHP prefix routes.
+ *
+ * The value of the define determines the names of the routes
+ * and their associated controller actions:
+ *
+ * Set to an array of prefixes you want to use in your application. Use for
+ * admin or other prefixed routes.
+ *
+ * Routing.prefixes = array('admin', 'manager');
+ *
+ * Enables:
+ * `admin_index()` and `/admin/controller/index`
+ * `manager_index()` and `/manager/controller/index`
+ *
+ */
+ //Configure::write('Routing.prefixes', array('admin'));
+
+/**
+ * Turn off all caching application-wide.
+ *
+ */
+ //Configure::write('Cache.disable', true);
+
+/**
+ * Enable cache checking.
+ *
+ * If set to true, for view caching you must still use the controller
+ * public $cacheAction inside your controllers to define caching settings.
+ * You can either set it controller-wide by setting public $cacheAction = true,
+ * or in each action using $this->cacheAction = true.
+ *
+ */
+ //Configure::write('Cache.check', true);
+
+/**
+ * Enable cache view prefixes.
+ *
+ * If set it will be prepended to the cache name for view file caching. This is
+ * helpful if you deploy the same application via multiple subdomains and languages,
+ * for instance. Each version can then have its own view cache namespace.
+ * Note: The final cache file name will then be `prefix_cachefilename`.
+ */
+ //Configure::write('Cache.viewPrefix', 'prefix');
+
+/**
+ * Session configuration.
+ *
+ * Contains an array of settings to use for session configuration. The defaults key is
+ * used to define a default preset to use for sessions, any settings declared here will override
+ * the settings of the default config.
+ *
+ * ## Options
+ *
+ * - `Session.cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'
+ * - `Session.timeout` - The number of minutes you want sessions to live for. This timeout is handled by CakePHP
+ * - `Session.cookieTimeout` - The number of minutes you want session cookies to live for.
+ * - `Session.checkAgent` - Do you want the user agent to be checked when starting sessions? You might want to set the
+ * value to false, when dealing with older versions of IE, Chrome Frame or certain web-browsing devices and AJAX
+ * - `Session.defaults` - The default configuration set to use as a basis for your session.
+ * There are four builtins: php, cake, cache, database.
+ * - `Session.handler` - Can be used to enable a custom session handler. Expects an array of callables,
+ * that can be used with `session_save_handler`. Using this option will automatically add `session.save_handler`
+ * to the ini array.
+ * - `Session.autoRegenerate` - Enabling this setting, turns on automatic renewal of sessions, and
+ * sessionids that change frequently. See CakeSession::$requestCountdown.
+ * - `Session.ini` - An associative array of additional ini values to set.
+ *
+ * The built in defaults are:
+ *
+ * - 'php' - Uses settings defined in your php.ini.
+ * - 'cake' - Saves session files in CakePHP's /tmp directory.
+ * - 'database' - Uses CakePHP's database sessions.
+ * - 'cache' - Use the Cache class to save sessions.
+ *
+ * To define a custom session handler, save it at /app/Model/Datasource/Session/.php.
+ * Make sure the class implements `CakeSessionHandlerInterface` and set Session.handler to
+ *
+ * To use database sessions, run the app/Config/Schema/sessions.php schema using
+ * the cake shell command: cake schema create Sessions
+ *
+ */
+ Configure::write('Session', array(
+ 'defaults' => 'php'
+ ));
+
+/**
+ * A random string used in security hashing methods.
+ */
+ Configure::write('Security.salt', 'BISBILHM133131Hiuhdiwg313ILdwLu1313wdhgmWIUDWLIM791279792');
+
+/**
+ * A random numeric string (digits only) used to encrypt/decrypt strings.
+ */
+ Configure::write('Security.cipherSeed', '2893470293094829375872390487092');
+
+/**
+ * Apply timestamps with the last modified time to static assets (js, css, images).
+ * Will append a query string parameter containing the time the file was modified. This is
+ * useful for invalidating browser caches.
+ *
+ * Set to `true` to apply timestamps when debug > 0. Set to 'force' to always enable
+ * timestamping regardless of debug value.
+ */
+ //Configure::write('Asset.timestamp', true);
+
+/**
+ * Compress CSS output by removing comments, whitespace, repeating tags, etc.
+ * This requires a/var/cache directory to be writable by the web server for caching.
+ * and /vendors/csspp/csspp.php
+ *
+ * To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use HtmlHelper::css().
+ */
+ //Configure::write('Asset.filter.css', 'css.php');
+
+/**
+ * Plug in your own custom JavaScript compressor by dropping a script in your webroot to handle the
+ * output, and setting the config below to the name of the script.
+ *
+ * To use, prefix your JavaScript link URLs with '/cjs/' instead of '/js/' or use JsHelper::link().
+ */
+ //Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php');
+
+/**
+ * The class name and database used in CakePHP's
+ * access control lists.
+ */
+ Configure::write('Acl.classname', 'DbAcl');
+ Configure::write('Acl.database', 'default');
+
+/**
+ * Uncomment this line and correct your server timezone to fix
+ * any date & time related errors.
+ */
+ //date_default_timezone_set('UTC');
+
+/**
+ * `Config.timezone` is available in which you can set users' timezone string.
+ * If a method of CakeTime class is called with $timezone parameter as null and `Config.timezone` is set,
+ * then the value of `Config.timezone` will be used. This feature allows you to set users' timezone just
+ * once instead of passing it each time in function calls.
+ */
+ //Configure::write('Config.timezone', 'Europe/Paris');
+
+/**
+ * Cache Engine Configuration
+ * Default settings provided below
+ *
+ * File storage engine.
+ *
+ * Cache::config('default', array(
+ * 'engine' => 'File', //[required]
+ * 'duration' => 3600, //[optional]
+ * 'probability' => 100, //[optional]
+ * 'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path
+ * 'prefix' => 'cake_', //[optional] prefix every cache file with this string
+ * 'lock' => false, //[optional] use file locking
+ * 'serialize' => true, //[optional]
+ * 'mask' => 0664, //[optional]
+ * ));
+ *
+ * APC (http://pecl.php.net/package/APC)
+ *
+ * Cache::config('default', array(
+ * 'engine' => 'Apc', //[required]
+ * 'duration' => 3600, //[optional]
+ * 'probability' => 100, //[optional]
+ * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
+ * ));
+ *
+ * Xcache (http://xcache.lighttpd.net/)
+ *
+ * Cache::config('default', array(
+ * 'engine' => 'Xcache', //[required]
+ * 'duration' => 3600, //[optional]
+ * 'probability' => 100, //[optional]
+ * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
+ * 'user' => 'user', //user from xcache.admin.user settings
+ * 'password' => 'password', //plaintext password (xcache.admin.pass)
+ * ));
+ *
+ * Memcached (http://www.danga.com/memcached/)
+ *
+ * Uses the memcached extension. See http://php.net/memcached
+ *
+ * Cache::config('default', array(
+ * 'engine' => 'Memcached', //[required]
+ * 'duration' => 3600, //[optional]
+ * 'probability' => 100, //[optional]
+ * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
+ * 'servers' => array(
+ * '127.0.0.1:11211' // localhost, default port 11211
+ * ), //[optional]
+ * 'persistent' => 'my_connection', // [optional] The name of the persistent connection.
+ * 'compress' => false, // [optional] compress data in Memcached (slower, but uses less memory)
+ * ));
+ *
+ * Wincache (http://php.net/wincache)
+ *
+ * Cache::config('default', array(
+ * 'engine' => 'Wincache', //[required]
+ * 'duration' => 3600, //[optional]
+ * 'probability' => 100, //[optional]
+ * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
+ * ));
+ */
+
+/**
+ * Configure the cache handlers that CakePHP will use for internal
+ * metadata like class maps, and model schema.
+ *
+ * By default File is used, but for improved performance you should use APC.
+ *
+ * Note: 'default' and other application caches should be configured in app/Config/bootstrap.php.
+ * Please check the comments in bootstrap.php for more info on the cache engines available
+ * and their settings.
+ */
+$engine = 'File';
+
+// In development mode, caches should expire quickly.
+$duration = '+999 days';
+if (Configure::read('debug') > 0) {
+ $duration = '+10 seconds';
+}
+
+// Prefix each application on the same server with a different string, to avoid Memcache and APC conflicts.
+$prefix = 'myapp_';
+
+/**
+ * Configure the cache used for general framework caching. Path information,
+ * object listings, and translation cache files are stored with this configuration.
+ */
+Cache::config('_cake_core_', array(
+ 'engine' => $engine,
+ 'prefix' => $prefix . 'cake_core_',
+ 'path' => CACHE . 'persistent' . DS,
+ 'serialize' => ($engine === 'File'),
+ 'duration' => $duration
+));
+
+/**
+ * Configure the cache for model and datasource caches. This cache configuration
+ * is used to store schema descriptions, and table listings in connections.
+ */
+Cache::config('_cake_model_', array(
+ 'engine' => $engine,
+ 'prefix' => $prefix . 'cake_model_',
+ 'path' => CACHE . 'models' . DS,
+ 'serialize' => ($engine === 'File'),
+ 'duration' => $duration
+));
diff --git a/cakephp/app/Config/database.php.default b/cakephp/app/Config/database.php.default
new file mode 100644
index 0000000..c8ee308
--- /dev/null
+++ b/cakephp/app/Config/database.php.default
@@ -0,0 +1,92 @@
+ The name of a supported datasource; valid options are as follows:
+ * Database/Mysql - MySQL 4 & 5,
+ * Database/Sqlite - SQLite (PHP5 only),
+ * Database/Postgres - PostgreSQL 7 and higher,
+ * Database/Sqlserver - Microsoft SQL Server 2005 and higher
+ *
+ * You can add custom database datasources (or override existing datasources) by adding the
+ * appropriate file to app/Model/Datasource/Database. Datasources should be named 'MyDatasource.php',
+ *
+ *
+ * persistent => true / false
+ * Determines whether or not the database should use a persistent connection
+ *
+ * host =>
+ * the host you connect to the database. To add a socket or port number, use 'port' => #
+ *
+ * prefix =>
+ * Uses the given prefix for all the tables in this database. This setting can be overridden
+ * on a per-table basis with the Model::$tablePrefix property.
+ *
+ * schema =>
+ * For Postgres/Sqlserver specifies which schema you would like to use the tables in.
+ * Postgres defaults to 'public'. For Sqlserver, it defaults to empty and use
+ * the connected user's default schema (typically 'dbo').
+ *
+ * encoding =>
+ * For MySQL, Postgres specifies the character encoding to use when connecting to the
+ * database. Uses database default not specified.
+ *
+ * sslmode =>
+ * For Postgres specifies whether to 'disable', 'allow', 'prefer', or 'require' SSL for the
+ * connection. The default value is 'allow'.
+ *
+ * unix_socket =>
+ * For MySQL to connect via socket specify the `unix_socket` parameter instead of `host` and `port`
+ *
+ * settings =>
+ * Array of key/value pairs, on connection it executes SET statements for each pair
+ * For MySQL : http://dev.mysql.com/doc/refman/5.6/en/set-statement.html
+ * For Postgres : http://www.postgresql.org/docs/9.2/static/sql-set.html
+ * For Sql Server : http://msdn.microsoft.com/en-us/library/ms190356.aspx
+ *
+ * flags =>
+ * A key/value array of driver specific connection options.
+ */
+class DATABASE_CONFIG {
+
+ public $default = array(
+ 'datasource' => 'Database/Mysql',
+ 'persistent' => false,
+ 'host' => 'localhost',
+ 'login' => 'user',
+ 'password' => 'password',
+ 'database' => 'database_name',
+ 'prefix' => '',
+ //'encoding' => 'utf8',
+ );
+
+ public $test = array(
+ 'datasource' => 'Database/Mysql',
+ 'persistent' => false,
+ 'host' => 'localhost',
+ 'login' => 'user',
+ 'password' => 'password',
+ 'database' => 'test_database_name',
+ 'prefix' => '',
+ //'encoding' => 'utf8',
+ );
+}
diff --git a/cakephp/app/Config/email.php.default b/cakephp/app/Config/email.php.default
new file mode 100644
index 0000000..cee93c3
--- /dev/null
+++ b/cakephp/app/Config/email.php.default
@@ -0,0 +1,94 @@
+ The name of a supported transport; valid options are as follows:
+ * Mail - Send using PHP mail function
+ * Smtp - Send using SMTP
+ * Debug - Do not send the email, just return the result
+ *
+ * You can add custom transports (or override existing transports) by adding the
+ * appropriate file to app/Network/Email. Transports should be named 'YourTransport.php',
+ * where 'Your' is the name of the transport.
+ *
+ * from =>
+ * The origin email. See CakeEmail::from() about the valid values
+ *
+ */
+class EmailConfig {
+
+ public $default = array(
+ 'transport' => 'Mail',
+ 'from' => 'you@localhost',
+ //'charset' => 'utf-8',
+ //'headerCharset' => 'utf-8',
+ );
+
+ public $smtp = array(
+ 'transport' => 'Smtp',
+ 'from' => array('site@localhost' => 'My Site'),
+ 'host' => 'localhost',
+ 'port' => 25,
+ 'timeout' => 30,
+ 'username' => 'user',
+ 'password' => 'secret',
+ 'client' => null,
+ 'log' => false,
+ //'charset' => 'utf-8',
+ //'headerCharset' => 'utf-8',
+ );
+
+ public $fast = array(
+ 'from' => 'you@localhost',
+ 'sender' => null,
+ 'to' => null,
+ 'cc' => null,
+ 'bcc' => null,
+ 'replyTo' => null,
+ 'readReceipt' => null,
+ 'returnPath' => null,
+ 'messageId' => true,
+ 'subject' => null,
+ 'message' => null,
+ 'headers' => null,
+ 'viewRender' => null,
+ 'template' => false,
+ 'layout' => false,
+ 'viewVars' => null,
+ 'attachments' => null,
+ 'emailFormat' => null,
+ 'transport' => 'Smtp',
+ 'host' => 'localhost',
+ 'port' => 25,
+ 'timeout' => 30,
+ 'username' => 'user',
+ 'password' => 'secret',
+ 'client' => null,
+ 'log' => true,
+ //'charset' => 'utf-8',
+ //'headerCharset' => 'utf-8',
+ );
+
+}
diff --git a/cakephp/app/Config/routes.php b/cakephp/app/Config/routes.php
new file mode 100644
index 0000000..a2b963f
--- /dev/null
+++ b/cakephp/app/Config/routes.php
@@ -0,0 +1,43 @@
+ 'pages', 'action' => 'display', 'home'));
+/**
+ * ...and connect the rest of 'Pages' controller's URLs.
+ */
+ Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
+
+/**
+ * Load all plugin routes. See the CakePlugin documentation on
+ * how to customize the loading of plugin routes.
+ */
+ CakePlugin::routes();
+
+/**
+ * Load the CakePHP default routes. Only remove this if you do not want to use
+ * the built-in default routes.
+ */
+ require CAKE . 'Config' . DS . 'routes.php';
diff --git a/cakephp/app/Console/Command/AppShell.php b/cakephp/app/Console/Command/AppShell.php
new file mode 100644
index 0000000..4ea0f2d
--- /dev/null
+++ b/cakephp/app/Console/Command/AppShell.php
@@ -0,0 +1,30 @@
+ array('className' => 'BoostCake.BoostCakeHtml'),
+ 'Form' => array('className' => 'BoostCake.BoostCakeForm'),
+ 'Paginator' => array('className' => 'BoostCake.BoostCakePaginator'),
+ );
+}
+?>
\ No newline at end of file
diff --git a/cakephp/app/Controller/Component/empty b/cakephp/app/Controller/Component/empty
new file mode 100644
index 0000000..e69de29
diff --git a/cakephp/app/Controller/FriendsController.php b/cakephp/app/Controller/FriendsController.php
new file mode 100644
index 0000000..051652a
--- /dev/null
+++ b/cakephp/app/Controller/FriendsController.php
@@ -0,0 +1,137 @@
+set('user', $this->Auth->user());
+ $this->layout = 'indexLayout';
+ $this->Session->write('Visitor.id',$this->Auth->user('id'));
+
+ $userdata = $this->User->find('all',
+ array(
+ 'conditions' => array('user.parentid' => 1)
+ )
+ );
+
+ $otherdata = $this->User->find('all',
+ array(
+ 'conditions' => array(
+ 'NOT' => array(
+ 'user.parentid' => ''
+ ),
+ 'NOT' => array(
+ 'user.parentid' => $this->Session->read('Visitor.id')
+ )
+ )
+ )
+ );
+
+ /* ◯◯くんの近くには誰くんと?がいます を出力*/
+ //userdataから1人取り出し、友達の情報をリストアップ
+ $frienddata = array();
+ $tmpdata = array();
+ foreach ($userdata as $dat) {
+ foreach ($dat['friend'] as $tmp) {
+ $tmpdata[] = $this->User->find('all',
+ array(
+ 'conditions' => array('user.id' => $tmp['friendsid'])
+ )
+ );
+ }
+ $frienddata[]=$tmpdata;
+ $tmpdata= array();
+ }
+ $resulttmp=array();
+
+ //子供とその友達の距離を測り、近傍に居るか否か見分ける
+ for($i=0;$iset("otherdata", $otherdata);
+ $this->set("userdata", $userdata);
+ }
+
+ //どのアクションが呼ばれてもはじめに実行される関数
+ public function beforeFilter()
+ {
+ parent::beforeFilter();
+ $this->response->disableCache();
+ //未ログインでアクセスできるアクションを指定
+ //これ以外のアクションへのアクセスはloginにリダイレクトされる規約になっている
+ $this->Auth->allow('register', 'login');
+
+ }
+
+ public function friend(){
+ $this->set('user', $this->Auth->user());
+ $this->layout = 'indexLayout';
+
+ if($this->request->is('post')){
+ $this->Friend->save($this->request->data);
+ }
+
+
+ }
+
+ public function register(){
+ //$this->requestにPOSTされたデータが入っている
+ //POSTメソッドかつユーザ追加が成功したら
+ if($this->request->is('post') && $this->User->save($this->request->data)){
+ //ログイン
+ //$this->request->dataの値を使用してログインする規約になっている
+ $this->Auth->login();
+ $this->redirect('index');
+ }
+ }
+
+
+ public function login(){
+ if($this->request->is('post')) {
+ if($this->Auth->login())
+ return $this->redirect('index');
+ else
+ $this->Session->setFlash('ログイン失敗');
+ }
+ }
+
+ public function logout(){
+ $this->Auth->logout();
+ $this->redirect('login');
+ }
+}
diff --git a/cakephp/app/Controller/PagesController.php b/cakephp/app/Controller/PagesController.php
new file mode 100644
index 0000000..359f4a2
--- /dev/null
+++ b/cakephp/app/Controller/PagesController.php
@@ -0,0 +1,78 @@
+redirect('/');
+ }
+ $page = $subpage = $title_for_layout = null;
+
+ if (!empty($path[0])) {
+ $page = $path[0];
+ }
+ if (!empty($path[1])) {
+ $subpage = $path[1];
+ }
+ if (!empty($path[$count - 1])) {
+ $title_for_layout = Inflector::humanize($path[$count - 1]);
+ }
+ $this->set(compact('page', 'subpage', 'title_for_layout'));
+
+ try {
+ $this->render(implode('/', $path));
+ } catch (MissingViewException $e) {
+ if (Configure::read('debug')) {
+ throw $e;
+ }
+ throw new NotFoundException();
+ }
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/cakephp/app/Controller/UsersController.php b/cakephp/app/Controller/UsersController.php
new file mode 100644
index 0000000..2a9865c
--- /dev/null
+++ b/cakephp/app/Controller/UsersController.php
@@ -0,0 +1,177 @@
+set('user', $this->Auth->user());
+ $this->layout = 'indexLayout';
+ $this->Session->write('Visitor.id',$this->Auth->user('id'));
+
+ $userdata = $this->User->find('all',
+ array(
+ 'conditions' => array('user.parentid' => 1)
+ )
+ );
+
+ $otherdata = $this->User->find('all',
+ array(
+ 'conditions' => array(
+ 'NOT' => array(
+ 'user.parentid' => ''
+ ),
+ 'NOT' => array(
+ 'user.parentid' => $this->Session->read('Visitor.id')
+ )
+ )
+ )
+ );
+
+ /* ◯◯くんの近くには誰くんと?がいます を出力*/
+ //userdataから1人取り出し、友達の情報をリストアップ
+ $frienddata = array();
+ $tmpdata = array();
+ foreach ($userdata as $dat) {
+ foreach ($dat['friend'] as $tmp) {
+ $tmpdata[] = $this->User->find('all',
+ array(
+ 'conditions' => array('user.id' => $tmp['friendsid'])
+ )
+ );
+ }
+ $frienddata[]=$tmpdata;
+ $tmpdata= array();
+ }
+ $resulttmp=array();
+
+ //子供とその友達の距離を測り、近傍に居るか否か見分ける
+ for($i=0;$iset("otherdata", $otherdata);
+ $this->set("userdata", $userdata);
+ }
+
+ //どのアクションが呼ばれてもはじめに実行される関数
+ public function beforeFilter()
+ {
+ parent::beforeFilter();
+ $this->response->disableCache();
+ //未ログインでアクセスできるアクションを指定
+ //これ以外のアクションへのアクセスはloginにリダイレクトされる規約になっている
+ $this->Auth->allow('register', 'login');
+
+ }
+
+ public function friend(){
+
+ //友達登録ボタンを押していたら、データベースを更新する
+ if($this->request->is('post')){
+ $this->loadModel('Friend');
+ if(isset($this->request->data['register'])) {
+ $this->Friend->save($this->request->data);
+ }
+ if(isset($this->request->data['delete'])) {
+ $delete_id = $this->Friend->find('first',
+ array(
+ 'fields' => array('friend.id'),
+ 'conditions' => array('friend.user_id' => $this->request->data['Friend']['user_id'], 'friend.friendsid' => $this->request->data['Friend']['friendsid'])
+ )
+ );
+ $this->Friend->delete($delete_id['Friend']['id']);
+ }
+ }
+
+ //ログインユーザの情報を取得する
+ $user = $this->User->find('first',
+ array(
+ 'conditions' => array('user.id' => $this->Auth->user('id'))
+ )
+ );
+
+ //ログインユーザの友達の情報を取得する
+ $friends = array();
+ foreach ($user['friend'] as $friend) {
+ array_push($friends,
+ $this->User->find('all',
+ array(
+ 'conditions' => array('user.id' => $friend['friendsid'])
+ )
+ )
+ );
+ }
+
+ $this->set('friends', $friends);
+ $this->set('user', $this->Auth->user());
+ $this->layout = 'indexLayout';
+ }
+
+
+ public function parent() {
+ $this->set('user', $this->Auth->user());
+ $this->layout = 'indexLayout';
+ }
+
+
+
+ public function register(){
+ //$this->requestにPOSTされたデータが入っている
+ //POSTメソッドかつユーザ追加が成功したら
+ if($this->request->is('post') && $this->User->save($this->request->data)){
+ //ログイン
+ //$this->request->dataの値を使用してログインする規約になっている
+ $this->Auth->login();
+ $this->redirect('index');
+ }
+ }
+
+
+ public function login(){
+ if($this->request->is('post')) {
+ if($this->Auth->login())
+ return $this->redirect('index');
+ else
+ $this->Session->setFlash('ログイン失敗');
+ }
+ }
+
+ public function logout(){
+ $this->Auth->logout();
+ $this->redirect('login');
+ }
+}
diff --git a/cakephp/app/Controller/location_distance.php b/cakephp/app/Controller/location_distance.php
new file mode 100644
index 0000000..2517864
--- /dev/null
+++ b/cakephp/app/Controller/location_distance.php
@@ -0,0 +1,30 @@
+ $distance, "distance_unit" => $distance_unit);
+}
+?>
\ No newline at end of file
diff --git a/cakephp/app/Lib/empty b/cakephp/app/Lib/empty
new file mode 100644
index 0000000..e69de29
diff --git a/cakephp/app/Locale/eng/LC_MESSAGES/empty b/cakephp/app/Locale/eng/LC_MESSAGES/empty
new file mode 100644
index 0000000..e69de29
diff --git a/cakephp/app/Model/AppModel.php b/cakephp/app/Model/AppModel.php
new file mode 100644
index 0000000..2783646
--- /dev/null
+++ b/cakephp/app/Model/AppModel.php
@@ -0,0 +1,33 @@
+data[$user['id']]['friendsid'] = AuthComponent::password($this->data[$user['id']]['friendsid'] );
+ // return true;
+ // }
+
+}
+
+?>
\ No newline at end of file
diff --git a/cakephp/app/Model/Position.php b/cakephp/app/Model/Position.php
new file mode 100644
index 0000000..28a7065
--- /dev/null
+++ b/cakephp/app/Model/Position.php
@@ -0,0 +1,14 @@
+
\ No newline at end of file
diff --git a/cakephp/app/Model/User.php b/cakephp/app/Model/User.php
new file mode 100644
index 0000000..a9cd7ff
--- /dev/null
+++ b/cakephp/app/Model/User.php
@@ -0,0 +1,49 @@
+ array(
+ array(
+ 'rule' => 'isUnique', //重複禁止
+ 'message' => '既に使用されている名前です。'
+ ),
+ array(
+ 'rule' => 'alphaNumeric', //半角英数字のみ
+ 'message' => '名前は半角英数字にしてください。'
+ ),
+ array(
+ 'rule' => array('between', 2, 32), //2~32文字
+ 'message' => '名前は2文字以上32文字以内にしてください。'
+ )
+ ),
+ 'password' => array(
+ array(
+ 'rule' => 'alphaNumeric',
+ 'message' => 'パスワードは半角英数字にしてください。'
+ ),
+ array(
+ 'rule' => array('between', 8, 32),
+ 'message' => 'パスワードは8文字以上32文字以内にしてください。'
+ )
+ )
+ );
+
+ public function beforeSave($options = array())
+ {
+ $this->data['User']['password'] = AuthComponent::password($this->data['User']['password']);
+ return true;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/cakephp/app/Plugin/DebugKit/.jshintrc b/cakephp/app/Plugin/DebugKit/.jshintrc
new file mode 100644
index 0000000..50681ab
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/.jshintrc
@@ -0,0 +1,84 @@
+{
+ // JSHint Default Configuration File (as on JSHint website)
+ // See http://jshint.com/docs/ for more details
+
+ "maxerr" : 500, // {int} Maximum error before stopping
+
+ // Enforcing
+ "bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
+ "camelcase" : true, // true: Identifiers must be in camelCase
+ "curly" : true, // true: Require {} for every new block or scope
+ "eqeqeq" : true, // true: Require triple equals (===) for comparison
+ "forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
+ "immed" : true, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
+ "indent" : 2, // {int} Number of spaces to use for indentation
+ "latedef" : false, // true: Require variables/functions to be defined before being used
+ "newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()`
+ "noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
+ "noempty" : true, // true: Prohibit use of empty blocks
+ "nonew" : true, // true: Prohibit use of constructors for side-effects (without assignment)
+ "plusplus" : false, // true: Prohibit use of `++` & `--`
+ "quotmark" : "single", // Quotation mark consistency:
+ // false : do nothing (default)
+ // true : ensure whatever is used is consistent
+ // "single" : require single quotes
+ // "double" : require double quotes
+ "undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
+ "unused" : true, // true: Require all defined variables be used
+ "strict" : true, // true: Requires all functions run in ES5 Strict Mode
+ "trailing" : true, // true: Prohibit trailing whitespaces
+ "maxparams" : false, // {int} Max number of formal params allowed per function
+ "maxdepth" : false, // {int} Max depth of nested blocks (within functions)
+ "maxstatements" : false, // {int} Max number statements per function
+ "maxcomplexity" : false, // {int} Max cyclomatic complexity per function
+ "maxlen" : 120, // {int} Max number of characters per line
+
+ // Relaxing
+ "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
+ "boss" : false, // true: Tolerate assignments where comparisons would be expected
+ "debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
+ "eqnull" : false, // true: Tolerate use of `== null`
+ "es5" : false, // true: Allow ES5 syntax (ex: getters and setters)
+ "esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`)
+ "evil" : false, // true: Tolerate use of `eval` and `new Function()`
+ "expr" : false, // true: Tolerate `ExpressionStatement` as Programs
+ "funcscope" : false, // true: Tolerate defining variables inside control statements"
+ "globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
+ "iterator" : false, // true: Tolerate using the `__iterator__` property
+ "lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
+ "laxbreak" : false, // true: Tolerate possibly unsafe line breakings
+ "laxcomma" : false, // true: Tolerate comma-first style coding
+ "loopfunc" : false, // true: Tolerate functions being defined in loops
+ "multistr" : false, // true: Tolerate multi-line strings
+ "proto" : false, // true: Tolerate using the `__proto__` property
+ "scripturl" : false, // true: Tolerate script-targeted URLs
+ "smarttabs" : false, // true: Tolerate mixed tabs/spaces when used for alignment
+ "shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
+ "sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
+ "supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
+ "validthis" : false, // true: Tolerate using this in a non-constructor function
+
+ // Environments
+ "browser" : true, // Web Browser (window, document, etc)
+ "couch" : false, // CouchDB
+ "devel" : true, // Development/debugging (alert, confirm, etc)
+ "dojo" : false, // Dojo Toolkit
+ "jquery" : false, // jQuery
+ "mootools" : false, // MooTools
+ "node" : false, // Node.js
+ "nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
+ "prototypejs" : false, // Prototype and Scriptaculous
+ "rhino" : false, // Rhino
+ "worker" : false, // Web Workers
+ "wsh" : false, // Windows Scripting Host
+ "yui" : false, // Yahoo User Interface
+
+ // Legacy
+ "nomen" : false, // true: Prohibit dangling `_` in variables
+ "onevar" : false, // true: Allow only one `var` statement per function
+ "passfail" : false, // true: Stop on first error
+ "white" : true, // true: Check against strict whitespace and indentation rules
+
+ // Custom Globals
+ "predef" : [ ] // additional predefined global variables
+}
diff --git a/cakephp/app/Plugin/DebugKit/Controller/Component/ToolbarComponent.php b/cakephp/app/Plugin/DebugKit/Controller/Component/ToolbarComponent.php
new file mode 100644
index 0000000..373b9aa
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/Controller/Component/ToolbarComponent.php
@@ -0,0 +1,4 @@
+
+# No version information was available in the source files.
+#
+#, fuzzy
+msgid ""
+msgstr "Project-Id-Version: PROJECT VERSION\n"
+ "POT-Creation-Date: 2014-01-23 08:29+0200\n"
+ "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
+ "Last-Translator: Lincoln Brito \n"
+ "Language-Team: LANGUAGE \n"
+ "MIME-Version: 1.0\n"
+ "Content-Type: text/plain; charset=UTF-8\n"
+ "Content-Transfer-Encoding: 8bit\n"
+ "Plural-Forms: nplurals=2; plural=n>1;\n"
+
+#: controllers/components/toolbar.php:91
+msgid "Component initialization and startup"
+msgstr "Inicialização de componente"
+
+#: controllers/components/toolbar.php:140
+msgid "Controller Action"
+msgstr "Action do Controller"
+
+#: controllers/components/toolbar.php:167
+msgid "Render Controller Action"
+msgstr "Renderizar Action do Controller"
+
+#: controllers/components/toolbar.php:231
+msgid "Could not load DebugToolbar panel %s"
+msgstr "Não foi possível carregar o painel %s do DebugToolbar"
+
+#: views/elements/debug_toolbar.ctp:25
+msgid "There are no active panels. You must enable a panel to see its output."
+msgstr "Não existem painéis ativos. Você deve habilitar um painel para visualizar sua saída."
+
+#: views/elements/history_panel.ctp:21
+msgid "Request History"
+msgstr "Histórico de requisições"
+
+#: views/elements/history_panel.ctp:23
+msgid "No previous requests logged."
+msgstr "Sem requisições anteriores logadas."
+
+#: views/elements/history_panel.ctp:25
+msgid "previous requests available"
+msgstr "requisições anteriores disponíveis"
+
+#: views/elements/history_panel.ctp:27
+msgid "Restore to current request"
+msgstr "Restaurar para requisição atual"
+
+#: views/elements/log_panel.ctp:21
+msgid "Logs"
+msgstr "Logs"
+
+#: views/elements/log_panel.ctp:28
+msgid "Time"
+msgstr "Tempo"
+
+#: views/elements/log_panel.ctp:28 views/elements/timer_panel.ctp:54
+msgid "Message"
+msgstr "Mensagem"
+
+#: views/elements/log_panel.ctp:37
+msgid "There were no log entries made this request"
+msgstr "Não houveram entradas no log para essa requisição "
+
+#: views/elements/request_panel.ctp:21
+msgid "Request"
+msgstr "Requisição"
+
+#: views/elements/request_panel.ctp:35
+msgid "Current Route"
+msgstr "Rota Atual"
+
+#: views/elements/session_panel.ctp:21
+msgid "Session"
+msgstr "Sessão"
+
+#: views/elements/sql_log_panel.ctp:21
+msgid "Sql Logs"
+msgstr "Logs Sql"
+
+#: views/elements/sql_log_panel.ctp:31
+msgid "toggle (%s) query explains for %s"
+msgstr "alternar (%s) query explains por %s"
+
+#: views/elements/sql_log_panel.ctp:39
+msgid "No slow queries!, or your database does not support EXPLAIN"
+msgstr "Sem consultas lentas!, ou o seu banco de dados não suporta EXPLAIN"
+
+#: views/elements/sql_log_panel.ctp:44
+msgid "No active database connections"
+msgstr "Sem conexões ativas de banco de dados"
+
+#: views/elements/timer_panel.ctp:33
+msgid "Memory"
+msgstr "Memória"
+
+#: views/elements/timer_panel.ctp:35
+msgid "Current Memory Use"
+msgstr "Uso atual de memória"
+
+#: views/elements/timer_panel.ctp:39
+msgid "Peak Memory Use"
+msgstr "Pico de uso de memória"
+
+#: views/elements/timer_panel.ctp:43
+msgid "Timers"
+msgstr "Tempos"
+
+#: views/elements/timer_panel.ctp:45
+msgid "%s (ms)"
+msgstr "%s (ms)"
+
+#: views/elements/timer_panel.ctp:46
+msgid "Total Request Time:"
+msgstr "Tempo Total de Requisição"
+
+#: views/elements/timer_panel.ctp:54
+msgid "Time in ms"
+msgstr "Tempo em ms"
+
+#: views/elements/timer_panel.ctp:54
+msgid "Graph"
+msgstr "Gráfico"
+
+#: views/elements/variables_panel.ctp:21
+msgid "View Variables"
+msgstr "Visualizar Variáveis"
+
+#: views/helpers/simple_graph.php:79
+msgid "Starting %sms into the request, taking %sms"
+msgstr "Começando %sms na requisição, levando %sms"
diff --git a/cakephp/app/Plugin/DebugKit/README.md b/cakephp/app/Plugin/DebugKit/README.md
new file mode 100644
index 0000000..140e177
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/README.md
@@ -0,0 +1,188 @@
+# CakePHP DebugKit [](http://travis-ci.org/cakephp/debug_kit)
+
+DebugKit provides a debugging toolbar and enhanced debugging tools for CakePHP applications.
+
+## Requirements
+
+The `master` branch has the following requirements:
+
+* CakePHP 3.0.0 or greater.
+* PHP 5.4.16 or greater.
+* SQLite or another database driver that CakePHP can talk to. By default DebugKit will use SQLite, if you
+ need to use a different database see the Database Configuration section below.
+
+## DebugKit for CakePHP 2.x
+
+If you want DebugKit for your 2.x application, you can use the latest `2.2.y` tag or the [2.2 branch](https://github.com/cakephp/debug_kit/tree/2.2).
+
+## Installation
+
+* Install the plugin with [Composer](https://getcomposer.org/) from your CakePHP Project's ROOT directory (where the **composer.json** file is located)
+```sh
+php composer.phar require --dev cakephp/debug_kit "~3.0"
+```
+
+* [Load the plugin](http://book.cakephp.org/3.0/en/plugins.html#loading-a-plugin)
+```php
+Plugin::load('DebugKit', ['bootstrap' => true, 'routes' => true]);
+```
+* Set `'debug' => true,` in `config/app.php`.
+
+## Reporting Issues
+
+If you have a problem with DebugKit please open an issue on [GitHub](https://github.com/cakephp/debug_kit/issues).
+
+## Contributing
+
+If you'd like to contribute to DebugKit, check out the
+[roadmap](https://github.com/cakephp/debug_kit/wiki/roadmap) for any
+planned features. You can [fork](https://help.github.com/articles/fork-a-repo)
+the project, add features, and send [pull
+requests](https://help.github.com/articles/using-pull-requests) or open
+[issues](https://github.com/cakephp/debug_kit/issues).
+
+## Versions
+
+DebugKit has several releases, each compatible with different releases of
+CakePHP. Use the appropriate version by downloading a tag, or checking out the
+correct branch.
+
+* `1.0, 1.1, 1.2` are compatible with CakePHP 1.2.x. These releases of DebugKit
+ will not work with CakePHP 1.3. You can also use the `1.2-branch` for the mos
+ recent updates and bugfixes.
+* `1.3.0` is compatible with CakePHP 1.3.x only. It will not work with CakePHP
+ 1.2. You can also use the `1.3` branch to get the most recent updates and
+ bugfixes.
+* `2.0.0` is compatible with CakePHP 2.0.x only. It will not work with previous
+ CakePHP versions.
+* `2.2.0` is compatible with CakePHP 2.2.0 and greater. It will not work with
+ older versions of CakePHP as this release uses new API's available in 2.2.
+ You can also use the `master` branch to get the most recent updates.
+* `2.2.x` are compatible with CakePHP 2.2.0 and greater. It is a necessary
+ upgrade for people using CakePHP 2.4 as the naming conventions around loggers
+ changed in that release.
+* `3.0.x` is compatible with CakePHP 3.0.x and is still under active development.
+
+# Documentation
+
+## Database Configuration
+
+By default DebugKit will store panel data into a SQLite database in your application's `tmp`
+directory. If you cannot install pdo_sqlite, you can configure DebugKit to use a different
+database by defining a `debug_kit` connection in your `config/app.php` file.
+
+## Toolbar Panels
+
+The DebugKit Toolbar is comprised of several panels, which are shown by clicking the
+CakePHP icon in the upper right-hand corner of your browser after DebugKit has been
+installed and loaded. Each panel is comprised of a panel class and view element.
+Typically, a panel handles the collection and display of a single type of information
+such as Logs or Request information. You can choose to panels from the toolbar or add
+your own custom panels.
+
+### Built-in Panels
+
+There are several built-in panels, they are:
+
+ * **Request** Displays information about the current request, GET, POST, Cake
+ Parameters, Current Route information and Cookies if the `CookieComponent`
+ is in you controller's components.
+ * **Session** Display the information currently in the Session.
+ * **Timer** Display any timers that were set during the request see
+ `DebugKitDebugger` for more information. Also displays
+ memory use at component callbacks as well as peak memory used.
+ * **Sql Logs** Displays sql logs for each database connection.
+ * **Log** Display any entries made to the log files this request.
+ * **Variables** Display View variables set in controller.
+ * **Environment** Display environment variables related to PHP + CakePHP.
+
+## Configuration
+
+There is no configuration at this time. Configuration options will be coming soon.
+
+## Developing Your Own Panels
+
+You can create your own custom panels for DebugKit to help in debugging your applications.
+
+### Panel Classes
+
+Panel Classes simply need to be placed in the `src/Panel` directory. The
+filename should match the classname, so the class `MyCustomPanel` would be
+expected to have a filename of `src/Panel/MyCustomPanel.php`.
+
+```php
+namespace App\Panel;
+
+use DebugKit\DebugPanel;
+
+/**
+ * My Custom Panel
+ */
+class MyCustomPanel extends DebugPanel {
+ ...
+}
+```
+
+Notice that custom panels are required to subclass the `DebugPanel` class.
+
+### Callbacks
+
+By default Panel objects have 2 callbacks, allowing them to hook into the
+current request. Panels subscribe to the `Controller.initialize` and
+`Controller.shutdown` events. If your panel needs to subscribe to additional
+events, you can use the `implementedEvents` method to define all of the events
+your panel is interested in.
+
+You should refer to the built-in panels for some examples on how you can build panels.
+
+
+### Panel Elements
+
+Each Panel is expected to have a view element that renders the content from the
+panel. The element name must be the underscored inflection of the class name.
+For example `SessionPanel` has an element named `session_panel.ctp`, and
+`SqllogPanel` has an element named `sqllog_panel.ctp`. These elements should be
+located in the root of your `View/Elements` directory.
+
+#### Custom Titles and Elements
+
+Panels should pick up their title and element name by convention. However, if you need to choose a custom element name or title, you can define methods to customize your panel's behavior:
+
+- `title()` - Configure the title that is displayed in the toolbar.
+- `elementName()` Configure which element should be used for a given panel.
+
+### Panels in Other Plugins
+
+Panels provided by [Plugins](http://book.cakephp.org/3.0/en/plugins.html)
+work almost entirely the same as other plugins, with one minor difference: You
+must set `public $plugin` to be the name of the plugin directory, so that the
+panel's Elements can be located at render time.
+
+```php
+namespace MyPlugin\Panel;
+
+use DebugKit\DebugPanel;
+
+class MyCustomPanel extends DebugPanel {
+ public $plugin = 'MyPlugin';
+ ...
+}
+```
+
+To use a plugin panel, update your application's DebugKit configuration to include
+the panel.
+
+```php
+Configure::write(
+ 'DebugKit.panels',
+ array_merge((array)Configure::read('DebugKit.panels'), ['MyPlugin.MyCustomPanel'])
+);
+```
+
+The above would load all the default panels as well as the custom panel from `MyPlugin`.
+
+## DebugKit Storage
+
+By default, DebugKit uses a small SQLite database in you application's `/tmp` directory to store
+the panel data. If you'd like DebugKit to store its data elsewhere, you should define a `debug_kit`
+connection.
diff --git a/cakephp/app/Plugin/DebugKit/VERSION.txt b/cakephp/app/Plugin/DebugKit/VERSION.txt
new file mode 100644
index 0000000..e4604e3
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/VERSION.txt
@@ -0,0 +1 @@
+3.2.1
diff --git a/cakephp/app/Plugin/DebugKit/composer.json b/cakephp/app/Plugin/DebugKit/composer.json
new file mode 100644
index 0000000..c0c26db
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/composer.json
@@ -0,0 +1,49 @@
+{
+ "name": "cakephp/debug_kit",
+ "description": "CakePHP Debug Kit",
+ "type": "cakephp-plugin",
+ "keywords": ["cakephp", "debug", "kit"],
+ "homepage": "https://github.com/cakephp/debug_kit",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Mark Story",
+ "homepage": "http://mark-story.com",
+ "role": "Author"
+ },
+ {
+ "name": "CakePHP Community",
+ "homepage": "https://github.com/cakephp/debug_kit/graphs/contributors"
+ }
+ ],
+ "support": {
+ "issues": "https://github.com/cakephp/debug_kit/issues",
+ "forum": "http://stackoverflow.com/tags/cakephp",
+ "irc": "irc://irc.freenode.org/cakephp",
+ "source": "https://github.com/cakephp/debug_kit"
+ },
+ "require": {
+ "cakephp/cakephp": "3.1.*",
+ "jdorn/sql-formatter": "~1.2"
+ },
+ "require-dev": {
+ "cakephp/cakephp-codesniffer": "dev-master",
+ "phpunit/phpunit": "4.1.*"
+ },
+ "autoload": {
+ "psr-4": {
+ "DebugKit\\": "src",
+ "DebugKit\\Test\\Fixture\\": "tests\\Fixture"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Cake\\Test\\": "vendor/cakephp/cakephp/tests",
+ "DebugKit\\Test\\": "tests"
+ }
+ },
+ "suggest": {
+ "ext-sqlite": "DebugKit needs to store panel data in a database. SQLite is simple and easy to use."
+ },
+ "minimum-stability": "beta"
+}
diff --git a/cakephp/app/Plugin/DebugKit/config/bootstrap.php b/cakephp/app/Plugin/DebugKit/config/bootstrap.php
new file mode 100644
index 0000000..ceaf857
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/config/bootstrap.php
@@ -0,0 +1,52 @@
+isEnabled() || php_sapi_name() === 'cli') {
+ return;
+}
+
+$hasDebugKitConfig = ConnectionManager::config('debug_kit');
+if (!$hasDebugKitConfig && !in_array('sqlite', PDO::getAvailableDrivers())) {
+ $msg = 'DebugKit not enabled. You need to either install pdo_sqlite, ' .
+ 'or define the "debug_kit" connection name.';
+ Log::warning($msg);
+ return;
+}
+
+if (!$hasDebugKitConfig) {
+ ConnectionManager::config('debug_kit', [
+ 'className' => 'Cake\Database\Connection',
+ 'driver' => 'Cake\Database\Driver\Sqlite',
+ 'database' => TMP . 'debug_kit.sqlite',
+ 'encoding' => 'utf8',
+ 'cacheMetadata' => true,
+ 'quoteIdentifiers' => false,
+ ]);
+}
+
+if (Plugin::routes('DebugKit') === false) {
+ require __DIR__ . DS . 'routes.php';
+}
+
+// Setup toolbar
+$debugBar->setup();
+DispatcherFactory::add($debugBar);
diff --git a/cakephp/app/Plugin/DebugKit/config/routes.php b/cakephp/app/Plugin/DebugKit/config/routes.php
new file mode 100644
index 0000000..1da9fd7
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/config/routes.php
@@ -0,0 +1,22 @@
+extensions('json');
+ $routes->connect(
+ '/toolbar/clear_cache',
+ ['controller' => 'Toolbar', 'action' => 'clearCache']
+ );
+ $routes->connect(
+ '/toolbar/*',
+ ['controller' => 'Requests', 'action' => 'view']
+ );
+ $routes->connect(
+ '/panels/view/*',
+ ['controller' => 'Panels', 'action' => 'view']
+ );
+ $routes->connect(
+ '/panels/*',
+ ['controller' => 'Panels', 'action' => 'index']
+ );
+});
diff --git a/cakephp/app/Plugin/DebugKit/src/Cache/Engine/DebugEngine.php b/cakephp/app/Plugin/DebugKit/src/Cache/Engine/DebugEngine.php
new file mode 100644
index 0000000..ef7bfa5
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Cache/Engine/DebugEngine.php
@@ -0,0 +1,276 @@
+ 0,
+ 'delete' => 0,
+ 'read' => 0,
+ 'hit' => 0,
+ 'miss' => 0,
+ ];
+
+ /**
+ * Constructor
+ *
+ * @param mixed $config Config data or the proxied adapter.
+ */
+ public function __construct($config)
+ {
+ $this->_config = $config;
+ }
+
+ /**
+ * Initialize the proxied Cache Engine
+ *
+ * @param array $config Array of setting for the engine.
+ * @return bool True, this engine cannot fail to initialize.
+ */
+ public function init(array $config = [])
+ {
+ if (is_object($this->_config)) {
+ $this->_engine = $this->_config;
+ return true;
+ }
+ $registry = new CacheRegistry;
+ $this->_engine = $registry->load('spies', $this->_config);
+ unset($registry);
+ return true;
+ }
+
+ /**
+ * Get the internal engine
+ *
+ * @return \Cake\Cache\CacheEngine
+ */
+ public function engine()
+ {
+ return $this->_engine;
+ }
+
+ /**
+ * Get the metrics for this object.
+ *
+ * @return array
+ */
+ public function metrics()
+ {
+ return $this->_metrics;
+ }
+
+ /**
+ * Track a metric.
+ *
+ * @param string $metric The metric to increment.
+ * @return void
+ */
+ protected function _track($metric)
+ {
+ $this->_metrics[$metric]++;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function write($key, $value)
+ {
+ $this->_track('write');
+ DebugTimer::start('Cache.write ' . $key);
+ $result = $this->_engine->write($key, $value);
+ DebugTimer::stop('Cache.write ' . $key);
+ return $result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function writeMany($data)
+ {
+ $this->_track('write');
+ DebugTimer::start('Cache.writeMany');
+ $result = $this->_engine->writeMany($data);
+ DebugTimer::stop('Cache.writeMany');
+ return $result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function read($key)
+ {
+ $this->_track('read');
+ DebugTimer::start('Cache.read ' . $key);
+ $result = $this->_engine->read($key);
+ DebugTimer::stop('Cache.read ' . $key);
+ $metric = 'hit';
+ if ($result === false) {
+ $metric = 'miss';
+ }
+ $this->_track($metric);
+ return $result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function readMany($data)
+ {
+ $this->_track('read');
+ DebugTimer::start('Cache.readMany');
+ $result = $this->_engine->readMany($data);
+ DebugTimer::stop('Cache.readMany');
+ return $result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function increment($key, $offset = 1)
+ {
+ $this->_track('write');
+ DebugTimer::start('Cache.increment ' . $key);
+ $result = $this->_engine->increment($key, $offset);
+ DebugTimer::stop('Cache.increment ' . $key);
+ return $result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function decrement($key, $offset = 1)
+ {
+ $this->_track('write');
+ DebugTimer::start('Cache.decrement ' . $key);
+ $result = $this->_engine->decrement($key, $offset);
+ DebugTimer::stop('Cache.decrement ' . $key);
+ return $result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function delete($key)
+ {
+ $this->_track('delete');
+ DebugTimer::start('Cache.delete ' . $key);
+ $result = $this->_engine->delete($key);
+ DebugTimer::stop('Cache.delete ' . $key);
+ return $result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function deleteMany($data)
+ {
+ $this->_track('delete');
+ DebugTimer::start('Cache.deleteMany');
+ $result = $this->_engine->deleteMany($data);
+ DebugTimer::stop('Cache.deleteMany');
+ return $result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function clear($check)
+ {
+ $this->_track('delete');
+ DebugTimer::start('Cache.clear');
+ $result = $this->_engine->clear($check);
+ DebugTimer::stop('Cache.clear');
+ return $result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function groups()
+ {
+ return $this->_engine->groups();
+ }
+
+ /**
+ * Return the proxied configuration data.
+ *
+ * This method uses func_get_args() as not doing so confuses the
+ * proxied class.
+ *
+ * @param string $key The key to set/read.
+ * @param mixed $value The value to set.
+ * @param bool $merge Whether or not configuration should be merged.
+ */
+ public function config($key = null, $value = null, $merge = true)
+ {
+ return call_user_func_array([$this->_engine, 'config'], func_get_args());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function clearGroup($group)
+ {
+ $this->_track('delete');
+ DebugTimer::start('Cache.clearGroup ' . $group);
+ $result = $this->_engine->clearGroup($group);
+ DebugTimer::stop('Cache.clearGroup ' . $group);
+ return $result;
+ }
+
+ /**
+ * Magic __toString() method to get the CacheEngine's name
+ *
+ * @return string Returns the CacheEngine's name
+ */
+ public function __toString()
+ {
+ if (!empty($this->_engine)) {
+ list($ns, $class) = namespaceSplit(get_class($this->_engine));
+ return str_replace('Engine', '', $class);
+ }
+ return $this->_config['className'];
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Console/Command/BenchmarkShell.php b/cakephp/app/Plugin/DebugKit/src/Console/Command/BenchmarkShell.php
new file mode 100644
index 0000000..1931a47
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Console/Command/BenchmarkShell.php
@@ -0,0 +1,175 @@
+args[0];
+ $defaults = ['t' => 100, 'n' => 10];
+ $options = array_merge($defaults, $this->params);
+ $times = [];
+
+ $this->out(Text::insert(__d('debug_kit', '-> Testing :url'), compact('url')));
+ $this->out("");
+ for ($i = 0; $i < $options['n']; $i++) {
+ if (floor($options['t'] - array_sum($times)) <= 0 || $options['n'] <= 1) {
+ break;
+ }
+
+ $start = microtime(true);
+ file_get_contents($url);
+ $stop = microtime(true);
+
+ $times[] = $stop - $start;
+ }
+ $this->_results($times);
+ }
+
+ /**
+ * Prints calculated results
+ *
+ * @param array $times Array of time values
+ * @return void
+ */
+ protected function _results($times)
+ {
+ $duration = array_sum($times);
+ $requests = count($times);
+
+ $this->out(Text::insert(__d('debug_kit', 'Total Requests made: :requests'), compact('requests')));
+ $this->out(Text::insert(__d('debug_kit', 'Total Time elapsed: :duration (seconds)'), compact('duration')));
+
+ $this->out("");
+
+ $this->out(Text::insert(__d('debug_kit', 'Requests/Second: :rps req/sec'), [
+ 'rps' => round($requests / $duration, 3)
+ ]));
+
+ $this->out(Text::insert(__d('debug_kit', 'Average request time: :average-time seconds'), [
+ 'average-time' => round($duration / $requests, 3)
+ ]));
+
+ $this->out(Text::insert(__d('debug_kit', 'Standard deviation of average request time: :std-dev'), [
+ 'std-dev' => round($this->_deviation($times, true), 3)
+ ]));
+
+ $this->out(Text::insert(__d('debug_kit', 'Longest/shortest request: :longest sec/:shortest sec'), [
+ 'longest' => round(max($times), 3),
+ 'shortest' => round(min($times), 3)
+ ]));
+
+ $this->out("");
+ }
+
+ /**
+ * One-pass, numerically stable calculation of population variance.
+ *
+ * Donald E. Knuth (1998).
+ * The Art of Computer Programming, volume 2: Seminumerical Algorithms, 3rd edn.,
+ * p. 232. Boston: Addison-Wesley.
+ *
+ * @param array $times Array of values
+ * @param bool $sample If true, calculates an unbiased estimate of the population
+ * variance from a finite sample.
+ * @return float Variance
+ */
+ protected function _variance($times, $sample = true)
+ {
+ $n = $mean = $M2 = 0;
+
+ foreach ($times as $time) {
+ $n += 1;
+ $delta = $time - $mean;
+ $mean = $mean + $delta / $n;
+ $M2 = $M2 + $delta * ($time - $mean);
+ }
+
+ if ($sample) {
+ $n -= 1;
+ }
+
+ return $M2 / $n;
+ }
+
+ /**
+ * Calculate the standard deviation.
+ *
+ * @param array $times Array of values
+ * @param bool $sample ''
+ * @return float Standard deviation
+ */
+ protected function _deviation($times, $sample = true)
+ {
+ return sqrt($this->_variance($times, $sample));
+ }
+
+ /**
+ * Get option parser.
+ *
+ * @return \Cake\Console\OptionParser
+ */
+ public function getOptionParser()
+ {
+ $parser = parent::getOptionParser();
+ $parser->description(__d(
+ 'debug_kit',
+ 'Allows you to obtain some rough benchmarking statistics' .
+ 'about a fully qualified URL.'
+ ))
+ ->addArgument('url', [
+ 'help' => __d('debug_kit', 'The URL to request.'),
+ 'required' => true
+ ])
+ ->addOption('n', [
+ 'default' => 10,
+ 'help' => __d('debug_kit', 'Number of iterations to perform.')
+ ])
+ ->addOption('t', [
+ 'default' => 100,
+ 'help' => __d(
+ 'debug_kit',
+ 'Maximum total time for all iterations, in seconds.' .
+ 'If a single iteration takes more than the timeout, only one request will be made'
+ )
+ ])
+ ->epilog(__d(
+ 'debug_kit',
+ 'Example Use: `cake benchmark --n 10 --t 100 http://localhost/testsite`. ' .
+ 'Note: this benchmark does not include browser render times.'
+ ));
+ return $parser;
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Console/Command/WhitespaceShell.php b/cakephp/app/Plugin/DebugKit/src/Console/Command/WhitespaceShell.php
new file mode 100644
index 0000000..7cee644
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Console/Command/WhitespaceShell.php
@@ -0,0 +1,100 @@
+params['path']) && strpos($this->params['path'], '/') === 0) {
+ $path = $this->params['path'];
+ } elseif (!empty($this->params['path'])) {
+ $path .= $this->params['path'];
+ }
+ $folder = new Folder($path);
+
+ $r = $folder->findRecursive('.*\.php');
+ $this->out("Checking *.php in " . $path);
+ foreach ($r as $file) {
+ $c = file_get_contents($file);
+ if (preg_match('/^[\n\r|\n\r|\n|\r|\s]+\<\?php/', $c)) {
+ $this->out('!!!contains leading whitespaces: ' . $this->shortPath($file));
+ }
+ if (preg_match('/\?\>[\n\r|\n\r|\n|\r|\s]+$/', $c)) {
+ $this->out('!!!contains trailing whitespaces: ' . $this->shortPath($file));
+ }
+ }
+ }
+
+ /**
+ * Much like main() except files are modified. Be sure to have
+ * backups or use version control.
+ *
+ * @return void
+ */
+ public function trim()
+ {
+ $path = APP;
+ if (!empty($this->params['path']) && strpos($this->params['path'], '/') === 0) {
+ $path = $this->params['path'];
+ } elseif (!empty($this->params['path'])) {
+ $path .= $this->params['path'];
+ }
+ $folder = new Folder($path);
+
+ $r = $folder->findRecursive('.*\.php');
+ $this->out("Checking *.php in " . $path);
+ foreach ($r as $file) {
+ $c = file_get_contents($file);
+ if (preg_match('/^[\n\r|\n\r|\n|\r|\s]+\<\?php/', $c) || preg_match('/\?\>[\n\r|\n\r|\n|\r|\s]+$/', $c)) {
+ $this->out('trimming' . $this->shortPath($file));
+ $c = preg_replace('/^[\n\r|\n\r|\n|\r|\s]+\<\?php/', '[\n\r|\n\r|\n|\r|\s]+$/', '?>', $c);
+ file_put_contents($file, $c);
+ }
+ }
+ }
+
+ /**
+ * get the option parser
+ *
+ * @return ConsoleOptionParser
+ */
+ public function getOptionParser()
+ {
+ $parser = parent::getOptionParser();
+ return $parser->addOption('path', [
+ 'short' => 'p',
+ 'help' => __d('cake_console', 'Absolute path or relative to APP.')
+ ]);
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Controller/Component/ToolbarComponent.php b/cakephp/app/Plugin/DebugKit/src/Controller/Component/ToolbarComponent.php
new file mode 100644
index 0000000..aaa7baf
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Controller/Component/ToolbarComponent.php
@@ -0,0 +1,44 @@
+ true]);` in your application\'s bootstrap.php.';
+ throw new \RuntimeException($msg);
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Controller/PanelsController.php b/cakephp/app/Plugin/DebugKit/src/Controller/PanelsController.php
new file mode 100644
index 0000000..e0e7345
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Controller/PanelsController.php
@@ -0,0 +1,93 @@
+viewBuilder()->layout('DebugKit.panel');
+ }
+
+ /**
+ * Index method that lets you get requests by panelid.
+ *
+ * @param string $requestId Request id
+ * @return void
+ * @throws \Cake\Network\Exception\NotFoundException
+ */
+ public function index($requestId = null)
+ {
+ $query = $this->Panels->find('byRequest', ['requestId' => $requestId]);
+ $panels = $query->toArray();
+ if (empty($panels)) {
+ throw new NotFoundException();
+ }
+ $this->set([
+ '_serialize' => ['panels'],
+ 'panels' => $panels
+ ]);
+ }
+
+ /**
+ * View a panel's data.
+ *
+ * @param string $id The id.
+ * @return void
+ */
+ public function view($id = null)
+ {
+ $this->Cookie->configKey('debugKit_sort', 'encryption', false);
+ $this->set('sort', $this->Cookie->read('debugKit_sort'));
+ $panel = $this->Panels->get($id);
+ $this->set('panel', $panel);
+ $this->set(unserialize($panel->content));
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Controller/RequestsController.php b/cakephp/app/Plugin/DebugKit/src/Controller/RequestsController.php
new file mode 100644
index 0000000..8f217f5
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Controller/RequestsController.php
@@ -0,0 +1,65 @@
+response->header(['Content-Security-Policy' => '']);
+ }
+
+ /**
+ * Before render handler.
+ *
+ * @param \Cake\Event\Event $event The event.
+ * @return void
+ */
+ public function beforeRender(Event $event)
+ {
+ $this->viewBuilder()->layout('DebugKit.toolbar');
+ }
+
+ /**
+ * View a request's data.
+ *
+ * @param string $id The id.
+ * @return void
+ */
+ public function view($id = null)
+ {
+ $toolbar = $this->Requests->get($id, ['contain' => 'Panels']);
+ $this->set('toolbar', $toolbar);
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Controller/ToolbarController.php b/cakephp/app/Plugin/DebugKit/src/Controller/ToolbarController.php
new file mode 100644
index 0000000..f1f56bd
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Controller/ToolbarController.php
@@ -0,0 +1,74 @@
+request->allowMethod('post');
+ if (!$this->request->data('name')) {
+ throw new NotFoundException('Invalid cache engine name.');
+ }
+ $result = Cache::clear(false, $this->request->data('name'));
+ $this->set([
+ '_serialize' => ['success'],
+ 'success' => $result,
+ ]);
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Database/Log/DebugLog.php b/cakephp/app/Plugin/DebugKit/src/Database/Log/DebugLog.php
new file mode 100644
index 0000000..6ba4539
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Database/Log/DebugLog.php
@@ -0,0 +1,139 @@
+_logger = $logger;
+ $this->_connectionName = $name;
+ }
+
+ /**
+ * Get the stored logs.
+ *
+ * @return array
+ */
+ public function name()
+ {
+ return $this->_connectionName;
+ }
+
+ /**
+ * Get the stored logs.
+ *
+ * @return array
+ */
+ public function queries()
+ {
+ return $this->_queries;
+ }
+
+ /**
+ * Get the total time
+ *
+ * @return int
+ */
+ public function totalTime()
+ {
+ return $this->_totalTime;
+ }
+
+ /**
+ * Get the total rows
+ *
+ * @return int
+ */
+ public function totalRows()
+ {
+ return $this->_totalRows;
+ }
+
+ /**
+ * Log queries
+ *
+ * @param \Cake\Database\Log\LoggedQuery $query The query being logged.
+ * @return void
+ */
+ public function log(LoggedQuery $query)
+ {
+ if ($this->_logger) {
+ $this->_logger->log($query);
+ }
+ if (!empty($query->params)) {
+ $query->query = $this->_interpolate($query);
+ }
+ $this->_totalTime += $query->took;
+ $this->_totalRows += $query->numRows;
+
+ $this->_queries[] = [
+ 'query' => $query->query,
+ 'took' => $query->took,
+ 'rows' => $query->numRows
+ ];
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/DebugMemory.php b/cakephp/app/Plugin/DebugKit/src/DebugMemory.php
new file mode 100644
index 0000000..c87db96
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/DebugMemory.php
@@ -0,0 +1,104 @@
+plugin) {
+ return $this->plugin . '.' . Inflector::underscore($name);
+ }
+ return Inflector::underscore($name);
+ }
+
+ /**
+ * Get the data a panel has collected.
+ *
+ * @return array
+ */
+ public function data()
+ {
+ return $this->_data;
+ }
+
+ /**
+ * Get the summary data for a panel.
+ *
+ * This data is displayed in the toolbar even when the panel is collapsed.
+ *
+ * @return string
+ */
+ public function summary()
+ {
+ return '';
+ }
+
+ /**
+ * Initialize hook method.
+ *
+ * @return void
+ */
+ public function initialize()
+ {
+ }
+
+ /**
+ * Shutdown callback
+ *
+ * @param \Cake\Event\Event $event The event.
+ * @return void
+ */
+ public function shutdown(Event $event)
+ {
+ }
+
+ /**
+ * Get the events this panels supports.
+ *
+ * @return array
+ */
+ public function implementedEvents()
+ {
+ return [
+ 'Controller.shutdown' => 'shutdown',
+ ];
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/DebugTimer.php b/cakephp/app/Plugin/DebugKit/src/DebugTimer.php
new file mode 100644
index 0000000..1013da6
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/DebugTimer.php
@@ -0,0 +1,209 @@
+ 1) {
+ $message .= ' #' . $i;
+ }
+
+ self::$_timers[$name] = [
+ 'start' => $start,
+ 'message' => $message,
+ 'named' => $named
+ ];
+ return true;
+ }
+
+ /**
+ * Stop a benchmarking timer.
+ *
+ * $name should be the same as the $name used in startTimer().
+ *
+ * @param string $name The name of the timer to end.
+ * @return bool true if timer was ended, false if timer was not started.
+ */
+ public static function stop($name = null)
+ {
+ $end = microtime(true);
+ if (!$name) {
+ $names = array_reverse(array_keys(self::$_timers));
+ foreach ($names as $name) {
+ if (!empty(self::$_timers[$name]['end'])) {
+ continue;
+ }
+ if (empty(self::$_timers[$name]['named'])) {
+ break;
+ }
+ }
+ } else {
+ $i = 1;
+ $_name = $name;
+ while (isset(self::$_timers[$name])) {
+ if (empty(self::$_timers[$name]['end'])) {
+ break;
+ }
+ $i++;
+ $name = $_name . ' #' . $i;
+ }
+ }
+ if (!isset(self::$_timers[$name])) {
+ return false;
+ }
+ self::$_timers[$name]['end'] = $end;
+ return true;
+ }
+
+ /**
+ * Get all timers that have been started and stopped.
+ * Calculates elapsed time for each timer. If clear is true, will delete existing timers
+ *
+ * @param bool $clear false
+ * @return array
+ */
+ public static function getAll($clear = false)
+ {
+ $start = self::requestStartTime();
+ $now = microtime(true);
+
+ $times = [];
+ if (!empty(self::$_timers)) {
+ $firstTimer = reset(self::$_timers);
+ $_end = $firstTimer['start'];
+ } else {
+ $_end = $now;
+ }
+ $times['Core Processing (Derived from $_SERVER["REQUEST_TIME"])'] = [
+ 'message' => __d('debug_kit', 'Core Processing (Derived from $_SERVER["REQUEST_TIME"])'),
+ 'start' => 0,
+ 'end' => $_end - $start,
+ 'time' => round($_end - $start, 6),
+ 'named' => null
+ ];
+ foreach (self::$_timers as $name => $timer) {
+ if (!isset($timer['end'])) {
+ $timer['end'] = $now;
+ }
+ $times[$name] = array_merge($timer, [
+ 'start' => $timer['start'] - $start,
+ 'end' => $timer['end'] - $start,
+ 'time' => self::elapsedTime($name)
+ ]);
+ }
+ if ($clear) {
+ self::$_timers = [];
+ }
+ return $times;
+ }
+
+ /**
+ * Clear all existing timers
+ *
+ * @return bool true
+ */
+ public static function clear()
+ {
+ self::$_timers = [];
+ return true;
+ }
+
+ /**
+ * Get the difference in time between the timer start and timer end.
+ *
+ * @param string $name the name of the timer you want elapsed time for.
+ * @param int $precision the number of decimal places to return, defaults to 5.
+ * @return float number of seconds elapsed for timer name, 0 on missing key
+ */
+ public static function elapsedTime($name = 'default', $precision = 5)
+ {
+ if (!isset(self::$_timers[$name]['start']) || !isset(self::$_timers[$name]['end'])) {
+ return 0;
+ }
+ return round(self::$_timers[$name]['end'] - self::$_timers[$name]['start'], $precision);
+ }
+
+ /**
+ * Get the total execution time until this point
+ *
+ * @return float elapsed time in seconds since script start.
+ */
+ public static function requestTime()
+ {
+ $start = self::requestStartTime();
+ $now = microtime(true);
+ return ($now - $start);
+ }
+
+ /**
+ * get the time the current request started.
+ *
+ * @return float time of request start
+ */
+ public static function requestStartTime()
+ {
+ if (defined('TIME_START')) {
+ $startTime = TIME_START;
+ } elseif (isset($GLOBALS['TIME_START'])) {
+ $startTime = $GLOBALS['TIME_START'];
+ } else {
+ $startTime = env('REQUEST_TIME');
+ }
+ return $startTime;
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Locale/debug_kit.pot b/cakephp/app/Plugin/DebugKit/src/Locale/debug_kit.pot
new file mode 100644
index 0000000..df4988d
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Locale/debug_kit.pot
@@ -0,0 +1,138 @@
+# LANGUAGE translation of Debug Kit Application
+# Copyright 2008 Andy Dawson
+# No version information was available in the source files.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: debug_kit-\n"
+"POT-Creation-Date: 2009-05-27 09:47+0200\n"
+"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
+"Last-Translator: Andy Dawson \n"
+"Language-Team:\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-Basepath: ../../../\n"
+
+#: controllers/components/toolbar.php:91
+msgid "Component initialization and startup"
+msgstr ""
+
+#: controllers/components/toolbar.php:140
+msgid "Controller Action"
+msgstr ""
+
+#: controllers/components/toolbar.php:167
+msgid "Render Controller Action"
+msgstr ""
+
+#: controllers/components/toolbar.php:231
+msgid "Could not load DebugToolbar panel %s"
+msgstr ""
+
+#: views/elements/debug_toolbar.ctp:25
+msgid "There are no active panels. You must enable a panel to see its output."
+msgstr ""
+
+#: views/elements/history_panel.ctp:21
+msgid "Request History"
+msgstr ""
+
+#: views/elements/history_panel.ctp:23
+msgid "No previous requests logged."
+msgstr ""
+
+#: views/elements/history_panel.ctp:25
+msgid "previous requests available"
+msgstr ""
+
+#: views/elements/history_panel.ctp:27
+msgid "Restore to current request"
+msgstr ""
+
+#: views/elements/log_panel.ctp:21
+msgid "Logs"
+msgstr ""
+
+#: views/elements/log_panel.ctp:28
+msgid "Time"
+msgstr ""
+
+#: views/elements/log_panel.ctp:28
+#: views/elements/timer_panel.ctp:54
+msgid "Message"
+msgstr ""
+
+#: views/elements/log_panel.ctp:37
+msgid "There were no log entries made this request"
+msgstr ""
+
+#: views/elements/request_panel.ctp:21
+msgid "Request"
+msgstr ""
+
+#: views/elements/request_panel.ctp:35
+msgid "Current Route"
+msgstr ""
+
+#: views/elements/session_panel.ctp:21
+msgid "Session"
+msgstr ""
+
+#: views/elements/sql_log_panel.ctp:21
+msgid "Sql Logs"
+msgstr ""
+
+#: views/elements/sql_log_panel.ctp:31
+msgid "toggle (%s) query explains for %s"
+msgstr ""
+
+#: views/elements/sql_log_panel.ctp:39
+msgid "No slow queries!, or your database does not support EXPLAIN"
+msgstr ""
+
+#: views/elements/sql_log_panel.ctp:44
+msgid "No active database connections"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:33
+msgid "Memory"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:35
+msgid "Current Memory Use"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:39
+msgid "Peak Memory Use"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:43
+msgid "Timers"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:45
+msgid "%s (ms)"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:46
+msgid "Total Request Time:"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:54
+msgid "Time in ms"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:54
+msgid "Graph"
+msgstr ""
+
+#: views/elements/variables_panel.ctp:21
+msgid "View Variables"
+msgstr ""
+
+#: views/helpers/simple_graph.php:79
+msgid "Starting %sms into the request, taking %sms"
+msgstr ""
+
diff --git a/cakephp/app/Plugin/DebugKit/src/Locale/eng/LC_MESSAGES/debug_kit.po b/cakephp/app/Plugin/DebugKit/src/Locale/eng/LC_MESSAGES/debug_kit.po
new file mode 100644
index 0000000..9aec832
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Locale/eng/LC_MESSAGES/debug_kit.po
@@ -0,0 +1,135 @@
+# LANGUAGE translation of CakePHP Application
+# Copyright YEAR NAME
+# No version information was available in the source files.
+#
+#, fuzzy
+msgid ""
+msgstr "Project-Id-Version: PROJECT VERSION\n"
+ "POT-Creation-Date: 2009-05-27 09:47+0200\n"
+ "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
+ "Last-Translator: NAME \n"
+ "Language-Team: LANGUAGE \n"
+ "MIME-Version: 1.0\n"
+ "Content-Type: text/plain; charset=UTF-8\n"
+ "Content-Transfer-Encoding: 8bit\n"
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: controllers/components/toolbar.php:91
+msgid "Component initialization and startup"
+msgstr ""
+
+#: controllers/components/toolbar.php:140
+msgid "Controller Action"
+msgstr ""
+
+#: controllers/components/toolbar.php:167
+msgid "Render Controller Action"
+msgstr ""
+
+#: controllers/components/toolbar.php:231
+msgid "Could not load DebugToolbar panel %s"
+msgstr ""
+
+#: views/elements/debug_toolbar.ctp:25
+msgid "There are no active panels. You must enable a panel to see its output."
+msgstr ""
+
+#: views/elements/history_panel.ctp:21
+msgid "Request History"
+msgstr ""
+
+#: views/elements/history_panel.ctp:23
+msgid "No previous requests logged."
+msgstr ""
+
+#: views/elements/history_panel.ctp:25
+msgid "previous requests available"
+msgstr ""
+
+#: views/elements/history_panel.ctp:27
+msgid "Restore to current request"
+msgstr ""
+
+#: views/elements/log_panel.ctp:21
+msgid "Logs"
+msgstr ""
+
+#: views/elements/log_panel.ctp:28
+msgid "Time"
+msgstr ""
+
+#: views/elements/log_panel.ctp:28 views/elements/timer_panel.ctp:54
+msgid "Message"
+msgstr ""
+
+#: views/elements/log_panel.ctp:37
+msgid "There were no log entries made this request"
+msgstr ""
+
+#: views/elements/request_panel.ctp:21
+msgid "Request"
+msgstr ""
+
+#: views/elements/request_panel.ctp:35
+msgid "Current Route"
+msgstr ""
+
+#: views/elements/session_panel.ctp:21
+msgid "Session"
+msgstr ""
+
+#: views/elements/sql_log_panel.ctp:21
+msgid "Sql Logs"
+msgstr ""
+
+#: views/elements/sql_log_panel.ctp:31
+msgid "toggle (%s) query explains for %s"
+msgstr ""
+
+#: views/elements/sql_log_panel.ctp:39
+msgid "No slow queries!, or your database does not support EXPLAIN"
+msgstr ""
+
+#: views/elements/sql_log_panel.ctp:44
+msgid "No active database connections"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:33
+msgid "Memory"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:35
+msgid "Current Memory Use"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:39
+msgid "Peak Memory Use"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:43
+msgid "Timers"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:45
+msgid "%s (ms)"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:46
+msgid "Total Request Time:"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:54
+msgid "Time in ms"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:54
+msgid "Graph"
+msgstr ""
+
+#: views/elements/variables_panel.ctp:21
+msgid "View Variables"
+msgstr ""
+
+#: views/helpers/simple_graph.php:79
+msgid "Starting %sms into the request, taking %sms"
+msgstr ""
diff --git a/cakephp/app/Plugin/DebugKit/src/Locale/fra/LC_MESSAGES/debug_kit.po b/cakephp/app/Plugin/DebugKit/src/Locale/fra/LC_MESSAGES/debug_kit.po
new file mode 100644
index 0000000..515574d
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Locale/fra/LC_MESSAGES/debug_kit.po
@@ -0,0 +1,135 @@
+# LANGUAGE translation of CakePHP Application
+# Copyright YEAR NAME
+# No version information was available in the source files.
+#
+#, fuzzy
+msgid ""
+msgstr "Project-Id-Version: PROJECT VERSION\n"
+ "POT-Creation-Date: 2013-06-04 12:00+0200\n"
+ "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
+ "Last-Translator: cake17 \n"
+ "Language-Team: \n"
+ "MIME-Version: 1.0\n"
+ "Content-Type: text/plain; charset=UTF-8\n"
+ "Content-Transfer-Encoding: 8bit\n"
+ "Plural-Forms: nplurals=2; plural=n>1;\n"
+
+#: controllers/components/toolbar.php:91
+msgid "Component initialization and startup"
+msgstr "Initialisation du component et démarrage"
+
+#: controllers/components/toolbar.php:140
+msgid "Controller Action"
+msgstr "Action du Controller"
+
+#: controllers/components/toolbar.php:167
+msgid "Render Controller Action"
+msgstr "Rendu de l'Action du Controller"
+
+#: controllers/components/toolbar.php:231
+msgid "Could not load DebugToolbar panel %s"
+msgstr "Ne peut charger le panel %s de DebugToolbar"
+
+#: views/elements/debug_toolbar.ctp:25
+msgid "There are no active panels. You must enable a panel to see its output."
+msgstr "Il n'y a pas de panels actifs. Vous devez activer le panel pour voir sa sortie."
+
+#: views/elements/history_panel.ctp:21
+msgid "Request History"
+msgstr "Historique des Requêtes"
+
+#: views/elements/history_panel.ctp:23
+msgid "No previous requests logged."
+msgstr "Pas de demandes antérieures enregistrées."
+
+#: views/elements/history_panel.ctp:25
+msgid "previous requests available"
+msgstr "Des requêtes antérieures sont disponibles"
+
+#: views/elements/history_panel.ctp:27
+msgid "Restore to current request"
+msgstr "Restaure la requête actuelle"
+
+#: views/elements/log_panel.ctp:21
+msgid "Logs"
+msgstr "Logs"
+
+#: views/elements/log_panel.ctp:28
+msgid "Time"
+msgstr "Date"
+
+#: views/elements/log_panel.ctp:28 views/elements/timer_panel.ctp:54
+msgid "Message"
+msgstr "Message"
+
+#: views/elements/log_panel.ctp:37
+msgid "There were no log entries made this request"
+msgstr "Il n'y avait pas d'entrées de log faîtes pour cette requête"
+
+#: views/elements/request_panel.ctp:21
+msgid "Request"
+msgstr "Requête"
+
+#: views/elements/request_panel.ctp:35
+msgid "Current Route"
+msgstr "Route actuelle"
+
+#: views/elements/session_panel.ctp:21
+msgid "Session"
+msgstr "Session"
+
+#: views/elements/sql_log_panel.ctp:21
+msgid "Sql Logs"
+msgstr "Logs Sql"
+
+#: views/elements/sql_log_panel.ctp:31
+msgid "toggle (%s) query explains for %s"
+msgstr "bascule (%s) requêtes expliquées pour %s"
+
+#: views/elements/sql_log_panel.ctp:39
+msgid "No slow queries!, or your database does not support EXPLAIN"
+msgstr "Pas de requêtes lentes!, ou votre base de données ne supporte pas EXPLAIN"
+
+#: views/elements/sql_log_panel.ctp:44
+msgid "No active database connections"
+msgstr "Pas de connections actives de la base de données"
+
+#: views/elements/timer_panel.ctp:33
+msgid "Memory"
+msgstr "Mémoire"
+
+#: views/elements/timer_panel.ctp:35
+msgid "Current Memory Use"
+msgstr "Utilisation de la Mémoire Actuelle"
+
+#: views/elements/timer_panel.ctp:39
+msgid "Peak Memory Use"
+msgstr "Utilisation de la Mémoire au niveau maximum"
+
+#: views/elements/timer_panel.ctp:43
+msgid "Timers"
+msgstr "Timers"
+
+#: views/elements/timer_panel.ctp:45
+msgid "%s (ms)"
+msgstr "%s (ms)"
+
+#: views/elements/timer_panel.ctp:46
+msgid "Total Request Time:"
+msgstr "Total du Temps de Requête"
+
+#: views/elements/timer_panel.ctp:54
+msgid "Time in ms"
+msgstr "Temps en ms"
+
+#: views/elements/timer_panel.ctp:54
+msgid "Graph"
+msgstr "Graph"
+
+#: views/elements/variables_panel.ctp:21
+msgid "View Variables"
+msgstr "Variables du View"
+
+#: views/helpers/simple_graph.php:79
+msgid "Starting %sms into the request, taking %sms"
+msgstr "Début en %sms de la requête, et prend %sms"
diff --git a/cakephp/app/Plugin/DebugKit/src/Locale/lim/LC_MESSAGES/debug_kit.po b/cakephp/app/Plugin/DebugKit/src/Locale/lim/LC_MESSAGES/debug_kit.po
new file mode 100644
index 0000000..bf3894a
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Locale/lim/LC_MESSAGES/debug_kit.po
@@ -0,0 +1,136 @@
+# LANGUAGE translation of Debug Kit Application
+# Copyright 2008 Andy Dawson
+# No version information was available in the source files.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: debug_kit-\n"
+"POT-Creation-Date: 2009-05-27 09:47+0200\n"
+"PO-Revision-Date: 2009-05-27 09:47+0200\n"
+"Last-Translator: Automatically generated\n"
+"Language-Team:none\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-Basepath: ../../../\n"
+"Language: lim\n"
+
+#: controllers/components/toolbar.php:91
+msgid "Component initialization and startup"
+msgstr ""
+
+#: controllers/components/toolbar.php:140
+msgid "Controller Action"
+msgstr ""
+
+#: controllers/components/toolbar.php:167
+msgid "Render Controller Action"
+msgstr ""
+
+#: controllers/components/toolbar.php:231
+msgid "Could not load DebugToolbar panel %s"
+msgstr ""
+
+#: views/elements/debug_toolbar.ctp:25
+msgid "There are no active panels. You must enable a panel to see its output."
+msgstr ""
+
+#: views/elements/history_panel.ctp:21
+msgid "Request History"
+msgstr ""
+
+#: views/elements/history_panel.ctp:23
+msgid "No previous requests logged."
+msgstr ""
+
+#: views/elements/history_panel.ctp:25
+msgid "previous requests available"
+msgstr ""
+
+#: views/elements/history_panel.ctp:27
+msgid "Restore to current request"
+msgstr ""
+
+#: views/elements/log_panel.ctp:21
+msgid "Logs"
+msgstr ""
+
+#: views/elements/log_panel.ctp:28
+msgid "Time"
+msgstr ""
+
+#: views/elements/log_panel.ctp:28 views/elements/timer_panel.ctp:54
+msgid "Message"
+msgstr ""
+
+#: views/elements/log_panel.ctp:37
+msgid "There were no log entries made this request"
+msgstr ""
+
+#: views/elements/request_panel.ctp:21
+msgid "Request"
+msgstr ""
+
+#: views/elements/request_panel.ctp:35
+msgid "Current Route"
+msgstr ""
+
+#: views/elements/session_panel.ctp:21
+msgid "Session"
+msgstr ""
+
+#: views/elements/sql_log_panel.ctp:21
+msgid "Sql Logs"
+msgstr ""
+
+#: views/elements/sql_log_panel.ctp:31
+msgid "toggle (%s) query explains for %s"
+msgstr ""
+
+#: views/elements/sql_log_panel.ctp:39
+msgid "No slow queries!, or your database does not support EXPLAIN"
+msgstr ""
+
+#: views/elements/sql_log_panel.ctp:44
+msgid "No active database connections"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:33
+msgid "Memory"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:35
+msgid "Current Memory Use"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:39
+msgid "Peak Memory Use"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:43
+msgid "Timers"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:45
+msgid "%s (ms)"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:46
+msgid "Total Request Time:"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:54
+msgid "Time in ms"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:54
+msgid "Graph"
+msgstr ""
+
+#: views/elements/variables_panel.ctp:21
+msgid "View Variables"
+msgstr ""
+
+#: views/helpers/simple_graph.php:79
+msgid "Starting %sms into the request, taking %sms"
+msgstr ""
diff --git a/cakephp/app/Plugin/DebugKit/src/Locale/nld/LC_MESSAGES/debug_kit.po b/cakephp/app/Plugin/DebugKit/src/Locale/nld/LC_MESSAGES/debug_kit.po
new file mode 100644
index 0000000..b6b754f
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Locale/nld/LC_MESSAGES/debug_kit.po
@@ -0,0 +1,141 @@
+# LANGUAGE translation of Debug Kit Application
+# Copyright 2008 Andy Dawson
+# No version information was available in the source files.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: debug_kit-\n"
+"POT-Creation-Date: 2009-05-27 09:47+0200\n"
+"PO-Revision-Date: 2014-07-17 17:04+0200\n"
+"Last-Translator: Marlin Cremers \n"
+"Language-Team: \n"
+"Language: nld\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+"X-Generator: Weblate 1.9\n"
+"X-Poedit-Basepath: ../../../\n"
+
+#: controllers/components/toolbar.php:91
+msgid "Component initialization and startup"
+msgstr "Component initializatie en opstarten"
+
+#: controllers/components/toolbar.php:140
+msgid "Controller Action"
+msgstr "Controller Actie"
+
+#: controllers/components/toolbar.php:167
+msgid "Render Controller Action"
+msgstr "Produceer Controller Actie"
+
+#: controllers/components/toolbar.php:231
+msgid "Could not load DebugToolbar panel %s"
+msgstr "Kon DebugToolbar paneel %s niet laden"
+
+#: views/elements/debug_toolbar.ctp:25
+msgid "There are no active panels. You must enable a panel to see its output."
+msgstr ""
+"Er zijn geen actieve panelen. Je moet een paneel aanzetten om de uitvoer te "
+"zien."
+
+#: views/elements/history_panel.ctp:21
+msgid "Request History"
+msgstr "Aanvraag Geschiedenis"
+
+#: views/elements/history_panel.ctp:23
+msgid "No previous requests logged."
+msgstr "Geen vorige aanvragen gelogged."
+
+#: views/elements/history_panel.ctp:25
+msgid "previous requests available"
+msgstr "vorige aanvraag beschikbaar"
+
+#: views/elements/history_panel.ctp:27
+msgid "Restore to current request"
+msgstr "Herstel naar actuele aanvraag"
+
+#: views/elements/log_panel.ctp:21
+msgid "Logs"
+msgstr "Logs"
+
+#: views/elements/log_panel.ctp:28
+msgid "Time"
+msgstr "Tijd"
+
+#: views/elements/log_panel.ctp:28
+#: views/elements/timer_panel.ctp:54
+msgid "Message"
+msgstr "Bericht"
+
+#: views/elements/log_panel.ctp:37
+msgid "There were no log entries made this request"
+msgstr "Er zijn geen log vermeldingen gemaakt in deze aanvraag"
+
+#: views/elements/request_panel.ctp:21
+msgid "Request"
+msgstr "Aanvraag"
+
+#: views/elements/request_panel.ctp:35
+msgid "Current Route"
+msgstr "Huide Route"
+
+#: views/elements/session_panel.ctp:21
+msgid "Session"
+msgstr "Sessie"
+
+#: views/elements/sql_log_panel.ctp:21
+msgid "Sql Logs"
+msgstr "Sql Logs"
+
+#: views/elements/sql_log_panel.ctp:31
+msgid "toggle (%s) query explains for %s"
+msgstr "schakel (%s) aanvraag uitleg voor %s"
+
+#: views/elements/sql_log_panel.ctp:39
+msgid "No slow queries!, or your database does not support EXPLAIN"
+msgstr "Geen langzame vragen!, of je database ondersteund geen EXPLAIN"
+
+#: views/elements/sql_log_panel.ctp:44
+msgid "No active database connections"
+msgstr "Geen actieve database verbindingen"
+
+#: views/elements/timer_panel.ctp:33
+msgid "Memory"
+msgstr "Geheugen"
+
+#: views/elements/timer_panel.ctp:35
+msgid "Current Memory Use"
+msgstr "Actueel Geheugen Gebruik"
+
+#: views/elements/timer_panel.ctp:39
+msgid "Peak Memory Use"
+msgstr "Hoogste Geheugen Gebruik"
+
+#: views/elements/timer_panel.ctp:43
+msgid "Timers"
+msgstr "Timers"
+
+#: views/elements/timer_panel.ctp:45
+msgid "%s (ms)"
+msgstr "%s (ms)"
+
+#: views/elements/timer_panel.ctp:46
+msgid "Total Request Time:"
+msgstr "Totale Aanvraag Tijd:"
+
+#: views/elements/timer_panel.ctp:54
+msgid "Time in ms"
+msgstr "Tijd in ms"
+
+#: views/elements/timer_panel.ctp:54
+msgid "Graph"
+msgstr "Diagram"
+
+#: views/elements/variables_panel.ctp:21
+msgid "View Variables"
+msgstr "View Variabelen"
+
+#: views/helpers/simple_graph.php:79
+msgid "Starting %sms into the request, taking %sms"
+msgstr "Starten %sms in de aanvraag, neemt %sms"
diff --git a/cakephp/app/Plugin/DebugKit/src/Locale/spa/LC_MESSAGES/debug_kit.po b/cakephp/app/Plugin/DebugKit/src/Locale/spa/LC_MESSAGES/debug_kit.po
new file mode 100644
index 0000000..0833a49
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Locale/spa/LC_MESSAGES/debug_kit.po
@@ -0,0 +1,135 @@
+# LANGUAGE translation of CakePHP Application
+# Copyright YEAR NAME
+# No version information was available in the source files.
+#
+#, fuzzy
+msgid ""
+msgstr "Project-Id-Version: PROJECT VERSION\n"
+ "POT-Creation-Date: 2009-05-27 09:47+0200\n"
+ "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
+ "Last-Translator: NAME \n"
+ "Language-Team: LANGUAGE \n"
+ "MIME-Version: 1.0\n"
+ "Content-Type: text/plain; charset=UTF-8\n"
+ "Content-Transfer-Encoding: 8bit\n"
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: controllers/components/toolbar.php:91
+msgid "Component initialization and startup"
+msgstr ""
+
+#: controllers/components/toolbar.php:140
+msgid "Controller Action"
+msgstr ""
+
+#: controllers/components/toolbar.php:167
+msgid "Render Controller Action"
+msgstr ""
+
+#: controllers/components/toolbar.php:231
+msgid "Could not load DebugToolbar panel %s"
+msgstr ""
+
+#: views/elements/debug_toolbar.ctp:25
+msgid "There are no active panels. You must enable a panel to see its output."
+msgstr ""
+
+#: views/elements/history_panel.ctp:21
+msgid "Request History"
+msgstr ""
+
+#: views/elements/history_panel.ctp:23
+msgid "No previous requests logged."
+msgstr ""
+
+#: views/elements/history_panel.ctp:25
+msgid "previous requests available"
+msgstr ""
+
+#: views/elements/history_panel.ctp:27
+msgid "Restore to current request"
+msgstr ""
+
+#: views/elements/log_panel.ctp:21
+msgid "Logs"
+msgstr ""
+
+#: views/elements/log_panel.ctp:28
+msgid "Time"
+msgstr ""
+
+#: views/elements/log_panel.ctp:28 views/elements/timer_panel.ctp:54
+msgid "Message"
+msgstr ""
+
+#: views/elements/log_panel.ctp:37
+msgid "There were no log entries made this request"
+msgstr ""
+
+#: views/elements/request_panel.ctp:21
+msgid "Request"
+msgstr ""
+
+#: views/elements/request_panel.ctp:35
+msgid "Current Route"
+msgstr ""
+
+#: views/elements/session_panel.ctp:21
+msgid "Session"
+msgstr ""
+
+#: views/elements/sql_log_panel.ctp:21
+msgid "Sql Logs"
+msgstr ""
+
+#: views/elements/sql_log_panel.ctp:31
+msgid "toggle (%s) query explains for %s"
+msgstr ""
+
+#: views/elements/sql_log_panel.ctp:39
+msgid "No slow queries!, or your database does not support EXPLAIN"
+msgstr ""
+
+#: views/elements/sql_log_panel.ctp:44
+msgid "No active database connections"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:33
+msgid "Memory"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:35
+msgid "Current Memory Use"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:39
+msgid "Peak Memory Use"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:43
+msgid "Timers"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:45
+msgid "%s (ms)"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:46
+msgid "Total Request Time:"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:54
+msgid "Time in ms"
+msgstr ""
+
+#: views/elements/timer_panel.ctp:54
+msgid "Graph"
+msgstr ""
+
+#: views/elements/variables_panel.ctp:21
+msgid "View Variables"
+msgstr ""
+
+#: views/helpers/simple_graph.php:79
+msgid "Starting %sms into the request, taking %sms"
+msgstr ""
\ No newline at end of file
diff --git a/cakephp/app/Plugin/DebugKit/src/Log/Engine/DebugKitLog.php b/cakephp/app/Plugin/DebugKit/src/Log/Engine/DebugKitLog.php
new file mode 100644
index 0000000..212b906
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Log/Engine/DebugKitLog.php
@@ -0,0 +1,78 @@
+logs[$type])) {
+ $this->logs[$type] = [];
+ }
+ $this->_logs[$type][] = [date('Y-m-d H:i:s'), $this->_format($message)];
+ }
+
+ /**
+ * Get the logs.
+ *
+ * @return array
+ */
+ public function all()
+ {
+ return $this->_logs;
+ }
+
+ /**
+ * Get the number of log entires.
+ *
+ * @return int
+ */
+ public function count()
+ {
+ return array_reduce($this->_logs, function ($sum, $v) {
+ return $sum + count($v);
+ }, 0);
+ }
+
+ /**
+ * Check if there are no logs.
+ *
+ * @return bool
+ */
+ public function noLogs()
+ {
+ return empty($this->_logs);
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Model/Behavior/TimedBehavior.php b/cakephp/app/Plugin/DebugKit/src/Model/Behavior/TimedBehavior.php
new file mode 100644
index 0000000..55cbd37
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Model/Behavior/TimedBehavior.php
@@ -0,0 +1,66 @@
+subject()->alias();
+ DebugTimer::start($alias . '_find', $alias . '->find()');
+ return $query->formatResults(function ($results) use ($alias) {
+ DebugTimer::stop($alias . '_find');
+ return $results;
+ });
+ }
+
+ /**
+ * beforeSave, starts a time before a save is initiated.
+ *
+ * @param Cake\Event\Event $event The beforeSave event
+ * @return void
+ */
+ public function beforeSave(Event $event)
+ {
+ $alias = $event->subject()->alias();
+ DebugTimer::start($alias . '_save', $alias . '->save()');
+ }
+
+ /**
+ * afterSave, stop the timer started from a save.
+ *
+ * @param Cake\Event\Event $event The afterSave event
+ * @return void
+ */
+ public function afterSave(Event $event)
+ {
+ $alias = $event->subject()->alias();
+ DebugTimer::stop($alias . '_save');
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Model/Entity/Panel.php b/cakephp/app/Plugin/DebugKit/src/Model/Entity/Panel.php
new file mode 100644
index 0000000..634a1cf
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Model/Entity/Panel.php
@@ -0,0 +1,28 @@
+connection();
+ $schema = $connection->schemaCollection();
+ $existing = $schema->listTables();
+
+ foreach ($fixtures as $name) {
+ $class = App::className($name, 'Test/Fixture', 'Fixture');
+ if ($class === false) {
+ throw new \RuntimeException("Unknown fixture '$name'.");
+ }
+ $fixture = new $class($this->connection()->configName());
+ $table = $fixture->table;
+ if (in_array($table, $existing)) {
+ continue;
+ }
+ $fixture->create($connection);
+ }
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Model/Table/PanelsTable.php b/cakephp/app/Plugin/DebugKit/src/Model/Table/PanelsTable.php
new file mode 100644
index 0000000..8c538cc
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Model/Table/PanelsTable.php
@@ -0,0 +1,66 @@
+belongsTo('DebugKit.Requests');
+ $this->ensureTables(['DebugKit.Requests', 'DebugKit.Panels']);
+ }
+
+ /**
+ * Find panels by requestid
+ *
+ * @param Cake\ORM\Query $query The query
+ * @param array $options The options to use.
+ * @return Cake\ORM\Query The query.
+ * @throws \RuntimeException
+ */
+ public function findByRequest(Query $query, array $options)
+ {
+ if (empty($options['requestId'])) {
+ throw new \RuntimeException('Missing request id in findByRequest.');
+ }
+ return $query->where(['Panels.request_id' => $options['requestId']])
+ ->order(['Panels.title' => 'ASC']);
+ }
+
+ /**
+ * DebugKit tables are special.
+ *
+ * @return string
+ */
+ public static function defaultConnectionName()
+ {
+ return 'debug_kit';
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Model/Table/RequestsTable.php b/cakephp/app/Plugin/DebugKit/src/Model/Table/RequestsTable.php
new file mode 100644
index 0000000..9fe72c7
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Model/Table/RequestsTable.php
@@ -0,0 +1,104 @@
+hasMany('DebugKit.Panels', [
+ 'sort' => 'Panels.title ASC',
+ ]);
+ $this->addBehavior('Timestamp', [
+ 'events' => [
+ 'Model.beforeSave' => ['requested_at' => 'new']
+ ]
+ ]);
+ $this->ensureTables(['DebugKit.Requests', 'DebugKit.Panels']);
+ }
+
+ /**
+ * DebugKit tables are special.
+ *
+ * @return string
+ */
+ public static function defaultConnectionName()
+ {
+ return 'debug_kit';
+ }
+
+ /**
+ * Finder method to get recent requests as a simple array
+ *
+ * @param Cake\ORM\Query $query The query
+ * @param array $options The options
+ * @return Query The query.
+ */
+ public function findRecent(Query $query, array $options)
+ {
+ return $query->order(['Requests.requested_at' => 'DESC'])
+ ->limit(10);
+ }
+
+ /**
+ * Garbage collect old request data.
+ *
+ * Delete request data that is older than 2 weeks old.
+ * This method will only trigger periodically.
+ *
+ * @return void
+ */
+ public function gc()
+ {
+ if (time() % 100 !== 0) {
+ return;
+ }
+ $noPurge = $this->find()
+ ->select(['id'])
+ ->hydrate(false)
+ ->order(['requested_at' => 'desc'])
+ ->limit(Configure::read('DebugKit.requestCount') ?: 20)
+ ->extract('id')
+ ->toArray();
+
+ $query = $this->Panels->query()
+ ->delete()
+ ->where(['request_id NOT IN' => $noPurge]);
+ $statement = $query->execute();
+ $statement->closeCursor();
+
+ $query = $this->query()
+ ->delete()
+ ->where(['id NOT IN' => $noPurge]);
+
+ $statement = $query->execute();
+ $statement->closeCursor();
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Panel/CachePanel.php b/cakephp/app/Plugin/DebugKit/src/Panel/CachePanel.php
new file mode 100644
index 0000000..e435dc8
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Panel/CachePanel.php
@@ -0,0 +1,69 @@
+_instances[$name] = $instance;
+ }
+ }
+
+ /**
+ * Get the data for this panel
+ *
+ * @return array
+ */
+ public function data()
+ {
+ $metrics = [];
+ foreach ($this->_instances as $name => $instance) {
+ $metrics[$name] = $instance->metrics();
+ }
+ return [
+ 'metrics' => $metrics
+ ];
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Panel/EnvironmentPanel.php b/cakephp/app/Plugin/DebugKit/src/Panel/EnvironmentPanel.php
new file mode 100644
index 0000000..3fe21fe
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Panel/EnvironmentPanel.php
@@ -0,0 +1,89 @@
+ $phpVer],
+ $_SERVER
+ );
+ unset($return['php']['argv']);
+
+ // CakePHP Data
+ $return['cake'] = [
+ 'APP' => APP,
+ 'APP_DIR' => APP_DIR,
+ 'CACHE' => CACHE,
+ 'CAKE' => CAKE,
+ 'CAKE_CORE_INCLUDE_PATH' => CAKE_CORE_INCLUDE_PATH,
+ 'CORE_PATH' => CORE_PATH,
+ 'CAKE_VERSION' => Configure::version(),
+ 'DS' => DS,
+ 'LOGS' => LOGS,
+ 'ROOT' => ROOT,
+ 'TESTS' => TESTS,
+ 'TMP' => TMP,
+ 'WWW_ROOT' => WWW_ROOT
+ ];
+
+ $cakeConstants = array_fill_keys(
+ [
+ 'DS', 'ROOT', 'TIME_START', 'SECOND', 'MINUTE', 'HOUR', 'DAY', 'WEEK', 'MONTH', 'YEAR',
+ ],
+ ''
+ );
+ $var = get_defined_constants(true);
+ $return['app'] = array_diff_key($var['user'], $return['cake'], $cakeConstants);
+
+ if (isset($var['hidef'])) {
+ $return['hidef'] = $var['hidef'];
+ }
+
+ return $return;
+ }
+
+ /**
+ * Shutdown callback
+ *
+ * @param \Cake\Event\Event $event Event
+ * @return void
+ */
+ public function shutdown(Event $event)
+ {
+ $this->_data = $this->_prepare($event->subject());
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Panel/HistoryPanel.php b/cakephp/app/Plugin/DebugKit/src/Panel/HistoryPanel.php
new file mode 100644
index 0000000..cd5acc7
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Panel/HistoryPanel.php
@@ -0,0 +1,50 @@
+find('recent');
+ return [
+ 'requests' => $recent->toArray(),
+ ];
+ }
+
+ /**
+ * Gets the initial text for the history summary
+ *
+ * @return string
+ */
+ public function summary()
+ {
+ return '0 xhr';
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Panel/IncludePanel.php b/cakephp/app/Plugin/DebugKit/src/Panel/IncludePanel.php
new file mode 100644
index 0000000..9cfa33e
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Panel/IncludePanel.php
@@ -0,0 +1,187 @@
+
+ */
+ protected $_pluginPaths = [];
+
+ /**
+ * File Types
+ *
+ * @var array
+ */
+ protected $_fileTypes = [
+ 'Cache', 'Config', 'Configure', 'Console', 'Component', 'Controller',
+ 'Behavior', 'Datasource', 'Model', 'Plugin', 'Test', 'View', 'Utility',
+ 'Network', 'Routing', 'I18n', 'Log', 'Error'
+ ];
+
+ /**
+ * Get a list of plugins on construct for later use
+ */
+ public function __construct()
+ {
+ foreach (Plugin::loaded() as $plugin) {
+ $this->_pluginPaths[$plugin] = Plugin::path($plugin);
+ }
+ }
+
+ /**
+ * Get a list of files that were included and split them out into the various parts of the app
+ *
+ * @param Controller $controller The controller.
+ * @return array
+ */
+ protected function _prepare(Controller $controller)
+ {
+ $return = ['core' => [], 'app' => [], 'plugins' => []];
+
+ foreach (get_included_files() as $file) {
+ $pluginName = $this->_isPluginFile($file);
+
+ if ($pluginName) {
+ $return['plugins'][$pluginName][$this->_getFileType($file)][] = $this->_niceFileName($file, $pluginName);
+ } elseif ($this->_isAppFile($file)) {
+ $return['app'][$this->_getFileType($file)][] = $this->_niceFileName($file, 'app');
+ } elseif ($this->_isCoreFile($file)) {
+ $return['core'][$this->_getFileType($file)][] = $this->_niceFileName($file, 'core');
+ }
+ }
+
+ $return['paths'] = $this->_includePaths();
+
+ ksort($return['core']);
+ ksort($return['plugins']);
+ ksort($return['app']);
+ return $return;
+ }
+
+ /**
+ * Get the possible include paths
+ *
+ * @return array
+ */
+ protected function _includePaths()
+ {
+ $paths = array_flip(array_filter(explode(PATH_SEPARATOR, get_include_path())));
+
+ unset($paths['.']);
+ return array_flip($paths);
+ }
+
+ /**
+ * Check if a path is part of cake core
+ *
+ * @param string $file File to check
+ * @return bool
+ */
+ protected function _isCoreFile($file)
+ {
+ return strstr($file, CAKE);
+ }
+
+ /**
+ * Check if a path is from APP but not a plugin
+ *
+ * @param string $file File to check
+ * @return bool
+ */
+ protected function _isAppFile($file)
+ {
+ return strstr($file, APP);
+ }
+
+ /**
+ * Check if a path is from a plugin
+ *
+ * @param string $file File to check
+ * @return bool
+ */
+ protected function _isPluginFile($file)
+ {
+ foreach ($this->_pluginPaths as $plugin => $path) {
+ if (strstr($file, $path)) {
+ return $plugin;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Replace the path with APP, CORE or the plugin name
+ *
+ * @param string $file File to check
+ * @param string $type The file type
+ * - app for app files
+ * - core for core files
+ * - PluginName for the name of a plugin
+ * @return bool
+ */
+ protected function _niceFileName($file, $type)
+ {
+ switch ($type) {
+ case 'app':
+ return str_replace(APP, 'APP/', $file);
+
+ case 'core':
+ return str_replace(CAKE, 'CORE/', $file);
+
+ default:
+ return str_replace($this->_pluginPaths[$type], $type . '/', $file);
+ }
+ }
+
+ /**
+ * Get the type of file (model, controller etc)
+ *
+ * @param string $file File to check.
+ * @return string
+ */
+ protected function _getFileType($file)
+ {
+ foreach ($this->_fileTypes as $type) {
+ if (stripos($file, '/' . $type . '/') !== false) {
+ return $type;
+ }
+ }
+
+ return 'Other';
+ }
+
+ /**
+ * Shutdown callback
+ *
+ * @param \Cake\Event\Event $event Event
+ * @return void
+ */
+ public function shutdown(Event $event)
+ {
+ $this->_data = $this->_prepare($event->subject());
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Panel/LogPanel.php b/cakephp/app/Plugin/DebugKit/src/Panel/LogPanel.php
new file mode 100644
index 0000000..5e3a22a
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Panel/LogPanel.php
@@ -0,0 +1,67 @@
+ 'DebugKit.DebugKit',
+ ]);
+ }
+
+ /**
+ * Get the panel data
+ *
+ * @return void
+ */
+ public function data()
+ {
+ return [
+ 'logger' => Log::engine('debug_kit_log_panel')
+ ];
+ }
+
+ /**
+ * Get the summary data.
+ *
+ * @return string
+ */
+ public function summary()
+ {
+ $logger = Log::engine('debug_kit_log_panel');
+ if (!$logger) {
+ return 0;
+ }
+ return $logger->count();
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Panel/PanelRegistry.php b/cakephp/app/Plugin/DebugKit/src/Panel/PanelRegistry.php
new file mode 100644
index 0000000..3322cf2
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Panel/PanelRegistry.php
@@ -0,0 +1,83 @@
+eventManager($events);
+ }
+
+ /**
+ * Resolve a panel classname.
+ *
+ * Part of the template method for Cake\Utility\ObjectRegistry::load()
+ *
+ * @param string $class Partial classname to resolve.
+ * @return string|false Either the correct classname or false.
+ */
+ protected function _resolveClassName($class)
+ {
+ return App::className($class, 'Panel', 'Panel');
+ }
+
+ /**
+ * Throws an exception when a component is missing.
+ *
+ * Part of the template method for Cake\Utility\ObjectRegistry::load()
+ *
+ * @param string $class The classname that is missing.
+ * @param string $plugin The plugin the component is missing in.
+ * @return void
+ * @throws \RuntimeException
+ */
+ protected function _throwMissingClassError($class, $plugin)
+ {
+ throw new \RuntimeException("Unable to find '$class' panel.");
+ }
+
+ /**
+ * Create the panels instance.
+ *
+ * Part of the template method for Cake\Utility\ObjectRegistry::load()
+ *
+ * @param string $class The classname to create.
+ * @param string $alias The alias of the panel.
+ * @param array $config An array of config to use for the panel.
+ * @return DebugKit\DebugPanel The constructed panel class.
+ */
+ protected function _create($class, $alias, $config)
+ {
+ $instance = new $class($this, $config);
+ $this->eventManager()->on($instance);
+ return $instance;
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Panel/RequestPanel.php b/cakephp/app/Plugin/DebugKit/src/Panel/RequestPanel.php
new file mode 100644
index 0000000..e73ca8b
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Panel/RequestPanel.php
@@ -0,0 +1,46 @@
+subject();
+ $request = $controller->request;
+ $this->_data = [
+ 'params' => $request->params,
+ 'query' => $request->query,
+ 'data' => $request->data,
+ 'cookie' => $request->cookies,
+ 'get' => $_GET,
+ 'headers' => ['response' => headers_sent($file, $line), 'file' => $file, 'line' => $line],
+ ];
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Panel/SessionPanel.php b/cakephp/app/Plugin/DebugKit/src/Panel/SessionPanel.php
new file mode 100644
index 0000000..b07d1c9
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Panel/SessionPanel.php
@@ -0,0 +1,38 @@
+subject()->request;
+ if ($request) {
+ $this->_data = ['content' => $request->session()->read()];
+ }
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Panel/SqlLogPanel.php b/cakephp/app/Plugin/DebugKit/src/Panel/SqlLogPanel.php
new file mode 100644
index 0000000..d75c905
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Panel/SqlLogPanel.php
@@ -0,0 +1,100 @@
+configName() === 'debug_kit') {
+ continue;
+ }
+ $logger = null;
+ if ($connection->logQueries()) {
+ $logger = $connection->logger();
+ }
+
+ if ($logger instanceof DebugLog) {
+ continue;
+ }
+ $logger = new DebugLog($logger, $name);
+
+ $connection->logQueries(true);
+ $connection->logger($logger);
+ $this->_loggers[] = $logger;
+ }
+ }
+
+ /**
+ * Get the data this panel wants to store.
+ *
+ * @return array
+ */
+ public function data()
+ {
+ return [
+ 'tables' => array_map(function ($table) {
+ return $table->alias();
+ }, TableRegistry::genericInstances()),
+ 'loggers' => $this->_loggers,
+ ];
+ }
+
+ /**
+ * Get summary data from the queries run.
+ *
+ * @return string
+ */
+ public function summary()
+ {
+ $count = $time = 0;
+ foreach ($this->_loggers as $logger) {
+ $count += count($logger->queries());
+ $time += $logger->totalTime();
+ }
+ if (!$count) {
+ return '0';
+ }
+ return "$count / $time ms";
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Panel/TimerPanel.php b/cakephp/app/Plugin/DebugKit/src/Panel/TimerPanel.php
new file mode 100644
index 0000000..aa06e30
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Panel/TimerPanel.php
@@ -0,0 +1,129 @@
+ 0, 'callable' => $before('Event: ' . $name)],
+ ['priority' => 999, 'callable' => $after('Event: ' . $name)]
+ ];
+ };
+
+ return [
+ 'Controller.initialize' => [
+ ['priority' => 0, 'callable' => function () {
+ DebugMemory::record(__d('debug_kit', 'Controller initialization'));
+ }],
+ ['priority' => 0, 'callable' => $before('Event: Controller.initialize')],
+ ['priority' => 999, 'callable' => $after('Event: Controller.initialize')]
+ ],
+ 'Controller.startup' => [
+ ['priority' => 0, 'callable' => $before('Event: Controller.startup')],
+ ['priority' => 999, 'callable' => $after('Event: Controller.startup')],
+ ['priority' => 999, 'callable' => function () {
+ DebugMemory::record(__d('debug_kit', 'Controller action start'));
+ DebugTimer::start(__d('debug_kit', 'Controller action'));
+ }],
+ ],
+ 'Controller.beforeRender' => [
+ ['priority' => 0, 'callable' => function () {
+ DebugTimer::stop(__d('debug_kit', 'Controller action'));
+ }],
+ ['priority' => 0, 'callable' => $before('Event: Controller.beforeRender')],
+ ['priority' => 999, 'callable' => $after('Event: Controller.beforeRender')],
+ ['priority' => 999, 'callable' => function () {
+ DebugMemory::record(__d('debug_kit', 'View Render start'));
+ DebugTimer::start(__d('debug_kit', 'View Render start'));
+ }],
+ ],
+ 'View.beforeRender' => $both('View.beforeRender'),
+ 'View.afterRender' => $both('View.afterRender'),
+ 'View.beforeLayout' => $both('View.beforeLayout'),
+ 'View.afterLayout' => $both('View.afterLayout'),
+ 'View.beforeRenderFile' => [
+ ['priority' => 0, 'callable' => function ($event, $filename) {
+ DebugTimer::start(__d('debug_kit', 'Render {0}', $filename));
+ }],
+ ],
+ 'View.afterRenderFile' => [
+ ['priority' => 0, 'callable' => function ($event, $filename) {
+ DebugTimer::stop(__d('debug_kit', 'Render {0}', $filename));
+ }],
+ ],
+ 'Controller.shutdown' => [
+ ['priority' => 0, 'callable' => $before('Event: Controller.shutdown')],
+ ['priority' => 0, 'callable' => function () {
+ DebugTimer::stop(__d('debug_kit', 'View Render start'));
+ DebugMemory::record(__d('debug_kit', 'Controller shutdown'));
+ }],
+ ['priority' => 999, 'callable' => $after('Event: Controller.shutdown')],
+ ],
+ ];
+ }
+
+ /**
+ * Get the data for the panel.
+ *
+ * @return array
+ */
+ public function data()
+ {
+ return [
+ 'requestTime' => DebugTimer::requestTime(),
+ 'timers' => DebugTimer::getAll(),
+ 'memory' => DebugMemory::getAll(),
+ 'peakMemory' => DebugMemory::getPeak(),
+ ];
+ }
+
+ /**
+ * Get the summary for the panel.
+ *
+ * @return string
+ */
+ public function summary()
+ {
+ $time = Number::precision(DebugTimer::requestTime(), 2) . ' s';
+ $memory = Number::toReadableSize(DebugMemory::getPeak());
+ return "$time / $memory";
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Panel/VariablesPanel.php b/cakephp/app/Plugin/DebugKit/src/Panel/VariablesPanel.php
new file mode 100644
index 0000000..2b385a4
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Panel/VariablesPanel.php
@@ -0,0 +1,134 @@
+errors();
+
+ foreach ($entity->visibleProperties() as $property) {
+ $v = $entity[$property];
+ if ($v instanceof EntityInterface) {
+ $errors[$property] = $this->_getErrors($v);
+ } elseif (is_array($v)) {
+ foreach ($v as $key => $varValue) {
+ if ($varValue instanceof EntityInterface) {
+ $errors[$property][$key] = $this->_getErrors($varValue);
+ }
+ }
+ }
+ }
+
+ return Hash::filter($errors);
+ }
+
+ /**
+ * Shutdown event
+ *
+ * @param \Cake\Event\Event $event The event
+ * @return void
+ */
+ public function shutdown(Event $event)
+ {
+ $controller = $event->subject();
+ $errors = [];
+
+ $walker = function (&$item) use (&$walker) {
+ if ($item instanceof Query || $item instanceof ResultSet) {
+ try {
+ $item = $item->toArray();
+ } catch (\Cake\Database\Exception $e) {
+ //Likely issue is unbuffered query; fall back to __debugInfo
+ $item = array_map($walker, $item->__debugInfo());
+ }
+ } elseif ($item instanceof Closure ||
+ $item instanceof PDO ||
+ $item instanceof SimpleXmlElement
+ ) {
+ $item = 'Unserializable object - ' . get_class($item);
+ } elseif ($item instanceof Exception) {
+ $item = sprintf(
+ 'Unserializable object - %s. Error: %s in %s, line %s',
+ get_class($item),
+ $item->getMessage(),
+ $item->getFile(),
+ $item->getLine()
+ );
+ } elseif (is_object($item) && method_exists($item, '__debugInfo')) {
+ // Convert objects into using __debugInfo.
+ $item = array_map($walker, $item->__debugInfo());
+ }
+ return $item;
+ };
+ // Copy so viewVars is not mutated.
+ $vars = $controller->viewVars;
+ array_walk_recursive($vars, $walker);
+
+ foreach ($vars as $k => $v) {
+ // Get the validation errors for Entity
+ if ($v instanceof EntityInterface) {
+ $errors[$k] = $this->_getErrors($v);
+ } elseif ($v instanceof Form) {
+ $formError = $v->errors();
+ if (!empty($formError)) {
+ $errors[$k] = $formError;
+ }
+ }
+ }
+
+ $this->_data = [
+ 'content' => $vars,
+ 'errors' => $errors
+ ];
+ }
+
+ /**
+ * Get summary data for the variables panel.
+ *
+ * @return int
+ */
+ public function summary()
+ {
+ if (!isset($this->_data['content'])) {
+ return 0;
+ }
+ return count($this->_data['content']);
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Routing/Filter/DebugBarFilter.php b/cakephp/app/Plugin/DebugKit/src/Routing/Filter/DebugBarFilter.php
new file mode 100644
index 0000000..5a2bd14
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Routing/Filter/DebugBarFilter.php
@@ -0,0 +1,240 @@
+ [
+ 'DebugKit.Cache',
+ 'DebugKit.Session',
+ 'DebugKit.Request',
+ 'DebugKit.SqlLog',
+ 'DebugKit.Timer',
+ 'DebugKit.Log',
+ 'DebugKit.Variables',
+ 'DebugKit.Environment',
+ 'DebugKit.Include',
+ 'DebugKit.History',
+ ],
+ 'forceEnable' => false,
+ ];
+
+ /**
+ * Constructor
+ *
+ * @param \Cake\Event\EventManager $events The event manager to use.
+ * @param array $config The configuration data for DebugKit.
+ */
+ public function __construct(EventManager $events, array $config)
+ {
+ $this->eventManager($events);
+ $this->config($config);
+ $this->_registry = new PanelRegistry($events);
+ }
+
+ /**
+ * Event bindings
+ *
+ * @return array
+ */
+ public function implementedEvents()
+ {
+ return [
+ 'Dispatcher.beforeDispatch' => [
+ 'callable' => 'beforeDispatch',
+ 'priority' => 0,
+ ],
+ 'Dispatcher.afterDispatch' => [
+ 'callable' => 'afterDispatch',
+ 'priority' => 9999,
+ ],
+ ];
+ }
+
+ /**
+ * Check whether or not debug kit is enabled.
+ *
+ * @return bool
+ */
+ public function isEnabled()
+ {
+ $enabled = (bool)Configure::read('debug');
+ if ($enabled) {
+ return true;
+ }
+ $force = $this->config('forceEnable');
+ if (is_callable($force)) {
+ return $force();
+ }
+ return $force;
+ }
+
+ /**
+ * Get the list of loaded panels
+ *
+ * @return array
+ */
+ public function loadedPanels()
+ {
+ return $this->_registry->loaded();
+ }
+
+ /**
+ * Get the list of loaded panels
+ *
+ * @param string $name The name of the panel you want to get.
+ * @return DebugKit\Panel\DebugPanel|null The panel or null.
+ */
+ public function panel($name)
+ {
+ return $this->_registry->{$name};
+ }
+
+ /**
+ * Do the required setup work.
+ *
+ * - Build panels.
+ * - Connect events
+ *
+ * @return void
+ */
+ public function setup()
+ {
+ foreach ($this->config('panels') as $panel) {
+ $this->_registry->load($panel);
+ }
+ }
+
+ /**
+ * Call the initialize method onl all the loaded panels.
+ *
+ * @param \Cake\Event\Event $event The beforeDispatch event.
+ * @return void
+ */
+ public function beforeDispatch(Event $event)
+ {
+ foreach ($this->_registry->loaded() as $panel) {
+ $this->_registry->{$panel}->initialize();
+ }
+ }
+
+ /**
+ * Save the toolbar data.
+ *
+ * @param \Cake\Event\Event $event The afterDispatch event.
+ * @return void
+ */
+ public function afterDispatch(Event $event)
+ {
+ $request = $event->data['request'];
+ // Skip debugkit requests and requestAction()
+ if ($request->param('plugin') === 'DebugKit' || $request->is('requested')) {
+ return;
+ }
+ $response = $event->data['response'];
+
+ $data = [
+ 'url' => $request->here(),
+ 'content_type' => $response->type(),
+ 'method' => $request->method(),
+ 'status_code' => $response->statusCode(),
+ 'requested_at' => $request->env('REQUEST_TIME'),
+ 'panels' => []
+ ];
+ $requests = TableRegistry::get('DebugKit.Requests');
+ $requests->gc();
+
+ $row = $requests->newEntity($data);
+ $row->isNew(true);
+
+ foreach ($this->_registry->loaded() as $name) {
+ $panel = $this->_registry->{$name};
+ try {
+ $content = serialize($panel->data());
+ } catch (\Exception $e) {
+ $content = serialize([
+ 'error' => $e->getMessage(),
+ ]);
+ }
+ $row->panels[] = $requests->Panels->newEntity([
+ 'panel' => $name,
+ 'element' => $panel->elementName(),
+ 'title' => $panel->title(),
+ 'summary' => $panel->summary(),
+ 'content' => $content,
+ ]);
+ }
+ $row = $requests->save($row);
+
+ $this->_injectScripts($row->id, $response);
+ $response->header(['X-DEBUGKIT-ID' => $row->id]);
+ }
+
+ /**
+ * Injects the JS to build the toolbar.
+ *
+ * The toolbar will only be injected if the response's content type
+ * contains HTML and there is a
+ = $this->fetch('content') ?>
+
+ = $this->Html->image('DebugKit.cake.icon.png', ['class' => 'indicator'])?>
+
+ tag.
+ *
+ * @param string $id ID to fetch data from.
+ * @param \Cake\Network\Response $response The response to augment.
+ * @return void
+ */
+ protected function _injectScripts($id, $response)
+ {
+ if (strpos($response->type(), 'html') === false) {
+ return;
+ }
+ $body = $response->body();
+ $pos = strrpos($body, '');
+ if ($pos === false) {
+ return;
+ }
+ $url = Router::url('/', true);
+ $script = "';
+ $body = substr($body, 0, $pos) . $script . substr($body, $pos);
+ $response->body($body);
+ }
+}
diff --git a/cakephp/app/Plugin/DebugKit/src/Template/Element/cache_panel.ctp b/cakephp/app/Plugin/DebugKit/src/Template/Element/cache_panel.ctp
new file mode 100644
index 0000000..7906307
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Template/Element/cache_panel.ctp
@@ -0,0 +1,74 @@
+
+
+
+
+
diff --git a/cakephp/app/Plugin/DebugKit/src/Template/Element/history_panel.ctp b/cakephp/app/Plugin/DebugKit/src/Template/Element/history_panel.ctp
new file mode 100644
index 0000000..91340e3
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Template/Element/history_panel.ctp
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
diff --git a/cakephp/app/Plugin/DebugKit/src/Template/Element/include_panel.ctp b/cakephp/app/Plugin/DebugKit/src/Template/Element/include_panel.ctp
new file mode 100644
index 0000000..42d189a
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Template/Element/include_panel.ctp
@@ -0,0 +1,23 @@
+
+
+= $this->Toolbar->makeNeatArray(['core' => $core, 'app' => $app, 'plugins' => $plugins]) ?>
diff --git a/cakephp/app/Plugin/DebugKit/src/Template/Element/log_panel.ctp b/cakephp/app/Plugin/DebugKit/src/Template/Element/log_panel.ctp
new file mode 100644
index 0000000..5df4414
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Template/Element/log_panel.ctp
@@ -0,0 +1,38 @@
+
+noLogs()): ?>
+
+
+
diff --git a/cakephp/app/Plugin/DebugKit/src/Template/Element/request_panel.ctp b/cakephp/app/Plugin/DebugKit/src/Template/Element/request_panel.ctp
new file mode 100644
index 0000000..161ae2e
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Template/Element/request_panel.ctp
@@ -0,0 +1,50 @@
+
+
+
' . __d('debug_kit', 'Headers already sent at file {0} and line {1}.', [$headers['file'], $headers['line']]) . '
+' . __d('debug_kit', 'No post data.') . '
+' . __d('debug_kit', 'No querystring data.') . '
+
diff --git a/cakephp/app/Plugin/DebugKit/src/Template/Element/session_panel.ctp b/cakephp/app/Plugin/DebugKit/src/Template/Element/session_panel.ctp
new file mode 100644
index 0000000..7bc32ef
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Template/Element/session_panel.ctp
@@ -0,0 +1,15 @@
+
+= $this->Toolbar->makeNeatArray($content);
diff --git a/cakephp/app/Plugin/DebugKit/src/Template/Element/sql_log_panel.ctp b/cakephp/app/Plugin/DebugKit/src/Template/Element/sql_log_panel.ctp
new file mode 100644
index 0000000..6cceb22
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Template/Element/sql_log_panel.ctp
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+ queries();
+ if (empty($queries)):
+ continue;
+ endif;
+
+ $noOutput = false;
+ ?>
+
+
diff --git a/cakephp/app/Plugin/DebugKit/src/Template/Element/timer_panel.ctp b/cakephp/app/Plugin/DebugKit/src/Template/Element/timer_panel.ctp
new file mode 100644
index 0000000..918cb0c
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Template/Element/timer_panel.ctp
@@ -0,0 +1,94 @@
+
+
+ = __d('debug_kit', 'Memory') ?>
+
+ = __d('debug_kit', 'Peak Memory Use:') ?>
+ = $this->Number->toReadableSize($peakMemory) ?>
+
+
+
+
+
+ | = __d('debug_kit', 'Message') ?> |
+ = __d('debug_kit', 'Memory Use') ?> |
+
+
+
+ $value): ?>
+
+ | = h($key) ?> |
+ = $this->Number->toReadableSize($value) ?> |
+
+
+
+
+
+
+
+ = __d('debug_kit', 'Timers') ?>
+
+ = __d('debug_kit', 'Total Request Time:') ?>
+ = $this->Number->precision($requestTime * 1000, 0) ?> ms
+
+
+
+
+
+ | = __d('debug_kit', 'Event') ?> |
+ = __d('debug_kit', 'Time in ms') ?> |
+ = __d('debug_kit', 'Timeline') ?> |
+
+
+
+ $timeInfo):
+ $indent = 0;
+ for ($j = 0; $j < $i; $j++):
+ if (($values[$j]['end'] > $timeInfo['start']) && ($values[$j]['end']) > ($timeInfo['end'])):
+ $indent++;
+ endif;
+ endfor;
+ $indent = str_repeat("\xC2\xA0\xC2\xA0", $indent);
+ ?>
+
+ |
+ = h($indent . $timeInfo['message']) ?>
+ |
+ = $this->Number->precision($timeInfo['time'] * 1000, 2) ?> |
+
+ = $this->SimpleGraph->bar(
+ $timeInfo['time'] * 1000,
+ $timeInfo['start'] * 1000,
+ [
+ 'max' => $maxTime * 1000,
+ 'requestTime' => $requestTime * 1000,
+ ]
+ ) ?>
+ |
+
+
+
+
diff --git a/cakephp/app/Plugin/DebugKit/src/Template/Element/variables_panel.ctp b/cakephp/app/Plugin/DebugKit/src/Template/Element/variables_panel.ctp
new file mode 100644
index 0000000..84ee89d
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Template/Element/variables_panel.ctp
@@ -0,0 +1,27 @@
+%s
';
+ echo $this->Toolbar->makeNeatArray($errors);
+endif;
diff --git a/cakephp/app/Plugin/DebugKit/src/Template/Layout/panel.ctp b/cakephp/app/Plugin/DebugKit/src/Template/Layout/panel.ctp
new file mode 100644
index 0000000..a855365
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Template/Layout/panel.ctp
@@ -0,0 +1 @@
+= $this->fetch('content') ?>
diff --git a/cakephp/app/Plugin/DebugKit/src/Template/Layout/toolbar.ctp b/cakephp/app/Plugin/DebugKit/src/Template/Layout/toolbar.ctp
new file mode 100644
index 0000000..b2afa51
--- /dev/null
+++ b/cakephp/app/Plugin/DebugKit/src/Template/Layout/toolbar.ctp
@@ -0,0 +1,17 @@
+
+
+
+ = $this->Html->css('DebugKit.reset') ?>
+ = $this->Html->css('DebugKit.toolbar') ?>
+
+
+ = $this->Html->script('DebugKit.jquery') ?>
+ = $this->Html->script('DebugKit.toolbar-app') ?>
+ = $this->fetch('script') ?>
+