Exemple #1
0
 function get_available_playbooks()
 {
     $app_dir = new folder();
     $app_dir->getFolderContent($this->playbook_dir);
     $ansible_playbooks = array();
     $ansible_playbooks = $app_dir->files;
     $ansible_playbook_array = array();
     foreach ($ansible_playbooks as $ansible) {
         $ansible_playbook = str_replace(".yml", "", $ansible->name);
         $ansible_playbook_array[] .= $ansible_playbook;
     }
     return $ansible_playbook_array;
 }
Exemple #2
0
 function get_available_groups()
 {
     $app_dir = new folder();
     $app_dir->getFolderContent($this->group_dir);
     $puppet_groups = array();
     $puppet_groups = $app_dir->files;
     $puppet_group_array = array();
     foreach ($puppet_groups as $puppet) {
         $puppet_group = str_replace(".pp", "", $puppet->name);
         $puppet_group_array[] .= $puppet_group;
     }
     sort($puppet_group_array);
     return $puppet_group_array;
 }
Exemple #3
0
 protected function add_folder($part)
 {
     if (!$this->is_home) {
         $this->dir .= '/' . $part . '/';
     } else {
         $this->dir .= '/' . $part;
     }
     $this->config_loader->load($this->dir . '00_folder.php');
     if ($this->config_loader->error) {
         return false;
     }
     $folder = new folder($this->config_loader->config);
     $folder->set_array($this->config_loader->config);
     $this->folders[] = $folder;
     return true;
 }
Exemple #4
0
 public function actionSelect($field = '', $dir = '')
 {
     $dir = empty($dir) ? zotop::get('dir') : $dir;
     $dir = trim(url::decode($dir), '/');
     $path = site::template();
     $path = $path . DS . str_replace('/', DS, $dir);
     $path = path::clean($path);
     $folders = folder::folders($path);
     $files = folder::files($path);
     $position = '<a href="' . zotop::url('system/template/select') . '">' . zotop::t('根目录') . '</a><em> : //</em> ';
     if (!empty($dir)) {
         $dirs = arr::dirpath($dir, '/');
         foreach ($dirs as $d) {
             $position .= '<a href="' . zotop::url('system/template/select', array('dir' => rawurlencode($d[1]))) . '">' . $d[0] . '</a> <em>/</em>';
         }
     }
     $page = new dialog();
     $page->title = zotop::t('模板管理');
     $page->set('field', $field);
     $page->set('dir', $dir);
     $page->set('position', $position);
     $page->set('folders', $folders);
     $page->set('files', $files);
     $page->display();
 }
Exemple #5
0
 public function getUnInstalled()
 {
     //获取已经安装的模块
     $installed = (array) $this->getInstalled();
     //获取目录
     $folders = folder::folders(ZOTOP_PATH_MODULES, false);
     $modules = array();
     foreach ($folders as $folder) {
         $modulePath = ZOTOP_PATH_MODULES . DS . $folder;
         $moduleUrl = '$modules/' . $folder;
         $moduleFile = $modulePath . DS . 'module.php';
         $m = @(include $moduleFile);
         if (is_array($m) && isset($m['id']) && !in_array($m['id'], array_keys($installed))) {
             $m['path'] = '$modules/' . $folder;
             $m['url'] = '$modules/' . $folder;
             if (!isset($m['icon'])) {
                 if (file::exists($modulePath . '/icon.png')) {
                     $m['icon'] = $moduleUrl . '/icon.png';
                 }
             }
             $modules[$m['id']] = $m;
         }
     }
     return $modules;
 }
Exemple #6
0
 function save($folder, $name)
 {
     if (!dir($folder)) {
         folder::create($folder);
     } else {
         folder::publico($folder);
     }
     $this->savePath = $folder . $name . "." . $this->mime;
 }
Exemple #7
0
 static function upload($fileName, $destination)
 {
     if (isset($_FILES[$fileName])) {
         folder::create(dirname($destination));
         if (move_uploaded_file($_FILES[$fileName]['tmp_name'], $destination)) {
             PHPToolkit::getClass('FileInterface');
             return new FileInterface($destination);
         }
     }
     return false;
 }
