]> wagnertech.de Git - timetracker.git/commitdiff
More progress with attachments.
authorNik Okuntseff <support@anuko.com>
Sun, 17 Mar 2019 17:43:17 +0000 (17:43 +0000)
committerNik Okuntseff <support@anuko.com>
Sun, 17 Mar 2019 17:43:17 +0000 (17:43 +0000)
33 files changed:
WEB-INF/lib/ttFileHelper.class.php
WEB-INF/resources/ca.lang.php
WEB-INF/resources/cs.lang.php
WEB-INF/resources/da.lang.php
WEB-INF/resources/de.lang.php
WEB-INF/resources/en.lang.php
WEB-INF/resources/es.lang.php
WEB-INF/resources/et.lang.php
WEB-INF/resources/fa.lang.php
WEB-INF/resources/fi.lang.php
WEB-INF/resources/fr.lang.php
WEB-INF/resources/gr.lang.php
WEB-INF/resources/he.lang.php
WEB-INF/resources/hu.lang.php
WEB-INF/resources/it.lang.php
WEB-INF/resources/ja.lang.php
WEB-INF/resources/ko.lang.php
WEB-INF/resources/nl.lang.php
WEB-INF/resources/no.lang.php
WEB-INF/resources/pl.lang.php
WEB-INF/resources/pt-br.lang.php
WEB-INF/resources/pt.lang.php
WEB-INF/resources/ro.lang.php
WEB-INF/resources/ru.lang.php
WEB-INF/resources/sk.lang.php
WEB-INF/resources/sl.lang.php
WEB-INF/resources/sr.lang.php
WEB-INF/resources/sv.lang.php
WEB-INF/resources/tr.lang.php
WEB-INF/resources/zh-cn.lang.php
WEB-INF/resources/zh-tw.lang.php
WEB-INF/templates/footer.tpl
project_files.php

