当前位置: 首页>>代码示例>>PHP>>正文


PHP COM_numberFormat函数代码示例

本文整理汇总了PHP中COM_numberFormat函数的典型用法代码示例。如果您正苦于以下问题:PHP COM_numberFormat函数的具体用法?PHP COM_numberFormat怎么用?PHP COM_numberFormat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了COM_numberFormat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: DIR_monthLink

/**
* Build link to a month's page
*
* @param    string  $dir_topic  current topic
* @param    int     $year   year to link to
* @param    int     $month  month to link to
* @param    int     $count  number of stories for that month (may be 0)
* @return   string          month name + count, as link or plain text
*
*/
function DIR_monthLink($dir_topic, $year, $month, $count)
{
    global $_CONF, $LANG_MONTH;
    $retval = $LANG_MONTH[$month] . ' (' . COM_numberFormat($count) . ')' . LB;
    if ($count > 0) {
        $month_url = COM_buildUrl($_CONF['site_url'] . '/directory.php' . '?topic=' . urlencode($dir_topic) . '&year=' . $year . '&month=' . $month);
        $retval = COM_createLink($retval, $month_url);
    }
    $retval .= LB;
    return $retval;
}
开发者ID:spacequad,项目名称:glfusion,代码行数:21,代码来源:directory.php

示例2: _showSelectTree

function _showSelectTree($aid = 0, $level = 0)
{
    $album = new mgAlbum($aid);
    $retval = '';
    $children = $album->getChildren();
    if ($album->id != 0 && $album->access > 0) {
        $block = '';
        if (!empty($children)) {
            $retval .= "<script type=\"text/javascript\"><!--" . LB . "function enableBlock" . $album->id . "() {" . LB . "  if (document.galselect.elements['album[" . $album->id . "]'].checked) {" . LB;
            foreach ($children as $child) {
                $retval .= "    document.galselect.elements['album[" . $child . "]'].disabled = true;" . LB;
                $retval .= "    document.galselect.elements['album[" . $child . "]'].checked = true;" . LB;
            }
            $retval .= "  } else {" . LB;
            foreach ($children as $child) {
                $retval .= "    document.galselect.elements['album[" . $child . "]'].disabled = false;" . LB;
                $retval .= "    document.galselect.elements['album[" . $child . "]'].checked = false;" . LB;
            }
            $retval .= "  }" . LB;
            foreach ($children as $child) {
                $child_of_child = $album->getChildren($child);
                if (!empty($child_of_child)) {
                    $retval .= '  enableBlock' . $child . '();' . LB;
                }
            }
            $retval .= "}" . LB . "// -->" . LB . "</script>" . LB;
            $block = 'onclick="enableBlock' . $album->id . '()" onchange="enableBlock' . $album->id . '()"';
        }
        if ($album->parent != 0) {
            $block = '';
        }
        $px = ($level - 1) * 15;
        $retval .= '<div style="margin-left:' . $px . 'px;">' . '<input type="checkbox" name="album[' . $album->id . ']" id="album_' . $album->id . '" value="1" ' . $block . XHTML . '>&nbsp;&nbsp;' . strip_tags($album->title) . ' (' . COM_numberFormat($album->album_disk_usage / 1024) . ' Kb)</div>' . LB;
    }
    $level++;
    foreach ($children as $child) {
        $retval .= _showSelectTree($child, $level);
    }
    return $retval;
}
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:40,代码来源:massdelete.php

示例3: batchreminders

/**
* This function used to send out reminders to users to access the site or account may be deleted
*
* @return   string          HTML with success or error message
*
*/
function batchreminders()
{
    global $_CONF, $_TABLES, $LANG04, $LANG28;
    $msg = '';
    $user_list = array();
    if (isset($_POST['delitem'])) {
        $user_list = $_POST['delitem'];
    }
    if (count($user_list) == 0) {
        $msg = $LANG28[79] . '<br' . XHTML . '>';
    }
    $c = 0;
    if (isset($_POST['delitem']) and is_array($_POST['delitem'])) {
        foreach ($_POST['delitem'] as $delitem) {
            $userid = COM_applyFilter($delitem);
            $useremail = DB_getItem($_TABLES['users'], 'email', "uid = '{$userid}'");
            $username = DB_getItem($_TABLES['users'], 'username', "uid = '{$userid}'");
            $lastlogin = DB_getItem($_TABLES['userinfo'], 'lastlogin', "uid = '{$userid}'");
            $lasttime = COM_getUserDateTimeFormat($lastlogin);
            if (file_exists($_CONF['path_data'] . 'reminder_email.txt')) {
                $template = COM_newTemplate($_CONF['path_data']);
                $template->set_file(array('mail' => 'reminder_email.txt'));
                $template->set_var('site_name', $_CONF['site_name']);
                $template->set_var('site_slogan', $_CONF['site_slogan']);
                $template->set_var('lang_username', $LANG04[2]);
                $template->set_var('username', $username);
                $template->set_var('name', COM_getDisplayName($uid));
                $template->set_var('lastlogin', $lasttime[0]);
                $template->parse('output', 'mail');
                $mailtext = $template->finish($template->get_var('output'));
            } else {
                if ($lastlogin == 0) {
                    $mailtext = $LANG28[83] . "\n\n";
                } else {
                    $mailtext = sprintf($LANG28[82], $lasttime[0]) . "\n\n";
                }
                $mailtext .= sprintf($LANG28[84], $username) . "\n";
                $mailtext .= sprintf($LANG28[85], $_CONF['site_url'] . '/users.php?mode=getpassword') . "\n\n";
            }
            $subject = sprintf($LANG28[81], $_CONF['site_name']);
            if ($_CONF['site_mail'] !== $_CONF['noreply_mail']) {
                $mailfrom = $_CONF['noreply_mail'];
                $mailtext .= LB . LB . $LANG04[159];
            } else {
                $mailfrom = $_CONF['site_mail'];
            }
            if (COM_mail($useremail, $subject, $mailtext, $mailfrom)) {
                DB_query("UPDATE {$_TABLES['users']} SET num_reminders=num_reminders+1 WHERE uid={$userid}");
                $c++;
            } else {
                COM_errorLog("Error attempting to send account reminder to use:{$username} ({$userid})");
            }
        }
    }
    // Since this function is used for deletion only, its necessary to say that
    // zero where deleted instead of just leaving this message away.
    COM_numberFormat($c);
    // just in case we have more than 999)..
    $msg .= "{$LANG28[80]}: {$c}<br" . XHTML . ">\n";
    return $msg;
}
开发者ID:milk54,项目名称:geeklog-japan,代码行数:67,代码来源:user.php

