Example #1
0
 public function admin_menu() {
   $menu = Menu::factory("root");
   gallery::admin_menu($menu, $this);
   module::event("admin_menu", $menu, $this);
   $menu->compact();
   return $menu;
 }
Example #2
0
 /**
  * Public function that creates a single instance
  */
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #3
0
 public function site_menu()
 {
     $menu = Menu::factory("root");
     gallery::site_menu($menu, $this);
     module::event("site_menu", $menu, $this);
     return $menu->compact();
 }
Example #4
0
 /**
  * Add a css file to the combined css list.
  * @param $file  the file name or path of the script to include. If a path is specified then
  *               it needs to be relative to DOCROOT. Just specifying a file name will result
  *               in searching Kohana's cascading file system.
  */
 public function css($file)
 {
     if ($path = gallery::find_file("css", $file, false)) {
         $this->css[$path] = 1;
     } else {
         Kohana_Log::add("error", "Can't find css file: {$file}");
     }
 }
Example #5
0
 /**
  * Kohana 2.4 introduces a new connection parameter.  If it's not specified, make sure that we
  * define it here to avoid an error later on.
  *
  * @todo: add an upgrade path to modify var/database.php so that we can avoid doing this at
  *        runtime.
  */
 protected function __construct(array $config)
 {
     if (!isset($config["connection"]["params"])) {
         $config["connection"]["params"] = null;
     }
     parent::__construct($config);
     if (gallery::show_profiler()) {
         $this->config['benchmark'] = true;
     }
 }
 public function index()
 {
     $input = Input::instance();
     $reply = GalleryRemoteReply::factory(gallery_remote::GR_STAT_SUCCESS);
     if ($this->_check_protocol($input, $reply)) {
         $reply->set('debug_gallery_version', gallery::version_string());
         $reply->set('debug_user', identity::active_user()->name);
         $reply->set('debug_user_type', 'Gallery_User');
         $reply->set('debug_user_already_logged_in', identity::active_user()->id != identity::guest()->id ? '1' : '');
         $reply->set('server_version', '2.15');
         $cmd = trim($input->post('cmd'));
         if ($cmd == 'login') {
             $this->_login($input, $reply);
         } else {
             if (self::isloggedin()) {
                 switch ($cmd) {
                     case 'no-op':
                         $reply->set('status_text', 'Noop command successful.');
                         $reply->send();
                         break;
                     case 'fetch-albums':
                     case 'fetch-albums-prune':
                         $this->_fetch_albums_prune($input, $reply);
                         break;
                     case 'new-album':
                         $this->_new_album($input, $reply);
                         break;
                     case 'album-properties':
                         $this->_album_properties($input, $reply);
                         break;
                     case 'add-item':
                         $this->_add_item($input, $reply);
                         break;
                     case 'move-album':
                         $this->_move_album($input, $reply);
                         break;
                     case 'increment-view-count':
                         $this->_increment_view_count($input, $reply);
                         break;
                     case 'image-properties':
                         $this->_image_properties($input, $reply);
                         break;
                     case 'fetch-album-images':
                         $this->_fetch_album_images($input, $reply);
                         break;
                     default:
                         $reply->send(gallery_remote::UNKNOWN_CMD);
                 }
             } else {
                 $reply->send(gallery_remote::LOGIN_MISSING);
             }
         }
     }
 }
Example #7
0
 /**
  * If css combining is enabled, add this css to the list of css that will be
  * combined into a single style element.  When combined, the order of style elements
  * is preserved.
  *
  * @param $file  the file name or path of the css to include. If a path is specified then
  *               it needs to be relative to DOCROOT. Just specifying a file name will result
  *               in searching Kohana's cascading file system.
  * @param $group the group of css to combine this with.  defaults to "core"
  */
 public function css($file, $group = "core")
 {
     if ($path = gallery::find_file("css", $file, false)) {
         if (isset($this->combine_queue["css"])) {
             $this->combine_queue["css"][$group][$path] = 1;
         } else {
             return html::stylesheet($path);
         }
     } else {
         Kohana_Log::add("error", "Can't find css file: {$file}");
     }
 }
 static function activate()
 {
     gallery::set_path_env(array(getenv("PATH"), module::get_var("gallery", "extra_binary_paths")));
     $exiv = exec('which exiv2');
     if ($exiv == '') {
         # Proper warning
     } else {
         module::set_var("author", "exiv_path", $exiv);
         $out = array();
         exec("{$exiv} -V", $out);
         $parts = split(' ', $out[0]);
         module::set_var("author", "exiv_version", $parts[1]);
     }
 }
 static function report_item_conversion_support()
 {
     if (gallery::RELEASE_CHANNEL == "release") {
         if (version_compare(gallery::VERSION, rawphoto_version::MIN_RELEASE_VERSION, ">=")) {
             site_status::clear("rawphoto_needs_item_conversion_support");
         } else {
             site_status::warning(t("The <em>Raw Photos</em> module requires Gallery %version or higher.", array("version" => rawphoto_version::MIN_RELEASE_VERSION)), "rawphoto_needs_item_conversion_support");
         }
     } else {
         if (version_compare(gallery::build_number(), rawphoto_version::MIN_BUILD_NUMBER, ">=")) {
             site_status::clear("rawphoto_needs_item_conversion_support");
         } else {
             site_status::warning(t("The <em>Raw Photos</em> module requires Gallery %version, build %build_number or higher.", array("version" => gallery::VERSION, "build_number" => rawphoto_version::MIN_BUILD_NUMBER)), "rawphoto_needs_item_conversion_support");
         }
     }
 }
