} $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(); } } } CacheEngine::CachePages(); redirect($base_config['baseurl'] . '/admin/interface/pages'); } else { echo '<p>Your password was incorrect. Hit the back button to try again.</p>'; return; } } else {
public function createNewOrder($storeName) { $insertor = new DBInsert('localhost', 'root', '', 'mydb'); $orderID = $insertor->insertNewOrder($this->getUsername(), $storeName); return $orderID; }
$q = new DBInsert('forums', $fields, 'Failed to insert forum'); $q->commit(); } echo '<p>Forums completed!</p>'; header('Refresh: 2; url=' . $base_config['baseurl'] . '/mass_import?import&part=categories'); break; case 'categories': $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();
public function addOrderItemToOrder(OrderItem $orderItem) { $insertor = new DBInsert('localhost', 'root', '', 'mydb'); $insertor->insertNewOrderItem($this->orderID, $this->storeName, $orderItem->getItemName(), $orderItem->getQuantity(), $orderItem->getPrice()); }
$changes = array(); if ($newkey != $old_lang['langkey']) { $changes['langkey'] = $newkey; } if ($newval != $old_lang['value']) { $changes['value'] = $newval; } if ($newcategory != $old_lang['category']) { $changes['category'] = $newcategory; } if (!empty($changes)) { $oldval = array(); foreach ($old_lang as $db_key => $db_val) { $oldval[] = $db_key . '=>' . $db_val; } $q2 = new DBInsert('interface_history', array('action' => 'edit', 'area' => 'language', 'field' => $id, 'user' => $futurebb_user['id'], 'time' => time(), 'old_value' => implode("\n", $oldval)), 'Failed to insert history entry'); $q2->commit(); $q2 = new DBUpdate('language', $changes, 'id=' . $id, 'Failed to update language'); $q2->commit(); } } //clear the cache CacheEngine::CacheLanguage(); redirect($base_config['baseurl'] . '/admin/interface/language'); return; } else { echo '<p>Your password was incorrect. Hit the back button to try again.</p>'; return; } } if (isset($_GET['delete'])) {
set_config('admin_pages', 'PT5pbmRleApiYW5zPT5iYW5zCnJlcG9ydHM9PnJlcG9ydHMKY2Vuc29yaW5nPT5jZW5zb3JpbmcKZm9ydW1zPT5mb3J1bXMKaXBfdHJhY2tlcj0+aXB0cmFja2VyCnVzZXJfZ3JvdXBzPT51c2VyZ3JvdXBzCnRyYXNoX2Jpbj0+dHJhc2hiaW4KbWFpbnRlbmFuY2U9Pm1haW50ZW5hbmNlCnN0eWxlPT5zdHlsZQpleHRlbnNpb25zPT5leHRlbnNpb25zCmludGVyZmFjZT0+aW50ZXJmYWNl'); set_config('mod_pages', 'YmFucz0+YmFucwpyZXBvcnRzPT5yZXBvcnRzCnRyYXNoX2Jpbj0+dHJhc2hiaW4KaXBfdHJhY2tlcj0+aXB0cmFja2Vy'); set_config('date_format', 'd M Y'); set_config('time_format', 'H:i'); //create guest user $insert = new DBInsert('users', array('username' => 'Guest', 'password' => 'Guest', 'email' => '', 'registered' => 0, 'registration_ip' => '', 'group_id' => 0, 'last_visit' => 0, 'last_page_load' => 0, 'signature' => ''), 'Failed to create admin user'); $insert->commit(); //create admin user $insert = new DBInsert('users', array('username' => get_cookie_data('adminusername'), 'password' => futurebb_hash(get_cookie_data('adminpass')), 'email' => get_cookie_data('adminemail'), 'registered' => time(), 'registration_ip' => $_SERVER['REMOTE_ADDR'], 'group_id' => 1, 'last_visit' => time(), 'last_page_load' => time(), 'rss_token' => md5(time())), 'Failed to create admin user'); $insert->commit(); //create user groups $insert = new DBInsert('user_groups', array('g_permanent' => 1, 'g_guest_group' => 0, 'g_name' => 'Administrators', 'g_title' => 'Administrator', 'g_admin_privs' => 1, 'g_mod_privs' => 1, 'g_edit_posts' => 1, 'g_delete_posts' => 1, 'g_signature' => 1, 'g_user_list' => 1, 'g_user_list_groups' => '', 'g_promote_group' => 0, 'g_promote_posts' => 0, 'g_promote_operator' => 0, 'g_promote_days' => 0, 'g_post_flood' => 0, 'g_posts_per_hour' => 0, 'g_post_links' => 1, 'g_post_images' => 1), 'Failed to create admin user group'); $insert->commit(); $insert = new DBInsert('user_groups', array('g_permanent' => 1, 'g_guest_group' => 1, 'g_name' => 'Guests', 'g_title' => 'Guest', 'g_admin_privs' => 0, 'g_mod_privs' => 0, 'g_edit_posts' => 0, 'g_delete_posts' => 0, 'g_signature' => 0, 'g_user_list' => 0, 'g_user_list_groups' => '', 'g_promote_group' => 0, 'g_promote_posts' => 0, 'g_promote_operator' => 0, 'g_promote_days' => 0, 'g_post_flood' => 0, 'g_posts_per_hour' => 0, 'g_post_links' => 0, 'g_post_images' => 0), 'Failed to create guest user group'); $insert->commit(); $insert = new DBInsert('user_groups', array('g_permanent' => 1, 'g_guest_group' => 0, 'g_name' => 'Members', 'g_title' => 'Member', 'g_admin_privs' => 0, 'g_mod_privs' => 0, 'g_edit_posts' => 1, 'g_delete_posts' => 1, 'g_signature' => 1, 'g_user_list' => 1, 'g_user_list_groups' => '', 'g_promote_group' => 0, 'g_promote_posts' => 0, 'g_promote_operator' => 0, 'g_promote_days' => 0, 'g_post_flood' => 60, 'g_posts_per_hour' => 0, 'g_post_links' => 1, 'g_post_images' => 1), 'Failed to create member user group'); $insert->commit(); //run through stock cache to insert pages and language keys include FORUM_ROOT . '/app_config/cache/pages.php'; $q = 'INSERT INTO `#^pages`(url,file,template,nocontentbox,admin,moderator,subdirs) VALUES'; $page_insert_data = array(); foreach ($pages as $url => $info) { $page_insert_data[] = '(\'' . $db->escape($url) . '\',\'' . $db->escape($info['file']) . '\',' . ($info['template'] ? '1' : '0') . ',' . (isset($info['nocontentbox']) ? '1' : '0') . ',' . ($info['admin'] ? '1' : '0') . ',' . ($info['mod'] ? '1' : '0') . ',0)'; } foreach ($pagessubdirs as $url => $info) { $page_insert_data[] = '(\'' . $db->escape($url) . '\',\'' . $db->escape($info['file']) . '\',' . ($info['template'] ? '1' : '0') . ',' . (isset($info['nocontentbox']) ? '1' : '0') . ',' . ($info['admin'] ? '1' : '0') . ',' . ($info['mod'] ? '1' : '0') . ',1)'; } $q = new DBMassInsert('pages', array('url', 'file', 'template', 'nocontentbox', 'admin', 'moderator', 'subdirs'), $page_insert_data, 'Failed to insert pages'); $q->commit(); unset($page_insert_data); unset($pages);
static function add_language_key($key, $text, $language = 'English', $category = 'main') { $q = new DBInsert('language', array('language' => $language, 'langkey' => $key, 'value' => $text, 'category' => $category), 'Failed to insert language key'); $q->commit(); //clear the cache $maindir = FORUM_ROOT . '/app_config/cache/language/' . $language; if (file_exists($maindir) && is_dir($maindir)) { $handle = opendir($maindir); while ($file = readdir($handle)) { if ($file != '.' && $file != '..') { unlink($maindir . '/' . $file); } } } }
</head> <body> <?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()); // 新規アルバム名の場合はディレクトリを作成