예제 #1
0
파일: News.php 프로젝트: jr-ewing/phpMyFAQ
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     global $PMF_LANG;
     $this->db = PMF_Db::getInstance();
     $this->language = PMF_Language::$language;
     $this->pmf_lang = $PMF_LANG;
 }
예제 #2
0
 /**
  * Constructor
  *
  * @param resource$result Resultset
  */
 public function __construct($result)
 {
     $this->db = PMF_Db::getInstance();
     $arrayObject = new ArrayObject();
     while ($row = $this->db->fetch_assoc($result)) {
         $arrayObject[] = $row;
     }
     $this->iterator = $arrayObject->getIterator();
 }
예제 #3
0
파일: Rating.php 프로젝트: nosch/phpMyFAQ
 /**
  * Constructor
  *
  * @since   2007-03-31
  * @author  Thorsten Rinne <*****@*****.**>
  */
 function __construct()
 {
     global $DB, $PMF_LANG, $plr;
     $this->db = PMF_Db::getInstance();
     $this->language = PMF_Language::$language;
     $this->type = $DB['type'];
     $this->pmf_lang = $PMF_LANG;
     $this->plr = $plr;
 }
예제 #4
0
파일: Sitemap.php 프로젝트: noon/phpMyFAQ
 /**
  * Constructor
  *
  * @param  integer $user     User
  * @param  array   $groups   Groupss
  * @since  2007-03-30
  * @author Thorsten Rinne <*****@*****.**>
  */
 public function __construct($user = null, $groups = null)
 {
     global $DB, $faqconfig;
     $this->db = PMF_Db::getInstance();
     $this->language = PMF_Language::$language;
     $this->type = $DB['type'];
     if (is_null($user)) {
         $this->user = -1;
     } else {
         $this->user = $user;
     }
     if (is_null($groups)) {
         $this->groups = array(-1);
     } else {
         $this->groups = $groups;
     }
     if ($faqconfig->get('main.permLevel') == 'medium') {
         $this->groupSupport = true;
     }
 }
예제 #5
0
파일: Utils.php 프로젝트: jr-ewing/phpMyFAQ
 /**
  * Returns an array of country codes for a specific FAQ record ID, 
  * specific category ID or all languages used by FAQ records , categories
  *
  * @param  integer $id    ID
  * @param  string  $table Specifies table
  * @return array
  */
 public static function languageAvailable($id, $table = 'faqdata')
 {
     $db = PMF_Db::getInstance();
     $output = array();
     if (isset($id)) {
         if ($id == 0) {
             // get languages for all ids
             $distinct = ' DISTINCT ';
             $where = '';
         } else {
             // get languages for specified id
             $distinct = '';
             $where = " WHERE id = " . $id;
         }
         $query = sprintf("\n                SELECT %s\n                    lang\n                FROM\n                    %s%s\n                %s", $distinct, SQLPREFIX, $table, $where);
         $result = $db->query($query);
         if ($db->numRows($result) > 0) {
             while ($row = $db->fetchObject($result)) {
                 $output[] = $row->lang;
             }
         }
     }
     return $output;
 }
예제 #6
0
파일: Stopwords.php 프로젝트: noon/phpMyFAQ
 /**
  * Constructor
  */
 private function __construct()
 {
     $this->db = PMF_Db::getInstance();
     $this->language = PMF_Language::$language;
     $this->table_name = SQLPREFIX . "faqstopwords";
 }
예제 #7
0
파일: Perm.php 프로젝트: jr-ewing/phpMyFAQ
 /**
  * Constructor
  *
  * @return void
  */
 protected function __construct()
 {
     $this->db = PMF_Db::getInstance();
 }
예제 #8
0
파일: Search.php 프로젝트: nosch/phpMyFAQ
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     $this->db = PMF_Db::getInstance();
     $this->language = PMF_Language::$language;
     $this->_table = SQLPREFIX . 'faqsearches';
 }
