/**
  * The application contains a lot of secure URLs which shouldn't be
  * publicly accessible. This tests ensures that whenever a user tries to
  * access one of those pages, a redirection to the login form is performed.
  *
  * @dataProvider getDatas
  */
 public function testCreate($datas)
 {
     $em = $this->container->get('doctrine.orm.entity_manager');
     $user = $em->getRepository("BackBundle:User")->findOneByPseudo("djscrave");
     $formData = array('title' => $datas, 'price' => 23.55, 'ref' => "BB-5555-A", 'city' => "Paris", 'cp' => "75002", 'address' => "12 rue Mandar", 'country' => "France", 'type' => "apt", 'energyLabel' => "A", 'surface' => 25, 'nbrooms' => 2, 'bedrooms' => 3, 'pricePerMeterSquare' => 100, 'content' => "Description de mon appartement", 'activate' => true, 'user' => $user);
     $announcement = new Announcement();
     $announcement->setTitle($formData['title']);
     $announcement->setPrice((double) $formData['price']);
     $announcement->setRef($formData['ref']);
     $announcement->setAddress($formData['address']);
     $announcement->setCity($formData['city']);
     $announcement->setCp($formData['cp']);
     $announcement->setContent($formData['content']);
     $announcement->setCountry($formData['country']);
     $announcement->setType($formData['type']);
     $announcement->setEnergyLabel($formData['energyLabel']);
     $announcement->setNbrooms((int) $formData['nbrooms']);
     $announcement->setBedrooms((int) $formData['bedrooms']);
     $announcement->setSurface($formData['surface']);
     $announcement->setPricePerMeterSquare((double) $formData['pricePerMeterSquare']);
     $announcement->setActivate($formData['activate']);
     $announcement->setUser($formData['user']);
     $em->persist($announcement);
     $em->flush();
     $this->assertEquals($datas, $announcement->getTitle());
     $announcement = $em->getRepository("BackBundle:Announcement")->findOneByTitle($datas);
     $announcement->setTitle("New B");
     $em->persist($announcement);
     $em->flush();
     $this->assertEquals("New B", $announcement->getTitle());
     $em->remove($announcement);
     $em->flush();
     $announcement = $em->getRepository("BackBundle:Announcement")->findOneByTitle("New B");
     $this->assertEquals(null, $announcement);
 }
Пример #2
0
 public function postTweet($status)
 {
     Codebird::setConsumerKey($this->container->getParameter('hm_twitterApiKey'), $this->container->getParameter('hm_twitterApiSecret'));
     $cb = Codebird::getInstance();
     $cb->setToken($this->container->getParameter('hm_twitterApiToken'), $this->container->getParameter('hm_twitterApiTokenSecret'));
     $reply = $cb->statuses_update('status=' . $status);
     return $reply;
 }
 protected function getLegacyKernel()
 {
     if (!isset($this->legacyKernelClosure)) {
         $this->legacyKernelClosure = $this->container->get('ezpublish_legacy.kernel');
     }
     $legacyKernelClosure = $this->legacyKernelClosure;
     return $legacyKernelClosure();
 }
 /**
  * Execute
  */
 public function testExecute()
 {
     $application = new Application();
     $application->add($this->container->get('announcement_command'));
     $command = $application->find('notifications:purge');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName()));
     $this->assertRegExp('/Terminé|affect/', $commandTester->getDisplay());
 }
 /**
  * @test
  * @group test_factory
  **/
 public function プラグイン生成テスト()
 {
     $manager = new Midnight\Crawler\PluginManager();
     $names = $manager->getEnablePluginNames();
     foreach ($names as $name) {
         $plugin = $this->container->get($name);
         $instance_name = 'Midnight\\Crawler\\Plugin\\TestData\\' . $name . 'TestData';
         $this->assertInstanceOf($instance_name, $plugin);
     }
 }
Пример #6
0
 /**
  * {@inheritdoc}
  */
 public function validate($value, Constraint $constraint)
 {
     // if recaptcha is disabled, always valid
     if (!$this->container->getParameter("vihuvac_recaptcha.enabled")) {
         return true;
     }
     // define variables for recaptcha check answer
     $secretKey = $this->container->getParameter("vihuvac_recaptcha.secret_key");
     $remoteip = $this->container->get("request_stack")->getCurrentRequest()->server->get("REMOTE_ADDR");
     $response = $this->container->get("request_stack")->getCurrentRequest()->get("g-recaptcha-response");
     if (!$this->checkAnswer($secretKey, $remoteip, $response)) {
         $this->context->addViolation($constraint->message);
     }
 }
