本文整理汇总了PHP中COM_getPermSQL函数的典型用法代码示例。如果您正苦于以下问题:PHP COM_getPermSQL函数的具体用法?PHP COM_getPermSQL怎么用?PHP COM_getPermSQL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了COM_getPermSQL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fixTopic
/**
* Update array if need be with correct topic.
*
* @param array $A Array of articles from db
* @param string $tid_list List of child topics of current topic
*/
function fixTopic(&$A, $tid_list)
{
global $_TABLES, $topic;
if (!empty($topic)) {
// This case may happen if a article belongs to the current topic but the default topic for the article is a child of the current topic.
$sql = "SELECT t.topic, t.imageurl\n FROM {$_TABLES['topics']} t, {$_TABLES['topic_assignments']} ta\n WHERE t.tid = ta.tid\n AND ta.type = 'article' AND ta.id = '{$A['sid']}' AND ta.tid = '{$topic}'\n " . COM_getLangSQL('tid', 'AND', 't') . COM_getPermSQL('AND', 0, 2, 't');
$result = DB_query($sql);
$nrows = DB_numRows($result);
if ($nrows > 0) {
$B = DB_fetchArray($result);
$A['topic'] = $B['topic'];
$A['imageurl'] = $B['imageurl'];
} else {
// Does not belong to current topic so check inherited
// Make sure sort order the same as in TOPIC_getTopic or articles with multiple topics might not display in the right topic when clicked
$sql = "SELECT t.topic, t.imageurl\n FROM {$_TABLES['topics']} t, {$_TABLES['topic_assignments']} ta\n WHERE t.tid = ta.tid\n AND ta.type = 'article' AND ta.id = '{$A['sid']}'\n AND (ta.tid IN({$tid_list}) AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '{$topic}')))\n " . COM_getLangSQL('tid', 'AND', 't') . COM_getPermSQL('AND', 0, 2, 't') . "\n ORDER BY ta.tdefault DESC, ta.tid ASC";
$result = DB_query($sql);
$nrows = DB_numRows($result);
if ($nrows > 0) {
$B = DB_fetchArray($result);
$A['topic'] = $B['topic'];
$A['imageurl'] = $B['imageurl'];
}
}
}
}
示例2: polllist
/**
* Shows all polls in system
*
* List all the polls on the system if no $pid is provided
*
* @return string HTML for poll listing
*
*/
function polllist()
{
global $_CONF, $_TABLES, $_USER, $_PO_CONF, $LANG25, $LANG_LOGIN, $LANG_POLLS;
$retval = '';
if (empty($_USER['username']) && ($_CONF['loginrequired'] == 1 || $_PO_CONF['pollsloginrequired'] == 1)) {
$retval = COM_startBlock($LANG_LOGIN[1], '', COM_getBlockTemplate('_msg_block', 'header'));
$login = new Template($_CONF['path_layout'] . 'submit');
$login->set_file(array('login' => 'submitloginrequired.thtml'));
$login->set_var('xhtml', XHTML);
$login->set_var('login_message', $LANG_LOGIN[2]);
$login->set_var('site_url', $_CONF['site_url']);
$login->set_var('lang_login', $LANG_LOGIN[3]);
$login->set_var('lang_newuser', $LANG_LOGIN[4]);
$login->parse('output', 'login');
$retval .= $login->finish($login->get_var('output'));
$retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
} else {
require_once $_CONF['path_system'] . 'lib-admin.php';
$header_arr = array(array('text' => $LANG25[9], 'field' => 'topic', 'sort' => true), array('text' => $LANG25[20], 'field' => 'voters', 'sort' => true), array('text' => $LANG25[3], 'field' => 'unixdate', 'sort' => true), array('text' => $LANG_POLLS['open_poll'], 'field' => 'is_open', 'sort' => true));
$defsort_arr = array('field' => 'unixdate', 'direction' => 'desc');
$text_arr = array('has_menu' => false, 'title' => $LANG_POLLS['pollstitle'], 'instructions' => "", 'icon' => '', 'form_url' => '');
$query_arr = array('table' => 'polltopics', 'sql' => $sql = "SELECT *,UNIX_TIMESTAMP(date) AS unixdate, display " . "FROM {$_TABLES['polltopics']} WHERE 1=1", 'query_fields' => array('topic'), 'default_filter' => COM_getPermSQL(), 'query' => '', 'query_limit' => 0);
$retval .= ADMIN_list('polls', 'plugin_getListField_polls', $header_arr, $text_arr, $query_arr, $defsort_arr);
}
return $retval;
}
示例3: EVLIST_pagenav
/**
* Get the Google-style page navigation for the list display
*
* @param string $start Starting date
* @param string $end Ending date
* @param integer $cat Category ID (optional)
* @param integer $page Current page number
* @param integer $range Range being displayed (upcoming, past, etc)
* @return string HTML for page navigation
*/
function EVLIST_pagenav($start, $end, $cat = 0, $page = 0, $range = 0, $cal = 0)
{
global $_TABLES, $_EV_CONF;
$cat = (int) $cat;
$range = (int) $range;
$cal = (int) $cal;
$limit = (int) $_EV_CONF['limit_list'];
if ($limit < 1) {
return '';
}
$base_url = EVLIST_URL . "/index.php?cat={$cat}&cal={$cal}&range={$range}&view=list";
if (!empty($cat)) {
$cat_join = " LEFT JOIN {$_TABLES['evlist_lookup']} l\n ON l.eid = ev.id ";
$cat_where = " AND l.cid = '{$cat}' ";
} else {
$cat_join = '';
$cat_where = '';
}
if ($cal > 0) {
$cal_where = ' AND cal.cal_id = ' . $cal;
} else {
$cal_where = '';
}
$sql = "SELECT count(rep.rp_id) as cnt\n FROM {$_TABLES['evlist_repeat']} rep\n LEFT JOIN {$_TABLES['evlist_events']} ev\n ON ev.id = rep.rp_ev_id\n LEFT JOIN {$_TABLES['evlist_calendars']} cal\n ON cal.cal_id = ev.cal_id\n {$cat_join}\n WHERE ev.status = 1 \n AND (\n (rep.rp_date_start <= '{$end}' AND rep.rp_date_end >= '{$start}')\n OR\n (rep.rp_date_end >= '{$start}' AND rep.rp_date_start <= '{$start}')\n OR\n (rep.rp_date_end <= '{$end}' AND rep.rp_date_start >= '{$start}')\n ) " . COM_getPermSQL('AND', 0, 2, 'ev') . ' ' . COM_getPermSQL('AND', 0, 2, 'cal') . " {$cat_where} {$cal_where}\n ORDER BY rep.rp_date_start ASC";
//echo $sql;die;
$res = DB_query($sql);
list($numrows) = DB_fetchArray($res);
if ($numrows > $limit) {
$numpages = ceil($numrows / $limit);
//$baseurl = EVLIST_URL . '/index.php?' . $range . $andcat;
$retval = COM_printPageNavigation($base_url, $page, $numpages);
}
return $retval;
}
示例4: getChildCategories
public function getChildCategories($pid = FALSE, $all_langs = FALSE)
{
global $_CONF, $_TABLES;
$retval = array();
if ($pid !== FALSE) {
return $retval;
}
$where = array();
$sql = "SELECT tid, topic, imageurl " . "FROM {$_TABLES['topics']} ";
if (Dataproxy::uid() > 1) {
$tids = DB_getItem($_TABLES['userindex'], 'tids', "uid = " . Dataproxy::uid());
if (!empty($tids)) {
$where[] = "(tid NOT IN ('" . str_replace(' ', "','", addslashes($tids)) . "'))";
}
}
// Adds permission check. When uid is 0, then it means access as Root
if (!Dataproxy::isRoot()) {
$temp = COM_getPermSQL('', Dataproxy::uid());
if (!empty($temp)) {
$where[] = $temp;
}
}
// Adds lang id. When uid is 0, then it means access as Root
if (!Dataproxy::isRoot() and function_exists('COM_getLangSQL') and $all_langs === FALSE) {
$temp = COM_getLangSQL('tid', '');
if (!empty($temp)) {
$where[] = $temp;
}
}
if (count($where) > 0) {
$sql .= " WHERE " . implode(" AND ", $where);
}
if ($_CONF['sortmethod'] == 'alpha') {
$sql .= ' ORDER BY topic ASC';
} else {
$sql .= ' ORDER BY sortnum';
}
$result = DB_query($sql);
if (DB_error()) {
return $retval;
}
while (($A = DB_fetchArray($result, FALSE)) !== FALSE) {
$entry = array();
$entry['id'] = stripslashes($A['tid']);
$entry['title'] = stripslashes($A['topic']);
$entry['uri'] = $_CONF['site_url'] . '/index.php?topic=' . $entry['id'];
$entry['date'] = FALSE;
$entry['image_uri'] = stripslashes($A['imageurl']);
$retval[] = $entry;
}
return $retval;
}
示例5: POLLS_pollList
/**
* Shows all polls in system
*
* List all the polls on the system if no $pid is provided
*
* @return string HTML for poll listing
*
*/
function POLLS_pollList()
{
global $_CONF, $_TABLES, $_USER, $_PO_CONF, $LANG25, $LANG_LOGIN, $LANG_POLLS;
$retval = '';
if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_PO_CONF['pollsloginrequired'] == 1)) {
$retval .= SEC_loginRequiredForm();
} else {
USES_lib_admin();
$header_arr = array(array('text' => $LANG25[9], 'field' => 'topic', 'sort' => true), array('text' => $LANG25[20], 'field' => 'voters', 'sort' => true, 'align' => 'center'), array('text' => $LANG25[3], 'field' => 'unixdate', 'sort' => true, 'align' => 'center'), array('text' => $LANG_POLLS['open_poll'], 'field' => 'is_open', 'sort' => true, 'align' => 'center'));
$defsort_arr = array('field' => 'unixdate', 'direction' => 'desc');
$text_arr = array('has_menu' => false, 'title' => $LANG_POLLS['pollstitle'], 'instructions' => "", 'icon' => '', 'form_url' => '');
$query_arr = array('table' => 'polltopics', 'sql' => $sql = "SELECT *,UNIX_TIMESTAMP(date) AS unixdate, display " . "FROM {$_TABLES['polltopics']} WHERE 1=1", 'query_fields' => array('topic'), 'default_filter' => COM_getPermSQL(), 'query' => '', 'query_limit' => 0);
$retval .= ADMIN_list('polls', 'POLLS_getListField', $header_arr, $text_arr, $query_arr, $defsort_arr, '', $token = 'dummy');
}
return $retval;
}
示例6: PAYPAL_listIPNlog
/**
* Displays the list of ipn history from the log stored in the database
*
*/
function PAYPAL_listIPNlog()
{
global $_CONF, $_TABLES, $LANG_PAYPAL_1, $_USER;
require_once $_CONF['path_system'] . 'lib-admin.php';
$retval = '';
if (DB_count($_TABLES['paypal_ipnlog']) == 0) {
$retval .= '<p>' . $LANG_PAYPAL_1['ipnlog_empty'] . '</p>';
}
$header_arr = array(array('text' => $LANG_PAYPAL_1['ID'], 'field' => 'id', 'sort' => true), array('text' => $LANG_PAYPAL_1['IP_address'], 'field' => 'ip_addr', 'sort' => true), array('text' => $LANG_PAYPAL_1['date_time'], 'field' => 'time', 'sort' => true), array('text' => $LANG_PAYPAL_1['verified'], 'field' => 'verified', 'sort' => true), array('text' => $LANG_PAYPAL_1['txn_id'], 'field' => 'txn_id', 'sort' => true), array('text' => $LANG_PAYPAL_1['payment_status'], 'field' => 'payment_status', 'sort' => true), array('text' => $LANG_PAYPAL_1['purchaser'], 'field' => 'custom', 'sort' => true));
$defsort_arr = array('field' => 'id', 'direction' => 'desc');
$text_arr = array('has_extras' => true, 'form_url' => $_CONF['site_admin_url'] . '/plugins/paypal/ipnlog.php');
$sql = "SELECT * FROM {$_TABLES['paypal_ipnlog']} WHERE 1=1";
$query_arr = array('table' => 'paypal_ipnlog', 'sql' => $sql, 'query_fields' => array('id', 'ip_addr', 'time', 'verified', 'txn_id', 'ipn_data'), 'default_filter' => COM_getPermSQL('AND', 0, 3));
$retval .= ADMIN_list('paypal', 'plugin_getListField_paypal_IPNlog', $header_arr, $text_arr, $query_arr, $defsort_arr);
return $retval;
}
示例7: PAYPAL_listDownloads
function PAYPAL_listDownloads()
{
global $_CONF, $_TABLES, $_IMAGE_TYPE, $LANG_ADMIN, $LANG_PAYPAL_1;
require_once $_CONF['path_system'] . 'lib-admin.php';
$retval = '';
if (DB_count($_TABLES['paypal_downloads']) == 0) {
$retval .= '<p>' . $LANG_PAYPAL_1['downloads_history_empty'] . '</p>';
}
$header_arr = array(array('text' => $LANG_PAYPAL_1['ID'], 'field' => 'id', 'sort' => true), array('text' => $LANG_PAYPAL_1['product_id'], 'field' => 'product_id', 'sort' => true), array('text' => $LANG_PAYPAL_1['filename_label'], 'field' => 'file', 'sort' => true), array('text' => $LANG_PAYPAL_1['date_time'], 'field' => 'dl_date', 'sort' => true), array('text' => $LANG_PAYPAL_1['user_id'], 'field' => 'user_id', 'sort' => true));
$defsort_arr = array('field' => 'id', 'direction' => 'desc');
$text_arr = array('has_extras' => true, 'form_url' => $_CONF['site_admin_url'] . '/plugins/paypal/downloads_history.php');
$sql = "SELECT\n\t *\n FROM {$_TABLES['paypal_downloads']}\n\t\t\tWHERE 1=1";
$query_arr = array('table' => 'paypal_downloads', 'sql' => $sql, 'query_fields' => array('id', 'product_id', 'file', 'dl_date', 'user_id'), 'default_filter' => COM_getPermSQL('AND', 0, 3));
$retval .= ADMIN_list('paypal', 'plugin_getListField_paypal_downloads', $header_arr, $text_arr, $query_arr, $defsort_arr);
return $retval;
}
示例8: polllist
/**
* Shows all polls in system
*
* List all the polls on the system if no $pid is provided
*
* @return string HTML for poll listing
*
*/
function polllist()
{
global $_CONF, $_TABLES, $_PO_CONF, $LANG25, $LANG_POLLS;
$retval = '';
if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_PO_CONF['pollsloginrequired'] == 1)) {
$retval .= SEC_loginRequiredForm();
} else {
require_once $_CONF['path_system'] . 'lib-admin.php';
$header_arr = array(array('text' => $LANG25[9], 'field' => 'topic', 'sort' => true), array('text' => $LANG25[20], 'field' => 'voters', 'sort' => true), array('text' => $LANG25[3], 'field' => 'unixdate', 'sort' => true), array('text' => $LANG_POLLS['open_poll'], 'field' => 'is_open', 'sort' => true));
$defsort_arr = array('field' => 'unixdate', 'direction' => 'desc');
$text_arr = array('has_menu' => false, 'title' => $LANG_POLLS['pollstitle'], 'instructions' => "", 'icon' => '', 'form_url' => '', 'form_url' => $_CONF['site_url'] . '/polls/index.php');
$query_arr = array('table' => 'polltopics', 'sql' => $sql = "SELECT *,UNIX_TIMESTAMP(created) AS unixdate, display " . "FROM {$_TABLES['polltopics']} WHERE 1=1", 'query_fields' => array('topic'), 'default_filter' => COM_getPermSQL(), 'query' => '', 'query_limit' => 0);
$retval .= ADMIN_list('polls', 'plugin_getListField_polls', $header_arr, $text_arr, $query_arr, $defsort_arr);
}
return $retval;
}
示例9: MAPS_listMarkersAdmin
/**
* List all markers that the user has access to
*
* @retun string HTML for the list
*
*/
function MAPS_listMarkersAdmin()
{
global $_CONF, $_TABLES, $_IMAGE_TYPE, $LANG_ADMIN, $LANG_MAPS_1;
require_once $_CONF['path_system'] . 'lib-admin.php';
$retval = '';
if (DB_count($_TABLES['maps_markers']) == 0) {
return $retval = '';
}
$header_arr = array(array('text' => $LANG_MAPS_1['id'], 'field' => 'mkid', 'sort' => true), array('text' => $LANG_MAPS_1['name'], 'field' => 'name', 'sort' => true), array('text' => $LANG_MAPS_1['map_label'], 'field' => 'mapname', 'sort' => true), array('text' => $LANG_MAPS_1['active_field'], 'field' => 'active', 'sort' => true), array('text' => $LANG_MAPS_1['hidden_field'], 'field' => 'hidden', 'sort' => true), array('text' => $LANG_ADMIN['edit'], 'field' => 'edit', 'sort' => false));
$defsort_arr = array('field' => 'modified', 'direction' => 'desc');
$text_arr = array('has_extras' => true, 'form_url' => $_CONF['site_admin_url'] . '/plugins/maps/markers.php');
$sql = "SELECT\n\t a.*, b.name as mapname\n FROM {$_TABLES['maps_markers']} AS a\n\t\t\tLEFT JOIN\n\t\t\t {$_TABLES['maps_maps']} AS b\n\t\t\tON a.mid = b.mid\n\t\t\tWHERE 1=1";
$query_arr = array('sql' => $sql, 'default_filter' => COM_getPermSQL('AND', 0, 3));
$retval .= ADMIN_list('markers', 'plugin_getListField_markers', $header_arr, $text_arr, $query_arr, $defsort_arr);
return $retval;
}
示例10: MAPS_listmaps
/**
* List all maps that the user has access to
*
* @retun string HTML for the list
*
*/
function MAPS_listmaps()
{
global $_CONF, $_TABLES, $_IMAGE_TYPE, $LANG_ADMIN, $LANG_MAPS_1;
require_once $_CONF['path_system'] . 'lib-admin.php';
$retval = '';
if (DB_count($_TABLES['maps_maps']) == 0) {
return $retval = '';
}
$header_arr = array(array('text' => $LANG_ADMIN['edit'], 'field' => 'edit', 'sort' => false), array('text' => $LANG_MAPS_1['id'], 'field' => 'mid', 'sort' => true), array('text' => $LANG_MAPS_1['name'], 'field' => 'name', 'sort' => true), array('text' => $LANG_MAPS_1['active_field'], 'field' => 'active', 'sort' => true), array('text' => $LANG_MAPS_1['hidden_field'], 'field' => 'hidden', 'sort' => true));
$defsort_arr = array('field' => 'mid', 'direction' => 'asc');
$text_arr = array('has_extras' => true, 'form_url' => $_CONF['site_admin_url'] . '/plugins/maps/index.php');
$sql = "SELECT\n\t *\n FROM {$_TABLES['maps_maps']}\n\t\t\tWHERE 1=1";
$query_arr = array('table' => 'maps_maps', 'sql' => $sql, 'query_fields' => array('name', 'description'), 'default_filter' => COM_getPermSQL('AND', 0, 3));
$retval .= ADMIN_list('maps', 'plugin_getListField_maps', $header_arr, $text_arr, $query_arr, $defsort_arr);
return $retval;
}
示例11: SITEMAPMENU_listTopics
/**
* Returns all topics (and their icons).
*
* @return string HTML for the topic list
*/
function SITEMAPMENU_listTopics($lst, $tid)
{
global $_CONF, $_TABLES, $_USER;
$sql = "SELECT tid, topic, imageurl FROM {$_TABLES['topics']}";
if ($tid != '') {
$sql .= " WHERE (tid = '" . addslashes($tid) . "') ";
}
if (!empty($_USER['uid']) and $_USER['uid'] > 1) {
$tids = DB_getItem($_TABLES['userindex'], 'tids', "uid = '{$_USER['uid']}'");
if (!empty($tids)) {
if ($tid == '') {
$sql .= ' WHERE ';
} else {
$sql .= ' AND ';
}
$sql .= " (tid NOT IN ('" . str_replace(' ', "','", $tids) . "'))" . COM_getPermSQL('AND');
} else {
if ($tid != '') {
$sql .= COM_getPermSQL('AND');
} else {
$sql .= COM_getPermSQL();
}
}
} else {
if ($tid != '') {
$sql .= COM_getPermSQL('AND');
} else {
$sql .= COM_getPermSQL();
}
}
if ($_CONF['sortmethod'] == 'alpha') {
$sql .= ' ORDER BY topic ASC';
} else {
$sql .= ' ORDER BY sortnum';
}
$result = DB_query($sql);
$retval = '';
while (($A = DB_fetchArray($result)) !== false) {
$retval .= '<h3 class="nav-title">' . SITEMAPMENU_esc(stripslashes($A['topic'])) . '</h3>' . LB;
if ($lst == 'all') {
$retval .= SITEMAPMENU_listStory($A['tid']);
}
}
return $retval;
}
示例12: listpolls
function listpolls()
{
global $_CONF, $_TABLES, $_IMAGE_TYPE, $LANG_ADMIN, $LANG25, $LANG_ACCESS;
require_once $_CONF['path_system'] . 'lib-admin.php';
$retval = '';
// writing the menu on top
$menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/plugins/polls/index.php?mode=edit', 'text' => $LANG_ADMIN['create_new']), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
$retval .= COM_startBlock($LANG25[18], '', COM_getBlockTemplate('_admin_block', 'header'));
$retval .= ADMIN_createMenu($menu_arr, $LANG25[19], plugin_geticon_polls());
// writing the actual list
$header_arr = array(array('text' => $LANG_ADMIN['edit'], 'field' => 'edit', 'sort' => false), array('text' => $LANG25[9], 'field' => 'topic', 'sort' => true), array('text' => $LANG25[20], 'field' => 'voters', 'sort' => true), array('text' => $LANG_ACCESS['access'], 'field' => 'access', 'sort' => false), array('text' => $LANG25[3], 'field' => 'unixdate', 'sort' => true), array('text' => $LANG25[33], 'field' => 'is_open', 'sort' => true));
$defsort_arr = array('field' => 'unixdate', 'direction' => 'desc');
$text_arr = array('has_extras' => true, 'instructions' => $LANG25[19], 'form_url' => $_CONF['site_admin_url'] . '/plugins/polls/index.php');
$query_arr = array('table' => 'polltopics', 'sql' => "SELECT *,UNIX_TIMESTAMP(created) AS unixdate " . "FROM {$_TABLES['polltopics']} WHERE 1=1", 'query_fields' => array('topic'), 'default_filter' => COM_getPermSQL('AND'));
$retval .= ADMIN_list('polls', 'plugin_getListField_polls', $header_arr, $text_arr, $query_arr, $defsort_arr);
$retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
return $retval;
}
示例13: makeProjectFileList
function makeProjectFileList($lid)
{
global $_CONF, $_TABLES, $LANG01, $_DLM_CONF, $LANG_DLM, $LANG_ADMIN;
require_once $_CONF['path_system'] . 'lib-admin.php';
$retval = '';
$project = DB_getItem($_TABLES['downloads'], 'project', "lid = '" . addslashes($lid) . "'");
if ($project == false) {
return '';
}
$permsql = $_DLM_CONF['has_edit_rights'] ? '' : COM_getPermSQL('AND', 0, 2, 'b');
$result = DB_query("SELECT a.lid, a.title, a.url, a.version, a.size, a.date, a.cid " . "FROM {$_TABLES['downloads']} a " . "LEFT JOIN {$_TABLES['downloadcategories']} b ON a.cid=b.cid " . "WHERE a.project='" . addslashes($project) . "' " . "AND a.project<>'' " . "AND a.is_released=1 " . $permsql . " ORDER BY a.date DESC LIMIT 10");
$header_arr = array(array('text' => $LANG_ADMIN['title'], 'field' => 'title'), array('text' => $LANG_DLM['file'], 'field' => 'url'), array('text' => $LANG_DLM['ver'], 'field' => 'version'), array('text' => $LANG_DLM['size'], 'field' => 'size'), array('text' => $LANG_DLM['submitdate'], 'field' => 'date'));
$data_arr = array();
$text_arr = array('has_menu' => false, 'title' => sprintf($LANG_DLM['projectfilelist'], $project));
while ($A = DB_fetchArray($result)) {
if (!matchLanguage($A['cid'])) {
continue;
}
$data_arr[] = array('title' => COM_createLink($A['title'], COM_buildURL($_CONF['site_url'] . '/downloads/index.php?id=' . $A['lid'])), 'url' => COM_createLink($A['url'], COM_buildURL($_CONF['site_url'] . '/downloads/visit.php?id=' . $A['lid'])), 'version' => $A['version'], 'size' => $A['size'], 'date' => strftime($_DLM_CONF['date_format'], $A['date']));
}
$retval .= ADMIN_simpleList('', $header_arr, $text_arr, $data_arr);
return $retval;
}
示例14: userprofile
//.........这里部分代码省略.........
}
}
$user_templates->set_var('lang_email', $LANG04[5]);
$user_templates->set_var('user_id', $user);
if ($A['email'] == '' || $A['emailfromuser'] == 0) {
$user_templates->set_var('email_option', '');
} else {
$user_templates->set_var('lang_sendemail', $LANG04[81]);
$user_templates->parse('email_option', 'email', true);
}
$user_templates->set_var('lang_homepage', $LANG04[6]);
$user_templates->set_var('user_homepage', COM_killJS($A['homepage']));
$user_templates->set_var('lang_location', $LANG04[106]);
$user_templates->set_var('user_location', strip_tags($A['location']));
$user_templates->set_var('lang_online', $LANG04[160]);
$user_templates->set_var('lang_bio', $LANG04[7]);
$user_templates->set_var('user_bio', nl2br($A['about']));
$user_templates->set_var('follow_me', SOC_getFollowMeIcons($user, 'follow_user_profile.thtml'));
$user_templates->set_var('lang_pgpkey', $LANG04[8]);
$user_templates->set_var('user_pgp', nl2br($A['pgpkey']));
$user_templates->set_var('start_block_last10stories', COM_startBlock($LANG04[82] . ' ' . $display_name));
if (!isset($_CONF['comment_engine']) || $_CONF['comment_engine'] == 'internal') {
$user_templates->set_var('start_block_last10comments', COM_startBlock($LANG04[10] . ' ' . $display_name));
}
$user_templates->set_var('start_block_postingstats', COM_startBlock($LANG04[83] . ' ' . $display_name));
$user_templates->set_var('lang_title', $LANG09[16]);
$user_templates->set_var('lang_date', $LANG09[17]);
// for alternative layouts: use these as headlines instead of block titles
$user_templates->set_var('headline_last10stories', $LANG04[82] . ' ' . $display_name);
if (!isset($_CONF['comment_engine']) || $_CONF['comment_engine'] == 'internal') {
$user_templates->set_var('headline_last10comments', $LANG04[10] . ' ' . $display_name);
}
$user_templates->set_var('headline_postingstats', $LANG04[83] . ' ' . $display_name);
$result = DB_query("SELECT tid FROM {$_TABLES['topics']}" . COM_getPermSQL());
$nrows = DB_numRows($result);
$tids = array();
for ($i = 0; $i < $nrows; $i++) {
$T = DB_fetchArray($result);
$tids[] = $T['tid'];
}
$topics = "'" . implode("','", $tids) . "'";
// list of last 10 stories by this user
if (sizeof($tids) > 0) {
$sql = "SELECT sid,title,UNIX_TIMESTAMP(date) AS unixdate FROM {$_TABLES['stories']} WHERE (uid = '" . (int) $user . "') AND (draft_flag = 0) AND (date <= NOW()) AND (tid IN ({$topics}))" . COM_getPermSQL('AND');
$sql .= " ORDER BY unixdate DESC LIMIT 10";
$result = DB_query($sql);
$nrows = DB_numRows($result);
} else {
$nrows = 0;
}
if ($nrows > 0) {
for ($i = 0; $i < $nrows; $i++) {
$C = DB_fetchArray($result);
$user_templates->set_var('cssid', $i % 2 + 1);
$user_templates->set_var('row_number', $i + 1 . '.');
$articleUrl = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $C['sid']);
$user_templates->set_var('article_url', $articleUrl);
$C['title'] = str_replace('$', '$', $C['title']);
$user_templates->set_var('story_title', COM_createLink($C['title'], $articleUrl, array('class' => '')));
$storytime = COM_getUserDateTimeFormat($C['unixdate']);
$user_templates->set_var('story_date', $storytime[0]);
$user_templates->parse('story_row', 'strow', true);
}
} else {
$user_templates->set_var('story_row', '<tr><td>' . $LANG01[37] . '</td></tr>');
}
示例15: links_edit_category
function links_edit_category($cid, $pid)
{
global $_CONF, $_TABLES, $_USER, $MESSAGE, $LANG_LINKS_ADMIN, $LANG_ADMIN, $LANG_ACCESS, $_LI_CONF;
$retval = '';
$cid = addslashes($cid);
if (!empty($pid)) {
// have parent id, so making a new subcategory
// get parent access rights
$result = DB_query("SELECT group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['linkcategories']} WHERE cid='" . addslashes($pid) . "'");
$A = DB_fetchArray($result);
$A['owner_id'] = $_USER['uid'];
$A['pid'] = $pid;
} elseif (!empty($cid)) {
// have category id, so editing a category
$sql = "SELECT * FROM {$_TABLES['linkcategories']} WHERE cid='{$cid}'" . COM_getPermSQL('AND');
$result = DB_query($sql);
$A = DB_fetchArray($result);
} else {
// nothing, so making a new top-level category
// get default access rights
$A['group_id'] = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name='Links Admin'");
SEC_setDefaultPermissions($A, $_LI_CONF['category_permissions']);
$A['owner_id'] = $_USER['uid'];
$A['pid'] = $_LI_CONF['root'];
}
$access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
if ($access < 3) {
return COM_showMessage(6, 'links');
}
$token = SEC_createToken();
$retval .= COM_startBlock($LANG_LINKS_ADMIN[56], '', COM_getBlockTemplate('_admin_block', 'header'));
$retval .= SEC_getTokenExpiryNotice($token);
$T = new Template($_CONF['path'] . 'plugins/links/templates/admin');
$T->set_file(array('page' => 'categoryeditor.thtml'));
$T->set_var('xhtml', XHTML);
$T->set_var('site_url', $_CONF['site_url']);
$T->set_var('site_admin_url', $_CONF['site_admin_url']);
$T->set_var('layout_url', $_CONF['layout_url']);
$T->set_var('lang_pagetitle', $LANG_LINKS_ADMIN[28]);
$T->set_var('lang_link_list', $LANG_LINKS_ADMIN[53]);
$T->set_var('lang_new_link', $LANG_LINKS_ADMIN[51]);
$T->set_var('lang_validate_links', $LANG_LINKS_ADMIN[26]);
$T->set_var('lang_list_categories', $LANG_LINKS_ADMIN[50]);
$T->set_var('lang_new_category', $LANG_LINKS_ADMIN[52]);
$T->set_var('lang_admin_home', $LANG_ADMIN['admin_home']);
$T->set_var('instructions', $LANG_LINKS_ADMIN[29]);
$T->set_var('lang_category', $LANG_LINKS_ADMIN[30]);
$T->set_var('lang_cid', $LANG_LINKS_ADMIN[32]);
$T->set_var('lang_description', $LANG_LINKS_ADMIN[31]);
$T->set_var('lang_topic', $LANG_LINKS_ADMIN[33]);
$T->set_var('lang_parent', $LANG_LINKS_ADMIN[34]);
$T->set_var('lang_save', $LANG_ADMIN['save']);
if (!empty($cid)) {
$delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>';
$jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
$T->set_var('delete_option', sprintf($delbutton, $jsconfirm));
$T->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
} else {
$T->set_var('delete_option', '');
}
$T->set_var('lang_cancel', $LANG_ADMIN['cancel']);
if (!empty($cid)) {
$T->set_var('cid_value', $A['cid']);
$T->set_var('old_cid_value', $A['cid']);
$T->set_var('category_options', links_select_box(3, $A['pid']));
$T->set_var('category_value', $A['category']);
$T->set_var('description_value', $A['description']);
} else {
$A['cid'] = COM_makeSid();
$T->set_var('cid_value', $A['cid']);
$T->set_var('old_cid_value', '');
$T->set_var('category_options', links_select_box(3, $A['pid']));
$T->set_var('category_value', '');
$T->set_var('description_value', '');
}
if (!isset($A['tid'])) {
$A['tid'] = 'all';
}
$topics = COM_topicList('tid,topic', $A['tid'], 1, true);
$T->set_var('topic_list', $topics);
$alltopics = '<option value="all"';
if ($A['tid'] == 'all') {
$alltopics .= ' selected="selected"';
}
$alltopics .= '>' . $LANG_LINKS_ADMIN[35] . '</option>' . LB;
$T->set_var('topic_selection', '<select name="tid">' . $alltopics . $topics . '</select>');
if (empty($cid)) {
$num_links = $LANG_ADMIN['na'];
} else {
$nresult = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['links']} WHERE cid='{$cid}'" . COM_getPermSQL('AND'));
$N = DB_fetchArray($nresult);
$num_links = COM_numberFormat($N['count']);
}
$T->set_var('lang_num_links', $LANG_LINKS_ADMIN[61]);
$T->set_var('num_links', $num_links);
// user access info
$T->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
$T->set_var('lang_owner', $LANG_ACCESS['owner']);
$T->set_var('owner_name', COM_getDisplayName($A['owner_id']));
$T->set_var('cat_ownerid', $A['owner_id']);
//.........这里部分代码省略.........