Exemple #1
0
/**
 * @brief display error message & exit (Tentative)
 */
function system_users_error($message)
{
    xoops_cp_header();
    xoops_error($message);
    xoops_cp_footer();
    exit;
}
Exemple #2
0
/**
 * @brief display error message & exit (Tentative)
 */
function system_modulesadmin_error($message)
{
    xoops_cp_header();
    xoops_error($message);
    xoops_cp_footer();
    exit;
}
Exemple #3
0
function tellafriend_checkModuleAdmin()
{
    $f = $GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php');
    if (file_exists($f)) {
        include_once $f;
        return true;
    } else {
        echo xoops_error("Error: You don't use the Frameworks \"adminmodule\". Please install this Frameworks");
        return false;
    }
}
Exemple #4
0
 function DefaultCheck()
 {
     if (ini_get('register_globals') == 1) {
         xoops_error(sprintf(_WARNPHPENV, 'register_globals', 'on', _WARNSECURITY), '', 'warning');
     }
     if (is_dir(XOOPS_ROOT_PATH . "/install/")) {
         xoops_error(sprintf(_WARNINSTALL2, XOOPS_ROOT_PATH . '/install/'), '', 'warning');
     }
     if (is_writable(XOOPS_ROOT_PATH . "/mainfile.php")) {
         xoops_error(sprintf(_WARNINWRITEABLE, XOOPS_ROOT_PATH . '/mainfile.php'), '', 'warning');
     }
 }
Exemple #5
0
/** Remove orphan tag-item links **/
function ilog_tag_synchronization($mid)
{
    $item_handler =& xoops_getmodulehandler("article", "ilog");
    $link_handler =& xoops_getmodulehandler("link", "tag");
    /* clear tag-item links */
    if (version_compare(mysql_get_server_info(), "4.1.0", "ge")) {
        $sql = "    DELETE FROM {$link_handler->table}" . "    WHERE " . "        tag_modid = {$mid}" . "        AND " . "        ( tag_itemid NOT IN " . "            ( SELECT DISTINCT {$item_handler->keyName} " . "                FROM {$item_handler->table} " . "                WHERE {$item_handler->table}.time_publish > 0" . "            ) " . "        )";
    } else {
        $sql = "    DELETE {$link_handler->table} FROM {$link_handler->table}" . "    LEFT JOIN {$item_handler->table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler->keyName} " . "    WHERE " . "        tag_modid = {$mid}" . "        AND " . "        ( aa.{$item_handler->keyName} IS NULL" . "            OR aa.time_publish < 1" . "        )";
    }
    if (!($result = $link_handler->db->queryF($sql))) {
        xoops_error($link_handler->db->error());
    }
}
Exemple #6
0
 function sendSpider($spider)
 {
     @$this->CURLSpidersExchange();
     switch (XOOPS_CURL_LIB) {
         case "PHPCURL":
             $sJSON = new Services_JSON();
             curl_setopt($this->curl_client, CURLOPT_POSTFIELDS, 'spider=' . $sJSON->encode(array("username" => $this->curl_xoops_username, "password" => $this->curl_xoops_password, "spider" => $spider)));
             $data = curl_exec($this->curl_client);
             xoops_error($data, 'cURL Result');
             exit(0);
             curl_close($this->curl_client);
             $result = $this->obj2array($sJSON->decode($data));
             break;
     }
     return $result;
 }
