$query = $db->query("SELECT username,ifadmin FROM pw_cmembers WHERE colonyid=" . S::sqlEscape($cyid) . ' AND uid IN(' . S::sqlImplode($selid) . ")"); while ($rt = $db->fetch_array($query)) { if ($rt['username'] == $colony['admin']) { Showmsg('colony_delfail'); } if ($groupid != 3 && $rt['ifadmin'] == '1' && $colony['admin'] != $windid) { Showmsg('colony_manager'); } $rt['ifadmin'] != -1 && $trueMemberCount++; $toUsers[] = $rt['username']; } //* $db->update("DELETE FROM pw_cmembers WHERE colonyid=" . S::sqlEscape($cyid) . " AND uid IN(" . S::sqlImplode($selid) . ")"); pwQuery::delete('pw_cmembers', 'colonyid=:colonyid AND uid IN (:uid)', array($cyid, $selid)); $newColony->updateInfoCount(array('members' => -$trueMemberCount)); $colony['members'] -= $trueMemberCount; updateGroupLevel($colony['id'], $colony); break; default: Showmsg('undefined_action'); } if ($toUsers) { M::sendNotice($toUsers, array('title' => getLangInfo('writemsg', 'o_' . $operateStep . '_title', array('cname' => S::escapeChar($colony['cname']))), 'content' => getLangInfo('writemsg', 'o_' . $operateStep . '_content', array('cname' => S::escapeChar($colony['cname']), 'curl' => "{$db_bbsurl}/{$basename}cyid={$cyid}")))); } refreshto("{$basename}", 'operate_success'); } } elseif ($a == 'fanoutmsg') { define('AJAX', 1); !$ifadmin && Showmsg('undefined_action'); if (empty($_POST['step'])) { S::gp(array('selid', 'group'), null, 2); $uids = $usernames = array();
$pwSQL['admin'] = $admin; } require_once A_P . 'lib/colonys.class.php'; $colonyServer = new PW_Colony(); if ($cid != $colony['classid']) { $cid = isset($o_classdb[$cid]) ? $cid : 0; $colonyServer->changeTopicToForum($cyid, $iftopicshowinforum, $cid, $colony['classid']); $pwSQL['classid'] = $cid; } elseif ($iftopicshowinforum != $colony['iftopicshowinforum'] && $colony['classid'] > 0) { $colonyServer->changeTopicShowInForum($cyid, $iftopicshowinforum, $colony['classid']); } $pwSQL['styleid'] = $styleid; //* $db->update("UPDATE pw_colonys SET " . S::sqlSingle($pwSQL) . ' WHERE id=' . S::sqlEscape($cyid)); pwQuery::update('pw_colonys', 'id=:id', array($cyid), $pwSQL); require_once R_P . 'u/require/core.php'; updateGroupLevel($cyid, $colony); adminmsg('operate_success', "{$basename}&action=editcolony"); } } elseif ($action == 'mergecolony') { if (empty($_POST['step'])) { require_once PrintApp('admin'); } else { $basename = $basename . '&action=mergecolony'; S::gp(array('fromcname', 'tocname'), ''); require_once A_P . 'lib/colony.class.php'; require_once A_P . 'lib/colonys.class.php'; $colonyServer = new PW_Colony(); if (!($colony = $colonyServer->getColonyByName($fromcname))) { adminmsg('源群组不存在!'); } if (!($toColony = $colonyServer->getColonyByName($tocname))) {
function updateInfoCount($info) { if (empty($info) || !is_array($info)) { return false; } $_sql_set = $extra = ''; foreach ($info as $key => $value) { if (in_array($key, array('tnum', 'pnum', 'members', 'albumnum', 'photonum', 'writenum', 'activitynum'))) { $_sql_set .= $extra . $key . '=' . $key . '+' . intval($value); $this->info[$key] += intval($value); $extra = ','; } } if (empty($_sql_set)) { return false; } //* $this->_db->update('UPDATE pw_colonys SET ' . $_sql_set . ' WHERE id=' . S::sqlEscape($this->cyid)); $this->_db->update(pwQuery::buildClause("UPDATE :pw_table SET {$_sql_set} WHERE id=:id", array('pw_colonys', $this->cyid))); require_once R_P . 'u/require/core.php'; updateGroupLevel($this->cyid, $this->info); }
function topicModify($tid, $postdata) { if ($postdata['ifcheck']) { $actions = '+'; $this->info['tnum']++; } else { $actions = '-'; $this->info['tnum']--; } //* $this->_db->update("UPDATE pw_colonys SET tnum=tnum{$actions}'1' WHERE id=" . S::sqlEscape($this->cyid)); $this->_db->update(pwQuery::buildClause("UPDATE :pw_table SET tnum=tnum{$actions}'1' WHERE id=:id", array('pw_colonys', $this->cyid))); updateGroupLevel($this->cyid, $this->info); }
} $db->update("UPDATE pw_cnlevel SET " . S::sqlSingle($config) . ' WHERE id=' . S::sqlEscape($id)); $basename .= '&action=level&job=edit&id=' . $id; adminmsg('operate_success'); } } elseif ($job == 'del') { define('AJAX', 1); S::gp(array('id'), 'GP', 2); if (empty($_POST['step'])) { $posthash = EncodeUrl("{$basename}&action=level&job=del&id={$id}"); require_once PrintApp('admin_ajax'); } else { $db->update("DELETE FROM pw_cnlevel WHERE id=" . S::sqlEscape($id)); echo "ok\t{$id}"; } updateGroupLevel(); ajax_footer(); } elseif ($job == 'upgrade') { if (empty($_POST['step'])) { require_once PrintApp('admin'); } else { S::gp(array('upgrade'), 'GP'); if (is_array($upgrade)) { foreach ($upgrade as $key => $value) { $upgrade[$key] = round($value, 2); } } $upgrade = serialize($upgrade); $db->pw_update("SELECT hk_name FROM pw_hack WHERE hk_name='o_groups_upgrade'", 'UPDATE pw_hack SET ' . S::sqlSingle(array('hk_value' => $upgrade, 'vtype' => 'array')) . " WHERE hk_name='o_groups_upgrade'", 'INSERT INTO pw_hack SET ' . S::sqlSingle(array('hk_name' => "o_groups_upgrade", 'vtype' => 'array', 'hk_value' => $upgrade))); updatecache_conf('o', true); $basename .= '&action=level&job=upgrade';