Ejemplo n.º 1
0
 /**
  * 上传图片
  */
 protected function Uploadpic($picdir = "")
 {
     $res['error'] = "";
     if (is_uploaded_file($_FILES['fileToUpload']['tmp_name'])) {
         $info = explode('.', strrev($_FILES['fileToUpload']['name']));
         //配置要上传目录地址
         $datadir = date("Y-m-d");
         $picdir = $picdir . "/" . $datadir;
         $picname = "user_" . intval($_REQUEST['project_id']) . "_" . time() . "." . strrev($info[0]);
         $fullname = $picdir . "/" . $picname;
         if (BaseTool::createABFolder($picdir)) {
             if (move_uploaded_file($_FILES['fileToUpload']['tmp_name'], $fullname)) {
                 $res["msg"] = "success";
                 $res["dir"] = $datadir . "/" . $picname;
             } else {
                 $res["error"] = "上传失败";
             }
         } else {
             $res['error'] = "上传失败";
         }
     } else {
         $res['error'] = '上传的文件不存在';
     }
     return $res;
 }
Ejemplo n.º 2
0
 /**
  * Logs in the user using the given username and password in the model.
  * @return boolean whether login is successful
  */
 public function save()
 {
     $user = new Users();
     $user->setAttributes($this->attributes);
     $user->setAttribute("password", BaseTool::ENPWD($this->password));
     if ($user->validate() && $user->save()) {
         $accountarray = array('user_id' => Yii::app()->db->getLastInsertID(), 'total' => 0, 'use_money' => 0, 'no_use_money' => 0, 'newworth' => 0);
         $newAccount = new Account();
         $newAccount->setAttributes($accountarray);
         $newAccount->save();
         //发送邮件
         $activecode = BaseTool::getActiveMailCode($this->username);
         $message = MailTemplet::getActiveEmail($this->username, $activecode);
         $mail = Yii::app()->Smtpmail;
         $mail->SetFrom(Yii::app()->params['adminEmail']);
         $mail->Subject = "好帮贷测试邮件";
         $mail->MsgHTML($message);
         $mail->AddAddress($this->email);
         if ($mail->Send()) {
             $user->updateAll(array("regtaken" => $activecode, "regativetime" => time() + 60 * 60), "username=:username", array(":username" => $this->username));
         }
         Yii::import("application.models.form.LoginForm", true);
         $loginform = new LoginForm();
         $loginarray = array('rememberMe' => false, 'username' => $this->username, 'password' => $this->password);
         $loginform->setAttributes($loginarray);
         if ($loginform->validate() && $loginform->login()) {
         }
         return true;
     } else {
         $usererror = $user->errors;
         $this->addError("username", current(current($usererror)));
         return false;
     }
 }
Ejemplo n.º 3
0
 public static function newFromArray($config)
 {
     global $kgConf;
     $section = new kfLogSection(__METHOD__);
     $t = new BaseTool();
     if (isset($config['remoteBasePath'])) {
         $t->remoteBasePath = $config['remoteBasePath'];
     }
     if (isset($config['sourceInfo'])) {
         $this->sourceInfo = $config['sourceInfo'];
     }
     $kgConf->I18N = isset($config['I18N']) ? $config['I18N'] : null;
     $t->displayTitle = isset($config['displayTitle']) ? $config['displayTitle'] : '';
     $t->revisionId = isset($config['revisionId']) ? $config['revisionId'] : '';
     $t->styles = array('//tools-static.wmflabs.org/cdnjs/ajax/libs/twitter-bootstrap/3.3.4/css/bootstrap.min.css', $kgConf->remoteBase . '/main.css');
     $t->scripts = array('//tools-static.wmflabs.org/cdnjs/ajax/libs/jquery/1.11.3/jquery.min.js', '//tools-static.wmflabs.org/cdnjs/ajax/libs/twitter-bootstrap/3.3.4/js/bootstrap.min.js');
     if (isset($config['authors'])) {
         $t->authors = $config['authors'];
     }
     if (isset($config['licenses'])) {
         $t->licenses = $config['licenses'];
     }
     if (isset($config['layout'])) {
         $t->layout = array_merge($t->layout, $config['layout']);
     }
     if (isset($config['styles'])) {
         $t->styles = $t->expandUrlArray(array_merge($t->styles, $config['styles']));
     }
     if (isset($config['scripts'])) {
         $t->scripts = $t->expandUrlArray(array_merge($t->scripts, $config['scripts']));
     }
     if (isset($config['scriptsHead'])) {
         $t->scriptsHead = $t->expandUrlArray(array_merge($t->scriptsHead, $config['scriptsHead']));
     }
     if (isset($config['requireJS'])) {
         $t->requireJS = $config['requireJS'];
     }
     $t->headTitle = $t->displayTitle;
     kfLog('Tool "' . $t->displayTitle . '" instantiated');
     return $t;
 }
