function find_token($additionalsql, $wantname) { if (!get_input_bool('sortbyvalue', 'Sort By Value', &$sbv, 'n')) { return; } $sql = 'select tok.tokenname as tokenname,' . ' tok.tokenval as tokenval,' . ' ext.extname as extname' . ' from alextreg_tokens as tok' . ' left outer join alextreg_extensions as ext' . ' on tok.extid=ext.id where (1=1)' . $additionalsql; if (!is_authorized_vendor()) { $sql .= " and (ext.public=1)"; } $sql .= ' order by ' . ($sbv ? 'tok.tokenval' : 'tok.tokenname'); $query = do_dbquery($sql); if ($query == false) { return; } else { render_token_list($wantname, $query); } db_free_result($query); }
function op_showhideext() { if (!welcome_here()) { return; } if (!get_input_string('extname', 'extension name', $extname)) { return; } if (!get_input_int('extid', 'extension id', $extid)) { return; } if (!get_input_bool('newval', 'toggle value', $newval)) { return; } $sqlauthor = db_escape_string($_SERVER['REMOTE_USER']); $sql = "update alextreg_extensions set public={$newval}, lastedit=NOW(), lasteditauthor='{$sqlauthor}' where id={$extid}"; if (do_dbupdate($sql) == 1) { $pubpriv = $newval ? "public" : "private"; update_papertrail("Extension '{$extname}' toggled {$pubpriv}", $sql, NULL); do_showext($extname); } // if }