Ejemplo n.º 1
0
        } else {
            $query .= 'id=' . $sync_options['cat_id'];
        }
        $cat_ids = array_from_query($query, 'id');
        $query = "\n            SELECT `id`, `file`, `path`\n            FROM " . IMAGES_TABLE . " INNER JOIN " . IMAGE_CATEGORY_TABLE . " ON id=image_id\n            WHERE " . SQL_VIDEOS . " " . $OVERWRITE . "\n            AND category_id IN (" . implode(',', $cat_ids) . ")\n            GROUP BY id";
    } else {
        $query = "SELECT `id`, `file`, `path`\n            FROM " . IMAGES_TABLE . "\n            WHERE " . SQL_VIDEOS . " " . $OVERWRITE . ";";
    }
    // Do the work, share with batch manager
    require_once dirname(__FILE__) . '/../include/function_sync2.php';
    // Send sync result to template
    $template->assign('sync_errors', $errors);
    $template->assign('sync_warnings', $warnings);
    $template->assign('sync_infos', $infos);
    // Send result to templates
    $template->assign('update_result', array('NB_ELEMENTS_POSTER' => $posters, 'NB_ELEMENTS_THUMB' => $thumbs, 'NB_ELEMENTS_EXIF' => $metadata, 'NB_ELEMENTS_CANDIDATES' => $videos, 'NB_ERRORS' => count($errors), 'NB_WARNINGS' => count($warnings)));
}
/* Get statistics */
// All videos with supported extensions by VideoJS
$query = "SELECT COUNT(*) FROM " . IMAGES_TABLE . " WHERE " . SQL_VIDEOS . ";";
list($nb_videos) = pwg_db_fetch_row(pwg_query($query));
// All videos with supported extensions by VideoJS and thumb
$query = "SELECT COUNT(*) FROM " . IMAGES_TABLE . " WHERE `representative_ext` IS NOT NULL AND " . SQL_VIDEOS . ";";
list($nb_videos_thumb) = pwg_db_fetch_row(pwg_query($query));
// All videos with supported extensions by VideoJS and with GPS data
$query = "SELECT COUNT(*) FROM " . IMAGES_TABLE . " WHERE `latitude` IS NOT NULL and `longitude` IS NOT NULL AND " . SQL_VIDEOS . ";";
list($nb_videos_geotagged) = pwg_db_fetch_row(pwg_query($query));
$query = 'SELECT id, CONCAT(name, IF(dir IS NULL, " (V)", "") ) AS name, uppercats, global_rank  FROM ' . CATEGORIES_TABLE;
display_select_cat_wrapper($query, array($sync_options['cat_id']), 'categories', false);
// send value to template
$template->assign(array('SUBCATS_INCLUDED_CHECKED' => $sync_options['subcats_included'] ? 'checked="checked"' : '', 'NB_VIDEOS' => $nb_videos, 'NB_VIDEOS_GEOTAGGED' => $nb_videos_geotagged, 'NB_VIDEOS_THUMB' => $nb_videos_thumb, 'VIDEOJS_PATH' => VIDEOJS_PATH));
Ejemplo n.º 2
0
  FROM ' . CATEGORIES_TABLE . '
  WHERE status = \'public\'
;';
        $query_false = '
SELECT id,name,uppercats,global_rank
  FROM ' . CATEGORIES_TABLE . '
  WHERE status = \'private\'
;';
        $template->assign(array('L_SECTION' => l10n('Manage authorizations for selected albums'), 'L_CAT_OPTIONS_TRUE' => l10n('Public'), 'L_CAT_OPTIONS_FALSE' => l10n('Private')));
        break;
    case 'representative':
        $query_true = '
SELECT id,name,uppercats,global_rank
  FROM ' . CATEGORIES_TABLE . '
  WHERE representative_picture_id IS NOT NULL
;';
        $query_false = '
SELECT DISTINCT id,name,uppercats,global_rank
  FROM ' . CATEGORIES_TABLE . ' INNER JOIN ' . IMAGE_CATEGORY_TABLE . ' ON id=category_id
  WHERE representative_picture_id IS NULL
;';
        $template->assign(array('L_SECTION' => l10n('Representative'), 'L_CAT_OPTIONS_TRUE' => l10n('singly represented'), 'L_CAT_OPTIONS_FALSE' => l10n('randomly represented')));
        break;
}
display_select_cat_wrapper($query_true, array(), 'category_option_true');
display_select_cat_wrapper($query_false, array(), 'category_option_false');
// +-----------------------------------------------------------------------+
// |                           sending html code                           |
// +-----------------------------------------------------------------------+
$template->assign_var_from_handle('DOUBLE_SELECT', 'double_select');
$template->assign_var_from_handle('ADMIN_CONTENT', 'cat_options');
Ejemplo n.º 3
0
        $page['errors'][] = l10n('Cannot delete the old permalink !');
    }
}
$template->set_filename('permalinks', 'permalinks.tpl');
// +-----------------------------------------------------------------------+
// | tabs                                                                  |
// +-----------------------------------------------------------------------+
$page['tab'] = 'permalinks';
include PHPWG_ROOT_PATH . 'admin/include/albums_tab.inc.php';
$query = '
SELECT
  id, permalink,
  CONCAT(id, " - ", name, IF(permalink IS NULL, "", " √") ) AS name,
  uppercats, global_rank
