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 function modeleMenu() { $ret = array(); $path = __DIR__ . '/../../views/menu/'; $modeles = scandir($path); foreach ($modeles as $modele) { if (is_file($path . $modele) && KLib\File::extension($modele) == 'tpl') { $ret[] = array('value' => KLib\File::woExtension($modele), 'key' => ucfirst(KLib\File::woExtension($modele))); } } ksort($ret); return $ret; }
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; }