|
From: <txm...@us...> - 2014-06-02 20:02:15
|
Revision: 12561
http://sourceforge.net/p/xoops/svn/12561
Author: txmodxoops
Date: 2014-06-02 20:02:11 +0000 (Mon, 02 Jun 2014)
Log Message:
-----------
Added more file
Updated
Work in progress
Modified Paths:
--------------
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin_pages.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/file.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/sql_files.php
Added Paths:
-----------
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_print.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_rss.php
XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_submit.php
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin_pages.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin_pages.php 2014-06-02 08:21:11 UTC (rev 12560)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/admin_pages.php 2014-06-02 20:02:11 UTC (rev 12561)
@@ -174,7 +174,7 @@
* @param string $language
*/
public function getAdminPagesSave($module_name, $table_name, $language, $fpif, $fpmf) {
- $stu_table_name = strtoupper($table_name);
+ $stu_table_name = strtoupper($table_name);
$ret = <<<EOT
case 'save':
if ( !\$GLOBALS['xoopsSecurity']->check() ) {
@@ -190,9 +190,9 @@
{
$field_name = $this->fields[$f]->getVar('field_name');
$field_element = $this->fields[$f]->getVar('field_element');
- if(($field_element == 1) || ($field_element == 2) || ($field_element == 3) || ($field_element > 11)) {
+ /*if(($field_element == 1) || ($field_element == 2) || ($field_element == 3) || ($field_element > 11)) {
$this->adminobjects->getSimpleSetVar($table_name, $field_name);
- } elseif(($field_element == 4) || ($field_element == 5)) {
+ } else*/if(($field_element == 4) || ($field_element == 5)) {
$this->adminobjects->getCheckBoxOrRadioYN($table_name, $field_name);
} elseif($field_element == 9) {
$this->adminobjects->getUploadImage($module_name, $table_name, $field_name);
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/file.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/file.php 2014-06-02 08:21:11 UTC (rev 12560)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/file.php 2014-06-02 20:02:11 UTC (rev 12561)
@@ -384,18 +384,18 @@
*/
public function getHeaderFilesComments($module, $filename) {
- $mod_name = $module->getVar('mod_name');
- $mod_version = $module->getVar('mod_version');
- $mod_since = $module->getVar('mod_since');
- $mod_min_xoops = $module->getVar('mod_min_xoops');
- $mod_author = $module->getVar('mod_author');
- $mod_credits = $module->getVar('mod_credits');
- $mod_author_mail = $module->getVar('mod_author_mail');
- $mod_author_website_url = $module->getVar('mod_author_website_url');
- $mod_license = $module->getVar('mod_license');
- $mod_subversion = $module->getVar('mod_subversion');
+ $name = $module->getVar('mod_name');
+ $version = $module->getVar('mod_version');
+ $since = $module->getVar('mod_since');
+ $min_xoops = $module->getVar('mod_min_xoops');
+ $author = $module->getVar('mod_author');
+ $credits = $module->getVar('mod_credits');
+ $author_mail = $module->getVar('mod_author_mail');
+ $author_website_url = $module->getVar('mod_author_website_url');
+ $license = $module->getVar('mod_license');
+ $subversion = $module->getVar('mod_subversion');
$date = date('D Y/m/d G:i:s');
- $package = strtolower($mod_name);
+ $package = strtolower($name);
$ret = <<<EOT
<?php
@@ -409,15 +409,15 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
- * {$mod_name} module for xoops
+ * {$name} module for xoops
*
* @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
- * @license {$mod_license}
+ * @license {$license}
* @package {$package}
- * @since {$mod_since}
- * @min_xoops {$mod_min_xoops}
- * @author {$mod_author} - Email:<{$mod_author_mail}> - Website:<{$mod_author_website_url}>
- * @version \$Id: {$mod_version} {$filename} {$mod_subversion} {$date}Z {$mod_credits} \$
+ * @since {$since}
+ * @min_xoops {$min_xoops}
+ * @author {$author} - Email:<{$author_mail}> - Website:<{$author_website_url}>
+ * @version \$Id: {$version} {$filename} {$subversion} {$date}Z {$credits} \$
*/\n
EOT;
return $ret;
Modified: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/sql_files.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/sql_files.php 2014-06-02 08:21:11 UTC (rev 12560)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/sql_files.php 2014-06-02 20:02:11 UTC (rev 12561)
@@ -113,29 +113,27 @@
*/
public function getDatabaseTables($module_name)
{
- $ret = '';
+ $ret = null;
foreach(array_keys($this->tables) as $t)
{
$table_name = $this->tables[$t]->getVar('table_name');
$table_autoincrement = $this->tables[$t]->getVar('table_autoincrement');
$nb_fields = $this->tables[$t]->getVar('table_nbfields');
- $ret .= $this->getDatabaseTable($module_name, $table_name, $table_autoincrement, $nb_fields);
+ $ret .= $this->getDatabaseFields($module_name, $table_name, $table_autoincrement, $nb_fields);
}
return $ret;
}
/*
- * @public function getDatabaseTable
+ * @public function getDatabaseFields
* @param string $module_name
* @param string $table_name
* @param boolean $table_autoincrement
* @param integer $nb_fields
*/
- public function getDatabaseTable($module_name, $table_name, $table_autoincrement, $nb_fields)
+ public function getDatabaseFields($module_name, $table_name, $table_autoincrement, $nb_fields)
{
- $ret = '';
- $j = 0;
- $comma = array();
+ $ret = null; $j = 0; $comma = array();
foreach(array_keys($this->fields) as $f)
{
// Creation of database table
@@ -195,38 +193,34 @@
$type = $field_type.'('.$field_value.')';
$default = "DEFAULT '{$field_default}'";
break;
- }
-
- if ( ($f == 1) && ($table_autoincrement == 1) ) {
- $ret .= $this->getFieldRow($field_name, $type, $field_attribute, $field_null, $default, 'auto_increment');
- $comma[$j] = $this->getKey(1, $field_name);
- $j++;
- } else {
- switch( $field_key ) {
- case 'unique':
- case 'index':
- case 'fulltext':
- switch( $field_key ) {
- case 'unique':
- $ret .= $this->getFieldRow($field_name, $type, $field_attribute, $field_null, $default);
- $comma[$j] = $this->getKey(2, $field_name);
- break;
- case 'index':
- $ret .= $this->getFieldRow($field_name, $type, $field_attribute, $field_null, $default);
- $comma[$j] = $this->getKey(3, $field_name);
- break;
- case 'fulltext':
- $ret .= $this->getFieldRow($field_name, $type, $field_attribute, $field_null, $default);
- $comma[$j] = $this->getKey(4, $field_name);
- break;
- }
- break;
- default:
+ }
+ switch( $field_key ) {
+ case 'PRIMARY':
+ if ( ($f == 1) && ($table_autoincrement == 1) ) {
+ $ret .= $this->getFieldRow($field_name, $type, $field_attribute, $field_null, null, 'auto_increment');
+ $comma[$j] = $this->getKey(1, $field_name);
+ } else {
$ret .= $this->getFieldRow($field_name, $type, $field_attribute, $field_null, $default);
- break;
- }
- $j++;
+ $comma[$j] = $this->getKey(1, $field_name);
+ }
+ break;
+ case 'UNIQUE':
+ $ret .= $this->getFieldRow($field_name, $type, $field_attribute, $field_null, $default);
+ $comma[$j] = $this->getKey(2, $field_name);
+ break;
+ case 'INDEX':
+ $ret .= $this->getFieldRow($field_name, $type, $field_attribute, $field_null, $default);
+ $comma[$j] = $this->getKey(3, $field_name);
+ break;
+ case 'FULLTEXT':
+ $ret .= $this->getFieldRow($field_name, $type, $field_attribute, $field_null, $default);
+ $comma[$j] = $this->getKey(4, $field_name);
+ break;
+ default:
+ $ret .= $this->getFieldRow($field_name, $type, $field_attribute, $field_null, $default);
+ break;
}
+ $j++;
}
}
$ret .= $this->getCommaCicle($j, $comma);
@@ -245,6 +239,39 @@
return $ret;
}
/*
+ * @public function getFieldRow
+ * @param string $field_name
+ * @param string $field_type_value
+ * @param string $field_attribute
+ * @param string $field_null
+ * @param string $field_default
+ * @param string $autoincrement
+ */
+ public function getFieldRow($field_name, $field_type_value, $field_attribute = null, $field_null = null, $field_default = null, $autoincrement = null) {
+ $ret_autoincrement = <<<SQL
+`{$field_name}` {$field_type_value} {$field_attribute} {$field_null} {$autoincrement},\n
+SQL;
+ $ret_field_attribute = <<<SQL
+`{$field_name}` {$field_type_value} {$field_attribute} {$field_null} {$field_default},\n
+SQL;
+ $ret_no_field_attribute = <<<SQL
+`{$field_name}` {$field_type_value} {$field_null} {$field_default},\n
+SQL;
+ $ret_slow = <<<SQL
+`{$field_name}` {$field_type_value},\n
+SQL;
+ if(!empty($autoincrement)) {
+ $ret = $ret_autoincrement;
+ } elseif($field_attribute != null) {
+ $ret = $ret_field_attribute;
+ } elseif($field_attribute == null) {
+ $ret = $ret_no_field_attribute;
+ } else {
+ $ret = $ret_slow;
+ }
+ return $ret;
+ }
+ /*
* @public function getKey
* @param integer $key
* @param array $field_name
@@ -274,30 +301,8 @@
}
return $ret;
}
+
/*
- * @public function getFieldRow
- * @param string $field_name
- * @param string $field_type_value
- * @param array $field_attribute
- * @param string $field_null
- * @param string $field_default
- * @param string $autoincrement
- */
- public function getFieldRow($field_name, $field_type_value, $field_attribute, $field_null, $field_default = '', $autoincrement = '')
- {
- if(!empty($autoincrement)) {
- $ret = <<<SQL
-`{$field_name}` {$field_type_value} {$field_attribute} {$field_null} {$field_default} {$autoincrement},\n
-SQL;
- } else {
- $ret = <<<SQL
-`{$field_name}` {$field_type_value} {$field_attribute} {$field_null} {$field_default},\n
-SQL;
- }
-
- return $ret;
- }
- /*
* @public function getComma
* @param array $array
* @param string $comma
Added: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_print.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_print.php (rev 0)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_print.php 2014-06-02 20:02:11 UTC (rev 12561)
@@ -0,0 +1,164 @@
+<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+/**
+ * tdmcreate module
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @package tdmcreate
+ * @since 2.5.0
+ * @author Txmod Xoops http://www.txmodxoops.org
+ * @version $Id: user_print.php 12258 2014-01-02 09:33:29Z timgno $
+ */
+defined('XOOPS_ROOT_PATH') or die('Restricted access');
+
+class UserPrint extends TDMCreateFile
+{
+ /*
+ * @var string
+ */
+ private $tdmcfile = null;
+ /*
+ * @var string
+ */
+ private $table = null;
+ /*
+ * @var string
+ */
+ private $fields = null;
+ /*
+ * @public function constructor
+ * @param string $module
+ * @param string $file_name
+ */
+ public function __construct($module, $table, $fields, $filename) {
+ $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->setModule($module);
+ //$this->setTable($table);
+ $this->setFileName($filename);
+ $this->table = $table;
+ $this->fields = $fields;
+ }
+ /*
+ * @static function &getInstance
+ * @param string $module
+ * @param mixed $table
+ * @param string $filename
+ */
+ public static function &getInstance($module, $table, $fields, $filename)
+ {
+ static $instance = false;
+ if (!$instance) {
+ $instance = new self($module, $table, $fields, $filename);
+ }
+ return $instance;
+ }
+
+ /*
+ * @public function getUserPrint
+ * @param string $mod_name
+ * @param string $table_name
+ * @param string $language
+ */
+ public function getUserPrint($mod_name, $table_name, $language) {
+ $stu_mod_name = strtoupper($mod_name);
+ $stl_mod_name = strtolower($mod_name);
+ $stu_table_name = strtoupper($table_name);
+
+ $ucf_mod_name = ucfirst($mod_name);
+ $ucf_table_name = ucfirst($table_name);
+
+ foreach(array_keys($this->fields) as $f)
+ {
+ $field_name = $this->fields[$f]->getVar('field_name');
+ $rp_field_name = $field_name;
+ if(strpos($field_name, '_')) {
+ $str = strpos($field_name, '_');
+ if($str !== false){
+ $rp_field_name = substr($field_name, $str + 1, strlen($field_name));
+ }
+ }
+ $lp_field_name = substr($field_name, 0, strpos($field_name, '_'));
+ if(( $f == 1 ) && ($this->table->getVar('table_autoincrement') == 1)){
+ $fpif = $field_name;
+ } else {
+ if ( $this->fields[$f]->getVar('field_main') == 1 ) {
+ $fpmf = $field_name; // fpmf = fields parameters main field
+ }
+ }
+ }
+ $stu_lp_field_name = strtoupper($lp_field_name);
+ $ret = <<<EOT
+\ninclude_once 'header.php';
+{$lp_field_name} = isset(\$_GET['{$fpif}']) ? intval(\$_GET['{$fpif}']) : 0;
+if ( empty({$fpif}) ) {
+ redirect_header({$stu_mod_name}_URL . '/index.php', 2, {$language}NO{$stu_lp_field_name});
+}
+EOT;
+ if(( $field_name == $lp_field_name.'_published' ) {
+ $ret .= <<<EOT
+// Verify that the article is published
+{$lp_field_name} = new {$ucf_mod_name}{$ucf_table_name}({$fpif});
+// Not yet published
+if ( {$lp_field_name}->getVar('{$lp_field_name}_published') == 0 || {$lp_field_name}->getVar('{$lp_field_name}_published') > time() ) {
+ redirect_header({$stu_mod_name}_URL . '/index.php', 2, {$language}NO{$stu_lp_field_name});
+ exit();
+}
+EOT;
+ }
+ if(( $field_name == $lp_field_name.'_expired' ) {
+ $ret .= <<<EOT
+// Expired
+if ( {$lp_field_name}->getVar('{$lp_field_name}_expired') != 0 && {$lp_field_name}->getVar('{$lp_field_name}_expired') < time() ) {
+ redirect_header({$stu_mod_name}_URL . '/index.php', 2, {$language}NO{$stu_lp_field_name});
+ exit();
+}
+EOT;
+ }
+ $ret .= <<<EOT
+
+// Verify permissions
+\$gperm_handler =& xoops_gethandler('groupperm');
+if (is_object(\$xoopsUser)) {
+ \$groups = \$xoopsUser->getGroups();
+} else {
+ \$groups = XOOPS_GROUP_ANONYMOUS;
+}
+if (!\$gperm_handler->checkRight('{$stl_mod_name}_view', {$lp_field_name}->getVat('{$fpif}'), \$groups, \$xoopsModule->getVar('mid'))) {
+ redirect_header({$stu_mod_name}_URL . '/index.php', 3, _NOPERM);
+ exit();
+}
+EOT;
+ return $ret;
+ }
+
+ /*
+ * @public function render
+ * @param null
+ */
+ public function render() {
+ $module = $this->getModule();
+ //$table = $this->getTable();
+ //$fields = $this->getFields();
+ $filename = $this->getFileName();
+ $module_name = $module->getVar('mod_name');
+ $table_name = $this->table->getVar('table_name');
+ $stu_mod_name = strtoupper($module_name);
+ $stl_mod_name = strtolower($module_name);
+ $stu_table_name = strtoupper($table_name);
+ $stl_table_name = strtolower($table_name);
+ $language = $this->getLanguage($module_name, 'MA');
+ $content = $this->getHeaderFilesComments($module, $filename);
+ $content .= $this->getUserPrint($module_name, $table_name, $language);
+ $this->tdmcfile->create($module_name, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
+ return $this->tdmcfile->renderFile();
+ }
+}
\ No newline at end of file
Added: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_rss.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_rss.php (rev 0)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_rss.php 2014-06-02 20:02:11 UTC (rev 12561)
@@ -0,0 +1,193 @@
+<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+/**
+ * tdmcreate module
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @package tdmcreate
+ * @since 2.5.0
+ * @author Txmod Xoops http://www.txmodxoops.org
+ * @version $Id: user_rss.php 12258 2014-01-02 09:33:29Z timgno $
+ */
+defined('XOOPS_ROOT_PATH') or die('Restricted access');
+
+class UserRss extends TDMCreateFile
+{
+ /*
+ * @var string
+ */
+ private $tdmcfile = null;
+ /*
+ * @var string
+ */
+ private $table = null;
+ /*
+ * @var string
+ */
+ private $fields = null;
+ /*
+ * @public function constructor
+ * @param string $module
+ * @param string $file_name
+ */
+ public function __construct($module, $table, $fields, $filename) {
+ $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->setModule($module);
+ //$this->setTable($table);
+ //$this->setFileName($filename);
+ $this->table = $table;
+ $this->fields = $fields;
+ }
+ /*
+ * @static function &getInstance
+ * @param string $module
+ * @param mixed $table
+ * @param string $filename
+ */
+ public static function &getInstance($module, $table, $fields, $filename)
+ {
+ static $instance = false;
+ if (!$instance) {
+ $instance = new self($module, $table, $fields, $filename);
+ }
+ return $instance;
+ }
+
+ /*
+ * @public function getUserRss
+ * @param string $table_name
+ * @param string $language
+ */
+ public function getUserRss($module_name, $table_name, $language) {
+ $stu_table_name = strtoupper($table_name);
+
+ foreach(array_keys($this->fields) as $f)
+ {
+ $field_name = $this->fields[$f]->getVar('field_name');
+ $rp_field_name = $field_name;
+ if(strpos($field_name, '_')) {
+ $str = strpos($field_name, '_');
+ if($str !== false){
+ $rp_field_name = substr($field_name, $str + 1, strlen($field_name));
+ }
+ }
+ $lp_field_name = substr($field_name, 0, strpos($field_name, '_'));
+ if($f == 1) {
+ $fpif = $field_name;
+ }
+ if($this->fields[$f]->getVar('field_main') == 1) {
+ $fpmf = $field_name;
+ }
+ if($this->fields[$f]->getVar('field_parent') == 1) {
+ $fppf = $field_name;
+ }
+ }
+
+ $ret = <<<EOT
+include_once 'header.php';
+\${$fppf} = {$module_name}_CleanVars(\$_GET, '{$fppf}', 0);
+include_once XOOPS_ROOT_PATH.'/class/template.php';
+\$items_count = \$xoopsModuleConfig['perpagerss'];
+
+if (function_exists('mb_http_output')) {
+ mb_http_output('pass');
+}
+//header ('Content-Type:text/xml; charset=UTF-8');
+\$xoopsModuleConfig["utf8"] = false;
+
+\$tpl = new XoopsTpl();
+\$tpl->xoops_setCaching(2); //1 = Cache global, 2 = Cache individuel (par template)
+\$tpl->xoops_setCacheTime(\$xoopsModuleConfig['timecacherss']*60); // Temps de cache en secondes
+\$categories = {$module_name}_MygetItemIds('{$module_name}_view', '{$module_name}');
+\$criteria = new CriteriaCompo();
+\$criteria->add(new Criteria('cat_status', 0, '!='));
+\$criteria->add(new Criteria('{$fppf}', '(' . implode(',', \$categories) . ')','IN'));
+if (\${$fppf} != 0){
+ \$criteria->add(new Criteria('{$fppf}', \${$fppf}));
+ \$cat = \${$table_name}Handler->get(\${$fppf});
+ \$title = \$xoopsConfig['sitename'] . ' - ' . \$xoopsModule->getVar('name') . ' - ' . \$cat->getVar('{$fpmf}');
+}else{
+ \$title = \$xoopsConfig['sitename'] . ' - ' . \$xoopsModule->getVar('name');
+}
+\$criteria->setLimit(\$xoopsModuleConfig['perpagerss']);
+\$criteria->setSort('date');
+\$criteria->setOrder('DESC');
+\${$table_name}_arr = \${$table_name}Handler->getall(\$criteria);
+
+if (!\$tpl->is_cached('db:rss.tpl', \${$fppf})) {
+ \$tpl->assign('channel_title', htmlspecialchars(\$title, ENT_QUOTES));
+ \$tpl->assign('channel_link', XOOPS_URL.'/');
+ \$tpl->assign('channel_desc', htmlspecialchars(\$xoopsConfig['slogan'], ENT_QUOTES));
+ \$tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss'));
+ \$tpl->assign('channel_webmaster', \$xoopsConfig['adminmail']);
+ \$tpl->assign('channel_editor', \$xoopsConfig['adminmail']);
+ \$tpl->assign('channel_category', 'Event');
+ \$tpl->assign('channel_generator', 'XOOPS - ' . htmlspecialchars(\$xoopsModule->getVar('{$fpmf}'), ENT_QUOTES));
+ \$tpl->assign('channel_language', _LANGCODE);
+ if ( _LANGCODE == 'fr' ) {
+ \$tpl->assign('docs', 'http://www.scriptol.fr/rss/RSS-2.0.html');
+ } else {
+ \$tpl->assign('docs', 'http://cyber.law.harvard.edu/rss/rss.html');
+ }
+ \$tpl->assign('image_url', XOOPS_URL . \$xoopsModuleConfig['logorss']);
+ \$dimention = getimagesize(XOOPS_ROOT_PATH . \$xoopsModuleConfig['logorss']);
+ if (empty(\$dimention[0])) {
+ \$width = 88;
+ } else {
+ \$width = (\$dimention[0] > 144) ? 144 : \$dimention[0];
+ }
+ if (empty(\$dimention[1])) {
+ \$height = 31;
+ } else {
+ \$height = (\$dimention[1] > 400) ? 400 : \$dimention[1];
+ }
+ \$tpl->assign('image_width', \$width);
+ \$tpl->assign('image_height', \$height);
+ foreach (array_keys(\${$table_name}_arr) as \$i) {
+ \$description = \${$table_name}_arr[\$i]->getVar('description');
+ //permet d'afficher uniquement la description courte
+ if (strpos(\$description,'[pagebreak]')==false){
+ \$description_short = \$description;
+ }else{
+ \$description_short = substr(\$description,0,strpos(\$description,'[pagebreak]'));
+ }
+ \$tpl->append('items', array('title' => htmlspecialchars(\${$table_name}_arr[\$i]->getVar('{$fpmf}'), ENT_QUOTES),
+ 'link' => XOOPS_URL . '/modules/{$module_name}/singlefile.php?{$fppf}=' . \${$table_name}_arr[\$i]->getVar('{$fppf}') . '&{$fpif}=' . \${$table_name}_arr[\$i]->getVar('{$fpif}'),
+ 'guid' => XOOPS_URL . '/modules/{$module_name}/singlefile.php?{$fppf}=' . \${$table_name}_arr[\$i]->getVar('{$fppf}') . '&{$fpif}=' . \${$table_name}_arr[\$i]->getVar('{$fpif}'),
+ 'pubdate' => formatTimestamp(\${$table_name}_arr[\$i]->getVar('date'), 'rss'),
+ 'description' => htmlspecialchars(\$description_short, ENT_QUOTES)));
+ }
+}
+header("Content-Type:text/xml; charset=" . _CHARSET);
+\$tpl->display('db:rss.tpl', \${$fppf});
+EOT;
+ return $ret;
+ }
+
+ /*
+ * @public function render
+ * @param null
+ */
+ public function render() {
+ $module = $this->getModule();
+ //$table = $this->getTable();
+ //$fields = $this->getFields();
+ $filename = $this->getFileName();
+ $module_name = $module->getVar('mod_name');
+ $table_name = $this->table->getVar('table_name');
+ $language = $this->getLanguage($module_name, 'MA');
+ $content = $this->getHeaderFilesComments($module, $filename);
+ $content .= $this->getUserRss($module_name, $table_name, $language);
+ $this->tdmcfile->create($module_name, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
+ return $this->tdmcfile->renderFile();
+ }
+}
\ No newline at end of file
Added: XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_submit.php
===================================================================
--- XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_submit.php (rev 0)
+++ XoopsModules/TDMCreate/branches/timgno/1.91/TDMCreate/class/files/user_submit.php 2014-06-02 20:02:11 UTC (rev 12561)
@@ -0,0 +1,196 @@
+<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+/**
+ * tdmcreate module
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+ * @package tdmcreate
+ * @since 2.5.0
+ * @author Txmod Xoops http://www.txmodxoops.org
+ * @version $Id: user_submit.php 12258 2014-01-02 09:33:29Z timgno $
+ */
+defined('XOOPS_ROOT_PATH') or die('Restricted access');
+
+class UserSubmit extends TDMCreateFile
+{
+ /*
+ * @var string
+ */
+ private $tdmcfile = null;
+ /*
+ * @var string
+ */
+ private $table = null;
+ /*
+ * @var string
+ */
+ private $fields = null;
+ /*
+ * @public function constructor
+ * @param string $module
+ * @param string $file_name
+ */
+ public function __construct($module, $table, $fields, $filename) {
+ $this->tdmcfile = TDMCreateFile::getInstance();
+ $this->setModule($module);
+ //$this->setTable($table);
+ $this->setFileName($filename);
+ $this->table = $table;
+ $this->fields = $fields;
+ }
+ /*
+ * @static function &getInstance
+ * @param string $module
+ * @param mixed $table
+ * @param string $filename
+ */
+ public static function &getInstance($module, $table, $fields, $filename)
+ {
+ static $instance = false;
+ if (!$instance) {
+ $instance = new self($module, $table, $fields, $filename);
+ }
+ return $instance;
+ }
+
+ /*
+ * @public function getUserSubmitHeader
+ * @param string $module
+ * @param mixed $table
+ * @param string $filename
+ */
+ public function getUserSubmitHeader()
+ {
+ $ret = <<<EOT
+include_once 'header.php';
+\$op = downloads_CleanVars(\$_REQUEST, 'op', 'form', 'string');
+// Template
+\$xoopsOption['template_main'] = 'submit.tpl';
+include_once XOOPS_ROOT_PATH.'/header.php';
+\$xoTheme->addStylesheet( XOOPS_URL . '/modules/' . \$xoopsModule->getVar('dirname', 'n') . '/css/style.css', null );
+//On recupere la valeur de l'argument op dans l'URL$
+// redirection if not permissions
+if (\$perm_submit == false) {
+ redirect_header('index.php', 2, _NOPERM);
+ exit();
+}
+
+//
+switch (\$op)
+{\n
+EOT;
+ return $ret;
+ }
+
+ /*
+ * @public function getAdminPagesList
+ * @param string $table_name
+ * @param string $language
+ */
+ public function getUserSubmitForm($table_name, $language) {
+ $ret = <<<EOT
+ case 'form':
+ default:
+ // Description
+ \$xoTheme->addMeta( 'meta', 'description', strip_tags({$language}SUBMIT));
+
+ // Create
+ \${$table_name}Obj =& \${$table_name}Handler->create();
+ \$form = \${$table_name}Obj->getForm();
+ \$xoopsTpl->assign('form', \$form->render());\n
+EOT;
+ return $ret;
+ }
+
+ /*
+ * @public function getUserSubmitSave
+ * @param null
+ */
+ public function getUserSubmitSave($module_name, $table_name)
+ {
+ $ret = <<<EOT
+ case 'save':
+ if ( !\$GLOBALS['xoopsSecurity']->check() ) {
+ redirect_header('{$table_name}.php', 3, implode(',', \$GLOBALS['xoopsSecurity']->getErrors()));
+ }
+ if (isset(\$_REQUEST['{$fpif}'])) {
+ \${$table_name}Obj =& \${$table_name}Handler->get(\$_REQUEST['{$fpif}']);
+ } else {
+ \${$table_name}Obj =& \${$table_name}Handler->create();
+ }
+EOT;
+ foreach (array_keys($this->fields) as $f)
+ {
+ $field_name = $this->fields[$f]->getVar('field_name');
+ $field_element = $this->fields[$f]->getVar('field_element');
+ /*if(($field_element == 1) || ($field_element == 2) || ($field_element == 3) || ($field_element > 11)) {
+ $this->adminobjects->getSimpleSetVar($table_name, $field_name);
+ } else*/if(($field_element == 4) || ($field_element == 5)) {
+ $this->adminobjects->getCheckBoxOrRadioYN($table_name, $field_name);
+ } elseif($field_element == 9) {
+ $this->adminobjects->getUploadImage($module_name, $table_name, $field_name);
+ } elseif($field_element == 10) {
+ $this->adminobjects->getUploadFile($module_name, $table_name, $field_name);
+ } elseif($field_element == 11) {
+ $this->adminobjects->getTextDateSelect($table_name, $field_name);
+ } else {
+ $this->adminobjects->getSimpleSetVar($table_name, $field_name);
+ }
+ }
+
+ $ret .= <<<EOT
+
+ if (\${$table_name}Handler->insert(\${$table_name}Obj)) {
+ redirect_header('index.php', 2, {$language}FORMOK);
+ }
+
+ echo \${$table_name}Obj->getHtmlErrors();
+ \$form =& \${$table_name}Obj->getForm();
+ \$form->display();
+ break;\n
+EOT;
+ return $ret;
+ }
+
+ /*
+ * @public function getUserSubmitFooter
+ * @param null
+ */
+ public function getUserSubmitFooter()
+ {
+ $ret = <<<EOT
+include_once 'footer.php';
+EOT;
+ return $ret;
+ }
+
+ /*
+ * @public function render
+ * @param null
+ */
+ public function render() {
+ $module = $this->getModule();
+ //$table = $this->getTable();
+ //$fields = $this->getFields();
+ $filename = $this->getFileName();
+ $module_name = $module->getVar('mod_name');
+ $table_name = $this->table->getVar('table_name');
+ $language = $this->getLanguage($module_name, 'MA');
+ $content = $this->getHeaderFilesComments($module, $filename);
+ $content .= $this->getUserSubmitHeader();
+ $content .= $this->getUserSubmitForm($table_name, $language);
+ $content .= $this->getUserSubmitSave($module_name, $table_name);
+ $content .= $this->getUserSubmitFooter();
+ $this->tdmcfile->create($module_name, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
+ return $this->tdmcfile->renderFile();
+ }
+}
\ No newline at end of file
|