コード例 #1
0
ファイル: LoginController.class.php プロジェクト: kumfo/YYphp
 public function verify()
 {
     //require YY_PATH.'Core/Code.class.php';
     import('Code', YY_PATH . 'Core');
     $code = new Code();
     $code->show();
 }
コード例 #2
0
ファイル: LoginControl.class.php プロジェクト: jyht/v5
 public function code()
 {
     //实例化验证码对象
     $code = new Code();
     //显示验证码
     $code->show();
 }
コード例 #3
0
 /**
  * 登录页面显示验证码
  *
  * @access public
  */
 public function code()
 {
     C(array("CODE_BG_COLOR" => "#ffffff", "CODE_LEN" => 4, "CODE_FONT_SIZE" => 20, "CODE_WIDTH" => 120, "CODE_HEIGHT" => 35));
     $code = new Code();
     $code->show();
     exit;
 }
コード例 #4
0
ファイル: IndexControl.class.php プロジェクト: jyht/v5
 /**
  * 申请友情链接验证码
  */
 public function code()
 {
     if (IS_POST) {
         if (Q('code', null, 'strtoupper') == session('code')) {
             echo 1;
             exit;
         }
     } else {
         $code = new Code();
         $code->show();
     }
 }
コード例 #5
0
ファイル: Code.php プロジェクト: binondord/laravel-recipes
 /**
  * Given a list of code names, return the list of topic ids
  */
 public static function idsFromNames(array $names)
 {
     $ids = [];
     foreach ($names as $name) {
         $topic = static::whereName($name)->first();
         if (!$topic) {
             $topic = new Code();
             $topic->name = $name;
             $topic->save();
         }
         $ids[] = $topic->id;
     }
     return $ids;
 }
コード例 #6
0
ファイル: Stub.php プロジェクト: nfx/pugooroo
 public function method($class, $method)
 {
     $classUnit = new ClassUnit($class);
     $code = new Code('init,default', "\t\t");
     $code->setSilent(true);
     $classUnit->setDesiredNesting(1);
     $class = $classUnit->getClass();
     $instanceVariable = $class->getInstanceVariable();
     //  '$' . $this->class . 'Instance';
     $method = $class->getMethod($method);
     $code->append($classUnit->getClassInitialization($code, $instanceVariable));
     $code->append(array('', '// actual call'));
     $classUnit->generateTestMethodCall($method, $instanceVariable, $code);
     echo $code;
 }
コード例 #7
0
ファイル: CodeAuthAction.php プロジェクト: itliuchang/test
 public function run($code)
 {
     if (Yii::app()->request->isAjaxRequest) {
         $user = User::model()->findByAttributes(array('id' => Yii::app()->user->id));
         $result = Coding::isValidCode($code);
         $hasused = Coding::hasUsedCode($code);
         if ($result['code'] == 200 && $user->status >= 3 && !$hasused) {
             $code = Code::model()->findByAttributes(array('code' => $code));
             $code->times--;
             $code->save();
             $codeused = new CodeUsed();
             $codeused->codeId = $code->id;
             $codeused->userId = Yii::app()->user->id;
             $codeused->createTime = date('YmdHis');
             $codeused->save();
             $user->status = 4;
             $user->save();
             $ccode = new CCode();
             $result = $ccode->getproduct($code->code);
             echo CJSON::encode(array('code' => 200, 'mes' => 'success', 'data' => $result['data']));
         } else {
             echo CJSON::encode(array('code' => 500, 'mes' => 'fail'));
         }
     }
 }
コード例 #8
0
ファイル: COrder.php プロジェクト: itliuchang/test
 public function update($id)
 {
     $transaction = Yii::app()->db->beginTransaction();
     try {
         $order = Order::model()->findByAttributes(array('id' => $id));
         $order->status = 1;
         $ordercompanyproduct = OrderCompany::model()->findAllByAttributes(array('orderId' => $id));
         if ($ordercompanyproduct) {
             foreach ($ordercompanyproduct as &$value) {
                 $code = Code::model()->findByAttributes(array('ordercompanyproductId' => $value->id));
                 $code->status = 1;
                 $value->status = 1;
                 if (!$value->save() || !$code->save()) {
                     throw new Exception("Error Processing Request", 1);
                 }
             }
         }
         $order->save();
         $transaction->commit();
     } catch (Exception $e) {
         $transaction->rollback();
         Yii::log('update fail', CLogger::LEVEL_ERROR, 'updatedb');
         return array('code' => 500, 'mes' => 'update fail');
     }
     return array('code' => 200, 'mes' => 'success');
 }
