/** * @return String * @desc Returns the HTML required for a SELECT box containing all available plugins in the /plugins/ directory. */ function plugin_available_select() { global $config; if (!function_exists('read_dir_to_array')) { include_once '../locations/common.php'; } $plugins = read_dir_to_array('../plugins/'); if (is_array($plugins) && sizeof($plugins)) { $str = '<select name="new_plugin" id="new_plugin"' . ($config['allow_plugins'] === true ? '' : ' disabled="true"') . '>'; foreach ($plugins as $plugin) { if (substr($plugin, 0, 1) != '_' && is_dir('../plugins/' . $plugin)) { $str .= '<option value="' . $plugin . '">' . ucfirst($plugin) . '</option>'; } } $str .= '</select>'; } else { $str = false; } return $str; }
} } ?> </head> <body onload="this.focus(); document.dialog.newfile.focus();" onkeypress="if (event.keyCode==27) { window.close(); }"> <form name="dialog" action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post"> <h1>Create New File</h1> <p><input type="radio" name="type" value="blank" id="new" checked="checked" /> <label for="new">Blank File</label></p> <?php // Get a listing of templates in the template directory if (is_dir('../templates/')) { $templates = read_dir_to_array('../templates/', array('wpt')); sort($templates); } // Now output options to select a templae if there are any if (sizeof($templates) && $config['use_templates'] == true) { echo '<p><input type="radio" name="type" value="template" id="url" /> <select name="template" onchange="document.dialog.type[1].checked = true;">'; echo '<option value="" selected="true">Select Template</option>'; foreach ($templates as $template) { echo '<option value="' . $template . '">' . str_replace(array('_', '.wpt'), array(' ', ''), $template) . '</option>'; } echo '</select></p>'; } else { echo "<script language=\"JavaScript\" type=\"text/javascript\">\n"; echo "<!--\n"; echo "document.dialog.submit();\n"; echo "// --!>\n";
function blosxom_listing($plugin, $id) { global $config; $listing = ''; // Pull in a posted value and store it in the session. if (isset($_POST['plugin_blosxom_pwd']) && $_POST['plugin_blosxom_pwd'] != '') { $_SESSION['plugin_blosxom_pwd'] = $_POST['plugin_blosxom_pwd']; $dir = $_SESSION['plugin_blosxom_pwd']; } else { if (isset($_SESSION['plugin_blosxom_pwd']) && stristr(str_replace('../', '', $_SESSION['plugin_blosxom_pwd']), $plugin['datadir'])) { $dir = $_SESSION['plugin_blosxom_pwd']; } else { $dir = $plugin['datadir']; } } // Handle request to delete an entry if (isset($_POST['delete_entry']) && strlen($_POST['delete_entry'])) { $del = $dir . $_POST['delete_entry']; if (is_file($del)) { if (!@unlink($del)) { $listing .= "<script language=\"JavaScript\" type=\"text/javascript\">\n"; $listing .= "<!--\n"; $listing .= "alert('Can\\'t delete that post - you might not have permission to do so.');\n"; $listing .= "// -->\n"; $listing .= "</script>\n"; } } } // Include our plugin and blosxom scripts $listing .= '<script language="JavaScript" type="text/javascript" src="../js/tools.js"></script>'; $listing .= '<script language="JavaScript" type="text/javascript" src="../js/plugins.js"></script>'; $listing .= '<script language="JavaScript" type="text/javascript" src="../plugins/blosxom/blosxom.js"></script>'; // If we're not at the home dir, then supply a link back up one if ($dir != $plugin['datadir'] && substr($dir, 0, -1) != $plugin['datadir']) { $listing .= "<a href=\"javascript:cdup('" . $dir . "');\" title=\"Parent Directory\"><img src=\"../images/files_up.gif\" width=\"19\" height=\"18\" alt=\"\" border=\"0\" align=\"absmiddle\" />�Parent Directory</a>\n"; } else { $listing .= "<a href=\"select_plugin.php?clear=true\" title=\"" . $config['plugins_label'] . "\"><img src=\"../images/files_up.gif\" width=\"19\" height=\"18\" alt=\"\" border=\"0\" align=\"absmiddle\" />�" . $config['plugins_label'] . "</a>\n"; } // Get all entries in this dir to an array $files = read_dir_to_array($dir); // Now if we have some entries, check them all and build the file listing if ($files !== false) { $file_list = array(); foreach ($files as $file) { if (is_dir(addslashes($dir . $file))) { if (is_readable($dir . '/' . $file) && is_writable($dir . '/' . $file)) { $listing .= "<a href=\"javascript:cd('" . urlencode($file) . urlencode("/") . "');\" id=\"" . $file . "_\" title=\"" . $file . "\"><img src=\"../images/files_dir.gif\" width=\"19\" height=\"18\" border=\"0\" align=\"absmiddle\" />�" . $file . "</a>\n"; } else { $listing .= "<div class=\"disabled\"><img src=\"../images/files_dir_locked.gif\" width=\"19\" height=\"18\" alt=\"Access Denied\" border=\"0\" align=\"absmiddle\" />�" . $file . "</div>\n"; } } else { // Add to listing of files in this dir. $file_list[] = $file; if (!in_array(substr($file, strrpos($file, '.') + 1), $config['restrict_files'])) { $listing .= "<a href=\"javascript:select('" . $file . "');\" ondblclick=\"select('" . $file . "'); if (confirm_open()) {parent.document.file.submit();}\" id=\"" . $file . "\" title=\"" . $file . "\"><img src=\"../images/files_file.gif\" width=\"19\" height=\"18\" border=\"0\" align=\"absmiddle\" />�" . $file . "</a>\n"; } else { $listing .= "<div class=\"disabled\"><img src=\"../images/files_file.gif\" width=\"19\" height=\"18\" title=\"File format restricted\" border=\"0\" align=\"absmiddle\" />�" . $file . "</div>\n"; } } } $listing .= "<form name=\"blosxom\" action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\">\n"; $listing .= "<input type=\"hidden\" name=\"p\" value=\"" . $id . "\" />\n"; $listing .= "<input type=\"hidden\" name=\"selected_element\" value=\"\" />\n"; $listing .= "<input type=\"hidden\" name=\"entry\" value=\"\" />\n"; $listing .= "<input type=\"hidden\" name=\"delete_entry\" value=\"\" />\n"; $listing .= "<input type=\"hidden\" name=\"plugin_blosxom_pwd\" value=\"" . $dir . "\" />\n"; $listing .= "</form>\n"; $listing .= "<script language=\"JavaScript\" type=\"text/javascript\">\n"; $listing .= "<!--\n"; $listing .= "if (parent.parent.frames.saveas_locations) {\n"; $listing .= "\tparent.document.file.filename.value = get_title();\n"; $listing .= "}\n"; $listing .= "parent.document.file.identifier.value = '" . addslashes($dir) . "';\n"; $listing .= "add_plugin_tool('../images/delete.gif', 'javascript:files_iframe.delete_entry();', 'Delete Selected Entry', 1);\n"; $listing .= "// -->\n"; $listing .= "</script>\n"; } else { $listing .= "<p>Could not access directory '" . $dir . "'.</p>"; } return $listing; }
echo '<div>'; echo '<label for="plugin_' . $p . '[' . $field['name'] . ']" class="plugin">' . ucfirst($field['name']) . ':</label>'; echo plugin_html_field($p, $field['name'], $plugin[$field['name']], $field['type'], $field['options']); echo '</div>'; } echo '</div>'; echo '<hr noshade="noshade" />'; echo '</span>'; } } echo '<input type="hidden" name="plugin_count" id="plugin_count" value="' . $p . '" />'; // Build out javascript details for adding a new plugin... if (!function_exists('read_dir_to_array')) { include_once '../locations/common.php'; } $plugins = read_dir_to_array('../plugins/'); if (is_array($plugins) && sizeof($plugins)) { echo "<script language=\"JavaScript\" type=\"text/javascript\">\n"; echo "<!--\n"; foreach ($plugins as $plugin) { if (substr($plugin, 0, 1) != '_' && is_dir('../plugins/' . $plugin)) { // Include the code for this plugin if available and required if (is_file('../plugins/' . $plugin . '/code.php')) { include_once '../plugins/' . $plugin . '/code.php'; } else { continue; } // Get the field details $fields = false; eval('$fields = ' . $plugin . '_get_fields();'); $js_str = '';
/** * @return void * @desc Checks temp dir for files older than 1 hr and deletes them. */ function cleanup_files() { // Date string for one hour ago (old files) $date = date('Ymd') . (date('H') - 1) . date('is'); $temp_files = array(); $temp_files = read_dir_to_array('../temp/'); foreach ($temp_files as $this_one) { $test = str_replace('.wp', '', $this_one); if ($test < $date) { @unlink('../temp/' . $this_one); } } }
?> <html> <head> <title>webpad: server browse</title> <link rel="stylesheet" href="../css/files.css" type="text/css" /> <script language="JavaScript" type="text/javascript" src="../js/tools.js"></script> <script language="JavaScript" type="text/javascript" src="../js/server.js"></script> </head> <body onkeypress="if (event.keyCode==27) { window.close(); }"> <?php if ($_SESSION['server_pwd'] != $config['home_dir']) { echo '<a href="javascript:cdup(document.server.server_pwd.value);" title="Parent Directory"><img src="../images/files_up.gif" width="19" height="18" alt="" border="0" align="absmiddle" />�Parent Directory</a>'; } // Get all entries in this dir to an array $files = read_dir_to_array($_SESSION['server_pwd']); // Now if we have some entries, check them all and build the file listing if ($files !== false) { $file_list = array(); foreach ($files as $file) { if (is_dir(addslashes($_SESSION['server_pwd'] . $file))) { if (is_readable($_SESSION['server_pwd'] . '/' . $file) && is_writable($_SESSION['server_pwd'] . '/' . $file)) { echo '<a href="javascript:cd(\'' . urlencode($file . '/') . '\');" id="' . $file . '_" title="' . $file . '"><img src="../images/files_dir.gif" width="19" height="18" border="0" align="absmiddle" />�' . $file . '</a>'; } else { echo '<div class="disabled"><img src="../images/files_dir_locked.gif" width="19" height="18" alt="Access Denied" border="0" align="absmiddle" />�' . $file . '</div>'; } } else { // Add to listing of files in this dir. $file_list[] = $file; if (!in_array(substr($file, strrpos($file, '.') + 1), $config['restrict_files'])) { echo '<a href="javascript:select(\'' . $file . '\');" ondblclick="select(\'' . $file . '\'); if (confirm_open()) {parent.document.file.submit();}" id="' . $file . '" title="' . $file . '"><img src="../images/files_file.gif" width="19" height="18" border="0" align="absmiddle" />�' . $file . '</a>';