public function loadLeaderboardMinutes($stat) { $sql = getArray("\n SELECT matches.tournamentName, name as player, sum(minutesPlayed) as count\n FROM player_match\n INNER JOIN matches ON player_match.date = matches.date\n WHERE player_match.seasonID = '{$this->season}'\n GROUP BY name, tournamentName\n ORDER BY count DESC;"); self::makeLeaderboardList($sql, $stat); $sql = getArray("\n SELECT name as player, sum(minutesPlayed) as count\n FROM player_match\n INNER JOIN matches ON player_match.date = matches.date\n WHERE player_match.seasonID = '{$this->season}'\n GROUP BY name\n ORDER BY count DESC;"); return self::makeLeaderboardListTotal($sql); }
public function loadNations() { $sql = getArray("\n SELECT nationality\n FROM nations;"); foreach ($sql as &$nation) { $this->nations[$nation["nationality"]] = $nation["nationality"]; } }
static function parseMovieInfoByContent($content, $p_code, $type) { $content = getBody($content, TVSouLiveParse::contentparmStart, TVSouLiveParse::contentparaend); // var_dump($content);color='#CC9966' $content = replaceStr($content, '#CC9966', '#6699CC'); $times = getArray($content, "<font color='#6699CC'>", "</font>"); $names = getArray($content, "<div id='e2' >", "</div>"); // var_dump($names); // $names=filterScript($names,8191); $timesArray = explode("{Array}", $times); $namesArray = explode("{Array}", $names); // var_dump($timesArray); $prod_itmes = array(); $index = 0; foreach ($timesArray as $timeItem) { $name = $namesArray[$index]; $nameArray = explode('<ahref=', $name); if (!isN($nameArray[0])) { $itemName = $nameArray[0]; } else { $itemName = filterScript($name, 8191); } $prod_itmes[$timeItem] = $itemName; $index++; } // var_dump($prod_itmes); if (count($prod_itmes) == 1) { return false; } return $prod_itmes; }
private function loadPositions() { $sql = getArray("\n SELECT position\n FROM positions\n ORDER BY positionID;"); foreach ($sql as &$position) { $this->positions[$position["position"]] = $position["position"]; } }
private function loadAllMatches() { $matches = getArray("\n SELECT *\n FROM matches\n WHERE matches.seasonID = '{$this->season}'\n ORDER BY date ASC;"); $lineUps = getArray("\n SELECT * FROM lineups"); if (count($matches) > 0) { foreach ($matches as &$match) { $newMatch = new Match($match["date"], $match["time"], $match["tournamentName"], $match["location"], $match["opposition"], $match["goalsFor"], $match["goalsAgainst"]); if (count($matches) > 0) { foreach ($lineUps as &$lineUp) { if ($lineUp["date"] == $match["date"]) { $newMatch->setLineUp($lineUp); } } } if ($match["location"] == 'Home') { $this->homeMatches[$match["date"]] = $newMatch; } else { if ($match["location"] == 'Away') { $this->awayMatches[$match["date"]] = $newMatch; } } $this->allMatches[$match["date"]] = $newMatch; $this->tournaments[$match["tournamentName"]]->addMatch($newMatch); } } }
function loadTournamentStatistics() { $tournaments = getArray("SELECT name FROM tournaments;"); foreach ($tournaments as &$tournament) { $this->tournamentStatistics[$tournament["name"]] = new TournamentStatistics($tournament["name"], $this->name, $this->kitNumber); } $this->events = ["matches" => array(), "goalscorer" => array(), "assist" => array(), "thirdAssist" => array(), "Red" => array(), "Yellow" => array(), "playerOn" => array(), "playerOff" => array()]; }
public function getOneById($id, $split_tag = True) { $tmp = $this->where(array('id' => $id))->find(); if ($split_tag == False) { return $tmp; } $tmp['tag'] = getArray($tmp['tag']); return $tmp; }
private function loadTournaments() { $tournaments = getArray("\n SELECT *\n FROM tournaments;"); if (count($tournaments) > 0) { foreach ($tournaments as &$tournament) { $tournamentName = $tournament["name"]; $this->tournaments[$tournamentName] = new Tournament($tournamentName); } } }
function getArray($node, $mysql_connection, $userId) { $array = false; $startDate = ""; $endDate = ""; $value = ""; if ($node->hasAttributes()) { foreach ($node->attributes as $attr) { $array[$attr->nodeName] = $attr->nodeValue; if ($attr->nodeName == "startDate") { $startDate = substr($attr->nodeValue, 0, 10); // echo $attr->nodeName .":".$startDate."###</br>"; } else { if ($attr->nodeName == "endDate") { $endDate = substr($attr->nodeValue, 0, 10); // $endDate=$attr->nodeValue; // echo $attr->nodeName .":".$endDate."###</br>"; } else { if ($attr->nodeName == "value") { $value = substr($attr->nodeValue, 0, 10); // $value=$attr->nodeValue; // echo "startDate:".$startDate."## #"; // echo "endDate:".$endDate."## #"; // echo "value:".$value."## #"; if ($startDate != "" && $endDate != "" && $value != "" && $endDate - $startDate == 1) { $sql = " INSERT INTO sportData (userId,startTime,endTime,step)values (" . $userId . "," . $startDate . "," . $endDate . "," . $value . ")"; echo "</br>sql:" . $sql; if (mysql_query($sql)) { echo "***ok***</br>"; } else { echo mysql_error(); } } } } } } } if ($node->hasChildNodes()) { if ($node->childNodes->length == 1) { $array[$node->firstChild->nodeName] = getArray($node->firstChild, $mysql_connection, $userId); } else { foreach ($node->childNodes as $childNode) { if ($childNode->nodeType != XML_TEXT_NODE) { $array[$childNode->nodeName][] = getArray($childNode, $mysql_connection, $userId); } } } } else { return $node->nodeValue; } return $array; }
function getAuthorOfArticleUsername($articleid) { $select = "SELECT username "; $from = " FROM articles, user "; $where = " WHERE articles.author_username = user.username AND articleid=" . $articleid . ";"; $query = $select . $from . $where; $userArray = getArray($query); if (!$userArray) { return -1; } else { return $userArray[0]['username']; } }
function daoGetUser($username) { if (isset($username)) { // something like this? necessary, mysql_dao could possibly do this? $username = addSlashes($username); $select = "SELECT username, password, email, firstname, lastname, webpage, birthdate, description "; $from = "FROM user "; $where = "WHERE username = " . $username; $query = $select . $from . $where; $userinfo = getArray($query); return new User($userinfo['username'], $userinfo['password'], $userinfo['email'], $userinfo['firstname'], $userinfo['lastname'], $userinfo['webpage'], $userinfo['birthdate'], $userinfo['description']); } else { //TODO: Error msg, no user. } }
function getList() { $query = "SELECT s.creator as username, s.name as name, u.firstname as creator, s.styleid as stylesheet, u.firstname FROM stylesheets s, user u WHERE s.creator = u.username;"; $table = getArray($query); foreach ($table as $row) { if ($row['stylesheet']) { echo "-" . $row['name'] . " (" . $row['creator'] . ")-" . $row['stylesheet']; } if (userMayRemove($row['stylesheet'])) { echo "-1"; } else { echo "-0"; } } }
private function loadAllOppositions() { $oppositions = getArray("\n SELECT *\n FROM oppositions WHERE seasonID = '{$this->season}'\n ORDER BY date ASC;"); if (count($oppositions) > 0) { foreach ($oppositions as &$opposition) { $newOpposition = new Opposition($opposition["date"], $opposition["time"], $opposition["tournamentName"], $opposition["location"], $opposition["opposition"]); if ($opposition["location"] == 'Home') { $this->homeOppositions[$opposition["date"]] = $newOpposition; } else { if ($opposition["location"] == 'Away') { $this->awayOppositions[$opposition["date"]] = $newOpposition; } } $this->allOppositions[$opposition["date"]] = $newOpposition; $this->tournaments[$opposition["tournamentName"]]->addOpposition($newOpposition); } } }
function video_getList($sId) { global $sModule; global $aXmlTemplates; global $sFilesPath; $sMode = getSettingValue($sModule, "listSource"); $iCount = (int) getSettingValue($sModule, "listCount"); if (!is_numeric($iCount) || $iCount <= 0) { $iCount = 10; } $oSource = new BxVideosSearch(); $oSource->aCurrent['sorting'] = 'top'; $oSource->aCurrent['paginate']['perPage'] = $iCount; $oSource->aCurrent['restriction']['id'] = array('value' => $sId, 'field' => 'ID', 'operator' => '<>'); switch ($sMode) { case "Member": $sOwner = getValue("SELECT `Owner` FROM `" . MODULE_DB_PREFIX . "Files` WHERE `ID` = '" . $sId . "'"); $oSource->aCurrent['restriction']['owner'] = array('value' => $sOwner, 'field' => 'Owner', 'operator' => '='); break; case "Related": $aFile = getArray("SELECT * FROM `" . MODULE_DB_PREFIX . "Files` WHERE `ID` = '" . $sId . "'"); $oSource->aCurrent['restriction']['keyword'] = array('value' => $aFile['Title'] . " " . $aFile['Tags'] . " " . $aFile['Description'], 'field' => '', 'operator' => 'against'); break; case "Top": default: $oSource->aCurrent['restriction']['id'] = array('value' => $sId, 'field' => 'ID', 'operator' => '<>'); break; } $aData = $oSource->getSearchData(); $iCurrentTime = time(); $sResult = ""; for ($i = 0; $i < count($aData); $i++) { $aData[$i]['uri'] = $oSource->getCurrentUrl('file', $aData[$i]['id'], $aData[$i]['uri']); $aData[$i]['date'] = _format_when($iCurrentTime - $aData[$i]['date']); $sImageFile = $aData[$i]['id'] . IMAGE_EXTENSION; $sThumbFile = $aData[$i]['id'] . THUMB_FILE_NAME . IMAGE_EXTENSION; if (!file_exists($sFilesPath . $sThumbFile)) { $sThumbFile = $sImageFile; } $sResult .= parseXml($aXmlTemplates['file'], $sThumbFile, $aData[$i]['size'], $aData[$i]['ownerName'], $aData[$i]['view'], $aData[$i]['voting_rate'], $aData[$i]['date'], $aData[$i]['title'], BX_DOL_URL_ROOT . $aData[$i]['uri']); } return $sResult; }
static function parseMovieInfoByContent($content, $p_code, $type) { $content = getBody($content, CnTVLiveParse::contentparmStart, CnTVLiveParse::contentparaend); $items = getArray($content, "<dd>", "</dd>"); $itemArray = explode("{Array}", $items); $prod_itmes = array(); foreach ($itemArray as $item) { $item = filterScript($item, 8191); $item = trim($item); $item = replaceStr($item, '回看', ''); $date = substr($item, 0, 5); $item = replaceStr($item, $date, ''); $prod_itmes[$date] = $item; } if (count($prod_itmes) == 1) { return false; } return $prod_itmes; }
/** * @name getArray * @desc Converts a domElement into an array * @param domelement $node * @return array OR false */ function getArray($node) { $array = false; if ($node->hasAttributes()) { foreach ($node->attributes as $attr) { $array[$attr->nodeName] = $attr->nodeValue; } } if ($node->hasChildNodes()) { if ($node->childNodes->length == 1) { $array[$node->firstChild->nodeName] = $node->firstChild->nodeValue; } else { foreach ($node->childNodes as $childNode) { if ($childNode->nodeType != XML_TEXT_NODE) { $array[$childNode->nodeName][] = getArray($childNode); } } } } return $array; }
function __construct($ad) { if (isset($ad['id'])) { $this->id = $ad['id']; } $this->private = $ad['private']; $this->seller_name = $ad['seller_name']; $this->email = $ad['email']; if (isset($ad['allow_mail'])) { $this->allow_mail = $ad['allow_mail']; } $this->phone = $ad['phone']; $this->city_id = $ad['city_id']; $this->category_id = $ad['category_id']; $this->title = $ad['title']; $this->description = $ad['description']; $this->price = $ad['price']; if (isset($ad['id_r'])) { $this->id_r = $ad['id_r']; } return getArray(); }
public function loadPlayers() { $seasonNumber = substr($this->season, 2, 2); $playerList = getArray("SELECT name, fullName, birthdate, nationality, positions.position, kitNumber, prefFoot,\n contractExp, transferFee, transferClub, imgSrc, kitNumber, onLoan, loanedOut, squad\n FROM players\n INNER JOIN positions ON positions.positionID = players.position\n WHERE lastSeason >= '{$seasonNumber}' AND firstSeason <= '{$seasonNumber}' AND squad = '{$this->squadName}'\n ORDER BY loanedOut, positionID, kitNumber"); foreach ($playerList as &$playerInfo) { $name = $playerInfo["name"]; $fullName = $playerInfo["fullName"]; $birthdate = $playerInfo["birthdate"]; $nationality = $playerInfo["nationality"]; $position = $playerInfo["position"]; $kitNumber = $playerInfo["kitNumber"]; $prefFoot = $playerInfo["prefFoot"]; $contractExp = $playerInfo["contractExp"]; $transferFee = $playerInfo["transferFee"]; $transferClub = $playerInfo["transferClub"]; $loanedOut = $playerInfo["loanedOut"]; $imgURL = $playerInfo["imgSrc"]; $squad = $playerInfo["squad"]; $player = new Player($name, $fullName, $birthdate, $nationality, $position, $kitNumber, $prefFoot, $contractExp, $transferFee, $transferClub, $imgURL, $loanedOut, $squad); array_push($this->squad, $player); } }
/** * Gets user's information from database by user's id * @param $sId - user ID * @return $aInfo - user info */ function getUserInfo($sId) { global $sWomanImageUrl; global $sManImageUrl; global $sImagesPath; global $sProfileUrl; global $sRootURL; //get info by ID on these fields $sNick = ""; $sSex = ""; $sAge = "0"; $sDesc = ""; $sImg = ""; $sProfile = ""; // You should change this query to retrieve user's data correctly $aUser = getArray("SELECT * FROM `Profiles` WHERE `ID` = '" . $sId . "' LIMIT 1"); /** * Define photo. * If this user has a photo you should define it's uri here. * Otherwise a "no_photo" image is used. */ if ((int) $aUser['PrimPhoto'] != 0) { $sPhoto = $sImagesPath . $aUser['ID'] . "/thumb_" . getValue("SELECT `med_file` FROM `media` WHERE `med_id`='" . $aUser['PrimPhoto'] . "'"); } else { $sPhoto = $aUser['Sex'] == 'female' ? $sWomanImageUrl : $sManImageUrl; } $sSex = isset($aUser['Sex']) ? $aUser['Sex'] : "male"; $sNick = $aUser['NickName']; $sAge = isset($aUser['DateOfBirth']) ? getAge($aUser['DateOfBirth']) : "25"; $sDesc = isset($aUser['DescriptionMe']) ? $aUser['DescriptionMe'] : ""; $sModRewrite = getValue("SELECT `VALUE` FROM `GlParams` WHERE `Name`='enable_modrewrite' LIMIT 1"); $sProfile = $sModRewrite == "on" ? $sRootURL . $sNick : $sProfileUrl . "?ID=" . $sId; /** * Return user info. * NOTE. Do not change the return statement order. */ return array("nick" => $sNick, "sex" => $sSex, "age" => $sAge, "desc" => $sDesc, "photo" => $sPhoto, "profile" => $sProfile); }
/** * Gets user's information from database by user's id * @param $sId - user ID * @return $aInfo - user info */ function getUserInfo($sId, $bNick = false) { global $sWomanImageUrl; global $sManImageUrl; global $sProfileUrl; global $sRootURL; //get info by ID on these fields $sNick = ""; $sSex = ""; $sAge = "0"; $sDesc = ""; $sPhoto = ""; $sProfile = ""; //You should change this query to retrieve user's data correctly $sWherePart = ($bNick ? "`NickName`" : "`ID`") . " = '" . $sId . "'"; $aUser = getArray("SELECT * FROM `Profiles` WHERE " . $sWherePart . " LIMIT 1"); /** * Define photo. * If this user has a photo you should define it's uri here. * Otherwise a "no_photo" image is used. */ $oBaseFunctions = bx_instance("BxBaseFunctions"); $sSex = !empty($aUser['Sex']) ? $aUser['Sex'] : "male"; $sPhoto = $oBaseFunctions->getMemberAvatar($sId); if (empty($sPhoto)) { $sPhoto = $sSex == "male" ? $sManImageUrl : $sWomanImageUrl; } $sNick = $aUser['NickName']; $sAge = isset($aUser['DateOfBirth']) ? getAge($aUser['DateOfBirth']) : "25"; $sDesc = isset($aUser['DescriptionMe']) ? strip_tags($aUser['DescriptionMe']) : ""; $sProfile = getParam('enable_modrewrite') == "on" ? $sRootURL . $sNick : $sProfileUrl . "?ID=" . $sId; /** * Return user info. * NOTE. Do not change the return statement order. */ return array("id" => (int) $aUser["ID"], "nick" => $sNick, "sex" => $sSex, "age" => $sAge, "desc" => $sDesc, "photo" => $sPhoto, "profile" => $sProfile); }
<?php function getArray() { return [1, 2, 3]; } $a = getArray(); ezc_array_set($a, 0, 2); print implode(", ", $a) . "\n"; print implode(", ", getArray()) . "\n";
/** * Actions with specified room */ function doRoom($sSwitch, $sUserId = "", $iRoomId = 0, $sTitle = "", $sPassword = "", $sDesc = "", $bTemp = false) { $iCurrentTime = time(); switch ($sSwitch) { case 'insert': $aCurRoom = getArray("SELECT * FROM `" . MODULE_DB_PREFIX . "Rooms` WHERE `Name`='" . $sTitle . "'"); $sStatus = $bTemp ? ROOM_STATUS_DELETE : ROOM_STATUS_NORMAL; if (!empty($aCurRoom['ID']) && $sUserId == $aCurRoom['OwnerID']) { getResult("UPDATE `" . MODULE_DB_PREFIX . "Rooms` SET `Name`='" . $sTitle . "', `Password`='" . $sPassword . "', `Desc`='" . $sDesc . "', `OwnerID`='" . $sUserId . "', `When`='" . $iCurrentTime . "', `Status`='" . $sStatus . "' WHERE `ID`='" . $aCurRoom['ID'] . "'"); return $aCurRoom['ID']; } else { if (empty($aCurRoom['ID'])) { getResult("INSERT INTO `" . MODULE_DB_PREFIX . "Rooms` (`ID`, `Name`, `Password`, `Desc`, `OwnerID`, `When`, `Status`) VALUES ('" . $iRoomId . "', '" . $sTitle . "', '" . $sPassword . "', '" . $sDesc . "', '" . $sUserId . "', '" . $iCurrentTime . "', '" . $sStatus . "')"); return getLastInsertId(); } else { return 0; } } break; case 'update': getResult("UPDATE `" . MODULE_DB_PREFIX . "Rooms` SET `Name`='" . $sTitle . "', `Password`='" . $sPassword . "', `Desc`='" . $sDesc . "', `When`='" . $iCurrentTime . "', `Status`='" . ROOM_STATUS_NORMAL . "' WHERE `ID`='" . $iRoomId . "'"); break; case 'delete': $sSql = "UPDATE `" . MODULE_DB_PREFIX . "Rooms` SET `When`='" . $iCurrentTime . "', `Status`='" . ROOM_STATUS_DELETE . "' WHERE `ID` = '" . $iRoomId . "'"; getResult($sSql); break; case 'enter': $sId = getValue("SELECT `ID` FROM `" . MODULE_DB_PREFIX . "RoomsUsers` WHERE `Room`='" . $iRoomId . "' AND `User`='" . $sUserId . "' LIMIT 1"); if (empty($sId)) { getResult("INSERT INTO `" . MODULE_DB_PREFIX . "RoomsUsers`(`Room`, `User`, `When`) VALUES('" . $iRoomId . "', '" . $sUserId . "', '" . $iCurrentTime . "')"); } else { getResult("UPDATE `" . MODULE_DB_PREFIX . "RoomsUsers` SET `When`='" . $iCurrentTime . "', `Status`='" . ROOM_STATUS_NORMAL . "' WHERE `ID`='" . $sId . "'"); } break; case 'exit': getResult("UPDATE `" . MODULE_DB_PREFIX . "RoomsUsers` SET `When`='" . $iCurrentTime . "', `Status`='" . ROOM_STATUS_DELETE . "' WHERE `Room`='" . $iRoomId . "' AND `User`='" . $sUserId . "' LIMIT 1"); break; case 'deleteTemp': if (useServer()) { getResult("DELETE FROM `" . MODULE_DB_PREFIX . "Rooms` WHERE `Status`='" . ROOM_STATUS_DELETE . "' AND `When`<" . ($iCurrentTime - 24 * 60 * 60)); } break; } }
/** * Get config */ /** * Get config */ case 'config': $sFileName = $sModulesPath . $sModule . "/xml/config.xml"; $rHandle = fopen($sFileName, "rt"); $sContents = fread($rHandle, filesize($sFileName)); fclose($rHandle); $sContents = str_replace("#filesUrl#", $sModuleUrl, $sContents); $sContents = str_replace("#serverUrl#", getRMSUrl($sServerApp), $sContents); break; case 'getFile': $aFile = getArray("SELECT * FROM `" . MODULE_DB_PREFIX . "Files` WHERE `ID` = '" . $sId . "' LIMIT 1"); $sExt = file_exists($sFilesPath . $sId . VC_M4V_EXTENSION) ? VC_M4V_EXTENSION : VC_FLV_EXTENSION; $sPlayFile = $sId . $sExt; $sGetFile = "get_file.php?id=" . $sId . "&token=" . _getToken($sId); $sSaveName = $aFile['Title'] . $sExt; $sImageFile = $GLOBALS['sFilesDir'] . $sId . VC_IMAGE_EXTENSION; $sMessage = ""; $sStatus = FAILED_VAL; switch ($aFile['Status']) { case VC_STATUS_DISAPPROVED: $sMessage = "msgFileNotApproved"; break; case VC_STATUS_PENDING: case VC_STATUS_PROCESSING: $sMessage = "msgFileNotProcessed"; break;
$userArray = getArray('users'); foreach ($userArray as $k => $value) { $userArray[$k] = $tempUserArray['DataSet'][0][$k]; } $sql = "INSERT INTO users " . stringKeys($userArray) . " VALUES " . stringValues($userArray) . ";"; $returnArray = updateData($DBConnArray, $sql); if (!$returnArray['ErrorReturn']['Success']) { $_SESSION['returnArray'] = $returnArray['ErrorReturn']['ErrorMessage']; header("Location: " . $_SERVER['HTTP_REFERER']); return; } $lastKey = $returnArray['last_key']; # # Insert record into canners table... # $cannerArray = getArray('canners'); foreach ($cannerArray as $k => $value) { $cannerArray[$k] = $cannerWorkArray[$k]; } $cannerArray['user_id'] = $lastKey; $sql = "INSERT INTO canners " . stringKeys($cannerArray) . " VALUES " . stringValues($cannerArray) . ";"; #echo $sql;die; $returnArray = updateData($DBConnArray, $sql); if (!$returnArray['ErrorReturn']['Success']) { $_SESSION['returnArray'] = $returnArray['ErrorReturn']['ErrorMessage']; header("Location: " . $_SERVER['HTTP_REFERER']); return; } # # Clean up temp record $sql = "DELETE FROM temp_users WHERE id = " . $_SESSION['returnValues']['last_key'] . ";";
function lastsave() { global $db, $cache; $p_id = be("all", "p_id"); $p_timestart = be("post", "p_timestart"); $p_timeend = be("post", "p_timeend"); $p_areastart = be("post", "p_areastart"); $p_areaend = be("post", "p_areaend"); $p_classtype = be("post", "p_classtype"); $p_collect_type = be("post", "p_collect_type"); $p_typestart = be("post", "p_typestart"); $p_typeend = be("post", "p_typeend"); $p_contentstart = be("post", "p_contentstart"); $p_contentend = be("post", "p_contentend"); $p_playcodetype = be("post", "p_playcodetype"); $p_playcodestart = be("post", "p_playcodestart"); $p_playcodeend = be("post", "p_playcodeend"); $p_playurlstart = be("post", "p_playurlstart"); $p_playurlend = be("post", "p_playurlend"); $p_playlinktype = be("post", "p_playlinktype"); $p_playlinkstart = be("post", "p_playlinkstart"); $p_playlinkend = be("post", "p_playlinkend"); $p_playspecialtype = be("post", "p_playspecialtype"); $p_playspecialrrul = be("post", "p_playspecialrrul"); $p_timestart = be("post", "p_timestart"); $p_playspecialrerul = be("post", "p_playspecialrerul"); $p_starringtype = be("post", "p_starringtype"); $p_starringstart = be("post", "p_starringstart"); $p_starringend = be("post", "p_starringend"); $p_titletype = be("post", "p_titletype"); $p_pictype = be("post", "p_pictype"); $p_pagetype = be("all", "p_pagetype"); $p_listcodestart = be("post", "p_listcodestart"); $p_listcodeend = be("post", "p_listcodeend"); $p_titlestart = be("post", "p_titlestart"); $p_titleend = be("post", "p_titleend"); $p_listlinkstart = be("post", "p_listlinkstart"); $p_listlinkend = be("post", "p_listlinkend"); $p_picstart = be("post", "p_picstart"); $p_picend = be("post", "p_picend"); $p_lzstart = be("post", "p_lzstart"); $p_lzend = be("post", "p_lzend"); $strlisturl = be("post", "listurl"); $p_coding = be("post", "p_coding"); $p_lzcodetype = be("post", "p_lzcodetype"); $p_lzcodestart = be("post", "p_lzcodestart"); $p_lzcodeend = be("post", "p_lzcodeend"); $p_languagestart = be("post", "p_languagestart"); $p_languageend = be("post", "p_languageend"); $p_remarksstart = be("post", "p_remarksstart"); $p_remarksend = be("post", "p_remarksend"); $p_directedstart = be("post", "p_directedstart"); $p_directedend = be("post", "p_directedend"); $p_setnametype = be("post", "p_setnametype"); $p_setnamestart = be("post", "p_setnamestart"); $p_setnameend = be("post", "p_setnameend"); $p_setnametype = be("post", "p_setnametype"); $p_playtype = be("post", "p_playtype"); //api start $playcodeApiUrl = be("post", "p_playcodeApiUrl"); $playcodeApiUrltype = be("post", "p_playcodeApiUrltype"); $p_playcodeApiUrlParamend = be("post", "p_playcodeApiUrlParamend"); $playcodeApiUrlParamstart = be("post", "p_playcodeApiUrlParamstart"); if (isN($playcodeApiUrltype)) { $playcodeApiUrltype = 0; } $p_videocodeApiUrl = be("post", "p_videocodeApiUrl"); $p_videocodeApiUrlParamstart = be("post", "p_videocodeApiUrlParamstart"); $p_videocodeApiUrlParamend = be("post", "p_videocodeApiUrlParamend"); $p_videourlstart = be("post", "p_videourlstart"); $p_videourlend = be("post", "p_videourlend"); $p_videocodeType = be("post", "p_videocodeType"); //api end if (isN($p_videocodeType)) { $p_videocodeType = 0; } if (isN($p_starringtype)) { $p_starringtype = 0; } if (isN($p_titletype)) { $p_titletype = 0; } if (isN($p_pictype)) { $p_pictype = 0; } $sql = "select * from {pre}cj_vod_projects Where p_id=" . $p_id; $row = $db->getRow($sql); $p_pagetype = $row["p_pagetype"]; $strSet = ""; if ($p_pagetype == 3 || $p_starringtype == 0) { $strSet .= "p_starringstart='" . $p_starringstart . "',p_starringend='" . $p_starringend . "',"; } else { $p_starringstart = $row["p_starringstart"]; $p_starringend = $row["p_starringend"]; } if ($p_pagetype == 3 || $p_titletype == 0) { $strSet .= "p_titlestart='" . $p_titlestart . "',p_titleend='" . $p_titleend . "',"; } else { $p_titlestart = $row["p_titlestart"]; $p_titleend = $row["p_titleend"]; } if ($p_pagetype == 3 || $p_pictype == 0) { $strSet .= "p_picstart='" . $p_picstart . "',p_picend='" . $p_picend . "',"; } else { $p_picstart = $row["p_picstart"]; $p_picend = $row["p_picend"]; } $strSet .= "p_lzstart='" . $p_lzstart . "',p_lzend='" . $p_lzend . "',p_timestart='" . $p_timestart . "',p_timeend='" . $p_timeend . "',p_areastart='" . $p_areastart . "',p_areaend='" . $p_areaend . "',p_classtype='" . $p_classtype . "',p_collect_type='" . $p_collect_type . "',p_typestart='" . $p_typestart . "',p_typeend='" . $p_typeend . "',p_contentstart='" . $p_contentstart . "',p_contentend='" . $p_contentend . "',p_playcodetype='" . $p_playcodetype . "',p_playcodestart='" . $p_playcodestart . "',p_playcodeend='" . $p_playcodeend . "',p_playurlstart='" . $p_playurlstart . "',p_playurlend='" . $p_playurlend . "',p_playlinktype='" . $p_playlinktype . "',p_playlinkstart='" . $p_playlinkstart . "',p_playlinkend='" . $p_playlinkend . "',p_playspecialtype='" . $p_playspecialtype . "',p_playspecialrrul='" . $p_playspecialrrul . "',p_playspecialrerul='" . $p_playspecialrerul . "',p_lzcodetype='" . $p_lzcodetype . "',p_lzcodestart='" . $p_lzcodestart . "',p_lzcodeend='" . $p_lzcodeend . "',p_languagestart='" . $p_languagestart . "',p_languageend='" . $p_languageend . "',p_remarksstart='" . $p_remarksstart . "',p_remarksend='" . $p_remarksend . "',p_directedstart='" . $p_directedstart . "',p_directedend='" . $p_directedend . "',p_setnametype='" . $p_setnametype . "',p_setnamestart='" . $p_setnamestart . "',p_setnameend='" . $p_setnameend . "'"; $strSet = $strSet . ",p_playcodeApiUrl='" . $playcodeApiUrl . "',p_playcodeApiUrltype='" . $playcodeApiUrltype . "',p_playcodeApiUrlParamend='" . $p_playcodeApiUrlParamend . "',p_playcodeApiUrlParamstart='" . $playcodeApiUrlParamstart . "'"; $strSet = $strSet . ",p_videocodeApiUrl='" . $p_videocodeApiUrl . "',p_videocodeApiUrlParamstart='" . $p_videocodeApiUrlParamstart . "',p_videocodeApiUrlParamend='" . $p_videocodeApiUrlParamend . "',p_videourlstart='" . $p_videourlstart . "',p_videourlend='" . $p_videourlend . "',p_videocodeType='" . $p_videocodeType . "'"; $db->query("update {pre}cj_vod_projects set " . $strSet . " where p_id=" . $p_id); $p_listcodestart = $row["p_listcodestart"]; $p_listcodeend = $row["p_listcodeend"]; $p_listlinkstart = $row["p_listlinkstart"]; $p_listlinkend = $row["p_listlinkend"]; $p_playcodestart = $row["p_playcodestart"]; $p_playcodeend = $row["p_playcodeend"]; $p_pagebatchurl = $row["p_pagebatchurl"]; $p_pagebatchid1 = $row["p_pagebatchid1"]; $p_pagebatchid2 = $row["p_pagebatchid2"]; $p_server = $row["p_server"]; $UrlTestMoive = ''; if ($p_server > 0) { $p_server_address = $db->getOne("select ds_url from {pre}vod_server where ds_id=" . $p_server); } $p_script = $row["p_script"]; // echo $p_pagetype; if ($p_pagetype != 3) { if (isN($_SESSION["strListCode"])) { $strListCode = getPage($strlisturl, $p_coding); $_SESSION["strListCode"] = $strListCode; } else { $strListCode = $_SESSION["strListCode"]; } if (isN($_SESSION["strListCodeCut"])) { $strListCodeCut = getBody($strListCode, $p_listcodestart, $p_listcodeend); $_SESSION["strListCodeCut"] = $strListCodeCut; } else { $strListCodeCut = $_SESSION["strListCodeCut"]; } if (isN($_SESSION["linkarrcode"])) { $linkarrcode = getArray($strListCodeCut, $p_listlinkstart, $p_listlinkend); $_SESSION["linkarrcode"] = $linkarrcode; } else { $linkarrcode = $_SESSION["linkarrcode"]; } if ($p_starringtype == 1) { $starringarrcode = getArray($strListCodeCut, $p_starringstart, $p_starringend); } if ($p_titletype == 1) { $titlearrcode = getArray($strListCodeCut, $p_titlestart, $p_titleend); } if ($p_pictype == 1) { $picarrcode = getArray($strListCodeCut, $p_picstart, $p_picend); } switch ($linkarrcode) { case False: errmsg("采集提示", "<li>在获取链接列表时出错。" . $linkarrcode . "</li>"); break; default: $linkarr = explode("{Array}", $linkarrcode); $UrlTest = getHrefFromLink($linkarr[0]); $UrlTest = definiteUrl($UrlTest, $strlisturl); // var_dump($UrlTest); $linkcode = getPage($UrlTest, $p_coding); $UrlTestMoive = $UrlTest; echo "<li>采集提示:采集页面:" . $UrlTest . "</li>"; break; } } else { $strlisturl = $p_pagebatchurl; $p_pagebatchurl = replaceStr($p_pagebatchurl, "{ID}", $p_pagebatchid1); $linkcode = getPage($p_pagebatchurl, $p_coding); } var_dump($p_playtype); if ($linkcode == False) { errmsg("采集提示", "获取内容页失败!"); return; } if ($p_titletype == 1) { switch ($titlearrcode) { case False: $titlecode = "获取失败"; break; default: $titlearr = explode("{Array}", $titlearrcode); $titlecode = $titlearr[0]; break; } } else { $titlecode = getBody($linkcode, $p_titlestart, $p_titleend); writetofile("tte.log", $linkcode); var_dump(ascii_decode($titlecode)); } if ($p_starringtype == 1) { switch ($starringarrcode) { case False: $starringcode = "获取失败"; break; default: $starringarr = explode("{Array}", $starringarrcode); $starringcode = $starringarr[0]; break; } } else { $starringcode = getBody($linkcode, $p_starringstart, $p_starringend); } if ($p_pictype == 1) { switch ($picarrcode) { case False: $piccode = "获取失败"; break; default: $picarr = explode("{Array}", $picarrcode); $piccode = $picarr[0]; break; } } else { $piccode = getBody($linkcode, $p_picstart, $p_picend); } $piccode = definiteUrl($piccode, $strlisturl); if ($p_lzcodetype == 1) { $lzfwcode = getBody($linkcode, $p_lzcodestart, $p_lzcodeend); $lzcode = getBody($lzfwcode, $p_lzstart, $p_lzend); $lzcode = replaceStr($lzcode, "False", "0"); } else { $lzcode = getBody($linkcode, $p_lzstart, $p_lzend); $lzcode = replaceStr($lzcode, "False", "0"); } $remarkscode = getBody($linkcode, $p_remarksstart, $p_remarksend); $remarkscode = replaceStr($remarkscode, "False", ""); $directedcode = getBody($linkcode, $p_directedstart, $p_directedend); $directedcode = replaceStr($directedcode, "False", ""); $languagecode = getBody($linkcode, $p_languagestart, $p_languageend); $languagecode = replaceStr($languagecode, "False", "未知"); $areacode = getBody($linkcode, $p_areastart, $p_areaend); if ($areacode == false) { $areacode = "未知"; } $timecode = getBody($linkcode, $p_timestart, $p_timeend); if ($timecode == false) { $timecode = date('Y-m-d', time()); } $contentcode = getBody($linkcode, $p_contentstart, $p_contentend); if ($contentcode == false) { $contentcode = "未知"; } $contentcode = replaceFilters($contentcode, $p_id, 2, 0); if ($p_classtype == 1) { $typecode = getBody($linkcode, $p_typestart, $p_typeend); } else { $typecode = $p_collect_type; $typearr = getValueByArray($cache[0], "t_id", $typecode); $typecode = $typearr["t_name"]; } if ($p_playcodetype == 1) { $playcode = getBody($linkcode, $p_playcodestart, $p_playcodeend); if ($p_playlinktype > 0) { $weburl = getArray($playcode, $p_playlinkstart, $p_playlinkend); } else { $weburl = getArray($playcode, $p_playurlstart, $p_playurlend); // var_dump($playcode); } if ($p_setnametype == 3) { $setnames = getArray($playcode, $p_setnamestart, $p_setnameend); } } else { if ($p_playcodetype == 2) { //from api // writetofile("d:\\s.txt",$linkcode) ; // echo $p_playcodeApiUrlParamend .'=='.$playcodeApiUrlParamstart; // echo $playcodeApiUrlParamstart .'\n' .$p_playcodeApiUrlParamend .' = '.$playcodeApiUrltype; if ($playcodeApiUrltype == 0) { $paracode = getBody($linkcode, $playcodeApiUrlParamstart, $p_playcodeApiUrlParamend); } else { $paracode = getBody($UrlTestMoive, $playcodeApiUrlParamstart, $p_playcodeApiUrlParamend); } // echo $paracode; $p_apibatchurl = replaceStr($playcodeApiUrl, "{PROD_ID}", $paracode); $p_apibatchurls = replaceStr($p_apibatchurl, "{PAGE_NO}", 1); // writetofile("d:\\ts.txt", $p_apibatchurls."\n"); $playcode = getFormatPage($p_apibatchurls, $p_coding); // echo $playcode."\n"; $weburl = getArray($playcode, $p_playlinkstart, $p_playlinkend); // writetofile("d:\\ts.txt",'aaaaa('.$p_playlinkstart.")\n\t(".$p_playlinkend.")\n\t"); $page_num = 2; // writetofile("d:\\ts.txt",$weburl); // echo "page 1 :".$weburl .'\n'; $flag = true; while ($flag && strpos($playcodeApiUrl, "{PAGE_NO}") !== false) { $p_apibatchurls = replaceStr($p_apibatchurl, "{PAGE_NO}", $page_num); // echo $p_apibatchurls .'\n'; $playcode = getFormatPage($p_apibatchurls, $p_coding); $weburls = getArray($playcode, $p_playlinkstart, $p_playlinkend); // writetofile("d:\\ts.txt", "page ".$page_num." :".$weburls .'\n'); if ($weburls) { $weburl = $weburl . "{Array}" . $weburls; $page_num = $page_num + 1; } else { $flag = false; } } // var_dump($weburl); // if ($p_playlinktype >0) { // $weburl = getArray($playcode,$p_playlinkstart,$p_playlinkend); // } // else{ // $weburl = getArray($playcode,$p_playurlstart,$p_playurlend); // // var_dump($playcode); // } // if ($p_setnametype == 3) { // $setnames = getArray($playcode,$p_setnamestart,$p_setnameend); // } } else { if ($p_playlinktype > 0) { $weburl = getArray($linkcode, $p_playlinkstart, $p_playlinkend); } else { $weburl = getArray($linkcode, $p_playurlstart, $p_playurlend); } if ($p_setnametype == 3) { $setnames = getArray($linkcode, $p_setnamestart, $p_setnameend); } } } $titlecode = filterScript($titlecode, $p_script); $titlecode = replaceFilters($titlecode, $p_id, 1, 0); $starringcode = filterScriptStar($starringcode, $p_script); $directedcode = filterScriptStar($directedcode, $p_script); $timecode = filterScript($timecode, $p_script); $typecode = filterScript($typecode, $p_script); $areacode = filterScript($areacode, $p_script); $piccode = filterScript($piccode, $p_script); $remarkscode = filterScript($remarkscode, $p_script); $languagecode = filterScript($languagecode, $p_script); ?> <form name="form" action="?action=saveok" method="post"> <table class="tb"> <tr> <td colspan="2" align="center">采 集 测 试 结 果</td> </tr> <tr> <td width="20%">名称:</td> <td> <?php echo $titlecode; ?> 连载:<?php echo $lzcode; ?> 备注:<?php echo $remarkscode; ?> </td> </tr> <tr> <td>演员:</td> <td> <?php echo $starringcode; ?> </td> </tr> <tr> <td>导演:</td> <td> <?php echo $directedcode; ?> </td> </tr> <tr> <td>日期:</td> <td> <?php echo $timecode; ?> </td> </tr> <tr> <td>栏目:</td> <td> <?php echo $typecode; ?> </td> </tr> <tr> <td>地区:</td> <td> <?php echo $areacode; ?> </td> </tr> <tr> <td>语言:</td> <td> <?php echo $languagecode; ?> </td> </tr> <tr> <td>图片:</td> <td> <?php echo getHrefFromImg($piccode); ?> </td> </tr> <tr> <td>介绍:</td> <td> <?php echo strip_tags($contentcode); ?> </td> </tr> <?php if ($weburl != False) { $webArray = explode("{Array}", $weburl); $setnamesArray = explode("{Array}", $setnames); $webArraTemp = array(); $index = 0; $webUrls = ''; for ($i = 0; $i < count($webArray); $i++) { $UrlTemp = $webArray[$i]; if (strpos($webUrls, $UrlTemp . '<array>') === false) { $webArraTemp[$index] = $UrlTemp; $webUrls = $webUrls . $UrlTemp . '<array>'; $index++; } } $webArray = $webArraTemp; for ($i = 0; $i < count($webArray); $i++) { $UrlTest = $webArray[$i]; if ($p_playspecialtype == 1 && strpos("," . $p_playspecialrrul, "[变量]")) { $Keyurl = explode("[变量]", $p_playspecialrrul); $urli = getBody($UrlTest, $Keyurl[0], $Keyurl[1]); if ($urli == False) { break; } $UrlTest = replaceStr($p_playspecialrerul, "[变量]", $urli); } if ($p_playspecialtype == 2) { $urArray = explode("/", $UrlTestMoive); // writetofile("d:\\ts.txt","ss:".$UrlTestMoive); $ur = ""; for ($k = 0; $k < count($urArray) - 1; $k++) { $ur = $ur . $urArray[$k] . "/"; } $UrlTest = $ur . $UrlTest . ".html"; } // writetofile("d:\\ts.txt", $UrlTest); if ($p_playlinktype == 1) { $UrlTest = getHrefFromLink($UrlTest); $UrlTest = definiteUrl($UrlTest, $strlisturl); $webCode = getPage($UrlTest, $p_coding); $url = getBody($webCode, $p_playurlstart, $p_playurlend); $url = replaceFilters($url, $p_id, 3, 0); $url = replaceLine($url); $androidUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseAndroidVideoUrlByContent($webCode, $p_coding, $p_script); $videoAddressUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseIOSVideoUrlByContent($webCode, $p_coding, $p_script); $videoAddressUrl = $androidUrl . '{====}' . $videoAddressUrl; } else { if ($p_playlinktype == 2) { $UrlTest = getHrefFromLink($UrlTest); if (isN($p_playurlend)) { $tmpA = strpos($UrlTest, $p_playurlstart); $url = substr($UrlTest, strlen($UrlTest) - $tmpA - strlen($p_playurlstart) + 1); } else { $url = getBody($UrlTest, $p_playurlstart, $p_playurlend); } } else { if ($p_playlinktype == 3) { $UrlTest = getHrefFromLink($UrlTest); $UrlTest = definiteUrl($UrlTest, $strlisturl); $webCode = getPage($UrlTest, $p_coding); $tmpB = getArray($webCode, $p_playurlstart, $p_playurlend); $tmpC = explode("{$Array}\$", $tmpB); foreach ($tmpC as $tmpD) { $url = $tmpD; ?> <tr> <td>播放列表:</td> <td> <?php echo $p_server_address . $UrlTest; ?> </td> </tr> <tr> <td>地址:</td> <td> <?php echo $p_server_address . $url; ?> </td> </tr> <?php } break; } else { $url = replaceFilters($UrlTest, $p_id, 3, 0); $url = replaceLine($url); // echo $url; $webCode = getPage($UrlTestMoive, $p_coding); $androidUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseAndroidVideoUrlByContent($webCode, $p_coding, $p_script); $videoAddressUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseIOSVideoUrlByContent($webCode, $p_coding, $p_script); $videoAddressUrl = $androidUrl . '{====}' . $videoAddressUrl; ?> <tr> <td>播放列表:</td> <td> <?php echo $p_server_address . $UrlTestMoive; ?> </td> </tr> <tr> <td>视频地址列表:</td> <td> <?php echo $p_server_address . replaceStr($videoAddressUrl, "\\", ""); ?> </td> </tr> <tr> <td>地址:</td> <td> <?php echo $p_server_address . $url; ?> </td> </tr> <?php continue; } } } if ($p_setnametype == 1) { $setname = getBody($url, $p_setnamestart, $p_setnameend); // $url = $setname ."$" .$url; } else { if ($p_setnametype == 2 && $p_playlinktype == 1) { $setname = getBody($webCode, $p_setnamestart, $p_setnameend); // $url = $setname ."$" .$url; } else { if ($p_setnametype == 3) { $setname = $setnamesArray[$i]; // $url = $setnamesArray[$i] . "$" .$url; } } } ?> <tr> <td>播放列表:</td> <td> <?php echo $UrlTest; ?> </td> </tr><tr> <td>视频地址列表:</td> <td> <?php echo $p_server_address . replaceStr($videoAddressUrl, "\\", ""); ?> </td> </tr> <tr> <td>地址:</td> <td> <?php echo $url; ?> 集数: <?php echo filterScriptStar($setname, $p_script); ?> </td> </tr> <?php } } ?> <tr> <td colspan="2"><input name="button" type="button" class="btn" id="button" onClick="window.location.href='javascript:history.go(-1)'" value="上一步"> <input name="Submit" type="submit" class="btn" id="Submit" value="完 成"></td> </tr> </table> </form> <?php }
$Login = trim($_SESSION["login"]); ?> <?php function getArray(&$Login) { $sql = "select * from pesquisa Where id_usuario= '{$Login}' and id_parte ='3';"; $Resultado = mysql_query($sql) or die("Erro: " . mysql_error()); $i = 0; $resposta = array(); while ($array_exibir = mysql_fetch_array($Resultado)) { $resposta[$i] = $array_exibir['id_resposta']; $i++; } return $resposta; } $meuArray = getArray($Login); ?> <?php function getArray1(&$Login) { $sql = "select * from pesquisaquais Where id_usuario= '{$Login}' and id_parte ='3';"; $Resultado = mysql_query($sql) or die("Erro: " . mysql_error()); $i = 0; $resposta1 = array(); while ($array_exibir = mysql_fetch_array($Resultado)) { $resposta1[$array_exibir['id_resposta']] = $array_exibir['resposta']; $i++; } return $resposta1; } $meuArray1 = getArray1($Login);
if (isset($_POST['myAction'])) { $action = $_POST['myAction']; switch ($action) { case 'start': start(); break; //weak areas //missed retake //previous //weak areas //missed retake //previous case 'init': mySave(0); break; case 'update': mySave(1); break; case 'getArray': getArray(); break; } } function start() { $test = "123"; $user_id = $_POST['user_id']; $element_id = $_POST['element_id']; $subtopics = $_POST['subtopics']; $simulated = $_POST['simulated']; $weak_areas = $_POST['weak_areas']; $missed_retake = $_POST['missed_retake']; $resume = $_POST['resume']; $newExam = new Exam($user_id, $element_id, $subtopics, $simulated, $weak_areas, $missed_retake, $resume); ?>
case 'kickUser': getResult("UPDATE `" . MODULE_DB_PREFIX . "CurrentUsers` SET `Status`='" . USER_STATUS_KICK . "', `When`='" . time() . "' WHERE `ID`='" . $sId . "'"); break; case 'changeUserType': $sUserId = getValue("SELECT `ID` FROM `" . MODULE_DB_PREFIX . "Profiles` WHERE `ID` = '" . $sId . "' LIMIT 1"); getResult(empty($sUserId) ? "INSERT INTO `" . MODULE_DB_PREFIX . "Profiles`(`ID`, `Type`) VALUES('" . $sId . "', '" . $sType . "')" : "UPDATE `" . MODULE_DB_PREFIX . "Profiles` SET `Type`='" . $sType . "' WHERE `ID`='" . $sId . "'"); break; case 'searchUser': $sContents = parseXml($aXmlTemplates['result'], "No User Found.", FAILED_VAL); $sUserId = searchUser($sParamValue, $sParamName); if (empty($sUserId)) { break; } $aUser = getUserInfo($sUserId); $aUser['sex'] = $aUser['sex'] == "female" ? "F" : "M"; $aProfile = getArray("SELECT * FROM `" . MODULE_DB_PREFIX . "Profiles` WHERE `ID` = '" . $sUserId . "' LIMIT 1"); if (!is_array($aProfile) || count($aProfile) == 0) { $aProfile = array("Banned" => FALSE_VAL, "Type" => CHAT_TYPE_FULL); } $sContents = parseXml($aXmlTemplates['result'], "", SUCCESS_VAL); $sContents .= parseXml($aXmlTemplates['user'], $sUserId, $aUser['nick'], $aUser['sex'], $aUser['age'], $aUser['photo'], $aUser['profile'], $aProfile['Banned'], $aProfile['Type']); break; /** * Get sounds */ /** * Get sounds */ case 'getSounds': $sFileName = $sModulesPath . $sModule . "/xml/sounds.xml"; if (file_exists($sFileName)) {
$sContents = parseXml($aXmlTemplates['result'], $sFileName, SUCCESS_VAL); break; case 'removeFile': $sId = str_replace(".file", "", $sId); removeFile($sId); break; /** * >>> ACTIONS FOR INVITE <<< * Check for pending messages for given user */ /** * >>> ACTIONS FOR INVITE <<< * Check for pending messages for given user */ case 'updateInvite': $aMsg = getArray("SELECT `SenderID`, `Message` FROM `" . MODULE_DB_PREFIX . "Pendings` WHERE `RecipientID`='" . $sRspId . "' ORDER BY `ID` DESC LIMIT 1"); //--- if there is a message return it and some information about it's author ---// if (!empty($aMsg['SenderID'])) { $aUserInfo = getUserInfo($aMsg['SenderID']); $sContents = parseXml($aXmlTemplates['result'], TRUE_VAL, $aMsg['Message'], $aMsg['SenderID'], $aUserInfo['nick'], $aUserInfo['photo'], $aUserInfo['profile']); } else { $sContents = parseXml($aXmlTemplates['result'], FALSE_VAL); } break; /** * >>> ACTIONS LITE VERSION ONLY <<< * Refreshs IM users' states and insert current user's connection in connections table. * Is used during authorize process. */ /** * >>> ACTIONS LITE VERSION ONLY <<<
} echo " <br> {$array["k1"]} <br>"; var_dump($array["multi"]["dimensional"]["array"]); function getArray() { return [1, 2, 3]; } #自 PHP 5.4 起可以用数组间接引用函数或方法调用的结果。之前只能通过一个临时变量。 自 PHP 5.5 起可以用数组间接引用一个数组原型 // on PHP 5.4 $ele = getArray()[1]; var_dump($ele); // previously $tmp = getArray(); $secondElement = $tmp[1]; // or list(, $secondElement) = getArray(); var_dump($secondElement); // 创建一个简单的数组 $array = array(1, 2, 3, 4, 5); print_r($array); // 现在删除其中的所有元素,但保持数组本身不变: foreach ($array as $i => $value) { unset($array[$i]); } print_r($array); // 添加一个单元(注意新的键名是 5,而不是你可能以为的 0) $array[] = 6; print_r($array); // 重新索引: $array = array_values($array); $array[] = 7;