@@ 445-465 (lines=21) @@ | ||
442 | * |
|
443 | * @return int |
|
444 | */ |
|
445 | public function getRightId($name) |
|
446 | { |
|
447 | // get right id |
|
448 | $select = sprintf(" |
|
449 | SELECT |
|
450 | right_id |
|
451 | FROM |
|
452 | %sfaqright |
|
453 | WHERE |
|
454 | name = '%s'", |
|
455 | PMF_Db::getTablePrefix(), |
|
456 | $this->config->getDb()->escape($name)); |
|
457 | ||
458 | $res = $this->config->getDb()->query($select); |
|
459 | if ($this->config->getDb()->numRows($res) != 1) { |
|
460 | return 0; |
|
461 | } |
|
462 | $row = $this->config->getDb()->fetchArray($res); |
|
463 | ||
464 | return $row['right_id']; |
|
465 | } |
|
466 | ||
467 | /** |
|
468 | * Returns an array that contains the IDs of all rights stored |
@@ 551-571 (lines=21) @@ | ||
548 | * |
|
549 | * @return int |
|
550 | */ |
|
551 | public function getGroupId($name) |
|
552 | { |
|
553 | $select = sprintf(" |
|
554 | SELECT |
|
555 | group_id |
|
556 | FROM |
|
557 | %sfaqgroup |
|
558 | WHERE |
|
559 | name = '%s'", |
|
560 | PMF_Db::getTablePrefix(), |
|
561 | $this->config->getDb()->escape($name) |
|
562 | ); |
|
563 | ||
564 | $res = $this->config->getDb()->query($select); |
|
565 | if ($this->config->getDb()->numRows($res) != 1) { |
|
566 | return 0; |
|
567 | } |
|
568 | $row = $this->config->getDb()->fetchArray($res); |
|
569 | ||
570 | return $row['group_id']; |
|
571 | } |
|
572 | ||
573 | /** |
|
574 | * Returns an associative array with the group-data of the group |
@@ 120-142 (lines=23) @@ | ||
117 | * |
|
118 | * @return string |
|
119 | */ |
|
120 | public function fetch($key, $value) |
|
121 | { |
|
122 | $select = sprintf(" |
|
123 | SELECT |
|
124 | %s |
|
125 | FROM |
|
126 | %sfaquserdata |
|
127 | WHERE |
|
128 | %s = '%s'", |
|
129 | $key, |
|
130 | PMF_Db::getTablePrefix(), |
|
131 | $key, |
|
132 | $this->config->getDb()->escape($value) |
|
133 | ); |
|
134 | ||
135 | $res = $this->config->getDb()->query($select); |
|
136 | ||
137 | if (0 === $this->config->getDb()->numRows($res)) { |
|
138 | return false; |
|
139 | } else { |
|
140 | return $this->config->getDb()->fetchObject($res)->$key; |
|
141 | } |
|
142 | } |
|
143 | ||
144 | /** |
|
145 | * Sets the user data given by $field and $value. If $field |
@@ 1249-1272 (lines=24) @@ | ||
1246 | * |
|
1247 | * @return int |
|
1248 | */ |
|
1249 | public function getSolutionIdFromId($faqId, $faqLang) |
|
1250 | { |
|
1251 | $query = sprintf(" |
|
1252 | SELECT |
|
1253 | solution_id |
|
1254 | FROM |
|
1255 | %sfaqdata |
|
1256 | WHERE |
|
1257 | id = %d |
|
1258 | AND |
|
1259 | lang = '%s'", |
|
1260 | PMF_Db::getTablePrefix(), |
|
1261 | (int) $faqId, |
|
1262 | $this->_config->getDb()->escape($faqLang) |
|
1263 | ); |
|
1264 | ||
1265 | $result = $this->_config->getDb()->query($query); |
|
1266 | ||
1267 | if ($row = $this->_config->getDb()->fetchObject($result)) { |
|
1268 | return $row->solution_id; |
|
1269 | } |
|
1270 | ||
1271 | return $this->getSolutionId(); |
|
1272 | } |
|
1273 | ||
1274 | /** |
|
1275 | * Gets the latest solution id for a FAQ record. |
|
@@ 1776-1800 (lines=25) @@ | ||
1773 | * |
|
1774 | * @return string |
|
1775 | */ |
|
1776 | public function getVisibilityOfQuestion($questionId) |
|
1777 | { |
|
1778 | $query = sprintf(" |
|
1779 | SELECT |
|
1780 | is_visible |
|
1781 | FROM |
|
1782 | %sfaqquestions |
|
1783 | WHERE |
|
1784 | id = %d |
|
1785 | AND |
|
1786 | lang = '%s'", |
|
1787 | PMF_Db::getTablePrefix(), |
|
1788 | $questionId, |
|
1789 | $this->_config->getLanguage()->getLanguage() |
|
1790 | ); |
|
1791 | ||
1792 | $result = $this->_config->getDb()->query($query); |
|
1793 | if ($this->_config->getDb()->numRows($result) > 0) { |
|
1794 | $row = $this->_config->getDb()->fetchObject($result); |
|
1795 | ||
1796 | return $row->is_visible; |
|
1797 | } |
|
1798 | ||
1799 | return; |
|
1800 | } |
|
1801 | ||
1802 | /** |
|
1803 | * Sets the visibilty of a question. |