public function testProxy()
 {
     $expect = "<strong>I’ll be back!</strong>";
     $proxy = new Proxy();
     $result = $proxy->send();
     $this->assertEquals($result, $expect);
 }
Beispiel #2
0
 public function testGetAdditionalHtmlAttribute()
 {
     $this->objectManagerMock->expects($this->once())->method('create')->with('Magento\\Framework\\Translate\\Inline')->will($this->returnValue($this->translateMock));
     $this->objectManagerMock->expects($this->never())->method('get');
     $this->translateMock->expects($this->exactly(2))->method('getAdditionalHtmlAttribute')->with($this->logicalOr('some_value', null))->will($this->returnArgument(0));
     $model = new Proxy($this->objectManagerMock, 'Magento\\Framework\\Translate\\Inline', false);
     $this->assertEquals('some_value', $model->getAdditionalHtmlAttribute('some_value'));
     $this->assertNull($model->getAdditionalHtmlAttribute());
 }
Beispiel #3
0
 function enable_step($old_state)
 {
     global $phpEx;
     global $phpbb_root_path;
     global $request;
     /*Require WP includes*/
     $proxy = new Proxy();
     $proxy->cache();
     //AAAAAAAAAAAAND let's hope it works?
     // Run parent enable step method
     return parent::enable_step($old_state);
 }
function getProxy()
{
    if (!empty($_GET['radomProxy'])) {
        require __DIR__ . '/library/getProxy.php';
        $hoge = new Proxy();
        $hoge->setRandomProxyAndPort();
        $proxy = $hoge->getProxy() . ":" . $hoge->getPort();
        return $proxy;
    } else {
        return false;
    }
}
 /**
  * Tests setting the name and body using the Notification class Constructor.
  */
 public function testConstructor()
 {
     // Create a new Proxy using the Constructor to set the name and data
     $proxy = new Proxy('colors', array('red', 'green', 'blue'));
     $data = $proxy->getData();
     // test assertions
     $this->assertNotNull($proxy, "Expecting proxy not null");
     $this->assertTrue($proxy->getProxyName() == 'colors', "Expecting proxy.getProxyName() == 'colors'");
     $this->assertTrue(sizeof($data) == 3, "Expecting data.length == 3");
     $this->assertTrue($data[0] == 'red', "Expecting data[0] == 'red'");
     $this->assertTrue($data[1] == 'green', "Expecting data[1] == 'green'");
     $this->assertTrue($data[2] == 'blue', "Expecting data[2] == 'blue'");
 }
Beispiel #6
0
 /**
  * check authorize info
  */
 private function cAuthorize()
 {
     $return = Proxy::getAuthorize();
     if ($return == false) {
         $this->safeInfo[] = array('content' => '欢迎您使用尚普商城。');
     }
 }
Beispiel #7
0
 public function getUrl($url, $timeout = 5)
 {
     $this->initInstance();
     curl_setopt($this->ch, CURLOPT_URL, $url);
     curl_setopt($this->ch, CURLOPT_TIMEOUT, intval($timeout));
     if ($this->cookie) {
         curl_setopt($this->ch, CURLOPT_COOKIE, $this->cookie);
     }
     if (is_array($this->use_proxy)) {
         $retry = $this->use_proxy ? 1 : 3;
         for ($i = 0; $i < $retry; $i++) {
             $proxy = $this->use_proxy ?: Proxy::rand();
             //允许手动指定Proxy配置
             curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, $proxy['delay']);
             curl_setopt($this->ch, CURLOPT_PROXY, $proxy['host']);
             curl_setopt($this->ch, CURLOPT_PROXYTYPE, $proxy['type']);
             $result = curl_exec($this->ch);
             if ($result && !curl_errno($this->ch)) {
                 break;
             }
         }
     } else {
         $result = curl_exec($this->ch);
     }
     return curl_errno($this->ch) ? false : $result;
 }
 function errorHandler()
 {
     if (!empty($this->current_fd)) {
         $rsp = Proxy::shutdown_handler();
         $rsp && $this->serv->send($this->current_fd, $rsp);
     }
 }