function waiting_del($id, $redir = null)
{
    if (!$GLOBALS['xoopsSecurity']->check()) {
        redirect_header('admin_waiting.php', 1, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
    }
    if ($id <= 0) {
        redirect_header('admin_waiting.php', 1);
    }
    $this_handler =& xoops_getModuleHandler('waiting', 'subscribers');
    $obj = $this_handler->get($id);
    if (!is_object($obj)) {
        redirect_header('admin_waiting.php', 1);
    }
    if (!$this_handler->delete($obj)) {
        xoops_cp_header();
        xoops_error(_AM_SUBSCRIBERS_ERROR, $obj->getVar('id'));
        xoops_cp_footer();
        exit;
    }
    redirect_header(!is_null($redir) ? base64_decode($redir) : 'admin_waiting.php', 2, _AM_SUBSCRIBERS_SUCCESS);
}
Exemple #8
0
/**
 * @param $module
 *
 * @return bool
 */
function update_wgteams_v10(&$module)
{
    global $xoopsDB;
    $result = $xoopsDB->query('SELECT t1.tpl_id FROM ' . $xoopsDB->prefix('tplfile') . ' t1, ' . $xoopsDB->prefix('tplfile') . ' t2 WHERE t1.tpl_refid = t2.tpl_refid AND t1.tpl_module = t2.tpl_module AND t1.tpl_tplset=t2.tpl_tplset AND t1.tpl_file = t2.tpl_file AND t1.tpl_type = t2.tpl_type AND t1.tpl_id > t2.tpl_id');
    $tplids = array();
    while (false !== (list($tplid) = $xoopsDB->fetchRow($result))) {
        $tplids[] = $tplid;
    }
    if (count($tplids) > 0) {
        $tplfile_handler = xoops_getHandler('tplfile');
        $duplicate_files = $tplfile_handler->getObjects(new Criteria('tpl_id', '(' . implode(',', $tplids) . ')', 'IN'));
        if (count($duplicate_files) > 0) {
            foreach (array_keys($duplicate_files) as $i) {
                $tplfile_handler->delete($duplicate_files[$i]);
            }
        }
    }
    $sql = 'SHOW INDEX FROM ' . $xoopsDB->prefix('tplfile') . " WHERE KEY_NAME = 'tpl_refid_module_set_file_type'";
    if (!($result = $xoopsDB->queryF($sql))) {
        xoops_error($this->db->error() . '<br>' . $sql);
        return false;
    }
    $ret = array();
    while (false !== ($myrow = $xoopsDB->fetchArray($result))) {
        $ret[] = $myrow;
    }
    if (!empty($ret)) {
        $module->setErrors("'tpl_refid_module_set_file_type' unique index is exist. Note: check 'tplfile' table to be sure this index is UNIQUE because XOOPS CORE need it.");
        return true;
    }
    $sql = 'ALTER TABLE ' . $xoopsDB->prefix('tplfile') . ' ADD UNIQUE tpl_refid_module_set_file_type ( tpl_refid, tpl_module, tpl_tplset, tpl_file, tpl_type )';
    if (!($result = $xoopsDB->queryF($sql))) {
        xoops_error($xoopsDB->error() . '<br>' . $sql);
        $module->setErrors("'tpl_refid_module_set_file_type' unique index is not added to 'tplfile' table. Warning: do not use XOOPS until you add this unique index.");
        return false;
    }
    return true;
}
function update_block($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $bmodule, $options = array(), $bgroups = array())
{
    global $xoopsConfig;
    if (empty($bmodule)) {
        xoops_cp_header();
        xoops_error(sprintf(_AM_NOTSELNG, _AM_VISIBLEIN));
        xoops_cp_footer();
        exit;
    }
    $myblock = new XoopsBlock($bid);
    $myblock->setVar('side', $bside);
    $myblock->setVar('weight', $bweight);
    $myblock->setVar('visible', $bvisible);
    $myblock->setVar('title', $btitle);
    $myblock->setVar('content', $bcontent);
    $myblock->setVar('bcachetime', $bcachetime);
    if (isset($options)) {
        $options_count = count($options);
        if ($options_count > 0) {
            //Convert array values to comma-separated
            for ($i = 0; $i < $options_count; $i++) {
                if (is_array($options[$i])) {
                    $options[$i] = implode(',', $options[$i]);
                }
            }
            $options = implode('|', $options);
            $myblock->setVar('options', $options);
        }
    }
    if ($myblock->isCustom()) {
        switch ($bctype) {
            case 'H':
                $name = _AM_CUSTOMHTML;
                break;
            case 'P':
                $name = _AM_CUSTOMPHP;
                break;
            case 'S':
                $name = _AM_CUSTOMSMILE;
                break;
            default:
                $name = _AM_CUSTOMNOSMILE;
                break;
        }
        $myblock->setVar('name', $name);
        $myblock->setVar('c_type', $bctype);
    } else {
        $myblock->setVar('c_type', 'H');
    }
    $msg = _AM_DBUPDATED;
    if ($myblock->store() != false) {
        $db =& Database::getInstance();
        $sql = sprintf("DELETE FROM %s WHERE block_id = %u", $db->prefix('block_module_link'), $bid);
        $db->query($sql);
        foreach ($bmodule as $bmid) {
            $sql = sprintf("INSERT INTO %s (block_id, module_id) VALUES (%u, %d)", $db->prefix('block_module_link'), $bid, intval($bmid));
            $db->query($sql);
        }
        include_once XOOPS_ROOT_PATH . '/class/template.php';
        $xoopsTpl = new XoopsTpl();
        $xoopsTpl->xoops_setCaching(2);
        if ($myblock->getVar('template') != '') {
            if ($xoopsTpl->is_cached('db:' . $myblock->getVar('template'), 'blk_' . $myblock->getVar('bid'))) {
                if (!$xoopsTpl->clear_cache('db:' . $myblock->getVar('template'), 'blk_' . $myblock->getVar('bid'))) {
                    $msg = 'Unable to clear cache for block ID ' . $bid;
                }
            }
        } else {
            if ($xoopsTpl->is_cached('db:system_dummy.html', 'blk_' . $bid)) {
                if (!$xoopsTpl->clear_cache('db:system_dummy.html', 'blk_' . $bid)) {
                    $msg = 'Unable to clear cache for block ID ' . $bid;
                }
            }
        }
        $groupperm_handler =& xoops_gethandler('groupperm');
        $groups_with_access =& $groupperm_handler->getGroupIds("block_read", $bid);
        $removed_groups = array_diff($groups_with_access, $bgroups);
        if (count($removed_groups) > 0) {
            foreach ($removed_groups as $groupid) {
                $criteria = new CriteriaCompo(new Criteria('gperm_name', 'block_read'));
                $criteria->add(new Criteria('gperm_groupid', $groupid));
                $criteria->add(new Criteria('gperm_itemid', $bid));
                $criteria->add(new Criteria('gperm_modid', 1));
                $perm = $groupperm_handler->getObjects($criteria);
                if (isset($perm[0]) && is_object($perm[0])) {
                    $groupperm_handler->delete($perm[0]);
                }
            }
        }
        $new_groups = array_diff($bgroups, $groups_with_access);
        if (count($new_groups) > 0) {
            foreach ($new_groups as $groupid) {
                $groupperm_handler->addRight("block_read", $bid, $groupid);
            }
        }
    } else {
        $msg = 'Failed update of block. ID:' . $bid;
    }
    redirect_header('admin.php?fct=blocksadmin&amp;t=' . time(), 1, $msg);
    exit;
}
                        $comment_url .= $extra_params;
                    }
                    $comment_url .= $com_config['itemName'];
                }
                $comment_tags['X_COMMENT_URL'] = XOOPS_URL . '/modules/' . $not_module->getVar('dirname') . '/' . $comment_url . '=' . $com_itemid . '&amp;com_id=' . $newcid . '&amp;com_rootid=' . $com_rootid . '&amp;com_mode=' . $com_mode . '&amp;com_order=' . $com_order . '#comment' . $newcid;
                $notification_handler =& xoops_gethandler('notification');
                $notification_handler->triggerEvent($not_category, $not_itemid, $not_event, $comment_tags, false, $not_modid);
            }
            if (!isset($comment_post_results)) {
                // if the comment is active, redirect to posted comment
                if ($comment->getVar('com_status') == XOOPS_COMMENT_ACTIVE) {
                    redirect_header($redirect_page . '=' . $com_itemid . '&amp;com_id=' . $newcid . '&amp;com_rootid=' . $com_rootid . '&amp;com_mode=' . $com_mode . '&amp;com_order=' . $com_order . '#comment' . $newcid, 2, _CM_THANKSPOST);
                } else {
                    // not active, so redirect to top comment page
                    redirect_header($redirect_page . '=' . $com_itemid . '&amp;com_mode=' . $com_mode . '&amp;com_order=' . $com_order . '#comment' . $newcid, 2, _CM_THANKSPOST);
                }
            }
        } else {
            if (!isset($purge_comment_post_results)) {
                include XOOPS_ROOT_PATH . '/header.php';
                xoops_error($comment->getHtmlErrors());
                include XOOPS_ROOT_PATH . '/footer.php';
            } else {
                $comment_post_results = $comment->getErrors();
            }
        }
        break;
    default:
        redirect_header(XOOPS_URL . '/', 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
        break;
}
Exemple #11
0
        }
        if ($imagecategory->getVar('imgcat_type') != 'C') {
            xoops_cp_header();
            xoops_error(_MD_SCATDELNG);
            xoops_cp_footer();
            exit;
        }
        $image_handler =& xoops_gethandler('image');
        $images =& $image_handler->getObjects(new Criteria('imgcat_id', $imgcat_id), true, false);
        $errors = array();
        foreach (array_keys($images) as $i) {
            if (!$image_handler->delete($images[$i])) {
                $errors[] = sprintf(_MD_FAILDEL, $i);
            } else {
                if (file_exists(XOOPS_UPLOAD_PATH . '/' . $images[$i]->getVar('image_name')) && !unlink(XOOPS_UPLOAD_PATH . '/' . $images[$i]->getVar('image_name'))) {
                    $errors[] = sprintf(_MD_FAILUNLINK, $i);
                }
            }
        }
        if (!$imgcat_handler->delete($imagecategory)) {
            $errors[] = sprintf(_MD_FAILDELCAT, $imagecategory->getVar('imgcat_name'));
        }
        if (count($errors) > 0) {
            xoops_cp_header();
            xoops_error($errors);
            xoops_cp_footer();
            exit;
        }
        redirect_header('admin.php?fct=images', 2, _MD_AM_DBUPDATED);
    }
}
Exemple #12
0
     redirect_header('admin.php?fct=avatars', 1, 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
 }
 $avatar_id = system_CleanVars($_POST, 'avatar_id', 0, 'int');
 if ($avatar_id <= 0) {
     redirect_header('admin.php?fct=avatars', 1, _AM_SYSTEM_DBERROR);
 }
 $avt_handler = xoops_gethandler('avatar');
 $avatar =& $avt_handler->get($avatar_id);
 if (!is_object($avatar)) {
     redirect_header('admin.php?fct=avatars', 1, _AM_SYSTEM_DBERROR);
 }
 if (!$avt_handler->delete($avatar)) {
     // Call Header
     xoops_cp_header();
     // Display errors
     xoops_error(sprintf(_AM_SYSTEM_AVATAR_FAILDEL, $avatar->getVar('avatar_id')));
     // Call Footer
     xoops_cp_footer();
     exit;
 }
 $file = $avatar->getVar('avatar_file');
 // Delete file
 @unlink(XOOPS_UPLOAD_PATH . '/' . $file);
 // Update member profil
 if (isset($user_id) && $avatar->getVar('avatar_type') == 'C') {
     $xoopsDB->query("UPDATE " . $xoopsDB->prefix('users') . " SET user_avatar='blank.gif' WHERE uid=" . intval($user_id));
 } else {
     $xoopsDB->query("UPDATE " . $xoopsDB->prefix('users') . " SET user_avatar='blank.gif' WHERE user_avatar='" . $file . "'");
 }
 redirect_header('admin.php?fct=avatars', 2, _AM_SYSTEM_DBUPDATED);
 break;
