public function removeItemFromOrder($itemName) { $selector = new DBSelect('localhost', 'root', '', 'mydb'); $storeID = $selector->selectStoreIDByStoreName($this->storeName); $itemID = $selector->selectItemIDByItemName($itemName); $selector = null; $dropper = new DBDrop('localhost', 'root', '', 'mydb'); $dropper->dropFromOrderItems($this->orderID, $storeID, $itemID); }
public function getItemNamesByCategory($categoryName) { $selector = new DBSelect('localhost', 'root', '', 'mydb'); $result = $selector->selectItemNamesByCategory($categoryName); $selector = null; $names = array(); foreach ($result as $row) { foreach ($row as $column) { array_push($names, $column); } } return $names; }
function cache_pages() { global $db; $q = new DBSelect('pages', array('*'), '', 'Failed to get pages'); $result = $q->commit(); $pages = array(); $pagessubdirs = array(); while ($cur_page = $db->fetch_assoc($result)) { $page = array('file' => $cur_page['file'], 'template' => $cur_page['template'] ? true : false, 'admin' => $cur_page['admin'] ? true : false, 'mod' => $cur_page['moderator'] ? true : false); if (isset($cur_page['nocontentbox']) && $cur_page['nocontentbox']) { $page['nocontentbox'] = $cur_page['nocontentbox'] ? true : false; } if ($cur_page['subdirs']) { $pagessubdirs[$cur_page['url']] = $page; } else { $pages[$cur_page['url']] = $page; } } file_put_contents(FORUM_ROOT . '/app_config/cache/pages.php', '<?php' . "\n" . '$pages = ' . var_export($pages, true) . ';' . "\n" . '$pagessubdirs = ' . var_export($pagessubdirs, true) . ';'); }
function cache_language() { global $db, $base_config; $q = new DBSelect('language', array('*'), '', 'Failed to get language entries'); $result = $q->commit(); $lang = array(); while ($lang_entry = $db->fetch_assoc($result)) { if (!isset($lang[$lang_entry['language']])) { $lang[$lang_entry['language']] = array(); } if (!isset($lang[$lang_entry['language']][$lang_entry['category']])) { $lang[$lang_entry['language']][$lang_entry['category']] = array(); } $lang[$lang_entry['language']][$lang_entry['category']][$lang_entry['langkey']] = $lang_entry['value']; } foreach ($lang as $language => $categories) { if (!file_exists(FORUM_ROOT . '/app_config/cache/language')) { mkdir(FORUM_ROOT . '/app_config/cache/language'); } if (!file_exists(FORUM_ROOT . '/app_config/cache/language/' . $language)) { mkdir(FORUM_ROOT . '/app_config/cache/language/' . $language); } foreach ($categories as $category => $lang_entries) { $lang_subset = array(); foreach ($lang_entries as $key => $val) { $lang_subset[$key] = str_replace('$baseurl$', $base_config['baseurl'], $val); } $out = '<?php' . "\n"; if ($category == 'main') { $out .= '$lang = '; } else { $out .= '$lang_addl = '; } $out .= var_export($lang_subset, true) . ';'; file_put_contents(FORUM_ROOT . '/app_config/cache/language/' . $language . '/' . $category . '.php', $out); } } }
<channel> <title><$title></title> <description><$description></description> <link>' . $base_config['baseurl'] . '/messages</link> <generator>FutureBB</generator>'; if (!isset($dirs[2])) { httperror(404); } $q = new DBSelect('users', array('username', 'id'), 'rss_token=\'' . $db->escape($dirs[2]) . '\'', 'Failed to find users'); $result = $q->commit(); if (!$db->num_rows($result)) { httperror(404); } list($username, $id) = $db->fetch_row($result); $q = new DBSelect('notifications', array('type', 'send_time', 'contents', 'arguments'), 'user='******'Failed to get notification list'); $q->set_order('send_time DESC'); $q->set_limit('20'); $result = $q->commit(); $title = translate('notifsfor', $username); while ($notif = $db->fetch_assoc($result)) { switch ($notif['type']) { case 'warning': $type = 'Warning'; break; case 'msg': $type = 'Message'; break; case 'notification': $type = 'Notification'; break;
" /> <input type="submit" name="delete" value="Yes" /> <a href="<?php echo $base_config['baseurl']; ?> /admin/interface/pages">No</a></p> </form> <?php return; } $q = new DBSelect('pages', array('*'), '', 'Failed to get page list'); $result = $q->commit(); if (isset($_POST['form_sent_b'])) { if (futurebb_hash($_POST['confirmpwd']) == $futurebb_user['password']) { foreach ($_POST as $key => $val) { if (ctype_digit((string) $key)) { //insert history entry $select = new DBSelect('pages', array('*'), 'id=' . intval($key), 'Failed to get old value'); $result = $select->commit(); $element = $db->fetch_assoc($result); $lines = array(); foreach ($element as $db_key => $db_val) { $lines[] = $db_key . '=>' . $db_val; } $insertquery = new DBInsert('interface_history', array('action' => 'edit', 'area' => 'pages', 'field' => intval($key), 'user' => $futurebb_user['id'], 'time' => time(), 'old_value' => base64_encode(implode("\n", $lines))), 'Failed to insert history entry'); $insertquery->commit(); foreach ($val as $field => $field_value) { //update the field $updatequery = new DBUpdate('pages', array($field => $field_value), 'id=' . intval($key), 'Failed to update page entry'); $updatequery->commit(); } } }
$q = new DBDelete('categories', '1=1', 'Failed to delete all existing categories'); $q->commit(); $cats_xml = $xml->categories; foreach ($cats_xml->category as $val) { $fields = array(); foreach ($val as $field => $data) { $fields[(string) $field] = (string) $data; } $q = new DBInsert('categories', $fields, 'Failed to insert category'); $q->commit(); } echo '<p>Categories completed!</p>'; header('Refresh: 2; url=' . $base_config['baseurl'] . '/mass_import?import&part=createforumurls'); break; case 'createforumurls': $q = new DBSelect('forums', array('id', 'name'), '1=1', 'Failed to get forum list'); $r1 = $q->commit(); while (list($id, $fname) = $db->fetch_row($r1)) { $base_name = URLEngine::make_friendly($fname); $name = $base_name; $add_num = 0; //check for forums with the same URL $result = $db->query('SELECT url FROM `#^forums` WHERE url LIKE \'' . $db->escape($name) . '%\'') or error('Failed to check for similar URLs', __FILE__, __LINE__, $db->error()); $urllist = array(); while (list($url) = $db->fetch_row($result)) { $urllist[] = $url; } $ok = false; $add_num = 0; while (!$ok) { $ok = true;
public static function addNewUser($username, $firstName, $lastName, $email, $password) { $selector = new DBSelect('localhost', 'root', '', 'mydb'); $result = $selector->hasUserUsername($username); if ($result) { $selector = null; return false; } else { $selector = null; $insertor = new DBInsert('localhost', 'root', '', 'mydb'); $insertor->insertNewUser($username, $firstName, $lastName, $email, $password); $insertor = null; return true; } }
case 'registered': $order = 'u.registered'; break; default: $order = 'u.username'; break; } if (isset($_GET['order']) && $_GET['order'] == 'desc') { $order .= ' DESC'; } else { $order .= ' ASC'; } } else { $order = 'u.username ASC'; } $q = new DBSelect('users', array('u.username', 'u.num_posts', 'u.registered', 'g.g_title AS title'), ' u.id>0 AND u.username<>\'Guest\' ' . $sql . ($visible_groups == '' ? '' : ' AND u.group_id IN(' . $visible_groups . ')') . ' AND u.deleted=0', 'Failed to get users'); $q->table_as('u'); $join = new DBLeftJoin('user_groups', 'g', 'g.g_id=u.group_id'); $q->add_join($join); $q->set_limit(($page - 1) * $per_page . ',' . $per_page); $q->set_order($order); $result = $q->commit(); unset($q); while ($cur_user = $db->fetch_assoc($result)) { echo '<tr> <td><a href="' . $base_config['baseurl'] . '/users/' . rawurlencode(htmlspecialchars($cur_user['username'])) . '">' . htmlspecialchars($cur_user['username']) . '</a></td> <td>' . htmlspecialchars($cur_user['title']) . '</td> <td>' . $cur_user['num_posts'] . '</td> <td>' . user_date($cur_user['registered']) . '</td> </tr>'; }
<?php } else { ?> <p><?php echo translate('nofileuploads'); ?> </p> <?php } ?> <h3><?php echo translate('existingexts'); ?> </h3> <?php $q = new DBSelect('extensions', array('id', 'name', 'website', 'support_url', 'uninstallable'), '1', 'Failed to get installed extensions'); $result = $q->commit(); if (!$db->num_rows($result)) { echo '<p>' . translate('noexts') . '</p>'; } else { ?> <table border="0"> <tr> <th><?php echo translate('name'); ?> </th> <th><?php echo translate('website'); ?> </th>
<?php $page_title = 'Interface Editing History'; $breadcrumbs = array(translate('administration') => 'admin', translate('interface') => 'admin/interface', 'History' => 'admin/interface/history'); $page_list = array(); $q = new DBSelect('pages', array('*'), '', 'Failed to get page list'); $result = $q->commit(); while ($page = $db->fetch_assoc($result)) { $page_list[$page['id']] = $page; } $q = new DBSelect('interface_history', array('h.*', 'u.username'), 'time>' . (time() - 60 * 60 * 24 * 60), 'Failed to retrieve history entries'); $q->set_order('time DESC'); $q->table_as('h'); $q->add_join(new DBJoin('users', 'u', 'u.id=h.user', 'LEFT')); $result = $q->commit(); $page_edits = array(); $field_edits = array(); $lang_edits = array(); $lang_ids = array(); while ($entry = $db->fetch_assoc($result)) { if ($entry['area'] == 'pages') { if (!isset($page_edits[$entry['field']])) { $page_edits[$entry['field']] = array(); } $page_edits[$entry['field']][] = array('time' => $entry['time'], 'old_value' => base64_decode($entry['old_value']), 'username' => $entry['username'], 'action' => $entry['action']); } else { if ($entry['area'] == 'interface') { if (!isset($field_edits[$entry['field']])) { $field_edits[$entry['field']] = array(); } $field_edits[$entry['field']][] = array('time' => $entry['time'], 'old_value' => $entry['old_value'], 'username' => $entry['username'], 'action' => $entry['action']);
</tr> <tr> <th>Content</th> <td><textarea name="content" rows="4" cols="50"></textarea></td> </tr> <tr> <th>Category</th> <td><input type="text" name="category" value="main" /></td> </tr> </table> <p><input type="submit" name="add_new" value="Add" /></p> </form> <?php return; } $q = new DBSelect('language', array('id', 'langkey', 'value', 'category'), 'language=\'' . $db->escape($_GET['language']) . '\' AND category=\'' . $db->escape($_GET['category']) . '\'', 'Failed to get language keys'); $q->set_order('langkey ASC'); $result = $q->commit(); $last_category = ''; ?> <form action="<?php echo $base_config['baseurl']; ?> /admin/interface/language" method="post" enctype="multipart/form-data"> <table border="0"> <tr> <th>Key</th> <th>Value</th> <th>Category</th> <th>Delete</th> </tr>
$q->add_join(new DBJoin('forums', 'rf', 'rf.id=f.redirect_id', 'LEFT')); $q->table_as('f'); $result = $q->commit(); if (!$db->num_rows($result)) { httperror(404); } $forum_info = $db->fetch_assoc($result); if (!strstr($forum_info['view_groups'], '-' . $futurebb_user['group_id'] . '-')) { //don't try to get smart and view forums without permission httperror(403); } if ($forum_info['redirect_url'] != null) { redirect($base_config['baseurl'] . '/rss/forum/' . $forum_info['redirect_url']); } $title = $forum_info['name'] . ' - ' . $futurebb_config['board_title']; $q = new DBSelect('posts', array('p.id', 'p.parsed_content', 'u.username AS poster', 't.subject', 'p.posted'), 't.forum_id=' . $forum_info['id'], 'Failed to get posts'); $q->add_join(new DBJoin('topics', 't', 't.id=p.topic_id', 'LEFT')); $q->add_join(new DBJoin('users', 'u', 'u.id=p.poster', 'LEFT')); $q->table_as('p'); $q->set_order('p.posted DESC'); $q->set_limit('20'); $result = $q->commit(); if (!$db->num_rows($result)) { httperror(404); } while ($post = $db->fetch_assoc($result)) { $output .= "\n\t" . '<item>' . "\n\t\t" . '<title><![CDATA[' . htmlspecialchars($forum_info['name']) . ' / ' . htmlspecialchars($post['subject']) . ']]></title>'; $output .= "\n\t\t" . '<pubDate>' . gmdate('D, d M Y H:i:s', $post['posted']) . ' +0000</pubDate>'; $output .= "\n\t\t" . '<link>' . $base_config['baseurl'] . '/posts/' . $post['id'] . '</link>'; $output .= "\n\t\t" . '<guid>' . $base_config['baseurl'] . '/posts/' . $post['id'] . '</guid>'; $output .= "\n\t\t" . '<author><![CDATA[' . htmlspecialchars($post['poster']) . ']]></author>';
<div class="forum_content rightbox admin"> <form action="<?php echo $base_config['baseurl']; ?> /admin/forums/enhanced" method="post" enctype="multipart/form-data" id="theform"> <h3><?php echo translate('editforums'); ?> </h3> <p><a style="text-decoration: underline;cursor:pointer" onclick="addCat();"><?php echo translate('addcat'); ?> </a></p> <div id="cat_container"> <?php $q = new DBSelect('forums', array('c.name AS cat_name', 'c.sort_position AS cat_sort_position', 'f.id', 'c.id AS cat_id', 'f.sort_position', 'f.name AS forum_name'), 'c.id IS NOT NULL', 'Failed to get forum list'); $q->table_as('f'); $q->set_order('c.sort_position,f.sort_position'); $q->add_join(new DBJoin('categories', 'c', 'c.id=f.cat_id', 'right')); $result = $q->commit(); $last_cat_id = -1; $highest_sort_orders = array(); while ($forum = $db->fetch_assoc($result)) { if ($forum['cat_id'] != $last_cat_id) { if ($last_cat_id != -1) { echo '</table></div>'; } $last_cat_id = $forum['cat_id']; echo '<div id="cat_' . $forum['cat_id'] . '"><h4><input type="hidden" name="cat_sort_order[' . $forum['cat_id'] . ']" value="' . $forum['cat_sort_position'] . '" /><input type="text" name="cat_title[' . $forum['cat_id'] . ']" value="' . htmlspecialchars($forum['cat_name']) . '" oninput="unlockSubmit();" /> <a onclick="moveCat(' . $forum['cat_id'] . ',\'up\');" style="cursor:pointer">↑</a> <a onclick="moveCat(' . $forum['cat_id'] . ',\'down\');" style="cursor:pointer">↓</a> (<a onClick="addForum(' . $forum['cat_id'] . ');" style="cursor:pointer">✚ ' . translate('addforum') . '</a>) (<a onclick="prepareDeleteCat(' . $forum['cat_id'] . ');" style="cursor:pointer">❌</a>)</h4><hr /><table border="0" id="table_cat_' . $forum['cat_id'] . '"><tr><th>' . translate('forumname') . '</th><th>Move</th><th>' . translate('delete') . '</th><th>' . translate('edit') . '</th><th>' . translate('changecategory') . '</th><th>' . translate('cancel') . '</th></tr>' . "\n"; } if ($forum['id'] != '') {
<?php require_once './php/Common/DBConnect.php'; // DB接続用 require_once './php/Register/RegisterControl.php'; require_once './php/Register/RegisterModel.php'; echo '<br><br><br>'; // 変数定義 $InputName = new InputName(); // アルバム名設定クラス $DBCon = new DBCon(); // DB接続クラス $UpList = new UpList(); // POSTデータ格納クラス $DBInsert = new DBInsert(); // DB格納クラス $DBSelect = new DBSelect(); // DBデータ取得クラス $Done = null; // DB操作結果 // DB接続にエラーが発生している場合は、始めに知らせる。 if ($DBInsert->getError != null) { echo $DBInsert->getError(); require_once './php/Common/ExitCode.html'; exit; } // 新規または既存アルバム名を取得(Model→Control) $InputName->setInputName(htmlspecialchars($_POST['CreateName']), $_POST['AlbumList']); $UpList->setAlbumName($InputName->getInputName()); // 新規アルバム名の場合はディレクトリを作成 DirCheck($UpList->getFileDirPath(), $UpList->getAlbumName()); // DBにデータを登録
<link rel="stylesheet" href="./css/Album.css"> <link rel="icon" type="image/vnd.microsoft.icon" href="./BackDesign/AlbumUp.ico"> <script src="//code.jquery.com/jquery-1.11.3.min.js"></script> </head> <body> <?php require_once './php/Common/DBConnect.php'; // DB接続用 require_once './php/List/ListControl.php'; require_once './php/List/ListView.php'; require_once './php/List/ListModel.php'; $DBCon = new DBCon(); // DB接続クラス $View = new ViewData(); // HTML出力系クラス $DBSel = new DBSelect(); // Selectクラス $AlbumData = null; // 配列データ $i = 0; // カウンタ // DB接続エラーがあれば中断 if ($DBSel->getError() != null) { echo $DBSel->getError(); require_once './php/Common/ExitCode.html'; exit; } // ページのタイトル名を渡す。 $View->setTitle($_GET['AlbumName']); // 出力するデータを選定する。 $DBSel->setResult(SelectData($DBSel->getSetDB(), $DBSel->getSql(), $View->getTitle()));