function wpcloud_show_user_quota_column_content($value, $column_name, $user_id) { $user = get_userdata( $user_id ); if ( 'user_quota' == $column_name ) { if (directory_exist($user_id)) { return '<strong>' . wpcloud_calc_used_percentage($user_id) . '%</strong> of ' . wpcloud_calc_user_space($user_id) . ' MB'; } else { return '<strong><acronym title="Inactive (directory hasn\'t been created yet)">Inactive</acronym></strong> of ' . wpcloud_calc_user_space($user_id) . ' MB'; } } return $value; }
function wpcloud_sys_panel() { echo '<div class="wrap"><h2>Cloud System Debug</h2>'; echo 'Getting php.ini<br/>'; echo 'max_upload: ' . (int)(ini_get('upload_max_filesize')) . '<br/>'; echo 'max_post: ' . (int)(ini_get('post_max_size')) . '<br/>'; echo 'memory_limit: ' . (int)(ini_get('memory_limit')) . '<br/>'; echo 'upload_mb: ' . min($max_upload, $max_post, $memory_limit) . '<hr>'; echo 'Starting System Checkup...<br/>'; $dir = ABSPATH . 'cloud'; $file = $dir . '/index.php'; echo 'folder_exist /cloud --> '; if(is_dir($dir)) { echo '<font style="color:green;font-weight:bold;">YES</font>'; } else { echo '<font style="color:red;font-weight:bold;">ERROR</font>'; } echo '<br/>'; echo 'folder_writeable /cloud --> '; if (is_writeable($dir)) { echo '<font style="color:green;font-weight:bold;">YES</font>'; } else { echo '<font style="color:red;font-weight:bold;">ERROR</font>'; } echo '<br/>'; echo 'file_exist /index.php --> '; if (file_exists($dir . '/index.php')) { echo '<font style="color:green;font-weight:bold;">YES</font>'; } else { echo '<font style="color:red;font-weight:bold;">ERROR</font>'; } echo '<br/>'; echo 'is_reachable /cloud/index.php --> '; $urlcheck = get_site_url() . '/cloud/index.php'; $agent = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; pt-pt) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27"; if(is_callable('curl_init')){ $ch=curl_init(); curl_setopt ($ch, CURLOPT_URL,$urlcheck ); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch,CURLOPT_VERBOSE,false); curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_exec($ch); $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if($httpcode==200) { echo '<font style="color:green;font-weight:bold;">YES [200]</font>'; } else if($httpcode==500) { echo '<font style="color:red;font-weight:bold;">ERROR 500</font>'; $headers = get_headers($urlcheck); echo ' - ' . $headers[0]; } else { echo '<font style="color:red;font-weight:bold;">ERROR' . $httpcode . '</font>'; $headers = get_headers($urlcheck); echo ' - ' . $headers[0]; } } else { echo '<font style="color:red;font-weight:bold;">(curl_init_missing) - check skip! warning...</font>'; } echo '<br/>'; echo '<hr>'; echo 'Starting Users folders diagnostic...<br/><hr>'; $blogusers = get_users('orderby=ID' ) ; foreach ( $blogusers as $user ) { echo '<strong>' . $user->ID . '</strong> - ' . $user->display_name . ' (' . $user->user_login . ')<br/>'; echo 'metavalue: >' . get_user_meta($user->ID,'wpcloud_user_quota',true) . '< || folder_exist '; if (directory_exist($user->ID)) { echo 'true'; } else { echo 'false'; } echo '<br/>'; echo 'used space: ' . wpcloud_calc_used_space($user->ID) . ' || user space: ' . wpcloud_calc_user_space($user->ID) . ' || percentage: ' . wpcloud_calc_used_percentage($user->ID) . '%'; echo '<hr>'; } echo '<hr>TOTAL USED SPACE: <strong>' . wpcloud_calc_total(false) . '</strong><br/>'; echo 'POTENTIAL USABLE SPACE: <strong>' . wpcloud_calc_total(true) . '</strong><br/>'; echo 'TOTAL SPACE: <strong>' . (int)(disk_total_space("/")/1000000000) . 'GB</strong></br/>'; }
function wpcloud_iframe_callback() { ?> <div class="head"> <?php $url = WP_PLUGIN_URL . '/cloud/includes/'; if (is_user_logged_in()) { echo 'Used space: '; $user_id = get_current_user_id(); echo '<strong>' . wpcloud_calc_used_space($user_id) . '</strong>'; echo '/' . wpcloud_calc_user_space($user_id) . ' MB (' . wpcloud_calc_used_percentage($user_id) . '%)'; } ?> </div> <div class="wrap"> <center> <?php if (get_option('wpcloud_custom_logo_url')) { echo '<img src="' . get_option('wpcloud_custom_logo_url') . '" />'; } else { echo '<img width="50%" src="' . $url . 'cloud.png" />'; } echo '<div class="clear"></div>'; if ( is_user_logged_in() ) { } else { echo '<h2>Welcome, guest!</h2>'; wp_login_form(); } ?> <?php echo do_shortcode('[cloud]'); echo '<hr>'; echo do_shortcode('[cloud_upload]'); ?> </center> </div> <?php echo ' <script> var elem = document.getElementById("adminmenuback"); elem.parentNode.removeChild(elem); var elem = document.getElementById("adminmenuwrap"); elem.parentNode.removeChild(elem); var elem = document.getElementById("wpfooter"); elem.parentNode.removeChild(elem); </script> ';?> <style> #wpcontent { margin-left:0px; } body { font-family: "Open Sans", sans-serif; padding: 0; margin: 0; background: #f5f5f5; } .head { width: 515px; margin: 3em auto 0em auto; text-align:right; } .wrap { width: 515px; margin: 0.2em auto 4em auto; background: white; padding: 25px; border: solid 1px #ECE9E9; -moz-border-radius: 10px; -webkit-border-radius: 10px; } h1 { margin: 0 0 5px 0; font-size:120%; font-weight:normal; color: #666; } a { color: #399ae5; text-decoration: none; } a:hover { color: #206ba4; text-decoration: underline; } <?php $icon_folder = $url . 'icons/'; ?> .wpcloud-file{list-style:none;margin:0;} .wpcloud-file{background:url(<?php echo $icon_folder; ?>document.png) 0 4px no-repeat;padding-left:24px;padding-bottom:2px;} .wpcloud-file.mime-imagejpeg,.wpcloud-file.mime-imagepng,.wpcloud-file.mime-imagejpeg,.wpcloud-file.mime-imagegif{background-image:url(<?php echo $icon_folder; ?>document-image.png);} .wpcloud-file.mime-applicationzip{background-image:url(<?php echo $icon_folder; ?>document-zipper.png);} .wpcloud-file.mime-applicationpdf{background-image:url(<?php echo $icon_folder; ?>document-pdf.png);} .wpcloud-file.mime-applicationvnd-ms-excel{background-image:url(<?php echo $icon_folder; ?>document-excel.png);} .wpcloud-file.mime-applicationvnd-openxmlformats-officedocument-spreadsheetml-sheet{background-image:url(<?php echo $icon_folder; ?>document-excel.png);} .wpcloud-file.mime-applicationmsword{background-image:url(<?php echo $icon_folder; ?>document-word.png);} .wpcloud-file.mime-applicationvnd-openxmlformats-officedocument-wordprocessingml-document{background-image:url(<?php echo $icon_folder; ?>document-word.png);} .wpcloud-file.mime-applicationvnd-oasis-opendocument-spreadsheet{background-image:url(<?php echo $icon_folder; ?>document-ods.png);} .wpcloud-file.mime-applicationvnd-oasis-opendocument-text{background-image:url(<?php echo $icon_folder; ?>document-odt.png);} .wpcloud-file.mime-audiompeg{background-image:url(<?php echo $icon_folder; ?>document-music.png);} #wpfooter { display:none;} </style> <?php }