예제 #1
0
/**
 * Update images.path field base on images.file and storage categories fulldirs.
 */
function update_path()
{
    $query = '
SELECT DISTINCT(storage_category_id)
  FROM ' . IMAGES_TABLE . '
  WHERE storage_category_id IS NOT NULL
;';
    $cat_ids = query2array($query, null, 'storage_category_id');
    $fulldirs = get_fulldirs($cat_ids);
    foreach ($cat_ids as $cat_id) {
        $query = '
UPDATE ' . IMAGES_TABLE . '
  SET path = ' . pwg_db_concat(array("'" . $fulldirs[$cat_id] . "/'", 'file')) . '
  WHERE storage_category_id = ' . $cat_id . '
;';
        pwg_query($query);
    }
}
예제 #2
0
    AND site_id = ' . $site_id;
    if (isset($_POST['cat']) and is_numeric($_POST['cat'])) {
        if (isset($_POST['subcats-included']) and $_POST['subcats-included'] == 1) {
            $query .= '
    AND uppercats ' . DB_REGEX_OPERATOR . ' \'(^|,)' . $_POST['cat'] . '(,|$)\'
';
        } else {
            $query .= '
    AND id = ' . $_POST['cat'] . '
';
        }
    }
    $db_categories = hash_from_query($query, 'id');
    // get categort full directories in an array for comparison with file
    // system directory tree
    $db_fulldirs = get_fulldirs(array_keys($db_categories));
    // what is the base directory to search file system sub-directories ?
    if (isset($_POST['cat']) and is_numeric($_POST['cat'])) {
        $basedir = $db_fulldirs[$_POST['cat']];
    } else {
        $basedir = preg_replace('#/*$#', '', $site_url);
    }
    // we need to have fulldirs as keys to make efficient comparison
    $db_fulldirs = array_flip($db_fulldirs);
    // finding next rank for each id_uppercat. By default, each category id
    // has 1 for next rank on its sub-categories to create
    $next_rank['NULL'] = 1;
    $query = '
SELECT id
  FROM ' . CATEGORIES_TABLE;
    $result = pwg_query($query);
예제 #3
0
$params = array(array('param' => 'prefix_thumbnail', 'value' => $save['prefix_thumbnail'], 'comment' => 'thumbnails filename prefix'), array('param' => 'mail_webmaster', 'value' => $save['mail_webmaster'], 'comment' => 'webmaster mail'), array('param' => 'default_language', 'value' => 'en_UK.iso-8859-1', 'comment' => 'Default gallery language'), array('param' => 'default_template', 'value' => 'default', 'comment' => 'Default gallery style'), array('param' => 'default_maxwidth', 'value' => '', 'comment' => 'maximum width authorized for displaying images'), array('param' => 'default_maxheight', 'value' => '', 'comment' => 'maximum height authorized for the displaying images'), array('param' => 'nb_comment_page', 'value' => '10', 'comment' => 'number of comments to display on each page'), array('param' => 'upload_maxfilesize', 'value' => '150', 'comment' => 'maximum filesize for the uploaded pictures'), array('param' => 'upload_maxwidth', 'value' => '800', 'comment' => 'maximum width authorized for the uploaded images'), array('param' => 'upload_maxheight', 'value' => '600', 'comment' => 'maximum height authorized for the uploaded images'), array('param' => 'upload_maxwidth_thumbnail', 'value' => '150', 'comment' => 'maximum width authorized for the uploaded thumbnails'), array('param' => 'upload_maxheight_thumbnail', 'value' => '100', 'comment' => 'maximum height authorized for the uploaded thumbnails'), array('param' => 'log', 'value' => 'false', 'comment' => 'keep an history of visits on your website'), array('param' => 'comments_validation', 'value' => 'false', 'comment' => 'administrators validate users comments before becoming visible'), array('param' => 'comments_forall', 'value' => 'false', 'comment' => 'even guest not registered can post comments'), array('param' => 'mail_notification', 'value' => 'false', 'comment' => 'automated mail notification for adminsitrators'), array('param' => 'nb_image_line', 'value' => '5', 'comment' => 'Number of images displayed per row'), array('param' => 'nb_line_page', 'value' => '3', 'comment' => 'Number of rows displayed per page'), array('param' => 'recent_period', 'value' => '7', 'comment' => 'Period within which pictures are displayed as new (in days)'), array('param' => 'auto_expand', 'value' => 'false', 'comment' => 'Auto expand of the category tree'), array('param' => 'show_nb_comments', 'value' => 'false', 'comment' => 'Show the number of comments under the thumbnails'), array('param' => 'use_iptc', 'value' => 'false', 'comment' => 'Use IPTC data during database synchronization with files metadata'), array('param' => 'use_exif', 'value' => 'false', 'comment' => 'Use EXIF data during database synchronization with files metadata'), array('param' => 'show_iptc', 'value' => 'false', 'comment' => 'Show IPTC metadata on picture.php if asked by user'), array('param' => 'show_exif', 'value' => 'true', 'comment' => 'Show EXIF metadata on picture.php if asked by user'), array('param' => 'authorize_remembering', 'value' => 'true', 'comment' => 'Authorize users to be remembered, see $conf{remember_me_length}'), array('param' => 'gallery_locked', 'value' => 'false', 'comment' => 'Lock your gallery temporary for non admin users'));
mass_inserts(CONFIG_TABLE, array_keys($params[0]), $params);
// refresh calculated datas
update_global_rank();
update_category();
// update calculated field "images.path"
$cat_ids = array();
$query = '
SELECT DISTINCT(storage_category_id) AS unique_storage_category_id
  FROM ' . IMAGES_TABLE . '
;';
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) {
    array_push($cat_ids, $row['unique_storage_category_id']);
}
$fulldirs = get_fulldirs($cat_ids);
foreach ($cat_ids as $cat_id) {
    $query = '
UPDATE ' . IMAGES_TABLE . '
  SET path = CONCAT(\'' . $fulldirs[$cat_id] . '\',\'/\',file)
  WHERE storage_category_id = ' . $cat_id . '
;';
    pwg_query($query);
}
// all sub-categories of private categories become private
$cat_ids = array();
$query = '
SELECT id
  FROM ' . CATEGORIES_TABLE . '
  WHERE status = \'private\'
;';