예제 #9
0
파일: functions.php 프로젝트: noon/phpMyFAQ
/**
 * Administrator logging
 *
 * @param   string
 * @return  void
 * @access  public
 * @since   2001-02-18
 * @author  Bastian Poettner <*****@*****.**>
 * @author  Thorsten Rinne <*****@*****.**>
 */
function adminlog($text)
{
    global $auth, $user;
    $faqconfig = PMF_Configuration::getInstance();
    $db = PMF_Db::getInstance();
    if ($faqconfig->get('main.enableAdminLog') && $auth && isset($user)) {
        $query = sprintf('INSERT INTO
                    %sfaqadminlog
                    (id, time, usr, text, ip)
                VALUES (%d, %d, %d, %s, %s)', SQLPREFIX, $db->nextID(SQLPREFIX . 'faqadminlog', 'id'), $_SERVER['REQUEST_TIME'], $user->userdata->get('user_id'), "'" . nl2br($text) . "'", "'" . $_SERVER['REMOTE_ADDR'] . "'");
        $db->query($query);
    }
}
예제 #10
0
파일: User.php 프로젝트: atlcurling/tkt
 /**
  * Constructor
  *
  * @param  PMF_Perm $perm Permission object
  * @param  array         $auth Authorization array
  * @return void
  */
 public function __construct(PMF_Perm $perm = null, array $auth = array())
 {
     $this->db = PMF_Db::getInstance();
     if ($perm !== null) {
         if (!$this->addPerm($perm)) {
             return false;
         }
     } else {
         $permLevel = PMF_Configuration::getInstance()->get('security.permLevel');
         $perm = PMF_Perm::selectPerm($permLevel);
         if (!$this->addPerm($perm)) {
             return false;
         }
     }
     // authentication objects
     // always make a 'local' $auth object (see: $auth_data)
     $this->auth_container = array();
     $authLocal = PMF_Auth::selectAuth($this->auth_data['authSource']['name']);
     $authLocal->selectEncType($this->auth_data['encType']);
     $authLocal->setReadOnly($this->auth_data['readOnly']);
     if (!$this->addAuth($authLocal, $this->auth_data['authSource']['type'])) {
         return false;
     }
     // additionally, set given $auth objects
     if (count($auth) > 0) {
         foreach ($auth as $name => $auth_object) {
             if (!$this->addAuth($auth_object, $name)) {
                 break;
             }
         }
     }
     // user data object
     $this->userdata = new PMF_User_UserData();
 }
예제 #11
0
파일: Faq.php 프로젝트: noon/phpMyFAQ
 /**
  * Constructor
  *
  * @param  integer $user   User
  * @param  array   $groups Groups
  * @return void
  */
 public function __construct($user = null, $groups = null)
 {
     global $PMF_LANG, $plr;
     $this->db = PMF_Db::getInstance();
     $this->language = PMF_Language::$language;
     $this->pmf_lang = $PMF_LANG;
     $this->plr = $plr;
     if (is_null($user)) {
         $this->user = -1;
     } else {
         $this->user = $user;
     }
     if (is_null($groups)) {
         $this->groups = array(-1);
     } else {
         $this->groups = $groups;
     }
     $faqconfig = PMF_Configuration::getInstance();
     if ($faqconfig->get('main.permLevel') == 'medium') {
         $this->groupSupport = true;
     }
 }
예제 #12
0
파일: Export.php 프로젝트: noon/phpMyFAQ
 /**
  * Wrapper for the PMF_Export_Docbook class
  * 
  */
 private static function _generateDocBookExport2()
 {
     // TODO: check/refine/improve/fix docbook.php and add toString method before recoding the method in order to use faq and news classes.
     global $PMF_CONF, $PMF_LANG;
     // XML DocBook export
     $parentID = 0;
     $rubrik = 0;
     $sql = '';
     $selectString = '';
     $db = PMF_Db::getInstance();
     $export = new PMF_Export_Docbook();
     $export->delete_file();
     // Set the FAQ title
     $faqtitel = PMF_String::htmlspecialchars($PMF_CONF['main.titleFAQ']);
     // Print the title of the FAQ
     $export->xmlContent = '<?xml version="1.0" encoding="' . $PMF_LANG['metaCharset'] . '"?>' . '<book lang="en">' . '<title>phpMyFAQ</title>' . '<bookinfo>' . '<title>' . $faqtitel . '</title>' . '</bookinfo>';
     // include the news
     $result = $db->query("SELECT id, header, artikel, datum FROM " . SQLPREFIX . "faqnews");
     // Write XML file
     $export->write_file();
     // Transformation of the news entries
     if ($db->num_rows($result) > 0) {
         $export->xmlContent .= '<part><title>News</title>';
         while ($row = $db->fetch_object($result)) {
             $datum = $export->aktually_date($row->datum);
             $export->xmlContent .= '<article>' . '<title>' . $row->header . '</title>' . '<para>' . wordwrap($datum, 20) . '</para>';
             $replacedString = ltrim(str_replace('<br />', '', $row->artikel));
             $export->TableImageText($replacedString);
             $export->xmlContent .= '</article>';
         }
         $export->xmlContent .= '</part>';
     }
     $export->write_file();
     // Transformation of the articles
     $export->xmlContent .= '<part>' . '<title>Artikel</title>' . '<preface>' . '<title>Rubriken</title>';
     // Selection of the categories
     $export->recursive_category($parentID);
     $export->xmlContent .= '</preface>' . '</part>' . '</book>';
     $export->write_file();
 }
예제 #13
0
파일: Captcha.php 프로젝트: noon/phpMyFAQ
 /**
  * Constructor
  *
  * @param   string  $sids      Session ID
  * @param   integer $caplength Length of captch code
  * @return  void
  */
 public function __construct($sids, $caplength = 6)
 {
     $this->db = PMF_Db::getInstance();
     $this->language = PMF_Language::$language;
     if ($sids > 0) {
         $this->sids = $sids;
     } else {
         $this->sids = '';
     }
     $this->userAgent = $_SERVER['HTTP_USER_AGENT'];
     $this->ip = $_SERVER['REMOTE_ADDR'];
     $this->caplength = $caplength;
     $this->letters = array('1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
     $this->code = '';
     $this->quality = 60;
     $this->fonts = $this->getFonts();
     $this->width = 200;
     $this->height = 40;
     $this->timestamp = $_SERVER['REQUEST_TIME'];
 }
예제 #14
0
파일: Category.php 프로젝트: atlcurling/tkt
 /**
  * Constructor
  *
  * @param  integer $user     User
  * @param  array   $groups   Group
  * @param  boolean $withperm With or without permission check
  * @return void
  */
 public function __construct($user = null, $groups = null, $withperm = true)
 {
     $this->language = PMF_Language::$language;
     $this->db = PMF_Db::getInstance();
     $this->categories = array();
     if (is_null($user)) {
         $this->user = -1;
     } else {
         $this->user = $user;
     }
     if (is_null($groups)) {
         $this->groups = array(-1);
     } else {
         $this->groups = $groups;
     }
     $this->lineTab = $this->getOrderedCategories($withperm);
     for ($i = 0; $i < count($this->lineTab); $i++) {
         $this->lineTab[$i]['level'] = $this->levelOf($this->lineTab[$i]['id']);
     }
 }
예제 #15
0
파일: Abstract.php 프로젝트: atlcurling/tkt
 /**
  * Constructor
  * 
  * @param integer $id attachment id
  * 
  * @return null
  */
 public function __construct($id = null)
 {
     $this->db = PMF_Db::getInstance();
     if (null !== $id) {
         $this->id = $id;
         $this->getMeta();
     }
 }
예제 #16
0
파일: Visits.php 프로젝트: noon/phpMyFAQ
 /**
  * Constructor
  * 
  * @return void
  */
 private function __construct()
 {
     $this->db = PMF_Db::getInstance();
     $this->language = PMF_Language::$language;
 }
예제 #17
0
파일: AuthDb.php 프로젝트: atlcurling/tkt
 /**
  * Constructor
  *
  * @param  string  $enctype   Type of encoding
  * @param  boolean $read_only Readonly?
  * @return void
  */
 function __construct($enctype = 'none', $read_only = false)
 {
     parent::__construct($enctype, $read_only);
     $this->db = PMF_Db::getInstance();
 }
예제 #18
0
 /**
  * Constructor
  *
  * @param  string $user User
  */
 public function __construct($user = null)
 {
     global $PMF_LANG;
     $this->db = PMF_Db::getInstance();
     $this->user = $user;
     if (!@extension_loaded('openssl')) {
         // PHP 4.3.0+: fsockopen needs OpenSSL
         $this->addIgnoreProtocol("https:", sprintf($PMF_LANG['ad_linkcheck_protocol_unsupported'], "https"));
     }
     $this->addIgnoreProtocol("ftp:", sprintf($PMF_LANG['ad_linkcheck_protocol_unsupported'], "ftp"));
     $this->addIgnoreProtocol("gopher:", sprintf($PMF_LANG['ad_linkcheck_protocol_unsupported'], "gopher"));
     $this->addIgnoreProtocol("mailto:", sprintf($PMF_LANG['ad_linkcheck_protocol_unsupported'], "mailto"));
     $this->addIgnoreProtocol("telnet:", sprintf($PMF_LANG['ad_linkcheck_protocol_unsupported'], "telnet"));
     $this->addIgnoreProtocol("feed:", sprintf($PMF_LANG['ad_linkcheck_protocol_unsupported'], "feed"));
     // Hack: these below are not real scheme for defining protocols like the ones above
     $this->addIgnoreProtocol("file:", sprintf($PMF_LANG['ad_linkcheck_protocol_unsupported'], "file"));
     $this->addIgnoreProtocol("javascript:", sprintf($PMF_LANG['ad_linkcheck_protocol_unsupported'], "javascript"));
     // load list of URLs to ignore / fail
     $this->loadConfigurationFromDB();
 }
예제 #19
0
/**
 * This function builds the the queries for the backup
 *
 * @param    string      query
 * @param    string      table name
 * @return   array
 * @access   public
 * @author   Meikel Katzengreis <*****@*****.**>
 * @author   Thorsten Rinne <*****@*****.**>
 * @since    2003-03-24
 */
function build_insert($query, $table)
{
    $db = PMF_Db::getInstance();
    if (!($result = $db->query($query))) {
        return;
    }
    $ret = array();
    $ret[] = "\r\n-- Table: " . $table;
    while ($row = $db->fetch_assoc($result)) {
        $p1 = array();
        $p2 = array();
        foreach ($row as $key => $val) {
            $p1[] = $key;
            if ('rights' != $key && is_numeric($val)) {
                $p2[] = $val;
            } else {
                if (is_null($val)) {
                    $p2[] = 'NULL';
                } else {
                    $p2[] = sprintf("'%s'", $db->escape_string($val));
                }
            }
        }
        $ret[] = "INSERT INTO " . $table . " (" . implode(",", $p1) . ") VALUES (" . implode(",", $p2) . ");";
    }
    return $ret;
}
예제 #20
0
 /**
  * Fetch all record attachments
  * 
  * @param integer $recordId ID of the record
  * 
  * @return array
  */
 public static function fetchByRecordId($recordId)
 {
     $retval = array();
     $db = PMF_Db::getInstance();
     $sql = sprintf("\n            SELECT\n                id\n            FROM \n                %sfaqattachment\n            WHERE \n                record_id = %d\n            AND\n                record_lang = '%s'", SQLPREFIX, $recordId, PMF_Language::$language);
     $result = $db->fetchAll($db->query($sql));
     if ($result) {
         foreach ($result as $item) {
             $retval[] = self::create($item->id);
         }
     }
     reset($retval);
     return $retval;
 }
예제 #21
0
 /**
  * Constructor
  * 
  * @return null
  */
 public function __construct()
 {
     $this->db = PMF_Db::getInstance();
 }