diff options
author | INOPIAE <inopiae@cacert.org> | 2013-07-14 08:32:34 +0200 |
---|---|---|
committer | INOPIAE <inopiae@cacert.org> | 2013-07-14 08:32:34 +0200 |
commit | 080d7a1fd282b6d5fbcb37980ca6ada112bf67d7 (patch) | |
tree | 6b200a05ba71811ba2bd7e9037f503822387abbe /pages | |
parent | f8eece94c2047e0eb2a68b05d3d5a2b047a7e430 (diff) | |
download | cacert-devel-080d7a1fd282b6d5fbcb37980ca6ada112bf67d7.tar.gz cacert-devel-080d7a1fd282b6d5fbcb37980ca6ada112bf67d7.tar.xz cacert-devel-080d7a1fd282b6d5fbcb37980ca6ada112bf67d7.zip |
bug 1010: changed if then else to ternery operator
Diffstat (limited to 'pages')
-rw-r--r-- | pages/account/18.php | 48 | ||||
-rw-r--r-- | pages/account/22.php | 42 |
2 files changed, 30 insertions, 60 deletions
diff --git a/pages/account/18.php b/pages/account/18.php index b4cee40..df33db6 100644 --- a/pages/account/18.php +++ b/pages/account/18.php @@ -32,23 +32,17 @@ $status = array_key_exists('status',$_SESSION['_config']) ? intval($_SESSION['_c <td class="DataTD"><?=_("Organisation")?></td> <td colspan="8" class="DataTD" > <select name="orgfilterid"> - <option value="0"<? - if (0==$orgfilterid) { - ?> selected <? - } - ?>><?=_("All")?></option> <? - $query = "select `orginfo`.`O`, `orginfo`.`id` - from `org`, `orginfo` - where `org`.`memid`='".intval($_SESSION['profile']['id'])."' `orginfo`.`id` = `org`.`orgid` - ORDER BY `oemail`.`modified` desc"; - $reso = mysql_query($query); - if(mysql_num_rows($reso) >= 1){ - while($row = mysql_fetch_assoc($res)){ - ?><option <?if ($row['id']==$orgfilterid) { - ?> selected <? - }?> value="><?=$row['id']?>"><?=$row['O']?></option> - <?} - }?> + <?=sprintf("<option value='%d' %s>%s</option>",0, 0 == $orgfilterid? " selected" : "" ,_("All")) ?> +<? $query = "select `orginfo`.`O`, `orginfo`.`id` + from `org`, `orginfo` + where `org`.`memid`='".intval($_SESSION['profile']['id'])."' `orginfo`.`id` = `org`.`orgid` + ORDER BY `oemail`.`modified` desc"; + $reso = mysql_query($query); + if(mysql_num_rows($reso) >= 1){ + while($row = mysql_fetch_assoc($res)){ + sprintf("<option value='%d' %s>%s</option>",$row['id'], $row['id'] == $orgfilterid? " selected" : "" , $row['O']); + } + }?> </select> </td> </tr> @@ -56,15 +50,9 @@ $status = array_key_exists('status',$_SESSION['_config']) ? intval($_SESSION['_c <td class="DataTD"><?=_("Sorting")?></td> <td colspan="8" class="DataTD" > <select name="sorting"> - <option <?if (0==$sorting) { - ?> selected <? - }?>value="0"><?=_("expire date (desc)")?></option> - <option <?if (1==$sorting) { - ?> selected <? - }?>value="1"><?=_("OU, expire date (desc)")?></option> - <option <?if (2==$sorting) { - ?> selected <? - }?>value="2"><?=_("Common name, expire date (desc)")?></option> + <?=sprintf("<option value='%d' %s>%s</option>",0, 0 == $sorting? " selected" : "" ,_("expire date (desc)")) ?> + <?=sprintf("<option value='%d' %s>%s</option>",1, 1 == $sorting ? " selected" : "" ,_("OU, expire date (desc)")) ?> + <?=sprintf("<option value='%d' %s>%s</option>",2, 2 == $sorting ? " selected" : "" ,_("Common name, expire date (desc)")) ?> </select> </td> </tr> @@ -72,12 +60,8 @@ $status = array_key_exists('status',$_SESSION['_config']) ? intval($_SESSION['_c <td class="DataTD"><?=_("Certificate status")?></td> <td colspan="8" class="DataTD" > <select name="status"> - <option <?if (0==$status) { - ?> selected <? - }?>value="0"><?=_("Actual")?></option> - <option <?if (0==$status) { - ?> selected <? - }?>value="1"><?=_("All")?></option> + <?=sprintf("<option value='%d' %s>%s</option>",0, 0 == $status? " selected" : "" ,_("Currrent/Active")) ?> + <?=sprintf("<option value='%d' %s>%s</option>",1, 1 == $status ? " selected" : "" ,_("All")) ?> </select> </td> </tr> diff --git a/pages/account/22.php b/pages/account/22.php index 7ad56bb..a572773 100644 --- a/pages/account/22.php +++ b/pages/account/22.php @@ -31,23 +31,17 @@ $status = array_key_exists('dstatus',$_SESSION['_config']) ? intval($_SESSION['_ <td class="DataTD"><?=_("Organisation")?></td> <td colspan="7" class="DataTD" > <select name="dorgfilterid"> - <option value="0"<? - if (0==$orgfilterid) { - ?> selected <? + <?=sprintf("<option value='%d' %s>%s</option>",0, 0 == $orgfilterid? " selected" : "" ,_("All")) ?> +<? $query = "select `orginfo`.`O`, `orginfo`.`id` + from `org`, `orginfo` + where `org`.`memid`='".intval($_SESSION['profile']['id'])."' `orginfo`.`id` = `org`.`orgid` + ORDER BY `oemail`.`modified` desc"; + $reso = mysql_query($query); + if(mysql_num_rows($reso) >= 1){ + while($row = mysql_fetch_assoc($res)){ + sprintf("<option value='%d' %s>%s</option>",$row['id'], $row['id'] == $orgfilterid? " selected" : "" , $row['O']); } - ?>><?=_("All")?></option> <? - $query = "select `orginfo`.`O`, `orginfo`.`id` - from `org`, `orginfo` - where `org`.`memid`='".intval($_SESSION['profile']['id'])."' `orginfo`.`id` = `org`.`orgid` - ORDER BY `oemail`.`modified` desc"; -$reso = mysql_query($query); -if(mysql_num_rows($reso) >= 1){ - while($row = mysql_fetch_assoc($res)){ - ?><option <?if ($row['id']==$orgfilterid) { - ?> selected <? - }?> value="><?=$row['id']?>"><?=$row['O']?></option> - <?} -}?> + }?> </select> </td> </tr> @@ -55,12 +49,8 @@ if(mysql_num_rows($reso) >= 1){ <td class="DataTD"><?=_("Sorting")?></td> <td colspan="7" class="DataTD" > <select name="dsorting"> - <option <?if (0==$sorting) { - ?> selected <? - }?>value="0"><?=_("expire date (desc)")?></option> - <option <?if (1==$sorting) { - ?> selected <? - }?>value="1"><?=_("Common name, expire date (desc)")?></option> + <?=sprintf("<option value='%d' %s>%s</option>",0, 0 == $sorting? " selected" : "" ,_("expire date (desc)")) ?> + <?=sprintf("<option value='%d' %s>%s</option>",1, 1 == $sorting ? " selected" : "" ,_("Common name, expire date (desc)")) ?> </select> </td> </tr> @@ -68,12 +58,8 @@ if(mysql_num_rows($reso) >= 1){ <td class="DataTD"><?=_("Certificate status")?></td> <td colspan="7" class="DataTD" > <select name="dstatus"> - <option <?if (0==$status) { - ?> selected <? - }?>value="0"><?=_("Actual")?></option> - <option <?if (0==$status) { - ?> selected <? - }?>value="1"><?=_("All")?></option> + <?=sprintf("<option value='%d' %s>%s</option>",0, 0 == $status? " selected" : "" ,_("Currrent/Active")) ?> + <?=sprintf("<option value='%d' %s>%s</option>",1, 1 == $status ? " selected" : "" ,_("All")) ?> </select> </td> </tr> |