当前位置: 首页>>代码示例>>PHP>>正文


PHP mass_updates函数代码示例

本文整理汇总了PHP中mass_updates函数的典型用法代码示例。如果您正苦于以下问题:PHP mass_updates函数的具体用法?PHP mass_updates怎么用?PHP mass_updates使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mass_updates函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save_images_order

/**
 * save the rank depending on given images order
 *
 * The list of ordered images id is supposed to be in the same parent
 * category
 *
 * @param array categories
 * @return void
 */
function save_images_order($category_id, $images)
{
    $current_rank = 0;
    $datas = array();
    foreach ($images as $id) {
        $datas[] = array('category_id' => $category_id, 'image_id' => $id, 'rank' => ++$current_rank);
    }
    $fields = array('primary' => array('image_id', 'category_id'), 'update' => array('rank'));
    mass_updates(IMAGE_CATEGORY_TABLE, $fields, $datas);
}
开发者ID:donseba,项目名称:Piwigo,代码行数:19,代码来源:element_set_ranks.php

示例2: save_upload_form_config

function save_upload_form_config($data, &$errors = array(), &$form_errors = array())
{
    if (!is_array($data) or empty($data)) {
        return false;
    }
    $upload_form_config = get_upload_form_config();
    $updates = array();
    foreach ($data as $field => $value) {
        if (!isset($upload_form_config[$field])) {
            continue;
        }
        if (is_bool($upload_form_config[$field]['default'])) {
            if (isset($value)) {
                $value = true;
            } else {
                $value = false;
            }
            $updates[] = array('param' => $field, 'value' => boolean_to_string($value));
        } elseif ($upload_form_config[$field]['can_be_null'] and empty($value)) {
            $updates[] = array('param' => $field, 'value' => 'false');
        } else {
            $min = $upload_form_config[$field]['min'];
            $max = $upload_form_config[$field]['max'];
            $pattern = $upload_form_config[$field]['pattern'];
            if (preg_match($pattern, $value) and $value >= $min and $value <= $max) {
                $updates[] = array('param' => $field, 'value' => $value);
            } else {
                $errors[] = sprintf($upload_form_config[$field]['error_message'], $min, $max);
                $form_errors[$field] = '[' . $min . ' .. ' . $max . ']';
            }
        }
    }
    if (count($errors) == 0) {
        mass_updates(CONFIG_TABLE, array('primary' => array('param'), 'update' => array('value')), $updates);
        return true;
    }
    return false;
}
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:38,代码来源:functions_upload.inc.php

示例3: save_categories_order

/**
 * save the rank depending on given categories order
 *
 * The list of ordered categories id is supposed to be in the same parent
 * category
 *
 * @param array categories
 * @return void
 */
function save_categories_order($categories)
{
    $current_rank_for_id_uppercat = array();
    $current_rank = 0;
    $datas = array();
    foreach ($categories as $category) {
        if (is_array($category)) {
            $id = $category['id'];
            $id_uppercat = $category['id_uppercat'];
            if (!isset($current_rank_for_id_uppercat[$id_uppercat])) {
                $current_rank_for_id_uppercat[$id_uppercat] = 0;
            }
            $current_rank = ++$current_rank_for_id_uppercat[$id_uppercat];
        } else {
            $id = $category;
            $current_rank++;
        }
        $datas[] = array('id' => $id, 'rank' => $current_rank);
    }
    $fields = array('primary' => array('id'), 'update' => array('rank'));
    mass_updates(CATEGORIES_TABLE, $fields, $datas);
    update_global_rank();
}
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:32,代码来源:cat_list.php

示例4: sync_metadata

/**
 * Sync all metadata of a list of images.
 * Metadata are fetched from original files and saved in database.
 *
 * @param int[] $ids
 */
