Portions created by the Initial Developer are Copyright (C) 2008-2023 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane James Rose */ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; //check permissions if (permission_exists('clip_view')) { //access granted } else { echo "access denied"; exit; } //include the header require_once "header.php"; //add multi-lingual support $language = new text; $text = $language->get(); //check if this is a file function isfile($filename) { return @filesize($filename) > 0 ? true : false; } //count the spaces function space($count) { $r=''; $i=0; while($i < $count) { $r .= ' '; $i++; } return $r; } //setup ajax echo ""; //setup the tree view //echo "// ---------------------------------------------\n"; //echo "// --- http://www.codeproject.com/jscript/dhtml_treeview.asp\n"; //echo "// --- Name: Easy DHTML Treeview --\n"; //echo "// --- Author: D.D. de Kerf --\n"; //echo "// --- Version: 0.2 Date: 13-6-2001 --\n"; //echo "// ---------------------------------------------\n"; echo ""; // keyboard shortcut bindings echo "\n"; echo "\n"; //save file key_press('ctrl+s', 'down', 'window', null, null, "if (parent.document.getElementById('frm_edit')) { parent.$('form#frm_edit').submit(); return false; }", true); //open file manager/clip library pane key_press('ctrl+q', 'down', 'window', null, null, "if (parent.document.getElementById('sidebar')) { parent.toggle_sidebar(); parent.focus_editor(); return false; }", true); //prevent backspace (browser history back) key_press('backspace', 'down', 'window', null, null, 'return false;', true); //keyboard shortcut to execute command (when included on command page) key_press('ctrl+enter', 'down', 'window', null, null, "if (!parent.document.getElementById('sidebar')) { parent.$('form#frm').submit(); return false; }", true); //show the content echo "\n"; echo "\n"; echo "
\n"; echo "
".$text['label-clip-library']."
\n"; $sql = "select * from v_clips order by clip_folder asc, clip_name asc"; $database = new database; $result = $database->select($sql, null, 'all'); unset($sql); if (!empty($result) && is_array($result) && @sizeof($result) != 0) { $master_array = array(); foreach ($result as $row) { if (!empty($row['clip_folder'])) { $clip_folder = rtrim($row['clip_folder'], '/'); } $clip_folder .= '/'.$row['clip_name']; $parts = explode('/', $clip_folder); $folders = array(); while ($bottom = array_pop($parts)) { if (sizeof($folders) > 0) { $folders = array($bottom => $folders); } else { $clip['uuid'] = $row['clip_uuid']; $clip['name'] = $row['clip_name']; $clip['before'] = $row['clip_text_start']; $clip['after'] = $row['clip_text_end']; $folders = array($bottom => $clip); } } $master_array = array_merge_recursive($master_array, $folders); } unset($result, $row); function parse_array($array) { if (!empty(is_array($array)) && is_array($array)) { foreach ($array as $folder_name => $clips) { //folder echo "".$folder_name.""; echo "
\n"; //clips foreach($clips as $row) { //clip echo "
\n"; echo ""; echo ""; echo escape($row['name']); echo "\n"; echo "\n"; echo "\n"; echo "
\n"; } echo "
\n"; } } } parse_array($master_array); } echo "
\n"; //inclue the footer require_once "footer.php";