示例4: DBADMIN_list

/**
*   List all backups, i.e. all files ending in .sql or .sql.gz
*
*   @return string  HTML for the list of files or an error when not writable
*/
function DBADMIN_list()
{
    global $_CONF, $_TABLES, $_IMAGE_TYPE, $LANG08, $LANG_ADMIN, $LANG_DB_BACKUP;
    global $token;
    USES_lib_admin();
    $retval = '';
    if (is_writable($_CONF['backup_path'])) {
        $backups = array();
        $fd = opendir($_CONF['backup_path']);
        $index = 0;
        while (false !== ($file = @readdir($fd))) {
            if ($file != '.' && $file != '..' && $file != 'CVS' && preg_match('/\\.sql(\\.gz)?$/i', $file)) {
                $index++;
                clearstatcache();
                $backups[] = $file;
            }
        }
        // AS, 2004-03-29 - Sort backup files by date, newest first.
        // Order given by 'readdir' might not be correct.
        usort($backups, 'DBADMIN_compareBackupFiles');
        $data_arr = array();
        $diskIconUrl = $_CONF['layout_url'] . '/images/admin/disk.' . $_IMAGE_TYPE;
        $attr['title'] = $LANG_DB_BACKUP['download'];
        $alt = $LANG_DB_BACKUP['download'];
        $num_backups = count($backups);
        $icon_img = COM_createImage($diskIconUrl, $alt, $attr);
        for ($i = 0; $i < $num_backups; $i++) {
            $downloadUrl = LGLIB_ADMIN_URL . '/index.php?download=x&amp;file=' . urlencode($backups[$i]);
            $downloadLink = COM_createLink($icon_img, $downloadUrl, $attr);
            $downloadLink .= '&nbsp;&nbsp;';
            $attr['style'] = 'vertical-align:top;';
            $downloadLink .= COM_createLink($backups[$i], $downloadUrl, $attr);
            $backupfile = $_CONF['backup_path'] . $backups[$i];
            $backupfilesize = COM_numberFormat(filesize($backupfile)) . ' <b>' . $LANG_DB_BACKUP['bytes'] . '</b>';
            $data_arr[$i] = array('file' => $downloadLink, 'size' => $backupfilesize, 'filename' => $backups[$i]);
        }
        $retval .= DBADMIN_menu("<p>{$LANG_DB_BACKUP['db_explanation']}</p><p>" . sprintf($LANG_DB_BACKUP['total_number'], $index) . '</p>');
        $header_arr = array(array('text' => $LANG_DB_BACKUP['backup_file'], 'field' => 'file'), array('text' => $LANG_DB_BACKUP['size'], 'field' => 'size'));
        $text_arr = array('form_url' => LGLIB_ADMIN_URL . '/index.php');
        $form_arr = array('bottom' => '', 'top' => '');
        if ($num_backups > 0) {
            $form_arr['bottom'] = '<input type="hidden" name="delete" value="x" />' . '<input type="hidden" name="' . CSRF_TOKEN . '" value="' . $token . '" />' . LB;
        }
        $options = array('chkselect' => true, 'chkminimum' => 0, 'chkfield' => 'filename');
        $retval .= ADMIN_simpleList('', $header_arr, $text_arr, $data_arr, $options, $form_arr);
        $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    } else {
        $retval .= COM_startBlock($LANG08[06], '', COM_getBlockTemplate('_msg_block', 'header'));
        $retval .= $LANG_DB_BACKUP['no_access'];
        COM_errorLog($_CONF['backup_path'] . ' is not writable.', 1);
        $retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
    }
    return $retval;
}
开发者ID:JohnToro,项目名称:lglib,代码行数:59,代码来源:index.php

示例5: 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']);
//.........这里部分代码省略.........
开发者ID:hostellerie,项目名称:nexpro,代码行数:101,代码来源:category.php

示例6: COM_createLink

                        if (SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']) == 3 && SEC_hasRights('calendarjp.edit')) {
                            $editurl = $_CONF['site_admin_url'] . '/plugins/calendarjp/index.php?mode=edit&amp;eid=' . $A['eid'];
                            $cal_templates->set_var('event_edit', COM_createLink($LANG01[4], $editurl));
                            $img = '<img src="' . $_CONF['layout_url'] . '/images/edit.' . $_IMAGE_TYPE . '" alt="' . $LANG01[4] . '" title="' . $LANG01[4] . '"' . XHTML . '>';
                            $cal_templates->set_var('edit_icon', COM_createLink($img, $editurl));
                            $cal_templates->set_var('hits_admin', COM_numberFormat($A['hits']));
                            $cal_templates->set_var('lang_hits_admin', $LANG10[30]);
                        } else {
                            $cal_templates->set_var('event_edit', '');
                            $cal_templates->set_var('edit_icon', '');
                        }
                    }
                    if ($mode == 'personal') {
                        // personal events don't have a hits counter
                        $cal_templates->set_var('lang_hits', '');
                        $cal_templates->set_var('hits', '');
                    } else {
                        $cal_templates->set_var('lang_hits', $LANG10[30]);
                        $cal_templates->set_var('hits', COM_numberFormat($A['hits']));
                    }
                    $cal_templates->parse('event_details', 'details', true);
                }
            }
            $cal_templates->parse('output', 'events');
            $display .= $cal_templates->finish($cal_templates->get_var('output'));
        }
        $display .= COM_endBlock();
        $display = COM_createHTMLDocument($display, array('pagetitle' => $pagetitle));
}
// end switch
COM_output($display);
开发者ID:milk54,项目名称:geeklog-japan,代码行数:31,代码来源:event.php

