Exemplo n.º 1
0
 private function save_metas()
 {
     $this->db->queryF("DELETE FROM " . $this->db->prefix("rd_meta") . " WHERE section='" . $this->id() . "'");
     if (empty($this->metas)) {
         return true;
     }
     $sql = "INSERT INTO " . $this->db->prefix("rd_meta") . " (`name`,`value`,`section`,`edit`) VALUES ";
     $values = '';
     foreach ($this->metas as $name => $value) {
         if (is_array($value)) {
             $value = $value['value'];
         }
         $values .= ($values == '' ? '' : ',') . "('" . MyTextSanitizer::addSlashes($name) . "','" . MyTextSanitizer::addSlashes($value) . "','" . $this->getVar('id_sec') . "','1')";
     }
     if ($this->db->queryF($sql . $values)) {
         return true;
     } else {
         $this->addError($this->db->error());
         return false;
     }
 }
Exemplo n.º 2
0
 function __construct($id = '')
 {
     $this->db =& XoopsDatabaseFactory::getDatabaseConnection();
     $this->_dbtable = $this->db->prefix("qpages_categos");
     $this->setNew();
     $this->initVarsFromTable();
     if ($id == '') {
         return;
     }
     if (is_numeric($id)) {
         if (!$this->loadValues($id)) {
             return;
         }
     } else {
         $this->primary = 'nombre_amigo';
         if (!$this->loadValues(MyTextSanitizer::addSlashes($id))) {
             return;
         }
     }
     $this->primary = 'id_cat';
     $this->unsetNew();
 }
Exemplo n.º 3
0
/**
* Check if a modules is installed
* @param string Module dirname
* @return bool
*/
function xt_module_installed($dir)
{
    if ($dir == '') {
        return;
    }
    $db = Database::getInstance();
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("modules") . " WHERE dirname='" . MyTextSanitizer::addSlashes($dir) . "'";
    list($num) = $db->fetchRow($db->query($sql));
    if ($num <= 0) {
        return false;
    }
    return true;
}
Exemplo n.º 4
0
 /**
  * Save existing meta
  */
 private function saveMetas()
 {
     $this->db->queryF("DELETE FROM " . $this->db->prefix("qpages_meta") . " WHERE page='" . $this->getID() . "'");
     if (empty($this->metas)) {
         return true;
     }
     $sql = "INSERT INTO " . $this->db->prefix("qpages_meta") . " (`name`,`value`,`page`) VALUES ";
     $values = '';
     foreach ($this->metas as $name => $value) {
         $values .= ($values == '' ? '' : ',') . "('" . MyTextSanitizer::addSlashes($name) . "','" . MyTextSanitizer::addSlashes($value) . "','" . $this->getID() . "')";
     }
     if ($this->db->queryF($sql . $values)) {
         return true;
     } else {
         $this->addError($this->db->error());
         return false;
     }
 }