本文整理汇总了PHP中create_collection函数的典型用法代码示例。如果您正苦于以下问题:PHP create_collection函数的具体用法?PHP create_collection怎么用?PHP create_collection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_collection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createdbFirstModels
public static function createdbFirstModels()
{
$dbName = DatabaseConfig::DB_NAME;
$pdo = new PDO("mysql:host=localhost;dbname={$dbName}", 'root', '');
$tables = array_map(function ($t) {
return $t[0];
}, $pdo->query("SHOW TABLES")->fetchAll(PDO::FETCH_NUM));
foreach ($tables as $tableName) {
$columns = array_map(function ($c) {
return $c['Field'];
}, $pdo->query("SHOW COLUMNS FROM {$tableName}")->fetchAll(PDO::FETCH_ASSOC));
$repositoryNameSplitted = explode("_", $tableName);
for ($i = 0; $i < count($repositoryNameSplitted); $i++) {
$repositoryNameSplitted[$i] = ucfirst($repositoryNameSplitted[$i]);
}
$repositoryName = implode("", $repositoryNameSplitted);
$model = $repositoryName[strlen($repositoryName) - 1] == 's' ? substr($repositoryName, 0, strlen($repositoryName) - 1) : $repositoryName;
$repositoryName .= "Repository";
createRepositories($repositoryName, $model, $tableName, $columns);
$output = "";
$output .= self::generateClassInfo($model);
$output .= self::generateConstants($model, $tableName, $columns);
$output .= self::generateFields($model, $tableName, $columns);
$output .= self::generateConstructor($model, $tableName, $columns);
$output .= self::generateGettersAndSetters($model, $tableName, $columns);
$output .= self::generateObjectGeter($columns);
$output .= "}";
$modelFile = fopen("Models/" . $model . '.php', 'w');
fwrite($modelFile, $output);
$collectionsOutput = create_collection($model);
$collectionFile = fopen('Collections/' . $model . 'Collection.php', 'w');
fwrite($collectionFile, $collectionsOutput);
}
}
示例2:
add_smart_collection();
# Log this
daily_stat("Added smart collection",0);
}
$research=getvalescaped("research","");
if ($research!="")
{
hook("preresearch");
$col=get_research_request_collection($research);
if ($col==false)
{
$rr=get_research_request($research);
$name="Research: " . $rr["name"]; # Do not translate this string, the collection name is translated when displayed!
$new=create_collection ($rr["user"],$name,1);
set_user_collection($userref,$new);
set_research_collection($research,$new);
}
else
{
set_user_collection($userref,$col);
}
hook("postresearch");
}
hook("processusercommand");
?>
<?php
示例3: payment_set_complete
<?php
include "../include/db.php";
include "../include/authenticate.php";
include "../include/general.php";
include "../include/resource_functions.php";
include "../include/search_functions.php";
include "../include/collections_functions.php";
if (getval("purchaseonaccount", "") != "" && $userrequestmode == 3) {
# Invoice mode.
# Mark as payment complete.
payment_set_complete($usercollection);
# Set new user collection to empty the basket (without destroying the old basket which contains the 'paid' flag to enable the download).
$oldcollection = $usercollection;
$name = get_mycollection_name($userref);
$newcollection = create_collection($userref, $name, 0, 1);
// make not deletable
set_user_collection($userref, $newcollection);
# Redirect to basket (old) collection for download.
redirect($baseurl_short . "pages/purchase_download.php?collection=" . $oldcollection);
}
include "../include/header.php";
if (getval("submit", "") == "") {
# ------------------- Show the size selection screen -----------------------
?>
<div class="BasicsBox">
<h2> </h2>
<h1><?php
echo $lang["buynow"];
?>
</h1>
示例4: switch
echo "\r\n";
}
// decide whether to skip, create a single resource, or create a collection of resources
switch($att_count){
case 0:
skip_mail($imap,$current_message,"Nothing to upload",true);
break;
case 1:
echo "Found $att_count attachment\r\n";
break;
default:
echo "Found $att_count attachments. Collection will be created\r\n";
$build_collection=true;
$collection=create_collection($fromuser_ref,$subject);
echo "Creating Collection $collection : $subject \r\n";
}
// save attachments
$checkmail_archive_state=$checkmail_default_archive;
$access=$checkmail_default_access;
$resource_types=get_resource_types();
for ($n=0;$n<count($files);$n++){
$file=$files[$n];
foreach ($resource_types as $resource_type){
$safe_varname="resourcetype".$resource_type['ref'];
示例5: explode
$themearr = explode('||', getval("themestring", ''));
collection_set_themes($collection_add, $themearr);
}
}
if ($collection_add != "") {
# Switch to the selected collection (existing or newly created) and refresh the frame.
set_user_collection($userref, $collection_add);
refresh_collection_frame($collection_add);
}
if ($send_collection_to_admin && $archive == -1 && getvalescaped('ajax', 'false') == true && getvalescaped('ajax_action', '') == 'send_collection_to_admin') {
$collection_id = getvalescaped('collection', '');
if ($collection_id == '') {
exit;
}
// Create a copy of the collection for admin:
$admin_copy = create_collection(-1, $lang['send_collection_to_admin_emailedcollectionname']);
copy_collection($collection_id, $admin_copy);
$collection_id = $admin_copy;
// Get the user (or username) of the contributor:
$user = get_user($userref);
if (isset($user) && trim($user['fullname']) != '') {
$user = $user['fullname'];
} else {
$user = $user['username'];
}
// Get details about the collection:
$collection = get_collection($collection_id);
$collection_name = $collection['name'];
$resources_in_collection = count(get_collection_resources($collection_id));
// Build mail and send it:
$subject = $applicationname . ': ' . $lang['send_collection_to_admin_emailsubject'] . $user;
示例6: get_user_collections
}
}
}
# Get count of collections
$c = get_user_collections($userref);
# If the user has just deleted the collection they were using, select a new collection
if ($deleted_usercoll && count($c) > 0) {
# Select the first collection in the dropdown box.
$usercollection = $c[0]["ref"];
set_user_collection($userref, $usercollection);
}
# User has deleted their last collection? add a new one.
if (count($c) == 0) {
# No collections to select. Create them a new collection.
$name = get_mycollection_name($userref);
$usercollection = create_collection($userref, $name);
set_user_collection($userref, $usercollection);
}
refresh_collection_frame($usercollection);
}
hook('customcollectionmanage');
$removeall = getvalescaped("removeall", "");
if ($removeall != "") {
remove_all_resources_from_collection($removeall);
refresh_collection_frame($usercollection);
}
include "../include/header.php";
?>
<div class="BasicsBox">
<h2> </h2>
<h1><?php
示例7: get_session_collections
function get_session_collections($rs_session, $userref = "", $create = false)
{
$extrasql = "";
if ($userref != "") {
$extrasql = "and user='" . $userref . "'";
}
$collectionrefs = sql_array("select ref value from collection where session_id='" . $rs_session . "' " . $extrasql, "");
if (count($collectionrefs) < 1 && $create) {
$collectionrefs[0] = create_collection($userref, "My Collection", 0, 1);
# Do not translate this string!
}
return $collectionrefs;
}
示例8: get_allowed_extensions_by_type
if ($resource_type != "") {
$allowed_extensions = get_allowed_extensions_by_type($resource_type);
}
$alternative = getvalescaped("alternative", "");
# Batch upload alternative files (Java)
$replace = getvalescaped("replace", "");
# Replace Resource Batch
$replace_resource = getvalescaped("replace_resource", "");
# Option to replace existing resource file
# Create a new collection?
if ($collection_add == -1) {
# The user has chosen Create New Collection from the dropdown.
if ($collectionname == "") {
$collectionname = $lang["upload"] . " " . date("ymdHis");
}
$collection_add = create_collection($userref, $collectionname);
if (getval("public", '0') == 1) {
collection_set_public($collection_add);
}
if (strlen(getval("themestring", '')) > 0) {
$themearr = explode('||', getval("themestring", ''));
collection_set_themes($collection_add, $themearr);
}
}
if ($collection_add != "") {
# Switch to the selected collection (existing or newly created) and refresh the frame.
set_user_collection($userref, $collection_add);
refresh_collection_frame($collection_add);
}
#handle posts
if ($_FILES) {
示例9: new_user
function new_user($newuser)
{
# Username already exists?
$c=sql_value("select count(*) value from user where username='$newuser'",0);
if ($c>0) {return false;}
# Create a new user with username $newuser. Returns the created user reference.
sql_query("insert into user(username) values ('" . escape_check($newuser) . "')");
$newref=sql_insert_id();
# Create a collection for this user, the collection name is translated when displayed!
global $lang;
$new=create_collection($newref,"My Collection",0,1); # Do not translate this string!
# set this to be the user's current collection
sql_query("update user set current_collection='$new' where ref='$newref'");
return $newref;
}
示例10: managed_collection_request
function managed_collection_request($ref, $details, $ref_is_resource = false)
{
# Request mode 1
# Managed via the administrative interface
# An e-mail is still sent.
global $applicationname, $email_from, $baseurl, $email_notify, $username, $useremail, $userref, $lang, $request_senduserupdates, $watermark, $filename_field, $view_title_field, $access, $resource_type_request_emails, $manage_request_admin;
# Has a resource reference (instead of a collection reference) been passed?
# Manage requests only work with collections. Create a collection containing only this resource.
if ($ref_is_resource) {
$admin_mail_template = "emailresourcerequest";
$user_mail_template = "emailuserresourcerequest";
$resourcedata = get_resource_data($ref);
$templatevars['thumbnail'] = get_resource_path($ref, true, "thm", false, "jpg", $scramble = -1, $page = 1, $watermark ? $access == 1 ? true : false : false);
# Allow alternative configuration settings for this resource type
resource_type_config_override($resourcedata['resource_type']);
if (!file_exists($templatevars['thumbnail'])) {
$templatevars['thumbnail'] = "../gfx/" . get_nopreview_icon($resourcedata["resource_type"], $resourcedata["file_extension"], false);
}
$templatevars['url'] = $baseurl . "/?r=" . $ref;
if (isset($filename_field)) {
$templatevars["filename"] = $lang["fieldtitle-original_filename"] . ": " . get_data_by_field($ref, $filename_field);
}
if (isset($resourcedata["field" . $view_title_field])) {
$templatevars["title"] = $resourcedata["field" . $view_title_field];
}
$c = create_collection($userref, $lang["request"] . " " . date("ymdHis"));
add_resource_to_collection($ref, $c);
$ref = $c;
# Proceed as normal
} else {
$admin_mail_template = "emailcollectionrequest";
$user_mail_template = "emailusercollectionrequest";
$collectiondata = get_collection($ref);
$templatevars['url'] = $baseurl . "/?c=" . $ref;
if (isset($collectiondata["name"])) {
$templatevars["title"] = $collectiondata["name"];
}
}
# Fomulate e-mail text
$templatevars['username'] = $username;
$templatevars["useremail"] = $useremail;
$userdata = get_user($userref);
$templatevars["fullname"] = $userdata["fullname"];
$message = "";
reset($_POST);
foreach ($_POST as $key => $value) {
if (strpos($key, "_label") !== false) {
# Add custom field
$setting = trim($_POST[str_replace("_label", "", $key)]);
if ($setting != "") {
$message .= $value . ": " . $setting . "\n\n";
}
}
}
if (trim($details) != "") {
$message .= $lang["requestreason"] . ": " . newlines($details) . "\n\n";
} else {
return false;
}
# Add custom fields
$c = "";
global $custom_request_fields, $custom_request_required;
if (isset($custom_request_fields)) {
$custom = explode(",", $custom_request_fields);
# Required fields?
if (isset($custom_request_required)) {
$required = explode(",", $custom_request_required);
}
for ($n = 0; $n < count($custom); $n++) {
if (isset($required) && in_array($custom[$n], $required) && getval("custom" . $n, "") == "") {
return false;
# Required field was not set.
}
$message .= i18n_get_translated($custom[$n]) . ": " . getval("custom" . $n, "") . "\n\n";
}
}
# Create the request
global $request_query;
$request_query = "insert into request(user,collection,created,request_mode,status,comments) values ('{$userref}','{$ref}',now(),1,0,'" . escape_check($message) . "')";
global $notify_manage_request_admin, $assigned_to_user;
$notify_manage_request_admin = false;
// Manage individual requests of resources:
hook('autoassign_individual_requests', '', array($userref, $ref, $message, isset($collectiondata)));
if (isset($manage_request_admin) && !isset($collectiondata)) {
$query = sprintf("\n SELECT DISTINCT r.resource_type AS value\n FROM collection_resource AS cr\n INNER JOIN resource r ON cr.resource = r.ref\n WHERE cr.collection = '%s';\n ", $ref);
$request_resource_type = sql_value($query, 0);
if ($request_resource_type != 0 && array_key_exists($request_resource_type, $manage_request_admin)) {
$request_query = sprintf("\n INSERT INTO request(\n user,\n collection,\n created,\n request_mode,\n `status`,\n comments,\n assigned_to\n )\n VALUES (\n '%s',\n '%s',\n NOW(),\n 1,\n 0,\n '%s',\n '%s'\n );\n ", $userref, $ref, escape_check($message), $manage_request_admin[$request_resource_type]);
$assigned_to_user = get_user($manage_request_admin[$request_resource_type]);
$notify_manage_request_admin = true;
}
}
// Manage collection requests:
hook('autoassign_collection_requests', '', array($userref, isset($collectiondata) ? $collectiondata : array(), $message, isset($collectiondata)));
if (isset($manage_request_admin) && isset($collectiondata)) {
$all_r_types = get_resource_types();
foreach ($all_r_types as $r_type) {
$all_resource_types[] = $r_type['ref'];
}
$resources = get_collection_resources($collectiondata['ref']);
//.........这里部分代码省略.........
示例11: new_user
function new_user($newuser)
{
# Username already exists?
$c = sql_value("select count(*) value from user where username='{$newuser}'", 0);
if ($c > 0) {
return false;
}
# Create a new user with username $newuser. Returns the created user reference.
sql_query("insert into user(username) values ('" . escape_check($newuser) . "')");
$newref = sql_insert_id();
# Create a collection for this user
global $lang;
$new = create_collection($newref, $lang["mycollection"], 0, 1);
# set this to be the user's current collection
sql_query("update user set current_collection='{$new}' where ref='{$newref}'");
return $newref;
}
示例12: HookAutoassign_mrequestsAllAutoassign_collection_requests
function HookAutoassign_mrequestsAllAutoassign_collection_requests($user_ref, $collection_data, $message, $manage_collection_request)
{
global $manage_request_admin, $assigned_to_user, $email_notify, $lang, $baseurl, $applicationname, $request_query, $notify_manage_request_admin;
// Do not process this any further as this should only handle collection requests
if (!$manage_collection_request) {
return false;
}
$resources = get_collection_resources($collection_data['ref']);
$mapped_fields = get_mapped_fields();
$collection_resources_by_assigned_user = array();
$collections = array();
// Build the collections map between asigned user and resources the collection should contain
foreach ($resources as $resource) {
$resource_data = get_resource_field_data($resource);
$assigned_administrator = 0;
$resource_not_assigned = true;
foreach ($resource_data as $r_data) {
if (in_array($r_data['ref'], $mapped_fields)) {
$assigned_administrator = get_mapped_user_by_field($r_data['ref'], $r_data['value']);
if ($assigned_administrator === 0) {
$collection_resources_by_assigned_user['not_managed'][] = $resource;
} else {
$collection_resources_by_assigned_user[$assigned_administrator][] = $resource;
}
$resource_not_assigned = false;
break;
}
}
if ($resource_not_assigned && !isset($manage_request_admin)) {
$collection_resources_by_assigned_user['not_managed'][] = $resource;
}
}
// Create collections based on who is supposed to handle the request
foreach ($collection_resources_by_assigned_user as $assigned_user_id => $collection_resources) {
if ($assigned_user_id === 'not_managed') {
$collections['not_managed'] = create_collection($user_ref, $collection_data['name'] . ' request for unmanaged resources');
foreach ($collection_resources as $collection_resource_id) {
add_resource_to_collection($collection_resource_id, $collections['not_managed']);
}
continue;
}
$user = get_user($assigned_user_id);
$collections[$assigned_user_id] = create_collection($user_ref, $collection_data['name'] . ' request - managed by ' . $user['email']);
foreach ($collection_resources as $collection_resource_id) {
add_resource_to_collection($collection_resource_id, $collections[$assigned_user_id]);
}
// Attach assigned admin to this collection
add_collection($user['ref'], $collections[$assigned_user_id]);
}
if (!empty($collections)) {
foreach ($collections as $assigned_to => $collection_id) {
$assigned_to_user = get_user($assigned_to);
$request_query = sprintf("\n INSERT INTO request(\n user,\n collection,\n created,\n request_mode,\n `status`,\n comments,\n assigned_to\n )\n VALUES (\n '%s', # user\n '%s', # collection\n NOW(), # created\n 1, # request_mode\n 0, # status\n '%s', # comments\n '%s' # assigned_to\n );\n ", $user_ref, $collection_id, escape_check($message), $assigned_to);
if ($assigned_to === 'not_managed' || !$assigned_to_user) {
$assigned_to_user['email'] = $email_notify;
$request_query = sprintf("\n INSERT INTO request(\n user,\n collection,\n created,\n request_mode,\n `status`,\n comments\n )\n VALUES (\n '%s', # user\n '%s', # collection\n NOW(), # created\n 1, # request_mode\n 0, # status\n '%s' # comments\n );\n ", $user_ref, $collection_id, escape_check($message), $assigned_to);
}
sql_query($request_query);
$request = sql_insert_id();
// Send the mail:
$email_message = $lang['requestassignedtoyoumail'] . "\n\n" . $baseurl . "/?q=" . $request . "\n";
send_mail($assigned_to_user['email'], $applicationname . ': ' . $lang['requestassignedtoyou'], $email_message);
unset($email_message);
}
$notify_manage_request_admin = false;
}
// If we've got this far, make sure auto assigning managed requests based on resource types won't overwrite this
unset($manage_request_admin);
return true;
}
示例13: managed_collection_request
function managed_collection_request($ref, $details, $ref_is_resource = false)
{
# Request mode 1
# Managed via the administrative interface
# An e-mail is still sent.
global $applicationname, $email_from, $baseurl, $email_notify, $username, $useremail, $userref, $lang, $request_senduserupdates, $watermark, $filename_field, $view_title_field, $access, $resource_type_request_emails;
# Has a resource reference (instead of a collection reference) been passed?
# Manage requests only work with collections. Create a collection containing only this resource.
if ($ref_is_resource) {
$admin_mail_template = "emailresourcerequest";
$user_mail_template = "emailuserresourcerequest";
$resourcedata = get_resource_data($ref);
$templatevars['thumbnail'] = get_resource_path($ref, true, "thm", false, "jpg", $scramble = -1, $page = 1, $watermark ? $access == 1 ? true : false : false);
if (!file_exists($templatevars['thumbnail'])) {
$templatevars['thumbnail'] = "../gfx/" . get_nopreview_icon($resourcedata["resource_type"], $resourcedata["file_extension"], false);
}
$templatevars['url'] = $baseurl . "/?r=" . $ref;
if (isset($filename_field)) {
$templatevars["filename"] = $lang["fieldtitle-original_filename"] . ": " . get_data_by_field($ref, $filename_field);
}
if (isset($resourcedata["field" . $view_title_field])) {
$templatevars["title"] = $resourcedata["field" . $view_title_field];
}
$c = create_collection($userref, $lang["request"] . " " . date("ymdHis"));
add_resource_to_collection($ref, $c);
$ref = $c;
# Proceed as normal
} else {
$admin_mail_template = "emailcollectionrequest";
$user_mail_template = "emailusercollectionrequest";
$collectiondata = get_collection($ref);
$templatevars['url'] = $baseurl . "/?c=" . $ref;
if (isset($collectiondata["name"])) {
$templatevars["title"] = $collectiondata["name"];
}
}
# Fomulate e-mail text
$templatevars['username'] = $username;
$templatevars["useremail"] = $useremail;
$userdata = get_user($userref);
$templatevars["fullname"] = $userdata["fullname"];
$message = "";
reset($_POST);
foreach ($_POST as $key => $value) {
if (strpos($key, "_label") !== false) {
# Add custom field
$setting = trim($_POST[str_replace("_label", "", $key)]);
if ($setting != "") {
$message .= $value . ": " . $setting . "\n\n";
}
}
}
if (trim($details) != "") {
$message .= $lang["requestreason"] . ": " . newlines($details) . "\n\n";
} else {
return false;
}
# Add custom fields
$c = "";
global $custom_request_fields, $custom_request_required;
if (isset($custom_request_fields)) {
$custom = explode(",", $custom_request_fields);
# Required fields?
if (isset($custom_request_required)) {
$required = explode(",", $custom_request_required);
}
for ($n = 0; $n < count($custom); $n++) {
if (isset($required) && in_array($custom[$n], $required) && getval("custom" . $n, "") == "") {
return false;
# Required field was not set.
}
$message .= i18n_get_translated($custom[$n]) . ": " . getval("custom" . $n, "") . "\n\n";
}
}
# Create the request
sql_query("insert into request(user,collection,created,request_mode,status,comments) values ('{$userref}','{$ref}',now(),1,0,'" . escape_check($message) . "')");
$request = sql_insert_id();
$templatevars["request_id"] = $request;
$templatevars["requesturl"] = $baseurl . "/?q=" . $request;
$templatevars["requestreason"] = $message;
hook("afterrequestcreate", "", array($request));
# Check if alternative request email notification address is set, only valid if collection contains resources of the same type
$admin_notify_email = $email_notify;
if (isset($resource_type_request_emails)) {
$requestrestypes = array_unique(sql_array("select r.resource_type as value from collection_resource cr left join resource r on cr.resource=r.ref where cr.collection='{$ref}'"));
if (count($requestrestypes) == 1 && isset($resource_type_request_emails[$requestrestypes[0]])) {
$admin_notify_email = $resource_type_request_emails[$requestrestypes[0]];
}
}
# Send the e-mail
$userconfirmmessage = $lang["requestsenttext"] . "<br /><br />{$message}<br /><br />" . $lang["clicktoviewresource"] . "<br />{$baseurl}/?c={$ref}";
$message = $lang["user_made_request"] . "<br /><br />" . $lang["username"] . ": " . $username . "<br />{$message}<br /><br />";
$message .= $lang["clicktoviewresource"] . "<br />{$baseurl}/?q={$request}";
send_mail($admin_notify_email, $applicationname . ": " . $lang["requestcollection"] . " - {$ref}", $message, $useremail, $useremail, $admin_mail_template, $templatevars);
if ($request_senduserupdates) {
send_mail($useremail, $applicationname . ": " . $lang["requestsent"] . " - {$ref}", $userconfirmmessage, $email_from, $email_notify, $user_mail_template, $templatevars);
}
# Increment the request counter
sql_query("update resource set request_count=request_count+1 where ref='{$ref}'");
return true;
//.........这里部分代码省略.........
示例14: printJson
printJson($delete);
}
// CREATE
// ============================================================
// - create a new collection
// ============================================================
// create a new collection
// returns id of new collection
if ($create_collection && $collection_name && $user_id) {
$allowchanges = 1;
$cant_delete = 0;
$collection_name = urldecode($collection_name);
if ($remove_unserscore) {
$collection_name = str_replace('_', ' ', $collection_name);
}
$create = create_collection($user_id, $collection_name, $allowchanges, $cant_delete);
$create = array('new_collection' => $create);
printJson($create);
}
// UPDATE
// ============================================================
// - set a new user to a file
// - set file size : no size set when file uploaded by API, execute after file upload
// - rename a file
// - rename a collection
// - move file to another collection
// ============================================================
// set a new user to a file
if ($set && $file_id && $user_id) {
$setUser = sql_query("UPDATE resource SET created_by='{$user_id}' WHERE ref='{$file_id}'");
$newUser = array('new_user' => $user_id, 'file' => $file_id);
示例15: trim
$useremail = $userdata[0]["email"];
$userpassword = $userdata[0]["password"];
$userfullname = $userdata[0]["fullname"];
if (!isset($userfixedtheme)) {
$userfixedtheme = $userdata[0]["fixed_theme"];
}
# only set if not set in config.php
$ip_restrict_group = trim($userdata[0]["ip_restrict_group"]);
$ip_restrict_user = trim($userdata[0]["ip_restrict_user"]);
$usercollection = $userdata[0]["current_collection"];
if ($usercollection == 0 || !is_numeric($usercollection)) {
# Create a collection for this user
global $lang;
include_once "collections_functions.php";
# Make sure collections functions are included before create_collection
$usercollection = create_collection($userref, $lang["mycollection"], 0, 1);
# set this to be the user's current collection
sql_query("update user set current_collection='{$usercollection}' where ref='{$userref}'");
}
$usersearchfilter = $userdata[0]["search_filter"];
$usereditfilter = $userdata[0]["edit_filter"];
$userresourcedefaults = $userdata[0]["resource_defaults"];
$userrequestmode = trim($userdata[0]["request_mode"]);
# Some alternative language choices for basket mode / e-commerce
if ($userrequestmode == 2 || $userrequestmode == 3) {
$lang["addtocollection"] = $lang["addtobasket"];
$lang["action-addtocollection"] = $lang["addtobasket"];
$lang["addtocurrentcollection"] = $lang["addtobasket"];
$lang["requestaddedtocollection"] = $lang["buyitemaddedtocollection"];
$lang["action-request"] = $lang["addtobasket"];
# The request button (renamed "Buy" by the line above) should always add the item to the current collection.