Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
- Specify a sort order in the configuration file
- Fix: Show single item
  • Loading branch information
ElfQrin authored Apr 17, 2017
1 parent 7bb9750 commit a6350dc
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
3 changes: 3 additions & 0 deletions config_x.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
$minimitems = array('name', 'lname'); # Ultra compact view for Mobile devices
}

$defsrt='`lname`,`name`'; # Default sort order
# $defsrt='`id`'; # Default sort order

# min/max lenght of user profile text fields (make sure max values are not bigger than the ones defined in the database)
$dbdatlen = array ('name'=>'0|128','lname'=>'0|128','address'=>'0|128','phonecell'=>'0|24','email'=>'5|128','www'=>'0|128');

Expand Down
9 changes: 6 additions & 3 deletions dbshow.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ function shwctrlbuttons() {
if ($fav) {
if (auth_user('STAR1')) {
$qdb="SELECT `starr` FROM `".$db_table1_name."` WHERE `id`=".$fav.";";
# echo "<br />".'*** 1: ['.$qdb.']'."<br />";
$dbo=dbx_query($dbx,$dbxcon,$qdb,$db_name);
$row=dbx_fetch_array($dbx,$dbo);
if ($row['starr']==0) {$xinv=1;} else {$xinv=0;}
Expand Down Expand Up @@ -202,12 +203,14 @@ function shwctrlbuttons() {

if ($starr) {
if ($starrbl==1) {
$qusrt.=' ORDER BY `starr` DESC, `id` ASC';
$qusrt.=' ORDER BY `starr` DESC';
if ($defsrt) {$qusrt.=', '.$defsrt;}
} elseif ($starrbl==2) {
$qusrt.=' ORDER BY `starr` ASC, `id` ASC';
$qusrt.=' ORDER BY `starr` ASC';
if ($defsrt) {$qusrt.=', '.$defsrt;}
}
} else {
$qusrt.=' ORDER BY `id` ASC';
if ($defsrt) {$qusrt.=' ORDER BY '.$defsrt;}
}

$qcnt='SELECT COUNT(*) AS c'." FROM `".$db_table1_name."`".$qusrch;
Expand Down
3 changes: 1 addition & 2 deletions dbshowitem.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
$dbo=dbx_query($dbx,$dbxcon,$qdb,$db_name);
if ($dbo) {
include('dbshow_header.inc.php');

$dbey=dbx_fetch_array($dbx,$dbo);
$cp=1;
include('dbshow_body.inc.php');
Expand All @@ -18,7 +17,7 @@
if ($action=='edit') {
$iid=$id;
$ou='';
$ou.=' '.'ID'.':'.$iid;
# $ou.=' '.'ID'.':'.$iid;
if (auth_user('DEL1')) {
$ou.=' '.'<a href="'.'dbshow.php?action=edit&del='.$iid.'"';
if ($askc_del1) {$ou.=' onclick="javascript:return confirm(\''.'Are you sure?'.'\');" ';}
Expand Down
9 changes: 5 additions & 4 deletions dbshowitem.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
<?
define('PAGETITLE','Address Book - Show');
define('PAGETITLE','Archivum Cruces - Vedi oggetto');
include('site_header.php');

echo '<center>'.'<h1>'.'Show Item'.'</h1>'.'</center>';
# echo '<center>'.'<h1>'.'Vedi oggetto'.'</h1>'.'</center>';

$action='view';
$outfmt='webpage';
$outwhr='browser';

# Allowed fields (as set in the configuration file)
$usrfld='id,';
reset($dbdat);
while ($l_1=each($dbdat)) {
list ($l_1a,$l_1b) = $l_1['value'];
list ($l_1a,$l_1b) = str_getcsv($l_1['value'],'|');
if ($l_1b>'0' && substr($l_1['key'],0,2)!='xx') {$usrfld.=$l_1['key'].',';}
}
$usrfld.='dat';
# $usrfld='*';
$qdbs1=$usrfld;

$id=addslashes(trim($_REQUEST['id']));
$action=addslashes(trim($_REQUEST['action'])); if ($action!='edit') {$action='view';}

include('dbshowitem.inc.php');

Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?
# release information

$project_n='EQ_AddressBook'; $project_v='r2017-02-10'; # fr2016-10-16
$project_n='EQ_AddressBook'; $project_v='r2017-04-17'; # fr2016-10-16

?>

0 comments on commit a6350dc

Please sign in to comment.