public function updatePo() { if (KLib\File::fileNameExtension($_FILES['file']['name']) != 'po') { throw new Exception('FORBIDDEN ACCESS', 403); } if (move_uploaded_file($_FILES['file']['tmp_name'], $this->path . C::g('LANG_DOMAIN_CURRENT') . '.po')) { return array('error' => 'OK'); } return array('error' => 'FAIL'); }
public static function selectFiles($path = null) { if (is_null($path)) { $path = realpath(ROOTDIR . '../views/') . '/'; } $ret = array(); $files = scandir($path); foreach ($files as $file) { if (is_file($path . $file) && KLib\File::fileNameExtension($file) == 'tpl') { $ret[] = $path . $file; } elseif (is_dir($path . $file) && !in_array($file, array('.', '..'))) { $ret = array_merge($ret, self::selectFiles($path . $file . '/')); } } return $ret; }