コード例 #9
0
ファイル: Code.php プロジェクト: smartlockmed/smartlock
 protected static function exec($query)
 {
     Code::$dataController = new DataController();
     Code::$dataController->connect();
     $result = Code::$dataController->exec($query);
     Code::$dataController->disconnect();
     return $result;
 }
コード例 #10
0
 public function run()
 {
     $this->controller->pageTitle = 'Book a Workspace';
     $now = date('Y-m-d', time());
     $date = Yii::app()->request->getParam('date');
     $date = $date == '' ? $now : $date;
     $proxy = new CHub();
     $result = $proxy->getHubList();
     if (Yii::app()->request->isAjaxRequest) {
         $id = Yii::app()->request->getParam('id');
         $hub = Yii::app()->request->getParam('hub');
         $date = Yii::app()->request->getParam('date');
         if ($id) {
             $date = date('Ymd', strtotime($date));
             $record = Reservations::model()->findAll('startTime =' . date('Ymd', strtotime($date)) . '100000' . ' and userId=' . Yii::app()->user->id . ' and type=1 and status=1');
             $orderid = Order::model()->findAllByAttributes(array('status' => 1, 'userId' => Yii::app()->user->id, 'type' => 1));
             if ($orderid) {
                 foreach ($orderid as $list) {
                     $order = OrderProduct::model()->find('endDate>=' . $date . ' and orderId=' . $list['id'] . ' and startDate<=' . $date);
                     if ($order) {
                         break;
                     }
                 }
                 if ($order) {
                     echo CJSON::encode(array('code' => 200, 'data' => array('num' => $order['totalTimes'] - $order['usedTimes'], 'count' => count($record))));
                 } else {
                     echo CJSON::encode(array('code' => 200, 'data' => array('num' => 0)));
                 }
             } else {
                 $code = CodeUsed::model()->findAll('userId=' . Yii::app()->user->id);
                 if ($code) {
                     foreach ($code as $list) {
                         $value = Code::model()->find('endDate>=' . $date . ' and id=' . $list['codeId'] . ' and startDate<=' . $date);
                         if ($value) {
                             break;
                         }
                     }
                     if ($value) {
                         echo CJSON::encode(array('code' => 200, 'data' => array('num' => 1, 'count' => count($record))));
                     } else {
                         echo CJSON::encode(array('code' => 200, 'data' => array('num' => 0)));
                     }
                 } else {
                     echo CJSON::encode(array('code' => 200, 'data' => array('num' => 0)));
                 }
             }
         } else {
             $proxy = new CReservation();
             $result = $proxy->getNumber($date);
             if ($result['code'] == 200) {
                 $data = array('code' => 200, 'data' => $result);
                 echo CJSON::encode($data);
             }
         }
     } else {
         $this->controller->render('workspacelist', array('data' => $result['data'], 'date' => $date));
     }
 }
コード例 #11
0
ファイル: Coding.php プロジェクト: itliuchang/test
 public static function checkCode($code)
 {
     $result = Code::model()->findByAttributes(array('code' => $code));
     if ($result) {
         $code = rand(10000000, 99999999);
         self::checkCode($code);
         return self::checkCode($code);
     } else {
         return true;
     }
 }
コード例 #12
0
 /**
  * Create VK OAuth response instance
  * @param string $string response data
  * @return Code|Error|Token|null response instance
  */
 public static function createResponse($string)
 {
     $data = parse_url($string, PHP_URL_QUERY | PHP_URL_FRAGMENT);
     switch (true) {
         case isset($data['fragment']):
             return Token::initializeByString($data['fragment']);
         case isset($data['query']) && strpos($data['query'], 'error=') !== false:
             return Error::initializeByString($data['query']);
         case isset($data['query']) && strpos($data['query'], 'error=') === false:
             return Code::initializeByString($data['query']);
     }
 }
