/** * @inheritdoc */ public function getRules() { $rules = new Rules(); if (!array_key_exists('rules', $this->data)) { throw new ConfigurationException(".INI Configuration must contain 'rules' section."); } foreach ($this->data['rules'] as $patternStr => $probability) { $pattern = new RulePattern((int) $probability); $startToken = ''; foreach (explode(' ', $patternStr) as $tokenStr) { if (strlen($tokenStr) <= 2) { throw new ConfigurationException("Pattern {$patternStr}: Token {$tokenStr} must exceed 2 characters."); } $isStartToken = false; if ($tokenStr[0] === '<' && substr($tokenStr, -1) === '>') { $isStartToken = true; $tokenStr = substr($tokenStr, 1, -1); $startToken = $tokenStr; } $token = new RulePatternToken($tokenStr, $isStartToken); $pattern->addToken($token); } if (empty($startToken)) { throw new ConfigurationException("Pattern {$patternStr}: Must contain start token."); } $rule = new Rule($startToken); $rule->addPattern($pattern); $rules->addRule($rule); } return $rules; }
/** * Transform file content to structured Rules * @return Rules The valid ruleset */ public function parse() { $rules = new Rules(); $userAgent = $rule = null; $separator = "\r\n"; $line = strtok($this->content, $separator); while ($line !== false) { if (strpos($line, '#') !== 0) { if (preg_match('/^User-Agent\\: (.*)$/i', $line, $matches)) { if ($userAgent !== null && $rule !== null) { $rules->add($userAgent, $rule); } $userAgent = $matches[1]; $rule = new Rule(); } elseif (preg_match('/^Allow: (.*)$/i', $line, $matches)) { $rule->allow($matches[1]); } elseif (preg_match('/^Disallow: (.*)$/i', $line, $matches)) { $rule->disallow($matches[1]); } } $line = strtok($separator); } //Handle the last item in the loop if ($rule instanceof Rule) { $rules->add($userAgent, $rule); } return $rules; }
public static function applyRules($model, $version) { if ($model instanceof Contacts) { $model = Rules::contactRules($model, $version); } else { if ($model instanceof Users) { $model = Rules::userRules($model, $version); } else { if ($model instanceof Opportunity) { $model = Rules::opportunityRules($model, $version); } else { if ($model instanceof Actions) { $model = Rules::actionsRules($model, $version); } else { if ($model instanceof Accounts) { $model = Rules::accountRules($model, $version); } else { if ($model instanceof Profile) { $model = Rules::profileRules($model, $version); } else { } } } } } } return $model; }
public static function getInstance() { if (self::$Instance === null) { self::$Instance = new Rules(); } return self::$Instance; }
public function __construct() { $this->Session = Session::getInstance(); $this->Rules = Rules::getInstance(); $this->Cache = CacheFactory::factory(); $this->tables = Config::read('modules.Session.User.Auth.tables'); $this->auths = array(); }
private function setNextStatesForDeathCellsInNeigbohrOfLiveCells() { $cells = $this->desk->getCells(); foreach ($cells as $cell) { $x = $cell->getX(); $y = $cell->getY(); foreach ($this->desk->getNeigbohrsCoordinates($x, $y) as $coords) { if (!$this->desk->cellExists($coords[0], $coords[1])) { $countOfAliveNeighbors = $this->desk->getCountOfLiveCellsInNeigbohr($coords[0], $coords[1]); $nextStateOfNonExistingCell = $this->rules->getNextState($countOfAliveNeighbors, false); if ($nextStateOfNonExistingCell === true) { $newLiveCell = new \Cell($coords[0], $coords[1], false); $newLiveCell->setNextState($nextStateOfNonExistingCell); $this->desk->addCell($newLiveCell); } } } } }
/** * @inheritdoc */ public function getRules() { $data = $this->data; $rules = new Rules(); foreach ($data->rule as $ruleData) { $rule = new Rule((string) $ruleData->token); $patternIdx = 0; foreach ($ruleData->patterns->pattern as $patternData) { $patternName = "Pattern {$rule->getTokenName()}#{$patternIdx}"; $hasStartToken = false; $potentialStartTokenIdxs = []; $tokens = []; foreach ($patternData->token as $tokenData) { $tokenName = (string) $tokenData; $isStartToken = (bool) $tokenData['is_start_token']; $tokens[] = ['name' => $tokenName, 'is_start_token' => $isStartToken]; if ($isStartToken) { if ($tokenName !== $rule->getTokenName()) { throw new ConfigurationException("{$patternName}: Only {$rule->getTokenName()} tokens can have the 'is_start_token' attribute."); } if ($hasStartToken) { throw new ConfigurationException("{$patternName}: Multiple {$rule->getTokenName()} tokens with 'is_start_token' attribute found. Only one is allowed."); } else { $hasStartToken = true; } } if ($tokenName === $rule->getTokenName()) { $potentialStartTokenIdxs[] = count($tokens) - 1; } } if (!$hasStartToken) { if (count($potentialStartTokenIdxs) === 0) { throw new ConfigurationException("Pattern {$rule->getTokenName()}/#{$patternIdx} must have unambiguous start token. No {$rule->getTokenName()} token found."); } elseif (count($potentialStartTokenIdxs) > 1) { throw new ConfigurationException("Pattern {$rule->getTokenName()}/#{$patternIdx} must have unambiguous start token. Multiple {$rule->getTokenName()} tokens found."); } else { $potentialStartTokenIdx = $potentialStartTokenIdxs[0]; $tokens[$potentialStartTokenIdx]['is_start_token'] = true; } } $pattern = new RulePattern((int) $patternData['probability']); foreach ($tokens as $token) { $pattern->addToken(new RulePatternToken($token['name'], $token['is_start_token'])); } $rule->addPattern($pattern); $patternIdx++; } $rules->addRule($rule); } return $rules; }
/** * returns found value. * this method returns values that maybe invalid. * * @param null|string $key * @return array|string|bool */ public function get($key = null) { if (is_null($key)) { return $this->found; } if (array_key_exists($key, $this->found)) { return $this->found[$key]; } $rules = array_key_exists($key, $this->rules) ? $this->rules[$key] : $this->ruler->withType('text'); $found = $this->find($key, $rules); $valTO = $this->verify->apply($found, $rules); if ($valTO->fails()) { $found = $valTO->getValue(); $message = $valTO->message(); $this->isError($key, $message, $found); if (is_array($found)) { $this->_findClean($found, $message); return $found; } return false; } $this->set($key, $valTO->getValue()); return $valTO->getValue(); }
<?php /* Reformatted 12.11.2015 */ // Helpers and includes include_once '/var/www/html/Lux/Core/Helper.php'; // Create Database Connection $DB = new Db("Inventory"); $OUTPUT = new Output(); // Get Request Data $REQUEST = new Request(); // User needs to be logged in for access $RULES = new Rules(1, "cart"); // Select Collection from Connection $collectionName = Helper::getCollectionName($REQUEST, "Cart"); $collection = $DB->selectCollection($collectionName); // Format Query $query = array("user_id" => $RULES->getId()); // Used for anayltics $LOG = new Logging("OAuth.query"); $LOG->log($RULES->getId(), 72, $query, 100, "OAuth Providers Queried"); // Format Limits (Skip, Limit) $options = Helper::formatLimits($REQUEST); // Find Documents $documents = $collection->find($query, $options); // Output $OUTPUT->success(0, $documents); ?>
<?php /* Reformatted 12.11.2015 */ // Helpers and inludes include_once '/var/www/html/Lux/Core/Helper.php'; // Create Database Connection $DB = new Db("SocialNetwork"); $OUTPUT = new Output(); // get Request Variables $REQUEST = new Request(); // Select Collection From Databse Connection $collectionName = Helper::getCollectionName($REQUEST, "Users"); $collection = $DB->selectCollection($collectionName); // Values which are accepted by the adjustment script $permitted = array("profile_name", "profile_picture", "bio", "images[]"); // Foramt Update and Options $update = Helper::updatePermitted($REQUEST, $permitted); $update = Helper::subDocUpdate($update, "providers.system"); $options = Helper::formatOptions($REQUEST); // Any profile can be changed by an admin, a normal user // can only change their own profile. if ($REQUEST->avail("id")) { $RULES = new Rules(5, "profile"); $document = $collection->findAndModify($REQUEST->get("id"), $update, $options); } else { $RULES = new Rules(1, "profile"); $document = $collection->findAndModify($RULES->getId(), $update, $options); } // Output $OUTPUT->success(0, $document, null);
<?php include_once '/var/www/html/Lux/Core/Helper.php'; $DB = new Db("SocialNetwork"); $OUTPUT = new Output(); $collection = $DB->selectCollection("Notifications"); $REQUEST = new Request(); $RULES = new Rules(1, "social"); $query = array("user_id" => $RULES->getId()); $update = array("status.seen" => 1); $options = Helper::formatLimits($REQUEST); $options["upsert"] = false; $document = $collection->findAndModify($query, $update, $options); $OUTPUT->success(0, $document); ?>
private function getToggleScript(Rules $rules, $cond = NULL) { $s = ''; foreach ($rules->getToggles() as $id => $visible) { $s .= "visible = true; {$cond}element = document.getElementById('" . $id . "');\n\t" . ($visible ? '' : 'visible = !visible; ') . $this->doToggle . "\n\t"; } foreach ($rules as $rule) { if ($rule->type === Rule::CONDITION && is_string($rule->operation)) { $script = $this->getClientScript($rule->control, $rule->operation, $rule->arg); if ($script) { $res = $this->getToggleScript($rule->subRules, $cond . "{$script} visible = visible && " . ($rule->isNegative ? '!' : '') . "res;\n\t"); if ($res) { $el = $rule->control->getControlPrototype(); if ($el->getName() === 'select') { $el->onchange("{$this->toggleFunction}(this)", TRUE); } else { $el->onclick("{$this->toggleFunction}(this)", TRUE); //$el->onkeyup("$this->toggleFunction(this)", TRUE); } $s .= $res; } } } } return $s; }
function music_form($GenreTags) { $QueryID = G::$DB->get_query_id(); $Torrent = $this->Torrent; $IsRemaster = !empty($Torrent['Remastered']); $UnknownRelease = !$this->NewTorrent && $IsRemaster && !$Torrent['RemasterYear']; if ($Torrent['GroupID']) { G::$DB->query(' SELECT ID, RemasterYear, RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber FROM torrents WHERE GroupID = ' . $Torrent['GroupID'] . "\n\t\t\t\t\tAND Remastered = '1'\n\t\t\t\t\tAND RemasterYear != 0\n\t\t\t\tORDER BY RemasterYear DESC,\n\t\t\t\t\tRemasterTitle DESC,\n\t\t\t\t\tRemasterRecordLabel DESC,\n\t\t\t\t\tRemasterCatalogueNumber DESC"); if (G::$DB->has_results()) { $GroupRemasters = G::$DB->to_array(false, MYSQLI_BOTH, false); } } $HasLog = $Torrent['HasLog']; $HasCue = $Torrent['HasCue']; $BadTags = $Torrent['BadTags']; $BadFolders = $Torrent['BadFolders']; $BadFiles = $Torrent['BadFiles']; $CassetteApproved = $Torrent['CassetteApproved']; $LossymasterApproved = $Torrent['LossymasterApproved']; $LossywebApproved = $Torrent['LossywebApproved']; global $ReleaseTypes; ?> <table cellpadding="3" cellspacing="1" border="0" class="layout border<?php if ($this->NewTorrent) { echo ' slice'; } ?> " width="100%"> <?php if ($this->NewTorrent) { ?> <tr id="artist_tr"> <td class="label">Artist(s):</td> <td id="artistfields"> <p id="vawarning" class="hidden">Please use the multiple artists feature rather than adding "Various Artists" as an artist; read <a href="wiki.php?action=article&id=369" target="_blank">this</a> for more information.</p> <?php if (!empty($Torrent['Artists'])) { $FirstArtist = true; foreach ($Torrent['Artists'] as $Importance => $Artists) { foreach ($Artists as $Artist) { ?> <input type="text" id="artist" name="artists[]" size="45" value="<?php echo display_str($Artist['name']); ?> " onblur="CheckVA();"<?php Users::has_autocomplete_enabled('other'); echo $this->Disabled; ?> /> <select id="importance" name="importance[]"<?php echo $this->Disabled; ?> > <option value="1"<?php echo $Importance == '1' ? ' selected="selected"' : ''; ?> >Main</option> <option value="2"<?php echo $Importance == '2' ? ' selected="selected"' : ''; ?> >Guest</option> <option value="4"<?php echo $Importance == '4' ? ' selected="selected"' : ''; ?> >Composer</option> <option value="5"<?php echo $Importance == '5' ? ' selected="selected"' : ''; ?> >Conductor</option> <option value="6"<?php echo $Importance == '6' ? ' selected="selected"' : ''; ?> >DJ / Compiler</option> <option value="3"<?php echo $Importance == '3' ? ' selected="selected"' : ''; ?> >Remixer</option> <option value="7"<?php echo $Importance == '7' ? ' selected="selected"' : ''; ?> >Producer</option> </select> <?php if ($FirstArtist) { if (!$this->DisabledFlag) { ?> <a href="javascript:AddArtistField()" class="brackets">+</a> <a href="javascript:RemoveArtistField()" class="brackets">−</a> <?php } $FirstArtist = false; } ?> <br /> <?php } } } else { ?> <input type="text" id="artist" name="artists[]" size="45" onblur="CheckVA();"<?php Users::has_autocomplete_enabled('other'); echo $this->Disabled; ?> /> <select id="importance" name="importance[]"<?php echo $this->Disabled; ?> > <option value="1">Main</option> <option value="2">Guest</option> <option value="4">Composer</option> <option value="5">Conductor</option> <option value="6">DJ / Compiler</option> <option value="3">Remixer</option> <option value="7">Producer</option> </select> <a href="#" onclick="AddArtistField(); return false;" class="brackets">+</a> <a href="#" onclick="RemoveArtistField(); return false;" class="brackets">−</a> <?php } ?> </td> </tr> <tr id="title_tr"> <td class="label">Album title:</td> <td> <input type="text" id="title" name="title" size="60" value="<?php echo display_str($Torrent['Title']); ?> "<?php echo $this->Disabled; ?> /> <p class="min_padding">Do not include the words remaster, re-issue, MFSL Gold, limited edition, bonus tracks, bonus disc or country-specific information in this field. That belongs in the edition information fields below; see <a href="wiki.php?action=article&id=159" target="_blank">this</a> for further information. Also remember to use the correct capitalization for your upload. See the <a href="wiki.php?action=article&id=317" target="_blank">Capitalization Guidelines</a> for more information.</p> </td> </tr> <tr id="musicbrainz_tr"> <td class="label tooltip" title="Click the "Find Info" button to automatically fill out parts of the upload form by selecting an entry in MusicBrainz">MusicBrainz:</td> <td><input type="button" value="Find Info" id="musicbrainz_button" /></td> </tr> <div id="musicbrainz_popup"> <a href="#null" id="popup_close">x</a> <h1 id="popup_title"></h1> <h2 id="popup_back"></h2> <div id="results1"></div> <div id="results2"></div> </div> <div id="popup_background"></div> <script type="text/javascript"> //<![CDATA[ hide(); if (document.getElementById("categories").disabled == false) { if (navigator.appName == 'Opera') { var useragent = navigator.userAgent; var match = useragent.split('Version/'); var version = parseFloat(match[1]); if (version >= 12.00) { show(); } } else if (navigator.appName != 'Microsoft Internet Explorer') { show(); } } function hide() { document.getElementById("musicbrainz_tr").style.display = "none"; document.getElementById("musicbrainz_popup").style.display = "none"; document.getElementById("popup_background").style.display = "none"; } function show() { document.getElementById("musicbrainz_tr").style.display = ""; document.getElementById("musicbrainz_popup").style.display = ""; document.getElementById("popup_background").style.display = ""; } //]]> </script> <tr id="year_tr"> <td class="label"> <span id="year_label_not_remaster"<?php if ($IsRemaster) { echo ' class="hidden"'; } ?> >Year:</span> <span id="year_label_remaster"<?php if (!$IsRemaster) { echo ' class="hidden"'; } ?> >Year of original release:</span> </td> <td> <p id="yearwarning" class="hidden">You have entered a year for a release which predates the medium's availability. You will need to change the year and enter additional edition information. If this information cannot be provided, check the "Unknown Release" check box below.</p> <input type="text" id="year" name="year" size="5" value="<?php echo display_str($Torrent['Year']); ?> "<?php echo $this->Disabled; ?> onblur="CheckYear();" /> This is the year of the original release. </td> </tr> <tr id="label_tr"> <td class="label">Record label (optional):</td> <td><input type="text" id="record_label" name="record_label" size="40" value="<?php echo display_str($Torrent['RecordLabel']); ?> "<?php echo $this->Disabled; ?> /></td> </tr> <tr id="catalogue_tr"> <td class="label">Catalogue number (optional):</td> <td> <input type="text" id="catalogue_number" name="catalogue_number" size="40" value="<?php echo display_str($Torrent['CatalogueNumber']); ?> "<?php echo $this->Disabled; ?> /> <br /> Please double-check the record label and catalogue number when using MusicBrainz. See <a href="wiki.php?action=article&id=688" target="_blank">this guide</a> for more details. </td> </tr> <tr id="releasetype_tr"> <td class="label"> <span id="releasetype_label">Release type:</span> </td> <td> <select id="releasetype" name="releasetype"<?php echo $this->Disabled; ?> > <option>---</option> <?php foreach ($ReleaseTypes as $Key => $Val) { echo "\t\t\t\t\t\t<option value=\"{$Key}\""; if ($Key == $Torrent['ReleaseType']) { echo ' selected="selected"'; } echo ">{$Val}</option>\n"; } ?> </select> Please take the time to fill this out properly. Need help? Try reading <a href="wiki.php?action=article&id=202" target="_blank">this wiki article</a> or searching <a href="https://musicbrainz.org/search" target="_blank">MusicBrainz</a>. </td> </tr> <?php } ?> <tr> <td class="label">Edition information:</td> <td> <input type="checkbox" id="remaster" name="remaster"<?php if ($IsRemaster) { echo ' checked="checked"'; } ?> onclick="Remaster();<?php if ($this->NewTorrent) { ?> CheckYear();<?php } ?> " /> <label for="remaster">Check this box if this torrent is a different release to the original, for example a limited or country specific edition or a release that includes additional bonus tracks or is a bonus disc.</label> <div id="remaster_true"<?php if (!$IsRemaster) { echo ' class="hidden"'; } ?> > <?php if (check_perms('edit_unknowns') || G::$LoggedUser['ID'] == $Torrent['UserID']) { ?> <br /> <input type="checkbox" id="unknown" name="unknown"<?php if ($UnknownRelease) { echo ' checked="checked"'; } ?> onclick="<?php if ($this->NewTorrent) { ?> CheckYear(); <?php } ?> ToggleUnknown();" /> <label for="unknown">Unknown Release</label> <?php } ?> <br /><br /> <?php if (!empty($GroupRemasters)) { ?> <input type="hidden" id="json_remasters" value="<?php echo display_str(json_encode($GroupRemasters)); ?> " /> <select id="groupremasters" name="groupremasters" onchange="GroupRemaster()"<?php if ($UnknownRelease) { echo ' disabled="disabled"'; } ?> > <option value="">-------</option> <?php $LastLine = ''; foreach ($GroupRemasters as $Index => $Remaster) { $Line = $Remaster['RemasterYear'] . ' / ' . $Remaster['RemasterTitle'] . ' / ' . $Remaster['RemasterRecordLabel'] . ' / ' . $Remaster['RemasterCatalogueNumber']; if ($Line != $LastLine) { $LastLine = $Line; ?> <option value="<?php echo $Index; ?> "<?php echo $Remaster['ID'] == $this->TorrentID ? ' selected="selected"' : ''; ?> ><?php echo $Line; ?> </option> <?php } } ?> </select> <br /> <?php } ?> <table id="edition_information" class="layout border" border="0" width="100%"> <tbody> <tr id="edition_year"> <td class="label">Year (required):</td> <td> <input type="text" id="remaster_year" name="remaster_year" size="5" value="<?php if ($Torrent['RemasterYear']) { echo display_str($Torrent['RemasterYear']); } ?> "<?php if ($UnknownRelease) { echo ' disabled="disabled"'; } ?> /> </td> </tr> <tr id="edition_title"> <td class="label">Title:</td> <td> <input type="text" id="remaster_title" name="remaster_title" size="50" value="<?php echo display_str($Torrent['RemasterTitle']); ?> "<?php if ($UnknownRelease) { echo ' disabled="disabled"'; } ?> /> <p class="min_padding">Title of the release (e.g. <span style="font-style: italic;">"Deluxe Edition" or "Remastered"</span>).</p> </td> </tr> <tr id="edition_record_label"> <td class="label">Record label:</td> <td> <input type="text" id="remaster_record_label" name="remaster_record_label" size="50" value="<?php echo display_str($Torrent['RemasterRecordLabel']); ?> "<?php if ($UnknownRelease) { echo ' disabled="disabled"'; } ?> /> <p class="min_padding">This is for the record label of the <strong>release</strong>. It may differ from the original.</p> </td> </tr> <tr id="edition_catalogue_number"> <td class="label">Catalogue number:</td> <td><input type="text" id="remaster_catalogue_number" name="remaster_catalogue_number" size="50" value="<?php echo display_str($Torrent['RemasterCatalogueNumber']); ?> "<?php if ($UnknownRelease) { echo ' disabled="disabled"'; } ?> /> <p class="min_padding">This is for the catalogue number of the <strong>release</strong>.</p> </td> </tr> </tbody> </table> </div> </td> </tr> <tr> <td class="label">Scene:</td> <td> <input type="checkbox" id="scene" name="scene" <?php if ($Torrent['Scene']) { echo 'checked="checked" '; } ?> /> <label for="scene">Select this only if this is a "scene release".<br />If you ripped it yourself, it is <strong>not</strong> a scene release. If you are not sure, <strong class="important_text">do not</strong> select it; you will be penalized. For information on the scene, visit <a href="https://en.wikipedia.org/wiki/Warez_scene" target="_blank">Wikipedia</a>.</label> </td> </tr> <tr> <td class="label">Format:</td> <td> <select id="format" name="format" onchange="Format()"> <option>---</option> <?php foreach (Misc::display_array($this->Formats) as $Format) { echo "\t\t\t\t\t\t<option value=\"{$Format}\""; if ($Format == $Torrent['Format']) { echo ' selected="selected"'; } echo ">{$Format}</option>\n"; // <option value="$Format" selected="selected">$Format</option> } ?> </select> <span id="format_warning" class="important_text"></span> </td> </tr> <tr id="bitrate_row"> <td class="label">Bitrate:</td> <td> <select id="bitrate" name="bitrate" onchange="Bitrate()"> <option value="">---</option> <?php if ($Torrent['Bitrate'] && !in_array($Torrent['Bitrate'], $this->Bitrates)) { $OtherBitrate = true; if (substr($Torrent['Bitrate'], strlen($Torrent['Bitrate']) - strlen(' (VBR)')) == ' (VBR)') { $Torrent['Bitrate'] = substr($Torrent['Bitrate'], 0, strlen($Torrent['Bitrate']) - 6); $VBR = true; } } else { $OtherBitrate = false; } // See if they're the same bitrate // We have to do this screwery because '(' is a regex character. $SimpleBitrate = explode(' ', $Torrent['Bitrate']); $SimpleBitrate = $SimpleBitrate[0]; foreach (Misc::display_array($this->Bitrates) as $Bitrate) { echo "\t\t\t\t\t\t<option value=\"{$Bitrate}\""; if ($SimpleBitrate && preg_match('/^' . $SimpleBitrate . '.*/', $Bitrate) || $OtherBitrate && $Bitrate == 'Other') { echo ' selected="selected"'; } echo ">{$Bitrate}</option>\n"; } ?> </select> <span id="other_bitrate_span"<?php if (!$OtherBitrate) { echo ' class="hidden"'; } ?> > <input type="text" name="other_bitrate" size="5" id="other_bitrate"<?php if ($OtherBitrate) { echo ' value="' . display_str($Torrent['Bitrate']) . '"'; } ?> onchange="AltBitrate();" /> <input type="checkbox" id="vbr" name="vbr"<?php if (isset($VBR)) { echo ' checked="checked"'; } ?> /><label for="vbr"> (VBR)</label> </span> </td> </tr> <?php if ($this->NewTorrent) { ?> <tr id="upload_logs" class="hidden"> <td class="label"> Log files: </td> <td id="logfields"> Check your log files before uploading <a href="logchecker.php" target="_blank">here</a>. For multi-disc releases, click the "<span class="brackets">+</span>" button to add multiple log files.<br /> <input id="file" type="file" multiple="multiple" name="logfiles[]" size="50" /> <a href="javascript:;" onclick="AddLogField();" class="brackets">+</a> <a href="javascript:;" onclick="RemoveLogField();" class="brackets">−</a> </td> </tr> <?php } if ($this->NewTorrent) { ?> <tr> <td class="label">Multi-format uploader:</td> <td><input type="button" value="+" id="add_format" /><input type="button" style="display: none;" value="-" id="remove_format" /></td> </tr> <tr id="placeholder_row_top"></tr> <tr id="placeholder_row_bottom"></tr> <?php } if (check_perms('torrents_edit_vanityhouse') && $this->NewTorrent) { ?> <tr> <td class="label">Vanity House:</td> <td> <label><input type="checkbox" id="vanity_house" name="vanity_house"<?php if ($Torrent['GroupID']) { echo ' disabled="disabled"'; } if ($Torrent['VanityHouse']) { echo ' checked="checked"'; } ?> /> Check this only if you are submitting your own work or submitting on behalf of the artist, and this is intended to be a Vanity House release. Checking this will also automatically add the group as a recommendation. </label> </td> </tr> <?php } ?> <tr> <td class="label">Media:</td> <td> <select name="media" onchange="CheckYear();" id="media"> <option>---</option> <?php foreach ($this->Media as $Media) { echo "\t\t\t\t\t\t<option value=\"{$Media}\""; if (isset($Torrent['Media']) && $Media == $Torrent['Media']) { echo ' selected="selected"'; } echo ">{$Media}</option>\n"; } ?> </select> </td> </tr> <?php if (!$this->NewTorrent && check_perms('users_mod')) { ?> <tr> <td class="label">Log/cue:</td> <td> <input type="checkbox" id="flac_log" name="flac_log"<?php if ($HasLog) { echo ' checked="checked"'; } ?> /> <label for="flac_log">Check this box if the torrent has, or should have, a log file.</label><br /> <input type="checkbox" id="flac_cue" name="flac_cue"<?php if ($HasCue) { echo ' checked="checked"'; } ?> /> <label for="flac_cue">Check this box if the torrent has, or should have, a cue file.</label><br /> <?php } if ((check_perms('users_mod') || G::$LoggedUser['ID'] == $Torrent['UserID']) && ($Torrent['LogScore'] == 100 || $Torrent['LogScore'] == 99)) { G::$DB->query(' SELECT LogID FROM torrents_logs_new WHERE TorrentID = ' . $this->TorrentID . "\n\t\t\t\t\tAND Log LIKE 'EAC extraction logfile%'\n\t\t\t\t\tAND (Adjusted = '0' OR Adjusted = '')"); list($LogID) = G::$DB->next_record(); if ($LogID) { if (!check_perms('users_mod')) { ?> <tr> <td class="label">Trumpable:</td> <td> <?php } ?> <input type="checkbox" id="make_trumpable" name="make_trumpable"<?php if ($Torrent['LogScore'] == 99) { echo ' checked="checked"'; } ?> /> <label for="make_trumpable">Check this box if you want this torrent to be trumpable (subtracts 1 point).</label> <?php if (!check_perms('users_mod')) { ?> </td> </tr> <?php } } } if (!$this->NewTorrent && check_perms('users_mod')) { ?> </td> </tr> <?php /* if ($HasLog) { ?> <tr> <td class="label">Log score</td> <td><input type="text" name="log_score" size="5" id="log_score" value="<?=display_str($Torrent['LogScore']) ?>" /></td> </tr> <tr> <td class="label">Log adjustment reason</td> <td> <textarea name="adjustment_reason" id="adjustment_reason" cols="60" rows="8"><?=display_str($Torrent['AdjustmentReason']); ?></textarea> <p class="min_padding">Contains reason for adjusting a score. <strong>This field is displayed on the torrent page.</strong></p> </td> </tr> <? }*/ ?> <tr> <td class="label">Bad tags:</td> <td><input type="checkbox" id="bad_tags" name="bad_tags"<?php if ($BadTags) { echo ' checked="checked"'; } ?> /> <label for="bad_tags">Check this box if the torrent has bad tags.</label></td> </tr> <tr> <td class="label">Bad folder names:</td> <td><input type="checkbox" id="bad_folders" name="bad_folders"<?php if ($BadFolders) { echo ' checked="checked"'; } ?> /> <label for="bad_folders">Check this box if the torrent has bad folder names.</label></td> </tr> <tr> <td class="label">Bad file names:</td> <td><input type="checkbox" id="bad_files" name="bad_files"<?php if ($BadFiles) { echo ' checked="checked"'; } ?> /> <label for="bad_files">Check this box if the torrent has bad file names.</label></td> </tr> <tr> <td class="label">Cassette approved:</td> <td><input type="checkbox" id="cassette_approved" name="cassette_approved"<?php if ($CassetteApproved) { echo ' checked="checked"'; } ?> /> <label for="cassette_approved">Check this box if the torrent is an approved cassette rip.</label></td> </tr> <tr> <td class="label">Lossy master approved:</td> <td><input type="checkbox" id="lossymaster_approved" name="lossymaster_approved"<?php if ($LossymasterApproved) { echo ' checked="checked"'; } ?> /> <label for="lossymaster_approved">Check this box if the torrent is an approved lossy master.</label></td> </tr> <tr> <td class="label">Lossy web approved:</td> <td><input type="checkbox" id="lossyweb_approved" name="lossyweb_approved"<?php if ($LossywebApproved) { echo ' checked="checked"'; } ?> /> <label for="lossyweb_approved">Check this box if the torrent is an approved lossy WEB release.</label></td> </tr> <?php } if ($this->NewTorrent) { ?> <tr> <td class="label">Tags:</td> <td> <?php if ($GenreTags) { ?> <select id="genre_tags" name="genre_tags" onchange="add_tag(); return false;"<?php echo $this->Disabled; ?> > <option>---</option> <?php foreach (Misc::display_array($GenreTags) as $Genre) { ?> <option value="<?php echo $Genre; ?> "><?php echo $Genre; ?> </option> <?php } ?> </select> <?php } ?> <input type="text" id="tags" name="tags" size="40" value="<?php echo display_str($Torrent['TagList']); ?> "<?php Users::has_autocomplete_enabled('other'); echo $this->Disabled; ?> /> <br /> <?php Rules::display_site_tag_rules(true); ?> </td> </tr> <tr> <td class="label">Image (optional):</td> <td><input type="text" id="image" name="image" size="60" value="<?php echo display_str($Torrent['Image']); ?> "<?php echo $this->Disabled; ?> /></td> </tr> <tr> <td class="label">Album description:</td> <td> <?php new TEXTAREA_PREVIEW('album_desc', 'album_desc', display_str($Torrent['GroupDescription']), 60, 8, true, true, false, array($this->Disabled)); ?> <p class="min_padding">Contains background information such as album history and maybe a review.</p> </td> </tr> <?php } // if new torrent ?> <tr> <td class="label">Release description (optional):</td> <td> <?php new TEXTAREA_PREVIEW('release_desc', 'release_desc', display_str($Torrent['TorrentDescription']), 60, 8); ?> <p class="min_padding">Contains information like encoder settings or details of the ripping process. <strong class="important_text">Do not paste the ripping log here.</strong></p> </td> </tr> </table> <?php // For AJAX requests (e.g. when changing the type from Music to Applications), // we don't need to include all scripts, but we do need to include the code // that generates previews. It will have to be eval'd after an AJAX request. if ($_SERVER['SCRIPT_NAME'] === '/ajax.php') { TEXTAREA_PREVIEW::JavaScript(false); } G::$DB->set_query_id($QueryID); }
<?php require_once "../../includes/initialize.php"; if (empty($_GET['id'])) { redirect_to("test.php"); } if (isset($_POST['submit1'])) { $rule = new Rules(); $rule->hotel_id = $_GET['id']; $rule->check_in = $_POST['check_in']; $rule->check_out = $_POST['check-out']; $rule->cancel = $_POST['cancel']; $rule->pet = $_POST['pet']; if ($rule->create()) { $message = "Rules created"; } else { $message = "Rueles could not be created"; } } ?> <?php echo output_message($message); ?> <form action="test3.php?id=<?php echo $_GET['id']; ?> " method="post"> <p>Check-in: <input type="text" name="check_in" value=""> </p>
<?php include_once '/var/www/html/Lux/Core/Helper.php'; $DB = new Db("SocialNetwork"); $OUTPUT = new Output(); $collection = $DB->selectCollection("Messages"); $REQUEST = new Request(); $RULES = new Rules(1, "social"); $query = array('root' => '1', array('participants' => $RULES->getId())); $options = Helper::formatLimits($REQUEST); $document = $collection->find($query, $options); $OUTPUT->success(0, $document); ?>
<strong>Before joining the disabled channel, please read our <br /> <span style="color: gold;">Golden Rules</span> which can be found <a style="color: #1464F4;" href="#" onclick="toggle_visibility('golden_rules')">here</a>.</strong> <br /><br /> <script type="text/javascript"> function toggle_visibility(id) { var e = document.getElementById(id); if (e.style.display == 'block') { e.style.display = 'none'; } else { e.style.display = 'block'; } } </script> <div id="golden_rules" class="rule_summary" style="width: 35%; font-weight: bold; display: none; text-align: left;"> <?php Rules::display_golden_rules(); ?> <br /><br /> </div> <p class="strong"> If you do not have access to an IRC client, you can use the WebIRC interface provided below.<br /> Please use your <?php echo SITE_NAME; ?> username. </p> <br /> <form class="confirm_form" name="chat" action="https://mibbit.com/" target="_blank" method="pre"> <input type="text" name="nick" width="20" /> <input type="hidden" name="channel" value="<?php
/** * Makes control mandatory. * @param string error message * @return FormControl provides a fluent interface * @deprecated */ public final function setRequired($message = NULL) { $this->rules->addRule(':Filled', $message); return $this; }
<?php // Helper functions and includs include_once '/var/www/html/Lux/Core/Helper.php'; $db = new Db("Inventory"); $OUTPUT = new Output(); $REQUEST = new Request(); $collection = $db->selectCollection("Cart"); $RULES = new Rules(1, "cart"); $REQUEST = new Request(); // get the asset, push it into the cart that is selected $collectionName = $REQUEST->get("collection", "Standard"); $cartName = $REQUEST->get("wishlist", "Default"); $document = $collection->findAndModify(array("user_id" => $RULES->getId()), array('$push' => array("wishlist." . $cartName => MongoDBRef::create($collectionName, $REQUEST->get("id"), "Assets")))); // Used for analytics $LOG = new Logging("Cart.order"); $LOG->log($RULES->getId(), 43, $REQUEST->get("id"), 100, "User Wished for item"); $OUTPUT->success(0, $document, null);
<?php require_once "bootstrap.php"; require_once "common/classes/rules.class.php"; require_once "common/classes/rulesManagementSet.class.php"; $rules = new Rules($dbDataArr); $rulesManagementSet = new RulesManagementSet($dbDataArr); $resultRules = $rules->getAll(); $resultRms = $rulesManagementSet->getAllNamesByMemberId($_SESSION["memberId"]); // $log->trace(print_r($result_rms, true)); $strRowList = ""; $strRowJS = ""; $arrRowList = array(); while ($row = $resultRules->fetch_array()) { $strRowList .= "<li value=\"" . $row["rulesID"] . "\" title=\"" . $row["rulesID"] . "\" id=\"Rule_" . $row["rulesID"] . "\">" . $row["ruleShortName"] . "</li>\n"; $strRowJS .= "<li value=\\\"" . $row["rulesID"] . "\\\" title=\\\"" . $row["rulesID"] . "\\\" id=\\\"Rule_" . $row["rulesID"] . "\\\">" . $row["ruleShortName"] . "</li>"; $arrRowList[] = '<li value="' . $row["rulesID"] . '" title="' . $row["rulesID"] . '" id="Rule_' . $row["rulesID"] . '">' . $row["ruleShortName"] . '</li>'; } // $strRowJS = "My major Test"; ?> <script language="JavaScript" type="text/javascript" src="/common/js/coordinates.js"></script> <script language="JavaScript" type="text/javascript" src="/common/js/drag.js"></script> <script language="JavaScript" type="text/javascript" src="/common/js/dragdrop.js"></script> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script> function selectrule() { var selectedvalue = document.getElementById("RulesManagementSetListing"); var userId = '1'; document.getElementById("RuleSetTitle").value = selectedvalue.options[selectedvalue.selectedIndex].text;
<?php session_start(); include "common/include/site_setup.php"; include "common/include/db_login.php"; include 'common/classes/BBCORE.php'; include 'common/classes/member.class.php'; include 'common/classes/rules.class.php'; $member = new Member($dbDataArr); $rules = new Rules($dbDataArr); $apiusername = $revere = $_POST['apiusername']; $apipassword = $revere = $_POST['apipassword']; $revere = $_POST['revere']; //print_r($revere); $xml = simplexml_load_string($revere); $urlstring = ""; $REFERRAL = $xml->REFERRAL; $PERSONAL = $xml->CUSTOMER->PERSONAL; $EMPLOYMENT = $xml->CUSTOMER->EMPLOYMENT; $BANK = $xml->CUSTOMER->BANK; $REFERENCES = $xml->CUSTOMER->REFERENCES; $REF = ""; foreach ($REFERENCES as $refa) { foreach ($refa as $refkey) { foreach ($refkey as $key => $value) { if ($value != "") { $REF .= "REF" . strtoupper($key) . "=" . $value . "&"; } } } }
private function importProfile($pieces,$version) { $model=new ProfileChild; $model->fullName=$pieces[0]; $model->username=$pieces[1]; $model->officePhone=$pieces[2]; $model->cellPhone=$pieces[3]; $model->emailAddress=$pieces[4]; $model->notes=$pieces[5]; $model->status=$pieces[6]; $model->tagLine=$pieces[7]; $model->lastUpdated=$pieces[8]; $model->updatedBy=$pieces[9]; $model->allowPost=$pieces[10]; $model->language=$pieces[11]; if($model->language=="") { $model->language="en"; } $model->timeZone=$pieces[12]; $model->resultsPerPage=$pieces[13]; $model->widgets=$pieces[14]; $model->widgetOrder=$pieces[15]; $model->backgroundColor=$pieces[16]; $model->menuBgColor=$pieces[17]; $model->menuTextColor=$pieces[18]; $model->backgroundImg=$pieces[19]; $model->pageOpacity=$pieces[20]; if(isset($pieces[21])) $model->startPage=$pieces[21]; if(isset($pieces[22])) $model->showSocialMedia=$pieces[22]; if(isset($pieces[23])) $model->showDetailView=$pieces[23]; $model=Rules::applyRules($model,$version); if($model->save()) { } else { } }
<?php // Helper functions and includes include_once '/var/www/html/Lux/Core/Helper.php'; $db = new Db("Inventory"); $OUTPUT = new Output(); $REQUEST = new Request(); $collection = $db->selectCollection("Cart"); $RULES = new Rules(1, "cart"); $REQUEST = new Request(); // get the asset, push it into the cart that is selected $collectionName = $REQUEST->get("collection", "Standard"); $cartName = $REQUEST->get("cart", "Default"); $document = $collection->findAndModify(array("user_id" => $RULES->getId()), array('$push' => array("carts." . $cartName => MongoDBRef::create($collectionName, $REQUEST->get("id"), "Assets")))); // Used for analytics $LOG = new Logging("Cart.add"); $LOG->log($RULES->getId(), 41, $REQUEST->get("id"), 100, "User added item to cart"); $OUTPUT->success(0, $document, null);
<?php // Helper functions and includes include_once '/var/www/html/Lux/Core/Helper.php'; $db = new Db("Inventory"); $OUTPUT = new Output(); $REQUEST = new Request(); $cart = $db->selectCollection("Cart"); $orders = $db->selectCollection("Orders"); // Must be logged in to place an order $RULES = new Rules(1, "cart"); $REQUEST = new Request(); // get the asset, push it into the cart that is selected $collectionName = $REQUEST->get("collection", "Standard"); $cartName = $REQUEST->get("cart", "Default"); $old = $cart->findAndModify(array("user_id" => $RULES->getId()), array("cart." . $cartName => []), array('new' => false)); // Criteria for an order $document = $orders->insert(array("user_id" => $RULES->getId(), "items" => $old["cart"][$cartName], "status.shipped" => false, "status.recieved" => false, "status.paid" => false, "status.modified" => false, "status.processed" => false, "status.finalized" => false)); // Used for anayltics $LOG = new Logging("Cart.order"); $LOG->log($RULES->getId(), 42, 2, 100, "User Ordered item"); $OUTPUT->success(0, $document, null);
<?php include_once '/var/www/html/Lux/Core/Helper.php'; $db = new Db("Scoreboard"); $OUTPUT = new Output(); $REQUEST = new Request(); $collection = $db->selectCollection("Users"); $RULES = new Rules(1, "scoreboard"); $REQUEST = new Request(); $quantity = intval($REQUEST->get("quantity", "1")); $asset_id = $REQUEST->get("asset_id"); $document = $collection->findAndModify(array("user_id" => $RULES->getId()), array('$inc' => array("assets." . $asset_id . ".quantity" => $quantity))); $LOG = new Logging("Scoreboard.asset"); $LOG->log($RULES->getId(), 61, $REQUEST->get("asset_id"), $quantity, "User added item to scoreboard Possessions"); $OUTPUT->success(0, $document, null);
httpResponse($user->getStatus()); break; case validateRoute('GET', 'rules'): $rules = new Rules($db); httpResponse($rules->query()); break; case validateRoute('POST', 'rules'): $rules = new Rules($db, $user); httpResponse($rules->create($postdata)); break; case validateRoute('PATCH', 'rules/\\d+'): $rules = new Rules($db, $user); httpResponse($rules->update($params[1], $postdata)); break; case validateRoute('DELETE', 'rules/\\d+'): $rules = new Rules($db, $user); httpResponse($rules->delete($params[1])); break; case validateRoute('GET', 'faq'): $faq = new Faq($db, $user); httpResponse($faq->query()); break; case validateRoute('POST', 'faq'): $faq = new Faq($db, $user); httpResponse($faq->create($postdata)); break; case validateRoute('PATCH', 'faq/\\d+'): $faq = new Faq($db, $user); httpResponse($faq->update($params[1], $postdata)); break; case validateRoute('DELETE', 'faq/\\d+'):
/** * Adds a validation condition based on another control a returns new branch. * @param IFormControl form control * @param mixed condition type * @param mixed optional condition arguments * @return Rules new branch */ public function addConditionOn(IFormControl $control, $operation, $value = NULL) { return $this->rules->addConditionOn($control, $operation, $value); }
<?php //Include the header View::show_header('Tagging rules'); ?> <!-- General Rules --> <div class="thin"> <div class="header"> <h3 id="general">Tagging rules</h3> </div> <div class="box pad rule_summary" style="padding: 10px 10px 10px 20px;"> <?php Rules::display_site_tag_rules(false); ?> </div> <!-- END General Rules --> <?php include 'jump.php'; ?> </div> <?php View::show_footer();
View::show_header('Chat Rules'); ?> <!-- Forum Rules --> <div class="thin"> <div class="box pad" style="padding: 10px 10px 10px 20px;"> <p>Anything not allowed on the forums is also not allowed on IRC and vice versa. They are separated for convenience only.</p> </div> <br /> <h3 id="forums">Forum Rules</h3> <div class="box pad rule_summary" style="padding: 10px 10px 10px 20px;"> <?php Rules::display_forum_rules(); ?> </div> </div> <!-- END Forum Rules --> <!-- IRC Rules --> <div class="thin"> <h3 id="irc">IRC Rules</h3> <div class="box pad rule_summary" style="padding: 10px 10px 10px 20px;"> <?php Rules::display_irc_chat_rules(); ?> </div> <?php include 'jump.php'; ?> </div> <?php View::show_footer();
<?php /* Reformatted 12.11.2015 */ // helpers nad includes include_once '/var/www/html/Lux/Core/Helper.php'; // Create Database Connection $db = new Db("SocialNetwork"); $OUTPUT = new Output(); // Get Request Data $REQUEST = new Request(); // No privleges Required $RULES = new Rules(0, "profile"); // Selects collection from Database Connection $collectionName = Helper::getCollectionName($REQUEST, "Groups"); $collection = $db->selectCollection($collectionName); // Format Query $query = Helper::formatQuery($REQUEST, "group_id"); // Used for anayltics $LOG = new Logging("Groups.query"); $LOG->log($RULES->getId(), 72, $query, 100, "Groups Queried"); // Find Documents in Collection $documents = $collection->find($query); // Output $OUTPUT->success(1, $documents); ?>
protected static function processAlias($alias) { if (file_exists('surls_functions.php')) { require 'surls_functions.php'; } $redirect_rules = Rules::GetRedirectRules(); if (isset($redirect_rules[$alias]) && "true" == $redirect_rules[$alias]['enabled']) { if (function_exists("surls_handler_{$alias}")) { call_user_func("surls_handler_{$alias}"); } else { header("Location: {$redirect_rules[$alias]['url']}", true, $redirect_rules[$alias]['http_status_code']); } } else { http_response_code(404); echo '<h1>404 Not Found</h1>'; } }