function updateOsmFile($filename, $db) { global $offset, $offsetfactorrels, $connection; $connection = connectToDatabase($db); // if there is no connection if (!$connection) { reportError("Cannot connect to database."); return false; } $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); if (!($fp = fopen($filename, "r"))) { reportError("Cannot open file."); return false; } while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { reportError("XML-Error."); return false; } } xml_parser_free($xml_parser); fclose($fp); pg_close($connection); echo "Finished " . $db . "...\n"; return true; }
/** * Delete the given model entity. * * @param Model $model Model to be deleted. * @param string $msg Message for a successful delete. * @param string $title Title for a successful delete. * * @return array */ protected function deleteThe(Model $model, $msg = 'messages.deleted', $title = 'messages.success') { if ($model->delete()) { return ['title' => trans("admin::{$title}"), 'msg' => trans("admin::{$msg}")]; } return reportError(); }
function connect() { //global $host_db,$user_db,$password_db,$bdd_db; $host_db = "localhost"; // nom de votre serveur $user_db = ""; // nom d'utilisateur de connexion � votre bdd $password_db = ""; // mot de passe de connexion � votre bdd $bdd_db = "grottoce"; // nom de votre bdd $connect_db = mysql_connect($host_db, $user_db, $password_db); $filename = "mysql"; if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $IP = $_SERVER['HTTP_X_FORWARDED_FOR']; } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) { $IP = $_SERVER['HTTP_CLIENT_IP']; } else { $IP = $_SERVER['REMOTE_ADDR']; } $content = "|" . $IP . "|" . session_id() . "|" . __FUNCTION__ . "|" . $connect_db; logDBToFile($content, $filename); if (is_resource($connect_db)) { mysql_select_db($bdd_db, $connect_db); mysql_query("SET NAMES UTF8"); return $connect_db; } else { reportError(mysql_error(), __FILE__, "function", __FUNCTION__, 'Connection Error'); exit; } }
function executeReader($sql) { try { global $odb; //clearError(); return $odb->query($sql); } catch (Exception $ex) { reportError(); } }
showClientWebsites($userid); } } } elseif ($siteid == 0 && isset($_GET['add'])) { if (isActive($userid)) { if (maxUserSites($userid) == false) { $_SESSION['website'] = newWebsite($userid); $siteid = $_SESSION['website']; showTemplates($siteid, 0, 0, 'select'); } else { if (isUser($userid)) { addStaticWebsite($userid); } elseif (isDeveloper($userid)) { sysMsg(MSG00093); if (isDeveloper($userid)) { reportError('User (U53R' . $userid . ') reached the maximum number of allowed websites.'); } } else { sysMsg(MSG00094); } showClientWebsites($userid); } } else { demoMsg(); showClientWebsites($userid); } } elseif (isset($_GET['website']) && isset($_GET['delete'])) { // $siteid = cleanGet($_GET['delete']); if ($siteid != 0) { if (isActive($userid)) { if ($_SESSION['userid'] == '1' && $userid == '1') {
/** Tries to find a response handler for $request->getType(). $request must be one of: - A JSONRequest object. Its getType() value is used as the handler lookup key. - An array, in which case the JSONRequest($request) is called to construct a request. - A string containing '{', in which case it is assumed to be message JSON and is passed on to JSONRequest($request). - A string containing a lookup key. If it is found, the response handler is passed that key rather than a JSONRequest() object. If $f is a string and does not map to a current entry then paths which have been registered in addAutoloadDir() are searched for a file names EVENT_TYPE.inc.php. If one is found, it is include and the mapping is re-checked (because presumably the file will register a handler). Returns: If no handler is found, null is returned. If one is found, it is handled as described in mapResponder() and on success a JSONResponder is returned. If an error is encountered in the handling of the request, the contained response will be a wrapper for that error. */ public static function getResponder($request) { $key = null; function reportError($r, $msg) { return new JSONResponder_Error($r, __CLASS__ . '::getResponder(): ' . $msg); } if (is_string($request)) { if (false === strpos($request, '{')) { $key = $request; } else { try { $request = new JSONRequest($request); $key = $request->getType(); } catch (Exception $e) { if (1) { throw $e; } else { return new JSONResponder_Error(null, "EXCEPTION while creating JSONRequest from request data: " . $e->getMessage()); } } } } else { if ($request instanceof JSONRequest) { $key = $request->getType(); } else { if (@is_array($request)) { $request = new JSONRequest($request); $key = $request->getType(); } else { // TODO: create an Exception response type to wrap this, and return it: return new JSONResponder_Error(new JSONRequest(), "Illegal arguments to " . __CLASS__ . "::getResponder([unknown])"); } } } $f = @self::$handlers[$key]; $request->set('arrivalTime', $request->get('arrivalTime', JSONMessage::timestamp())); while (!$f) { foreach (self::$DispatcherPath as $dir) { $fn = $dir . '/' . $key . '.inc.php'; if (@file_exists($fn)) { require_once $fn; $f = @self::$handlers[$key]; break; } } if (!$f) { return null; } //reportErr($request,"No Responder found for message type '".$key."'."); break; } if (is_string($f)) { if (class_exists($f)) { $x = new $f($request); if ($x instanceof JSONResponder) { return $x; } else { if ($x instanceof JSONResponse) { return new JSONResponder_Generic($request, $x); } else { return reportError($r, "class mapped to [" . $key . "] is neither " . "a JSONResponder nor a JSONResponse!"); } } } else { if (function_exists($f)) { $x = $f($request); if ($x instanceof JSONResponder) { return $x; } else { if ($x instanceof JSONResponse) { return new JSONResponder_Generic($request, $x); } else { return reportError($request, "JSONMessageDispatcher mapped to [" . $key . "] returned an object of an unknown type!"); } } } else { return reportError($request, "JSONResponder mapped to [" . $key . "] names neither a class nor a function!"); } } } else { if (is_callable($f)) { $x = $f($request); if ($x instanceof JSONResponder) { return $x; } else { if ($x instanceof JSONResponse) { return new JSONResponder_Generic($request, $x); } else { return reportError($request, "JSONMessageDispatcher mapped to [" . $key . "] returned an object of an unknown typ!"); } } } else { return reportError($request, "JSONMessageDispatcher handler mapped to [" . $key . "] is not callable!"); } } }
<?php if (isset($_POST['query'])) { $query = $_POST['query']; $query = stripcslashes($query); $q = strtolower($query); $forbidden = array('drop', 'delete', 'update', 'create', 'alter'); foreach ($forbidden as $key) { if (strpos($q, $key) !== false) { reportError("Query modifies the data! Queries like DROP, DELETE, UPDATE, CREATE and ALTER are not supported as they change the underlying data."); die; } } $result = executeQuery($con, $query); if ($result == false) { reportError(mysqli_error($con)); die; } ?> <table class="bordered"> <thead> <?php $numFields = mysqli_num_fields($result); echo '<tr>'; for ($i = 0; $i < $numFields; $i++) { $field = mysqli_fetch_field_direct($result, $i); echo '<th>' . $field->name . '</th>'; } echo '</tr>'; ?> </thead>
$path = '/'; } if (isset($_FILES['uploadFile']['name'])) { if (!$_FILES['uploadFile']['error'] and $_FILES['uploadFile']['name'] and $_FILES['uploadFile']['size'] > 0) { @ini_set('max_execution_time', '1800'); @set_time_limit(1800); try { $tempFile = APPROOT . '/cache/' . md5(mt_rand(0, 99999999) . time()); move_uploaded_file($_FILES['uploadFile']['tmp_name'], $tempFile); $fp = fopen($tempFile, 'rb'); $client->putStream($fp, $path . '/' . $_FILES['uploadFile']['name']); fclose($fp); header('Location: options.php?command=list&path=' . urlencode($path)); unlink($tempFile); } catch (\Vdisk\Exception $e) { reportError($e); } } else { echo 'Not a valid file selected.'; } } else { include_once APPROOT . '/tpl/upload.php'; } } else { header('Location: options.php?command=auth'); } } else { header('Location: options.php?command=login&ref=' . urlencode($path)); } break; case 'login':
<?php // POST atom/add?contents=contentsStr require_once "../common.php"; if ($_SERVER["REQUEST_METHOD"] !== "POST") { reportError(HTTP_STATUS_METHOD_NOT_ARROWED, "You should use POST method to use this API."); } if (!isset($_REQUEST["contents"])) { reportError(HTTP_STATUS_BAD_REQUEST, "Argument 'contents' is not passed."); } $db = connectDB(); $retv = db_addAtomElement($db, $_REQUEST["contents"]); if ($retv[0] != 0) { reportError(HTTP_STATUS_INTERNAL_SERVER_ERROR, $retv[1]); } http_response_code(HTTP_STATUS_CREATED); elementListBegin(); echoAtomElement(UUID_ServerResponse, $retv[1]); echoAtomElement($retv[1], $_REQUEST["contents"]); elementListEnd();
/** Not currently used */ public function recoverFromMismatchedSet($input, $e, $follow) { if ($this->mismatchIsMissingToken($input, $follow)) { // System.out.println("missing token"); reportError($e); // we don't know how to conjure up a token for sets yet return $this->getMissingSymbol($input, $e, TokenConst::$INVALID_TOKEN_TYPE, $follow); } // TODO do single token deletion like above for Token mismatch throw $e; }
break; case 'login': if (!$session->is_logged_in()) { show_form('login'); } break; case 'resetpw': if (!isset($_SESSION['userid'])) { if ($index_page[1] != '0' && $index_page[1] == 'send') { if (isValid($_POST['email'], 'email')) { if (emailExists($_POST['email'])) { if (sendNewPassw($_POST['email'])) { show_msg(translate('An email has been sent to your email address. Please follow the instructions in the email.', sz_config('language'))); } else { show_msg(translate('An error has occurred while trying to reset your password.', sz_config('language'))); if (reportError('Unable to reset password for' . $_POST['email'])) { show_msg(translate('The website developers have been notified and you will be contacted shortly.', sz_config('language'))); } else { reportErrorManually('33215'); } } } else { show_form('passreset', translate('Please enter your own email address.', sz_config('language'))); } } else { show_form('passreset', translate('You have entered an invalid email address. Please try again.', sz_config('language'))); } } else { show_form('passreset', ''); } }
function execSQL($sql, $frame, $file, $function) { $connect_db = connect(); $req = mysql_query($sql) or die(reportError(mysql_error(), $file, $frame, $function, 'Erreur SQL : ' . $sql)); if ($req) { $id = mysql_insert_id($connect_db); $affected_rows = mysql_affected_rows($connect_db); } //mysql_free_result($req); close($connect_db); $array = array('mysql_query' => $req, 'mysql_insert_id' => $id, 'mysql_affected_rows' => $affected_rows); return $array; }
} else { //build query string $query = "INSERT INTO quizzes (question, answer1, answer2, answer3, answer4, answer5, answer6, answer7, answer8, results, url_code, multiple, ip_restrict, ip_list) "; $query .= "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?);"; //prepare and execute query $statement = $conn->prepare($query); if ($conn->error) { reportError($conn->error, $errors); } $statement->bind_param("ssssssssssssss", $question, $answersArray[0], $answersArray[1], $answersArray[2], $answersArray[3], $answersArray[4], $answersArray[5], $answersArray[6], $answersArray[7], $results, $quizURLcode, $multiple, $ip_restrict, $iplist); if ($conn->error) { reportError($conn->error, $errors); } $statement->execute(); if ($conn->error) { reportError($conn->error, $errors); } $statement->close(); $conn->close(); } //stop execution if any page errors occurred verifyNoErrors($errors); //redirect to this page, but now with a urlcode url parameter header("Location: quiz.php?qid=" . $quizURLcode); exit; } ?> <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
function checkAuth() { if (!isset($_SESSION['auth']) || $_SESSION['auth'] !== true) { reportError(1, __("You must authenticate to run the upgrade.")); } }
function validateNewUser() { $email = mysql_real_escape_string($_GET["email"]); $token = mysql_real_escape_string($_GET["token"]); $password = mysql_real_escape_string($_GET["password"]); $md5password = md5($password); $sql = "SELECT * FROM `verification` WHERE `email` \n LIKE '{$email}' AND `token` LIKE '{$token}'"; $result = mysql_query($sql); if (mysql_num_rows($result) == 1) { $sql = "INSERT INTO `users` (`email`, `password`, `active`) \n VALUES ('{$email}', '{$md5password}', '1');"; if (!mysql_query($sql)) { reportError($sql); } $sql = "DELETE FROM `verification` WHERE `email` = '{$email}'"; if (!mysql_query($sql)) { reportError($sql); } else { $_POST["email"] = $email; $_POST["password"] = $password; checkLogin(); echo '1'; } } else { echo 'Your verification values are incorrect: ' + $email + $token; } }
?> </b></p> <p><?php echo __("Please click"); ?> <a href="index.php"><?php echo __("here"); ?> </a> <?php echo __("to logon to Xibo as \"xibo_admin\" with the password you chose earlier."); ?> </p> </div> <?php } else { reportError("0", __("A required parameter was missing. Please go through the installer sequentially!"), __("Start Again")); // Fixme : translate "Start Again" ? } include 'install/footer.inc'; # Functions function checkFsPermissions() { # Check for appropriate filesystem permissions return is_writable("install.php") && is_writable("settings.php") && is_writable("upgrade.php") || is_writable("."); } function checkMySQL() { # Check PHP has MySQL module installed return extension_loaded("mysql"); } function checkJson()
function getInsertID() { try { global $odb; clearError(); return mysql_insert_id($odb); } catch (Exception $ex) { reportError(); } }
$sql3 = "UPDATE " . $prefix . "pokalsieger SET finalgegner = '" . $neuerName . "' WHERE finalgegner = '" . $showTeamName . "'"; $sql4 = mysql_query($sql3) or reportError(mysql_error(), $sql3); $sql3 = "UPDATE " . $prefix . "cupsieger SET sieger = '" . $neuerName . "' WHERE sieger = '" . $showTeamName . "'"; $sql4 = mysql_query($sql3) or reportError(mysql_error(), $sql3); $sql3 = "UPDATE " . $prefix . "cupsieger SET finalgegner = '" . $neuerName . "' WHERE finalgegner = '" . $showTeamName . "'"; $sql4 = mysql_query($sql3) or reportError(mysql_error(), $sql3); $sql3 = "UPDATE " . $prefix . "geschichte_tabellen SET team = '" . $neuerName . "' WHERE team = '" . $showTeamName . "'"; $sql4 = mysql_query($sql3) or reportError(mysql_error(), $sql3); $sql3 = "UPDATE " . $prefix . "spiele SET team1 = '" . $neuerName . "' WHERE team1 = '" . $showTeamName . "'"; $sql4 = mysql_query($sql3) or reportError(mysql_error(), $sql3); $sql3 = "UPDATE " . $prefix . "spiele SET team2 = '" . $neuerName . "' WHERE team2 = '" . $showTeamName . "'"; $sql4 = mysql_query($sql3) or reportError(mysql_error(), $sql3); $sql3 = "UPDATE " . $prefix . "testspiel_anfragen SET team1_name = '" . $neuerName . "' WHERE team1_name = '" . $showTeamName . "'"; $sql4 = mysql_query($sql3) or reportError(mysql_error(), $sql3); $sql3 = "UPDATE " . $prefix . "transfermarkt_leihe SET bieter = '" . $neuerName . "' WHERE bieter = '" . $showTeamName . "'"; $sql4 = mysql_query($sql3) or reportError(mysql_error(), $sql3); if ($cookie_teamname == $showTeamName) { // if the name of one's own club was changed $_SESSION['teamname'] = $neuerName; // change the name in the session as well $cookie_teamname = $neuerName; // and for the rest of the current page $showTeamName = $neuerName; // just to be consistent addInfoBox(_('Dein Verein heißt jetzt:') . ' ' . $neuerName); } else { // if the name of another user's club was changed by the support staff addInfoBox($showTeamName . ' heißt jetzt: ' . $neuerName); $showTeamName = $neuerName; // just to be consistent }
$domains = array('http://nominatim.openstreetmap.org/', 'http://www.yournavigation.org/', 'http://openlinkmap.org/', 'http://beta.openlinkmap.org/', 'http://www.openlinkmap.org/', 'http://www.openstreetmap.org/'); $allowed = false; foreach ($domains as $domain) { if (strpos($url, $domain) === 0) { $allowed = true; break; } } if ($url && $allowed) { // query string $fields = ''; if (count($_REQUEST) > 2) { foreach ($_REQUEST as $key => $value) { if ($key != 'url' && $key != 'method') { $fields .= $key . '=' . rawurlencode($value) . '&'; } } } $fields = substr($fields, 0, strlen($fields) - 1); $response = apiRequest($url . "?" . $fields); $content = $response[0]; $info = $response[1]; // return the response if ($response) { header("Content-type: " . $info['content_type']); echo $content; } } else { reportError("Not allowed proxy request: " . $url); exit; }
function endElement($parser, $name) { global $tags, $id, $type, $lat, $lon, $connection; if ($name == "TAG") { if ($tags == "") { $tags = '"' . addslashes($attr['K']) . '"=>"' . addslashes($attr['V']) . '"'; } else { $tags .= ',"' . addslashes($attr['K']) . '"=>"' . addslashes($attr['V']) . '"'; } } else { if ($name == "NODE") { $result = pg_query($connection, "INSERT INTO " . $type . " (id, tags, geom) VALUES ('" . $id . "', '" . str_replace("\"", "\\\"", $tags) . "', GeometryFromText('POINT ( " . $lon . " " . $lat . " )', 4326 ))"); if (!$result) { reportError("Failed to insert element: http://www.openstreetmap.org/edit?editor=remote&" . substr($type, 0, -1) . $id); } $tags = ''; } } }
fclose($F); $last = exec("mailx -s 'test Setup Failed' {$mailTo} < {$tmpFile} ", $tossme, $rptGen); } // Using the standard source path /home/fosstester/fossology if (array_key_exists('WORKSPACE', $_ENV)) { $apath = $_ENV['WORKSPACE']; print "workspaces:\napath:{$apath}\n"; } $tonight = new TestRun($path); print "Running tests\n"; $testPath = "{$tonight->srcPath}" . "/tests"; print "testpath is:{$testPath}\n"; if (!chdir($testPath)) { $error = "Error can't cd to {$testPath}\n"; print $error; reportError($error); exit(1); } print "Running Functional tests\n"; /* * This fails if run by fosstester as Db.conf is not world readable and the * script is not running a fossy... need to think about this... * */ $TestLast = exec('./testFOSSology.php -a -e', $results, $rtn); print "after running tests the output is\n"; print_r($results) . "\n"; /* * At this point should have results, generate the results summary and email it. * * 10-29-2009: the results are generated in testFOSSology.php and mailed there
<?php // POST atom/add?contents=contentsStr require_once "../common.php"; if ($_SERVER["REQUEST_METHOD"] !== "GET") { reportError(HTTP_STATUS_METHOD_NOT_ARROWED, "You should use GET method to use this API."); } $idStr = substr($_SERVER["PATH_INFO"], 1); $idStr = verifyUUIDString($idStr); if (!$idStr) { reportError(HTTP_STATUS_BAD_REQUEST, "Given ElementID is not valid."); } $db = connectDB(); $retv = db_getAtomElementByID($db, $idStr); if ($retv[0] != 0) { reportError(HTTP_STATUS_INTERNAL_SERVER_ERROR, $retv[1]); } if ($retv[1] == 0) { reportError(HTTP_STATUS_NOT_FOUND, $retv[1]); } http_response_code(HTTP_STATUS_OK); elementListBegin(); echoAtomElement(UUID_ServerResponse, $retv[1]); echoAtomElement($idStr, $retv[2]); elementListEnd();
function tagTransform($filename, $tags, $osmtype) { $results = array(); if (file_exists($filename)) { $xml = simplexml_load_file($filename); } else { reportError("Could not open file: " . $filename); } foreach ($xml->translation as $translation) { if ($translation->match != false) { $tagsmatch = tagsMatch($translation->match, $tags, $osmtype); if (!$tagsmatch[0]) { continue; } } $regexmatches = $tagsmatch[1]; if ($translation->find != false) { foreach ($translation->find->children() as $find) { $regexmatches[(string) $find['match_id']] = tagMatch($find['k'], $find['v'], $tags); } } if ($translation->output != false) { foreach ($translation->output->children() as $output) { $type = $output->getName(); if ($type == "copy-all") { $results = $tags; } else { if ($type == "copy-unmatched") { $results = $tags; foreach ($regexmatches as $regexmatch) { if ($results[$regexmatch[0][0]] == $regexmatch[1][0]) { unset($results[$regexmatch[0][0]]); } } } else { if ($type == "copy-matched") { $results = $regexmatches; foreach ($regexmatches as $regexmatch) { $results[$regexmatch[0][0]] == $regexmatch[1][0]; } } else { if ($type == "tag") { if ($regexmatches[(string) $output['from_match']] && (string) $output['from_match'] != "") { for ($i = 0; $i < count($regexmatches[(string) $output['from_match']][0]); $i++) { $newKey = preg_replace('/\\{' . $i . '\\}/', $regexmatches[(string) $output['from_match']][0][$i], (string) $output['k']); $newValue = preg_replace('/\\{' . $i . '\\}/', $regexmatches[(string) $output['from_match']][1][$i], (string) $output['v']); } $results[$newKey] = $newValue; } else { $results[(string) $output['k']] = (string) $output['v']; } } } } } } } return $results; } return $tags; }
$staticUriImg = "http://maps.google.com/maps/api/staticmap?maptype=terrain&amp;zoom=09&amp;sensor=false&amp;markers=icon:http://www.grottocenter.org/images/icons/grotto1.png|" . $data[$i]['Latitude'] . "," . $data[$i]['Longitude'] . "&amp;size=300x250"; } $staticUriA = "http://maps.google.com/maps?hl=" . strtolower($shortLang) . "&amp;q=" . $data[$i]['Latitude'] . "," . $data[$i]['Longitude']; $description .= '<div><a href="' . $staticUriA . '"><img src="' . $staticUriImg . '" border="0" alt="IMG" /></a></div>'; } $xml .= '<link>' . $url . '</link>'; $xml .= '<guid isPermaLink="false">' . $date . ' - ' . $title . '</guid>'; $xml .= '<description>' . $description . '</description>'; $xml .= '<pubDate>' . $date . '</pubDate>'; if ($contact != "") { $xml .= '<author>' . $contact; if ($author != "") { $xml .= ' (' . $author . ')'; } $xml .= '</author>'; } $xml .= '<category>' . $category . '</category>'; $xml .= '<atom:link href="' . $feedFileName . '" rel="self" type="application/rss+xml" />'; $xml .= '</item>'; } $xml .= '</channel>'; $xml .= '</rss>'; $feedFileName = "rss_" . $shortLang . ".xml"; $handleW = @fopen($feedFileName, 'wb'); if ($handleW) { @fwrite($handleW, $xml); } else { reportError("Impossible to write {$feedFileName}...", __FILE__, "update_rss", "update_rss", ''); } @fclose($handleW); }
} // Step 5 run the post install process /* for most updates you don't have to remake the db and license cache. Need to add a -d for turning it off. */ print "Running fo-postinstall\n"; $iRes = $tonight->foPostinstall(); print "install results are:{$iRes}\n"; if ($iRes !== TRUE) { $error = "There were errors in the postinstall process check fop.out\n"; print $error; print "calling reportError\n"; reportError($error, 'fop.out'); exit(1); } // Step 6 run the scheduler test to make sure everything is clean print "Starting Scheduler Test\n"; if ($tonight->schedulerTest() !== TRUE) { $error = "Error! in scheduler test examine ST.out\n"; print $error; reportError($error, 'ST.out'); exit(1); } print "Starting Scheduler\n"; if ($tonight->startScheduler() !== TRUE) { $error = "Error! Could not start fossology-scheduler\n"; print $error; reportError($error, NULL); exit(1); }
if( $err != "" ) { reportError( $err, $sql ); die; } $order_item_id = mysql_insert_id(); $sql = "INSERT INTO merch_order_item_options ( order_item_id, option_name, option_value ) VALUES ( $order_item_id, '$option_name', '$size' )"; $result = mysql_query( $sql ); $err = mysql_error(); if( $err != "" ) { reportError( $err, $sql ); die; } } else if (strcmp ($res, "INVALID") == 0) { fwrite( $file, requestDetail() ); } } fclose ($fp); fclose( $file ); }
/** * We need to update the user groups */ private function UpdateUserGroups() { $db =& $this->db; // Get all the current users in the system $SQL = "SELECT UserID, groupID, UserName FROM `user`"; if (!($result = $db->query($SQL))) { reportError('20.php', "Error creating user groups" . $db->error()); } while ($row = $db->get_assoc_row($result)) { // For each display create a display group and link it to the display $ugid = 0; $userID = Kit::ValidateParam($row['UserID'], _INT); $groupID = Kit::ValidateParam($row['groupID'], _INT); $username = Kit::ValidateParam($row['UserName'], _STRING); $ug = new UserGroup($db); // For each one create a user specific group if (!($ugId = $ug->Add($username, 1))) { reportError('20.php', "Error creating user groups" . $db->error()); } // Link to the users own userspecific group and also to the one they were already on $ug->Link($ugId, $userID); $ug->Link($groupID, $userID); } }
} break; case 'getPlayerStats': if ($invalidArg === false) { getPlayerStats($playerId); } break; case 'reportError': if ($invalidArg === false) { $error = arg('error'); if ($error === false) { $invalidArg = 'error'; } } if ($invalidArg === false) { reportError($playerId, $error); } break; case 'info': phpinfo(); break; case 'testEmail': require_once "emails.php"; testEmail(); break; default: $invalidArg = 'cmd'; break; } if ($invalidArg !== false) { $ret = array("status" => "INVALID_ARG", "arg" => $invalidArg);
/** * Show a message that displays how to use (invoke) this PHP script and exit. */ function showUsage() { reportError('Usage: php run_js_tests.php'); }
public function updateXML() { $this->addLog("<" . __LINE__ . "> " . __METHOD__); $this->addLog("Generando XML UPDATE para {$this->contentId}"); //$keywordStr = "\"" . implode("\r\n", $this->keywords) . "\""; $keywordStr = implode(" ", $this->keywords); $this->arraySubForm = array("Content Title" => $this->title, "Website Category" => $this->webCat, "Genres" => $this->tag); if ($this->isModeloArgentina === TRUE) { $this->arraySubForm["Creator"] = $this->nombreModeloArgentina; } else { if ($this->isIdeas === TRUE) { $this->arraySubForm["Creator"] = "Ideas"; } else { $this->arraySubForm["Creator"] = $this->artist . $this->marca . $this->festivo; } } $this->arraySubForm["Thumbnail"] = ""; if (!is_numeric($this->contentId) || $this->contentId <= 0) { $this->genException("CRIT", __LINE__, __METHOD__, ": content_id no valido"); } $carriers = explode(",", CARRIERS); $langs = explode(",", LANGS); $xmlstr = XML_HEADER . '<mgdImageUpdate xmlns="http://www.qpass.net/telcel/mgdImage" xmlns:qpass="******" xmlns:jcr="http://www.jcp.org/jcr/1.0">' . "\n"; $xmlstr .= "\t<qpass:ppuid>{$this->contentId}</qpass:ppuid>\r\n"; // TAG:MERCHANT foreach ($this->merchants as $merchant) { $carrier = $this->obtainCarrier($merchant); $xmlstr .= "\t<qpass:merchant>{$carrier}</qpass:merchant>\r\n"; } // TAG:RATING if (!empty($this->rating)) { $rating = $this->adult == "true" ? "18+" : $this->rating; $xmlstr .= "\n <qpass:rating>\n <qpass:scheme>Mexico</qpass:scheme>\n <qpass:value>{$this->rating}</qpass:value>\n <qpass:comment>Comment</qpass:comment>\n </qpass:rating>\n"; } // TAG:TITLE foreach ($this->langs as $lang) { if (mustTranslateToEN($lang, $this->contentType) === TRUE) { $trans = translate($this->dbc, $this->contentId, 'nombre'); if ($trans === FALSE || $trans === NULL) { reportError("ERROR: Ocurrio un error traduciendo {$this->contentId} => 'nombre'"); } else { $xmlstr .= "\t<title qpass:lang=\"{$this->obtainLang($lang)}\">" . konvert($trans) . "</title>\r\n"; } } else { $xmlstr .= "\t<title qpass:lang=\"{$this->obtainLang($lang)}\">{$this->title}</title>\r\n"; } } // TAG:GENRES if (!empty($this->tag)) { $xmlstr .= "\t<genres>{$this->tag}</genres>\n"; } if (!empty($this->tagEng)) { $xmlstr .= "\t<genres>{$this->tagEng}</genres>\n"; } // TAG:SUBGENRES1 if (!empty($this->subTag)) { $xmlstr .= "\t<subgenres1>{$this->subTag}</subgenres1>\n"; } if (!empty($this->subTagEng)) { $xmlstr .= "\t<subgenres1>{$this->subTagEng}</subgenres1>\n"; } // TAG:KEYWORDS foreach ($this->langs as $lang) { // en el caso de los keywords es diferente if (mustTranslateToEN($lang, $this->contentType) === TRUE) { $trans = translate($this->dbc, $this->contentId, 'keywords'); if ($trans === FALSE || $trans === NULL) { reportError("ERROR: Ocurrio un error traduciendo {$this->contentId} => 'keywords'"); } else { // cargo array con keywords traducidos $keywords = explode(",", $trans); foreach ($keywords as $kw) { $kw = trim($kw); if (!empty($kw)) { $xmlstr .= "\t<keywords qpass:lang=\"{$this->obtainLang($lang)}\">" . konvert($kw) . "</keywords>\r\n"; } } } } else { foreach ($this->keywords as $keyword) { $keyword = trim($keyword); if (!empty($keyword)) { $xmlstr .= "\t<keywords qpass:lang=\"{$this->obtainLang($lang)}\">{$keyword}</keywords>\r\n"; } } } } // TAG:SHORTDESCRIPTION foreach ($this->langs as $lang) { if (mustTranslateToEN($lang, $this->contentType) === TRUE) { $trans = translate($this->dbc, $this->contentId, 'short_desc'); if ($trans === FALSE || $trans === NULL) { reportError("ERROR: Ocurrio un error traduciendo {$this->contentId} => 'short_desc'"); } else { $xmlstr .= "\t<shortDescription qpass:lang=\"{$this->obtainLang($lang)}\">" . konvert($trans) . "</shortDescription>\r\n"; } } else { $xmlstr .= "\t<shortDescription qpass:lang=\"{$this->obtainLang($lang)}\">{$this->getShortDescription()}</shortDescription>\r\n"; } } // TAG:LONGDESCRIPTION foreach ($this->langs as $lang) { if (mustTranslateToEN($lang, $this->contentType) === TRUE) { $trans = translate($this->dbc, $this->contentId, 'long_desc'); if ($trans === FALSE || $trans === NULL) { reportError("ERROR: Ocurrio un error traduciendo {$this->contentId} => 'long_desc'"); } else { $xmlstr .= "\t<longDescription qpass:lang=\"{$this->obtainLang($lang)}\">" . konvert($trans) . "</longDescription>\r\n"; } } else { $xmlstr .= "\t<longDescription qpass:lang=\"{$this->obtainLang($lang)}\">{$this->getLongDescription()}</longDescription>\r\n"; } } // TAG:WEBSITECATEGORY if (!empty($this->webCat)) { $xmlstr .= "\t<websiteCategory>{$this->webCat}</websiteCategory>\n"; } $xmlstr .= "</mgdImageUpdate>"; $this->addLog("XML Generado:\n" . $xml); return $xmlstr; }