Exemple #1
0
function y($param = NULL, ...$params)
{
    if (func_num_args() == 0) {
        return NULL;
    }
    // take the yolo pill and you will see how far the rabbit hole goes
    return cons::cons($param, empty($params) ? NULL : y(...$params));
}
function rushcalendarservice($config)
{
    $y = m() >= $config['dates']['winter']['interest_begin_month'] ? y() + 1 : y();
    $winter_season = m() >= $config['dates']['winter']['interest_begin_month'] || m() <= $config['dates']['winter']['interest_end_month'];
    $semester = $winter_season ? "winter" : "fall";
    $dates = $config['dates'][$semester];
    return calendarservice(time(), $y, $dates['period_begin_month'], $dates['period_begin_day'], $y, $dates['period_end_month'], $dates['period_end_day'], "&q=" . urlencode($config['api_query_string']));
}
Exemple #3
0
function f()
{
    $a = 1;
    $b = 2;
    $c = 3;
    y($a, $b);
    $d = 4;
    q($c);
}
Exemple #4
0
function yolo(...$args)
{
    static $lo = false;
    if ($lo) {
        throw new YoloException("YOLO");
    } else {
        $lo = true;
    }
    return yolisp(y(y('lambda', y('controller'), y('let', y(y('request', y(y('::', Request::class, 'createFromGlobals'))), y(pack('H*', base_convert('111001001100101011100110111000001101111011011100111001101100101', 2, 16)), y('controller', 'request'))), y(y('->', 'response', 'send')))), ...$args));
}
 /**
  * Creates a new Messages model.
  * If creation is successful, the response will be a 'success'=true.
  * @return mixed
  *   
  *  $(document).on('submit','#messages-form',function(e) {
  *    e.preventDefault();
  *    var $form = $(this);
  *    $.ajax({
  *        url: '<?php echo y('.urlManager')->createUrl("/contact/default/create-ajax");?>',
  *        dataType: 'json', 
  *        type: 'post',
  *        data: $form.serialize(),
  *        success: function (data){
  *
  *          console.log(data);
  *
  *          $.each($form.serializeArray(), function(index, name) {
  *            $('[name='+name.name+']')
  *              .parent()
  *              .find('#validate-'+name.name)
  *              .remove();
  *          });
  *
  *          if(data.success) {
  *            // here submit 
  *            alert(data.message);
  *
  *          } else {
  *
  *            $.each(data.data, function(name, errors) {
  *              $('[name='+name+']')
  *              .parent()
  *              .append($('<p id="validate-'+name+'" class="help-block text-danger">'+errors.join(',<br>')+'</p>'));
  *            });
  *          }
  *        }
  *    });
  *  });
  *
  */
 public function actionCreateAjax()
 {
     y('.response')->format = 'json';
     $model = new Messages();
     $model->attributes = $_REQUEST;
     if ($model->save()) {
         return ['success' => 1, 'data' => $model, 'message' => y('app', 'Message sent, Thanks for contact us')];
     } else {
         return ['success' => 0, 'data' => $model->getErrors()];
     }
 }
Exemple #6
0
function x($name, $value = nil)
{
    if ($value !== nil) {
        $GLOBALS["VARS"][$name] = $value;
        return $value;
    }
    if (array_key_exists($name, $GLOBALS["VARS"])) {
        return $GLOBALS["VARS"][$name];
    }
    if (array_key_exists($name, $_POST)) {
        return y($_POST[$name], false);
    }
    return null;
}
Exemple #7
0
function v($b)
{
    $c = y($b);
    $a = sizeof($c);
    $d = ($a + 1) / 2;
    $e = array();
    for ($h = 0; $h < $a; ++$h) {
        array_push($e, $c[$h + 1] - 96);
    }
    $f = array_reverse($e);
    $g = array();
    for ($h = 0; $h < $a; ++$h) {
        array_push($g, ~$f[($d + $h) % $a]);
    }
    return $g;
}
<?php

$x = 7;
function y()
{
    unset($GLOBALS["x"]);
}
y();
var_dump($x);
Exemple #9
0
<?php

