/** * * @param WOOOF $wo * @param array $in * @return [ 'changeOk' => bool, 'changePass' => boolean, 'errors' => array ] */ public static function changePassword(WOOOF $wo, $in) { $place = __CLASS__ . '::' . __FUNCTION__; if ($wo->userData['id'] == '0123456789') { $wo->handleShowStopperError('505'); } $errors = []; if ($in['newPass'] !== $in['newPassConfirm']) { $errors[] = "Passwords given do not match."; $out = ['changeOk' => false, 'errors' => $errors]; return $out; } $res = VO_Users::passwordChange($wo, $in); if ($res === FALSE) { $out = ['changeOk' => false, 'errors' => $wo->getErrorsAsArrayAndClear()]; $wo->db->rollback(); } else { $out = ['changeOk' => true, 'changePass' => $res]; $wo->db->commit(); } return $out; }
<?php // _genericMetaData.php // CAUTION: TODO: Work in progress require_once '../setup.inc.php'; $requestedAction = 'read'; $pageLocation = '1'; $browserTitle = 'MetaData'; $timers = array(); $wo = new WOOOF(); if (!$wo->constructedOk) { $wo->handleShowStopperError("1000 Failed to init WOOOF."); } $paramNames = array('_tableName'); $in = $wo->getMultipleGetPost($paramNames); //$in['where'] = "region='Greece'"; $tableName = $in['_tableName']; $table = new Generic($tableName, $wo); // requires view : __v_columnMetaData $res = $table->showMetaData($in); // if ( $tpl === FALSE ) { $wo->handleShowStopperError( print_r($errors,true) ); } if ($res === FALSE) { // $wo->handleShowStopperError( $error ); $tpl = array('browserTitle' => $browserTitle, 'content' => 'Sorry, smg went wrong', 'errorMessage' => nl2br($wo->getErrorsAsStringAndClear()), 'message' => ''); } else { $tpl = array('browserTitle' => $tableName . ' ' . $browserTitle, 'content' => $res, 'message' => ''); } $wo->fetchApplicationFragment('structural/generic_template.php'); // UNREACHEABLE: As generic_template.php exits at its end! // End of file _genericMetaData.php
if (isset($_GET['action'])) { $action = $wo->cleanUserInput($_GET['action']); } else { if (isset($_POST['action'])) { $action = $wo->cleanUserInput($_POST['action']); } else { $action = 'read'; } } $content = ''; $extraScripts = ''; if ($address != '1') { $security = $wo->db->getSecurityPermitionsForLocationAndUser($address, $userData['id']); if (!isset($security[$action]) || $security[$action] != true) { //die('Δεν έχετε την απαιτούμενη έγκριση ασφάλειας για να προβείτε σε αυτή την ενέργεια. Θα πρέπει να κάνετε login με άλλο λογαριασμό για να προχωρήσετε.<br/>Αυτό το σφάλμα μπορεί να συμβεί επίσης αν ζητήσετε μια ενέργεια που δεν έχει οριστεί.'); $wo->handleShowStopperError('You are not authorised for this action. Please login with an admin account.'); } else { $addressItems = explode('_', $address); if (count($addressItems) < 2 || $addressItems[0] != '1') { //$wo->reportError('Η διεύθυνση που δώσατε είναι εσφαλμένη. Δεν βρέθηκε το κατάλληλο descriptor.'); $wo->handleShowStopperError('Wrong authorisation location.'); } $table = new WOOOF_dataBaseTable($wo->db, '', $addressItems[1]); if ($action == 'read' && count($addressItems) == 2) { if ($table->getAdminPresentation() == '4') { $table2 = new WOOOF_dataBaseTable($wo->db, $table->getGroupedByTable()); if (!isset($_GET[$table->getLocalGroupColumn()]) || $_GET[$table->getLocalGroupColumn()] == '') { if ($table2->getOrderingColumnForListings() != '') { $orderBy = $table2->getOrderingColumnForListings(); } else { $orderBy = 'id';
/** * * @param WOOOF $wo * @param array $in // [ 'email' ] * @return array [ 'resendOk', 'errors' ] */ public static function resendToken(WOOOF $wo, $in) { $place = __CLASS__ . '::' . __FUNCTION__; $requestedAction = 'resendToken'; $pageLocation = '3'; $browserTitle = 'MovieRama User Verification Token Resend'; if ($wo->userData['id'] != '0123456789') { $wo->handleShowStopperError("505 {$place}: " . $wo->userData['id']); } if (!$wo->hasContent($in['email'])) { $wo->logError(self::_ECP . "2359 You must provide your email in order to resend your verification token."); return false; } $movieramaUserRec = $wo->db->getRowByColumn('movierama_users', 'username', $in['email']); if ($movieramaUserRec === FALSE) { return false; } if ($movieramaUserRec === NULL) { $wo->logError(self::_ECP . "2360 I am sorry it seems you are not a registered MovieRama user."); return false; } $res = VO_Registration::tokenResend($wo, $in); if ($res === FALSE) { $out = ['resendOk' => false, 'errors' => $wo->getErrorsAsArrayAndClear()]; $wo->db->rollback(); } else { $out = ['resendOk' => true, 'resend' => $res]; $wo->db->commit(); } return $out; }
public static function getWOOOF($pageLocation, $requestedAction, WOOOF $wo = NULL) { if ($wo === NULL && ($wo = WOOOF::$instance) === NULL) { $wo = new WOOOF(true, $pageLocation, $requestedAction); if (!$wo->constructedOk) { $wo->handleShowStopperError("1000 Failed to init WOOOF."); } } else { $succ = $wo->checkLocationAndAction($pageLocation, $requestedAction); if ($succ !== TRUE) { $wo->handleShowStopperError('Security Error'); } } return $wo; }
/** * * @param WOOOF $wo * @param array $in [array of user answers to eval criteria] * @return false | [ 'evaluationSavedOk' => bool, 'evaluationSavedForEvalId' => string ] */ public static function submitEvaluation(WOOOF $wo, $in) { $place = __CLASS__ . '::' . __FUNCTION__; if ($wo->userData['id'] == '0123456789') { $wo->handleShowStopperError('505'); } if (!$wo->hasContent($in)) { $wo->logError(self::_ECP . "1226 You must provide data to submit an evaluation"); return false; } $res = VO_Evaluation::submitEval($wo, $in, $wo->app->userId); if ($res === FALSE) { $out = ['evaluationSavedOk' => false, 'errors' => $wo->getErrorsAsArrayAndClear()]; $wo->db->rollback(); } else { $out = ['evaluationSavedOk' => true, 'evaluationSavedForEvalId' => $res]; $wo->db->commit(); } return $out; }
/** * * @param WOOOF $wo * @param array $in * @return false | [ 'flagItemOk' => bool, 'flagItemRecType' => string, 'errors' => array ] */ public static function flagMovie(WOOOF $wo, $in) { $place = __CLASS__ . '::' . __FUNCTION__; if ($wo->userData['id'] == '0123456789') { $wo->handleShowStopperError('505'); } if (!$wo->hasContent($in['whatId'])) { $wo->logError(self::_ECP . "4196 You must provide a movie ID to report!"); return false; } if (!$wo->hasContent($in['whatType'])) { $wo->logError(self::_ECP . "4197 You must provide a target type to report!"); return false; } if (!$wo->hasContent($in['flagText'])) { $wo->logError(self::_ECP . "4198 You must provide flag text!"); return false; } $res = VO_FlagItem::saveFlagItem($wo, $wo->app->userId, $in); if ($res === FALSE) { $out = ['flagItemOk' => false, 'errors' => $wo->getErrorsAsArrayAndClear()]; $wo->db->rollback(); } else { $out = ['flagItemOk' => true, 'flagItemRecType' => $res]; $wo->db->commit(); } return $out; }