Ejemplo n.º 1
0
function tags_init(&$a)
{
    if ($a->argc > 1) {
        $limit = intval($a->argv[1]);
    }
    require_once 'widget.php';
    echo json_encode(get_taglist($limit ? $limit : 50));
    killme();
}
Ejemplo n.º 2
0
;';
        pwg_query($query);
    }
    $represented_albums = $_POST['represent'];
    $page['infos'][] = l10n('Photo informations updated');
}
// tags
$query = '
SELECT
    id,
    name
  FROM ' . IMAGE_TAG_TABLE . ' AS it
    JOIN ' . TAGS_TABLE . ' AS t ON t.id = it.tag_id
  WHERE image_id = ' . $_GET['image_id'] . '
;';
$tag_selection = get_taglist($query);
// retrieving direct information about picture
$query = '
SELECT *
  FROM ' . IMAGES_TABLE . '
  WHERE id = ' . $_GET['image_id'] . '
;';
$row = pwg_db_fetch_assoc(pwg_query($query));
$storage_category_id = null;
if (!empty($row['storage_category_id'])) {
    $storage_category_id = $row['storage_category_id'];
}
$image_file = $row['file'];
// +-----------------------------------------------------------------------+
// |                             template init                             |
// +-----------------------------------------------------------------------+
Ejemplo n.º 3
0
</h4>
                                            <?php 
        echo the_excerpt_max_charlength_page(get_the_id(), 200);
        ?>
                                          </div>
                                        </div>   
            <hr>
                                    <?php 
    }
} else {
    // no posts found
}
/* Restore original Post Data */
wp_reset_postdata();
?>
            
        </div>         
    </div>
 <div class="col-xs-6 col-sm-4 col-md-3">
      <?php 
get_categorylist();
?>
      <?php 
get_taglist();
?>
  
  </div>
  
</div>
<?php 
get_footer();
Ejemplo n.º 4
0
/**
 * Add main toolbar to current page
 * @trigger loc_after_page_header
 */
