/** * @return array */ public function load() { $request = new request(self::steam_matches_url, $this->_get_data_array()); $xml = $request->send(); if (is_null($xml)) { return null; } $matches = array(); if (isset($xml->matches)) { $this->_total_results = $xml->total_results; foreach ($xml->matches as $m_matches) { foreach ($m_matches as $m) { $match = new match(); $match->set_array((array) $m); foreach ($m->players as $players) { foreach ($players as $player) { $slot = new slot(); $slot->set_array((array) $player); $match->add_slot($slot); } } $matches[$match->get('match_id')] = $match; } } } return $matches; }
/** * Load match info by match_id */ public function load() { $request = new request(self::steam_match_url, array('match_id' => $this->get_match_id())); $match_info = $request->send(); if (is_null($match_info)) { return null; } $match = new match(); $players = array(); foreach ($match_info->players->player as $key => $player) { $players[] = $player; } $data = (array) $match_info; unset($data['players']); $data['start_time'] = date('Y-m-d H:i:s', $data['start_time']); $data['radiant_win'] = $data['radiant_win'] == 'true' ? '1' : '0'; $match->set_array($data); // slots info foreach ($players as $player) { $data = (array) $player; $data['match_id'] = $this->get_match_id(); $slot = new slot(); $slot->set_array($data); // additional_units if (isset($data['additional_units'])) { $slot->set_additional_unit_items((array) $data['additional_units']->unit); } // abilities if (isset($data['ability_upgrades'])) { $d = (array) $data['ability_upgrades']; $abilities_upgrade = $d['ability']; if (!is_array($abilities_upgrade)) { $abilities_upgrade = array($abilities_upgrade); } foreach ($abilities_upgrade as $k => $v) { $abilities_upgrade[$k] = (array) $abilities_upgrade[$k]; } $slot->set_abilities_upgrade($abilities_upgrade); } $match->add_slot($slot); } if (isset($match_info->picks_bans)) { $picks_bans = (array) $match_info->picks_bans; foreach ($picks_bans['pick_ban'] as $k => $v) { $picks_bans['pick_ban'][$k] = (array) $v; if ($picks_bans['pick_ban'][$k]['is_pick'] == 'false') { $picks_bans['pick_ban'][$k]['is_pick'] = '0'; } else { $picks_bans['pick_ban'][$k]['is_pick'] = '1'; } } $match->set_all_pick_bans($picks_bans['pick_ban']); } return $match; }
/** * @param int $match_id * @return match */ public function load($match_id = null) { if (!is_null($match_id)) { $this->set_match_id($match_id); } $db = db::obtain(); $query_for_match = 'SELECT * FROM ' . db::real_tablename('matches') . ' WHERE match_id=?'; $query_for_slots = 'SELECT * FROM ' . db::real_tablename('slots') . ' WHERE match_id=?'; $match_info = $db->query_first_pdo($query_for_match, array($this->get_match_id())); $match = new match(); if (!$match_info) { return $match; } $match->set_array($match_info); $slots = $db->fetch_array_pdo($query_for_slots, array($this->get_match_id())); $slot_ids = ''; foreach ($slots as $slot) { $slot_ids .= $slot['id'] . ','; } $query_for_ability_upgrades = 'SELECT * FROM ' . db::real_tablename('ability_upgrades') . ' WHERE slot_id IN (' . rtrim($slot_ids, ',') . ')'; $ability_upgrade = $db->fetch_array_pdo($query_for_ability_upgrades); $ability_upgrade_formatted = array(); foreach ($ability_upgrade as $a) { if (!isset($ability_upgrade_formatted[$a['slot_id']])) { $ability_upgrade_formatted[$a['slot_id']] = array(); } array_push($ability_upgrade_formatted[$a['slot_id']], $a); } $query_for_additional_units = 'SELECT * FROM ' . db::real_tablename('additional_units') . ' WHERE slot_id IN (' . rtrim($slot_ids, ',') . ')'; $additional_units = $db->fetch_array_pdo($query_for_additional_units); $additional_units_formatted = array(); foreach ($additional_units as $additional_unit) { if (!isset($additional_units_formatted[$additional_unit['slot_id']])) { $additional_units_formatted[$additional_unit['slot_id']] = array(); } array_push($additional_units_formatted[$additional_unit['slot_id']], $additional_unit); } foreach ($slots as $s) { $slot = new slot(); $slot->set_array($s); if (isset($ability_upgrade_formatted[$slot->get('id')])) { $slot->set_abilities_upgrade($ability_upgrade_formatted[$slot->get('id')]); } if (isset($additional_units_formatted[$slot->get('id')])) { $slot->set_additional_unit_items($additional_units_formatted[$slot->get('id')]); } $match->add_slot($slot); } if ($match->get('game_mode') == match::CAPTAINS_MODE) { $query_for_picks_bans = 'SELECT `is_pick`, `hero_id`, `team`, `order` FROM ' . db::real_tablename('picks_bans') . ' WHERE match_id = ? ORDER BY `order`'; $picks_bans = $db->fetch_array_pdo($query_for_picks_bans, array($match->get('match_id'))); $match->set_all_pick_bans($picks_bans); } return $match; }
/** * Load matches from db * * Possible filters: league_id, hero_id, account_id, start_at_match_id * Also matches_requested used as LIMIT * @return Match[] */ public function load() { $matchesInfo = $this->_getMatchesIdsFromMatches(); $matchesIds = array(); foreach ($matchesInfo as $matchInfo) { array_push($matchesIds, $matchInfo['match_id']); } if (count($matchesIds) === 0) { return array(); } $slotsInfo = $this->_loadSlotsInfo($matchesIds); $picksBansFormattedInfo = $this->_loadPicksBansInfo($matchesIds); $slotsIds = array(); foreach ($slotsInfo as $slotInfo) { array_push($slotsIds, $slotInfo['id']); } $abilitiesUpgradeFormattedInfo = $this->_loadAbilityUpgradesInfo($slotsIds); $additionalUnitsFormattedInfo = $this->_loadAdditionalUnitsInfo($slotsIds); // we load all matches info and now need to make proper match objects $matches = array(); foreach ($matchesInfo as $matchInfo) { $match = new Match(); $match->setArray($matchInfo); $slots_count = 0; foreach ($slotsInfo as $slotInfo) { if ($slots_count > 9) { // match can't has more than 10 slots break; } if ((int) $slotInfo['match_id'] === (int) $match->get('match_id')) { $slot = new slot(); $slot->setArray($slotInfo); if (array_key_exists($slot->get('id'), $abilitiesUpgradeFormattedInfo)) { $slot->setAbilitiesUpgrade($abilitiesUpgradeFormattedInfo[$slot->get('id')]); } if (array_key_exists($slot->get('id'), $additionalUnitsFormattedInfo)) { $slot->setAdditionalUnitItems($additionalUnitsFormattedInfo[$slot->get('id')]); } $match->addSlot($slot); $slots_count++; } } if (array_key_exists($match->get('match_id'), $picksBansFormattedInfo)) { $match->setAllPickBans($picksBansFormattedInfo[$match->get('match_id')]); } $matches[$match->get('match_id')] = $match; } return $matches; }
/** * Adds a site to the buffer. * * @param object site $site The site to add. * @param integer $indent The indent level of the object */ function addSite(&$site, $indent) { $tabs = $this->_getTabs($indent); $this->_buffer .= ' ' . $tabs . '<site'; $this->_buffer .= ' name="' . $site->getField('name') . '"'; $this->_buffer .= ' owner="' . slot::getOwner($site->getField('name')) . '"'; $this->_buffer .= ' title="' . addslashes($site->getField('title')) . '"'; $this->_buffer .= ' type="' . $site->getField('type') . '"'; $this->_buffer .= '>'; foreach ($site->sections as $key => $val) { if ($site->sections[$key]->getField('type') == 'link') { $this->addNavLink($site->sections[$key], $indent + 1); } if ($site->sections[$key]->getField('type') == 'heading') { $this->addHeading($site->sections[$key], $indent + 1); } if ($site->sections[$key]->getField('type') == 'divider') { $this->addDivider($site->sections[$key], $indent + 1); } else { $this->addSection($site->sections[$key], $indent + 1); } } $this->_buffer .= ' ' . $tabs . '</site> '; }
/** * Load matches from db * * Possible filters: league_id, hero_id, account_id, start_at_match_id * Also matches_requested used as LIMIT * @return array */ public function load() { $matches_info = $this->_get_matches_ids_from_matches(); $matches_ids = array(); foreach ($matches_info as $match_info) { array_push($matches_ids, $match_info['match_id']); } if (count($matches_ids) == 0) { return array(); } $slots_info = $this->_load_slots_info($matches_ids); $picks_bans_formatted_info = $this->_load_picks_bans_info($matches_ids); $slots_ids = array(); foreach ($slots_info as $slot_info) { array_push($slots_ids, $slot_info['id']); } $abilities_upgrade_formatted_info = $this->_load_ability_upgrades_info($slots_ids); $additional_units_formatted_info = $this->_load_additional_units_info($slots_ids); // we load all matches info and now need to make proper match objects $matches = array(); foreach ($matches_info as $match_info) { $match = new match(); $match->set_array($match_info); $slots_count = 0; foreach ($slots_info as $slot_info) { if ($slots_count > 9) { // match can't has more than 10 slots break; } if ($slot_info['match_id'] == $match->get('match_id')) { $slot = new slot(); $slot->set_array($slot_info); if (isset($abilities_upgrade_formatted_info[$slot->get('id')])) { $slot->set_abilities_upgrade($abilities_upgrade_formatted_info[$slot->get('id')]); } if (isset($additional_units_formatted_info[$slot->get('id')])) { $slot->set_additional_unit_items($additional_units_formatted_info[$slot->get('id')]); } $match->add_slot($slot); $slots_count++; } } if (isset($picks_bans_formatted_info[$match->get('match_id')])) { $match->set_all_pick_bans($picks_bans_formatted_info[$match->get('match_id')]); } $matches[$match->get('match_id')] = $match; } return $matches; }
break; } } } } //--------------------------- // check view permissions //--------------------------- if (!$thisPage || !$thisPage->canview("everyone")) { print "\t\t<title>Error</title>\n"; ob_start(); print "You may not view this RSS Feed. This may be due to any of the following reasons:<br />"; print "<ul>"; if ($thisSite->site_does_not_exist) { print "<li>This feed does not exist. "; if ($_SESSION[auser] == slot::getOwner($thisSite->name) || $allowpersonalsites && $_SESSION[atype] != 'visitor' && $thisSite->name == $_SESSION[auser]) { print "<br /><a href='{$PHP_SELF}?{$sid}&action=add_site&sitename=" . $thisSite->name . "'>Create Site</a>"; } print "</li>"; } else { if (!$thisPage) { print "<li>Requested page object doesn't exist.</li>"; } else { print "<li>The feed has not been made public by the owner.</li>"; } } print "</ul>"; $description = htmlspecialchars(ob_get_contents(), ENT_QUOTES); ob_end_clean(); print "\t\t<description>"; print $description;
break; } } if (!$nameGood) { $errorPrinter->doError(400, "Invalid user, '" . $_GET['user'] . "'. Did you mean one of the following? <div style='margin-left: 20px;'>" . implode(" <br/>", array_keys($usernames)) . "</div>"); } // Start the output header('Content-Type: text/xml'); print "<slotList>"; /********************************************************* * Fetch all of the info for all of the sites and slots * that the user is an editor or owner for, so we don't have * to get them again. *********************************************************/ // this should include all sites that the user owns as well. $userOwnedSlots = slot::getSlotInfoWhereUserOwner($_GET['user']); if (!array_key_exists($_GET['user'], $userOwnedSlots)) { $userOwnedSlots[$_GET['user']] = array(); $userOwnedSlots[$_GET['user']]['slot_name'] = $_GET['user']; $userOwnedSlots[$_GET['user']]['slot_type'] = 'personal'; $userOwnedSlots[$_GET['user']]['slot_owner'] = $_GET['user']; $userOwnedSlots[$_GET['user']]['site_exits'] = false; } // Add any user-owned groups that aren't already in the slot list $userOwnedGroups = group::getGroupsOwnedBy($_GET['user']); foreach ($userOwnedGroups as $classSiteName) { if (!isset($userOwnedSlots[$classSiteName])) { $userOwnedSlots[$classSiteName] = array(); $userOwnedSlots[$classSiteName]['slot_name'] = $classSiteName; $userOwnedSlots[$classSiteName]['slot_type'] = 'class'; $userOwnedSlots[$classSiteName]['slot_owner'] = $_GET['user'];
/** * Build an array of all of the sites and slots that the user * is either the owner of or an editor (has permission add, edit, and delete) of */ function allSitesSlots($user) { global $classes, $usersFutureClasses; $allsites = array(); // The user's personal site if ($user == slot::getOwner($user) || !slot::exists($user)) { $allsites[$user] = array(); $allsites[$user]['slot_name'] = $user; $allsites[$user]['slot_type'] = 'personal'; $allsites[$user]['owner_uname'] = $user; $allsites[$user]['site_exits'] = false; } // Add slots that the user is an owner of. // This will include all of the created sites as well $allsites = array_merge($allsites, $slots); // Add the sites that the user is a Site-Level Editor for. $allsites = array_merge($allsites, segue::getSiteInfoWhereUserIsSiteLevelEditor($user)); $sitesEditorOf = segue::getSiteInfoWhereUserIsSiteLevelEditor($user); $usersAllClasses = array(); if ($_SESSION[atype] == 'prof') { foreach ($classes as $n => $v) { $usersAllClasses[] = $n; } foreach ($usersFutureClasses as $n => $v) { $usersAllClasses[] = $n; } } printpre($allsites); printpre($usersAllClasses); printpre($sitesEditorOf); printpre($sitesOwnerOf); printpre($slots); $allsites = array_unique(array_merge($allsites, $usersAllClasses, $sitesOwnerOf, $sitesEditorOf, $slots)); $allGroups = group::getGroupsOwnedBy($user); $sitesInGroups = array(); foreach ($allGroups as $n => $g) { $sitesInGroups = array_unique(array_merge($sitesInGroups, group::getClassesFromName($g))); } foreach ($allsites as $n => $site) { if (!in_array($site, $sitesInGroups)) { $allsites2[] = $site; } } $allsites = array_merge($allsites2, $allGroups); asort($allsites); /* print "<pre>"; print_r($usersAllClasses); print "</pre>"; */ $sites = array(); $slots = array(); foreach ($allsites as $n => $site) { $siteObj =& new site($site); $exists = $siteObj->fetchFromDB(); if ($exists) { $sites[] = $site; } else { $slots[] = $site; } } return array($sites, $slots); }
/** * Add new slot for slots-array * @param slot $slot * @return match */ public function add_slot(slot $slot) { $this->_slots[$slot->get('player_slot')] = $slot; return $this; }
$response['message'] = __("No ports found for TemplateID: ") . " {$templateid}"; } else { $response['error'] = false; $response['errorcode'] = 200; $response['powerport'] = $ports; } echoResponse(200, $response); }); // // URL: /api/v1/devicetemplate/:templateid/slot // Method: GET // Params: templateid // Returns: Slots defined for device template with templateid // $app->get('/devicetemplate/:templateid/slot', function ($templateid) use($app) { if (!($slots = slot::GetAll($templateid))) { $response['error'] = true; $response['errorcode'] = 404; $response['message'] = __("No slots found for TemplateID: ") . " {$templateid}"; } else { $response['error'] = false; $response['errorcode'] = 200; $response['slot'] = $slots; } echoResponse(200, $response); }); // // URL: /api/v1/manufacturer // Method: GET // Params: none // Returns: All defined manufacturers
function insertDB($down = 0, $copysite = 0, $importing = 0, $keepDiscussions = 0) { $a = $this->createSQLArray(1); if (!$importing) { $a[] = "FK_createdby='" . addslashes($_SESSION[aid]) . "'"; $a[] = $this->_datafields[addedtimestamp][1][0] . "=NOW()"; $a[] = "FK_updatedby='" . addslashes($_SESSION[aid]) . "'"; } else { $a[] = "FK_createdby=" . db_get_value("user", "user_id", "user_uname='" . addslashes($this->data[addedby]) . "'"); $a[] = $this->_datafields[addedtimestamp][1][0] . "='" . addslashes($this->getField("addedtimestamp")) . "'"; $a[] = "FK_updatedby=" . db_get_value("user", "user_id", "user_uname='" . addslashes($this->data[editedby]) . "'"); $a[] = $this->_datafields[editedtimestamp][1][0] . "='" . addslashes($this->getField("editedtimestamp")) . "'"; } // insert into the site table $query = "INSERT INTO site SET " . implode(",", $a) . ";"; /* print "<br />query = $query<br />"; */ db_query($query); $this->id = lastid(); /* print "<H1>ID = ".$this->id."</H1>"; */ // in order to insert a site, the active user must own a slot // update the name for that slot if (slot::exists($this->data[name])) { $query = "UPDATE slot"; $where = " WHERE slot_name = '" . addslashes($this->data[name]) . "' AND FK_owner = '" . addslashes($_SESSION[aid]) . "'"; } else { $query = "INSERT INTO slot"; $where = ""; } $query .= " \n\t\t\tSET \n\t\t\t\tslot_name = '" . addslashes($this->data[name]) . "',\n\t\t\t\tFK_owner = '" . addslashes($_SESSION[aid]) . "',\n\t\t\t\tslot_type = '" . addslashes($this->data[type]) . "',\n\t\t\t\tFK_site = '" . addslashes($this->id) . "'" . $where; /* echo $query."<br />"; */ db_query($query); // See if there is a site hash (meaning that we are being copied). // If so, try to match our id with the hash entry for 'NEXT'. if ($GLOBALS['__site_hash']['site'] && ($oldId = array_search('NEXT', $GLOBALS['__site_hash']['site']))) { $GLOBALS['__site_hash']['site'][$oldId] = $this->name; } // the sections haven't been created yet, so we don't have to insert data[sections] for now // add new permissions entry.. force update $this->updatePermissionsDB(1); // add log entry /* log_entry("add_site",$this->name,"","","$_SESSION[auser] added ".$this->name); */ // insert down (insert sections) if ($down && $this->fetcheddown && $this->sections) { foreach (array_keys($this->sections) as $id) { // Mark our Id as the next one to set if (is_array($GLOBALS['__site_hash']['sections'])) { $GLOBALS['__site_hash']['sections'][$id] = 'NEXT'; } $this->sections[$id]->id = 0; // createSQLArray uses this to tell if we are inserting or updating $this->sections[$id]->insertDB(1, $this->name, $copysite, $importing, $keepDiscussions); } } return 1; }
/** * Adds a site to the buffer. * * @param object site $site The site to add. * @param integer $indent The indent level of the object */ function addSite(&$site) { // Add flags for when to add permissions rows $site->spiderDownLockedFlag(); $siteElement =& $this->_document->createElement('site'); $this->_document->appendChild($siteElement); // site id and type $siteElement->setAttribute('owner', slot::getOwner($site->getField('name'))); $siteElement->setAttribute('type', $site->getField('type')); // Media quota $slot = new Slot($site->getField('name')); $quota = $slot->getField('quota'); if ($quota) { $siteElement->setAttribute('mediaQuota', $quota); } $this->addCommonProporties($site, $siteElement); // use the slot-name for backwards-compatability $siteElement->setAttribute('id', $site->getField('name')); // header $header =& $this->_document->createElement('header'); $siteElement->appendChild($header); $header->appendChild($this->_document->createTextNode(htmlspecialchars($site->getField('header')))); // footer $footer =& $this->_document->createElement('footer'); $siteElement->appendChild($footer); $footer->appendChild($this->_document->createTextNode(htmlspecialchars($site->getField('footer')))); // Theme $this->addTheme($site, $siteElement); // Media $this->addMedia($site, $siteElement); // sections foreach ($site->sections as $key => $val) { if ($site->sections[$key]->getField('type') == 'link') { $this->addSectionNavLink($site->sections[$key], $siteElement); } else { if ($site->sections[$key]->getField('type') == 'heading') { $this->addHeading($site->sections[$key], $siteElement); } else { if ($site->sections[$key]->getField('type') == 'divider') { $this->addDivider($site->sections[$key], $siteElement); } else { $this->addSection($site->sections[$key], $siteElement); } } } } }
<?php $secondpage = type::super('secondpage', 'string'); if (!is_null($secondpage) && dyn::get('user')->hasPerm('page[content]')) { if (!is_null(type::post('save-back')) || !is_null(type::post('save'))) { slot::saveBlock(); echo message::success(lang::get('structure_content_save'), true); } if ($secondpage == 'show') { $sql = sql::factory(); $sql->query(' SELECT s.*, m.output FROM ' . sql::table('slots') . ' AS s LEFT JOIN ' . sql::table('module') . ' AS m ON m.id = s.modul WHERE s.id=' . $id)->result(); $pageArea = new pageArea($sql); $form = form::factory('module', 'id=' . $sql->get('modul'), 'index.php'); $form->setSave(false); $form->addFormAttribute('class', ''); $form->setSuccessMessage(null); $input = $pageArea->OutputFilter($form->get('input'), $sql); $form->addRawField($input); $form->addHiddenField('secondpage', $secondpage); $form->addHiddenField('id', $id); ?> <div class="row"> <div class="col-lg-12">
$obj->owner = strtolower($_REQUEST['adduname']); $obj->assocSite = strtolower($_REQUEST['addclassid']); $obj->type = 'class'; $obj->uploadlimit = 'NULL'; $obj->insertDB(); //db_query($query); } /****************************************************************************** * Delete Associated Site: ******************************************************************************/ if ($_REQUEST['action'] == "deletesite" && $_REQUEST['delstudentsite']) { $slot_name = $_REQUEST['delstudentsite']; $id = db_get_value("slot", "slot_id", "slot_name='" . addslashes($slot_name) . "'"); if ($id > 0) { // delete a slot $slotObj = new slot("", "", "", "", $id); $slotObj->delete(); } } /****************************************************************************** * Add student to a class site ******************************************************************************/ if ($_REQUEST['action'] == "add" && $_REQUEST['addstudent']) { // make sure the user is in the db $valid = 0; foreach ($_auth_mods as $_auth) { $func = "_valid_" . $_auth; // print "<br />AUTH: trying ".$_auth ."..."; //debug if ($x = $func($_REQUEST['addstudent'], "", 1)) { $valid = 1; break;
function insertDB() { global $error; if (segue::siteExists($this->name) || slot::exists($this->name, 0)) { error("That site name, " . $this->name . ", is already in use."); } if (!ereg("^([0-9a-zA-Z_.-]{0,})\$", $this->name)) { error("Your slot name is invalid. It may only contain alphanumeric characters, '-', '_' and '.'"); } if (!$error) { // get id for owner of slot $query = "SELECT user_id FROM user WHERE user_uname = '" . addslashes($this->owner) . "'"; /* echo $query."<br />"; */ $r = db_query($query); if (!db_num_rows($r)) { return false; } $a = db_fetch_assoc($r); $owner_id = $a[user_id]; if ($this->site) { $site = "'" . addslashes($this->site) . "'"; } else { $site = "NULL"; } if ($this->assocSite) { // get id for assoc_site of slot $query = "SELECT slot_id FROM slot WHERE slot_name = '" . addslashes($this->assocSite) . "'"; /* echo $query."<br />"; */ $r = db_query($query); $a = db_fetch_assoc($r); $assocSite = "'" . addslashes($a[slot_id]) . "'"; } else { $assocSite = "NULL"; } if (preg_match('/^[0-9]*$/', $this->uploadlimit)) { $uploadLimit = $this->uploadlimit; } else { $uploadLimit = "NULL"; } if (!$this->name) { error("Slot name not specified. Please notify the administrator of the steps that took you to this point."); print "Slot name not specified. Please notify the administrator of the steps that took you to this point."; exit; } $query = "\n\t\t\t\tINSERT INTO \n\t\t\t\t\tslot \n\t\t\t\tSET \n\t\t\t\t\tFK_owner= '" . addslashes($owner_id) . "',\n\t\t\t\t\tslot_name='" . addslashes($this->name) . "',\n\t\t\t\t\tslot_type='" . addslashes($this->type) . "',\n\t\t\t\t\tFK_site=" . $site . ",\n\t\t\t\t\tFK_assocsite=" . $assocSite . ",\n\t\t\t\t\tslot_uploadlimit=" . $this->uploadlimit . "\n\t\t\t"; /* print $query; */ db_query($query); echo mysql_error(); } }
$_SESSION[siteObj]->setField("footer", $_REQUEST[footer]); } if ($_REQUEST[copyfooter]) { $_SESSION[siteObj]->setField("header", $_SESSION[siteObj]->getField("footer")); } if ($_REQUEST[copyheader]) { $_SESSION[siteObj]->setField("footer", $_SESSION[siteObj]->getField("header")); } } if (!isset($_SESSION["settings"]) || !isset($_SESSION["siteObj"])) { // create the settings array with default values. $settings must be passed along with each link. // The array will be saved on clicking a save button. $_SESSION[settings] = array("sitename" => $_REQUEST[sitename], "add" => 0, "edit" => 0, "step" => 1, "recursiveenable" => "", "copydownpermissions" => "", "template" => "template0", "comingFrom" => $_REQUEST[comingFrom]); $_SESSION[siteObj] =& new site($_REQUEST[sitename]); if (slot::exists($_REQUEST[sitename])) { $slotObj = new slot($_REQUEST[sitename]); $_SESSION[siteObj]->setField("type", $slotObj->getField("type")); } else { if (isclass($_REQUEST[sitename])) { $_SESSION[siteObj]->setField("type", "class"); } else { if (!$_SESSION[siteObj]->getField("type") || $_SESSION[siteObj]->getField("type") == "") { $_SESSION[siteObj]->setField("type", "personal"); } } } $_SESSION[settings][className] = $_REQUEST[sitename]; if ($_REQUEST[action] == 'add_site') { $_SESSION[settings][add] = 1; $_SESSION[settings][edit] = 0; }
echo slot::getSlot('welcome'); } else { echo '<h1>' . $this->get('name') . '</h1>'; } ?> </div> </div> </div> </section> <div class="container"> <div class="row"> <div class="col-lg-12"> <section id="content"> <?php echo slot::getSlot('boxen'); ?> <div class="row"> <div class="col-md-12"> <?php echo dyn::get('content'); ?> </div> </div> </section> </div> </div> <div class="row"> <div class="col-lg-12">
/** * Runs the update */ function run() { // modify the story_display_type option $query = "\n\t\tDESCRIBE\n\t\t\tstory story_display_type\n\t\t"; $r = db_query($query); $a = db_fetch_assoc($r); if (!eregi("(enum\\()(.*'rss'.*)(\\))", $a['Type']) && eregi("(enum\\()(.*)(\\))", $a['Type'], $parts)) { $query = "\n\t\t\tALTER TABLE \n\t\t\t\tstory\n\t\t\tCHANGE \n\t\t\t\tstory_display_type story_display_type \n\t\t\t\t\tENUM(" . $parts[2] . ",'rss') \n\t\t\t\t\tDEFAULT '" . $a['Default'] . "' \n\t\t\t\t\t" . ($a['Null'] ? "" : "NOT") . " NULL\n\t\t\t"; $r = db_query($query); } // create the cache directory if it doesn't exist // check for rss cache dir global $cfg; $path = realpath($cfg[uploaddir]); if (!file_exists($path . "/RSScache/")) { mkdir($path . "/RSScache/", 0770); } if (!file_exists($path . "/RSScache/autocache/")) { mkdir($path . "/RSScache/autocache/", 0770); } //modify the usertype in user table $query = "\n\t\tDESCRIBE\n\t\t\tuser user_type\n\t\t"; $r = db_query($query); $a = db_fetch_assoc($r); if (!eregi("(enum\\()(.*'visitor'.*)(\\))", $a['Type']) && eregi("(enum\\()(.*)(\\))", $a['Type'], $parts)) { $query = "\n\t\t\tALTER TABLE \n\t\t\t\tuser\n\t\t\tCHANGE \n\t\t\t\tuser_type user_type \n\t\t\t\t\tENUM(" . $parts[2] . ",'visitor','guest') \n\t\t\t\t\tDEFAULT '" . $a['Default'] . "' \n\t\t\t\t\t" . ($a['Null'] ? "" : "NOT") . " NULL\n\t\t\t"; $r = db_query($query); } //add the story_discusslabel field to the story table $query = "\n\t\tDESCRIBE\n\t\t\tstory story_discusslabel\n\t\t"; $r = db_query($query); if (db_num_rows($r) < 1) { $query = "\n\t\t\tALTER TABLE \n\t\t\t\tstory\n\t\t\tADD \n\t\t\t\tstory_discusslabel VARCHAR( 128 ) NULL AFTER story_discussauthor\n\t\t\t"; $r = db_query($query); } // check that the class_semester field in the class table is of type varchar $query = "\n\t\tDESCRIBE\n\t\t\tclass class_semester\n\t\t"; $r = db_query($query); $a = db_fetch_assoc($r); if ($a['Type'] != "varchar(50)") { $query = "ALTER TABLE \n\t\t\t\t\t\t\tclass\n\t\t\t\t\t\tCHANGE \n\t\t\t\t\t\t\tclass_semester\n\t\t\t\t\t\t\tclass_semester \n\t\t\t\t\t\t\tVARCHAR(50) \n\t\t\t\t\t\t\tDEFAULT 'w' \n\t\t\t\t\t\t\tNOT NULL"; $r = db_query($query); } // Go through all the sites and make sure that all of their parts have // the media links updated if (ini_get('max_execution_time') < 300) { ini_set('max_execution_time', 300); } $allSlots = slot::getAllSlots(); print "\n<br />Starting Link->Tag conversion."; foreach ($allSlots as $id => $sitename) { print "\n<br />Converting links to tags in site '" . $sitename . "'..."; convertAllInteralLinksToTags($sitename); } print "\n<br />Link->Tag conversion done."; }