/** * Connects to database * * @param array $db_info */ public function __construct($db_info = null) { // Database config can be overwritten on construction. if (!is_null($db_info) && is_array($db_info)) { foreach ($db_info as $k => $v) { if (inarray($k, array('db_host', 'db_user', 'db_pass', 'db_base'))) { $this->{$k} = $v; } } } try { $this->dbh = new PDO(sprintf('mysql:host=%s;dbname=%s', $this->db_host, $this->db_base), $this->db_user, $this->db_pass); $this->dbh->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); } catch (PDOException $e) { echo $e->getMessage(); } }
message_die(GENERAL_ERROR, "Couldn't obtain guest user/online information.", "", __LINE__, __FILE__, $sql); } $onlinerow_guest = $db->sql_fetchrowset($result); $sql = "SELECT forum_name, forum_id\n\t\tFROM " . FORUMS_TABLE; if ($forums_result = $db->sql_query($sql)) { while ($forumsrow = $db->sql_fetchrow($forums_result)) { $forum_data[$forumsrow['forum_id']] = $forumsrow['forum_name']; } } else { message_die(GENERAL_ERROR, "Couldn't obtain user/online forums information.", "", __LINE__, __FILE__, $sql); } $reg_userid_ary = array(); if (count($onlinerow_reg)) { $registered_users = 0; for ($i = 0; $i < count($onlinerow_reg); $i++) { if (!inarray($onlinerow_reg[$i]['user_id'], $reg_userid_ary)) { $reg_userid_ary[] = $onlinerow_reg[$i]['user_id']; $username = $onlinerow_reg[$i]['username']; if ($onlinerow_reg[$i]['user_allow_viewonline'] || $userdata['user_level'] == ADMIN) { $registered_users++; $hidden = FALSE; } else { $hidden_users++; $hidden = TRUE; } if ($onlinerow_reg[$i]['user_session_page'] < 1) { switch ($onlinerow_reg[$i]['user_session_page']) { case PAGE_INDEX: $location = $lang['Forum_index']; $location_url = "index.{$phpEx}?pane=right"; break;
} $url = URL::to('videos/' . $cd . '/' . $entry); $vid = false; $type = 'insert_drive_file'; //$ext = explode('.',$entry); if (inarray($entry, $video)) { $type = 'play_arrow'; $vid = true; } else { if (inarray($entry, $images)) { $type = 'image'; } else { if (inarray($entry, $pdfs)) { $type = 'picture_as_pdf'; } else { if (inarray($entry, $subs)) { $type = 'subtitles'; } } } } if ($vid) { $con = '<a id="caca" href="' . $url_target . '"><span class="title">' . $entry . '</span> </a><p>' . $file_size . '</p>'; } else { $con = '<span id="caca2" class="title">' . $entry . '</span> <p>' . $file_size . '</p>'; } $text = '<li class="ellipsis collection-item avatar"> <i class="material-icons circle red">' . $type . '</i>' . $con . '<a download href="' . $url . '" class="secondary-content"><i class="material-icons">file_download</i></a> </li>';
function sidebar($o) { if ($o['disable_in_mms'] !== false) { if ($_GET['mms'] == 'X') { return array(); } } //set a few variables I'll use to 0 or blank or their default correct size global $sidebar_left; global $sidebar_right; $left_pull = ''; $main_push = ''; $main_size = 12; $eh_class = ''; $eh_group = ''; //Set up Equal Heights if need be $accepted_ehl_types = array('interger', 'double'); if ($equal_height != '') { if ($o['equal_height_group'] == '') { $error .= 'Please give the sidebar function an equal height group, or disable equal height.<br />'; } //Make sure EHL is a number. If it is, set it. If not, set it to 990px if (gettype(!inarray(gettype($o['equal_height_limit'])), $accepted_ehl_types)) { $equal_height = '990'; } else { $equal_height = $o['equal_height_limit']; } $equal_height_class = ' equal-height '; $equal_height_group = ' data-group="' . $equal_height_group . '" data-to="' . $equal_height . '" '; } //set sizes of sidebars back to zero if the sidebar does not exist for the current page, then set main size if ($sidebar_left == '0') { $left_size = 0; } if ($sidebar_right == '0') { $right_size = 0; } //Check for default sidebar. If one exists and the left/right counterpart is blank, set the left/right data to point to the default sidebar //echo '<!-- oLS: '.$o['left_sidebar'].' | SL: '.$sidebar_left.' | oDSL: '.$o['default_sidebar_left'].' | oDSLS: '.$o['default_sidebar_left_source'].' -->'; if ($o['left_sidebar'] == true && ($sidebar_left == '0' || $sidebar_right == '') && $o['default_sidebar_left'] == true) { $sidebar_left = $o['default_sidebar_left_source']; //echo '<!-- here! -->'; } if ($o['right_sidebar'] == true && ($sidebar_right == '0' || $sidebar_right == '') && $o['default_sidebar_right'] == true) { $sidebar_right = $o['default_sidebar_right_source']; } //Check for pixel/percentage size vs column size, set main_size based on columns or percentages, create sidebar if ($o['left_sidebar'] == true && $sidebar_left != '0') { if (strlen($o['left_sidebar_columns']) > 0) { $left_size_c = 'col-md-' . $o['left_sidebar_columns']; $main_size = 12; } elseif (strlen($o['left_sidebar_size']) > 0) { $left_size_p = $o['left_sidebar_percent']; $left_size_c = ''; $main_size = 100; } else { $error .= "Please set a size for the left sidebar.<br />"; } $SBL = file_get_contents($sidebar_left); echo '<!-- SBL: ' . $sidebar_left . ' oSBL: ' . $o['default_sidebar_left_source'] . ' -->'; $sb_left = '<div id="sidebar-left" ' . $left_size_p . ' class="' . $left_size_c . ' ' . $left_pull . ' ' . $equal_height_class . ' ' . $o['left_adtl_classes'] . ' user" ' . $eh_group . '>' . $SBL . '</div>'; } if ($o['right_sidebar'] == true && $sidebar_right != '0') { if (strlen($o['right_sidebar_columns']) > 0) { $right_size_c = 'col-md-' . $o['right_sidebar_columns']; $main_size = 12; } elseif (strlen($o['left_sidebar_size']) > 0) { $right_size_p = $o['left_sidebar_percent']; $right_size_c = ''; $main_size = 100; } else { $error .= "Please set a width for the right sidebar.<br />"; } $SBR = file_get_contents($sidebar_right); echo '<!-- SBR: ' . $sidebar_right . ' oSBR: ' . $o['default_sidebar_right_source'] . ' -->'; $sb_right = '<div id="sidebar-right" ' . $right_size_p . ' class="' . $right_size_c . ' ' . $right_pull . ' ' . $equal_height_class . ' ' . $o['right_adtl_classes'] . ' user" ' . $eh_group . '>' . $SBR . '</div>'; } echo '<!-- here -->'; //Do the math and set the main size $main_size = $main_size - $left_size - $right_size; if ($o['left_sidebar_columns'] != '' || $o['right_sidebar_columns'] != '') { $main_size_c = 'col-md-' . $main_size; $main_size_p = ''; } else { $main_size_c = ''; $main_size_p = ' width="' . $main_size . '%" '; } //create Main div with push and correct size if need be $main_div = '<div ' . $main_size_p . ' class="' . $main_size_c . ' main-col ' . $main_push . ' ' . $eh_class . '" ' . $eh_group . ' >'; //set the return and return it $return = array('left' => $sb_left, 'right' => $sb_right, 'main_size' => $main_size, 'left_size' => $left_size, 'right_size' => $right_size, 'main' => $main_div); if ($error == '') { return $return; } else { echo $error; } }
$changes[] = " ADD {$field} " . $create_def[$table][$field]; } else { $changes[] = " CHANGE {$oldfield} {$field} " . $create_def[$table][$field]; } } $alter_sql .= join(',', $changes); unset($changes); unset($current_fields); $sql = "SHOW INDEX \n\t\t\t\t\tFROM {$table}"; $result = query($sql, "Couldn't get list of indices for table {$table}"); unset($indices); while ($row = $db->sql_fetchrow($result)) { $indices[] = $row['Key_name']; } while (list($key_name, $key_field) = each($key_def[$table])) { if (!inarray($key_name, $indices)) { $alter_sql .= $key_name == 'PRIMARY' ? ", ADD PRIMARY KEY ({$key_field})" : ", ADD INDEX {$key_name} ({$key_field})"; } } query($alter_sql, "Couldn't alter table {$table}"); print "<span class=\"ok\"><b>OK</b></span><br />\n"; flush(); } end_step('convert_forums'); case 'convert_forums': $sql = "SELECT * \n\t\t\t\tFROM " . FORUMS_TABLE; $result = query($sql, "Couldn't get list with all forums"); while ($row = $db->sql_fetchrow($result)) { print " * Converting forum '" . $row['forum_name'] . "' :: "; flush(); // forum_access: (only concerns posting)
<?php session_start(); ob_start(); if (!isset($_SESSION["user_id"])) { header("Location:/login/"); } if (!isset($_GET["edit"])) { if (!inarray($_GET["edit"], array("profile", "payment"))) { header("Location:/user/info"); } } require_once "../../inc/config.php"; require_once ROOT_PATH . "inc/database.php"; $user = getUser($_SESSION["user_id"]); if ($_SERVER["REQUEST_METHOD"] == "POST") { if (password_verify($_POST["old_password"], $user["password"])) { // process the form if ($_GET["edit"] == "profile") { // process the profile information update if (empty($_POST["new_password"])) { $password = false; } else { $password = password_hash($_POST["new_password"], PASSWORD_DEFAULT); } $update = updateUser($user["user_id"], $_POST["fname"], $_POST["lname"], $_POST["email"], $_POST["add1"], $_POST["add2"], $_POST["city"], $_POST["state"], $_POST["zip"], $password); if ($update) { $_SESSION["profile-updated"] = true; } header("Location:/user/info/"); } elseif ($_GET["edit"] == "payment") {
<?php $xml = domxml_open_file("../xml/keywords.xml"); $root = $xml->root(); $keywordList = split(",", "XML, HTML"); print_r($keywordList); if (count($keywordList) > 0) { foreach ($keywordList as $kw) { $node_array = $root->get_elements_by_tagname("keyword"); for ($i = 0; $i < count($node_array); $i++) { $node = $node_array[$i]; if (inarray($node->get_attribute("term"), $keywordList)) { } } } } function extractText($array) { if (count($array) <= 1) { //we only have one tag to process! for ($i = 0; $i < count($array); $i++) { $node = $array[$i]; $value = $node->get_content(); } return $value; } }