/**
 * @param  XoopsObject $module
 * @return bool
 */
function xoops_module_install_about(XoopsObject $module)
{
    $data_file = XOOPS_ROOT_PATH . '/modules/about/sql/mysql.about.sql';
    $GLOBALS['xoopsDB']->queryF('SET NAMES utf8');
    if (!$GLOBALS['xoopsDB']->queryFromFile($data_file)) {
        $module->setErrors('Pre-set data were not installed');
        return true;
    }
    return true;
}
Beispiel #2
0
 function xhelpReport()
 {
     parent::init();
     $this->initVar('results', XOBJ_DTYPE_ARRAY, null, false);
     $this->initVar('hasResults', XOBJ_DTYPE_INT, 0, false);
     $this->initVar('hasGraph', XOBJ_DTYPE_INT, 0, false);
 }
Beispiel #3
0
 public function getValues($keys = null, $format = null, $maxDepth = null)
 {
     $ret = parent::getValues($keys, $format, $maxDepth);
     $ret['navigation'] = Xoops_Locale::translate('L_RELATED_NAVIGATION_OPTION' . $this->getVar('related_navigation'), 'page');
     $ret['related_links'] = Page::getInstance()->getLinkHandler()->getLinks($this->getVar('related_id'));
     return $ret;
 }
 /**
  * @param      $ctable
  * @param null|array $id
  */
 public function __construct($ctable, $id = null)
 {
     $this->ctable = $ctable;
     $this->db = XoopsDatabaseFactory::getDatabaseConnection();
     parent::__construct();
     $this->initVar('comment_id', XOBJ_DTYPE_INT, null, false);
     $this->initVar('item_id', XOBJ_DTYPE_INT, null, false);
     $this->initVar('order', XOBJ_DTYPE_INT, null, false);
     $this->initVar('mode', XOBJ_DTYPE_OTHER, null, false);
     $this->initVar('subject', XOBJ_DTYPE_TXTBOX, null, false, 255);
     $this->initVar('comment', XOBJ_DTYPE_TXTAREA, null, false, null);
     $this->initVar('ip', XOBJ_DTYPE_OTHER, null, false);
     $this->initVar('pid', XOBJ_DTYPE_INT, 0, false);
     $this->initVar('date', XOBJ_DTYPE_INT, null, false);
     $this->initVar('nohtml', XOBJ_DTYPE_INT, 1, false);
     $this->initVar('nosmiley', XOBJ_DTYPE_INT, 0, false);
     $this->initVar('noxcode', XOBJ_DTYPE_INT, 0, false);
     $this->initVar('user_id', XOBJ_DTYPE_INT, null, false);
     $this->initVar('icon', XOBJ_DTYPE_OTHER, null, false);
     $this->initVar('prefix', XOBJ_DTYPE_OTHER, null, false);
     if (!empty($id)) {
         if (is_array($id)) {
             $this->assignVars($id);
         } else {
             $this->load((int) $id);
         }
     }
 }
Beispiel #5
0
 /**
  *
  */
 function __construct()
 {
     parent::__construct();
     $this->initVar('id', XOBJ_DTYPE_INT, null, false, 5);
     $this->initVar('code', XOBJ_DTYPE_TXTBOX, null, false);
     $this->initVar('smile_url', XOBJ_DTYPE_TXTBOX, null, false);
     $this->initVar('emotion', XOBJ_DTYPE_TXTBOX, null, false);
     $this->initVar('display', XOBJ_DTYPE_INT, null, false, 1);
 }
 function __construct()
 {
     parent::__construct();
     $this->initVar('rank_id', XOBJ_DTYPE_INT, null, false, 5);
     $this->initVar('rank_title', XOBJ_DTYPE_TXTBOX, null, false);
     $this->initVar('rank_min', XOBJ_DTYPE_INT, null, false, 8);
     $this->initVar('rank_max', XOBJ_DTYPE_INT, null, false, 8);
     $this->initVar('rank_special', XOBJ_DTYPE_INT, null, false, 1);
     $this->initVar('rank_image', XOBJ_DTYPE_TXTBOX, null, false);
 }
