本文整理汇总了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;
}
示例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();
}
示例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'));
}
示例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;
}
示例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
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}