index aad91e9fd3ff7fc758c83d73c036b303cc42e77e..af470c711a9548158bc1cc7a40e7ca8e38fec23d 100644 (file)
@@ -52,6 +52,8 @@ class ttFileHelper {
   // checkSiteRegistration - obtains site id and key from local database.
   // If not found, it tries to register with file stroage facility.
   function checkSiteRegistration() {
+
+    global $i18n;
     $mdb2 = getConnection();
 
     // Obtain site id.
@@ -94,6 +96,8 @@ class ttFileHelper {
           $mdb2->exec($sql);
           $sql = "insert into tt_site_config values('locker_key', $key, now(), null)";
           $mdb2->exec($sql);
+        } else {
+          $this->errors->add($i18n->get('error.file_storage'));
         }
       }
     } else {
@@ -109,16 +113,21 @@ class ttFileHelper {
   }
 
   // putFile - puts uploaded file in remote storage.
-  function putFile($description) {
-
-    $url = $this->storage_uri;
-    $fields = array('description' => urlencode($description),
-//     'fname' => urlencode($_POST['first_name']),
-//     'title' => urlencode($_POST['title']),
-//     'company' => urlencode($_POST['institution']),
-//     'age' => urlencode($_POST['age']),
-//     'email' => urlencode($_POST['email']),
-//     'phone' => urlencode($_POST['phone'])
+  function putFile($fields) {
+    $mdb2 = getConnection();
+
+    $fields = array('site_id' => urlencode($this->site_id),
+      'site_key' => urlencode($this->site_key),
+      //'org_id' => urlencode($this->org_id),       // TODO: obtain this properly.
+      //'org_key' => urlencode($this->org_key),     // TODO: obtain this properly.
+      //'group_id' => urlencode($this->group_id),   // TODO: obtain this properly.
+      //'group_key' => urlencode($this->group_key), // TODO: obtain this properly.
+      //'user_id' => urlencode($this->user_id),     // TODO: obtain this properly.
+      //'user_key' => urlencode($this->user_key),   // TODO: obtain this properly.
+      'file_name' => urlencode($fields['file_name']),
+      'description' => urlencode($fields['description']),
+      // TODO: add file content here, too. Will this work for large files?
+      //
     );
 
     // url-ify the data for the POST.
@@ -129,7 +138,7 @@ class ttFileHelper {
     $ch = curl_init();
 
     // Set the url, number of POST vars, POST data.
-    curl_setopt($ch, CURLOPT_URL, $url);
+    curl_setopt($ch, CURLOPT_URL, $this->putfile_uri);
     curl_setopt($ch, CURLOPT_POST, count($fields));
     curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@@ -142,7 +151,8 @@ class ttFileHelper {
 
     if ($result) {
       $result_array = json_decode($result, true);
-      $file_id = $mdb2->quote($result_array['id']);
+      $file_id = $result_array['file_id'];
+      $file_key = $result_array['file_key'];
     }
 
     unlink($_FILES['newfile']['tmp_name']);
index 59ea97effc092428701e1fe4d4358c224c2d43b5..06a28c88a7664c5b3f1c5b23c67f74bda59f9444 100644 (file)
@@ -120,6 +120,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 96f17769f4307691f3b472251c42f71f111b5e54..97ab7e676411c28829f8c701ee298d9a9a74dfd8 100644 (file)
@@ -122,6 +122,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 7a6ef813587084da3e054f2b08016cee3eb62b38..403289ba13857670ff7c90a4ea63976501f6568d 100644 (file)
@@ -116,6 +116,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index bc7ba0c3af05abfad749be5342c846ad419faa8f..980706d2875970c4645541706227b381f048800f 100644 (file)
@@ -110,6 +110,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 8dc20118daf1176c0e25a4683708e9ce397c7785..f1fc72aa1943dd864c15c8afd6946d2e468916be 100644 (file)
@@ -105,6 +105,7 @@ $i18n_key_words = array(
 'error.format' => 'Invalid file format.',
 'error.user_count' => 'Limit on user count.',
 'error.expired' => 'Expiration date reached.',
+'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 'warn.sure' => 'Are you sure?',
index 7978ff5575cbdfbd7c9135487b9c1a2c04fef3cf..4f33f6d9f20b3f2cccc5c07f360f135fc0919e9a 100644 (file)
@@ -118,6 +118,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 94fb496e4d0ca4b6dfdd6744122ca5a78ee127df..f46db014a3ab3346e970a527c10ed2f9cda6f649 100644 (file)
@@ -126,6 +126,8 @@ $i18n_key_words = array(
 'error.format' => 'Faili formaat on vale.',
 'error.user_count' => 'Kasutajate arvu piirang.',
 'error.expired' => 'Kehtivusaeg on lõppenud.',
+// TODO: translate the following.
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 'warn.sure' => 'Oled kindel?',
index 17a76172e67435e0e8810fac4bb8f506b376c773..8111b3d3607efeab9d864e6fa9eb4c348ddd8a4a 100644 (file)
@@ -123,6 +123,8 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// TODO: translate the following.
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 661edd86c2a286c85f5b8f30971d2396dd33f651..2f3a409230908343a87fa25fa91bffc87402cfe9 100644 (file)
@@ -118,6 +118,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index b797b6ff14b48941f770f2d1cad448e50bc3e628..1bb5f680f76447343f9b6765bfea98ec9f1595d9 100644 (file)
@@ -116,6 +116,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index a69e6aa8c7d19292290eb9f4f6af1f8430ca0acf..bb2a334b2e01576b7ee4204078cce023dbb31467 100644 (file)
@@ -111,6 +111,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 8cc4d02270f4e067ac5a1826e680f7fec6819654..19ace043bbd467117197852328bd583f3f2007c5 100644 (file)
@@ -133,6 +133,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 8c2e730c627ec9c32c5fac8662b6be93ac65380a..349c224c1475174bc59c8cd628e9c90284681133 100644 (file)
@@ -121,6 +121,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index c1a87b731b78128f4f1f142e2a483e98986a83a9..c19f9f3d61f458a6f260b71a9f1b9700cfd5b62c 100644 (file)
@@ -115,6 +115,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 3b48408c68d7d2732bfcd46020c05df1403e7dcc..c53b8aede46c54c9478e98096f756f83e95699bc 100644 (file)
@@ -124,6 +124,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 1a77cde766063ab39d511559bddfe458fde16502..cf3f608edfb3f4ad42ac7f96da07b9f8584e416c 100644 (file)
@@ -123,6 +123,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 426a1428547fd3ae4357508de5d3734d19a75e57..e56846c799744f09e7bae2d51bf37e0a6bd08acc 100644 (file)
@@ -105,6 +105,8 @@ $i18n_key_words = array(
 'error.format' => 'Bestandsformaat niet valide.',
 'error.user_count' => 'Limiet op aantal gebruikers.',
 'error.expired' => 'Verloop datum is bereikt.',
+// TODO: translate the following.
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 'warn.sure' => 'Ben je er zeker van?',
index a37e8881bf93d6dd85afd0c77bbc8a0aabb5fb24..e6816351c4dff1f760d934d8892230ae220ca231 100644 (file)
@@ -124,6 +124,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 9258b85120b92f0d6697b06a29c0131a5cec58bb..e81fc254df43a8717ccf634fc40a8b9b97d32684 100644 (file)
@@ -120,6 +120,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 99d4d1c73a61c205838e7f489754ed2b8b93b9d5..f5d923906e9b3b3c55539bc5eb79eac57de09f8a 100644 (file)
@@ -117,6 +117,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 8969cdcdd4eaf0289f01c78989986b43c90c7827..a0ac39b2483d4787b93fd5d21878c04c42e7f7e7 100644 (file)
@@ -117,6 +117,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 74b843e981a9eeebea75a9f6624ff61b8ebe9878..83218b041f17276156a6b04bce70d8e69e10a4e3 100644 (file)
@@ -124,6 +124,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index c8dee6fc4d0a4322e57f5fed124d9022186c8401..36815e9fbf423e88b7d5bf6a9a98cbf9e4943367 100644 (file)
@@ -104,6 +104,7 @@ $i18n_key_words = array(
 'error.format' => 'Неверный формат файла.',
 'error.user_count' => 'Ограничение на количество пользователей.',
 'error.expired' => 'Достигнута дата экспирации.',
+'error.file_storage' => 'Ошибка файлохранилища.',
 
 // Warning messages.
 'warn.sure' => 'Вы уверены?',
index 34d92dd59ee4eb3e65dbe224d31d7d610f1153fc..1a53dc8f25efef4ff6cfd4451afe4e7f173d57d0 100644 (file)
@@ -122,6 +122,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index a4cc8fef95c392fd3d3faaaec9adedbc0fb36356..c9144c8cf6dfe0b60039a482c3c037d412e0a6db 100644 (file)
@@ -114,6 +114,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 7178d548cf6d59cc72d446c772b82a3515e48e87..6365d1c09d2d23f241746b3a464bb14788f73627 100644 (file)
@@ -117,6 +117,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 818a7db5e78d8eb10cd4d72c3b836567b3233f98..c89dd6488223f6ec5d442d3ab077727d9ae4cdf9 100644 (file)
@@ -115,6 +115,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 7608d155fdbefe8168f21a073b2099967a46ad79..fd96a2af72eb993e4d0e46063a27a2ed843a3d9c 100644 (file)
@@ -127,6 +127,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index ef133c96792d978ff98860abc2c02720c48ad396..8d561837a63806e0c5ebdfc8ac41011c6ddda12a 100644 (file)
@@ -116,6 +116,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 9aa1245183f14da9a0aebfedc7794a70915a833b..dc590fec53ffe343ab56c8872de82a3bd3cf1417 100644 (file)
@@ -121,6 +121,7 @@ $i18n_key_words = array(
 // 'error.format' => 'Invalid file format.',
 // 'error.user_count' => 'Limit on user count.',
 // 'error.expired' => 'Expiration date reached.',
+// 'error.file_storage' => 'File storage error.',
 
 // Warning messages.
 // TODO: translate the following.
index 1dcec8020860e5342c222fab26948a471d86c07c..9f0efd99a01d519735c26e579c56069d901250d5 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.18.59.4874 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.18.59.4875 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index affc6d72af912347dee31ef14465f623f8a74354..fec090b21942d725c9699ed38d9655286368b11d 100644 (file)
@@ -72,7 +72,10 @@ if ($request->isPost()) {
 
   if ($err->no()) {
     $fileHelper = new ttFileHelper($err);
-    $fileHelper->putFile($cl_description);
+    $fields = array('description'=>$cl_description); // TODO: add other fields here if required.
+    if (!$fileHelper->putFile($fields)) {
+      $err->add($i18n->get('error.expired'));
+    }
   }
 //  if ($err->no()) $msg->add($i18n->get('form.import.success'));
 } // isPost