Beispiel #7
0
 function getVar($key, $format = 's')
 {
     $value = parent::getVar($key, $format);
     if ($key == 'field_options' && !empty($value)) {
         foreach (array_keys($value) as $idx) {
             $value[$idx] = base64_decode($value[$idx]);
         }
     }
     return $value;
 }
Beispiel #8
0
 /**
  *
  */
 function __construct()
 {
     parent::__construct();
     $this->initVar('bid', XOBJ_DTYPE_INT, null, false, 5);
     $this->initVar('cid', XOBJ_DTYPE_INT, null, false, 5);
     $this->initVar('impressions', XOBJ_DTYPE_INT, null, false, 8);
     $this->initVar('clicks', XOBJ_DTYPE_INT, null, false, 8);
     $this->initVar('datestart', XOBJ_DTYPE_INT, null, false, 10);
     $this->initVar('dateend', XOBJ_DTYPE_INT, null, false, 10);
 }
Beispiel #9
0
 function __construct()
 {
     parent::__construct();
     $this->initVar("id", XOBJ_DTYPE_INT, null, false);
     $this->initVar("title", XOBJ_DTYPE_TXTBOX, '');
     $this->initVar("created", XOBJ_DTYPE_INT, time());
     $this->initVar("updated", XOBJ_DTYPE_INT, time());
     $this->initVar("uid", XOBJ_DTYPE_INT, 0);
     $this->initVar("url", XOBJ_DTYPE_TXTBOX, '');
 }
 function __construct()
 {
     parent::__construct();
     $this->initVar('cid', XOBJ_DTYPE_INT, null, false, 5);
     $this->initVar('name', XOBJ_DTYPE_TXTBOX, null, false);
     $this->initVar('contact', XOBJ_DTYPE_TXTBOX, null, false);
     $this->initVar('email', XOBJ_DTYPE_TXTBOX, null, false);
     $this->initVar('login', XOBJ_DTYPE_TXTBOX, null, false);
     $this->initVar('passwd', XOBJ_DTYPE_TXTBOX, null, false);
     $this->initVar('extrainfo', XOBJ_DTYPE_TXTAREA, null, false);
     // For allow HTML
     //$this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false);
 }
Beispiel #11
0
 /**
  *
  */
 function __construct()
 {
     parent::__construct();
     $this->initVar('bid', XOBJ_DTYPE_INT, null, false, 5);
     $this->initVar('cid', XOBJ_DTYPE_INT, null, false, 3);
     $this->initVar('imptotal', XOBJ_DTYPE_INT, null, false, 8);
     $this->initVar('impmade', XOBJ_DTYPE_INT, null, false, 8);
     $this->initVar('clicks', XOBJ_DTYPE_INT, null, false, 8);
     $this->initVar('imageurl', XOBJ_DTYPE_TXTBOX, null, false);
     $this->initVar('clickurl', XOBJ_DTYPE_TXTBOX, null, false);
     $this->initVar('date', XOBJ_DTYPE_INT, null, false, 10);
     $this->initVar('htmlbanner', XOBJ_DTYPE_INT, null, false, 1);
     $this->initVar('htmlcode', XOBJ_DTYPE_TXTBOX, null, false);
     // For allow HTML
     //$this->initVar( 'dohtml', XOBJ_DTYPE_INT, 1, false);
 }
