Esempio n. 1
0
 function column_perms($file)
 {
     return WPFB_Output::RoleNames($file->GetReadPermissions(), true) . ($file->file_offline ? ' <span class="offline">' . __('offline') . '</span>' : '');
 }
Esempio n. 2
0
         $file = WPFB_File::GetFile((int) $_REQUEST['id']);
     }
     if ($file != null && $file->CurUserCanAccess(true)) {
         wpfb_print_json(array('id' => $file->GetId(), 'url' => $file->GetUrl(), 'path' => $file->GetLocalPathRel()));
     } else {
         echo '-1';
     }
     exit;
 case 'catinfo':
     wpfb_loadclass('Category', 'Output');
     if (empty($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) {
         die('-1');
     }
     $cat = WPFB_Category::GetCat((int) $_REQUEST['id']);
     if ($cat != null && $cat->CurUserCanAccess(true)) {
         wpfb_print_json(array('id' => $cat->GetId(), 'url' => $cat->GetUrl(), 'path' => $cat->GetLocalPathRel(), 'roles' => $cat->GetReadPermissions(), 'roles_str' => WPFB_Output::RoleNames($cat->GetReadPermissions(), true)));
     } else {
         echo '-1';
     }
     exit;
 case 'postbrowser':
     if (!current_user_can('edit_posts')) {
         wpfb_print_json(array(array('id' => '0', 'text' => __('Cheatin&#8217; uh?'), 'classes' => '', 'hasChildren' => false)));
         exit;
     }
     $id = empty($_REQUEST['root']) || $_REQUEST['root'] == 'source' ? 0 : intval($_REQUEST['root']);
     $onclick = empty($_REQUEST['onclick']) ? '' : $_REQUEST['onclick'];
     $args = array('hide_empty' => 0, 'hierarchical' => 1, 'orderby' => 'name', 'parent' => $id);
     $terms = get_terms('category', $args);
     $items = array();
     foreach ($terms as &$t) {
Esempio n. 3
0
    static function PrintForm($name, $item = null, $vars = array())
    {
        wpfb_loadclass('Output');
        WPFB_Core::PrintJS();
        /* only required for wpfbConf */
        ?>
<script type="text/javascript">
//<![CDATA[

jQuery(document).ready(function($){
	WPFB_formCategoryChanged();
});

function WPFB_formCategoryChanged()
{
	var catId = jQuery('#file_category,#cat_parent').val();
	if(!catId || catId <= 0) {
		jQuery('#<?php 
        echo $name;
        ?>
_inherited_permissions_label').html('<?php 
        echo WPFB_Output::RoleNames(WPFB_Core::$settings->default_roles, true);
        ?>
');
	} else {
		jQuery.ajax({
			url: wpfbConf.ajurl,
			data: {action:"catinfo","id":catId},
			dataType: "json",
			success: (function(data){jQuery('#<?php 
        echo $name;
        ?>
_inherited_permissions_label').html(data.roles_str);})
		});
	}
}
//]]>
</script>
	<?php 
        extract($vars);
        if (is_writable(WPFB_Core::UploadDir())) {
            include WPFB_PLUGIN_ROOT . 'lib/wpfb_form_' . $name . '.php';
        }
    }
Esempio n. 4
0
    static function CatRow($cat, $sub_level = 0)
    {
        $cat_id = $cat->cat_id;
        $parent_cat = $cat->GetParent();
        $user_roles = $cat->GetReadPermissions();
        $title = esc_attr($cat->cat_name);
        if ($sub_level > 0) {
            $title = str_repeat('-', $sub_level) . " {$title}";
        }
        ?>
			<tr id="cat-<?php 
        echo $cat_id;
        ?>
">
				<th scope="row" class="check-column"><input type="checkbox" name="delete[]" value="<?php 
        echo $cat_id;
        ?>
" /><div style="font-size:11px; text-align:center;"><?php 
        echo $cat_id;
        ?>
</div></th>
				<td class="wpfilebase-admin-list-row-title"><a class="row-title" href="<?php 
        echo esc_attr($cat->GetEditUrl());
        ?>
" title="&quot;<?php 
        echo $title;
        ?>
&quot; bearbeiten">
				<?php 
        if (!empty($cat->cat_icon)) {
            ?>
<img src="<?php 
            echo $cat->GetIconUrl();
            ?>
" height="32" /><?php 
        }
        ?>
				<span><?php 
        echo $title;
        ?>
</span>
				</a></td>
				<td><?php 
        echo esc_html($cat->cat_description);
        ?>
</td>
				<td class="num"><?php 
        echo "<a href='" . admin_url("admin.php?page=wpfilebase_files&file_category=" . $cat->GetId()) . "'>{$cat->cat_num_files}</a> / {$cat->cat_num_files_total}";
        ?>
</td>
				<td><?php 
        echo $parent_cat ? '<a href="' . $parent_cat->GetEditUrl() . '">' . esc_html($parent_cat->cat_name) . '</a>' : '-';
        ?>
</td>
				<td><code><?php 
        echo esc_html($cat->cat_path);
        ?>
</code></td>
				<td><?php 
        echo WPFB_Output::RoleNames($user_roles, true);
        ?>
</td>

				<td><?php 
        echo $cat->GetOwnerId() <= 0 || !($usr = get_userdata($cat->GetOwnerId())) ? '-' : esc_html($usr->user_login);
        ?>
</td>
				<td class="num"><?php 
        echo $cat->cat_order;
        ?>
</td>
			</tr>
	<?php 
    }
Esempio n. 5
0
 function column_perms($file)
 {
     return WPFB_Output::RoleNames($file->GetReadPermissions(), true);
 }
Esempio n. 6
0
 private static function catInfo($args)
 {
     wpfb_loadclass('Category', 'Output');
     if (empty($args['id']) || !is_numeric($args['id'])) {
         die('-1');
     }
     $cat = WPFB_Category::GetCat((int) $args['id']);
     if ($cat != null && $cat->CurUserCanAccess(true)) {
         wp_send_json(array('id' => $cat->GetId(), 'url' => $cat->GetUrl(), 'path' => $cat->GetLocalPathRel(), 'roles' => $cat->GetReadPermissions(), 'roles_str' => WPFB_Output::RoleNames($cat->GetReadPermissions(), true)));
     } else {
         echo '-1';
     }
 }