Exemple #8
0
 /**
  * 打包全部的hook文件
  *
  */
 public static function hooks()
 {
     $modules = zotop::data('module');
     foreach ((array) $modules as $module) {
         if ((int) $module['status'] >= 0 && folder::exists($module['path'])) {
             //加载hook文件
             runtime::$hooks[] = $module['path'] . DS . 'hooks' . DS . ZOTOP_APPLICATION_GROUP . '.php';
             //加载库文件
             zotop::register(@(include path::decode($module['path']) . DS . 'classes.php'));
         }
     }
 }
Exemple #9
0
 public function actionIndex($dir = '')
 {
     $dir = empty($dir) ? zotop::get('dir') : $dir;
     $dir = url::decode($dir);
     $path = ZOTOP_PATH_ROOT . DS . trim($dir, DS);
     $path = path::clean($path);
     //获取当前目录的子目录及子文件
     $folders = (array) folder::folders($path);
     $files = (array) folder::files($path);
     $position = '<a href="' . zotop::url('webftp/index/index') . '">root</a>';
     $dirs = arr::dirpath($dir, '/');
     foreach ($dirs as $d) {
         $position .= ' <em>/</em> <a href="' . zotop::url('webftp/index/index', array('dir' => rawurlencode($d[1]))) . '">' . $d[0] . '</a>';
     }
     $page = new page();
     $page->title = '文件管理器';
     $page->set('position', $position);
     $page->set('navbar', $this->navbar($dir));
     $page->set('folders', $folders);
     $page->set('files', $files);
     $page->set('path', $path);
     $page->set('dir', $dir);
     $page->display();
 }
<?php

require_once './header.php';
logged_in_only();
?>

<h2 class="title">Select Folder</h2>

			<div style="width:100%; height:330px; overflow:auto;">

				<?php 
require_once './folders.php';
$tree = new folder();
$tree->make_tree(0);
$tree->print_tree();
$path = $tree->print_path($folderid);
?>

			</div>
			<br>
			<input type="submit" value=" OK " onClick="javascript:opener.childof.value = '<?php 
echo $folderid;
?>
';opener.path.value = '<?php 
echo $path;
?>
'; self.close()">
			<input type="button" value="Cancel" onClick="window.close()">
			<input type="button" value=" New Folder " onClick="self.location.href='javascript:foldernew(<?php 
echo $folderid;
?>
Exemple #11
0
 /**
  * 应用程序重启
  *
  *
  * @return null
  */
 public static function reboot()
 {
     //清理运行时文件
     folder::clear(ZOTOP_PATH_RUNTIME);
     //加载全部配置
     zotop::config(@(include ZOTOP_PATH_DATA . DS . 'config.php'));
     zotop::config('zotop.database', @(include ZOTOP_PATH_DATA . DS . 'database.php'));
     zotop::config('zotop.application', @(include ZOTOP_PATH_DATA . DS . 'application.php'));
     zotop::config('zotop.module', @(include ZOTOP_PATH_DATA . DS . 'module.php'));
     zotop::config('zotop.router', @(include ZOTOP_PATH_DATA . DS . 'router.php'));
     zotop::register(@(include ZOTOP_PATH_MODULES . DS . 'system' . DS . 'libraries.php'));
     zotop::register(@(include ZOTOP_PATH_APPLICATION . DS . 'libraries.php'));
     //加载全部开启模块的hook以及注册类文件
     $modules = zotop::config('zotop.module');
     foreach ((array) $modules as $module) {
         if ((int) $module['status'] >= 0 && folder::exists($module['path'])) {
             //加载库文件
             zotop::register(@(include path::decode($module['path']) . DS . 'libraries.php'));
             //加载hook文件
             application::$hooks[] = $module['path'] . DS . 'hooks' . DS . ZOTOP_APPLICATION . '.php';
         }
     }
     //打包配置文件
     zotop::data(ZOTOP_PATH_RUNTIME . DS . ZOTOP_APPLICATION . '.config.php', zotop::config());
     //打包hook文件
     file::write(ZOTOP_PATH_RUNTIME . DS . ZOTOP_APPLICATION . '.hooks.php', application::compile(application::$hooks), true);
     //加载hooks以便核心文件使用
     zotop::load(ZOTOP_PATH_RUNTIME . DS . ZOTOP_APPLICATION . '.hooks.php');
     //打包类文件
     file::write(ZOTOP_PATH_RUNTIME . DS . ZOTOP_APPLICATION . '.core.php', application::compile(zotop::register()), true);
 }
Exemple #12
0
 /**
  * 清理缓存缓存
  * 
  * @param string $key 缓存变量名
  * @return mixed
  */
 public function clear()
 {
     folder::clean($this->root);
 }