function sync_metadata($ids)
{
    global $conf;
    if (!defined('CURRENT_DATE')) {
        define('CURRENT_DATE', date('Y-m-d'));
    }
    $datas = array();
    $tags_of = array();
    $query = '
SELECT id, path, representative_ext
  FROM ' . IMAGES_TABLE . '
  WHERE id IN (
' . wordwrap(implode(', ', $ids), 160, "\n") . '
)
;';
    $result = pwg_query($query);
    while ($data = pwg_db_fetch_assoc($result)) {
        $data = get_sync_metadata($data);
        if ($data === false) {
            continue;
        }
        $id = $data['id'];
        foreach (array('keywords', 'tags') as $key) {
            if (isset($data[$key])) {
                if (!isset($tags_of[$id])) {
                    $tags_of[$id] = array();
                }
                foreach (explode(',', $data[$key]) as $tag_name) {
                    $tags_of[$id][] = tag_id_from_tag_name($tag_name);
                }
            }
        }
        $data['date_metadata_update'] = CURRENT_DATE;
        $datas[] = $data;
    }
    if (count($datas) > 0) {
        $update_fields = get_sync_metadata_attributes();
        $update_fields[] = 'date_metadata_update';
        $update_fields = array_diff($update_fields, array('tags', 'keywords'));
        mass_updates(IMAGES_TABLE, array('primary' => array('id'), 'update' => $update_fields), $datas, MASS_UPDATES_SKIP_EMPTY);
    }
    set_tags_of($tags_of);
}
开发者ID:HassenLin,项目名称:piwigo_utf8filename,代码行数:49,代码来源:functions_metadata.php

示例5: update_uppercats

/**
 * Updates categories.uppercats field based on categories.id + categories.id_uppercat
 */
function update_uppercats()
{
    $query = '
SELECT id, id_uppercat, uppercats
  FROM ' . CATEGORIES_TABLE . '
;';
    $cat_map = query2array($query, 'id');
    $datas = array();
    foreach ($cat_map as $id => $cat) {
        $upper_list = array();
        $uppercat = $id;
        while ($uppercat) {
            $upper_list[] = $uppercat;
            $uppercat = $cat_map[$uppercat]['id_uppercat'];
        }
        $new_uppercats = implode(',', array_reverse($upper_list));
        if ($new_uppercats != $cat['uppercats']) {
            $datas[] = array('id' => $id, 'uppercats' => $new_uppercats);
        }
    }
    $fields = array('primary' => array('id'), 'update' => array('uppercats'));
    mass_updates(CATEGORIES_TABLE, $fields, $datas);
}
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:26,代码来源:functions.php

示例6: unset

                }
            }
        }
        if (isset($need_update[$key])) {
            $row['nb_pages'] += $need_update[$key];
            $updates[] = $row;
            unset($need_update[$key]);
        }
    }
}
foreach ($need_update as $time_key => $nb_pages) {
    $time_tokens = explode('-', $time_key);
    $inserts[] = array('year' => $time_tokens[0], 'month' => @$time_tokens[1], 'day' => @$time_tokens[2], 'hour' => @$time_tokens[3], 'nb_pages' => $nb_pages);
}
if (count($updates) > 0) {
    mass_updates(HISTORY_SUMMARY_TABLE, array('primary' => array('year', 'month', 'day', 'hour'), 'update' => array('nb_pages')), $updates);
}
if (count($inserts) > 0) {
    mass_inserts(HISTORY_SUMMARY_TABLE, array_keys($inserts[0]), $inserts);
}
if ($max_id != 0) {
    $query = '
UPDATE ' . HISTORY_TABLE . '
  SET summarized = \'true\'
  WHERE summarized = \'false\'
    AND id <= ' . $max_id . '
;';
    pwg_query($query);
}
// +-----------------------------------------------------------------------+
// | Page parameters check                                                 |
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:31,代码来源:stats.php

示例7: ws_categories_getList


//.........这里部分代码省略.........
        ' . get_sql_condition_FandF(array('visible_categories' => 'id'), "\n  AND") . '
  ORDER BY ' . DB_RANDOM_FUNCTION . '()
  LIMIT 1
