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


PHP rex::getTablePrefix方法代码示例

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


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

示例1: copyContent

 public static function copyContent($article_id, $clang, $from_revision_id, $to_revision_id)
 {
     if ($from_revision_id == $to_revision_id) {
         return false;
     }
     // clear the revision to which we will later copy all slices
     $dc = rex_sql::factory();
     // $dc->setDebug();
     $dc->setQuery('delete from ' . rex::getTablePrefix() . 'article_slice where article_id=' . $article_id . ' and clang_id=' . $clang . ' and revision=' . $to_revision_id);
     $gc = rex_sql::factory();
     $gc->setQuery('select * from ' . rex::getTablePrefix() . "article_slice where article_id='{$article_id}' and clang_id='{$clang}' and revision='{$from_revision_id}' ORDER by ctype_id, priority");
     $cols = rex_sql::factory();
     $cols->setquery('SHOW COLUMNS FROM ' . rex::getTablePrefix() . 'article_slice');
     foreach ($gc as $slice) {
         $ins = rex_sql::factory();
         // $ins->setDebug();
         $ins->setTable(rex::getTablePrefix() . 'article_slice');
         foreach ($cols as $col) {
             $colname = $col->getValue('Field');
             $ins->setValue($colname, $slice->getValue($colname));
         }
         $ins->setValue('id', 0);
         // trigger auto increment
         $ins->setValue('revision', $to_revision_id);
         $ins->addGlobalCreateFields();
         $ins->addGlobalUpdateFields();
         $ins->insert();
     }
     rex_article_cache::delete($article_id);
     return true;
 }
开发者ID:staabm,项目名称:redaxo,代码行数:31,代码来源:revision.php

示例2: tearDown

 public function tearDown()
 {
     $deleteuser = rex_sql::factory();
     $deleteuser->setQuery('DELETE FROM ' . rex::getTablePrefix() . "user WHERE login = '" . $this->login . "' LIMIT 1");
     // make sure we don't mess up the global scope
     session_destroy();
 }
开发者ID:staabm,项目名称:redaxo,代码行数:7,代码来源:backend_login_test.php

示例3: get

 /**
  * {@inheritdoc}
  */
 public static function get($id)
 {
     $sql = rex_sql::factory();
     $sql->setQuery('SELECT perms FROM ' . rex::getTablePrefix() . 'user_role WHERE id = ?', [$id]);
     if ($sql->getRows() == 0) {
         return null;
     }
     return new self($sql->getArrayValue('perms'));
 }
开发者ID:staabm,项目名称:redaxo,代码行数:12,代码来源:role.php

示例4: isValid

 public function isValid($value)
 {
     $sql = rex_sql::factory();
     $sql->setQuery('SELECT * FROM ' . rex::getTablePrefix() . 'template WHERE id=' . $value . ' AND active=1');
     if ($sql->getRows() != 1 && $value != 0) {
         return rex_i18n::msg('system_setting_default_template_id_invalid');
     }
     return true;
 }
开发者ID:skerbis,项目名称:redaxo,代码行数:9,代码来源:system_setting_default_template_id.php

示例5: getEntriesByTimeline

 public static function getEntriesByTimeline()
 {
     //Start - get all timelines from the database
     $sql = rex_sql::factory();
     $timelines = $sql->getArray('SELECT `user_id` FROM `' . rex::getTablePrefix() . 'socialhub_facebook_timeline`');
     unset($sql);
     if (empty($timelines)) {
         return false;
     }
     //End - get all timelines from the database
     //Start - get all accounts from the database
     $sql = rex_sql::factory();
     $accounts = $sql->getArray('SELECT * FROM `' . rex::getTablePrefix() . 'socialhub_facebook_account` ORDER BY `id` ASC');
     unset($sql);
     if (empty($accounts)) {
         return false;
     }
     //End - get all accounts from the database
     //Start - get entries by timeline from twitter
     foreach ($timelines as $timeline) {
         $fb = new Facebook\Facebook(['app_id' => $accounts[0]['app_id'], 'app_secret' => $accounts[0]['app_secret'], 'default_graph_version' => 'v2.5', 'default_access_token' => $accounts[0]['app_id'] . '|' . $accounts[0]['app_secret']]);
         try {
             $response = $fb->get('/' . $timeline['user_id'] . '/posts');
         } catch (Facebook\Exceptions\FacebookResponseException $e) {
             echo rex_view::error('Graph returned an error: ' . $e->getMessage());
         } catch (Facebook\Exceptions\FacebookSDKException $e) {
             echo rex_view::error('Facebook SDK returned an error: ' . $e->getMessage());
         }
         if (empty($response)) {
             return;
         }
         $response = json_decode($response->getBody(), true);
         foreach ($response['data'] as $post) {
             list($userID, $postID) = explode('_', $post['id']);
             $newPost = rex_sql::factory();
             $newPost->setTable(rex::getTablePrefix() . 'socialhub_entry_timeline');
             $newPost->setWhere(['post_id' => $postID]);
             $newPost->select();
             if ($newPost->getRows() === 0) {
                 $newPost->reset();
                 $newPost->setTable(rex::getTablePrefix() . 'socialhub_entry_timeline');
                 $newPost->setValue('source', 'facebook');
                 $newPost->setValue('post_id', $postID);
                 $newPost->setValue('message', $post['message']);
                 $newPost->setValue('author_id', $userID);
                 $newPost->setValue('created_time', date('Y-m-d H:i:s', strtotime($post['created_time'])));
                 $newPost->setValue('query', '/' . $timeline['user_id'] . '/posts');
                 try {
                     $newPost->insert();
                 } catch (rex_sql_exception $e) {
                     echo rex_view::warning($e->getMessage());
                 }
             }
         }
     }
     //End - get entries by timeline from twitter
 }
