コード例 #1
0
ファイル: tplfile.php プロジェクト: geekwright/XoopsCore25
 /**
  * Update Tplfile, even if a safe transaction (i.e. http get)
  *
  * @param  XoopsTplfile $tplfile
  * @return bool true on success, otherwise false
  */
 public function forceUpdate(XoopsTplfile $tplfile)
 {
     $className = 'XoopsTplfile';
     if (!$tplfile instanceof $className) {
         return false;
     }
     if (!$tplfile->isDirty()) {
         return true;
     }
     if (!$tplfile->cleanVars()) {
         return false;
     }
     foreach ($tplfile->cleanVars as $k => $v) {
         ${$k} = $v;
     }
     if (!$tplfile->isNew()) {
         $sql = sprintf('UPDATE %s SET tpl_tplset = %s, tpl_file = %s, tpl_desc = %s, tpl_lastimported = %u, tpl_lastmodified = %u WHERE tpl_id = %u', $this->db->prefix('tplfile'), $this->db->quoteString($tpl_tplset), $this->db->quoteString($tpl_file), $this->db->quoteString($tpl_desc), $tpl_lastimported, $tpl_lastmodified, $tpl_id);
         if (!($result = $this->db->queryF($sql))) {
             return false;
         }
         if (isset($tpl_source) && $tpl_source != '') {
             $sql = sprintf('UPDATE %s SET tpl_source = %s WHERE tpl_id = %u', $this->db->prefix('tplsource'), $this->db->quoteString($tpl_source), $tpl_id);
             if (!($result = $this->db->queryF($sql))) {
                 return false;
             }
         }
         return true;
     } else {
         return false;
     }
 }
コード例 #2
0
ファイル: tplfile.php プロジェクト: RanLee/XoopsCore
 /**
  * forceUpdate
  *
  * @param XoopsTplfile $tplfile
  *
  * @return bool
  */
 public function forceUpdate(XoopsTplfile &$tplfile)
 {
     if (!$tplfile->isDirty()) {
         return true;
     }
     if (!$tplfile->cleanVars(false)) {
         return false;
     }
     foreach ($tplfile->cleanVars as $k => $v) {
         ${$k} = $v;
     }
     if (!$tplfile->isNew()) {
         $tpl_id = 0;
         $values = array('tpl_module' => $tpl_module, 'tpl_refid' => $tpl_refid, 'tpl_tplset' => $tpl_tplset, 'tpl_file' => $tpl_file, 'tpl_desc' => $tpl_desc, 'tpl_lastmodified' => $tpl_lastmodified, 'tpl_lastimported' => $tpl_lastimported, 'tpl_type' => $tpl_type);
         if (!$this->db2->updatePrefix('tplfile', $values, array('tpl_id' => $tpl_id))) {
             return false;
         }
         if (isset($tpl_source) && $tpl_source != '') {
             $tpl_id = 0;
             $values = array('tpl_source' => $tpl_source);
             if ($this->db2->updatePrefix('tplsource', $values, array('tpl_id' => $tpl_id))) {
                 return false;
             }
         }
         return true;
     } else {
         return false;
     }
 }