Exemplo n.º 1
0
function groupObjects($group_by, $objects)
{
    if (count($group_by) == 0) {
        $grouped = array('groups' => array(array('group' => array('id' => 0, 'name' => '', 'pid' => 0), 'subgroups' => array())), 'grouped_objects' => array(0 => $objects));
    } else {
        // first grouping
        $grouped = makeGroups($objects, $group_by[0]);
        // more groupings
        for ($gb_index = 1; $gb_index < count($group_by); $gb_index++) {
            $to_remove = array();
            foreach ($grouped['grouped_objects'] as $key => $gobjects) {
                $member_id = strrpos($key, "_") === FALSE ? $key : substr($key, strrpos($key, "_") + 1);
                $parent_group = getGroup($grouped['groups'], $member_id);
                $grouped_tmp = makeGroups($gobjects, $group_by[$gb_index], $parent_group);
                if ($parent_group) {
                    setGroup($grouped['groups'], $member_id, $parent_group);
                }
                if (count($grouped_tmp['grouped_objects']) > 0) {
                    foreach ($grouped_tmp['grouped_objects'] as $m => $objs) {
                        foreach ($objs as $obj) {
                            $grouped['grouped_objects'][$key . "_" . $m][] = $obj;
                        }
                    }
                    $to_remove[] = $key;
                }
            }
            foreach ($to_remove as $k) {
                unset($grouped['grouped_objects'][$k]);
            }
        }
    }
    return $grouped;
}
Exemplo n.º 2
0
    $sql = "ALTER TABLE `pre_sanree_brand_businesses` ADD `newbanner` VARCHAR( 255 ) NULL AFTER `banner`;";
    runquery($sql);
}
$sql = "ALTER TABLE `pre_sanree_brand_businesses` CHANGE `qq` `qq` VARCHAR( 255 ) NULL DEFAULT NULL;";
runquery($sql);
$sql = "ALTER TABLE `pre_sanree_brand_businesses` CHANGE `tel` `tel` VARCHAR( 255 ) NULL DEFAULT NULL;";
runquery($sql);
if (!rowvalue_exists(array('field' => 'index', 'value' => 0), 'sanree_brand_menu_order')) {
    $addsql1 = <<<EOF
INSERT INTO `pre_sanree_brand_menu_order` (`index`, `myalbum`, `dzgroup`, `goods`, `news`, `coupon`, `jobs`, `video`, `guestbook`, `ordinary`) VALUES
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
EOF;
    runquery($addsql1);
}
if ($pv * 1000 <= 1608) {
    setGroup();
}
if ($pv * 1000 <= 1430) {
    $addsql1 = <<<EOF
INSERT INTO `pre_sanree_brand_slide` (`ID`, `pic1`, `movie1`, `pic2`, `movie2`, `pic3`, `movie3`, `pic4`, `movie4`, `pic5`, `movie5`, `movie11`, `movie22`, `movie33`, `movie44`, `movie55`) VALUES
(2, '{pluginimg}/sad21.jpg', 'http://dx.sanree.com/', '{pluginimg}/sad22.jpg', 'http://dx.sanree.com/', '{pluginimg}/sad23.jpg', 'http://dx.sanree.com/', '{pluginimg}/sad24.jpg', 'http://dx.sanree.com/', '{pluginimg}/sad25.jpg', 'http://dx.sanree.com/', NULL, NULL, NULL, NULL, NULL);
EOF;
    runquery($addsql1);
}
if ($pv * 1000 <= 1408) {
    $addsql1 = <<<EOF
INSERT INTO `pre_sanree_brand_diytemplate` (`diytemplateid`, `name`, `content`, `uid`, `username`, `dateline`, `displayorder`, `status`, `issys`) VALUES 
(1, '{$installlang['blockclass_index_styletexttitle']}', '<div class="module cl xl">\\r\\n<ul>\\r\\n[loop]\\r\\n<li><a href="{url}"{target}>{brandname}</a></li>\\r\\n[/loop]\\r\\n</ul>\\r\\n</div>', 1, 'admin', 1349698114, 0, 1, 1), 
(2, '{$installlang['blockclass_index_styleimgtitle']}', '<div class="module cl xl">\\r\\n<ul>\\r\\n[loop]\\r\\n<li>\\r\\n<p><a href="{url}"{target}><img src="{pic}" width="{picwidth}" height="{picheight}" /></a></p>\\r\\n<p><a href="{url}"{target}>{brandname}</a></p>\\r\\n</li>\\r\\n[/loop]\\r\\n</ul>\\r\\n</div>', 1, 'admin', 1349746834, 0, 1, 1); 
EOF;
    runquery($addsql1);