示例7: edittopic


//.........这里部分代码省略.........
    if (!empty($tid) && SEC_hasRights('topic.edit')) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $topic_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        $topic_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
        $topic_templates->set_var('warning_msg', $LANG27[6]);
    }
    $topic_templates->set_var('lang_topicid', $LANG27[2]);
    $topic_templates->set_var('topic_id', $A['tid']);
    $topic_templates->set_var('lang_donotusespaces', $LANG27[5]);
    $topic_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
    $topic_templates->set_var('lang_owner', $LANG_ACCESS['owner']);
    $ownername = COM_getDisplayName($A['owner_id']);
    $topic_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}"));
    $topic_templates->set_var('owner_name', $ownername);
    $topic_templates->set_var('owner', $ownername);
    $topic_templates->set_var('owner_id', $A['owner_id']);
    $topic_templates->set_var('lang_group', $LANG_ACCESS['group']);
    $topic_templates->set_var('lang_save', $LANG_ADMIN['save']);
    $topic_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $topic_templates->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access));
    $topic_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']);
    $topic_templates->set_var('lang_permissions_key', $LANG_ACCESS['permissionskey']);
    $topic_templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
    $topic_templates->set_var('permissions_msg', $LANG_ACCESS['permmsg']);
    $topic_templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']);
    $topic_templates->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']));
    // show sort order only if they specified sortnum as the sort method
    if ($_CONF['sortmethod'] != 'alpha') {
        $topic_templates->set_var('lang_sortorder', $LANG27[10]);
        if ($A['sortnum'] == 0) {
            $A['sortnum'] = '';
        }
        $topic_templates->set_var('sort_order', '<input type="text" size="3" maxlength="3" name="sortnum" value="' . $A['sortnum'] . '"' . XHTML . '>');
    } else {
        $topic_templates->set_var('lang_sortorder', $LANG27[14]);
        $topic_templates->set_var('sort_order', $LANG27[15]);
    }
    $topic_templates->set_var('lang_storiesperpage', $LANG27[11]);
    if ($A['limitnews'] == 0) {
        $topic_templates->set_var('story_limit', '');
    } else {
        $topic_templates->set_var('story_limit', $A['limitnews']);
    }
    $topic_templates->set_var('default_limit', $_CONF['limitnews']);
    $topic_templates->set_var('lang_defaultis', $LANG27[16]);
    $topic_templates->set_var('lang_topicname', $LANG27[3]);
    $topic_templates->set_var('topic_name', stripslashes($A['topic']));
    if (empty($A['tid'])) {
        $A['imageurl'] = '/images/topics/';
    }
    $topic_templates->set_var('lang_topicimage', $LANG27[4]);
    $topic_templates->set_var('lang_uploadimage', $LANG27[27]);
    $topic_templates->set_var('icon_dimensions', $_CONF['max_topicicon_width'] . ' x ' . $_CONF['max_topicicon_height']);
    $topic_templates->set_var('lang_maxsize', $LANG27[28]);
    $topic_templates->set_var('max_url_length', 255);
    $topic_templates->set_var('image_url', $A['imageurl']);
    $topic_templates->set_var('lang_metadescription', $LANG_ADMIN['meta_description']);
    $topic_templates->set_var('lang_metakeywords', $LANG_ADMIN['meta_keywords']);
    if (!empty($A['meta_description'])) {
        $topic_templates->set_var('meta_description', $A['meta_description']);
    }
    if (!empty($A['meta_keywords'])) {
        $topic_templates->set_var('meta_keywords', $A['meta_keywords']);
    }
    $topic_templates->set_var('lang_defaulttopic', $LANG27[22]);
    $topic_templates->set_var('lang_defaulttext', $LANG27[23]);
    if ($A['is_default'] == 1) {
        $topic_templates->set_var('default_checked', 'checked="checked"');
    } else {
        $topic_templates->set_var('default_checked', '');
    }
    $topic_templates->set_var('lang_archivetopic', $LANG27[25]);
    $topic_templates->set_var('lang_archivetext', $LANG27[26]);
    $topic_templates->set_var('archive_disabled', '');
    if ($A['archive_flag'] == 1) {
        $topic_templates->set_var('archive_checked', 'checked="checked"');
    } else {
        $topic_templates->set_var('archive_checked', '');
        // Only 1 topic can be the archive topic - so check if there already is one
        if (DB_count($_TABLES['topics'], 'archive_flag', '1') > 0) {
            $topic_templates->set_var('archive_disabled', 'disabled');
        }
    }
    if (empty($tid)) {
        $num_stories = $LANG_ADMIN['na'];
    } else {
        $nresult = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['stories']} WHERE tid = '" . addslashes($tid) . "'" . COM_getPermSql('AND'));
        $N = DB_fetchArray($nresult);
        $num_stories = COM_numberFormat($N['count']);
    }
    $topic_templates->set_var('lang_num_stories', $LANG27[30]);
    $topic_templates->set_var('num_stories', $num_stories);
    $topic_templates->set_var('gltoken_name', CSRF_TOKEN);
    $topic_templates->set_var('gltoken', $token);
    $topic_templates->parse('output', 'editor');
    $retval .= $topic_templates->finish($topic_templates->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
开发者ID:hostellerie,项目名称:nexpro,代码行数:101,代码来源:topic.php

示例8: userprofile


//.........这里部分代码省略.........
    $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 (count($tids) > 0) {
        $sql = "SELECT sid,title,UNIX_TIMESTAMP(date) AS unixdate FROM {$_TABLES['stories']} WHERE (uid = {$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('$', '&#36;', $C['title']);
            $user_templates->set_var('story_title', COM_createLink(stripslashes($C['title']), $articleUrl, array('class' => 'b')));
            $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>');
    }
    // list of last 10 comments by this user
    $sidArray = array();
    if (count($tids) > 0) {
        // first, get a list of all stories the current visitor has access to
        $sql = "SELECT sid FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date <= NOW()) AND (tid IN ({$topics}))" . COM_getPermSQL('AND');
        $result = DB_query($sql);
        $numsids = DB_numRows($result);
        for ($i = 1; $i <= $numsids; $i++) {
            $S = DB_fetchArray($result);
            $sidArray[] = $S['sid'];
        }
    }
    $sidList = implode("', '", $sidArray);
    $sidList = "'{$sidList}'";
    // then, find all comments by the user in those stories
    $sql = "SELECT sid,title,cid,UNIX_TIMESTAMP(date) AS unixdate FROM {$_TABLES['comments']} WHERE (uid = {$user}) GROUP BY sid,title,cid,UNIX_TIMESTAMP(date)";
    // SQL NOTE:  Using a HAVING clause is usually faster than a where if the
    // field is part of the select
    // if (!empty ($sidList)) {
    //     $sql .= " AND (sid in ($sidList))";
    // }
    if (!empty($sidList)) {
        $sql .= " HAVING sid in ({$sidList})";
    }
    $sql .= " ORDER BY unixdate DESC LIMIT 10";
    $result = DB_query($sql);
    $nrows = DB_numRows($result);
    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 . '.');
            $comment_url = $_CONF['site_url'] . '/comment.php?mode=view&amp;cid=' . $C['cid'];
            $C['title'] = str_replace('$', '&#36;', $C['title']);
            $user_templates->set_var('comment_title', COM_createLink(stripslashes($C['title']), $comment_url, array('class' => 'b')));
            $commenttime = COM_getUserDateTimeFormat($C['unixdate']);
            $user_templates->set_var('comment_date', $commenttime[0]);
            $user_templates->parse('comment_row', 'row', true);
        }
    } else {
        $user_templates->set_var('comment_row', '<tr><td>' . $LANG01[29] . '</td></tr>');
    }
    // posting stats for this user
    $user_templates->set_var('lang_number_stories', $LANG04[84]);
    $sql = "SELECT COUNT(*) AS count FROM {$_TABLES['stories']} WHERE (uid = {$user}) AND (draft_flag = 0) AND (date <= NOW())" . COM_getPermSQL('AND');
    $result = DB_query($sql);
    $N = DB_fetchArray($result);
    $user_templates->set_var('number_stories', COM_numberFormat($N['count']));
    $user_templates->set_var('lang_number_comments', $LANG04[85]);
    $sql = "SELECT COUNT(*) AS count FROM {$_TABLES['comments']} WHERE (uid = {$user})";
    if (!empty($sidList)) {
        $sql .= " AND (sid in ({$sidList}))";
    }
    $result = DB_query($sql);
    $N = DB_fetchArray($result);
    $user_templates->set_var('number_comments', COM_numberFormat($N['count']));
    $user_templates->set_var('lang_all_postings_by', $LANG04[86] . ' ' . $display_name);
    // Call custom registration function if enabled and exists
    if ($_CONF['custom_registration'] && function_exists('CUSTOM_userDisplay')) {
        $user_templates->set_var('customfields', CUSTOM_userDisplay($user));
    }
    PLG_profileVariablesDisplay($user, $user_templates);
    $user_templates->parse('output', 'profile');
    $retval .= $user_templates->finish($user_templates->get_var('output'));
    $retval .= PLG_profileBlocksDisplay($user);
    return $retval;
}
开发者ID:hostellerie,项目名称:nexpro,代码行数:101,代码来源:usersettings.php

