当前位置: 首页>>代码示例>>PHP>>正文


PHP R::store方法代码示例

本文整理汇总了PHP中R::store方法的典型用法代码示例。如果您正苦于以下问题:PHP R::store方法的具体用法?PHP R::store怎么用?PHP R::store使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在R的用法示例。


在下文中一共展示了R::store方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: edit_post

 function edit_post($f3)
 {
     // Update Tool Locations
     $this->D->sharedLocationsList = array();
     if ($f3->exists('POST.locations')) {
         foreach ($f3->get('POST.locations') as $id) {
             $this->D->sharedLocationsList[] = \R::load('locations', $id);
         }
     }
     $f3->clear('POST.locations');
     $this->D->import($f3->get('POST'));
     $this->D->training_levels or $this->D->training_levels = json_encode($f3->get('TRAINING_LEVELS'));
     \R::begin();
     try {
         $id = \R::store($this->D);
         \R::commit();
     } catch (\Exception $e) {
         \R::rollback();
         if ($e->getSQLState() == 23000) {
         }
         throw new \Exception($this->D->name . ' is not a unique name.');
         throw new \Exception();
     }
     if ($f3->get('dry')) {
         logger($f3, 'added    ' . $this->class_name() . ', id=' . $id);
     } else {
         logger($f3, 'modified ' . $this->class_name() . ', id=' . $id);
     }
     $f3->reroute($this->redirect());
 }
开发者ID:neyre,项目名称:tools.olin.edu,代码行数:30,代码来源:tools.php

示例2: register

    function register($data)
    {
        try {
            include_once 'dbcon.php';
        } catch (Exception $e) {
            ?>
<script type="text/javascript">
alert("Unable to connect to DB, Please contact Administrator");
</script>
<?php 
        }
        $admin->uname = $username;
        $admin->password = $password;
        $admin->sh_name = $shName;
        $admin->full_name = $fullName;
        $admin->desc = $desc;
        $admin->location = $location;
        $admin->address = $address;
        $admin->date_added = $dateAdded;
        $admin->estd_year = $estddate;
        try {
            R::store($admin);
        } catch (Exception $e) {
            ?>
<script type="text/javascript">
			alert("Unable to save to DB, Please contact Administrator");
			</script>
<?php 
        }
    }
开发者ID:4sujittiwari,项目名称:AdminPanel,代码行数:30,代码来源:registermodel.php

示例3: do_stuff

function do_stuff()
{
    /* 26.9|0.0|0.0|31.4|0.00|0.00|0.00|0.00 */
    $result = file_get_contents('http://ourproject.dyndns-server.com:8099/&');
    echo $result;
    $rs = explode('|', $result);
    echo "\n";
    $now = new DateTime();
    $b = R::dispense('timedate');
    $b->time = $now->format('Y-m-d H:i:s');
    $b->T1 = $rs[0];
    $b->T2 = $rs[1];
    $b->T3 = $rs[2];
    $b->T4 = $rs[3];
    $b->V1 = $rs[4];
    $b->V2 = $rs[5];
    $b->V3 = $rs[6];
    $b->V4 = $rs[7];
    R::store($b);
    echo $b->time;
    echo "\n";
    // MySQL datetime format
    sleep(10);
    // wait 20 seconds
    do_stuff();
    // call this function again
}
开发者ID:limweb,项目名称:webappservice,代码行数:27,代码来源:index.php

示例4: save

 public function save()
 {
     if ($this->is_validated()) {
         if ($this->isDublicateBillingUser($this->validated_data['user_name'])) {
             $this->setError('Duplicate Username, Please choose another');
         } elseif ($this->isNotStrongPassword($this->validated_data['user_password'])) {
             $this->setError('Please choose strong password');
         } else {
             if ($this->validated_data['user_password'] != $this->validated_data['user_confirm_password']) {
                 $this->setError('Confirm password is not matched');
             } else {
                 $client = R::dispense("user");
                 $client->fullname = $this->validated_data['user_full_name'];
                 $client->username = $this->validated_data['user_name'];
                 $client->password = md5(SALT . $this->validated_data['user_password']);
                 $client->duelimit = $this->validated_data['user_credit_limit'];
                 $client->extralimit = $this->validated_data['user_extra_credit'];
                 $client->type = 'client';
                 $client->email = $this->validated_data['user_email'];
                 $client->mobile = $this->validated_data['user_mobile'];
                 $client->note = $this->validated_data['user_notes'];
                 $client->createdate = CURRENT_DTT;
                 $client->updatedate = CURRENT_DTT;
                 $client->createby = 1001;
                 $client->isactive = 1;
                 $clientid = R::store($client);
             }
         }
         if ($this->getError() == "") {
             $this->fails = FALSE;
         } else {
             $this->fails = TRUE;
         }
     }
 }