コード例 #13
0
 protected function assertDataInIndex($validator, array $data)
 {
     // pre
     $this->assertArrayHasKey('label', $data, 'Pre-Condition: Data hat kein Label gesetzt');
     $this->assertArrayHasKey('identifier', $data, 'Pre-Condition: Data hat keinen Identifier gesetzt');
     try {
         $validator->process($data);
         $this->fail('Es war eine UniqueConstraintException erwartet, aber keine wurde gecatched: ' . Code::varInfo($data));
     } catch (UniqueConstraintException $e) {
         $this->assertEquals($e->uniqueConstraint, 'tag_label', 'unique constraint name ist falsch gesetzt');
         $this->assertEquals($e->duplicateKey, array('label' => $data['label']), 'duplikate key daten sind falsch gesetzt');
         $this->assertEquals($e->duplicateIdentifier, $data['identifier'], 'identifier ist falsch gesetzt');
         return $e;
     }
 }
コード例 #14
0
 public function run()
 {
     $this->controller->pageTitle = "Profile";
     if (Yii::app()->request->isAjaxRequest) {
         $id = Yii::app()->user->id;
         $user = User::model()->findByAttributes(array('id' => $id));
         $user->nickName = Yii::app()->request->getParam('nickName');
         $user->portrait = Yii::app()->request->getParam('portrait');
         Yii::app()->user->setState('portrait', Yii::app()->request->getParam('portrait'));
         $user->background = Yii::app()->request->getParam('background');
         $user->title = Yii::app()->request->getParam('title');
         $user->website = Yii::app()->request->getParam('website');
         $user->description = Assist::removeXSS(Yii::app()->request->getParam('description'));
         $user->birthday = Yii::app()->request->getParam('birthday');
         $user->gender = Yii::app()->request->getParam('gender');
         $user->location = Yii::app()->request->getParam('hub');
         $skills = preg_replace('/,+/', ',', Yii::app()->request->getParam('skills'));
         $skills = preg_replace('/,+/', ',', $skills);
         $user->skills = trim($skills, ',');
         $interests = preg_replace('/,+/', ',', Yii::app()->request->getParam('interests'));
         $interests = preg_replace('/,+/', ',', $interests);
         $user->interests = trim($interests, ',');
         //$user->wechatid = Yii::app()->request->getParam('wechatid');
         $user->facebookid = Yii::app()->request->getParam('facebookid');
         $user->twitterid = Yii::app()->request->getParam('twitterid');
         $user->linkedinid = Yii::app()->request->getParam('linkedinid');
         $user->instagramid = Yii::app()->request->getParam('instagramid');
         $status = Yii::app()->request->getParam('status');
         $code = Code::model()->findByAttributes(array('userId' => $id));
         if ($status == 1) {
             $user->status = 2;
         }
         $havecode = empty($code) ? 0 : 1;
         if ($user->save()) {
             echo CJSON::encode(array('code' => 200, 'message' => 'success', 'data' => $havecode));
         }
     } else {
         $id = Yii::app()->user->id;
         $user = User::model()->findByAttributes(array('id' => $id));
         $proxy = new CHub();
         $hub = $proxy->getHubList();
         $this->controller->render('updateProfile', array('user' => $user, 'hub' => $hub['data']));
     }
 }
コード例 #15
0
ファイル: GlobalInput.php プロジェクト: pscheit/psc-cms
 /**
  * @return \Psc\Form\DataInput
  */
 public static function instance($name)
 {
     if (!isset(self::$instances[$name])) {
         switch ($name) {
             case 'GET':
                 $input = $_GET;
                 break;
             case 'POST':
                 $input = $_POST;
                 break;
             case 'COOKIE':
                 $input = $_COOKIE;
                 break;
             default:
                 throw new \Psc\Exception('Parameter: ' . Code::varinfo($name) . ' nicht erlaubt');
         }
         self::$instances[$name] = new FormDataInput($input, FormDataInput::TYPE_ARRAY);
     }
     return self::$instances[$name];
 }
コード例 #16
0
<?php

