/**
  * return the id number of the current gallery
  *
  * @param string $gallery_name (optional) - the name of the gallery, use URI segment 1, if not set
  * @return integer - the id number of the gallery
  * @author Andy Bennett
  */
 public static function get_gallery_id($gallery_name = 'media')
 {
     $db = new SteamDatabase();
     $sql = 'SELECT id FROM galleries WHERE LOWER(title)="' . strtolower($gallery_name) . '"';
     $r = $db->get_row_query($sql);
     return $r == false ? false : $r->id;
 }
 /**
  * get page plugins
  *
  * @param string $pid 
  * @return array
  * @author Andy Bennett
  */
 public static function get_page_plugins($pid, $plugin_name = NULL)
 {
     $plug_table = Kohana::config('appconf.page_plugins_table');
     if (is_null($plug_table)) {
         $plug_table = 'page_plugins';
     }
     $db = new SteamDatabase();
     $db->select('*')->from($plug_table)->where(array('pid' => $pid));
     if (isset($plugin_name)) {
         $db->orwhere(array('plugin_name' => $plugin_name));
     }
     $db->orderby('order');
     $c = $db->get_result();
     $col = array();
     foreach ($c as $p) {
         $name = $p->plugin_name;
         $settings = array();
         // $settings['column'] = $p->column;
         $settings['order'] = $p->order;
         $settings['template'] = $p->template;
         try {
             $col[] = PluginManager::getPlugin($name)->setSettings($settings);
         } catch (Exception $e) {
             Kohana::log('debug', $e->getMessage());
         }
     }
     return $col;
 }
 public static function get_containers()
 {
     $db = new SteamDatabase();
     return $db->select_list('container', array('cms' => 1));
 }