Пример #7
0
 protected function checkMethods()
 {
     if ($this->container->getEnvironment() == "prod") {
         return $this->getMethodsCache();
     }
     $config = $this->createMethodsCache();
     return $config;
 }
 /**
  * Get the translated field from a content object
  * 
  * @param \eZ\Publish\Core\Repository\Values\Content\Content $content
  * @param string $fieldIdentifier
  * @return \eZ\Publish\API\Repository\Values\Content\Field
  */
 protected function getTranslatedContentFieldValue( $content, $fieldIdentifier )
 {
     $translationHelper = $this->container->get( 'ezpublish.translation_helper' );
     $field = $translationHelper->getTranslatedField( $content, $fieldIdentifier );
     if( $field instanceof Field )
     {
         return $field->value;
     }
     return false;
 }
Пример #9
0
 function deleteIn($loc)
 {
     global $user;
     if ($user && $user->is_acting_admin == 1) {
         include_once BASE . 'framework/core/models-1/container.php';
         global $db;
         $containers = $db->selectObjects('container', "external='" . serialize($loc) . "'");
         foreach ($containers as $container) {
             container::delete($container);
             $db->delete('container', 'id=' . $container->id);
         }
     }
 }
Пример #10
0
 private function getRoutingConfig()
 {
     $file = 'route/routing.php';
     if ($this->container->getEnvironment() == "prod") {
         if (\FileCache::isExist($file)) {
             return \FileCache::get($file);
         }
     }
     $sources = \Config::get('routing::source');
     $routings = [];
     foreach ($sources as $source) {
         $routing = (include_once "src/{$source}/routing.php");
         if ($routing) {
             $routings = array_merge($routings, $routing);
         }
     }
     \FileCache::set($file, $routings);
     return $routings;
 }
 function _LinksList()
 {
     $ret_val = new container();
     $div = html_div("medium-text");
     $div->add(html_br(2));
     $link = $this->getViewVariable('arr_links');
     if (is_array($link) && $link[0]['link.link_id']) {
         $ul = html_ul();
         $countLink = count($link);
         for ($i = 0; $i < $countLink; $i++) {
             $elem = container();
             Debug::oneVar($link);
             $elem->add(html_a($link[$i]["link.link_url"], $link[$i]["link.link_name"], null, "_blank"));
             $elem->add(html_a(Util::format_URLPath("links/index.php", "link_id=" . $link[$i]["link.link_id"] . "&amp;action=invalid"), "[" . agt("Enlace_roto") . "]", null, _top));
             $elem->add(html_a(Util::format_URLPath("links/index.php", "link_id=" . $link[$i]["link.link_id"] . "&amp;action=delete"), "[" . agt("Eliminar") . "]", null, _top));
             $elem->add(html_br());
             $elem->add($link[$i]["link.link_description"]);
             $ul->add($elem);
         }
         $div->add($ul);
         $div->add(html_a(Util::format_URLPath("links/index.php", "action=insert"), "[" . agt("insertar") . "]", null, _top));
         $ret_val->add($div);
     }
     return $ret_val;
 }
 function _courseList()
 {
     $ret_val = new container();
     $div = html_div("medium-text");
     $div->add(html_br(2));
     $course = $this->getViewVariable('arr_courses');
     if (is_array($course) && $course[0]['course_id']) {
         $ul = html_ul();
         $countCourse = count($course);
         for ($i = 0; $i < $countCourse; $i++) {
             $elem = container();
             $elem->add(html_a(Util::format_URLPath("course/index.php", "course=" . $course[$i]["course_id"]), $course[$i]["course_name"], null, "_top"));
             $elem->add(html_br());
             $elem->add($course[$i]["course_description"]);
             $ul->add($elem);
         }
         $div->add($ul);
         $ret_val->add($div);
     }
     return $ret_val;
 }
Пример #13
0
<?php

include 'controller/container.php';
include 'include/header.php';
$id = $_SESSION['userid'];
$obj = new container();
?>
 <head>
