function focus_setup_metainfo() { global $REX; if (!isset($REX['USER'])) { return; } $install_metas = array('med_focuspoint_data' => array('Focuspoint Data', 'med_focuspoint_data', 200, '', 1, '', '', '', ''), 'med_focuspoint_css' => array('Focuspoint CSS', 'med_focuspoint_css', 201, '', 1, '', '', '', '')); $db = new rex_sql(); foreach ($db->getDbArray('SHOW COLUMNS FROM `rex_file` LIKE \'med_focuspoint_%\';') as $column) { unset($install_metas[$column['Field']]); } foreach ($install_metas as $k => $v) { $db->setQuery('SELECT `name` FROM `rex_62_params` WHERE `name`=\'' . $k . '\';'); if ($db->getRows() > 0) { // FIELD KNOWN TO METAINFO BUT MISSING IN ARTICLE.. $db->setQuery('ALTER TABLE `rex_file` ADD `' . $k . '` TEXT NOT NULL;'); if ($REX['REDAXO']) { echo rex_info('Metainfo Feld ' . $k . ' wurde repariert.'); } } else { if (!function_exists('a62_add_field')) { require_once $REX['INCLUDE_PATH'] . '/addons/metainfo/functions/function_metainfo.inc.php'; } a62_add_field($v[0], $v[1], $v[2], $v[3], $v[4], $v[5], $v[6], $v[7], $v[8]); if ($REX['REDAXO']) { echo rex_info('Metainfo Feld ' . $k . ' wurde angelegt.'); } } } rex_file::copy(rex_path::addon("focuspoint", "classes/class.rex_effect_focuspoint_resize.inc.php"), rex_path::addon("image_manager", "classes/effects/class.rex_effect_focuspoint_resize.inc.php")); }
/** * SET CONTENT OF ROBOTS.TXT * * @return (string) robots.txt */ public function setContent($content) { global $REX; $out = ''; $langs = array_keys($REX['CLANG']); // get clang ids $defaultRobotsTxt = 'User-agent: *' . "\r\n" . 'Disallow:'; if (!$REX['ADDON']['seo42']['settings']['no_robots_txt_auto_disallow']) { foreach ($langs as $lang) { $query = "SELECT id FROM " . $REX['TABLE_PREFIX'] . "article WHERE seo_noindex = '1' AND status = 1 AND clang = " . $lang; $sql = new rex_sql(); $sql->setQuery($query); for ($i = 1; $i <= $sql->getRows(); $i++) { $out .= "Disallow: /" . seo42::getTrimmedUrl($sql->getValue('id'), $lang) . "\r\n"; $sql->next(); } } } if ($out != '') { $out = "User-agent: *" . "\r\n" . $out . "\r\n"; } if ($out == '' && $content == '') { $this->robots_txt = $defaultRobotsTxt; } else { $this->robots_txt = $out . $content; } }
function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0) { $this->label = $this->elements[1]; $table = $this->elements[2]; // ***** ERSTER AUFRUF -> key erstellen if (!$send) { $this->value = md5($_SERVER["REMOTE_ADDR"] . time()); } else { // in tabelle nachsehen ob formcode vorhanden $sql = 'select ' . $this->label . ' from ' . $table . ' WHERE ' . $this->label . '="' . $this->value . '" LIMIT 1'; $cd = new rex_sql(); if ($this->params["debug"]) { $cd->debugsql = true; } $cd->setQuery($sql); if ($cd->getRows() == 1) { $this->params["warning"][] = $this->elements[3]; $this->params["warning_messages"][] = $this->elements[3]; } } $form_output[] = '<input type="hidden" name="FORM[' . $this->params["form_name"] . '][el_' . $this->id . ']" value="' . htmlspecialchars(stripslashes($this->value)) . '" />'; $email_elements[$this->label] = stripslashes($this->value); $sql_elements[$this->label] = stripslashes($this->value); return; }
function asd_news_addClang($params) { global $REX; $id = $params['id']; $name = $params['name']; $now = new DateTime(); $error = false; $sql = new rex_sql(); $sql->setQuery('SELECT * FROM `' . rex_asd_news_config::getTable() . '` WHERE `clang` = ' . $REX['START_CLANG_ID']); for ($i = 1; $i <= $sql->getRows(); $i++) { $save = new rex_sql(); $save->setTable(rex_asd_news_config::getTable()); $save->setValues($sql->getRow()); $save->setValue('clang', $id); $save->setValue('createdAt', $now->format('Y-m-d H:i:s')); $save->setValue('updatedAt', $now->format('Y-m-d H:i:s')); $save->setValue('publishedAt', '0000-00-00 00:00:00'); $save->setValue('createdBy', $REX['USER']->getValue('user_id')); $save->setValue('updatedBy', $REX['USER']->getValue('user_id')); $save->setValue('publishedBy', 0); $save->setValue('status', 0); unset($save->values['news_id']); if (!$save->insert()) { $error = $save->getError(); } } if ($error) { echo rex_warning('ASD News: Neuigkeiten in der Sprache "' . $name . '" konnten nicht angelegt werden<br />' . $error); } else { echo rex_info('ASD News: Neuigkeiten in der Sprache "' . $name . '" wurden angelegt'); } }
/** * 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 = new rex_sql(); $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 = new rex_sql(); $sql->setQuery('DELETE FROM ' . $REX['TABLE_PREFIX'] . '62_params'); rex_generateAll(); }
/** * Konstruktor. Stellt die Daten der Kategorie aus der Datenbank zusammen. * @param int $kategorie_id Kategorie ID. * @param int $clang_id Redaxo SprachID. * @param string $table_prefix Redaxo Tabellen Praefix ($REX['TABLE_PREFIX']) */ public function __construct($kategorie_id, $clang_id, $table_prefix = "rex_") { $this->table_prefix = $table_prefix; // Sprachfallback $query_prove = "SELECT * FROM " . $this->table_prefix . "d2u_stellenmarkt_kategorien_lang AS lang " . "WHERE kategorie_id = " . $kategorie_id . " " . "ORDER BY clang_id DESC"; $result_prove = new rex_sql(); $result_prove->setQuery($query_prove); $num_rows_prove = $result_prove->getRows(); $is_lang_available = false; $fallback_lang_id = 0; for ($i = 0; $i < $num_rows_prove; $i++) { if ($result_prove->getValue("lang.clang_id") == $clang_id) { $is_lang_available = true; } else { $fallback_lang_id = $result_prove->getValue("lang.clang_id"); } $result_prove->next(); } $sql_clang_id = $clang_id; if ($is_lang_available == false) { $sql_clang_id = $fallback_lang_id; } $query = "SELECT * FROM " . $this->table_prefix . "d2u_stellenmarkt_kategorien AS kategorien " . "LEFT JOIN " . $this->table_prefix . "d2u_stellenmarkt_kategorien_lang AS lang " . "ON kategorien.kategorie_id = lang.kategorie_id " . "WHERE kategorien.kategorie_id = " . $kategorie_id . " " . "AND (clang_id = " . $sql_clang_id . " OR clang_id IS NULL) " . "LIMIT 0, 1"; $result = new rex_sql(); $result->setQuery($query); $num_rows = $result->getRows(); if ($num_rows > 0) { $this->kategorie_id = $result->getValue("kategorie_id"); if ($result->getValue("clang_id") != "") { $this->clang_id = $result->getValue("clang_id"); } $this->interne_bezeichnung = $result->getValue("interne_bezeichnung"); $this->name = $result->getValue("name"); } }
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 = new rex_sql(); // $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 = new rex_sql(); // $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 = new rex_sql(); // $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 = new rex_sql(); // $ins->debugsql = 1; $ins->setTable($REX['TABLE_PREFIX'] . "article_slice"); $cols = new rex_sql(); $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; }
/** * Vorgehensweise * Die install.sql muss bereits ausgeführt worden sein und die Module und * Action somit bereits in der Datenbank stehen. * Als erstes werden die IDs des Modules "Gästebuch - Eintragsliste" und der * Action "Gästebuch - Eintragsliste StatusPerdatei" ausgelesen und dann nachgesehen, * ob es dazu schon eine Zuweisung in der Tabelle rex_module_action gibt. * Ist das nicht der Fall, werden die IDs entsprechend eingetragen. * * Die automatische Zuweisung zwischen Action und Modul ist damit erledigt. * Im Fehlerfalle muss eine Meldung ausgegeben werden. * Die Action könnte dann evtl. per Hand noch zugewiesen werden. * * * @param string Name des Modules (auf richtige Schreibweise achten!) * @param string Name der Action (auf richtige Schreibweise achten!) * @return mixed TRUE oder ein Fehlertext */ function rex_a63_installAction2Modul($modul_name, $action_name) { global $REX; if (!isset($modul_name) or $modul_name == '' or !isset($action_name) or $action_name == '') { return 'rex_a63_installAction2Modul: Keinen Modul- oder Aktionname übergeben.'; } /** * Diese Abfrage gibt zurück * - wenn es bereits eine Verküpfung in der Tabelle rex_module_action gibt: * m_id a_id mod_action_m_id mod_action_a_id * 42 9 true true * * - gibt es noch keine Verknüpfung, sieht die Rückgabe so aus: * m_id a_id mod_action_m_id mod_action_a_id * 42 9 false false * * m_id und a_id sind von MySQL vergebene IDs und entsprechen nicht diesem Beispiel hier! * */ $qry = 'SELECT `' . $REX['TABLE_PREFIX'] . 'module`.`id` AS m_id, `' . $REX['TABLE_PREFIX'] . 'action`.`id` AS a_id, IF(`' . $REX['TABLE_PREFIX'] . 'module_action`.`module_id` != 0, "true", "false") AS mod_action_m_id, IF(`' . $REX['TABLE_PREFIX'] . 'module_action`.`action_id` != 0, "true", "false") AS mod_action_a_id FROM (`' . $REX['TABLE_PREFIX'] . 'module` , `' . $REX['TABLE_PREFIX'] . 'action`) LEFT JOIN `' . $REX['TABLE_PREFIX'] . 'module_action` ON ( `' . $REX['TABLE_PREFIX'] . 'module_action`.`module_id` = `' . $REX['TABLE_PREFIX'] . 'module`.`id` AND `' . $REX['TABLE_PREFIX'] . 'module_action`.`action_id` = `' . $REX['TABLE_PREFIX'] . 'action`.`id` ) WHERE `' . $REX['TABLE_PREFIX'] . 'module`.`name` = "' . $modul_name . '" AND `' . $REX['TABLE_PREFIX'] . 'action`.`name` = "' . $action_name . '" LIMIT 1'; $sql = new rex_sql(); //$sql->debugsql = true; $data = $sql->getArray($qry); if (is_array($data) and $sql->getRows() == 1) { foreach ($data as $row) { // prüfe IDs auf vorhandensein // sind diese IDs in dieser Kombination noch nicht in der Verknüpfungstabelle // dann können sie dort eingetragen werden if ($row['mod_action_m_id'] == 'false' and $row['mod_action_a_id'] == 'false') { $qry = 'INSERT INTO `' . $REX['TABLE_PREFIX'] . 'module_action` ( `id` , `module_id` , `action_id` ) VALUES (NULL , "' . $row['m_id'] . '", "' . $row['a_id'] . '")'; $sql2 = new rex_sql(); //$sql->debugsql = true; $sql2->setQuery($qry); if (!$REX['a63_sql_compare']) { $sql2->freeResult(); } } else { return 'rex_a63_installAction2Modul: Es exitiert bereits eine Zuweisung zwischen dem Modul "' . $modul_name . '" und der Aktion "' . $action_name . '".'; } } } else { return 'rex_a63_installAction2Modul: Fehler in der Datenbankabfrage. Ist der Modulname "' . $modul_name . '" und der Aktionname "' . $action_name . '" richtig?'; } if (!$REX['a63_sql_compare']) { $sql->freeResult(); } return true; }
public static function init() { global $REX; $sql = new rex_sql(); $sql->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'tracking_code WHERE id = 1'); if ($sql->getRows() > 0) { self::$trackingCode = $sql->getValue('tracking_code'); } }
/** * check if entrys exists for the addon * @return bool */ public static function checkEntrys() { global $REX; $sql = new rex_sql(); $sql->setTable($REX['TABLE_PREFIX'] . 'url_control_generate'); $sql->setWhere('`table` = "' . rex_asd_news_config::getTable() . '"'); $sql->select('1'); return (bool) $sql->getRows(); }
/** * delete the metafields */ public static function delFields() { global $REX; $sql = new rex_sql(); $sql->setQuery('SELECT `name` FROM ' . $REX['TABLE_PREFIX'] . '62_params WHERE `name` LIKE "asd_%"'); $delFields = array(); for ($i = 1; $i <= $sql->getRows(); $i++) { $delFields[] = a62_delete_field($sql->getValue('name')); $sql->next(); } return self::checkErrorMessage($delFields); }
function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0) { // ***** SELECT FESTLEGEN $SEL = new rex_select(); $SEL->setName('FORM[' . $this->params["form_name"] . '][el_' . $this->id . '][]'); $SEL->setId("el_" . $this->id); $SEL->setSize(5); $SEL->setMultiple(1); // ***** SQL - ROHDATEN ZIEHEN $sql = $this->elements[5]; $teams = new rex_sql(); $teams->debugsql = $this->params["debug"]; $teams->setQuery($sql); for ($t = 0; $t < $teams->getRows(); $t++) { $SEL->addOption($teams->getValue($this->elements[7]), $teams->getValue($this->elements[6])); $teams->next(); } $wc = ""; // if (isset($warning["el_" . $this->getId()])) $wc = $warning["el_" . $this->getId()]; $SEL->setStyle('class="multipleselect ' . $wc . '"'); // ***** EINGELOGGT ODER NICHT SETZEN if ($send == 0) { // erster aufruf // Daten ziehen if ($this->params["main_id"] > 0) { $this->value = array(); $g = new rex_sql(); $g->debugsql = $this->params["debug"]; $g->setQuery('select ' . $this->elements[3] . ' from ' . $this->elements[1] . ' where ' . $this->elements[2] . '=' . $this->params["main_id"]); $gg = $g->getArray(); if (is_array($gg)) { foreach ($gg as $g) { $this->value[] = $g[$this->elements[3]]; } } } } // ***** AUSWAHL SETZEN if (is_array($this->value)) { foreach ($this->value as $val) { $SEL->setSelected($val); } } // ***** AUSGEBEN $form_output[] = ' <p class="formmultipleselect"> <label class="multipleselect ' . $wc . '" for="el_' . $this->id . '" >' . $this->elements[4] . '</label> ' . $SEL->get() . ' </p>'; }
function enterObject(&$warning, $send, &$warning_messages) { if ($send == "1") { foreach ($this->xaObjects as $xoObject) { $sql = 'select ' . $this->xaElements[2] . ' from ' . $this->params["main_table"] . ' WHERE ' . $this->xaElements[2] . '="' . $xoObject->getValue() . '" LIMIT 1'; $cd = new rex_sql(); $cd->setQuery($sql); if ($cd->getRows() > 0) { $warning["el_" . $xoObject->getId()] = $this->params["error_class"]; $warning_messages[] = $this->xaElements[3]; } } } }
/** * Gibt den HTML Content zurück */ function get() { $table = $this->getTable(); $field = $this->getField(); $foreignField = $this->getForeignField(); $value = $this->formatValue(); $qry = 'SELECT ' . $field . ' FROM ' . $table . ' WHERE ' . $foreignField . ' = "' . $value . '"'; $sql = new rex_sql(); // $sql->debugsql = true; $sql->setQuery($qry); if ($sql->getRows() == 1) { return $sql->getValue($field); } return ''; }
function getValue($value) { if (!is_array($value)) { $value = array(); $section =& $this->getSection(); // Alle vorhanden Werte löschen $sql = new rex_sql(); $sql->setQuery('SELECT `' . $this->foreignField . '` FROM `' . $this->foreignTable . '` WHERE ' . $section->_getWhereString()); for ($i = 0; $i < $sql->getRows(); $i++) { $value[] = $sql->getValue($this->foreignField); $sql->next(); } } return $value; }
/** * Konstruktor. Stellt die Daten des Kontaktes aus der Datenbank zusammen. * @param int $kontakt_id Kontakt ID. * @param String $table_prefix. Redaxo Tabellen Praefix ($REX['TABLE_PREFIX']) */ public function __construct($kontakt_id, $table_prefix = "rex_") { $this->table_prefix = $table_prefix; $query = "SELECT * FROM " . $this->table_prefix . "d2u_stellenmarkt_kontakt " . "WHERE kontakt_id = " . $kontakt_id; $result = new rex_sql(); $result->setQuery($query); $num_rows = $result->getRows(); if ($num_rows > 0) { $this->kontakt_id = $result->getValue("kontakt_id"); $this->name = $result->getValue("name"); if ($result->getValue("bild") != "") { $this->bild = $result->getValue("bild"); } $this->telefon = $result->getValue("telefon"); $this->email = $result->getValue("email"); } }
function execute() { global $REX; $gt = new rex_sql(); if ($this->params["debug"]) { $gt->debugsql = true; } $gt->setQuery('select * from rex_xform_email_template where name="' . $this->action["elements"][2] . '"'); if ($gt->getRows() == 1) { $mail_to = $REX['ERROR_EMAIL']; if (isset($this->action["elements"][3]) && $this->action["elements"][3] != "") { foreach ($this->elements_email as $key => $value) { if ($this->action["elements"][3] == $key) { $mail_to = $value; } } } if (isset($this->action["elements"][4]) && $this->action["elements"][4] != "") { $mail_to = $this->action["elements"][4]; } $mail_from = $gt->getValue("mail_from"); $mail_subject = $gt->getValue("subject"); $mail_body = $gt->getValue("body"); foreach ($this->elements_email as $search => $replace) { $mail_from = str_replace('###' . $search . '###', $replace, $mail_from); $mail_subject = str_replace('###' . $search . '###', $replace, $mail_subject); $mail_body = str_replace('###' . $search . '###', $replace, $mail_body); $mail_from = str_replace('***' . $search . '***', urlencode($replace), $mail_from); $mail_subject = str_replace('***' . $search . '***', urlencode($replace), $mail_subject); $mail_body = str_replace('***' . $search . '***', urlencode($replace), $mail_body); } $mail = new rex_mailer(); $mail->AddAddress($mail_to, $mail_to); $mail->WordWrap = 80; $mail->FromName = $mail_from; $mail->From = $mail_from; $mail->Subject = $mail_subject; $mail->Body = nl2br($mail_body); $mail->AltBody = strip_tags($mail_body); // $mail->IsHTML(true); if (!$mail->Send()) { echo "FAILED"; } } }
public static function init() { global $REX; self::$curClang = $REX['CUR_CLANG']; $sql = new rex_sql(); $sql->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'string_table'); foreach ($REX['CLANG'] as $clangId => $clangName) { for ($i = 0; $i < $sql->getRows(); $i++) { $key = $sql->getValue('keyname'); $value = nl2br($sql->getValue('value_' . $clangId)); self::$stringTable[$clangId][$key] = $value; self::$stringTableKeys[$clangId][] = $REX['ADDON']['string_table']['settings']['key_start_token'] . $key . $REX['ADDON']['string_table']['settings']['key_end_token']; self::$stringTableValues[$clangId][] = $value; $sql->next(); } $sql->reset(); } }
function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0) { $SEL = new rex_select(); $SEL->setName('FORM[' . $this->params["form_name"] . '][el_' . $this->id . ']'); $SEL->setId("el_" . $this->id); $SEL->setSize(1); $sql = $this->elements[4]; $teams = new rex_sql(); $teams->debugsql = $this->params["debug"]; $teams->setQuery($sql); $sqlnames = array(); if ($this->elements[3] != 1) { // mit --- keine auswahl --- $SEL->addOption($this->elements[3], "0"); } for ($t = 0; $t < $teams->getRows(); $t++) { $SEL->addOption($teams->getValue($this->elements[6]), $teams->getValue($this->elements[5])); if (isset($this->elements[7])) { $sqlnames[$teams->getValue($this->elements[5])] = $teams->getValue($this->elements[7]); } $teams->next(); } $wc = ""; if (isset($warning["el_" . $this->getId()])) { $wc = $warning["el_" . $this->getId()]; } $SEL->setStyle(' class="select ' . $wc . '"'); if ($this->value == "" && isset($this->elements[7]) && $this->elements[7] != "") { $this->value = $this->elements[7]; } $SEL->setSelected($this->value); $form_output[] = ' <p class="formselect"> <label class="select ' . $wc . '" for="el_' . $this->id . '" >' . $this->elements[2] . '</label> ' . $SEL->get() . ' </p>'; $email_elements[$this->elements[1]] = stripslashes($this->value); if (isset($sqlnames[$this->value])) { $email_elements[$this->elements[1] . '_SQLNAME'] = stripslashes($sqlnames[$this->value]); } if (!isset($this->elements[8]) || $this->elements[8] != "no_db") { $sql_elements[$this->elements[1]] = $this->value; } }
function execute() { foreach ($this->elements_email as $k => $v) { if ($this->action["elements"][4] == $k) { $value = $v; } } $gd = new rex_sql(); // $gd->debugsql = 1; $gd->setQuery('select * from ' . $this->action["elements"][2] . ' where ' . $this->action["elements"][3] . '="' . addslashes($value) . '"'); if ($gd->getRows() == 1) { $ar = $gd->getArray(); foreach ($ar[0] as $k => $v) { $this->elements_email[$k] = $v; } } // $email_elements[$this->elements[1]] = stripslashes($this->value); // if ($this->elements[4] != "no_db") $sql_elements[$this->elements[1]] = $this->value; return; }
/** * @param array $params * @return array */ public static function isImageInUse($params) { /** @var i18n $I18N */ global $I18N; $sql = new rex_sql(); $sqlCols = rex_asd_news_config::getConfig('sql'); $sql->setQuery('SELECT `id`, `title` FROM `' . rex_asd_news_config::getTable() . '` WHERE `' . $sqlCols['picture'] . '` = "' . $params['filename'] . '"'); if ($sql->getRows()) { $message = $I18N->msg('asd_news') . '<br /><ul>'; for ($i = 1; $i <= $sql->getRow(); $i++) { $message .= ' <li> <a href="index.php?page=' . rex_asd_news_config::getName() . '&func=edit&id=' . $sql->getValue('id') . '"> ' . $sql->getValue('title') . ' </a> </li>'; } $message .= '</ul>'; $params['subject'][] = $message; } return $params['subject']; }
function rex_a62_metainfo_button($params) { global $REX, $I18N_META_INFOS; $fields = new rex_sql(); $fields->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . '62_params p,' . $REX['TABLE_PREFIX'] . '62_type t WHERE `p`.`type` = `t`.`id` AND `p`.`name` LIKE "cat_%" LIMIT 1'); $return = '<div class="rex-meta-button"><script type="text/javascript"><!-- function rex_metainfo_toggle() { var trs = getElementsByClass("rex-metainfo-cat"); for(i=0;i<trs.length;i++) { show = toggleElement(trs[i]); } if (show == "") changeImage("rex-meta-icon","media/file_del.gif") else changeImage("rex-meta-icon","media/file_add.gif"); } //--></script><a href="javascript:rex_metainfo_toggle();"><img src="media/file_add.gif" id="rex-meta-icon" alt="' . $I18N_META_INFOS->msg('edit_metadata') . '" title="' . $I18N_META_INFOS->msg('edit_metadata') . '" /></a></div>'; if ($fields->getRows() == 1) { return $return; } }
function rex_a62_metainfo_button($params) { global $REX, $I18N; $fields = new rex_sql(); $fields->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . '62_params p,' . $REX['TABLE_PREFIX'] . '62_type t WHERE `p`.`type` = `t`.`id` AND `p`.`name` LIKE "cat_%" LIMIT 1'); if ($fields->getRows() == 1) { $return = '<p class="rex-button-add"><script type="text/javascript"><!-- function rex_metainfo_toggle() { jQuery("#rex-form-structure-category .rex-metainfo-cat").toggle(); img = jQuery("img#rex-metainfo-icon"); if(img.attr("src") == "media/file_add.gif") img.attr("src","media/file_del.gif"); else img.attr("src","media/file_add.gif"); } //--></script><a class="rex-button-add" href="javascript:rex_metainfo_toggle();"><img src="media/file_add.gif" id="rex-metainfo-icon" alt="' . $I18N->msg('minfo_edit_metadata') . '" title="' . $I18N->msg('minfo_edit_metadata') . '" /></a></p>'; return $params['subject'] . $return; } return $params['subject']; }
/** * Erweitert das Meta-Formular um die neuen Meta-Felder */ function rex_a62_metainfo_form($params) { // Nur beim EDIT gibts auch ein Medium zum bearbeiten if ($params['extension_point'] == 'MEDIA_FORM_EDIT') { $params['activeItem'] = $params['media']; // Hier die category_id setzen, damit keine Warnung entsteht (REX_LINK_BUTTON) $params['activeItem']->setValue('category_id', 0); } else { if ($params['extension_point'] == 'MEDIA_ADDED') { global $REX; $sql = new rex_sql(); $qry = 'SELECT file_id FROM ' . $REX['TABLE_PREFIX'] . 'file WHERE filename="' . $params['filename'] . '"'; $sql->setQuery($qry); if ($sql->getRows() == 1) { $params['file_id'] = $sql->getValue('file_id'); } else { trigger_error('Error occured during file upload', E_USER_ERROR); exit; } } } return _rex_a62_metainfo_form('med_', $params, '_rex_a62_metainfo_med_handleSave'); }
} else { $dbchecked0 = ' checked="checked"'; } $redaxo_user_login = rex_post('redaxo_user_login', 'string'); $redaxo_user_pass = rex_post('redaxo_user_pass', 'string'); echo ' <p> <label for="redaxo_user_login">' . $I18N->msg("setup_046") . ':</label> <input type="text" value="' . $redaxo_user_login . '" id="redaxo_user_login" name="redaxo_user_login"' . rex_tabindex() . '/> </p> <p> <label for="redaxo_user_pass">' . $I18N->msg("setup_047") . ':</label> <input type="text" value="' . $redaxo_user_pass . '" id="redaxo_user_pass" name="redaxo_user_pass"' . rex_tabindex() . '/> </p>'; if ($user_sql->getRows() > 0) { echo ' <p> <input class="rex-chckbx" type="checkbox" id="noadmin" name="noadmin" value="1"' . rex_tabindex() . '/> <label class="rex-lbl-right" for="noadmin">' . $I18N->msg("setup_048") . '</label> </p>'; } echo ' <p> <input class="rex-sbmt" type="submit" value="' . $I18N->msg("setup_049") . '"' . rex_tabindex() . ' /> </p> </fieldset> </form>'; } // ---------------------------------- MODUS 5 | Setup verschieben ...
} else { $func_link = "edit"; } $lang_chooser .= "<a href='" . $_SERVER["PHP_SELF"] . "?page=" . $page . "&subpage=" . $subpage . "&func=" . $func_link . "&entry_id=" . $entry_id . "'" . $style . ">"; $lang_chooser .= $I18N_STELLEN->msg('sprachunabhaengig'); $lang_chooser .= "</a>"; } foreach ($REX['CLANG'] as $clang_id => $clang_name) { $lang_chooser .= " | "; if ($subform == $clang_id + 1) { $lang_chooser .= $clang_name; } else { $query = "SELECT * FROM " . $REX['TABLE_PREFIX'] . "d2u_stellenmarkt_kategorien_lang WHERE kategorie_id =" . $entry_id . " AND clang_id = " . $clang_id; $result = new rex_sql(); $result->setQuery($query); $num_rows = $result->getRows(); if ($num_rows == 0) { $func_link = "add"; $style = ' class="rex-offline"'; } else { $func_link = "edit"; $style = ' class="rex-online"'; } $lang_chooser .= "<a href='" . $_SERVER["PHP_SELF"] . "?page=" . $page . "&subpage=" . $subpage . "&subform=" . ($clang_id + 1) . "&func=" . $func_link . "&entry_id=" . $entry_id . "' " . $style . ">"; $lang_chooser .= $clang_name; $lang_chooser .= "</a>"; } } } if ($subform == 0) { $form = rex_form::factory($REX['TABLE_PREFIX'] . 'd2u_stellenmarkt_kategorien', $I18N_STELLEN->msg('kategorien') . " " . $I18N_STELLEN->msg('sprachunabhaengig'), "kategorie_id = " . $entry_id, "post", false);
if ($KAT->getRows() != 1) { // kategorie existiert nicht if ($category_id != 0) { $category_id = 0; $article_id = 0; } } else { // kategorie existiert $KPATH = explode('|', $KAT->getValue('path')); $KATebene = count($KPATH) - 1; for ($ii = 1; $ii < $KATebene; $ii++) { $SKAT = new rex_sql(); $SKAT->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'article WHERE id=' . $KPATH[$ii] . ' AND startpage=1 AND clang=' . $clang); $catname = str_replace(' ', ' ', $SKAT->getValue('catname')); $catid = $SKAT->getValue('id'); if ($SKAT->getRows() == 1) { if ($KATPERM || $REX_USER->hasPerm('csw[' . $catid . ']') || $REX_USER->hasPerm('csr[' . $catid . ']')) { $KATout .= '<li>: <a href="index.php?page=structure&category_id=' . $catid . '&clang=' . $clang . '"' . rex_tabindex() . '>' . $catname . '</a> </li>'; $KATPATH .= $KPATH[$ii] . "|"; if ($REX_USER->hasPerm('csw[' . $catid . ']')) { $KATPERM = true; } } } } if ($KATPERM || $REX_USER->hasPerm('csw[' . $category_id . ']') || $REX_USER->hasPerm('csr[' . $category_id . ']')) { $catname = str_replace(' ', ' ', $KAT->getValue('catname')); $KATout .= '<li>: <a href="index.php?page=structure&category_id=' . $category_id . '&clang=' . $clang . '"' . rex_tabindex() . '>' . $catname . '</a> </li>'; $KATPATH .= $category_id . '|'; if ($REX_USER->hasPerm('csw[' . $category_id . ']')) { $KATPERM = true;
function getGuestbook($user_id, $aid, $params = array()) { global $REX; $MY = FALSE; if (is_object($REX['COM_USER']) && $REX['COM_USER']->getValue("rex_com_user.id") == $user_id) { $MY = TRUE; } $u = new rex_sql(); $u->setQuery("select * from rex_com_user where id=" . $user_id); if ($u->getRows() != 1) { return ""; } // ***** ADD MESSAGE if (is_object($REX['COM_USER']) && $_REQUEST["add_message"] != "") { $text = $_REQUEST["text"]; if ($text == "") { $errormessage = '<p class="warning" colspan=2>Es wurde keine Nachricht eingetragen !</p>'; } else { $addmsgsql = new rex_sql(); $addmsgsql->setTable("rex_com_guestbook"); $addmsgsql->setValue("user_id", $user_id); $addmsgsql->setValue("from_user_id", $REX['COM_USER']->getValue("id")); $addmsgsql->setValue("text", $text); $addmsgsql->setValue("create_datetime", time()); $addmsgsql->insert(); if ($user_id != $REX['COM_USER']->getValue('rex_com_user.id')) { rex_com_user::exeAction($user_id, "sendemail_guestbook", array("user_id" => $REX['COM_USER']->getValue('rex_com_user.id'), "firstname" => $REX['COM_USER']->getValue('rex_com_user.firstname'), "name" => $REX['COM_USER']->getValue('rex_com_user.name'), "login" => $REX['COM_USER']->getValue('rex_com_user.login'), "to_user_id" => $u->getValue('rex_com_user.id'), "to_firstname" => $u->getValue('rex_com_user.firstname'), "to_name" => $u->getValue('rex_com_user.name'), "to_login" => $u->getValue('rex_com_user.login'))); } } } elseif ($MY && $_REQUEST["delete_message"] != "") { $msg_id = (int) $_REQUEST["msg_id"]; if ($msg_id == 0) { $errormessage = '<p class="warning">Es wurde keine Nachricht ausgewählt!</p>'; } else { $addmsgsql = new rex_sql(); // $addmsgsql->debugsql = 1; $addmsgsql->setQuery('delete from rex_com_guestbook where id=' . $msg_id . ' and user_id="' . $REX['COM_USER']->getValue("id") . '"'); } } // ***** SHOW MESSAGES $guestsql = new rex_sql(); $guestsql->debugsql = 0; $guestsql->setQuery("SELECT * \n\t\t\tFROM rex_com_guestbook \n\t\t\tLEFT JOIN rex_com_user ON rex_com_guestbook.from_user_id=rex_com_user.id \n\t\t\tWHERE rex_com_guestbook.user_id='" . $user_id . "' \n\t\t\tORDER BY rex_com_guestbook.create_datetime desc"); if ($guestsql->getRows() <= 0) { $echo .= '<p class="com-whitebox">Kein Gästebucheintrag vorhanden !</p>'; } else { $cl = ""; for ($i = 0; $i < $guestsql->getRows(); $i++) { // $cl $echo .= ' <div class="com-guestbook"> <div class="com-image"> <p class="image">' . rex_com_showUser($guestsql, "image") . '</p> </div> <div class="com-content"> <div class="com-content-2"> <div class="com-content-name"> <p><span class="color-1">' . rex_com_showUser($guestsql, "name") . ', ' . rex_com_showUser($guestsql, "city", "", FALSE) . '</span> <br />' . rex_com_formatter($guestsql->getValue("rex_com_guestbook.create_datetime"), 'datetime') . ' </p> </div> <p><b>' . nl2br(htmlspecialchars($guestsql->getValue("rex_com_guestbook.text"))) . '</b></p>'; if ($guestsql->getValue("rex_com_user.motto") != '') { $echo .= '<p>Motto: ' . $guestsql->getValue("rex_com_user.motto") . '</p>'; } if ($MY) { $link_params = array_merge($params, array("user_id" => $user_id, "delete_message" => 1, "msg_id" => $guestsql->getValue("rex_com_guestbook.id"))); $echo .= '<br /><p class="link-button"><a href="' . rex_getUrl($aid, '', $link_params) . '"><span>Löschen</span></a></p>'; } $echo .= '</div></div> <div class="clearer"> </div> </div>'; if ($cl == "") { $cl = ' class="alternative"'; } else { $cl = ""; } $guestsql->next(); } } // $echo .= '</tr></table>'; if (is_object($REX['COM_USER'])) { $echo .= '<div id="rex-form" class="com-guestbook-form spcl-bgcolor"> <form action="' . $REX["FRONTEND_FILE"] . '" method="post" id="guestbookform"> <h2>Einen neuen Eintrag schreiben</h2> ' . $errormessage . ' <input type="hidden" name="add_message" value="1" /> <input type="hidden" name="user_id" value="' . $user_id . '" /> <input type="hidden" name="article_id" value="' . $aid . '" /> '; foreach ($params as $k => $v) { $echo .= '<input type="hidden" name="' . $k . '" value="' . htmlspecialchars($v) . '" />'; } $echo .= ' <p class="formtextarea"> <label for="f-message">Nachricht:</label> <textarea id="f-message" name="text" cols="40" rows="4" /></textarea> </p> <p class="link-save"> <a href="javascript:void(0);" onclick="document.getElementById(\'guestbookform\').submit()"><span>Speichern</span></a></p> </p> <div class="clearer"> </div> </form> </div>'; } return $echo; }
// ------------- MODUL IST VORHANDEN $module_id = $CM->getValue($REX['TABLE_PREFIX'] . "article_slice.modultyp_id"); // ----- RECHTE AM MODUL ? if ($REX_USER->hasPerm("admin[]") || $REX_USER->hasPerm("dev[]") || $REX_USER->hasPerm("module[{$module_id}]") || $REX_USER->hasPerm("module[0]")) { // rechte sind vorhanden // ctype beachten // verschieben / vertauschen // article regenerieren. $slice_id = $CM->getValue($REX['TABLE_PREFIX'] . "article_slice.id"); $slice_article_id = $CM->getValue("article_id"); $re_slice_id = $CM->getValue($REX['TABLE_PREFIX'] . "article_slice.re_article_slice_id"); $slice_ctype = $CM->getValue($REX['TABLE_PREFIX'] . "article_slice.ctype"); $gs = new rex_sql(); // $gs->debugsql = 1; $gs->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article_slice where article_id='{$slice_article_id}'"); for ($i = 0; $i < $gs->getRows(); $i++) { $SID[$gs->getValue("re_article_slice_id")] = $gs->getValue("id"); $SREID[$gs->getValue("id")] = $gs->getValue("re_article_slice_id"); $SCTYPE[$gs->getValue("id")] = $gs->getValue("ctype"); $gs->next(); } $message = $I18N->msg('slice_moved_error'); // ------ moveup if ($function == "moveup") { if ($SREID[$slice_id] > 0) { if ($SCTYPE[$SREID[$slice_id]] == $slice_ctype) { $gs->setQuery("update " . $REX['TABLE_PREFIX'] . "article_slice set re_article_slice_id='" . $SREID[$SREID[$slice_id]] . "' where id='" . $slice_id . "'"); $gs->setQuery("update " . $REX['TABLE_PREFIX'] . "article_slice set re_article_slice_id='" . $slice_id . "' where id='" . $SREID[$slice_id] . "'"); if ($SID[$slice_id] > 0) { $gs->setQuery("update " . $REX['TABLE_PREFIX'] . "article_slice set re_article_slice_id='" . $SREID[$slice_id] . "' where id='" . $SID[$slice_id] . "'"); }
function regenerateArticlesByModultypId($modules) { global $PHP_SELF, $module_id, $FORM, $REX_USER, $REX, $I18N; include_once $REX[INCLUDE_PATH] . "/clang.inc.php"; $modules = explode("__", $modules); array_pop($modules); $gc = new rex_sql(); foreach ($modules as $modul_id) { $gc->setQuery("SELECT DISTINCT(" . $REX['TABLE_PREFIX'] . "article.id) FROM " . $REX['TABLE_PREFIX'] . "article\n \t LEFT JOIN " . $REX['TABLE_PREFIX'] . "article_slice ON " . $REX['TABLE_PREFIX'] . "article.id=" . $REX['TABLE_PREFIX'] . "article_slice.article_id\n \t WHERE " . $REX['TABLE_PREFIX'] . "article_slice.modultyp_id='{$modul_id}'"); for ($i = 0; $i < $gc->getRows(); $i++) { rex_generateArticle($gc->getValue($REX['TABLE_PREFIX'] . "article.id")); $gc->next(); } } }