;';
                        $subresult = pwg_query($query);
                        if (pwg_db_num_rows($subresult) > 0) {
                            list($image_id) = pwg_db_fetch_row($subresult);
                        }
                    }
                }
            }
        }
        if (isset($image_id)) {
            if ($conf['representative_cache_on_subcats'] and $row['user_representative_picture_id'] != $image_id) {
                $user_representative_updates_for[$row['id']] = $image_id;
            }
            $row['representative_picture_id'] = $image_id;
            $image_ids[] = $image_id;
            $categories[] = $row;
        }
        unset($image_id);
        // management of the album thumbnail -- stops here
        $cats[] = $row;
    }
    usort($cats, 'global_rank_compare');
    // management of the album thumbnail -- starts here
    if (count($categories) > 0) {
        $thumbnail_src_of = array();
        $new_image_ids = array();
        $query = '
SELECT id, path, representative_ext, level
  FROM ' . IMAGES_TABLE . '
  WHERE id IN (' . implode(',', $image_ids) . ')
;';
        $result = pwg_query($query);
        while ($row = pwg_db_fetch_assoc($result)) {
            if ($row['level'] <= $user['level']) {
                $thumbnail_src_of[$row['id']] = DerivativeImage::thumb_url($row);
            } else {
                // problem: we must not display the thumbnail of a photo which has a
                // higher privacy level than user privacy level
                //
                // * what is the represented category?
                // * find a random photo matching user permissions
                // * register it at user_representative_picture_id
                // * set it as the representative_picture_id for the category
                foreach ($categories as &$category) {
                    if ($row['id'] == $category['representative_picture_id']) {
                        // searching a random representant among elements in sub-categories
                        $image_id = get_random_image_in_category($category);
                        if (isset($image_id) and !in_array($image_id, $image_ids)) {
                            $new_image_ids[] = $image_id;
                        }
                        if ($conf['representative_cache_on_level']) {
                            $user_representative_updates_for[$category['id']] = $image_id;
                        }
                        $category['representative_picture_id'] = $image_id;
                    }
                }
                unset($category);
            }
        }
        if (count($new_image_ids) > 0) {
            $query = '
SELECT id, path, representative_ext
  FROM ' . IMAGES_TABLE . '
  WHERE id IN (' . implode(',', $new_image_ids) . ')
;';
            $result = pwg_query($query);
            while ($row = pwg_db_fetch_assoc($result)) {
                $thumbnail_src_of[$row['id']] = DerivativeImage::thumb_url($row);
            }
        }
    }
    // compared to code in include/category_cats, we only persist the new
    // user_representative if we have used $user['id'] and not the guest id,
    // or else the real guest may see thumbnail that he should not
    if (!$params['public'] and count($user_representative_updates_for)) {
        $updates = array();
        foreach ($user_representative_updates_for as $cat_id => $image_id) {
            $updates[] = array('user_id' => $user['id'], 'cat_id' => $cat_id, 'user_representative_picture_id' => $image_id);
        }
        mass_updates(USER_CACHE_CATEGORIES_TABLE, array('primary' => array('user_id', 'cat_id'), 'update' => array('user_representative_picture_id')), $updates);
    }
    foreach ($cats as &$cat) {
        foreach ($categories as $category) {
            if ($category['id'] == $cat['id'] and isset($category['representative_picture_id'])) {
                $cat['tn_url'] = $thumbnail_src_of[$category['representative_picture_id']];
            }
        }
        // we don't want them in the output
        unset($cat['user_representative_picture_id'], $cat['count_images'], $cat['count_categories']);
    }
    unset($cat);
    // management of the album thumbnail -- stops here
    if ($params['tree_output']) {
        return categories_flatlist_to_tree($cats);
    }
    return array('categories' => new PwgNamedArray($cats, 'category', ws_std_get_category_xml_attributes()));
}
开发者ID:HassenLin,项目名称:piwigo_utf8filename,代码行数:101,代码来源:pwg.categories.php