Beispiel #9
0
 /**
  * check authorize info
  */
 private function cAuthorize()
 {
     $return = Proxy::getAuthorize();
     if ($return == false) {
         $this->safeInfo[] = array('content' => '您使用的软件未进行商业授权,请尽快购买!<a href="http://www.aircheng.com/buy" target="_blank">点击授权</a>');
     }
 }
 /**
  * Deploy
  *
  * @param   remote.server.deploy.Deployable deployment
  */
 public function deployBean($deployment)
 {
     if ($deployment instanceof IncompleteDeployment) {
         throw new DeployException('Incomplete deployment originating from ' . $deployment->origin, $deployment->cause);
     }
     $this->cat && $this->cat->info($this->getClassName(), 'Begin deployment of', $deployment);
     // Register beans classloader. This classloader must be put at the beginning
     // to prevent loading of the home interface not implmenenting BeanInterface
     $cl = $deployment->getClassLoader();
     ClassLoader::getDefault()->registerLoader($cl, TRUE);
     $impl = $cl->loadClass($deployment->getImplementation());
     $interface = $cl->loadClass($deployment->getInterface());
     $directoryName = $deployment->getDirectoryName();
     // Fetch naming directory
     $directory = NamingDirectory::getInstance();
     // Create beanContainer
     // TBI: Check which kind of bean container has to be created
     $beanContainer = StatelessSessionBeanContainer::forClass($impl);
     $this->cat && $beanContainer->setTrace($this->cat);
     // Create invocation handler
     $invocationHandler = new ContainerInvocationHandler();
     $invocationHandler->setContainer($beanContainer);
     // Now bind into directory
     $directory->bind($directoryName, Proxy::newProxyInstance($cl, array($interface), $invocationHandler));
     $this->cat && $this->cat->info($this->getClassName(), 'End deployment of', $impl->getName(), 'with ND entry', $directoryName);
     return $beanContainer;
 }
Beispiel #11
0
 /**
  * Parses an XML string and returns a Proxy for it.
  * @param string|Proxy|null $xml
  * @param string $encoding The character set to use, defaults to UTF-8
  * @return Proxy
  */
 public function parse($xml = null, $encoding = null)
 {
     if (!$xml) {
         return Proxy(null);
     }
     if ($xml instanceof Proxy) {
         // already parsed
         return $xml->cloneNode();
     }
     $xml = (string) $xml;
     try {
         return $this->parseFull($xml, $encoding);
     } catch (\arc\UnknownError $e) {
         return $this->parsePartial($xml, $encoding);
     }
 }
Beispiel #12
0
 public static function create($batchId, $urlId, $proxyId, $updateBatch)
 {
     SystemUtility::log('PING START', true);
     SystemUtility::log('GATHERING DATA');
     # Update batch here in case something crashes below
     if ($updateBatch) {
         SystemUtility::log('THIS IS THE LAST PING IN BATCH');
         $batch = \Batch::findFirst();
         $batch->updatedAt = SystemUtility::getSqlNowDate();
         $batch->save();
     }
     $url = \Url::findFirst($urlId);
     $proxy = \Proxy::findFirst($proxyId);
     # Create new ping
     $ping = new \Ping();
     $ping->batchId = $batchId;
     $ping->proxyId = $proxyId;
     $ping->httpCode = self::HTTP_CODE_IN_PROGRESS;
     $ping->duration = 0;
     $ping->error = '';
     $ping->save();
     self::doPing($ping, $url, $proxy);
     SystemUtility::log('PING END');
     return $ping;
 }