开发者ID:phoebusryan,项目名称:rex_socialhub,代码行数:57,代码来源:class.rex_socialhub_facebook.php

示例6: getTemplate

 static function getTemplate($name)
 {
     $gt = rex_sql::factory();
     $gt->setQuery('select * from ' . rex::getTablePrefix() . 'yform_email_template where name=:name', [':name' => $name]);
     if ($gt->getRows() == 1) {
         $b = $gt->getArray();
         return current($b);
     }
     return false;
 }
开发者ID:VIEWSION,项目名称:redaxo_yform,代码行数:10,代码来源:yform_email_template.php

示例7: prepareQuery

 private static function prepareQuery($qry)
 {
     // rex::getUser() gibts im Setup nicht
     $user = rex::getUser() ? rex::getUser()->getValue('login') : '';
     $qry = str_replace('%USER%', $user, $qry);
     $qry = str_replace('%TIME%', time(), $qry);
     $qry = str_replace('%TABLE_PREFIX%', rex::getTablePrefix(), $qry);
     $qry = str_replace('%TEMP_PREFIX%', rex::getTempPrefix(), $qry);
     return $qry;
 }
开发者ID:staabm,项目名称:redaxo,代码行数:10,代码来源:util.php

示例8: getTemplate

 static function getTemplate($name)
 {
     $gt = rex_sql::factory();
     $gt->setQuery('select * from ' . rex::getTablePrefix() . 'yform_email_template where name="' . mysql_real_escape_string($name) . '"');
     if ($gt->getRows() == 1) {
         $b = $gt->getArray();
         return current($b);
     }
     return false;
 }
开发者ID:xong,项目名称:redaxo_yform,代码行数:10,代码来源:emailtemplate.php