require_once "../../includes/initialize.php";
global $session;
if (!$session->is_logged_in()) {
    redirect_to("../../index.php");
}
if ($_POST['oper'] == 'add') {
    $code = new Code();
    $code->user_id = $_POST['user_id'];
    $code->code = $_POST['code'];
    $code->message = $_POST['message'];
    $code->item = $_POST['item'];
    $code->value = $_POST['value'];
    $code->create();
} else {
    if ($_POST['oper'] == 'edit') {
        $code = Code::get_by_id($_POST['id']);
        $code->user_id = $_POST['user_id'];
        $code->code = $_POST['code'];
        $code->message = $_POST['message'];
        $code->item = $_POST['item'];
        $code->value = $_POST['value'];
        $code->update();
    } else {
        if ($_POST['oper'] == 'del') {
            Code::get_by_id($_POST['id'])->delete();
        }
    }
}
コード例 #17
0
 /**
  * @test
  * @dataProvider validCodeProvider
  *
  * @covers ::isValid
  *
  * @SuppressWarnings(PHPMD.StaticAccess)
  */
 public function testIsValidCode($code, $expected)
 {
     $actual = Code::isValid($code);
     $this->assertTrue($expected === $actual);
 }
コード例 #18
0
ファイル: captcha.php プロジェクト: Winsen1990/rock
<?php

/**
 * 验证码
 * @author winsen
 * @version 1.0.0
 */
include 'library/init.inc.php';
$_vc = new Code();
//实例化一个对象
$_vc->doimg();
$_SESSION['code'] = $_vc->getCode();
//验证码保存到SESSION
コード例 #19
0
 public function code()
 {
     $code = new Code(80, 25, '', '', 3, 15);
     $code->show();
 }
コード例 #20
0
ファイル: get.php プロジェクト: pablocazorla/Snippets
<?php

session_start();
if (isset($_SESSION["us"])) {
    include_once 'definition.php';
    $Code = new Code();
    $jsondata = array();
    if (isset($_GET['list'])) {
        $jsondata = $Code->getCodes($_GET['snippet_id']);
    }
    header('Content-type: application/json; charset=utf-8');
    echo json_encode($jsondata);
    exit;
} else {
    echo 'logout';
}
コード例 #21
0
ファイル: Code.php プロジェクト: houdunwang/hdphp
 /**
  * 验证验证码
  *
  * @param string $field 表单字段
  *
  * @return bool
  */
 public function auth($field = 'code')
 {
     return !isset($_POST[$field]) || strtoupper($_POST[$field]) == Code::get();
 }
コード例 #22
0
ファイル: code.php プロジェクト: Winsen1990/easyilife
<?php

include 'library/init.inc.php';
$code = new Code(array('line' => false, 'snow' => false));
$code->doimg();
$_SESSION['code'] = $code->getCode();
コード例 #23
0
ファイル: UserController.php プロジェクト: ChenHuaPHP/ZOLshop
 public function code()
 {
     Code::make();
 }
コード例 #24
0
ファイル: editor.php プロジェクト: wangshipeng/Php-Online
<?php