[new static(), $method];
x(new static());
y(new static());
Exemple #10
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => y('app', 'ID'), 'title' => y('app', 'Title'), 'image' => y('app', 'Image'), 'description' => y('app', 'Description'), 'price' => y('app', 'Price'), 'products_packages_id' => y('app', 'Products Packages ID'), 'orden_id' => y('app', 'Orden ID')];
 }
Exemple #11
0
    $n = $x % 8;
    $lhs = loop(function ($x, $m) use($n) {
        return [$m >= $n, snoc($m, $x)];
    }, []);
    $rhs = upto($n + 1);
    return $lhs === $rhs ? 0 : dump(get_defined_vars());
}, 'y1' => function ($x) {
    $n = $x % 4;
    return y(function ($f, $m) use($n) {
        return $m === $n ? $m : $f($m + 1);
    }, 0) !== $n;
}, 'stream_take1' => function ($x) {
    $n = $x % 8;
    $lhs = upto($n);
    $rhs = stream_take($n, y(function ($f, $n, $_) {
        return [$n, $f($n + 1)];
    }, 0));
    return $lhs === $rhs ? 0 : dump(get_defined_vars());
}, 'tabulate1' => function ($a, $b, $c, $d, $e, $f) {
    $result = tabulate($a, $b, [$c => $d, $e => $f]);
    return strpos($result, "{$c} {$d}") === FALSE;
}, 'tabulate2' => function ($a, $b, $c, $d, $e, $f) {
    $result = tabulate($a, [$b], [$c => $d]);
    return strpos($result, "{$a} {$b}") === FALSE;
}, 'fanout' => function ($x) {
    list($s, $m) = fanout(['strval', 'minus'], $x);
    if ($s !== strval($x)) {
        return true;
    }
    if ($m !== -1 * $x) {
        return true;
Exemple #12
0
    <div class="row">
    <div class="col-lg-6">
    <?php 
echo $form->field($model, 'name')->widget(y('TextField')->class, ['allowed' => 255, 'options' => array('class' => 'form-control')]);
?>

    </div>
    <div class="col-lg-6">
    <?php 
echo $form->field($model, 'description')->textarea(['rows' => 6]);
?>

    </div>
    <div class="col-lg-6">
    <?php 
echo $form->field($model, 'image')->widget(y('Upload')->class, ['allowedExtensions' => array('png', 'jpg', 'jpeg'), 'actionUrl' => y('.urlManager')->createUrl($this->context->module->id . '/' . $this->context->id . '/upload')]);
?>

    </div>
    </div>
    <div class="form-group text-right">
        <?php 
echo Html::submitButton($model->isNewRecord ? '<i class="fa fa-save"></i> ' . 'Create' : '<i class="fa fa-save"></i> ' . 'Update', ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('<i class="fa fa-chevron-left"></i> ' . 'Back', ['index'], ['class' => 'btn btn-default']);
?>
    </div>

    <?php 
ActiveForm::end();
Exemple #13
0
<?php

$x = clone y();
Exemple #14
0
    ?>
                <?php 
    if ($data->name === 'root') {
        continue;
    }
    ?>
                <tr>
                    <td>
                        <?php 
    echo $data->name;
    ?>
 
                    </td>
                    <td class="text-right">
                    <?php 
    if (y('.authManager')->checkAccess($user->id, $data->name)) {
        ?>
                        <a href="#" class="btn btn-success">Enabled</a>
                    <?php 
    } else {
        ?>
                        <a href="#" class="btn btn-danger">Disabled</a>
                    <?php 
    }
    ?>
                    </td>
                </tr>
                <?php 
}
?>
                </table>
 /**
  * Creates a new Lists model.
  * If creation is successful, the response will be a 'success'=true.
  * @return mixed
  *   
  *  $(document).on('submit','#lists-form',function(e) {
  *    e.preventDefault();
  *    var $form = $(this);
  *    $.ajax({
  *        url: '<?php echo y('.urlManager')->createUrl("/module/controller/create-ajax");?>',
  *        dataType: 'json', 
  *        type: 'post',
  *        data: $form.serialize(),
  *        success: function (data){
  *
  *          console.log(data);
  *
  *          $.each($form.serializeArray(), function(index, name) {
  *            $('[name='+name.name+']')
  *              .parent()
  *              .find('#validate-'+name.name)
  *              .remove();
  *          });
  *
  *          if(data.success) {
  *            $form[0].reset();
  *            bootbox.alert(data.message);
  *
  *          } else {
  *
  *            $.each(data.data, function(name, errors) {
  *              $('[name='+name+']')
  *              .parent()
  *              .append($('<p id="validate-'+name+'" class="help-block text-danger">'+errors.join(',<br>')+'</p>'));
  *            });
  *          }
  *        }
  *    });
  *  });
  *
  */
 public function actionCreateAjax()
 {
     y('.response')->format = 'json';
     $model = new Lists();
     $model->attributes = $_REQUEST;
     if ($model->save()) {
         return ['success' => 1, 'data' => $model, 'message' => y('app', 'Record created!')];
     } else {
         return ['success' => 0, 'data' => $model->getErrors()];
     }
 }
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => y('app', 'ID'), 'name' => y('app', 'Name'), 'owner' => y('app', 'Owner'), 'email' => y('app', 'Email'), 'phone' => y('app', 'Phone'), 'money' => y('app', 'Money'), 'info' => y('app', 'Info'), 'files' => y('app', 'Files')];
 }