Exemple #13
0
 /**
  * 返回目录下的全部文件夹的数组
  * @param string $path 路径
  * @param array $filter 
  * @param bool|int $recurse 子目录,或者子目录级数
  * @param bool $fullpath 全路径或者仅仅获取文件名称
  * @param array $ignore 忽略的文件夹名称
  * @return array
  */
 public static function folders($path, $filter = '.', $recurse = false, $fullpath = false, $ignore = array('.svn', 'CVS', '.DS_Store', '__MACOSX'))
 {
     $folders = array();
     $path = path::clean($path);
     if (!is_dir($path)) {
         return false;
     }
     $handle = opendir($path);
     while (($file = readdir($handle)) !== false) {
         $f = $path . DS . $file;
         if ($file != '.' && $file != '..' && !in_array($file, $ignore) && is_dir($f)) {
             if (preg_match("/{$filter}/", $file)) {
                 if ($fullpath) {
                     $folders[] = $f;
                 } else {
                     $folders[] = $file;
                 }
             }
             if ($recurse) {
                 if (is_integer($recurse)) {
                     $recurse--;
                 }
                 $subfolders = folder::folders($f, $recurse, $fullpath, $filter, $ignore);
                 $folders = array_merge($folders, $subfolders);
             }
         }
     }
     closedir($handle);
     return $folders;
 }