示例9: execute

 public function execute()
 {
     $config = rex_plugin::get('cronjob', 'article_status')->getProperty('config');
     $from = $config['from'];
     $to = $config['to'];
     $from['before'] = (array) $from['before'];
     $to['before'] = (array) $to['before'];
     $sql = rex_sql::factory();
     // $sql->setDebug();
     $sql->setQuery('
         SELECT  name
         FROM    ' . rex::getTablePrefix() . 'metainfo_field
         WHERE   name="' . $from['field'] . '" OR name="' . $to['field'] . '"
     ');
     $rows = $sql->getRows();
     if ($rows < 2) {
         if ($rows == 0) {
             $msg = 'Metainfo fields "' . $from['field'] . '" and "' . $to['field'] . '" not found';
         } else {
             $field = $sql->getValue('name') == $from['field'] ? $to['field'] : $from['field'];
             $msg = 'Metainfo field "' . $field . '" not found';
         }
         $this->setMessage($msg);
         return false;
     }
     $time = time();
     $sql->setQuery('
         SELECT  id, clang_id, status
         FROM    ' . rex::getTablePrefix() . 'article
         WHERE
             (     ' . $from['field'] . ' > 0
             AND   ' . $from['field'] . ' < ' . $time . '
             AND   status IN (' . implode(',', $from['before']) . ')
             AND   (' . $to['field'] . ' > ' . $time . ' OR ' . $to['field'] . ' = 0 OR ' . $to['field'] . ' = "")
             )
         OR
             (     ' . $to['field'] . ' > 0
             AND   ' . $to['field'] . ' < ' . $time . '
             AND   status IN (' . implode(',', $to['before']) . ')
             )
     ');
     $rows = $sql->getRows();
     include_once rex_path::addon('structure', 'functions/function_rex_structure.php');
     for ($i = 0; $i < $rows; ++$i) {
         if (in_array($sql->getValue('status'), $from['before'])) {
             $status = $from['after'];
         } else {
             $status = $to['after'];
         }
         rex_article_service::articleStatus($sql->getValue('id'), $sql->getValue('clang_id'), $status);
         $sql->next();
     }
     $this->setMessage('Updated articles: ' . $rows);
     return true;
 }
开发者ID:skerbis,项目名称:redaxo,代码行数:55,代码来源:cronjob.php

示例10: setValue

 public function setValue($value)
 {
     $value = (int) $value;
     $sql = rex_sql::factory();
     $sql->setQuery('SELECT * FROM ' . rex::getTablePrefix() . 'template WHERE id=' . $value . ' AND active=1');
     if ($sql->getRows() != 1 && $value != 0) {
         return rex_i18n::msg('system_setting_default_template_id_invalid');
     }
     rex_config::set('structure/content', 'default_template_id', $value);
     return true;
 }
开发者ID:staabm,项目名称:redaxo,代码行数:11,代码来源:system_setting_default_template_id.php

示例11: deleteSlices

 public static function deleteSlices()
 {
     $IDs = rex_get('slices');
     $sql = rex_sql::factory();
     // $sql->setDebug();
     $sql->setTable(rex::getTablePrefix() . 'article_slice');
     $sql->setWhere("id IN('" . implode("','", $IDs) . "')", array());
     $sql->delete();
     $_SESSION[__CLASS__]['active'] = 0;
     die;
 }
开发者ID:nilsology,项目名称:slice_ui,代码行数:11,代码来源:slice_footer.php

示例12: execute

 public function execute()
 {
     $tables = rex_sql::showTables(1, rex::getTablePrefix());
     if (is_array($tables) && !empty($tables)) {
         $sql = rex_sql::factory();
         // $sql->setDebug();
         try {
             $sql->setQuery('OPTIMIZE TABLE ' . implode(', ', $tables));
             return true;
         } catch (rex_sql_exception $e) {
             return false;
         }
     }
     return false;
 }
开发者ID:staabm,项目名称:redaxo,代码行数:15,代码来源:cronjob.php

示例13: handleSave

 public function handleSave(array $params, rex_sql $sqlFields)
 {
     if (rex_request_method() != 'post' || !isset($params['id'])) {
         return $params;
     }
     $sql = rex_sql::factory();
     // $sql->setDebug();
     $sql->setTable(rex::getTablePrefix() . 'clang');
     $sql->setWhere('id=:id', ['id' => $params['id']]);
     parent::fetchRequestValues($params, $sql, $sqlFields);
     // do the save only when metafields are defined
     if ($sql->hasValues()) {
         $sql->update();
     }
     rex_clang_service::generateCache();
     return $params;
 }
开发者ID:DECAF,项目名称:redaxo,代码行数:17,代码来源:clang_handler.php

示例14: __construct

 public function __construct()
 {
     parent::__construct();
     $tableName = rex::getTablePrefix() . 'user';
     $this->setSqlDb(1);
     $this->setSystemId(self::SYSTEM_ID);
     $this->setSessionDuration(rex::getProperty('session_duration'));
     $qry = 'SELECT * FROM ' . $tableName . ' WHERE status=1';
     $this->setUserQuery($qry . ' AND id = :id');
     $this->setLoginQuery($qry . '
         AND login = :login
         AND (login_tries < ' . self::LOGIN_TRIES_1 . '
             OR login_tries < ' . self::LOGIN_TRIES_2 . ' AND UNIX_TIMESTAMP(lasttrydate) < ' . (time() - self::RELOGIN_DELAY_1) . '
             OR UNIX_TIMESTAMP(lasttrydate) > ' . (time() - self::RELOGIN_DELAY_2) . '
         )');
     $this->tableName = $tableName;
 }
开发者ID:skerbis,项目名称:redaxo,代码行数:17,代码来源:backend_login.php

示例15: handleSave

 public function handleSave(array $params, rex_sql $sqlFields)
 {
     if (rex_request_method() != 'post') {
         return $params;
     }
     $article = rex_sql::factory();
     // $article->setDebug();
     $article->setTable(rex::getTablePrefix() . 'article');
     $article->setWhere('id=:id AND clang_id=:clang', ['id' => $params['id'], 'clang' => $params['clang']]);
     parent::fetchRequestValues($params, $article, $sqlFields);
     // do the save only when metafields are defined
     if ($article->hasValues()) {
         $article->update();
     }
     // Artikel nochmal mit den zusätzlichen Werten neu generieren
     rex_article_cache::generateMeta($params['id'], $params['clang']);
     return $params;
 }
开发者ID:DECAF,项目名称:redaxo,代码行数:18,代码来源:category_handler.php


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