示例9: CMT_commentBar

/**
* This function displays the comment control bar
*
* Prints the control that allows the user to interact with Geeklog Comments
*
* @param    string  $sid    ID of item in question
* @param    string  $title  Title of item
* @param    string  $type   Type of item (i.e. article, photo, etc)
* @param    string  $order  Order that comments are displayed in
* @param    string  $mode   Mode (nested, flat, etc.)
* @param    int     $ccode  Comment code: -1=no comments, 0=allowed, 1=closed
* @return   string          HTML Formated comment bar
* @see CMT_userComments
*
*/
function CMT_commentBar($sid, $title, $type, $order, $mode, $ccode = 0)
{
    global $_CONF, $_TABLES, $_USER, $LANG01;
    $parts = explode('/', $_SERVER['PHP_SELF']);
    $page = array_pop($parts);
    $nrows = DB_count($_TABLES['comments'], array('sid', 'type'), array($sid, $type));
    $commentbar = new Template($_CONF['path_layout'] . 'comment');
    $commentbar->set_file(array('commentbar' => 'commentbar.thtml'));
    $commentbar->set_var('xhtml', XHTML);
    $commentbar->set_var('site_url', $_CONF['site_url']);
    $commentbar->set_var('site_admin_url', $_CONF['site_admin_url']);
    $commentbar->set_var('layout_url', $_CONF['layout_url']);
    $commentbar->set_var('lang_comments', $LANG01[3]);
    $commentbar->set_var('lang_refresh', $LANG01[39]);
    $commentbar->set_var('lang_reply', $LANG01[60]);
    $commentbar->set_var('lang_disclaimer', $LANG01[26]);
    if ($ccode == 0) {
        $commentbar->set_var('reply_hidden_or_submit', 'submit');
    } else {
        $commentbar->set_var('reply_hidden_or_submit', 'hidden');
    }
    $commentbar->set_var('num_comments', COM_numberFormat($nrows));
    $commentbar->set_var('comment_type', $type);
    $commentbar->set_var('sid', $sid);
    $cmt_title = stripslashes($title);
    $commentbar->set_var('story_title', $cmt_title);
    // Article's are pre-escaped.
    if ($type != 'article') {
        $cmt_title = htmlspecialchars($cmt_title);
    }
    $commentbar->set_var('comment_title', $cmt_title);
    if ($type == 'article') {
        $articleUrl = COM_buildUrl($_CONF['site_url'] . "/article.php?story={$sid}");
    } else {
        // for a plugin
        /**
         * Link to plugin defined link or lacking that a generic link
         * that the plugin should support (hopefully)
         */
        list($plgurl, $plgid) = PLG_getCommentUrlId($type);
        $articleUrl = "{$plgurl}?{$plgid}={$sid}";
    }
    $commentbar->set_var('article_url', $articleUrl);
    if ($page == 'comment.php') {
        $link = COM_createLink($cmt_title, $articleUrl, array('class' => 'non-ul b'));
        $commentbar->set_var('story_link', $link);
        $commentbar->set_var('start_storylink_anchortag', '<a href="' . $articleUrl . '" class="non-ul">');
        $commentbar->set_var('end_storylink_anchortag', '</a>');
    } else {
        $commentbar->set_var('story_link', $articleUrl);
    }
    if (!empty($_USER['uid']) && $_USER['uid'] > 1) {
        $username = $_USER['username'];
        $fullname = $_USER['fullname'];
    } else {
        $result = DB_query("SELECT username,fullname FROM {$_TABLES['users']} WHERE uid = 1");
        $N = DB_fetchArray($result);
        $username = $N['username'];
        $fullname = $N['fullname'];
    }
    if (empty($fullname)) {
        $fullname = $username;
    }
    $commentbar->set_var('user_name', $username);
    $commentbar->set_var('user_fullname', $fullname);
    if (!empty($_USER['username'])) {
        $author = COM_getDisplayName($_USER['uid'], $username, $fullname);
        $commentbar->set_var('user_nullname', $author);
        $commentbar->set_var('author', $author);
        $commentbar->set_var('login_logout_url', $_CONF['site_url'] . '/users.php?mode=logout');
        $commentbar->set_var('lang_login_logout', $LANG01[35]);
    } else {
        $commentbar->set_var('user_nullname', '');
        $commentbar->set_var('login_logout_url', $_CONF['site_url'] . '/users.php?mode=new');
        $commentbar->set_var('lang_login_logout', $LANG01[61]);
    }
    if ($page == 'comment.php') {
        $commentbar->set_var('parent_url', $_CONF['site_url'] . '/comment.php');
        $hidden = '';
        if ($_REQUEST['mode'] == 'view') {
            $hidden .= '<input type="hidden" name="cid" value="' . $_REQUEST['cid'] . '"' . XHTML . '>';
            $hidden .= '<input type="hidden" name="pid" value="' . $_REQUEST['cid'] . '"' . XHTML . '>';
        } else {
            if ($_REQUEST['mode'] == 'display') {
                $hidden .= '<input type="hidden" name="pid" value="' . $_REQUEST['pid'] . '"' . XHTML . '>';
//.........这里部分代码省略.........
开发者ID:hostellerie,项目名称:nexpro,代码行数:101,代码来源:lib-comment.php

示例10: thanksVars

 /**
  *   Get the variables from the return URL to display a "thank-you"
  *   message to the buyer.
  *
  *   @uses   getMainUrl()
  *   @uses   PaymentGw::Description()
  *   @param  array   $A      Optionally override the $_GET parameters
  *   @return array           Array of standard name=>value pairs
  */
 public function thanksVars($A = '')
 {
     if (empty($A)) {
         $A = $_GET;
         // Amazon's returnUrl uses $_GET
     }
     list($currency, $amount) = preg_split('/\\s+/', $A['transactionAmount']);
     $amount = COM_numberFormat($amount, 2);
     $R = array('payment_date' => strftime('%d %b %Y @ %H:%M:%S', $A['transactionDate']), 'currency' => $currency, 'payment_amount' => $amount, 'gateway_url' => self::getMainUrl(), 'gateway_name' => self::Description());
     return $R;
 }
开发者ID:NewRoute,项目名称:paypal,代码行数:20,代码来源:amazon.class.php

示例11: USER_sendReminders

/**
* This function used to send out reminders to users to access the site or account may be deleted
*
* @return   string          HTML with success or error message
*
*/
function USER_sendReminders()
{
    global $_CONF, $_TABLES, $LANG04, $LANG28;
    $msg = '';
    $user_list = array();
    if (isset($_POST['delitem'])) {
        $user_list = $_POST['delitem'];
    }
    $nusers = count($user_list);
    if (count($user_list) == 0) {
        $msg = $LANG28[79] . '<br/>';
    } else {
        $c = 0;
        if (isset($_POST['delitem']) and is_array($_POST['delitem'])) {
            foreach ($_POST['delitem'] as $delitem) {
                $uid = COM_applyFilter($delitem);
                $useremail = DB_getItem($_TABLES['users'], 'email', "uid = '{$uid}'");
                $username = DB_getItem($_TABLES['users'], 'username', "uid = '{$uid}'");
                $lastlogin = DB_getItem($_TABLES['userinfo'], 'lastlogin', "uid = '{$uid}'");
                $lasttime = COM_getUserDateTimeFormat($lastlogin);
                if (file_exists($_CONF['path_data'] . 'reminder_email.txt')) {
                    $template = new Template($_CONF['path_data']);
                    $template->set_file(array('mail' => 'reminder_email.txt'));
                    $template->set_var('site_url', $_CONF['site_url']);
                    $template->set_var('site_name', $_CONF['site_name']);
                    $template->set_var('site_slogan', $_CONF['site_slogan']);
                    $template->set_var('lang_username', $LANG04[2]);
                    $template->set_var('username', $username);
                    $template->set_var('name', COM_getDisplayName($uid));
                    $template->set_var('lastlogin', $lasttime[0]);
                    $template->parse('output', 'mail');
                    $mailtext = $template->get_var('output');
                } else {
                    if ($lastlogin == 0) {
                        $mailtext = $LANG28[83] . "\n\n";
                    } else {
                        $mailtext = sprintf($LANG28[82], $lasttime[0]) . "\n\n";
                    }
                    $mailtext .= sprintf($LANG28[84], $username) . "\n";
                    $mailtext .= sprintf($LANG28[85], $_CONF['site_url'] . '/users.php?mode=getpassword') . "\n\n";
                }
                $subject = sprintf($LANG28[81], $_CONF['site_name']);
                if ($_CONF['site_mail'] !== $_CONF['noreply_mail']) {
                    $mailfrom = $_CONF['noreply_mail'];
                    global $LANG_LOGIN;
                    $mailtext .= LB . LB . $LANG04[159];
                } else {
                    $mailfrom = $_CONF['site_mail'];
                }
                $to = array();
                $to = COM_formatEmailAddress($username, $useremail);
                $from = array();
                $from = COM_formatEmailAddress('', $mailfrom);
                if (COM_mail($to, $subject, $mailtext, $from)) {
                    DB_query("UPDATE {$_TABLES['users']} SET num_reminders=num_reminders+1 WHERE uid={$uid}");
                    $c++;
                } else {
                    COM_errorLog("Error attempting to send account reminder to user: {$username} ({$uid})");
                }
            }
        }
        COM_numberFormat($c);
        // just in case we have more than 999)..
        $msg .= "{$LANG28[80]}: {$c}<br/>\n";
    }
    return $msg;
}
开发者ID:spacequad,项目名称:glfusion,代码行数:73,代码来源:user.php

示例12: MG_listDir


//.........这里部分代码省略.........
     * This could cause a problem with the 'create the album structure' feature
     * Need to come up with a better way to handle this.
     */
    /*
        $album_selectbox  = '';
        if (SEC_hasRights('mediagallery.admin') || ($_MG_CONF['member_albums'] == 1 && $_MG_CONF['member_album_root'] == 0)) {
            $album_selectbox .= '<option value="0">' . $LANG_MG01['root_album'] . '</option>';
        }
        $root_album = new mgAlbum(0);
        $root_album->buildAlbumBox($album_selectbox, $album_id, 3, -1, 'upload');
        $album_selectbox .= '</select>';
    */
    //    $album_selectbox  = MG_buildAlbumBox($root_album, $album_id, 3, -1, 'upload');
    $rowcounter = 0;
    $retval = '';
    $T = COM_newTemplate(MG_getTemplatePath($album_id));
    $T->set_file('admin', 'filelist.thtml');
    $T->set_var(array('lang_put_files' => $LANG_MG01['put_files'], 'lang_into_album' => $LANG_MG01['into_album']));
    $destDirCount++;
    $dest = sprintf("d%04d", $destDirCount);
    // build a select box of valid albums for upload
    require_once $_CONF['path'] . 'plugins/mediagallery/include/classAlbum.php';
    $album_selectbox = '<select name="' . $dest . '">' . LB;
    $root_album = new mgAlbum(0);
    $root_album->buildAlbumBox($album_selectbox, $album_id, 3, -1, 'upload');
    $album_selectbox .= '</select>' . LB;
    $T->set_block('admin', 'dirRow', 'dRow');
    $pdir = $dir == '' ? './' : $dir;
    $T->set_var(array('directory' => $pdir, 'destination' => $album_selectbox, 'dirdest' => $dest));
    $T->set_block('admin', 'fileRow', 'fRow');
    // calculate parent directory...
    $dirParts = array();
    $dirParts = explode('/', $dir);
    $numDirs = count($dirParts);
    $dirPath = '';
    if ($numDirs > 1) {
        for ($x = 0; $x < $numDirs - 1; $x++) {
            $dirPath .= $dirParts[$x];
            if ($x < $numDirs - 2) {
                $dirPath .= '/';
            }
        }
        $dirlink = '<a href="' . $_MG_CONF['site_url'] . '/admin.php?mode=list&amp;album_id=' . $album_id . '&amp;dir=' . $dirPath . '">Parent directory</a>';
        $T->set_var(array('row_class' => $rowcounter % 2 ? '2' : '1', 'checkbox' => '', 'palbum' => '', 'pfile' => '', 'dirid' => '', 'filename' => $dirlink, 'fullname' => '', 'filesize' => '', 'parent_select' => '', 'color' => '', 'type' => ''));
        $T->parse('fRow', 'fileRow', true);
        $rowcounter++;
    }
    while (($file = readdir($dh)) != false) {
        if ($file == '..' || $file == '.') {
            continue;
        }
        $filetmp = $directory . $file;
        $filename = basename($file);
        $file_extension = strtolower(substr(strrchr($filename, '.'), 1));
        $isadirectory = 0;
        if (is_dir($filetmp)) {
            $isadirectory = 1;
            $type = 'Directory';
            $fullDir = urlencode($dir . '/' . $filename);
            $dirlink = '<a href="' . $_MG_CONF['site_url'] . '/admin.php?album_id=' . $album_id . '&amp;mode=list&amp;dir=' . $fullDir . '">' . $filename . '</a>';
        }
        if ($isadirectory == 0) {
            switch ($file_extension) {
                case 'jpg':
                case 'bmp':
                case 'tif':
                case 'png':
                    $type = 'Image';
                    break;
                case 'avi':
                case 'wmv':
                case 'asf':
                case 'mov':
                    $type = 'Video';
                    break;
                case 'mp3':
                case 'ogg':
                    $type = 'Audio';
                    break;
                default:
                    $type = 'Unknown';
                    break;
            }
        }
        $max_filesize = DB_getItem($_TABLES['mg_albums'], 'max_filesize', 'album_id=' . intval($album_id));
        $toobig = 0;
        if ($max_filesize != 0 && filesize($filetmp) > $max_filesize) {
            $toobig = 1;
        }
        $pCount++;
        $pvalue = sprintf("i%04d", $pCount);
        $T->set_var(array('row_class' => $rowcounter % 2 ? '2' : '1', 'checkbox' => '<input type="checkbox" name="pic[]" value="' . $pvalue . '"' . XHTML . '>', 'palbum' => '<input type="hidden" name="album_lb_id_' . $pvalue . '" value="' . $dest . '"' . XHTML . '>', 'pfile' => '<input type="hidden" name="picfile_' . $pvalue . '" value="' . $filetmp . '"' . XHTML . '>', 'dirid' => '<input type="hidden" name="dest" value="' . $dest . '"' . XHTML . '>', 'filename' => $isadirectory ? $dirlink : $filename, 'fullname' => $filetmp, 'filesize' => COM_numberFormat(filesize($filetmp) / 1024) . ' kB', 'parent_select' => '<select name="parentaid">' . LB . $album_selectbox, 'color' => $toobig ? '<span style="font-color:red;">' : '<span style="font-color:black;">', 'type' => $type));
        $T->parse('fRow', 'fileRow', true);
        $rowcounter++;
    }
    $T->parse('dRow', 'dirRow', true);
    closedir($dh);
    $retval .= $T->finish($T->parse('output', 'admin'));
    return $retval;
}
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:101,代码来源:ftpmedia.php

示例13: COM_buildUrl

     $bodytext = '<p>' . $bodytext . '</p>';
     $fulltext = '<p>' . $fulltext . '</p>';
     $fulltext_no_br = '<p>' . $fulltext_no_br . '</p>';
 }
 $story_template->set_var('story_introtext', $introtext);
 $story_template->set_var('story_bodytext', $bodytext);
 $story_template->set_var('story_text', $fulltext);
 $story_template->set_var('story_text_no_br', $fulltext_no_br);
 $story_template->set_var('site_name', $_CONF['site_name']);
 $story_template->set_var('site_slogan', $_CONF['site_slogan']);
 $story_template->set_var('story_id', $story->getSid());
 $articleUrl = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $story->getSid());
 if ($story->DisplayElements('commentcode') >= 0) {
     $commentsUrl = $articleUrl . '#comments';
     $comments = $story->DisplayElements('comments');
     $numComments = COM_numberFormat($comments);
     $story_template->set_var('story_comments', $numComments);
     $story_template->set_var('comments_url', $commentsUrl);
     $story_template->set_var('comments_text', $numComments . ' ' . $LANG01[3]);
     $story_template->set_var('comments_count', $numComments);
     $story_template->set_var('lang_comments', $LANG01[3]);
     $comments_with_count = sprintf($LANG01[121], $numComments);
     if ($comments > 0) {
         $comments_with_count = COM_createLink($comments_with_count, $commentsUrl);
     }
     $story_template->set_var('comments_with_count', $comments_with_count);
 }
 $story_template->set_var('lang_full_article', $LANG08[33]);
 $story_template->set_var('article_url', $articleUrl);
 $printable = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $story->getSid() . '&amp;mode=print');
 $story_template->set_var('printable_url', $printable);