Exemple #13
0
     redirect_header('admin.php?fct=groups', 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
 }
 $system_catids = system_CleanVars($_POST, 'system_catids', array(), 'array');
 $admin_mids = system_CleanVars($_POST, 'admin_mids', array(), 'array');
 $read_mids = system_CleanVars($_POST, 'read_mids', array(), 'array');
 $read_bids = system_CleanVars($_POST, 'read_bids', array(), 'array');
 $member_handler =& xoops_gethandler('member');
 $group =& $member_handler->createGroup();
 $group->setVar('name', $_POST["name"]);
 $group->setVar('description', $_POST["desc"]);
 if (count($system_catids) > 0) {
     $group->setVar('group_type', 'Admin');
 }
 if (!$member_handler->insertGroup($group)) {
     xoops_cp_header();
     xoops_error($group->getHtmlErrors());
     xoops_cp_footer();
 } else {
     $groupid = $group->getVar('groupid');
     $gperm_handler =& xoops_gethandler('groupperm');
     if (count($system_catids) > 0) {
         array_push($admin_mids, 1);
         foreach ($system_catids as $s_cid) {
             $sysperm =& $gperm_handler->create();
             $sysperm->setVar('gperm_groupid', $groupid);
             $sysperm->setVar('gperm_itemid', $s_cid);
             $sysperm->setVar('gperm_name', 'system_admin');
             $sysperm->setVar('gperm_modid', 1);
             $gperm_handler->insert($sysperm);
         }
     }
Exemple #14
0
                             $groups_failed[] = $group;
                         }
                     }
                     if (!empty($groups_failed)) {
                         $group_names = $member_handler->getGroupList(new Criteria('groupid', "(" . implode(", ", $groups_failed) . ")", 'IN'));
                         $adduser_errormsg = sprintf(_AM_SYSTEM_USERS_CNRNU2, implode(", ", $group_names));
                     } else {
                         xoops_load("XoopsUserUtility");
                         XoopsUserUtility::sendWelcome($newuser);
                         redirect_header("admin.php?fct=users", 1, _AM_SYSTEM_DBUPDATED);
                         exit;
                     }
                 }
             }
         }
         xoops_error($adduser_errormsg);
     }
     break;
     // Activ member
 // Activ member
 case 'users_active':
     if (isset($_REQUEST["uid"])) {
         $obj =& $member_handler->getUser($uid);
         //echo $_REQUEST["uid"];
         //print_r($obj);
     }
     $obj->setVar("level", 1);
     if ($member_handler->insertUser($obj, true)) {
         redirect_header("admin.php?fct=users", 1, _AM_SYSTEM_DBUPDATED);
     }
     echo $obj->getHtmlErrors();
 * @version         $Id$
 */