FROM ' . CATEGORIES_TABLE;
display_select_cat_wrapper($query, $selected_cat, 'categories', false);
// --- generate display of active permalinks -----------------------------------
$sort_by = parse_sort_variables(array('id', 'name', 'permalink'), 'name', 'psf', array('delete_permanent'), 'SORT_');
$query = '
SELECT id, permalink, uppercats, global_rank
  FROM ' . CATEGORIES_TABLE . '
  WHERE permalink IS NOT NULL
';
if ($sort_by[0] == 'id' or $sort_by[0] == 'permalink') {
    $query .= ' ORDER BY ' . $sort_by[0];
}
$categories = array();
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) {
    $row['name'] = get_cat_display_name_cache($row['uppercats']);
    $categories[] = $row;
  FROM ' . PFEMAIL_MAILBOXES_TABLE . ' AS pm
    JOIN ' . CATEGORIES_TABLE . ' AS c ON c.id = category_id
  ORDER BY pm.id DESC
;';
$mailboxes = query2array($query);
foreach ($mailboxes as $idx => $mailbox) {
    $mailboxes[$idx]['album'] = get_cat_display_name_cache($mailbox['uppercats'], null, false);
    $mailboxes[$idx]['data'] = json_encode($mailbox);
}
$template->assign(array('mailboxes' => $mailboxes, 'PWG_TOKEN' => get_pwg_token()));
// list of albums
$query = '
SELECT id,name,uppercats,global_rank
  FROM ' . CATEGORIES_TABLE . '
;';
display_select_cat_wrapper($query, isset($category_options_selected) ? $category_options_selected : array(), 'category_options');
// groups
$query = '
SELECT id
  FROM ' . GROUPS_TABLE . '
;';
$group_ids = query2array($query, null, 'id');
$query = '
SELECT id
  FROM ' . GROUPS_TABLE . '
  WHERE pfemail_notify = \'true\'
;';
$groups_selected = query2array($query, null, 'id');
$template->assign(array('CACHE_KEYS' => get_admin_client_cache_keys(array('groups')), 'groups' => $group_ids, 'groups_selected' => $groups_selected));
// +-----------------------------------------------------------------------+
// | sending html code                                                     |
Ejemplo n.º 5
0
;';
$author_counts = array();
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) {
    if (!isset($author_counts[$row['author']])) {
        $author_counts[$row['author']] = 0;
    }
    $author_counts[$row['author']]++;
}
foreach ($author_counts as $author => $counter) {
    $authors[] = array('author' => $author, 'counter' => $counter);
}
$template->assign('AUTHORS', $authors);
//------------------------------------------------------------- categories form
$query = '
SELECT id,name,global_rank,uppercats
  FROM ' . CATEGORIES_TABLE . '
' . get_sql_condition_FandF(array('forbidden_categories' => 'id', 'visible_categories' => 'id'), 'WHERE') . '
;';
display_select_cat_wrapper($query, array(), 'category_options', true);
// include menubar
$themeconf = $template->get_template_vars('themeconf');
if (!isset($themeconf['hide_menu_on']) or !in_array('theSearchPage', $themeconf['hide_menu_on'])) {
    include PHPWG_ROOT_PATH . 'include/menubar.inc.php';
}
//------------------------------------------------------------ html code display
include PHPWG_ROOT_PATH . 'include/page_header.php';
trigger_notify('loc_end_search');
flush_page_messages();
$template->pparse('search');
include PHPWG_ROOT_PATH . 'include/page_tail.php';
Ejemplo n.º 6
0
} else {
    $tpl_introduction = array('sync' => 'dirs', 'sync_meta' => true, 'display_info' => false, 'add_to_caddie' => false, 'subcats_included' => true, 'privacy_level_selected' => 0, 'meta_all' => false, 'meta_empty_overrides' => false);
    $cat_selected = array();
    if (isset($_GET['cat_id'])) {
        check_input_parameter('cat_id', $_GET, false, PATTERN_ID);
        $cat_selected = array($_GET['cat_id']);
        $tpl_introduction['sync'] = 'files';
    }
}
$tpl_introduction['privacy_level_options'] = get_privacy_level_options();
$template->assign('introduction', $tpl_introduction);
$query = '
SELECT id,name,uppercats,global_rank
  FROM ' . CATEGORIES_TABLE . '
  WHERE site_id = ' . $site_id;
