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


PHP rex_sql::factory方法代码示例

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


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

示例1: rex_a62_metainfo_cleanup

/**
 * Alle Metafelder löschen, nicht das nach einem Import in der Parameter Tabelle
 * noch Datensätze zu Feldern stehen, welche nicht als Spalten in der
 * rex_article angelegt wurden!
 */
function rex_a62_metainfo_cleanup($params)
{
    global $REX;
    // Cleanup nur durchführen, wenn auch die rex_article Tabelle neu angelegt wird
    if (isset($params['force']) && $params['force'] != true && strpos($params['content'], 'CREATE TABLE `' . $REX['TABLE_PREFIX'] . 'article`') === false && strpos($params['content'], 'CREATE TABLE ' . $REX['TABLE_PREFIX'] . 'article') === false) {
        return;
    }
    require_once $REX['INCLUDE_PATH'] . '/addons/metainfo/classes/class.rex_table_manager.inc.php';
    $sql = rex_sql::factory();
    $sql->setQuery('SELECT name FROM ' . $REX['TABLE_PREFIX'] . '62_params');
    for ($i = 0; $i < $sql->getRows(); $i++) {
        if (substr($sql->getValue('name'), 0, 4) == 'med_') {
            $tableManager = new rex_a62_tableManager($REX['TABLE_PREFIX'] . 'file');
        } else {
            $tableManager = new rex_a62_tableManager($REX['TABLE_PREFIX'] . 'article');
        }
        $tableManager->deleteColumn($sql->getValue('name'));
        $sql->next();
    }
    // evtl reste aufräumen
    $tablePrefixes = array('article' => array('art_', 'cat_'), 'file' => array('med_'));
    foreach ($tablePrefixes as $table => $prefixes) {
        $table = $REX['TABLE_PREFIX'] . $table;
        $tableManager = new rex_a62_tableManager($table);
        foreach (rex_sql::showColumns($table) as $column) {
            $column = $column['name'];
            if (in_array(substr($column, 0, 4), $prefixes)) {
                $tableManager->deleteColumn($column);
            }
        }
    }
    $sql = rex_sql::factory();
    $sql->setQuery('DELETE FROM ' . $REX['TABLE_PREFIX'] . '62_params');
}
开发者ID:Barnhiac,项目名称:MTW_REDAXO,代码行数:39,代码来源:extension_cleanup.inc.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: effectsFromType

 function effectsFromType($type)
 {
     global $REX;
     $qry = '
   SELECT e.* 
   FROM ' . $REX['TABLE_PREFIX'] . '679_types t, ' . $REX['TABLE_PREFIX'] . '679_type_effects e
   WHERE e.type_id = t.id AND t.name="' . $type . '" order by e.prior';
     $sql = rex_sql::factory();
     //    $sql->debugsql = true;
     $sql->setQuery($qry);
     $effects = array();
     while ($sql->hasNext()) {
         $effname = $sql->getValue('effect');
         $params = unserialize($sql->getValue('parameters'));
         $effparams = array();
         // extract parameter out of array
         if (isset($params['rex_effect_' . $effname])) {
             foreach ($params['rex_effect_' . $effname] as $name => $value) {
                 $effparams[str_replace('rex_effect_' . $effname . '_', '', $name)] = $value;
                 unset($effparams[$name]);
             }
         }
         $effect = array('effect' => $effname, 'params' => $effparams);
         $effects[] = $effect;
         $sql->next();
     }
     return $effects;
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:28,代码来源:class.rex_image_manager.inc.php

示例4: execute

 function execute()
 {
     // START - Spezialfall "be_em_relation"
     /*
     $be_em_table_field = "";
     if($this->elements_sql["type_name"] == "be_em_relation")
     {
     	$be_em_table_field = $this->elements_sql["f1"];
     	$this->elements_sql["f1"] = $this->elements_sql["f3"]."_".$this->elements_sql["f1"];
     }
     */
     // ENDE - Spezialfall
     // ********************************* TABLE A
     // $this->params["debug"]= TRUE;
     $sql = rex_sql::factory();
     if ($this->params["debug"]) {
         $sql->debugsql = TRUE;
     }
     $main_table = "";
     if (isset($this->action["elements"][2]) && $this->action["elements"][2] != "") {
         $main_table = $this->action["elements"][2];
     } else {
         $main_table = $this->params["main_table"];
     }
     if ($main_table == "") {
         $this->params["form_show"] = TRUE;
         $this->params["hasWarnings"] = TRUE;
         $this->params["warning_messages"][] = $this->params["Error-Code-InsertQueryError"];
         return FALSE;
     }
     $sql->setTable($main_table);
     $where = "";
     if (isset($this->action["elements"][3]) && trim($this->action["elements"][3]) != "") {
         $where = trim($this->action["elements"][3]);
     }
     // SQL Objekt mit Werten füllen
     foreach ($this->elements_sql as $key => $value) {
         $sql->setValue($key, $value);
         if ($where != "") {
             $where = str_replace('###' . $key . '###', addslashes($value), $where);
         }
     }
     if ($where != "") {
         $sql->setWhere($where);
         $sql->update();
         $flag = "update";
     } else {
         $sql->insert();
         $flag = "insert";
         $id = $sql->getLastId();
         $this->elements_email["ID"] = $id;
         // $this->elements_sql["ID"] = $id;
         if ($id == 0) {
             $this->params["form_show"] = TRUE;
             $this->params["hasWarnings"] = TRUE;
             $this->params["warning_messages"][] = $this->params["Error-Code-InsertQueryError"];
         }
     }
     return;
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:60,代码来源:class.xform.action_manage_db.inc.php

示例5: formatElement

 public function formatElement()
 {
     $name = $this->getFieldName();
     $qry = 'SELECT ' . $this->labelField . ',' . $name . ' FROM ' . $this->table->getTableName() . ' WHERE 1=1';
     if ($this->whereCondition != '') {
         $qry .= ' AND (' . $this->whereCondition . ')';
     }
     // Im Edit Mode das Feld selbst nicht als Position einfügen
     if ($this->table->isEditMode()) {
         $qry .= ' AND (' . $name . '!=' . $this->getValue() . ')';
     }
     $qry .= ' ORDER BY ' . $name;
     $sql = rex_sql::factory();
     $sql->setQuery($qry);
     $this->select->addOption(rex_i18n::msg($this->firstOptionMsg), 1);
     $value = 1;
     foreach ($sql as $opt) {
         $value = $opt->getValue($name) + 1;
         $this->select->addOption(rex_i18n::rawMsg($this->optionMsg, $opt->getValue($this->labelField)), $value);
     }
     if (!$this->table->isEditMode()) {
         $this->select->setSelected($value);
     }
     return parent::formatElement();
 }
开发者ID:staabm,项目名称:redaxo,代码行数:25,代码来源:prio.php

示例6: 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

示例7: rex_d2u_stellenmarkt_media_is_in_use

/**
 * Prüft ob dieses Addon Medien im Medienpool nutzt.
 * @global array $REX Redaxo Einstellungen
 * @param type $params Übergabeparameter des Extension Points
 * @return string Warnnachricht als Array
 */
function rex_d2u_stellenmarkt_media_is_in_use($params)
{
    global $REX;
    $warning = $params['subject'];
    $filename = addslashes($params['filename']);
    $sql_stelle = rex_sql::factory();
    $sql_stelle->setQuery('SELECT * FROM `' . $REX['TABLE_PREFIX'] . 'd2u_stellenmarkt_stellen` WHERE bild = "' . $filename . '"');
    $rows_stelle = $sql_stelle->getRows();
    $sql_kontakt = rex_sql::factory();
    $sql_kontakt->setQuery('SELECT * FROM `' . $REX['TABLE_PREFIX'] . 'd2u_stellenmarkt_kontakt` WHERE bild = "' . $filename . '"');
    $rows_kontakt = $sql_kontakt->getRows();
    $message = "";
    if ($rows_stelle > 0 || $rows_kontakt > 0) {
        $message = 'Stellenmarkt Addon:<br /><ul>';
    }
    for ($i = 0; $i < $rows_stelle; $i++) {
        $message .= '<li><a href="javascript:openPage(\'index.php?page=d2u_stellenmarkt&subpage=stellen&func=edit&entry_id=' . $sql_stelle->getValue('stellen_id') . '\')">' . $sql_stelle->getValue('interne_bezeichnung') . '</a></li>';
    }
    for ($i = 0; $i < $rows_kontakt; $i++) {
        $message .= '<li><a href="javascript:openPage(\'index.php?page=d2u_stellenmarkt&subpage=kontakte&func=edit&entry_id=' . $sql_kontakt->getValue('kontakt_id') . '\')">' . $sql_kontakt->getValue('name') . '</a></li>';
    }
    if (strlen($message) > 0) {
        $message .= '</ul>';
        $warning[] = $message;
    }
    return $warning;
}
开发者ID:TobiasKrais,项目名称:d2u_stellenmarkt,代码行数:33,代码来源:config.inc.php

示例8: generateCSSFile

 public static function generateCSSFile($themeId)
 {
     global $REX;
     // include scss compiler
     if (!class_exists('scssc')) {
         require_once $REX['INCLUDE_PATH'] . '/addons/website_manager/plugins/themes/classes/class.scss.inc.php';
     }
     // vars
     $scssPhpFile = self::getScssPhpSourceFile();
     $cssFile = self::constructCSSFileWithPathForBackend($themeId);
     // get sql for scss php file
     $theme = rex_sql::factory();
     $theme->setQuery('SELECT * FROM rex_website_theme WHERE id = ' . $themeId);
     // interpret php to scss
     ob_start();
     include $scssPhpFile;
     $interpretedPhp = ob_get_contents();
     ob_end_clean();
     // strip comments
     $interpretedPhp = self::stripCSSComments($interpretedPhp);
     // compile scss to css
     try {
         $scss = new scssc();
         $scss->setFormatter('scss_formatter');
         $compiledScss = $scss->compile($interpretedPhp);
     } catch (Exception $e) {
         echo "<strong>SCSS Compile Error:</strong> <br/>";
         echo $e->getMessage();
         exit;
     }
     // write css
     $fileHandle = fopen($cssFile, 'w');
     fwrite($fileHandle, $compiledScss);
     fclose($fileHandle);
 }
开发者ID:olien,项目名称:themes,代码行数:35,代码来源:class.rex_website_theme.inc.php

示例9: execute

 public function execute()
 {
     if (!rex::getUser()->isAdmin()) {
         throw new rex_api_exception('user has no permission for this operation!');
     }
     $type = rex_get('type', 'string');
     switch ($type) {
         case 'articles':
             $prefix = 'art\\_%';
             $defaultFields = [['translate:online_from', 'art_online_from', '1', '', '10', ''], ['translate:online_to', 'art_online_to', '2', '', '10', ''], ['translate:description', 'art_description', '3', '', '2', '']];
             break;
         case 'media':
             $prefix = 'med\\_%';
             $defaultFields = [['translate:pool_file_description', 'med_description', '1', '', '2', ''], ['translate:pool_file_copyright', 'med_copyright', '2', '', '1', '']];
             break;
         default:
             throw new rex_api_exception(sprintf('metainfo type "%s" does not have default field.', $type));
     }
     $existing = rex_sql::factory()->getArray('SELECT name FROM ' . rex::getTable('metainfo_field') . ' WHERE name LIKE ?', [$prefix]);
     $existing = array_column($existing, 'name', 'name');
     foreach ($defaultFields as $field) {
         if (!isset($existing[$field[1]])) {
             $return = call_user_func_array('rex_metainfo_add_field', $field);
             if (is_string($return)) {
                 throw new rex_api_exception($return);
             }
         }
     }
     return new rex_api_result(true, rex_i18n::msg('minfo_default_fields_created'));
 }
开发者ID:DECAF,项目名称:redaxo,代码行数:30,代码来源:api_default_fields.php

示例10: get_slices_for_article

    public static function get_slices_for_article($article_id, $clang_id = FALSE, $ctype_id = FALSE, $modultyp_id = FALSE)
    {
        global $REX;
        self::$slices = array();
        $sql = rex_sql::factory();
        $qry = '
SELECT id, re_article_slice_id, modultyp_id, ctype, clang  
FROM ' . $REX['TABLE_PREFIX'] . 'article_slice 
WHERE article_id=' . $article_id;
        if ($clang_id !== FALSE) {
            $qry .= ' AND clang = ' . $clang_id;
        }
        $sql->setQuery($qry);
        while ($sql->hasNext()) {
            self::$slices[$sql->getValue('re_article_slice_id')] = array('id' => $sql->getValue('id'), 'clang_id' => $sql->getValue('clang'), 'ctype_id' => $sql->getValue('ctype'), 'modultyp_id' => $sql->getValue('modultyp_id'));
            $sql->next();
        }
        if (count(self::$slices) > 1) {
            self::order_slices();
        }
        if (count(self::$slices) && $modultyp_id !== FALSE) {
            self::filter_slices_by_modultyp_id($modultyp_id);
        }
        if (count(self::$slices) && $ctype_id !== FALSE) {
            self::filter_slices_by_ctype_id($ctype_id);
        }
        if (count(self::$slices)) {
            foreach (self::$slices as $key => $val) {
                self::$slices[$key] = OOArticleSlice::getArticleSliceById($val['id'], $val['clang_id']);
            }
        }
        return self::$slices;
    }
开发者ID:nilsology,项目名称:addcode_includes,代码行数:33,代码来源:class.iw_article_slice.global.php

示例11: getListValue

 static function getListValue($params)
 {
     $return = array();
     $db = rex_sql::factory();
     // $db->debugsql = 1;
     $query = $params['params']['field']['query'];
     $pos = strrpos(strtoupper($query), 'ORDER BY ');
     if ($pos !== false) {
         $query = substr($query, 0, $pos);
     }
     $pos = strrpos(strtoupper($query), 'LIMIT ');
     if ($pos !== false) {
         $query = substr($query, 0, $pos);
     }
     $multiple = (int) $params['params']['field']['multiple'];
     if ($multiple != 1) {
         $where = ' `id` = ' . $db->escape($params['value']) . ' ';
     } else {
         $where = ' FIND_IN_SET(`id`, ' . $db->escape($params['value']) . ')';
     }
     $pos = strrpos(strtoupper($query), 'WHERE ');
     if ($pos !== false) {
         $query = substr($query, 0, $pos) . ' WHERE ' . $where . ' AND ' . substr($query, $pos + strlen('WHERE '));
     } else {
         $query .= ' WHERE ' . $where;
     }
     $db_array = $db->getArray($query);
     foreach ($db_array as $entry) {
         $return[] = $entry['name'];
     }
     if (count($return) == 0 && $params['value'] != '' && $params['value'] != '0') {
         $return[] = $params['value'];
     }
     return implode('<br />', $return);
 }
开发者ID:VIEWSION,项目名称:redaxo_yform,代码行数:35,代码来源:checkbox_sql.php

示例12: executeAction

 function executeAction()
 {
     $table = $this->getElement(2);
     // Tabelle vorhanden ?
     $sql = rex_sql::factory();
     $sql->debugsql = 1;
     $sql->setQuery('show tables');
     $table_exists = false;
     foreach ($sql->getArray() as $k => $v) {
         if ($table == $v) {
             $table_exists = true;
             break;
         }
     }
     if (!$table_exists) {
         $sql->setQuery('CREATE TABLE `' . $table . '` (`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY);');
     }
     // Welche Felder sind vorhanden ?
     $sql->setQuery('show columns from ' . $table);
     $sql_cols = $sql->getArray();
     $cols = array();
     foreach ($sql_cols as $k => $v) {
         $cols[] = $v['Field'];
     }
     // wenn Feld nicht in Datenbank, dann als TEXT anlegen.
     foreach ($this->params['value_pool']['sql'] as $key => $value) {
         if (!in_array($key, $cols)) {
             $sql->setQuery('ALTER TABLE `' . $table . '` ADD `' . $key . '` TEXT NOT NULL;');
         }
     }
     return;
 }
开发者ID:VIEWSION,项目名称:redaxo_yform,代码行数:32,代码来源:createdb.php

示例13: updatePrio

 protected static function updatePrio($order, $table, $idField, $useLike)
 {
     global $REX;
     $sql = rex_sql::factory();
     foreach ($order as $prio => $keyname) {
         $sql->setQuery('UPDATE ' . $table . ' SET priority = ' . ($prio + 1) . ' ' . self::getWhere($useLike, $idField, $keyname));
     }
 }
开发者ID:darwin26,项目名称:string_table,代码行数:8,代码来源:class.rex_prio_switch.inc.php

示例14: rex_copyRevisionContent

 function rex_copyRevisionContent($article_id, $clang, $from_revision_id, $to_revision_id, $from_re_sliceid = 0, $to_revision_delete = FALSE)
 {
     global $REX;
     if ($to_revision_delete) {
         $dc = rex_sql::factory();
         // $dc->debugsql = 1;
         $dc->setQuery('delete from ' . $REX['TABLE_PREFIX'] . 'article_slice where article_id=' . $article_id . ' and clang=' . $clang . ' and revision=' . $to_revision_id);
     }
     if ($from_revision_id == $to_revision_id) {
         return false;
     }
     $gc = rex_sql::factory();
     // $gc->debugsql = 1;
     $gc->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article_slice where re_article_slice_id='{$from_re_sliceid}' and article_id='{$article_id}' and clang='{$clang}' and revision='{$from_revision_id}'");
     if ($gc->getRows() == 1) {
         // letzt slice_id des ziels holen ..
         $glid = rex_sql::factory();
         // $glid->debugsql = 1;
         $glid->setQuery("\n\t\t\t\t\tselect \n\t\t\t\t\t\tr1.id, r1.re_article_slice_id\n\t        from \n\t\t\t\t\t\t" . $REX['TABLE_PREFIX'] . "article_slice as r1\n\t\t\t\t\tleft join " . $REX['TABLE_PREFIX'] . "article_slice as r2 on r1.id = r2.re_article_slice_id\n\t        where \n\t\t\t\t\t\tr1.article_id = {$article_id} and r1.clang = {$clang} and \n\t\t\t\t\t\tr2.id is NULL and \n\t\t\t\t\t\tr1.revision='{$to_revision_id}';");
         if ($glid->getRows() == 1) {
             $to_last_slice_id = $glid->getValue("r1.id");
         } else {
             $to_last_slice_id = 0;
         }
         $ins = rex_sql::factory();
         // $ins->debugsql = 1;
         $ins->setTable($REX['TABLE_PREFIX'] . "article_slice");
         $cols = rex_sql::factory();
         $cols->setquery("SHOW COLUMNS FROM " . $REX['TABLE_PREFIX'] . "article_slice");
         for ($j = 0; $j < $cols->rows; $j++, $cols->next()) {
             $colname = $cols->getValue("Field");
             if ($colname == "re_article_slice_id") {
                 $value = $to_last_slice_id;
             } elseif ($colname == "revision") {
                 $value = $to_revision_id;
             } elseif ($colname == "createdate") {
                 $value = time();
             } elseif ($colname == "updatedate") {
                 $value = time();
             } elseif ($colname == "createuser") {
                 $value = $REX["USER"]->getValue("login");
             } elseif ($colname == "updateuser") {
                 $value = $REX["USER"]->getValue("login");
             } else {
                 $value = $gc->getValue($colname);
             }
             if ($colname != "id") {
                 $ins->setValue($colname, $ins->escape($value));
             }
         }
         $ins->insert();
         // id holen und als re setzen und weitermachen..
         rex_copyRevisionContent($article_id, $clang, $from_revision_id, $to_revision_id, $gc->getValue("id"));
         return true;
     }
     rex_generateArticle($article_id);
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:58,代码来源:function_rex_copyrevisioncontent.inc.php

示例15: 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


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