Beispiel #13
0
 public function model($route)
 {
     // Sanitize the call
     $route = str_replace('../', '', (string) $route);
     $file = DIR_APPLICATION . 'model/' . $route . '.php';
     $class = 'Model' . preg_replace('/[^a-zA-Z0-9]/', '', $route);
     if (is_file($file)) {
         include_once $file;
         $proxy = new Proxy();
         foreach (get_class_methods($class) as $method) {
             $proxy->attach($method, $this->closure($this->registry, $route . '/' . $method));
         }
         $this->registry->set('model_' . str_replace(array('/', '-', '.'), array('_', '', ''), (string) $route), $proxy);
     } else {
         throw new \Exception('Error: Could not load model ' . $route . '!');
     }
 }
Beispiel #14
0
 public function run()
 {
     $i = 0;
     while ($i < 100) {
         $i++;
         $proxy = $this->proxy->getWorks();
         $this->connector->setProxy($proxy);
         $list = $this->parserFreeProxy->getIpList();
         //$response = $this->connector->getResponse('https://api.ipify.org');
         /*if($response == $proxy->ip){
         			echo 'works';
         		} else {
         			echo 'not wokrs';
         		}*/
         exit;
     }
 }
 /**
  * Returns a value for the given serialized string
  *
  * @param   server.protocol.Serializer serializer
  * @param   remote.protocol.SerializedData serialized
  * @param   [:var] context default array()
  * @return  var
  */
 public function valueOf($serializer, $serialized, $context = array())
 {
     $oid = $serialized->consumeSize();
     $serialized->consume('{');
     $interface = $serializer->valueOf($serialized, $context);
     $serialized->consume('}');
     return Proxy::newProxyInstance(ClassLoader::getDefault(), array(XPClass::forName($serializer->packageMapping($interface))), RemoteInvocationHandler::newInstance((int) $oid, $context['handler']));
 }
Beispiel #16
0
 /**
  * The start action, it shows the "search" view
  */
 public function indexAction()
 {
     $searchParams = ['ping.batchId' => 'batchId', 'ping.proxyId' => 'proxyId', 'b.urlId' => 'urlId'];
     Tag::setDefaults(array('urlId' => $this->request->get('urlId'), 'proxyId' => $this->request->get('proxyId'), 'pingId' => $this->request->get('pingId'), 'batchId' => $this->request->get('batchId')));
     $this->view->pings = $this->searchPings($searchParams);
     $this->view->proxies = Proxy::find();
     $this->view->urls = Url::find();
     $this->view->batches = Batch::find();
     #$this->view->disable();
 }
Beispiel #17
0
 /**
  * Constructor
  * @param string[] $serverConfigPrefixes array containing the config Prefixes
  */
 public function __construct($serverConfigPrefixes, ILDAPWrapper $ldap)
 {
     parent::__construct($ldap);
     foreach ($serverConfigPrefixes as $configPrefix) {
         $this->backends[$configPrefix] = new \OCA\User_LDAP\Group_LDAP($this->getAccess($configPrefix));
         if (is_null($this->refBackend)) {
             $this->refBackend =& $this->backends[$configPrefix];
         }
     }
 }
Beispiel #18
0
 /**
  * Shows the view to create a "new" product
  */
 public function newAction()
 {
     $reflection = new FormReflectionManager($this->flash);
     $this->view->name = $reflection->get('name');
     $this->view->urls = Url::find() ?: array();
     $this->view->proxies = Proxy::find() ?: array();
     $this->view->reflected_proxyId = explode(',', $reflection->get('proxyId'));
     $this->view->reflected_address = explode(',', $reflection->get('address'));
     #$this->view->disable();
 }
 public static function main(array $args = array())
 {
     $gumballMachine = NULL;
     $count = 0;
     if (count($args) < 2) {
         println("GumballMachine <name> <inventory>");
         exit;
     }
     $count = $args[1];
     $gumballMachine = new GumballMachine($args[0], $count);
     Proxy::runServer($args[0], $gumballMachine, "GumballMachineRemote");
 }