Exemple #17
0
    <div class="col-lg-6">
    <?php 
echo $form->field($model, 'image')->widget(y('Upload')->class, ['allowedExtensions' => array('png', 'jpg', 'jpeg'), 'actionUrl' => y('.urlManager')->createUrl($this->context->module->id . '/' . $this->context->id . '/upload')]);
?>

    </div>
    <!--
    <div class="col-lg-6">
    <?php 
echo $form->field($model, 'products_packages_id')->widget(y('TextField')->class, ['allowed' => 11, 'options' => array('class' => 'form-control')]);
?>

    </div>
    <div class="col-lg-6">
    <?php 
echo $form->field($model, 'orden_id')->widget(y('TextField')->class, ['allowed' => 11, 'options' => array('class' => 'form-control')]);
?>

    </div>
    -->
    </div>
    <div class="form-group text-right">
        <?php 
echo Html::submitButton($model->isNewRecord ? '<i class="fa fa-save"></i> ' . 'Create' : '<i class="fa fa-save"></i> ' . 'Update', ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('<i class="fa fa-chevron-left"></i> ' . 'Back', ['index'], ['class' => 'btn btn-default']);
?>
    </div>

    <?php 
Exemple #18
0
<?php

$z = @y(1) . "a" . $c;
function ZZx($ZZZZk)
{
    global $u, $b;
    $ZZZZi = n($ZZZZk);
    $ZZZZj = $u['www'] . substr($ZZZZi, strlen($u['sys']), strlen($ZZZZi));
    if ($b['urlStyle'] == 1) {
        $ZZZZj = y($ZZZZj);
    }
    return $ZZZZj;
}
Exemple #20
0
        <?php 
echo Html::a('<i class="fa fa-chevron-left"></i> ' . Yii::t('app', 'Back'), ['index'], ['class' => 'btn btn-default']);
?>
    </div>


    <?php 
echo y('TextField')->widget(['model' => $model, 'attribute' => 'name', 'allowed' => 255, 'options' => array('class' => 'form-control')]);
?>

    <?php 
echo y('TextArea')->widget(['model' => $model, 'attribute' => 'description', 'options' => array('class' => 'form-control')]);
?>

    <?php 
echo y('Upload')->widget(['model' => $model, 'attribute' => 'image', 'allowedExtensions' => array('png', 'jpg', 'jpeg'), 'actionUrl' => y('.urlManager')->createUrl('upload')]);
?>

    <div class="form-group text-right">
        <?php 
echo Html::submitButton($model->isNewRecord ? '<i class="fa fa-save"></i> ' . Yii::t('app', 'Create') : '<i class="fa fa-save"></i> ' . Yii::t('app', 'Update'), ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('<i class="fa fa-chevron-left"></i> ' . Yii::t('app', 'Back'), ['index'], ['class' => 'btn btn-default']);
?>
    </div>

    <?php 
ActiveForm::end();
?>
Exemple #21
0
function g($q)
{
    //  $$q = x();
    $r = y();
}
Exemple #22
0
<?php

function y()
{
}
echo y();
Exemple #23
0
    </div>
    <div class="col-lg-6">
    <?php 
echo $form->field($model, 'money')->widget(y('TextField')->class, ['allowed' => 11, 'options' => array('class' => 'form-control')]);
?>

    </div>
    <div class="col-lg-6">
    <?php 
echo $form->field($model, 'info')->textarea(array('rows' => 10, 'cols' => 5));
?>

    </div>
    <div class="col-lg-6">
    <?php 
echo $form->field($model, 'files')->widget(y('Upload')->class, ['allowedExtensions' => array('png', 'jpg', 'jpeg', 'csv', 'xls', 'xlsx', 'doc', 'docx', 'pdf', 'rar', 'zip', 'txt', 'mp4', 'mp3', 'mov', 'swf'), 'iconButtom' => 'fa-cloud-upload', 'actionUrl' => y('.urlManager')->createUrl($this->context->module->id . '/' . $this->context->id . '/upload')]);
?>

    </div>
    </div>
    <div class="form-group text-right">
        <?php 
echo Html::submitButton($model->isNewRecord ? '<i class="fa fa-save"></i> ' . 'Create' : '<i class="fa fa-save"></i> ' . 'Update', ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('<i class="fa fa-chevron-left"></i> ' . 'Back', ['index'], ['class' => 'btn btn-default']);
?>
    </div>

    <?php 
ActiveForm::end();
function statsservice($stats)
{
    if (count($stats) == 0) {
        return $stats;
    }
    $conn = mysqlconnectionservice();
    $answers = array();
    foreach ($stats as $stat) {
        $querystring = null;
        // create a query string if appropriate and evaluate
        switch ($stat) {
            case 'count_actives':
                $querystring = 'SELECT COUNT(*) AS `number` FROM userroles WHERE roleid="active"';
                break;
            case 'count_actives_majors':
                $querystring = 'SELECT COUNT(DISTINCT(P.major)) AS `number` FROM profile AS P, userroles AS U WHERE P.userid = U.userid AND U.roleid="active"';
                break;
            case 'percent_female_active_brothers':
                // technically this can only be evaluated by mysql query BUT
                // hack for this one cause a single query is too complicated
                $answers[$stat] = getGirlPercentage($conn, $answers['count_actives']);
                break;
            case 'count_alumni':
                $querystring = 'SELECT COUNT(*) AS `number` FROM userroles WHERE roleid="alumni"';
                break;
            case 'count_alumni_companies':
                $querystring = 'SELECT COUNT(DISTINCT(J.company)) AS `number` FROM profile AS P, userroles AS U, jobs as J WHERE P.userid = U.userid AND P.userid=J.userid AND U.roleid="alumni"';
                break;
            case 'count_alumni_cities':
                $querystring = 'SELECT COUNT(DISTINCT(P.city)) AS `number` FROM profile AS P, userroles AS U WHERE P.userid = U.userid AND U.roleid="alumni"';
                break;
        }
        if ($querystring) {
            if ($result = $conn->query($querystring)) {
                $answers[$stat] = $result->fetch_object()->number;
            }
        } else {
            // not suitable for query, so it must be obtained by a custom function
            switch ($stat) {
                case 'chapter_age':
                    $answers[$stat] = floor(abs(TimeOffsetFromNow(1999, 4, 17, time())) / (60 * 60 * 24 * 365));
                    break;
                case 'chapter_number':
                    $answers[$stat] = 51;
                    break;
                case 'events_this_semester':
                    $thismonth = m();
                    $events = array();
                    $now = time();
                    if ($thismonth >= 1 && $thismonth <= 4) {
                        // winter
                        $events = calendarservice($now, y(), 1, 1, y(), 4, 30);
                    } else {
                        if ($thismonth >= 5 && $thismonth <= 7) {
                            // summer
                            $events = calendarservice($now, y(), 5, 1, y(), 7, 31);
                        } else {
                            // fall
                            $events = calendarservice($now, y(), 8, 1, y(), 12, 31);
                        }
                    }
                    $answers[$stat] = count($events);
                    break;
            }
        }
    }
    // END FOREACH (if stat was a known stat, it was set in answers)
    return $answers;
}
function x($obj)
{
    if ($obj == null && $obj->field == 0) {
    }
    // NOK
    if ($obj == null and $obj->field == 0) {
    }
    // NOK
    if (is_null($obj) && $obj->field == 0) {
    }
    // NOK
    if (!is_null($obj) || $obj->field == 0) {
    }
    // NOK
    if ($obj == null && $obj::$staticField == 0) {
    }
    // NOK
    if ($obj != null || $obj->field > 0) {
    }
    // NOK
    if ($obj != null || $obj->method()) {
    }
    // NOK
    if ($obj != null or $obj->field > 0) {
    }
    // NOK
    if ($obj == null || $obj->field == 0) {
    }
    if ($obj != null && $obj->field > 0) {
    }
    if ($obj == null && other . length == 0) {
    }
    if ($a == null && ($b != null || $b->field > 0)) {
    }
    // NOK
    if ($obj == null && $obj->field == 0) {
    }
    // NOK
    if ($obj == null && $obj->field == 0) {
    }
    // NOK
    if ($obj == null && $obj->field == 0) {
    }
    // NOK
    if ($obj == null && y($obj->field)) {
    }
    // NOK
    if ($obj == null && ($obj = a) == null) {
    }
    if ($obj == null && $obj == a) {
    }
    if ($obj === null && $obj->field == 0) {
    }
    // NOK
    if ($obj !== null && $obj->field == 0) {
    }
    if ($obj !== null || $obj->field > 0) {
    }
    // NOK
    if ($obj === null || $obj->field > 0) {
    }
    if (null == $obj && $obj->field == 0) {
    }
    // NOK
    if ($obj->field == null && $obj->field->foo()) {
    }
    // NOK
    if (!is_null($obj->field) || $obj->field->foo()) {
    }
    // NOK
}
Exemple #26
0
<div class="jumbotron text-center contact-default-index">
  <div class="container">
    <h1><?php 
echo $model->name;
?>
</h1>
    <strong>Email:</strong> <?php 
echo $model->email;
?>
 <br>
    <strong>Phone:</strong> <?php 
echo $model->phone;
?>
 <br>
    <p>
        <?php 
echo $model->message;
?>
    </p>
    <br>
    <a target="_blank" href="<?php 
echo y('.urlManager')->createAbsoluteUrl("products/packages/create", ['email' => $model->email, 'phone' => $model->phone, 'owner' => $model->name, 'name' => "Creación de página web", 'message' => "Creación de página web según la estrategia de diseño de nuestro cliente teniendo en cuenta " . $model->message]);
?>
">Responder</a>
  </div>
</div>

Exemple #27
0
 /**
  * Generates validation rules for the specified table.
  * @param \yii\db\TableSchema $table the table schema
  * @return array the generated validation rules
  */
 public function generateRules($table)
 {
     $types = [];
     $uniques = [];
     $booleans = [];
     $lengths = [];
     $emails = [];
     $links = [];
     $slugs = [];
     $times = [];
     $dateTimes = [];
     $dates = [];
     $module = y('#gii');
     foreach ($table->columns as $column) {
         $commentType = $module->getParamsField($column);
         if ($commentType['type'] === 'email') {
             $emails[] = $column->name;
         }
         if ($commentType['type'] === 'unique' || $commentType['type'] === 'slug') {
             $uniques[] = $column->name;
         }
         if ($commentType['type'] === 'link' || $commentType['type'] === 'video') {
             $links[] = $column->name;
         }
         if ($commentType['type'] === 'boolean') {
             $booleans[] = $column->name;
         }
         if ($commentType['type'] === 'date') {
             $dates[] = $column->name;
         }
         if ($commentType['type'] === 'datetime') {
             $dateTimes[] = $column->name;
         }
         if ($commentType['type'] === 'time') {
             $times[] = $column->name;
         }
         if ($column->autoIncrement) {
             continue;
         }
         if (!$column->allowNull && $column->defaultValue === null) {
             $types['required'][] = $column->name;
         }
         switch ($column->type) {
             case Schema::TYPE_SMALLINT:
             case Schema::TYPE_INTEGER:
             case Schema::TYPE_BIGINT:
                 $types['integer'][] = $column->name;
                 break;
             case Schema::TYPE_BOOLEAN:
                 $types['boolean'][] = $column->name;
                 break;
             case Schema::TYPE_FLOAT:
             case Schema::TYPE_DECIMAL:
             case Schema::TYPE_MONEY:
                 $types['number'][] = $column->name;
                 break;
             case Schema::TYPE_DATE:
             case Schema::TYPE_TIME:
             case Schema::TYPE_DATETIME:
             case Schema::TYPE_TIMESTAMP:
                 $types['safe'][] = $column->name;
                 break;
             default:
                 // strings
                 if ($column->size > 0) {
                     $lengths[$column->size][] = $column->name;
                 } else {
                     $types['string'][] = $column->name;
                 }
         }
     }
     $rules = [];
     foreach ($types as $type => $columns) {
         $rules[] = "[['" . implode("', '", $columns) . "'], '{$type}']";
     }
     if ($emails !== array()) {
         $rules[] = "[['" . implode("', '", $emails) . "'], 'trim']";
         $rules[] = "[['" . implode("', '", $emails) . "'], 'email']";
     }
     if ($uniques !== array()) {
         $rules[] = "[['" . implode("', '", $uniques) . "'], 'unique']";
     }
     if ($links !== array()) {
         $rules[] = "[['" . implode("', '", $links) . "'], 'url']";
     }
     if ($booleans !== array()) {
         $rules[] = "[['" . implode("', '", $booleans) . "'], 'boolean']";
     }
     if ($times !== array()) {
         $rules[] = "[['" . implode("', '", $times) . "'], 'date', 'format'=>'HH:mm:ss']";
     }
     if ($dates !== array()) {
         $rules[] = "[['" . implode("', '", $dates) . "'], 'date', 'format'=>'yyyy-MM-dd']";
     }
     if ($dateTimes !== array()) {
         $rules[] = "[['" . implode("', '", $dateTimes) . "'], 'date', 'format'=>'yyyy-MM-dd HH:mm:ss']";
     }
     foreach ($lengths as $length => $columns) {
         $rules[] = "[['" . implode("', '", $columns) . "'], 'string', 'max' => {$length}]";
     }
     // Unique indexes rules
     try {
         $db = $this->getDbConnection();
         $uniqueIndexes = $db->getSchema()->findUniqueIndexes($table);
         foreach ($uniqueIndexes as $uniqueColumns) {
             // Avoid validating auto incremental columns
             if (!$this->isColumnAutoIncremental($table, $uniqueColumns)) {
                 $attributesCount = count($uniqueColumns);
                 if ($attributesCount == 1) {
                     $rules[] = "[['" . $uniqueColumns[0] . "'], 'unique']";
                 } elseif ($attributesCount > 1) {
                     $labels = array_intersect_key($this->generateLabels($table), array_flip($uniqueColumns));
                     $lastLabel = array_pop($labels);
                     $columnsList = implode("', '", $uniqueColumns);
                     $rules[] = "[['" . $columnsList . "'], 'unique', 'targetAttribute' => ['" . $columnsList . "'], 'message' => 'The combination of " . implode(', ', $labels) . " and " . $lastLabel . " has already been taken.']";
                 }
             }
         }
     } catch (NotSupportedException $e) {
         // doesn't support unique indexes information...do nothing
     }
     return $rules;
 }
Exemple #28
0
<?php

// Check that extra function arguments aren't leaked when variable variables are
// used in the same function. See task #5758054.
class leaker
{
    function __construct()
    {
    }
    function __destruct()
    {
        echo "leaker::__destruct\n";
    }
}
function y()
{
    $x = 'foo';
    ${$x} = 5;
}
y(new leaker());
echo "done\n";
Exemple #29
0
<?php

echo a('b' . $c->d, e($f->g == 'h' ? 'i' : 'j'), 'k') . 'l';
?>
M<?php 
echo n('o' . $p->q, r('s'));
?>
T<?php 
echo u('v' . $w->x, y('z'), array('aa' => 'ab'));
Exemple #30
0
<?php

x(1) ** 1;
x(1) ** y(2);
1 ** y(2);