开发者ID:bogiesoft,项目名称:Slim_PHP_Project,代码行数:35,代码来源:client_library.php

示例5: view

 function view($args)
 {
     $id = array_shift($args);
     $permission = R::load('permission', $id);
     if (!is_numeric($id) && !$permission->getID()) {
         $this->redirect(PACKAGE_URL);
     }
     $allgroups = R::findAll('group');
     foreach ($allgroups as $key => $group) {
         foreach ($permission->sharedGroup as $group_c) {
             if ($group->id == $group_c->id) {
                 $allgroups[$key]->checked = true;
             }
         }
     }
     //		echo $permission->name;exit;
     $view = new G2_TwigView('pages/view');
     $view->permission = $permission;
     $view->allGroups = $allgroups;
     $form = new G2_FormMagic($view->get_render());
     if ($form->is_posted()) {
         $groups = R::loadAll('group', array_keys($form->data()['groups']));
         $permission->sharedGroup = $groups;
         R::store($permission);
         Admin_Alert::add_message("\"{$permission->name}\" permission was updated");
         $this->redirect(PACKAGE_URL);
     }
     echo $form->parse();
 }
开发者ID:g2design,项目名称:g2-modules,代码行数:29,代码来源:admin.php

示例6: save

 public function save()
 {
     if ($this->is_validated()) {
         if ($this->isDublicateUser($this->validated_data['user_name'])) {
             $this->setError('Duplicate username,Please choose another');
         } elseif ($this->isNotStrongPassword($this->validated_data['user_password'])) {
             $this->setError('Please choose strong password');
         } else {
             $clientreseller = R::dispense("user");
             $clientreseller->fullname = $this->validated_data['reseller_user_id'];
             $clientreseller->linetitle = $this->validated_data['reseller_line_id'];
             $clientreseller->currencyrate = $this->validated_data['reseller_currency_conversion_rate'];
             $clientreseller->username = $this->validated_data['reseller_cpanel_user_name'];
             $clientreseller->password = md5(SALT . $this->validated_data['reseller_cpanel_password']);
             $clientreseller->resellerlevel = $this->validated_data['reseller_level'];
             $clientreseller->note = $this->validated_data['reseller_notes'];
             $clientreseller->type = 4;
             $clientreseller->createdate = CURRENT_DTT;
             $clientreseller->updatedate = CURRENT_DTT;
             $clientreseller->createby = 1001;
             $clientreseller->isactive = 1;
             $clientresellerid = R::store($clientreseller);
         }
     }
     if ($this->getError() == "") {
         $this->fails = FALSE;
     } else {
         $this->fails = TRUE;
     }
 }
开发者ID:bogiesoft,项目名称:Slim_PHP_Project,代码行数:30,代码来源:clientreseller_library.php

示例7: _log_focus

function _log_focus($openid, $operation, $user_info = NULL)
{
    R::addDatabase('wechat_csc', $GLOBALS['db_wechat_csc_url'], $GLOBALS['db_wechat_csc_user'], $GLOBALS['db_wechat_csc_pass']);
    R::selectDatabase('wechat_csc');
    if (!R::testConnection()) {
        exit('DB failed' . PHP_EOL);
    }
    R::freeze(true);
    try {
        $user = R::getRedBean()->dispense('wxcsc_focus');
        $user->openid = $openid;
        $user->operation = $operation;
        if ($operation == 'focus' && $user_info != NULL) {
            $user->nickname = $user_info['nickname'];
            $user->sex = $user_info['sex'];
            $user->language = $user_info['language'];
            $user->city = $user_info['city'];
            $user->province = $user_info['province'];
            $user->country = $user_info['country'];
        }
        $user_id = R::store($user);
    } catch (Exception $e) {
        header('Content-type:text/json;charset=utf-8');
        echo json_encode(['result' => 'failed', 'error' => 'db error wechat', 'details' => $e->getMessage()]);
        die;
    }
    R::close();
}
开发者ID:adexbn,项目名称:gds_wechat,代码行数:28,代码来源:api_csc.php