Beispiel #20
0
 public static function go($nm_page)
 {
     if ($nm_page == Forward::$_BACK) {
         Forward::goBack();
     } else {
         if ($nm_page == Forward::$_BLOCK) {
             //fica parado
         } else {
             Forward::goURL(Proxy::page($nm_page));
         }
     }
 }
 public static function main(array $args = array())
 {
     $location = array("localhost:10000", "localhost:10000", "localhost:10000");
     $monitor = array();
     for ($i = 0; $i < count($location); $i++) {
         $machine = Proxy::getProxy($location[$i]);
         $monitor[$i] = new GumballMonitor($machine);
         println($monitor[$i]);
     }
     for ($i = 0; $i < count($monitor); $i++) {
         $monitor[$i]->report();
     }
 }
Beispiel #22
0
 protected function setOptionProxy(&$descriptor)
 {
     if (is_object($this->proxy)) {
         $proxy = $this->proxy->getProxy($descriptor['descriptor_key'], $descriptor['option'][CURLOPT_URL]);
         if (is_string($proxy['proxy']) && DryPath::isIp($proxy['proxy'])) {
             $this->setOption($descriptor, CURLOPT_PROXY, $proxy['proxy']);
         } else {
             $descriptor['option'][CURLOPT_URL] = false;
         }
     } elseif (is_string($this->proxy)) {
         $this->setOption($descriptor, CURLOPT_PROXY, $this->proxy);
     }
 }
Beispiel #23
0
 private function createProxies()
 {
     $json = $this->loadProxyJson();
     foreach ($json as $entry) {
         $country = Country::findFirst(array("code = '{$entry->country}'"));
         if (!$country) {
             $country = new Country();
             $country->code = strtoupper($entry->country);
             $country->name = $entry->country;
             $country->save();
         }
         $proxy = Proxy::findFirst(array("address = '{$entry->url}'"));
         if (!$proxy) {
             $proxy = new Proxy();
             $proxy->countryId = $country->id;
             $proxy->address = $entry->url;
             $proxy->save();
             echo '<br />Proxy created: ' . $entry->url;
         } else {
             echo '<br />Proxy exists...';
         }
     }
 }
            die(sprintf("Config XML error: %s at line %d", xml_error_string(xml_get_error_code($this->parser)), xml_get_current_line_number($this->parser)));
            //This is before we have the log location
        }
        xml_parser_free($this->parser);
        return $this->results;
    }
    function tagStart($parser, $name, $attrs)
    {
        $attrs = array_change_key_case($attrs, CASE_LOWER);
        $tag = array(strtolower($name) => $attrs);
        array_push($this->results, $tag);
    }
    function tagEnd($parser, $name)
    {
        //http://www.php.net/manual/en/function.xml-parse.php
        $this->results[count($this->results) - 2]['childrens'][] = $this->results[count($this->results) - 1];
        if (count($this->results[count($this->results) - 2]['childrens']) == 1) {
            $this->results[count($this->results) - 2]['firstchild'] =& $this->results[count($this->results) - 2]['childrens'][0];
        }
        array_pop($this->results);
    }
    function __destruct()
    {
    }
}
$proxyConfig = new ProxyConfig();
$proxyConfig->useXML();
//$proxyConfig->useJSON();
$proxyLog = new ProxyLog($proxyConfig);
$proxyObject = new Proxy($proxyConfig, $proxyLog);
$proxyObject->getResponse();
    ?>
                <tr>
                    <td align="center"><?php 
    echo $mensagem->getNome();
    ?>
</td>
                    <td align="center"><?php 
    echo $mensagem->getEmpresa();
    ?>
</td>
                    <td align="center"><?php 
    echo $mensagem->getAssunto();
    ?>
</td>
                    <td align="center"><a href="<?php 
    echo Proxy::page(DetalharMensagemPage::$NM_PAGINA, array(Proxy::encrypt('id') => $mensagem->getId()));
    ?>
">>></a></td>
                </tr>
            <?php 
}
?>
    
                
            </tbody>
        </table>
        </div>
		
		
		
	</div>