Exemple #14
0
}
$f3->set('DB', new DB\SQL('mysql:host=' . $cfg['DB']['host'] . ';dbname=' . $cfg['DB']['database'] . '', $cfg['DB']['username'], $cfg['DB']['password']));
$f3->set('cfg', $cfg);
$f3->set('UI', 'ui/|media/');
$f3->set('AUTOLOAD', './|lib/|controllers/|inc/|/modules/');
$f3->set('PLUGINS', 'lib/f3/');
//$media_dir = 'D:\Web\LiN\media\uploads\1';
//$domainID = $f3->get("domain");
$media_dir = '../../media/uploads/';
$media_dir_use = "/media/uploads/";
if (!is_dir($media_dir)) {
    mkdir($media_dir, 0777, true);
}
//test_array(($media_dir));
//test_array($domain);
$folders = folder::_tree($media_dir);
$section = isset($_REQUEST['section']) ? $_REQUEST['section'] : "";
$folder = isset($_REQUEST['path']) ? $_REQUEST['path'] : "/";
$folder_raw = $folder;
//test_array($folder);
$targetDir = realpath($media_dir . $folder);
if ($section == "files") {
    $targetDir = realpath($media_dir . $folder);
    $sorter = "1";
    if (isset($_REQUEST['sort'])) {
        $sorter = $_REQUEST['sort'];
    }
    $order = "ASC";
    if (isset($_REQUEST['order'])) {
        $order = $_REQUEST['order'];
    }
	<p><input type="checkbox" name="inherit"> Inherit Public Status to all Subfolders and Bookmarks</p>
	<input type="submit" value=" OK ">
	<input type="button" value=" Cancel " onClick="self.close()">
	</form>
	<script>
	this.focus();
	document.getElementById('fedit').foldername.focus();
	</script>

	<?php 
    } else {
        $query = sprintf("UPDATE folder SET name='%s', public='%d' WHERE id='%d' AND user='******'", $mysql->escape($foldername), $mysql->escape($public), $mysql->escape($folderid), $mysql->escape($username));
        if ($mysql->query($query)) {
            if ($inherit) {
                require_once ABSOLUTE_PATH . "folders.php";
                $tree = new folder();
                $tree->get_children($folderid);
                if (count($tree->get_children) > 0) {
                    $sub_folders = implode(",", $tree->get_children);
                    # set subfolders to public
                    $query = sprintf("UPDATE folder SET public='%d' WHERE id IN (%s) AND user='******'", $mysql->escape($public), $mysql->escape($sub_folders), $mysql->escape($username));
                    if (!$mysql->query($query)) {
                        message($mysql->error);
                    }
                    $sub_folders .= "," . $folderid;
                    # set bookmarks to public as well
                    $query = sprintf("UPDATE bookmark SET public='%d' WHERE childof IN (%s) AND user='******'", $mysql->escape($public), $mysql->escape($sub_folders), $mysql->escape($username));
                    if ($mysql->query($query)) {
                        echo '<script language="JavaScript">reloadclose();</script>';
                    } else {
                        message($mysql->error);
<?php

require_once "./header.php";
logged_in_only();
$noconfirm = set_get_noconfirm();
# the root folder cannot be deleted
if ($folderid == "" || $folderid == 0) {
    message("No Folder selected");
} else {
    if (!$settings['confirm_delete'] || $noconfirm) {
        # lets do the deletion if the confirm variable is set to FALSE or after confirmation
        require_once ABSOLUTE_PATH . "folders.php";
        $tree = new folder();
        $tree->get_children($folderid);
        # we need $parent_folders for javascript code below.
        $parent_folders = $tree->get_path_to_root($folderid);
        if (count($parent_folders) > 1) {
            $parent_folder = $parent_folders[1];
        } else {
            $parent_folder = 0;
        }
        array_push($tree->get_children, $folderid);
        $folders = implode(",", $tree->get_children);
        # first delete all subfolders
        $query = sprintf("DELETE FROM folder WHERE childof IN (%s) AND user='******'", $mysql->escape($folders), $mysql->escape($username));
        if (!$mysql->query($query)) {
            message($mysql->error);
        }
        # of course, we want to delete all bookmarks as well
        $query = sprintf("DELETE FROM bookmark WHERE childof IN (%s) AND user='******'", $mysql->escape($folders), $mysql->escape($username));
        if (!$mysql->query($query)) {
Exemple #17
0
<?php

require_once "./async_header.php";
logged_in_only();
require_once ABSOLUTE_PATH . "folders.php";
$tree = new folder();
$tree->make_tree(0);
$tree->print_tree('index.php');
 public function selectImages()
 {
     $this->render("/Layout/ajax");
     //this line render the view, since this is a ajax response it will load the respective ajax view
     if ($this->request->is('post')) {
         // $dir represents the /img folder where all the images are stored, this means that
         // this new folder command is not creating a new folder, just creating a new path
         $dir = new folder(WWW_ROOT . 'img/');
         //$path = $dir->path;
         // ->find('.*', true) => finds all the files inside /img folder
         $files = $dir->find('.*', true);
         // encode the files in the json format
         echo json_encode($files);
         exit;
         // it doesn't work without the exit;
     }
 }
Exemple #19
0
 /**
  * 上传文件
  *
  * @param string $name  FILE字段名称
  * @param string $path  上传的路径
  * @param string $ext   扩展名
  * @param boolean $rename 是否重新命名
  * @return array
  */
 public static function upload($name, $path, $ext, $rename = true)
 {
     if (!file_exists(dirname($path))) {
         folder::create(dirname($path));
     }
     $ext = explode(',', $ext);
     $files = $_FILES[$name];
     $attachments = array();
     //转换数组
     if (is_array($files['name'])) {
         foreach ($files as $key => $var) {
             foreach ($var as $id => $val) {
                 $attachments[$id][$key] = $val;
             }
         }
     } else {
         $attachments[] = $files;
     }
     //上传
     $return = array();
     foreach ($attachments as $k => $file) {
         if (in_array(self::ext($file['name']), $ext)) {
             $tmp = $path;
             if ($rename) {
                 $tmp .= DS . rand::string(10) . self::ext($file['name']);
             } else {
                 $tmp .= DS . $file['name'];
             }
             @move_uploaded_file($file['name'], $tmp);
             $return[] = $tmp;
             @unlink($file['tmp_name']);
         } else {
             $return[] = false;
         }
     }
     return $return;
 }
<?php

require_once "../../includes/initialize.php";
$session->parent_folder_id = $_SESSION['parent_folder_id'];
if (isset($_POST['submit'])) {
    $foldername = trim($_POST['foldername']);
    $username = $session->username;
    $parent_folder_id = $session->parent_folder_id;
    $new_folder = folder::check_existing_folder($foldername, $parent_folder_id, $username);
    if ($new_folder) {
        $session->message("Folder is already created");
        redirect_to("list_files.php");
    } else {
        $folder = new folder();
        $folder->foldername = $foldername;
        $folder->username = $session->username;
        $folder->parent_folder_id = $_SESSION['parent_folder_id'];
        if ($folder->create()) {
            $created_folder = folder::return_folder_id($folder->foldername, $folder->username, $folder->parent_folder_id);
            //$new_parent_folder = $created_folder->folder_id;
            $new_folder_name = $created_folder->foldername;
            $session->message(" {$new_folder_name} is created");
            redirect_to("list_files.php?parent_folder_id={$parent_folder_id}");
        }
    }
} else {
    $foldername = "";
}
include_layout_template('admin_header.php');
echo output_message($message);
?>
Exemple #21
0
 /**
  * 返回目录下的全部文件的数组,当level为0时候返回全部子文件夹目录
  * @param string $path 路径
  * @param array $ext 特定的文件格式,如只获取jpg,png格式
  * @param bool|int $recurse 子目录,或者子目录级数
  * @param bool $fullpath 全路径或者仅仅获取文件名称
  * @param array $ignore 忽略的文件夹名称
  * @return array
  */
 public static function brower($path, $ext = '', $recurse = false, $fullpath = false, $ignore = array('.svn', 'CVS', '.DS_Store', '__MACOSX'))
 {
     return folder::files($path, $recurse, $fullpath, $ext, $ignore);
 }
Exemple #22
0
		</td>
	</tr>

    <tr>
      <td>
        Folder to export:
      </td>
      <td>
	<div style="width:<?php 
    echo $column_width_folder == 0 ? "auto" : $column_width_folder;
    ?>
; height:350px; overflow:auto;">

	<?php 
    require_once ABSOLUTE_PATH . "folders.php";
    $tree = new folder();
    $tree->make_tree(0);
    $tree->print_tree();
    ?>

	</div>
      </td>
    </tr>

    <tr>
      <td>
        <input type="hidden" name="folder" value="<?php 
    echo $folderid;
    ?>
">
        <input type="submit" value="Export">
 public function delete($id = FALSE)
 {
     $recycle = $this->recycles->find($id);
     $destroy = unserialize($recycle->data);
     switch ($recycle->type) {
         case 'file':
             $get = folder::get(WEBROOT . $this->config->item('public_folder'));
             $keys = array_keys($get['filename'], $destroy->file);
             if (count($keys) > 0) {
                 foreach ($keys as $key) {
                     $the_file = $get['fullpath'][$key];
                     if (file_exists($the_file)) {
                         unlink($the_file);
                         $destroyed = $destroy->name;
                     }
                 }
             } else {
                 $destroyed = $destroy->name;
             }
             break;
         default:
             $destroyed = $destroy->name;
             break;
     }
     if ($destroyed) {
         if ($this->recycles->delete($recycle->id)) {
             $this->session->set_flashdata('success', 'You have successfully deleted "' . $recycle->name . '" permanently.');
             redirect('admin/recycle');
         }
     }
 }
Exemple #24
0
/**
 * This functions return number of unreaded mails
 *
 * @uses $CFG, $DB
 * @param int $userid User ID
 * @param int $courseid Course ID
 * @param int $folderid Folder ID (Optional) When fault this param, return total number of unreaded mails
 * @return int Number of unread mails.
 * @todo Finish documenting this function
 **/
function email_count_unreaded_mails($userid, $courseid, $folderid = NULL)
{
    global $CFG, $DB;
    require_once $CFG->dirroot . '/blocks/email_list/email/folder.class.php';
    $folderman = new folder();
    if (!$folderid or $folderid <= 0) {
        $myfolders = $folderman->get_folders($userid, EMAIL_INBOX);
        // Prepare list of folders
        foreach ($myfolders as $myfolder) {
            $folders[] = $myfolder->id;
        }
        list($fsql, $params2) = $DB->get_in_or_equal($folders);
        $params = array('userid' => $userid, 'courseid' => $courseid, 'readed' => 0, 'sended' => 1);
        $params = array_merge($params, $params2);
        $sql = "SELECT COUNT(m.id)\n\t                            FROM {block_email_list_mail} m\n\t                   LEFT JOIN {block_email_list_send} s ON m.id = s.mailid\n\t                   LEFT JOIN {block_email_list_foldermail} fm ON m.id = fm.mailid ";
        // WHERE principal clause for filter by user and course
        $wheresql = " WHERE s.userid = ?\n\t\t\t\t\t  AND s.course = ?\n\t\t\t\t\t  AND s.readed = ?\n\t\t\t\t\t  AND s.sended = ?\n\t\t\t\t\t  AND fm.folderid {$fsql}";
        return $DB->count_records_sql($sql . $wheresql, $params);
    } else {
        // Get folder
        if (!($folder = $folderman->get_folder($folderid))) {
            return 0;
        }
        if ($folder->isparenttype == EMAIL_INBOX) {
            // For apply order, I've writting an sql clause
            $sql = "SELECT count(*)\n\t\t                            FROM {block_email_list_mail} m\n\t\t                   LEFT JOIN {block_email_list_send} s ON m.id = s.mailid\n\t\t                   LEFT JOIN {block_email_list_foldermail} fm ON m.id = fm.mailid ";
            $params = array('userid' => $userid, 'course' => $courseid, 'folderid' => $folder->id, 'readed' => 0, 'sended' => 1);
            // WHERE principal clause for filter by user and course
            $wheresql = " WHERE s.userid = :userid\n\t\t\t\t\t\t  AND s.course = :course\n\t\t\t\t\t\t  AND fm.folderid = :folderid\n\t\t\t\t\t\t  AND s.readed = :readed\n\t\t\t\t\t\t  AND s.sended = :sended";
            return $DB->count_records_sql($sql . $wheresql, $params);
        } else {
            if ($folder->isparenttype == EMAIL_DRAFT) {
                // For apply order, I've writting an sql clause
                $sql = "SELECT count(*)\n\t\t                   \tFROM {block_email_list_mail} m\n\t\t                   \tLEFT JOIN {block_email_list_foldermail} fm ON m.id = fm.mailid ";
                $params = array('userid' => $userid, 'course' => $courseid, 'folderid' => $folder->id);
                // WHERE principal clause for filter user and course
                $wheresql = " WHERE m.userid = :userid\n\t\t\t\t\t\t  AND m.course = :course\n\t\t\t\t\t\t  AND fm.folderid = :folderid";
                return $DB->count_records_sql($sql . $wheresql, $params);
            } else {
                return 0;
            }
        }
    }
}
function list_bookmarks($bookmarks, $show_checkbox, $show_folder, $show_icon, $show_link, $show_desc, $show_date, $show_edit, $show_move, $show_delete, $show_share, $show_header, $user = false)
{
    global $folderid, $expand, $settings, $column_width_folder, $bookmark_image, $edit_image, $move_image, $delete_image, $folder_opened, $folder_opened_public, $date_formats, $order;
    # print the bookmark header if enabled.
    # Yes, it's ugly PHP code, but beautiful HTML code.
    if ($show_header) {
        if ($order[0] == 'titleasc') {
            $sort_t = 'titledesc';
            $img_t = '<img src="./images/ascending.gif" alt="">';
        } else {
            if ($order[0] == 'titledesc') {
                $sort_t = 'titleasc';
                $img_t = '<img src="./images/descending.gif" alt="">';
            } else {
                $sort_t = 'titleasc';
                $img_t = '<img src="./images/descending.gif" alt="" class="invisible">';
            }
        }
        if ($order[0] == 'dateasc') {
            $sort_d = 'datedesc';
            $img_d = '<img src="./images/ascending.gif" alt="">';
        } else {
            if ($order[0] == 'datedesc') {
                $sort_d = 'dateasc';
                $img_d = '<img src="./images/descending.gif" alt="">';
            } else {
                $sort_d = 'dateasc';
                $img_d = '<img src="./images/descending.gif" alt="" class="invisible">';
            }
        }
        echo '<div class="bookmarkcaption">' . "\n";
        if ($show_folder) {
            echo "\t" . '<div style="width:' . $column_width_folder . '; float: left;">&nbsp;</div>' . "\n";
        }
        if ($show_checkbox) {
            echo "\t\t" . '<div class="bmleft">' . "\n";
            echo "\t\t\t" . '<input type="checkbox" name="CheckAll" onClick="selectthem(\'checkall\', this.checked)">' . "\n";
            echo "\t\t" . '</div>' . "\n";
        }
        if ($show_date) {
            $query_data = array('folderid' => $folderid, 'expand' => implode(",", $expand), 'order' => $sort_d);
            if ($user) {
                $query_data['user'] = $user;
            }
            $query_string = assemble_query_string($query_data);
            echo "\t\t" . '<div class="bmright">' . "\n";
            echo "\t\t\t" . '<span class="date">' . "\n";
            echo "\t\t\t\t" . '<a href="' . $_SERVER['SCRIPT_NAME'] . '?' . $query_string . '" class="f">Date ' . $img_d . '</a>' . "\n";
            echo "\t\t\t" . '</span>' . "\n";
            if ($show_edit) {
                echo "\t\t\t" . '<img src="./images/edit.gif"   alt="" class="invisible">' . "\n";
            }
            if ($show_move) {
                echo "\t\t\t" . '<img src="./images/move.gif"   alt="" class="invisible">' . "\n";
            }
            if ($show_delete) {
                echo "\t\t\t" . '<img src="./images/delete.gif" alt="" class="invisible">' . "\n";
            }
            echo "\t\t" . '</div>' . "\n";
        }
        echo "\t\t" . '<div class="link">' . "\n";
        if ($show_icon) {
            echo "\t\t\t" . '<img src="./images/bookmark_image.gif" alt="" class="invisible">' . "\n";
        }
        $query_data['order'] = $sort_t;
        $query_string = assemble_query_string($query_data);
        echo "\t\t\t" . '<a href="' . $_SERVER['SCRIPT_NAME'] . '?' . $query_string . '" class="f">Title ' . $img_t . '</a>' . "\n";
        echo "\t\t" . '</div>' . "\n";
        echo "\t" . '</div>' . "\n\n";
    }
    if ($show_folder) {
        require_once ABSOLUTE_PATH . "folders.php";
        $tree = new folder();
    }
    echo '<form name="bookmarks" action="" class="nav">' . "\n";
    foreach ($bookmarks as $value) {
        echo '<div class="bookmark">' . "\n";
        # the folders, only needed when searching for bookmarks
        if ($show_folder) {
            if ($value['fid'] == null) {
                $value['name'] = $settings['root_folder_name'];
                $value['fid'] = 0;
            }
            if ($value['fpublic']) {
                $folder_image = $folder_opened_public;
            } else {
                $folder_image = $folder_opened;
            }
            $expand = $tree->get_path_to_root($value['fid']);
            echo "\t" . '<div style="width:' . $column_width_folder . '; float: left;">';
            echo '<a class="f" href="./index.php?expand=' . implode(",", $expand) . '&folderid=' . $value['fid'] . '#' . $value['fid'] . '">';
            echo $folder_image . " " . $value['name'] . "</a>";
            echo "</div>\n";
        }
        # the checkbox and favicon section
        echo "\t" . '<div class="bmleft">' . "\n";
        # the checkbox
        if ($show_checkbox) {
            echo "\t\t" . '<input type="checkbox" name="' . $value['id'] . '">' . "\n";
        }
        echo "\n\t</div>\n";
        # the share, date and edit/move/delete icon section
        echo "\t" . '<div class="bmright">' . "\n";
        if ($show_share) {
            $share = $value['public'] ? 'public' : 'private';
            echo "\t\t" . '<span class="' . $share . '">' . $share . "</span>\n";
        }
        if ($show_date) {
            echo "\t\t" . '<span class="date">';
            echo date($date_formats[$settings['date_format']], $value['timestamp']);
            echo "\t</span>\n";
        }
        # the edit column
        if ($show_edit) {
            echo "\t\t" . '<a href="javascript:bookmarkedit(\'' . $value['id'] . '\')">';
            echo sprintf($edit_image, "Edit");
            echo "</a>\n";
        }
        # the move column
        if ($show_move) {
            echo "\t\t" . '<a href="javascript:bookmarkmove(\'' . $value['id'] . '\', \'' . 'expand=' . implode(",", $expand) . '&amp;folderid=' . $folderid . '\')">';
            echo sprintf($move_image, "Move");
            echo "</a>\n";
        }
        # the delete column
        if ($show_delete) {
            echo "\t\t" . '<a href="javascript:bookmarkdelete(\'' . $value['id'] . '\')">';
            echo sprintf($delete_image, "Delete");
            echo "</a>\n";
        }
        echo "\t</div>\n";
        # the favicon
        echo "\t" . '<div class="link">' . "\n";
        echo "\t\t";
        if ($show_icon) {
            if ($value['favicon'] && is_file($value['favicon'])) {
                echo '<img src="' . $value['favicon'] . '" width="16" height="16" alt="">' . "\n";
            } else {
                echo $bookmark_image . "\n";
            }
        }
        # the link
        if ($settings['open_new_window']) {
            $target = ' target="_blank"';
        } else {
            $target = null;
        }
        if ($show_link) {
            $link = '<a href="' . $value['url'] . '" title="' . $value['url'] . '"' . $target . '>' . $value['title'] . "</a>";
        } else {
            $link = $value['title'];
        }
        echo "\t\t{$link}\n";
        echo "\t</div>\n";
        # the description and if not empty
        if ($show_desc && $value['description'] != "") {
            if ($show_folder) {
                $css_extension = ' style="margin-left: ' . $column_width_folder . ';"';
            } else {
                $css_extension = "";
            }
            echo "\t" . '<div class="description"' . $css_extension . '>' . $value['description'] . "</div>\n";
        }
        echo "</div>\n\n";
    }
    echo "</form>\n";
}
Exemple #26
0
 public function savefile($savepath, $filename)
 {
     //返回实际目录
     $dir = ZOTOP_PATH_ROOT . DS . $savepath;
     //目录检测
     if (!is_dir($dir) && !folder::create($dir, 0777)) {
         $this->error = 8;
         //目录不存在且无法自动创建
         return false;
     }
     @chmod($dir, 0777);
     if (!is_writeable($dir) && $dir != '/') {
         $this->error = 9;
         //不可写
         return false;
     }
     $savefile = $dir . $filename;
     return $savefile;
 }
            message($mysql->error);
        }
    }
} else {
    if (count($bmlist) < 1) {
        message("No Bookmark to edit.");
    } else {
        if ($post_title == "" || $post_url == "" || $post_icon) {
            $query = sprintf("SELECT title, url, description, childof, id, favicon, public\n\t\t\t\tFROM bookmark\n\t\t\t\tWHERE id='%d'\n\t\t\t\tAND user='******'\n\t\t\t\tAND deleted != '1'", $mysql->escape($bmlist[0]), $mysql->escape($username));
            if ($mysql->query($query)) {
                if (mysql_num_rows($mysql->result) != 1) {
                    message("No Bookmark to edit");
                } else {
                    $row = mysql_fetch_object($mysql->result);
                    require_once ABSOLUTE_PATH . "folders.php";
                    $tree = new folder();
                    $query_string = "?expand=" . implode(",", $tree->get_path_to_root($row->childof)) . "&amp;folderid=" . $row->childof;
                    $path = $tree->print_path($row->childof);
                    if ($post_icon && $settings['show_bookmark_icon']) {
                        if (isset($row->favicon)) {
                            @unlink($row->favicon);
                        }
                        require_once ABSOLUTE_PATH . "favicon.php";
                        $favicon = new favicon($post_url);
                        if (isset($favicon->favicon)) {
                            $icon = '<img src="' . $favicon->favicon . '" width="16" height="16" alt="">';
                            $query = sprintf("UPDATE bookmark SET favicon='%s' WHERE user='******' AND id='%d'", $mysql->escape($favicon->favicon), $mysql->escape($username), $mysql->escape($bmlist[0]));
                            if (!$mysql->query($query)) {
                                message($mysql->error);
                            }
                        } else {
Exemple #28
0
 public function files($path = '')
 {
     $files = folder::files($path, false, true);
     return $files;
 }
Exemple #29
0
	<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
	<script src="assets/js/script.js" type="text/javascript"></script>
	<link rel="stylesheet" type="text/css" href="assets/css/style.css">	
</head>


<?php 
/* Database connection establishment */
include "config/db_connection.php";
$conn = new DatabaseConnection();
include "classes/files.php";
$files = new file();
include "classes/folders.php";
include "classes/filesystem.php";
if (isset($_REQUEST['folder_submit'])) {
    $folder = new folder();
    $folder->setName($_REQUEST['folder']);
    $folder->setCreatedTime(date('Y-m-d h:i:s'));
    $folder->setPath("storage");
    $folder->insert_folder_record();
    mkdir("storage/" . $_REQUEST['folder']);
}
?>


<body>
<header>
	<ul class="nav">		
		<li><a href="javascript:;" id="my_files">My Files</a></li>	
		<li><a href="javascript:;" id="new_folder">Create New Folder</a></li>
		<li><a href="javascript:;" id="upload_file">Upload File</a></li>
 public function upload($file, $destiny)
 {
     //echo "FILE: {$_FILES[$file]['name']}, SIZE: {$_FILES[$file]['size']} IS UPLOADED: ".is_uploaded_file($_FILES[$file]['tmp_name']);
     if (isset($_FILES[$file]) and $_FILES[$file]['size'] > 0 and is_uploaded_file($_FILES[$file]['tmp_name'])) {
         $dir = dirname($file);
         folder::create_dir($dir);
         //echo '<h3>'.$_FILES[$file]['tmp_name'].' to '.$destiny.'</h3>';
         return move_uploaded_file($_FILES[$file]['tmp_name'], $destiny);
     } else {
         return false;
     }
 }