本文整理汇总了PHP中createList函数的典型用法代码示例。如果您正苦于以下问题:PHP createList函数的具体用法?PHP createList怎么用?PHP createList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createList函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ModifyHolidays
function ModifyHolidays()
{
global $sourcedir, $scripturl, $txt, $context;
// Submitting something...
if (isset($_REQUEST['delete']) && !empty($_REQUEST['holiday'])) {
checkSession();
foreach ($_REQUEST['holiday'] as $id => $value) {
$_REQUEST['holiday'][$id] = (int) $id;
}
// Now the IDs are "safe" do the delete...
require_once $sourcedir . '/Subs-Calendar.php';
removeHolidays($_REQUEST['holiday']);
}
$listOptions = array('id' => 'holiday_list', 'title' => $txt['current_holidays'], 'items_per_page' => 20, 'base_href' => $scripturl . '?action=admin;area=managecalendar;sa=holidays', 'default_sort_col' => 'name', 'get_items' => array('file' => $sourcedir . '/Subs-Calendar.php', 'function' => 'list_getHolidays'), 'get_count' => array('file' => $sourcedir . '/Subs-Calendar.php', 'function' => 'list_getNumHolidays'), 'no_items_label' => $txt['holidays_no_entries'], 'columns' => array('name' => array('header' => array('value' => $txt['holidays_title']), 'data' => array('sprintf' => array('format' => '<a href="' . $scripturl . '?action=admin;area=managecalendar;sa=editholiday;holiday=%1$d">%2$s</a>', 'params' => array('id_holiday' => false, 'title' => false))), 'sort' => array('default' => 'title', 'reverse' => 'title DESC')), 'date' => array('header' => array('value' => $txt['date']), 'data' => array('function' => create_function('$rowData', '
global $txt;
// Recurring every year or just a single year?
$year = $rowData[\'year\'] == \'0004\' ? sprintf(\'(%1$s)\', $txt[\'every_year\']) : $rowData[\'year\'];
// Construct the date.
return sprintf(\'%1$d %2$s %3$s\', $rowData[\'day\'], $txt[\'months\'][(int) $rowData[\'month\']], $year);
'), 'class' => 'windowbg'), 'sort' => array('default' => 'event_date', 'reverse' => 'event_date DESC')), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />'), 'data' => array('sprintf' => array('format' => '<input type="checkbox" name="holiday[%1$d]" class="input_check" />', 'params' => array('id_holiday' => false)), 'style' => 'text-align: center'))), 'form' => array('href' => $scripturl . '?action=admin;area=managecalendar;sa=holidays'), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '
<a href="' . $scripturl . '?action=admin;area=managecalendar;sa=editholiday" style="margin: 0 1em">[' . $txt['holidays_add'] . ']</a>
<input type="submit" name="delete" value="' . $txt['quickmod_delete_selected'] . '" class="button_submit" />', 'style' => 'text-align: right;')));
require_once $sourcedir . '/Subs-List.php';
createList($listOptions);
//loadTemplate('ManageCalendar');
$context['page_title'] = $txt['manage_holidays'];
// Since the list is the only thing to show, use the default list template.
$context['default_list'] = 'holiday_list';
$context['sub_template'] = 'show_list';
}
示例2: createOpenInvoiceList
function createOpenInvoiceList()
{
$currentDate = date('Ymd');
$res = mysqli_query_check("select count(*) as cnt from {prefix}invoice i where i.deleted = 0 AND i.interval_type > 0 AND i.next_interval_date <= {$currentDate} AND i.archived = 0");
$row = mysqli_fetch_assoc($res);
if ($row['cnt'] > 0) {
createList('open_invoices', 'invoice', 'resultlist_repeating_invoices', $GLOBALS['locLabelInvoicesWithIntervalDue'], "i.interval_type > 0 AND i.next_interval_date <= {$currentDate} AND i.archived = 0", true);
}
$open = '';
$res = mysqli_query_check('SELECT id FROM {prefix}invoice_state WHERE invoice_open=1');
while ($id = mysqli_fetch_value($res)) {
if ($open) {
$open .= ', ';
}
$open .= $id;
}
$unpaid = '';
$res = mysqli_query_check('SELECT id FROM {prefix}invoice_state WHERE invoice_unpaid=1');
while ($id = mysqli_fetch_value($res)) {
if ($unpaid) {
$unpaid .= ', ';
}
$unpaid .= $id;
}
if ($open) {
createList('open_invoices', 'invoice', 'resultlist_open_invoices', $GLOBALS['locLabelOpenInvoices'], "i.state_id IN ({$open}) AND i.archived=0", true);
}
if ($unpaid) {
createList('open_invoices', 'invoice', 'resultlist_unpaid_invoices', $GLOBALS['locLabelUnpaidInvoices'], "i.state_id IN ({$unpaid}) AND i.archived=0", true, true);
}
}
示例3: action_sportal_admin_permission_profiles_list
/**
* Show page listing of all permission groups in the system
*/
public function action_sportal_admin_permission_profiles_list()
{
global $context, $scripturl, $txt, $modSettings;
// Removing some permission profiles?
if (!empty($_POST['remove_profiles']) && !empty($_POST['remove']) && is_array($_POST['remove'])) {
checkSession();
$remove = array();
foreach ($_POST['remove'] as $index => $profile_id) {
$remove[(int) $index] = (int) $profile_id;
}
sp_delete_profiles($remove);
}
// Build the listoption array to display the permission profiles
$listOptions = array('id' => 'portal_permisssions', 'title' => $txt['sp_admin_permission_profiles_list'], 'items_per_page' => $modSettings['defaultMaxMessages'], 'no_items_label' => $txt['error_sp_no_articles'], 'base_href' => $scripturl . '?action=admin;area=portalprofiles;sa=listpermission;', 'default_sort_col' => 'name', 'get_items' => array('function' => array($this, 'list_spLoadProfiles')), 'get_count' => array('function' => array($this, 'list_spCountProfiles')), 'columns' => array('name' => array('header' => array('value' => $txt['sp_admin_profiles_col_name']), 'data' => array('db' => 'label'), 'sort' => array('default' => 'name', 'reverse' => 'name DESC')), 'articles' => array('header' => array('value' => $txt['sp_admin_profiles_col_articles'], 'class' => 'centertext'), 'data' => array('function' => create_function('$row', '
return empty($row[\'articles\']) ? \'0\' : $row[\'articles\'];
'), 'class' => 'centertext')), 'blocks' => array('header' => array('value' => $txt['sp_admin_profiles_col_blocks'], 'class' => 'centertext'), 'data' => array('function' => create_function('$row', '
return empty($row[\'blocks\']) ? \'0\' : $row[\'blocks\'];
'), 'class' => 'centertext')), 'categories' => array('header' => array('value' => $txt['sp_admin_profiles_col_categories'], 'class' => 'centertext'), 'data' => array('function' => create_function('$row', '
return empty($row[\'categories\']) ? \'0\' : $row[\'categories\'];
'), 'class' => 'centertext')), 'pages' => array('header' => array('value' => $txt['sp_admin_profiles_col_pages'], 'class' => 'centertext'), 'data' => array('function' => create_function('$row', '
return empty($row[\'pages\']) ? \'0\' : $row[\'pages\'];
'), 'class' => 'centertext')), 'shoutboxes' => array('header' => array('value' => $txt['sp_admin_profiles_col_shoutboxes'], 'class' => 'centertext'), 'data' => array('function' => create_function('$row', '
return empty($row[\'shoutboxes\']) ? \'0\' : $row[\'shoutboxes\'];
'), 'class' => 'centertext')), 'action' => array('header' => array('value' => $txt['sp_admin_articles_col_actions'], 'class' => 'centertext'), 'data' => array('sprintf' => array('format' => '<a href="?action=admin;area=portalprofiles;sa=editpermission;profile_id=%1$s;' . $context['session_var'] . '=' . $context['session_id'] . '" accesskey="e">' . sp_embed_image('modify') . '</a>
<a href="?action=admin;area=portalprofiles;sa=deletepermission;profile_id=%1$s;' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(' . JavaScriptEscape($txt['sp_admin_articles_delete_confirm']) . ') && submitThisOnce(this);" accesskey="d">' . sp_embed_image('delete') . '</a>', 'params' => array('id' => true)), 'class' => 'centertext', 'style' => "width: 40px")), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />', 'class' => 'centertext'), 'data' => array('function' => create_function('$row', '
return \'<input type="checkbox" name="remove[]" value="\' . $row[\'id\'] . \'" class="input_check" />\';
'), 'class' => 'centertext'))), 'form' => array('href' => $scripturl . '?action=admin;area=portalprofiles;sa=listpermission', 'include_sort' => true, 'include_start' => true, 'hidden_fields' => array($context['session_var'] => $context['session_id'])));
// Set the context values
$context['page_title'] = $txt['sp_admin_permission_profiles_list'];
$context['sub_template'] = 'show_list';
$context['default_list'] = 'portal_permisssions';
// Create the list.
require_once SUBSDIR . '/GenericList.class.php';
createList($listOptions);
}
示例4: createList
function createList($category, $list)
{
global $connection;
global $DBErrorMsg;
if ($category !== 'products') {
//query db to get parent
$query = "SELECT...";
if ($result = $connection->query($query)) {
while ($row = $result->fetch_assoc()) {
//create category list
$parent = $row['canonical_name'];
if ($parent !== 'products') {
$list = '<li><a href="index.php?nav=' . htmlentities($row['canonical_name']) . '">' . htmlentities($row['name']) . '</a>
<span class="glyphicon glyphicon-menu-right"></span> </li>' . $list;
}
}
} else {
echo databaseErrorMsg($DBErrorMsg);
}
//get list recursively
$returnList = createList($parent, $list);
} else {
//Added on last recursion cycle
$returnList = '<ol class="breadcrumb"><li><a href="index.php">Main Menu</a> <span class="glyphicon glyphicon-menu-right"></span> </li>' . $list;
}
return $returnList;
}
示例5: registerUser
function registerUser($username, $password, $email)
{
$salt = createSalt();
$password = saltPassword($password, $salt);
$user_id = createUID('users', 'user_id');
$userCreated = mysql_query("INSERT INTO users (user_id, username, password, email, salt) VALUES ('" . $user_id . "', '" . $username . "', '" . $password . "', '" . $email . "', '" . $salt . "')");
if ($userCreated) {
return createList($user_id);
} else {
$userDeleted = mysql_query("DELETE FROM users WHERE user_id = '" . $user_id . "' AND username = '" . $username . "'");
return false;
}
}
示例6: action_sportal_admin_article_list
/**
* Show a listing of articles in the system
*/
public function action_sportal_admin_article_list()
{
global $context, $scripturl, $txt, $modSettings;
// Build the listoption array to display the categories
$listOptions = array('id' => 'portal_articles', 'title' => $txt['sp_admin_articles_list'], 'items_per_page' => $modSettings['defaultMaxMessages'], 'no_items_label' => $txt['error_sp_no_articles'], 'base_href' => $scripturl . '?action=admin;area=portalarticles;sa=list;', 'default_sort_col' => 'title', 'get_items' => array('function' => array($this, 'list_spLoadArticles')), 'get_count' => array('function' => array($this, 'list_spCountArticles')), 'columns' => array('title' => array('header' => array('value' => $txt['sp_admin_articles_col_title']), 'data' => array('db' => 'title'), 'sort' => array('default' => 'title', 'reverse' => 'title DESC')), 'namespace' => array('header' => array('value' => $txt['sp_admin_articles_col_namespace']), 'data' => array('db' => 'article_id'), 'sort' => array('default' => 'article_namespace', 'reverse' => 'article_namespace DESC')), 'category' => array('header' => array('value' => $txt['sp_admin_articles_col_category']), 'data' => array('db' => 'category_name'), 'sort' => array('default' => 'name', 'reverse' => 'name DESC')), 'author' => array('header' => array('value' => $txt['sp_admin_articles_col_author']), 'data' => array('db' => 'author_name'), 'sort' => array('default' => 'author_name', 'reverse' => 'author_name DESC')), 'type' => array('header' => array('value' => $txt['sp_admin_articles_col_type']), 'data' => array('db' => 'type'), 'sort' => array('default' => 'type', 'reverse' => 'type DESC')), 'date' => array('header' => array('value' => $txt['sp_admin_articles_col_date']), 'data' => array('db' => 'date'), 'sort' => array('default' => 'date', 'reverse' => 'date DESC')), 'status' => array('header' => array('value' => $txt['sp_admin_articles_col_status'], 'class' => 'centertext'), 'data' => array('db' => 'status_image', 'class' => 'centertext'), 'sort' => array('default' => 'status', 'reverse' => 'status DESC')), 'action' => array('header' => array('value' => $txt['sp_admin_articles_col_actions'], 'class' => 'centertext'), 'data' => array('sprintf' => array('format' => '<a href="?action=admin;area=portalarticles;sa=edit;article_id=%1$s;' . $context['session_var'] . '=' . $context['session_id'] . '" accesskey="e">' . sp_embed_image('modify') . '</a>
<a href="?action=admin;area=portalarticles;sa=delete;article_id=%1$s;' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(' . JavaScriptEscape($txt['sp_admin_articles_delete_confirm']) . ') && submitThisOnce(this);" accesskey="d">' . sp_embed_image('delete') . '</a>', 'params' => array('id' => true)), 'class' => 'centertext nowrap')), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />', 'class' => 'centertext'), 'data' => array('function' => create_function('$row', '
return \'<input type="checkbox" name="remove[]" value="\' . $row[\'id\'] . \'" class="input_check" />\';
'), 'class' => 'centertext'))), 'form' => array('href' => $scripturl . '?action=admin;area=portalarticles;sa=remove', 'include_sort' => true, 'include_start' => true, 'hidden_fields' => array($context['session_var'] => $context['session_id'])), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '<input type="submit" name="remove_articles" value="' . $txt['sp_admin_articles_remove'] . '" class="right_submit" />')));
// Set the context values
$context['page_title'] = $txt['sp_admin_articles_title'];
$context['sub_template'] = 'show_list';
$context['default_list'] = 'portal_articles';
// Create the list.
require_once SUBSDIR . '/GenericList.class.php';
createList($listOptions);
}
示例7: BrowseMailQueue
/**
* Display the mail queue...
*/
function BrowseMailQueue()
{
global $scripturl, $context, $modSettings, $txt, $smcFunc;
global $sourcedir;
// First, are we deleting something from the queue?
if (isset($_REQUEST['delete'])) {
checkSession('post');
$smcFunc['db_query']('', '
DELETE FROM {db_prefix}mail_queue
WHERE id_mail IN ({array_int:mail_ids})', array('mail_ids' => $_REQUEST['delete']));
}
// How many items do we have?
$request = $smcFunc['db_query']('', '
SELECT COUNT(*) AS queue_size, MIN(time_sent) AS oldest
FROM {db_prefix}mail_queue', array());
list($mailQueueSize, $mailOldest) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
$context['oldest_mail'] = empty($mailOldest) ? $txt['mailqueue_oldest_not_available'] : time_since(time() - $mailOldest);
$context['mail_queue_size'] = comma_format($mailQueueSize);
$listOptions = array('id' => 'mail_queue', 'title' => $txt['mailqueue_browse'], 'items_per_page' => 20, 'base_href' => $scripturl . '?action=admin;area=mailqueue', 'default_sort_col' => 'age', 'no_items_label' => $txt['mailqueue_no_items'], 'get_items' => array('function' => 'list_getMailQueue'), 'get_count' => array('function' => 'list_getMailQueueSize'), 'columns' => array('subject' => array('header' => array('value' => $txt['mailqueue_subject']), 'data' => array('function' => create_function('$rowData', '
global $smcFunc;
return $smcFunc[\'strlen\']($rowData[\'subject\']) > 50 ? sprintf(\'%1$s...\', htmlspecialchars($smcFunc[\'substr\']($rowData[\'subject\'], 0, 47))) : htmlspecialchars($rowData[\'subject\']);
'), 'class' => 'smalltext'), 'sort' => array('default' => 'subject', 'reverse' => 'subject DESC')), 'recipient' => array('header' => array('value' => $txt['mailqueue_recipient']), 'data' => array('sprintf' => array('format' => '<a href="mailto:%1$s">%1$s</a>', 'params' => array('recipient' => true)), 'class' => 'smalltext'), 'sort' => array('default' => 'recipient', 'reverse' => 'recipient DESC')), 'priority' => array('header' => array('value' => $txt['mailqueue_priority']), 'data' => array('function' => create_function('$rowData', '
global $txt;
// We probably have a text label with your priority.
$txtKey = sprintf(\'mq_mpriority_%1$s\', $rowData[\'priority\']);
// But if not, revert to priority 0.
return isset($txt[$txtKey]) ? $txt[$txtKey] : $txt[\'mq_mpriority_1\'];
'), 'class' => 'smalltext'), 'sort' => array('default' => 'priority', 'reverse' => 'priority DESC')), 'age' => array('header' => array('value' => $txt['mailqueue_age']), 'data' => array('function' => create_function('$rowData', '
return time_since(time() - $rowData[\'time_sent\']);
'), 'class' => 'smalltext'), 'sort' => array('default' => 'time_sent', 'reverse' => 'time_sent DESC')), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />'), 'data' => array('function' => create_function('$rowData', '
return \'<input type="checkbox" name="delete[]" value="\' . $rowData[\'id_mail\'] . \'" class="input_check" />\';
'), 'class' => 'smalltext'))), 'form' => array('href' => $scripturl . '?action=admin;area=mailqueue', 'include_start' => true, 'include_sort' => true), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '<input type="submit" name="delete_redirects" value="' . $txt['quickmod_delete_selected'] . '" onclick="return confirm(\'' . $txt['quickmod_confirm'] . '\');" class="button_submit" /><a class="button_link" href="' . $scripturl . '?action=admin;area=mailqueue;sa=clear;' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(\'' . $txt['mailqueue_clear_list_warning'] . '\');">' . $txt['mailqueue_clear_list'] . '</a> ')));
require_once $sourcedir . '/Subs-List.php';
createList($listOptions);
loadTemplate('ManageMail');
$context['sub_template'] = 'browse';
}
示例8: createList
function createList($array, $currentParent, $currLevel = 0, $prevLevel = -1)
{
foreach ($array as $categoryId => $category) {
if ($currentParent == $category['parent_ID']) {
if ($currLevel > $prevLevel) {
echo " <div> ";
}
if ($currLevel == $prevLevel) {
echo " </li> ";
}
echo '<a href="topics.php?topic_ID=' . $category['topic_ID'] . '" class="btn btn-primary" >' . $category['topic_title'] . '</a>';
if ($currLevel > $prevLevel) {
$prevLevel = $currLevel;
}
$currLevel++;
createList($array, $categoryId, $currLevel, $prevLevel);
$currLevel--;
}
}
if ($currLevel == $prevLevel) {
echo "</div>";
}
}
示例9: action_list
public function action_list()
{
global $txt, $context, $scripturl, $modSettings, $settings;
loadJavascriptFile('notify.js', array('defer' => true));
loadJavascriptFile('jquery.knob.js', array('defer' => true));
loadCSSFile('notify.css');
addInlineJavascript('dismissnotice_editable();', true);
$modSettings['jquery_include_ui'] = true;
loadCSSFile('dism/jquery.ui.theme.css');
loadCSSFile('dism/jquery.ui.datepicker.css');
loadCSSFile('dism/jquery.ui.d.theme.css');
loadCSSFile('dism/jquery.ui.core.css');
$possible_locals = array($txt['lang_locale']);
$b = explode('_', $txt['lang_locale']);
foreach ($b as $a) {
$possible_locals[] = $a;
}
foreach ($possible_locals as $local) {
if (file_exists($settings['default_theme_dir'] . '/scripts/datepicker-i18n/datepicker-' . $local . '.js')) {
loadJavascriptFile('datepicker-i18n/datepicker-' . $local . '.js', array('defer' => true));
break;
$context['datepicker_local'] = $local;
}
}
$list_options = array('id' => 'list_dismissible_notices', 'title' => $txt['dismissnotices_title_list'], 'items_per_page' => 20, 'base_href' => $scripturl . '?action=admin;area=dismissnotice;sa=list' . $context['session_var'] . '=' . $context['session_id'], 'default_sort_col' => 'timeadded', 'get_items' => array('function' => array($this, 'getItems')), 'get_count' => array('function' => array($this, 'countItems')), 'data_check' => array('class' => function ($rowData) {
return 'editable_' . $rowData['id_notice'];
}), 'no_items_label' => $txt['hooks_no_hooks'], 'columns' => array('timeadded' => array('header' => array('value' => $txt['dismissnotices_time_added']), 'data' => array('function' => function ($rowData) {
return standardTime($rowData['added']);
}), 'sort' => array('default' => 'added', 'reverse' => 'added DESC')), 'body' => array('header' => array('value' => $txt['dismissnotices_body']), 'data' => array('db' => 'body')), 'class' => array('header' => array('value' => $txt['dismissnotices_class']), 'data' => array('db_htmlsafe' => 'class'), 'sort' => array('default' => 'class', 'reverse' => 'class DESC')), 'expire' => array('header' => array('value' => $txt['dismissnotices_expire']), 'data' => array('function' => function ($rowData) {
return Dismissible_Notices_Integrate::formatExpireCol($rowData['expire']);
}), 'sort' => array('default' => 'expire', 'reverse' => 'expire DESC')), 'edit' => array('header' => array('value' => ''), 'data' => array('function' => function ($rowData) {
global $txt;
return '<a data-idnotice="' . $rowData['id_notice'] . '" class="dismissnotice_editable" href="#">' . $txt['modify'] . '</a>';
}))), 'additional_rows' => array(array('position' => 'bottom_of_list', 'value' => '<a id="dismissnotice_new" class="floatright linkbutton" href="#">' . $txt['new'] . '</a>')));
require_once SUBSDIR . '/GenericList.class.php';
createList($list_options);
}
示例10: create_chmod_control
function create_chmod_control($chmodFiles = array(), $chmodOptions = array(), $restore_write_status = false)
{
global $context, $modSettings, $package_ftp, $boarddir, $txt, $sourcedir, $scripturl;
// If we're restoring the status of existing files prepare the data.
if ($restore_write_status && isset($_SESSION['pack_ftp']) && !empty($_SESSION['pack_ftp']['original_perms'])) {
function list_restoreFiles($dummy1, $dummy2, $dummy3, $do_change)
{
global $txt;
$restore_files = array();
foreach ($_SESSION['pack_ftp']['original_perms'] as $file => $perms) {
// Check the file still exists, and the permissions were indeed different than now.
$file_permissions = @fileperms($file);
if (!file_exists($file) || $file_permissions == $perms) {
unset($_SESSION['pack_ftp']['original_perms'][$file]);
continue;
}
// Are we wanting to change the permission?
if ($do_change && isset($_POST['restore_files']) && in_array($file, $_POST['restore_files'])) {
// Use FTP if we have it.
if (!empty($package_ftp)) {
$ftp_file = strtr($file, array($_SESSION['pack_ftp']['root'] => ''));
$package_ftp->chmod($ftp_file, $perms);
} else {
@chmod($file, $perms);
}
$new_permissions = @fileperms($file);
$result = $new_permissions == $perms ? 'success' : 'failure';
unset($_SESSION['pack_ftp']['original_perms'][$file]);
} elseif ($do_change) {
$new_permissions = '';
$result = 'skipped';
unset($_SESSION['pack_ftp']['original_perms'][$file]);
}
// Record the results!
$restore_files[] = array('path' => $file, 'old_perms_raw' => $perms, 'old_perms' => substr(sprintf('%o', $perms), -4), 'cur_perms' => substr(sprintf('%o', $file_permissions), -4), 'new_perms' => isset($new_permissions) ? substr(sprintf('%o', $new_permissions), -4) : '', 'result' => isset($result) ? $result : '', 'writable_message' => '<span style="color: ' . (@is_writable($file) ? 'green' : 'red') . '">' . (@is_writable($file) ? $txt['package_file_perms_writable'] : $txt['package_file_perms_not_writable']) . '</span>');
}
return $restore_files;
}
$listOptions = array('id' => 'restore_file_permissions', 'title' => $txt['package_restore_permissions'], 'get_items' => array('function' => 'list_restoreFiles', 'params' => array(!empty($_POST['restore_perms']))), 'columns' => array('path' => array('header' => array('value' => $txt['package_restore_permissions_filename']), 'data' => array('db' => 'path', 'class' => 'smalltext')), 'old_perms' => array('header' => array('value' => $txt['package_restore_permissions_orig_status']), 'data' => array('db' => 'old_perms', 'class' => 'smalltext')), 'cur_perms' => array('header' => array('value' => $txt['package_restore_permissions_cur_status']), 'data' => array('function' => create_function('$rowData', '
global $txt;
$formatTxt = $rowData[\'result\'] == \'\' || $rowData[\'result\'] == \'skipped\' ? $txt[\'package_restore_permissions_pre_change\'] : $txt[\'package_restore_permissions_post_change\'];
return sprintf($formatTxt, $rowData[\'cur_perms\'], $rowData[\'new_perms\'], $rowData[\'writable_message\']);
'), 'class' => 'smalltext')), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />'), 'data' => array('sprintf' => array('format' => '<input type="checkbox" name="restore_files[]" value="%1$s" class="input_check" />', 'params' => array('path' => false)), 'style' => 'text-align: center')), 'result' => array('header' => array('value' => $txt['package_restore_permissions_result']), 'data' => array('function' => create_function('$rowData', '
global $txt;
return $txt[\'package_restore_permissions_action_\' . $rowData[\'result\']];
'), 'class' => 'smalltext'))), 'form' => array('href' => !empty($chmodOptions['destination_url']) ? $chmodOptions['destination_url'] : $scripturl . '?action=admin;area=packages;sa=perms;restore;' . $context['session_var'] . '=' . $context['session_id']), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '<input type="submit" name="restore_perms" value="' . $txt['package_restore_permissions_restore'] . '" class="button_submit" />', 'class' => 'titlebg', 'style' => 'text-align: right;'), array('position' => 'after_title', 'value' => '<span class="smalltext">' . $txt['package_restore_permissions_desc'] . '</span>', 'class' => 'windowbg2')));
// Work out what columns and the like to show.
if (!empty($_POST['restore_perms'])) {
$listOptions['additional_rows'][1]['value'] = sprintf($txt['package_restore_permissions_action_done'], $scripturl . '?action=admin;area=packages;sa=perms;' . $context['session_var'] . '=' . $context['session_id']);
unset($listOptions['columns']['check'], $listOptions['form'], $listOptions['additional_rows'][0]);
$context['sub_template'] = 'show_list';
$context['default_list'] = 'restore_file_permissions';
} else {
unset($listOptions['columns']['result']);
}
// Create the list for display.
require_once $sourcedir . '/lib/Subs-List.php';
createList($listOptions);
// If we just restored permissions then whereever we are, we are now done and dusted.
if (!empty($_POST['restore_perms'])) {
obExit();
}
} elseif ($restore_write_status) {
return true;
}
// This is where we report what we got up to.
$return_data = array('files' => array('writable' => array(), 'notwritable' => array()));
// If we have some FTP information already, then let's assume it was required and try to get ourselves connected.
if (!empty($_SESSION['pack_ftp']['connected'])) {
// Load the file containing the ftp_connection class.
loadClassFile('Class-Package.php');
$package_ftp = new ftp_connection($_SESSION['pack_ftp']['server'], $_SESSION['pack_ftp']['port'], $_SESSION['pack_ftp']['username'], package_crypt($_SESSION['pack_ftp']['password']));
}
// Just got a submission did we?
if (empty($package_ftp) && isset($_POST['ftp_username'])) {
loadClassFile('Class-Package.php');
$ftp = new ftp_connection($_POST['ftp_server'], $_POST['ftp_port'], $_POST['ftp_username'], $_POST['ftp_password']);
// We're connected, jolly good!
if ($ftp->error === false) {
// Common mistake, so let's try to remedy it...
if (!$ftp->chdir($_POST['ftp_path'])) {
$ftp_error = $ftp->last_message;
$ftp->chdir(preg_replace('~^/home[2]?/[^/]+?~', '', $_POST['ftp_path']));
}
if (!in_array($_POST['ftp_path'], array('', '/'))) {
$ftp_root = strtr($boarddir, array($_POST['ftp_path'] => ''));
if (substr($ftp_root, -1) == '/' && ($_POST['ftp_path'] == '' || substr($_POST['ftp_path'], 0, 1) == '/')) {
$ftp_root = substr($ftp_root, 0, -1);
}
} else {
$ftp_root = $boarddir;
}
$_SESSION['pack_ftp'] = array('server' => $_POST['ftp_server'], 'port' => $_POST['ftp_port'], 'username' => $_POST['ftp_username'], 'password' => package_crypt($_POST['ftp_password']), 'path' => $_POST['ftp_path'], 'root' => $ftp_root, 'connected' => true);
if (!isset($modSettings['package_path']) || $modSettings['package_path'] != $_POST['ftp_path']) {
updateSettings(array('package_path' => $_POST['ftp_path']));
}
// This is now the primary connection.
$package_ftp = $ftp;
//.........这里部分代码省略.........
示例11: MembersAwaitingActivation
//.........这里部分代码省略.........
$context['allowed_actions'] = array('ok' => $txt['admin_browse_w_activate'], 'okemail' => $txt['admin_browse_w_activate'] . ' ' . $txt['admin_browse_w_email'], 'delete' => $txt['admin_browse_w_delete'], 'deleteemail' => $txt['admin_browse_w_delete'] . ' ' . $txt['admin_browse_w_email'], 'remind' => $txt['admin_browse_w_remind'] . ' ' . $txt['admin_browse_w_email']);
}
// Create an option list for actions allowed to be done with selected members.
$allowed_actions = '
<option selected="selected" value="">' . $txt['admin_browse_with_selected'] . ':</option>
<option value="" disabled="disabled">-----------------------------</option>';
foreach ($context['allowed_actions'] as $key => $desc) {
$allowed_actions .= '
<option value="' . $key . '">' . $desc . '</option>';
}
// Setup the Javascript function for selecting an action for the list.
$javascript = '
function onSelectChange()
{
if (document.forms.postForm.todo.value == "")
return;
var message = "";';
// We have special messages for approving deletion of accounts - it's surprisingly logical - honest.
if ($context['current_filter'] == 4) {
$javascript .= '
if (document.forms.postForm.todo.value.indexOf("reject") != -1)
message = "' . $txt['admin_browse_w_delete'] . '";
else
message = "' . $txt['admin_browse_w_reject'] . '";';
} else {
$javascript .= '
if (document.forms.postForm.todo.value.indexOf("delete") != -1)
message = "' . $txt['admin_browse_w_delete'] . '";
else if (document.forms.postForm.todo.value.indexOf("reject") != -1)
message = "' . $txt['admin_browse_w_reject'] . '";
else if (document.forms.postForm.todo.value == "remind")
message = "' . $txt['admin_browse_w_remind'] . '";
else
message = "' . ($context['browse_type'] == 'approve' ? $txt['admin_browse_w_approve'] : $txt['admin_browse_w_activate']) . '";';
}
$javascript .= '
if (confirm(message + " ' . $txt['admin_browse_warn'] . '"))
document.forms.postForm.submit();
}';
$listOptions = array('id' => 'approve_list', 'items_per_page' => $modSettings['defaultMaxMembers'], 'base_href' => $scripturl . '?action=admin;area=viewmembers;sa=browse;type=' . $context['browse_type'] . (!empty($context['show_filter']) ? ';filter=' . $context['current_filter'] : ''), 'default_sort_col' => 'date_registered', 'get_items' => array('file' => $sourcedir . '/Subs-Members.php', 'function' => 'list_getMembers', 'params' => array('is_activated = {int:activated_status}', array('activated_status' => $context['current_filter']), $context['show_duplicates'])), 'get_count' => array('file' => $sourcedir . '/Subs-Members.php', 'function' => 'list_getNumMembers', 'params' => array('is_activated = {int:activated_status}', array('activated_status' => $context['current_filter']))), 'columns' => array('id_member' => array('header' => array('value' => $txt['member_id']), 'data' => array('db' => 'id_member', 'class' => 'windowbg', 'style' => 'text-align: center;'), 'sort' => array('default' => 'id_member', 'reverse' => 'id_member DESC')), 'user_name' => array('header' => array('value' => $txt['username']), 'data' => array('sprintf' => array('format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=profile;u=%1$d">%2$s</a>', 'params' => array('id_member' => false, 'member_name' => false))), 'sort' => array('default' => 'member_name', 'reverse' => 'member_name DESC')), 'email' => array('header' => array('value' => $txt['email_address']), 'data' => array('sprintf' => array('format' => '<a href="mailto:%1$s">%1$s</a>', 'params' => array('email_address' => true)), 'class' => 'windowbg'), 'sort' => array('default' => 'email_address', 'reverse' => 'email_address DESC')), 'ip' => array('header' => array('value' => $txt['ip_address']), 'data' => array('sprintf' => array('format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=trackip;searchip=%1$s">%1$s</a>', 'params' => array('member_ip' => false))), 'sort' => array('default' => 'INET_ATON(member_ip)', 'reverse' => 'INET_ATON(member_ip) DESC')), 'hostname' => array('header' => array('value' => $txt['hostname']), 'data' => array('function' => create_function('$rowData', '
global $modSettings;
return host_from_ip($rowData[\'member_ip\']);
'), 'class' => 'smalltext')), 'date_registered' => array('header' => array('value' => $txt['date_registered']), 'data' => array('function' => create_function('$rowData', '
return timeformat($rowData[\'date_registered\']);
')), 'sort' => array('default' => 'date_registered DESC', 'reverse' => 'date_registered')), 'duplicates' => array('header' => array('value' => $txt['duplicates'], 'style' => 'width: 20%'), 'data' => array('function' => create_function('$rowData', '
global $scripturl, $txt;
$member_links = array();
foreach ($rowData[\'duplicate_members\'] as $member)
{
if ($member[\'id\'])
$member_links[] = \'<a href="\' . $scripturl . \'?action=profile;u=\' . $member[\'id\'] . \'" \' . (!empty($member[\'is_banned\']) ? \'style="color: red;"\' : \'\') . \'>\' . $member[\'name\'] . \'</a>\';
else
$member_links[] = $member[\'name\'] . \' (\' . $txt[\'guest\'] . \')\';
}
return implode (\', \', $member_links);
'), 'class' => 'smalltext')), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />'), 'data' => array('sprintf' => array('format' => '<input type="checkbox" name="todoAction[]" value="%1$d" class="input_check" />', 'params' => array('id_member' => false)), 'class' => 'windowbg', 'style' => 'text-align: center'))), 'javascript' => $javascript, 'form' => array('href' => $scripturl . '?action=admin;area=viewmembers;sa=approve;type=' . $context['browse_type'], 'name' => 'postForm', 'include_start' => true, 'include_sort' => true, 'hidden_fields' => array('orig_filter' => $context['current_filter'])), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '
<div class="floatleft">
[<a href="' . $scripturl . '?action=admin;area=viewmembers;sa=browse;showdupes=' . ($context['show_duplicates'] ? 0 : 1) . ';type=' . $context['browse_type'] . (!empty($context['show_filter']) ? ';filter=' . $context['current_filter'] : '') . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . ($context['show_duplicates'] ? $txt['dont_check_for_duplicate'] : $txt['check_for_duplicate']) . '</a>]
</div>
<div class="floatright">
<select name="todo" onchange="onSelectChange();">
' . $allowed_actions . '
</select>
<noscript><input type="submit" value="' . $txt['go'] . '" class="button_submit" /></noscript>
</div>')));
// Pick what column to actually include if we're showing duplicates.
if ($context['show_duplicates']) {
unset($listOptions['columns']['email']);
} else {
unset($listOptions['columns']['duplicates']);
}
// Only show hostname on duplicates as it takes a lot of time.
if (!$context['show_duplicates'] || !empty($modSettings['disableHostnameLookup'])) {
unset($listOptions['columns']['hostname']);
}
// Is there any need to show filters?
if (isset($context['available_filters']) && count($context['available_filters']) > 1) {
$filterOptions = '
<strong>' . $txt['admin_browse_filter_by'] . ':</strong>
<select name="filter" onchange="this.form.submit();">';
foreach ($context['available_filters'] as $filter) {
$filterOptions .= '
<option value="' . $filter['type'] . '"' . ($filter['selected'] ? ' selected="selected"' : '') . '>' . $filter['desc'] . ' - ' . $filter['amount'] . ' ' . ($filter['amount'] == 1 ? $txt['user'] : $txt['users']) . '</option>';
}
$filterOptions .= '
</select>
<noscript><input type="submit" value="' . $txt['go'] . '" name="filter" class="button_submit" /></noscript>';
$listOptions['additional_rows'][] = array('position' => 'above_column_headers', 'value' => $filterOptions, 'style' => 'text-align: center;');
}
// What about if we only have one filter, but it's not the "standard" filter - show them what they are looking at.
if (!empty($context['show_filter']) && !empty($context['available_filters'])) {
$listOptions['additional_rows'][] = array('position' => 'above_column_headers', 'value' => '<strong>' . $txt['admin_browse_filter_show'] . ':</strong> ' . $context['available_filters'][0]['desc'], 'class' => 'smalltext', 'style' => 'text-align: left;');
}
// Now that we have all the options, create the list.
require_once $sourcedir . '/Subs-List.php';
createList($listOptions);
}
示例12: action_profile
/**
* Show all the custom profile fields available to the user.
*
* - Allows for drag/drop sorting of custom profile fields
* - Accessed with ?action=admin;area=featuresettings;sa=profile
*
* @uses sub template show_custom_profile
*/
public function action_profile()
{
global $txt, $scripturl, $context;
loadTemplate('ManageFeatures');
$context['page_title'] = $txt['custom_profile_title'];
$context['sub_template'] = 'show_custom_profile';
// What about standard fields they can tweak?
$standard_fields = array('location', 'gender', 'website', 'personal_text', 'posts', 'warning_status');
// What fields can't you put on the registration page?
$context['fields_no_registration'] = array('posts', 'warning_status');
// Are we saving any standard field changes?
if (isset($_POST['save'])) {
checkSession();
validateToken('admin-scp');
$changes = array();
// Do the active ones first.
$disable_fields = array_flip($standard_fields);
if (!empty($_POST['active'])) {
foreach ($_POST['active'] as $value) {
if (isset($disable_fields[$value])) {
unset($disable_fields[$value]);
}
}
}
// What we have left!
$changes['disabled_profile_fields'] = empty($disable_fields) ? '' : implode(',', array_keys($disable_fields));
// Things we want to show on registration?
$reg_fields = array();
if (!empty($_POST['reg'])) {
foreach ($_POST['reg'] as $value) {
if (in_array($value, $standard_fields) && !isset($disable_fields[$value])) {
$reg_fields[] = $value;
}
}
}
// What we have left!
$changes['registration_fields'] = empty($reg_fields) ? '' : implode(',', $reg_fields);
if (!empty($changes)) {
updateSettings($changes);
}
}
createToken('admin-scp');
require_once SUBSDIR . '/GenericList.class.php';
require_once SUBSDIR . '/ManageFeatures.subs.php';
// Create a listing for all our standard fields
$listOptions = array('id' => 'standard_profile_fields', 'title' => $txt['standard_profile_title'], 'base_href' => $scripturl . '?action=admin;area=featuresettings;sa=profile', 'get_items' => array('function' => 'list_getProfileFields', 'params' => array(true)), 'columns' => array('field' => array('header' => array('value' => $txt['standard_profile_field']), 'data' => array('db' => 'label', 'style' => 'width: 60%;')), 'active' => array('header' => array('value' => $txt['custom_edit_active'], 'class' => 'centertext'), 'data' => array('function' => create_function('$rowData', '
$isChecked = $rowData[\'disabled\'] ? \'\' : \' checked="checked"\';
$onClickHandler = $rowData[\'can_show_register\'] ? sprintf(\'onclick="document.getElementById(\\\'reg_%1$s\\\').disabled = !this.checked;"\', $rowData[\'id\']) : \'\';
return sprintf(\'<input type="checkbox" name="active[]" id="active_%1$s" value="%1$s" class="input_check" %2$s %3$s />\', $rowData[\'id\'], $isChecked, $onClickHandler);
'), 'style' => 'width: 20%;', 'class' => 'centertext')), 'show_on_registration' => array('header' => array('value' => $txt['custom_edit_registration'], 'class' => 'centertext'), 'data' => array('function' => create_function('$rowData', '
$isChecked = $rowData[\'on_register\'] && !$rowData[\'disabled\'] ? \' checked="checked"\' : \'\';
$isDisabled = $rowData[\'can_show_register\'] ? \'\' : \' disabled="disabled"\';
return sprintf(\'<input type="checkbox" name="reg[]" id="reg_%1$s" value="%1$s" class="input_check" %2$s %3$s />\', $rowData[\'id\'], $isChecked, $isDisabled);
'), 'style' => 'width: 20%;', 'class' => 'centertext'))), 'form' => array('href' => $scripturl . '?action=admin;area=featuresettings;sa=profile', 'name' => 'standardProfileFields', 'token' => 'admin-scp'), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '<input type="submit" name="save" value="' . $txt['save'] . '" class="right_submit" />')));
createList($listOptions);
// And now we do the same for all of our custom ones
$token = createToken('admin-sort');
$listOptions = array('id' => 'custom_profile_fields', 'title' => $txt['custom_profile_title'], 'base_href' => $scripturl . '?action=admin;area=featuresettings;sa=profile', 'default_sort_col' => 'vieworder', 'no_items_label' => $txt['custom_profile_none'], 'items_per_page' => 25, 'sortable' => true, 'get_items' => array('function' => 'list_getProfileFields', 'params' => array(false)), 'get_count' => array('function' => 'list_getProfileFieldSize'), 'columns' => array('vieworder' => array('header' => array('value' => '', 'style' => 'display: none'), 'data' => array('db' => 'vieworder', 'style' => 'display: none'), 'sort' => array('default' => 'vieworder')), 'field_name' => array('header' => array('value' => $txt['custom_profile_fieldname']), 'data' => array('function' => create_function('$rowData', '
global $scripturl;
return sprintf(\'<a href="%1$s?action=admin;area=featuresettings;sa=profileedit;fid=%2$d">%3$s</a><div class="smalltext">%4$s</div>\', $scripturl, $rowData[\'id_field\'], $rowData[\'field_name\'], $rowData[\'field_desc\']);
'), 'style' => 'width: 65%;'), 'sort' => array('default' => 'field_name', 'reverse' => 'field_name DESC')), 'field_type' => array('header' => array('value' => $txt['custom_profile_fieldtype']), 'data' => array('function' => create_function('$rowData', '
global $txt;
$textKey = sprintf(\'custom_profile_type_%1$s\', $rowData[\'field_type\']);
return isset($txt[$textKey]) ? $txt[$textKey] : $textKey;
'), 'style' => 'width: 10%;'), 'sort' => array('default' => 'field_type', 'reverse' => 'field_type DESC')), 'cust' => array('header' => array('value' => $txt['custom_profile_active'], 'class' => 'centertext'), 'data' => array('function' => create_function('$rowData', '
$isChecked = $rowData[\'active\'] ? \' checked="checked"\' : \'\';
return sprintf(\'<input type="checkbox" name="cust[]" id="cust_%1$s" value="%1$s" class="input_check"%2$s />\', $rowData[\'id_field\'], $isChecked);
'), 'style' => 'width: 8%;', 'class' => 'centertext'), 'sort' => array('default' => 'active DESC', 'reverse' => 'active')), 'placement' => array('header' => array('value' => $txt['custom_profile_placement']), 'data' => array('function' => create_function('$rowData', '
global $txt;
return $txt[\'custom_profile_placement_\' . (empty($rowData[\'placement\']) ? \'standard\' : ($rowData[\'placement\'] == 1 ? \'withicons\' : \'abovesignature\'))];
'), 'style' => 'width: 5%;'), 'sort' => array('default' => 'placement DESC', 'reverse' => 'placement')), 'show_on_registration' => array('data' => array('sprintf' => array('format' => '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=%1$s">' . $txt['modify'] . '</a>', 'params' => array('id_field' => false)), 'style' => 'width: 5%;'))), 'form' => array('href' => $scripturl . '?action=admin;area=featuresettings;sa=profileedit', 'name' => 'customProfileFields', 'token' => 'admin-scp'), 'additional_rows' => array(array('class' => 'submitbutton', 'position' => 'below_table_data', 'value' => '<input type="submit" name="onoff" value="' . $txt['save'] . '" class="right_submit" />
<input type="submit" name="new" value="' . $txt['custom_profile_make_new'] . '" class="right_submit" />'), array('position' => 'top_of_list', 'value' => '<p class="infobox">' . $txt['custom_profile_sort'] . '</p>')), 'javascript' => '
$().elkSortable({
sa: "profileorder",
error: "' . $txt['admin_order_error'] . '",
title: "' . $txt['admin_order_title'] . '",
placeholder: "ui-state-highlight",
href: "?action=admin;area=featuresettings;sa=profile",
token: {token_var: "' . $token['admin-sort_token_var'] . '", token_id: "' . $token['admin-sort_token'] . '"}
});
');
createList($listOptions);
}
示例13: ModifyLanguages
function ModifyLanguages()
{
global $txt, $context, $scripturl;
global $user_info, $smcFunc, $sourcedir, $language, $boarddir, $forum_version;
// Setting a new default?
if (!empty($_POST['set_default']) && !empty($_POST['def_language'])) {
checkSession();
if ($_POST['def_language'] != $language) {
require_once $sourcedir . '/Subs-Admin.php';
updateSettingsFile(array('language' => '\'' . $_POST['def_language'] . '\''));
$language = $_POST['def_language'];
}
}
$listOptions = array('id' => 'language_list', 'items_per_page' => 20, 'base_href' => $scripturl . '?action=admin;area=languages', 'title' => $txt['edit_languages'], 'get_items' => array('function' => 'list_getLanguages'), 'get_count' => array('function' => 'list_getNumLanguages'), 'columns' => array('default' => array('header' => array('value' => $txt['languages_default']), 'data' => array('function' => create_function('$rowData', '
return \'<input type="radio" name="def_language" value="\' . $rowData[\'id\'] . \'" \' . ($rowData[\'default\'] ? \'checked="checked"\' : \'\') . \' onclick="highlightSelected(\\\'list_language_list_\' . $rowData[\'id\'] . \'\\\');" class="input_radio" />\';
'), 'style' => 'text-align: center; width: 8%;')), 'name' => array('header' => array('value' => $txt['languages_lang_name']), 'data' => array('function' => create_function('$rowData', '
global $scripturl, $context;
return sprintf(\'<a href="%1$s?action=admin;area=languages;sa=editlang;lid=%2$s">%3$s</a>\', $scripturl, $rowData[\'id\'], $rowData[\'name\']);
'))), 'character_set' => array('header' => array('value' => $txt['languages_character_set']), 'data' => array('db_htmlsafe' => 'char_set')), 'count' => array('header' => array('value' => $txt['languages_users']), 'data' => array('db_htmlsafe' => 'count', 'style' => 'text-align: center')), 'locale' => array('header' => array('value' => $txt['languages_locale']), 'data' => array('db_htmlsafe' => 'locale'))), 'form' => array('href' => $scripturl . '?action=admin;area=languages'), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '<input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" /><input type="submit" name="set_default" value="' . $txt['save'] . '"' . (is_writable($boarddir . '/Settings.php') ? '' : ' disabled="disabled"') . ' class="button_submit" />', 'style' => 'text-align: right;')), 'javascript' => '
var prevClass = "";
var prevDiv = "";
function highlightSelected(box)
{
if (prevClass != "")
prevDiv.className = prevClass;
prevDiv = document.getElementById(box);
prevClass = prevDiv.className;
prevDiv.className = "highlight2";
}
highlightSelected("list_language_list_' . ($language == '' ? 'english' : $language) . '");
');
// Display a warning if we cannot edit the default setting.
if (!is_writable($boarddir . '/Settings.php')) {
$listOptions['additional_rows'][] = array('position' => 'after_title', 'value' => $txt['language_settings_writable'], 'class' => 'smalltext alert');
}
require_once $sourcedir . '/Subs-List.php';
createList($listOptions);
$context['sub_template'] = 'show_list';
$context['default_list'] = 'language_list';
}
示例14: KB_mreports
function KB_mreports()
{
global $scripturl, $sourcedir, $txt, $smcFunc, $context;
isAllowedTo('manage_kb');
$list_options = array('id' => 'kb_know_reports', 'title' => $txt['kb_rlist1'], 'items_per_page' => 30, 'base_href' => $scripturl . '?action=kb;area=manage', 'default_sort_col' => 'id', 'start_var_name' => 'startreport', 'request_vars' => array('desc' => 'descreport', 'sort' => 'sortreport'), 'get_items' => array('function' => create_function('$start, $items_per_page, $sort', '
global $context, $smcFunc;
$request = $smcFunc[\'db_query\'](\'\', \'
SELECT k.id, k.id_article, k.id_member, k.comment, m.id_member, m.real_name, k.date
FROM {db_prefix}kb_reports AS k
LEFT JOIN {db_prefix}members AS m ON (m.id_member = k.id_member)
ORDER BY {raw:sort}
LIMIT {int:start}, {int:per_page}\',
array(
\'sort\' => $sort,
\'start\' => $start,
\'per_page\' => $items_per_page,
)
);
$kbcn = array();
while ($row = $smcFunc[\'db_fetch_assoc\']($request))
$kbcn[] = $row;
$smcFunc[\'db_free_result\']($request);
return $kbcn;
')), 'get_count' => array('function' => create_function('', '
global $smcFunc;
$request = $smcFunc[\'db_query\'](\'\', \'
SELECT COUNT(*)
FROM {db_prefix}kb_reports\',
array());
list ($total_kbn) = $smcFunc[\'db_fetch_row\']($request);
$smcFunc[\'db_free_result\']($request);
return $total_kbn;
')), 'no_items_label' => $txt['knowledgebasenone'], 'columns' => array('id' => array('header' => array('value' => $txt['kb_rlistcomment']), 'data' => array('function' => create_function('$row', '
global $scripturl;
return \'\'.$row[\'comment\'].\'\';
'), 'style' => 'width: 20%; text-align: left;'), 'sort' => array('default' => 'id', 'reverse' => 'id DESC')), 'real_name' => array('header' => array('value' => $txt['kb_rlistnor1']), 'data' => array('function' => create_function('$row', '
global $scripturl;
return \'<a href="\'.$scripturl.\'?action=profile;u=\'.$row[\'id_member\'].\'">\'.$row[\'real_name\'].\'</a>\';
'), 'style' => 'width: 4%; text-align: center;'), 'sort' => array('default' => 'real_name', 'reverse' => 'real_name DESC')), 'date' => array('header' => array('value' => $txt['knowledgebasecreated']), 'data' => array('function' => create_function('$row', '
return timeformat($row[\'date\']);
'), 'style' => 'width: 5%; text-align: center;'), 'sort' => array('default' => 'date', 'reverse' => 'date DESC')), 'id_article' => array('header' => array('value' => '<input type="checkbox" name="all" class="input_check" onclick="invertAll(this, this.form);" />'), 'data' => array('function' => create_function('$row', '
global $sc, $txt, $scripturl;
return \'[<a href="\'.$scripturl.\'?action=kb;area=article;cont=\'.$row[\'id_article\'].\'">\'.$txt[\'kb_rlistnor44\'].\'</a>]
<input type="checkbox" class="input_check" name="delete[]" value="\' . $row[\'id\'] . \'" />\';
'), 'style' => 'width: 2%; text-align: center;'), 'sort' => array('default' => 'id_article', 'reverse' => 'id_article DESC'))), 'form' => array('href' => $scripturl . '?action=kb;area=manage', 'include_sort' => true, 'include_start' => true, 'hidden_fields' => array($context['session_var'] => $context['session_id'])), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '
<input type="submit" name="remove" value="' . $txt['kb_remove_log2'] . '" class="button_submit" onclick="return confirmSubmit();" />
<input type="submit" name="removeall" value="' . $txt['kb_remove_log1'] . '" class="button_submit" onclick="return confirmSubmit();" />')));
require_once $sourcedir . '/Subs-List.php';
createList($list_options);
if (isset($_POST['removeall'])) {
checkSession();
$query_params = array('table' => 'kb_reports', 'where' => '');
$query_data = array();
KB_DeleteData($query_params, $query_data);
$mes = $txt['kb_del_areports'];
KB_log_actions('del_report', 0, $mes);
KB_cleanCache();
redirectexit('action=kb;area=manage');
} elseif (!empty($_POST['remove']) && isset($_POST['delete'])) {
checkSession();
$query_params = array('table' => 'kb_reports', 'where' => 'id IN ({array_string:delete_actions})');
$query_data = array('delete_actions' => array_unique($_POST['delete']));
KB_DeleteData($query_params, $query_data);
$mes = $txt['kb_del_reports'];
KB_log_actions('del_report', 0, $mes);
KB_cleanCache();
redirectexit('action=kb;area=manage');
}
}
示例15: EditMessageIcons
//.........这里部分代码省略.........
$deleteIcons = array();
foreach ($_POST['checked_icons'] as $icon) {
$deleteIcons[] = (int) $icon;
}
// Do the actual delete!
$smcFunc['db_query']('', '
DELETE FROM {db_prefix}message_icons
WHERE id_icon IN ({array_int:icon_list})', array('icon_list' => $deleteIcons));
} elseif ($context['sub_action'] == 'editicon' && isset($_GET['icon'])) {
$_GET['icon'] = (int) $_GET['icon'];
// Do some preperation with the data... like check the icon exists *somewhere*
if (strpos($_POST['icon_filename'], '.gif') !== false) {
$_POST['icon_filename'] = substr($_POST['icon_filename'], 0, -4);
}
if (!file_exists($settings['default_theme_dir'] . '/images/post/' . $_POST['icon_filename'] . '.gif')) {
fatal_lang_error('icon_not_found');
} elseif (strlen($_POST['icon_filename']) > 16) {
fatal_lang_error('icon_name_too_long');
} elseif ($_POST['icon_location'] == $_GET['icon'] && !empty($_GET['icon'])) {
fatal_lang_error('icon_after_itself');
}
// First do the sorting... if this is an edit reduce the order of everything after it by one ;)
if ($_GET['icon'] != 0) {
$oldOrder = $context['icons'][$_GET['icon']]['true_order'];
foreach ($context['icons'] as $id => $data) {
if ($data['true_order'] > $oldOrder) {
$context['icons'][$id]['true_order']--;
}
}
}
// If there are no existing icons and this is a new one, set the id to 1 (mainly for non-mysql)
if (empty($_GET['icon']) && empty($context['icons'])) {
$_GET['icon'] = 1;
}
// Get the new order.
$newOrder = $_POST['icon_location'] == 0 ? 0 : $context['icons'][$_POST['icon_location']]['true_order'] + 1;
// Do the same, but with the one that used to be after this icon, done to avoid conflict.
foreach ($context['icons'] as $id => $data) {
if ($data['true_order'] >= $newOrder) {
$context['icons'][$id]['true_order']++;
}
}
// Finally set the current icon's position!
$context['icons'][$_GET['icon']]['true_order'] = $newOrder;
// Simply replace the existing data for the other bits.
$context['icons'][$_GET['icon']]['title'] = $_POST['icon_description'];
$context['icons'][$_GET['icon']]['filename'] = $_POST['icon_filename'];
$context['icons'][$_GET['icon']]['board_id'] = (int) $_POST['icon_board'];
// Do a huge replace ;)
$iconInsert = array();
$iconInsert_new = array();
foreach ($context['icons'] as $id => $icon) {
if ($id != 0) {
$iconInsert[] = array($id, $icon['board_id'], $icon['title'], $icon['filename'], $icon['true_order']);
} else {
$iconInsert_new[] = array($icon['board_id'], $icon['title'], $icon['filename'], $icon['true_order']);
}
}
$smcFunc['db_insert']('replace', '{db_prefix}message_icons', array('id_icon' => 'int', 'id_board' => 'int', 'title' => 'string-80', 'filename' => 'string-80', 'icon_order' => 'int'), $iconInsert, array('id_icon'));
if (!empty($iconInsert_new)) {
$smcFunc['db_insert']('replace', '{db_prefix}message_icons', array('id_board' => 'int', 'title' => 'string-80', 'filename' => 'string-80', 'icon_order' => 'int'), $iconInsert_new, array('id_icon'));
}
}
// Sort by order, so it is quicker :)
$smcFunc['db_query']('alter_table_icons', '
ALTER TABLE {db_prefix}message_icons
ORDER BY icon_order', array('db_error_skip' => true));
// Unless we're adding a new thing, we'll escape
if (!isset($_POST['add'])) {
redirectexit('action=admin;area=smileys;sa=editicons');
}
}
$context[$context['admin_menu_name']]['current_subsection'] = 'editicons';
$listOptions = array('id' => 'message_icon_list', 'base_href' => $scripturl . '?action=admin;area=smileys;sa=editicons', 'get_items' => array('function' => 'list_getMessageIcons'), 'no_items_label' => $txt['icons_no_entries'], 'columns' => array('icon' => array('data' => array('function' => create_function('$rowData', '
global $settings;
$images_url = $settings[file_exists(sprintf(\'%1$s/images/post/%2$s.gif\', $settings[\'theme_dir\'], $rowData[\'filename\'])) ? \'actual_images_url\' : \'default_images_url\'];
return sprintf(\'<img src="%1$s/post/%2$s.gif" alt="%3$s" />\', $images_url, $rowData[\'filename\'], htmlspecialchars($rowData[\'title\']));
')), 'style' => 'text-align: center;'), 'filename' => array('header' => array('value' => $txt['smileys_filename']), 'data' => array('sprintf' => array('format' => '%1$s.gif', 'params' => array('filename' => true)))), 'tooltip' => array('header' => array('value' => $txt['smileys_description']), 'data' => array('db_htmlsafe' => 'title', 'class' => 'windowbg')), 'board' => array('header' => array('value' => $txt['icons_board']), 'data' => array('function' => create_function('$rowData', '
global $txt;
return empty($rowData[\'board_name\']) ? $txt[\'icons_edit_icons_all_boards\'] : $rowData[\'board_name\'];
'))), 'modify' => array('header' => array('value' => $txt['smileys_modify']), 'data' => array('sprintf' => array('format' => '<a href="' . $scripturl . '?action=admin;area=smileys;sa=editicon;icon=%1$s">' . $txt['smileys_modify'] . '</a>', 'params' => array('id_icon' => false)), 'style' => 'text-align: center')), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />'), 'data' => array('sprintf' => array('format' => '<input type="checkbox" name="checked_icons[]" value="%1$d" class="input_check" />', 'params' => array('id_icon' => false)), 'style' => 'text-align: center'))), 'form' => array('href' => $scripturl . '?action=admin;area=smileys;sa=editicons'), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '<input type="submit" name="delete" value="' . $txt['quickmod_delete_selected'] . '" style="float: right" class="button_submit" />[<a href="' . $scripturl . '?action=admin;area=smileys;sa=editicon">' . $txt['icons_add_new'] . '</a>]')));
require_once $sourcedir . '/Subs-List.php';
createList($listOptions);
// If we're adding/editing an icon we'll need a list of boards
if ($context['sub_action'] == 'editicon' || isset($_POST['add'])) {
// Force the sub_template just in case.
$context['sub_template'] = 'editicon';
$context['new_icon'] = !isset($_GET['icon']);
// Get the properties of the current icon from the icon list.
if (!$context['new_icon']) {
$context['icon'] = $context['icons'][$_GET['icon']];
}
// Get a list of boards needed for assigning this icon to a specific board.
$boardListOptions = array('use_permissions' => true, 'selected_board' => isset($context['icon']['board_id']) ? $context['icon']['board_id'] : 0);
require_once $sourcedir . '/Subs-MessageIndex.php';
$context['categories'] = getBoardList($boardListOptions);
}
}