function admintools_add_public_controller()
{
    global $MultiView, $conf, $template, $page, $user, $picture;
    if (script_basename() == 'picture' and empty($picture['current'])) {
        return;
    }
    $url_root = get_root_url();
    $tpl_vars = array();
    if ($MultiView->is_admin()) {
        // full options for admin
        $tpl_vars['U_SITE_ADMIN'] = $url_root . 'admin.php?page=';
        $tpl_vars['MULTIVIEW'] = $MultiView->get_data();
        $tpl_vars['USER'] = $MultiView->get_user();
        $tpl_vars['CURRENT_USERNAME'] = $user['id'] == $conf['guest_id'] ? l10n('guest') : $user['username'];
        $tpl_vars['DELETE_CACHE'] = isset($conf['multiview_invalidate_cache']);
        if (($admin_lang = $MultiView->get_user_language()) !== false) {
            include_once PHPWG_ROOT_PATH . 'include/functions_mail.inc.php';
            switch_lang_to($admin_lang);
        }
    } else {
        if ($conf['AdminTools']['public_quick_edit'] and script_basename() == 'picture' and $picture['current']['added_by'] == $user['id']) {
            // only "edit" button for photo owner
        } else {
            return;
        }
    }
    $tpl_vars['POSITION'] = $conf['AdminTools']['closed_position'];
    $tpl_vars['DEFAULT_OPEN'] = $conf['AdminTools']['default_open'];
    $tpl_vars['U_SELF'] = $MultiView->get_clean_url(true);
    // photo page
    if (script_basename() == 'picture') {
        $url_self = duplicate_picture_url();
        $tpl_vars['IS_PICTURE'] = true;
        // admin can add to caddie and set representattive
        if ($MultiView->is_admin()) {
            $template->clear_assign(array('U_SET_AS_REPRESENTATIVE', 'U_PHOTO_ADMIN', 'U_CADDIE'));
            $template->set_prefilter('picture', 'admintools_remove_privacy');
            $tpl_vars['U_CADDIE'] = add_url_params($url_self, array('action' => 'add_to_caddie'));
            $query = '
SELECT element_id FROM ' . CADDIE_TABLE . '
  WHERE element_id = ' . $page['image_id'] . '
;';
            $tpl_vars['IS_IN_CADDIE'] = pwg_db_num_rows(pwg_query($query)) > 0;
            if (isset($page['category'])) {
                $tpl_vars['CATEGORY_ID'] = $page['category']['id'];
                $tpl_vars['U_SET_REPRESENTATIVE'] = add_url_params($url_self, array('action' => 'set_as_representative'));
                $tpl_vars['IS_REPRESENTATIVE'] = $page['category']['representative_picture_id'] == $page['image_id'];
            }
            $tpl_vars['U_ADMIN_EDIT'] = $url_root . 'admin.php?page=photo-' . $page['image_id'] . (isset($page['category']) ? '&amp;cat_id=' . $page['category']['id'] : '');
        }
        $tpl_vars['U_DELETE'] = add_url_params($url_self, array('delete' => '', 'pwg_token' => get_pwg_token()));
        // gets tags (full available list is loaded in ajax)
        include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
        $query = '
SELECT id, name
  FROM ' . IMAGE_TAG_TABLE . ' AS it
    JOIN ' . TAGS_TABLE . ' AS t ON t.id = it.tag_id
  WHERE image_id = ' . $page['image_id'] . '
;';
        $tag_selection = get_taglist($query);
        $tpl_vars['QUICK_EDIT'] = array('img' => $picture['current']['derivatives']['square']->get_url(), 'name' => $picture['current']['name'], 'comment' => $picture['current']['comment'], 'author' => $picture['current']['author'], 'level' => $picture['current']['level'], 'date_creation' => substr($picture['current']['date_creation'], 0, 10), 'date_creation_time' => substr($picture['current']['date_creation'], 11, 5), 'tag_selection' => $tag_selection);
    } else {
        if ($MultiView->is_admin() and @$page['section'] == 'categories' and isset($page['category'])) {
            $url_self = duplicate_index_url();
            $tpl_vars['IS_CATEGORY'] = true;
            $tpl_vars['CATEGORY_ID'] = $page['category']['id'];
            $template->clear_assign(array('U_EDIT', 'U_CADDIE'));
            $tpl_vars['U_ADMIN_EDIT'] = $url_root . 'admin.php?page=album-' . $page['category']['id'];
            if (!empty($page['items'])) {
                $tpl_vars['U_CADDIE'] = add_url_params($url_self, array('caddie' => 1));
            }
            $tpl_vars['QUICK_EDIT'] = array('img' => null, 'name' => $page['category']['name'], 'comment' => $page['category']['comment']);
            if (!empty($page['category']['representative_picture_id'])) {
                $query = '
SELECT * FROM ' . IMAGES_TABLE . '
  WHERE id = ' . $page['category']['representative_picture_id'] . '
;';
                $image_infos = pwg_db_fetch_assoc(pwg_query($query));
                $tpl_vars['QUICK_EDIT']['img'] = DerivativeImage::get_one(IMG_SQUARE, $image_infos)->get_url();
            }
        }
    }
    $template->assign(array('ADMINTOOLS_PATH' => './plugins/' . ADMINTOOLS_ID . '/', 'ato' => $tpl_vars));
    $template->set_filename('ato_public_controller', realpath(ADMINTOOLS_PATH . 'template/public_controller.tpl'));
    $template->parse('ato_public_controller');
    if ($MultiView->is_admin() && @$admin_lang !== false) {
        switch_lang_back();
    }
}
Ejemplo n.º 5
0
    if (0 == $level) {
        $level_options[$level] = l10n('Everybody');
    }
}
$template->assign(array('filter_level_options' => $level_options, 'filter_level_options_selected' => isset($_SESSION['bulk_manager_filter']['level']) ? $_SESSION['bulk_manager_filter']['level'] : 0));
// tags
$filter_tags = array();
if (!empty($_SESSION['bulk_manager_filter']['tags'])) {
    $query = '
SELECT
    id,
    name
  FROM ' . TAGS_TABLE . '
  WHERE id IN (' . implode(',', $_SESSION['bulk_manager_filter']['tags']) . ')
;';
    $filter_tags = get_taglist($query);
}
$template->assign('filter_tags', $filter_tags);
// in the filter box, which category to select by default
$selected_category = array();
if (isset($_SESSION['bulk_manager_filter']['category'])) {
    $selected_category = array($_SESSION['bulk_manager_filter']['category']);
} else {
    // we need to know the category in which the last photo was added
    $query = '
SELECT category_id
  FROM ' . IMAGE_CATEGORY_TABLE . '
  ORDER BY image_id DESC
  LIMIT 1
;';
    $result = pwg_query($query);