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

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