http://www.fsf.org/ or write * to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. * */ /** * Templates parameters. * Here are defined arrays that we to handle static sections. * From version > 0.8-Stable we use DB for sections. */ // Get all the section names from the DB $cms->dbms->dbquery("select section_name, id from " . $cms->dbms->DB_tbl_prefix . "sections order by id"); // For each section found, get up its attributes and populate the arrays for ($sid=0; $sid<$cms->dbms->dbnum_rows(); $sid++) { $sect_temp = $cms->dbms->dbfetch_array(); $sect_name = $sect_temp[0]; $sect_id = $sect_temp[1]; //echo "DEBUG: Sect_id: $sect_id, Sect_name: $sect_name, sid: $sid"; // Push the resultset to nest queries $cms->dbms->stack_push(); // This was introduced in 0.9 devel, where templates are stored into another table. // WARN: Here we are breaking DB compatibility with cmsdam version < 0.9 devel! // Get the language, the template file, the short and the long description for this section $cms->dbms->dbquery("select sect.language, temp.template_file, sect.short_description, sect.long_description, sect.c_user, sect.c_date from " . $cms->dbms->DB_tbl_prefix . "section_templates as sect, " . $cms->dbms->DB_tbl_prefix . "templates as temp where temp.template = sect.template_name and sect.language = temp.language and sect.section_id = $sect_id"); // Cycle on the languages of that section for ($temp_langs=0; $temp_langs<$cms->dbms->dbnum_rows(); $temp_langs++) { $dets_temp = $cms->dbms->dbfetch_array(); $dets_lang = $dets_temp[0]; $dets_tmplfile = $dets_temp[1]; $dets_shortdes = $dets_temp[2]; $dets_longdes = $dets_temp[3]; $dets_c_user = $dets_temp[4]; $dets_c_date = $dets_temp[5]; //echo " TEST: Langs: " . $dets_longdes; // Populate some arrays $cms->conf->Section_file_arr[$dets_lang][$sid] = $dets_tmplfile; // This is for retro compatibility! $cms->conf->Section_template_arr[$dets_lang][$sid] = $dets_tmplfile; $cms->conf->Section_cr_user_arr[$dets_lang][$sid] = $dets_c_user; $cms->conf->Section_cr_date_arr[$dets_lang][$sid] = $dets_c_date; $cms->conf->Shortdescription_arr[$dets_lang][$sid] = $dets_shortdes; $cms->conf->Section_langs_Shortdesc_arr[$dets_lang][$sid] = $dets_shortdes; $cms->conf->Longdescription_arr[$dets_lang][$sid] = $dets_longdes; $cms->conf->Section_langs_Longdesc_arr[$dets_lang][$sid] = $dets_longdes; //echo "DEBUG: " . $dets_lang . "; file_arr . " . $cms->conf->Section_file_arr[$dets_lang][$sid]; if ($cms->conf->Section_file_arr[$dets_lang][$sid] != "") { // This section have a language internationalized template file, so update its language array $cms->conf->Section_langs_arr[$sid][] = $dets_lang; } } // Pop the resultset to return to the section_name query $cms->dbms->stack_pop(); // Section Users $cms->dbms->stack_push(); $cms->dbms->dbquery("select user_name from " . $cms->dbms->DB_tbl_prefix . "section_users where section_id = $sect_id"); $users_list = ""; $temp_nusers = $cms->dbms->dbnum_rows(); // For each user owner of that section for ($temp_users=0; $temp_users<$temp_nusers; $temp_users++) { $users_temp = $cms->dbms->dbfetch_array(); if ($temp_users == ($temp_nusers - 1)) { // Last record $users_list .= $users_temp[0]; } else { // Not the last user $users_list .= $users_temp[0] . ", "; } } //echo "TEST: sid: $sid, users: " . $users_list; // Populate the Section users array $cms->conf->Section_users_arr[$sid] = $users_list; $cms->dbms->stack_pop(); // Section Groups $cms->dbms->stack_push(); $cms->dbms->dbquery("select group_name from " . $cms->dbms->DB_tbl_prefix . "section_groups where section_id = $sect_id"); $groups_list = ""; $temp_ngroups = $cms->dbms->dbnum_rows(); // For each group owner of that section for ($temp_groups=0; $temp_groups<$temp_ngroups; $temp_groups++) { $groups_temp = $cms->dbms->dbfetch_array(); if ($temp_groups == ($temp_ngroups - 1)) { // Last record $groups_list .= $groups_temp[0]; } else { // Not the last group $groups_list .= $groups_temp[0] . ", "; } } //echo "TEST: sid: $sid, groups: " . $groups_list; // Populate the Section groups array $cms->conf->Section_groups_arr[$sid] = $groups_list; $cms->dbms->stack_pop(); // Search Users $cms->dbms->stack_push(); $cms->dbms->dbquery("select user_name from " . $cms->dbms->DB_tbl_prefix . "section_search_users where section_id = $sect_id"); $users_list = ""; $temp_nusers = $cms->dbms->dbnum_rows(); // For each user owner of that section for ($temp_users=0; $temp_users<$temp_nusers; $temp_users++) { $users_temp = $cms->dbms->dbfetch_array(); if ($temp_users == ($temp_nusers - 1)) { // Last record $users_list .= $users_temp[0]; } else { // Not the last user $users_list .= $users_temp[0] . ", "; } } //echo "TEST: sid: $sid, s_users: " . $users_list; // Populate the Search users array $cms->conf->Search_users_arr[$sid] = $users_list; $cms->dbms->stack_pop(); // Search Groups $cms->dbms->stack_push(); $cms->dbms->dbquery("select group_name from " . $cms->dbms->DB_tbl_prefix . "section_search_groups where section_id = $sect_id"); $groups_list = ""; $temp_ngroups = $cms->dbms->dbnum_rows(); // For each group owner of that section for ($temp_groups=0; $temp_groups<$temp_ngroups; $temp_groups++) { $groups_temp = $cms->dbms->dbfetch_array(); if ($temp_groups == ($temp_ngroups - 1)) { // Last record $groups_list .= $groups_temp[0]; } else { // Not the last group $groups_list .= $groups_temp[0] . ", "; } } //echo "TEST: sid: $sid, s_groups: " . $groups_list; // Populate the Search groups array $cms->conf->Search_groups_arr[$sid] = $groups_list; $cms->dbms->stack_pop(); // Populate the Section_arr array $cms->conf->Section_arr[$sid] = $sect_name; // echo " TEST: Sections: " . $cms->conf->Section_arr[$i]; } ?>