示例8: dologinAction

 public function dologinAction()
 {
     Db::connect();
     $bean = R::dispense('user');
     // the redbean model
     $required = ['Name' => 'name', 'Email' => 'email', 'User_Name' => ['rmnl', 'az_lower'], 'Password' => 'password_hash'];
     \RedBeanFVM\RedBeanFVM::registerAutoloader();
     // for future use
     $fvm = \RedBeanFVM\RedBeanFVM::getInstance();
     $fvm->generate_model($bean, $required);
     //the magic
     R::store($bean);
     $val = new validation();
     $val->addSource($_POST)->addRule('email', 'email', true, 1, 255, true)->addRule('password', 'string', true, 10, 150, false);
     $val->run();
     if (count($val->errors)) {
         Debug::r($val->errors);
         foreach ($val->errors as $error) {
             Notification::setMessage($error, Notification::TYPE_ERROR);
         }
         $this->redirect(Request::createUrl('login', 'login'));
     } else {
         Notification::setMessage("Welcome back !", Notification::TYPE_SUCCESS);
         Debug::r($val->sanitized);
         session::set('user', ['sanil']);
         $this->redirect(Request::createUrl('index', 'index'));
     }
 }
开发者ID:santonil2004,项目名称:ovc,代码行数:28,代码来源:loginController.php

示例9: newarticles

function newarticles()
{
    global $app;
    try {
        $request = $app->request();
        $mediaType = $request->getMediaType();
        $body = $request->getBody();
        $input = json_decode($body);
        if ($input) {
            $article = R::dispense('articles');
            $article->title = (string) $input->title;
            $article->url = (string) $input->url;
            $article->date = (string) $input->date;
            $id = R::store($article);
            $app->response()->header('Content-Type', 'application/json');
            echo json_encode(R::exportAll($article));
        } else {
            throw new ResourceNotFoundException();
        }
    } catch (ResourceNotFoundException $e) {
        $app->response()->status(404);
    } catch (Exception $e) {
        $app->response()->status(400);
        $app->response()->header('X-Status-Reason', $e->getMessage());
    }
}
开发者ID:limweb,项目名称:webappservice,代码行数:26,代码来源:samplecrud.php

示例10: Save

 public function Save()
 {
     if (!$this->Verify()) {
         return -1;
     }
     return R::store($this->GetEvent());
 }
开发者ID:rileyteige,项目名称:MyHorseShow-Server,代码行数:7,代码来源:events.php

示例11: process

 public function process(array $documents, &$context)
 {
     $franchiseIds = [];
     $franchiseIds[] = self::mediaToKey($context->media);
     foreach ($context->relationData as $relation) {
         if ($relation['media'] != $context->media->media) {
             continue;
         }
         if ($relation['type'] == MediaRelation::Character) {
             continue;
         }
         if (BanHelper::isFranchiseCouplingBanned($relation['media'], $relation['mal_id'], $context->media->media, $context->media->mal_id)) {
             continue;
         }
         $franchiseIds[] = self::mediaToKey($relation);
     }
     foreach (R::findAll('media', 'media||mal_id IN (' . R::genSlots($franchiseIds) . ')', $franchiseIds) as $relatedMedia) {
         $franchiseIds[] = $relatedMedia->franchise;
     }
     $franchiseId = reset($franchiseIds);
     $media =& $context->media;
     $media->franchise = $franchiseId;
     R::store($media);
     $query = 'UPDATE media SET franchise = ? WHERE franchise IN (' . R::genSlots($franchiseIds) . ')';
     R::exec($query, array_merge([$franchiseId], $franchiseIds));
 }
开发者ID:Lucas8x,项目名称:graph,代码行数:26,代码来源:MediaSubProcessorFranchises.php

示例12: handle

 public function handle($context)
 {
     # Ensure that the user is staff at least
     $context->mustbestaff();
     # Load the publication RESTfully
     $pub = R::load('publication', $context->rest()[0]);
     # Check if the staff is allowed to edit it.
     if ($context->user()->id != $pub->uploaderId) {
         $context->local()->addval('error', 'You must be the staff who uploaded this to edit it.');
         return 'editpub.twig';
     }
     # Check if it's a post
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {
         # Set up a new publication handler.
         $pubcreator = new Manipulatepub($pub, 'editpub.twig');
         $returnerr = $pubcreator->manipulatepublication($context);
         # If it's a non-empty string a error occured.
         if (!empty($returnerr)) {
             $context->local()->addval('error', $returnerr);
             return 'editpub.twig';
         }
         $pub = $pubcreator->getpub();
         # Otherwise it is a publication, so store it.
         R::store($pub);
         # The publication has been sucessfully edited, let's divert the user to the view page using REST.
         $context->divert("/viewpub/" . $pub->id);
     }
     $context->local()->addval(['pub' => $pub, 'auths' => $pub->sharedAuthor]);
     return 'editpub.twig';
 }
