コード例 #1
0
ファイル: index.php プロジェクト: rafals/PHP-static-pages
function content($view = 'index')
{
    global $node;
    global $params_num;
    global $params;
    //echo 'n'.$node.' pn'.$params_num;
    $path = array('views');
    for ($i = 0; $i <= $node; $i++) {
        //echo ' i'.$i;
        if (isset($params[$i])) {
            array_push($path, $params[$i]);
        } else {
            if ($i == $params_num) {
                array_push($path, $view);
            } else {
                $path = array('404');
            }
        }
    }
    $file = file_join($path) . '.php';
    //echo $file;
    $node++;
    if (file_exists($file)) {
        include $file;
    } else {
        include '404.php';
    }
}
コード例 #2
0
ファイル: kfmDirectory.php プロジェクト: Mayoh/grupo-ha
 function rename($newname)
 {
     global $kfm, $kfmDirectoryInstances;
     if (!$kfm->setting('allow_directory_edit')) {
         return $this->error(kfm_lang('permissionDeniedEditDirectory'));
     }
     if ($this->isLink()) {
         return $this->error(kfm_lang('cannotRenameLink'));
     }
     if (!$this->isWritable()) {
         return $this->error(kfm_lang('permissionDeniedRename', $this->name));
     }
     if (!$this->checkName($newname)) {
         return $this->error(kfm_lang('cannotRenameFromTo', $this->name, $newname));
     }
     $parent = kfmDirectory::getInstance($this->pid);
     if (file_exists($parent->path() . $newname)) {
         return $this->error(kfm_lang('aDirectoryNamedAlreadyExists', $newname));
     }
     rename(rtrim($this->path(), ' /'), file_join($parent->path(), rtrim($newname, ' /')));
     if (file_exists($this->path())) {
         return $this->error(kfm_lang('failedRenameDirectory'));
     }
     $kfm->db->query("update " . KFM_DB_PREFIX . "directories set name='" . sql_escape($newname) . "' where id=" . $this->id);
     $this->name = $newname;
     $this->cached_path = $this->path();
     $kfmDirectoryInstances[$this->id] = $this;
 }