开发者ID:alxstuart,项目名称:ajfs.me,代码行数:31,代码来源:article.php

示例14: listbackups

/**
* List all backups, i.e. all files ending in .sql
*
* @return   string      HTML for the list of files or an error when not writable
*
*/
function listbackups()
{
    global $_CONF, $_TABLES, $_IMAGE_TYPE, $LANG08, $LANG_ADMIN, $LANG_DB_BACKUP, $_DB_dbms;
    require_once $_CONF['path_system'] . 'lib-admin.php';
    $retval = '';
    if (is_writable($_CONF['backup_path'])) {
        $backups = array();
        $fd = opendir($_CONF['backup_path']);
        $index = 0;
        while (false !== ($file = @readdir($fd))) {
            if ($file != '.' && $file != '..' && $file != 'CVS' && preg_match('/\\.sql$/i', $file)) {
                $index++;
                clearstatcache();
                $backups[] = $file;
            }
        }
        // AS, 2004-03-29 - Sort backup files by date, newest first.
        // Order given by 'readdir' might not be correct.
        usort($backups, 'compareBackupFiles');
        $data_arr = array();
        $thisUrl = $_CONF['site_admin_url'] . '/database.php';
        $num_backups = count($backups);
        for ($i = 0; $i < $num_backups; $i++) {
            $downloadUrl = $thisUrl . '?mode=download&amp;file=' . urlencode($backups[$i]);
            $downloadLink = COM_createLink($backups[$i], $downloadUrl, array('title' => $LANG_DB_BACKUP['download']));
            $backupfile = $_CONF['backup_path'] . $backups[$i];
            $backupfilesize = COM_numberFormat(filesizeHelper($backupfile)) . ' <b>' . $LANG_DB_BACKUP['bytes'] . '</b>';
            $data_arr[$i] = array('file' => $downloadLink, 'size' => $backupfilesize, 'filename' => $backups[$i]);
        }
        $token = SEC_createToken();
        $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/database.php?mode=backup&amp;' . CSRF_TOKEN . '=' . $token, 'text' => $LANG_ADMIN['create_new']));
        if ($_DB_dbms == 'mysql') {
            $menu_arr[] = array('url' => $thisUrl . '?mode=optimize', 'text' => $LANG_DB_BACKUP['optimize_menu']);
            if (innodb_supported()) {
                $menu_arr[] = array('url' => $thisUrl . '?mode=innodb', 'text' => $LANG_DB_BACKUP['convert_menu']);
            }
        }
        $menu_arr[] = array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']);
        $retval .= COM_startBlock($LANG_DB_BACKUP['last_ten_backups'], '', COM_getBlockTemplate('_admin_block', 'header'));
        $retval .= ADMIN_createMenu($menu_arr, "<p>{$LANG_DB_BACKUP['db_explanation']}</p>" . '<p>' . sprintf($LANG_DB_BACKUP['total_number'], $index) . '</p>', $_CONF['layout_url'] . '/images/icons/database.' . $_IMAGE_TYPE);
        $header_arr = array(array('text' => $LANG_DB_BACKUP['backup_file'], 'field' => 'file'), array('text' => $LANG_DB_BACKUP['size'], 'field' => 'size'));
        $text_arr = array('form_url' => $thisUrl);
        $form_arr = array('bottom' => '', 'top' => '');
        if ($num_backups > 0) {
            $form_arr['bottom'] = '<input type="hidden" name="mode" value="delete"' . XHTML . '>' . '<input type="hidden" name="' . CSRF_TOKEN . '" value="' . $token . '"' . XHTML . '>' . LB;
        }
        $listoptions = array('chkdelete' => true, 'chkminimum' => 0, 'chkfield' => 'filename');
        $retval .= ADMIN_simpleList('', $header_arr, $text_arr, $data_arr, $listoptions, $form_arr);
        $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    } else {
        $retval .= COM_showMessageText($LANG_DB_BACKUP['no_access'], $LANG08[06]);
        COM_errorLog($_CONF['backup_path'] . ' is not writable.', 1);
    }
    return $retval;
}
开发者ID:milk54,项目名称:geeklog-japan,代码行数:61,代码来源:database.php

