} /* Perform the correct action based on the parsed request array */ if ($request[0] == "POST") { // if something sent via POST if ($id) { // if the ID is provided, it's supposed to be a reply to a thread $results = postToThread($id, $_POST); } else { // otherwise it's new thread $results = postNewThread($_POST); } } elseif ($request[0] == "GET") { // else if something via GET if ($id) { // id set, fetch certain thread $results = getThread($id); } else { // otherwise fetch them all $results = getAllThreads(); } } else { // if method is not "GET" nor "POST", it should not be allowed die("Invalid API Call: This method is not allowed"); } if (!$results) { // if $results is NULL something is wrong, show error die("Invalid API Call: Internal error"); } else { echo json_encode($results); } // otherwise JSON the results
InitGP(array_merge(array('auth'), $items)); $tmpArray = $changedArray = $updateArray = array(); foreach ($items as $v) { ${$v} && ($changedArray = array_merge(explode(',', ${$v}), $changedArray)); } $changedArray = array_unique($changedArray); empty($changedArray) && adminmsg('operate_error', "{$basename}&admintype=authentication&action=forumpost"); foreach ($changedArray as $value) { $updateArray[$value] = array('auth_cellphone' => $auth[$value]['cellphone'] ? 1 : 0, 'auth_alipay' => $auth[$value]['alipay'] ? 1 : 0, 'auth_certificate' => $auth[$value]['certificate'] ? 1 : 0, 'auth_allowread' => $auth[$value]['allowread'] ? 1 : 0, 'auth_allowpost' => $auth[$value]['allowpost'] ? 1 : 0, 'auth_allowrp' => $auth[$value]['allowrp'] ? 1 : 0, 'auth_allowupload' => $auth[$value]['allowupload'] ? 1 : 0, 'auth_logicalmethod' => $auth[$value]['logicalmethod'] ? 1 : 0); } updateForumset($updateArray); adminmsg('operate_success', "{$basename}&action=forumpost"); } } elseif ($action == 'forumcredit') { if (empty($step)) { list($catedb, $threaddb) = getAllThreads(); $space = '<i class="lower lower_a"></i>'; } elseif ($step == 2) { InitGP(array('auth')); $updateArray = array(); foreach ($auth as $key => $value) { !empty($value['cellphone']) && ($value['cellphone'] = $value['cellphone'] < 0 ? 0 : (int) $value['cellphone']); !empty($value['alipay']) && ($value['alipay'] = $value['alipay'] < 0 ? 0 : (int) $value['alipay']); !empty($value['certificate']) && ($value['certificate'] = $value['certificate'] < 0 ? 0 : (int) $value['certificate']); $updateArray[$key] = array('auth_cellphone_credit' => $value['cellphone'], 'auth_alipay_credit' => $value['alipay'], 'auth_certificate_credit' => $value['certificate']); } updateForumset($updateArray); adminmsg('operate_success', "{$basename}&action=forumcredit"); } } elseif ($action == 'static' || $action == 'smsbuy') { L::loadClass('client', 'utility/platformapisdk', false);