<script>
function validateForm()
{
var a=document.forms["form2"]["id"].value;
var x=document.forms["form2"]["addressone"].value;
var y=document.forms["form2"]["addresstwo"].value;
var z=document.forms["form2"]["city"].value;
var q=document.forms["form2"]["state"].value;
var w=document.forms["form2"]["postal_code"].value;
var e=document.forms["form2"]["phone"].value;
if (a==null ||a=="" || x==null || x=="" || y==null || y=="" || z==null 
|| z=="" || q==null || q=="" ||  w==null || w=="" || e==null || e=="")
{
alert("Please fill all the inputs");
return false;
}
else{
	$.post("controller/value.php", {id: a,addressone: x, addresstwo: y,city: z,state: q,postal_code: w,phone: e},
   function(data) {
	//alert("Data Loaded: " + data);
	var form = document.forms['form2'];
	var elements = form.elements;
	for (var i = 0, len = elements.length; i < len; ++i) {
 function icon_link($path_action, $path_img, $text, $class, $width = null, $height = null, $border = null)
 {
     $container = new container();
     //html_div();
     //$container->set_tag_attribute('valign', 'center');
     $icon_link = html_a($path_action, "");
     $icon_link->add(html_img($path_img, $width, $height, $border));
     $container->add($icon_link);
     $container->add(html_a($path_action, $text, $class));
     return $container;
 }
Пример #15
0
<?php

include 'include/header.php';
include 'controller/container.php';
$obj = new container();
?>

<div class="main-container inner"><!-- start: PAGE -->
	<div class="main-content">
		<div class="container">
			<div class="row">
				<div class="col-sm-12"><!-- start: FORM WIZARD PANEL -->
					<div class="panel panel-white">
						<div class="row">
							<div class="col-md-12" style="text-align:center;"><br/> <br/> <br/>
								<b><h1>MY LOGIN HISTORY</h1></b>
							</div>
						</div>
						<div class="panel-body">
							<div class="row">
								<div class="col-md-2"></div>
								<div class="col-md-8">
									<div class="table-responsive">
										<table class="table table-bordered  table-hover" id="sample-table-1" style="height: 10px;">
											<thead>
												<tr class="info">
													<th>Date</th>
													<th>IP Address</th>
													<th>Used 2FA</th>
												</tr>
											</thead>
Пример #16
0
 /**
  * Sett opp triggers hos brukeren
  */
 public function link_triggers()
 {
     if ($this->active) {
         // hent triggere kun for det aktive oppdraget
         $type = "active";
         $oppdrag = array($this->active);
     } else {
         if (!$this->oppdrag_loaded) {
             $this->user_load_all();
             return;
         }
         // kontroller at det ikke er satt noen params
         if ($this->up->params->exists("oppdrag")) {
             // fjern fra params
             $this->up->params->lock();
             $this->up->params->remove("oppdrag_id");
             $this->up->params->remove("oppdrag", true);
         }
         $type = "unlock";
         $oppdrag = $this->oppdrag;
     }
     // hvilke triggere skal være tilgjengelige nå?
     $triggers = new container();
     // gå gjennom oppdragene og sett opp triggerinformasjonen
     foreach ($oppdrag as $row) {
         // ingen triggere?
         if ($row['uo_locked'] == 0 && $row['uo_active'] == 0) {
             continue;
         }
         $o_params = $type == "active" ? $row['o_params'] : $row['o_unlock_params'];
         $o_params_object = $type == "active" ? $this->params[$row['o_id']]['o_params'] : $this->params[$row['o_id']]['o_unlock_params'];
         $uo_params = $row['uo_params'];
         // mangler navn?
         $name = $o_params_object->get("name");
         if (empty($name)) {
             continue;
         }
         $trigger = array($name, $row['o_id'], $o_params, $type, $uo_params);
         $triggers->items[] = $trigger;
     }
     // endringer?
     $data = $triggers->build();
     if ($this->up->params->get("oppdrag_triggers") !== $data) {
         // aktiv?
         if ($this->active) {
             $params = new params();
             $params->params = $this->active;
             $this->up->params->lock();
             $this->up->params->update("oppdrag", $params->build());
             $this->up->params->update("oppdrag_id", $this->active['o_id'], true);
         }
         $this->up->params->update("oppdrag_triggers", $data, true);
     }
     $this->load_triggers($triggers);
 }
Пример #17
0
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
if (!defined('EXPONENT')) {
    exit('');
}
$container = null;
if (isset($_GET['id'])) {
    $container = $db->selectObject('container', 'id=' . intval($_GET['id']));
}
if ($container != null) {
    $iloc = unserialize($container->internal);
    $cloc = unserialize($container->external);
    $cloc->int = $container->id;
    if (exponent_permissions_check('delete_module', $loc) || exponent_permissions_check('delete_module', $cloc) || exponent_permissions_check('administrate', $iloc)) {
        container::delete($container, isset($_GET['rerank']) ? 1 : 0);
        $db->delete('container', 'id=' . $container->id);
        if (isset($_SESSION['containers_cache'])) {
            unset($_SESSION['containers_cache']);
        }
        // Check to see if its the last reference
        $locref = $db->selectObject('locationref', "module='" . $iloc->mod . "' AND source='" . $iloc->src . "' AND internal='" . $iloc->int . "'");
        if ($locref->refcount == 0 && exponent_permissions_check('administrate', $iloc) && call_user_func(array($iloc->mod, 'hasContent')) == 1) {
            $template = new template('ContainerModule', '_lastreferencedelete', $loc);
            $template->assign('iloc', $iloc);
            $template->assign('redirect', exponent_flow_get());
            $template->output();
        } else {
            exponent_flow_redirect();
        }
    } else {
Пример #18
0
    exit("");
}
$container = null;
$iloc = null;
$cloc = null;
if (isset($_POST['id'])) {
    $container = $db->selectObject("container", "id=" . intval($_POST['id']));
}
if ($container != null) {
    $iloc = unserialize($container->internal);
    $loc = unserialize($container->external);
    $cloc = unserialize($container->external);
    $cloc->int = $container->id;
}
if (exponent_permissions_check("add_module", $loc) || $iloc != null && exponent_permissions_check("administrate", $iloc) || $cloc != null && exponent_permissions_check("edit_module", $cloc)) {
    $container = container::update($_POST, $container, $loc);
    if (isset($container->id)) {
        $db->updateObject($container, "container");
    } else {
        $db->insertObject($container, "container");
    }
    if ($container->is_existing == 0) {
        $iloc = unserialize($container->internal);
        $locref = $db->selectObject("locationref", "module='" . $iloc->mod . "' AND source='" . $iloc->src . "'");
        $locref->description = isset($_POST['description']) ? $_POST['description'] : '';
        $db->updateObject($locref, "locationref", "module='" . $iloc->mod . "' AND source='" . $iloc->src . "'");
    }
    if (isset($_SESSION['containers_cache'])) {
        unset($_SESSION['containers_cache']);
    }
    exponent_flow_redirect();
Пример #19
0
<?php

include 'include/header.php';
include 'controller/container.php';
$obj = new container();
?>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
function SubmitForm() {
var str=true;
var firstname = $("#user_first_name").val();
var lastname = $("#user_last_name").val();
var email = $("#user_email").val();
var country = $("#country").val();
var password = $("#password_again").val();
if(firstname=="")
{
//document.getElementById("user_first_name").innerHTML="Please enter your first name";
return false;
}
else if
(lastname=="")
{
//document.getElementById("user_last_name").innerHTML="Please enter last name";
return false;
}
else if(email=="")
{
//document.getElementById("user_email").innerHTML="Please enter password";
return false;
}
 function _courseList($isGuest)
 {
     $ret_val = new container();
     $div = html_div("medium-text");
     $course = $this->getViewVariable('arr_courses');
     if (is_array($course) && $course[0]['course_id']) {
         $ul = html_ul();
         $countCourse = count($course);
         for ($i = 0; $i < $countCourse; $i++) {
             $elem = container();
             $elem->add(html_a(Util::format_URLPath("course/index.php", "course=" . $course[$i]["course_id"]), $course[$i]["course_name"], null, "_top"));
             $elem->add(html_br());
             $elem->add($course[$i]["course_description"]);
             $elem->add(html_br());
             if (!$isGuest) {
                 if (!$course[$i]["course_isRegister"]) {
                     $elem->add(html_a(Util::format_URLPath("subscribe/index.php", "course_id=" . $course[$i]["course_id"]), agt('miguel_subscribe'), null, '_top'));
                 } else {
                     $elem->add(html_a(Util::format_URLPath("unsubscribe/index.php", "course_id=" . $course[$i]["course_id"]), agt('miguel_unsubscribe'), null, '_top'));
                 }
             }
             $ul->add($elem);
         }
         $div->add($ul);
         $ret_val->add($div);
     }
     return $ret_val;
 }
Пример #21
0
 /**
  * Marker forumet som sett
  */
 public function forum_seen()
 {
     $this->params_load();
     $container = new container($this->params_user->get("forums"));
     foreach ($container->items as $key => $row) {
         if ($row[0] != "ff") {
             continue;
         }
         if ($row[1] != $this->ff->id) {
             continue;
         }
         // må oppdatere antallet?
         if (isset($row[4]) && $row[4] > 0) {
             $this->params_user->lock();
             $forums = $this->params_user->get("forums");
             $container = new container($forums);
             foreach ($container->items as $key => $row) {
                 if ($row[0] != "ff" || $row[1] != $this->ff->id) {
                     continue;
                 }
                 // fjern antallet og lagre
                 unset($container->items[$key][4]);
                 $this->params_user->update("forums", $container->build());
                 $this->params_user->commit();
                 return true;
             }
             $this->params_user->commit();
             return NULL;
         }
         return false;
     }
     return NULL;
 }
Пример #22
0
<?php

include 'include/header.php';
include 'controller/container.php';
$obj = new container();
include 'include/trading-api.php';
$poloniex = new poloniex('AU04SSJF-RGA9O99O-5LN3ZG39-01W6ZZ4Z', '771e542c64fcdd441b10aa9af58f4a8748db848c0d1d254d63e639683fad41b342bbb2bbf7c96042511e2967a3dbddd67a2afd109fb1845fc3c2e1df2d16e2a3');
?>
<script>
function calculate() {
	var sllimit = document.getElementById('sllimit').value;	
	var slamount = document.getElementById('slamount').value;
	var result = document.getElementById('sltotal');	
	var myResult = sllimit * slamount;
	result.value = myResult;
}
$( document ).ready(function() {
	$('#buyamount').on('keyup',function(){
		var per = $('#buyamount').val() * 0.2/100;
		$('#buypercent').val(per);
		var total = $('#buyprice').val() * this.value;
		$('#buytotal').val(total);
	});

	$('#sellamount').on('keyup',function(){
		var total = $('#sellprice').val() * this.value;
		$('#selltotal').val(total);
		var sellper = total * 0.2/100;
		$('#sellpercent').val(sellper);
	});
});
Пример #23
0
 /**
  * used to create containers for new modules
  * @global db the exponent database object
  * @param  $iloc
  * @param  $m
  * @param bool $linked
  * @return void
  */
 private function add_container($iloc, $m, $linked = false)
 {
     global $db;
     if ($iloc->mod != 'contactmodule') {
         $iloc->mod = $this->new_modules[$iloc->mod];
         $m->internal = isset($m->internal) && strstr($m->internal, "Controller") ? $m->internal : serialize($iloc);
         $m->action = isset($m->action) ? $m->action : 'showall';
         $m->view = isset($m->view) ? $m->view : 'showall';
         if ($m->view == "Default") {
             $m->view = 'showall';
         }
     } else {
         // must be an old school contactmodule
         $iloc->mod = $this->new_modules[$iloc->mod];
         $m->internal = serialize($iloc);
     }
     if ($linked) {
         $newconfig = new expConfig();
         $config['aggregate'] = array($iloc->src);
         $newconfig->config = $config;
         $newmodule['i_mod'] = $iloc->mod;
         $newmodule['modcntrol'] = $iloc->mod;
         $newmodule['rank'] = $m->rank;
         $newmodule['views'] = $m->view;
         $newmodule['title'] = $m->title;
         $newmodule['actions'] = $m->action;
         $_POST['current_section'] = 1;
         $m = container::update($newmodule, $m, expUnserialize($m->external));
         $newmodinternal = expUnserialize($m->internal);
         $newmod = explode("Controller", $newmodinternal->mod);
         $newmodinternal->mod = $newmod[0];
         $newconfig->location_data = $newmodinternal;
         $newconfig->save();
     }
     $db->insertObject($m, 'container');
 }
Пример #24
0
 public function logoutAction()
 {
     $sessionUser = new container('user');
     $sessionUser->offsetUnset("connected");
     $sessionUser->offsetUnset("id");
     $sessionUser->offsetUnset("username");
     $sessionUser->offsetUnset("wantTutorial");
     $sessionUser->offsetUnset("wantNotifications");
     // Comming from the TutorialController.
     if (isset($sessionUser->isProjectsPageAlreadyAccessed)) {
         $sessionUser->offsetUnset("isProjectsPageAlreadyAccessed");
     }
     if (isset($_COOKIE['loginCookie'])) {
         unset($_COOKIE['loginCookie']);
         setcookie('loginCookie', null, -1, '/');
     }
     $this->redirect()->toRoute('user');
 }
Пример #25
0
        } else {
            $this->instances[$a] = $closure;
            // $closure 本身就是一个对象
        }
    }
    // make 方法用于生产实例
    public function make($b, $parameters = [])
    {
        if (isset($this->instances[$b])) {
            return $this->instances[$b];
        }
        array_unshift($parameters, $this);
        return call_user_func_array($this->binds[$b], $parameters);
    }
}
$app = new container();
$app->bind("cache", function ($index) {
    $caches = ['redis', 'memache'];
    return new $cache[$index]();
});
$app->make("cache", [1]);
$app->bind("msg", "uooki/msg/apmsg");
$app->make("msg");
exit;
class test
{
    protected $binds;
    public static function meth1()
    {
        $a = self::meth2();
        echo $a . '\\n';