// 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.
$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 {
}
// 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.
$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);
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']);
// '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.
// '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.
// '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.
// '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.
'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?',
// '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.
'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?',
// '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.
// '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.
// '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.
// '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.
// '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.
// '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.
// '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.
// '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.
// '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.
'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?',
// '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.
// '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.
// '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.
// '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.
// '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.
'error.format' => 'Неверный формат файла.',
'error.user_count' => 'Ограничение на количество пользователей.',
'error.expired' => 'Достигнута дата экспирации.',
+'error.file_storage' => 'Ошибка файлохранилища.',
// Warning messages.
'warn.sure' => 'Вы уверены?',
// '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.
// '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.
// '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.
// '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.
// '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.
// '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.
// '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.
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.59.4874 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.59.4875 | Copyright © <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>
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