function drawEventForm() { global $page; $f = new form('cal_events', @$_GET['id'], $page['title']); if (url_id()) { $f->set_title_prefix(drawHeader(false, ' ')); } if ($page['is_admin']) { $f->set_field(array('name' => 'created_user', 'class' => 'admin', 'type' => 'select', 'sql' => 'SELECT id, CONCAT_WS(", ", lastname, firstname) FROM users WHERE is_active = 1 ORDER BY lastname, firstname', 'default' => $_SESSION['user_id'], 'required' => true, 'label' => getString('posted_by'))); } $f->set_field(array('name' => 'title' . langExt(), 'label' => getString('title'), 'type' => 'text')); $f->set_field(array('name' => 'start_date', 'label' => getString('start_date'), 'type' => 'datetime', 'required' => true)); $f->set_field(array('name' => 'end_date', 'label' => getString('end_date'), 'type' => 'datetime', 'required' => true)); $f->set_field(array('name' => 'type_id', 'type' => 'select', 'sql' => 'SELECT id, description' . langExt() . ' FROM cal_events_types ORDER BY description', 'label' => getString('category'), 'required' => 'true')); $f->set_field(array('name' => 'description' . langExt(), 'label' => getString('description'), 'type' => 'textarea', 'class' => 'tinymce')); langUnsetFields($f, 'title,description'); formAddChannels($f, 'cal_events', 'event_id'); $f->set_order('created_user,title, start_date, end_date, type_id, description, channels'); langTranslateCheckbox($f, url_id()); return $f->draw(false, false); }
<?php $clips = db_query('SELECT c.id, c.title' . langExt() . ' title FROM press_clips c ' . getChannelsWhere('press_clips', 'c', 'clip_id') . ' ORDER BY c.pub_date DESC', 4); if (db_found($clips)) { while ($c = db_fetch($clips)) { $return .= '<tr><td colspan="2"><a href="/' . $m['folder'] . '/clip.php?id=' . $c['id'] . '">' . format_string($c['title'], 40) . '</a></td></tr>'; } } else { $return .= '<tr><td colspan="2" class="empty">No clips have been added.</td></tr>'; }
echo $r['description']; ?> </td> </tr> <?php if (getOption('channels')) { ?> <tr> <td class="left"><?php echo getString('channels_label'); ?> </td> <td> <?php $channels = db_query('SELECT c.title' . langExt() . ' title FROM press_clips_to_channels d2c JOIN channels c ON d2c.channel_id = c.id WHERE d2c.clip_id = ' . $_GET['id']); while ($c = db_fetch($channels)) { ?> · <?php echo $c['title']; ?> </a><br> <?php } ?> </td> </tr> <?php
function langUnsetFields($form, $names) { //unset fields for other languages //todo - take multiple names //if (!getOption('languages')) return false; $names = array_separated($names); foreach ($names as $name) { $languages = db_array('SELECT code FROM languages WHERE id <> ' . $_SESSION['language_id']); foreach ($languages as &$l) { $l = $name . langExt($l); } $form->unset_fields(implode(',', $languages)); } }
<?php include '../../include.php'; if ($posting) { format_post_bits('is_selected'); langTranslatePost('name,description'); $id = db_save('soc_members'); url_change_post('../'); } echo drawTop(); $f = new form('soc_members', @$_GET['id'], $page['title']); $f->set_field(array('name' => 'name' . langExt(), 'type' => 'text', 'label' => getString('title'))); $f->set_field(array('name' => 'country_id', 'type' => 'select', 'sql' => 'SELECT id, en FROM jr_countries ORDER BY en')); $f->set_field(array('name' => 'description' . langExt(), 'type' => 'textarea', 'class' => 'tinymce', 'label' => getString('description'))); langUnsetFields($f, 'name,description'); langTranslateCheckbox($f); $f->set_title_prefix($page['breadcrumbs']); echo $f->draw(); echo drawBottom();
</td> </tr> <?php } ?> <tr> <td class="left"><?php echo getString('permissions'); ?> </td> <td colspan="2"> <?php if ($r['is_admin']) { echo "Site Administrator"; } else { $permissions = array_merge(db_array('SELECT m.title' . langExt() . ' title FROM modules m JOIN users_to_modules a ON m.id = a.module_id WHERE a.user_id = ' . $_GET['id'] . ' AND a.is_admin = 1 ORDER BY m.title'), db_array('SELECT m.title' . langExt() . ' title FROM modulettes m JOIN users_to_modulettes a ON m.id = a.modulette_id WHERE a.user_id = ' . $_GET['id'] . ' ORDER BY m.title')); if (count($permissions)) { sort($permissions); echo draw_list($permissions); } else { echo getString('none'); } } ?> </td> </tr> <?php } if (getOption("staff_showhome")) { ?> <tr class="group">
</a><br> <?php } ?> </td> </tr> <?php } ?> </table> <?php } else { //main table $result = db_table('SELECT e.id, e.title' . langExt() . ' title, t.title' . langExt() . ' "group", e2t.type_id FROM external_orgs e JOIN external_orgs_to_types e2t ON e.id = e2t.org_id JOIN external_orgs_types t ON e2t.type_id = t.id WHERE e.is_active = 1 ORDER BY t.title, e.title '); $t = new table('external_orgs_types', drawHeader(array('#bottom' => getString('add_new')))); $t->set_column('title', 'l', getString('title')); foreach ($result as &$r) { $r['group'] = draw_link('./type.php?id=' . $r['type_id'], $r['group']); $r['title'] = draw_link('./?id=' . $r['id'], $r['title']); } echo $t->draw($result, 'There are no external orgs added yet.'); //add new include 'edit.php'; }
<?php include "../include.php"; echo drawTop(); if (url_id()) { $title = db_grab('SELECT title' . langExt() . ' title FROM press_clips_types WHERE id = ' . $_GET["id"]); $result = db_table('SELECT c.id, c.title' . langExt() . ' title, c.pub_date, c.publication' . langExt() . ' publication, ISNULL(c.created_date, c.updated_date) updated FROM press_clips c ' . getChannelsWhere('press_clips', 'c', 'clip_id') . ' AND c.type_id = ' . $_GET["id"] . ' ORDER BY updated DESC'); $t = new table('press_clips', drawHeader(false, $title)); $t->set_column('title', 'l', getString('title')); $t->set_column('publication', 'l', getString('publication')); $t->set_column('pub_date', 'r', getString('published')); foreach ($result as &$r) { $r['title'] = draw_link('clip.php?id=' . $r['id'], format_string($r['title'], 50)); $r['pub_date'] = format_date($r['pub_date']); } echo $t->draw($result, 'There are no clips tagged <i>' . $title . '</i>.'); } else { $t = new table('press_clips', drawHeader()); $t->set_column('category', 'l', getString('category')); $t->set_column('clips', 'r', getString('clips')); $result = db_table('SELECT t.id, t.title' . langExt() . ' category, (SELECT COUNT(*) FROM press_clips c WHERE c.type_id = t.id) clips FROM press_clips_types t ORDER BY t.precedence'); foreach ($result as &$r) { $r['category'] = draw_link(url_query_add(array('id' => $r['id']), false), $r['category']); } echo $t->draw($result); } echo drawBottom();
<?php include '../include.php'; if (url_action('delete')) { db_delete('docs'); url_drop(); } echo drawTop(); if (getOption('languages')) { $result = db_table('SELECT d.id, d.title' . langExt() . ' title, ' . db_updated('d') . ', i.extension, i.description alt, c.title' . langExt() . ' "group", l.title language FROM docs d JOIN docs_to_categories d2c ON d.id = d2c.documentID JOIN docs_categories c ON d2c.categoryID = c.id JOIN docs_types i ON d.type_id = i.id JOIN languages l ON d.language_id = l.id ' . getChannelsWhere('docs', 'd', 'doc_id') . ' ORDER BY c.precedence, d.title;'); } else { $result = db_table('SELECT d.id, d.title, ' . db_updated('d') . ', i.extension, i.description alt, c.title "group" FROM docs d JOIN docs_to_categories d2c ON d.id = d2c.documentID JOIN docs_categories c ON d2c.categoryID = c.id JOIN docs_types i ON d.type_id = i.id ' . getChannelsWhere('docs', 'd', 'doc_id') . '
<?php include '../../include.php'; if (url_action('delete')) { db_delete('soc_whatsnew', $_GET['delete_id']); url_drop('action,delete_id'); } echo drawTop(); $t = new table('soc_whatsnew', drawHeader(array('edit/' => getString('add_new')))); $t->set_column('draggy', 'd', ' '); $t->set_column('title', 'l', getString('title')); $t->set_column('updated', 'r', getString('updated')); $t->set_column('delete', 'd', ' '); $result = db_table('SELECT w.id, w.title' . langExt() . ' title, ' . db_updated('w') . ' FROM soc_whatsnew w WHERE w.is_active = 1 ORDER BY w.precedence'); foreach ($result as &$r) { $r['draggy'] = draw_img('/images/icons/move.png'); $r['title'] = draw_link('edit.php?id=' . $r['id'], format_string($r['title'], 70)); $r['updated'] = format_date($r['updated']); $r['delete'] = drawColumnDelete($r['id']); } echo $t->draw($result); echo drawBottom();
<?php include 'include.php'; echo drawTop(); if (!isset($_GET['office_id'])) { $_GET['office_id'] = 1; $_josh['request']['path_query'] = '/staff/locations.php?office_id=1'; } $locations = db_query('SELECT o.id, o.name' . langExt() . ' FROM offices o WHERE o.is_active = 1 AND (SELECT COUNT(*) FROM users u WHERE u.is_active = 1 AND u.officeID = o.id) > 0 ORDER BY o.precedence'); if (db_found($locations)) { $pages = array(); $counter = 1; while ($l = db_fetch($locations)) { if ($counter < 6) { $pages['/staff/locations.php?office_id=' . $l['id']] = $l['name']; } else { if ($counter == 6) { $pages['/staff/locations.php?office_id=other'] = 'Other'; $others = array(); } $others[] = $l['id']; } $counter++; } echo drawNavigation($pages, 'path_query'); } if ($_GET['office_id'] == 'other') { echo drawStaffList('u.is_active = 1 AND u.officeID IN (' . implode(',', $others) . ')'); } else { echo drawStaffList('u.is_active = 1 and u.officeID = ' . $_GET['office_id']); }
if (admin()) { $f->set_group(getString('permissions'), increment()); //new rule: only admins can edit permissions $f->set_field(array('type' => 'checkbox', 'name' => 'is_admin', 'label' => getString('is_admin'), 'position' => increment())); if (!empty($_GET['id'])) { $sql = 'SELECT m.id, m.title' . langExt() . ', (SELECT COUNT(*) FROM users_to_modules u2m WHERE u2m.is_admin = 1 AND u2m.module_id = m.id AND u2m.user_id = ' . $_GET['id'] . ') checked FROM modules m WHERE m.is_active = 1'; } else { $sql = 'SELECT id, title' . langExt() . ' FROM modules WHERE is_active = 1'; } $f->set_field(array('type' => 'checkboxes', 'name' => 'modules', 'label' => getString('module_permissions'), 'sql' => $sql, 'position' => increment())); $f->set_field(array('type' => 'checkboxes', 'name' => 'modulettes', 'label' => getString('modulette_permissions'), 'options_table' => 'modulettes', 'linking_table' => 'users_to_modulettes', 'option_title' => 'title' . langExt(), 'option_id' => 'modulette_id', 'object_id' => 'user_id', 'position' => increment())); } else { $f->unset_fields('is_admin'); } //administrative info (admin) if ($page['is_admin']) { $f->set_group(getString('administrative_info'), increment()); formAddChannels($f, 'users', 'user_id'); $f->set_field(array('name' => 'startDate', 'label' => getString('start_date'), 'type' => 'date', 'required' => true, 'position' => increment())); $f->set_field(array('name' => 'endDate', 'label' => getString('end_date'), 'type' => 'date', 'required' => false, 'position' => increment())); if (getOption('staff_showrank')) { $f->set_field(array('name' => 'rankID', 'label' => getString('rank'), 'type' => 'select', 'sql' => 'SELECT id, description FROM intranet_ranks ORDER BY sequence', 'default' => db_grab('SELECT id FROM intranet_ranks WHERE isPayroll = 1'), 'required' => true, 'position' => increment())); } else { $f->unset_fields('rankID'); } //if (getOption('staff_ldcode')) {
} echo drawSimpleTop(getString('login_account_request')); echo drawMessage(getString('login_account_request_msg')); $f = new form('users_requests', false, getString('login_account_request')); $f->set_field(array('type' => 'select', 'sql' => 'SELECT id, title' . langExt() . ' title FROM organizations WHERE is_active = 1 ORDER BY precedence', 'name' => 'organization_id', 'label' => getString('organization'), 'required' => true, 'null_value' => getString('please_select'))); $f->set_field(array('type' => 'text', 'name' => 'firstname', 'label' => getString('name_first'))); $f->set_field(array('type' => 'text', 'name' => 'nickname', 'label' => getString('nickname'))); $f->set_field(array('type' => 'text', 'name' => 'lastname', 'label' => getString('name_last'))); $f->set_field(array('type' => 'text', 'name' => 'title', 'label' => getString('staff_title'))); $f->set_field(array('type' => 'text', 'name' => 'phone', 'label' => getString('telephone'))); $f->set_field(array('type' => 'text', 'name' => 'email', 'label' => getString('email'))); if (getOption('staff_showoffice')) { $f->set_field(array('type' => 'select', 'name' => 'officeID', 'label' => getString('location'), 'sql' => 'SELECT id, name FROM offices ORDER BY precedence', 'required' => true)); } else { $f->unset_fields('officeID'); } if (getOption('staff_showdept')) { $f->set_field(array('type' => 'select', 'name' => 'departmentID', 'label' => getString('department'), 'sql' => 'SELECT departmentID, departmentName FROM departments WHERE is_active = 1 ORDER BY precedence')); } else { $f->unset_fields('departmentID'); } if (getOption('channels') && url_id() == user()) { $f->set_group(getString('email_prefs')); $f->set_field(array('name' => 'email_prefs', 'option_title' => 'title' . langExt(), 'type' => 'checkboxes', 'label' => getString('email_prefs_label'), 'options_table' => 'channels', 'linking_table' => 'users_to_channels_prefs', 'object_id' => 'user_id', 'option_id' => 'channel_id', 'default' => 'all')); } if (getOption('legal')) { $f->set_field(array('type' => 'checkbox', 'name' => 'legal', 'label' => getString('legal_checkbox'))); } $f->set_field(array('type' => 'textarea', 'name' => 'bio', 'label' => getString('bio'), 'class' => 'tinymce')); echo $f->draw(); echo drawSimpleBottom();
<?php include 'include.php'; $orgs = array(); if (getOption('staff_allowshared')) { $orgs[0] = 'Shared'; } $orgs = db_table('SELECT id, title' . langExt() . ' title from organizations WHERE is_active = 1 ORDER BY precedence', $orgs, false, false); echo drawTop(); if (count($orgs) < 8) { ?> <table class='navigation staff' cellspacing='1'> <tr class='staff-hilite'> <?php foreach ($orgs as $o) { ?> <td width='14.28%'<?php if (url_id() == $o['id']) { ?> class='selected'<?php } ?> ><?php if (url_id() != $o['id']) { ?> <a href='organizations.php?id=<?php echo $o['id']; ?> '><?php } else { ?>
<?php include '../../include.php'; echo drawTop(); echo drawTableStart(); echo drawHeaderRow(false, 1, getString('edit'), 'edit/'); echo '<tr><td class="text">' . db_grab('SELECT content' . langExt() . ' FROM guide') . '</td></tr>'; echo drawTableEnd(); echo drawBottom();
<?php $return .= '<tr><td colspan="2">' . drawSelectUser('staff', false, true, 0, true, true, "Jump to Staff Member") . '</td></tr>'; $pages = db_table('SELECT url, title' . langExt() . ' title FROM pages WHERE module_id = ' . $m['id'] . ' AND is_active = 1 AND is_hidden <> 1 AND is_admin <> 1 ORDER by precedence'); foreach ($pages as &$p) { $p = draw_link('/staff/' . $p['url'], $p['title']); } $return .= draw_table_rows($pages);
foreach ($addresses as $lang => $emails) { $topic = db_grab('SELECT t.title' . langExt($lang) . ' title, y.title' . langExt($lang) . ' type, t.created_date FROM bb_topics t LEFT JOIN bb_topics_types y ON t.type_id = y.id WHERE t.id = ' . $_POST['topic_id']); $reply = db_grab('SELECT f.description' . langExt($lang) . ' description, ISNULL(u.nickname, u.firstname) firstname, u.lastname FROM bb_followups f JOIN users u ON f.created_user = u.id WHERE f.id = ' . $id); $channels_text = db_array('SELECT c.title' . langExt($lang) . ' FROM bb_topics_to_channels t2c JOIN channels c ON t2c.channel_id = c.id WHERE t2c.topic_id = ' . $_POST['topic_id']); $channels_text = implode(', ', $channels_text); $message = '<p style="font-weight:bold;">' . $reply['firstname'] . ' ' . $reply['lastname'] . ' ' . getString('bb_followup', $lang) . '</p> <p>' . getString('title', $lang) . ': ' . draw_link(url_base() . '/bb/topic.php?id=' . $id, $topic['title']) . '</p> <p>' . getString('channels_label', $lang) . ': ' . $channels_text . '</p>'; if ($topic['type']) { $message .= '<p>' . getString('category', $lang) . ': ' . $topic['type'] . '</p>'; } $message .= '<div style="color:#555; border-top:1px dotted #555; padding-top:5px; margin-top:5px;">' . $reply['description'] . '</div>'; emailUser($emails, 'RE: ' . $topic['title'], $message); } } bbDrawRss(); url_change(); } elseif (isset($_GET['delete'])) { db_delete('bb_topics');
$title = getString('add_new'); $_josh['referrer'] = false; $_josh['request']['path_query'] = 'edit.php'; //shoddy way of setting the form target $r['url'] = 'http://'; } else { url_query_require(); echo drawTop(); $title = $page['title']; $r = db_grab('SELECT id, title, url, description from external_orgs WHERE id = ' . $_GET['id']); } if ($included) { $_GET['id'] = false; } //type id was auto-setting checkbox echo '<a name="bottom"></a>'; $f = new form('external_orgs', @$_GET['id'], $title); if (!$included) { $f->set_title_prefix(drawHeader(false, ' ')); } $f->set_field(array('name' => 'title' . langExt(), 'type' => 'text', 'label' => getString('title'))); $f->set_field(array('name' => 'description' . langExt(), 'type' => 'textarea', 'label' => getString('description'), 'class' => 'tinymce')); $f->set_field(array('name' => 'url' . langExt(), 'type' => 'text', 'label' => getString('url'))); $f->set_field(array('name' => 'types', 'label' => getString('type'), 'option_title' => 'title' . langExt(), 'type' => 'checkboxes', 'options_table' => 'external_orgs_types', 'linking_table' => 'external_orgs_to_types', 'object_id' => 'org_id', 'option_id' => 'type_id')); formAddChannels($f, 'external_orgs', 'org_id'); langUnsetFields($f, 'title,description'); langTranslateCheckbox($f, url_id()); echo $f->draw($r, !$included); if (!$included) { echo drawBottom(); }
) { alert('Only these filetypes are supported by this system:\n\n <?php echo implode('\\n', $doctypes); ?> \n\nPlease change your selection, or make sure that the \nappropriate extension is at the end of the filename.'); return false; } } return true; } //--> </script> <?php $f = new form('docs', @$_GET['id'], $page['title']); $f->set_title_prefix($page['breadcrumbs']); $f->set_field(array('name' => 'title' . langExt(), 'label' => getString('title'), 'type' => 'text')); $f->set_field(array('name' => 'description' . langExt(), 'label' => getString('description'), 'type' => 'textarea', 'class' => 'tinymce')); $f->set_field(array('name' => 'content', 'label' => getString('file'), 'type' => 'file', 'additional' => getString('upload_max') . file_get_max())); $f->unset_fields('type_id,is_deleted'); if (getOption('languages')) { $f->set_field(array('name' => 'language_id', 'type' => 'select', 'sql' => 'SELECT id, title FROM languages ORDER BY title', 'label' => getString('language'), 'required' => true)); } else { $f->unset_fields('language_id'); } $f->unset_fields('type_id'); formAddChannels($f, 'docs', 'doc_id'); $f->set_field(array('name' => 'categories', 'label' => getString('categories'), 'type' => 'checkboxes', 'options_table' => 'docs_categories', 'option_title' => 'title' . langExt(), 'linking_table' => 'docs_to_categories', 'object_id' => 'documentID', 'option_id' => 'categoryID')); langUnsetFields($f, 'title,description'); langTranslateCheckbox($f, url_id()); echo $f->draw(); echo drawBottom();
$channels = array_post_checkboxes('channels'); $languages = db_table('SELECT id, code FROM languages'); foreach ($languages as $l) { $addresses = db_array('SELECT DISTINCT u.email FROM users u JOIN users_to_channels_prefs u2cp ON u.id = u2cp.user_id WHERE u.is_active = 1 AND u.language_id = ' . $l['id'] . ' AND u2cp.channel_id IN (' . implode(',', $channels) . ')'); $topic = db_grab('SELECT ISNULL(u.nickname, u.firstname) firstname, u.lastname, t.title' . langExt($l['code']) . ' title, t.description' . langExt($l['code']) . ' description, y.title' . langExt($l['code']) . ' type, t.created_date FROM bb_topics t LEFT JOIN bb_topics_types y ON t.type_id = y.id JOIN users u ON t.created_user = u.id WHERE t.id = ' . $id); $channels_text = db_array('SELECT title' . langExt($l['code']) . ' FROM channels WHERE id IN (' . implode(',', $channels) . ')'); $channels_text = implode(', ', $channels_text); $message = '<p style="font-weight:bold;">' . $topic['firstname'] . ' ' . $topic['lastname'] . ' ' . getString('bb_notify', $l['code']) . '</p> <p>' . getString('title', $l['code']) . ': ' . draw_link(url_base() . '/bb/topic.php?id=' . $id, $topic['title']) . '</p> <p>' . getString('channels_label', $l['code']) . ': ' . $channels_text . '</p>'; if ($topic['type']) { $message .= '<p>' . getString('category', $l['code']) . ': ' . $topic['type'] . '</p>'; } $message .= '<div style="color:#555; border-top:1px dotted #555; padding-top:5px; margin-top:5px;">' . $topic['description'] . '</div>'; emailUser($addresses, $topic['title'], $message); } } bbDrawRss(); url_change(); } echo drawTop(drawSyndicateLink('bb'));
<?php include "../include.php"; echo drawTop(); $result = db_table('SELECT c.id, c.title' . langExt() . ' title, c.pub_date, t.title' . langExt() . ' "group", c.publication' . langExt() . ' publication, ' . db_updated('c') . ' FROM press_clips c JOIN press_clips_types t ON c.type_id = t.id ' . getChannelsWhere('press_clips', 'c', 'clip_id') . ' ORDER BY t.title, pub_date DESC', 20); $t = new table('press-clips', drawHeader(array('edit.php' => getString('add_new')))); $t->set_column('title', 'l', getString('title')); foreach ($result as &$r) { $r['title'] = draw_link("clip.php?id=" . $r["id"], format_string($r["title"], 80)) . '<br>' . $r["publication"] . ' <span class="light">' . format_date($r["pub_date"]) . '</span>'; } echo $t->draw($result, getString('pressclips_recent_empty')); include "edit.php"; echo drawBottom();
//need a type url_query_require('./'); if (url_action('delete')) { db_delete('external_orgs', $_GET['org_id']); url_drop('action,org_id'); } echo drawTop(); //main table echo drawTableStart(); if ($page['is_admin']) { echo drawHeaderRow($page['breadcrumbs'] . format_string(db_grab('SELECT title' . langExt() . ' title FROM external_orgs_types WHERE id = ' . $_GET['id'])), 1, getString('add_new'), '#bottom'); } else { echo drawHeaderRow($page['breadcrumbs'] . format_string(db_grab('SELECT title' . langExt() . ' title FROM external_orgs_types WHERE id = ' . $_GET['id']))); } $orgs = db_query('SELECT o.id, o.url, o.title' . langExt() . ' title, o.description' . langExt() . ' description FROM external_orgs o ' . getChannelsWhere('external_orgs', 'o', 'org_id') . ' AND (SELECT COUNT(*) FROM external_orgs_to_types t WHERE t.org_id = o.id AND t.type_id = ' . $_GET['id'] . ' > 0) ORDER BY o.title'); if (db_found($orgs)) { while ($o = db_fetch($orgs)) { ?> <tr> <td class='text'> <?php if ($page['is_admin']) { ?> <a href="<?php echo drawDeleteLink('delete this org?', $o['id'], 'delete', 'org_id'); ?>
<?php include "include.php"; if (url_action('delete')) { db_delete('bb_topics_types'); url_drop('action,id'); } echo drawTop(); $t = new table('bb_topics_types', drawHeader($page['is_admin'] ? array('category_edit.php' => getString('category_new')) : false)); $t->set_column('category', 'l', getString('category')); $t->set_column('topics', 'r', getString('topics')); if ($page['is_admin']) { $t->set_column('delete', 'd', ' '); } $result = db_table('SELECT y.id, y.title' . langExt() . ' category, (SELECT COUNT(*) FROM bb_topics t WHERE t.type_id = y.id AND t.is_active = 1) topics FROM bb_topics_types y WHERE y.is_active = 1 ORDER BY y.title'); foreach ($result as &$r) { $r['category'] = draw_link('category.php?id=' . $r['id'], $r['category']); if ($page['is_admin']) { $r['delete'] = draw_img('/images/icons/delete.png', url_query_add(array('action' => 'delete', 'id' => $r['id']), false)); } } echo $t->draw($result, 'No categories added yet'); echo drawBottom();
function addCheckboxes($name, $desc, $table, $linking_table = false, $table_col = false, $link_col = false, $id = false, $admin = false) { global $rows; $rows .= '<tr'; if ($admin) { $rows .= ' class="admin"'; } $title = "title"; $checked = 0; //special addition for permissions $where = $name == "permissions" ? " AND l.is_admin = 1" : ""; //special exception for channels table if ($table == "channels") { $title = "title" . langExt(); $checked = 1; } $rows .= '> <td class="left">' . $desc . '</td> <td>'; if ($id) { $result = db_query("SELECT \n\t\t\t\t\t\tt.id, \n\t\t\t\t\t\tt.{$title},\n\t\t\t\t\t\t(SELECT COUNT(*) FROM {$linking_table} l WHERE l.{$table_col} = {$id} AND l.{$link_col} = t.id {$where}) checked\n\t\t\t\t\tFROM {$table} t\n\t\t\t\t\tWHERE t.is_active = 1\n\t\t\t\t\tORDER BY t.{$title}"); } else { $result = db_query("SELECT id, {$title}, {$checked} checked FROM {$table} WHERE is_active = 1 ORDER BY {$title}"); } if ($total = db_found($result)) { $counter = 0; $max = ceil($total / 3); $rows .= '<table class="nospacing" width="100%"><tr>'; while ($r = db_fetch($result)) { if ($counter == 0) { $rows .= '<td width="33%" style="vertical-align:top;"><table class="nospacing">'; } $chkname = "chk-" . $name . "-" . $r["id"]; $rows .= ' <tr> <td>' . draw_form_checkbox($chkname, $r["checked"]) . '</td> <td>' . drawCheckboxText($chkname, $r[$title]) . '</td> </tr>'; if ($counter == $max - 1) { $rows .= '</table></td>'; $counter = 0; } else { $counter++; } } if ($counter != 0) { $rows .= '</table></td>'; } $rows .= '</tr></table>'; } $rows .= ' </td> </tr>'; }
if ($posting) { langTranslatePost('title'); $id = db_save('modules'); url_drop('id'); } echo drawTop(); if (url_id()) { //form $f = new form('modules', @$_GET['id']); $f->set_field(array('type' => 'text', 'name' => 'title' . langExt(), 'label' => getString('title'))); langUnsetFields($f, 'title'); langTranslateCheckbox($f); echo $f->draw(); } else { //modules list $t = new table('modules', drawHeader()); $t->set_column('is_selected', 'd', ' '); $t->set_column('draggy', 'd', ' '); $t->set_column('title', 'l', getString('title')); $t->set_column('pages', 'r'); $result = db_table('SELECT m.id, m.title' . langExt() . ' title, m.is_active, (SELECT COUNT(*) FROM pages p WHERE p.module_id = m.id AND p.modulette_id IS NULL) pages FROM modules m ORDER BY m.precedence'); $t->set_draggable('draggy'); foreach ($result as &$r) { $r['is_selected'] = draw_form_checkbox('foo', $r['is_active'], false, 'ajax_set(\'modules\', \'is_active\', ' . $r['id'] . ', ' . abs($r['is_active'] - 1) . ');'); $r['draggy'] = draw_img('/images/icons/move.png'); $r['title'] = draw_link('./?id=' . $r['id'], $r['title']); $r['pages'] = draw_link('pages.php?module_id=' . $r['id'], format_quantitize($r['pages'], 'page')); } echo $t->draw($result, 'No modules'); } echo drawBottom();
<?php include '../../include.php'; if ($posting) { langTranslatePost('title'); $id = db_save('modulettes'); url_drop('id'); } echo drawTop(); if (url_id()) { //form $f = new form('modulettes', @$_GET['id']); langUnsetFields($f, 'title'); langTranslateCheckbox($f); echo $f->draw(); } else { //modulettes list $t = new table('modulettes', drawHeader()); $t->set_column('is_active', 'd', ' '); $t->set_column('title', 'l', getString('title')); $t->set_column('pages', 'r'); $result = db_table('SELECT m.id, m.title' . langExt() . ' title, m.is_active, (SELECT COUNT(*) FROM pages p WHERE p.modulette_id = m.id) pages FROM modulettes m ORDER BY m.title' . langExt()); foreach ($result as &$r) { $r['is_active'] = draw_form_checkbox('is_active', $r['is_active'], false, 'ajax_set(\'modulettes\', \'is_active\', ' . $r['id'] . ', ' . abs($r['is_active'] - 1) . ');'); $r['title'] = draw_link('modulettes.php?id=' . $r['id'], $r['title']); $r['pages'] = draw_link('pages.php?modulette_id=' . $r['id'], format_quantitize($r['pages'], 'page')); } echo $t->draw($result, 'No modulettes'); } echo drawBottom();
//$r["title"] = str_replace("The Associated Press: ", "", $r["title"]); } elseif ($url["domainname"] == "google" && $url["subfolder"] == "afp") { $r["publication"] = "AFP"; $r["title"] = str_replace("Afp: ", "", $r["title"]); } elseif ($url["domainname"] == "google" && $url["subfolder"] == "ap") { $r["publication"] = "AP"; $r["title"] = str_replace("The Associated Press: ", "", $r["title"]); } } } //to control return_to redirects. i'm not sure how i should handle this generally. it's a problem mainly when the page is included if ($referrer && $referrer["host"] == $request["host"]) { $_josh["referrer"] = false; } $f = new form('press_clips', @$_GET['id'], $action); if (!$included) { $f->set_title_prefix($page['breadcrumbs']); } $f->set_field(array('name' => 'title' . langExt(), 'type' => 'text', 'label' => getString('title'))); $f->set_field(array('name' => 'url', 'type' => 'text', 'label' => getString('url'))); $f->set_field(array('name' => 'publication' . langExtT(), 'type' => 'text', 'label' => getString('publication'))); $f->set_field(array('name' => 'pub_date', 'type' => 'date', 'label' => getString('published'), 'required' => true)); $f->set_field(array('name' => 'description' . langExt(), 'type' => 'textarea', 'label' => getString('description'), 'class' => 'tinymce')); $f->set_field(array('name' => 'type_id', 'label' => getString('category'), 'type' => 'select', 'sql' => 'SELECT id, title' . langExt() . ' title FROM press_clips_types ORDER BY precedence', 'required' => true)); formAddChannels($f, 'press_clips', 'clip_id'); langUnsetFields($f, 'title,description,publication'); langTranslateCheckbox($f, url_id()); echo $f->draw(@$r, !$included); if (!$included) { echo drawBottom(); }
<?php include 'include.php'; echo drawTop(); if (url_id()) { //get a particular topic $title = db_grab('SELECT title' . langExt() . ' title FROM bb_topics_types WHERE id = ' . $_GET['id']); $where = ' AND t.type_id = ' . $_GET['id']; } else { $title = 'Uncategorised Topics'; $where = ' AND t.type_id IS NULL'; } echo bbDrawTable(false, $where, $title); echo drawBottom();
db_delete('organizations', $_GET['delete_id']); url_drop('delete_id,action'); } echo drawTop(); if (url_id()) { //form $f = new form('organizations', @$_GET['id']); $f->set_field(array('type' => 'text', 'name' => 'title' . langExt(), 'label' => getString('title'))); langUnsetFields($f, 'title'); langTranslateCheckbox($f); echo $f->draw(); } else { //modules list $t = new table('organizations', drawHeader()); $t->set_column('draggy', 'd', ' '); $t->set_column('title', 'l', getString('title')); $t->set_column('delete', 'd', ' '); $result = db_table('SELECT id, title' . langExt() . ' title FROM organizations WHERE is_active = 1 ORDER BY precedence'); foreach ($result as &$r) { $r['draggy'] = draw_img('/images/icons/move.png'); $r['title'] = draw_link('organizations.php?id=' . $r['id'], $r['title']); $r['delete'] = drawColumnDelete($r['id']); } echo $t->draw($result, 'No organizations'); //add new $f = new form('organizations'); $f->set_field(array('type' => 'text', 'name' => 'title' . langExt(), 'label' => getString('title'))); langUnsetFields($f, 'title'); echo $f->draw(false, false); } echo drawBottom();
<?php $orgs = db_table('SELECT id, title' . langExt() . ' title FROM external_orgs_types ORDER BY title'); foreach ($orgs as &$o) { $o = draw_link('/' . $m["folder"] . '/type.php?id=' . $o["id"], format_string($o["title"], 21)); } $return .= draw_table_rows($orgs);