Ejemplo n.º 4
0
 */
/**
 * Configuration
 * -------------------------------------------------
 */
// BaseTool & Localization
require_once __DIR__ . '/../libs/basetool/InitTool.php';
require_once __DIR__ . '/../ToolStart.php';
$I18N = new Intuition(array('domain' => 'tsintuition', 'mode' => 'dashboard'));
// Load all domains so we can get some statistics later on and
// make sure "getAvailableLangs" is complete
foreach ($I18N->getAllRegisteredDomains() as $domainKey) {
    $I18N->loadTextdomain($domainKey);
}
// Initialize BaseTool
$Tool = BaseTool::newFromArray(array('displayTitle' => $I18N->msg('title'), 'remoteBasePath' => $I18N->dashboardHome, 'localBasePath' => $I18N->localBaseDir, 'revisionId' => $I18N->version, 'styles' => array('main.css'), 'scripts' => array('main.js'), 'licenses' => array('CC-BY 3.0' => 'https://creativecommons.org/licenses/by/3.0/')));
$Tool->setSourceInfoGithub('Krinkle', 'intuition', dirname(__DIR__));
/**
 * Tool settings
 * -------------------------------------------------
 */
$toolSettings = array('tabs' => array());
/**
 * Post actions
 * -------------------------------------------------
 */
