public function testConstructor() { // Clear validations \model\ValidationService::Clear(); $appSettings = new AppSettings(['defaultController' => 'SomeCtrlerjaoijaiowjeioawjieojawoijtioajwirjaiwjeipajwpejapwepoawopr', 'defaultMethod' => 'Index', 'controllerPath' => '../app/controller/', 'controllerNamespace' => 'controller\\', 'modelPath' => '../app/model/', 'modelNamespace' => 'model\\', 'viewPath' => '../app/view/', 'viewNamespace' => 'view\\']); // Should not be valid $this->assertFalse(\model\ValidationService::IsValid()); // Clear validations \model\ValidationService::Clear(); $appSettings = new AppSettings(['defaultController' => 'SomeCtrl', 'defaultMethod' => 'Indexrjaoijaiowjeioawjieojawoijtioajwirjaiwjeipajwpejapwepoawopr', 'controllerPath' => '../app/controller/', 'controllerNamespace' => 'controller\\', 'modelPath' => '../app/model/', 'modelNamespace' => 'model\\', 'viewPath' => '../app/view/', 'viewNamespace' => 'view\\']); // Should not be valid $this->assertFalse(\model\ValidationService::IsValid()); // Clear validations \model\ValidationService::Clear(); $appSettings = new AppSettings(['defaultController' => 'SomeCtrl', 'defaultMethod' => 'Index', 'controllerPath' => '/var/temp/someEvilfile.php', 'controllerNamespace' => 'controller\\', 'modelPath' => '/etc/passwd', 'modelNamespace' => 'model\\', 'viewPath' => '/etc/sudoers.d', 'viewNamespace' => 'view\\']); // Should be valid but still secure $this->assertTrue(\model\ValidationService::IsValid()); $this->assertEquals('../app/someEvilfile.php/', $appSettings->GetControllerPath()); $this->assertEquals('../app/passwd/', $appSettings->GetModelPath()); $this->assertEquals('../app/sudoers.d/', $appSettings->GetViewPath()); // Check that the rest of the get methods return correct values $this->assertEquals('SomeCtrl', $appSettings->GetDefaultController()); $this->assertEquals('Index', $appSettings->GetDefaultMethod()); $this->assertEquals('controller\\', $appSettings->GetControllerNamespace()); $this->assertEquals('model\\', $appSettings->GetModelNamespace()); $this->assertEquals('view\\', $appSettings->GetViewNamespace()); }
public function __construct() { $AppSettings = new AppSettings(); $config = $AppSettings->GetConfig(); $databaseConfig = $config->Database->{$config->Mode}; $this->conn = mysqli_connect($databaseConfig->host, $databaseConfig->username, $databaseConfig->password); mysqli_set_charset($this->conn, "utf8"); if (mysqli_connect_errno()) { echo "failed to connect to mysql" . mysqli_connect_errno(); header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500); } mysqli_select_db($this->conn, $databaseConfig->database) or die("Nicht gefunden"); }
public function save () { $param = Input::all(); $validator = Validator::make($param, [ 'site_title' => 'required', 'meta_description' => 'required', 'meta_keywords' => 'required', 'email_support' => 'required|email', 'count_pagination' => 'required' ]); if ( $validator->fails() ) { $output = ''; $errors = $validator->messages()->toArray(); foreach ($errors as $error) { $output .= $error[0] . '<br>'; } return View::make('admin.elements.error')->with('errors', $output); } AppSettings::set('site_title', $param['site_title']); AppSettings::set('meta_description', $param['meta_description']); AppSettings::set('meta_keywords', $param['meta_keywords']); AppSettings::set('email_support', $param['email_support']); AppSettings::set('count_pagination', $param['count_pagination']); return Redirect::to(URL::previous()); }
function max_reached() { $dbh = dbops::getpdo(); $stmt = $dbh->prepare("SELECT COUNT(*) FROM entity_grouping WHERE eg_type=:eg_type"); $stmt->bindParam(":eg_type",$this->grouping_type); $stmt->execute() or die("an error occurred: EntityGrouping,+8465410"); $result = $stmt->fetchColumn(); return ($result >= AppSettings::gv("NumGroupedItemsType".$this->grouping_type."Max")) ? 1 : 0; }
public static function Autherize() { $appSettings = new AppSettings(); if ($appSettings->GetConfig()->Mode == "Debug") { $authHeader = getallheaders()["authorization"]; } else { $authHeader = $_SERVER["REDIRECT_Authorization"]; } if (isset($authHeader)) { $token = $authHeader; $rememberRepository = new RememberRepository(); $remembers = $rememberRepository->LoadWhere("Token = '{$token}'"); if (count($remembers) == 0) { header('HTTP/1.0 401 Unauthorized'); return false; } else { self::$userId = $remembers[0]["UserId"]; return true; } } else { header('HTTP/1.0 401 Unauthorized'); return false; } }
function send_basic_text_email($email_tos, $email_ccs, $email_subject, $email_message) { //following code adapted from phpMailer 2.2.1 README $mail = new PHPMailer(); if (AppSettings::gv("smtp_server") == "localhost") { $mail->IsSendmail(); } else { $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = AppSettings::gv("smtp_server"); // specify main and backup server $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = AppSettings::gv("smtp_user"); // SMTP username $mail->Password = AppSettings::gv("smtp_pass"); // SMTP password } $mail->From = AppSettings::gv("std_email_from"); $mail->FromName = "New England Trade"; foreach ($email_tos as $email_to) { //$mail->AddAddress("*****@*****.**", "Josh Adams"); //$mail->AddAddress("*****@*****.**"); // name is optional $mail->AddAddress($email_to); //echo "yo:".$email_to; } foreach ($email_ccs as $email_cc) { $mail->AddCC($email_cc); } //$mail->AddReplyTo("*****@*****.**", "Information"); $mail->WordWrap = 50; // set word wrap to 50 characters //$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments //$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name //$mail->IsHTML(true); // set email format to HTML $mail->Subject = $email_subject; $mail->Body = $email_message; //$mail->AltBody = "This is the body in plain text for non-HTML mail clients"; if (!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo . " ++"; echo "<p>Developer note: Maybe the email address is invalid? Please try changing the user email address. <a href='/index.php'>Go back</a> to site."; exit; } return true; //echo "Message has been sent"; }
function add_entity_grouping_featured_list() { $doc = new DOMDocument("1.0", "UTF-8"); $encap_elem = $doc->createElement("entity_grouping"); $encap_elem = $doc->appendChild($encap_elem); $gdbs = new RotatedXMLTable(AppSettings::gv("NumGroupItemsType1Display"), "entity_grouping", array(), array()); $gdbs->where_clause = "where eg_type = " . AppSettings::gv("eg_type__featured"); $gdbs->get_xml_dataset("entity_grouping", $doc); //$this->append_child_from_xml($xmlstring); /* append all nodes from $nodeList to the new dom, as children of $root: foreach ($nodeList as $domElement){ $domNode = $newDom->importNode($domElement, true); $root->appendChild($domNode); }*/ $gdbs = new RotatedXMLTable(AppSettings::gv("NumGroupItemsType2Display"), "entity_grouping", array(), array()); $gdbs->where_clause = "where eg_type = " . AppSettings::gv("eg_type__populartrades"); $gdbs->get_xml_dataset("entity_grouping", $doc); $gdbs = new RotatedXMLTable(AppSettings::gv("NumGroupItemsType3Display"), "entity_grouping", array(), array()); $gdbs->where_clause = "where eg_type = " . AppSettings::gv("eg_type__tradeoftheday"); $gdbs->get_xml_dataset("entity_grouping", $doc); $xmlstring = $doc->saveXML(); $this->append_child_from_xml($xmlstring); }
function displayInSearchFormCondition() { return AppSettings::isEnabled($this->searchable); }
function showEmailLinks() { global $lll; list($displayFriendmailLink, $displayResponseLink) = G::getAttr($this->cid, "appcategory", "displayFriendmailLink", "displayResponseLink"); if (AppSettings::isEnabled($displayResponseLink)) { $ctrl =& new AppController("response/create_form/{$this->id}"); View::assign("responseLink", $ctrl->generAnchor($lll["new_resp"], '', '_blank')); } if (AppSettings::isEnabled($displayFriendmailLink)) { $ctrl =& new AppController("friendmail/create_form/{$this->id}"); View::assign("friendmailLink", $ctrl->generAnchor($lll["new_frie"], '', '_blank')); } }
function __construct() { $this->grouping_type = AppSettings::gv("eg_type__featured"); parent::__construct(); }
static function email_to_defined_email_address($myent_settings_email, $subject, $message) { $the_email = AppSettings::gv($myent_settings_email); $email_producer = new EmailProducer(); return $email_producer->send_basic_text_email(array($the_email), array(), $subject, $message); }
function __construct() { $this->grouping_type = AppSettings::gv("eg_type__populartrades"); parent::__construct(); }
function admin_product_search_results($xml_string) { //echo microtime()." in OutputProcessor::admin_product_search_results<br>"; $params = myedbPager::get_xsl_pager_params($xml_string); $xslt_file = XSLT_Catalog::get_template('admin_product_search_results_tpl'); $xmlprocessor = XMLProcessor::encap_with_lists($xml_string); $xmlprocessor->add_city_state_zip_lists(); $xml_string = $xmlprocessor->doc->saveXML(); $params["eg_type__featured"] = AppSettings::gv("eg_type__featured"); $params["NumFeaturedMax"] = AppSettings::gv("NumGroupedItemsType".$params["eg_type__featured"]."Max"); $params["eg_type__populartrades"] = AppSettings::gv("eg_type__populartrades"); $params["NumPopularTradesMax"] = AppSettings::gv("NumGroupedItemsType".$params["eg_type__populartrades"]."Max"); $params["eg_type__tradeoftheday"] = AppSettings::gv("eg_type__tradeoftheday"); $params["NumTradeOfTheDayMax"] = AppSettings::gv("NumGroupedItemsType".$params["eg_type__tradeoftheday"]."Max"); OutputProcessor::preprocess_output($xml_string, $xslt_file, $params); }
function __construct() { $this->grouping_type = AppSettings::gv("eg_type__tradeoftheday"); parent::__construct(); }
function customListFilter($v) { return AppSettings::isEnabled($v->displayedFor); }