function const_blocs_language($modules, $modules_name, $tables_arr) { $language = '_MB_' . strtoupper($modules_name) . '_'; $blocs_language_file = "blocks.php"; $blocs_language_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/language/french/" . $blocs_language_file; $en_tete = const_entete($modules, 0); $text = '<?php' . $en_tete . ' '; foreach (array_keys($tables_arr) as $i) { //Champs $champs_total = explode("|", $tables_arr[$i]->getVar("tables_champs")); $nb_champs = count($champs_total); $nb_caracteres = strlen($tables_arr[$i]->getVar("tables_name")); $tables_blocs = $tables_arr[$i]->getVar('tables_blocs'); $language1 = $language . strtoupper($tables_arr[$i]->getVar("tables_name")) . '_'; if ($tables_blocs == 1) { $text .= 'define("' . $language1 . 'DISPLAY","Afficher"); define("' . $language1 . 'TITLELENGTH","Longueur du titre"); define("' . $language1 . 'CATTODISPLAY","Sélectionner les catégories à affichées"); define("' . $language1 . 'ALLCAT","Toutes les catégories"); '; } //Recuperation des noms des tables for ($j = 0; $j < $nb_champs; $j++) { //Nom des champs $champs1 = explode(":", $champs_total[$j]); $champs[$j] = $champs1[0]; $champs_final[$j] = substr("" . $champs1[0] . "", $nb_caracteres + 1); $text .= 'define("' . $language1 . strtoupper($champs_final[$j]) . '","' . UcFirstAndToLower($champs_final[$j]) . '"); '; } $text .= ' '; } $text .= ' ?>'; //Integration du contenu dans le bloc $handle = fopen($blocs_language_path_file, "w"); if (is_writable($blocs_language_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_BLOCS_LANGUAGE . '<br>' . $blocs_language_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . _AM_TDMCREATE_CONST_OK_BLOCS_LANGUAGE . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_BLOCS_LANGUAGE . '<br>' . $blocs_language_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }
function const_admin_menu($modules, $modules_name, $tables_arr) { global $xoopsModule, $xoopsConfig; $language = '_MI_' . strtoupper($modules_name) . '_MANAGER_'; $admin_menu_file = "menu.php"; $admin_menu_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/admin/" . $admin_menu_file; $en_tete = const_entete($modules, 0); $menu = 0; $text = '<?php' . $en_tete . ' $adminmenu = array(); $adminmenu[' . $menu . ']["title"] = ' . $language . 'INDEX; $adminmenu[' . $menu . ']["link"] = "admin/index.php"; '; $menu++; foreach (array_keys($tables_arr) as $i) { $tables_id = $tables_arr[$i]->getVar("tables_id"); if ($tables_arr[$i]->getVar("tables_display_admin") == 1) { $text .= '$adminmenu[' . $menu . ']["title"] = ' . $language . '' . strtoupper($tables_arr[$i]->getVar("tables_name")) . '; $adminmenu[' . $menu . ']["link"] = "admin/' . $tables_arr[$i]->getVar("tables_name") . '.php"; '; $menu++; } } $tables_id++; $text .= '$adminmenu[' . $menu . ']["title"] = ' . $language . 'PERMISSIONS; $adminmenu[' . $menu . ']["link"] = "admin/permissions.php"; '; $menu++; $text .= ' $adminmenu[' . $menu . ']["title"] = ' . $language . 'ABOUT; $adminmenu[' . $menu . ']["link"] = "admin/about.php"; ?>'; //Integration du contenu dans admin_header $handle = fopen($admin_menu_path_file, "w"); if (is_writable($admin_menu_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_ADMIN_MENU . '<br>' . $admin_menu_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . _AM_TDMCREATE_CONST_OK_ADMIN_MENU . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_ADMIN_MENU . '<br>' . $admin_menu_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }
function const_include_functions($modules, $modules_name) { $include_functions_file = "functions.php"; $include_functions_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/include/" . $include_functions_file; $en_tete = const_entete($modules, 0); $text = '<?php' . $en_tete . ' /***************Blocks***************/ function block_addCatSelect($cats) { if(is_array($cats)) { $cat_sql = "(".current($cats); array_shift($cats); foreach($cats as $cat) { $cat_sql .= ",".$cat; } $cat_sql .= ")"; } return $cat_sql; } ?>'; //Integration du contenu dans le bloc $handle = fopen($include_functions_path_file, "w"); if (is_writable($include_functions_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_INCLUDE_FUNCTIONS . '<br>' . $include_functions_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . _AM_TDMCREATE_CONST_OK_INCLUDE_FUNCTIONS . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_INCLUDE_FUNCTIONS . '<br>' . $include_functions_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }
function const_user_index($modules, $modules_name, $tables_id, $tables_module_table, $tables_name) { $language = '_AM_' . strtoupper($modules_name) . ''; $language_manager = '_AM_' . strtoupper($modules_name) . '_MANAGER_' . strtoupper($tables_name) . ''; $modules_name_minuscule = strtolower($modules_name); $user_index_file = "index.php"; $user_index_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/" . $user_index_file; $en_tete = const_entete($modules, 0); $text = '<?php' . $en_tete . ' include "../../mainfile.php"; include_once XOOPS_ROOT_PATH."/header.php"; include_once XOOPS_ROOT_PATH."/footer.php"; ?>'; //Integration du contenu dans le bloc $handle = fopen($user_index_path_file, "w"); if (is_writable($user_index_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . sprintf(_AM_TDMCREATE_CONST_NOTOK_INDEX_USER, $tables_name) . '<br>' . $user_index_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . sprintf(_AM_TDMCREATE_CONST_OK_INDEX_USER, $tables_name) . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . sprintf(_AM_TDMCREATE_CONST_NOTOK_INDEX_USER, $tables_name) . '<br>' . $user_index_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }
function const_blocs($modules, $modules_name, $tables_module_table, $tables_name, $tables_champs, $tables_parametres, $topic) { $language = '_MB_' . strtoupper($tables_module_table) . ''; $modules_name_minuscule = strtolower($modules_name); $blocs_file = "blocks_" . $tables_name . ".php"; $blocs_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/blocks/" . $blocs_file; $constructor = const_champs($modules_name, $tables_module_table, $tables_name, $tables_champs, $tables_name, 0, 0, 0); $en_tete = const_entete($modules, 0); $text = '<?php' . $en_tete . ' include_once XOOPS_ROOT_PATH."/modules/' . $modules_name . '/include/functions.php"; function b_' . $modules_name_minuscule . '_' . $tables_name . '($options) { include_once XOOPS_ROOT_PATH."/modules/' . $modules_name . '/class/' . $tables_name . '.php"; $myts =& MyTextSanitizer::getInstance(); $' . $tables_name . ' = array(); $type_block = $options[0]; $nb_' . $tables_name . ' = $options[1]; $lenght_title = $options[2]; $' . $tables_name . 'Handler =& xoops_getModuleHandler("' . $tables_module_table . '", "' . $modules_name . '"); $criteria = new CriteriaCompo(); array_shift($options); array_shift($options); array_shift($options); '; if ($topic == 1) { $text .= 'if (!(count($options) == 1 && $options[0] == 0)) { $criteria->add(new Criteria("' . $tables_name . '_topic", block_addCatSelect($options),"IN")); } '; } $text .= ' switch ($type_block) { // pour le bloc: ' . $tables_name . ' recents case "recent": $criteria->add(new Criteria("' . $tables_name . '_online", 1)); $criteria->setSort("' . $tables_name . '_date_created"); $criteria->setOrder("DESC"); break; // pour le bloc: ' . $tables_name . ' du jour case "day": $criteria->add(new Criteria("' . $tables_name . '_online", 1)); $criteria->add(new Criteria("' . $tables_name . '_date_created", strtotime(date("Y/m/d")), ">=")); $criteria->add(new Criteria("' . $tables_name . '_date_created", strtotime(date("Y/m/d"))+86400, "<=")); $criteria->setSort("' . $tables_name . '_date_created"); $criteria->setOrder("ASC"); break; // pour le bloc: ' . $tables_name . ' aléatoires case "random": $criteria->add(new Criteria("' . $tables_name . '_online", 1)); $criteria->setSort("RAND()"); break; } $criteria->setLimit($nb_' . $tables_name . '); $' . $tables_name . '_arr = $' . $tables_name . 'Handler->getall($criteria);'; $text .= ' foreach (array_keys($' . $tables_name . '_arr) as $i) { '; $prefix = '$' . $tables_name . '_arr[$i]->getVar'; //Champs $champs = explode("|", $tables_champs); $nb_champs = count($champs); //Parametres $parametres = explode("|", $tables_parametres); $nb_parametres = count($parametres); $j = 0; $structure_parametres[3] = 0; for ($i = 0; $i < $nb_champs; $i++) { $structure_champs = explode(":", $champs[$i]); if ($i != 0) { $structure_parametres = explode(":", $parametres[$j]); $j++; } if ($structure_parametres[3] == 1 || $i == 0) { $text .= ' $' . $tables_name . '[$i]["' . $structure_champs[0] . '"] = ' . $prefix . '("' . $structure_champs[0] . '"); '; } } $text .= ' } return $' . $tables_name . '; } function b_' . $modules_name_minuscule . '_' . $tables_name . '_edit($options) {'; if ($topic == 1) { $text .= ' include_once XOOPS_ROOT_PATH."/modules/' . $modules_name . '/class/topic.php"; $topicHandler =& xoops_getModuleHandler("' . $modules_name . '_topic", "' . $modules_name . '"); $criteria = new CriteriaCompo(); $criteria->setSort("topic_title"); $criteria->setOrder("ASC"); $topic_arr = $topicHandler->getall($criteria); '; } $text .= ' $form = "".' . $language . '_DISPLAY."\\n"; $form .= "<input type=\\"hidden\\" name=\\"options[0]\\" value=\\"".$options[0]."\\" />"; $form .= "<input name=\\"options[1]\\" size=\\"5\\" maxlength=\\"255\\" value=\\"".$options[1]."\\" type=\\"text\\" /> <br />"; $form .= "".' . $language . '_TITLELENGTH." : <input name=\\"options[2]\\" size=\\"5\\" maxlength=\\"255\\" value=\\"".$options[2]."\\" type=\\"text\\" /><br /><br />"; array_shift($options); array_shift($options); array_shift($options);'; $text .= ' $form .= "".' . $language . '_CATTODISPLAY."<br /><select name=\\"options[]\\" multiple=\\"multiple\\" size=\\"5\\">"; $form .= "<option value=\\"0\\" " . (array_search(0, $options) === false ? "" : "selected=\\"selected\\"") . ">" .' . $language . '_ALLCAT . "</option>"; foreach (array_keys($topic_arr) as $i) { $form .= "<option value=\\"" . $topic_arr[$i]->getVar("topic_id") . "\\" " . (array_search($topic_arr[$i]->getVar("topic_id"), $options) === false ? "" : "selected=\\"selected\\"") . ">".$topic_arr[$i]->getVar("topic_title")."</option>"; } $form .= "</select>"; return $form; } ?>'; //Integration du contenu dans le bloc $handle = fopen($blocs_path_file, "w"); if (is_writable($blocs_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_BLOCS . '<br>' . $blocs_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . _AM_TDMCREATE_CONST_OK_BLOCS . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_BLOCS . '<br>' . $blocs_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }
function const_admin_about($modules, $modules_name, $menu) { global $xoopsModule, $xoopsConfig; $language = '_AM_' . strtoupper($modules_name) . '_ABOUT_'; $language_manager = '_AM_' . strtoupper($modules_name) . '_MANAGER_ABOUT'; $admin_about_file = "about.php"; $admin_about_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/admin/" . $admin_about_file; $en_tete = const_entete($modules, 0); $text = '<?php' . $en_tete . ' include_once("./header.php"); xoops_cp_header(); if ( !is_readable(XOOPS_ROOT_PATH."/Frameworks/art/functions.admin.php")) { ' . $modules_name . '_adminmenu(' . $menu . ', ' . $language_manager . '); echo "<style> .CPbigTitle{ font-size: 20px; color: #1E90FF; background: no-repeat left top; font-weight: bold; height: 40px; vertical-align: middle; padding: 10px 0 0 50px; border-bottom: 3px solid #1E90FF; } </style>"; } else { include_once XOOPS_ROOT_PATH."/Frameworks/art/functions.admin.php"; loadModuleAdminMenu (' . $menu . ', ' . $language_manager . '); } //menu echo "<div class=\\"CPbigTitle\\" style=\\"background-image: url(../images/deco/about.png); background-repeat: no-repeat; background-position: left; padding-left: 50px;\\"><strong>".' . $language_manager . '."</strong> </div><br />"; $versioninfo =& $module_handler->get( $xoopsModule->getVar("mid") ); echo "<style type=\\"text/css\\"> label,text { display: block; float: left; margin-bottom: 2px; } label { text-align: right; width: 150px; padding-right: 20px; } br { clear: left; } </style> <fieldset> <legend style=\\"font-weight: bold; color: #900;\\">".$xoopsModule->getVar("name")."</legend> <div style=\\"padding: 8px;\\"> <img src=\\"".XOOPS_URL."/modules/".$xoopsModule->getVar("dirname")."/".$versioninfo->getInfo("image")."\\" alt=\\"\\" hspace=\\"10\\" vspace=\\"0\\" /></a>\\n <div style=\\"padding: 5px;\\"><strong>".$versioninfo->getInfo("name")." version ".$versioninfo->getInfo("version")."</strong></div>\\n <label>".' . $language . 'RELEASEDATE.":</label><text>".$versioninfo->getInfo("release")."</text><br /> <label>".' . $language . 'AUTHOR.":</label><text>".$versioninfo->getInfo("author")."</text><br /> <label>".' . $language . 'CREDITS.":</label><text>".$versioninfo->getInfo("credits")."</text><br /> <label>".' . $language . 'LICENSE.":</label><text><a href=\\"".$versioninfo->getInfo("license_file")."\\" target=\\"_blank\\" >".$versioninfo->getInfo("license")."</a></text>\\n </div> </fieldset> <br clear=\\"all\\"/> <fieldset> <legend style=\\"font-weight: bold; color: #900;\\">".' . $language . 'MODULE_INFO."</legend> <div style=\\"padding: 8px;\\"> <label>".' . $language . 'MODULE_STATUS.":</label><text>".$versioninfo->getInfo("module_status")."</text><br /> <label>".' . $language . 'WEBSITE.":</label><text><a href=\\"".$versioninfo->getInfo("module_website_url")."\\" target=\\"_blank\\">".$versioninfo->getInfo("module_website_name")."</a></text><br /> </div> </fieldset> <br clear=\\"all\\" /> <fieldset> <legend style=\\"font-weight: bold; color: #900;\\">".' . $language . 'AUTHOR_INFO."</legend> <div style=\\"padding: 8px;\\"> <label>".' . $language . 'AUTHOR_NAME.":</label><text>".$versioninfo->getInfo("author")."</text><br /> <label>".' . $language . 'WEBSITE.":</label><text><a href=\\"".$versioninfo->getInfo("author_website_url")."\\" target=\\"_blank\\">".$versioninfo->getInfo("author_website_name")."</a></text><br /> </div> </fieldset> <br clear=\\"all\\" />"; $file = XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/changelog.txt"; if ( is_readable( $file ) ){ echo "<fieldset> <legend style=\\"font-weight: bold; color: #900;\\">".' . $language . 'CHANGELOG."</legend> <div style=\\"padding: 8px;\\"> <div>".implode("<br />", file( $file ))."</div> </div> </fieldset> <br clear=\\"all\\" />"; } echo "<br /><br /> <div align=\\"center\\"><a href=\\"http://www.tdmxoops.net\\" target=\\"_blank\\"><img src=\\"http://www.tdmxoops.net/images/logo_modules.gif\\" alt=\\"TDM\\" title=\\"TDM\\"></a></div> "; xoops_cp_footer(); ?>'; //Integration du contenu dans admin_header $handle = fopen($admin_about_path_file, "w"); if (is_writable($admin_about_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_ADMIN_ABOUT . '<br>' . $about_menu_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . _AM_TDMCREATE_CONST_OK_ADMIN_ABOUT . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_ADMIN_ABOUT . '<br>' . $about_menu_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }
function const_modinfo_language($modules, $modules_name, $tables_arr) { $language = '_MI_' . strtoupper($modules_name) . '_'; $modinfo_language_file = "modinfo.php"; $modinfo_language_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/language/french/" . $modinfo_language_file; $en_tete = const_entete($modules, 0); $text = '<?php' . $en_tete . ' //Menu define("' . $language . 'MANAGER_INDEX","Index"); '; foreach (array_keys($tables_arr) as $i) { $text .= 'define("' . $language . 'MANAGER_' . strtoupper($tables_arr[$i]->getVar("tables_name")) . '","' . ucfirst(strtolower($tables_arr[$i]->getVar("tables_name"))) . '"); '; } $text .= ' define("' . $language . 'MANAGER_ABOUT","A propos"); define("' . $language . 'MANAGER_PREFERENCES","Preferences"); define("' . $language . 'MANAGER_UPDATE","Mise a jour"); define("' . $language . 'MANAGER_PERMISSIONS","Permissions"); //Config define("' . $language . 'EDITOR","Editeur"); '; foreach (array_keys($tables_arr) as $i) { $tables_name = $tables_arr[$i]->getVar("tables_name"); $tables_champs = $tables_arr[$i]->getVar("tables_champs"); $tables_parametres = $tables_arr[$i]->getVar("tables_parametres"); //Champs $champs = explode("|", $tables_champs); $nb_champs = count($champs); //Parametres $parametres = explode("|", $tables_parametres); $nb_parametres = count($parametres); $j = 0; for ($i = 0; $i < $nb_champs; $i++) { $structure_champs = explode(":", $champs[$i]); $language1 = $language . strtoupper($structure_champs[0]) . ''; if ($i != 0) { $structure_parametres = explode(":", $parametres[$j]); $j++; if ($structure_parametres[0] == 'XoopsFormUploadImage' || $structure_parametres[0] == 'XoopsFormUploadFile') { $text .= ' define("' . $language1 . '_SIZE","Taille autorisee pour ' . $structure_champs[0] . '"); define("' . $language1 . '_MIMETYPES","Types mime autorises pour ' . $structure_champs[0] . '"); '; } } } } $text .= ' //Blocks '; foreach (array_keys($tables_arr) as $i) { $language1 = $language . strtoupper($tables_arr[$i]->getVar("tables_name")) . ''; $text .= 'define("' . $language1 . '_BLOCK_RECENT","' . strtolower($tables_arr[$i]->getVar("tables_name")) . ' recents"); define("' . $language1 . '_BLOCK_DAY","' . strtolower($tables_arr[$i]->getVar("tables_name")) . ' d\'aujourdh\'ui"); define("' . $language1 . '_BLOCK_RANDOM","' . strtolower($tables_arr[$i]->getVar("tables_name")) . ' aleatoires"); '; } $text .= ' ?>'; //Integration du contenu dans modinfo $handle = fopen($modinfo_language_path_file, "w"); if (is_writable($modinfo_language_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_MODINFO_LANGUAGE . '<br>' . $modinfo_language_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . _AM_TDMCREATE_CONST_OK_MODINFO_LANGUAGE . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_MODINFO_LANGUAGE . '<br>' . $modinfo_language_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }
function const_admin_language($modules, $modules_name, $tables_arr) { $language = '_AM_' . strtoupper($modules_name) . '_'; $admin_language_file = "admin.php"; $admin_language_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/language/french/" . $admin_language_file; $en_tete = const_entete($modules, 0); $text = '<?php' . $en_tete . ' //Menu define("' . $language . 'MANAGER_INDEX","Index"); '; foreach (array_keys($tables_arr) as $i) { $text .= 'define("' . $language . 'THEREARE_' . strtoupper($tables_arr[$i]->getVar("tables_name")) . '","Il y a <span style=\\"color: #ff0000; font-weight: bold\\">%s</span> ' . ucfirst($tables_arr[$i]->getVar("tables_name")) . 's dans la Base de donnée"); define("' . $language . 'THEREARE_' . strtoupper($tables_arr[$i]->getVar("tables_name")) . '_ONLINE","Il y a <span style=\'color: #ff0000; font-weight: bold\'>%s</span> ' . ucfirst($tables_arr[$i]->getVar("tables_name")) . 's en attente"); '; } $text .= ' define("' . $language . 'MANAGER_ABOUT","A propos"); define("' . $language . 'MANAGER_PREFERENCES","Preferences"); define("' . $language . 'MANAGER_UPDATE","Mise a jour"); define("' . $language . 'MANAGER_PERMISSIONS","Permissions"); //Index '; foreach (array_keys($tables_arr) as $i) { $text .= 'define("' . $language . 'MANAGER_' . strtoupper($tables_arr[$i]->getVar("tables_name")) . '","' . ucfirst(strtolower($tables_arr[$i]->getVar("tables_name"))) . '"); '; } $text .= ' //General define("' . $language . 'FORMOK","Enregistre avec succes"); define("' . $language . 'FORMDELOK","Supprimé avec succès"); define("' . $language . 'FORMSUREDEL", "Etes-vous sûr de vouloir supprimer : <b><span style=\\"color : Red\\"> %s </span></b>"); define("' . $language . 'FORMSURERENEW", "Etes-vous sûr de vouloir renevouler : <b><span style=\\"color : Red\\"> %s </span></b>"); define("' . $language . 'FORMUPLOAD","Upload"); define("' . $language . 'FORMIMAGE_PATH","Fichier present dans %s"); define("' . $language . 'FORMACTION","Action"); define("' . $language . 'OFF","Hors ligne"); define("' . $language . 'ON","En ligne"); define("' . $language . 'EDIT","Editer"); define("' . $language . 'DELETE","Supprimer"); '; $verif = true; foreach (array_keys($tables_arr) as $i) { //Champs $champs_total = explode("|", $tables_arr[$i]->getVar("tables_champs")); $nb_champs = count($champs_total); $nb_caracteres = strlen($tables_arr[$i]->getVar("tables_name")); $language1 = $language . strtoupper($tables_arr[$i]->getVar("tables_name")) . '_'; //Recuperation des noms des tables for ($j = 0; $j < $nb_champs; $j++) { //Nom des champs $champs1 = explode(":", $champs_total[$j]); $champs[$j] = $champs1[0]; $champs_final[$j] = substr("" . $champs1[0] . "", $nb_caracteres + 1); if ($verif == true) { $text .= 'define("' . $language1 . 'ADD","Ajouter un ' . $tables_arr[$i]->getVar("tables_name") . '"); define("' . $language1 . 'EDIT","Editer un ' . $tables_arr[$i]->getVar("tables_name") . '"); '; } $verif = false; $text .= 'define("' . $language1 . strtoupper($champs_final[$j]) . '","' . UcFirstAndToLower($champs_final[$j]) . '"); '; } $verif = true; $text .= ' '; } $text .= '//Blocks.php '; foreach (array_keys($tables_arr) as $i) { $language1 = $language . strtoupper($tables_arr[$i]->getVar("tables_name")) . '_'; $text .= 'define("' . $language1 . 'BLOCK_DAY","' . $tables_arr[$i]->getVar("tables_name") . 's d\'aujourdh\'ui"); define("' . $language1 . 'BLOCK_RANDOM","' . $tables_arr[$i]->getVar("tables_name") . 's aleatoires"); define("' . $language1 . 'BLOCK_RECENT","' . $tables_arr[$i]->getVar("tables_name") . 's recents"); '; } $text .= ' //Permissions define("' . $language . 'PERMISSIONS_ACCESS","Permission de voir"); define("' . $language . 'PERMISSIONS_SUBMIT","Permission de soumettre"); //About.php define("' . $language . 'ABOUT_RELEASEDATE","Release Date"); define("' . $language . 'ABOUT_AUTHOR","Author"); define("' . $language . 'ABOUT_CREDITS","Credits"); define("' . $language . 'ABOUT_README","Générale Information"); define("' . $language . 'ABOUT_MANUAL","Aide"); define("' . $language . 'ABOUT_LICENSE","Licence"); define("' . $language . 'ABOUT_MODULE_STATUS","Status"); define("' . $language . 'ABOUT_WEBSITE","Web Site"); define("' . $language . 'ABOUT_AUTHOR_NAME","Author Name"); define("' . $language . 'ABOUT_AUTHOR_WORD","Author Word"); define("' . $language . 'ABOUT_CHANGELOG","Change Log"); define("' . $language . 'ABOUT_MODULE_INFO","Module Info"); define("' . $language . 'ABOUT_AUTHOR_INFO","Author Info"); define("' . $language . 'ABOUT_DISCLAIMER","Disclaimer"); define("' . $language . 'ABOUT_DISCLAIMER_TEXT","GPL Licensed - No Warranty"); ?>'; //Integration du contenu dans le bloc $handle = fopen($admin_language_path_file, "w"); if (is_writable($admin_language_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_ADMIN_LANGUAGE . '<br>' . $admin_language_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . _AM_TDMCREATE_CONST_OK_ADMIN_LANGUAGE . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_ADMIN_LANGUAGE . '<br>' . $admin_language_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }
function const_admin_pages($modules, $modules_name, $tables_id, $tables_module_table, $tables_name, $tables_img, $tables_champs, $tables_parametres, $menu) { $language = '_AM_' . strtoupper($modules_name) . ''; $language_manager = '_AM_' . strtoupper($modules_name) . '_MANAGER_' . strtoupper($tables_name) . ''; $modules_name_minuscule = strtolower($modules_name); $admin_page_file = $tables_name . ".php"; $admin_page_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/admin/" . $admin_page_file; $en_tete = const_entete($modules, 0); $text = '<?php' . $en_tete . ' include_once("./header.php"); xoops_cp_header(); if (isset($_REQUEST["op"])) { $op = $_REQUEST["op"]; } else { @$op = "show_list_' . $tables_name . '"; } //Menu admin if ( !is_readable(XOOPS_ROOT_PATH . "/Frameworks/art/functions.admin.php") ) { ' . $modules_name . '_adminmenu(' . $menu . ', ' . $language_manager . '); } else { include_once XOOPS_ROOT_PATH."/Frameworks/art/functions.admin.php"; loadModuleAdminMenu (' . $menu . ', ' . $language_manager . '); } //Sous menu echo "<div class=\\"CPbigTitle\\" style=\\"background-image: url(../images/deco/' . $tables_img . '); background-repeat: no-repeat; background-position: left; padding-left: 50px;\\"> <strong>".' . $language_manager . '."</strong> </div><br /><br>";'; //Champs $champs_total = explode("|", $tables_champs); $nb_champs = count($champs_total); //Parametres $parametres_total = explode("|", $tables_parametres); //Recuperation des noms des tables for ($i = 0; $i < $nb_champs; $i++) { //Nom des champs $champs1 = explode(":", $champs_total[$i]); $champs[$i] = $champs1[0]; //Afficher dans l'admin if ($i == 0) { $champs_param_display_admin[$i] = '0'; } else { $parametres = explode(":", $parametres_total[$i - 1]); $champs_param_type[$i] = $parametres[0]; $champs_param_display_admin[$i] = $parametres[1]; } } $champs_id = $champs[0]; $champs_name = $champs[1]; $text .= ' switch ($op) { case "save_' . $tables_name . '": if ( !$GLOBALS["xoopsSecurity"]->check() ) { redirect_header("' . $tables_name . '.php", 3, implode(",", $GLOBALS["xoopsSecurity"]->getErrors())); } if (isset($_REQUEST["' . $champs_id . '"])) { $obj =& $' . $tables_name . 'Handler->get($_REQUEST["' . $champs_id . '"]); } else { $obj =& $' . $tables_name . 'Handler->create(); } '; $champs_save = const_show_champs_parametres($modules_name, $tables_name, $champs_id, $nb_champs, $champs, $champs_param_display_admin, $champs_param_type, $language, '', 2); $text .= '' . $champs_save . ' if ($' . $tables_name . 'Handler->insert($obj)) { redirect_header("' . $tables_name . '.php?op=show_list_' . $tables_name . '", 2, ' . $language . '_FORMOK); } //include_once("../include/forms.php"); echo $obj->getHtmlErrors(); $form =& $obj->getForm(); break; case "edit_' . $tables_name . '": $obj = $' . $tables_name . 'Handler->get($_REQUEST["' . $champs_id . '"]); $form = $obj->getForm(); break; case "delete_' . $tables_name . '": $obj =& $' . $tables_name . 'Handler->get($_REQUEST["' . $champs_id . '"]); if (isset($_REQUEST["ok"]) && $_REQUEST["ok"] == 1) { if ( !$GLOBALS["xoopsSecurity"]->check() ) { redirect_header("' . $tables_name . '.php", 3, implode(",", $GLOBALS["xoopsSecurity"]->getErrors())); } if ($' . $tables_name . 'Handler->delete($obj)) { redirect_header("' . $tables_name . '.php", 3, ' . $language . '_FORMDELOK); } else { echo $obj->getHtmlErrors(); } } else { xoops_confirm(array("ok" => 1, "' . $champs_id . '" => $_REQUEST["' . $champs_id . '"], "op" => "delete_' . $tables_name . '"), $_SERVER["REQUEST_URI"], sprintf(' . $language . '_FORMSUREDEL, $obj->getVar("' . $tables_name . '"))); } break; case "update_online_' . $tables_name . '": if (isset($_REQUEST["' . $champs_id . '"])) { $obj =& $' . $tables_name . 'Handler->get($_REQUEST["' . $champs_id . '"]); } $obj->setVar("' . $tables_name . '_online", $_REQUEST["' . $tables_name . '_online"]); if ($' . $tables_name . 'Handler->insert($obj)) { redirect_header("' . $tables_name . '.php", 3, ' . $language . '_FORMOK); } echo $obj->getHtmlErrors(); break; case "default": default: $criteria = new CriteriaCompo(); $criteria->setSort("' . $champs_id . '"); $criteria->setOrder("ASC"); $numrows = $' . $tables_name . 'Handler->getCount(); $' . $tables_name . '_arr = $' . $tables_name . 'Handler->getall($criteria); '; if ($tables_name != 'topic') { $text .= ' //Affichage du tableau if ($numrows>0) { echo "<table width=\\"100%\\" cellspacing=\\"1\\" class=\\"outer\\"> <tr> '; $champs_colonne_name = const_show_champs_parametres($modules_name, $tables_name, $champs_id, $nb_champs, $champs, $champs_param_display_admin, $champs_param_type, $language, '', 0); $text .= '' . $champs_colonne_name . ' <th align=\\"center\\" width=\\"10%\\">".' . $language . '_FORMACTION."</th> </tr>"; $class = "odd"; foreach (array_keys($' . $tables_name . '_arr) as $i) { if ( $' . $tables_name . '_arr[$i]->getVar("topic_pid") == 0) { echo "<tr class=\\"".$class."\\">"; $class = ($class == "even") ? "odd" : "even"; '; $champs_data = const_show_champs_parametres($modules_name, $tables_name, $champs_id, $nb_champs, $champs, $champs_param_display_admin, $champs_param_type, $language, '', 1); $text .= '' . $champs_data . ' echo "<td align=\\"center\\" width=\\"10%\\"> <a href=\\"' . $tables_name . '.php?op=edit_' . $tables_name . '&' . $champs_id . '=".$' . $tables_name . '_arr[$i]->getVar("' . $champs_id . '")."\\"><img src=\\"../images/deco/edit.gif\\" alt=\\"".' . $language . '_EDIT."\\" title=\\"".' . $language . '_EDIT."\\"></a> <a href=\\"' . $tables_name . '.php?op=delete_' . $tables_name . '&' . $champs_id . '=".$' . $tables_name . '_arr[$i]->getVar("' . $champs_id . '")."\\"><img src=\\"../images/deco/delete.gif\\" alt=\\"".' . $language . '_DELETE."\\" title=\\"".' . $language . '_DELETE."\\"></a> </td>"; echo "</tr>"; } } echo "</table><br><br>"; } '; } else { $text .= ' //Fonction qui permet afficher les catégories enfants function ' . $modules_name . '_display_children($topic_id = 0, $topic_arr, $prefix = "", $order = "", &$class) { $topicHandler =& xoops_getModuleHandler("' . $tables_module_table . '", "' . $modules_name . '"); $prefix = $prefix."<img src=\\"".XOOPS_URL."/modules/' . $modules_name . '/images/deco/arrow.gif\\">"; foreach (array_keys($topic_arr) as $i) { $topic_id = $topic_arr[$i]->getVar("topic_id"); $topic_img = $topic_arr[$i]->getVar("topic_img"); $topic_title = $topic_arr[$i]->getVar("topic_title"); $topic_weight = $topic_arr[$i]->getVar("topic_weight"); echo "<tr class=\\"".$class."\\">"; '; $champs_data = const_show_champs_parametres($modules_name, $tables_name, $champs_id, $nb_champs, $champs, $champs_param_display_admin, $champs_param_type, $language, 1, 1); $text .= '' . $champs_data . ' echo "<td align=\\"center\\" width=\\"10%\\"> <a href=\\"' . $tables_name . '.php?op=edit_' . $tables_name . '&' . $champs_id . '=".$' . $tables_name . '_arr[$i]->getVar("' . $champs_id . '")."\\"><img src=\\"../images/deco/edit.gif\\" alt=\\"".' . $language . '_EDIT."\\" title=\\"".' . $language . '_EDIT."\\"></a> <a href=\\"' . $tables_name . '.php?op=delete_' . $tables_name . '&' . $champs_id . '=".$' . $tables_name . '_arr[$i]->getVar("' . $champs_id . '")."\\"><img src=\\"../images/deco/delete.gif\\" alt=\\"".' . $language . '_DELETE."\\" title=\\"".' . $language . '_DELETE."\\"></a> </td> </tr>"; $class = ($class == "even") ? "odd" : "even"; $criteria = new CriteriaCompo(); $criteria->add(new Criteria("topic_pid", $topic_arr[$i]->getVar("topic_id"))); $criteria->setSort("topic_title"); $criteria->setOrder("ASC"); $topic_pid = $' . $tables_name . 'Handler->getall($criteria); $num_pid = $' . $tables_name . 'Handler->getCount(); if ( $num_pid != 0 ) { ' . $modules_name . '_display_children($topic_id, $topic_pid, $prefix, $order, $class); } } } //Affichage du tableau if ($numrows>0) { echo "<table width=\\"100%\\" cellspacing=\\"1\\" class=\\"outer\\"> <tr> '; $champs_colonne_name = const_show_champs_parametres($modules_name, $tables_name, $champs_id, $nb_champs, $champs, $champs_param_display_admin, $champs_param_type, $language, '', 0); $text .= '' . $champs_colonne_name . ' <th align=\\"center\\" width=\\"10%\\">".' . $language . '_FORMACTION."</th> </tr>"; $class = "odd"; $prefix = "<img src=\\"".XOOPS_URL."/modules/' . $modules_name . '/images/deco/arrow.gif\\">"; foreach (array_keys($' . $tables_name . '_arr) as $i) { if ( $' . $tables_name . '_arr[$i]->getVar("topic_pid") == 0 ) { $topic_id = $' . $tables_name . '_arr[$i]->getVar("topic_id"); $topic_img = $' . $tables_name . '_arr[$i]->getVar("topic_img"); $topic_title = $' . $tables_name . '_arr[$i]->getVar("topic_title"); $topic_weight = $' . $tables_name . '_arr[$i]->getVar("topic_weight"); echo "<tr class=\\"".$class."\\">"; '; $champs_data = const_show_champs_parametres($modules_name, $tables_name, $champs_id, $nb_champs, $champs, $champs_param_display_admin, $champs_param_type, $language, 1, 1); $text .= '' . $champs_data . ' echo "<td align=\\"center\\" width=\\"10%\\"> <a href=\\"' . $tables_name . '.php?op=edit_' . $tables_name . '&' . $champs_id . '=".$' . $tables_name . '_arr[$i]->getVar("' . $champs_id . '")."\\"><img src=\\"../images/deco/edit.gif\\" alt=\\"".' . $language . '_EDIT."\\" title=\\"".' . $language . '_EDIT."\\"></a> <a href=\\"' . $tables_name . '.php?op=delete_' . $tables_name . '&' . $champs_id . '=".$' . $tables_name . '_arr[$i]->getVar("' . $champs_id . '")."\\"><img src=\\"../images/deco/delete.gif\\" alt=\\"".' . $language . '_DELETE."\\" title=\\"".' . $language . '_DELETE."\\"></a> </td> </tr>"; $class = ($class == "even") ? "odd" : "even"; $criteria = new CriteriaCompo(); $criteria->add(new Criteria("topic_pid", $topic_id)); $criteria->setSort("topic_title"); $criteria->setOrder("ASC"); $topic_pid = $' . $tables_name . 'Handler->getall($criteria); $num_pid = $' . $tables_name . 'Handler->getCount(); if ( $num_pid != 0) { ' . $modules_name . '_display_children($topic_id, $topic_pid, $prefix, "topic_title", $class); } } } echo "</table><br><br>"; } '; } $text .= ' // Affichage du formulaire $obj =& $' . $tables_name . 'Handler->create(); $form = $obj->getForm(); } echo "<br /><br /> <div align=\\"center\\"><a href=\\"http://www.tdmxoops.net\\" target=\\"_blank\\"><img src=\\"http://www.tdmxoops.net/images/logo_modules.gif\\" alt=\\"TDM\\" title=\\"TDM\\"></a></div> "; xoops_cp_footer(); ?>'; //Integration du contenu dans le bloc $handle = fopen($admin_page_path_file, "w"); if (is_writable($admin_page_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . sprintf(_AM_TDMCREATE_CONST_NOTOK_ADMIN_PAGES, $tables_name) . '<br>' . $admin_page_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . sprintf(_AM_TDMCREATE_CONST_OK_ADMIN_PAGES, $tables_name) . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . sprintf(_AM_TDMCREATE_CONST_NOTOK_ADMIN_PAGES, $tables_name) . '<br>' . $admin_page_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }
function const_admin_permissions($modules, $modules_name, $tables_arr, $menu) { $language_manager = '_AM_' . strtoupper($modules_name) . '_MANAGER_'; $language = '_AM_' . strtoupper($modules_name) . '_PERMISSIONS_'; $myts =& MyTextSanitizer::getInstance(); $admin_permissions_file = "permissions.php"; $admin_permissions_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/admin/" . $admin_permissions_file; $en_tete = const_entete($modules, 0); $text = '<?php' . $en_tete . ' include("header.php"); if( !empty($_POST["submit"]) ) { redirect_header( XOOPS_URL."/modules/".$xoopsModule->dirname()."/admin/permissions.php" , 1 , _MP_GPERMUPDATED ); } xoops_cp_header(); global $xoopsDB; if ( !is_readable(XOOPS_ROOT_PATH . "/Frameworks/art/functions.admin.php")) { ' . $modules_name . '_adminmenu(' . $menu . ',' . $language_manager . 'PERMISSIONS); } else { include_once XOOPS_ROOT_PATH."/Frameworks/art/functions.admin.php"; loadModuleAdminMenu (' . $menu . ',' . $language_manager . 'PERMISSIONS); } //menu echo "<div class=\\"CPbigTitle\\" style=\\"background-image: url(../images/deco/permissions.png); background-repeat: no-repeat; background-position: left; padding-left: 50px;\\"> <strong>".' . $language_manager . 'PERMISSIONS."</strong> </div><br />"; $permtoset= isset($_POST["permtoset"]) ? intval($_POST["permtoset"]) : 1; $selected=array("","",""); $selected[$permtoset-1]=" selected"; echo " <form method=\\"post\\" name=\\"fselperm\\" action=\\"permissions.php\\"> <table border=0> <tr> <td> <select name=\\"permtoset\\" onChange=\\"javascript: document.fselperm.submit()\\"> <option value=\\"1\\"".$selected[0].">".' . $language . 'ACCESS."</option> <option value=\\"2\\"".$selected[1].">".' . $language . 'SUBMIT."</option> </select> </td> </tr> </table> </form>"; $module_id = $xoopsModule->getVar("mid"); switch($permtoset) { case 1: $title_of_form = ' . $language . 'ACCESS; $perm_name = "' . $modules_name . '_access"; $perm_desc = ""; break; case 2: $title_of_form = ' . $language . 'SUBMIT; $perm_name = "' . $modules_name . '_submit"; $perm_desc = ""; break; } $permform = new XoopsGroupPermForm($title_of_form, $module_id, $perm_name, $perm_desc, "admin/permissions.php"); $xt = new XoopsTopic( $xoopsDB -> prefix("' . $modules_name . '_topic") ); $alltopics =& $xt->getTopicsList(); foreach ($alltopics as $topic_id => $topic) { $permform->addItem($topic_id, $topic["title"], $topic["pid"]); } echo $permform->render(); echo "<br /><br /><br /><br />\\n"; unset ($permform); echo "<br /><br /> <div align=\\"center\\"><a href=\\"http://www.tdmxoops.net\\" target=\\"_blank\\"><img src=\\"http://www.tdmxoops.net/images/logo_modules.gif\\" alt=\\"TDM\\" title=\\"TDM\\"></a></div> "; ?>'; //Integration du contenu dans admin_header $handle = fopen($admin_permissions_path_file, "w"); if (is_writable($admin_permissions_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_ADMIN_PERMISSIONS . '<br>' . $admin_permissions_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . _AM_TDMCREATE_CONST_OK_ADMIN_PERMISSIONS . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_ADMIN_PERMISSIONS . '<br>' . $admin_permissions_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }
function const_class($modules, $modules_name, $tables_module_table, $tables_name, $tables_champs, $tables_parametres) { $language = '_AM_' . strtoupper($modules_name) . '_'; $modules_name_minuscule = strtolower($modules_name); $class_name = $tables_name; $class_file = $class_name . ".php"; $class_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/class/" . $class_file; $constructor = const_champs($modules_name, $tables_module_table, $tables_name, $tables_champs, $language, 0, 0, 0, 0); $en_tete = const_entete($modules, 0); //Champs $champs_total = explode("|", $tables_champs); $nb_champs = count($champs_total); //print_r($champs_total); //Parametres $parametres_total = explode("|", $tables_parametres); //Recuperation des parametres affichage dans le formulaire for ($i = 0; $i < $nb_champs; $i++) { $champs = explode(":", $champs_total[$i]); //Afficher dans les elements du formulaire et choisir le type if ($i == 0) { $champs_param_elements[$i] = '0'; $champs_param_display_form[$i] = '0'; } else { $parametres1 = explode(":", $parametres_total[$i - 1]); //print_r($parametres1); $champs_param_display_form[$i] = $parametres1[3]; $champs_param_elements[$i] = $parametres1[0]; $champs_param_required_field[$i] = $parametres1[6]; if ($parametres1[4] == 1) { $champs_param_main_field = $champs[0]; } } } $form = const_champs($modules_name, $tables_module_table, $tables_name, $tables_champs, $language, $champs_param_display_form, $champs_param_elements, $champs_param_required_field, 1); $text = '<?php' . $en_tete . ' if (!defined("XOOPS_ROOT_PATH")) { die("XOOPS root path not defined"); } if (!class_exists("XoopsPersistableObjectHandler")) { include_once XOOPS_ROOT_PATH."/modules/' . $modules_name . '/class/object.php"; } class ' . $tables_module_table . ' extends XoopsObject { //Constructor function __construct() { $this->XoopsObject();'; $text .= ' ' . $constructor . ' // Pour autoriser le html $this->initVar("dohtml", XOBJ_DTYPE_INT, 1, false); '; $text .= ' } function ' . $tables_module_table . '() { $this->__construct(); } function getForm($action = false) { global $xoopsDB, $xoopsModuleConfig; if ($action === false) { $action = $_SERVER["REQUEST_URI"]; } $title = $this->isNew() ? sprintf(' . $language . strtoupper($tables_name) . '_ADD) : sprintf(' . $language . strtoupper($tables_name) . '_EDIT); include_once(XOOPS_ROOT_PATH."/class/xoopsformloader.php"); $form = new XoopsThemeForm($title, "form", $action, "post", true); $form->setExtra(\'enctype="multipart/form-data"\'); '; $text .= '' . $form . ''; $text .= ' $form->addElement(new XoopsFormHidden("op", "save_' . $tables_name . '")); $form->addElement(new XoopsFormButton("", "submit", _SUBMIT, "submit")); $form->display(); return $form; } }'; $text .= ' class ' . $modules_name . $tables_module_table . 'Handler extends XoopsPersistableObjectHandler { function __construct(&$db) { parent::__construct($db, "' . $tables_module_table . '", "' . $tables_module_table . '", "' . $tables_name . '_id", "' . $champs_param_main_field . '"); } } ?>'; //Integration du contenu dans la classe $handle = fopen($class_path_file, "w"); if (is_writable($class_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . sprintf(_AM_TDMCREATE_CONST_NOTOK_CLASS, $tables_name) . '<br>' . $class_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . sprintf(_AM_TDMCREATE_CONST_OK_CLASS, $tables_name) . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . sprintf(_AM_TDMCREATE_CONST_NOTOK_CLASS, $tables_name) . '<br>' . $class_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }
function const_blocs_templates($modules, $modules_name, $tables_name, $tables_module_table, $tables_champs, $tables_parametres) { $language = '_MB_' . strtoupper($modules_name) . '_'; //1er blocks $blocs_language_file = '' . $tables_module_table . '_block_day.html'; $blocs_language_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/templates/blocks/" . $blocs_language_file; $en_tete = const_entete($modules, 0); $text = ' <table class="outer"> <{foreachq item=' . $tables_name . ' from=$block}> <tr class = "<{cycle values = "even,odd"}>"> <td>'; //Champs $champs = explode("|", $tables_champs); $nb_champs = count($champs); //Parametres $parametres = explode("|", $tables_parametres); $nb_parametres = count($parametres); $j = 0; $structure_parametres[3] = 0; for ($i = 0; $i < $nb_champs; $i++) { $structure_champs = explode(":", $champs[$i]); if ($i != 0) { $structure_parametres = explode(":", $parametres[$j]); $j++; } if ($structure_parametres[3] == 1 || $i == 0) { $text .= '<{$' . $tables_name . '.' . $structure_champs[0] . '}>; '; } } $text .= '</td> </tr> <{/foreach}> </table> '; //Integration du contenu dans le bloc $handle = fopen($blocs_language_path_file, "w"); if (is_writable($blocs_language_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_BLOCS_TEMPLATE . '<br>' . $blocs_language_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . _AM_TDMCREATE_CONST_OK_BLOCS_TEMPLATE . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_BLOCS_TEMPLATE . '<br>' . $blocs_language_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } //2eme blocks $blocs_language_file = '' . $tables_module_table . '_block_recent.html'; $blocs_language_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/templates/blocks/" . $blocs_language_file; $en_tete = const_entete($modules, 0); $text = ' <table class="outer"> <{foreachq item=' . $tables_name . ' from=$block}> <tr class = "<{cycle values = "even,odd"}>"> <td>'; //Champs $champs = explode("|", $tables_champs); $nb_champs = count($champs); //Parametres $parametres = explode("|", $tables_parametres); $nb_parametres = count($parametres); $j = 0; $structure_parametres[3] = 0; for ($i = 0; $i < $nb_champs; $i++) { $structure_champs = explode(":", $champs[$i]); if ($i != 0) { $structure_parametres = explode(":", $parametres[$j]); $j++; } if ($structure_parametres[3] == 1 || $i == 0) { $text .= '<{$' . $tables_name . '.' . $structure_champs[0] . '}>; '; } } $text .= '</td> </tr> <{/foreach}> </table> '; //Integration du contenu dans le bloc $handle = fopen($blocs_language_path_file, "w"); if (is_writable($blocs_language_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_BLOCS_TEMPLATE . '<br>' . $blocs_language_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . _AM_TDMCREATE_CONST_OK_BLOCS_TEMPLATE . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_BLOCS_TEMPLATE . '<br>' . $blocs_language_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } //3eme blocks $blocs_language_file = '' . $tables_module_table . '_block_random.html'; $blocs_language_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/templates/blocks/" . $blocs_language_file; $en_tete = const_entete($modules, 0); $text = ' <table class="outer"> <{foreachq item=' . $tables_name . ' from=$block}> <tr class = "<{cycle values = "even,odd"}>"> <td>'; //Champs $champs = explode("|", $tables_champs); $nb_champs = count($champs); //Parametres $parametres = explode("|", $tables_parametres); $nb_parametres = count($parametres); $j = 0; $structure_parametres[3] = 0; for ($i = 0; $i < $nb_champs; $i++) { $structure_champs = explode(":", $champs[$i]); if ($i != 0) { $structure_parametres = explode(":", $parametres[$j]); $j++; } if ($structure_parametres[3] == 1 || $i == 0) { $text .= '<{$' . $tables_name . '.' . $structure_champs[0] . '}>; '; } } $text .= '</td> </tr> <{/foreach}> </table> '; //Integration du contenu dans le bloc $handle = fopen($blocs_language_path_file, "w"); if (is_writable($blocs_language_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_BLOCS_TEMPLATE . '<br>' . $blocs_language_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . _AM_TDMCREATE_CONST_OK_BLOCS_TEMPLATE . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_BLOCS_TEMPLATE . '<br>' . $blocs_language_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }
function const_admin_index($modules, $modules_name, $tables_arr, $menu) { $language = '_AM_' . strtoupper($modules_name) . '_MANAGER_'; $language1 = '_AM_' . strtoupper($modules_name) . '_THEREARE_'; $myts =& MyTextSanitizer::getInstance(); $admin_index_file = "index.php"; $admin_index_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/admin/" . $admin_index_file; $en_tete = const_entete($modules, 0); $text = '<?php' . $en_tete . ' include_once("./header.php"); xoops_cp_header(); global $xoopsModule; //Apelle du menu admin if ( !is_readable(XOOPS_ROOT_PATH."/Frameworks/art/functions.admin.php")) { ' . $modules_name . '_adminmenu(' . $menu . ', ' . $language . 'INDEX); } else { include_once XOOPS_ROOT_PATH."/Frameworks/art/functions.admin.php"; loadModuleAdminMenu (' . $menu . ', ' . $language . 'INDEX); } '; foreach (array_keys($tables_arr) as $i) { $text .= ' //compte "total" $count_' . $tables_arr[$i]->getVar("tables_name") . ' = $' . $tables_arr[$i]->getVar("tables_name") . 'Handler->getCount(); //compte "attente" $criteria = new CriteriaCompo(); $criteria->add(new Criteria("' . $tables_arr[$i]->getVar("tables_name") . '_online", 1)); $' . $tables_arr[$i]->getVar("tables_name") . '_online = $' . $tables_arr[$i]->getVar("tables_name") . 'Handler->getCount($criteria); '; } $text .= ' include_once XOOPS_ROOT_PATH."/modules/' . $modules_name . '/class/menu.php"; $menu = new ' . $modules_name . 'Menu(); '; foreach (array_keys($tables_arr) as $i) { $text .= '$menu->addItem("' . $tables_arr[$i]->getVar("tables_name") . '", "' . $tables_arr[$i]->getVar("tables_name") . '.php", "../images/deco/' . $tables_arr[$i]->getVar("tables_img") . '", ' . $language . strtoupper($tables_arr[$i]->getVar("tables_name")) . ');'; } //$menu->addItem("Preference" "../../system/admin.php?fct=preferences&op=showmod&mod=".$xoopsModule->getVar("mid")."&&confcat_id=1", "../images/decos/pref.png", '.$language.'NAVPREFERENCES); $text .= ' $menu->addItem("update", "../../system/admin.php?fct=modulesadmin&op=update&module=' . $modules_name . '", "../images/deco/update.png", ' . $language . 'UPDATE); $menu->addItem("permissions", "permissions.php", "../images/deco/permissions.png", ' . $language . 'PERMISSIONS); $menu->addItem("preference", "../../system/admin.php?fct=preferences&op=showmod&mod=".$xoopsModule->getVar("mid"). "&&confcat_id=1", "../images/deco/pref.png", ' . $language . 'PREFERENCES); $menu->addItem("about", "about.php", "../images/deco/about.png", ' . $language . 'ABOUT); echo $menu->getCSS(); echo "<div class=\\"CPbigTitle\\" style=\\"background-image: url(../images/deco/index.png); background-repeat: no-repeat; background-position: left; padding-left: 50px;\\"><strong>".' . $language . 'INDEX."</strong></div><br /> <table width=\\"100%\\" border=\\"0\\" cellspacing=\\"10\\" cellpadding=\\"4\\"> <tr> <td valign=\\"top\\">".$menu->render()."</td> <td valign=\\"top\\" width=\\"60%\\">"; '; foreach (array_keys($tables_arr) as $i) { $text .= ' echo "<fieldset> <legend class=\\"CPmediumTitle\\">".' . $language . '' . strtoupper($tables_arr[$i]->getVar("tables_name")) . '."</legend> <br />"; printf(' . $language1 . strtoupper($tables_arr[$i]->getVar("tables_name")) . ', $count_' . $tables_arr[$i]->getVar("tables_name") . '); echo "<br /><br />"; printf(' . $language1 . strtoupper($tables_arr[$i]->getVar("tables_name")) . '_ONLINE, $' . $tables_arr[$i]->getVar("tables_name") . '_online); echo "<br /> </fieldset><br /><br />"; '; } $text .= ' echo "</td> </tr> </table> <br /><br /> <div align=\\"center\\"><a href=\\"http://www.tdmxoops.net\\" target=\\"_blank\\"><img src=\\"http://www.tdmxoops.net/images/logo_modules.gif\\" alt=\\"TDM\\" title=\\"TDM\\"></a></div> "; xoops_cp_footer(); ?>'; //Integration du contenu dans admin_header $handle = fopen($admin_index_path_file, "w"); if (is_writable($admin_index_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_ADMIN_INDEX . '<br>' . $admin_index_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . _AM_TDMCREATE_CONST_OK_ADMIN_INDEX . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_ADMIN_INDEX . '<br>' . $admin_index_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }
function const_include_coms($modules, $modules_name, $tables_name, $tables_module_table, $tables_champs, $tables_parametres, $tables_img) { $coms_file = "comment_new.php"; $coms_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/" . $coms_file; $en_tete = const_entete($modules, 0); ////Copie des fichiers coms //comment_edit.php $coms_edit = XOOPS_ROOT_PATH . "/modules/TDMCreate/include/comment_edit.php"; copy($coms_edit, XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/comment_edit.php"); //comment_delete.php $coms_delete = XOOPS_ROOT_PATH . "/modules/TDMCreate/include/comment_delete.php"; copy($coms_delete, XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/comment_delete.php"); //comment_post.php $coms_post = XOOPS_ROOT_PATH . "/modules/TDMCreate/include/comment_post.php"; copy($coms_post, XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/comment_post.php"); //comment_reply.php $coms_reply = XOOPS_ROOT_PATH . "/modules/TDMCreate/include/comment_reply.php"; copy($coms_reply, XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/comment_reply.php"); //Champs $champs_total = explode("|", $tables_champs); $nb_champs = count($champs_total); //print_r($champs_total); //Parametres $parametres_total = explode("|", $tables_parametres); //Recuperation des parametres affichage dans le formulaire for ($j = 0; $j < $nb_champs; $j++) { $champs = explode(":", $champs_total[$j]); //Afficher dans les elements du formulaire et choisir le type if ($j != 0) { $parametres1 = explode(":", $parametres_total[$j - 1]); if ($parametres1[4] == 1) { $champs_param_main_field = $champs[0]; } } } $text = '<?php' . $en_tete . ' include "../../mainfile.php"; include_once XOOPS_ROOT_PATH."/modules/' . $modules_name . '/class/' . $tables_name . '.php"; $com_itemid = isset($_REQUEST["com_itemid"]) ? intval($_REQUEST["com_itemid"]) : 0; if ($com_itemid > 0) { $' . $tables_name . 'Handler =& xoops_getModuleHandler("' . $tables_module_table . '", "' . $tables_name . '"); $' . $tables_name . ' = $' . $tables_name . 'handler->get($com_itemid); $com_replytitle = $' . $tables_name . '->getVar("' . $champs_param_main_field . '"); include XOOPS_ROOT_PATH."/include/comment_new.php"; } ?>'; $handle = fopen($coms_path_file, "w"); if (is_writable($coms_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_COMS . '<br>' . $coms_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . _AM_TDMCREATE_CONST_OK_COMS . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_COMS . '<br>' . $coms_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }
function const_class_menu($modules, $modules_name) { $modules_name_minuscule = strtolower($modules_name); $class_menu_file = "menu.php"; $class_menu_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/class/" . $class_menu_file; $en_tete = const_entete($modules, 0); $text = '<?php' . $en_tete . ' class ' . $modules_name . 'Menu { public $Width = 100; public $Height = 100; public $BgColor = "transparent"; public $OverBgColor = "#FFF6C1"; public $BorderWidth = 1; public $BorderColor = "#CCCCCC"; public $OverBorderColor = "#FF9900"; public $BorderStyle = "solid"; public $OverBorderStyle = "solid"; public $Font = "Tahoma, Arial, Helvetica"; public $FontColor = "#666666"; public $OverFontColor = "#1E90FF"; public $FontDeco = "none"; public $OverFontDeco = "none"; public $FontSize = 11; public $FontWeight = "bold"; public $FontExtra = "Tahoma, Arial, Helvetica"; public $FontExtraColor = "#A98952"; public $OverFontExtraColor = "#0033FF"; public $FontExtraDeco = "underline"; public $OverFontExtraDeco = "underline"; public $FontExtraSize = 9; public $FontExtraWeight = "normal"; public $TextAlign = "center"; private $_items = array(); public function addItem($id, $link="", $icon="", $name="", $extra="", $alt=""){ if (isset($this->_items[$id])) return false; $rtn["link"] = $link; $rtn["icon"] = $icon; $rtn["name"] = $name; $rtn["extra"] = $extra; $rtn["alt"] = $alt; $this->_items[$id] = $rtn; return true; } public function setLink($id, $link){ if (isset($this->_items[$id])){ $this->_items[$id]["link"] = $link; return true; } else { return false; } } public function setIcon($id, $icon){ if (isset($this->_items[$id])){ $this->_items[$id]["icon"] = $icon; return true; } else { return false; } } public function setName($id, $name){ if (isset($this->_items[$id])){ $this->_items[$id]["name"] = $name; return true; } else { return false; } } public function setExtra($id, $extra){ if (isset($this->_items[$id])){ $this->_items[$id]["extra"] = $extra; return true; } else { return false; } } public function setAlt($id, $alt){ if (isset($this->_items[$id])){ $this->_items[$id]["alt"] = $alt; return true; } else { return false; } } public function getCSS($ws = true){ if ($ws) $csscode = "<style type=\\"text/css\\">\\n<!--"; $csscode .= "div.rmmenuicon{ margin: 3px; font-family: $this->Font; text-align: ".$this->TextAlign."; } div.rmmenuicon a { display: block; float: left; height: ".$this->Height."px !important; height: ".$this->Height."px; width: ".$this->Width."px !important; width: ".$this->Width."px; vertical-align: middle; text-decoration : none; border: ".$this->BorderWidth."px $this->BorderStyle $this->BorderColor; padding: 2px 5px 1px 5px; margin: 3px; color: $this->FontColor; } div.rmmenuicon img { margin-top: 8px; margin-bottom: 8px; } div.rmmenuicon a span { font-size: ".$this->FontSize."px; font-weight: $this->FontWeight; display: block; } div.rmmenuicon a span.uno{ font-size: ".$this->FontExtraSize."px; font-weight: $this->FontExtraWeight; text-decoration: $this->FontExtraDeco; color: $this->FontExtraColor; } div.rmmenuicon a:hover{ background-color: $this->OverBgColor; border: ".$this->BorderWidth."px $this->BorderStyle $this->OverBorderColor; color: $this->OverFontColor; } div.rmmenuicon a:hover span{ text-decoration: $this->OverFontDeco; } div.rmmenuicon a:hover span.uno{ text-decoration: $this->OverFontExtraDeco; color: $this->OverFontExtraColor; }"; if ($ws) $csscode .= "\\n-->\\n</style>"; return $csscode; } public function render(){ $ret = "<div class=\\"rmmenuicon\\">"; foreach ($this->_items as $k => $v){ $ret .= "<a href=\\"".$v["link"]."\\" title=\\"".($v["alt"]!="" ? $v["alt"] : $v["name"])."\\">".($v["icon"]!="" ? "<img src=\\"".$v["icon"]."\\" alt=\\"".$v["name"]."\\" /> " : ""); if ($v["name"] != "") $ret .= "<span>".$v["name"]."</span>"; if ($v["extra"] != "") $ret .= "<span class=\\"uno\\">".$v["extra"]."</span>"; if ($v["extra"] != "") $ret .= "<span class=\\"uno\\">".$v["extra"]."</span>"; $ret .= "</a>"; } $ret .= "</div><div style=\\"clear: both;\\"></div>"; return $ret; } public function display(){ echo $this->render(); } } ?>'; //Integration du contenu dans la classe $handle = fopen($class_menu_path_file, "w"); if (is_writable($class_menu_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_CLASS_MENU . '<br>' . $class_menu_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . _AM_TDMCREATE_CONST_OK_CLASS_MENU . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_CLASS_MENU . '<br>' . $class_menu_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }
function const_include_install($modules, $modules_name, $tables_arr) { $indexFile = XOOPS_ROOT_PATH . "/modules/TDMCreate/include/index.html"; $include_install_file = "install.php"; $include_install_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/include/" . $include_install_file; $en_tete = const_entete($modules, 0); $text = '<?php' . $en_tete . ' $indexFile = XOOPS_ROOT_PATH."/modules/TDMCreate/include/index.html"; $blankFile = XOOPS_ROOT_PATH."/modules/TDMCreate/images/deco/blank.gif"; //Creation du dossier "uploads" pour le module à la racine du site $module_uploads = XOOPS_ROOT_PATH."/uploads/' . $modules_name . '"; if(!is_dir($module_uploads)) mkdir($module_uploads, 0777); chmod($module_uploads, 0777); copy($indexFile, XOOPS_ROOT_PATH."/uploads/' . $modules_name . '/index.html"); '; foreach (array_keys($tables_arr) as $i) { $tables_name = $tables_arr[$i]->getVar("tables_name"); $tables_champs = $tables_arr[$i]->getVar("tables_champs"); $tables_parametres = $tables_arr[$i]->getVar("tables_parametres"); //Champs $champs = explode("|", $tables_champs); $nb_champs = count($champs); //Parametres $parametres = explode("|", $tables_parametres); $nb_parametres = count($parametres); $j = 0; for ($i = 0; $i < $nb_champs; $i++) { $structure_champs = explode(":", $champs[$i]); if ($i != 0) { $structure_parametres = explode(":", $parametres[$j]); $j++; } if ($i == 0) { $text .= ' //Creation du fichier ' . $tables_name . ' dans uploads $module_uploads = XOOPS_ROOT_PATH."/uploads/' . $modules_name . '/' . $tables_name . '"; if(!is_dir($module_uploads)) mkdir($module_uploads, 0777); chmod($module_uploads, 0777); copy($indexFile, XOOPS_ROOT_PATH."/uploads/' . $modules_name . '/' . $tables_name . '/index.html"); '; } else { if ($structure_parametres[0] == 'XoopsFormUploadImage' || $structure_parametres[0] == 'XoopsFormUploadFile') { $text .= ' //Creation du dossier "uploads" pour le module à la racine du site $module_uploads = XOOPS_ROOT_PATH."/uploads/' . $modules_name . '/' . $tables_name . '/' . $structure_champs[0] . '"; if(!is_dir($module_uploads)) mkdir($module_uploads, 0777); chmod($module_uploads, 0777); copy($indexFile, XOOPS_ROOT_PATH."/uploads/' . $modules_name . '/' . $tables_name . '/' . $structure_champs[0] . '/index.html"); copy($blankFile, XOOPS_ROOT_PATH."/uploads/' . $modules_name . '/' . $tables_name . '/' . $structure_champs[0] . '/blank.gif"); '; } } } } $text .= ' ?>'; /*****************************************************/ //Integration du contenu dans le bloc $handle = fopen($include_install_path_file, "w"); if (is_writable($include_install_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_INCLUDE_FUNCTIONS . '<br>' . $include_install_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . _AM_TDMCREATE_CONST_OK_INCLUDE_FUNCTIONS . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_INCLUDE_FUNCTIONS . '<br>' . $include_install_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }
function const_xoopsversion($modules, $modules_name, $tables_arr) { $language = '_MI_' . strtoupper($modules_name) . ''; $xoopsversion_file = "xoops_version.php"; $xoopsversion_path_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/" . $xoopsversion_file; $en_tete = const_entete($modules, 0); $text = '<?php' . $en_tete . ' $modversion["name"] = "' . $modules->getVar("modules_name") . '"; $modversion["version"] = ' . $modules->getVar("modules_version") . '; $modversion["description"] = "' . $modules->getVar("modules_description") . '"; $modversion["author"] = "' . $modules->getVar("modules_author") . '"; $modversion["author_website_url"] = "' . $modules->getVar("modules_author_website_url") . '"; $modversion["author_website_name"] = "' . $modules->getVar("modules_author_website_name") . '"; $modversion["credits"] = "' . $modules->getVar("modules_credits") . '"; $modversion["license"] = "' . $modules->getVar("modules_license") . '"; $modversion["release_info"] = "' . $modules->getVar("modules_release_info") . '"; $modversion["release_file"] = "' . $modules->getVar("modules_release_file") . '"; $modversion["manual"] = "' . $modules->getVar("modules_manual") . '"; $modversion["manual_file"] = "' . $modules->getVar("modules_manual_file") . '"; $modversion["image"] = "images/' . $modules->getVar("modules_image") . '"; $modversion["dirname"] = "' . $modules->getVar("modules_name") . '"; //about $modversion["demo_site_url"] = "' . $modules->getVar("modules_demo_site_url") . '"; $modversion["demo_site_name"] = "' . $modules->getVar("modules_demo_site_name") . '"; $modversion["module_website_url"] = "' . $modules->getVar("modules_module_website_url") . '"; $modversion["module_website_name"] = "' . $modules->getVar("modules_module_website_name") . '"; $modversion["release"] = "' . $modules->getVar("modules_release") . '"; $modversion["module_status"] = "' . $modules->getVar("modules_status") . '"; '; if ($modules->getVar("modules_display_admin") == 1) { $text .= ' // Admin things $modversion["hasAdmin"] = 1; '; } $text .= ' $modversion["adminindex"] = "admin/index.php"; $modversion["adminmenu"] = "admin/menu.php"; // Mysql file $modversion["sqlfile"]["mysql"] = "sql/mysql.sql"; // Tables '; $j = 0; foreach (array_keys($tables_arr) as $i) { $text .= '$modversion["tables"][' . $j . '] = "' . $tables_arr[$i]->getVar('tables_module_table') . '"; '; $j++; } $text .= ' // Scripts to run upon installation or update $modversion["onInstall"] = "include/install.php"; //$modversion["onUpdate"] = "include/update.php";'; if ($modules->getVar("modules_display_menu") == 1) { $text .= '// Menu $modversion["hasMain"] = 1; '; } if ($modules->getVar("modules_active_search") == 1) { $text .= ' //Recherche $modversion["hasSearch"] = 1; $modversion["search"]["file"] = "include/search.inc.php"; $modversion["search"]["func"] = "' . $modules_name . '_search"; '; } $text .= ' $i = 1; include_once XOOPS_ROOT_PATH . "/class/xoopslists.php"; $modversion["config"][$i]["name"] = "' . $modules_name . '_editor"; $modversion["config"][$i]["title"] = "' . $language . '_EDITOR"; $modversion["config"][$i]["description"] = ""; $modversion["config"][$i]["formtype"] = "select"; $modversion["config"][$i]["valuetype"] = "text"; $modversion["config"][$i]["default"] = "dhtmltextarea"; $modversion["config"][$i]["options"] = XoopsLists::getDirListAsArray(XOOPS_ROOT_PATH . "/class/xoopseditor"); $modversion["config"][$i]["category"] = "global"; $i++; '; foreach (array_keys($tables_arr) as $i) { $tables_name = $tables_arr[$i]->getVar("tables_name"); $tables_champs = $tables_arr[$i]->getVar("tables_champs"); $tables_parametres = $tables_arr[$i]->getVar("tables_parametres"); //Champs $champs = explode("|", $tables_champs); $nb_champs = count($champs); //Parametres $parametres = explode("|", $tables_parametres); $nb_parametres = count($parametres); $j = 0; for ($i = 0; $i < $nb_champs; $i++) { $structure_champs = explode(":", $champs[$i]); $language1 = $language . '_' . strtoupper($structure_champs[0]) . ''; if ($i != 0) { $structure_parametres = explode(":", $parametres[$j]); $j++; if ($structure_parametres[0] == 'XoopsFormUploadImage') { $text .= ' //Uploads : size ' . $structure_champs[0] . ' $modversion["config"][$i]["name"] = "' . $structure_champs[0] . '_size"; $modversion["config"][$i]["title"] = "' . $language1 . '_SIZE"; $modversion["config"][$i]["description"] = ""; $modversion["config"][$i]["formtype"] = "textbox"; $modversion["config"][$i]["valuetype"] = "int"; $modversion["config"][$i]["default"] = "10485760"; $i++; //Uploads : mimetypes ' . $structure_champs[0] . ' $modversion["config"][$i]["name"] = "' . $structure_champs[0] . '_mimetypes"; $modversion["config"][$i]["title"] = "' . $language1 . '_MIMETYPES"; $modversion["config"][$i]["description"] = ""; $modversion["config"][$i]["formtype"] = "select_multi"; $modversion["config"][$i]["valuetype"] = "array"; $modversion["config"][$i]["default"] = array("image/gif", "image/jpeg", "image/png"); $modversion["config"][$i]["options"] = array( "bmp" => "image/bmp", "gif" => "image/gif", "jpeg" => "image/pjpeg", "jpeg" => "image/jpeg", "jpg" => "image/jpeg", "jpe" => "image/jpeg", "png" => "image/png"); $i++; '; } else { if ($structure_parametres[0] == 'XoopsFormUploadFile') { $text .= ' //Uploads : size ' . $structure_champs[0] . ' $modversion["config"][$i]["name"] = "' . $structure_champs[0] . '_size"; $modversion["config"][$i]["title"] = "' . $language1 . '_SIZE"; $modversion["config"][$i]["description"] = ""; $modversion["config"][$i]["formtype"] = "textbox"; $modversion["config"][$i]["valuetype"] = "int"; $modversion["config"][$i]["default"] = "10485760"; $i++; //Uploads : mimetypes ' . $structure_champs[0] . ' $modversion["config"][$i]["name"] = "' . $structure_champs[0] . '_mimetypes"; $modversion["config"][$i]["title"] = "' . $language1 . '_MIMETYPES"; $modversion["config"][$i]["description"] = ""; $modversion["config"][$i]["formtype"] = "select_multi"; $modversion["config"][$i]["valuetype"] = "array"; $modversion["config"][$i]["default"] = array("image/gif", "image/jpeg", "image/png"); $modversion["config"][$i]["options"] = array( "bmp" => "image/bmp", "gif" => "image/gif", "ico" => "image/icon", "ief" => "image/ief", "jpeg" => "image/pjpeg", "jpeg" => "image/jpeg", "jpg" => "image/jpeg", "jpe" => "image/jpeg", "png" => "image/png", "tiff" => "image/tiff", "tif" => "image/tif", "wbmp" => "image/vnd.wap.wbmp", "ace" => "application/x-ace-compressed", "ai" => "application/postscript", "aif" => "audio/x-aiff", "aifc" => "audio/x-aiff", "aiff" => "audio/x-aiff", "asc" => "text/plain", "asf" => "video/x-ms-asf", "asx" => "audio/x-ms-wax", "au" => "audio/basic", "avi" => "video/x-msvideo", "bcpio" => "application/x-bcpio", "bin" => "application/octet-stream", "cdf" => "application/x-netcdf", "class" => "application/octet-stream", "cpio" => "application/x-cpio", "cpt" => "application/mac-compactpro", "csh" => "application/x-csh", "css" => "text/css", "dll" => "application/octet-stream", "dir" => "application/x-director", "djvu" => "image/vnd.djvu", "djv" => "image/vnd.djvu", "dms" => "application/octet-stream", "doc" => "application/msword", "dcr" => "application/x-director", "dvi" => "application/x-dvi", "dxr" => "application/x-director", "eps" => "application/postscript", "etx" => "text/x-setext", "exe" => "application/octet-stream", "ez" => "application/andrew-inset", "gtar" => "application/x-gtar", "hdf" => "application/x-hdf", "hqx" => "application/mac-binhex40", "htm" => "text/html", "html" => "text/html", "ice" => "x-conference-xcooltalk", "iges" => "model/iges", "igs" => "model/iges", "js" => "application/x-javascript", "kar" => "audio/midi", "latex" => "application/x-latex", "lha" => "application/octet-stream", "Log" => "text/plain", "log" => "text/plain", "lzh" => "application/octet-stream", "man" => "application/x-troff-man", "me" => "application/x-troff-me", "mesh" => "model/mesh", "msh" => "model/mesh", "mid" => "audio/midi", "midi" => "audio/midi", "mov" => "video/quicktime", "movie" => "video/x-sgi-movie", "mxu" => "video/vnd.mpegurl", "mpe" => "video/mpeg", "mpeg" => "video/mpeg", "mpg" => "video/mpeg", "mpga" => "audio/mpeg", "mp2" => "audio/mpeg", "mp3" => "audio/mpeg", "ms" => "application/x-troff-ms", "m3u" => "audio/x-mpegurl", "nc" => "application/x-netcdf", "oda" => "application/oda", "pbm" => "image/x-portable-bitmap", "pdb" => "chemical/x-pdb", "pgm" => "image/x-portable-graymap", "pnm" => "image/x-portable-anymap", "ppm" => "image/x-portable-pixmap", "pdf" => "application/pdf", "pgn" => "application/x-chess-pgn", "php" => "text/php", "php3" => "text/php3", "ps" => "application/postscript", "qt" => "video/quicktime", "roff" => "application/x-troff", "sgm" => "text/sgml", "sgml" => "text/sgml", "sh" => "application/x-sh", "shar" => "application/x-shar", "skd" => "application/x-koan", "skm" => "application/x-koan", "skp" => "application/x-koan", "skt" => "application/x-koan", "silo" => "model/mesh", "sit" => "application/x-stuffit", "smi" => "application/smil", "smil" => "application/smil", "snd" => "audio/basic", "so" => "application/octet-stream", "spl" => "application/x-futuresplash", "src" => "application/x-wais-source", "sv4cpio" => "application/x-sv4cpio", "sv4crc" => "application/x-sv4crc", "swf" => "application/x-shockwave-flash", "ra" => "audio/x-realaudio", "ram" => "audio/x-pn-realaudio", "rar" => "application/x-rar-compressed", "ras" => "image/x-cmu-raster", "rgb" => "image/x-rgb", "rm" => "audio/x-pn-realaudio", "rpm" => "audio/x-pn-realaudio-plugin", "rtf" => "text/rtf", "rtx" => "text/richtext", "t" => "application/x-troff", "tar" => "application/x-tar", "tar.gz" => "application/x-gzip", "tcl" => "application/x-tcl", "tex" => "application/x-tex", "texinfo" => "application/x-texinfo", "texi" => "application/x-texinfo", "tr" => "application/x-troff", "tsv" => "text/tab-seperated-values", "txt" => "text/plain", "ustar" => "application/x-ustar", "vcd" => "application/x-cdlink", "vrml" => "model/vrml", "wav" => "audio/x-wav", "wax" => "audio/x-windows-media", "wbxml" => "application/vnd.wap.wbxml", "wma" => "audio/x-ms-wma", "wm" => "video/x-ms-wm", "wmd" => "application/x-ms-wmd", "wml" => "text/vnd.wap.wml", "wmlc" => "application/vnd.wap.wmlc", "wmls" => "text/vnd.wap.wmlscript", "wmlsc" => "application/vnd.wap.wmlscriptc", "wmx" => "video/x-ms-wmx", "wmv" => "video/x-ms-wmv", "wmz" => "application/x-ms-wmz", "wrl" => "model/vrml", "wvx" => "video/x-ms-wvx", "xbm" => "image/x-xbitmap", "xpm" => "image/x-xpixmap", "xht" => "application/xhtml+xml", "xhtml" => "application/xhtml+xml", "XM" => "audio/fasttracker", "xml" => "text/xml", "xsl" => "text/xml", //"xls" => "application/excel", "xls" => "application/vnd.ms-excel", "xwd" => "image/x-windowdump", "xyz" => "chemical/x-xyz", "zip" => "application/zip", "Zip" => "application/zip", "unknown" => "application/octet-stream"); $i++; '; } } } } } $text .= ' //Blocs $i = 1;'; foreach (array_keys($tables_arr) as $i) { $tables_module_table = $tables_arr[$i]->getVar("tables_module_table"); $tables_name = $tables_arr[$i]->getVar("tables_name"); $tables_blocs = $tables_arr[$i]->getVar("tables_blocs"); $language = '_MI_' . strtoupper($tables_module_table) . ''; if ($tables_blocs == 1) { $text .= ' $modversion["blocks"][$i]["file"] = "blocks_' . $tables_name . '.php"; $modversion["blocks"][$i]["name"] = ' . $language . '_BLOCK_RECENT; $modversion["blocks"][$i]["description"] = ""; $modversion["blocks"][$i]["show_func"] = "b_' . $tables_module_table . '"; $modversion["blocks"][$i]["edit_func"] = "b_' . $tables_module_table . '_edit"; $modversion["blocks"][$i]["options"] = "recent|5|25|0"; $modversion["blocks"][$i]["template"] = "' . $tables_module_table . '_block_recent.html"; $i++; $modversion["blocks"][$i]["file"] = "blocks_' . $tables_name . '.php"; $modversion["blocks"][$i]["name"] = ' . $language . '_BLOCK_DAY; $modversion["blocks"][$i]["description"] = ""; $modversion["blocks"][$i]["show_func"] = "b_' . $tables_module_table . '"; $modversion["blocks"][$i]["edit_func"] = "b_' . $tables_module_table . '_edit"; $modversion["blocks"][$i]["options"] = "day|5|25|0"; $modversion["blocks"][$i]["template"] = "' . $tables_module_table . '_block_day.html"; $i++; $modversion["blocks"][$i]["file"] = "blocks_' . $tables_name . '.php"; $modversion["blocks"][$i]["name"] = ' . $language . '_BLOCK_RANDOM; $modversion["blocks"][$i]["description"] = ""; $modversion["blocks"][$i]["show_func"] = "b_' . $tables_module_table . '"; $modversion["blocks"][$i]["edit_func"] = "b_' . $tables_module_table . '_edit"; $modversion["blocks"][$i]["options"] = "random|5|25|0"; $modversion["blocks"][$i]["template"] = "' . $tables_module_table . '_block_random.html"; $i++;'; } } $text .= ' ?>'; //Integration du contenu dans le fichier xoopsconfig.php $handle = fopen($xoopsversion_path_file, "w"); if (is_writable($xoopsversion_path_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_XOOPS_VERSION . '<br>' . $xoopsversion_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . _AM_TDMCREATE_CONST_OK_XOOPS_VERSION . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_XOOPS_VERSION . '<br>' . $xoopsversion_path_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }
function const_include_search($modules, $modules_name, $tables_name, $tables_module_table, $tables_champs, $tables_parametres, $tables_img) { $searchfile = "search.inc.php"; $searchpath_file = XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/include/" . $searchfile; $en_tete = const_entete($modules, 0); //copie de l'image de la table et renommer $extension = preg_replace("/^.+\\.([^.]+)\$/sU", "\\1", $tables_img); $imgFile = XOOPS_ROOT_PATH . "/modules/TDMCreate/images/uploads/tables/" . $tables_img . ""; $img_search = $tables_name . "_search." . $extension; if (file_exists($imgFile)) { copy($imgFile, XOOPS_ROOT_PATH . "/modules/TDMCreate/modules/" . $modules_name . "/images/deco/" . $img_search . ""); } //Champs $champs_total = explode("|", $tables_champs); $nb_champs = count($champs_total); //print_r($champs_total); //Parametres $parametres_total = explode("|", $tables_parametres); $k = 0; //Recuperation des parametres affichage dans le formulaire for ($j = 0; $j < $nb_champs; $j++) { $champs = explode(":", $champs_total[$j]); //Afficher dans les elements du formulaire et choisir le type if ($j != 0) { $parametres1 = explode(":", $parametres_total[$j - 1]); if ($parametres1[5] == 1) { $champs_param_search_field[$k] = $champs[0]; $k++; } if ($parametres1[4] == 1) { $champs_param_main_field = $champs[0]; } } } function search_field($champs_param_search_field, $options) { $nb_champs_param_search_field = count($champs_param_search_field); $sql = '('; for ($l = 0; $l < $nb_champs_param_search_field; $l++) { if ($l != $nb_champs_param_search_field - 1) { $sql .= '' . $champs_param_search_field[$l] . ' LIKE \'%$queryarray[' . $options . ']%\' OR '; } else { $sql .= '' . $champs_param_search_field[$l] . ' LIKE \'%$queryarray[0]%\''; } } $sql .= ')'; return $sql; } $text = '<?php' . $en_tete . ' function ' . $modules_name . '_search($queryarray, $andor, $limit, $offset, $userid) { global $xoopsDB; $sql = "SELECT ' . $tables_name . '_id, ' . $champs_param_main_field . ', ' . $tables_name . '_submitter, ' . $tables_name . '_date_created FROM ".$xoopsDB->prefix("' . $tables_module_table . '")." WHERE ' . $tables_name . '_online = 1"; if ( $userid != 0 ) { $sql .= " AND ' . $tables_name . '_submitter=".intval($userid)." "; } if ( is_array($queryarray) && $count = count($queryarray) ) { $sql .= " AND ('; $text .= '' . search_field($champs_param_search_field, 0) . '"; for($i=1;$i<$count;$i++) { $sql .= " $andor "; '; $text .= '$sql .= "' . search_field($champs_param_search_field, '$i') . '"; } $sql .= ")"; } $sql .= " ORDER BY ' . $tables_name . '_date_created DESC"; $result = $xoopsDB->query($sql,$limit,$offset); $ret = array(); $i = 0; while($myrow = $xoopsDB->fetchArray($result)) { $ret[$i]["image"] = "images/deco/' . $img_search . '"; $ret[$i]["link"] = "' . $tables_name . '.php?' . $tables_name . '_id=".$myrow["' . $tables_name . '_id"].""; $ret[$i]["title"] = $myrow["' . $champs_param_main_field . '"]; $ret[$i]["time"] = $myrow["' . $tables_name . '_date_created"]; $ret[$i]["uid"] = $myrow["' . $tables_name . '_submitter"]; $i++; } return $ret; } ?>'; //Integration du contenu dans le fichier xoopsconfig.php $handle = fopen($searchpath_file, "w"); if (is_writable($searchpath_file)) { if (fwrite($handle, $text) === FALSE) { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_SEARCH . '<br>' . $searchpath_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; exit; } echo '<tr> <td>' . _AM_TDMCREATE_CONST_OK_SEARCH . '</td> <td><img src="./../images/deco/on.gif"></td> </tr>'; fclose($handle); } else { echo '<tr> <td>' . _AM_TDMCREATE_CONST_NOTOK_SEARCH . '<br>' . $searchpath_file . '</td> <td><img src="./../images/deco/off.gif"></td> </tr>'; } }