Beispiel #12
0
 /**
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->initVar('msg_id', XOBJ_DTYPE_INT, null, false);
     $this->initVar('msg_image', XOBJ_DTYPE_OTHER, 'icon1.gif', false, 100);
     $this->initVar('subject', XOBJ_DTYPE_TXTBOX, null, true, 255);
     $this->initVar('from_userid', XOBJ_DTYPE_INT, null, true);
     $this->initVar('to_userid', XOBJ_DTYPE_INT, null, true);
     $this->initVar('msg_time', XOBJ_DTYPE_INT, time(), false);
     $this->initVar('msg_text', XOBJ_DTYPE_TXTAREA, null, true);
     $this->initVar('read_msg', XOBJ_DTYPE_INT, 0, false);
     $this->initVar('from_delete', XOBJ_DTYPE_INT, 1, false);
     $this->initVar('to_delete', XOBJ_DTYPE_INT, 0, false);
     $this->initVar('from_save', XOBJ_DTYPE_INT, 0, false);
     $this->initVar('to_save', XOBJ_DTYPE_INT, 0, false);
 }
Beispiel #13
0
 /**
  * PresenterCategories constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $this->initVar('cat_id', XOBJ_DTYPE_INT);
     $this->initVar('cat_pid', XOBJ_DTYPE_INT);
     $this->initVar('cat_title', XOBJ_DTYPE_TXTBOX);
     $this->initVar('cat_desc', XOBJ_DTYPE_TXTAREA);
     $this->initVar('cat_image', XOBJ_DTYPE_TXTBOX);
     $this->initVar('cat_weight', XOBJ_DTYPE_INT);
     //      $this->initVar('cat_color', XOBJ_DTYPE_TXTBOX);
     $this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false);
     $this->initVar('dosmiley', XOBJ_DTYPE_INT, 1, false);
     $this->initVar('doxcode', XOBJ_DTYPE_INT, 1, false);
     $this->initVar('doimage', XOBJ_DTYPE_INT, 1, false);
     $this->initVar('dobr', XOBJ_DTYPE_INT, 1, false);
 }
Beispiel #14
0
 function cleanVars()
 {
     if (!parent::cleanVars()) {
         return false;
     }
     // The following validation code doesn't have this class,
     // because the validation code accesses handlers.
     // But, this follows traditional architecture of XOOPS2.
     $gHandler = xoops_gethandler('group');
     $group =& $gHandler->get($this->get('gperm_groupid'));
     if (!is_object($group)) {
         return false;
     }
     $mHandler = xoops_gethandler('module');
     if ($this->get('gperm_modid') != 1) {
         $module =& $mHandler->get($this->get('gperm_modid'));
         if (!is_object($module)) {
             return false;
         }
     }
     if ($this->get('gperm_name') == GROUPPERM_VAL_MODREAD || $this->get('gperm_name') == GROUPPERM_VAL_MODADMIN) {
         $mHandler = xoops_gethandler('module');
         $module =& $mHandler->get($this->get('gperm_itemid'));
         if (!is_object($module)) {
             return false;
         }
     } else {
         if ($this->get('gperm_name') == GROUPPERM_VAL_BLOCKREAD) {
             $bHandler = xoops_gethandler('block');
             $block =& $bHandler->get($this->get('gperm_itemid'));
             if (!is_object($block)) {
                 return false;
             }
         }
     }
     return true;
 }
Beispiel #15
0
 /**
  * PresenterSlides constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $this->initVar('slides_id', XOBJ_DTYPE_INT);
     $this->initVar('slides_cid', XOBJ_DTYPE_INT);
     $this->initVar('slides_uid', XOBJ_DTYPE_INT);
     $this->initVar('slides_title', XOBJ_DTYPE_TXTBOX);
     $this->initVar('slides_content', XOBJ_DTYPE_TXTAREA);
     $this->initVar('css_id', XOBJ_DTYPE_TXTBOX);
     $this->initVar('css_class', XOBJ_DTYPE_TXTBOX);
     $this->initVar('slides_transition_x', XOBJ_DTYPE_TXTBOX);
     $this->initVar('slides_transition_y', XOBJ_DTYPE_TXTBOX);
     $this->initVar('slides_transition_z', XOBJ_DTYPE_TXTBOX);
     $this->initVar('slides_rotation_x', XOBJ_DTYPE_TXTBOX);
     $this->initVar('slides_rotation_y', XOBJ_DTYPE_TXTBOX);
     $this->initVar('slides_rotation_z', XOBJ_DTYPE_TXTBOX);
     $this->initVar('slides_scale_x', XOBJ_DTYPE_TXTBOX);
     $this->initVar('slides_scale_y', XOBJ_DTYPE_TXTBOX);
     $this->initVar('slides_scale_z', XOBJ_DTYPE_TXTBOX);
     $this->initVar('slides_created', XOBJ_DTYPE_LTIME);
     $this->initVar('slides_published', XOBJ_DTYPE_LTIME);
     $this->initVar('slides_position', XOBJ_DTYPE_INT);
     $this->initVar('slides_online', XOBJ_DTYPE_INT);
     $this->initVar('slides_type', XOBJ_DTYPE_INT);
     $this->initVar('slides_notes', XOBJ_DTYPE_TXTAREA);
     $this->initVar('slides_mp3', XOBJ_DTYPE_TXTBOX);
     $this->initVar('slides_time', XOBJ_DTYPE_INT);
     $this->initVar('slides_status', XOBJ_DTYPE_INT);
     $this->initVar('slides_waiting', XOBJ_DTYPE_INT);
     $this->initVar('slides_online', XOBJ_DTYPE_INT);
     $this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false);
     $this->initVar('dosmiley', XOBJ_DTYPE_INT, 1, false);
     $this->initVar('doxcode', XOBJ_DTYPE_INT, 1, false);
     $this->initVar('doimage', XOBJ_DTYPE_INT, 1, false);
     $this->initVar('dobr', XOBJ_DTYPE_INT, 1, false);
 }
 /**
  * Store a {@link XoopsConfigCategory}
  *
  * @param XoopsObject|XoopsConfigCategory $confcat a XoopsConfigCategory object
  *
  * @return bool true on success, otherwise false
  */
 public function insert(XoopsObject $confcat)
 {
     $className = 'XoopsConfigCategory';
     if (!$confcat instanceof $className) {
         return false;
     }
     if (!$confcat->isDirty()) {
         return true;
     }
     if (!$confcat->cleanVars()) {
         return false;
     }
     foreach ($confcat->cleanVars as $k => $v) {
         ${$k} = $v;
     }
     if ($confcat->isNew()) {
         $confcat_id = $this->db->genId('configcategory_confcat_id_seq');
         $sql = sprintf('INSERT INTO %s (confcat_id, confcat_name, confcat_order) VALUES (%u, %s, %u)', $this->db->prefix('configcategory'), $confcat_id, $this->db->quoteString($confcat_name), $confcat_order);
     } else {
         $sql = sprintf('UPDATE %s SET confcat_name = %s, confcat_order = %u WHERE confcat_id = %u', $this->db->prefix('configcategory'), $this->db->quoteString($confcat_name), $confcat_order, $confcat_id);
     }
     if (!($result = $this->db->query($sql))) {
         return false;
     }
     if (empty($confcat_id)) {
         $confcat_id = $this->db->getInsertId();
     }
     $confcat->assignVar('confcat_id', $confcat_id);
     return $confcat_id;
 }
