Esempio n. 1
0
 public function delete($groupname)
 {
     $errors = array();
     $groupArray = $this->auth->get_group_by_name($groupname);
     if (!$groupArray) {
         $this->session->set_flash('flash', 'Group not found');
         url::redirect(SubfolioTheme::get_site_root() . "-cms/groups");
         exit;
     }
     // delete the user
     $this->auth->delete_group($groupname);
     $this->auth->save_groups();
     $this->session->set_flash('flash', 'Group deleted');
     url::redirect(SubfolioTheme::get_site_root() . "-cms/groups");
     exit;
 }
Esempio n. 2
0
 public function removefromgroup($username)
 {
     $errors = array();
     $userArray = $this->auth->get_user_by_name($username);
     if (!$userArray) {
         url::redirect(SubfolioTheme::get_site_root() . "-cms/users");
         exit;
     }
     if (!isset($_GET['group'])) {
         $this->session->set_flash('flash', 'No group');
         url::redirect(SubfolioTheme::get_site_root() . "-cms/users/edit/" . $username);
         exit;
     }
     if (!$this->auth->remove_user_from_group($username, $_GET['group'])) {
         $this->session->set_flash('flash', 'Remove failed please try again');
         url::redirect(SubfolioTheme::get_site_root() . "-cms/users/edit/" . $username);
         exit;
     }
     $this->auth->save_groups();
     $this->session->set_flash('flash', 'Removed from group');
     url::redirect(SubfolioTheme::get_site_root() . "-cms/users/edit/" . $username);
     exit;
 }
Esempio n. 3
0
    foreach ($errors as $error) {
        ?>
        <li><?php 
        print $error;
        ?>
</li>
      <?php 
    }
    ?>
    </ul>
  </div>
  <?php 
}
?>
  <form action="<?php 
print SubfolioTheme::get_site_root();
?>
-cms/groups/create" method="post">

    <div class="login_field" style="padding-bottom: 20px;">
      <label for="name">Group name:</label>
      <input type="text" name="name" id="name" class="field" value="<?php 
echo isset($_POST['name']) ? $_POST['name'] : '';
?>
" tabindex="1" />
    </div>

    <div class="subButton copy">
      <input type="submit" value="Submit" />
    </div>
  </form>
Esempio n. 4
0
 public function get_thumbnail_url()
 {
     $root = SubfolioTheme::get_site_root();
     if ($this->has_custom_thumbnail()) {
         return $root . "directory/" . format::urlencode_parts($this->parent) . "/-thumbnails-custom/" . Filebrowser::double_encode_specialcharacters($this->get_custom_thumbnail_file_name());
     } else {
         $thumbnail = "-thumbnails/" . $this->name;
         $url = $root . "directory/" . format::urlencode_parts($this->parent) . "/-thumbnails/" . Filebrowser::double_encode_specialcharacters(urlencode($this->name));
         if (!file_exists("-thumbnails")) {
             mkdir("-thumbnails", 0755, true);
         }
         $build_thumbnail = false;
         if (!$this->has_thumbnail()) {
             $build_thumbnail = true;
         }
         if ($build_thumbnail) {
             $max_size = Kohana::config('filebrowser.thumbnail_max_filesize');
             $stats = stat($this->name);
             if ($stats['size'] > $max_size * 1024 * 1024) {
                 return '';
             } else {
                 $thumbnail_width = SubfolioTheme::get_option('thumbnail_width', Kohana::config('filebrowser.thumbnail_width'));
                 $thumbnail_height = SubfolioTheme::get_option('thumbnail_height', Kohana::config('filebrowser.thumbnail_height'));
                 $info = @getimagesize($this->name);
                 if (isset($info[1])) {
                     if ($info[1] <= $thumbnail_height) {
                     } else {
                         $this->image = new Image($this->name);
                         if ($this->image) {
                             $this->image->resize($thumbnail_width, $thumbnail_height, Image::HEIGHT);
                             $this->image->save($thumbnail);
                         }
                     }
                 }
             }
         }
         if (file_exists($thumbnail)) {
             $thumbnail_stats = stat($thumbnail);
             return $url . "?rnd=" . $thumbnail_stats['ctime'];
         } else {
             return '';
         }
     }
 }
Esempio n. 5
0
 public function get_file_url()
 {
     $root = SubfolioTheme::get_site_root();
     return $root . "directory/" . format::urlencode_parts($this->filepath);
 }
Esempio n. 6
0
 public function get_view_url()
 {
     $root = SubfolioTheme::get_site_root();
     $theme = Kohana::config('filebrowser.theme');
     return $root . "config/themes/" . $theme;
 }
Esempio n. 7
0
 public function inline_images($type)
 {
     $root = SubfolioTheme::get_site_root();
     $list = array();
     if ($type == "top") {
         $inline = Subfolio::$filebrowser->get_file_list("img", "-t-", true);
     } else {
         if ($type == "middle") {
             $inline = Subfolio::$filebrowser->get_file_list("img", "-m-", true);
         } else {
             if ($type == "bottom") {
                 $inline = Subfolio::$filebrowser->get_file_list("img", "-b-", true);
             }
         }
     }
     foreach ($inline as $item) {
         list($width, $height, $type, $attr) = @getimagesize(Subfolio::$filebrowser->fullfolderpath . "/" . $item->name);
         $list_item = array();
         $list_item['url'] = Subfolio::$filebrowser->get_link($item->name, TRUE);
         $list_item['width'] = $width;
         $list_item['height'] = $height;
         $list[] = $list_item;
     }
     return $list;
 }