if (isset($_POST['action'])) {
    switch ($_POST['action']) {
        case 'prefset':
            // Set a 30-day, then redirect to index
            $I18N->setCookie('userlang', $_POST['fpLang']);
Ejemplo n.º 5
0
$user = Users::model()->findByPk($user_id);
$useraccount = Account::model()->find("user_id=:user_id", array(":user_id" => $user_id));
?>
<div class="col-lg-12" style="padding:10px 25px 0px 25px;">
    <div class="panel panel-default" style="margin-bottom: 0px;">
        <div class="panel-body">
            <div class="row">
                <div class="col-lg-4 col-md-4 col-xs-4">
                    <img style="width:100px;height:100px;" class="img-rounded img-responsive" src="<?php 
echo Yii::app()->theme->baseUrl;
?>
/images/wechat/huodong/product.jpg"/>
                </div>
                <div class="col-lg-8" style="text-align: left;">
                    <p style="font-size: 20px;"><small>用户名:</small><?php 
echo BaseTool::truncate_utf8_string($user->username, 4);
?>
</p>
                    <p style="font-size:18px;"><small>可用资金:</small><font style="color:red;"><?php 
echo $useraccount->use_money;
?>
</font></p>
                    <p style="font-size:18px;"><small>安全级别:</small><font style="color:red;"><?php 
echo $user->getSafeLevelLabel();
?>
</font></p>
                </div>
            </div>
        </div>
    </div>
</div>
Ejemplo n.º 6
0
$dataProvider = new CActiveDataProvider('Tender', array('criteria' => array('select' => 't.*', 'condition' => 't.user_id=:user_id AND t.status =2', 'order' => 't.id DESC', 'params' => array(":user_id" => Yii::app()->user->getId())), 'pagination' => array('pageSize' => 20)));
?>
                <?php 
if ($dataProvider->getData()) {
    foreach ($dataProvider->getData() as $value) {
        ?>
                        <tr>
                            <td><?php 
        echo $value->id;
        ?>
</td>
                            <td title="<?php 
        echo $value->project->title;
        ?>
"><?php 
        echo BaseTool::truncate_utf8_string($value->project->title, 8);
        ?>
</td>
                            <td><?php 
        echo $value->project->user->username;
        ?>
</td>
                            <td><?php 
        echo Project::getTypeValue($value->project->type);
        ?>
</td>
                            <td><?php 
        echo Project::getCollectionValue($value->project->collection_type);
        ?>
</td>
                            <td><?php 
Ejemplo n.º 7
0
 /**
  * 淘宝项目
  */
 public function actionTaobao()
 {
     $this->layout = "//layouts/member_html5";
     $error = "";
     if (isset($_POST['title'])) {
         //发布项目处理
         $_POST['type'] = 3;
         $_POST['low_account'] = 50;
         $va_param = $_POST;
         unset($va_param['publis_submit']);
         unset($va_param['picname']);
         Yii::import("application.models.form.ProjectForm", true);
         //形象图片处理
         $attch = CUploadedFile::getInstanceByName("picname");
         $error = "";
         if ($attch == null) {
             $name = Yii::app()->theme->baseUrl . "/images/projectdefault.png";
         } elseif ($attch->size > 1024 * 1024) {
             $error = "形象图片不超过1M";
         } elseif (!in_array(strtolower($attch->extensionName), array("jpeg", "jpg", "gif", "png"))) {
             $error = "上传的图片格式不正确";
         } else {
             $filename = "user_" . Yii::app()->user->getId() . "_" . time() . "." . strtolower($attch->extensionName);
             $path = "/data/upload/project/" . date("Y-m-d") . "/";
             $filepath = Yii::getPathOfAlias('webroot') . $path . $filename;
             $name = $path . $filename;
             if (BaseTool::createFolder($path)) {
                 if (!$attch->saveAs($filepath)) {
                     $error = "形象图片上传出错";
                 }
             }
         }
         if (empty($error)) {
             $va_param['litt_pic'] = $name;
             $oneProjectForm = new ProjectForm();
             $oneProjectForm->scenario = 'taobao';
             $oneProjectForm->setAttributes($va_param);
             if ($oneProjectForm->validate()) {
                 $va_param['account'] = $va_param['account_one'] * $va_param['choutimes'];
                 $result = $oneProjectForm->taobaoSave($va_param);
                 if ($result === true) {
                     $this->redirect("/member/projects/publishing.html");
                     Yii::app()->end();
                 } else {
                     $errorarray = $oneProjectForm->getErrors();
                     $error = current(current($errorarray));
                 }
             } else {
                 $errorarray = $oneProjectForm->getErrors();
                 $error = current(current($errorarray));
             }
         }
     }
     $this->pageTitle = "发布项目-" . Yii::app()->name;
     $this->render('taobao', array("publish_error" => $error));
 }
Ejemplo n.º 8
0
                                    <span class="qys_publish_dec">每人最低需筹资的金额</span></td>
                            </tr>
                            <tr>
                                <td  class="qys_publish_td_left">形象图片:</td>
                                <td class="qys_publish_td_right">
                                    <div class="form-group">
                                        <input class="col-xs-12 col-sm-4" type="file" name="picname"/>
                                        <label class="hidden-xs col-sm-8 qys_publish_dec">( 规格为 350x224 PX )</label>
                                    </div></td>
                            </tr>
                            <tr>
                                <td  class="qys_publish_td_left">筹资详情:</td>
                                <td class="qys_publish_td_right" style="line-height: 20px;">
                                    <textarea name="content" id="publish_content"></textarea>
                                    <?php 
$this->widget('ext.ueditor.UeditorWidget', array('id' => 'publish_content', 'name' => 'editor', 'options' => BaseTool::defaultEditer(), "initialFrameWidth" => "98%"));
?>
                                </td>
                            </tr>
                            <tr>
                                <td  class="qys_publish_td_left"></td>
                                <td class="qys_publish_td_right"><input class="publish_submit" id="publish_submit_submit" type="button" name="publish_submit" value="发布项目"/></td>
                            </tr>
                        </table>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
Ejemplo n.º 9
0
$initPath = '../../ts-krinkle-basetool';
if (!is_readable($initPath)) {
    $initPath = dirname(__DIR__) . '/includes/libs/ts-krinkle-basetool';
}
require_once $initPath . '/InitTool.php';
// Load Intuition
require_once dirname(__DIR__) . '/ToolStart.php';
// Initialize Intuition
$I18N = new TsIntuition(array('domain' => 'TsIntuition', 'mode' => 'dashboard'));
// Load all domains so we can get some statistics later on and
// make sure "getAvailableLangs" is complete
foreach ($I18N->getAllRegisteredDomains() as $domainKey => $domainInfo) {
    $I18N->loadTextdomain($domainKey);
}
// Initialize BaseTool
$Tool = BaseTool::newFromArray(array('displayTitle' => $I18N->msg('fullname'), 'krinklePrefix' => false, 'remoteBasePath' => $I18N->dashboardHome, 'localBasePath' => $I18N->localBaseDir, 'revisionId' => $I18N->version, 'styles' => array('main.css')));
$Tool->setSourceInfoGithub('Krinkle', 'TsIntuition', dirname(__DIR__));
/* Load Scripts & Styles */
// jQuery UI
$jqueryui = $kgConf->getJQueryUI();
$Tool->addScripts($jqueryui['scripts']);
$Tool->addStyles($jqueryui['styles']);
/* Add initial stuff to <head> and <body> */
$Tool->doHtmlHead();
$Tool->doStartBodyWrapper();
/**
 * Tool settings
 * -------------------------------------------------
 */
$toolSettings = array('tabs' => array());
/**
Ejemplo n.º 10
0
<?php

// BaseTool & Localization
require_once __DIR__ . '/lib/basetool/InitTool.php';
require_once KR_TSINT_START_INC;
// Class for this tool
require_once __DIR__ . '/class.php';
$kgTool = new KrSnapshots();
// Local settings
require_once __DIR__ . '/local.php';
$I18N = new TsIntuition('mwsnapshots');
$toolConfig = array('displayTitle' => $I18N->msg('title-overview'), 'remoteBasePath' => dirname($kgConf->getRemoteBase()) . '/', 'revisionId' => '0.2.0', 'styles' => array('main.css'), 'scripts' => array('main.js'), 'I18N' => $I18N);
$kgBaseTool = BaseTool::newFromArray($toolConfig);
$kgBaseTool->setSourceInfoGithub('Krinkle', 'mw-tool-snapshots', __DIR__);
Ejemplo n.º 11
0
<?php

if (isset($page)) {
    $page = intval($page);
} else {
    $page = 1;
}
if (isset($id)) {
    #获得筹资记录
    $startlog = ($page - 1) * 10;
    $thischoujilu = Tender::model()->findAll("project_id=:project_id order by id asc limit :startlog,10 ", array(":project_id" => intval($id), ":startlog" => $startlog));
    if ($thischoujilu) {
        foreach ($thischoujilu as $choujiluvalue) {
            echo '<ul class="list-inline text-right qys_choujilu_list"><li><span style="color:red;">' . intval($choujiluvalue->money) . ' 元</span></li><li>' . BaseTool::truncate_utf8_string($choujiluvalue->user->username, 6) . '</li><li style="color:#777;">' . date("Y/m/d", $choujiluvalue->addtime) . '</li></ul>';
        }
    } else {
        echo '没有数据';
    }
} else {
    echo '错误的数据';
}
Ejemplo n.º 12
0
<?php

/**
 * Main index
 *
 * @author Timo Tijhof, 2015
 * @license http://krinkle.mit-license.org/
 * @package mw-tool-example
 */
/**
 * Configuration
 * -------------------------------------------------
 */
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../class.php';
// require_once __DIR__ . '/../config.php';
$tool = new ExampleTool();
$I18N = new Intuition('example');
$kgBase = BaseTool::newFromArray(array('displayTitle' => 'Example', 'revisionId' => '0.0.0', 'remoteBasePath' => dirname($kgConf->getRemoteBase()) . '/', 'I18N' => $I18N));
$kgBase->setSourceInfoGithub('Krinkle', 'mw-tool-example', dirname(__DIR__));
/**
 * Output
 * -------------------------------------------------
 */
$tool->run();
$kgBase->flushMainOutput();
Ejemplo n.º 13
0
<?php

/**
 * Main index
 *
 * @author Timo Tijhof, 2015
 * @license http://krinkle.mit-license.org/
 * @package wmf-tool-tour
 */
/**
 * Configuration
 * -------------------------------------------------
 */
// BaseTool
require_once __DIR__ . '/../vendor/autoload.php';
// Class for this tool
require_once __DIR__ . '/../class.php';
$tool = new TourTool();
// Local settings
#require_once __DIR__ . '/../config.php';
$kgBase = BaseTool::newFromArray(array('displayTitle' => 'Wiki Tour', 'remoteBasePath' => dirname($kgConf->getRemoteBase()) . '/', 'revisionId' => '0.1.0', 'styles' => array('https://tools-static.wmflabs.org/cdnjs/ajax/libs/bootstrap-table/1.8.1/bootstrap-table.min.css'), 'scripts' => array('https://tools-static.wmflabs.org/cdnjs/ajax/libs/bootstrap-table/1.8.1/bootstrap-table.min.js')));
$kgBase->setSourceInfoGithub('Krinkle', 'wmf-tool-tour', dirname(__DIR__));
/**
 * Output
 * -------------------------------------------------
 */
$tool->run();
$kgBase->flushMainOutput();
Ejemplo n.º 14
0
 /**
  * 
  * @param type $string
  * @param type $string1
  * @return boolean
  * 验证密码是否正确
  */
 public function validatePassword($string = '', $string1 = "")
 {
     if (BaseTool::ENPWD($string) === $string1) {
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 15
0
 /**
  * Returns a peer instance associated with this om.
  *
  * Since Peer classes are not to have any instance attributes, this method returns the
  * same instance for all member of this class. The method could therefore
  * be static, but this would prevent one from overriding the behavior.
  *
  * @return     ToolPeer
  */
 public function getPeer()
 {
     if (self::$peer === null) {
         self::$peer = new ToolPeer();
     }
     return self::$peer;
 }