display_select_cat_wrapper($query, $cat_selected, 'category_options', false);
if (count($errors) > 0) {
    foreach ($errors as $error) {
        $template->append('sync_errors', array('ELEMENT' => $error['path'], 'LABEL' => $error['type'] . ' (' . $error_labels[$error['type']][0] . ')'));
    }
    foreach ($error_labels as $error_type => $error_description) {
        $template->append('sync_error_captions', array('TYPE' => $error_type, 'LABEL' => $error_description[1]));
    }
}
if (count($infos) > 0 and isset($_POST['display_info']) and $_POST['display_info'] == 1) {
    foreach ($infos as $info) {
        $template->append('sync_infos', array('ELEMENT' => $info['path'], 'LABEL' => $info['info']));
    }
}
// +-----------------------------------------------------------------------+
// |                          sending html code                            |
Ejemplo n.º 7
0
        $page['errors'][] = l10n('Select at least one album');
    }
}
// +-----------------------------------------------------------------------+
// |                       template initialization                         |
// +-----------------------------------------------------------------------+
$template->set_filename('cat_move', 'cat_move.tpl');
$template->assign(array('U_HELP' => get_root_url() . 'admin/popuphelp.php?page=cat_move', 'F_ACTION' => get_root_url() . 'admin.php?page=cat_move'));
// +-----------------------------------------------------------------------+
// | tabs                                                                  |
// +-----------------------------------------------------------------------+
$page['tab'] = 'move';
include PHPWG_ROOT_PATH . 'admin/include/albums_tab.inc.php';
// +-----------------------------------------------------------------------+
// |                          Categories display                           |
// +-----------------------------------------------------------------------+
$query = '
SELECT id,name,uppercats,global_rank
  FROM ' . CATEGORIES_TABLE . '
  WHERE dir IS NULL
;';
display_select_cat_wrapper($query, array(), 'category_to_move_options');
$query = '
SELECT id,name,uppercats,global_rank
  FROM ' . CATEGORIES_TABLE . '
;';
display_select_cat_wrapper($query, array(), 'category_parent_options');
// +-----------------------------------------------------------------------+
// |                          sending html code                            |
// +-----------------------------------------------------------------------+
$template->assign_var_from_handle('ADMIN_CONTENT', 'cat_move');
Ejemplo n.º 8
0
  SET polaroid_active = \'true\'
  WHERE id IN (' . implode(',', $_POST['albums']) . ')
;';
        pwg_query($query);
    }
    $page['infos'][] = l10n('Your configuration settings are saved');
}
// +-----------------------------------------------------------------------+
// | template init                                                         |
// +-----------------------------------------------------------------------+
$template->set_filename('plugin_admin_content', dirname(__FILE__) . '/admin_config.tpl');
// +-----------------------------------------------------------------------+
// | form options                                                          |
// +-----------------------------------------------------------------------+
// associate to albums
$query = '
SELECT id
  FROM ' . CATEGORIES_TABLE . '
  WHERE polaroid_active = \'true\'
;';
$polaroid_albums = array_from_query($query, 'id');
$query = '
SELECT id,name,uppercats,global_rank
  FROM ' . CATEGORIES_TABLE . '
;';
display_select_cat_wrapper($query, $polaroid_albums, 'album_options');
$template->assign('apply_to_albums', $conf['polaroid']['apply_to_albums']);
// +-----------------------------------------------------------------------+
// | sending html code                                                     |
// +-----------------------------------------------------------------------+
$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
Ejemplo n.º 9
0
// +-----------------------------------------------------------------------+
$title = l10n('User comments');
$page['body_id'] = 'theCommentsPage';
$template->set_filenames(array('comments' => 'comments.tpl'));
$template->assign(array('F_ACTION' => PHPWG_ROOT_PATH . 'comments.php', 'F_KEYWORD' => htmlspecialchars(stripslashes(@$_GET['keyword'])), 'F_AUTHOR' => htmlspecialchars(stripslashes(@$_GET['author']))));
// +-----------------------------------------------------------------------+
// |                          form construction                            |
// +-----------------------------------------------------------------------+
// Search in a particular category
$blockname = 'categories';
$query = '
SELECT id, name, uppercats, global_rank
  FROM ' . CATEGORIES_TABLE . '
' . get_sql_condition_FandF(array('forbidden_categories' => 'id', 'visible_categories' => 'id'), 'WHERE') . '
;';
display_select_cat_wrapper($query, array(@$_GET['cat']), $blockname, true);
// Filter on recent comments...
$tpl_var = array();
foreach ($since_options as $id => $option) {
    $tpl_var[$id] = $option['label'];
}
$template->assign('since_options', $tpl_var);
$template->assign('since_options_selected', $page['since']);
// Sort by
$template->assign('sort_by_options', $sort_by);
$template->assign('sort_by_options_selected', $page['sort_by']);
// Sorting order
$template->assign('sort_order_options', $sort_order);
$template->assign('sort_order_options_selected', $page['sort_order']);
// Number of items
$blockname = 'items_number_option';