update-db-1.8.5-1.8.6.inc.php 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238
  1. <?php // $Id: update-db-1.8.5-1.8.6.inc.php 22197 2009-07-17 17:49:44Z ivantcholakov $
  2. /* See license terms in /dokeos_license.txt */
  3. /**
  4. ==============================================================================
  5. * Update the Dokeos database from an older version
  6. * Notice : This script has to be included by index.php or update_courses.php
  7. *
  8. * @package dokeos.install
  9. * @todo
  10. * - conditional changing of tables. Currently we execute for example
  11. * ALTER TABLE `$dbNameForm`.`cours` instructions without checking wether this is necessary.
  12. * - reorganise code into functions
  13. * @todo use database library
  14. ==============================================================================
  15. */
  16. //load helper functions
  17. require_once("install_upgrade.lib.php");
  18. require_once('../inc/lib/image.lib.php');
  19. $old_file_version = '1.8.5';
  20. $new_file_version = '1.8.6';
  21. //remove memory and time limits as much as possible as this might be a long process...
  22. if(function_exists('ini_set'))
  23. {
  24. ini_set('memory_limit',-1);
  25. ini_set('max_execution_time',0);
  26. }else{
  27. error_log('Update-db script: could not change memory and time limits',0);
  28. }
  29. /*
  30. ==============================================================================
  31. MAIN CODE
  32. ==============================================================================
  33. */
  34. //check if we come from index.php or update_courses.php - otherwise display error msg
  35. if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE'))
  36. {
  37. //check if the current Dokeos install is elligible for update
  38. if (!file_exists('../inc/conf/configuration.php'))
  39. {
  40. echo '<b>'.get_lang('Error').' !</b> Dokeos '.implode('|', $updateFromVersion).' '.get_lang('HasNotBeenFound').'.<br><br>
  41. '.get_lang('PleasGoBackToStep1').'.
  42. <p><button type="submit" class="back" name="step1" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
  43. </td></tr></table></form></body></html>';
  44. exit ();
  45. }
  46. //get_config_param() comes from install_functions.inc.php and
  47. //actually gets the param from
  48. $_configuration['db_glue'] = get_config_param('dbGlu');
  49. if ($singleDbForm)
  50. {
  51. $_configuration['table_prefix'] = get_config_param('courseTablePrefix');
  52. $_configuration['main_database'] = get_config_param('mainDbName');
  53. $_configuration['db_prefix'] = get_config_param('dbNamePrefix');
  54. }
  55. $dbScormForm = eregi_replace('[^a-z0-9_-]', '', $dbScormForm);
  56. if (!empty ($dbPrefixForm) && !ereg('^'.$dbPrefixForm, $dbScormForm))
  57. {
  58. $dbScormForm = $dbPrefixForm.$dbScormForm;
  59. }
  60. if (empty ($dbScormForm) || $dbScormForm == 'mysql' || $dbScormForm == $dbPrefixForm)
  61. {
  62. $dbScormForm = $dbPrefixForm.'scorm';
  63. }
  64. $res = @mysql_connect($dbHostForm, $dbUsernameForm, $dbPassForm);
  65. //if error on connection to the database, show error and exit
  66. if ($res === false)
  67. {
  68. //$no = mysql_errno();
  69. //$msg = mysql_error();
  70. //echo '<hr>['.$no.'] - '.$msg.'<hr>';
  71. echo get_lang('DBServerDoesntWorkOrLoginPassIsWrong').'.<br /><br />' .
  72. ' '.get_lang('PleaseCheckTheseValues').' :<br /><br />
  73. <b>'.get_lang('DBHost').'</b> : '.$dbHostForm.'<br />
  74. <b>'.get_lang('DBLogin').'</b> : '.$dbUsernameForm.'<br />
  75. <b>'.get_lang('DBPassword').'</b> : '.$dbPassForm.'<br /><br />
  76. '.get_lang('PleaseGoBackToStep').' '. (defined('DOKEOS_INSTALL') ? '3' : '1').'.
  77. <p><button type="submit" class="back" name="step'. (defined('DOKEOS_INSTALL') ? '3' : '1').'" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
  78. </td></tr></table></form></body></html>';
  79. exit ();
  80. }
  81. // The Dokeos system has not been designed to use special SQL modes that were introduced since MySQL 5
  82. @mysql_query("set session sql_mode='';");
  83. $dblistres = mysql_list_dbs();
  84. $dblist = array();
  85. while ($row = mysql_fetch_object($dblistres)) {
  86. $dblist[] = $row->Database;
  87. }
  88. /*
  89. -----------------------------------------------------------
  90. Normal upgrade procedure:
  91. start by updating main, statistic, user databases
  92. -----------------------------------------------------------
  93. */
  94. //if this script has been included by index.php, not update_courses.php, so
  95. // that we want to change the main databases as well...
  96. $only_test = false;
  97. $log = 0;
  98. if (defined('DOKEOS_INSTALL'))
  99. {
  100. if ($singleDbForm)
  101. {
  102. $dbStatsForm = $dbNameForm;
  103. $dbScormForm = $dbNameForm;
  104. $dbUserForm = $dbNameForm;
  105. }
  106. /**
  107. * Update the databases "pre" migration
  108. */
  109. include ("../lang/english/create_course.inc.php");
  110. if ($languageForm != 'english')
  111. {
  112. //languageForm has been escaped in index.php
  113. include ("../lang/$languageForm/create_course.inc.php");
  114. }
  115. //get the main queries list (m_q_list)
  116. $m_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql','main');
  117. if(count($m_q_list)>0)
  118. {
  119. //now use the $m_q_list
  120. /**
  121. * We connect to the right DB first to make sure we can use the queries
  122. * without a database name
  123. */
  124. if(strlen($dbNameForm)>40){
  125. error_log('Database name '.$dbNameForm.' is too long, skipping',0);
  126. }elseif(!in_array($dbNameForm,$dblist)){
  127. error_log('Database '.$dbNameForm.' was not found, skipping',0);
  128. }else{
  129. mysql_select_db($dbNameForm);
  130. foreach($m_q_list as $query){
  131. if($only_test){
  132. error_log("mysql_query($dbNameForm,$query)",0);
  133. }else{
  134. $res = mysql_query($query);
  135. if($log)
  136. {
  137. error_log("In $dbNameForm, executed: $query",0);
  138. }
  139. }
  140. }
  141. }
  142. }
  143. // Filling the access_url_rel_user table with access_url_id by default = 1
  144. $query = "SELECT user_id FROM $dbNameForm.user";
  145. $result_users = mysql_query($query);
  146. while ($row= mysql_fetch_array($result_users,MYSQL_NUM)) {
  147. $user_id = $row[0];
  148. $sql="INSERT INTO $dbNameForm.access_url_rel_user SET user_id=$user_id, access_url_id=1";
  149. $res = mysql_query($sql);
  150. //Updating user image
  151. $query = "SELECT picture_uri FROM $dbNameForm.user WHERE user_id=$user_id";
  152. $res = mysql_query($query);
  153. $picture_uri = mysql_fetch_array($res,MYSQL_NUM);
  154. $file = $picture_uri[0];
  155. $dir = api_get_path(SYS_CODE_PATH).'upload/users/';
  156. $image_repository = file_exists($dir.$file)? $dir.$file:$dir.$user_id.'/'.$file;
  157. if (!is_dir($dir.$user_id)) {
  158. $perm = octdec(!empty($perm)?$perm:'0777');
  159. @mkdir($dir.$user_id, $perm);
  160. }
  161. if (file_exists($image_repository)) {
  162. chmod($dir.$user_id, 0777);
  163. if (is_dir($dir.$user_id)) {
  164. $picture_location = $dir.$user_id.'/'.$file;
  165. $big_picture_location = $dir.$user_id.'/big_'.$file;
  166. $temp = new image($image_repository);
  167. $picture_infos=getimagesize($image_repository);
  168. $thumbwidth = 150;
  169. if (empty($thumbwidth) or $thumbwidth==0) {
  170. $thumbwidth=150;
  171. }
  172. $new_height = ($picture_infos[0] > 0)?round(($thumbwidth/$picture_infos[0])*$picture_infos[1]) : 0;
  173. $temp->resize($thumbwidth,$new_height,0);
  174. $type=$picture_infos[2];
  175. // original picture
  176. $big_temp = new image($image_repository);
  177. switch (!empty($type)) {
  178. case 2 : $temp->send_image('JPG',$picture_location);
  179. $big_temp->send_image('JPG',$big_picture_location);
  180. break;
  181. case 3 : $temp->send_image('PNG',$picture_location);
  182. $big_temp->send_image('JPG',$big_picture_location);
  183. break;
  184. case 1 : $temp->send_image('GIF',$picture_location);
  185. $big_temp->send_image('JPG',$big_picture_location);
  186. break;
  187. }
  188. if ($image_repository == $dir.$file) {
  189. @unlink($image_repository);
  190. }
  191. }
  192. }
  193. }
  194. // Filling the access_url_rel_session table with access_url_id by default = 1
  195. $query = "SELECT id FROM $dbNameForm.session";
  196. $result = mysql_query($query);
  197. while ($row= mysql_fetch_array($result,MYSQL_NUM)) {
  198. $sql="INSERT INTO $dbNameForm.access_url_rel_session SET session_id=".$row[0].", access_url_id=1";
  199. $res = mysql_query($sql);
  200. }
  201. //Since the parser of the migration DB does not work for this kind of inserts (HTML) we move it here
  202. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  203. (\'TemplateTitleCourseTitle\', \'TemplateTitleCourseTitleDescription\', \'coursetitle.gif\', \'
  204. <head>
  205. {CSS}
  206. <style type="text/css">
  207. .gris_title {
  208. color: silver;
  209. }
  210. h1
  211. {
  212. text-align: right;
  213. }
  214. </style>
  215. </head>
  216. <body>
  217. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
  218. <tbody>
  219. <tr>
  220. <td style="vertical-align: middle; width: 50%;" colspan="1" rowspan="1">
  221. <h1>TITULUS 1<br>
  222. <span class="gris_title">TITULUS 2</span><br>
  223. </h1>
  224. </td>
  225. <td style="width: 50%;">
  226. <img style="width: 100px; height: 100px;" alt="dokeos logo" src="{COURSE_DIR}images/logo_dokeos.png"></td>
  227. </tr>
  228. </tbody>
  229. </table>
  230. <p><br>
  231. <br>
  232. </p>
  233. </body>
  234. \');';
  235. $res = mysql_query($sql);
  236. /*
  237. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  238. (\'TemplateTitleCheckList\', \'TemplateTitleCheckListDescription\', \'checklist.gif\', \'
  239. <head>
  240. {CSS}
  241. </head>
  242. <body>
  243. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
  244. <tbody>
  245. <tr>
  246. <td style="vertical-align: top; width: 66%;">
  247. <h3>Lorem ipsum dolor sit amet</h3>
  248. <ul>
  249. <li>consectetur adipisicing elit</li>
  250. <li>sed do eiusmod tempor incididunt</li>
  251. <li>ut labore et dolore magna aliqua</li>
  252. </ul>
  253. <h3>Ut enim ad minim veniam</h3>
  254. <ul>
  255. <li>quis nostrud exercitation ullamco</li>
  256. <li>laboris nisi ut aliquip ex ea commodo consequat</li>
  257. <li>Excepteur sint occaecat cupidatat non proident</li>
  258. </ul>
  259. <h3>Sed ut perspiciatis unde omnis</h3>
  260. <ul>
  261. <li>iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam</li>
  262. <li>eaque ipsa quae ab illo inventore veritatis</li>
  263. <li>et quasi architecto beatae vitae dicta sunt explicabo.&nbsp;</li>
  264. </ul>
  265. </td>
  266. <td style="background: transparent url({IMG_DIR}postit.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; width: 33%; text-align: center; vertical-align: bottom;">
  267. <h3>Ut enim ad minima</h3>
  268. Veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur.<br>
  269. <h3>
  270. <img style="width: 180px; height: 144px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_smile.png "><br></h3>
  271. </td>
  272. </tr>
  273. </tbody>
  274. </table>
  275. <p><br>
  276. <br>
  277. </p>
  278. </body>
  279. \');';
  280. $res = mysql_query($sql);
  281. */
  282. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  283. (\'TemplateTitleTeacher\', \'TemplateTitleTeacherDescription\', \'yourinstructor.gif\', \'
  284. <head>
  285. {CSS}
  286. <style type="text/css">
  287. .text
  288. {
  289. font-weight: normal;
  290. }
  291. </style>
  292. </head>
  293. <body>
  294. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
  295. <tbody>
  296. <tr>
  297. <td></td>
  298. <td style="height: 33%;"></td>
  299. <td></td>
  300. </tr>
  301. <tr>
  302. <td style="width: 25%;"></td>
  303. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right; font-weight: bold;" colspan="1" rowspan="1">
  304. <span class="text">
  305. <br>
  306. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis pellentesque.</span>
  307. </td>
  308. <td style="width: 25%; font-weight: bold;">
  309. <img style="width: 180px; height: 241px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_case.png "></td>
  310. </tr>
  311. </tbody>
  312. </table>
  313. <p><br>
  314. <br>
  315. </p>
  316. </body>
  317. \');
  318. ';
  319. $res = mysql_query($sql);
  320. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  321. (\'TemplateTitleLeftList\', \'TemplateTitleListLeftListDescription\', \'leftlist.gif\', \'
  322. <head>
  323. {CSS}
  324. </head>
  325. <body>
  326. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
  327. <tbody>
  328. <tr>
  329. <td style="width: 66%;"></td>
  330. <td style="vertical-align: bottom; width: 33%;" colspan="1" rowspan="4">&nbsp;<img style="width: 180px; height: 248px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_reads.png "><br>
  331. </td>
  332. </tr>
  333. <tr align="right">
  334. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">Lorem
  335. ipsum dolor sit amet.
  336. </td>
  337. </tr>
  338. <tr align="right">
  339. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
  340. Vivamus
  341. a quam.&nbsp;<br>
  342. </td>
  343. </tr>
  344. <tr align="right">
  345. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
  346. Proin
  347. a est stibulum ante ipsum.</td>
  348. </tr>
  349. </tbody>
  350. </table>
  351. <p><br>
  352. <br>
  353. </p>
  354. </body>
  355. \');';
  356. $res = mysql_query($sql);
  357. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  358. (\'TemplateTitleLeftRightList\', \'TemplateTitleLeftRightListDescription\', \'leftrightlist.gif\', \'
  359. <head>
  360. {CSS}
  361. </head>
  362. <body>
  363. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; height: 400px; width: 720px;" border="0" cellpadding="15" cellspacing="6">
  364. <tbody>
  365. <tr>
  366. <td></td>
  367. <td style="vertical-align: top;" colspan="1" rowspan="4">&nbsp;<img style="width: 180px; height: 294px;" alt="Trainer" src="{COURSE_DIR}images/trainer/trainer_join_hands.png "><br>
  368. </td>
  369. <td></td>
  370. </tr>
  371. <tr>
  372. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">Lorem
  373. ipsum dolor sit amet.
  374. </td>
  375. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: left;">
  376. Convallis
  377. ut.&nbsp;Cras dui magna.</td>
  378. </tr>
  379. <tr>
  380. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">
  381. Vivamus
  382. a quam.&nbsp;<br>
  383. </td>
  384. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: left;">
  385. Etiam
  386. lacinia stibulum ante.<br>
  387. </td>
  388. </tr>
  389. <tr>
  390. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">
  391. Proin
  392. a est stibulum ante ipsum.</td>
  393. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: left;">
  394. Consectetuer
  395. adipiscing elit. <br>
  396. </td>
  397. </tr>
  398. </tbody>
  399. </table>
  400. <p><br>
  401. <br>
  402. </p>
  403. </body>
  404. \');';
  405. $res = mysql_query($sql);
  406. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  407. (\'TemplateTitleRightList\', \'TemplateTitleRightListDescription\', \'rightlist.gif\', \'
  408. <head>
  409. {CSS}
  410. </head>
  411. <body style="direction: ltr;">
  412. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
  413. <tbody>
  414. <tr>
  415. <td style="vertical-align: bottom; width: 50%;" colspan="1" rowspan="4"><img style="width: 300px; height: 199px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_points_right.png"><br>
  416. </td>
  417. <td style="width: 50%;"></td>
  418. </tr>
  419. <tr>
  420. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 50%;">
  421. Convallis
  422. ut.&nbsp;Cras dui magna.</td>
  423. </tr>
  424. <tr>
  425. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 50%;">
  426. Etiam
  427. lacinia.<br>
  428. </td>
  429. </tr>
  430. <tr>
  431. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 50%;">
  432. Consectetuer
  433. adipiscing elit. <br>
  434. </td>
  435. </tr>
  436. </tbody>
  437. </table>
  438. <p><br>
  439. <br>
  440. </p>
  441. </body>
  442. \');';
  443. $res = mysql_query($sql);
  444. /*
  445. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  446. (\'TemplateTitleComparison\', \'TemplateTitleComparisonDescription\', \'compare.gif\', \'
  447. <head>
  448. {CSS}
  449. </head>
  450. <body>
  451. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
  452. <tr>
  453. <td style="height: 10%; width: 33%;"></td>
  454. <td style="vertical-align: top; width: 33%;" colspan="1" rowspan="2">&nbsp;<img style="width: 180px; height: 271px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_standing.png "><br>
  455. </td>
  456. <td style="height: 10%; width: 33%;"></td>
  457. </tr>
  458. <tr>
  459. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 33%; text-align: right;">
  460. Lorem ipsum dolor sit amet.
  461. </td>
  462. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 33%;">
  463. Convallis
  464. ut.&nbsp;Cras dui magna.</td>
  465. </tr>
  466. </body>
  467. \');';
  468. $res = mysql_query($sql);
  469. */
  470. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  471. (\'TemplateTitleDiagram\', \'TemplateTitleDiagramDescription\', \'diagram.gif\', \'
  472. <head>
  473. {CSS}
  474. </head>
  475. <body>
  476. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
  477. <tbody>
  478. <tr>
  479. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; height: 33%; width: 33%;">
  480. <br>
  481. Etiam
  482. lacinia stibulum ante.
  483. Convallis
  484. ut.&nbsp;Cras dui magna.</td>
  485. <td colspan="1" rowspan="3">
  486. <img style="width: 350px; height: 267px;" alt="Alaska chart" src="{COURSE_DIR}images/diagrams/alaska_chart.png "></td>
  487. </tr>
  488. <tr>
  489. <td colspan="1" rowspan="1">
  490. <img style="width: 300px; height: 199px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_points_right.png "></td>
  491. </tr>
  492. <tr>
  493. </tr>
  494. </tbody>
  495. </table>
  496. <p><br>
  497. <br>
  498. </p>
  499. </body>
  500. \');
  501. ';
  502. $res = mysql_query($sql);
  503. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  504. (\'TemplateTitleDesc\', \'TemplateTitleCheckListDescription\', \'description.gif\', \'
  505. <head>
  506. {CSS}
  507. </head>
  508. <body>
  509. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
  510. <tbody>
  511. <tr>
  512. <td style="width: 50%; vertical-align: top;">
  513. <img style="width: 48px; height: 49px; float: left;" alt="01" src="{COURSE_DIR}images/small/01.png " hspace="5"><br>Lorem ipsum dolor sit amet<br><br><br>
  514. <img style="width: 48px; height: 49px; float: left;" alt="02" src="{COURSE_DIR}images/small/02.png " hspace="5">
  515. <br>Ut enim ad minim veniam<br><br><br>
  516. <img style="width: 48px; height: 49px; float: left;" alt="03" src="{COURSE_DIR}images/small/03.png " hspace="5">Duis aute irure dolor in reprehenderit<br><br><br>
  517. <img style="width: 48px; height: 49px; float: left;" alt="04" src="{COURSE_DIR}images/small/04.png " hspace="5">Neque porro quisquam est</td>
  518. <td style="vertical-align: top; width: 50%; text-align: right;" colspan="1" rowspan="1">
  519. <img style="width: 300px; height: 291px;" alt="Gearbox" src="{COURSE_DIR}images/diagrams/gearbox.jpg "><br></td>
  520. </tr><tr></tr>
  521. </tbody>
  522. </table>
  523. <p><br>
  524. <br>
  525. </p>
  526. </body>
  527. \');
  528. ';
  529. $res = mysql_query($sql);
  530. /*
  531. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  532. (\'TemplateTitleObjectives\', \'TemplateTitleObjectivesDescription\', \'courseobjectives.gif\', \'
  533. <head>
  534. {CSS}
  535. </head>
  536. <body>
  537. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
  538. <tbody>
  539. <tr>
  540. <td style="vertical-align: bottom; width: 33%;" colspan="1" rowspan="2">
  541. <img style="width: 180px; height: 271px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_chair.png "><br>
  542. </td>
  543. <td style="height: 10%; width: 66%;"></td>
  544. </tr>
  545. <tr>
  546. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; text-align: left; width: 66%;">
  547. <h3>Lorem ipsum dolor sit amet</h3>
  548. <ul>
  549. <li>consectetur adipisicing elit</li>
  550. <li>sed do eiusmod tempor incididunt</li>
  551. <li>ut labore et dolore magna aliqua</li>
  552. </ul>
  553. <h3>Ut enim ad minim veniam</h3>
  554. <ul>
  555. <li>quis nostrud exercitation ullamco</li>
  556. <li>laboris nisi ut aliquip ex ea commodo consequat</li>
  557. <li>Excepteur sint occaecat cupidatat non proident</li>
  558. </ul>
  559. </td>
  560. </tr>
  561. </tbody>
  562. </table>
  563. <p><br>
  564. <br>
  565. </p>
  566. </body>
  567. \');';
  568. $res = mysql_query($sql);
  569. */
  570. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  571. (\'TemplateTitleCycle\', \'TemplateTitleCycleDescription\', \'cyclechart.gif\', \'
  572. <head>
  573. {CSS}
  574. <style>
  575. .title
  576. {
  577. color: white; font-weight: bold;
  578. }
  579. </style>
  580. </head>
  581. <body>
  582. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="8" cellspacing="6">
  583. <tbody>
  584. <tr>
  585. <td style="text-align: center; vertical-align: bottom; height: 10%;" colspan="3" rowspan="1">
  586. <img style="width: 250px; height: 76px;" alt="arrow" src="{COURSE_DIR}images/diagrams/top_arrow.png ">
  587. </td>
  588. </tr>
  589. <tr>
  590. <td style="height: 5%; width: 45%; vertical-align: top; background-color: rgb(153, 153, 153); text-align: center;">
  591. <span class="title">Lorem ipsum</span>
  592. </td>
  593. <td style="height: 5%; width: 10%;"></td>
  594. <td style="height: 5%; vertical-align: top; background-color: rgb(153, 153, 153); text-align: center;">
  595. <span class="title">Sed ut perspiciatis</span>
  596. </td>
  597. </tr>
  598. <tr>
  599. <td style="background-color: rgb(204, 204, 255); width: 45%; vertical-align: top;">
  600. <ul>
  601. <li>dolor sit amet</li>
  602. <li>consectetur adipisicing elit</li>
  603. <li>sed do eiusmod tempor&nbsp;</li>
  604. <li>adipisci velit, sed quia non numquam</li>
  605. <li>eius modi tempora incidunt ut labore et dolore magnam</li>
  606. </ul>
  607. </td>
  608. <td style="width: 10%;"></td>
  609. <td style="background-color: rgb(204, 204, 255); width: 45%; vertical-align: top;">
  610. <ul>
  611. <li>ut enim ad minim veniam</li>
  612. <li>quis nostrud exercitation</li><li>ullamco laboris nisi ut</li>
  613. <li> Quis autem vel eum iure reprehenderit qui in ea</li>
  614. <li>voluptate velit esse quam nihil molestiae consequatur,</li>
  615. </ul>
  616. </td>
  617. </tr>
  618. <tr align="center">
  619. <td style="height: 10%; vertical-align: top;" colspan="3" rowspan="1">
  620. <img style="width: 250px; height: 76px;" alt="arrow" src="{COURSE_DIR}images/diagrams/bottom_arrow.png ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
  621. </td>
  622. </tr>
  623. </tbody>
  624. </table>
  625. <p><br>
  626. <br>
  627. </p>
  628. </body>
  629. \');';
  630. $res = mysql_query($sql);
  631. /*
  632. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  633. (\'TemplateTitleLearnerWonder\', \'TemplateTitleLearnerWonderDescription\', \'learnerwonder.gif\', \'
  634. <head>
  635. {CSS}
  636. </head>
  637. <body>
  638. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
  639. <tbody>
  640. <tr>
  641. <td style="width: 33%;" colspan="1" rowspan="4">
  642. <img style="width: 120px; height: 348px;" alt="learner wonders" src="{COURSE_DIR}images/silhouette.png "><br>
  643. </td>
  644. <td style="width: 66%;"></td>
  645. </tr>
  646. <tr align="center">
  647. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
  648. Convallis
  649. ut.&nbsp;Cras dui magna.</td>
  650. </tr>
  651. <tr align="center">
  652. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
  653. Etiam
  654. lacinia stibulum ante.<br>
  655. </td>
  656. </tr>
  657. <tr align="center">
  658. <td style="background: transparent url({IMG_DIR}faded_grey.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 66%;">
  659. Consectetuer
  660. adipiscing elit. <br>
  661. </td>
  662. </tr>
  663. </tbody>
  664. </table>
  665. <p><br>
  666. <br>
  667. </p>
  668. </body>
  669. \');
  670. ';
  671. $res = mysql_query($sql);
  672. */
  673. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  674. (\'TemplateTitleTimeline\', \'TemplateTitleTimelineDescription\', \'phasetimeline.gif\', \'
  675. <head>
  676. {CSS}
  677. <style>
  678. .title
  679. {
  680. font-weight: bold; text-align: center;
  681. }
  682. </style>
  683. </head>
  684. <body>
  685. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="8" cellspacing="5">
  686. <tbody>
  687. <tr class="title">
  688. <td style="vertical-align: top; height: 3%; background-color: rgb(224, 224, 224);">Lorem ipsum</td>
  689. <td style="height: 3%;"></td>
  690. <td style="vertical-align: top; height: 3%; background-color: rgb(237, 237, 237);">Perspiciatis</td>
  691. <td style="height: 3%;"></td>
  692. <td style="vertical-align: top; height: 3%; background-color: rgb(245, 245, 245);">Nemo enim</td>
  693. </tr>
  694. <tr>
  695. <td style="vertical-align: top; width: 30%; background-color: rgb(224, 224, 224);">
  696. <ul>
  697. <li>dolor sit amet</li>
  698. <li>consectetur</li>
  699. <li>adipisicing elit</li>
  700. </ul>
  701. <br>
  702. </td>
  703. <td>
  704. <img style="width: 32px; height: 32px;" alt="arrow" src="{COURSE_DIR}images/small/arrow.png ">
  705. </td>
  706. <td style="vertical-align: top; width: 30%; background-color: rgb(237, 237, 237);">
  707. <ul>
  708. <li>ut labore</li>
  709. <li>et dolore</li>
  710. <li>magni dolores</li>
  711. </ul>
  712. </td>
  713. <td>
  714. <img style="width: 32px; height: 32px;" alt="arrow" src="{COURSE_DIR}images/small/arrow.png ">
  715. </td>
  716. <td style="vertical-align: top; background-color: rgb(245, 245, 245); width: 30%;">
  717. <ul>
  718. <li>neque porro</li>
  719. <li>quisquam est</li>
  720. <li>qui dolorem&nbsp;&nbsp;</li>
  721. </ul>
  722. <br><br>
  723. </td>
  724. </tr>
  725. </tbody>
  726. </table>
  727. <p><br>
  728. <br>
  729. </p>
  730. </body>
  731. \');
  732. ';
  733. $res = mysql_query($sql);
  734. /*
  735. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  736. (\'TemplateTitleStopAndThink\', \'TemplateTitleStopAndThinkDescription\', \'stopthink.gif\', \'
  737. <head>
  738. {CSS}
  739. </head>
  740. <body>
  741. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
  742. <tbody>
  743. <tr>
  744. <td style="vertical-align: bottom; width: 33%;" colspan="1" rowspan="2">
  745. <img style="width: 180px; height: 169px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_staring.png ">
  746. <br>
  747. </td>
  748. <td style="height: 10%; width: 66%;"></td>
  749. </tr>
  750. <tr>
  751. <td style="background: transparent url({IMG_DIR}postit.png ) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; width: 66%; vertical-align: middle; text-align: center;">
  752. <h3>Attentio sectetur adipisicing elit</h3>
  753. <ul>
  754. <li>sed do eiusmod tempor incididunt</li>
  755. <li>ut labore et dolore magna aliqua</li>
  756. <li>quis nostrud exercitation ullamco</li>
  757. </ul><br></td>
  758. </tr>
  759. </tbody>
  760. </table>
  761. <p><br>
  762. <br>
  763. </p>
  764. </body>
  765. \');';
  766. $res = mysql_query($sql);
  767. */
  768. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  769. (\'TemplateTitleTable\', \'TemplateTitleCheckListDescription\', \'table.gif\', \'
  770. <head>
  771. {CSS}
  772. <style type="text/css">
  773. .title
  774. {
  775. font-weight: bold; text-align: center;
  776. }
  777. .items
  778. {
  779. text-align: right;
  780. }
  781. </style>
  782. </head>
  783. <body>
  784. <br />
  785. <h2>A table</h2>
  786. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px;" border="1" cellpadding="5" cellspacing="0">
  787. <tbody>
  788. <tr class="title">
  789. <td>City</td>
  790. <td>2005</td>
  791. <td>2006</td>
  792. <td>2007</td>
  793. <td>2008</td>
  794. </tr>
  795. <tr class="items">
  796. <td>Lima</td>
  797. <td>10,40</td>
  798. <td>8,95</td>
  799. <td>9,19</td>
  800. <td>9,76</td>
  801. </tr>
  802. <tr class="items">
  803. <td>New York</td>
  804. <td>18,39</td>
  805. <td>17,52</td>
  806. <td>16,57</td>
  807. <td>16,60</td>
  808. </tr>
  809. <tr class="items">
  810. <td>Barcelona</td>
  811. <td>0,10</td>
  812. <td>0,10</td>
  813. <td>0,05</td>
  814. <td>0,05</td>
  815. </tr>
  816. <tr class="items">
  817. <td>Paris</td>
  818. <td>3,38</td>
  819. <td >3,63</td>
  820. <td>3,63</td>
  821. <td>3,54</td>
  822. </tr>
  823. </tbody>
  824. </table>
  825. <br>
  826. </body>
  827. \');';
  828. $res = mysql_query($sql);
  829. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  830. (\'TemplateTitleAudio\', \'TemplateTitleAudioDescription\', \'audiocomment.gif\', \'
  831. <head>
  832. {CSS}
  833. </head>
  834. <body>
  835. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
  836. <tbody>
  837. <tr>
  838. <td>
  839. <div align="center">
  840. <span style="text-align: center;">
  841. <embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="300" height="20" bgcolor="#FFFFFF" src="{REL_PATH}main/inc/lib/mediaplayer/player.swf" allowfullscreen="false" allowscriptaccess="always" flashvars="file={COURSE_DIR}audio/ListeningComprehension.mp3&amp;autostart=true"></embed>
  842. </span></div>
  843. <br>
  844. </td>
  845. <td colspan="1" rowspan="3"><br>
  846. <img style="width: 300px; height: 341px; float: right;" alt="image" src="{COURSE_DIR}images/diagrams/head_olfactory_nerve.png "><br></td>
  847. </tr>
  848. <tr>
  849. <td colspan="1" rowspan="1">
  850. <img style="width: 180px; height: 271px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_glasses.png"><br></td>
  851. </tr>
  852. <tr>
  853. </tr>
  854. </tbody>
  855. </table>
  856. <p><br>
  857. <br>
  858. </p>
  859. </body>
  860. \');';
  861. $res = mysql_query($sql);
  862. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  863. (\'TemplateTitleVideo\', \'TemplateTitleVideoDescription\', \'video.gif\', \'
  864. <head>
  865. {CSS}
  866. </head>
  867. <body>
  868. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 720px; height: 400px;" border="0" cellpadding="15" cellspacing="6">
  869. <tbody>
  870. <tr>
  871. <td style="width: 50%; vertical-align: top;">
  872. <div style="text-align: center;" id="player810625-parent">
  873. <div style="border-style: none; overflow: hidden; width: 320px; height: 240px; background-color: rgb(220, 220, 220);">
  874. <div id="player810625">
  875. <div id="player810625-config" style="overflow: hidden; display: none; visibility: hidden; width: 0px; height: 0px;">url={REL_PATH}main/default_course_document/video/flv/example.flv width=320 height=240 loop=false play=false downloadable=false fullscreen=true displayNavigation=true displayDigits=true align=left dispPlaylist=none playlistThumbs=false</div>
  876. </div>
  877. <embed
  878. type="application/x-shockwave-flash"
  879. src="{REL_PATH}main/inc/lib/mediaplayer/player.swf"
  880. width="320"
  881. height="240"
  882. id="single"
  883. name="single"
  884. quality="high"
  885. allowfullscreen="true"
  886. flashvars="width=320&height=240&autostart=false&file={REL_PATH}main/default_course_document/video/flv/example.flv&repeat=false&image=&showdownload=false&link={REL_PATH}main/default_course_document/video/flv/example.flv&showdigits=true&shownavigation=true&logo="
  887. />
  888. </div>
  889. </div>
  890. </td>
  891. <td style="background: transparent url({IMG_DIR}faded_grey.png) repeat scroll center top; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; vertical-align: top; width: 50%;">
  892. <h3><br>
  893. </h3>
  894. <h3>Lorem ipsum dolor sit amet</h3>
  895. <ul>
  896. <li>consectetur adipisicing elit</li>
  897. <li>sed do eiusmod tempor incididunt</li>
  898. <li>ut labore et dolore magna aliqua</li>
  899. </ul>
  900. <h3>Ut enim ad minim veniam</h3>
  901. <ul>
  902. <li>quis nostrud exercitation ullamco</li>
  903. <li>laboris nisi ut aliquip ex ea commodo consequat</li>
  904. <li>Excepteur sint occaecat cupidatat non proident</li>
  905. </ul>
  906. </td>
  907. </tr>
  908. </tbody>
  909. </table>
  910. <p><br>
  911. <br>
  912. </p>
  913. <style type="text/css">body{}</style><!-- to fix a strange bug appearing with firefox when editing this template -->
  914. </body>
  915. \'); ';
  916. $res = mysql_query($sql);
  917. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  918. (\'TemplateTitleFlash\', \'TemplateTitleFlashDescription\', \'flash.gif\', \'
  919. <head>
  920. {CSS}
  921. </head>
  922. <body>
  923. <center>
  924. <table style="background: transparent url({IMG_DIR}faded_blue_horizontal.png ) repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; text-align: left; width: 100%; height: 400px;" border="0" cellpadding="15" cellspacing="6">
  925. <tbody>
  926. <tr>
  927. <td align="center">
  928. <embed width="700" height="300" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="{COURSE_DIR}flash/SpinEchoSequence.swf" play="true" loop="true" menu="true"></embed></span><br />
  929. </td>
  930. </tr>
  931. </tbody>
  932. </table>
  933. <p><br>
  934. <br>
  935. </p>
  936. </center>
  937. </body>
  938. \'); ';
  939. $res = mysql_query($sql);
  940. // Check if course_module exists, as it was not installed in Dokeos 1.8.5 because of a broken query, and $sql = 'INSERT it if necessary
  941. $query = "SELECT * FROM $dbNameForm.course_module";
  942. $result = mysql_query($query);
  943. if ($result === false) {
  944. //the course_module table doesn't exist, create it
  945. $sql = "CREATE TABLE $dbNameForm.course_module (
  946. id int unsigned NOT NULL auto_increment,
  947. name varchar(100) NOT NULL,
  948. link varchar(255) NOT NULL,
  949. image varchar(100) default NULL,
  950. `row` int unsigned NOT NULL default '0',
  951. `column` int unsigned NOT NULL default '0',
  952. position varchar(20) NOT NULL default 'basic',
  953. PRIMARY KEY (id)
  954. )
  955. ";
  956. $result = mysql_query($sql);
  957. if ($result !== false) {
  958. $sql = "INSERT INTO $dbNameForm.course_module (name, link, image, `row`,`column`, position) VALUES
  959. ('calendar_event','calendar/agenda.php','agenda.gif',1,1,'basic'),
  960. ('link','link/link.php','links.gif',4,1,'basic'),
  961. ('document','document/document.php','documents.gif',3,1,'basic'),
  962. ('student_publication','work/work.php','works.gif',3,2,'basic'),
  963. ('announcement','announcements/announcements.php','valves.gif',2,1,'basic'),
  964. ('user','user/user.php','members.gif',2,3,'basic'),
  965. ('forum','forum/index.php','forum.gif',1,2,'basic'),
  966. ('quiz','exercice/exercice.php','quiz.gif',2,2,'basic'),
  967. ('group','group/group.php','group.gif',3,3,'basic'),
  968. ('course_description','course_description/','info.gif',1,3,'basic'),
  969. ('chat','chat/chat.php','chat.gif',0,0,'external'),
  970. ('dropbox','dropbox/index.php','dropbox.gif',4,2,'basic'),
  971. ('tracking','tracking/courseLog.php','statistics.gif',1,3,'courseadmin'),
  972. ('homepage_link','link/link.php?action=addlink','npage.gif',1,1,'courseadmin'),
  973. ('course_setting','course_info/infocours.php','reference.gif',1,1,'courseadmin'),
  974. ('External','','external.gif',0,0,'external'),
  975. ('AddedLearnpath','','scormbuilder.gif',0,0,'external'),
  976. ('conference','conference/index.php?type=conference','conf.gif',0,0,'external'),
  977. ('conference','conference/index.php?type=classroom','conf.gif',0,0,'external'),
  978. ('learnpath','newscorm/lp_controller.php','scorm.gif',5,1,'basic'),
  979. ('blog','blog/blog.php','blog.gif',1,2,'basic'),
  980. ('blog_management','blog/blog_admin.php','blog_admin.gif',1,2,'courseadmin'),
  981. ('course_maintenance','course_info/maintenance.php','backup.gif',2,3,'courseadmin'),
  982. ('survey','survey/survey_list.php','survey.gif',2,1,'basic'),
  983. ('wiki','wiki/index.php','wiki.gif',2,3,'basic'),
  984. ('gradebook','gradebook/index.php','gradebook.gif',2,2,'basic'),
  985. ('glossary','glossary/index.php','glossary.gif',2,1,'basic'),
  986. ('notebook','notebook/index.php','notebook.gif',2,1,'basic')";
  987. $res = mysql_query($sql);
  988. }
  989. }
  990. //get the stats queries list (s_q_list)
  991. $s_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql','stats');
  992. if(count($s_q_list)>0)
  993. {
  994. //now use the $s_q_list
  995. /**
  996. * We connect to the right DB first to make sure we can use the queries
  997. * without a database name
  998. */
  999. if(strlen($dbStatsForm)>40){
  1000. error_log('Database name '.$dbStatsForm.' is too long, skipping',0);
  1001. }elseif(!in_array($dbStatsForm,$dblist)){
  1002. error_log('Database '.$dbStatsForm.' was not found, skipping',0);
  1003. }else{
  1004. mysql_select_db($dbStatsForm);
  1005. foreach($s_q_list as $query){
  1006. if($only_test){
  1007. error_log("mysql_query($dbStatsForm,$query)",0);
  1008. }else{
  1009. $res = mysql_query($query);
  1010. if($log)
  1011. {
  1012. error_log("In $dbStatsForm, executed: $query",0);
  1013. }
  1014. }
  1015. }
  1016. }
  1017. }
  1018. //get the user queries list (u_q_list)
  1019. $u_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql','user');
  1020. if(count($u_q_list)>0)
  1021. {
  1022. //now use the $u_q_list
  1023. /**
  1024. * We connect to the right DB first to make sure we can use the queries
  1025. * without a database name
  1026. */
  1027. if(strlen($dbUserForm)>40){
  1028. error_log('Database name '.$dbUserForm.' is too long, skipping',0);
  1029. }elseif(!in_array($dbUserForm,$dblist)){
  1030. error_log('Database '.$dbUserForm.' was not found, skipping',0);
  1031. }else{
  1032. mysql_select_db($dbUserForm);
  1033. foreach($u_q_list as $query){
  1034. if($only_test){
  1035. error_log("mysql_query($dbUserForm,$query)",0);
  1036. error_log("In $dbUserForm, executed: $query",0);
  1037. }else{
  1038. $res = mysql_query($query);
  1039. }
  1040. }
  1041. }
  1042. }
  1043. //the SCORM database doesn't need a change in the pre-migrate part - ignore
  1044. }
  1045. /*
  1046. -----------------------------------------------------------
  1047. Update the Dokeos course databases
  1048. this part can be accessed in two ways:
  1049. - from the normal upgrade process
  1050. - from the script update_courses.php,
  1051. which is used to upgrade more than MAX_COURSE_TRANSFER courses
  1052. Every time this script is accessed, only
  1053. MAX_COURSE_TRANSFER courses are upgraded.
  1054. -----------------------------------------------------------
  1055. */
  1056. $prefix = '';
  1057. if ($singleDbForm)
  1058. {
  1059. $prefix = get_config_param ('table_prefix');
  1060. }
  1061. //get the courses databases queries list (c_q_list)
  1062. $c_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql','course');
  1063. if(count($c_q_list)>0)
  1064. {
  1065. //get the courses list
  1066. if(strlen($dbNameForm)>40)
  1067. {
  1068. error_log('Database name '.$dbNameForm.' is too long, skipping',0);
  1069. }
  1070. elseif(!in_array($dbNameForm,$dblist))
  1071. {
  1072. error_log('Database '.$dbNameForm.' was not found, skipping',0);
  1073. }
  1074. else
  1075. {
  1076. mysql_select_db($dbNameForm);
  1077. $res = mysql_query("SELECT code,db_name,directory,course_language FROM course WHERE target_course_code IS NULL ORDER BY code");
  1078. if($res===false){die('Error while querying the courses list in update_db.inc.php');}
  1079. if(mysql_num_rows($res)>0)
  1080. {
  1081. $i=0;
  1082. $list = array();
  1083. //while( ($i < MAX_COURSE_TRANSFER) && ($row = mysql_fetch_array($res)))
  1084. while($row = mysql_fetch_array($res))
  1085. {
  1086. $list[] = $row;
  1087. $i++;
  1088. }
  1089. foreach($list as $row_course)
  1090. {
  1091. //now use the $c_q_list
  1092. /**
  1093. * We connect to the right DB first to make sure we can use the queries
  1094. * without a database name
  1095. */
  1096. if (!$singleDbForm) //otherwise just use the main one
  1097. {
  1098. mysql_select_db($row_course['db_name']);
  1099. }
  1100. foreach($c_q_list as $query)
  1101. {
  1102. if ($singleDbForm) //otherwise just use the main one
  1103. {
  1104. $query = preg_replace('/^(UPDATE|ALTER TABLE|CREATE TABLE|DROP TABLE|INSERT INTO|DELETE FROM)\s+(\w*)(.*)$/',"$1 $prefix{$row_course['db_name']}_$2$3",$query);
  1105. }
  1106. if($only_test)
  1107. {
  1108. error_log("mysql_query(".$row_course['db_name'].",$query)",0);
  1109. }
  1110. else
  1111. {
  1112. $res = mysql_query($query);
  1113. if($log)
  1114. {
  1115. error_log("In ".$row_course['db_name'].", executed: $query",0);
  1116. }
  1117. }
  1118. }
  1119. $t_d = $row_course['db_name'].".document";
  1120. $t_ip = $row_course['db_name'].".item_property";
  1121. if($singleDbForm)
  1122. {
  1123. $t_d = "$prefix{$row_course['db_name']}_document";
  1124. $t_ip = "$prefix{$row_course['db_name']}_item_property";
  1125. }
  1126. // shared documents folder
  1127. $query = "INSERT INTO $t_d (path,title,filetype,size) VALUES ('/shared_folder','".get_lang('SharedDocumentsDirectory')."','folder','0')";
  1128. $myres = mysql_query($query);
  1129. if ($myres !== false) {
  1130. $doc_id = mysql_insert_id();
  1131. $query = "INSERT INTO $t_ip (tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility) VALUES ('document',1,NOW(),NOW(),$doc_id,'FolderAdded',1,0,NULL,1)";
  1132. $myres = mysql_query($query);
  1133. }
  1134. }
  1135. }
  1136. }
  1137. }
  1138. }
  1139. else
  1140. {
  1141. echo 'You are not allowed here !';
  1142. }
  1143. ?>