Example #10
0
 /**
  * Add image to item
  * @return void
  * @param integer id of item
  * @param string dir with images
  */
 public function add_image($item, $dir)
 {
     // Check for user permission
     if (user::is_got()) {
         $this->set_title(Kohana::lang('gallery.add_image'));
         $this->add_breadcrumb(Kohana::lang('gallery.add_image'), url::current());
         // Set redirect URL
         if (isset($_POST['redirect'])) {
             $redirect = $_POST['redirect'];
         } else {
             $redirect = request::referrer();
         }
         $form = array('image' => '', 'redirect' => $redirect);
         $errors = array();
         if (isset($_FILES)) {
             $files = new Validation($_FILES);
             // Rules
             $files->add_rules('image', 'upload::valid', 'upload::required', 'upload::type[jpg,jpeg]', 'upload::size[500K]');
             if ($files->validate()) {
                 // Temporary file
                 $filename = upload::save('image');
                 // Get new name
                 $id = gallery::get_image_new_name($item, $dir);
                 // Save original and thumb
                 Image::factory($filename)->save('./data/' . $dir . '/' . $item . '_' . $id . '.jpg');
                 Image::factory($filename)->resize(128, 128, Image::AUTO)->quality(85)->save('./data/' . $dir . '/' . $item . '_' . $id . '_m.jpg');
                 // Remove the temporary file
                 unlink($filename);
                 url::redirect($form['redirect']);
             } else {
                 // Repopulate form with error and original values
                 $form = arr::overwrite($form, $files->as_array());
                 $errors = $files->errors('gallery_errors');
             }
         }
         // View
         $this->template->content = new View('admin/add_image');
         $this->template->content->errors = $errors;
         $this->template->content->form = $form;
     } else {
         url::redirect('/denied');
     }
 }
Example #11
0
 static function get($block_id, $theme)
 {
     $block = "";
     switch ($block_id) {
         case "metadata":
             if ($theme->item()) {
                 $block = new Block();
                 $block->css_id = "g-metadata";
                 $block->title = $theme->item()->is_album() ? t("Album info") : ($theme->item()->is_movie() ? t("Movie info") : t("Photo info"));
                 $block->content = new View("info_block.html");
                 if ($theme->item->title && module::get_var("info", "show_title")) {
                     $info["title"] = array("label" => t("Title:"), "value" => html::purify($theme->item->title));
                 }
                 if ($theme->item->description && module::get_var("info", "show_description")) {
                     $info["description"] = array("label" => t("Description:"), "value" => nl2br(html::purify($theme->item->description)));
                 }
                 if (!$theme->item->is_album() && module::get_var("info", "show_name")) {
                     $info["file_name"] = array("label" => t("File name:"), "value" => html::clean($theme->item->name));
                 }
                 if ($theme->item->captured && module::get_var("info", "show_captured")) {
                     $info["captured"] = array("label" => t("Captured:"), "value" => gallery::date_time($theme->item->captured));
                 }
                 if ($theme->item->owner && module::get_var("info", "show_owner")) {
                     $display_name = $theme->item->owner->display_name();
                     if ($theme->item->owner->url) {
                         $info["owner"] = array("label" => t("Owner:"), "value" => html::anchor(html::clean($theme->item->owner->url), html::clean($display_name)));
                     } else {
                         $info["owner"] = array("label" => t("Owner:"), "value" => html::clean($display_name));
                     }
                 }
                 if ($theme->item->width && $theme->item->height && module::get_var("info", "show_dimensions")) {
                     $info["size"] = array("label" => t("Dimensions:"), "value" => t("%width x %height px", array("width" => $theme->item->width, "height" => $theme->item->height)));
                 }
                 $block->content->metadata = $info;
                 module::event("info_block_get_metadata", $block, $theme->item);
             }
             break;
     }
     return $block;
 }
 static function get($block_id, $theme)
 {
     $block = new Block();
     switch ($block_id) {
         case "simple":
             $item = $theme->item;
             if (!$item or !$item->is_photo()) {
                 return "";
             }
             $block->css_id = "g-about-this-photo";
             $block->title = t("About this photo");
             $block->content = new View("about_this_photo.html");
             // exif API doesn't give easy access to individual keys, so do this the hard way
             if (module::is_active("exif")) {
                 $exif = ORM::factory("exif_record")->where("item_id", "=", $theme->item()->id)->find();
                 if ($exif->loaded()) {
                     $exif = unserialize($exif->data);
                     $timestamp = strtotime($exif["DateTime"]);
                     //$block->content->date = gallery::date($timestamp);
                     $block->content->date = date('D j M Y', $timestamp);
                     $block->content->time = gallery::time($timestamp);
                 }
             }
             $block->content->vcount = $theme->item()->view_count;
             // IPTC - copied more or less from iptc.php
             if (module::is_active("iptc")) {
                 $record = ORM::factory("iptc_record")->where("item_id", "=", $theme->item()->id)->find();
                 if ($record->loaded()) {
                     $record = unserialize($record->data);
                     $block->content->source = $record["Source"];
                     $block->content->caption = $record["Caption"];
                 }
             }
             if (module::is_active("tag")) {
                 $block->content->tags = tag::item_tags($theme->item());
             }
             break;
     }
     return $block;
 }