$revision = isset($_GET['revision']) ? $_GET['revision'] : '';
if (!isset($_GET['file']) || $_GET['file'] == '') {
    redirect();
}
$file_name = ROOT_PATH . '/code/' . $_GET['file'] . $CONF["EXTENSION"];
if (!is_file($file_name)) {
    redirect();
}
require_once APPLICATION_PATH . '/models/Code.php';
$codeObj = new Code();
if (isset($_POST['code'], $_POST['action'])) {
    switch ($_POST['action']) {
        case 'Run':
            if (!file_put_contents($file_name, trim($_POST['code']))) {
                redirect();
            }
            break;
        case 'Download':
            if (!file_put_contents($file_name, trim($_POST['code']))) {
                redirect();
            } else {
                header('Content-Description: File Transfer');
                header('Content-Type: application/octet-stream');
                header('Content-Disposition: attachment; filename=' . $_GET['file'] . '.php');
                header('Content-Transfer-Encoding: binary');
                header('Expires: 0');
                header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
                header('Pragma: public');
                header('Content-Length: ' . filesize($file_name));
コード例 #25
0
ファイル: addCust.php プロジェクト: hirvonen/backStage_yii
foreach ($code_info as $_code_info_v) {
    $district_options[$_code_info_v->code_value] = $_code_info_v->code_meaning;
}
echo $form->dropDownList($addr_info, 'addr_district', $district_options);
?>
			</td>
		</tr>
		<tr>
			<td>
				<?php 
echo $form->label($cust_info, 'cust_source');
?>
			</td>
			<td>
				<?php 
$code_model = Code::model();
$query = 'select * from tbl_code where code_tbl_name = "tbl_customer" and code_name = "cust_source"';
$code_info = $code_model->findAllBySql($query);
$cust_source_options = array();
foreach ($code_info as $_code_info_v) {
    $cust_source_options[$_code_info_v->code_value] = $_code_info_v->code_meaning;
}
echo $form->dropDownList($cust_info, 'cust_source', $cust_source_options);
?>
			</td>
		</tr>
		<tr class="alt">
			<td>
				<?php 
echo $form->label($cust_info, 'cust_in_time');
?>
コード例 #26
0
ファイル: doc.php プロジェクト: pinair/ClassCrowd
echo '<a href="main.php?sidebar=lessons&subject_id=' . $_GET['subject_id'] . '&content=add&lesson_id=' . $_GET['lesson_id'] . '"<h2><i class="fa fa-pencil-square-o"></i> Edit lesson</h2></a>';
?>
</div>


<br>


<ul>
<?php 
foreach ($bullets as $bullet) {
    echo '<div class="bullet-li"><h3><i class="fa fa-lightbulb-o paddedicon"></i>' . $bullet->getBullet() . '</h3></div>';
    //2) get Text in each bullets
    $texts = Text::getTextByBullet($bullet->getId());
    //3) get Code in each bullets
    $codes = Code::getCodeBybullet($bullet->getId());
    //4) get Photos in each bullets
    $photos = Photo::getPhotosByBullet($bullet->getId());
    // Now i Will make an associative array with date, type of object and object
    $notes = array();
    //2) start whit text
    if (count($texts) > 0) {
        foreach ($texts as $text) {
            $note = new Note($text->getDate(), 'text', $text);
            array_push($notes, $note);
        }
    }
    //3) then with code
    if (count($codes) > 0) {
        foreach ($codes as $code) {
            $note = new Note($code->getDate(), 'code', $code);
コード例 #27
0
 /**
  * @access public
  * @param string $sText
  */
 public function __construct($sText)
 {
     $this->sText = $sText;
     parent::__construct();
 }
コード例 #28
0
ファイル: index.php プロジェクト: amsakib/SimpleShare
<?php

require_once 'includes/session.php';
require_once 'includes/database.php';
require_once 'includes/code.php';
require_once 'includes/functions.php';
include 'includes/header.php';
?>

<?php 
$code = new Code();
$titleError = $codeError = "";
$error = false;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (!empty($_POST['title'])) {
        $code->title = trim($_POST['title']);
        if (!preg_match("/^[a-zA-Z0-9.-_ ]*\$/", $code->title)) {
            $titleError = "Only letters, period, numbers and spaces are allowed!";
            $error = true;
        }
    } else {
        $titleError = "Code Title is required!";
        $error = true;
    }
    if ($session->is_logged_in()) {
        $code->user_id = $session->user_id;
        $code->privacy = $_POST['privacy'];
    }
    if (!empty($_POST['code'])) {
        $code->code = $_POST['code'];
    } else {
コード例 #29
0
ファイル: Module.php プロジェクト: pscheit/psc-cms
 /**
  * @return File
  */
 public function getClassFile($className)
 {
     return Code::mapClassToFile($className, $this->classPath);
 }
コード例 #30
0
$what = $_POST['what'];
$ids = $_POST['ids'];
$response = "error";
global $session;
if (!$session->is_logged_in()) {
    die("not logged in");
}
if ($what == "user") {
    foreach ($ids as $id) {
        User::get_by_id($id)->delete();
    }
    $response = "success";
} else {
    if ($what == "code") {
        foreach ($ids as $id) {
            Code::get_by_id($id)->delete();
        }
        $response = "success";
    } else {
        if ($what == "redeemed_code") {
            foreach ($ids as $id) {
                RedeemedCode::get_by_id($id)->delete();
            }
            $response = "success";
        } else {
            if ($what == "log") {
                foreach ($ids as $id) {
                    Logs::get_by_id($id)->delete();
                }
                $response = "success";
            } else {