function create_data_info($flat = NULL) { $data = array(); $files = new SortableDirectoryIterator(ROOT_DIR . '/' . POST_DIR . '/'); $existing_title = array(); if (isset($flat)) { if ("year" === $flat) { foreach ($files as $file) { $info = extract_info($file, $existing_file); //Create the data array with all the data ordered by year/month/day $data[(int) $info[5]][] = $info; } } elseif ("month" === $flat) { foreach ($files as $file) { $info = extract_info($file, $existing_file); $key = $info[5] . $info[6]; //Create the data array with all the data ordered by year/month/day $data[(int) $key][] = $info; } } elseif ("day" === $flat) { foreach ($files as $file) { $info = extract_info($file, $existing_file); $key = $info[5] . $info[6] . $info[7]; //Create the data array with all the data ordered by year/month/day $data[(int) $key][] = $info; } } elseif ("post" === $flat) { foreach ($files as $file) { //Create the data array with all the data ordered by year/month/day $data[] = extract_info($file, $existing_file); } } } else { foreach ($files as $file) { $info = extract_info($file, $existing_file); //Create the data array with all the data ordered by year/month/day $data[(int) $info[5]][(int) $info[6]][(int) $info[7]][] = $info; } } unset($existing_file); unset($files); unset($size); return $data; }
# modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. The name of the author may not be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. include str_replace('//', '/', dirname(__FILE__) . '/') . '../config.php'; require_once ROOT_DIR . "/" . INC_DIR . "/functions.php"; include_once ROOT_DIR . '/' . LAYOUT_DIR . '/header.php'; $files = new DirectoryIterator(ROOT_DIR . '/' . POST_DIR . '/'); $size = iterator_count($files); $files->seek($size - 1); $emp = array(); $info = extract_info($files, $emp); echo post_to_html($info, True, false); include_once ROOT_DIR . '/' . LAYOUT_DIR . '/sidebar.php'; include_once ROOT_DIR . '/' . LAYOUT_DIR . '/footer.php';
<?php $g_time_now = time(); // list Condor attributes to be printed $g_user_list = array("Name", "State", "Activity", "LoadAvg", "ClientMachine", "RemoteUser", "JobId", "JobStart"); $g_admin_list = array("SCVersion", "MyAddress", "Arch", "OpSys", "VirtualMemory", "Disk", "Memory", "KFlops", "Mips", "CondorVersion"); if (isset($_REQUEST['admin']) && !empty($_REQUEST['admin'])) { $g_list = array_merge($g_user_list, $g_admin_list); } else { $g_list = $g_user_list; } $g_list_length = count($g_list); $str = `condor_status -xml`; //echo "count = " . strlen($str); $g_xml = simplexml_load_string($str); $g_total_machines = count($g_xml->c); $g_matrix = extract_info(); print_table($g_matrix); ?> <hr> <p>Last update: <?php echo date(DATE_RFC822); ?> </p> <?php do_refresh_button(); ?> </body> </html>