Example #13
0
 static function reply($data = array())
 {
     Session::instance()->abort_save();
     header("X-Gallery-API-Version: " . rest::API_VERSION);
     switch (Input::instance()->get("output", "json")) {
         case "json":
             json::reply($data);
             break;
         case "jsonp":
             if (!($callback = Input::instance()->get("callback", ""))) {
                 throw new Rest_Exception("Bad Request", 400, array("errors" => array("callback" => "missing")));
             }
             if (preg_match('/^[$A-Za-z_][0-9A-Za-z_]*$/', $callback) == 1) {
                 header("Content-type: application/javascript; charset=UTF-8");
                 print "{$callback}(" . json_encode($data) . ")";
             } else {
                 throw new Rest_Exception("Bad Request", 400, array("errors" => array("callback" => "invalid")));
             }
             break;
         case "html":
             header("Content-type: text/html; charset=UTF-8");
             if ($data) {
                 $html = preg_replace("#([\\w]+?://[\\w]+[^ \\'\"\n\r\t<]*)#ise", "'<a href=\"\\1\" >\\1</a>'", var_export($data, 1));
             } else {
                 $html = t("Empty response");
             }
             print "<pre>{$html}</pre>";
             if (gallery::show_profiler()) {
                 Profiler::enable();
                 $profiler = new Profiler();
                 $profiler->render();
             }
             break;
         default:
             throw new Rest_Exception("Bad Request", 400);
     }
 }
Example #14
0
 static function get($block_id, $theme)
 {
     $block = "";
     switch ($block_id) {
         case "metadata":
             if ($theme->item()) {
                 $block = new Block();
                 $block->css_id = "g-metadata";
                 $block->title = $theme->item()->is_album() ? t("Album info") : t("Photo info");
                 $block->content = new View("info_block.html");
                 if ($theme->item->title && module::get_var("info", "show_title")) {
                     $info["title"] = array("label" => t("Title:"), "value" => html::purify($theme->item->title));
                 }
                 if ($theme->item->description && module::get_var("info", "show_description")) {
                     $info["description"] = array("label" => t("Description:"), "value" => nl2br(html::purify($theme->item->description)));
                 }
                 if (!$theme->item->is_album() && module::get_var("info", "show_name")) {
                     $info["file_name"] = array("label" => t("File name:"), "value" => html::clean($theme->item->name));
                 }
                 if ($theme->item->captured && module::get_var("info", "show_captured")) {
                     $info["captured"] = array("label" => t("Captured:"), "value" => gallery::date_time($theme->item->captured));
                 }
                 if ($theme->item->owner && module::get_var("info", "show_owner")) {
                     $display_name = $theme->item->owner->display_name();
                     if ($theme->item->owner->url) {
                         $info["owner"] = array("label" => t("Owner:"), "value" => "<a href=\"{$theme->item->owner->url}\">" . html::clean($display_name) . "</a>");
                     } else {
                         $info["owner"] = array("label" => t("Owner:"), "value" => html::clean($display_name));
                     }
                 }
                 $block->content->metadata = $info;
                 module::event("info_block_get_metadata", $block, $theme->item);
             }
             break;
     }
     return $block;
 }
