Example #1
0
function send()
{
    $pid = posix_getpid();
    $client = new swoole_client(SWOOLE_SOCK_TCP, SWOOLE_SOCK_ASYNC);
    //异步非阻塞
    $client->on("connect", function (swoole_client $cli) use($pid) {
        $data = microtime(true);
        lg("[{$pid}] Send: {$data}", __LINE__);
        $cli->send($data);
    });
    $client->on("receive", function (swoole_client $cli, $data) use($pid) {
        lg("[{$pid}] Received: {$data}", __LINE__);
        $cli->close();
    });
    $client->on("error", function (swoole_client $cli) use($pid) {
        $cli->close();
        //lg("[$pid] error then conn close", __LINE__);
        exit(0);
    });
    $client->on("close", function (swoole_client $cli) use($pid) {
        //lg("[$pid] conn close", __LINE__);
    });
    $client->connect('127.0.0.1', 8001, 0.5);
    //lg("[$pid] create conn succ", __LINE__);
    exit(0);
}
function config($name, $value = null)
{
    global $config;
    if ($value) {
        return $config->{$name} = $value;
    } else {
        if (empty($config->{$name})) {
            lg('Parameter ' . $name . ' not defined in config', 'warning');
        }
        return isset($config->{$name}) ? $config->{$name} : '';
    }
}
Example #3
0
 static function start($controller)
 {
     $content = trace($controller, 1);
     $content = '';
     if (!method_exists($controller, 'xrespond')) {
         self::show_welcome();
     }
     $template = file_get_contents(__DIR__ . "/html/mini.html") ?: "{{content}}";
     $content = str_replace("{{content}}", $content, $template);
     lg($content);
     print $content;
 }
Example #4
0
function get_queue()
{
    global $redis_key;
    $redis = conn_redis();
    while (1) {
        $ret = $redis->blPop($redis_key, 30);
        if (isset($ret[1])) {
            //lg("[" . posix_getpid() . '] ' . var_export($ret[1], true));
            lg($ret[1]);
        }
        usleep(5000);
    }
}
Example #5
0
 public function messages()
 {
     $messages = collect();
     try {
         $fetch = $this->server()->getMessages();
     } catch (ErrorException $e) {
         lg('notice', $e->getMessage(), [$this->email->except('userpass')->toArray()]);
         return $messages;
     }
     foreach ($fetch as $message) {
         $messages->push($this->create($message));
     }
     return $messages;
 }
Example #6
0
function send_data()
{
    global $count;
    global $url, $port;
    $pid = posix_getpid();
    $fp = @stream_socket_client("tcp://{$url}:{$port}", $errno, $errstr, 30);
    if (!$fp) {
        exit(1);
    }
    $rand = random();
    $data = time() . "-{$rand}-{$pid}-{$count}";
    fwrite($fp, $data . "\r\n");
    lg("c: {$data}");
    //$ret = fgets($fp, 1024);
    fclose($fp);
    exit(0);
}
Example #7
0
function send_data()
{
    global $count;
    global $url, $port;
    global $base;
    $pid = posix_getpid();
    $rand = random();
    $data = time() . "-{$rand}-{$pid}-{$count}";
    $bev = new EventBufferEvent($base, null, EventBufferEvent::OPT_CLOSE_ON_FREE | EventBufferEvent::OPT_DEFER_CALLBACKS);
    $bev->setTimeouts(3, 3);
    $bev->setCallbacks('readcb', null, 'eventcb', $pid);
    $bev->enable(Event::READ | Event::WRITE);
    $bev->connect("{$url}:{$port}");
    $bev->write($data . "\r\n");
    $base->dispatch();
    lg("[{$pid}] {$data}");
    //lg("pid:{$pid},count:{$count}");
    exit(0);
}
Example #8
0
 public static function load($view_rep, $view_file)
 {
     if (tg('_tsk') == 'news') {
         $instance = new news();
         $array = $instance->index();
     }
     if (isset($array)) {
         $titre = lg('TITR') . ' | ' . $array['titre'];
         $content = htmlentities($array['titre']);
         $image = "http://{$_SERVER['HTTP_HOST']}" . criimg_link('upload/news/' . $array['img'], 200, 200, 'PNG');
         $actual_link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
     } else {
         $titre = lg('TITR');
         $content = 'Site Internet Officiel de la présidence de la République du Tchad.';
         $image = './img/header.jpg';
         $actual_link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
     }
     include_once AFFICH_REP . 'layout/header.php';
     include_once AFFICH_REP . 'layout/limen.php';
     include_once AFFICH_REP . $view_rep . SLASH . $view_file . '_v.php';
 }