示例8: save_profile_from_post

function save_profile_from_post($userdata, &$errors)
{
    global $conf, $page;
    $errors = array();
    if (!isset($_POST['validate'])) {
        return false;
    }
    $special_user = in_array($userdata['id'], array($conf['guest_id'], $conf['default_user_id']));
    if ($special_user) {
        unset($_POST['username'], $_POST['mail_address'], $_POST['password'], $_POST['use_new_pwd'], $_POST['passwordConf'], $_POST['theme'], $_POST['language']);
        $_POST['theme'] = get_default_theme();
        $_POST['language'] = get_default_language();
    }
    if (!defined('IN_ADMIN')) {
        unset($_POST['username']);
    }
    if ($conf['allow_user_customization'] or defined('IN_ADMIN')) {
        $int_pattern = '/^\\d+$/';
        if (empty($_POST['nb_image_page']) or !preg_match($int_pattern, $_POST['nb_image_page'])) {
            $errors[] = l10n('The number of photos per page must be a not null scalar');
        }
        // periods must be integer values, they represents number of days
        if (!preg_match($int_pattern, $_POST['recent_period']) or $_POST['recent_period'] < 0) {
            $errors[] = l10n('Recent period must be a positive integer value');
        }
        if (!in_array($_POST['language'], array_keys(get_languages()))) {
            die('Hacking attempt, incorrect language value');
        }
        if (!in_array($_POST['theme'], array_keys(get_pwg_themes()))) {
            die('Hacking attempt, incorrect theme value');
        }
    }
    if (isset($_POST['mail_address'])) {
        // if $_POST and $userdata have are same email
        // validate_mail_address allows, however, to check email
        $mail_error = validate_mail_address($userdata['id'], $_POST['mail_address']);
        if (!empty($mail_error)) {
            $errors[] = $mail_error;
        }
    }
    if (!empty($_POST['use_new_pwd'])) {
        // password must be the same as its confirmation
        if ($_POST['use_new_pwd'] != $_POST['passwordConf']) {
            $errors[] = l10n('The passwords do not match');
        }
        if (!defined('IN_ADMIN')) {
            // changing password requires old password
            $query = '
  SELECT ' . $conf['user_fields']['password'] . ' AS password
    FROM ' . USERS_TABLE . '
    WHERE ' . $conf['user_fields']['id'] . ' = \'' . $userdata['id'] . '\'
  ;';
            list($current_password) = pwg_db_fetch_row(pwg_query($query));
            if (!$conf['password_verify']($_POST['password'], $current_password)) {
                $errors[] = l10n('Current password is wrong');
            }
        }
    }
    if (count($errors) == 0) {
        // mass_updates function
        include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
        if (isset($_POST['mail_address'])) {
            // update common user informations
            $fields = array($conf['user_fields']['email']);
            $data = array();
            $data[$conf['user_fields']['id']] = $userdata['id'];
            $data[$conf['user_fields']['email']] = $_POST['mail_address'];
            // password is updated only if filled
            if (!empty($_POST['use_new_pwd'])) {
                $fields[] = $conf['user_fields']['password'];
                // password is hashed with function $conf['password_hash']
                $data[$conf['user_fields']['password']] = $conf['password_hash']($_POST['use_new_pwd']);
            }
            // username is updated only if allowed
            if (!empty($_POST['username'])) {
                if ($_POST['username'] != $userdata['username'] and get_userid($_POST['username'])) {
                    $page['errors'][] = l10n('this login is already used');
                    unset($_POST['redirect']);
                } else {
                    $fields[] = $conf['user_fields']['username'];
                    $data[$conf['user_fields']['username']] = $_POST['username'];
                    // send email to the user
                    if ($_POST['username'] != $userdata['username']) {
                        include_once PHPWG_ROOT_PATH . 'include/functions_mail.inc.php';
                        switch_lang_to($userdata['language']);
                        $keyargs_content = array(get_l10n_args('Hello', ''), get_l10n_args('Your username has been successfully changed to : %s', $_POST['username']));
                        pwg_mail($_POST['mail_address'], array('subject' => '[' . $conf['gallery_title'] . '] ' . l10n('Username modification'), 'content' => l10n_args($keyargs_content), 'content_format' => 'text/plain'));
                        switch_lang_back();
                    }
                }
            }
            mass_updates(USERS_TABLE, array('primary' => array($conf['user_fields']['id']), 'update' => $fields), array($data));
        }
        if ($conf['allow_user_customization'] or defined('IN_ADMIN')) {
            // update user "additional" informations (specific to Piwigo)
            $fields = array('nb_image_page', 'language', 'expand', 'show_nb_hits', 'recent_period', 'theme');
            if ($conf['activate_comments']) {
                $fields[] = 'show_nb_comments';
            }
            $data = array();
//.........这里部分代码省略.........
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:101,代码来源:profile.php

示例9: die

// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify  |
// | it under the terms of the GNU General Public License as published by  |
// | the Free Software Foundation                                          |
// |                                                                       |
// | This program is distributed in the hope that it will be useful, but   |
// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
// | General Public License for more details.                              |
// |                                                                       |
// | You should have received a copy of the GNU General Public License     |
// | along with this program; if not, write to the Free Software           |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA.                                                                  |
// +-----------------------------------------------------------------------+
if (!defined('PHPWG_ROOT_PATH')) {
    die('Hacking attempt!');
}
$upgrade_description = 'fill empty images name with filename';
include_once PHPWG_ROOT_PATH . 'include/constants.php';
// +-----------------------------------------------------------------------+
// |                            Upgrade content                            |
// +-----------------------------------------------------------------------+
$query = 'SELECT id, file FROM ' . IMAGES_TABLE . ' WHERE name IS NULL;';
$images = pwg_query($query);
$updates = array();
while ($row = pwg_db_fetch_assoc($images)) {
    $updates[] = array('id' => $row['id'], 'name' => get_name_from_file($row['file']));
}
mass_updates(IMAGES_TABLE, array('primary' => array('id'), 'update' => array('name')), $updates);
echo "\n" . '"' . $upgrade_description . '"' . ' ended' . "\n";
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:31,代码来源:117-database.php

示例10: pwg_query

pwg_query($query);
$query = '
SELECT user_id, theme
  FROM ' . USER_INFOS_TABLE . '
;';
$result = pwg_query($query);
$users = array();
while ($row = pwg_db_fetch_assoc($result)) {
    list($user_template, $user_theme) = explode('/', $row['theme']);
    switch ($user_template) {
        case 'yoga':
            break;
        case 'gally':
            $user_theme = 'gally-' . $user_theme;
            break;
        case 'floPure':
            $user_theme = 'Pure_' . $user_theme;
            break;
        case 'floOs':
            $user_theme = 'OS_' . $user_theme;
            break;
        case 'simple':
            $user_theme = 'simple-' . $user_theme;
            break;
        default:
            $user_theme = 'Sylvia';
    }
    array_push($users, array('user_id' => $row['user_id'], 'theme' => $user_theme));
}
mass_updates(USER_INFOS_TABLE, array('primary' => array('user_id'), 'update' => array('theme')), $users);
echo "\n" . $upgrade_description . "\n";
开发者ID:donseba,项目名称:Piwigo,代码行数:31,代码来源:84-database.php

示例11: array_from_query

          WHERE tag_id = ' . $tag_id . '
        ;';
                    $destination_tag_image_ids = array_from_query($query, 'image_id');
                    $inserts = array();
                    foreach ($destination_tag_image_ids as $image_id) {
                        $inserts[] = array('tag_id' => $destination_tag_id, 'image_id' => $image_id);
                    }
                    if (count($inserts) > 0) {
                        mass_inserts(IMAGE_TAG_TABLE, array_keys($inserts[0]), $inserts);
                    }
                    $page['infos'][] = l10n('Tag "%s" is now a duplicate of "%s"', stripslashes($tag_name), $current_name_of[$tag_id]);
                }
            }
        }
    }
    mass_updates(TAGS_TABLE, array('primary' => array('id'), 'update' => array('name', 'url_name')), $updates);
}
// +-----------------------------------------------------------------------+
// |                               merge tags                              |
// +-----------------------------------------------------------------------+
if (isset($_POST['merge_submit'])) {
    if (!isset($_POST['destination_tag'])) {
        $page['errors'][] = l10n('No destination tag selected');
    } else {
        $destination_tag_id = $_POST['destination_tag'];
        $tag_ids = explode(',', $_POST['merge_list']);
        if (is_array($tag_ids) and count($tag_ids) > 1) {
            $name_of_tag = array();
            $query = '
SELECT
    id,
开发者ID:donseba,项目名称:Piwigo,代码行数:31,代码来源:tags.php

示例12: update_rating_score

/**
 * Update images.rating_score field.
 * We use a bayesian average (http://en.wikipedia.org/wiki/Bayesian_average) with
 *  C = average number of rates per item
 *  m = global average rate (all rates)
 *
 * @param int|false $element_id if false applies to all
 * @return array (score, average, count) values are null if $element_id is false
*/
function update_rating_score($element_id = false)
{
    if (($alt_result = trigger_change('update_rating_score', false, $element_id)) !== false) {
        return $alt_result;
    }
    $query = '
SELECT element_id,
    COUNT(rate) AS rcount,
    SUM(rate) AS rsum
  FROM ' . RATE_TABLE . '
  GROUP by element_id';
    $all_rates_count = 0;
    $all_rates_avg = 0;
    $item_ratecount_avg = 0;
    $by_item = array();
    $result = pwg_query($query);
    while ($row = pwg_db_fetch_assoc($result)) {
        $all_rates_count += $row['rcount'];
        $all_rates_avg += $row['rsum'];
        $by_item[$row['element_id']] = $row;
    }
    if ($all_rates_count > 0) {
        $all_rates_avg /= $all_rates_count;
        $item_ratecount_avg = $all_rates_count / count($by_item);
    }
    $updates = array();
    foreach ($by_item as $id => $rate_summary) {
        $score = ($item_ratecount_avg * $all_rates_avg + $rate_summary['rsum']) / ($item_ratecount_avg + $rate_summary['rcount']);
        $score = round($score, 2);
        if ($id == $element_id) {
            $return = array('score' => $score, 'average' => round($rate_summary['rsum'] / $rate_summary['rcount'], 2), 'count' => $rate_summary['rcount']);
        }
        $updates[] = array('id' => $id, 'rating_score' => $score);
    }
    mass_updates(IMAGES_TABLE, array('primary' => array('id'), 'update' => array('rating_score')), $updates);
    //set to null all items with no rate
    if (!isset($by_item[$element_id])) {
        $query = '
SELECT id FROM ' . IMAGES_TABLE . '
  LEFT JOIN ' . RATE_TABLE . ' ON id=element_id
  WHERE element_id IS NULL AND rating_score IS NOT NULL';
        $to_update = array_from_query($query, 'id');
        if (!empty($to_update)) {
            $query = '
UPDATE ' . IMAGES_TABLE . '
  SET rating_score=NULL
  WHERE id IN (' . implode(',', $to_update) . ')';
            pwg_query($query);
        }
    }
    return isset($return) ? $return : array('score' => null, 'average' => null, 'count' => 0);
}
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:61,代码来源:functions_rate.inc.php

示例13: array

         $date_creation = null;
     } else {
         $date_creation = $_POST['date_creation'];
     }
     $datas = array();
     foreach ($collection as $image_id) {
         $datas[] = array('id' => $image_id, 'date_creation' => $date_creation);
     }
     mass_updates(IMAGES_TABLE, array('primary' => array('id'), 'update' => array('date_creation')), $datas);
 } else {
     if ('level' == $action) {
         $datas = array();
         foreach ($collection as $image_id) {
             $datas[] = array('id' => $image_id, 'level' => $_POST['level']);
         }
         mass_updates(IMAGES_TABLE, array('primary' => array('id'), 'update' => array('level')), $datas);
         if (isset($_SESSION['bulk_manager_filter']['level'])) {
             if ($_POST['level'] < $_SESSION['bulk_manager_filter']['level']) {
                 $redirect = true;
             }
         }
     } else {
         if ('add_to_caddie' == $action) {
             fill_caddie($collection);
         } else {
             if ('delete' == $action) {
                 if (isset($_POST['confirm_deletion']) and 1 == $_POST['confirm_deletion']) {
                     $deleted_count = delete_elements($collection, true);
                     if ($deleted_count > 0) {
                         $_SESSION['page_infos'][] = l10n_dec('%d photo was deleted', '%d photos were deleted', $deleted_count);
                         $redirect_url = get_root_url() . 'admin.php?page=' . $_GET['page'];
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:31,代码来源:batch_manager_global.php

示例14: die

// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify  |
// | it under the terms of the GNU General Public License as published by  |
// | the Free Software Foundation                                          |
// |                                                                       |
// | This program is distributed in the hope that it will be useful, but   |
// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
// | General Public License for more details.                              |
// |                                                                       |
// | You should have received a copy of the GNU General Public License     |
// | along with this program; if not, write to the Free Software           |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA.                                                                  |
// +-----------------------------------------------------------------------+
if (!defined('PHPWG_ROOT_PATH')) {
    die('Hacking attempt!');
}
$upgrade_description = 'makes sure default user has a theme and a language';
$query = '
SELECT
    theme,
    language
  FROM ' . USER_INFOS_TABLE . '
  WHERE user_id = ' . $conf['default_user_id'] . '
;';
$result = pwg_query($query);
list($theme, $language) = pwg_db_fetch_row($result);
$data = array('user_id' => $conf['default_user_id'], 'theme' => empty($theme) ? 'Sylvia' : $theme, 'language' => empty($language) ? 'en_UK' : $language);
mass_updates(USER_INFOS_TABLE, array('primary' => array('user_id'), 'update' => array('theme', 'language')), array($data));
echo "\n" . $upgrade_description . "\n";
开发者ID:squidjam,项目名称:Piwigo,代码行数:31,代码来源:97-database.php

示例15: pwg_query

        $result = pwg_query($query);
        while ($row = pwg_db_fetch_assoc($result)) {
            $infos_of_image[$row['id']] = $row;
        }
    }
    foreach ($infos_of_image as &$info) {
        $info['src_image'] = new SrcImage($info);
    }
    unset($info);
}
if (count($user_representative_updates_for)) {
    $updates = array();
    foreach ($user_representative_updates_for as $cat_id => $image_id) {
        $updates[] = array('user_id' => $user['id'], 'cat_id' => $cat_id, 'user_representative_picture_id' => $image_id);
    }
    mass_updates(USER_CACHE_CATEGORIES_TABLE, array('primary' => array('user_id', 'cat_id'), 'update' => array('user_representative_picture_id')), $updates);
}
if (count($categories) > 0) {
    // Update filtered data
    if (function_exists('update_cats_with_filtered_data')) {
        update_cats_with_filtered_data($categories);
    }
    $template->set_filename('index_category_thumbnails', 'mainpage_categories.tpl');
    trigger_notify('loc_begin_index_category_thumbnails', $categories);
    $tpl_thumbnails_var = array();
    foreach ($categories as $category) {
        if (0 == $category['count_images']) {
            continue;
        }
        $category['name'] = trigger_change('render_category_name', $category['name'], 'subcatify_category_name');
        if ($page['section'] == 'recent_cats') {
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:31,代码来源:category_cats.inc.php


注:本文中的mass_updates函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。