Example #15
0
 /**
  * Display list of items associated with page and of specified type
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_ItemList($tag_params, $children, $type)
 {
     $manager = UserPageItemsManager::getInstance();
     $page_id = isset($tag_params['page']) ? fix_id($tag_params['page']) : null;
     // create query conditions
     $conditions = array();
     if (!is_null($page_id)) {
         $conditions['page'] = $page_id;
     }
     $conditions['type'] = $type;
     // get items from database
     $items = $manager->getItems(array('id', 'item'), $conditions);
     if ($type == user_page::VIDEO) {
         // create template
         $template = $this->loadTemplate($tag_params, 'page_items_video.xml');
         // connect tag handlers
         if (class_exists('youtube')) {
             $module = youtube::getInstance();
             $template->registerTagHandler('_video', $module, 'tag_Video');
         }
     } else {
         // create template
         $template = $this->loadTemplate($tag_params, 'page_items_gallery.xml');
         // connect tag handlers
         if (class_exists('gallery')) {
             $module = gallery::getInstance();
             $template->registerTagHandler('_gallery', $module, 'tag_Group');
         }
     }
     // parse items
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('item' => $item->item, 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('user_pages_items_delete', 400, $this->getLanguageConstant('title_delete_page'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'page_items_delete'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
Example #16
0
 static function credits()
 {
     $version_string = SafeString::of_safe_html('<bdo dir="ltr">Gallery ' . gallery::version_string() . '</bdo>');
     return "<li class=\"g-first\">" . t(module::get_var("gallery", "credits"), array("url" => "http://gallery.menalto.com", "gallery_version" => $version_string)) . "</li>";
 }
Example #17
0
echo p::clean($user->name);
?>
        </td>
        <td>
          <?php 
echo p::clean($user->full_name);
?>
        </td>
        <td>
          <?php 
echo p::clean($user->email);
?>
        </td>
        <td>
          <?php 
echo $user->last_login == 0 ? "" : gallery::date($user->last_login);
?>
        </td>
        <td class="gActions">
          <a href="<?php 
echo url::site("admin/users/edit_user_form/{$user->id}");
?>
"
              open_text="<?php 
echo t("close");
?>
"
              class="gPanelLink gButtonLink ui-state-default ui-corner-all ui-icon-left">
            <span class="ui-icon ui-icon-pencil"></span><span class="gButtonText"><?php 
echo t("edit");
?>
Example #18
0
 static function site_menu($menu, $theme)
 {
     if ($theme->page_type != "login") {
         $menu->append(Menu::factory("link")->id("home")->label(t("Home"))->url(url::site("albums/1")));
         $item = $theme->item();
         $can_edit = $item && access::can("edit", $item);
         $can_add = $item && access::can("add", $item);
         if ($can_add) {
             $menu->append($add_menu = Menu::factory("submenu")->id("add_menu")->label(t("Add")));
             $add_menu->append(Menu::factory("dialog")->id("add_photos_item")->label(t("Add photos"))->url(url::site("simple_uploader/app/{$item->id}")));
             if ($item->is_album()) {
                 $add_menu->append(Menu::factory("dialog")->id("add_album_item")->label(t("Add an album"))->url(url::site("form/add/albums/{$item->id}?type=album")));
             }
         }
         $menu->append($options_menu = Menu::factory("submenu")->id("options_menu")->label(t("Photo options")));
         if ($item && ($can_edit || $can_add)) {
             if ($can_edit) {
                 $options_menu->append(Menu::factory("dialog")->id("edit_item")->label($item->is_album() ? t("Edit album") : t("Edit photo"))->url(url::site("form/edit/{$item->type}s/{$item->id}")));
             }
             if ($item->is_album()) {
                 $options_menu->label(t("Album options"));
                 if ($can_edit) {
                     $options_menu->append(Menu::factory("dialog")->id("edit_permissions")->label(t("Edit permissions"))->url(url::site("permissions/browse/{$item->id}")));
                 }
             }
         }
         if (user::active()->admin) {
             $menu->append($admin_menu = Menu::factory("submenu")->id("admin_menu")->label(t("Admin")));
             gallery::admin_menu($admin_menu, $theme);
             module::event("admin_menu", $admin_menu, $theme);
         }
         module::event("site_menu", $menu, $theme);
     }
 }
        </tr>
        <? $i = 0; ?>
        <? foreach ($finished_tasks as $task): ?>
        <tr class="<?php 
echo $i % 2 == 0 ? "g-odd" : "g-even";
?>
 <?php 
echo $task->state == "success" ? "g-success" : "g-error";
?>
">
          <td class="<?php 
echo $task->state == "success" ? "g-success" : "g-error";
?>
">
            <?php 
echo gallery::date_time($task->updated);
?>
          </td>
          <td>
            <?php 
echo $task->name;
?>
          </td>
          <td>
            <? if ($task->state == "success"): ?>
            <?php 
echo t("Success");
?>
            <? elseif ($task->state == "error"): ?>
            <?php 
echo t("Failed");
        document.write("<scr" + "ipt type=\"text/javascript\" src=\"<?php 
echo url::base(false) . gallery::find_file("js", "jquery.js", false);
?>
\"></scr" + "ipt>");
        document.write("<scr" + "ipt type=\"text/javascript\" src=\"<?php 
echo url::base(false) . gallery::find_file("js", "jquery.tagcanvas.mod.min.js", false);
?>
\"></scr" + "ipt>");
      };
      setTimeout("initScripts()", 50);
    } else if (typeof(jQuery().tagcanvas) == 'undefined') {
      if (!jQueryTagCanvasScriptFlag) {
        // load one script
        jQueryTagCanvasScriptFlag = true;
        document.write("<scr" + "ipt type=\"text/javascript\" src=\"<?php 
echo url::base(false) . gallery::find_file("js", "jquery.tagcanvas.mod.min.js", false);
?>
\"></scr" + "ipt>");
      };
      setTimeout("initScripts()", 50);
    } else {
      // libraries loaded - run actual code
      function redraw() {
        // set g-tag-cloud-html5-embed-canvas size
        $("#g-tag-cloud-html5-embed-canvas").attr({
          'width' : $("#g-tag-cloud-html5-embed").parent().width(),
          'height': $("#g-tag-cloud-html5-embed").parent().height()
        });
        // start g-tag-cloud-html5-embed-canvas
        if(!$('#g-tag-cloud-html5-embed-canvas').tagcanvas(<?php 
echo $options;
Example #21
0
 /**
  * Delete product
  * @param integer id of product
  * @return void
  */
 public function delete($id)
 {
     // Check user permission
     if (user::is_got()) {
         // Settings
         $this->set_title(Kohana::lang('eshop.delete_product'));
         $this->add_breadcrumb(Kohana::lang('eshop.delete_product'), url::current());
         if ($_POST) {
             if (isset($_POST['yes'])) {
                 // clicked on yes = delete
                 $cat = $this->products->get_product_cat($id);
                 $cat = $cat[0];
                 $status = $this->products->delete_data($id);
                 // Also delte images if deletition was successful
                 if ($status == TRUE) {
                     gallery::delete_images($id, 'products');
                 }
                 url::redirect('/cat/' . $cat . '/' . cat::get_name($cat));
             } else {
                 url::redirect('/product/' . $id . '/' . string::to_url(product::get_name($id)));
             }
         }
         // page
         $this->template->content = new View('admin/product_delete');
     } else {
         url::redirect('/denied');
     }
 }
