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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232
  1. <?php // $Id: update-db-1.8.5-1.8.6.inc.php 19471 2009-03-31 23:28:53Z cvargas1 $
  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. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  237. (\'TemplateTitleCheckList\', \'TemplateTitleCheckListDescription\', \'checklist.gif\', \'
  238. <head>
  239. {CSS}
  240. </head>
  241. <body>
  242. <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">
  243. <tbody>
  244. <tr>
  245. <td style="vertical-align: top; width: 66%;">
  246. <h3>Lorem ipsum dolor sit amet</h3>
  247. <ul>
  248. <li>consectetur adipisicing elit</li>
  249. <li>sed do eiusmod tempor incididunt</li>
  250. <li>ut labore et dolore magna aliqua</li>
  251. </ul>
  252. <h3>Ut enim ad minim veniam</h3>
  253. <ul>
  254. <li>quis nostrud exercitation ullamco</li>
  255. <li>laboris nisi ut aliquip ex ea commodo consequat</li>
  256. <li>Excepteur sint occaecat cupidatat non proident</li>
  257. </ul>
  258. <h3>Sed ut perspiciatis unde omnis</h3>
  259. <ul>
  260. <li>iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam</li>
  261. <li>eaque ipsa quae ab illo inventore veritatis</li>
  262. <li>et quasi architecto beatae vitae dicta sunt explicabo.&nbsp;</li>
  263. </ul>
  264. </td>
  265. <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;">
  266. <h3>Ut enim ad minima</h3>
  267. Veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur.<br>
  268. <h3>
  269. <img style="width: 180px; height: 144px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_smile.png "><br></h3>
  270. </td>
  271. </tr>
  272. </tbody>
  273. </table>
  274. <p><br>
  275. <br>
  276. </p>
  277. </body>
  278. \');';
  279. $res = mysql_query($sql);
  280. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  281. (\'TemplateTitleTeacher\', \'TemplateTitleTeacherDescription\', \'yourinstructor.gif\', \'
  282. <head>
  283. {CSS}
  284. <style type="text/css">
  285. .text
  286. {
  287. font-weight: normal;
  288. }
  289. </style>
  290. </head>
  291. <body>
  292. <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">
  293. <tbody>
  294. <tr>
  295. <td></td>
  296. <td style="height: 33%;"></td>
  297. <td></td>
  298. </tr>
  299. <tr>
  300. <td style="width: 25%;"></td>
  301. <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">
  302. <span class="text">
  303. <br>
  304. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis pellentesque.</span>
  305. </td>
  306. <td style="width: 25%; font-weight: bold;">
  307. <img style="width: 180px; height: 241px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_case.png "></td>
  308. </tr>
  309. </tbody>
  310. </table>
  311. <p><br>
  312. <br>
  313. </p>
  314. </body>
  315. \');
  316. ';
  317. $res = mysql_query($sql);
  318. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  319. (\'TemplateTitleLeftList\', \'TemplateTitleListLeftListDescription\', \'leftlist.gif\', \'
  320. <head>
  321. {CSS}
  322. </head>
  323. <body>
  324. <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">
  325. <tbody>
  326. <tr>
  327. <td style="width: 66%;"></td>
  328. <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>
  329. </td>
  330. </tr>
  331. <tr align="right">
  332. <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
  333. ipsum dolor sit amet.
  334. </td>
  335. </tr>
  336. <tr align="right">
  337. <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%;">
  338. Vivamus
  339. a quam.&nbsp;<br>
  340. </td>
  341. </tr>
  342. <tr align="right">
  343. <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%;">
  344. Proin
  345. a est stibulum ante ipsum.</td>
  346. </tr>
  347. </tbody>
  348. </table>
  349. <p><br>
  350. <br>
  351. </p>
  352. </body>
  353. \');';
  354. $res = mysql_query($sql);
  355. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  356. (\'TemplateTitleLeftRightList\', \'TemplateTitleLeftRightListDescription\', \'leftrightlist.gif\', \'
  357. <head>
  358. {CSS}
  359. </head>
  360. <body>
  361. <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">
  362. <tbody>
  363. <tr>
  364. <td></td>
  365. <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>
  366. </td>
  367. <td></td>
  368. </tr>
  369. <tr>
  370. <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
  371. ipsum dolor sit amet.
  372. </td>
  373. <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;">
  374. Convallis
  375. ut.&nbsp;Cras dui magna.</td>
  376. </tr>
  377. <tr>
  378. <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;">
  379. Vivamus
  380. a quam.&nbsp;<br>
  381. </td>
  382. <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;">
  383. Etiam
  384. lacinia stibulum ante.<br>
  385. </td>
  386. </tr>
  387. <tr>
  388. <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;">
  389. Proin
  390. a est stibulum ante ipsum.</td>
  391. <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;">
  392. Consectetuer
  393. adipiscing elit. <br>
  394. </td>
  395. </tr>
  396. </tbody>
  397. </table>
  398. <p><br>
  399. <br>
  400. </p>
  401. </body>
  402. \');';
  403. $res = mysql_query($sql);
  404. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  405. (\'TemplateTitleRightList\', \'TemplateTitleRightListDescription\', \'rightlist.gif\', \'
  406. <head>
  407. {CSS}
  408. </head>
  409. <body style="direction: ltr;">
  410. <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">
  411. <tbody>
  412. <tr>
  413. <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>
  414. </td>
  415. <td style="width: 50%;"></td>
  416. </tr>
  417. <tr>
  418. <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%;">
  419. Convallis
  420. ut.&nbsp;Cras dui magna.</td>
  421. </tr>
  422. <tr>
  423. <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%;">
  424. Etiam
  425. lacinia.<br>
  426. </td>
  427. </tr>
  428. <tr>
  429. <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%;">
  430. Consectetuer
  431. adipiscing elit. <br>
  432. </td>
  433. </tr>
  434. </tbody>
  435. </table>
  436. <p><br>
  437. <br>
  438. </p>
  439. </body>
  440. \');';
  441. $res = mysql_query($sql);
  442. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  443. (\'TemplateTitleComparison\', \'TemplateTitleComparisonDescription\', \'compare.gif\', \'
  444. <head>
  445. {CSS}
  446. </head>
  447. <body>
  448. <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">
  449. <tr>
  450. <td style="height: 10%; width: 33%;"></td>
  451. <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>
  452. </td>
  453. <td style="height: 10%; width: 33%;"></td>
  454. </tr>
  455. <tr>
  456. <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;">
  457. Lorem ipsum dolor sit amet.
  458. </td>
  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; text-align: left; width: 33%;">
  460. Convallis
  461. ut.&nbsp;Cras dui magna.</td>
  462. </tr>
  463. </body>
  464. \');';
  465. $res = mysql_query($sql);
  466. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  467. (\'TemplateTitleDiagram\', \'TemplateTitleDiagramDescription\', \'diagram.gif\', \'
  468. <head>
  469. {CSS}
  470. </head>
  471. <body>
  472. <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">
  473. <tbody>
  474. <tr>
  475. <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%;">
  476. <br>
  477. Etiam
  478. lacinia stibulum ante.
  479. Convallis
  480. ut.&nbsp;Cras dui magna.</td>
  481. <td colspan="1" rowspan="3">
  482. <img style="width: 350px; height: 267px;" alt="Alaska chart" src="{COURSE_DIR}images/diagrams/alaska_chart.png "></td>
  483. </tr>
  484. <tr>
  485. <td colspan="1" rowspan="1">
  486. <img style="width: 300px; height: 199px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_points_right.png "></td>
  487. </tr>
  488. <tr>
  489. </tr>
  490. </tbody>
  491. </table>
  492. <p><br>
  493. <br>
  494. </p>
  495. </body>
  496. \');
  497. ';
  498. $res = mysql_query($sql);
  499. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  500. (\'TemplateTitleDesc\', \'TemplateTitleCheckListDescription\', \'description.gif\', \'
  501. <head>
  502. {CSS}
  503. </head>
  504. <body>
  505. <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">
  506. <tbody>
  507. <tr>
  508. <td style="width: 50%; vertical-align: top;">
  509. <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>
  510. <img style="width: 48px; height: 49px; float: left;" alt="02" src="{COURSE_DIR}images/small/02.png " hspace="5">
  511. <br>Ut enim ad minim veniam<br><br><br>
  512. <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>
  513. <img style="width: 48px; height: 49px; float: left;" alt="04" src="{COURSE_DIR}images/small/04.png " hspace="5">Neque porro quisquam est</td>
  514. <td style="vertical-align: top; width: 50%; text-align: right;" colspan="1" rowspan="1">
  515. <img style="width: 300px; height: 291px;" alt="Gearbox" src="{COURSE_DIR}images/diagrams/gearbox.jpg "><br></td>
  516. </tr><tr></tr>
  517. </tbody>
  518. </table>
  519. <p><br>
  520. <br>
  521. </p>
  522. </body>
  523. \');
  524. ';
  525. $res = mysql_query($sql);
  526. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  527. (\'TemplateTitleObjectives\', \'TemplateTitleObjectivesDescription\', \'courseobjectives.gif\', \'
  528. <head>
  529. {CSS}
  530. </head>
  531. <body>
  532. <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">
  533. <tbody>
  534. <tr>
  535. <td style="vertical-align: bottom; width: 33%;" colspan="1" rowspan="2">
  536. <img style="width: 180px; height: 271px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_chair.png "><br>
  537. </td>
  538. <td style="height: 10%; width: 66%;"></td>
  539. </tr>
  540. <tr>
  541. <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%;">
  542. <h3>Lorem ipsum dolor sit amet</h3>
  543. <ul>
  544. <li>consectetur adipisicing elit</li>
  545. <li>sed do eiusmod tempor incididunt</li>
  546. <li>ut labore et dolore magna aliqua</li>
  547. </ul>
  548. <h3>Ut enim ad minim veniam</h3>
  549. <ul>
  550. <li>quis nostrud exercitation ullamco</li>
  551. <li>laboris nisi ut aliquip ex ea commodo consequat</li>
  552. <li>Excepteur sint occaecat cupidatat non proident</li>
  553. </ul>
  554. </td>
  555. </tr>
  556. </tbody>
  557. </table>
  558. <p><br>
  559. <br>
  560. </p>
  561. </body>
  562. \');';
  563. $res = mysql_query($sql);
  564. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  565. (\'TemplateTitleCycle\', \'TemplateTitleCycleDescription\', \'cyclechart.gif\', \'
  566. <head>
  567. {CSS}
  568. <style>
  569. .title
  570. {
  571. color: white; font-weight: bold;
  572. }
  573. </style>
  574. </head>
  575. <body>
  576. <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">
  577. <tbody>
  578. <tr>
  579. <td style="text-align: center; vertical-align: bottom; height: 10%;" colspan="3" rowspan="1">
  580. <img style="width: 250px; height: 76px;" alt="arrow" src="{COURSE_DIR}images/diagrams/top_arrow.png ">
  581. </td>
  582. </tr>
  583. <tr>
  584. <td style="height: 5%; width: 45%; vertical-align: top; background-color: rgb(153, 153, 153); text-align: center;">
  585. <span class="title">Lorem ipsum</span>
  586. </td>
  587. <td style="height: 5%; width: 10%;"></td>
  588. <td style="height: 5%; vertical-align: top; background-color: rgb(153, 153, 153); text-align: center;">
  589. <span class="title">Sed ut perspiciatis</span>
  590. </td>
  591. </tr>
  592. <tr>
  593. <td style="background-color: rgb(204, 204, 255); width: 45%; vertical-align: top;">
  594. <ul>
  595. <li>dolor sit amet</li>
  596. <li>consectetur adipisicing elit</li>
  597. <li>sed do eiusmod tempor&nbsp;</li>
  598. <li>adipisci velit, sed quia non numquam</li>
  599. <li>eius modi tempora incidunt ut labore et dolore magnam</li>
  600. </ul>
  601. </td>
  602. <td style="width: 10%;"></td>
  603. <td style="background-color: rgb(204, 204, 255); width: 45%; vertical-align: top;">
  604. <ul>
  605. <li>ut enim ad minim veniam</li>
  606. <li>quis nostrud exercitation</li><li>ullamco laboris nisi ut</li>
  607. <li> Quis autem vel eum iure reprehenderit qui in ea</li>
  608. <li>voluptate velit esse quam nihil molestiae consequatur,</li>
  609. </ul>
  610. </td>
  611. </tr>
  612. <tr align="center">
  613. <td style="height: 10%; vertical-align: top;" colspan="3" rowspan="1">
  614. <img style="width: 250px; height: 76px;" alt="arrow" src="{COURSE_DIR}images/diagrams/bottom_arrow.png ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
  615. </td>
  616. </tr>
  617. </tbody>
  618. </table>
  619. <p><br>
  620. <br>
  621. </p>
  622. </body>
  623. \');';
  624. $res = mysql_query($sql);
  625. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  626. (\'TemplateTitleLearnerWonder\', \'TemplateTitleLearnerWonderDescription\', \'learnerwonder.gif\', \'
  627. <head>
  628. {CSS}
  629. </head>
  630. <body>
  631. <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">
  632. <tbody>
  633. <tr>
  634. <td style="width: 33%;" colspan="1" rowspan="4">
  635. <img style="width: 120px; height: 348px;" alt="learner wonders" src="{COURSE_DIR}images/silhouette.png "><br>
  636. </td>
  637. <td style="width: 66%;"></td>
  638. </tr>
  639. <tr align="center">
  640. <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%;">
  641. Convallis
  642. ut.&nbsp;Cras dui magna.</td>
  643. </tr>
  644. <tr align="center">
  645. <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%;">
  646. Etiam
  647. lacinia stibulum ante.<br>
  648. </td>
  649. </tr>
  650. <tr align="center">
  651. <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%;">
  652. Consectetuer
  653. adipiscing elit. <br>
  654. </td>
  655. </tr>
  656. </tbody>
  657. </table>
  658. <p><br>
  659. <br>
  660. </p>
  661. </body>
  662. \');
  663. ';
  664. $res = mysql_query($sql);
  665. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  666. (\'TemplateTitleTimeline\', \'TemplateTitleTimelineDescription\', \'phasetimeline.gif\', \'
  667. <head>
  668. {CSS}
  669. <style>
  670. .title
  671. {
  672. font-weight: bold; text-align: center;
  673. }
  674. </style>
  675. </head>
  676. <body>
  677. <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">
  678. <tbody>
  679. <tr class="title">
  680. <td style="vertical-align: top; height: 3%; background-color: rgb(224, 224, 224);">Lorem ipsum</td>
  681. <td style="height: 3%;"></td>
  682. <td style="vertical-align: top; height: 3%; background-color: rgb(237, 237, 237);">Perspiciatis</td>
  683. <td style="height: 3%;"></td>
  684. <td style="vertical-align: top; height: 3%; background-color: rgb(245, 245, 245);">Nemo enim</td>
  685. </tr>
  686. <tr>
  687. <td style="vertical-align: top; width: 30%; background-color: rgb(224, 224, 224);">
  688. <ul>
  689. <li>dolor sit amet</li>
  690. <li>consectetur</li>
  691. <li>adipisicing elit</li>
  692. </ul>
  693. <br>
  694. </td>
  695. <td>
  696. <img style="width: 32px; height: 32px;" alt="arrow" src="{COURSE_DIR}images/small/arrow.png ">
  697. </td>
  698. <td style="vertical-align: top; width: 30%; background-color: rgb(237, 237, 237);">
  699. <ul>
  700. <li>ut labore</li>
  701. <li>et dolore</li>
  702. <li>magni dolores</li>
  703. </ul>
  704. </td>
  705. <td>
  706. <img style="width: 32px; height: 32px;" alt="arrow" src="{COURSE_DIR}images/small/arrow.png ">
  707. </td>
  708. <td style="vertical-align: top; background-color: rgb(245, 245, 245); width: 30%;">
  709. <ul>
  710. <li>neque porro</li>
  711. <li>quisquam est</li>
  712. <li>qui dolorem&nbsp;&nbsp;</li>
  713. </ul>
  714. <br><br>
  715. </td>
  716. </tr>
  717. </tbody>
  718. </table>
  719. <p><br>
  720. <br>
  721. </p>
  722. </body>
  723. \');
  724. ';
  725. $res = mysql_query($sql);
  726. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  727. (\'TemplateTitleStopAndThink\', \'TemplateTitleStopAndThinkDescription\', \'stopthink.gif\', \'
  728. <head>
  729. {CSS}
  730. </head>
  731. <body>
  732. <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">
  733. <tbody>
  734. <tr>
  735. <td style="vertical-align: bottom; width: 33%;" colspan="1" rowspan="2">
  736. <img style="width: 180px; height: 169px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_staring.png ">
  737. <br>
  738. </td>
  739. <td style="height: 10%; width: 66%;"></td>
  740. </tr>
  741. <tr>
  742. <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;">
  743. <h3>Attentio sectetur adipisicing elit</h3>
  744. <ul>
  745. <li>sed do eiusmod tempor incididunt</li>
  746. <li>ut labore et dolore magna aliqua</li>
  747. <li>quis nostrud exercitation ullamco</li>
  748. </ul><br></td>
  749. </tr>
  750. </tbody>
  751. </table>
  752. <p><br>
  753. <br>
  754. </p>
  755. </body>
  756. \');';
  757. $res = mysql_query($sql);
  758. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  759. (\'TemplateTitleTable\', \'TemplateTitleCheckListDescription\', \'table.gif\', \'
  760. <head>
  761. {CSS}
  762. <style type="text/css">
  763. .title
  764. {
  765. font-weight: bold; text-align: center;
  766. }
  767. .items
  768. {
  769. text-align: right;
  770. }
  771. </style>
  772. </head>
  773. <body>
  774. <br />
  775. <h2>A table</h2>
  776. <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">
  777. <tbody>
  778. <tr class="title">
  779. <td>City</td>
  780. <td>2005</td>
  781. <td>2006</td>
  782. <td>2007</td>
  783. <td>2008</td>
  784. </tr>
  785. <tr class="items">
  786. <td>Lima</td>
  787. <td>10,40</td>
  788. <td>8,95</td>
  789. <td>9,19</td>
  790. <td>9,76</td>
  791. </tr>
  792. <tr class="items">
  793. <td>New York</td>
  794. <td>18,39</td>
  795. <td>17,52</td>
  796. <td>16,57</td>
  797. <td>16,60</td>
  798. </tr>
  799. <tr class="items">
  800. <td>Barcelona</td>
  801. <td>0,10</td>
  802. <td>0,10</td>
  803. <td>0,05</td>
  804. <td>0,05</td>
  805. </tr>
  806. <tr class="items">
  807. <td>Paris</td>
  808. <td>3,38</td>
  809. <td >3,63</td>
  810. <td>3,63</td>
  811. <td>3,54</td>
  812. </tr>
  813. </tbody>
  814. </table>
  815. <br>
  816. </body>
  817. \');';
  818. $res = mysql_query($sql);
  819. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  820. (\'TemplateTitleAudio\', \'TemplateTitleAudioDescription\', \'audiocomment.gif\', \'
  821. <head>
  822. {CSS}
  823. </head>
  824. <body>
  825. <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">
  826. <tbody>
  827. <tr>
  828. <td>
  829. <div align="center">
  830. <span style="text-align: center;">
  831. <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>
  832. </span></div>
  833. <br>
  834. </td>
  835. <td colspan="1" rowspan="3"><br>
  836. <img style="width: 300px; height: 341px; float: right;" alt="image" src="{COURSE_DIR}images/diagrams/head_olfactory_nerve.png "><br></td>
  837. </tr>
  838. <tr>
  839. <td colspan="1" rowspan="1">
  840. <img style="width: 180px; height: 271px;" alt="trainer" src="{COURSE_DIR}images/trainer/trainer_glasses.png"><br></td>
  841. </tr>
  842. <tr>
  843. </tr>
  844. </tbody>
  845. </table>
  846. <p><br>
  847. <br>
  848. </p>
  849. </body>
  850. \');';
  851. $res = mysql_query($sql);
  852. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  853. (\'TemplateTitleVideo\', \'TemplateTitleVideoDescription\', \'video.gif\', \'
  854. <head>
  855. {CSS}
  856. </head>
  857. <body>
  858. <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">
  859. <tbody>
  860. <tr>
  861. <td style="width: 50%; vertical-align: top;">
  862. <div style="border-style: none; overflow: hidden; height: 200px; width: 300px; background-color: rgb(220, 220, 220); background-image: url({REL_PATH}main/inc/lib/fckeditor/editor/plugins/flvPlayer/flvPlayer.gif); background-repeat: no-repeat; background-position: center center;"><script src="{REL_PATH}main/inc/lib/fckeditor/editor/plugins/flvPlayer/swfobject.js" type="text/javascript"></script>
  863. <div id="player810625"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.
  864. <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=400 height=200 loop=false play=false downloadable=false fullscreen=true displayNavigation=true displayDigits=true align=left dispPlaylist=none playlistThumbs=false</div>
  865. </div>
  866. <script type="text/javascript">
  867. var s1 = new SWFObject("{REL_PATH}main/inc/lib/fckeditor/editor/plugins/flvPlayer/mediaplayer.swf","single","400","200","7");
  868. s1.addVariable("width","400");
  869. s1.addVariable("height","200");
  870. s1.addVariable("autostart","false");
  871. s1.addVariable("file","{REL_PATH}main/default_course_document/video/flv/example.flv");
  872. s1.addVariable("repeat","false");
  873. s1.addVariable("image","");
  874. s1.addVariable("showdownload","false");
  875. s1.addVariable("link","{REL_PATH}main/default_course_document/video/flv/example.flv");
  876. s1.addParam("allowfullscreen","true");
  877. s1.addVariable("showdigits","true");
  878. s1.addVariable("shownavigation","true");
  879. s1.addVariable("logo","");
  880. s1.write("player810625");
  881. </script></div>
  882. </td>
  883. <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%;">
  884. <h3><br>
  885. </h3>
  886. <h3>Lorem ipsum dolor sit amet</h3>
  887. <ul>
  888. <li>consectetur adipisicing elit</li>
  889. <li>sed do eiusmod tempor incididunt</li>
  890. <li>ut labore et dolore magna aliqua</li>
  891. </ul>
  892. <h3>Ut enim ad minim veniam</h3>
  893. <ul>
  894. <li>quis nostrud exercitation ullamco</li>
  895. <li>laboris nisi ut aliquip ex ea commodo consequat</li>
  896. <li>Excepteur sint occaecat cupidatat non proident</li>
  897. </ul>
  898. </td>
  899. </tr>
  900. </tbody>
  901. </table>
  902. <p><br>
  903. <br>
  904. </p>
  905. <style type="text/css">body{}</style><!-- to fix a strange bug appearing with firefox when editing this template -->
  906. </body>
  907. \'); ';
  908. $res = mysql_query($sql);
  909. $sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
  910. (\'TemplateTitleFlash\', \'TemplateTitleFlashDescription\', \'flash.gif\', \'
  911. <head>
  912. {CSS}
  913. </head>
  914. <body>
  915. <center>
  916. <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">
  917. <tbody>
  918. <tr>
  919. <td align="center">
  920. <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 />
  921. </td>
  922. </tr>
  923. </tbody>
  924. </table>
  925. <p><br>
  926. <br>
  927. </p>
  928. </center>
  929. </body>
  930. \'); ';
  931. $res = mysql_query($sql);
  932. // 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
  933. $query = "SELECT * FROM $dbNameForm.course_module";
  934. $result = mysql_query($query);
  935. if ($result === false) {
  936. //the course_module table doesn't exist, create it
  937. $sql = "CREATE TABLE $dbNameForm.course_module (
  938. id int unsigned NOT NULL auto_increment,
  939. name varchar(100) NOT NULL,
  940. link varchar(255) NOT NULL,
  941. image varchar(100) default NULL,
  942. `row` int unsigned NOT NULL default '0',
  943. `column` int unsigned NOT NULL default '0',
  944. position varchar(20) NOT NULL default 'basic',
  945. PRIMARY KEY (id)
  946. )
  947. ";
  948. $result = mysql_query($sql);
  949. if ($result !== false) {
  950. $sql = "INSERT INTO $dbNameForm.course_module (name, link, image, `row`,`column`, position) VALUES
  951. ('calendar_event','calendar/agenda.php','agenda.gif',1,1,'basic'),
  952. ('link','link/link.php','links.gif',4,1,'basic'),
  953. ('document','document/document.php','documents.gif',3,1,'basic'),
  954. ('student_publication','work/work.php','works.gif',3,2,'basic'),
  955. ('announcement','announcements/announcements.php','valves.gif',2,1,'basic'),
  956. ('user','user/user.php','members.gif',2,3,'basic'),
  957. ('forum','forum/index.php','forum.gif',1,2,'basic'),
  958. ('quiz','exercice/exercice.php','quiz.gif',2,2,'basic'),
  959. ('group','group/group.php','group.gif',3,3,'basic'),
  960. ('course_description','course_description/','info.gif',1,3,'basic'),
  961. ('chat','chat/chat.php','chat.gif',0,0,'external'),
  962. ('dropbox','dropbox/index.php','dropbox.gif',4,2,'basic'),
  963. ('tracking','tracking/courseLog.php','statistics.gif',1,3,'courseadmin'),
  964. ('homepage_link','link/link.php?action=addlink','npage.gif',1,1,'courseadmin'),
  965. ('course_setting','course_info/infocours.php','reference.gif',1,1,'courseadmin'),
  966. ('External','','external.gif',0,0,'external'),
  967. ('AddedLearnpath','','scormbuilder.gif',0,0,'external'),
  968. ('conference','conference/index.php?type=conference','conf.gif',0,0,'external'),
  969. ('conference','conference/index.php?type=classroom','conf.gif',0,0,'external'),
  970. ('learnpath','newscorm/lp_controller.php','scorm.gif',5,1,'basic'),
  971. ('blog','blog/blog.php','blog.gif',1,2,'basic'),
  972. ('blog_management','blog/blog_admin.php','blog_admin.gif',1,2,'courseadmin'),
  973. ('course_maintenance','course_info/maintenance.php','backup.gif',2,3,'courseadmin'),
  974. ('survey','survey/survey_list.php','survey.gif',2,1,'basic'),
  975. ('wiki','wiki/index.php','wiki.gif',2,3,'basic'),
  976. ('gradebook','gradebook/index.php','gradebook.gif',2,2,'basic'),
  977. ('glossary','glossary/index.php','glossary.gif',2,1,'basic'),
  978. ('notebook','notebook/index.php','notebook.gif',2,1,'basic')";
  979. $res = mysql_query($sql);
  980. }
  981. }
  982. //get the stats queries list (s_q_list)
  983. $s_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql','stats');
  984. if(count($s_q_list)>0)
  985. {
  986. //now use the $s_q_list
  987. /**
  988. * We connect to the right DB first to make sure we can use the queries
  989. * without a database name
  990. */
  991. if(strlen($dbStatsForm)>40){
  992. error_log('Database name '.$dbStatsForm.' is too long, skipping',0);
  993. }elseif(!in_array($dbStatsForm,$dblist)){
  994. error_log('Database '.$dbStatsForm.' was not found, skipping',0);
  995. }else{
  996. mysql_select_db($dbStatsForm);
  997. foreach($s_q_list as $query){
  998. if($only_test){
  999. error_log("mysql_query($dbStatsForm,$query)",0);
  1000. }else{
  1001. $res = mysql_query($query);
  1002. if($log)
  1003. {
  1004. error_log("In $dbStatsForm, executed: $query",0);
  1005. }
  1006. }
  1007. }
  1008. }
  1009. }
  1010. //get the user queries list (u_q_list)
  1011. $u_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql','user');
  1012. if(count($u_q_list)>0)
  1013. {
  1014. //now use the $u_q_list
  1015. /**
  1016. * We connect to the right DB first to make sure we can use the queries
  1017. * without a database name
  1018. */
  1019. if(strlen($dbUserForm)>40){
  1020. error_log('Database name '.$dbUserForm.' is too long, skipping',0);
  1021. }elseif(!in_array($dbUserForm,$dblist)){
  1022. error_log('Database '.$dbUserForm.' was not found, skipping',0);
  1023. }else{
  1024. mysql_select_db($dbUserForm);
  1025. foreach($u_q_list as $query){
  1026. if($only_test){
  1027. error_log("mysql_query($dbUserForm,$query)",0);
  1028. error_log("In $dbUserForm, executed: $query",0);
  1029. }else{
  1030. $res = mysql_query($query);
  1031. }
  1032. }
  1033. }
  1034. }
  1035. //the SCORM database doesn't need a change in the pre-migrate part - ignore
  1036. }
  1037. /*
  1038. -----------------------------------------------------------
  1039. Update the Dokeos course databases
  1040. this part can be accessed in two ways:
  1041. - from the normal upgrade process
  1042. - from the script update_courses.php,
  1043. which is used to upgrade more than MAX_COURSE_TRANSFER courses
  1044. Every time this script is accessed, only
  1045. MAX_COURSE_TRANSFER courses are upgraded.
  1046. -----------------------------------------------------------
  1047. */
  1048. $prefix = '';
  1049. if ($singleDbForm)
  1050. {
  1051. $prefix = get_config_param ('table_prefix');
  1052. }
  1053. //get the courses databases queries list (c_q_list)
  1054. $c_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql','course');
  1055. if(count($c_q_list)>0)
  1056. {
  1057. //get the courses list
  1058. if(strlen($dbNameForm)>40)
  1059. {
  1060. error_log('Database name '.$dbNameForm.' is too long, skipping',0);
  1061. }
  1062. elseif(!in_array($dbNameForm,$dblist))
  1063. {
  1064. error_log('Database '.$dbNameForm.' was not found, skipping',0);
  1065. }
  1066. else
  1067. {
  1068. mysql_select_db($dbNameForm);
  1069. $res = mysql_query("SELECT code,db_name,directory,course_language FROM course WHERE target_course_code IS NULL ORDER BY code");
  1070. if($res===false){die('Error while querying the courses list in update_db.inc.php');}
  1071. if(mysql_num_rows($res)>0)
  1072. {
  1073. $i=0;
  1074. $list = array();
  1075. //while( ($i < MAX_COURSE_TRANSFER) && ($row = mysql_fetch_array($res)))
  1076. while($row = mysql_fetch_array($res))
  1077. {
  1078. $list[] = $row;
  1079. $i++;
  1080. }
  1081. foreach($list as $row_course)
  1082. {
  1083. //now use the $c_q_list
  1084. /**
  1085. * We connect to the right DB first to make sure we can use the queries
  1086. * without a database name
  1087. */
  1088. if (!$singleDbForm) //otherwise just use the main one
  1089. {
  1090. mysql_select_db($row_course['db_name']);
  1091. }
  1092. foreach($c_q_list as $query)
  1093. {
  1094. if ($singleDbForm) //otherwise just use the main one
  1095. {
  1096. $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);
  1097. }
  1098. if($only_test)
  1099. {
  1100. error_log("mysql_query(".$row_course['db_name'].",$query)",0);
  1101. }
  1102. else
  1103. {
  1104. $res = mysql_query($query);
  1105. if($log)
  1106. {
  1107. error_log("In ".$row_course['db_name'].", executed: $query",0);
  1108. }
  1109. }
  1110. }
  1111. $t_d = $row_course['db_name'].".document";
  1112. $t_ip = $row_course['db_name'].".item_property";
  1113. if($singleDbForm)
  1114. {
  1115. $t_d = "$prefix{$row_course['db_name']}_document";
  1116. $t_ip = "$prefix{$row_course['db_name']}_item_property";
  1117. }
  1118. // shared documents folder
  1119. $query = "INSERT INTO $t_d (path,title,filetype,size) VALUES ('/shared_folder','".get_lang('SharedDocumentsDirectory')."','folder','0')";
  1120. $myres = mysql_query($query);
  1121. if ($myres !== false) {
  1122. $doc_id = mysql_insert_id();
  1123. $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)";
  1124. $myres = mysql_query($query);
  1125. }
  1126. }
  1127. }
  1128. }
  1129. }
  1130. }
  1131. else
  1132. {
  1133. echo 'You are not allowed here !';
  1134. }
  1135. ?>