Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 603988
Collapse All | Expand All

(-)a/cite/formats/cite_ascii.php (-1 / +1 lines)
Lines 94-100 Link Here
94
		// LOOP OVER EACH RECORD:
94
		// LOOP OVER EACH RECORD:
95
		// Fetch one page of results (or less if on the last page)
95
		// Fetch one page of results (or less if on the last page)
96
		// (i.e., upto the limit specified in $showMaxRows) fetch a row into the $row array and ...
96
		// (i.e., upto the limit specified in $showMaxRows) fetch a row into the $row array and ...
97
		for ($rowCounter=0; (($rowCounter < $showMaxRows) && ($row = @ mysql_fetch_array($result))); $rowCounter++)
97
		for ($rowCounter=0; (($rowCounter < $showMaxRows) && ($row = @ $result->fetch_array())); $rowCounter++)
98
		{
98
		{
99
			foreach ($row as $rowFieldName => $rowFieldValue)
99
			foreach ($row as $rowFieldName => $rowFieldValue)
100
				// Apply search & replace 'actions' to all fields that are listed in the 'fields' element of the arrays contained in '$plainTextSearchReplaceActionsArray':
100
				// Apply search & replace 'actions' to all fields that are listed in the 'fields' element of the arrays contained in '$plainTextSearchReplaceActionsArray':
(-)a/cite/formats/cite_html.php (-1 / +1 lines)
Lines 113-119 Link Here
113
		// LOOP OVER EACH RECORD:
113
		// LOOP OVER EACH RECORD:
114
		// Fetch one page of results (or less if on the last page)
114
		// Fetch one page of results (or less if on the last page)
115
		// (i.e., upto the limit specified in $showRows) fetch a row into the $row array and ...
115
		// (i.e., upto the limit specified in $showRows) fetch a row into the $row array and ...
116
		for ($rowCounter=0; (($rowCounter < $showRows) && ($row = @ mysql_fetch_array($result))); $rowCounter++)
116
		for ($rowCounter=0; (($rowCounter < $showRows) && ($row = @ $result->fetch_array())); $rowCounter++)
117
		{
117
		{
118
			$encodedRowData = $row; // we keep '$row' in its original (unencoded) form since unencoded data will be required by function 'linkifyFieldItems()' below
118
			$encodedRowData = $row; // we keep '$row' in its original (unencoded) form since unencoded data will be required by function 'linkifyFieldItems()' below
119
119
(-)a/cite/formats/cite_latex.php (-1 / +1 lines)
Lines 130-136 Link Here
130
		// LOOP OVER EACH RECORD:
130
		// LOOP OVER EACH RECORD:
131
		// Fetch one page of results (or less if on the last page)
131
		// Fetch one page of results (or less if on the last page)
132
		// (i.e., upto the limit specified in $showMaxRows) fetch a row into the $row array and ...
132
		// (i.e., upto the limit specified in $showMaxRows) fetch a row into the $row array and ...
133
		for ($rowCounter=0; (($rowCounter < $showMaxRows) && ($row = @ mysql_fetch_array($result))); $rowCounter++)
133
		for ($rowCounter=0; (($rowCounter < $showMaxRows) && ($row = @ $result->fetch_array())); $rowCounter++)
134
		{
134
		{
135
			foreach ($row as $rowFieldName => $rowFieldValue)
135
			foreach ($row as $rowFieldName => $rowFieldValue)
136
				// Apply search & replace 'actions' to all fields that are listed in the 'fields' element of the arrays contained in '$latexSearchReplaceActionsArray':
136
				// Apply search & replace 'actions' to all fields that are listed in the 'fields' element of the arrays contained in '$latexSearchReplaceActionsArray':
(-)a/cite/formats/cite_latex_bbl.php (-1 / +1 lines)
Lines 182-188 Link Here
182
		// LOOP OVER EACH RECORD:
182
		// LOOP OVER EACH RECORD:
183
		// Fetch one page of results (or less if on the last page)
183
		// Fetch one page of results (or less if on the last page)
184
		// (i.e., upto the limit specified in $showMaxRows) fetch a row into the $row array and ...
184
		// (i.e., upto the limit specified in $showMaxRows) fetch a row into the $row array and ...
185
		for ($rowCounter=0; (($rowCounter < $showMaxRows) && ($row = @ mysql_fetch_array($result))); $rowCounter++)
185
		for ($rowCounter=0; (($rowCounter < $showMaxRows) && ($row = @ $result->fetch_array())); $rowCounter++)
186
		{
186
		{
187
			foreach ($row as $rowFieldName => $rowFieldValue)
187
			foreach ($row as $rowFieldName => $rowFieldValue)
188
				// Apply search & replace 'actions' to all fields that are listed in the 'fields' element of the arrays contained in '$latexSearchReplaceActionsArray':
188
				// Apply search & replace 'actions' to all fields that are listed in the 'fields' element of the arrays contained in '$latexSearchReplaceActionsArray':
(-)a/cite/formats/cite_markdown.php (-1 / +1 lines)
Lines 92-98 Link Here
92
		// LOOP OVER EACH RECORD:
92
		// LOOP OVER EACH RECORD:
93
		// Fetch one page of results (or less if on the last page)
93
		// Fetch one page of results (or less if on the last page)
94
		// (i.e., upto the limit specified in $showMaxRows) fetch a row into the $row array and ...
94
		// (i.e., upto the limit specified in $showMaxRows) fetch a row into the $row array and ...
95
		for ($rowCounter=0; (($rowCounter < $showMaxRows) && ($row = @ mysql_fetch_array($result))); $rowCounter++)
95
		for ($rowCounter=0; (($rowCounter < $showMaxRows) && ($row = @ $result->fetch_array())); $rowCounter++)
96
		{
96
		{
97
			foreach ($row as $rowFieldName => $rowFieldValue)
97
			foreach ($row as $rowFieldName => $rowFieldValue)
98
				// Apply search & replace 'actions' to all fields that are listed in the 'fields' element of the arrays contained in '$markdownSearchReplaceActionsArray':
98
				// Apply search & replace 'actions' to all fields that are listed in the 'fields' element of the arrays contained in '$markdownSearchReplaceActionsArray':
(-)a/cite/formats/cite_pdf.php (-1 / +1 lines)
Lines 181-187 Link Here
181
		// LOOP OVER EACH RECORD:
181
		// LOOP OVER EACH RECORD:
182
		// Fetch one page of results (or less if on the last page)
182
		// Fetch one page of results (or less if on the last page)
183
		// (i.e., upto the limit specified in $showMaxRows) fetch a row into the $row array and ...
183
		// (i.e., upto the limit specified in $showMaxRows) fetch a row into the $row array and ...
184
		for ($rowCounter=0; (($rowCounter < $showMaxRows) && ($row = @ mysql_fetch_array($result))); $rowCounter++)
184
		for ($rowCounter=0; (($rowCounter < $showMaxRows) && ($row = @ $result->fetch_array())); $rowCounter++)
185
		{
185
		{
186
			foreach ($row as $rowFieldName => $rowFieldValue)
186
			foreach ($row as $rowFieldName => $rowFieldValue)
187
				// Apply search & replace 'actions' to all fields that are listed in the 'fields' element of the arrays contained in '$pdfSearchReplaceActionsArray':
187
				// Apply search & replace 'actions' to all fields that are listed in the 'fields' element of the arrays contained in '$pdfSearchReplaceActionsArray':
(-)a/cite/formats/cite_rtf.php (-1 / +1 lines)
Lines 113-119 Link Here
113
		// LOOP OVER EACH RECORD:
113
		// LOOP OVER EACH RECORD:
114
		// Fetch one page of results (or less if on the last page)
114
		// Fetch one page of results (or less if on the last page)
115
		// (i.e., upto the limit specified in $showMaxRows) fetch a row into the $row array and ...
115
		// (i.e., upto the limit specified in $showMaxRows) fetch a row into the $row array and ...
116
		for ($rowCounter=0; (($rowCounter < $showMaxRows) && ($row = @ mysql_fetch_array($result))); $rowCounter++)
116
		for ($rowCounter=0; (($rowCounter < $showMaxRows) && ($row = @ $result->fetch_array())); $rowCounter++)
117
		{
117
		{
118
			foreach ($row as $rowFieldName => $rowFieldValue)
118
			foreach ($row as $rowFieldName => $rowFieldValue)
119
				// Apply search & replace 'actions' to all fields that are listed in the 'fields' element of the arrays contained in '$rtfSearchReplaceActionsArray':
119
				// Apply search & replace 'actions' to all fields that are listed in the 'fields' element of the arrays contained in '$rtfSearchReplaceActionsArray':
(-)a/contrib/mediawiki/refbase.php (-5 / +4 lines)
Lines 81-98 Link Here
81
  		"/ +- +/"              =>  " &#8211; "
81
  		"/ +- +/"              =>  " &#8211; "
82
  	);
82
  	);
83
83
84
    $link = mysql_connect($hostName, $username, $password);
84
    $link = new mysqli($hostName, $username, $password, $databaseName);
85
    if (! $link)
85
    if (! $link)
86
      die("Couldn't connect to MySQL");
86
      die("Couldn't connect to MySQL");
87
    mysql_select_db($databaseName, $link) or die("Couldn't open $db: ".mysql_error());
88
87
89
    //select the new updated values
88
    //select the new updated values
90
    $result = mysql_query( "SELECT type, author, title, year, publication, volume, issue, pages, publisher, place, language, issn, doi FROM $tableRefs where serial=$input" )
89
    $result = $link->query( "SELECT type, author, title, year, publication, volume, issue, pages, publisher, place, language, issn, doi FROM $tableRefs where serial=$input" )
91
      or die("SELECT Error: ".mysql_error());
90
      or die("SELECT Error: ".$link->error);
92
91
93
    $cite = "";
92
    $cite = "";
94
93
95
    while ($row = mysql_fetch_array($result)) {
94
    while ($row = $result->fetch_array()) {
96
      if ($row["type"]=="Journal Article"){
95
      if ($row["type"]=="Journal Article"){
97
        $cite .= "{{cite_journal|url=$databaseBaseURL"."show.php?record=$input|";
96
        $cite .= "{{cite_journal|url=$databaseBaseURL"."show.php?record=$input|";
98
        if(!empty($row["author"])){
97
        if(!empty($row["author"])){
(-)a/duplicate_modify.php (-1 / +1 lines)
Lines 158-164 Link Here
158
	foreach($queryArray as $query)
158
	foreach($queryArray as $query)
159
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
159
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
160
160
161
	$affectedRows = ($result ? mysql_affected_rows ($connection) : 0); // get the number of rows that were modified (or return 0 if an error occurred)
161
	$affectedRows = ($result ? $connection->affected_rows : 0); // get the number of rows that were modified (or return 0 if an error occurred)
162
162
163
	if ($affectedRows == 0) // no rows were affected by the update
163
	if ($affectedRows == 0) // no rows were affected by the update
164
	{
164
	{
(-)a/includes/atomxml.inc.php (-1 / +1 lines)
Lines 295-301 Link Here
295
			$exportArray = array(); // array for individually exported records
295
			$exportArray = array(); // array for individually exported records
296
296
297
			// Generate the export for each record and push them onto an array:
297
			// Generate the export for each record and push them onto an array:
298
			for ($rowCounter=0; (($rowCounter < $showRows) && ($row = @ mysql_fetch_array($result))); $rowCounter++)
298
			for ($rowCounter=0; (($rowCounter < $showRows) && ($row = @ $result->fetch_array())); $rowCounter++)
299
			{
299
			{
300
				// Export the current record as Atom XML entry:
300
				// Export the current record as Atom XML entry:
301
				$entry = atomEntry($row, $markupPatternsArray);
301
				$entry = atomEntry($row, $markupPatternsArray);
(-)a/includes/include.inc.php (-54 / +52 lines)
Lines 224-231 Link Here
224
		{
224
		{
225
			// (1) OPEN the database connection:
225
			// (1) OPEN the database connection:
226
			//      (variables are set by include file 'db.inc.php'!)
226
			//      (variables are set by include file 'db.inc.php'!)
227
			if (!($connection = @ mysql_connect($hostName, $username, $password)))
227
			if (!($connection = @ new mysqli($hostName, $username, $password, $databaseName)))
228
				if (mysql_errno() != 0) // this works around a stupid(?) behaviour of the Roxen webserver that returns 'errno: 0' on success! ?:-(
228
				if (mysqli_connect_error()) // this works around a stupid(?) behaviour of the Roxen webserver that returns 'errno: 0' on success! ?:-(
229
					showErrorMsg("The following error occurred while trying to connect to the host:");
229
					showErrorMsg("The following error occurred while trying to connect to the host:");
230
230
231
			//     Get the MySQL version and save it to a session variable:
231
			//     Get the MySQL version and save it to a session variable:
Lines 242-253 Link Here
242
				else
242
				else
243
					queryMySQLDatabase("SET NAMES latin1"); // by default, we establish a 'latin1' connection
243
					queryMySQLDatabase("SET NAMES latin1"); // by default, we establish a 'latin1' connection
244
			}
244
			}
245
246
			// (3) SELECT the database:
247
			//      (variables are set by include file 'db.inc.php'!)
248
			if (!(mysql_select_db($databaseName, $connection)))
249
				if (mysql_errno() != 0) // this works around a stupid(?) behaviour of the Roxen webserver that returns 'errno: 0' on success! ?:-(
250
					showErrorMsg("The following error occurred while trying to connect to the database:");
251
		}
245
		}
252
	}
246
	}
253
247
Lines 262-269 Link Here
262
		global $client;
256
		global $client;
263
257
264
		// (3) RUN the query on the database through the connection:
258
		// (3) RUN the query on the database through the connection:
265
		if (!($result = @ mysql_query($query, $connection)))
259
		if (!($result = @ $connection->query($query)))
266
			if (mysql_errno() != 0) // this works around a stupid(?) behaviour of the Roxen webserver that returns 'errno: 0' on success! ?:-(
267
			{
260
			{
268
				if (isset($client) AND preg_match("/^cli/i", $client)) // if the query originated from a command line client such as the "refbase" CLI client ("cli-refbase-1.0")
261
				if (isset($client) AND preg_match("/^cli/i", $client)) // if the query originated from a command line client such as the "refbase" CLI client ("cli-refbase-1.0")
269
					// note that we also HTML encode the query for CLI clients since a malicious user could use the client parameter to perform a cross-site scripting (XSS) attack
262
					// note that we also HTML encode the query for CLI clients since a malicious user could use the client parameter to perform a cross-site scripting (XSS) attack
Lines 285-292 Link Here
285
278
286
		if (isset($connection))
279
		if (isset($connection))
287
			// (5) CLOSE the database connection:
280
			// (5) CLOSE the database connection:
288
			if (!(mysql_close($connection)))
281
			if (!($connection->close()))
289
				if (mysql_errno() != 0) // this works around a stupid(?) behaviour of the Roxen webserver that returns 'errno: 0' on success! ?:-(
290
					showErrorMsg("The following error occurred while trying to disconnect from the database:");
282
					showErrorMsg("The following error occurred while trying to disconnect from the database:");
291
	}
283
	}
292
284
Lines 301-307 Link Here
301
293
302
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection
294
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection
303
295
304
		$row = mysql_fetch_row($result); // fetch the current row into the array $row (it'll be always *one* row, but anyhow)
296
		$row = $result->fetch_row(); // fetch the current row into the array $row (it'll be always *one* row, but anyhow)
305
		$mysqlVersionString = $row[0]; // extract the contents of the first (and only) row (returned version string will be something like "4.0.20-standard" etc.)
297
		$mysqlVersionString = $row[0]; // extract the contents of the first (and only) row (returned version string will be something like "4.0.20-standard" etc.)
306
		$mysqlVersion = preg_replace("/^(\d+\.\d+).+/", "\\1", $mysqlVersionString); // extract main version number (e.g. "4.0") from version string
298
		$mysqlVersion = preg_replace("/^(\d+\.\d+).+/", "\\1", $mysqlVersionString); // extract main version number (e.g. "4.0") from version string
307
299
Lines 313-325 Link Here
313
	// Get MySQL field info:
305
	// Get MySQL field info:
314
	// (i.e. fetch field (column) information from a given result resource; returns the
306
	// (i.e. fetch field (column) information from a given result resource; returns the
315
	//  field property given in '$propertyName', else an array of all field properties;
307
	//  field property given in '$propertyName', else an array of all field properties;
316
	//  see <http://www.php.net/mysql_fetch_field>)
308
	//  see <http://www.php.net/mysqli_fetch_field>)
317
	function getMySQLFieldInfo($result, $fieldOffset, $propertyName = "")
309
	function getMySQLFieldInfo($result, $fieldOffset, $propertyName = "")
318
	{
310
	{
319
		$fieldInfoArray = array();
311
		$fieldInfoArray = array();
320
312
321
		// Get field (column) metadata:
313
		// Get field (column) metadata:
322
		$fieldInfo = mysql_fetch_field($result, (int)$fieldOffset); // returns an object containing the field information
314
		$fieldInfo = $result->fetch_field_direct((int)$fieldOffset); // returns an object containing the field information
323
315
324
		// Copy object properties to an array:
316
		// Copy object properties to an array:
325
		$fieldInfoArray["name"]         = $fieldInfo->name;         // column name
317
		$fieldInfoArray["name"]         = $fieldInfo->name;         // column name
Lines 351-357 Link Here
351
	function seekInMySQLResultsToOffset($result, $rowOffset, $showRows, $displayType, $citeType)
343
	function seekInMySQLResultsToOffset($result, $rowOffset, $showRows, $displayType, $citeType)
352
	{
344
	{
353
		// Find out how many rows are available:
345
		// Find out how many rows are available:
354
		$rowsFound = @ mysql_num_rows($result);
346
		$rowsFound = @ $result->num_rows;
355
		if ($rowsFound > 0) // If there were rows found ...
347
		if ($rowsFound > 0) // If there were rows found ...
356
		{
348
		{
357
			// ... setup variables in order to facilitate "previous" & "next" browsing:
349
			// ... setup variables in order to facilitate "previous" & "next" browsing:
Lines 396-402 Link Here
396
			$nextOffset = $rowOffset + $showRows;
388
			$nextOffset = $rowOffset + $showRows;
397
389
398
			// d) Seek to the current offset
390
			// d) Seek to the current offset
399
			mysql_data_seek($result, $rowOffset); // move internal result pointer to the row number given in '$rowOffset'
391
			$result->data_seek($rowOffset); // move internal result pointer to the row number given in '$rowOffset'
400
		}
392
		}
401
		else // set variables to zero in order to prevent 'Undefined variable...' messages when nothing was found ('$rowsFound = 0'):
393
		else // set variables to zero in order to prevent 'Undefined variable...' messages when nothing was found ('$rowsFound = 0'):
402
		{
394
		{
Lines 421-429 Link Here
421
	function showErrorMsg($headerMsg)
413
	function showErrorMsg($headerMsg)
422
	{
414
	{
423
		global $client;
415
		global $client;
416
		global $connection;
424
417
425
		$errorNo = mysql_errno();
418
		$errorNo = mysqli_connect_errno();
426
		$errorMsg = mysql_error();
419
		$errorMsg = mysqli_connect_error();
427
420
428
		if (preg_match("/^cli/i", $client)) // if the query originated from a command line client such as the "refbase" CLI client ("cli-refbase-1.0")
421
		if (preg_match("/^cli/i", $client)) // if the query originated from a command line client such as the "refbase" CLI client ("cli-refbase-1.0")
429
			// note that we also HTML encode the '$errorMsg' for CLI clients since a malicious user could use the client parameter to perform a cross-site scripting (XSS) attack
422
			// note that we also HTML encode the '$errorMsg' for CLI clients since a malicious user could use the client parameter to perform a cross-site scripting (XSS) attack
Lines 631-637 Link Here
631
		$query = "SELECT user_id FROM $tableAuth WHERE email = " . quote_smart($emailAddress);
624
		$query = "SELECT user_id FROM $tableAuth WHERE email = " . quote_smart($emailAddress);
632
625
633
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection
626
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection
634
		$row = mysql_fetch_array($result);
627
		$row = $result->fetch_array();
635
628
636
		return($row["user_id"]);
629
		return($row["user_id"]);
637
	}
630
	}
Lines 944-950 Link Here
944
						$result = queryMySQLDatabase($queryRefs);
937
						$result = queryMySQLDatabase($queryRefs);
945
938
946
						// Get the record id that was created:
939
						// Get the record id that was created:
947
						$serialNo = @ mysql_insert_id($connection); // find out the unique ID number of the newly created record (Note: this function should be called immediately after the
940
						$serialNo = @ $connection->insert_id; // find out the unique ID number of the newly created record (Note: this function should be called immediately after the
948
						                                            // SQL INSERT statement! After any subsequent query it won't be possible to retrieve the auto_increment identifier value for THIS record!)
941
						                                            // SQL INSERT statement! After any subsequent query it won't be possible to retrieve the auto_increment identifier value for THIS record!)
949
942
950
						// ADD USER DATA:
943
						// ADD USER DATA:
Lines 3736-3745 Link Here
3736
3729
3737
		$foundSerialsArray = array(); // initialize array variable (which will hold the serial numbers of all found records)
3730
		$foundSerialsArray = array(); // initialize array variable (which will hold the serial numbers of all found records)
3738
3731
3739
		$rowsFound = @ mysql_num_rows($result);
3732
		$rowsFound = @ $result->num_rows;
3740
		if ($rowsFound > 0) // If there were rows found ...
3733
		if ($rowsFound > 0) // If there were rows found ...
3741
		{
3734
		{
3742
			while ($row = @ mysql_fetch_array($result)) // for all rows found
3735
			while ($row = @ $result->fetch_array()) // for all rows found
3743
			{
3736
			{
3744
				$recordID = $row["record_id"]; // get the serial number of the current record
3737
				$recordID = $row["record_id"]; // get the serial number of the current record
3745
				$foundSerialsArray[] = $recordID; // add this record's serial to the array of found serial numbers
3738
				$foundSerialsArray[] = $recordID; // add this record's serial to the array of found serial numbers
Lines 3835-3844 Link Here
3835
3828
3836
		$userGroupsArray = array(); // initialize array variable
3829
		$userGroupsArray = array(); // initialize array variable
3837
3830
3838
		$rowsFound = @ mysql_num_rows($result);
3831
		$rowsFound = @ $result->num_rows;
3839
		if ($rowsFound > 0) // If there were rows found ...
3832
		if ($rowsFound > 0) // If there were rows found ...
3840
		{
3833
		{
3841
			while ($row = @ mysql_fetch_array($result)) // for all rows found
3834
			while ($row = @ $result->fetch_array()) // for all rows found
3842
			{
3835
			{
3843
				// remove any meaningless delimiter(s) from the beginning or end of a field string:
3836
				// remove any meaningless delimiter(s) from the beginning or end of a field string:
3844
				$rowUserGroupsString = trimTextPattern($row["user_groups"], "( *; *)+", true, true);
3837
				$rowUserGroupsString = trimTextPattern($row["user_groups"], "( *; *)+", true, true);
Lines 3893-3902 Link Here
3893
3886
3894
		$userQueriesArray = array(); // initialize array variable
3887
		$userQueriesArray = array(); // initialize array variable
3895
3888
3896
		$rowsFound = @ mysql_num_rows($result);
3889
		$rowsFound = @ $result->num_rows;
3897
		if ($rowsFound > 0) // If there were rows found ...
3890
		if ($rowsFound > 0) // If there were rows found ...
3898
		{
3891
		{
3899
			while ($row = @ mysql_fetch_array($result)) // for all rows found
3892
			while ($row = @ $result->fetch_array()) // for all rows found
3900
				$userQueriesArray[] = $row["query_name"]; // append this row's query name to the array of found user queries
3893
				$userQueriesArray[] = $row["query_name"]; // append this row's query name to the array of found user queries
3901
3894
3902
			// join array of unique user queries with '; ' as separator:
3895
			// join array of unique user queries with '; ' as separator:
Lines 3928-3937 Link Here
3928
3921
3929
		$userCiteKeysArray = array(); // initialize array variable
3922
		$userCiteKeysArray = array(); // initialize array variable
3930
3923
3931
		$rowsFound = @ mysql_num_rows($result);
3924
		$rowsFound = @ $result->num_rows;
3932
		if ($rowsFound > 0) // If there were rows found ...
3925
		if ($rowsFound > 0) // If there were rows found ...
3933
		{
3926
		{
3934
			while ($row = @ mysql_fetch_array($result)) // for all rows found
3927
			while ($row = @ $result->fetch_array()) // for all rows found
3935
			{
3928
			{
3936
				// If this row's cite key already exists in the global array of found cite keys ('$citeKeysArray'),
3929
				// If this row's cite key already exists in the global array of found cite keys ('$citeKeysArray'),
3937
				// we'll uniquify it, otherwise we'll take it as is
3930
				// we'll uniquify it, otherwise we'll take it as is
Lines 4005-4013 Link Here
4005
3998
4006
		$availableFormatsStylesTypesArray = array(); // initialize array variable
3999
		$availableFormatsStylesTypesArray = array(); // initialize array variable
4007
4000
4008
		$rowsFound = @ mysql_num_rows($result);
4001
		$rowsFound = @ $result->num_rows;
4009
		if ($rowsFound > 0) // If there were rows found ...
4002
		if ($rowsFound > 0) // If there were rows found ...
4010
			while ($row = @ mysql_fetch_array($result)) // for all rows found
4003
			while ($row = @ $result->fetch_array()) // for all rows found
4011
				$availableFormatsStylesTypesArray[$row[$dataType . "_id"]] = $row[$dataType . "_name"]; // append this row's format/style/type name to the array of found user formats/styles/types
4004
				$availableFormatsStylesTypesArray[$row[$dataType . "_id"]] = $row[$dataType . "_name"]; // append this row's format/style/type name to the array of found user formats/styles/types
4012
4005
4013
		return $availableFormatsStylesTypesArray;
4006
		return $availableFormatsStylesTypesArray;
Lines 4036-4044 Link Here
4036
4029
4037
		$enabledFormatsStylesTypesArray = array(); // initialize array variable
4030
		$enabledFormatsStylesTypesArray = array(); // initialize array variable
4038
4031
4039
		$rowsFound = @ mysql_num_rows($result);
4032
		$rowsFound = @ $result->num_rows;
4040
		if ($rowsFound > 0) // If there were rows found ...
4033
		if ($rowsFound > 0) // If there were rows found ...
4041
			while ($row = @ mysql_fetch_array($result)) // for all rows found
4034
			while ($row = @ $result->fetch_array()) // for all rows found
4042
			{
4035
			{
4043
				if ($returnIDsAsValues) // return format/style/type IDs as element values:
4036
				if ($returnIDsAsValues) // return format/style/type IDs as element values:
4044
					$enabledFormatsStylesTypesArray[] = $row[$dataType . "_id"]; // append this row's format/style/type ID to the array of found user formats/styles/types
4037
					$enabledFormatsStylesTypesArray[] = $row[$dataType . "_id"]; // append this row's format/style/type ID to the array of found user formats/styles/types
Lines 4101-4110 Link Here
4101
		else
4094
		else
4102
			$sessionVariableName = "user_" . $dataType . "s"; // yields 'user_styles' or 'user_types'
4095
			$sessionVariableName = "user_" . $dataType . "s"; // yields 'user_styles' or 'user_types'
4103
4096
4104
		$rowsFound = @ mysql_num_rows($result);
4097
		$rowsFound = @ $result->num_rows;
4105
		if ($rowsFound > 0) // If there were rows found ...
4098
		if ($rowsFound > 0) // If there were rows found ...
4106
		{
4099
		{
4107
			while ($row = @ mysql_fetch_array($result)) // for all rows found
4100
			while ($row = @ $result->fetch_array()) // for all rows found
4108
				$userFormatsStylesTypesArray[] = $row[$dataType . "_name"]; // append this row's format/style/type name to the array of found user formats/styles/types
4101
				$userFormatsStylesTypesArray[] = $row[$dataType . "_name"]; // append this row's format/style/type name to the array of found user formats/styles/types
4109
4102
4110
			// we'll only update the appropriate session variable if either a normal user is logged in -OR- the admin is logged in and views his own user options page
4103
			// we'll only update the appropriate session variable if either a normal user is logged in -OR- the admin is logged in and views his own user options page
Lines 4182-4188 Link Here
4182
		$query = "SELECT style_spec FROM $tableStyles WHERE style_name = " . quote_smart($citeStyle);
4175
		$query = "SELECT style_spec FROM $tableStyles WHERE style_name = " . quote_smart($citeStyle);
4183
4176
4184
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection
4177
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection
4185
		$row = mysql_fetch_array($result);
4178
		$row = $result->fetch_array();
4186
4179
4187
		return($row["style_spec"]);
4180
		return($row["style_spec"]);
4188
	}
4181
	}
Lines 4201-4207 Link Here
4201
		$query = "SELECT format_spec FROM $tableFormats WHERE format_name = " . quote_smart($formatName) . " AND format_type = " . quote_smart($formatType);
4194
		$query = "SELECT format_spec FROM $tableFormats WHERE format_name = " . quote_smart($formatName) . " AND format_type = " . quote_smart($formatType);
4202
4195
4203
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection
4196
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection
4204
		$row = mysql_fetch_array($result);
4197
		$row = $result->fetch_array();
4205
4198
4206
		return($row["format_spec"]);
4199
		return($row["format_spec"]);
4207
	}
4200
	}
Lines 4220-4226 Link Here
4220
		$query = "SELECT depends_path FROM $tableDepends WHERE depends_external = " . quote_smart($externalUtilityName);
4213
		$query = "SELECT depends_path FROM $tableDepends WHERE depends_external = " . quote_smart($externalUtilityName);
4221
4214
4222
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection
4215
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection
4223
		$row = mysql_fetch_array($result);
4216
		$row = $result->fetch_array();
4224
4217
4225
		return($row["depends_path"]);
4218
		return($row["depends_path"]);
4226
	}
4219
	}
Lines 4249-4262 Link Here
4249
4242
4250
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection
4243
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection
4251
4244
4252
		if (mysql_num_rows($result) == 1) // interpret query result: Do we have exactly one row?
4245
		if ($result->num_rows == 1) // interpret query result: Do we have exactly one row?
4253
		{
4246
		{
4254
			$userPermissionsArray = array(); // initialize array variables
4247
			$userPermissionsArray = array(); // initialize array variables
4255
			$userPermissionsFieldNameArray = array();
4248
			$userPermissionsFieldNameArray = array();
4256
4249
4257
			$row = mysql_fetch_array($result); // fetch the one row into the array '$row'
4250
			$row = $result->fetch_array(); // fetch the one row into the array '$row'
4258
4251
4259
			$fieldsFound = mysql_num_fields($result); // count the number of fields
4252
			$fieldsFound = $result->field_count; // count the number of fields
4260
4253
4261
			for ($i=0; $i<$fieldsFound; $i++)
4254
			for ($i=0; $i<$fieldsFound; $i++)
4262
			{
4255
			{
Lines 4314-4323 Link Here
4314
4307
4315
		$languagesArray = array(); // initialize array variable
4308
		$languagesArray = array(); // initialize array variable
4316
4309
4317
		$rowsFound = @ mysql_num_rows($result);
4310
		$rowsFound = @ $result->num_rows;
4318
		if ($rowsFound > 0) // If there were rows found ...
4311
		if ($rowsFound > 0) // If there were rows found ...
4319
		{
4312
		{
4320
			while ($row = @ mysql_fetch_array($result)) // for all rows found
4313
			while ($row = @ $result->fetch_array()) // for all rows found
4321
				$languagesArray[] = $row["language_name"]; // append this row's language name to the array of found languages
4314
				$languagesArray[] = $row["language_name"]; // append this row's language name to the array of found languages
4322
		}
4315
		}
4323
4316
Lines 4366-4374 Link Here
4366
4359
4367
		$userOptionsArray = array(); // initialize array variable
4360
		$userOptionsArray = array(); // initialize array variable
4368
4361
4369
		$rowsFound = @ mysql_num_rows($result);
4362
		$rowsFound = @ $result->num_rows;
4370
		if ($rowsFound == 1) // Interpret query result: Do we have exactly one row?
4363
		if ($rowsFound == 1) // Interpret query result: Do we have exactly one row?
4371
			$userOptionsArray = @ mysql_fetch_array($result); // fetch the one row into the array '$userOptionsArray'
4364
			$userOptionsArray = @ $result->fetch_array(); // fetch the one row into the array '$userOptionsArray'
4372
4365
4373
		return $userOptionsArray;
4366
		return $userOptionsArray;
4374
	}
4367
	}
Lines 4495-4501 Link Here
4495
4488
4496
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection
4489
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection
4497
4490
4498
		$row = mysql_fetch_row($result); // fetch the current row into the array $row (it'll be always *one* row, but anyhow)
4491
		$row = $result->fetch_row(); // fetch the current row into the array $row (it'll be always *one* row, but anyhow)
4499
		$numberOfRecords = $row[0]; // extract the contents of the first (and only) row
4492
		$numberOfRecords = $row[0]; // extract the contents of the first (and only) row
4500
4493
4501
		return $numberOfRecords;
4494
		return $numberOfRecords;
Lines 4586-4592 Link Here
4586
4579
4587
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection
4580
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection
4588
4581
4589
		$row = mysql_fetch_row($result); // fetch the current row into the array $row (it'll be always *one* row, but anyhow)
4582
		$row = $result->fetch_row(); // fetch the current row into the array $row (it'll be always *one* row, but anyhow)
4590
		$lastModifiedDateTime = $row[0] . " " . $row[1];
4583
		$lastModifiedDateTime = $row[0] . " " . $row[1];
4591
4584
4592
		return $lastModifiedDateTime;
4585
		return $lastModifiedDateTime;
Lines 4974-4980 Link Here
4974
		$i = 0;
4967
		$i = 0;
4975
		$resultBuffer = array();
4968
		$resultBuffer = array();
4976
4969
4977
		while ($row = @ mysql_fetch_array($resultId))
4970
		while ($row = @ $result->fetch_array(Id))
4978
		{
4971
		{
4979
			if ($SplitValues) // if desired, split field contents into substrings
4972
			if ($SplitValues) // if desired, split field contents into substrings
4980
			{
4973
			{
Lines 5089-5098 Link Here
5089
5082
5090
		$fieldContentsArray = array(); // initialize array variable
5083
		$fieldContentsArray = array(); // initialize array variable
5091
5084
5092
		$rowsFound = @ mysql_num_rows($result);
5085
		$rowsFound = @ $result->num_rows;
5093
		if ($rowsFound > 0) // If there were rows found ...
5086
		if ($rowsFound > 0) // If there were rows found ...
5094
		{
5087
		{
5095
			while ($row = @ mysql_fetch_array($result)) // for all rows found
5088
			while ($row = @ $result->fetch_array()) // for all rows found
5096
				$fieldContentsArray[] = $row[$columnName]; // append this row's field value to the array of extracted field values
5089
				$fieldContentsArray[] = $row[$columnName]; // append this row's field value to the array of extracted field values
5097
		}
5090
		}
5098
5091
Lines 6028-6040 Link Here
6028
6021
6029
	// --------------------------------------------------------------------
6022
	// --------------------------------------------------------------------
6030
6023
6031
	// this function uses 'mysql_real_escape_string()' to:
6024
	// this function uses 'mysqli_real_escape_string()' to:
6032
	// - prepend backslashes to \, ', "
6025
	// - prepend backslashes to \, ', "
6033
	// - replace the characters \x00, \n, \r, and \x1a with a MySQL acceptable representation
6026
	// - replace the characters \x00, \n, \r, and \x1a with a MySQL acceptable representation
6034
	//   for queries (e.g., the newline character is replaced with the litteral string '\n')
6027
	//   for queries (e.g., the newline character is replaced with the litteral string '\n')
6035
	function escapeSQL($sourceString)
6028
	function escapeSQL($sourceString)
6036
	{
6029
	{
6037
		$sourceString = mysql_real_escape_string($sourceString);
6030
		global $connection;
6031
6032
		if (!$connection)
6033
			connectToMySQLDatabase();
6034
6035
		$sourceString = $connection->real_escape_string($sourceString);
6038
6036
6039
		return $sourceString;
6037
		return $sourceString;
6040
	}
6038
	}
Lines 6408-6414 Link Here
6408
		          . "\n\t\t</image>";
6406
		          . "\n\t\t</image>";
6409
6407
6410
		// fetch results: upto the limit specified in '$showRows', fetch a row into the '$row' array and write out a RSS item:
6408
		// fetch results: upto the limit specified in '$showRows', fetch a row into the '$row' array and write out a RSS item:
6411
		for ($rowCounter=0; (($rowCounter < $showRows) && ($row = @ mysql_fetch_array($result))); $rowCounter++)
6409
		for ($rowCounter=0; (($rowCounter < $showRows) && ($row = @ $result->fetch_array())); $rowCounter++)
6412
		{
6410
		{
6413
			$origTitle = $row['title']; // save the original title contents before applying any search & replace actions
6411
			$origTitle = $row['title']; // save the original title contents before applying any search & replace actions
6414
6412
Lines 6494-6500 Link Here
6494
		$fieldValuesArray = array(); // initialize array variable which will hold the splitted sub-items
6492
		$fieldValuesArray = array(); // initialize array variable which will hold the splitted sub-items
6495
6493
6496
		// split field values on the given delimiter:
6494
		// split field values on the given delimiter:
6497
		for ($i=0; $row = @ mysql_fetch_array($result); $i++)
6495
		for ($i=0; $row = @ $result->fetch_array(); $i++)
6498
		{
6496
		{
6499
			$fieldSubValuesArray = preg_split($delim, $row[$fieldName]); // split field contents on '$delim' (which is interpreted as perl-style regular expression!)
6497
			$fieldSubValuesArray = preg_split($delim, $row[$fieldName]); // split field contents on '$delim' (which is interpreted as perl-style regular expression!)
6500
			foreach ($fieldSubValuesArray as $fieldSubValue)
6498
			foreach ($fieldSubValuesArray as $fieldSubValue)
(-)a/includes/install.inc.php (-11 / +4 lines)
Lines 64-78 Link Here
64
		global $connection;
64
		global $connection;
65
65
66
		// Establish a *new* connection that has admin permissions
66
		// Establish a *new* connection that has admin permissions
67
		// (1) OPEN the database connection:
67
		if (!($connection = @ new mysqli($hostName, $adminUserName, $adminPassword, $databaseName)))
68
		if (!($connection = @ mysql_connect($hostName, $adminUserName, $adminPassword)))
69
			if (mysql_errno() != 0) // this works around a stupid(?) behaviour of the Roxen webserver that returns 'errno: 0' on success! ?:-(
70
				showErrorMsg("The following error occurred while trying to connect to the host:", "");
68
				showErrorMsg("The following error occurred while trying to connect to the host:", "");
71
72
		// (2) SELECT the database:
73
		if (!(mysql_select_db($databaseName, $connection)))
74
			if (mysql_errno() != 0) // this works around a stupid(?) behaviour of the Roxen webserver that returns 'errno: 0' on success! ?:-(
75
				showErrorMsg("The following error occurred while trying to connect to the database:", "");
76
	}
69
	}
77
70
78
	// --------------------------------------------------------------------
71
	// --------------------------------------------------------------------
Lines 104-110 Link Here
104
97
105
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
98
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
106
	
99
	
107
		$rowsFound = @ mysql_num_rows($result);
100
		$rowsFound = @ $result->num_rows;
108
		if ($rowsFound == 0)
101
		if ($rowsFound == 0)
109
		{
102
		{
110
			$query = "INSERT INTO " . $table . " VALUES " . $values;
103
			$query = "INSERT INTO " . $table . " VALUES " . $values;
Lines 133-139 Link Here
133
		$queryFields = "SHOW FIELDS FROM " . $table;
126
		$queryFields = "SHOW FIELDS FROM " . $table;
134
		$result = queryMySQLDatabase($queryFields); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
127
		$result = queryMySQLDatabase($queryFields); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
135
128
136
		while ($row = @ mysql_fetch_array($result)) // for all fields found, check if any of their names matches the field name that we want to add
129
		while ($row = @ $result->fetch_array()) // for all fields found, check if any of their names matches the field name that we want to add
137
			if ($row["Field"] == $column)
130
			if ($row["Field"] == $column)
138
				$present = true;
131
				$present = true;
139
132
Lines 165-171 Link Here
165
		$queryFields = "SHOW TABLES";
158
		$queryFields = "SHOW TABLES";
166
		$result = queryMySQLDatabase($queryFields); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
159
		$result = queryMySQLDatabase($queryFields); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
167
160
168
		while ($row = @ mysql_fetch_array($result)) // for all tables found, check if any of their names matches the table name that we want to add
161
		while ($row = @ $result->fetch_array()) // for all tables found, check if any of their names matches the table name that we want to add
169
			if ($row[0] == $table)
162
			if ($row[0] == $table)
170
				$present = true;
163
				$present = true;
171
164
(-)a/includes/modsxml.inc.php (-1 / +1 lines)
Lines 198-204 Link Here
198
                                                      );
198
                                                      );
199
199
200
    // Generate the export for each record and push them onto an array:
200
    // Generate the export for each record and push them onto an array:
201
    while ($row = @ mysql_fetch_array($result)) {
201
    while ($row = @ $result->fetch_array()) {
202
      // Export the current record as MODS XML
202
      // Export the current record as MODS XML
203
      $record = modsRecord($row);
203
      $record = modsRecord($row);
204
204
(-)a/includes/oaidcxml.inc.php (-1 / +1 lines)
Lines 69-75 Link Here
69
		$citeKeysArray = array(); // array of cite keys (used to ensure uniqueness of cite keys among all exported records)
69
		$citeKeysArray = array(); // array of cite keys (used to ensure uniqueness of cite keys among all exported records)
70
70
71
		// Generate the export for each record and push them onto an array:
71
		// Generate the export for each record and push them onto an array:
72
		while ($row = @ mysql_fetch_array($result))
72
		while ($row = @ $result->fetch_array())
73
		{
73
		{
74
			// Export the current record as OAI_DC XML:
74
			// Export the current record as OAI_DC XML:
75
			$record = oaidcRecord($row, "oai_dc");
75
			$record = oaidcRecord($row, "oai_dc");
(-)a/includes/odfxml.inc.php (-1 / +1 lines)
Lines 155-161 Link Here
155
		list($universalSearchReplaceActionsArray, $fieldSpecificSearchReplaceActionsArray, $odfIndexesToRefbaseFieldsArray, $referenceTypesToRefbaseTypesArray) = initializeArrays();
155
		list($universalSearchReplaceActionsArray, $fieldSpecificSearchReplaceActionsArray, $odfIndexesToRefbaseFieldsArray, $referenceTypesToRefbaseTypesArray) = initializeArrays();
156
156
157
		// Generate the export for each record and push them onto an array:
157
		// Generate the export for each record and push them onto an array:
158
		while ($row = @ mysql_fetch_array($result))
158
		while ($row = @ $result->fetch_array())
159
		{
159
		{
160
			// Parse the current record into an array of field data that shall be exported to ODF:
160
			// Parse the current record into an array of field data that shall be exported to ODF:
161
			$recordExportArray = parseRecord($row, $odfIndexesToRefbaseFieldsArray, $referenceTypesToRefbaseTypesArray, $universalSearchReplaceActionsArray, $fieldSpecificSearchReplaceActionsArray);
161
			$recordExportArray = parseRecord($row, $odfIndexesToRefbaseFieldsArray, $referenceTypesToRefbaseTypesArray, $universalSearchReplaceActionsArray, $fieldSpecificSearchReplaceActionsArray);
(-)a/includes/srwxml.inc.php (-1 / +1 lines)
Lines 86-92 Link Here
86
			$exportArray = array(); // Array for individually exported records
86
			$exportArray = array(); // Array for individually exported records
87
87
88
			// Generate the export for each record and push them onto an array:
88
			// Generate the export for each record and push them onto an array:
89
			for ($rowCounter=0; (($rowCounter < $showRows) && ($row = @ mysql_fetch_array($result))); $rowCounter++)
89
			for ($rowCounter=0; (($rowCounter < $showRows) && ($row = @ $result->fetch_array())); $rowCounter++)
90
			{
90
			{
91
				if (preg_match("/DC/i", $exportFormat)) // export the current record as DC XML (i.e. simple Dublin Core):
91
				if (preg_match("/DC/i", $exportFormat)) // export the current record as DC XML (i.e. simple Dublin Core):
92
					$record = oaidcRecord($row, "srw_dc"); // function 'oaidcRecord()' is defined in 'oaidcxml.inc.php'
92
					$record = oaidcRecord($row, "srw_dc"); // function 'oaidcRecord()' is defined in 'oaidcxml.inc.php'
(-)a/install.php (-14 / +5 lines)
Lines 380-393 Link Here
380
		// If we made it here, then the data is considered valid!
380
		// If we made it here, then the data is considered valid!
381
381
382
		// (1) Open the database connection and use the mysql database:
382
		// (1) Open the database connection and use the mysql database:
383
		if (!($connection = @ mysql_connect($hostName,$adminUserName,$adminPassword)))
383
		if (!($connection = @ new mysqli($hostName,$adminUserName,$adminPassword,$adminDatabaseName)))
384
			if (mysql_errno() != 0) // this works around a stupid(?) behaviour of the Roxen webserver that returns 'errno: 0' on success! ?:-(
385
				showErrorMsg("The following error occurred while trying to connect to the host:", "");
384
				showErrorMsg("The following error occurred while trying to connect to the host:", "");
386
385
387
		if (!(mysql_select_db($adminDatabaseName, $connection)))
388
			if (mysql_errno() != 0) // this works around a stupid(?) behaviour of the Roxen webserver that returns 'errno: 0' on success! ?:-(
389
				showErrorMsg("The following error occurred while trying to connect to the database:", "");
390
391
386
392
		// First, check if we're a dealing with MySQL version 4.1.x or greater:
387
		// First, check if we're a dealing with MySQL version 4.1.x or greater:
393
		// (MySQL 4.1.x is required if the refbase MySQL database/tables shall be installed using Unicode/UTF-8 as default character set)
388
		// (MySQL 4.1.x is required if the refbase MySQL database/tables shall be installed using Unicode/UTF-8 as default character set)
Lines 417-428 Link Here
417
			$queryUpdateDependsTable = "UPDATE " . $databaseName . "." . $tableDepends . " SET depends_enabled = \"false\" WHERE depends_external = \"bibutils\""; // disable Bibutils functionality
412
			$queryUpdateDependsTable = "UPDATE " . $databaseName . "." . $tableDepends . " SET depends_enabled = \"false\" WHERE depends_external = \"bibutils\""; // disable Bibutils functionality
418
413
419
		// (2) Run the INSTALL queries on the mysql database through the connection:
414
		// (2) Run the INSTALL queries on the mysql database through the connection:
420
		if (!($result = @ mysql_query ($queryGrantStatement, $connection)))
415
		if (!($result = @ $connection->query ($queryGrantStatement)))
421
			if (mysql_errno() != 0) // this works around a stupid(?) behaviour of the Roxen webserver that returns 'errno: 0' on success! ?:-(
422
				showErrorMsg("The following error occurred while trying to query the database:", "");
416
				showErrorMsg("The following error occurred while trying to query the database:", "");
423
417
424
		if (!($result = @ mysql_query ($queryCreateDB, $connection)))
418
		if (!($result = @ $connection->query ($queryCreateDB)))
425
			if (mysql_errno() != 0) // this works around a stupid(?) behaviour of the Roxen webserver that returns 'errno: 0' on success! ?:-(
426
				showErrorMsg("The following error occurred while trying to query the database:", "");
419
				showErrorMsg("The following error occurred while trying to query the database:", "");
427
420
428
		// IMPORT the literature database structure from file:
421
		// IMPORT the literature database structure from file:
Lines 436-448 Link Here
436
		// stderr to stdout, which you can then easily print using something like print `shellcommand 2>&1`.
429
		// stderr to stdout, which you can then easily print using something like print `shellcommand 2>&1`.
437
430
438
		// run the UPDATE query on the depends table of the (just imported) literature database:
431
		// run the UPDATE query on the depends table of the (just imported) literature database:
439
		if (!($result = @ mysql_query ($queryUpdateDependsTable, $connection)))
432
		if (!($result = @ $connection->query ($queryUpdateDependsTable)))
440
			if (mysql_errno() != 0) // this works around a stupid(?) behaviour of the Roxen webserver that returns 'errno: 0' on success! ?:-(
441
				showErrorMsg("The following error occurred while trying to query the database:", "");
433
				showErrorMsg("The following error occurred while trying to query the database:", "");
442
434
443
		// (5) Close the database connection:
435
		// (5) Close the database connection:
444
		if (!(mysql_close($connection)))
436
		if (!($connection->close()))
445
			if (mysql_errno() != 0) // this works around a stupid(?) behaviour of the Roxen webserver that returns 'errno: 0' on success! ?:-(
446
				showErrorMsg("The following error occurred while trying to disconnect from the database:", "");
437
				showErrorMsg("The following error occurred while trying to disconnect from the database:", "");
447
438
448
		$resultLines = ""; // initialize variable
439
		$resultLines = ""; // initialize variable
(-)a/modify.php (-3 / +3 lines)
Lines 448-454 Link Here
448
		$queryFile = "SELECT file FROM $tableRefs WHERE serial = " . quote_smart($serialNo);
448
		$queryFile = "SELECT file FROM $tableRefs WHERE serial = " . quote_smart($serialNo);
449
449
450
		$result = queryMySQLDatabase($queryFile); // RUN the query on the database through the connection
450
		$result = queryMySQLDatabase($queryFile); // RUN the query on the database through the connection
451
		$row = @ mysql_fetch_array($result);
451
		$row = @ $result->fetch_array();
452
452
453
		$fileName = $row["file"];
453
		$fileName = $row["file"];
454
	}
454
	}
Lines 947-953 Link Here
947
			// (3) RUN the query on the database through the connection:
947
			// (3) RUN the query on the database through the connection:
948
			$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
948
			$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
949
949
950
			if (mysql_num_rows($result) == 1) // if there's already an existing user_data entry, we perform an UPDATE action:
950
			if ($result->num_rows == 1) // if there's already an existing user_data entry, we perform an UPDATE action:
951
				$queryUserData = "UPDATE $tableUserData SET "
951
				$queryUserData = "UPDATE $tableUserData SET "
952
				               . "marked = " . quote_smart($markedRadio) . ", "
952
				               . "marked = " . quote_smart($markedRadio) . ", "
953
				               . "copy = " . quote_smart($copyName) . ", "
953
				               . "copy = " . quote_smart($copyName) . ", "
Lines 1134-1140 Link Here
1134
		$result = queryMySQLDatabase($queryRefs); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
1134
		$result = queryMySQLDatabase($queryRefs); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
1135
1135
1136
		// Get the record id that was created
1136
		// Get the record id that was created
1137
		$serialNo = @ mysql_insert_id($connection); // find out the unique ID number of the newly created record (Note: this function should be called immediately after the
1137
		$serialNo = @ $connection->insert_id; // find out the unique ID number of the newly created record (Note: this function should be called immediately after the
1138
													// SQL INSERT statement! After any subsequent query it won't be possible to retrieve the auto_increment identifier value for THIS record!)
1138
													// SQL INSERT statement! After any subsequent query it won't be possible to retrieve the auto_increment identifier value for THIS record!)
1139
1139
1140
		$formVars['serialNo'] = $serialNo; // for '$recordAction = "add"' we update the original '$formVars' array element to ensure a correct serial number when generating the file name via the 'parsePlaceholderString()' function
1140
		$formVars['serialNo'] = $serialNo; // for '$recordAction = "add"' we update the original '$formVars' array element to ensure a correct serial number when generating the file name via the 'parsePlaceholderString()' function
(-)a/queries.php (-2 / +2 lines)
Lines 73-82 Link Here
73
73
74
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection (function 'queryMySQLDatabase()' is defined in 'include.inc.php')
74
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection (function 'queryMySQLDatabase()' is defined in 'include.inc.php')
75
75
76
		$rowsFound = @ mysql_num_rows($result);
76
		$rowsFound = @ $result->num_rows;
77
		if ($rowsFound == 1) // if there was exactly one row found (normally, this should be the case) ...
77
		if ($rowsFound == 1) // if there was exactly one row found (normally, this should be the case) ...
78
		{
78
		{
79
			$row = mysql_fetch_array($result);
79
			$row = $result->fetch_array();
80
80
81
			// redirect the browser to 'query_manager.php':
81
			// redirect the browser to 'query_manager.php':
82
			if (encodeHTML($submitAction) == $loc["ButtonTitle_Edit"]) // note that we need to HTML encode '$submitAction' for comparison with the HTML encoded locales (function 'encodeHTML()' is defined in 'include.inc.php')
82
			if (encodeHTML($submitAction) == $loc["ButtonTitle_Edit"]) // note that we need to HTML encode '$submitAction' for comparison with the HTML encoded locales (function 'encodeHTML()' is defined in 'include.inc.php')
(-)a/query_manager.php (-2 / +2 lines)
Lines 174-183 Link Here
174
		// (3a) RUN the query on the database through the connection:
174
		// (3a) RUN the query on the database through the connection:
175
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
175
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
176
176
177
		if (@ mysql_num_rows($result) == 1) // this condition is added here to avoid the case that editing a query item which got deleted in the meantime invokes a seemingly correct but empty 'edit query' form
177
		if (@ $result->num_rows == 1) // this condition is added here to avoid the case that editing a query item which got deleted in the meantime invokes a seemingly correct but empty 'edit query' form
178
		{
178
		{
179
			// (3b) EXTRACT results:
179
			// (3b) EXTRACT results:
180
			$row = mysql_fetch_array($result); // fetch the current row into the array $row (it'll be always *one* row, but anyhow)
180
			$row = $result->fetch_array(); // fetch the current row into the array $row (it'll be always *one* row, but anyhow)
181
181
182
			// check whether the user tries to edit a query that does not belong to his own set of saved queries:
182
			// check whether the user tries to edit a query that does not belong to his own set of saved queries:
183
			if ($row['user_id'] != getUserID($loginEmail)) // the function 'getUserID' and the '$loginEmail' variable are specified in 'include.inc.php'
183
			if ($row['user_id'] != getUserID($loginEmail)) // the function 'getUserID' and the '$loginEmail' variable are specified in 'include.inc.php'
(-)a/query_modify.php (-3 / +3 lines)
Lines 176-182 Link Here
176
176
177
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection (function 'queryMySQLDatabase()' is defined in 'include.inc.php')
177
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection (function 'queryMySQLDatabase()' is defined in 'include.inc.php')
178
178
179
		if (@ mysql_num_rows($result) > 0) // if there's already a saved query (belonging to this user) with exactly the same name
179
		if (@ $result->num_rows > 0) // if there's already a saved query (belonging to this user) with exactly the same name
180
			$errors["queryName"] = "You've got already a query with that name!<br>Please choose a different name:"; // the user's query name must be unique (since the query popup of the 'Recall My Query' form on the main page uses the query's name to recall a particular query)
180
			$errors["queryName"] = "You've got already a query with that name!<br>Please choose a different name:"; // the user's query name must be unique (since the query popup of the 'Recall My Query' form on the main page uses the query's name to recall a particular query)
181
			// note that we could allow for duplicate query names if the query popup on the main page would work with query IDs instead. However, from an interface design perspective, duplicate query names shouldn't be allowed anyhow. So we simply don't permit them.
181
			// note that we could allow for duplicate query names if the query popup on the main page would work with query IDs instead. However, from an interface design perspective, duplicate query names shouldn't be allowed anyhow. So we simply don't permit them.
182
	}
182
	}
Lines 261-267 Link Here
261
261
262
	if (preg_match("/^(edit|delet)$/", $queryAction))
262
	if (preg_match("/^(edit|delet)$/", $queryAction))
263
	{
263
	{
264
		$affectedRows = ($result ? mysql_affected_rows ($connection) : 0); // get the number of rows that were modified (or return 0 if an error occurred)
264
		$affectedRows = ($result ? $connection->affected_rows : 0); // get the number of rows that were modified (or return 0 if an error occurred)
265
265
266
		if ($affectedRows == 0) // no rows were affected by the update, i.e., the query must have been deleted in the meantime!
266
		if ($affectedRows == 0) // no rows were affected by the update, i.e., the query must have been deleted in the meantime!
267
		// NOTE: Previously, we did return "Warning_SavedQueryDoesNotExistAnymore": "This saved query does not exist anymore".
267
		// NOTE: Previously, we did return "Warning_SavedQueryDoesNotExistAnymore": "This saved query does not exist anymore".
Lines 283-289 Link Here
283
	}
283
	}
284
284
285
	elseif ($queryAction == "add") // Get the query id that was created:
285
	elseif ($queryAction == "add") // Get the query id that was created:
286
		$queryID = @ mysql_insert_id($connection); // find out the unique ID number of the newly created query (Note: this function should be called immediately after the
286
		$queryID = @ $connection->insert_id; // find out the unique ID number of the newly created query (Note: this function should be called immediately after the
287
													// SQL INSERT statement! After any subsequent query it won't be possible to retrieve the auto_increment identifier value for THIS record!)
287
													// SQL INSERT statement! After any subsequent query it won't be possible to retrieve the auto_increment identifier value for THIS record!)
288
288
289
	// update the 'userQueries' session variable:
289
	// update the 'userQueries' session variable:
(-)a/record.php (-2 / +2 lines)
Lines 305-314 Link Here
305
			// (3a) RUN the query on the database through the connection:
305
			// (3a) RUN the query on the database through the connection:
306
			$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
306
			$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
307
307
308
			if (@ mysql_num_rows($result) == 1) // this condition is added here to avoid the case that clicking on a search result item which got deleted in the meantime invokes a seemingly correct but empty 'edit record' search form
308
			if (@ $result->num_rows == 1) // this condition is added here to avoid the case that clicking on a search result item which got deleted in the meantime invokes a seemingly correct but empty 'edit record' search form
309
			{
309
			{
310
				// (3b) EXTRACT results:
310
				// (3b) EXTRACT results:
311
				$row = mysql_fetch_array($result); //fetch the current row into the array $row (it'll be always *one* row, but anyhow)
311
				$row = $result->fetch_array(); //fetch the current row into the array $row (it'll be always *one* row, but anyhow)
312
				
312
				
313
				// fetch attributes of the current record into variables:
313
				// fetch attributes of the current record into variables:
314
				$authorName = encodeHTML($row['author']);
314
				$authorName = encodeHTML($row['author']);
(-)a/rss.php (-1 / +1 lines)
Lines 123-129 Link Here
123
	$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
123
	$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
124
124
125
	// find out how many rows are available:
125
	// find out how many rows are available:
126
	$rowsFound = @ mysql_num_rows($result);
126
	$rowsFound = @ $result->num_rows;
127
127
128
	// construct a meaningful channel description based on the specified 'WHERE' clause:
128
	// construct a meaningful channel description based on the specified 'WHERE' clause:
129
	$rssChannelDescription = "Displays all newly added records where " . explainSQLQuery($sanitizedWhereClause) . "."; // function 'explainSQLQuery()' is defined in 'include.inc.php'
129
	$rssChannelDescription = "Displays all newly added records where " . explainSQLQuery($sanitizedWhereClause) . "."; // function 'explainSQLQuery()' is defined in 'include.inc.php'
(-)a/search.php (-11 / +11 lines)
Lines 576-582 Link Here
576
	if (($displayType == "Export"))
576
	if (($displayType == "Export"))
577
	{
577
	{
578
		// Find out how many rows are available:
578
		// Find out how many rows are available:
579
		$rowsFound = @ mysql_num_rows($result); // for all other display types, the '$rowsFound' variable is set within function 'seekInMySQLResultsToOffset()' (see below)
579
		$rowsFound = @ $result->num_rows; // for all other display types, the '$rowsFound' variable is set within function 'seekInMySQLResultsToOffset()' (see below)
580
		if ($rowsFound > 0) // If there were rows found ...
580
		if ($rowsFound > 0) // If there were rows found ...
581
		{
581
		{
582
			generateExport($result, $rowOffset, $showRows, $exportFormat, $exportType, $exportStylesheet, $displayType, $viewType, $userID); // export records using the export format specified in '$exportFormat'
582
			generateExport($result, $rowOffset, $showRows, $exportFormat, $exportType, $exportStylesheet, $displayType, $viewType, $userID); // export records using the export format specified in '$exportFormat'
Lines 609-615 Link Here
609
	$queryURL = rawurlencode($query); // URL encode SQL query
609
	$queryURL = rawurlencode($query); // URL encode SQL query
610
610
611
	if (!preg_match("/^SELECT/i", $query)) // for queries other than SELECT queries (e.g. UPDATE, DELETE or INSERT queries that were executed by the admin via use of 'sql_search.php')
611
	if (!preg_match("/^SELECT/i", $query)) // for queries other than SELECT queries (e.g. UPDATE, DELETE or INSERT queries that were executed by the admin via use of 'sql_search.php')
612
		$affectedRows = ($result ? mysql_affected_rows ($connection) : 0); // get the number of rows that were modified (or return 0 if an error occurred)
612
		$affectedRows = ($result ? $connection->affected_rows : 0); // get the number of rows that were modified (or return 0 if an error occurred)
613
613
614
	// If the previous query (which is stored in the 'oldQuery' session variable) is different
614
	// If the previous query (which is stored in the 'oldQuery' session variable) is different
615
	// from the current query, we append it to the 'queryHistory' session variable:
615
	// from the current query, we append it to the 'queryHistory' session variable:
Lines 893-899 Link Here
893
					$CounterMax = 0; // Otherwise don't hide any columns
893
					$CounterMax = 0; // Otherwise don't hide any columns
894
894
895
				// count the number of fields
895
				// count the number of fields
896
				$fieldsFound = mysql_num_fields($result);
896
				$fieldsFound = $result->field_count;
897
				if ($displayType != "Browse")
897
				if ($displayType != "Browse")
898
				{
898
				{
899
					// hide those last columns that were added by the script and not by the user
899
					// hide those last columns that were added by the script and not by the user
Lines 1059-1065 Link Here
1059
				// BEGIN RESULTS DATA COLUMNS --------------
1059
				// BEGIN RESULTS DATA COLUMNS --------------
1060
				// Fetch one page of results (or less if on the last page)
1060
				// Fetch one page of results (or less if on the last page)
1061
				// (i.e., upto the limit specified in $showRows) fetch a row into the $row array and ...
1061
				// (i.e., upto the limit specified in $showRows) fetch a row into the $row array and ...
1062
				for ($rowCounter=0; (($rowCounter < $showRows) && ($row = @ mysql_fetch_array($result))); $rowCounter++)
1062
				for ($rowCounter=0; (($rowCounter < $showRows) && ($row = @ $result->fetch_array())); $rowCounter++)
1063
				{
1063
				{
1064
					if (is_integer($rowCounter / 2)) // if we currently are at an even number of rows
1064
					if (is_integer($rowCounter / 2)) // if we currently are at an even number of rows
1065
						$rowClass = "even";
1065
						$rowClass = "even";
Lines 1276-1282 Link Here
1276
					$CounterMax = ($CounterMax + 1); // ...we'll also need to hide the 'related' column (which isn't displayed in Details view but is only used to generate a link to related records)
1276
					$CounterMax = ($CounterMax + 1); // ...we'll also need to hide the 'related' column (which isn't displayed in Details view but is only used to generate a link to related records)
1277
1277
1278
				// count the number of fields
1278
				// count the number of fields
1279
				$fieldsFound = mysql_num_fields($result);
1279
				$fieldsFound = $result->field_count;
1280
				// hide those last columns that were added by the script and not by the user
1280
				// hide those last columns that were added by the script and not by the user
1281
				$fieldsToDisplay = $fieldsFound-(2+$CounterMax+$addCounterMax); // (2+$CounterMax) -> $CounterMax is increased by 2 in order to hide the 'orig_record' & 'serial' columns (which were added to make checkboxes & dup warning work)
1281
				$fieldsToDisplay = $fieldsFound-(2+$CounterMax+$addCounterMax); // (2+$CounterMax) -> $CounterMax is increased by 2 in order to hide the 'orig_record' & 'serial' columns (which were added to make checkboxes & dup warning work)
1282
																				// $addCounterMax is set to 1 when the field given in '$fileVisibilityException[0]' (defined in 'ini.inc.php') was added to the query, otherwise '$addCounterMax = 0'
1282
																				// $addCounterMax is set to 1 when the field given in '$fileVisibilityException[0]' (defined in 'ini.inc.php') was added to the query, otherwise '$addCounterMax = 0'
Lines 1436-1442 Link Here
1436
				// BEGIN RESULTS DATA COLUMNS --------------
1436
				// BEGIN RESULTS DATA COLUMNS --------------
1437
				// Fetch one page of results (or less if on the last page)
1437
				// Fetch one page of results (or less if on the last page)
1438
				// (i.e., upto the limit specified in $showRows) fetch a row into the $row array and ...
1438
				// (i.e., upto the limit specified in $showRows) fetch a row into the $row array and ...
1439
				for ($rowCounter=0; (($rowCounter < $showRows) && ($row = @ mysql_fetch_array($result))); $rowCounter++)
1439
				for ($rowCounter=0; (($rowCounter < $showRows) && ($row = @ $result->fetch_array())); $rowCounter++)
1440
				{
1440
				{
1441
					// ... print out each of the attributes
1441
					// ... print out each of the attributes
1442
					// in that row as a separate TR (Table Row)
1442
					// in that row as a separate TR (Table Row)
Lines 2359-2374 Link Here
2359
		$recordSerialsArray = array();
2359
		$recordSerialsArray = array();
2360
		$duplicateRecordSerialsArray = array();
2360
		$duplicateRecordSerialsArray = array();
2361
2361
2362
		$rowsFound = @ mysql_num_rows($result);
2362
		$rowsFound = @ $result->num_rows;
2363
2363
2364
		// Identify any records with matching field data:
2364
		// Identify any records with matching field data:
2365
		if ($rowsFound > 0) // if there were rows found ...
2365
		if ($rowsFound > 0) // if there were rows found ...
2366
		{
2366
		{
2367
			// Count the number of fields:
2367
			// Count the number of fields:
2368
			$fieldsFound = mysql_num_fields($result);
2368
			$fieldsFound = $result->field_count;
2369
2369
2370
			// Loop over each row in the result set:
2370
			// Loop over each row in the result set:
2371
			for ($rowCounter=0; $row = @ mysql_fetch_array($result); $rowCounter++)
2371
			for ($rowCounter=0; $row = @ $result->fetch_array(); $rowCounter++)
2372
			{
2372
			{
2373
				$recordIdentifier = ""; // make sure our buffer variable is empty
2373
				$recordIdentifier = ""; // make sure our buffer variable is empty
2374
2374
Lines 5148-5157 Link Here
5148
		// Check whether the extracted serial numbers and cite keys exist in the database:
5148
		// Check whether the extracted serial numbers and cite keys exist in the database:
5149
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection (function 'queryMySQLDatabase()' is defined in 'include.inc.php')
5149
		$result = queryMySQLDatabase($query); // RUN the query on the database through the connection (function 'queryMySQLDatabase()' is defined in 'include.inc.php')
5150
5150
5151
		if (@ mysql_num_rows($result) > 0) // if there were rows found ...
5151
		if (@ $result->num_rows > 0) // if there were rows found ...
5152
		{
5152
		{
5153
			// Loop over each row in the result set:
5153
			// Loop over each row in the result set:
5154
			for ($rowCounter=0; $row = @ mysql_fetch_array($result); $rowCounter++)
5154
			for ($rowCounter=0; $row = @ $result->fetch_array(); $rowCounter++)
5155
			{
5155
			{
5156
				if (!in_array($row["serial"], $foundRecordSerialsKeysArray) OR (!empty($row["cite_key"]) AND !in_array($row["cite_key"], $foundRecordSerialsKeysArray))) // if this record identifier hasn't been seen yet
5156
				if (!in_array($row["serial"], $foundRecordSerialsKeysArray) OR (!empty($row["cite_key"]) AND !in_array($row["cite_key"], $foundRecordSerialsKeysArray))) // if this record identifier hasn't been seen yet
5157
				{
5157
				{
(-)a/sitemap.php (-1 / +1 lines)
Lines 66-72 Link Here
66
	// (3) RUN the query on the database through the connection:
66
	// (3) RUN the query on the database through the connection:
67
	$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
67
	$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
68
68
69
	while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
69
	while ($row = $result->fetch_array(, MYSQL_ASSOC)) {
70
		echo "  <url>\n";
70
		echo "  <url>\n";
71
		echo "    <loc>".$databaseBaseURL."show.php?record=".$row['serial']."</loc>\n";
71
		echo "    <loc>".$databaseBaseURL."show.php?record=".$row['serial']."</loc>\n";
72
		if (!empty($row['modified_date'])) {
72
		if (!empty($row['modified_date'])) {
(-)a/update.php (-84 / +84 lines)
Lines 250-269 Link Here
250
		// TODO: create a new function 'changeColumn()' that only modifies the column spec if the new column spec is different from the old one
250
		// TODO: create a new function 'changeColumn()' that only modifies the column spec if the new column spec is different from the old one
251
		$query = "ALTER table " . $tableDeleted . " MODIFY edition varchar(50) default NULL";
251
		$query = "ALTER table " . $tableDeleted . " MODIFY edition varchar(50) default NULL";
252
		$result = queryMySQLDatabase($query);
252
		$result = queryMySQLDatabase($query);
253
		$resultArray["Table 'deleted': altered table specification. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0); // get the number of rows that were modified (or return 0 if an error occurred)
253
		$resultArray["Table 'deleted': altered table specification. Affected rows"] = ($result ? $connection->affected_rows : 0); // get the number of rows that were modified (or return 0 if an error occurred)
254
254
255
		$query = "ALTER table " . $tableDeleted . " MODIFY thesis enum('Bachelor''s thesis','Honours thesis','Master''s thesis','Ph.D. thesis','Diploma thesis','Doctoral thesis','Habilitation thesis') default NULL";
255
		$query = "ALTER table " . $tableDeleted . " MODIFY thesis enum('Bachelor''s thesis','Honours thesis','Master''s thesis','Ph.D. thesis','Diploma thesis','Doctoral thesis','Habilitation thesis') default NULL";
256
		$result = queryMySQLDatabase($query);
256
		$result = queryMySQLDatabase($query);
257
		$resultArray["Table 'deleted': altered table specification. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
257
		$resultArray["Table 'deleted': altered table specification. Affected rows"] = ($result ? $connection->affected_rows : 0);
258
258
259
		// Alter table specification for table 'refs'
259
		// Alter table specification for table 'refs'
260
		$query = "ALTER table " . $tableRefs . " MODIFY edition varchar(50) default NULL";
260
		$query = "ALTER table " . $tableRefs . " MODIFY edition varchar(50) default NULL";
261
		$result = queryMySQLDatabase($query);
261
		$result = queryMySQLDatabase($query);
262
		$resultArray["Table 'refs': altered table specification. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
262
		$resultArray["Table 'refs': altered table specification. Affected rows"] = ($result ? $connection->affected_rows : 0);
263
263
264
		$query = "ALTER table " . $tableRefs . " MODIFY thesis enum('Bachelor''s thesis','Honours thesis','Master''s thesis','Ph.D. thesis','Diploma thesis','Doctoral thesis','Habilitation thesis') default NULL";
264
		$query = "ALTER table " . $tableRefs . " MODIFY thesis enum('Bachelor''s thesis','Honours thesis','Master''s thesis','Ph.D. thesis','Diploma thesis','Doctoral thesis','Habilitation thesis') default NULL";
265
		$result = queryMySQLDatabase($query);
265
		$result = queryMySQLDatabase($query);
266
		$resultArray["Table 'refs': altered table specification. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
266
		$resultArray["Table 'refs': altered table specification. Affected rows"] = ($result ? $connection->affected_rows : 0);
267
267
268
		// Add field 'version' to table 'deleted'
268
		// Add field 'version' to table 'deleted'
269
		$properties = "MEDIUMINT(8) UNSIGNED DEFAULT 1 AFTER modified_by";
269
		$properties = "MEDIUMINT(8) UNSIGNED DEFAULT 1 AFTER modified_by";
Lines 276-302 Link Here
276
		// Update table 'refs'
276
		// Update table 'refs'
277
		$query = "UPDATE " . $tableRefs . " SET thesis = NULL WHERE thesis = ''"; // this fix is required to ensure correct sorting when outputting citations with '$citeOrder="type"' or '$citeOrder="type-year"'
277
		$query = "UPDATE " . $tableRefs . " SET thesis = NULL WHERE thesis = ''"; // this fix is required to ensure correct sorting when outputting citations with '$citeOrder="type"' or '$citeOrder="type-year"'
278
		$result = queryMySQLDatabase($query);
278
		$result = queryMySQLDatabase($query);
279
		$resultArray["Table 'refs': updated 'thesis' field (replaced empty string with NULL). Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
279
		$resultArray["Table 'refs': updated 'thesis' field (replaced empty string with NULL). Affected rows"] = ($result ? $connection->affected_rows : 0);
280
280
281
		$query = "UPDATE " . $tableRefs . " SET type = 'Conference Article' WHERE type RLIKE '^(Unsupported: )?Conference Proceeding$'"; // this may not be perfect since some items of type "Conference Proceeding" may be actually a "Conference Volume"
281
		$query = "UPDATE " . $tableRefs . " SET type = 'Conference Article' WHERE type RLIKE '^(Unsupported: )?Conference Proceeding$'"; // this may not be perfect since some items of type "Conference Proceeding" may be actually a "Conference Volume"
282
		$result = queryMySQLDatabase($query);
282
		$result = queryMySQLDatabase($query);
283
		$resultArray["Table 'refs': updated 'type' field ('Conference Proceeding' => 'Conference Article'). Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
283
		$resultArray["Table 'refs': updated 'type' field ('Conference Proceeding' => 'Conference Article'). Affected rows"] = ($result ? $connection->affected_rows : 0);
284
284
285
		$query = "UPDATE " . $tableRefs . " SET type = 'Miscellaneous' WHERE type RLIKE '^(Unsupported: )?Generic$'";
285
		$query = "UPDATE " . $tableRefs . " SET type = 'Miscellaneous' WHERE type RLIKE '^(Unsupported: )?Generic$'";
286
		$result = queryMySQLDatabase($query);
286
		$result = queryMySQLDatabase($query);
287
		$resultArray["Table 'refs': updated 'type' field ('Generic' => 'Miscellaneous'). Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
287
		$resultArray["Table 'refs': updated 'type' field ('Generic' => 'Miscellaneous'). Affected rows"] = ($result ? $connection->affected_rows : 0);
288
288
289
		$query = "UPDATE " . $tableRefs . " SET type = 'Newspaper Article' WHERE type RLIKE '^(Unsupported: )?Newspaper$'"; // this may not be perfect since some items of type "Newspaper" may be actually a "Newspaper Volume"
289
		$query = "UPDATE " . $tableRefs . " SET type = 'Newspaper Article' WHERE type RLIKE '^(Unsupported: )?Newspaper$'"; // this may not be perfect since some items of type "Newspaper" may be actually a "Newspaper Volume"
290
		$result = queryMySQLDatabase($query);
290
		$result = queryMySQLDatabase($query);
291
		$resultArray["Table 'refs': updated 'type' field ('Newspaper' => 'Newspaper Article'). Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
291
		$resultArray["Table 'refs': updated 'type' field ('Newspaper' => 'Newspaper Article'). Affected rows"] = ($result ? $connection->affected_rows : 0);
292
292
293
		$query = "UPDATE " . $tableRefs . " SET type = 'Software' WHERE type RLIKE '^(Unsupported: )?Computer Program$'";
293
		$query = "UPDATE " . $tableRefs . " SET type = 'Software' WHERE type RLIKE '^(Unsupported: )?Computer Program$'";
294
		$result = queryMySQLDatabase($query);
294
		$result = queryMySQLDatabase($query);
295
		$resultArray["Table 'refs': updated 'type' field ('Computer Program' => 'Software'). Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
295
		$resultArray["Table 'refs': updated 'type' field ('Computer Program' => 'Software'). Affected rows"] = ($result ? $connection->affected_rows : 0);
296
296
297
		$query = "UPDATE " . $tableRefs . " SET type = REPLACE(type,'Unsupported: ','') WHERE type RLIKE '^Unsupported: (Abstract|Conference (Article|Volume)|Magazine Article|Manual|Miscellaneous|Newspaper Article|Patent|Report|Software)$'";
297
		$query = "UPDATE " . $tableRefs . " SET type = REPLACE(type,'Unsupported: ','') WHERE type RLIKE '^Unsupported: (Abstract|Conference (Article|Volume)|Magazine Article|Manual|Miscellaneous|Newspaper Article|Patent|Report|Software)$'";
298
		$result = queryMySQLDatabase($query);
298
		$result = queryMySQLDatabase($query);
299
		$resultArray["Table 'refs': updated 'type' field (removed 'Unsupported' label for all newly supported types). Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
299
		$resultArray["Table 'refs': updated 'type' field (removed 'Unsupported' label for all newly supported types). Affected rows"] = ($result ? $connection->affected_rows : 0);
300
300
301
		// Add new utilities to table 'depends'
301
		// Add new utilities to table 'depends'
302
		$values = "(NULL, 'pdftotext', 'true', NULL)";
302
		$values = "(NULL, 'pdftotext', 'true', NULL)";
Lines 329-338 Link Here
329
		// First, check how many users are contained in table 'users':
329
		// First, check how many users are contained in table 'users':
330
		$query = "SELECT user_id, first_name, last_name FROM " . $tableUsers;
330
		$query = "SELECT user_id, first_name, last_name FROM " . $tableUsers;
331
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
331
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
332
		$rowsFound = @ mysql_num_rows($result);
332
		$rowsFound = @ $result->num_rows;
333
		if ($rowsFound > 0) // If there were rows (= user IDs) found ...
333
		if ($rowsFound > 0) // If there were rows (= user IDs) found ...
334
		{
334
		{
335
			while ($row = @ mysql_fetch_array($result))
335
			while ($row = @ $result->fetch_array())
336
			{
336
			{
337
				$values = "(NULL, " . $row['user_id'] . ", 'yes', 'yes', 'no', 'yes', '<:authors[2|+|++]:><:year:>', 'yes', 'transliterate', 'no', '<:authors[2| & | et al.]:>< :year:>< {:recordIdentifier:}>', NULL, 'author, title, publication, keywords, abstract')";
337
				$values = "(NULL, " . $row['user_id'] . ", 'yes', 'yes', 'no', 'yes', '<:authors[2|+|++]:><:year:>', 'yes', 'transliterate', 'no', '<:authors[2| & | et al.]:>< :year:>< {:recordIdentifier:}>', NULL, 'author, title, publication, keywords, abstract')";
338
				$resultArray["Table 'user_options': inserted default options for user " . $row['user_id'] . " (" . $row['first_name'] . " " . $row['last_name'] . ")"] = insertIfNotExists(array("user_id" => $row['user_id']), $tableUserOptions, $values);
338
				$resultArray["Table 'user_options': inserted default options for user " . $row['user_id'] . " (" . $row['first_name'] . " " . $row['last_name'] . ")"] = insertIfNotExists(array("user_id" => $row['user_id']), $tableUserOptions, $values);
Lines 362-378 Link Here
362
		// Disable the Browse view feature (which isn't done yet) for all users
362
		// Disable the Browse view feature (which isn't done yet) for all users
363
		$query= "UPDATE " . $tableUserPermissions . " SET allow_browse_view = 'no'";
363
		$query= "UPDATE " . $tableUserPermissions . " SET allow_browse_view = 'no'";
364
		$result = queryMySQLDatabase($query);
364
		$result = queryMySQLDatabase($query);
365
		$resultArray["Table 'user_permissions': disabled the Browse view feature (which isn't done yet). Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
365
		$resultArray["Table 'user_permissions': disabled the Browse view feature (which isn't done yet). Affected rows"] = ($result ? $connection->affected_rows : 0);
366
366
367
		// Enable the Export feature for anyone who's not logged in ('$userID = 0'):
367
		// Enable the Export feature for anyone who's not logged in ('$userID = 0'):
368
		$query= "UPDATE " . $tableUserPermissions . " SET allow_export = 'yes', allow_batch_export = 'yes' WHERE user_id = 0";
368
		$query= "UPDATE " . $tableUserPermissions . " SET allow_export = 'yes', allow_batch_export = 'yes' WHERE user_id = 0";
369
		$result = queryMySQLDatabase($query);
369
		$result = queryMySQLDatabase($query);
370
		$resultArray["Table 'user_permissions': enabled the export feature for anyone who's not logged in. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
370
		$resultArray["Table 'user_permissions': enabled the export feature for anyone who's not logged in. Affected rows"] = ($result ? $connection->affected_rows : 0);
371
371
372
		// Update table 'styles'
372
		// Update table 'styles'
373
		$query = "UPDATE " . $tableStyles . " SET style_spec = REPLACE(style_spec,'cite_','styles/cite_') WHERE style_spec RLIKE '^cite_'";
373
		$query = "UPDATE " . $tableStyles . " SET style_spec = REPLACE(style_spec,'cite_','styles/cite_') WHERE style_spec RLIKE '^cite_'";
374
		$result = queryMySQLDatabase($query);
374
		$result = queryMySQLDatabase($query);
375
		$resultArray["Table 'styles': updated 'style_spec' field. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
375
		$resultArray["Table 'styles': updated 'style_spec' field. Affected rows"] = ($result ? $connection->affected_rows : 0);
376
376
377
		$values = "(NULL, 'Ann Glaciol', 'true', 'styles/cite_AnnGlaciol_JGlaciol.php', 'B010', '1')";
377
		$values = "(NULL, 'Ann Glaciol', 'true', 'styles/cite_AnnGlaciol_JGlaciol.php', 'B010', '1')";
378
		$resultArray["Table 'styles': inserted style 'Ann Glaciol'"] = insertIfNotExists(array("style_name" => "Ann Glaciol"), $tableStyles, $values);
378
		$resultArray["Table 'styles': inserted style 'Ann Glaciol'"] = insertIfNotExists(array("style_name" => "Ann Glaciol"), $tableStyles, $values);
Lines 406-501 Link Here
406
406
407
		$query = "UPDATE " . $tableStyles . " SET order_by = 'B010' WHERE style_name = 'Ann Glaciol'";
407
		$query = "UPDATE " . $tableStyles . " SET order_by = 'B010' WHERE style_name = 'Ann Glaciol'";
408
		$result = queryMySQLDatabase($query);
408
		$result = queryMySQLDatabase($query);
409
		$resultArray["Table 'styles': updated 'Ann Glaciol' style. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
409
		$resultArray["Table 'styles': updated 'Ann Glaciol' style. Affected rows"] = ($result ? $connection->affected_rows : 0);
410
410
411
		$query = "UPDATE " . $tableStyles . " SET order_by = 'B020' WHERE style_name = 'Deep Sea Res'";
411
		$query = "UPDATE " . $tableStyles . " SET order_by = 'B020' WHERE style_name = 'Deep Sea Res'";
412
		$result = queryMySQLDatabase($query);
412
		$result = queryMySQLDatabase($query);
413
		$resultArray["Table 'styles': updated 'Deep Sea Res' style. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
413
		$resultArray["Table 'styles': updated 'Deep Sea Res' style. Affected rows"] = ($result ? $connection->affected_rows : 0);
414
414
415
		$query = "UPDATE " . $tableStyles . " SET order_by = 'B030' WHERE style_name = 'J Glaciol'";
415
		$query = "UPDATE " . $tableStyles . " SET order_by = 'B030' WHERE style_name = 'J Glaciol'";
416
		$result = queryMySQLDatabase($query);
416
		$result = queryMySQLDatabase($query);
417
		$resultArray["Table 'styles': updated 'J Glaciol' style. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
417
		$resultArray["Table 'styles': updated 'J Glaciol' style. Affected rows"] = ($result ? $connection->affected_rows : 0);
418
418
419
		$query = "UPDATE " . $tableStyles . " SET order_by = 'B040' WHERE style_name = 'Mar Biol'";
419
		$query = "UPDATE " . $tableStyles . " SET order_by = 'B040' WHERE style_name = 'Mar Biol'";
420
		$result = queryMySQLDatabase($query);
420
		$result = queryMySQLDatabase($query);
421
		$resultArray["Table 'styles': updated 'Mar Biol' style. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
421
		$resultArray["Table 'styles': updated 'Mar Biol' style. Affected rows"] = ($result ? $connection->affected_rows : 0);
422
422
423
		$query = "UPDATE " . $tableStyles . " SET order_by = 'B050' WHERE style_name = 'MEPS'";
423
		$query = "UPDATE " . $tableStyles . " SET order_by = 'B050' WHERE style_name = 'MEPS'";
424
		$result = queryMySQLDatabase($query);
424
		$result = queryMySQLDatabase($query);
425
		$resultArray["Table 'styles': updated 'MEPS' style. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
425
		$resultArray["Table 'styles': updated 'MEPS' style. Affected rows"] = ($result ? $connection->affected_rows : 0);
426
426
427
		$query = "UPDATE " . $tableStyles . " SET order_by = 'B060' WHERE style_name = 'Polar Biol'";
427
		$query = "UPDATE " . $tableStyles . " SET order_by = 'B060' WHERE style_name = 'Polar Biol'";
428
		$result = queryMySQLDatabase($query);
428
		$result = queryMySQLDatabase($query);
429
		$resultArray["Table 'styles': updated 'Polar Biol' style. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
429
		$resultArray["Table 'styles': updated 'Polar Biol' style. Affected rows"] = ($result ? $connection->affected_rows : 0);
430
430
431
		$query = "UPDATE " . $tableStyles . " SET order_by = 'C010' WHERE style_name = 'Text Citation'";
431
		$query = "UPDATE " . $tableStyles . " SET order_by = 'C010' WHERE style_name = 'Text Citation'";
432
		$result = queryMySQLDatabase($query);
432
		$result = queryMySQLDatabase($query);
433
		$resultArray["Table 'styles': updated 'Text Citation' style. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
433
		$resultArray["Table 'styles': updated 'Text Citation' style. Affected rows"] = ($result ? $connection->affected_rows : 0);
434
434
435
		// Update table 'types'
435
		// Update table 'types'
436
		$query = "UPDATE " . $tableTypes . " SET order_by = '01' WHERE type_name = 'Journal Article'";
436
		$query = "UPDATE " . $tableTypes . " SET order_by = '01' WHERE type_name = 'Journal Article'";
437
		$result = queryMySQLDatabase($query);
437
		$result = queryMySQLDatabase($query);
438
		$resultArray["Table 'types': updated 'Journal Article' type. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
438
		$resultArray["Table 'types': updated 'Journal Article' type. Affected rows"] = ($result ? $connection->affected_rows : 0);
439
439
440
		$query = "UPDATE " . $tableTypes . " SET order_by = '02' WHERE type_name = 'Abstract'";
440
		$query = "UPDATE " . $tableTypes . " SET order_by = '02' WHERE type_name = 'Abstract'";
441
		$result = queryMySQLDatabase($query);
441
		$result = queryMySQLDatabase($query);
442
		$resultArray["Table 'types': updated 'Abstract' type. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
442
		$resultArray["Table 'types': updated 'Abstract' type. Affected rows"] = ($result ? $connection->affected_rows : 0);
443
443
444
		$query = "UPDATE " . $tableTypes . " SET order_by = '03' WHERE type_name = 'Book Chapter'";
444
		$query = "UPDATE " . $tableTypes . " SET order_by = '03' WHERE type_name = 'Book Chapter'";
445
		$result = queryMySQLDatabase($query);
445
		$result = queryMySQLDatabase($query);
446
		$resultArray["Table 'types': updated 'Book Chapter' type. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
446
		$resultArray["Table 'types': updated 'Book Chapter' type. Affected rows"] = ($result ? $connection->affected_rows : 0);
447
447
448
		$query = "UPDATE " . $tableTypes . " SET order_by = '04' WHERE type_name = 'Book Whole'";
448
		$query = "UPDATE " . $tableTypes . " SET order_by = '04' WHERE type_name = 'Book Whole'";
449
		$result = queryMySQLDatabase($query);
449
		$result = queryMySQLDatabase($query);
450
		$resultArray["Table 'types': updated 'Book Whole' type. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
450
		$resultArray["Table 'types': updated 'Book Whole' type. Affected rows"] = ($result ? $connection->affected_rows : 0);
451
451
452
		$query = "UPDATE " . $tableTypes . " SET order_by = '05' WHERE type_name = 'Conference Article'";
452
		$query = "UPDATE " . $tableTypes . " SET order_by = '05' WHERE type_name = 'Conference Article'";
453
		$result = queryMySQLDatabase($query);
453
		$result = queryMySQLDatabase($query);
454
		$resultArray["Table 'types': updated 'Conference Article' type. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
454
		$resultArray["Table 'types': updated 'Conference Article' type. Affected rows"] = ($result ? $connection->affected_rows : 0);
455
455
456
		$query = "UPDATE " . $tableTypes . " SET order_by = '06' WHERE type_name = 'Conference Volume'";
456
		$query = "UPDATE " . $tableTypes . " SET order_by = '06' WHERE type_name = 'Conference Volume'";
457
		$result = queryMySQLDatabase($query);
457
		$result = queryMySQLDatabase($query);
458
		$resultArray["Table 'types': updated 'Conference Volume' type. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
458
		$resultArray["Table 'types': updated 'Conference Volume' type. Affected rows"] = ($result ? $connection->affected_rows : 0);
459
459
460
		$query = "UPDATE " . $tableTypes . " SET order_by = '07' WHERE type_name = 'Journal'";
460
		$query = "UPDATE " . $tableTypes . " SET order_by = '07' WHERE type_name = 'Journal'";
461
		$result = queryMySQLDatabase($query);
461
		$result = queryMySQLDatabase($query);
462
		$resultArray["Table 'types': updated 'Journal' type. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
462
		$resultArray["Table 'types': updated 'Journal' type. Affected rows"] = ($result ? $connection->affected_rows : 0);
463
463
464
		$query = "UPDATE " . $tableTypes . " SET order_by = '08' WHERE type_name = 'Magazine Article'";
464
		$query = "UPDATE " . $tableTypes . " SET order_by = '08' WHERE type_name = 'Magazine Article'";
465
		$result = queryMySQLDatabase($query);
465
		$result = queryMySQLDatabase($query);
466
		$resultArray["Table 'types': updated 'Magazine Article' type. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
466
		$resultArray["Table 'types': updated 'Magazine Article' type. Affected rows"] = ($result ? $connection->affected_rows : 0);
467
467
468
		$query = "UPDATE " . $tableTypes . " SET order_by = '09' WHERE type_name = 'Manual'";
468
		$query = "UPDATE " . $tableTypes . " SET order_by = '09' WHERE type_name = 'Manual'";
469
		$result = queryMySQLDatabase($query);
469
		$result = queryMySQLDatabase($query);
470
		$resultArray["Table 'types': updated 'Manual' type. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
470
		$resultArray["Table 'types': updated 'Manual' type. Affected rows"] = ($result ? $connection->affected_rows : 0);
471
471
472
		$query = "UPDATE " . $tableTypes . " SET order_by = '10' WHERE type_name = 'Manuscript'";
472
		$query = "UPDATE " . $tableTypes . " SET order_by = '10' WHERE type_name = 'Manuscript'";
473
		$result = queryMySQLDatabase($query);
473
		$result = queryMySQLDatabase($query);
474
		$resultArray["Table 'types': updated 'Manuscript' type. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
474
		$resultArray["Table 'types': updated 'Manuscript' type. Affected rows"] = ($result ? $connection->affected_rows : 0);
475
475
476
		$query = "UPDATE " . $tableTypes . " SET order_by = '11' WHERE type_name = 'Map'";
476
		$query = "UPDATE " . $tableTypes . " SET order_by = '11' WHERE type_name = 'Map'";
477
		$result = queryMySQLDatabase($query);
477
		$result = queryMySQLDatabase($query);
478
		$resultArray["Table 'types': updated 'Map' type. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
478
		$resultArray["Table 'types': updated 'Map' type. Affected rows"] = ($result ? $connection->affected_rows : 0);
479
479
480
		$query = "UPDATE " . $tableTypes . " SET order_by = '12' WHERE type_name = 'Miscellaneous'";
480
		$query = "UPDATE " . $tableTypes . " SET order_by = '12' WHERE type_name = 'Miscellaneous'";
481
		$result = queryMySQLDatabase($query);
481
		$result = queryMySQLDatabase($query);
482
		$resultArray["Table 'types': updated 'Miscellaneous' type. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
482
		$resultArray["Table 'types': updated 'Miscellaneous' type. Affected rows"] = ($result ? $connection->affected_rows : 0);
483
483
484
		$query = "UPDATE " . $tableTypes . " SET order_by = '13' WHERE type_name = 'Newspaper Article'";
484
		$query = "UPDATE " . $tableTypes . " SET order_by = '13' WHERE type_name = 'Newspaper Article'";
485
		$result = queryMySQLDatabase($query);
485
		$result = queryMySQLDatabase($query);
486
		$resultArray["Table 'types': updated 'Newspaper Article' type. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
486
		$resultArray["Table 'types': updated 'Newspaper Article' type. Affected rows"] = ($result ? $connection->affected_rows : 0);
487
487
488
		$query = "UPDATE " . $tableTypes . " SET order_by = '14' WHERE type_name = 'Patent'";
488
		$query = "UPDATE " . $tableTypes . " SET order_by = '14' WHERE type_name = 'Patent'";
489
		$result = queryMySQLDatabase($query);
489
		$result = queryMySQLDatabase($query);
490
		$resultArray["Table 'types': updated 'Patent' type. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
490
		$resultArray["Table 'types': updated 'Patent' type. Affected rows"] = ($result ? $connection->affected_rows : 0);
491
491
492
		$query = "UPDATE " . $tableTypes . " SET order_by = '15' WHERE type_name = 'Report'";
492
		$query = "UPDATE " . $tableTypes . " SET order_by = '15' WHERE type_name = 'Report'";
493
		$result = queryMySQLDatabase($query);
493
		$result = queryMySQLDatabase($query);
494
		$resultArray["Table 'types': updated 'Report' type. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
494
		$resultArray["Table 'types': updated 'Report' type. Affected rows"] = ($result ? $connection->affected_rows : 0);
495
495
496
		$query = "UPDATE " . $tableTypes . " SET order_by = '16' WHERE type_name = 'Software'";
496
		$query = "UPDATE " . $tableTypes . " SET order_by = '16' WHERE type_name = 'Software'";
497
		$result = queryMySQLDatabase($query);
497
		$result = queryMySQLDatabase($query);
498
		$resultArray["Table 'types': updated 'Software' type. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
498
		$resultArray["Table 'types': updated 'Software' type. Affected rows"] = ($result ? $connection->affected_rows : 0);
499
499
500
		$values = "(NULL, 'Abstract', 'true', 2, '02')";
500
		$values = "(NULL, 'Abstract', 'true', 2, '02')";
501
		$resultArray["Table 'types': inserted type 'Abstract'"] = insertIfNotExists(array("type_name" => "Abstract"), $tableTypes, $values);
501
		$resultArray["Table 'types': inserted type 'Abstract'"] = insertIfNotExists(array("type_name" => "Abstract"), $tableTypes, $values);
Lines 546-623 Link Here
546
		// Enable disabled localizations
546
		// Enable disabled localizations
547
		$query = "UPDATE " . $tableLanguages . " SET language_enabled = 'true' WHERE language_name = 'de'";
547
		$query = "UPDATE " . $tableLanguages . " SET language_enabled = 'true' WHERE language_name = 'de'";
548
		$result = queryMySQLDatabase($query);
548
		$result = queryMySQLDatabase($query);
549
		$resultArray["Table 'languages': enabled German language option. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
549
		$resultArray["Table 'languages': enabled German language option. Affected rows"] = ($result ? $connection->affected_rows : 0);
550
550
551
		// Alter table specification for table 'formats'
551
		// Alter table specification for table 'formats'
552
		$query = "ALTER table " . $tableFormats . " MODIFY format_type enum('export','import','cite') NOT NULL default 'export'";
552
		$query = "ALTER table " . $tableFormats . " MODIFY format_type enum('export','import','cite') NOT NULL default 'export'";
553
		$result = queryMySQLDatabase($query);
553
		$result = queryMySQLDatabase($query);
554
		$resultArray["Table 'formats': altered table specification. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
554
		$resultArray["Table 'formats': altered table specification. Affected rows"] = ($result ? $connection->affected_rows : 0);
555
555
556
		// Update existing formats in table 'formats'
556
		// Update existing formats in table 'formats'
557
		$query = "UPDATE " . $tableFormats . " SET format_name = 'BibTeX' WHERE format_name = 'Bibtex'";
557
		$query = "UPDATE " . $tableFormats . " SET format_name = 'BibTeX' WHERE format_name = 'Bibtex'";
558
		$result = queryMySQLDatabase($query);
558
		$result = queryMySQLDatabase($query);
559
		$resultArray["Table 'formats': renamed format name 'Bibtex' to 'BibTeX'. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
559
		$resultArray["Table 'formats': renamed format name 'Bibtex' to 'BibTeX'. Affected rows"] = ($result ? $connection->affected_rows : 0);
560
560
561
		// Update existing import formats in table 'formats'
561
		// Update existing import formats in table 'formats'
562
		$query = "UPDATE " . $tableFormats . " SET format_spec = 'bibutils/import_bib2refbase.php', order_by = 'A010' WHERE format_name = 'BibTeX' AND format_type = 'import'";
562
		$query = "UPDATE " . $tableFormats . " SET format_spec = 'bibutils/import_bib2refbase.php', order_by = 'A010' WHERE format_name = 'BibTeX' AND format_type = 'import'";
563
		$result = queryMySQLDatabase($query);
563
		$result = queryMySQLDatabase($query);
564
		$resultArray["Table 'formats': updated 'BibTeX' import format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
564
		$resultArray["Table 'formats': updated 'BibTeX' import format. Affected rows"] = ($result ? $connection->affected_rows : 0);
565
565
566
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A020' WHERE format_name = 'Copac' AND format_type = 'import'";
566
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A020' WHERE format_name = 'Copac' AND format_type = 'import'";
567
		$result = queryMySQLDatabase($query);
567
		$result = queryMySQLDatabase($query);
568
		$resultArray["Table 'formats': updated 'Copac' import format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
568
		$resultArray["Table 'formats': updated 'Copac' import format. Affected rows"] = ($result ? $connection->affected_rows : 0);
569
569
570
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A030' WHERE format_name = 'CSA' AND format_type = 'import'";
570
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A030' WHERE format_name = 'CSA' AND format_type = 'import'";
571
		$result = queryMySQLDatabase($query);
571
		$result = queryMySQLDatabase($query);
572
		$resultArray["Table 'formats': updated 'CSA' import format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
572
		$resultArray["Table 'formats': updated 'CSA' import format. Affected rows"] = ($result ? $connection->affected_rows : 0);
573
573
574
		$query = "UPDATE " . $tableFormats . " SET format_spec = 'bibutils/import_end2refbase.php', order_by = 'A040' WHERE format_name = 'Endnote' AND format_type = 'import'";
574
		$query = "UPDATE " . $tableFormats . " SET format_spec = 'bibutils/import_end2refbase.php', order_by = 'A040' WHERE format_name = 'Endnote' AND format_type = 'import'";
575
		$result = queryMySQLDatabase($query);
575
		$result = queryMySQLDatabase($query);
576
		$resultArray["Table 'formats': updated 'Endnote' import format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
576
		$resultArray["Table 'formats': updated 'Endnote' import format. Affected rows"] = ($result ? $connection->affected_rows : 0);
577
577
578
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A045' WHERE format_name = 'Endnote XML' AND format_type = 'import'";
578
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A045' WHERE format_name = 'Endnote XML' AND format_type = 'import'";
579
		$result = queryMySQLDatabase($query);
579
		$result = queryMySQLDatabase($query);
580
		$resultArray["Table 'formats': updated 'Endnote XML' import format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
580
		$resultArray["Table 'formats': updated 'Endnote XML' import format. Affected rows"] = ($result ? $connection->affected_rows : 0);
581
581
582
		$query = "UPDATE " . $tableFormats . " SET format_name = 'ISI', format_spec = 'import_isi2refbase.php', order_by = 'A050', depends_id = 1 WHERE (format_name = 'RIS (ISI)' OR format_name = 'ISI') AND format_type = 'import'";
582
		$query = "UPDATE " . $tableFormats . " SET format_name = 'ISI', format_spec = 'import_isi2refbase.php', order_by = 'A050', depends_id = 1 WHERE (format_name = 'RIS (ISI)' OR format_name = 'ISI') AND format_type = 'import'";
583
		$result = queryMySQLDatabase($query);
583
		$result = queryMySQLDatabase($query);
584
		$resultArray["Table 'formats': updated 'ISI' import format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
584
		$resultArray["Table 'formats': updated 'ISI' import format. Affected rows"] = ($result ? $connection->affected_rows : 0);
585
585
586
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A060' WHERE format_name = 'Pubmed Medline' AND format_type = 'import'";
586
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A060' WHERE format_name = 'Pubmed Medline' AND format_type = 'import'";
587
		$result = queryMySQLDatabase($query);
587
		$result = queryMySQLDatabase($query);
588
		$resultArray["Table 'formats': updated 'Pubmed Medline' import format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
588
		$resultArray["Table 'formats': updated 'Pubmed Medline' import format. Affected rows"] = ($result ? $connection->affected_rows : 0);
589
589
590
		$query = "UPDATE " . $tableFormats . " SET format_spec = 'bibutils/import_med2refbase.php', order_by = 'A065' WHERE format_name = 'Pubmed XML' AND format_type = 'import'";
590
		$query = "UPDATE " . $tableFormats . " SET format_spec = 'bibutils/import_med2refbase.php', order_by = 'A065' WHERE format_name = 'Pubmed XML' AND format_type = 'import'";
591
		$result = queryMySQLDatabase($query);
591
		$result = queryMySQLDatabase($query);
592
		$resultArray["Table 'formats': updated 'Pubmed XML' import format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
592
		$resultArray["Table 'formats': updated 'Pubmed XML' import format. Affected rows"] = ($result ? $connection->affected_rows : 0);
593
593
594
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A070' WHERE format_name = 'RefWorks' AND format_type = 'import'";
594
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A070' WHERE format_name = 'RefWorks' AND format_type = 'import'";
595
		$result = queryMySQLDatabase($query);
595
		$result = queryMySQLDatabase($query);
596
		$resultArray["Table 'formats': updated 'RefWorks' import format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
596
		$resultArray["Table 'formats': updated 'RefWorks' import format. Affected rows"] = ($result ? $connection->affected_rows : 0);
597
597
598
		$query = "UPDATE " . $tableFormats . " SET format_spec = 'import_ris2refbase.php', order_by = 'A080', depends_id = 1 WHERE format_name = 'RIS' AND format_type = 'import'";
598
		$query = "UPDATE " . $tableFormats . " SET format_spec = 'import_ris2refbase.php', order_by = 'A080', depends_id = 1 WHERE format_name = 'RIS' AND format_type = 'import'";
599
		$result = queryMySQLDatabase($query);
599
		$result = queryMySQLDatabase($query);
600
		$resultArray["Table 'formats': updated 'RIS' import format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
600
		$resultArray["Table 'formats': updated 'RIS' import format. Affected rows"] = ($result ? $connection->affected_rows : 0);
601
601
602
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A090' WHERE format_name = 'SciFinder' AND format_type = 'import'";
602
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A090' WHERE format_name = 'SciFinder' AND format_type = 'import'";
603
		$result = queryMySQLDatabase($query);
603
		$result = queryMySQLDatabase($query);
604
		$resultArray["Table 'formats': updated 'SciFinder' import format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
604
		$resultArray["Table 'formats': updated 'SciFinder' import format. Affected rows"] = ($result ? $connection->affected_rows : 0);
605
605
606
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A100' WHERE format_name = 'Text (Tab-Delimited)' AND format_type = 'import'";
606
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A100' WHERE format_name = 'Text (Tab-Delimited)' AND format_type = 'import'";
607
		$result = queryMySQLDatabase($query);
607
		$result = queryMySQLDatabase($query);
608
		$resultArray["Table 'formats': updated 'Text (Tab-Delimited)' import format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
608
		$resultArray["Table 'formats': updated 'Text (Tab-Delimited)' import format. Affected rows"] = ($result ? $connection->affected_rows : 0);
609
609
610
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A150' WHERE format_name = 'CrossRef XML' AND format_type = 'import'";
610
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A150' WHERE format_name = 'CrossRef XML' AND format_type = 'import'";
611
		$result = queryMySQLDatabase($query);
611
		$result = queryMySQLDatabase($query);
612
		$resultArray["Table 'formats': updated 'CrossRef XML' import format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
612
		$resultArray["Table 'formats': updated 'CrossRef XML' import format. Affected rows"] = ($result ? $connection->affected_rows : 0);
613
613
614
		$query = "UPDATE " . $tableFormats . " SET format_spec = 'bibutils/import_modsxml2refbase.php', order_by = 'A160', depends_id = 2 WHERE format_name = 'MODS XML' AND format_type = 'import'";
614
		$query = "UPDATE " . $tableFormats . " SET format_spec = 'bibutils/import_modsxml2refbase.php', order_by = 'A160', depends_id = 2 WHERE format_name = 'MODS XML' AND format_type = 'import'";
615
		$result = queryMySQLDatabase($query);
615
		$result = queryMySQLDatabase($query);
616
		$resultArray["Table 'formats': updated 'MODS XML' import format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
616
		$resultArray["Table 'formats': updated 'MODS XML' import format. Affected rows"] = ($result ? $connection->affected_rows : 0);
617
617
618
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A170' WHERE format_name = 'OAI_DC XML' AND format_type = 'import'";
618
		$query = "UPDATE " . $tableFormats . " SET order_by = 'A170' WHERE format_name = 'OAI_DC XML' AND format_type = 'import'";
619
		$result = queryMySQLDatabase($query);
619
		$result = queryMySQLDatabase($query);
620
		$resultArray["Table 'formats': updated 'OAI_DC XML' import format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
620
		$resultArray["Table 'formats': updated 'OAI_DC XML' import format. Affected rows"] = ($result ? $connection->affected_rows : 0);
621
621
622
		// Add new import formats in table 'formats'
622
		// Add new import formats in table 'formats'
623
		$values = "(NULL, 'Copac', 'import', 'true', 'bibutils/import_copac2refbase.php', 'A020', 2)";
623
		$values = "(NULL, 'Copac', 'import', 'true', 'bibutils/import_copac2refbase.php', 'A020', 2)";
Lines 650-696 Link Here
650
		// Update existing export formats in table 'formats'
650
		// Update existing export formats in table 'formats'
651
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B010' WHERE format_name = 'BibTeX' AND format_type = 'export'";
651
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B010' WHERE format_name = 'BibTeX' AND format_type = 'export'";
652
		$result = queryMySQLDatabase($query);
652
		$result = queryMySQLDatabase($query);
653
		$resultArray["Table 'formats': updated 'BibTeX' export format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
653
		$resultArray["Table 'formats': updated 'BibTeX' export format. Affected rows"] = ($result ? $connection->affected_rows : 0);
654
654
655
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B040' WHERE format_name = 'Endnote' AND format_type = 'export'";
655
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B040' WHERE format_name = 'Endnote' AND format_type = 'export'";
656
		$result = queryMySQLDatabase($query);
656
		$result = queryMySQLDatabase($query);
657
		$resultArray["Table 'formats': updated 'Endnote' export format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
657
		$resultArray["Table 'formats': updated 'Endnote' export format. Affected rows"] = ($result ? $connection->affected_rows : 0);
658
658
659
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B050' WHERE format_name = 'ISI' AND format_type = 'export'";
659
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B050' WHERE format_name = 'ISI' AND format_type = 'export'";
660
		$result = queryMySQLDatabase($query);
660
		$result = queryMySQLDatabase($query);
661
		$resultArray["Table 'formats': updated 'ISI' export format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
661
		$resultArray["Table 'formats': updated 'ISI' export format. Affected rows"] = ($result ? $connection->affected_rows : 0);
662
662
663
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B080' WHERE format_name = 'RIS' AND format_type = 'export'";
663
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B080' WHERE format_name = 'RIS' AND format_type = 'export'";
664
		$result = queryMySQLDatabase($query);
664
		$result = queryMySQLDatabase($query);
665
		$resultArray["Table 'formats': updated 'RIS' export format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
665
		$resultArray["Table 'formats': updated 'RIS' export format. Affected rows"] = ($result ? $connection->affected_rows : 0);
666
666
667
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B105' WHERE format_name = 'Text (CSV)' AND format_type = 'export'";
667
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B105' WHERE format_name = 'Text (CSV)' AND format_type = 'export'";
668
		$result = queryMySQLDatabase($query);
668
		$result = queryMySQLDatabase($query);
669
		$resultArray["Table 'formats': updated 'Text (CSV)' export format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
669
		$resultArray["Table 'formats': updated 'Text (CSV)' export format. Affected rows"] = ($result ? $connection->affected_rows : 0);
670
670
671
		$query = "UPDATE " . $tableFormats . " SET format_name = 'Atom XML', format_enabled = 'true', format_spec ='export_atomxml.php', order_by = 'B140' WHERE format_name = 'OpenSearch RSS' AND format_type = 'export'";
671
		$query = "UPDATE " . $tableFormats . " SET format_name = 'Atom XML', format_enabled = 'true', format_spec ='export_atomxml.php', order_by = 'B140' WHERE format_name = 'OpenSearch RSS' AND format_type = 'export'";
672
		$result = queryMySQLDatabase($query);
672
		$result = queryMySQLDatabase($query);
673
		$resultArray["Table 'formats': updated 'OpenSearch RSS' export format, and renamed it to 'Atom XML'. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
673
		$resultArray["Table 'formats': updated 'OpenSearch RSS' export format, and renamed it to 'Atom XML'. Affected rows"] = ($result ? $connection->affected_rows : 0);
674
674
675
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B160' WHERE format_name = 'MODS XML' AND format_type = 'export'";
675
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B160' WHERE format_name = 'MODS XML' AND format_type = 'export'";
676
		$result = queryMySQLDatabase($query);
676
		$result = queryMySQLDatabase($query);
677
		$resultArray["Table 'formats': updated 'MODS XML' export format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
677
		$resultArray["Table 'formats': updated 'MODS XML' export format. Affected rows"] = ($result ? $connection->affected_rows : 0);
678
678
679
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B170' WHERE format_name = 'OAI_DC XML' AND format_type = 'export'";
679
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B170' WHERE format_name = 'OAI_DC XML' AND format_type = 'export'";
680
		$result = queryMySQLDatabase($query);
680
		$result = queryMySQLDatabase($query);
681
		$resultArray["Table 'formats': updated 'OAI_DC XML' export format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
681
		$resultArray["Table 'formats': updated 'OAI_DC XML' export format. Affected rows"] = ($result ? $connection->affected_rows : 0);
682
682
683
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B180' WHERE format_name = 'ODF XML' AND format_type = 'export'";
683
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B180' WHERE format_name = 'ODF XML' AND format_type = 'export'";
684
		$result = queryMySQLDatabase($query);
684
		$result = queryMySQLDatabase($query);
685
		$resultArray["Table 'formats': updated 'ODF XML' export format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
685
		$resultArray["Table 'formats': updated 'ODF XML' export format. Affected rows"] = ($result ? $connection->affected_rows : 0);
686
686
687
		$query = "UPDATE " . $tableFormats . " SET format_name = 'SRW_MODS XML', order_by = 'B195' WHERE format_name = 'SRW XML' AND format_type = 'export'";
687
		$query = "UPDATE " . $tableFormats . " SET format_name = 'SRW_MODS XML', order_by = 'B195' WHERE format_name = 'SRW XML' AND format_type = 'export'";
688
		$result = queryMySQLDatabase($query);
688
		$result = queryMySQLDatabase($query);
689
		$resultArray["Table 'formats': updated 'SRW XML' export format, and renamed it to 'SRW_MODS XML'. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
689
		$resultArray["Table 'formats': updated 'SRW XML' export format, and renamed it to 'SRW_MODS XML'. Affected rows"] = ($result ? $connection->affected_rows : 0);
690
690
691
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B200' WHERE format_name = 'Word XML' AND format_type = 'export'";
691
		$query = "UPDATE " . $tableFormats . " SET order_by = 'B200' WHERE format_name = 'Word XML' AND format_type = 'export'";
692
		$result = queryMySQLDatabase($query);
692
		$result = queryMySQLDatabase($query);
693
		$resultArray["Table 'formats': updated 'Word XML' export format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
693
		$resultArray["Table 'formats': updated 'Word XML' export format. Affected rows"] = ($result ? $connection->affected_rows : 0);
694
694
695
		// Add new export formats in table 'formats'
695
		// Add new export formats in table 'formats'
696
		$values = "(NULL, 'ADS', 'export', 'true', 'bibutils/export_xml2ads.php', 'B005', 2)";
696
		$values = "(NULL, 'ADS', 'export', 'true', 'bibutils/export_xml2ads.php', 'B005', 2)";
Lines 720-750 Link Here
720
		// Update existing citation formats in table 'formats'
720
		// Update existing citation formats in table 'formats'
721
		$query = "UPDATE " . $tableFormats . " SET order_by = 'C010' WHERE format_name = 'html' AND format_type = 'cite'";
721
		$query = "UPDATE " . $tableFormats . " SET order_by = 'C010' WHERE format_name = 'html' AND format_type = 'cite'";
722
		$result = queryMySQLDatabase($query);
722
		$result = queryMySQLDatabase($query);
723
		$resultArray["Table 'formats': updated 'html' citation format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
723
		$resultArray["Table 'formats': updated 'html' citation format. Affected rows"] = ($result ? $connection->affected_rows : 0);
724
724
725
		$query = "UPDATE " . $tableFormats . " SET order_by = 'C020' WHERE format_name = 'RTF' AND format_type = 'cite'";
725
		$query = "UPDATE " . $tableFormats . " SET order_by = 'C020' WHERE format_name = 'RTF' AND format_type = 'cite'";
726
		$result = queryMySQLDatabase($query);
726
		$result = queryMySQLDatabase($query);
727
		$resultArray["Table 'formats': updated 'RTF' citation format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
727
		$resultArray["Table 'formats': updated 'RTF' citation format. Affected rows"] = ($result ? $connection->affected_rows : 0);
728
728
729
		$query = "UPDATE " . $tableFormats . " SET order_by = 'C030' WHERE format_name = 'PDF' AND format_type = 'cite'";
729
		$query = "UPDATE " . $tableFormats . " SET order_by = 'C030' WHERE format_name = 'PDF' AND format_type = 'cite'";
730
		$result = queryMySQLDatabase($query);
730
		$result = queryMySQLDatabase($query);
731
		$resultArray["Table 'formats': updated 'PDF' citation format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
731
		$resultArray["Table 'formats': updated 'PDF' citation format. Affected rows"] = ($result ? $connection->affected_rows : 0);
732
732
733
		$query = "UPDATE " . $tableFormats . " SET order_by = 'C040' WHERE format_name = 'LaTeX' AND format_type = 'cite'";
733
		$query = "UPDATE " . $tableFormats . " SET order_by = 'C040' WHERE format_name = 'LaTeX' AND format_type = 'cite'";
734
		$result = queryMySQLDatabase($query);
734
		$result = queryMySQLDatabase($query);
735
		$resultArray["Table 'formats': updated 'LaTeX' citation format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
735
		$resultArray["Table 'formats': updated 'LaTeX' citation format. Affected rows"] = ($result ? $connection->affected_rows : 0);
736
736
737
		$query = "UPDATE " . $tableFormats . " SET order_by = 'C045' WHERE format_name = 'LaTeX .bbl' AND format_type = 'cite'";
737
		$query = "UPDATE " . $tableFormats . " SET order_by = 'C045' WHERE format_name = 'LaTeX .bbl' AND format_type = 'cite'";
738
		$result = queryMySQLDatabase($query);
738
		$result = queryMySQLDatabase($query);
739
		$resultArray["Table 'formats': updated 'LaTeX .bbl' citation format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
739
		$resultArray["Table 'formats': updated 'LaTeX .bbl' citation format. Affected rows"] = ($result ? $connection->affected_rows : 0);
740
740
741
		$query = "UPDATE " . $tableFormats . " SET order_by = 'C050' WHERE format_name = 'Markdown' AND format_type = 'cite'";
741
		$query = "UPDATE " . $tableFormats . " SET order_by = 'C050' WHERE format_name = 'Markdown' AND format_type = 'cite'";
742
		$result = queryMySQLDatabase($query);
742
		$result = queryMySQLDatabase($query);
743
		$resultArray["Table 'formats': updated 'Markdown' citation format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
743
		$resultArray["Table 'formats': updated 'Markdown' citation format. Affected rows"] = ($result ? $connection->affected_rows : 0);
744
744
745
		$query = "UPDATE " . $tableFormats . " SET order_by = 'C060' WHERE format_name = 'ASCII' AND format_type = 'cite'";
745
		$query = "UPDATE " . $tableFormats . " SET order_by = 'C060' WHERE format_name = 'ASCII' AND format_type = 'cite'";
746
		$result = queryMySQLDatabase($query);
746
		$result = queryMySQLDatabase($query);
747
		$resultArray["Table 'formats': updated 'ASCII' citation format. Affected rows"] = ($result ? mysql_affected_rows($connection) : 0);
747
		$resultArray["Table 'formats': updated 'ASCII' citation format. Affected rows"] = ($result ? $connection->affected_rows : 0);
748
748
749
		// Add new citation formats in table 'formats'
749
		// Add new citation formats in table 'formats'
750
		$values = "(NULL, 'html', 'cite', 'true', 'formats/cite_html.php', 'C010', 1)";
750
		$values = "(NULL, 'html', 'cite', 'true', 'formats/cite_html.php', 'C010', 1)";
Lines 773-782 Link Here
773
		$formatIDArray = array();
773
		$formatIDArray = array();
774
		$query = "SELECT format_id, format_name FROM " . $tableFormats . " WHERE (format_name RLIKE '^(BibTeX|Endnote|RIS)$' AND format_type = 'export')";
774
		$query = "SELECT format_id, format_name FROM " . $tableFormats . " WHERE (format_name RLIKE '^(BibTeX|Endnote|RIS)$' AND format_type = 'export')";
775
		$result = queryMySQLDatabase($query);
775
		$result = queryMySQLDatabase($query);
776
		$rowsFound = @ mysql_num_rows($result);
776
		$rowsFound = @ $result->num_rows;
777
		if ($rowsFound > 0)
777
		if ($rowsFound > 0)
778
		{
778
		{
779
			while ($row = @ mysql_fetch_array($result))
779
			while ($row = @ $result->fetch_array())
780
				$formatIDArray[$row['format_id']] = $row['format_name'];
780
				$formatIDArray[$row['format_id']] = $row['format_name'];
781
		}
781
		}
782
782
Lines 791-800 Link Here
791
		$formatIDArray = array();
791
		$formatIDArray = array();
792
		$query = "SELECT format_id, format_name FROM " . $tableFormats . " WHERE (format_name RLIKE '^(ISI|ODF XML|Word XML)$' AND format_type = 'export') OR (format_name RLIKE '^(html|RTF|PDF|LaTeX)$' AND format_type = 'cite')";
792
		$query = "SELECT format_id, format_name FROM " . $tableFormats . " WHERE (format_name RLIKE '^(ISI|ODF XML|Word XML)$' AND format_type = 'export') OR (format_name RLIKE '^(html|RTF|PDF|LaTeX)$' AND format_type = 'cite')";
793
		$result = queryMySQLDatabase($query);
793
		$result = queryMySQLDatabase($query);
794
		$rowsFound = @ mysql_num_rows($result);
794
		$rowsFound = @ $result->num_rows;
795
		if ($rowsFound > 0)
795
		if ($rowsFound > 0)
796
		{
796
		{
797
			while ($row = @ mysql_fetch_array($result))
797
			while ($row = @ $result->fetch_array())
798
				$formatIDArray[$row['format_id']] = $row['format_name'];
798
				$formatIDArray[$row['format_id']] = $row['format_name'];
799
		}
799
		}
800
800
Lines 802-811 Link Here
802
		$styleIDArray = array();
802
		$styleIDArray = array();
803
		$query = "SELECT style_id, style_name FROM " . $tableStyles . " WHERE style_name RLIKE '^(AMA|APA|Chicago|Harvard( [0-9]+)?|J Glaciol|MLA|Vancouver)$'";
803
		$query = "SELECT style_id, style_name FROM " . $tableStyles . " WHERE style_name RLIKE '^(AMA|APA|Chicago|Harvard( [0-9]+)?|J Glaciol|MLA|Vancouver)$'";
804
		$result = queryMySQLDatabase($query);
804
		$result = queryMySQLDatabase($query);
805
		$rowsFound = @ mysql_num_rows($result);
805
		$rowsFound = @ $result->num_rows;
806
		if ($rowsFound > 0)
806
		if ($rowsFound > 0)
807
		{
807
		{
808
			while ($row = @ mysql_fetch_array($result))
808
			while ($row = @ $result->fetch_array())
809
				$styleIDArray[$row['style_id']] = $row['style_name'];
809
				$styleIDArray[$row['style_id']] = $row['style_name'];
810
		}
810
		}
811
811
Lines 813-822 Link Here
813
		$typeIDArray = array();
813
		$typeIDArray = array();
814
		$query = "SELECT type_id, type_name FROM " . $tableTypes . " WHERE type_name RLIKE '^(Abstract|Conference Article|Conference Volume|Magazine Article|Manual|Miscellaneous|Newspaper Article|Patent|Report|Software)$'";
814
		$query = "SELECT type_id, type_name FROM " . $tableTypes . " WHERE type_name RLIKE '^(Abstract|Conference Article|Conference Volume|Magazine Article|Manual|Miscellaneous|Newspaper Article|Patent|Report|Software)$'";
815
		$result = queryMySQLDatabase($query);
815
		$result = queryMySQLDatabase($query);
816
		$rowsFound = @ mysql_num_rows($result);
816
		$rowsFound = @ $result->num_rows;
817
		if ($rowsFound > 0)
817
		if ($rowsFound > 0)
818
		{
818
		{
819
			while ($row = @ mysql_fetch_array($result))
819
			while ($row = @ $result->fetch_array())
820
				$typeIDArray[$row['type_id']] = $row['type_name'];
820
				$typeIDArray[$row['type_id']] = $row['type_name'];
821
		}
821
		}
822
822
Lines 843-852 Link Here
843
		// First, check how many users are contained in table 'users':
843
		// First, check how many users are contained in table 'users':
844
		$query = "SELECT user_id, first_name, last_name FROM " . $tableUsers;
844
		$query = "SELECT user_id, first_name, last_name FROM " . $tableUsers;
845
		$result = queryMySQLDatabase($query);
845
		$result = queryMySQLDatabase($query);
846
		$rowsFound = @ mysql_num_rows($result);
846
		$rowsFound = @ $result->num_rows;
847
		if ($rowsFound > 0) // If there were rows (= user IDs) found ...
847
		if ($rowsFound > 0) // If there were rows (= user IDs) found ...
848
		{
848
		{
849
			while ($row = @ mysql_fetch_array($result))
849
			while ($row = @ $result->fetch_array())
850
			{
850
			{
851
				foreach ($formatIDArray as $formatID => $formatName)
851
				foreach ($formatIDArray as $formatID => $formatName)
852
				{
852
				{
(-)a/user_details.php (-1 / +1 lines)
Lines 170-176 Link Here
170
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
170
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
171
171
172
		// (3b) EXTRACT results:
172
		// (3b) EXTRACT results:
173
		$row = mysql_fetch_array($result); //fetch the current row into the array $row
173
		$row = $result->fetch_array(); //fetch the current row into the array $row
174
174
175
		// If the admin is logged in AND the displayed user data are NOT his own, we overwrite the default header message:
175
		// If the admin is logged in AND the displayed user data are NOT his own, we overwrite the default header message:
176
		// (Since the admin is allowed to view and edit account data from other users, we have to provide a dynamic header message in that case)
176
		// (Since the admin is allowed to view and edit account data from other users, we have to provide a dynamic header message in that case)
(-)a/user_login.php (-3 / +3 lines)
Lines 121-130 Link Here
121
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
121
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
122
122
123
		// (4) EXTRACT results:
123
		// (4) EXTRACT results:
124
		if (mysql_num_rows($result) == 1) // Interpret query result: Do we have exactly one row?
124
		if ($result->num_rows == 1) // Interpret query result: Do we have exactly one row?
125
		{
125
		{
126
			$foundUser = true; // then we have found the user
126
			$foundUser = true; // then we have found the user
127
			$row = mysql_fetch_array($result); // fetch the one row into the array '$row'
127
			$row = $result->fetch_array(); // fetch the one row into the array '$row'
128
		}
128
		}
129
		else
129
		else
130
			$foundUser = false;
130
			$foundUser = false;
Lines 146-152 Link Here
146
			// Now we need to get the user's first name and last name (e.g., in order to display them within the login welcome message)
146
			// Now we need to get the user's first name and last name (e.g., in order to display them within the login welcome message)
147
			$query = "SELECT user_id, first_name, last_name, abbrev_institution, language, last_login FROM $tableUsers WHERE user_id = " . quote_smart($userID); // CONSTRUCT SQL QUERY
147
			$query = "SELECT user_id, first_name, last_name, abbrev_institution, language, last_login FROM $tableUsers WHERE user_id = " . quote_smart($userID); // CONSTRUCT SQL QUERY
148
			$result = queryMySQLDatabase($query); // RUN the query on the database through the connection (function 'queryMySQLDatabase()' is defined in 'include.inc.php')
148
			$result = queryMySQLDatabase($query); // RUN the query on the database through the connection (function 'queryMySQLDatabase()' is defined in 'include.inc.php')
149
			$row2 = mysql_fetch_array($result); // EXTRACT results: fetch the one row into the array '$row2'
149
			$row2 = $result->fetch_array(); // EXTRACT results: fetch the one row into the array '$row2'
150
150
151
			// Save the fetched user details to the session file:
151
			// Save the fetched user details to the session file:
152
152
(-)a/user_options.php (-1 / +1 lines)
Lines 170-176 Link Here
170
	$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
170
	$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
171
171
172
	// (3b) EXTRACT results:
172
	// (3b) EXTRACT results:
173
	$row = mysql_fetch_array($result); // fetch the current row into the array $row
173
	$row = $result->fetch_array(); // fetch the current row into the array $row
174
174
175
	// If the admin is logged in AND the displayed user data are NOT his own, we overwrite the default header message:
175
	// If the admin is logged in AND the displayed user data are NOT his own, we overwrite the default header message:
176
	// (Since the admin is allowed to view and edit account data from other users, we have to provide a dynamic header message in that case)
176
	// (Since the admin is allowed to view and edit account data from other users, we have to provide a dynamic header message in that case)
(-)a/user_options_modify.php (-1 / +1 lines)
Lines 405-411 Link Here
405
		// RUN the query on the database through the connection:
405
		// RUN the query on the database through the connection:
406
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
406
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
407
407
408
		if (mysql_num_rows($result) == 1) // if there's already an existing user_data entry, we perform an UPDATE action:
408
		if ($result->num_rows == 1) // if there's already an existing user_data entry, we perform an UPDATE action:
409
			$queryArray[] = "UPDATE $tableUserOptions SET "
409
			$queryArray[] = "UPDATE $tableUserOptions SET "
410
			              . "export_cite_keys = " . quote_smart($formVars["export_cite_keys"])
410
			              . "export_cite_keys = " . quote_smart($formVars["export_cite_keys"])
411
			              . ", autogenerate_cite_keys = " . quote_smart($formVars["autogenerate_cite_keys"])
411
			              . ", autogenerate_cite_keys = " . quote_smart($formVars["autogenerate_cite_keys"])
(-)a/user_receipt.php (-5 / +5 lines)
Lines 238-244 Link Here
238
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
238
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
239
239
240
		// (4) EXTRACT results (since 'user_id' is the unique primary key for the 'users' table, there will be only one matching row)
240
		// (4) EXTRACT results (since 'user_id' is the unique primary key for the 'users' table, there will be only one matching row)
241
		$row = @ mysql_fetch_array($result);
241
		$row = @ $result->fetch_array();
242
242
243
		// Build the correct header message:
243
		// Build the correct header message:
244
		if (!isset($_SESSION['HeaderString'])) // if there's no saved message
244
		if (!isset($_SESSION['HeaderString'])) // if there's no saved message
Lines 294-300 Link Here
294
294
295
			echo "\n\t\t<tr>\n\t\t\t<td align=\"left\"><b>Account Details:</b></td>";
295
			echo "\n\t\t<tr>\n\t\t\t<td align=\"left\"><b>Account Details:</b></td>";
296
296
297
			if (mysql_num_rows($result) == 1) // If there's a user associated with this user ID
297
			if ($result->num_rows == 1) // If there's a user associated with this user ID
298
			{
298
			{
299
				// Add edit/delete button:
299
				// Add edit/delete button:
300
				echo "\n\t\t\t<td align=\"left\">";
300
				echo "\n\t\t\t<td align=\"left\">";
Lines 404-410 Link Here
404
				echo "\n\t\t<tr>\n\t\t\t<td align=\"left\"><b>Display Options:</b></td>"
404
				echo "\n\t\t<tr>\n\t\t\t<td align=\"left\"><b>Display Options:</b></td>"
405
				   . "\n\t\t\t<td align=\"right\">";
405
				   . "\n\t\t\t<td align=\"right\">";
406
406
407
				if ((mysql_num_rows($result) == 1) OR ($userID == 0)) // If there's a user associated with this user ID (or if we're supposed to display options/permissions for anyone who isn't logged in)
407
				if (($result->num_rows == 1) OR ($userID == 0)) // If there's a user associated with this user ID (or if we're supposed to display options/permissions for anyone who isn't logged in)
408
					echo "<a href=\"user_options.php?userID=" . $userID . "\"><img src=\"img/options.gif\" alt=\"" . $loc["options"] . "\" title=\"" . $loc["LinkTitle_EditOptions"] . "\" width=\"11\" height=\"17\" hspace=\"0\" border=\"0\"></a>";
408
					echo "<a href=\"user_options.php?userID=" . $userID . "\"><img src=\"img/options.gif\" alt=\"" . $loc["options"] . "\" title=\"" . $loc["LinkTitle_EditOptions"] . "\" width=\"11\" height=\"17\" hspace=\"0\" border=\"0\"></a>";
409
409
410
				echo "</td>\n\t\t</tr>";
410
				echo "</td>\n\t\t</tr>";
Lines 413-419 Link Here
413
				echo "\n\t\t<tr valign=\"top\">"
413
				echo "\n\t\t<tr valign=\"top\">"
414
				   . "\n\t\t\t<td>Use language:</td>";
414
				   . "\n\t\t\t<td>Use language:</td>";
415
415
416
				if (mysql_num_rows($result) == 1) // If there's a user associated with this user ID
416
				if ($result->num_rows == 1) // If there's a user associated with this user ID
417
					echo "\n\t\t\t<td>\n\t\t\t\t<ul>\n\t\t\t\t\t<li>" . $row["language"] . "</li>\n\t\t\t\t</ul>\n\t\t\t</td>";
417
					echo "\n\t\t\t<td>\n\t\t\t\t<ul>\n\t\t\t\t\t<li>" . $row["language"] . "</li>\n\t\t\t\t</ul>\n\t\t\t</td>";
418
				else // no user exists with this user ID
418
				else // no user exists with this user ID
419
					echo "\n\t\t\t<td>\n\t\t\t\t<ul>\n\t\t\t\t\t<li>" . $defaultLanguage . "</li>\n\t\t\t\t</ul>\n\t\t\t</td>";
419
					echo "\n\t\t\t<td>\n\t\t\t\t<ul>\n\t\t\t\t\t<li>" . $defaultLanguage . "</li>\n\t\t\t\t</ul>\n\t\t\t</td>";
Lines 596-602 Link Here
596
					echo "\n\t\t<tr>\n\t\t\t<td align=\"left\"><b>User Permissions:</b></td>"
596
					echo "\n\t\t<tr>\n\t\t\t<td align=\"left\"><b>User Permissions:</b></td>"
597
					   . "\n\t\t\t<td align=\"right\">";
597
					   . "\n\t\t\t<td align=\"right\">";
598
598
599
					if ((mysql_num_rows($result) == 1) OR ($userID == 0)) // If there's a user associated with this user ID (or if we're supposed to display options/permissions for anyone who isn't logged in)
599
					if (($result->num_rows == 1) OR ($userID == 0)) // If there's a user associated with this user ID (or if we're supposed to display options/permissions for anyone who isn't logged in)
600
						echo "<a href=\"user_options.php?userID=" . $userID . "#permissions\"><img src=\"img/options.gif\" alt=\"" . $loc["permissions"] . "\" title=\"" . $loc["LinkTitle_EditPermissions"] . "\" width=\"11\" height=\"17\" hspace=\"0\" border=\"0\"></a>";
600
						echo "<a href=\"user_options.php?userID=" . $userID . "#permissions\"><img src=\"img/options.gif\" alt=\"" . $loc["permissions"] . "\" title=\"" . $loc["LinkTitle_EditPermissions"] . "\" width=\"11\" height=\"17\" hspace=\"0\" border=\"0\"></a>";
601
601
602
					echo "</td>\n\t\t</tr>";
602
					echo "</td>\n\t\t</tr>";
(-)a/user_validation.php (-7 / +7 lines)
Lines 203-209 Link Here
203
			// (3) RUN the query on the database through the connection:
203
			// (3) RUN the query on the database through the connection:
204
			$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
204
			$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
205
205
206
			if (mysql_num_rows($result) == 1) // (4) Interpret query result: Is it taken?
206
			if ($result->num_rows == 1) // (4) Interpret query result: Is it taken?
207
				$errors["email"] = "A user already exists with this email address as login name.\n\t\t<br>\n\t\tPlease enter a different one:";
207
				$errors["email"] = "A user already exists with this email address as login name.\n\t\t<br>\n\t\tPlease enter a different one:";
208
		}
208
		}
209
	}
209
	}
Lines 353-359 Link Here
353
		// (3a) RUN the query on the database through the connection:
353
		// (3a) RUN the query on the database through the connection:
354
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
354
		$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
355
355
356
		$row = mysql_fetch_array($result); // (3b) EXTRACT results: fetch the current row into the array $row
356
		$row = $result->fetch_array(); // (3b) EXTRACT results: fetch the current row into the array $row
357
357
358
		// 1) Mail feedback to user, i.e., send the person who wants to be added as new user a notification email:
358
		// 1) Mail feedback to user, i.e., send the person who wants to be added as new user a notification email:
359
		$emailRecipient = $formVars["firstName"] . " " . $formVars["lastName"] . " <" . $formVars["email"] . ">";
359
		$emailRecipient = $formVars["firstName"] . " " . $formVars["lastName"] . " <" . $formVars["email"] . ">";
Lines 448-454 Link Here
448
	elseif ((!isset($_SESSION['loginEmail']) && ($addNewUsers == "everyone") && ($_REQUEST['userID'] == "")) | (isset($_SESSION['loginEmail']) && ($loginEmail == $adminLoginEmail) && ($_REQUEST['userID'] == ""))) // -> perform an insert:
448
	elseif ((!isset($_SESSION['loginEmail']) && ($addNewUsers == "everyone") && ($_REQUEST['userID'] == "")) | (isset($_SESSION['loginEmail']) && ($loginEmail == $adminLoginEmail) && ($_REQUEST['userID'] == ""))) // -> perform an insert:
449
	{
449
	{
450
		// Get the user id that was created
450
		// Get the user id that was created
451
		$userID = @ mysql_insert_id($connection);
451
		$userID = @ $connection->insert_id;
452
452
453
		// Use the first two characters of the email as a salt for the password
453
		// Use the first two characters of the email as a salt for the password
454
		$salt = substr($formVars["email"], 0, 2);
454
		$salt = substr($formVars["email"], 0, 2);
Lines 477-483 Link Here
477
			// get the 'format_id' for the record entry in table 'formats' whose 'format_name' matches that in '$defaultUserExportFormats' (defined in 'ini.inc.php'):
477
			// get the 'format_id' for the record entry in table 'formats' whose 'format_name' matches that in '$defaultUserExportFormats' (defined in 'ini.inc.php'):
478
			$query = "SELECT format_id FROM $tableFormats WHERE format_name = " . quote_smart($defaultUserExportFormat) . " AND format_type = 'export'";
478
			$query = "SELECT format_id FROM $tableFormats WHERE format_name = " . quote_smart($defaultUserExportFormat) . " AND format_type = 'export'";
479
			$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
479
			$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
480
			$row = mysql_fetch_array($result);
480
			$row = $result->fetch_array();
481
481
482
			// Insert a row with the found format ID for this new user into the 'user_formats' table:
482
			// Insert a row with the found format ID for this new user into the 'user_formats' table:
483
			$queryArray[] = "INSERT INTO $tableUserFormats VALUES (NULL, " . quote_smart($row["format_id"]) . ", " . quote_smart($userID) . ", \"true\")";
483
			$queryArray[] = "INSERT INTO $tableUserFormats VALUES (NULL, " . quote_smart($row["format_id"]) . ", " . quote_smart($userID) . ", \"true\")";
Lines 488-494 Link Here
488
			// get the 'format_id' for the record entry in table 'formats' whose 'format_name' matches that in '$defaultUserCiteFormats' (defined in 'ini.inc.php'):
488
			// get the 'format_id' for the record entry in table 'formats' whose 'format_name' matches that in '$defaultUserCiteFormats' (defined in 'ini.inc.php'):
489
			$query = "SELECT format_id FROM $tableFormats WHERE format_name = " . quote_smart($defaultUserCiteFormat) . " AND format_type = 'cite'";
489
			$query = "SELECT format_id FROM $tableFormats WHERE format_name = " . quote_smart($defaultUserCiteFormat) . " AND format_type = 'cite'";
490
			$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
490
			$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
491
			$row = mysql_fetch_array($result);
491
			$row = $result->fetch_array();
492
492
493
			// Insert a row with the found format ID for this new user into the 'user_formats' table:
493
			// Insert a row with the found format ID for this new user into the 'user_formats' table:
494
			$queryArray[] = "INSERT INTO $tableUserFormats VALUES (NULL, " . quote_smart($row["format_id"]) . ", " . quote_smart($userID) . ", \"true\")";
494
			$queryArray[] = "INSERT INTO $tableUserFormats VALUES (NULL, " . quote_smart($row["format_id"]) . ", " . quote_smart($userID) . ", \"true\")";
Lines 499-505 Link Here
499
			// get the 'style_id' for the record entry in table 'styles' whose 'style_name' matches that in '$defaultUserStyles' (defined in 'ini.inc.php'):
499
			// get the 'style_id' for the record entry in table 'styles' whose 'style_name' matches that in '$defaultUserStyles' (defined in 'ini.inc.php'):
500
			$query = "SELECT style_id FROM $tableStyles WHERE style_name = " . quote_smart($defaultUserStyle);
500
			$query = "SELECT style_id FROM $tableStyles WHERE style_name = " . quote_smart($defaultUserStyle);
501
			$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
501
			$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
502
			$row = mysql_fetch_array($result);
502
			$row = $result->fetch_array();
503
503
504
			// Insert a row with the found style ID for this new user into the 'user_styles' table:
504
			// Insert a row with the found style ID for this new user into the 'user_styles' table:
505
			$queryArray[] = "INSERT INTO $tableUserStyles VALUES (NULL, " . quote_smart($row["style_id"]) . ", " . quote_smart($userID) . ", \"true\")";
505
			$queryArray[] = "INSERT INTO $tableUserStyles VALUES (NULL, " . quote_smart($row["style_id"]) . ", " . quote_smart($userID) . ", \"true\")";
Lines 510-516 Link Here
510
			// get the 'type_id' for the record entry in table 'types' whose 'type_name' matches that in '$defaultUserTypes' (defined in 'ini.inc.php'):
510
			// get the 'type_id' for the record entry in table 'types' whose 'type_name' matches that in '$defaultUserTypes' (defined in 'ini.inc.php'):
511
			$query = "SELECT type_id FROM $tableTypes WHERE type_name = " . quote_smart($defaultUserType);
511
			$query = "SELECT type_id FROM $tableTypes WHERE type_name = " . quote_smart($defaultUserType);
512
			$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
512
			$result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
513
			$row = mysql_fetch_array($result);
513
			$row = $result->fetch_array();
514
514
515
			// Insert a row with the found type ID for this new user into the 'user_types' table:
515
			// Insert a row with the found type ID for this new user into the 'user_types' table:
516
			$queryArray[] = "INSERT INTO $tableUserTypes VALUES (NULL, " . quote_smart($row["type_id"]) . ", " . quote_smart($userID) . ", \"true\")";
516
			$queryArray[] = "INSERT INTO $tableUserTypes VALUES (NULL, " . quote_smart($row["type_id"]) . ", " . quote_smart($userID) . ", \"true\")";
(-)a/users.php (-4 / +4 lines)
Lines 186-192 Link Here
186
	$queryURL = rawurlencode($query); // URL encode SQL query
186
	$queryURL = rawurlencode($query); // URL encode SQL query
187
187
188
	// First, find out how many rows are available:
188
	// First, find out how many rows are available:
189
	$rowsFound = @ mysql_num_rows($result);
189
	$rowsFound = @ $result->num_rows;
190
	if ($rowsFound > 0) // If there were rows found ...
190
	if ($rowsFound > 0) // If there were rows found ...
191
		{
191
		{
192
			// ... setup variables in order to facilitate "previous" & "next" browsing:
192
			// ... setup variables in order to facilitate "previous" & "next" browsing:
Lines 218-224 Link Here
218
			$nextOffset = $rowOffset + $showRows;
218
			$nextOffset = $rowOffset + $showRows;
219
219
220
			// d) Seek to the current offset
220
			// d) Seek to the current offset
221
			mysql_data_seek($result, $rowOffset);
221
			$result->data_seek($rowOffset);
222
		}
222
		}
223
	else // set variables to zero in order to prevent 'Undefined variable...' messages when nothing was found ('$rowsFound = 0'):
223
	else // set variables to zero in order to prevent 'Undefined variable...' messages when nothing was found ('$rowsFound = 0'):
224
		{
224
		{
Lines 296-302 Link Here
296
			$CounterMax = "0";
296
			$CounterMax = "0";
297
297
298
			// count the number of fields
298
			// count the number of fields
299
			$fieldsFound = mysql_num_fields($result);
299
			$fieldsFound = $result->field_count;
300
			// hide those last columns that were added by the script and not by the user
300
			// hide those last columns that were added by the script and not by the user
301
			$fieldsToDisplay = $fieldsFound-(1+$CounterMax); // (1+$CounterMax) -> $CounterMax is increased by 1 in order to hide the user_id column (which was added to make the checkbox work)
301
			$fieldsToDisplay = $fieldsFound-(1+$CounterMax); // (1+$CounterMax) -> $CounterMax is increased by 1 in order to hide the user_id column (which was added to make the checkbox work)
302
302
Lines 432-438 Link Here
432
        echo "</tr>";
432
        echo "</tr>";
433
433
434
			// BEGIN RESULTS DATA COLUMNS --------------
434
			// BEGIN RESULTS DATA COLUMNS --------------
435
			for ($rowCounter=0; (($rowCounter < $showRows) && ($row = @ mysql_fetch_array($result))); $rowCounter++)
435
			for ($rowCounter=0; (($rowCounter < $showRows) && ($row = @ $result->fetch_array())); $rowCounter++)
436
			{
436
			{
437
				if (is_integer($rowCounter / 2)) // if we currently are at an even number of rows
437
				if (is_integer($rowCounter / 2)) // if we currently are at an even number of rows
438
					$rowClass = "even";
438
					$rowClass = "even";

Return to bug 603988