Beispiel #26
0
 function __construct($storage, $cacheFile)
 {
     parent::__construct($storage);
     $this->cache = $this->readCache($cacheFile);
     $this->ends = str_repeat("", $this->getCharSize() + 1);
 }
			</thead>
			
			<?php 
$fachada = Fachada::getInstance();
$clientes = $fachada->cadastroUsuario()->listarClientesComReservas();
foreach ($clientes as $cliente) {
    ?>
				
			<tbody>
				<tr>
					<td><?php 
    echo $cliente->getNome();
    ?>
</td>
					<td align="center"><a href="<?php 
    echo Proxy::page(ListarReservaPage::$NM_PAGINA, array(Proxy::encrypt('id_cliente') => $cliente->getId()));
    ?>
">Ver Reservas</a></td>
				</tr>
			</tbody>
			
		<?php 
}
?>
		</table>
		
	</div>
	<br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br />
	<br /> <br />
	<div class="clr"></div>
 /**
  * Runs the server. Loads the listener using XPClass::forName()
  * so that the class is loaded within the thread's process space
  * and will be recompiled whenever the thread is restarted.
  *
  * @throws  lang.XPException in case initializing the server fails
  * @throws  lang.SystemException in case setuid fails
  */
 public function run()
 {
     try {
         with($class = XPClass::forName('peer.ftp.server.FtpProtocol'), $cl = ClassLoader::getDefault());
         // Add listener
         $this->server->setProtocol($proto = $class->newInstance($storage = Proxy::newProxyInstance($cl, array(XPClass::forName('peer.ftp.server.storage.Storage')), $this->storageHandler), Proxy::newProxyInstance($cl, array(XPClass::forName('security.auth.Authenticator')), $this->authenticatorHandler)));
         // Copy interceptors to connection listener
         $proto->interceptors = $this->interceptors;
         // Enable debugging
         if ($this->cat) {
             $proto->setTrace($this->cat);
             $this->server instanceof Traceable && $this->server->setTrace($this->cat);
         }
         // Try to start the server
         $this->server->init();
     } catch (Throwable $e) {
         $this->server->shutdown();
         throw $e;
     }
     // Check if we should run child processes
     // with another uid/pid
     if (isset($this->processGroup)) {
         $group = posix_getgrnam($this->processGroup);
         $this->cat && $this->cat->debugf('Setting group to: %s (GID: %d)', $group['name'], $group['uid']);
         if (!posix_setgid($group['gid'])) {
             throw new SystemException('Could not set GID');
         }
     }
     if (isset($this->processOwner)) {
         $user = posix_getpwnam($this->processOwner);
         $this->cat && $this->cat->debugf('Setting user to: %s (UID: %d)', $user['name'], $user['uid']);
         if (!posix_setuid($user['uid'])) {
             throw new SystemException('Could not set UID');
         }
     }
     $this->server->service();
 }
		
			<div class="content wh92pc mrgL30 content_destaques">
			
			<h3>Promoções</h3>
			
			<ul class="lista_produtos" id="lista_produtos">
				
				<?php 
$fachada = Fachada::getInstance();
$produtos = $fachada->cadastroProduto()->buscarProdutoPorSituacaoLimitada(SituacaoProduto::$_PROMOCAO, 5);
foreach ($produtos as $produto) {
    ?>
				
				<li>
					<a href="<?php 
    echo Proxy::page(ProdutoPage::$NM_PAGINA, array(Proxy::encrypt('id') => $produto->getId()));
    ?>
">  
					<?php 
    $fotos = $produto->getFotos();
    ?>
					<img alt="" src="<?php 
    echo Constants::$_FOTOS . $fotos[0]->getNomeArquivo();
    ?>
" width="150" height="185"/>
					<span class="descricao_prod"><?php 
    echo $produto->getDescricao();
    ?>
</span><br/>
					<span class="preco_prod">R$ <?php 
    echo $produto->getValor();
 public function __construct()
 {
     parent::__construct(self::NAME, new ArrayObject());
     $this->users =& $this->data;
 }