/** * page code function */ function PageCompMainCode() { global $memberID; global $groupID; global $arrGroup; global $site; $arrGroupFields = getDefaultGroupEditArr(); fillGroupArrByDBValues($arrGroupFields, $arrGroup); $arrErr = array(); if (isset($_POST['do_submit'])) { $arrOldGroupFields = $arrGroupFields; fillGroupArrByPostValues($arrGroupFields); $arrUpdGroupFields = compareUpdatedGroupFields($arrOldGroupFields, $arrGroupFields); if (!empty($arrUpdGroupFields)) { $arrErr = checkGroupErrors($arrUpdGroupFields); if (empty($arrErr)) { saveGroup($arrUpdGroupFields, $groupID); Header("Location: {$site['url']}group.php?ID={$groupID}"); exit; } } else { Header("Location: {$site['url']}group.php?ID={$groupID}"); exit; } } $res = genGroupEditForm($arrGroupFields, $arrErr, false, $groupID); return $res; }
/** * page code function */ function PageCompMainCode() { global $memberID; global $site; $arrNewGroup = getDefaultGroupEditArr(); $arrErr = array(); if (isset($_POST['do_submit'])) { fillGroupArrByPostValues($arrNewGroup); $arrErr = checkGroupErrors($arrNewGroup); if (md5($_POST['simg']) != $_COOKIE['strSec']) { $arrErr['simg'] = 'SIMG_ERR'; } unset($_COOKIE['strSec']); if (empty($arrErr)) { $arrNewGroup['creatorID'] = array('Name' => 'creatorID', 'Type' => 'text', 'Value' => $memberID); $newGroupID = saveGroup($arrNewGroup); if ($newGroupID) { addMember2Group($memberID, $newGroupID, 'Active'); $groupHomeLink = "{$site['url']}group.php?ID={$newGroupID}"; $res = _t('_Group creation successful', $groupHomeLink); $res .= "<br />"; $res .= _t('_Gallery upload_desc'); $res .= genUploadForm($newGroupID, true, true); } else { $res = _t('_Group creation unknown error'); } return $res; } } $res = genGroupEditForm($arrNewGroup, $arrErr, true); return $res; }
case 'getHaul': $results = getHaul($_REQUEST['op_id'], $_REQUEST['haul_id']); _toarray($results); break; case 'delHaul': delHaul($_REQUEST['haul_id']); $results['id'] = $_REQUEST['op_id']; $results['Hauls'] = getHaul($_REQUEST['op_id']); echo json_encode($results); break; ///// ///// ///// ///// case 'saveGroup': saveGroup($_REQUEST['group_id'], $_REQUEST['displayname'], $_REQUEST['url'], $_REQUEST['userids']); break; case 'getGroup': $results = getGroup($_REQUEST['user_id']); echo json_encode($results); break; ///// ///// ///// ///// case 'saveBuyer': $buyer_id = saveBuyer($_REQUEST['user_id']); echo json_encode($buyer_id); break; case 'rateBuyer': $rating_id = rateBuyer($_REQUEST['buyer_id'], $_REQUEST['user_id'], $_REQUEST['rateup']);
$data["nbGroup"] = $nbGroup; $data["nbIteration"] = $json["data"]["nbIteration"]; $data["users"] = $usersCaracterisitcs; $response = getJSONFromCodeError(200); $response["data"] = $data; $file = 'generator/data.json'; $current = file_get_contents($file); $current = json_encode($data, true); file_put_contents($file, $current); // Generation + sauvegarde $data = exec("py ./generator/" . $json["data"]["type"] . ".py"); // Reponse if ($data == null || $data == "") { $response = getJSONFromCodeError(600); } else { saveGroup(json_decode($data, true)); $response = getJSONFromCodeError(200); } echo json_encode($response); function saveGroup($data) { mysql_query("DELETE FROM `GROUP`"); mysql_query("DELETE FROM `USER_GROUP`"); foreach ($data["groups"] as $group) { mysql_query("INSERT INTO `GROUP`(`id`,`project_id`, `name`, `score`) VALUES ('" . $group["id"] . "','" . 1 . "','" . $group["name"] . "', '" . $group["score"] . "')"); } foreach ($data["users"] as $user) { mysql_query("INSERT INTO `USER_GROUP`(`user_id`, `group_id`) VALUES ('" . $user["id"] . "','" . $user["groupId"] . "')"); } } function getIdUserList()
switch ($region) { case 'sysinfo': // nothing to save here break; case 'datetime': saveDatetime($backend); break; case 'server': saveServer($backend); break; case 'seo': case 'frontend': case 'backend': case 'users': case 'system': saveGroup($backend, $region); break; case 'security': saveSecurity($backend); break; case 'mail': saveMail($backend); break; case 'searchblock': saveSearch($backend); break; case 'headers': saveHeaderfiles($backend); break; } if (count($err_msg)) {
function saveSecurity($backend) { $val = CAT_Helper_Validate::getInstance(); $enabled_captcha = $val->sanitizePost('enabled_captcha') == '1' ? '1' : '0'; $enabled_asp = $val->sanitizePost('enabled_asp') == '1' ? '1' : '0'; $captcha_type = $val->sanitizePost('captcha_type', NULL, true); // update database settings $backend->db()->query(sprintf("UPDATE `%smod_captcha_control` SET\n\t\tenabled_captcha = '%s', enabled_asp = '%s', captcha_type = '%s' ", CAT_TABLE_PREFIX, $enabled_captcha, $enabled_asp, $captcha_type)); // save text-captchas if ($captcha_type == 'text') { // ct_text $text_qa = $val->sanitizePost('text_qa', NULL, true); if (!preg_match('/### .*? ###/', $text_qa)) { $backend->db()->query(sprintf("UPDATE `%smod_captcha_control` SET ct_text = '%s'", CAT_TABLE_PREFIX, $text_qa)); } } // save the others saveGroup($backend, 'security'); }
</form> <br><br> <i>Sample (.csv, .xls): <a href="import_sample.csv">import_sample.csv</a></i> <?php } else { if ($_FILES["file"]["error"] > 0 || $read_only) { echo "Error: " . $_FILES["file"]["error"] . "<br />"; } else { $file_tmp_name = $_FILES["file"]["tmp_name"]; $file_lines = file($file_tmp_name, FILE_IGNORE_NEW_LINES); $file_name = $_FILES["file"]["name"]; include "include/import.common.php"; // // Save the group & addresses // $file_group_name = ""; if (count($ab) > 0) { $file_group_name = "@IMPORT-" . $file_name . "-" . Date("Y-m-j_H:i:s"); saveGroup($file_group_name); } foreach ($ab as $addressbook) { saveAddress($addressbook, $file_group_name); echo "- <b><i>" . getIfSet($addressbook, 'firstname') . trim(" " . getIfSet($addressbook, 'middlename')) . ", " . getIfSet($addressbook, 'lastname') . "</i></b>, " . getIfSet($addressbook, 'email') . ", " . getIfSet($addressbook, 'email2') . ", " . getIfSet($addressbook, 'company') . "<br>"; } echo "<br/><br/><div class='msgbox'>The " . $import_type . "-file '" . $_FILES["file"]["name"] . "' is imported into " . count($ab) . " records<br/>"; echo "<i>of the new group <a href='index{$page_ext}?group_name=" . $file_group_name . "'>" . $file_group_name . "</a></i></div>"; //*/ } } // end if(!$submit) include "include/footer.inc.php";
<?php include_once '../include/headers.php'; include_once '../include/dbutils.php'; include_once '../include/main.php'; include_once 'domain/groups.php'; db_connect(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $request_payload = file_get_contents('php://input'); //var_dump($request_payload); $json = json_decode($request_payload); $value = saveGroup($json); //return JSON array exit(json_encode($value)); }
$task = $mode; } switch ($task) { ##-- GROUPS ------------- case 'list_groups': showGroups($option); break; case 'group_add': editGroup(false); break; case 'group_edit': editGroup(true); break; case 'group_save': case 'group_apply': saveGroup(); break; case 'group_publish': publishItem('#__community_acl_groups', $cid, 1); break; case 'group_unpublish': publishItem('#__community_acl_groups', $cid, 0); break; case 'group_delete': deleteItem('#__community_acl_groups', $cid); break; case 'group_sync': changeItem('#__community_acl_groups', $cid, 1); break; case 'group_unsync': changeItem('#__community_acl_groups', $cid, 0);
updatecache_l(); adminmsg('operate_success', "{$basename}#2"); } elseif ($_POST['action'] == "vipedit") { S::gp(array('viptitle', 'vippic'), 'P', 0); $gid = saveGroup('special', array('title' => $viptitle['add'], 'img' => $vippic['add'], 'num' => 0)); unset($viptitle['add'], $vippic['add']); foreach ($viptitle as $key => $value) { $db->update("UPDATE pw_usergroups SET " . S::sqlSingle(array('grouptitle' => $value, 'groupimg' => $vippic[$key])) . " WHERE gptype='special' AND gid=" . S::sqlEscape($key)); //updatecache_g($key); /*update cache*/ } updatecache_l(); adminmsg('operate_success', "{$basename}#3"); } elseif ($action == 'addgroup') { S::gp(array('newtitle', 'newpic', 'gtype'), 'GP', 0); S::gp(array('newpost'), 'GP', 2); $gid = saveGroup($gtype, array('title' => array($newtitle), 'img' => array($newpic), 'num' => array($newpost))); $gid && ($basename = "{$admin_file}?adminjob=level&action=editgroup&gid={$gid}"); adminmsg('operate_success', $basename); } elseif ($action == "delgroup") { PostCheck($verify); S::gp(array('delid')); if ($delid < 7) { adminmsg('level_del'); } $db->update("DELETE FROM pw_usergroups WHERE gid=" . S::sqlEscape($delid)); //* P_unlink(D_P . "data/groupdb/group_$delid.php"); pwCache::deleteData(D_P . "data/groupdb/group_{$delid}.php"); updatecache_l(); adminmsg('operate_success'); } elseif ($action == "editgroup") { S::gp(array('gid', 'step'), 'GP', 2);
include_once dirname(__FILE__) . '/groups.html.php'; JArrayHelper::toInteger($cid); switch ($task) { case "new": editGroup($option, 0); break; case "edit": editGroup($option, $cid[0]); break; case "remove": removeGroup($cid); break; case "apply": case "saveg": case "save": saveGroup($option); break; case "cancel": cancelGroup($option); break; case "emailgroup": emailGroup($gid); break; case "sendemail": sendEmail($gid); break; case "show": default: showGroups($option); } function editGroup($option, $uid)