Example #9
0
<div class="span9">
<div class="postcontent"><h2><?php 
echo lg('PLUSACT');
?>
</h2>
<link rel="stylesheet" href="css/zebra_pagination.css" type="text/css">
 <?php 
global $db;
$records_per_page = 6;
$pagination = new pagination();
if (!$db->Query("SELECT titr" . LANG . " as titre ,id,img,app,DATE_FORMAT(dat,'%d-%m-%Y') as dat,cont" . LANG . " as content from news   where titr" . LANG . " IS NOT NULL and flash = 0 order by id DESC")) {
    $db->Kill('Error1s');
}
if ($db->RowCount() > 0) {
    $totalrow = $db->RowCount();
    $requet = "SELECT titr" . LANG . " as titre,aut" . LANG . " as autor ,id,img,app,DATE_FORMAT(dat,'%d-%m-%Y') as dat,cont" . LANG . " as content from news   where titr" . LANG . " IS NOT NULL and flash = 0 order by id DESC limit " . ($pagination->get_page() - 1) * $records_per_page . ', ' . $records_per_page;
    if (!$db->Query($requet)) {
        $db->Kill($requet);
    }
    $pagination->records($totalrow);
    $pagination->records_per_page($records_per_page);
    ?>


            <?php 
    $index = 0;
    ?>

            <?php 
    while (!$db->EndOfSeek()) {
        $row = $db->Row();
Example #10
0
<?php 
}
?>
 
 <!--End Lien TDB-->
<!--Start Lien Util-->
 
 <?php 
if (!$db->Query("SELECT titr" . LANG . " as titre ,id, lien from lienu   where titr" . LANG . " IS NOT NULL order by id ")) {
    $db->Kill('Error1s');
}
if ($db->RowCount() > 0) {
    ?>
 <div class="panel panel-primary span12 blkcom div3" style="webkit-border-radius:5px;border-radius:5px; border: 1px solid ;border-color:#49bae8;padding: 10px 15px; ">
   <h5> <?php 
    echo lg("LIEN");
    ?>
 </h5>
  <div class="panel-body">  
  <ul class="nav nav-pills ddmenu  "  >
<?php 
    while (!$db->EndOfSeek()) {
        $row = $db->Row();
        //  $class= str_replace(".","",strrchr($row->img,'.'));
        ?>
     <li class="span12 div2" ><a  href="http://<?php 
        echo $row->lien;
        ?>
" target=_blank ><i class="general foundicon-star"></i><?php 
        echo $row->titre;
        ?>
Example #11
0
 public function workOnUser($provider, $provideruser, $profile)
 {
     // $provideruser has profile details from provider
     $social = Social::model()->find("provider='" . $provider . "' AND provideruser='******'");
     if ($social) {
         $user = User::model()->find("id=" . $social->yiiuser);
         // $user['yiiuser'] has app user id
         return $user;
     } else {
         // no user is connected to that provideruser,
         $social = new Social();
         // a new relation will be needed
         $social->provider = $provider;
         // what provider
         $social->provideruser = $provideruser;
         // the unique user
         // if a yii-user is already logged in add the provideruser to that account
         if (!Yii::app()->user->isGuest) {
             $social->yiiuser = Yii::app()->user->id;
             $user = User::model()->findByPk(Yii::app()->user->id);
             lg('Existing user' . $social->yiiuser);
             lg('Existing user email' . $user->email);
             // capture profile info
             $user_profile = Yii::app()->getModule('user')->user($social->yiiuser)->profile;
             $user->model()->syncProfileViaHybridAuth($user_profile, $profile);
         } else {
             lg('Facebook email: ' . $profile->email);
             $user = User::model()->findByAttributes(array('email' => $profile->email));
             if (!is_null($user)) {
                 // to do - create way to associate facebook account
                 Yii::app()->user->setFlash('email_problem', 'Your email already exists. Please log in to your account with your email.');
                 Yii::app()->user->setReturnUrl('/user/profile/edit');
                 $this->redirect('/user/login');
             }
             if ($profile->email == '') {
                 lg('Hybrid: No email, report error & redirect user');
                 Yii::app()->user->setFlash('email_problem', 'We require your email for registration.');
                 $this->redirect('/user/registration');
             }
             // we want to create a new user
             // take new profile info and register user
             lg('New user');
             $user_id = User::model()->registerViaHybridAuth($profile);
             if ($user_id !== false) {
                 $user = User::model()->findByPk($user_id);
                 $social->yiiuser = $user->id;
             }
             // to do - if no new user_id
             // then social id is 0 and future log in will fail
             // return with new user id
         }
         if ($social->save()) {
             return $user;
         }
     }
 }
Example #12
0
<div class="postcontent"><h2><?php 
echo lg('LIEN');
?>
</h2>

<?php 
global $db;
$records_per_page = 16;
$pagination = new pagination();
if (!$db->Query("SELECT titr" . LANG . " as titre ,id from lienu   where titr" . LANG . " IS NOT NULL order by id ")) {
    $db->Kill('Error1s');
}
if ($db->RowCount() > 0) {
    $totalrow = $db->RowCount();
    if (!$db->Query("SELECT titr" . LANG . " as titre ,id,lien from lienu   where titr" . LANG . " IS NOT NULL order by id  limit  " . ($pagination->get_page() - 1) * $records_per_page . ', ' . $records_per_page)) {
        $db->Kill('Error1s');
    }
    $pagination->records($totalrow);
    $pagination->records_per_page($records_per_page);
    ?>

<div class="pj">
<ul>
<?php 
    while (!$db->EndOfSeek()) {
        $row = $db->Row();
        //	$class=	str_replace(".","",strrchr($row->img,'.'));
        ?>
     <li class="lien"><a href="http://<?php 
        echo $row->lien;
        ?>
Example #13
0
			<?php 
require 'buy_button.php';
?>
		</div>
	</div>

	<?php 
//Вкладки
?>
	<div class="product_dop_modes">
		<?php 
if ($product->paramNotEmpty('param_polnoeopisanie')) {
    // полное описание товара
    ?>
			<div class="product_dop_modes_content alter_block product_dop_modes_content_tab" itemprop="description" data-modtitle="<?php 
    echo lg('Описание');
    ?>
">
				<?php 
    echo HTML::del_mso_code($product->get('param_polnoeopisanie'));
    ?>
			</div>
		<?php 
}
?>
		
		
		<?php 
if (ISHOP_GALLERY) {
    //другие товары в этой категории
    ?>
Example #14
0
                <div id="act">
<a href="com-<?php 
        echo $row->id . '-' . fl($row->titre);
        ?>
.html" id="link">
<p  class="titactp"><?php 
        echo $row->titre;
        ?>
 </p>
<p id="datact" class="datact"><?php 
        echo $row->dat;
        ?>
</p>
<P class="contact"><?php 
        echo limitmot($row->content, 25) . '.....' . '<span class="suit">' . lg('SUIT') . '</span>';
        ?>
</P>
</a>

</div><!--End act-->
            <?php 
    }
    ?>

 </div>       

        <?php 
    // render the pagination links
    $pagination->render();
} else {
Example #15
0
          </ul>
        
          <!-- #######################################fin partie 1 d'actualiter######################################################### --> 
        <?php 
    } else {
        ?>

   
     
        <!-- / Right Column --> 
      </div>
   <p class="nospace btmspace-15" ><?php 
        echo lg('MSGVIDE');
        ?>
</p>  <?php 
    }
} else {
    ?>

                       <p class="nospace btmspace-15" ><?php 
    echo lg('MSGVIDE');
    ?>
</p>
                   
         <?php 
}
?>

         
          <!-- ################################################################################################ --> 
        </div>
Example #16
0

<div class="span9" >

<div class="span12"> 
<h3  style="color:#d60022;"><?php 
echo lg('FORM');
?>
</h3>       
<hr >

<div class="plan">



 <h4 class="">Trouver l’information sur un nom de domaine ou vérifiez la disponibilité de votre nom de domaine ?</h4>
         <p class="text-info">
 <form name="enq" method="post" action="" >
   
  
      <input type="text" name="name" id="name" value=""   placeholder="Nom de domaine"  style="width:270px;" />    
    <select name="categorie" id="cat" style="width:285px;"  >
             <option value="" >td</option>
             <option value="" >gouv.td</option>
             <option value="" >pr.td</option>
             <option value="" >com.td</option>
             <option value="" >org.td</option>
             <option value="" >nat.td</option>
             <option value="" >tourism.td</option>
             <option value="" >info.td</option>
             <option value="" >net.td</option>
Example #17
0
		<td>
			<?php 
        echo $this->s_price($summa * $this->get_summa_zakaz_discount($summa) / 100);
        ?>
		</td>
	</tr>		
	<?php 
    }
    ?>
	
	<?php 
    if ($this->sets['mod_cards'] && isset($_SESSION['card_nomer']) && $this->card > 0) {
        ?>
	<tr>
		<td colspan="4" style="text-align: right;"><?php 
        echo lg('Скидка по дисконтной карте');
        if ($this->card) {
            echo ' (' . $this->card . '%)';
        }
        ?>
:</td>
		<td><?php 
        echo $this->s_price($summa * $this->card / 100);
        ?>
</td>
	</tr>
	<?php 
    }
    ?>
 
Example #18
0
<div id="content" class="three_quarter"> 
<?php 
if (tg('id') != '') {
    $id = tg('id');
    $titre = tg('titre');
    global $db;
    $sqlparent = "SELECT titr" . LANG . " as myalbum  from album  where id=" . $id . " and titr" . LANG . " IS NOT NULL ";
    if (!$db->Query($sqlparent)) {
        $db->Kill("ERROR PAGE");
    }
    if ($db->RowCount() > 0) {
        $array = $db->RowArray();
        ?>
 
 <h1  > <?php 
        echo lg('GALPHOTOS');
        ?>
    » <?php 
        echo $array['myalbum'];
        ?>
 </h1>
 <div id="gallery">
        <figure>
        
          <article>
           
           <ul class="nospace clear">
          <?php 
        if ($dossier = opendir('upload/album/' . $id . '/')) {
            $f = 1;
            while (false != ($fichier = readdir($dossier))) {
Example #19
0
                $prevLevel = $currLevel;
            }
            $currLevel++;
            createTreeplan($array, $categoryId, $currLevel, $prevLevel);
            $currLevel--;
        }
    }
    if ($currLevel == $prevLevel) {
        echo "</li>  </ul> ";
    }
}
?>




<div class="postcontent"><h2><?php 
echo lg('PLAN');
?>
</h2>
<div class="plan">


<?php 
createTreeplan($arrayCategories, 0);
?>

</div>
</div>

Example #20
0
 <div class="span9" >
<div class="postcontent"><h2><?php 
echo lg('DOCX');
?>
</h2>

<?php 
global $db;
$records_per_page = 16;
$pagination = new pagination();
if (!$db->Query("SELECT titr" . LANG . " as titre ,id,img from document  where titr" . LANG . " IS NOT NULL  order by id DESC")) {
    $db->Kill('Error1s');
}
if ($db->RowCount() > 0) {
    $totalrow = $db->RowCount();
    if (!$db->Query("SELECT titr" . LANG . " as titre ,id,img from document  where titr" . LANG . " IS NOT NULL order by id DESC limit " . ($pagination->get_page() - 1) * $records_per_page . ', ' . $records_per_page)) {
        $db->Kill('Error1s');
    }
    $pagination->records($totalrow);
    $pagination->records_per_page($records_per_page);
    ?>

<div class="pj">
<ul>
<?php 
    while (!$db->EndOfSeek()) {
        $row = $db->Row();
        $class = str_replace(".", "", strrchr($row->img, '.'));
        ?>
<li class="<?php 
        echo $class;
Example #21
0
<div id="content" class="three_quarter"> 
<h1 class="heading" > » <?php 
echo lg('SYNTHESEDACTUALITER');
?>
</h1>


 

 <?php 
global $db;
$records_per_page = 100;
$pagination = new pagination();
if (!$db->Query("SELECT id  , titr" . LANG . " as titre  from synthese where  titr" . LANG . " IS NOT NULL      order by  id DESC  ")) {
    $db->Kill('Error1s');
}
if ($db->RowCount() > 0) {
    $totalrow = $db->RowCount();
    if (!$db->Query("SELECT id  , titr" . LANG . " as titre  from synthese where  titr" . LANG . " IS NOT NULL      order by  id DESC   limit " . ($pagination->get_page() - 1) * $records_per_page . ', ' . $records_per_page)) {
        $db->Kill('Error1s');
    }
    $pagination->records($totalrow);
    $pagination->records_per_page($records_per_page);
    ?>

     <div class="sidebar"> 
        <!-- ################################################################################################ -->
       <article>

        <nav class="sdb_holder">
Example #22
0
            <?php 
    }
    ?>
  

           
           
          </ul>
        </nav>
         </article>
       
      <link rel="stylesheet" href="css/zebra_pagination.css" type="text/css">
<?php 
    // render the pagination links
    $pagination->render();
    ?>
         </div>  

<?php 
} else {
    echo lg('MSGRESULTRECHERCH');
}
?>
     


      </div>
    

     
Example #23
0
    ?>
 


<?php 
    echo $array['content'];
    ?>
 
  
</p>  
  
</div>


<div class="span12"><h2><?php 
    echo lg('PLUSEVENT');
    ?>
</h2>
<link rel="stylesheet" href="css/zebra_pagination.css" type="text/css">
 <?php 
    global $db;
    $records_per_page = 6;
    $pagination = new pagination();
    if (!$db->Query("SELECT titr" . LANG . " as titre ,id,img,app,DATE_FORMAT(dat,'%d-%m-%Y') as dat,cont" . LANG . " as content from event   where titr" . LANG . " IS NOT NULL and id <> " . tg('id') . " order by id DESC")) {
        $db->Kill('Error1s');
    }
    if ($db->RowCount() > 0) {
        $totalrow = $db->RowCount();
        $requet = "SELECT titr" . LANG . " as titre ,aut" . LANG . " as autor,id,img,app,DATE_FORMAT(dat,'%d-%m-%Y') as dat,cont" . LANG . " as content from event   where titr" . LANG . " IS NOT NULL and id <> " . tg('id') . " order by id DESC limit " . ($pagination->get_page() - 1) * $records_per_page . ', ' . $records_per_page;
        if (!$db->Query($requet)) {
            $db->Kill($requet);
Example #24
0
	</div>
	
</div>
<?php 
}
?>
<div class="form_block">
	<div class="form_title fb_title">
		<div class="fb_title"><span class="redz"> *</span> - <?php 
echo lg('поля, обязательные для заполнения');
?>
</div>
	</div>
	<div class="form_content">
		<div class="button button2" onclick="$(this).parents('form').submit();"><?php 
echo lg('Заказать звонок');
?>
</div>
		<input type="hidden" name="send" value="1">
		<input type="hidden" name="order_call_form" value="1">
	</div>
</div>

</form>
</div>
<script type="text/javascript">
	function review_file(review_btn) {
		$(review_btn).parent('div').find('input[type=file]').click();
		$(review_btn).parent('div').find('input[type=file]').on('change', function(){
			$(review_btn).parent('div').find('.input_file_text').html($(review_btn).parent('div').find('input[type=file]').val());
		});
Example #25
0
<?php

if (tp('q') != '' && tg('s') == 0) {
    define('POST', tp('q'));
    header('location:././?_tsk=recherche&m=2&s=' . POST);
} else {
    if (tg('s') !== 0) {
        define('POST', tg('s'));
    } else {
        exit(header('location:./'));
    }
}
if (strlen(POST) < 3) {
    msgbox(lg('RECHERR'), 0, './', 4);
} else {
    view::load('page', 'recherche');
}
Example #26
0
    ?>
			<div class="news_icon">
			<img src="<?php 
    echo $art['news_icon'];
    ?>
" width="40px" height="40px ">
			</div>
		<?php 
}
?>
		<div class="news_title"><?php 
echo $art['t'];
?>
</div>
		<div class="news_date"><?php 
echo lg('опубликовано');
?>
: <?php 
echo date('d-m-Y', strtotime($art['date']));
?>
</div>
	</div>
	<div class="news_text"<?php 
if ($this->show_photo() && !empty($art['photo'])) {
    echo ' style="min-height: 134px;";';
}
?>
>
		<?php 
echo $art['txt'];
?>
Example #27
0
         
         <span style="color:#55ABDA;" > <?php 
echo lg('FAXL');
?>
 </span><br> 00235 22514501<br>
           
        
<br> 
          <?php 
echo lg('NANJAMINA');
?>

         
          <br><br> 
          <?php 
echo lg('VMAIL');
?>
<br> <a href="#">contact@presidence.td</a>
          </address>  <br> <br> 
        </article>
            </li>
           
           
          </ul>	</div>	


  
        </div>	</div>	
       
       
Example #28
0
if (isset($_POST['keystring']) && isset($_SESSION['captcha_keystring']) && $_SESSION['captcha_keystring'] != $_POST['keystring']) {
    ?>
		<div class="alert">Неверно введен код с картинки!</div>
	<?php 
}
?>
	<div class="form_block">
		<div class="form_title fb_title">
			<div class="fb_title"><span class="redz"> *</span> - <?php 
echo lg('поля, обязательные для заполнения');
?>
</div>
		</div>
		<div class="form_content">
			<div class="button button2" onclick="$(this).parents('form').submit();"><?php 
echo lg('Отправить');
?>
</div>
			<input type="submit" value="Отправить" onclick="yaCounter8127127.reachGoal('ORDER1'); return true;">
			<input type="hidden" name="send" value="1">
			<input type="hidden" name="posted" value="1">
		</div>
	</div>

</form>

<script type="text/javascript">
	function review_file(review_btn) {
		$(review_btn).parent('div').find('input[type=file]').click();
		$(review_btn).parent('div').find('input[type=file]').on('change', function(){
			$(review_btn).parent('div').find('.input_file_text').html($(review_btn).parent('div').find('input[type=file]').val());
Example #29
0
    ?>
:</td>
		<td><input class="input_text" type="text" name="login" style="width: 150px;" /></td>
	</tr>
	<tr>
		<td><?php 
    echo lg('Пароль');
    ?>
:</td>
		<td><input class="input_text" type="password" name="pass" style="width: 150px;" /></td>
	</tr>
	<tr>
		<td style="padding-right: 5px;"><div class="button button1" onclick="$(this).parents('form').submit();"><?php 
    echo lg('Войти');
    ?>
</div></td>
		<td>
			<a href="reg/registr"><?php 
    echo lg('Регистрация');
    ?>
</a><br>
			<a href="reg/restore"><?php 
    echo lg('Забыли пароль?');
    ?>
</a>
		</td>
	</tr>
</table>
</form>
<?php 
}
Example #30
0
            </div>
             <div class="one_quarter" style="float: right;">
              <label for="url">&nbsp;&nbsp;</label>
               <input name="submit" type="submit" value="<?php 
    echo lg('RECHERCH');
    ?>
" style="float: right;" >

            </div>

           
           
          
          </form> </br> </br> </br> </br>  </br>  
 <h1 class="heading"> <?php 
    echo lg('ARCHIV');
    ?>
 &raquo; <a href="<?php 
    echo LANG;
    ?>
-docx-<?php 
    echo tg('id');
    ?>
-<?php 
    echo fl($model);
    ?>
.html">    <?php 
    echo $model;
    ?>
  </a>  </h1>