It would be nice to add a few staple functions to the core, ones that I use a lot for different purposes... here's a list I'd like have available (their names are arbitrary), can anyone think of others?
function qa_allow_check($opt) {
if(qa_opt($opt) == QA_PERMIT_POINTS)
return qa_get_logged_in_points() >= qa_opt($opt.'_points');
return !qa_permit_value_error(qa_opt($opt), qa_get_logged_in_userid(), qa_get_logged_in_level(), qa_get_logged_in_flags());
}
function qa_id_to_handle($uid) {
require_once QA_INCLUDE_DIR.'qa-app-users.php';
if (QA_FINAL_EXTERNAL_USERS) {
$publictouserid=qa_get_public_from_userids(array($uid));
$handle=@$publictouserid[$uid];
}
else {
$handle = qa_db_read_one_value(
qa_db_query_sub(
'SELECT handle FROM ^users WHERE userid = #',
$uid
),
true
);
}
if (!isset($handle)) return;
return $handle;
}
function qa_handle_to_id($handle) {
require_once QA_INCLUDE_DIR.'qa-app-users.php';
if (QA_FINAL_EXTERNAL_USERS) {
$publictouserid=qa_get_userids_from_public(array($handle));
$userid=@$publictouserid[$handle];
}
else {
$userid = qa_db_read_one_value(
qa_db_query_sub(
'SELECT userid FROM ^users WHERE handle = $',
$handle
),
true
);
}
if (!isset($userid)) return;
return $userid;
}
function qa_error_log($x) {
ob_start();
var_dump($x);
$contents = ob_get_contents();
ob_end_clean();
error_log($contents);
}