Beispiel #17
0
 /**
  * assign a value to a variable
  * 
  * @access public
  * @param string $key name of the variable to assign
  * @param mixed $value value to assign
  * @param bool $not_gpc
  */
 function setVar($key, $value, $not_gpc = false)
 {
     $uservars = array_keys($this->getVars());
     if (!in_array($key, $uservars)) {
         return $this->_profile->setVar($key, $value, $not_gpc);
     }
     return parent::setVar($key, $value, $not_gpc);
 }
Beispiel #18
0
 public function getVar($key, $format = 's')
 {
     $return_value = parent::getVar($key, $format);
     if (XOBJ_DTYPE_ARRAY == $this->vars[$key]['data_type'] && !is_array($return_value)) {
         // now it's an array
         $return_value = array();
     }
     return $return_value;
 }
Beispiel #19
0
 /**
  * Delete an image from the database
  *
  * @param  XoopsObject|XoopsImage $image a XoopsImage object
  *
  * @return bool true on success, otherwise false
  **/
 public function delete(XoopsObject $image)
 {
     $className = 'XoopsImage';
     if (!$image instanceof $className) {
         return false;
     }
     $id = $image->getVar('image_id');
     $sql = sprintf('DELETE FROM %s WHERE image_id = %u', $this->db->prefix('image'), $id);
     if (!($result = $this->db->query($sql))) {
         return false;
     }
     $sql = sprintf('DELETE FROM %s WHERE image_id = %u', $this->db->prefix('imagebody'), $id);
     $this->db->query($sql);
     return true;
 }