include_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'mainfile.php';
xoops_header(false);
$denied = true;
if (!empty($_REQUEST['token'])) {
    if ($GLOBALS['xoopsSecurity']->validateToken($_REQUEST['token'], false)) {
        $denied = false;
    }
} else {
    if (is_object($xoopsUser) && $xoopsUser->isAdmin()) {
        $denied = false;
    }
}
if ($denied) {
    xoops_error(_NOPERM);
    exit;
}
$token = isset($_REQUEST['token']) ? $_REQUEST['token'] : '';
$name_form = 'memberslist';
$name_userid = 'uid' . (!empty($_REQUEST['multiple']) ? '[]' : '');
$name_username = '******' . (!empty($_REQUEST['multiple']) ? '[]' : '');
xoops_loadLanguage('findusers');
/**
 * Enter description here...
 *
 */
class XoopsRank extends XoopsObject
{
    /**
     * Construct
Exemple #16
0
	// Published end date
	if( isset($_POST['auto']) && is_array($_POST['autoexp']) ){
		$autoexp = mktime( $_POST['autoexp']['hour'], $_POST['autoexp']['min'], @$_POST['autoexp']['sec'], $_POST['autoexp']['month'], $_POST['autoexp']['day'], $_POST['autoexp']['year'] );
	} elseif ( $story->getVar('expired') > 0 ) {
		$autoexp = $story->getVar('expired');
		$story->setVar('autoexpdate', 1);
	} else {
		$autoexp = time();
	}

	$xoopsOption['template_main'] = "{$mydirname}_submit.html";
//	require_once sprintf('%s/modules/legacy/language/%s/main.php' ,XOOPS_ROOT_PATH, $xoopsConfig['language']);

	require_once XOOPS_ROOT_PATH.'/header.php';
	if( !empty($errors) ) xoops_error($errors);
	// require dirname(dirname(__FILE__)).'/include/storyform.inc.php';
	require dirname(dirname(__FILE__)).'/include/storyform_templatevars.inc.php';
	$xoopsTpl->assign( 'xoops_breadcrumbs' , array(
		array( 'name' => $xoopsModule->getVar('name') , 'url' => XOOPS_URL.'/modules/'.$mydirname.'/' ) ,
		array( 'name' => _MD_SUBMITNEWS ) ,
	) ) ; // GIJ
	$xoopsTpl->assign( 'mod_config' , $xoopsModuleConfig ) ;

	require_once XOOPS_ROOT_PATH.'/footer.php';
}

if( $op == 'delete' ){
	if(empty($storyid)){
		die(_NOPERM);
		exit();
Exemple #17
0
            $smile_display = intval($_POST['smile_display']) > 0 ? 1 : 0;
            $newid = $db->genId($db->prefix('smilies') . "_id_seq");
            $sql = sprintf("INSERT INTO %s (id, code, smile_url, emotion, display) VALUES (%d, %s, %s, %s, %d)", $db->prefix('smiles'), $newid, $db->quoteString($smile_code), $db->quoteString($smile_url), $db->quoteString($smile_desc), $smile_display);
            if (!$db->query($sql)) {
                $err = 'Failed storing smiley data into the database';
            }
        }
    } else {
        $err = $uploader->getErrors();
    }
    if (!isset($err)) {
        unset($_SESSION['XoopsEmotions']);
        unset($_SESSION['XoopsEmotions_expire']);
        redirect_header($current_file, 2, _AM_DBUPDATED);
    } else {
        redirect_header($current_file, 3, xoops_error($err));
    }
}
$time = time();
if (!isset($_SESSION['XoopsEmotions']) && @$_SESSION['XoopsEmotions_expire'] < $time) {
    $_SESSION['XoopsEmotions'] = $myts->getSmileys();
    $_SESSION['XoopsEmotions_expire'] = $time + 300;
}
//xoops_header(false);
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . _LANGCODE . '" lang="' . _LANGCODE . '">';
echo '<head>';
echo '<meta http-equiv="content-type" content="text/html; charset=' . _CHARSET . '" />';
echo '<meta http-equiv="content-language" content="' . _LANGCODE . '" />';
?>
<head>
Exemple #18
0
    }
    if (!is_writable(XOOPS_UPLOAD_PATH)) {
        xoops_error(sprintf(_AD_WARNINGNOTWRITEABLE, XOOPS_UPLOAD_PATH));
        echo '<br />';
    }
    if (!is_writable(XOOPS_COMPILE_PATH)) {
        xoops_error(sprintf(_AD_WARNINGNOTWRITEABLE, XOOPS_COMPILE_PATH));
        echo '<br />';
    }
    //www fits inside www_private, lets add a trailing slash to make sure it doesn't
    if (strpos(XOOPS_PATH . '/', XOOPS_ROOT_PATH . '/') !== false || strpos(XOOPS_PATH . '/', $_SERVER['DOCUMENT_ROOT'] . '/') !== false) {
        xoops_error(sprintf(_AD_WARNINGXOOPSLIBINSIDE, XOOPS_PATH));
        echo '<br />';
    }
    if (strpos(XOOPS_VAR_PATH . '/', XOOPS_ROOT_PATH . '/') !== false || strpos(XOOPS_VAR_PATH . '/', $_SERVER['DOCUMENT_ROOT'] . '/') !== false) {
        xoops_error(sprintf(_AD_WARNINGXOOPSLIBINSIDE, XOOPS_VAR_PATH));
        echo '<br />';
    }
}
if (!empty($_GET['xoopsorgnews'])) {
    // Multiple feeds
    $myts =& MyTextSanitizer::getInstance();
    $rssurl = array();
    $rssurl[] = 'http://sourceforge.net/export/rss2_projnews.php?group_id=41586&rss_fulltext=1';
    $rssurl[] = 'http://www.xoops.org/backend.php';
    if ($URLs = (include $GLOBALS['xoops']->path('language/' . xoops_getConfigOption('language') . '/backend.php'))) {
        $rssurl = array_unique(array_merge($rssurl, $URLs));
    }
    $rssfile = 'adminnews-' . xoops_getConfigOption('language');
    xoops_load('XoopsCache');
    $items = array();
Exemple #19
0
         $isreply = 1;
     }
     $forumpost->setIp($HTTP_SERVER_VARS['REMOTE_ADDR']);
     $forumpost->setUid($uid);
 }
 $subject = xoops_trim($HTTP_POST_VARS['subject']);
 $subject = $subject == '' ? _NOTITLE : $subject;
 $forumpost->setSubject($subject);
 $forumpost->setText($HTTP_POST_VARS['message']);
 $forumpost->setNohtml($HTTP_POST_VARS['nohtml']);
 $forumpost->setNosmiley($HTTP_POST_VARS['nosmiley']);
 $forumpost->setIcon($HTTP_POST_VARS['icon']);
 $forumpost->setAttachsig($HTTP_POST_VARS['attachsig']);
 if (!($postid = $forumpost->store())) {
     include_once XOOPS_ROOT_PATH . '/header.php';
     xoops_error('Could not insert forum post');
     include_once XOOPS_ROOT_PATH . '/footer.php';
     exit;
 }
 if (is_object($xoopsUser) && !empty($isnew)) {
     $xoopsUser->incrementPost();
 }
 // RMV-NOTIFY
 // Define tags for notification message
 $tags = array();
 $tags['THREAD_NAME'] = $HTTP_POST_VARS['subject'];
 $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/viewtopic.php?forum=' . $forum . '&post_id=' . $postid . '&topic_id=' . $forumpost->topic();
 $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $postid;
 include_once 'include/notification.inc.php';
 $forum_info = newbb_notify_iteminfo('forum', $forum);
 $tags['FORUM_NAME'] = $forum_info['name'];
Exemple #20
0
            }
        }
        $user->setVar('last_login', time());
        if (!$member_handler->insertUser($user)) {
        }
        $_SESSION = array();
        $_SESSION['xoopsUserId'] = $user->getVar('uid');
        $_SESSION['xoopsUserGroups'] = $user->getGroups();
        if (!empty($xoopsConfig['use_ssl'])) {
            xoops_confirm(array($xoopsConfig['sslpost_name'] => session_id()), XOOPS_URL . '/misc.php?action=showpopups&amp;type=ssllogin', _US_PRESSLOGIN, _LOGIN);
        } else {
            echo sprintf(_US_LOGGINGU, $user->getVar('uname'));
            echo '<div style="text-align:center;"><input value="' . _CLOSE . '" type="button" onclick="document.window.opener.location.reload();document.window.close();" /></div>';
        }
    } else {
        xoops_error(_US_INCORRECTLOGIN . '<br /><a href="login.php">' . _BACK . '</a>');
    }
}
if ($op == 'login') {
    echo '
    <div style="text-align: center; padding: 5; margin: 0">
    <form action="login.php" method="post">
      <table class="outer" width="95%">
        <tr>
          <td class="head">' . _USERNAME . '</td>
          <td class="even"><input type="text" name="username" value="" /></td>
        </tr>
        <tr>
          <td class="head">' . _PASSWORD . '</td>
          <td class="even"><input type="password" name="userpass" value="" /></td>
        </tr>
Exemple #21
0
         if ($uploader->upload()) {
             $rank_image = $uploader->getSavedFileName();
             $delete_old_image = true;
         }
     }
     if ($rank_special > 0) {
         $_POST['rank_min'] = $_POST['rank_max'] = -1;
     }
     $sql = "UPDATE " . $db->prefix("ranks") . " SET rank_title = " . $db->quoteString($rank_title) . ", rank_min = " . intval($_POST['rank_min']) . ", rank_max = " . intval($_POST['rank_max']) . ", rank_special = " . $rank_special;
     if ($delete_old_image) {
         $sql .= ", rank_image = " . $db->quoteString($rank_image);
     }
     $sql .= " WHERE rank_id = " . $rank_id;
     if (!$db->query($sql)) {
         xoops_cp_header();
         xoops_error('Failed storing rank data into the database');
         xoops_cp_footer();
     } else {
         if ($delete_old_image) {
             $old_rank_path = str_replace("\\", "/", realpath(XOOPS_UPLOAD_PATH . '/' . trim($_POST['old_rank'])));
             if (0 === strpos($old_rank_path, XOOPS_UPLOAD_PATH) && is_file($old_rank_path)) {
                 unlink($old_rank_path);
             }
         }
         redirect_header("admin.php?fct=userrank&amp;op=RankForumAdmin", 1, _MD_AM_DBUPDATED);
     }
     break;
 default:
     include_once XOOPS_ROOT_PATH . "/modules/system/admin/userrank/userrank.php";
     RankForumAdmin();
     break;
Exemple #22
0
 $HotelObj->setVar('hotel_add_time', time());
 //var_dump($HotelObj);
 //var_dump($_POST);
 if (!$id) {
     $HotelObj->setNew();
 }
 if ($HotelObj->isNew()) {
     $redirect_msg = '添加成功';
     $redirect_to = 'martin.hotel.php';
 } else {
     $redirect_msg = '修改成功';
     $redirect_to = 'martin.hotel.php';
 }
 if (!$hotel_handler->insert($HotelObj)) {
     if ($HotelObj->_errors) {
         xoops_error($HotelObj->error);
     }
     redirect_header('javascript:history.go(-1);', 2, '操作失败');
     exit;
 }
 $hotel_id = $HotelObj->getVar('hotel_id');
 $hotel_tags = $HotelObj->getVar('hotel_tags');
 // hotel tag
 if ($hotel_id > 0 && !empty($hotel_tags)) {
     $hotel_handler->updateTags($HotelObj);
 }
 redirect_header($redirect_to, 2, $redirect_msg);
 break;
 /*case "upload":
 			include MARTIN_ROOT_PATH . "admin/upload.php";
 		break;
function myblocksadmin_update_block($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $bmodule, $options = array())
{
    global $xoopsConfig;
    if (empty($bmodule)) {
        xoops_cp_header();
        xoops_error(sprintf(_AM_NOTSELNG, _AM_VISIBLEIN));
        xoops_cp_footer();
        exit;
    }
    $myblock = new XoopsBlock($bid);
    // $myblock->setVar('side', $bside); GIJ -
    if ($bside >= 0) {
        $myblock->setVar('side', $bside);
    }
    // GIJ +
    $myblock->setVar('weight', $bweight);
    $myblock->setVar('visible', $bvisible);
    $myblock->setVar('title', $btitle);
    $myblock->setVar('content', $bcontent);
    $myblock->setVar('bcachetime', $bcachetime);
    if (isset($options) && count($options) > 0) {
        $options = implode('|', $options);
        $myblock->setVar('options', $options);
    }
    if ($myblock->getVar('block_type') == 'C') {
        switch ($bctype) {
            case 'H':
                $name = _AM_CUSTOMHTML;
                break;
            case 'P':
                $name = _AM_CUSTOMPHP;
                break;
            case 'S':
                $name = _AM_CUSTOMSMILE;
                break;
            default:
                $name = _AM_CUSTOMNOSMILE;
                break;
        }
        $myblock->setVar('name', $name);
        $myblock->setVar('c_type', $bctype);
    } else {
        $myblock->setVar('c_type', 'H');
    }
    $msg = _AM_DBUPDATED;
    if ($myblock->store() != false) {
        $db =& Database::getInstance();
        $sql = sprintf("DELETE FROM %s WHERE block_id = %u", $db->prefix('block_module_link'), $bid);
        $db->query($sql);
        foreach ($bmodule as $bmid) {
            $sql = sprintf("INSERT INTO %s (block_id, module_id) VALUES (%u, %d)", $db->prefix('block_module_link'), $bid, intval($bmid));
            $db->query($sql);
        }
        include_once XOOPS_ROOT_PATH . '/class/template.php';
        $xoopsTpl = new XoopsTpl();
        $xoopsTpl->xoops_setCaching(2);
        if ($myblock->getVar('template') != '') {
            if ($xoopsTpl->is_cached('db:' . $myblock->getVar('template'))) {
                if (!$xoopsTpl->clear_cache('db:' . $myblock->getVar('template'))) {
                    $msg = 'Unable to clear cache for block ID' . $bid;
                }
            }
        } else {
            if ($xoopsTpl->is_cached('db:system_dummy.html', 'block' . $bid)) {
                if (!$xoopsTpl->clear_cache('db:system_dummy.html', 'block' . $bid)) {
                    $msg = 'Unable to clear cache for block ID' . $bid;
                }
            }
        }
    } else {
        $msg = 'Failed update of block. ID:' . $bid;
    }
    // redirect_header('admin.php?fct=blocksadmin&amp;t='.time(),1,$msg);
    // exit(); GIJ -
    return $msg;
    // GIJ +
}
 public function error($msg)
 {
     xoops_error($msg);
     exit;
 }
Exemple #25
0
     $xoBreadCrumb->addHelp(system_adminVersion('banners', 'help') . '#banner_client_delete');
     $xoBreadCrumb->render();
     $cid = system_CleanVars($_REQUEST, 'cid', 0, 'int');
     if ($cid > 0) {
         $obj = $banner_client_Handler->get($cid);
         if (isset($_POST['ok']) && $_POST['ok'] == 1) {
             if (!$GLOBALS['xoopsSecurity']->check()) {
                 redirect_header('admin.php?fct=banners', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
             }
             if ($banner_client_Handler->delete($obj)) {
                 // Delete client banners
                 $banner_Handler->deleteAll(new Criteria('cid', $cid));
                 $banner_finish_Handler->deleteAll(new Criteria('cid', $cid));
                 redirect_header('admin.php?fct=banners', 3, _AM_SYSTEM_BANNERS_DBUPDATED);
             } else {
                 xoops_error($obj->getHtmlErrors());
             }
         } else {
             xoops_confirm(array('ok' => 1, 'cid' => $cid, 'op' => 'banner_client_delete'), 'admin.php?fct=banners', _AM_SYSTEM_BANNERS_SUREDELBNR);
         }
     } else {
         redirect_header('admin.php?fct=banners', 1, _AM_SYSTEM_DBERROR);
     }
     break;
 case 'new_banner':
     // Form: New Banner
     $xoBreadCrumb->addLink(_AM_SYSTEM_BANNERS_NAV_ADDBNR);
     $xoBreadCrumb->addHelp(system_adminVersion('banners', 'help') . '#new_banner');
     $xoBreadCrumb->addTips(_AM_SYSTEM_BANNERS_NAV_TIPS);
     $xoBreadCrumb->render();
     $obj = $banner_Handler->create();
Exemple #26
0
     exit;
 }
 if ($newid != 0) {
     $blocklinkmodule_handler =& xoops_getmodulehandler('blocklinkmodule');
     // Delete old link
     $criteria = new CriteriaCompo(new Criteria('block_id', $newid));
     $blocklinkmodule_handler->deleteAll($criteria);
     // Assign link
     $modules = $_POST['modules'];
     foreach ($modules as $mid) {
         $blocklinkmodule = $blocklinkmodule_handler->create();
         $blocklinkmodule->setVar('block_id', $newid);
         $blocklinkmodule->setVar('module_id', $mid);
         if (!$blocklinkmodule_handler->insert($blocklinkmodule)) {
             xoops_cp_header();
             xoops_error($blocklinkmodule->getHtmlErrors());
             xoops_cp_footer();
             exit;
         }
     }
 }
 $groupperm_handler =& xoops_gethandler('groupperm');
 $groups = $_POST['groups'];
 $groups_with_access =& $groupperm_handler->getGroupIds("block_read", $newid);
 $removed_groups = array_diff($groups_with_access, $groups);
 if (count($removed_groups) > 0) {
     foreach ($removed_groups as $groupid) {
         $criteria = new CriteriaCompo(new Criteria('gperm_name', 'block_read'));
         $criteria->add(new Criteria('gperm_groupid', $groupid));
         $criteria->add(new Criteria('gperm_itemid', $newid));
         $criteria->add(new Criteria('gperm_modid', 1));
Exemple #27
0
 function clone_block_ok($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options)
 {
     global $xoopsUser;
     $block = new XoopsBlock($bid);
     $clone =& $block->xoopsClone();
     if (empty($bmodule)) {
         xoops_cp_header();
         xoops_error(sprintf(_AM_NOTSELNG, _AM_VISIBLEIN));
         xoops_cp_footer();
         exit;
     }
     $clone->setVar('side', $bside);
     $clone->setVar('weight', $bweight);
     $clone->setVar('visible', $bvisible);
     $clone->setVar('content', $bcontent);
     //$clone->setVar('title', $btitle);
     $clone->setVar('bcachetime', $bcachetime);
     if (isset($options) && count($options) > 0) {
         $options = implode('|', $options);
         $clone->setVar('options', $options);
     }
     $clone->setVar('bid', 0);
     if ($block->getVar('block_type') == 'C' || $block->getVar('block_type') == 'E') {
         $clone->setVar('block_type', 'E');
     } else {
         $clone->setVar('block_type', 'D');
     }
     $newid = $clone->store();
     if (!$newid) {
         xoops_cp_header();
         $clone->getHtmlErrors();
         xoops_cp_footer();
         exit;
     }
     if ($clone->getVar('template') != '') {
         $tplfile_handler =& xoops_gethandler('tplfile');
         $btemplate =& $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $bid);
         if (count($btemplate) > 0) {
             $tplclone =& $btemplate[0]->xoopsClone();
             $tplclone->setVar('tpl_id', 0);
             $tplclone->setVar('tpl_refid', $newid);
             $tplman->insert($tplclone);
         }
     }
     $db =& Database::getInstance();
     foreach ($bmodule as $bmid) {
         $sql = 'INSERT INTO ' . $db->prefix('block_module_link') . ' (block_id, module_id) VALUES (' . $newid . ', ' . $bmid . ')';
         $db->query($sql);
     }
     $groups =& $xoopsUser->getGroups();
     $count = count($groups);
     for ($i = 0; $i < $count; $i++) {
         $sql = "INSERT INTO " . $db->prefix('group_permission') . " (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES (" . $groups[$i] . ", " . $newid . ", 1, 'block_read')";
         $db->query($sql);
     }
     redirect_header('admin.php?fct=blocksadmin&amp;t=' . time(), 1, _AM_DBUPDATED);
 }
Exemple #28
0
            $image->setVar('image_name', $uploader->getSavedFileName());
            $image->setVar('image_nicename', $image_nicename);
            $image->setVar('image_mimetype', $uploader->getMediaType());
            $image->setVar('image_created', time());
            $image->setVar('image_display', 1);
            $image->setVar('image_weight', 0);
            $image->setVar('imgcat_id', $imgcat_id);
            if ($imgcat->getVar('imgcat_storetype') == 'db') {
                $fp = @fopen($uploader->getSavedDestination(), 'rb');
                $fbinary = @fread($fp, filesize($uploader->getSavedDestination()));
                @fclose($fp);
                $image->setVar('image_body', $fbinary, true);
                @unlink($uploader->getSavedDestination());
            }
            if (!$image_handler->insert($image)) {
                $err = sprintf(_FAILSAVEIMG, $image->getVar('image_nicename'));
            }
        }
    } else {
        $err = sprintf(_FAILFETCHIMG, 0);
        $err .= '<br />' . implode('<br />', $uploader->getErrors(false));
    }
    if (isset($err)) {
        xoops_header(false);
        xoops_error($err);
        echo '</head><body><div style="text-align:center;"><input value="' . _BACK . '" type="button" onclick="javascript:history.go(-1);" /></div>';
        xoops_footer();
        exit;
    }
    header('location: imagemanager.php?cat_id=' . $imgcat_id . '&target=' . $target);
}
Exemple #29
0
                    default:
                        break;
                }
                if (file_exists($filepath)) {
                    if (false != ($fp = fopen($filepath, 'r'))) {
                        $filesource = fread($fp, filesize($filepath));
                        fclose($fp);
                        $tplfile->setVar('tpl_source', $filesource, true);
                        $tplfile->setVar('tpl_tplset', $tplset);
                        $tplfile->setVar('tpl_lastmodified', time());
                        $tplfile->setVar('tpl_lastimported', time());
                        if (!$tpltpl_handler->insert($tplfile)) {
                        } else {
                            $error = false;
                        }
                    }
                }
            }
            if (false != $error) {
                xoops_cp_header();
                xoops_error('Could not import file ' . $filepath);
                echo '<br /><a href="admin.php?fct=tplsets&amp;op=listtpl&amp;tplset=' . $tplset . '&amp;moddir=' . $moddir . '">' . _MD_AM_BTOTADMIN . '</a>';
                xoops_cp_footer();
                exit;
            }
            redirect_header('admin.php?fct=tplsets&amp;op=listtpl&amp;moddir=' . $tplfile->getVar('tpl_module') . '&amp;tplset=' . urlencode($tplfile->getVar('tpl_tplset')), 2, _MD_AM_DBUPDATED);
            break;
        default:
            break;
    }
}
Exemple #30
0
                                  <div class="clear"></div>
                             </div>
                         </div>
                    </td>
				</tr>
				<tr>
					<td><textarea id="code_mirror" name="templates" rows=24 cols=110>' . $content . '</textarea></td>
				</tr>
			  </table>';
        echo '<input type="hidden" name="path_file" value="' . $path_file . '"><input type="hidden" name="file" value="' . trim($_REQUEST['file']) . '"><input type="hidden" name="ext" value="' . $ext . '"></form>';
        break;
        // Restore backup file
    // Restore backup file
    case 'tpls_restore':
        $extensions = array('.html', '.htm', '.css');
        //check if the file is inside themes directory
        $valid_dir = stristr(realpath($_REQUEST['path_file']), realpath(XOOPS_ROOT_PATH . '/themes'));
        $old_file = $_REQUEST['path_file'] . '.back';
        $new_file = $_REQUEST['path_file'];
        $extension_verif = strrchr($new_file, '.');
        if ($valid_dir && in_array($extension_verif, $extensions) && file_exists($old_file) && file_exists($new_file)) {
            if (unlink($new_file)) {
                if (rename($old_file, $new_file)) {
                    xoops_result(_AM_SYSTEM_TEMPLATES_RESTORE_OK);
                    exit;
                }
            }
        }
        xoops_error(_AM_SYSTEM_TEMPLATES_RESTORE_NOTOK);
        break;
}