@@ -184,7 +184,7 @@ |
||
184 | 184 | } |
185 | 185 | |
186 | 186 | //redirect_header("javascript:history.go(-1)", 3, $redirect_msg); |
187 | - redirect_header("index.php", 3, $redirect_msg); |
|
187 | + redirect_header("index.php", 3, $redirect_msg); |
|
188 | 188 | exit; |
189 | 189 | |
190 | 190 | break; |
@@ -287,8 +287,7 @@ discard block |
||
287 | 287 | * @param array $groups : group with granted permission |
288 | 288 | * @param integer $itemID : faqid on which we are setting permissions |
289 | 289 | * @return boolean : TRUE if the no errors occured |
290 | - |
|
291 | -*/ |
|
290 | + */ |
|
292 | 291 | function sf_saveItemPermissions($groups, $itemID) |
293 | 292 | { |
294 | 293 | $result = true; |
@@ -536,7 +535,7 @@ discard block |
||
536 | 535 | function sf_collapsableBar($tablename = '', $iconname = '') |
537 | 536 | { |
538 | 537 | |
539 | - ?> |
|
538 | + ?> |
|
540 | 539 | <script type="text/javascript"><!-- |
541 | 540 | function goto_URL(object) |
542 | 541 | { |
@@ -24,19 +24,19 @@ |
||
24 | 24 | //$form->addElement(new XoopsFormDhtmlTextArea(_MD_SF_ANSWER_FAQ, 'answer', '', 15, 60), true); |
25 | 25 | |
26 | 26 | $editorTray = new XoopsFormElementTray(_MD_SF_ANSWER_FAQ, '<br />'); |
27 | - if (class_exists('XoopsFormEditor')) { |
|
28 | - $options['name'] = 'answer'; |
|
29 | - $options['value'] = ''; |
|
30 | - $options['rows'] = 5; |
|
31 | - $options['cols'] = '100%'; |
|
32 | - $options['width'] = '100%'; |
|
33 | - $options['height'] = '200px'; |
|
34 | - $answerEditor = new XoopsFormEditor('', $xoopsModuleConfig['form_editorOptionsUser'], $options, $nohtml = false, $onfailure = 'textarea'); |
|
35 | - $editorTray->addElement($answerEditor,true ); |
|
36 | - } else { |
|
37 | - $answerEditor = new XoopsFormDhtmlTextArea(_MD_SF_ANSWER_FAQ, 'answer', '', '100%', '100%'); |
|
38 | - $editorTray->addElement($answerEditor, true ); |
|
39 | - } |
|
27 | + if (class_exists('XoopsFormEditor')) { |
|
28 | + $options['name'] = 'answer'; |
|
29 | + $options['value'] = ''; |
|
30 | + $options['rows'] = 5; |
|
31 | + $options['cols'] = '100%'; |
|
32 | + $options['width'] = '100%'; |
|
33 | + $options['height'] = '200px'; |
|
34 | + $answerEditor = new XoopsFormEditor('', $xoopsModuleConfig['form_editorOptionsUser'], $options, $nohtml = false, $onfailure = 'textarea'); |
|
35 | + $editorTray->addElement($answerEditor,true ); |
|
36 | + } else { |
|
37 | + $answerEditor = new XoopsFormDhtmlTextArea(_MD_SF_ANSWER_FAQ, 'answer', '', '100%', '100%'); |
|
38 | + $editorTray->addElement($answerEditor, true ); |
|
39 | + } |
|
40 | 40 | $form->addElement($editorTray); |
41 | 41 | |
42 | 42 | // NOTIFY ON PUBLISH |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | // Changing categoryid type to int(11) |
27 | - $table->addAlteredField('categoryid', "int(11) NOT NULL default '0'", false); |
|
27 | + $table->addAlteredField('categoryid', "int(11) NOT NULL default '0'", false); |
|
28 | 28 | |
29 | 29 | if (!$dbupdater->updateTable($table)) { |
30 | 30 | /** |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | // Editing smartfaq_categories table |
37 | 37 | $table = new SmartDbTable('smartfaq_categories'); |
38 | 38 | // Changing categoryid type to int(11) |
39 | - $table->addAlteredField('categoryid', "int(11) NOT NULL default '0'", false); |
|
39 | + $table->addAlteredField('categoryid', "int(11) NOT NULL default '0'", false); |
|
40 | 40 | |
41 | 41 | // Changing parentid type to int(11) |
42 | - $table->addAlteredField('parentid', "int(11) NOT NULL default '0'", false); |
|
42 | + $table->addAlteredField('parentid', "int(11) NOT NULL default '0'", false); |
|
43 | 43 | |
44 | 44 | if (!$dbupdater->updateTable($table)) { |
45 | 45 | /** |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | // Editing smartfaq_answers table |
52 | 52 | $table = new SmartDbTable('smartfaq_answers'); |
53 | 53 | // Changing categoryid type to int(11) |
54 | - $table->addAlteredField('answerid', "int(11) NOT NULL default '0'", false); |
|
54 | + $table->addAlteredField('answerid', "int(11) NOT NULL default '0'", false); |
|
55 | 55 | |
56 | 56 | // Changing parentid type to int(11) |
57 | - $table->addAlteredField('faqid', "int(11) NOT NULL default '0'", false); |
|
57 | + $table->addAlteredField('faqid', "int(11) NOT NULL default '0'", false); |
|
58 | 58 | |
59 | 59 | if (!$dbupdater->updateTable($table)) { |
60 | 60 | /** |
@@ -48,7 +48,7 @@ |
||
48 | 48 | if ( isset($HTTP_POST_VARS) ) { |
49 | 49 | foreach ($HTTP_POST_VARS as $k => $v) { |
50 | 50 | $$k = $v; |
51 | - } |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | if ( isset($HTTP_GET_VARS['op']) ) { |
@@ -37,20 +37,20 @@ |
||
37 | 37 | //$form->addElement($answer_text, true); |
38 | 38 | |
39 | 39 | $editorTray = new XoopsFormElementTray(_MD_SF_ANSWER_FAQ, '<br />'); |
40 | - if (class_exists('XoopsFormEditor')) { |
|
41 | - $options['name'] = 'answer'; |
|
42 | - $options['value'] = $answerObj->answer(); |
|
43 | - $options['rows'] = 5; |
|
44 | - $options['cols'] = '100%'; |
|
45 | - $options['width'] = '100%'; |
|
46 | - $options['height'] = '200px'; |
|
47 | - $answerEditor = new XoopsFormEditor('', $xoopsModuleConfig['form_editorOptionsUser'], $options, $nohtml = false, $onfailure = 'textarea'); |
|
48 | - $editorTray->addElement($answerEditor); |
|
49 | - } else { |
|
50 | - $answerEditor = new XoopsFormDhtmlTextArea('', 'answer', $faqObj->question(), '100%', '100%'); |
|
51 | - $answerEditor->setDescription(_MD_SF_ANSWER_FAQ_DSC); |
|
52 | - $editorTray->addElement($answerEditor); |
|
53 | - } |
|
40 | + if (class_exists('XoopsFormEditor')) { |
|
41 | + $options['name'] = 'answer'; |
|
42 | + $options['value'] = $answerObj->answer(); |
|
43 | + $options['rows'] = 5; |
|
44 | + $options['cols'] = '100%'; |
|
45 | + $options['width'] = '100%'; |
|
46 | + $options['height'] = '200px'; |
|
47 | + $answerEditor = new XoopsFormEditor('', $xoopsModuleConfig['form_editorOptionsUser'], $options, $nohtml = false, $onfailure = 'textarea'); |
|
48 | + $editorTray->addElement($answerEditor); |
|
49 | + } else { |
|
50 | + $answerEditor = new XoopsFormDhtmlTextArea('', 'answer', $faqObj->question(), '100%', '100%'); |
|
51 | + $answerEditor->setDescription(_MD_SF_ANSWER_FAQ_DSC); |
|
52 | + $editorTray->addElement($answerEditor); |
|
53 | + } |
|
54 | 54 | |
55 | 55 | $form->addElement($editorTray); |
56 | 56 |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | { |
24 | 24 | var $attachment_array = array(); |
25 | 25 | /** |
26 | - * constructor |
|
27 | - */ |
|
26 | + * constructor |
|
27 | + */ |
|
28 | 28 | function __construct ($id = null) |
29 | 29 | { |
30 | 30 | $this->db =& XoopsDatabaseFactory::getDatabaseConnection(); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } |
185 | 185 | $post_attachment .= '<br />'; |
186 | 186 | } |
187 | - } |
|
187 | + } |
|
188 | 188 | |
189 | 189 | return $post_attachment; |
190 | 190 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | function notLoaded() |
242 | 242 | { |
243 | - return ($this->getVar('answerid')== -1); |
|
243 | + return ($this->getVar('answerid')== -1); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | function sendNotifications($notifications=array()) |
@@ -294,11 +294,11 @@ discard block |
||
294 | 294 | { |
295 | 295 | |
296 | 296 | /** |
297 | - * create a new answer |
|
298 | - * |
|
299 | - * @param bool $isNew flag the new objects as "new"? |
|
300 | - * @return object sfAnswer |
|
301 | - */ |
|
297 | + * create a new answer |
|
298 | + * |
|
299 | + * @param bool $isNew flag the new objects as "new"? |
|
300 | + * @return object sfAnswer |
|
301 | + */ |
|
302 | 302 | function &create($isNew = true) |
303 | 303 | { |
304 | 304 | $answer = new sfAnswer(); |
@@ -310,11 +310,11 @@ discard block |
||
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
313 | - * retrieve an answer |
|
314 | - * |
|
315 | - * @param int $id answerid of the answer |
|
316 | - * @return mixed reference to the {@link sfAnswer} object, FALSE if failed |
|
317 | - */ |
|
313 | + * retrieve an answer |
|
314 | + * |
|
315 | + * @param int $id answerid of the answer |
|
316 | + * @return mixed reference to the {@link sfAnswer} object, FALSE if failed |
|
317 | + */ |
|
318 | 318 | function &get($id) |
319 | 319 | { |
320 | 320 | if (intval($id) > 0) { |
@@ -336,12 +336,12 @@ discard block |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
339 | - * insert a new answer in the database |
|
340 | - * |
|
341 | - * @param object $answer reference to the {@link sfAnswer} object |
|
342 | - * @param bool $force |
|
343 | - * @return bool FALSE if failed, TRUE if already present and unchanged or successful |
|
344 | - */ |
|
339 | + * insert a new answer in the database |
|
340 | + * |
|
341 | + * @param object $answer reference to the {@link sfAnswer} object |
|
342 | + * @param bool $force |
|
343 | + * @return bool FALSE if failed, TRUE if already present and unchanged or successful |
|
344 | + */ |
|
345 | 345 | function insert(&$answerObj, $force = false) |
346 | 346 | { |
347 | 347 | if (strtolower(get_class($answerObj)) != 'sfanswer') { |
@@ -384,12 +384,12 @@ discard block |
||
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
387 | - * delete an answer from the database |
|
388 | - * |
|
389 | - * @param object $answer reference to the answer to delete |
|
390 | - * @param bool $force |
|
391 | - * @return bool FALSE if failed. |
|
392 | - */ |
|
387 | + * delete an answer from the database |
|
388 | + * |
|
389 | + * @param object $answer reference to the answer to delete |
|
390 | + * @param bool $force |
|
391 | + * @return bool FALSE if failed. |
|
392 | + */ |
|
393 | 393 | function delete(&$answer, $force = false) |
394 | 394 | { |
395 | 395 | if (strtolower(get_class($answer)) != 'sfanswer') { |
@@ -412,12 +412,12 @@ discard block |
||
412 | 412 | } |
413 | 413 | |
414 | 414 | /** |
415 | - * delete an answer from the database |
|
416 | - * |
|
417 | - * @param object $answer reference to the answer to delete |
|
418 | - * @param bool $force |
|
419 | - * @return bool FALSE if failed. |
|
420 | - */ |
|
415 | + * delete an answer from the database |
|
416 | + * |
|
417 | + * @param object $answer reference to the answer to delete |
|
418 | + * @param bool $force |
|
419 | + * @return bool FALSE if failed. |
|
420 | + */ |
|
421 | 421 | function deleteFaqAnswers(&$faqObj) |
422 | 422 | { |
423 | 423 | if (strtolower(get_class($faqObj)) != 'sffaq') { |
@@ -435,12 +435,12 @@ discard block |
||
435 | 435 | } |
436 | 436 | |
437 | 437 | /** |
438 | - * retrieve answers from the database |
|
439 | - * |
|
440 | - * @param object $criteria {@link CriteriaElement} conditions to be met |
|
441 | - * @param bool $id_as_key use the answerid as key for the array? |
|
442 | - * @return array array of {@link sfAnswer} objects |
|
443 | - */ |
|
438 | + * retrieve answers from the database |
|
439 | + * |
|
440 | + * @param object $criteria {@link CriteriaElement} conditions to be met |
|
441 | + * @param bool $id_as_key use the answerid as key for the array? |
|
442 | + * @return array array of {@link sfAnswer} objects |
|
443 | + */ |
|
444 | 444 | function &getObjects($criteria = null, $id_as_key = false) |
445 | 445 | { |
446 | 446 | $ret = array(); |
@@ -474,12 +474,12 @@ discard block |
||
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
477 | - * retrieve 1 official answer (for now SmartFAQ only allow 1 official answer...) |
|
478 | - * |
|
479 | - * @param object $criteria {@link CriteriaElement} conditions to be met |
|
480 | - * @param int $faqid |
|
481 | - * @return mixed reference to the {@link sfAnswer} object, FALSE if failed |
|
482 | - */ |
|
477 | + * retrieve 1 official answer (for now SmartFAQ only allow 1 official answer...) |
|
478 | + * |
|
479 | + * @param object $criteria {@link CriteriaElement} conditions to be met |
|
480 | + * @param int $faqid |
|
481 | + * @return mixed reference to the {@link sfAnswer} object, FALSE if failed |
|
482 | + */ |
|
483 | 483 | function &getOfficialAnswer($faqid=0) |
484 | 484 | { |
485 | 485 | $theaAnswers =& $this->getAllAnswers($faqid, _SF_AN_STATUS_APPROVED, 1, 0); |
@@ -493,12 +493,12 @@ discard block |
||
493 | 493 | } |
494 | 494 | |
495 | 495 | /** |
496 | - * retrieve all answers |
|
497 | - * |
|
498 | - * @param object $criteria {@link CriteriaElement} conditions to be met |
|
499 | - * @param int $faqid |
|
500 | - * @return array array of {@link sfAnswer} objects |
|
501 | - */ |
|
496 | + * retrieve all answers |
|
497 | + * |
|
498 | + * @param object $criteria {@link CriteriaElement} conditions to be met |
|
499 | + * @param int $faqid |
|
500 | + * @return array array of {@link sfAnswer} objects |
|
501 | + */ |
|
502 | 502 | function &getAllAnswers($faqid=0, $status = -1, $limit = 0, $start = 0, $sort = 'datesub', $order = 'DESC') |
503 | 503 | { |
504 | 504 | $hasStatusCriteria = false; |
@@ -531,11 +531,11 @@ discard block |
||
531 | 531 | } |
532 | 532 | |
533 | 533 | /** |
534 | - * count answers matching a condition |
|
535 | - * |
|
536 | - * @param object $criteria {@link CriteriaElement} to match |
|
537 | - * @return int count of answers |
|
538 | - */ |
|
534 | + * count answers matching a condition |
|
535 | + * |
|
536 | + * @param object $criteria {@link CriteriaElement} to match |
|
537 | + * @return int count of answers |
|
538 | + */ |
|
539 | 539 | function getCount($criteria = null) |
540 | 540 | { |
541 | 541 | $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_answers'); |
@@ -552,11 +552,11 @@ discard block |
||
552 | 552 | } |
553 | 553 | |
554 | 554 | /** |
555 | - * count answers matching a condition and group by faq ID |
|
556 | - * |
|
557 | - * @param object $criteria {@link CriteriaElement} to match |
|
558 | - * @return array |
|
559 | - */ |
|
555 | + * count answers matching a condition and group by faq ID |
|
556 | + * |
|
557 | + * @param object $criteria {@link CriteriaElement} to match |
|
558 | + * @return array |
|
559 | + */ |
|
560 | 560 | function getCountByFAQ($criteria = null) |
561 | 561 | { |
562 | 562 | $sql = 'SELECT faqid, COUNT(*) FROM '.$this->db->prefix('smartfaq_answers'); |
@@ -580,11 +580,11 @@ discard block |
||
580 | 580 | } |
581 | 581 | |
582 | 582 | /** |
583 | - * delete answers matching a set of conditions |
|
584 | - * |
|
585 | - * @param object $criteria {@link CriteriaElement} |
|
586 | - * @return bool FALSE if deletion failed |
|
587 | - */ |
|
583 | + * delete answers matching a set of conditions |
|
584 | + * |
|
585 | + * @param object $criteria {@link CriteriaElement} |
|
586 | + * @return bool FALSE if deletion failed |
|
587 | + */ |
|
588 | 588 | function deleteAll($criteria = null) |
589 | 589 | { |
590 | 590 | $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_answers'); |
@@ -599,14 +599,14 @@ discard block |
||
599 | 599 | } |
600 | 600 | |
601 | 601 | /** |
602 | - * Change a value for answers with a certain criteria |
|
603 | - * |
|
604 | - * @param string $fieldname Name of the field |
|
605 | - * @param string $fieldvalue Value to write |
|
606 | - * @param object $criteria {@link CriteriaElement} |
|
607 | - * |
|
608 | - * @return bool |
|
609 | - **/ |
|
602 | + * Change a value for answers with a certain criteria |
|
603 | + * |
|
604 | + * @param string $fieldname Name of the field |
|
605 | + * @param string $fieldvalue Value to write |
|
606 | + * @param object $criteria {@link CriteriaElement} |
|
607 | + * |
|
608 | + * @return bool |
|
609 | + **/ |
|
610 | 610 | function updateAll($fieldname, $fieldvalue, $criteria = null) |
611 | 611 | { |
612 | 612 | $set_clause = is_numeric($fieldvalue)? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue); |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | var $_smartModule= null; |
71 | 71 | var $_smartModuleConfig; |
72 | 72 | /** |
73 | - * constructor |
|
74 | - */ |
|
73 | + * constructor |
|
74 | + */ |
|
75 | 75 | function __construct($id= null) |
76 | 76 | { |
77 | 77 | $this->db= & XoopsDatabaseFactory::getDatabaseConnection(); |
@@ -591,11 +591,11 @@ discard block |
||
591 | 591 | } |
592 | 592 | |
593 | 593 | /** |
594 | - * retrieve an FAQ |
|
595 | - * |
|
596 | - * @param int $id faqid of the user |
|
597 | - * @return mixed reference to the {@link sfFaq} object, FALSE if failed |
|
598 | - */ |
|
594 | + * retrieve an FAQ |
|
595 | + * |
|
596 | + * @param int $id faqid of the user |
|
597 | + * @return mixed reference to the {@link sfFaq} object, FALSE if failed |
|
598 | + */ |
|
599 | 599 | function & get($id) |
600 | 600 | { |
601 | 601 | if (intval($id) > 0) { |
@@ -617,12 +617,12 @@ discard block |
||
617 | 617 | } |
618 | 618 | |
619 | 619 | /** |
620 | - * insert a new faq in the database |
|
621 | - * |
|
622 | - * @param object $faq reference to the {@link sfFaq} object |
|
623 | - * @param bool $force |
|
624 | - * @return bool FALSE if failed, TRUE if already present and unchanged or successful |
|
625 | - */ |
|
620 | + * insert a new faq in the database |
|
621 | + * |
|
622 | + * @param object $faq reference to the {@link sfFaq} object |
|
623 | + * @param bool $force |
|
624 | + * @return bool FALSE if failed, TRUE if already present and unchanged or successful |
|
625 | + */ |
|
626 | 626 | function insert(& $faq, $force= false) |
627 | 627 | { |
628 | 628 | |
@@ -668,12 +668,12 @@ discard block |
||
668 | 668 | } |
669 | 669 | |
670 | 670 | /** |
671 | - * delete an FAQ from the database |
|
672 | - * |
|
673 | - * @param object $faq reference to the FAQ to delete |
|
674 | - * @param bool $force |
|
675 | - * @return bool FALSE if failed. |
|
676 | - */ |
|
671 | + * delete an FAQ from the database |
|
672 | + * |
|
673 | + * @param object $faq reference to the FAQ to delete |
|
674 | + * @param bool $force |
|
675 | + * @return bool FALSE if failed. |
|
676 | + */ |
|
677 | 677 | function delete(& $faq, $force= false) |
678 | 678 | { |
679 | 679 | $smartModule= & sf_getModuleInfo(); |
@@ -707,12 +707,12 @@ discard block |
||
707 | 707 | } |
708 | 708 | |
709 | 709 | /** |
710 | - * retrieve FAQs from the database |
|
711 | - * |
|
712 | - * @param object $criteria {@link CriteriaElement} conditions to be met |
|
713 | - * @param bool $id_as_key use the faqid as key for the array? |
|
714 | - * @return array array of {@link sfFaq} objects |
|
715 | - */ |
|
710 | + * retrieve FAQs from the database |
|
711 | + * |
|
712 | + * @param object $criteria {@link CriteriaElement} conditions to be met |
|
713 | + * @param bool $id_as_key use the faqid as key for the array? |
|
714 | + * @return array array of {@link sfFaq} objects |
|
715 | + */ |
|
716 | 716 | function & getObjects($criteria= null, $id_as_key= false, $notNullFields= '') |
717 | 717 | { |
718 | 718 | $ret= array(); |
@@ -851,11 +851,11 @@ discard block |
||
851 | 851 | } |
852 | 852 | |
853 | 853 | /** |
854 | - * count FAQs matching a condition |
|
855 | - * |
|
856 | - * @param object $criteria {@link CriteriaElement} to match |
|
857 | - * @return int count of FAQs |
|
858 | - */ |
|
854 | + * count FAQs matching a condition |
|
855 | + * |
|
856 | + * @param object $criteria {@link CriteriaElement} to match |
|
857 | + * @return int count of FAQs |
|
858 | + */ |
|
859 | 859 | function getCount($criteria= null, $notNullFields= '') |
860 | 860 | { |
861 | 861 | $sql= 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_faq'); |
@@ -1224,11 +1224,11 @@ discard block |
||
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | /** |
1227 | - * delete FAQs matching a set of conditions |
|
1228 | - * |
|
1229 | - * @param object $criteria {@link CriteriaElement} |
|
1230 | - * @return bool FALSE if deletion failed |
|
1231 | - */ |
|
1227 | + * delete FAQs matching a set of conditions |
|
1228 | + * |
|
1229 | + * @param object $criteria {@link CriteriaElement} |
|
1230 | + * @return bool FALSE if deletion failed |
|
1231 | + */ |
|
1232 | 1232 | function deleteAll($criteria= null) |
1233 | 1233 | { |
1234 | 1234 | $sql= 'DELETE FROM '.$this->db->prefix('smartfaq_faq'); |
@@ -1244,14 +1244,14 @@ discard block |
||
1244 | 1244 | } |
1245 | 1245 | |
1246 | 1246 | /** |
1247 | - * Change a value for FAQ with a certain criteria |
|
1248 | - * |
|
1249 | - * @param string $fieldname Name of the field |
|
1250 | - * @param string $fieldvalue Value to write |
|
1251 | - * @param object $criteria {@link CriteriaElement} |
|
1252 | - * |
|
1253 | - * @return bool |
|
1254 | - **/ |
|
1247 | + * Change a value for FAQ with a certain criteria |
|
1248 | + * |
|
1249 | + * @param string $fieldname Name of the field |
|
1250 | + * @param string $fieldvalue Value to write |
|
1251 | + * @param object $criteria {@link CriteriaElement} |
|
1252 | + * |
|
1253 | + * @return bool |
|
1254 | + **/ |
|
1255 | 1255 | function updateAll($fieldname, $fieldvalue, $criteria= null) |
1256 | 1256 | { |
1257 | 1257 | $set_clause= is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | var $_flagForDrop = false; |
103 | 103 | |
104 | 104 | /** |
105 | - * @var array $_updatedFields containing fields which values will be updated |
|
105 | + * @var array $_updatedFields containing fields which values will be updated |
|
106 | 106 | */ |
107 | 107 | var $_updatedFields; |
108 | 108 | |
@@ -111,24 +111,24 @@ discard block |
||
111 | 111 | */ //felix |
112 | 112 | var $_updatedWhere; |
113 | 113 | |
114 | - /** |
|
115 | - * Constructor |
|
116 | - * |
|
117 | - * @param string $name name of the table |
|
118 | - * |
|
119 | - */ |
|
114 | + /** |
|
115 | + * Constructor |
|
116 | + * |
|
117 | + * @param string $name name of the table |
|
118 | + * |
|
119 | + */ |
|
120 | 120 | function __construct($name) |
121 | 121 | { |
122 | 122 | $this->_name = $name; |
123 | 123 | $this->_data = array(); |
124 | 124 | } |
125 | 125 | |
126 | - /** |
|
127 | - * Return the table name, prefixed with site table prefix |
|
128 | - * |
|
129 | - * @return string table name |
|
130 | - * |
|
131 | - */ |
|
126 | + /** |
|
127 | + * Return the table name, prefixed with site table prefix |
|
128 | + * |
|
129 | + * @return string table name |
|
130 | + * |
|
131 | + */ |
|
132 | 132 | function name() |
133 | 133 | { |
134 | 134 | global $xoopsDB; |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | return $xoopsDB->prefix($this->_name); |
137 | 137 | } |
138 | 138 | |
139 | - /** |
|
140 | - * Checks if the table already exists in the database |
|
141 | - * |
|
142 | - * @return bool TRUE if it exists, FALSE if not |
|
143 | - * |
|
144 | - */ |
|
139 | + /** |
|
140 | + * Checks if the table already exists in the database |
|
141 | + * |
|
142 | + * @return bool TRUE if it exists, FALSE if not |
|
143 | + * |
|
144 | + */ |
|
145 | 145 | function exists() |
146 | 146 | { |
147 | 147 | return smart_TableExists($this->_name); |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | global $xoopsDB; |
153 | 153 | $result = $xoopsDB->query("SHOW COLUMNS FROM ".$this->name()); |
154 | 154 | while ($existing_field = $xoopsDB->fetchArray($result)) { |
155 | - $fields[$existing_field['Field']] = $existing_field['Type']; |
|
156 | - if ($existing_field['Null'] != "YES") { |
|
157 | - $fields[$existing_field['Field']] .= " NOT NULL"; |
|
158 | - } |
|
159 | - if ($existing_field['Extra']) { |
|
160 | - $fields[$existing_field['Field']] .= " ".$existing_field['Extra']; |
|
161 | - } |
|
155 | + $fields[$existing_field['Field']] = $existing_field['Type']; |
|
156 | + if ($existing_field['Null'] != "YES") { |
|
157 | + $fields[$existing_field['Field']] .= " NOT NULL"; |
|
158 | + } |
|
159 | + if ($existing_field['Extra']) { |
|
160 | + $fields[$existing_field['Field']] .= " ".$existing_field['Extra']; |
|
161 | + } |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | return $fields; |
@@ -171,56 +171,56 @@ discard block |
||
171 | 171 | return isset($existingFields[$field]); |
172 | 172 | } |
173 | 173 | |
174 | - /** |
|
175 | - * Set the table structure |
|
176 | - * |
|
177 | - * @param string $structure table structure |
|
178 | - * |
|
179 | - */ |
|
174 | + /** |
|
175 | + * Set the table structure |
|
176 | + * |
|
177 | + * @param string $structure table structure |
|
178 | + * |
|
179 | + */ |
|
180 | 180 | function setStructure($structure) |
181 | 181 | { |
182 | 182 | $this->_structure = $structure; |
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
186 | - * Return the table structure |
|
187 | - * |
|
188 | - * @return string table structure |
|
189 | - * |
|
190 | - */ |
|
186 | + * Return the table structure |
|
187 | + * |
|
188 | + * @return string table structure |
|
189 | + * |
|
190 | + */ |
|
191 | 191 | function getStructure() |
192 | 192 | { |
193 | 193 | return sprintf($this->_structure, $this->name()); |
194 | 194 | } |
195 | 195 | |
196 | - /** |
|
197 | - * Add values of a record to be added |
|
198 | - * |
|
199 | - * @param string $data values of a record |
|
200 | - * |
|
201 | - */ |
|
196 | + /** |
|
197 | + * Add values of a record to be added |
|
198 | + * |
|
199 | + * @param string $data values of a record |
|
200 | + * |
|
201 | + */ |
|
202 | 202 | function setData($data) |
203 | 203 | { |
204 | 204 | $this->_data[] = $data; |
205 | 205 | } |
206 | 206 | |
207 | - /** |
|
208 | - * Get the data array |
|
209 | - * |
|
210 | - * @return array containing the records values to be added |
|
211 | - * |
|
212 | - */ |
|
207 | + /** |
|
208 | + * Get the data array |
|
209 | + * |
|
210 | + * @return array containing the records values to be added |
|
211 | + * |
|
212 | + */ |
|
213 | 213 | function getData() |
214 | 214 | { |
215 | 215 | return $this->_data; |
216 | 216 | } |
217 | 217 | |
218 | - /** |
|
219 | - * Use to insert data in a table |
|
220 | - * |
|
221 | - * @return bool true if success, false if an error occured |
|
222 | - * |
|
223 | - */ |
|
218 | + /** |
|
219 | + * Use to insert data in a table |
|
220 | + * |
|
221 | + * @return bool true if success, false if an error occured |
|
222 | + * |
|
223 | + */ |
|
224 | 224 | function addData() |
225 | 225 | { |
226 | 226 | global $xoopsDB; |
@@ -239,13 +239,13 @@ discard block |
||
239 | 239 | |
240 | 240 | } |
241 | 241 | |
242 | - /** |
|
243 | - * Add a field to be added |
|
244 | - * |
|
245 | - * @param string $name name of the field |
|
246 | - * @param string $properties properties of the field |
|
247 | - * |
|
248 | - */ |
|
242 | + /** |
|
243 | + * Add a field to be added |
|
244 | + * |
|
245 | + * @param string $name name of the field |
|
246 | + * @param string $properties properties of the field |
|
247 | + * |
|
248 | + */ |
|
249 | 249 | function addAlteredField($name, $properties, $showerror=true) |
250 | 250 | { |
251 | 251 | $field['name'] = $name; |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
258 | - * Invert values 0 to 1 and 1 to 0 |
|
259 | - * |
|
260 | - * @param string $name name of the field |
|
261 | - * @param string $old old propertie |
|
262 | - * @param string $new new propertie |
|
263 | - * |
|
264 | - */ //felix |
|
258 | + * Invert values 0 to 1 and 1 to 0 |
|
259 | + * |
|
260 | + * @param string $name name of the field |
|
261 | + * @param string $old old propertie |
|
262 | + * @param string $new new propertie |
|
263 | + * |
|
264 | + */ //felix |
|
265 | 265 | function addUpdatedWhere($name, $newValue, $oldValue) |
266 | 266 | { |
267 | 267 | $field['name'] = $name; |
@@ -270,13 +270,13 @@ discard block |
||
270 | 270 | $this->_updatedWhere[] = $field; |
271 | 271 | } |
272 | 272 | |
273 | - /** |
|
274 | - * Add new field of a record to be added |
|
275 | - * |
|
276 | - * @param string $name name of the field |
|
277 | - * @param string $properties properties of the field |
|
278 | - * |
|
279 | - */ |
|
273 | + /** |
|
274 | + * Add new field of a record to be added |
|
275 | + * |
|
276 | + * @param string $name name of the field |
|
277 | + * @param string $properties properties of the field |
|
278 | + * |
|
279 | + */ |
|
280 | 280 | function addNewField($name, $properties) |
281 | 281 | { |
282 | 282 | $field['name'] = $name; |
@@ -284,24 +284,24 @@ discard block |
||
284 | 284 | $this->_newFields[] = $field; |
285 | 285 | } |
286 | 286 | |
287 | - /** |
|
288 | - * Get fields that need to be altered |
|
289 | - * |
|
290 | - * @return array fields that need to be altered |
|
291 | - * |
|
292 | - */ |
|
287 | + /** |
|
288 | + * Get fields that need to be altered |
|
289 | + * |
|
290 | + * @return array fields that need to be altered |
|
291 | + * |
|
292 | + */ |
|
293 | 293 | function getAlteredFields() |
294 | 294 | { |
295 | 295 | return $this->_alteredFields; |
296 | 296 | } |
297 | 297 | |
298 | - /** |
|
299 | - * Add field for which the value will be updated |
|
300 | - * |
|
301 | - * @param string $name name of the field |
|
302 | - * @param string $value value to be set |
|
303 | - * |
|
304 | - */ |
|
298 | + /** |
|
299 | + * Add field for which the value will be updated |
|
300 | + * |
|
301 | + * @param string $name name of the field |
|
302 | + * @param string $value value to be set |
|
303 | + * |
|
304 | + */ |
|
305 | 305 | function addUpdatedField($name, $value) |
306 | 306 | { |
307 | 307 | $field['name'] = $name; |
@@ -309,76 +309,76 @@ discard block |
||
309 | 309 | $this->_updatedFields[] = $field; |
310 | 310 | } |
311 | 311 | |
312 | - /** |
|
313 | - * Get new fields to be added |
|
314 | - * |
|
315 | - * @return array fields to be added |
|
316 | - * |
|
317 | - */ |
|
312 | + /** |
|
313 | + * Get new fields to be added |
|
314 | + * |
|
315 | + * @return array fields to be added |
|
316 | + * |
|
317 | + */ |
|
318 | 318 | function getNewFields() |
319 | 319 | { |
320 | 320 | return $this->_newFields; |
321 | 321 | } |
322 | 322 | |
323 | - /** |
|
324 | - * Get fields which values need to be updated |
|
325 | - * |
|
326 | - * @return array fields which values need to be updated |
|
327 | - * |
|
328 | - */ |
|
323 | + /** |
|
324 | + * Get fields which values need to be updated |
|
325 | + * |
|
326 | + * @return array fields which values need to be updated |
|
327 | + * |
|
328 | + */ |
|
329 | 329 | function getUpdatedFields() |
330 | 330 | { |
331 | 331 | return $this->_updatedFields; |
332 | 332 | } |
333 | 333 | |
334 | - /** |
|
335 | - * Get fields which values need to be updated |
|
336 | - * |
|
337 | - * @return array fields which values need to be updated |
|
338 | - * |
|
339 | - */ //felix |
|
334 | + /** |
|
335 | + * Get fields which values need to be updated |
|
336 | + * |
|
337 | + * @return array fields which values need to be updated |
|
338 | + * |
|
339 | + */ //felix |
|
340 | 340 | function getUpdatedWhere() |
341 | 341 | { |
342 | 342 | return $this->_updatedWhere; |
343 | 343 | } |
344 | 344 | |
345 | - /** |
|
346 | - * Add values of a record to be added |
|
347 | - * |
|
348 | - * @param string $name name of the field |
|
349 | - * |
|
350 | - */ |
|
345 | + /** |
|
346 | + * Add values of a record to be added |
|
347 | + * |
|
348 | + * @param string $name name of the field |
|
349 | + * |
|
350 | + */ |
|
351 | 351 | function addDropedField($name) |
352 | 352 | { |
353 | 353 | $this->_dropedFields[] = $name; |
354 | 354 | } |
355 | 355 | |
356 | - /** |
|
357 | - * Get fields that need to be droped |
|
358 | - * |
|
359 | - * @return array fields that need to be droped |
|
360 | - * |
|
361 | - */ |
|
356 | + /** |
|
357 | + * Get fields that need to be droped |
|
358 | + * |
|
359 | + * @return array fields that need to be droped |
|
360 | + * |
|
361 | + */ |
|
362 | 362 | function getDropedFields() |
363 | 363 | { |
364 | 364 | return $this->_dropedFields; |
365 | 365 | } |
366 | 366 | |
367 | - /** |
|
368 | - * Set the flag to drop the table |
|
369 | - * |
|
370 | - */ |
|
367 | + /** |
|
368 | + * Set the flag to drop the table |
|
369 | + * |
|
370 | + */ |
|
371 | 371 | function setFlagForDrop() |
372 | 372 | { |
373 | 373 | $this->_flagForDrop = true; |
374 | 374 | } |
375 | 375 | |
376 | - /** |
|
377 | - * Use to create a table |
|
378 | - * |
|
379 | - * @return bool true if success, false if an error occured |
|
380 | - * |
|
381 | - */ |
|
376 | + /** |
|
377 | + * Use to create a table |
|
378 | + * |
|
379 | + * @return bool true if success, false if an error occured |
|
380 | + * |
|
381 | + */ |
|
382 | 382 | function createTable() |
383 | 383 | { |
384 | 384 | global $xoopsDB; |
@@ -395,12 +395,12 @@ discard block |
||
395 | 395 | return $ret; |
396 | 396 | } |
397 | 397 | |
398 | - /** |
|
399 | - * Use to drop a table |
|
400 | - * |
|
401 | - * @return bool true if success, false if an error occured |
|
402 | - * |
|
403 | - */ |
|
398 | + /** |
|
399 | + * Use to drop a table |
|
400 | + * |
|
401 | + * @return bool true if success, false if an error occured |
|
402 | + * |
|
403 | + */ |
|
404 | 404 | function dropTable() |
405 | 405 | { |
406 | 406 | global $xoopsDB; |
@@ -418,12 +418,12 @@ discard block |
||
418 | 418 | } |
419 | 419 | } |
420 | 420 | |
421 | - /** |
|
422 | - * Use to alter a table |
|
423 | - * |
|
424 | - * @return bool true if success, false if an error occured |
|
425 | - * |
|
426 | - */ |
|
421 | + /** |
|
422 | + * Use to alter a table |
|
423 | + * |
|
424 | + * @return bool true if success, false if an error occured |
|
425 | + * |
|
426 | + */ |
|
427 | 427 | function alterTable() |
428 | 428 | { |
429 | 429 | global $xoopsDB; |
@@ -446,12 +446,12 @@ discard block |
||
446 | 446 | return $ret; |
447 | 447 | } |
448 | 448 | |
449 | - /** |
|
450 | - * Use to add new fileds in the table |
|
451 | - * |
|
452 | - * @return bool true if success, false if an error occured |
|
453 | - * |
|
454 | - */ |
|
449 | + /** |
|
450 | + * Use to add new fileds in the table |
|
451 | + * |
|
452 | + * @return bool true if success, false if an error occured |
|
453 | + * |
|
454 | + */ |
|
455 | 455 | function addNewFields() |
456 | 456 | { |
457 | 457 | global $xoopsDB; |
@@ -471,12 +471,12 @@ discard block |
||
471 | 471 | return $ret; |
472 | 472 | } |
473 | 473 | |
474 | - /** |
|
475 | - * Use to update fields values |
|
476 | - * |
|
477 | - * @return bool true if success, false if an error occured |
|
478 | - * |
|
479 | - */ |
|
474 | + /** |
|
475 | + * Use to update fields values |
|
476 | + * |
|
477 | + * @return bool true if success, false if an error occured |
|
478 | + * |
|
479 | + */ |
|
480 | 480 | function updateFieldsValues() |
481 | 481 | { |
482 | 482 | global $xoopsDB; |
@@ -491,16 +491,16 @@ discard block |
||
491 | 491 | } else { |
492 | 492 | echo " " . sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()) . "<br />"; |
493 | 493 | } |
494 | - } |
|
494 | + } |
|
495 | 495 | |
496 | - return $ret; |
|
496 | + return $ret; |
|
497 | 497 | } |
498 | - /** |
|
499 | - * Use to update fields values |
|
500 | - * |
|
501 | - * @return bool true if success, false if an error occured |
|
502 | - * |
|
503 | - */ //felix |
|
498 | + /** |
|
499 | + * Use to update fields values |
|
500 | + * |
|
501 | + * @return bool true if success, false if an error occured |
|
502 | + * |
|
503 | + */ //felix |
|
504 | 504 | function updateWhereValues() |
505 | 505 | { |
506 | 506 | global $xoopsDB; |
@@ -516,16 +516,16 @@ discard block |
||
516 | 516 | } else { |
517 | 517 | echo " " . sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()) . "<br />"; |
518 | 518 | } |
519 | - } |
|
519 | + } |
|
520 | 520 | |
521 | - return $ret; |
|
521 | + return $ret; |
|
522 | 522 | } |
523 | - /** |
|
524 | - * Use to drop fields |
|
525 | - * |
|
526 | - * @return bool true if success, false if an error occured |
|
527 | - * |
|
528 | - */ |
|
523 | + /** |
|
524 | + * Use to drop fields |
|
525 | + * |
|
526 | + * @return bool true if success, false if an error occured |
|
527 | + * |
|
528 | + */ |
|
529 | 529 | function dropFields() |
530 | 530 | { |
531 | 531 | global $xoopsDB; |
@@ -564,16 +564,16 @@ discard block |
||
564 | 564 | |
565 | 565 | } |
566 | 566 | |
567 | - /** |
|
568 | - * Use to execute a general query |
|
569 | - * |
|
570 | - * @param string $query query that will be executed |
|
571 | - * @param string $goodmsg message displayed on success |
|
572 | - * @param string $badmsg message displayed on error |
|
573 | - * |
|
574 | - * @return bool true if success, false if an error occured |
|
575 | - * |
|
576 | - */ |
|
567 | + /** |
|
568 | + * Use to execute a general query |
|
569 | + * |
|
570 | + * @param string $query query that will be executed |
|
571 | + * @param string $goodmsg message displayed on success |
|
572 | + * @param string $badmsg message displayed on error |
|
573 | + * |
|
574 | + * @return bool true if success, false if an error occured |
|
575 | + * |
|
576 | + */ |
|
577 | 577 | function runQuery($query, $goodmsg, $badmsg) |
578 | 578 | { |
579 | 579 | global $xoopsDB; |
@@ -589,14 +589,14 @@ discard block |
||
589 | 589 | } |
590 | 590 | } |
591 | 591 | |
592 | - /** |
|
593 | - * Use to rename a table |
|
594 | - * |
|
595 | - * @param string $from name of the table to rename |
|
596 | - * @param string $to new name of the renamed table |
|
597 | - * |
|
598 | - * @return bool true if success, false if an error occured |
|
599 | - */ |
|
592 | + /** |
|
593 | + * Use to rename a table |
|
594 | + * |
|
595 | + * @param string $from name of the table to rename |
|
596 | + * @param string $to new name of the renamed table |
|
597 | + * |
|
598 | + * @return bool true if success, false if an error occured |
|
599 | + */ |
|
600 | 600 | function renameTable($from, $to) |
601 | 601 | { |
602 | 602 | global $xoopsDB; |
@@ -617,15 +617,15 @@ discard block |
||
617 | 617 | } |
618 | 618 | } |
619 | 619 | |
620 | - /** |
|
621 | - * Use to update a table |
|
622 | - * |
|
623 | - * @param object $table {@link SmartDbTable} that will be updated |
|
624 | - * |
|
625 | - * @see SmartDbTable |
|
626 | - * |
|
627 | - * @return bool true if success, false if an error occured |
|
628 | - */ |
|
620 | + /** |
|
621 | + * Use to update a table |
|
622 | + * |
|
623 | + * @param object $table {@link SmartDbTable} that will be updated |
|
624 | + * |
|
625 | + * @see SmartDbTable |
|
626 | + * |
|
627 | + * @return bool true if success, false if an error occured |
|
628 | + */ |
|
629 | 629 | function updateTable($table) |
630 | 630 | { |
631 | 631 | global $xoopsDB; |