Beispiel #20
0
 /**
  * Delete from the database
  * @param  XoopsPrivmessage $pm {@link XoopsPrivmessage} object
  * @return bool
  **/
 public function delete(XoopsObject $pm)
 {
     $className = 'XoopsPrivmessage';
     if (!$pm instanceof $className) {
         return false;
     }
     if (!($result = $this->db->query(sprintf('DELETE FROM %s WHERE msg_id = %u', $this->db->prefix('priv_msgs'), $pm->getVar('msg_id'))))) {
         return false;
     }
     return true;
 }
Beispiel #21
0
 /**
  * Delete a {@link XoopsConfigOption}
  *
  * @param XoopsObject|XoopsConfigOption $confoption a XoopsConfigOption object
  *
  * @return bool true on success, otherwise false
  */
 public function delete(XoopsObject $confoption)
 {
     $className = 'XoopsConfigOption';
     if (!$confoption instanceof $className) {
         return false;
     }
     $sql = sprintf('DELETE FROM %s WHERE confop_id = %u', $this->db->prefix('configoption'), $confoption->getVar('confop_id'));
     if (!($result = $this->db->query($sql))) {
         return false;
     }
     return true;
 }
Beispiel #22
0
 public function toArray()
 {
     $ret = parent::getValues();
     unset($ret['dohtml']);
     return $ret;
 }
Beispiel #23
0
 /**
  * inserts a membership in the database
  *
  * @param  XoopsObject|XoopsMembership $mship a XoopsMembership object
  *
  * @return bool true on success, otherwise false
  */
 public function insert(XoopsObject $mship)
 {
     $className = 'XoopsMembership';
     if (!$mship instanceof $className) {
         return false;
     }
     if (!$mship->isDirty()) {
         return true;
     }
     if (!$mship->cleanVars()) {
         return false;
     }
     foreach ($mship->cleanVars as $k => $v) {
         ${$k} = $v;
     }
     if ($mship->isNew()) {
         $linkid = $this->db->genId('groups_users_link_linkid_seq');
         $sql = sprintf('INSERT INTO %s (linkid, groupid, uid) VALUES (%u, %u, %u)', $this->db->prefix('groups_users_link'), $linkid, $groupid, $uid);
     } else {
         $sql = sprintf('UPDATE %s SET groupid = %u, uid = %u WHERE linkid = %u', $this->db->prefix('groups_users_link'), $groupid, $uid, $linkid);
     }
     if (!($result = $this->db->query($sql))) {
         return false;
     }
     if (empty($linkid)) {
         $linkid = $this->db->getInsertId();
     }
     $mship->assignVar('linkid', $linkid);
     return true;
 }
 /**
  * add an error and error code
  *
  * @param string $err_code error code to add
  * @param string $err_str  error to add
  * @access public
  */
 function setErrors($err_code, $err_str)
 {
     $this->_error_codes[] = $err_code;
     parent::setErrors($err_str);
 }
 function cleanVars()
 {
     $iret = parent::cleanVars();
     foreach ($this->vars as $k => $v) {
         $cleanv = $v['value'];
         if (!$v['changed']) {
         } else {
             $cleanv = is_string($cleanv) ? trim($cleanv) : $cleanv;
             switch ($v['data_type']) {
                 case XOBJ_DTYPE_FLOAT:
                     $cleanv = (double) $cleanv;
                     break;
                 default:
                     break;
             }
             //個別の変数チェックがあれば実行;
             $checkMethod = 'checkVar_' . $k;
             if (method_exists($this, $checkMethod)) {
                 $this->{$checkMethod}($cleanv);
             }
         }
         $this->cleanVars[$k] =& $cleanv;
         unset($cleanv);
     }
     if (count($this->_errors) > 0) {
         return false;
     }
     $this->unsetDirty();
     return true;
 }