开发者ID:Raffprta,项目名称:Open-Access,代码行数:30,代码来源:editpub.php

示例13: __probe

 private function __probe($filename, $prettify)
 {
     // Start time
     $init = microtime(true);
     // Default options
     $options = '-loglevel quiet -show_format -show_streams -print_format json';
     if ($prettify) {
         $options .= ' -pretty';
     }
     // Avoid escapeshellarg() issues with UTF-8 filenames
     setlocale(LC_CTYPE, 'en_US.UTF-8');
     //$command = sprintf('ffprobe %s %s ', $options, escapeshellarg($filename));
     $command = sprintf('./ffprobe %s "%s" ', $options, $filename);
     // Run the ffprobe, save the JSON output then decode
     $json = json_decode(shell_exec($command), true);
     //if (!isset($json->format))
     if (!isset($json['format'])) {
         //throw new Exception('Unsupported file type: '.$filename."\r\nCommand:\r\n".$command."\r\n");
         $output = 'ffprobe: Unsupported file type: ' . $filename . "\r\nCommand:\r\n" . $command . "\r\n";
         $colors = new Colors();
         $colors->getColoredString($output, 'black', 'red');
         //The command finished with an error.
         $error = R::dispense('error');
         //$video->ownError = array($error);
         $error->raw_output = $output;
         $error->repaired = false;
         $id = R::store($error);
     }
     // Save parse time (milliseconds)
     $this->parse_time = round((microtime(true) - $init) * 1000);
     return $json;
 }
开发者ID:kevan,项目名称:ffmpeg-crawler,代码行数:32,代码来源:ffprobe.php

示例14: testChill

 /**
  * Test Chill mode.
  * 
  * @return void
  */
 public function testChill()
 {
     $bean = R::dispense('bean');
     $bean->col1 = '1';
     $bean->col2 = '2';
     R::store($bean);
     asrt(count(R::$writer->getColumns('bean')), 3);
     $bean->col3 = '3';
     R::store($bean);
     asrt(count(R::$writer->getColumns('bean')), 4);
     R::freeze(array('umbrella'));
     $bean->col4 = '4';
     R::store($bean);
     asrt(count(R::$writer->getColumns('bean')), 5);
     R::freeze(array('bean'));
     $bean->col5 = '5';
     try {
         R::store($bean);
         fail();
     } catch (Exception $e) {
         pass();
     }
     asrt(count(R::$writer->getColumns('bean')), 5);
     R::freeze(array());
     $bean->col5 = '5';
     R::store($bean);
     asrt(count(R::$writer->getColumns('bean')), 6);
 }
开发者ID:daviddeutsch,项目名称:redbean-adaptive,代码行数:33,代码来源:Chill.php

示例15: process

 public function process(array $documents, &$context)
 {
     $doc = $documents[self::URL_MEDIA];
     $dom = self::getDOM($doc);
     $xpath = new DOMXPath($dom);
     //chapter count
     preg_match_all('#([0-9]+|Unknown)#', self::getNodeValue($xpath, '//span[text() = \'Chapters:\']/following-sibling::node()[self::text()]'), $matches);
     $chapterCount = Strings::makeInteger($matches[0][0]);
     //volume count
     preg_match_all('#([0-9]+|Unknown)#', self::getNodeValue($xpath, '//span[text() = \'Volumes:\']/following-sibling::node()[self::text()]'), $matches);
     $volumeCount = Strings::makeInteger($matches[0][0]);
     //serialization
     $serializationMalId = null;
     $serializationName = null;
     $q = $xpath->query('//span[text() = \'Serialization:\']/../a');
     if ($q->length > 0) {
         $node = $q->item(0);
         preg_match('#/magazine/([0-9]+)$#', $node->getAttribute('href'), $matches);
         $serializationMalId = Strings::makeInteger($matches[1]);
         $serializationName = Strings::removeSpaces($q->item(0)->nodeValue);
     }
     $media =& $context->media;
     $media->chapters = $chapterCount;
     $media->volumes = $volumeCount;
     $media->serialization_id = $serializationMalId;
     $media->serialization_name = $serializationName;
     R::store($media);
 }
开发者ID:Lucas8x,项目名称:graph,代码行数:28,代码来源:MangaSubProcessorBasic.php


注:本文中的R::store方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。