if (!move_uploaded_file($_FILES['file']['tmp_name'], $uploaddir . '/' . $_FILES['file']['name'])) { throw new Exception(__('Impossible de déplacer le fichier temporaire', __FILE__)); } if (!file_exists($uploaddir . '/' . $_FILES['file']['name'])) { throw new Exception(__('Impossible d\'uploader le fichier (limite du serveur web ?)', __FILE__)); } ajax::success(); } if (init('action') == 'haltSystem') { ajax::success(jeedom::haltSystem()); } if (init('action') == 'rebootSystem') { ajax::success(jeedom::rebootSystem()); } if (init('action') == 'forceSyncHour') { ajax::success(jeedom::forceSyncHour()); } if (init('action') == 'saveCustom') { $path = dirname(__FILE__) . '/../../'; if (init('version') != 'desktop' && init('version') != 'mobile') { throw new Exception(__('La version ne peut etre que desktop ou mobile', __FILE__)); } if (init('type') != 'js' && init('type') != 'css') { throw new Exception(__('La version ne peut etre que js ou css', __FILE__)); } $path .= init('version') . '/custom/'; if (!file_exists($path)) { mkdir($path); } $path .= 'custom.' . init('type'); if (file_exists($path)) {
public static function isDateOk() { if (file_exists('/tmp/jeedom_dateOk')) { return true; } if (strtotime('now') < strtotime('2015-01-01 00:00:00') || strtotime('now') > strtotime('2019-01-01 00:00:00')) { shell_exec('sudo sntp ' . config::byKey('ntp::optionalServer', 'core', '0.debian.pool.ntp.org')); sleep(3); } if (strtotime('now') < strtotime('2015-01-01 00:00:00') || strtotime('now') > strtotime('2019-01-01 00:00:00')) { shell_exec('sudo sntp 1.debian.pool.ntp.org'); sleep(3); } if (strtotime('now') < strtotime('2015-01-01 00:00:00') || strtotime('now') > strtotime('2019-01-01 00:00:00')) { jeedom::forceSyncHour(); sleep(3); } if (strtotime('now') < strtotime('2015-01-01 00:00:00') || strtotime('now') > strtotime('2019-01-01 00:00:00')) { log::add('core', 'error', __('La date du système est incorrect (avant 2014-01-01 ou après 2019-01-01) : ', __FILE__) . date('Y-m-d H:i:s'), 'dateCheckFailed'); return false; } touch('/tmp/jeedom_dateOk'); return true; }