Beispiel #26
0
 /**
  * Delete an image from the database
  *
  * @param  XoopsObject|XoopsImageSetImg $imgsetimg a XoopsImageSet object
  *
  * @return bool true on success, otherwise false
  **/
 public function delete(XoopsObject $imgsetimg)
 {
     $className = 'XoopsImageSetImg';
     if (!$imgsetimg instanceof $className) {
         return false;
     }
     $sql = sprintf('DELETE FROM %s WHERE imgsetimg_id = %u', $this->db->prefix('imgsetimg'), $imgsetimg->getVar('imgsetimg_id'));
     if (!($result = $this->db->query($sql))) {
         return false;
     }
     return true;
 }
 /**
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->initVar('block_id', XOBJ_DTYPE_INT);
     $this->initVar('module_id', XOBJ_DTYPE_INT);
 }
 /**
  * Compare two objects and returns, in an array, the differences
  *
  * @param  XoopsObject $old_object The first object to compare
  * @param  XoopsObject $new_object The new object
  * @return array       differences    key = fieldname, value = array('old_value', 'new_value')
  */
 function compareObjects($old_object, $new_object)
 {
     $ret = array();
     $vars_name = array_keys($old_object->getVars());
     foreach ($vars_name as $one_var) {
         if ($old_object->getVar($one_var, 'f') == $new_object->getVar($one_var, 'f')) {
         } else {
             $ret[$one_var] = array($old_object->getVar($one_var), $new_object->getVar($one_var));
         }
     }
     return $ret;
 }
Beispiel #29
0
 /**
  * delete a block from the database
  *
  * @param XoopsObject|XoopsBlock $block a XoopsBlock object
  *
  * @return bool true on success, otherwise false
  */
 public function delete(XoopsObject $block)
 {
     $className = 'XoopsBlock';
     if (!$block instanceof $className) {
         return false;
     }
     $id = $block->getVar('bid');
     $sql = sprintf('DELETE FROM %s WHERE bid = %u', $this->db->prefix('newblocks'), $id);
     if (!($result = $this->db->query($sql))) {
         return false;
     }
     $sql = sprintf('DELETE FROM %s WHERE block_id = %u', $this->db->prefix('block_module_link'), $id);
     $this->db->query($sql);
     return true;
 }
Beispiel #30
0
 /**
  * Delete a {@link XoopsGroupPerm}
  *
  * @param XoopsObject|XoopsGroupPerm $perm a XoopsGroupPerm object
  *
  * @return bool true on success, otherwise false
  */
 public function delete(XoopsObject $perm)
 {
     $className = 'XoopsGroupPerm';
     if (!$perm instanceof $className) {
         return false;
     }
     $sql = sprintf('DELETE FROM %s WHERE gperm_id = %u', $this->db->prefix('group_permission'), $perm->getVar('gperm_id'));
     if (!($result = $this->db->query($sql))) {
         return false;
     }
     return true;
 }