Example #22
0
<?php

include "./gallery.php";
$gallery = new gallery("./img/");
$gallery->addItem("test", "test.png", array("alt" => "ALT", "title" => "TITLE"));
$gallery->render();
/*Doplňující funkce*/
$gallery->addExtension("gif");
$gallery->removeExtension("png");
$gallery->automaticScan();
//NEBO
$gallery->automaticScan(array("alt" => "ALT", "title" => "TITLE"));
/*načtení všech obrázků v složce s jednotným parametrem ALT a TITLE*/
Example #23
0
function rcms_parse_dynamik_menu($format)
{
    global $system;
    function convertArray($ar)
    {
        $var = '{ ';
        foreach ($ar as $key => $val) {
            $var .= '"' . $key . '" : ';
            if (is_array($val)) {
                $var .= convertArray($val) . ', ';
            } else {
                $var .= '"' . $val . '", ';
            }
        }
        if ($var[strlen($var) - 2] == ',') {
            $var[strlen($var) - 2] = ' ';
        }
        return $var . '} ';
    }
    $pic_right = '&nbsp;&nbsp;<b>�</b> ';
    //Commented becouse f*****g IE, Microsoft, Gates and his mother...
    //$pic_right = '&nbsp;<img src = \''.SKIN_PATH.'arrow_right.gif\'>';
    //$pic_down = '<img src = \''.SKIN_PATH.'arrow_down.gif\'>';
    $pic_down = '';
    $navigation = parse_ini_file(CONFIG_PATH . 'navigation.ini', true);
    $dyna = parse_ini_file(CONFIG_PATH . 'dynamik.ini', true);
    $result = array();
    foreach ($navigation as $link) {
        if (substr($link['url'], 0, 9) == 'external:') {
            $target = '_blank';
            $link['url'] = substr($link['url'], 9);
        } else {
            $target = '';
        }
        $tdata = explode(':', $link['url'], 2);
        if (count($tdata) == 2) {
            list($modifier, $value) = $tdata;
        } else {
            $modifier = $tdata[0];
        }
        if (!empty($value) && !empty($system->navmodifiers[$modifier])) {
            if ($clink = call_user_func($system->navmodifiers[$modifier]['m'], $value)) {
                $result[] = array($clink[0], empty($link['name']) ? $clink[1] : __($link['name']), $target);
            }
        } else {
            $result[] = array($link['url'], __($link['name']));
        }
    }
    $menu = ' <script type="text/javascript" src="modules/jsc/navigation.js"></script> <div class="dhtml_menu"> <div class="horz_menu"> ';
    foreach ($result as $item) {
        if (empty($item[2])) {
            $item[2] = '_top';
        }
        if (empty($item[4])) {
            $item[4] = '';
        }
        // Begin of Icons support by Migel
        //$arr = array();
        if ($item[0] == '?module=articles') {
            if (!isset($dyna['use_art'])) {
                $articles = new articles();
                $containers = $articles->getContainers();
                $count = 0;
                if (is_array($containers)) {
                    $item[1] .= '&nbsp;' . $pic_down;
                    $containers = array_reverse($containers);
                    foreach ($containers as $conkey => $conval) {
                        $count++;
                        if ($count != $dyna['max']) {
                            $arr['ddm_article']['&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; '] = '?module=articles&c=' . $conkey;
                            if (!isset($dyna['min'])) {
                                $articles->setWorkContainer($conkey);
                                $art = $articles->getCategories();
                                $count2 = 0;
                                if (is_array($art)) {
                                    unset($arr['ddm_article']['&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; ']);
                                    $arr['ddm_article'][$pic_right . '&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; '] = array('-' => '?module=articles&c=' . $conkey);
                                    $art = array_reverse($art);
                                    foreach ($art as $artkey => $artval) {
                                        $count2++;
                                        if ($count2 != $dyna['max']) {
                                            $arr['ddm_article'][$pic_right . '&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; ']['&nbsp;&nbsp; ' . cut_text($artval['title']) . '&nbsp;&nbsp;'] = '?module=articles&c=' . $conkey . '&b=' . $artval['id'];
                                            $art2 = $articles->getArticles($artval['id']);
                                            $count3 = 0;
                                            if (count($art2) > 0) {
                                                unset($arr['ddm_article'][$pic_right . '&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; ']['&nbsp;&nbsp; ' . cut_text($artval['title']) . '&nbsp;&nbsp;']);
                                                $arr['ddm_article'][$pic_right . '&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; '][$pic_right . '&nbsp;&nbsp; ' . cut_text($artval['title']) . '&nbsp;&nbsp;'] = array('-' => '?module=articles&c=' . $conkey . '&b=' . $artval['id']);
                                                $art2 = array_reverse($art2);
                                                foreach ($art2 as $art2key => $art2val) {
                                                    $count3++;
                                                    if ($count3 != $dyna['max']) {
                                                        $arr['ddm_article'][$pic_right . '&nbsp;&nbsp; ' . cut_text($conval) . '&nbsp;&nbsp; '][$pic_right . '&nbsp;&nbsp; ' . cut_text($artval['title']) . '&nbsp;&nbsp;']['&nbsp;&nbsp;' . cut_text($art2val['title']) . '&nbsp;&nbsp;'] = '?module=articles&c=' . $conkey . '&b=' . $artval['id'] . '&a=' . $art2val['id'];
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                $item[4] = 'ddm_article';
            }
            $item[3] = 'articles.png';
        } elseif ($item[0] == '?module=gallery') {
            if (!isset($dyna['use_gal'])) {
                $gallery = new gallery();
                $kw = $gallery->getAvaiableValues('keywords');
                $count = 0;
                if (is_array($kw)) {
                    $kw = array_reverse($kw);
                    $count++;
                    if (!isset($dyna['min'])) {
                        foreach ($kw as $key => $val) {
                            if ($count != $dyna['max']) {
                                $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By keywords') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;'] = array('-' => '?module=gallery&keyword=' . $val);
                                $kw2 = $gallery->getLimitedImagesList('keywords', $val);
                                $kw2 = array_reverse($kw2);
                                $count2 = 0;
                                foreach ($kw2 as $key2 => $val2) {
                                    $count2++;
                                    if ($count2 != $dyna['max']) {
                                        $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By keywords') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;']['&nbsp;&nbsp;' . cut_text($val2) . '&nbsp;&nbsp;'] = '?module=gallery&id=' . $val2;
                                    }
                                }
                            }
                        }
                    }
                }
                $kw = $gallery->getAvaiableValues('size');
                $count = 0;
                if (is_array($kw)) {
                    $kw = array_reverse($kw);
                    $count++;
                    $item[1] .= '&nbsp;' . $pic_down;
                    if (!isset($dyna['min'])) {
                        foreach ($kw as $key => $val) {
                            if ($count != $dyna['max']) {
                                $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By size') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;'] = array('-' => '?module=gallery&size=' . $val);
                                $kw2 = $gallery->getLimitedImagesList('size', $val);
                                $kw2 = array_reverse($kw2);
                                $count2 = 0;
                                foreach ($kw2 as $key2 => $val2) {
                                    $count2++;
                                    if ($count2 != $dyna['max']) {
                                        $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By size') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;']['&nbsp;&nbsp;' . cut_text($val2) . '&nbsp;&nbsp;'] = '?module=gallery&id=' . $val2;
                                    }
                                }
                            }
                        }
                    }
                }
                $kw = $gallery->getAvaiableValues('type');
                $count = 0;
                if (is_array($kw)) {
                    $kw = array_reverse($kw);
                    $count++;
                    if (!isset($dyna['min'])) {
                        foreach ($kw as $key => $val) {
                            if ($count != $dyna['max']) {
                                $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By type') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;'] = array('-' => '?module=gallery&type=' . $val);
                                $kw2 = $gallery->getLimitedImagesList('type', $val);
                                $kw2 = array_reverse($kw2);
                                $count2 = 0;
                                foreach ($kw2 as $key2 => $val2) {
                                    $count2++;
                                    if ($count2 != $dyna['max']) {
                                        $arr['ddm_gallery'][$pic_right . '&nbsp;&nbsp;' . __('By type') . '&nbsp;&nbsp;'][$pic_right . '&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;']['&nbsp;&nbsp;' . cut_text($val2) . '&nbsp;&nbsp;'] = '?module=gallery&id=' . $val2;
                                    }
                                }
                            }
                        }
                    }
                }
                $kw = $gallery->getFullImagesList();
                $count = 0;
                if (count($kw) > 0) {
                    $kw = array_reverse($kw);
                    $count++;
                    foreach ($kw as $key => $val) {
                        if ($count != $dyna['max']) {
                            $arr['ddm_gallery']['&nbsp;&nbsp;' . cut_text($val) . '&nbsp;&nbsp;'] = '?module=gallery&id=' . $val;
                        }
                    }
                }
                $item[4] = 'ddm_gallery';
            }
            $item[3] = 'gallery.png';
        } elseif ($item[0] == '?module=user.list') {
            if (!isset($dyna['use_mem'])) {
                $userlist = $system->getUserList('*', 'nickname');
                $count = 0;
                if (count($userlist) > 0) {
                    $item[1] .= '&nbsp;' . $pic_down;
                    $userlist = array_reverse($userlist);
                    foreach ($userlist as $conkey => $conval) {
                        $count++;
                        if ($count != $dyna['max']) {
                            $arr['ddm_users']['&nbsp;&nbsp;' . cut_text($conval['nickname']) . '&nbsp;&nbsp;'] = '?module=user.list&user='******'username'];
                        }
                    }
                }
                $item[4] = 'ddm_users';
            }
            $item[3] = 'userlist.png';
        } elseif ($item[0] == '?module=filesdb') {
            if (!isset($dyna['use_fdb'])) {
                $filesdb = new linksdb(DOWNLOADS_DATAFILE);
                $count = 0;
                if (!empty($filesdb->data)) {
                    $item[1] .= '&nbsp;' . $pic_down;
                    $fdb = array_reverse($filesdb->data);
                    foreach ($fdb as $conkey => $conval) {
                        $count++;
                        if ($count != $dyna['max']) {
                            $arr['ddm_filesdb']['&nbsp;&nbsp;' . cut_text($conval['name']) . '&nbsp;&nbsp;'] = '?module=filesdb&id=' . (sizeof($fdb) - ($count - 1));
                            if (count($conval['files']) > 0) {
                                if (!isset($dyna['min'])) {
                                    unset($arr['ddm_filesdb']['&nbsp;&nbsp;' . cut_text($conval['name']) . '&nbsp;&nbsp;']);
                                    $arr['ddm_filesdb'][$pic_right . '&nbsp;&nbsp;' . cut_text($conval['name']) . '&nbsp;&nbsp;'] = array('-' => '?module=filesdb&id=' . (sizeof($fdb) - ($count - 1)));
                                    $count2 = 0;
                                    $conval['files'] = array_reverse($conval['files']);
                                    foreach ($conval['files'] as $artkey => $artval) {
                                        $count2++;
                                        if ($count2 != $dyna['max']) {
                                            $arr['ddm_filesdb'][$pic_right . '&nbsp;&nbsp;' . cut_text($conval['name']) . '&nbsp;&nbsp;']['&nbsp;&nbsp;' . cut_text($artval['name']) . '&nbsp;&nbsp;'] = '?module=filesdb&id=' . (sizeof($fdb) - ($count - 1)) . '&fid=' . (sizeof($conval['files']) - ($count2 - 1));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                $item[4] = 'ddm_filesdb';
            }
            $item[3] = 'files.png';
        } elseif ($item[0] == '?module=forum') {
            if (!isset($dyna['use_for'])) {
                $topics = @unserialize(@file_get_contents(FORUM_PATH . 'topic_index.dat'));
                $count = 0;
                if (count($topics) > 0) {
                    $item[1] .= '&nbsp;' . $pic_down;
                    if (is_array($topics)) {
                        $topics = array_reverse($topics);
                        foreach ($topics as $conkey => $conval) {
                            $count++;
                            if ($count != $dyna['max']) {
                                $arr['ddm_forum']['&nbsp;&nbsp;' . cut_text($conval['title']) . '&nbsp;&nbsp;'] = '?module=forum&id=' . (sizeof($topics) - $count) . '&action=topic';
                            }
                        }
                    }
                }
                $item[4] = 'ddm_forum';
            }
            $item[3] = 'forum.png';
        } elseif ($item[1] == 'CUSTOM1') {
            $item[1] = __(file_get_contents(CONFIG_PATH . 'custom_menu_title_1.txt')) . '&nbsp;' . $pic_down;
            $arr['ddm_custom1'] = arr2ddm(unserialize(file_get_contents(CONFIG_PATH . 'custom_menu_1.dat')));
            $item[4] = 'ddm_custom1';
            $item[3] = 'custom1.png';
        } elseif ($item[1] == 'CUSTOM2') {
            $item[1] = __(file_get_contents(CONFIG_PATH . 'custom_menu_title_2.txt')) . '&nbsp;' . $pic_down;
            $arr['ddm_custom2'] = arr2ddm(unserialize(file_get_contents(CONFIG_PATH . 'custom_menu_2.dat')));
            $item[4] = 'ddm_custom2';
            $item[3] = 'custom2.png';
        } elseif ($item[1] == 'CUSTOM3') {
            $item[1] = __(file_get_contents(CONFIG_PATH . 'custom_menu_title_3.txt')) . '&nbsp;' . $pic_down;
            $arr['ddm_custom3'] = arr2ddm(unserialize(file_get_contents(CONFIG_PATH . 'custom_menu_3.dat')));
            $item[4] = 'ddm_custom3';
            $item[3] = 'custom3.png';
        } else {
            $item[3] = 'default.png';
        }
        if (isset($dyna['ico'])) {
            $item[3] = '<img src="skins/icons/' . $item[3] . '">';
        } else {
            $item[3] = '';
        }
        $menu .= str_replace('{link}', $item[0], str_replace('{title}', $item[1], str_replace('{target}', @$item[2], str_replace('{icon}', $item[3], str_replace('{id}', $item[4], $format)))));
        // End of Icons support by Migel
    }
    $menu .= ' <br clear="both" /> </div>';
    $result = $menu . ' <script type="text/javascript"> dhtmlmenu_build(' . convertArray($arr, 'arr') . ');</script></div>';
    return $result;
}
Example #24
0
 /**
  * Show page for printing all attached cards with selected text.
  */
 private function print_card()
 {
     $id = fix_id($_REQUEST['transaction']);
     $manager = ShopTransactionsManager::getInstance();
     $item_manager = ShopItemManager::getInstance();
     $transaction_item_manager = ShopTransactionItemsManager::getInstance();
     // get transaction with specified id
     $transaction = $manager->getSingleItem(array('id'), array('id' => $id));
     // ensure transaction is a valid one
     if (!is_object($transaction)) {
         return;
     }
     // get items associated with transaction
     $transaction_items = $transaction_item_manager->getItems(array('item', 'description'), array('transaction' => $transaction->id));
     if (count($transaction_items) == 0) {
         return;
     }
     $id_list = array();
     $description_list = array();
     foreach ($transaction_items as $item) {
         $id_list[] = $item->item;
         $description_list[$item->item] = $item->description;
     }
     // get unique id and gallery
     $shop_items = $item_manager->getItems(array('id', 'uid', 'gallery'), array('id' => $id_list));
     if (count($shop_items) == 0) {
         return;
     }
     // prepare final list and only include items that are actually known cards
     $items = array();
     foreach ($shop_items as $item) {
         if (!array_key_exists($item->uid, $this->text_position)) {
             continue;
         }
         $position = $this->text_position[$item->uid];
         $description = unserialize($description_list[$item->id]);
         $data = array('text' => $description['text'], 'top' => $position[0] . '%', 'left' => $position[1] . '%', 'bottom' => $position[2] . '%', 'right' => $position[3] . '%', 'image' => gallery::getGroupImageById($item->gallery));
         $items[] = $data;
     }
     // prepare template
     $template = new TemplateHandler('print_card.xml', $this->path . 'templates/');
     if (count($items) > 0) {
         foreach ($items as $item) {
             $template->setLocalParams($item);
             $template->restoreXML();
             $template->parse();
         }
     }
 }
<ul>
  <?php 
foreach ($comments as $comment) {
    ?>
  <div class="allcomments-comment">
   <li id="g-comment-<?php 
    echo $comment->id;
    ?>
">
    <p class="allcomments-author">
     <a href="<?php 
    echo $comment->item()->url();
    ?>
">
       <?php 
    echo t("on %date", array("date" => gallery::date_time($comment->created), "title" => $comment->item()->title));
    ?>
</a><br />
     <a href="<?php 
    echo $comment->item()->url();
    ?>
">
       <?php 
    echo $comment->item()->thumb_img(array(), 128);
    ?>
</a>
     <a href="<?php 
    echo $comment->author_url();
    ?>
">
     <?php 
 /**
  * Handle drawing list of manufacturers tag
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_ManufacturerList($tag_params, $children)
 {
     $manager = ShopManufacturerManager::getInstance();
     $conditions = array();
     $selected = -1;
     if (class_exists('gallery')) {
         $use_images = true;
         $gallery = gallery::getInstance();
         $gallery_manager = GalleryManager::getInstance();
     } else {
         $use_images = false;
     }
     if (isset($tag_params['selected'])) {
         $selected = fix_id($tag_params['selected']);
     }
     $items = $manager->getItems($manager->getFieldNames(), $conditions);
     $template = $this->_parent->loadTemplate($tag_params, 'manufacturer_list_item.xml');
     if (count($items) > 0) {
         foreach ($items as $item) {
             // get image
             $image = '';
             if ($use_images && !empty($item->logo)) {
                 $image_item = $gallery_manager->getSingleItem($gallery_manager->getFieldNames(), array('id' => $item->logo));
                 if (is_object($image_item)) {
                     $image = $gallery->getImageURL($image_item);
                 }
             }
             // prepare parameters
             $params = array('id' => $item->id, 'name' => $item->name, 'web_site' => $item->web_site, 'logo' => $image, 'selected' => $selected == $item->id ? 1 : 0, 'item_change' => url_MakeHyperlink($this->_parent->getLanguageConstant('change'), window_Open('shop_manufacturer_change', 360, $this->_parent->getLanguageConstant('title_manufacturer_change'), true, true, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'manufacturers'), array('sub_action', 'change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->_parent->getLanguageConstant('delete'), window_Open('shop_manufacturer_delete', 400, $this->_parent->getLanguageConstant('title_manufacturer_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'manufacturers'), array('sub_action', 'delete'), array('id', $item->id)))));
             // parse template
             $template->setLocalParams($params);
             $template->restoreXML();
             $template->parse();
         }
     }
 }
        ?>
              />
              <?php 
    } else {
        ?>
              <?php 
        echo t("No thumbnail");
        ?>
              <?php 
    }
    ?>
            </a>
          </div>
        </div>
        <p><?php 
    echo gallery::date($comment->created);
    ?>
</p>
           <?php 
    echo nl2br(html::purify($comment->text));
    ?>
      </td>
      <td>
        <ul class="g-buttonset-vertical">
        <?php 
    if ($comment->state != "unpublished") {
        ?>
          <li>
            <a href="javascript:set_state('unpublished',<?php 
        echo $comment->id;
        ?>
 public function initialize($entity = null, $options = null)
 {
     $gallery = new Select('galleryid', gallery::find(), array('using' => array('id', 'name'), 'useEmpty' => TRUE, 'emptyText' => $this->di->get('translate')->_('Seleccione una galeria')));
     $gallery->setLabel('Gallerry');
     $this->add($gallery);
 }
Example #29
0
 public function context_menu($item, $thumbnail_css_selector)
 {
     $menu = Menu::factory("root")->append(Menu::factory("submenu")->id("context_menu")->label(t("Options")))->css_class("gContextMenu");
     gallery::context_menu($menu, $this, $item, $thumbnail_css_selector);
     module::event("context_menu", $menu, $this, $item, $thumbnail_css_selector);
     return $menu->compact();
 }
Example #30
0
<?php

setlocale(LC_TIME, 'ita');
date_default_timezone_set('Europe/Rome');
include "./utils/class.utils.php";
include "./utils/class.gallery.php";
include "./utils/class.seminar.php";
$gallery = new gallery();
$util = new utils();
$s = new seminar();
$s->setSource("./json/seminari.json");
function sort_by_date($a, $b)
{
    $dA = strtotime($a['data']);
    $dB = strtotime($b['data']);
    return $dB - $dA;
}
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Gallerie Foto | Associazione Renbukai</title>
    <link rel="apple-touch-icon-precomposed" href="assets/favicon_t.png" />
    <link rel="shortcut icon" href="assets/favicon.png">
    <meta name="description" content="aikido scuola pesaro rimini renbukai jo bokken tanto arti marziali foglietta fujimoto osawa tada">
    <meta name="author" content="cbolk">
    <!-- bootstrap -->
    <!-- bootstrap -->