示例15: _createMailStory

function _createMailStory($sid)
{
    global $_CONF, $_TABLES, $LANG_DIRECTION, $LANG01, $LANG08;
    USES_lib_story();
    $story = new Story();
    $args = array('sid' => $sid, 'mode' => 'view');
    $output = STORY_LOADED_OK;
    $result = PLG_invokeService('story', 'get', $args, $output, $svc_msg);
    if ($result == PLG_RET_OK) {
        /* loadFromArray cannot be used, since it overwrites the timestamp */
        reset($story->_dbFields);
        while (list($fieldname, $save) = each($story->_dbFields)) {
            $varname = '_' . $fieldname;
            if (array_key_exists($fieldname, $output)) {
                $story->{$varname} = $output[$fieldname];
            }
        }
        $story->_username = $output['username'];
        $story->_fullname = $output['fullname'];
    }
    if ($output == STORY_PERMISSION_DENIED) {
        $display = COM_siteHeader('menu', $LANG_ACCESS['accessdenied']) . COM_showMessageText($LANG_ACCESS['storydenialmsg'], $LANG_ACCESS['accessdenied'], true, 'error') . COM_siteFooter();
        echo $display;
        exit;
    } elseif ($output == STORY_INVALID_SID) {
        COM_404();
    } else {
        $T = new Template($_CONF['path_layout'] . 'article');
        $T->set_file('article', 'mailable.thtml');
        list($cacheFile, $style_cache_url) = COM_getStyleCacheLocation();
        $T->set_var('direction', $LANG_DIRECTION);
        $T->set_var('css_url', $style_cache_url);
        $T->set_var('page_title', $_CONF['site_name'] . ': ' . $story->displayElements('title'));
        $T->set_var('story_title', $story->DisplayElements('title'));
        $T->set_var('story_subtitle', $story->DisplayElements('subtitle'));
        $story_image = $story->DisplayElements('story_image');
        if ($story_image != '') {
            $T->set_var('story_image', $story_image);
        } else {
            $T->unset_var('story_image');
        }
        if ($_CONF['hidestorydate'] != 1) {
            $T->set_var('story_date', $story->displayElements('date'));
        }
        if ($_CONF['contributedbyline'] == 1) {
            $T->set_var('lang_contributedby', $LANG01[1]);
            $authorname = COM_getDisplayName($story->displayElements('uid'));
            $T->set_var('author', $authorname);
            $T->set_var('story_author', $authorname);
            $T->set_var('story_author_username', $story->DisplayElements('username'));
        }
        $T->set_var('story_introtext', $story->DisplayElements('introtext'));
        $T->set_var('story_bodytext', $story->DisplayElements('bodytext'));
        $T->set_var('site_name', $_CONF['site_name']);
        $T->set_var('site_slogan', $_CONF['site_slogan']);
        $T->set_var('story_id', $story->getSid());
        $articleUrl = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $story->getSid());
        if ($story->DisplayElements('commentcode') >= 0) {
            $commentsUrl = $articleUrl . '#comments';
            $comments = $story->DisplayElements('comments');
            $numComments = COM_numberFormat($comments);
            $T->set_var('story_comments', $numComments);
            $T->set_var('comments_url', $commentsUrl);
            $T->set_var('comments_text', $numComments . ' ' . $LANG01[3]);
            $T->set_var('comments_count', $numComments);
            $T->set_var('lang_comments', $LANG01[3]);
            $comments_with_count = sprintf($LANG01[121], $numComments);
            if ($comments > 0) {
                $comments_with_count = COM_createLink($comments_with_count, $commentsUrl);
            }
            $T->set_var('comments_with_count', $comments_with_count);
        }
        $T->set_var('lang_full_article', $LANG08[33]);
        $T->set_var('article_url', $articleUrl);
        COM_setLangIdAndAttribute($T);
        $T->parse('output', 'article');
        $htmlMsg = $T->finish($T->get_var('output'));
        return $htmlMsg;
    }
}
开发者ID:spacequad,项目名称:glfusion,代码行数:80,代码来源:profiles.php


注:本文中的COM_numberFormat函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。