/* For licensing terms, see /dokeos_license.txt */
/**
* This file contains additional dropbox functions. Initially there were some
* functions in the init files also but I have moved them over
* to one file -- Patrick Cool <patrick.cool@UGent.be>, Ghent University
*/
/**
* This function is a wrapper function for the multiple actions feature.
* @return Mixed If there is a problem, return a string message, otherwise nothing
@ -137,11 +135,11 @@ function delete_category($action, $id)
// step 1: delete the category
$sql="DELETE FROM ".$dropbox_cnf['tbl_category']." WHERE cat_id='".Database::escape_string($id)."' AND $sentreceived='1'";
$result=Database::query($sql);
$result=Database::query($sql,__FILE__,__LINE__);
// step 2: delete all the documents in this category
$sql="SELECT * FROM ".$entries_table." WHERE cat_id='".Database::escape_string($id)."'";
$result=Database::query($sql);
$result=Database::query($sql,__FILE__,__LINE__);
while ($row=Database::fetch_array($result))
{
@ -227,7 +225,7 @@ function store_move($id, $target, $part)
WHERE dest_user_id='".Database::escape_string($_user['user_id'])."'
AND file_id='".Database::escape_string($id)."'
";
api_sql_query($sql,__FILE__,__LINE__);
Database::query($sql,__FILE__,__LINE__);
$return_message=get_lang('ReceivedFileMoved');
}
if ($part=='sent')
@ -236,7 +234,7 @@ function store_move($id, $target, $part)
WHERE uploader_id='".Database::escape_string($_user['user_id'])."'
AND id='".Database::escape_string($id)."'
";
api_sql_query($sql,__FILE__,__LINE__);
Database::query($sql,__FILE__,__LINE__);
$return_message=get_lang('SentFileMoved');
}
}
@ -325,8 +323,8 @@ function get_dropbox_categories($filter='')
$sql="SELECT * FROM ".$dropbox_cnf['tbl_category']." WHERE user_id='".$_user['user_id']."'";
$result=api_sql_query($sql);
while ($row=mysql_fetch_array($result))
$result=Database::query($sql,__FILE__,__LINE__);
while ($row=Database::fetch_array($result))
{
if(($filter=='sent' AND $row['sent']==1) OR ($filter=='received' AND $row['received']==1) OR $filter=='')
{
@ -382,7 +380,7 @@ function store_addcategory()
{
// step 3a, we check if the category doesn't already exist
$sql="SELECT * FROM ".$dropbox_cnf['tbl_category']." WHERE user_id='".$_user['user_id']."' AND cat_name='".Database::escape_string(Security::remove_XSS($_POST['category_name']))."' AND received='".$received."' AND sent='".$sent."'";
$result=api_sql_query($sql);
$result=Database::query($sql,__FILE__,__LINE__);
// step 3b, we add the category if it does not exist yet.
@ -390,7 +388,7 @@ function store_addcategory()
{
$sql="INSERT INTO ".$dropbox_cnf['tbl_category']." (cat_name, received, sent, user_id)
@ -427,7 +425,7 @@ function display_addcategory_form($category_name='', $id='',$action)
{
// retrieve the category we are editing
$sql="SELECT * FROM ".$dropbox_cnf['tbl_category']." WHERE cat_id='".Database::escape_string($id)."'";
$result=api_sql_query($sql);
$result=Database::query($sql,__FILE__,__LINE__);
$row=Database::fetch_array($result);
if ($category_name=='') // after an edit with an error we do not want to return to the original name but the name we already modified. (happens when createinrecievedfiles AND createinsentfiles are not checked)
@ -690,8 +688,8 @@ function getUserNameFromId ( $id) // RH: Mailing: return 'Mailing ' + id
$sql = "SELECT CONCAT(lastname,' ', firstname) AS name