// store the post vars in get vars, so that both vars can be accessed at once // it is done this was around, so post vars get's higher priority and overwrites duplicated in get vars if (isset($_POST)) { foreach ($_POST as $arr => $arrval) { $_GET[$arr] = str_replace("'", "", $arrval); } } // see what to do define("CONTACT_DISPLAY_AMOUNT", 25); if (isset($_GET["key"])) { switch ($_GET["key"]) { default: $OUTPUT = listContacts(); } } else { $OUTPUT = listContacts(); } require "template.php"; // function creates the listing of the contacts (listing all if no alphabet letter was specified) function listContacts() { global $_GET, $_SESSION; global $mail_sender; extract($_GET); $OUTPUT = ""; // store unset variables so different commands remember previous values // this way u can search, and go through contacts, suppliers and customers with the same search if (!isset($key)) { $key = ""; } if (!isset($fields)) {
$contact_id = intval(mosGetParam($_REQUEST, 'contact_id', 0)); $catid = intval(mosGetParam($_REQUEST, 'catid', 0)); switch ($op) { case 'sendmail': sendmail($con_id, $option); break; } switch ($task) { case 'view': contactpage($contact_id); break; case 'vcard': vCard($contact_id); break; default: listContacts($option, $catid); break; } function listContacts($option, $catid) { global $mainframe, $database, $my; global $mosConfig_live_site; global $Itemid; /* Query to retrieve all categories that belong under the contacts section and that are published. */ $query = "SELECT *, COUNT( a.id ) AS numlinks" . "\n FROM #__categories AS cc" . "\n LEFT JOIN #__contact_details AS a ON a.catid = cc.id" . "\n WHERE a.published = 1" . "\n AND cc.section = 'com_contact_details'" . "\n AND cc.published = 1" . "\n AND a.access <= " . (int) $my->gid . "\n AND cc.access <= " . (int) $my->gid . "\n GROUP BY cc.id" . "\n ORDER BY cc.ordering"; $database->setQuery($query); $categories = $database->loadObjectList(); $count = count($categories); if ($count < 2 && @$categories[0]->numlinks == 1) { // if only one record exists loads that record, instead of displying category list contactpage($option, 0);