public function testRefresh()
 {
     // Line 2794
     $url = 'http://localhost/';
     $dummy = "<html><head><meta http-equiv=\"refresh\" content=\"0; URL={$url}\"></head></html>\n";
     $this->assertEquals($dummy, COM_refresh($url));
 }
Example #2
0
function MG_rebuildQuota()
{
    global $_TABLES, $_MG_CONF, $_CONF;
    $result = DB_query("SELECT album_id FROM {$_TABLES['mg_albums']}");
    while ($row = DB_fetchArray($result)) {
        MG_updateQuotaUsage($row['album_id']);
    }
    echo COM_refresh($_MG_CONF['admin_url'] . 'index.php?msg=16');
    exit;
}
Example #3
0
function MG_saveUser()
{
    global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01, $_POST;
    $uid = COM_applyFilter($_POST['uid'], true);
    $quota = COM_applyFilter($_POST['quota'], true) * 1048576;
    $active = COM_applyFilter($_POST['active'], true);
    $result = DB_query("SELECT uid FROM {$_TABLES['mg_userprefs']} WHERE uid=" . $uid);
    $nRows = DB_numRows($result);
    if ($nRows > 0) {
        DB_query("UPDATE {$_TABLES['mg_userprefs']} SET quota=" . $quota . ",active=" . $active . " WHERE uid=" . $uid, 1);
    } else {
        DB_query("INSERT INTO {$_TABLES['mg_userprefs']} SET uid=" . $uid . ", quota=" . $quota . ",active=" . $active, 1);
    }
    echo COM_refresh($_MG_CONF['admin_url'] . 'quotareport.php');
    exit;
}
Example #4
0
function MG_batchDeleteSession()
{
    global $_MG_CONF, $_CONF, $_TABLES;
    if (!empty($_POST['sel'])) {
        $numItems = count($_POST['sel']);
        for ($i = 0; $i < $numItems; $i++) {
            DB_delete($_TABLES['mg_session_items'], 'session_id', $_POST['sel'][$i]);
            if (DB_error()) {
                COM_errorLog("Media Gallery Error: Error removing session items");
            }
            DB_delete($_TABLES['mg_sessions'], 'session_id', $_POST['sel'][$i]);
            if (DB_error()) {
                COM_errorLog("Media Gallery Error: Error removing session");
            }
        }
    }
    echo COM_refresh($_MG_CONF['admin_url'] . 'sessions.php');
    exit;
}
Example #5
0
function MG_batchDeleteSession()
{
    global $_MG_CONF, $_CONF, $_TABLES, $_POST;
    $numItems = count($_POST['sel']);
    for ($i = 0; $i < $numItems; $i++) {
        $sql = "DELETE FROM {$_TABLES['mg_session_items']} WHERE session_id='" . $_POST['sel'][$i] . "'";
        $result = DB_query($sql);
        if (DB_error()) {
            COM_errorLog("Media Gallery Error: Error removing session items");
        }
        $sql = "DELETE FROM {$_TABLES['mg_sessions']} WHERE session_id='" . $_POST['sel'][$i] . "'";
        $result = DB_query($sql);
        if (DB_error()) {
            COM_errorLog("Media Gallery Error: Error removing session");
        }
    }
    echo COM_refresh($_MG_CONF['admin_url'] . 'sessions.php');
    exit;
}
Example #6
0
function MG_rebuildQuota()
{
    global $_TABLES, $_MG_CONF, $_CONF;
    $res1 = DB_query("SELECT album_id FROM {$_TABLES['mg_albums']}");
    while ($row = DB_fetchArray($res1)) {
        $quota = 0;
        $sql = "SELECT m.media_filename, m.media_mime_ext FROM {$_TABLES['mg_media_albums']} as ma INNER JOIN " . $_TABLES['mg_media'] . " as m " . " ON ma.media_id=m.media_id WHERE ma.album_id=" . $row['album_id'];
        $result = DB_query($sql);
        while (list($filename, $mimeExt) = DB_fetchArray($result)) {
            if ($_MG_CONF['discard_original'] == 1) {
                $quota += @filesize($_MG_CONF['path_mediaobjects'] . 'orig/' . $filename[0] . '/' . $filename . '.' . $mimeExt);
                $quota += @filesize($_MG_CONF['path_mediaobjects'] . 'disp/' . $filename[0] . '/' . $filename . '.jpg');
            } else {
                $quota += @filesize($_MG_CONF['path_mediaobjects'] . 'orig/' . $filename[0] . '/' . $filename . '.' . $mimeExt);
            }
        }
        DB_query("UPDATE {$_TABLES['mg_albums']} SET album_disk_usage=" . $quota . " WHERE album_id=" . $row['album_id']);
    }
    echo COM_refresh($_MG_CONF['admin_url'] . 'index.php?msg=16');
    exit;
}
Example #7
0
function MG_rotateMedia($album_id, $media_id, $direction, $actionURL = '')
{
    global $_TABLES, $_MG_CONF;
    $sql = "SELECT * FROM " . $_TABLES['mg_media'] . " WHERE media_id='" . DB_escapeString($media_id) . "'";
    $result = DB_query($sql);
    $numRows = DB_numRows($result);
    if ($numRows == 0) {
        $sql = "SELECT * FROM " . $_TABLES['mg_mediaqueue'] . " WHERE media_id='" . DB_escapeString($media_id) . "'";
        $result = DB_query($sql);
        $numRows = DB_numRows($result);
    }
    if ($numRows == 0) {
        COM_errorLog("MG_rotateMedia: Unable to retrieve media object data");
        if ($actionURL == '') {
            return false;
        }
        echo COM_refresh($actionURL);
        exit;
    }
    $row = DB_fetchArray($result);
    $filename = $row['media_filename'];
    $media_size = false;
    foreach ($_MG_CONF['validExtensions'] as $ext) {
        if (file_exists($_MG_CONF['path_mediaobjects'] . 'tn/' . $filename[0] . '/' . $filename . $ext)) {
            $tn = $_MG_CONF['path_mediaobjects'] . 'tn/' . $filename[0] . '/' . $filename . $ext;
            $disp = $_MG_CONF['path_mediaobjects'] . 'disp/' . $filename[0] . '/' . $filename . $ext;
            break;
        }
    }
    $orig = $_MG_CONF['path_mediaobjects'] . 'orig/' . $filename[0] . '/' . $filename . '.' . $row['media_mime_ext'];
    list($rc, $msg) = IMG_rotateImage($tn, $direction);
    list($rc, $msg) = IMG_rotateImage($disp, $direction);
    list($rc, $msg) = IMG_rotateImage($orig, $direction);
    if ($actionURL == -1 || $actionURL == '') {
        return true;
    }
    echo COM_refresh($actionURL . '&t=' . time());
    exit;
}
Example #8
0
/**
* Copies a record from one table to another (can be the same table)
*
* This will use a REPLACE INTO...SELECT FROM to copy a record from one table
* to another table.  They can be the same table.
*
* @param        string          $table          Table to insert record into
* @param        string          $fields         Comma delmited list of fields to copy over
* @param        string          $values         Values to store in database field
* @param        string          $tablefrom      Table to get record from
* @param        array|string    $id             Field name(s) to use in where clause
* @param        array|string    $value          Value(s) to use in where clause
* @param        string          $return_page    Page to send user to when done
*
*/
function DB_copy($table, $fields, $values, $tablefrom, $id, $value, $return_page = '')
{
    global $_DB, $_TABLES, $_CONF;
    $_DB->dbCopy($table, $fields, $values, $tablefrom, $id, $value);
    if (!empty($return_page)) {
        print COM_refresh("{$return_page}");
    }
}
Example #9
0
            if (SEC_inGroup($frecord['grp_id'])) {
                DB_query("DELETE FROM {$_TABLES['ff_log']} WHERE uid=" . (int) $_USER['uid'] . " AND forum=" . (int) $frecord['forum_id'] . "");
                $tsql = DB_query("SELECT id FROM {$_TABLES['ff_topic']} WHERE forum={$frecord['forum_id']} and pid=0");
                while ($trecord = DB_fetchArray($tsql)) {
                    $log_sql = DB_query("SELECT * FROM {$_TABLES['ff_log']} WHERE uid=" . (int) $_USER['uid'] . " AND topic=" . (int) $trecord['id'] . " AND forum=" . (int) $frecord['forum_id']);
                    if (DB_numRows($log_sql) == 0) {
                        DB_query("INSERT INTO {$_TABLES['ff_log']} (uid,forum,topic,time) VALUES (" . (int) $_USER['uid'] . "," . (int) $frecord['forum_id'] . "," . (int) $trecord['id'] . ",'{$now}')");
                    }
                }
            }
        }
    }
    if ($extraWhere != '') {
        echo COM_refresh($_CONF['site_url'] . '/forum/index.php?forum=' . (int) $forum_id);
    } else {
        echo COM_refresh($_CONF['site_url'] . '/forum/index.php');
    }
    exit;
}
if ($op == 'subscribe') {
    $display = FF_siteHeader();
    if ($forum != 0) {
        $forum_name = DB_getItem($_TABLES['ff_forums'], 'forum_name', 'forum_id=' . (int) $forum);
        DB_query("INSERT INTO {$_TABLES['subscriptions']} (type,category,category_desc,id,id_desc,uid,date_added) VALUES ('forum'," . (int) $forum . ",'" . DB_escapeString($forum_name) . "',0,'" . $LANG_GF02['msg138'] . "'," . (int) $_USER['uid'] . ", now() )");
        // Delete all individual topic notification records
        DB_query("DELETE FROM {$_TABLES['subscriptions']} WHERE type='forum' AND uid=" . (int) $_USER['uid'] . " AND category=" . (int) $forum . " AND id > 0");
        $display .= FF_statusMessage($LANG_GF02['msg134'], $_CONF['site_url'] . '/forum/index.php?forum=' . $forum, $LANG_GF02['msg135']);
    } else {
        $display .= FF_BlockMessage($LANG_GF01['ERROR'], $LANG_GF02['msg136'], false);
    }
    $display .= FF_siteFooter();
Example #10
0
            break;
        case 'delete':
            // delete the element
            $id = COM_applyFilter($_GET['mid'], true);
            $menu_id = COM_applyFilter($_GET['menuid'], true);
            $menu = menu::getInstance($menu_id);
            MB_deleteChildElements($id, $menu_id);
            $menu->reorderMenu(0);
            echo COM_refresh($_CONF['site_admin_url'] . '/menu.php?mode=menu&amp;menu=' . $menu_id);
            exit;
            break;
        case 'deletemenu':
            // delete the element
            $menu_id = COM_applyFilter($_GET['id'], true);
            MB_deleteMenu($menu_id);
            echo COM_refresh($_CONF['site_admin_url'] . '/menu.php');
            exit;
            break;
        case 'newmenu':
            $content = MB_createMenu();
            $currentSelect = $LANG_MB01['menu_builder'];
            break;
        default:
            $content = MB_displayMenuList();
            break;
    }
} else {
    if (isset($_POST['cancel']) && isset($_POST['menu'])) {
        $menu_id = COM_applyFilter($_POST['menu'], true);
        $content = MB_displayTree($menu_id);
    } else {
Example #11
0
        $sort_user = $_USER['uid'];
    }
    $sort_datetime = time();
    $referer = DB_escapeString($referer);
    $keywords = DB_escapeString($keywords);
    $sql = "INSERT INTO {$_TABLES['mg_sort']} (sort_id,sort_user,sort_query,sort_results,sort_datetime,referer,keywords)\n            VALUES ('{$sort_id}',{$sort_user},'{$sqltmp}',{$numresults},{$sort_datetime},'{$referer}','{$keywords}')";
    $result = DB_query($sql);
    if (DB_error()) {
        COM_errorLog("Media Gallery: Error placing sort query into database");
    }
    $sort_purge = time() - 3660;
    // 43200;
    DB_query("DELETE FROM {$_TABLES['mg_sort']} WHERE sort_datetime < " . $sort_purge);
    $pageBody .= MG_search($sort_id, 1);
} elseif ($mode == $LANG_MG01['cancel']) {
    echo COM_refresh($_MG_CONF['site_url'] . '/index.php');
    exit;
} elseif (isset($_GET['id'])) {
    $id = COM_applyFilter($_GET['id']);
    $page = COM_applyFilter($_GET['page'], true);
    if ($page < 1) {
        $page = 1;
    }
    $pageBody .= MG_search($id, $page);
} else {
    $pageBody .= MG_displaySearchBox('');
}
$display = MG_siteHeader($LANG_MG00['results']);
$display .= $pageBody;
$display .= MG_siteFooter();
echo $display;
Example #12
0
/**
* Display form to email a story to someone.
*
* @param    string  $sid    ID of article to email
* @return   string          HTML for email story form
*
*/
function mailstoryform($sid, $to = '', $toemail = '', $from = '', $fromemail = '', $shortmsg = '', $msg = 0)
{
    global $_CONF, $_TABLES, $_USER, $LANG08, $LANG_LOGIN;
    require_once $_CONF['path_system'] . 'lib-story.php';
    $retval = '';
    if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_CONF['emailstoryloginrequired'] == 1)) {
        $retval = COM_startBlock($LANG_LOGIN[1], '', COM_getBlockTemplate('_msg_block', 'header'));
        $login = new Template($_CONF['path_layout'] . 'submit');
        $login->set_file(array('login' => 'submitloginrequired.thtml'));
        $login->set_var('xhtml', XHTML);
        $login->set_var('site_url', $_CONF['site_url']);
        $login->set_var('site_admin_url', $_CONF['site_admin_url']);
        $login->set_var('layout_url', $_CONF['layout_url']);
        $login->set_var('login_message', $LANG_LOGIN[2]);
        $login->set_var('lang_login', $LANG_LOGIN[3]);
        $login->set_var('lang_newuser', $LANG_LOGIN[4]);
        $login->parse('output', 'login');
        $retval .= $login->finish($login->get_var('output'));
        $retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
        return $retval;
    }
    $story = new Story();
    $result = $story->loadFromDatabase($sid, 'view');
    if ($result != STORY_LOADED_OK) {
        return COM_refresh($_CONF['site_url'] . '/index.php');
    }
    if ($msg > 0) {
        $retval .= COM_showMessage($msg);
    }
    if (empty($from) && empty($fromemail)) {
        if (!COM_isAnonUser()) {
            $from = COM_getDisplayName($_USER['uid'], $_USER['username'], $_USER['fullname']);
            $fromemail = DB_getItem($_TABLES['users'], 'email', "uid = {$_USER['uid']}");
        }
    }
    $mail_template = new Template($_CONF['path_layout'] . 'profiles');
    $mail_template->set_file('form', 'contactauthorform.thtml');
    $mail_template->set_var('xhtml', XHTML);
    $mail_template->set_var('site_url', $_CONF['site_url']);
    $mail_template->set_var('site_admin_url', $_CONF['site_admin_url']);
    $mail_template->set_var('layout_url', $_CONF['layout_url']);
    $mail_template->set_var('start_block_mailstory2friend', COM_startBlock($LANG08[17]));
    $mail_template->set_var('lang_title', $LANG08[31]);
    $mail_template->set_var('story_title', $story->displayElements('title'));
    $url = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $sid);
    $mail_template->set_var('story_url', $url);
    $link = COM_createLink($story->displayElements('title'), $url);
    $mail_template->set_var('story_link', $link);
    $mail_template->set_var('lang_fromname', $LANG08[20]);
    $mail_template->set_var('name', $from);
    $mail_template->set_var('lang_fromemailaddress', $LANG08[21]);
    $mail_template->set_var('email', $fromemail);
    $mail_template->set_var('lang_toname', $LANG08[18]);
    $mail_template->set_var('toname', $to);
    $mail_template->set_var('lang_toemailaddress', $LANG08[19]);
    $mail_template->set_var('toemail', $toemail);
    $mail_template->set_var('lang_cc', $LANG08[36]);
    $mail_template->set_var('lang_cc_description', $LANG08[37]);
    $mail_template->set_var('lang_shortmessage', $LANG08[27]);
    $mail_template->set_var('shortmsg', htmlspecialchars($shortmsg));
    $mail_template->set_var('lang_warning', $LANG08[22]);
    $mail_template->set_var('lang_sendmessage', $LANG08[16]);
    $mail_template->set_var('story_id', $sid);
    $mail_template->set_var('end_block', COM_endBlock());
    PLG_templateSetVars('emailstory', $mail_template);
    $mail_template->parse('output', 'form');
    $retval .= $mail_template->finish($mail_template->get_var('output'));
    return $retval;
}
Example #13
0
                DB_query("UPDATE {$_TABLES['nf_templatedata']} set logicalID='{$id}',firstTask=0 WHERE id='{$A['id']}'");
                $id++;
            }
        }
        // Set the firstTask Flag for just the first logical id
        // Reset all to 0 and then set the flag to 1 for the first logical task
        DB_query("UPDATE {$_TABLES['nf_templatedata']} set firstTask=0 WHERE nf_templateID='{$templateID}'");
        $sql = "SELECT id FROM {$_TABLES['nf_templatedata']} WHERE nf_templateID='{$templateID}' ORDER BY logicalID  Limit 1";
        list($first_taskID) = DB_fetchArray(DB_query($sql));
        DB_query("UPDATE {$_TABLES['nf_templatedata']} set firstTask=1 WHERE id='{$first_taskID}'");
        break;
    case 'delete':
        DB_query("DELETE FROM {$_TABLES['nf_templatedatanextstep']} WHERE nf_templateDataFrom = '{$taskID}'");
        DB_query("DELETE FROM {$_TABLES['nf_templateassignment']} WHERE nf_templateDataID='{$taskID}'");
        DB_query("DELETE FROM {$_TABLES['nf_templatedata']} WHERE id='{$taskID}'");
        echo COM_refresh("index.php?templateID=" . $templateID);
        break;
}
if ($templateID > 0) {
    $actionurl = $_CONF['site_admin_url'] . '/plugins/nexflow/index.php';
    $imgset = "{$_CONF['layout_url']}/nexflow/images";
    $reminder_image = '<span style="padding-left:5px;"><img src ="' . $imgset . '/admin/reminder.gif" TITLE="Task Reminder Enabled"></span>';
    $notify1_image = '<span style="padding-left:5px;"><img src ="' . $imgset . '/admin/notify.gif" TITLE="Task Assignment Notification Enabled"></span>';
    $notify2_image = '<span style="padding-left:5px;"><img src ="' . $imgset . '/admin/postnotify.gif" TITLE="Task Completion Notification Enabled"></span>';
    $p = new Template($_CONF['path_layout'] . 'nexflow/admin');
    $p->set_file(array('page' => 'template_tasks.thtml', 'records' => 'template_task_record.thtml'));
    $p->set_var('action_url', $actionurl);
    $p->set_var('public_url', $_CONF['site_admin_url'] . '/plugins/nexflow');
    $p->set_var('template_id', $templateID);
    $p->set_var('edit_task_id', $taskID);
    $p->set_var('show_taskoptions', 'none');
Example #14
0
     $promptform = '<p><FORM ACTION="' . $_CONF['site_url'] . '/forum/moderation.php" METHOD="POST">';
     $promptform .= '<INPUT TYPE="hidden" NAME="modconfirmdelete" VALUE="1">';
     $promptform .= '<INPUT TYPE="hidden" NAME="msgid"  VALUE="' . $fortopicid . '">';
     $promptform .= '<INPUT TYPE="hidden" NAME="forum"  VALUE="' . $forum . '">';
     $promptform .= '<INPUT TYPE="hidden" NAME="msgpid" VALUE="' . $msgpid . '">';
     $promptform .= '<INPUT TYPE="hidden" NAME="top" VALUE="' . $top . '">';
     $promptform .= '<CENTER><INPUT TYPE="submit" NAME="submit" VALUE="' . $LANG_GF01['CONFIRM'] . '">&nbsp;&nbsp;';
     $promptform .= '<INPUT TYPE="submit" NAME="submit" VALUE="' . $LANG_GF01['CANCEL'] . '"></CENTER>';
     $promptform .= '</CENTER></FORM></p>';
     alertMessage($alertmessage, $LANG_GF02['msg182'], $promptform);
 } elseif ($modfunction == 'editpost' and forum_modPermission($forum, $_USER['uid'], 'mod_edit') and $fortopicid != 0) {
     $page = COM_applyFilter($_REQUEST['page'], true);
     echo COM_refresh("createtopic.php?method=edit&id={$fortopicid}&page={$page}");
     echo $LANG_GF02['msg110'];
 } elseif ($modfunction == 'lockedpost' and forum_modPermission($forum, $_USER['uid'], 'mod_edit') and $fortopicid != 0) {
     echo COM_refresh("createtopic.php?method=postreply&id={$fortopicid}");
     echo $LANG_GF02['msg173'];
 } elseif ($modfunction == 'movetopic' and forum_modPermission($forum, $_USER['uid'], 'mod_move') and $fortopicid != 0) {
     $SECgroups = SEC_getUserGroups();
     // Returns an Associative Array - need to parse out the group id's
     $modgroups = '';
     foreach ($SECgroups as $key) {
         if ($modgroups == '') {
             $modgroups = $key;
         } else {
             $modgroups .= ",{$key}";
         }
     }
     /* Check and see if user had moderation rights to another forum to complete the topic move */
     $sql = "SELECT DISTINCT forum_name FROM {$_TABLES['gf_moderators']} a , {$_TABLES['gf_forums']} b ";
     $sql .= "where a.mod_forum = b.forum_id AND ( a.mod_uid='{$_USER['uid']}' OR a.mod_groupid in ({$modgroups}))";
Example #15
0
/**
* Delete a user
*
* @param    int     $uid    id of user to delete
* @return   string          HTML redirect
*
*/
function deleteUser($uid)
{
    global $_CONF;
    if (!USER_deleteAccount($uid)) {
        return COM_refresh($_CONF['site_admin_url'] . '/user.php');
    }
    return COM_refresh($_CONF['site_admin_url'] . '/user.php?msg=22');
}
Example #16
0
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
###############################################################################
/**
* Geeklog common function library
*/
require_once '../lib-common.php';
/**
* Security check to ensure user even belongs on this page
*/
require_once 'auth.inc.php';
// MAIN
if (isset($_GET['mode']) && $_GET['mode'] == 'logout') {
    print COM_refresh($_CONF['site_url'] . '/users.php?mode=logout');
}
/**
* Display a reminder to execute the security check script
*
* @return   string      HTML for security reminder (or empty string)
*/
function security_check_reminder()
{
    global $_CONF, $_TABLES, $_IMAGE_TYPE, $MESSAGE;
    $retval = '';
    if (!SEC_inGroup('Root')) {
        return $retval;
    }
    $done = DB_getItem($_TABLES['vars'], 'value', "name = 'security_check'");
    if ($done != 1) {
Example #17
0
/**
 * Plugin function that is called after comment form is submitted.
 * Needs to at least save the comment and check return value.
 * Add any additional logic your plugin may need to perform on comments.
 *
 * $title       comment title
 * $comment     comment text
 * $id          Item id to which $cid belongs
 * $pid         comment parent
 * $postmode    'html' or 'text'
 *
 */
function _mg_savecomment($title, $comment, $id, $pid, $postmode)
{
    global $_CONF, $_MG_CONF, $_TABLES, $LANG03;
    $retval = '';
    $title = strip_tags($title);
    $pid = COM_applyFilter($pid, true);
    $postmode = COM_applyFilter($postmode);
    $ret = CMT_saveComment($title, $comment, $id, $pid, 'mediagallery', $postmode);
    if ($ret > 0) {
        $retval = '';
        if (SESS_isSet('glfusion.commentpresave.error')) {
            $retval = COM_showMessageText(SESS_getVar('glfusion.commentpresave.error'), '', true);
            SESS_unSet('glfusion.commentpresave.error');
        }
        $retval .= CMT_commentform($title, $comment, $id, $pid, 'mediagallery', $LANG03[14], $postmode);
        return $retval;
    } else {
        $comments = DB_count($_TABLES['comments'], array('sid', 'type'), array(DB_escapeString($id), 'mediagallery'));
        DB_change($_TABLES['mg_media'], 'media_comments', $comments, 'media_id', DB_escapeString($id));
        return COM_refresh($_MG_CONF['site_url'] . "/media.php?s={$id}#comments");
    }
}
Example #18
0
/**
* Example of custom function that can be used to handle a login error.
* Only active with custom registration mode enabled
* Used if you have a custom front page and need to trap and reformat any error messages
* This example redirects to the front page with a extra passed variable plus the message
* Note: Message could be a string but in this case maps to $MESSAGE[81] as a default - edit in language file
*/
function CUSTOM_loginErrorHandler($msg = '')
{
    global $_CONF, $MESSAGE;
    if ($msg > 0) {
        $msg = $msg;
    } elseif ($msg == '') {
        $msg = 81;
    }
    $retval = COM_refresh($_CONF['site_url'] . '/index.php?mode=loginfail&amp;msg=' . $msg);
    echo $retval;
    exit;
}
Example #19
0
File: index.php Project: ivywe/maps
switch ($mode) {
    //Create a new marker for admin
    case 'edit':
        echo COM_refresh($_CONF['site_url'] . "/admin/plugins/maps/marker_edit.php");
        exit;
        break;
        //Edit marker sumission
    //Edit marker sumission
    case 'editsubmission':
        $id = $_REQUEST['id'];
        echo COM_refresh($_CONF['site_url'] . "/admin/plugins/maps/marker_edit.php?mode=editsubmission&amp;mkid={$id}");
        exit;
        break;
    case 'setgeolocation':
        MAPS_setGeoLocation();
        echo COM_refresh($_CONF['site_url'] . "/admin/plugins/maps/index.php?msg=" . urlencode($LANG_MAPS_1['set_geo_location']));
        exit;
        break;
    default:
        $display = COM_siteHeader('menu', $LANG_MAPS_1['plugin_name']);
        $display .= MAPS_admin_menu();
        if (!empty($_REQUEST['msg'])) {
            $display .= COM_startBlock($LANG_MAPS_1['message'], '', 'blockheader-message.thtml');
            $display .= $_REQUEST['msg'];
            $display .= COM_endBlock('blockfooter-message.thtml');
        }
        $display .= '<img src="' . $_CONF['site_admin_url'] . '/plugins/maps/images/maps.png" alt="" align="left" hspace="5">' . '<p>' . $LANG_MAPS_1['plugin_doc'] . ' <a href="http://geeklog.fr/downloads/index.php/maps" target="_blank">' . $LANG_MAPS_1['online'] . '</a>.</p>';
        $display .= '<br /><h1>' . $LANG_MAPS_1['maps_list'] . '</h1>';
        $display .= '<p>' . $LANG_MAPS_1['you_can'] . '<a href="' . $_CONF['site_url'] . '/admin/plugins/maps/map_edit.php">' . $LANG_MAPS_1['create_map'] . '</a>.</p><p>&nbsp;</p>';
        $display .= MAPS_listmaps();
        $display .= COM_siteFooter(0);
Example #20
0
/**
* Copies and installs new style plugins
*
* Copies all files the proper place and runs the automated installer
* or upgrade.
*
* @return   string              Formatted HTML containing the page body
*
*/
function post_uploadProcess()
{
    global $_CONF, $_PLUGINS, $_TABLES, $autotagData, $LANG32, $_DB_dbms, $_DB_table_prefix;
    $retval = '';
    $upgrade = false;
    $masterErrorCount = 0;
    $masterErrorMsg = '';
    $autotagData = array();
    $autotagData['id'] = COM_applyFilter($_POST['pi_name']);
    $autotagData['name'] = $autotagData['id'];
    $autotagData['version'] = COM_applyFilter($_POST['pi_version']);
    $autotagData['glfusionversion'] = COM_applyFilter($_POST['pi_gl_version']);
    $tdir = COM_applyFilter($_POST['temp_dir']);
    $tdir = preg_replace('/[^a-zA-Z0-9\\-_\\.]/', '', $tdir);
    $tdir = str_replace('..', '', $tdir);
    $tmp = $_CONF['path_data'] . $tdir;
    $autotagData = array();
    $rc = _at_parseXML($tmp);
    if ($rc == -1) {
        // no xml file found
        return _at_errorBox($LANG32[74]);
    }
    clearstatcache();
    $permError = 0;
    $permErrorList = '';
    // copy to proper directories
    if (defined('DEMO_MODE')) {
        _pi_deleteDir($tmp);
        echo COM_refresh($_CONF['site_admin_url'] . '/autotag.php?msg=503');
        exit;
    }
    if (function_exists('set_time_limit')) {
        @set_time_limit(30);
    }
    $autotagData['id'] = preg_replace('/[^a-zA-Z0-9\\-_\\.]/', '', $autotagData['id']);
    $rc = _pi_file_copy($tmp . '/' . $autotagData['id'] . '.class.php', $_CONF['path_system'] . 'autotags/');
    if ($rc === false) {
        $errorMessage = '<h2>' . $LANG32[42] . '</h2>' . $LANG32[43] . $permErrorList . '<br />' . $LANG32[44];
        _pi_deleteDir($tmp);
        return _at_errorBox($errorMessage);
    }
    // copy template files, if any
    if (isset($autotagData['template']) && is_array($autotagData['template'])) {
        foreach ($autotagData['template'] as $filename) {
            $rc = _pi_file_copy($tmp . '/' . $filename, $_CONF['path_system'] . 'autotags/');
            if ($rc === false) {
                @unlink($_CONF['path_system'] . $autotagData['id'] . '.class.php');
                $errorMessage = '<h2>' . $LANG32[42] . '</h2>' . $LANG32[43] . $permErrorList . '<br />' . $LANG32[44];
                _pi_deleteDir($tmp);
                return _at_errorBox($errorMessage);
            }
        }
    }
    $tag = DB_escapeString($autotagData['id']);
    $desc = DB_escapeString($autotagData['description']);
    $is_enabled = 1;
    $is_function = 1;
    $replacement = '';
    DB_query("REPLACE INTO {$_TABLES['autotags']} (tag,description,is_enabled,is_function,replacement) VALUES ('" . $tag . "','" . $desc . "'," . $is_enabled . "," . $is_function . ",'')");
    _pi_deleteDir($tmp);
    CTL_clearCache();
    // show status (success or fail)
    return $retval;
}
Example #21
0
* Main
*/
$display = '';
$mode = '';
if (isset($_POST['save'])) {
    $mode = 'save';
}
if (isset($_POST['cancel'])) {
    $mode = 'cancel';
}
$T = new Template($_MG_CONF['template_path'] . '/admin');
$T->set_file('admin', 'administration.thtml');
$T->set_var(array('site_admin_url' => $_CONF['site_admin_url'], 'site_url' => $_MG_CONF['site_url'], 'mg_navigation' => MG_navigation(), 'lang_admin' => $LANG_MG00['admin'], 'version' => $_MG_CONF['pi_version']));
if ($mode == 'save' && SEC_checkToken()) {
    $T->set_var(array('admin_body' => MG_saveConfig(), 'mg_navigation' => MG_navigation()));
} elseif ($mode == 'cancel') {
    echo COM_refresh($_MG_CONF['admin_url'] . 'index.php');
    exit;
} elseif ($mode == $LANG_MG01['continue']) {
    COM_setMessage(2);
    echo COM_refresh($_MG_CONF['admin_url'] . 'index.php');
    exit;
} else {
    $T->set_var(array('admin_body' => MG_editConfig(), 'title' => $LANG_MG01['system_options'], 'lang_help' => '<img src="' . MG_getImageFile('button_help.png') . '" style="border:none;" alt="?" />', 'help_url' => $_MG_CONF['site_url'] . '/docs/usage.html#System_Options'));
}
$T->parse('output', 'admin');
$display = COM_siteHeader('menu', '');
$display .= $T->finish($T->get_var('output'));
$display .= COM_siteFooter();
echo $display;
exit;
Example #22
0
function MG_saveMediaEdit($album_id, $media_id, $actionURL)
{
    global $_USER, $_CONF, $_TABLES, $_MG_CONF, $LANG_MG00, $LANG_MG01, $LANG_MG03;
    $back = COM_applyFilter($_POST['rpath']);
    if ($back != '') {
        $actionURL = $back;
    }
    $queue = COM_applyFilter($_POST['queue'], true);
    $replacefile = 0;
    if (isset($_POST['replacefile'])) {
        $replacefile = COM_applyFilter($_POST['replacefile']);
    }
    if ($replacefile == 1) {
        require_once $_CONF['path'] . 'plugins/mediagallery/include/lib-upload.php';
        $repfilename = $_FILES['repfilename'];
        $filename = $repfilename['name'];
        $file = $repfilename['tmp_name'];
        $opt = array('replace' => $media_id);
        list($rc, $msg) = MG_getFile($file, $filename, $album_id, $opt);
        COM_errorLog($msg);
    }
    // see if we had an attached thumbnail before...
    $thumb = $_FILES['attthumb'];
    $thumbnail = $thumb['tmp_name'];
    $att = isset($_POST['attachtn']) ? COM_applyFilter($_POST['attachtn'], true) : 0;
    $attachtn = $att == 1 ? 1 : 0;
    $table = $queue ? $_TABLES['mg_mediaqueue'] : $_TABLES['mg_media'];
    $old_attached_tn = DB_getItem($table, 'media_tn_attached', 'media_id="' . addslashes($media_id) . '"');
    if ($old_attached_tn == 0 && $att == 1 && $thumbnail == '') {
        $attachtn = 0;
    }
    $remove_old_tn = 0;
    if ($old_attached_tn == 1 && $attachtn == 0) {
        $remove_old_tn = 1;
    }
    $remote_media = DB_getItem($table, 'remote_media', 'media_id="' . addslashes($media_id) . '"');
    $remote_url = addslashes(COM_stripslashes($_POST['remoteurl']));
    if ($_MG_CONF['htmlallowed']) {
        $media_title = COM_checkWords(COM_stripslashes($_POST['media_title']));
        $media_desc = COM_checkWords(COM_stripslashes($_POST['media_desc']));
    } else {
        $media_title = htmlspecialchars(strip_tags(COM_checkWords(COM_stripslashes($_POST['media_title']))));
        $media_desc = htmlspecialchars(strip_tags(COM_checkWords(COM_stripslashes($_POST['media_desc']))));
    }
    $media_time_month = COM_applyFilter($_POST['media_month']);
    $media_time_day = COM_applyFilter($_POST['media_day']);
    $media_time_year = COM_applyFilter($_POST['media_year']);
    $media_time_hour = COM_applyFilter($_POST['media_hour']);
    $media_time_minute = COM_applyFilter($_POST['media_minute']);
    $original_filename = COM_applyFilter(COM_stripslashes($_POST['original_filename']));
    if ($replacefile == 1) {
        $original_filename = $filename;
    }
    $cat_id = COM_applyFilter($_POST['cat_id'], true);
    $media_keywords = COM_stripslashes($_POST['media_keywords']);
    $media_keywords_safe = substr($media_keywords, 0, 254);
    $media_keywords = addslashes(htmlspecialchars(strip_tags(COM_checkWords($media_keywords_safe))));
    $artist = addslashes(COM_applyFilter(COM_stripslashes($_POST['artist'])));
    $musicalbum = addslashes(COM_applyFilter(COM_stripslashes($_POST['musicalbum'])));
    $genre = addslashes(COM_applyFilter(COM_stripslashes($_POST['genre'])));
    $media_time = mktime($media_time_hour, $media_time_minute, 0, $media_time_month, $media_time_day, $media_time_year, 1);
    $owner_sql = '';
    if (isset($_POST['owner_name'])) {
        $owner_id = COM_applyFilter($_POST['owner_name'], true);
        $owner_sql = ',media_user_id=' . $owner_id . ' ';
    }
    $sql = "UPDATE " . $table . "\n            SET media_title='" . addslashes($media_title) . "',\n            media_desc='" . addslashes($media_desc) . "',\n            media_original_filename='" . addslashes($original_filename) . "',\n            media_time=" . $media_time . ",\n            media_tn_attached=" . $attachtn . ",\n            media_category=" . intval($cat_id) . ",\n            media_keywords='" . $media_keywords . "',\n            artist='" . $artist . "',\n            album='" . $musicalbum . "',\n            genre='" . $genre . "',\n            remote_url='" . $remote_url . "' " . $owner_sql . "WHERE media_id='" . addslashes($media_id) . "'";
    DB_query($sql);
    if (DB_error() != 0) {
        echo COM_errorLog("Media Gallery: ERROR Updating image in media database");
    }
    PLG_itemSaved($media_id, 'mediagallery');
    // process playback options if any...
    if (isset($_POST['autostart'])) {
        // asf
        $opt['autostart'] = COM_applyFilter($_POST['autostart'], true);
        $opt['enablecontextmenu'] = COM_applyFilter($_POST['enablecontextmenu'], true);
        $opt['stretchtofit'] = isset($_POST['stretchtofit']) ? COM_applyFilter($_POST['stretchtofit'], true) : 0;
        $opt['showstatusbar'] = COM_applyFilter($_POST['showstatusbar'], true);
        $opt['uimode'] = COM_applyFilter($_POST['uimode']);
        $opt['height'] = isset($_POST['height']) ? COM_applyFilter($_POST['height'], true) : 0;
        $opt['width'] = isset($_POST['width']) ? COM_applyFilter($_POST['width'], true) : 0;
        $opt['bgcolor'] = isset($_POST['bgcolor']) ? COM_applyFilter($_POST['bgcolor']) : 0;
        $opt['playcount'] = isset($_POST['playcount']) ? COM_applyFilter($_POST['playcount'], true) : 0;
        $opt['loop'] = isset($_POST['loop']) ? COM_applyFilter($_POST['loop'], true) : 0;
        if ($opt['playcount'] < 1) {
            $opt['playcount'] = 1;
        }
        MG_savePBOption($media_id, 'autostart', $opt['autostart'], true);
        MG_savePBOption($media_id, 'enablecontextmenu', $opt['enablecontextmenu'], true);
        if ($opt['stretchtofit'] != '') {
            MG_savePBOption($media_id, 'stretchtofit', $opt['stretchtofit'], true);
        }
        MG_savePBOption($media_id, 'showstatusbar', $opt['showstatusbar'], true);
        MG_savePBOption($media_id, 'uimode', $opt['uimode']);
        MG_savePBOption($media_id, 'height', $opt['height'], true);
        MG_savePBOption($media_id, 'width', $opt['width'], true);
        MG_savePBOption($media_id, 'bgcolor', $opt['bgcolor']);
        MG_savePBOption($media_id, 'playcount', $opt['playcount'], true);
        MG_savePBOption($media_id, 'loop', $opt['loop'], true);
    }
    if (isset($_POST['play'])) {
        // swf
        $opt['play'] = COM_applyFilter($_POST['play'], true);
        $opt['menu'] = isset($_POST['menu']) ? COM_applyFilter($_POST['menu'], true) : 0;
        $opt['quality'] = isset($_POST['quality']) ? COM_applyFilter($_POST['quality']) : '';
        $opt['flashvars'] = isset($_POST['flashvars']) ? COM_applyFilter($_POST['flashvars']) : '';
        $opt['height'] = COM_applyFilter($_POST['height'], true);
        $opt['width'] = COM_applyFilter($_POST['width'], true);
        $opt['loop'] = isset($_POST['loop']) ? COM_applyFilter($_POST['loop'], true) : 0;
        $opt['scale'] = isset($_POST['scale']) ? COM_applyFilter($_POST['scale']) : '';
        $opt['wmode'] = isset($_POST['wmode']) ? COM_applyFilter($_POST['wmode']) : '';
        $opt['allowscriptaccess'] = isset($_POST['allowscriptaccess']) ? COM_applyFilter($_POST['allowscriptaccess']) : '';
        $opt['bgcolor'] = isset($_POST['bgcolor']) ? COM_applyFilter($_POST['bgcolor']) : '';
        $opt['swf_version'] = isset($_POST['swf_version']) ? COM_applyFilter($_POST['swf_version'], true) : 9;
        MG_savePBOption($media_id, 'play', $opt['play'], true);
        if ($opt['menu'] != '') {
            MG_savePBOption($media_id, 'menu', $opt['menu'], true);
        }
        MG_savePBOption($media_id, 'quality', $opt['quality']);
        MG_savePBOption($media_id, 'flashvars', $opt['flashvars']);
        MG_savePBOption($media_id, 'height', $opt['height'], true);
        MG_savePBOption($media_id, 'width', $opt['width'], true);
        MG_savePBOption($media_id, 'loop', $opt['loop'], true);
        MG_savePBOption($media_id, 'scale', $opt['scale']);
        MG_savePBOption($media_id, 'wmode', $opt['wmode']);
        MG_savePBOption($media_id, 'allowscriptaccess', $opt['allowscriptaccess']);
        MG_savePBOption($media_id, 'bgcolor', $opt['bgcolor']);
        MG_savePBOption($media_id, 'swf_version', $opt['swf_version'], true);
    }
    if (isset($_POST['autoplay'])) {
        // quicktime
        $opt['autoplay'] = COM_applyFilter($_POST['autoplay'], true);
        $opt['autoref'] = COM_applyFilter($_POST['autoref'], true);
        $opt['controller'] = COM_applyFilter($_POST['controller'], true);
        $opt['kioskmode'] = COM_applyFilter($_POST['kioskmode'], true);
        $opt['scale'] = COM_applyFilter($_POST['scale']);
        $opt['height'] = COM_applyFilter($_POST['height'], true);
        $opt['width'] = COM_applyFilter($_POST['width'], true);
        $opt['bgcolor'] = COM_applyFilter($_POST['bgcolor']);
        $opt['loop'] = COM_applyFilter($_POST['loop'], true);
        MG_savePBOption($media_id, 'autoref', $opt['autoref'], true);
        MG_savePBOption($media_id, 'autoplay', $opt['autoplay'], true);
        MG_savePBOption($media_id, 'controller', $opt['controller'], true);
        MG_savePBOption($media_id, 'kioskmode', $opt['kioskmode'], true);
        MG_savePBOption($media_id, 'scale', $opt['scale']);
        MG_savePBOption($media_id, 'height', $opt['height'], true);
        MG_savePBOption($media_id, 'width', $opt['width'], true);
        MG_savePBOption($media_id, 'bgcolor', $opt['bgcolor'], true);
        MG_savePBOption($media_id, 'loop', $opt['loop'], true);
    }
    if ($attachtn == 1 && $thumbnail != '') {
        require_once $_CONF['path'] . 'plugins/mediagallery/include/lib-upload.php';
        $media_filename = DB_getItem($_TABLES['mg_media'], 'media_filename', 'media_id="' . addslashes($media_id) . '"');
        $thumbFilename = $_MG_CONF['path_mediaobjects'] . 'tn/' . $media_filename[0] . '/tn_' . $media_filename;
        MG_attachThumbnail($album_id, $thumbnail, $thumbFilename);
    }
    if ($remove_old_tn == 1) {
        $media_filename = DB_getItem($_TABLES['mg_media'], 'media_filename', 'media_id="' . addslashes($media_id) . '"');
        $tmpstr = 'tn/' . $media_filename[0] . '/tn_' . $media_filename;
        $ext = Media::getMediaExt($_MG_CONF['path_mediaobjects'] . $tmpstr);
        if (!empty($ext)) {
            @unlink($_MG_CONF['path_mediaobjects'] . $tmpstr . $ext);
        }
    }
    if ($queue) {
        echo COM_refresh($actionURL);
    } else {
        require_once $_CONF['path'] . 'plugins/mediagallery/include/rssfeed.php';
        MG_buildAlbumRSS($album_id);
        echo COM_refresh($actionURL);
    }
    exit;
}
Example #23
0
/**
* Main Function
*/
if (SEC_checkToken()) {
    $action = COM_applyFilter($_GET['action']);
    if ($action == 'install') {
        if (plugin_install_calendar()) {
            // Redirects to the plugin editor
            echo COM_refresh($_CONF['site_admin_url'] . '/plugins.php?msg=44');
            exit;
        } else {
            echo COM_refresh($_CONF['site_admin_url'] . '/plugins.php?msg=72');
            exit;
        }
    } else {
        if ($action == 'uninstall') {
            if (plugin_uninstall_calendar('installed')) {
                /**
                 * Redirects to the plugin editor
                 */
                echo COM_refresh($_CONF['site_admin_url'] . '/plugins.php?msg=45');
                exit;
            } else {
                echo COM_refresh($_CONF['site_admin_url'] . '/plugins.php?msg=73');
                exit;
            }
        }
    }
}
echo COM_refresh($_CONF['site_admin_url'] . '/plugins.php');
Example #24
0
} else {
    if ($mode == $LANG_ADMIN['delete'] && !empty($LANG_ADMIN['delete'])) {
        $mode = "delete";
    }
}
if ($action == $LANG_ADMIN['cancel']) {
    // cancel
    $mode = "";
}
//echo "mode=".$mode."<br>";
if ($mode == "" or $mode == "edit" or $mode == "new" or $mode == "export" or $mode == "sampleimport" or $mode == "copy") {
} else {
    if (!SEC_checkToken()) {
        //    if (SEC_checkToken()){//テスト用
        COM_accessLog("User {$_USER['username']} tried to illegally and failed CSRF checks.");
        echo COM_refresh($_CONF['site_admin_url'] . '/index.php');
        exit;
    }
}
if ($mode == "exportexec") {
    LIB_export($pi_name);
    exit;
}
if ($mode == "sampleimportexec") {
    LIB_sampleimport($pi_name);
}
//
$menuno = 51;
$display = '';
$information = array();
switch ($mode) {
Example #25
0
                DB_query("DELETE FROM {$_TABLES['storysubmission']} WHERE sid='" . DB_escapeString($sid) . "'");
            }
        } else {
            $topic = DB_getItem($_TABLES['stories'], "tid", "sid='" . DB_escapeString($sid) . "'");
            $sql = DB_query("SELECT sid,tid,date,uid,title,introtext,bodytext,hits from {$_TABLES['stories']} WHERE sid='" . DB_escapeString($sid) . "'");
            list($sid, $tid, $storydate, $uid, $subject, $introtext, $bodytext, $hits) = DB_fetchArray($sql);
            $num_posts = _ff_migratetopic($forum, $sid, $tid, $storydate, $uid, $subject, $introtext, $bodytext, $hits) + $num_posts;
            $num_stories++;
            if (isset($_POST['delPostMigrate']) && $_POST['delPostMigrate'] == 1) {
                migrate_deletestory($sid);
            }
        }
    }
    gf_resyncforum($forum);
    CTL_clearCache();
    echo COM_refresh($_CONF['site_admin_url'] . "/plugins/forum/migrate.php?num_stories=" . $num_stories . "&num_posts=" . $num_posts);
    exit;
}
function _ff_migratetopic($forum, $sid, $tid, $storydate, $uid, $subject, $introtext, $bodytext, $hits)
{
    global $_TABLES;
    $num_posts = 0;
    $comment = $introtext . $bodytext;
    $comment = prepareStringForDB($comment);
    $subject = prepareStringForDB($subject);
    $postmode = "html";
    $name = DB_getITEM($_TABLES['users'], 'username', "uid=" . (int) $uid);
    $email = DB_getITEM($_TABLES['users'], 'email', "uid=" . (int) $uid);
    $website = DB_getITEM($_TABLES['users'], 'homepage', "uid=" . (int) $uid);
    $datetime = explode(" ", $storydate);
    $date = explode("-", $datetime[0]);
Example #26
0
/**
 * Delete an existing static page
 *
 * @param   array   args    Contains all the data provided by the client
 * @param   string  &output OUTPUT parameter containing the returned text
 * @param   string  &svc_msg OUTPUT parameter containing any service messages
 * @return  int		    Response code as defined in lib-plugins.php
 */
function service_delete_staticpages($args, &$output, &$svc_msg)
{
    global $_CONF, $_TABLES, $_USER, $LANG_ACCESS, $LANG12, $LANG_STATIC, $LANG_LOGIN;
    if (empty($args['sp_id']) && !empty($args['id'])) {
        $args['sp_id'] = $args['id'];
    }
    // Apply filters to the parameters passed by the webservice
    if ($args['gl_svc']) {
        $args['sp_id'] = COM_applyBasicFilter($args['sp_id']);
        $args['mode'] = COM_applyBasicFilter($args['mode']);
    }
    $sp_id = $args['sp_id'];
    if (!SEC_hasRights('staticpages.delete')) {
        $output = COM_siteHeader('menu', $LANG_STATIC['access_denied']);
        $output .= COM_showMessageText($LANG_STATIC['access_denied_msg'], $LANG_STATIC['access_denied'], true);
        $output .= COM_siteFooter();
        if (!COM_isAnonUser()) {
            return PLG_RET_PERMISSION_DENIED;
        } else {
            return PLG_RET_AUTH_FAILED;
        }
    }
    DB_delete($_TABLES['staticpage'], 'sp_id', $sp_id);
    DB_delete($_TABLES['comments'], array('sid', 'type'), array($sp_id, 'staticpages'));
    PLG_itemDeleted($sp_id, 'staticpages');
    $output = COM_refresh($_CONF['site_admin_url'] . '/plugins/staticpages/index.php');
    return PLG_RET_OK;
}
Example #27
0
function LIB_delete($pi_name)
{
    global $_CONF;
    global $_TABLES;
    $lang_box_admin = "LANG_" . strtoupper($pi_name) . "_ADMIN";
    global ${$lang_box_admin};
    $lang_box_admin = ${$lang_box_admin};
    $table = $_TABLES[strtoupper($pi_name) . '_def_group'];
    $id = COM_applyFilter($_POST['id'], true);
    // CHECK
    $err = "";
    //category addtionfield check!!!
    if ($err != "") {
        $pagetitle = $lang_box_admin['err'];
        $retval .= DATABOX_siteHeader($pi_name, '_admin', $page_title);
        $retval .= COM_startBlock($lang_box_admin['err'], '', COM_getBlockTemplate('_msg_block', 'header'));
        $retval .= $err;
        $retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
        $retval .= DATABOX_siteFooter($pi_name, '_admin');
        return $retval;
    }
    //
    DB_delete($table, 'group_id', $id);
    return COM_refresh($_CONF['site_admin_url'] . '/plugins/' . THIS_SCRIPT . '?msg=2');
}
Example #28
0
    $usermodeUID = $_USER['uid'];
}
if (DB_count($_TABLES['nf_projects'], 'id', $project_id) == 1) {
    if ($CONF_NF['debug']) {
        COM_errorLog("Reclaim Project:{$project_id}");
    }
    $status = DB_getItem($_TABLES['nf_projects'], 'status', "id='{$project_id}'");
    $prev_status = DB_getItem($_TABLES['nf_projects'], 'prev_status', "id='{$project_id}'");
    if ($prev_status < 1 or $status == $prev_status) {
        $prev_status = 1;
    }
    if ($status == 6) {
        // Currently in Recycled State
        DB_query("UPDATE {$_TABLES['nf_projects']} SET status='{$prev_status}', prev_status=6 WHERE id='{$project_id}'");
    } elseif ($status == 7) {
        // Currently in On-Hold State
        DB_query("UPDATE {$_TABLES['nf_projects']} SET status='{$prev_status}', prev_status=7 WHERE id='{$project_id}'");
        $taskQuery = DB_query("SELECT * FROM {$_TABLES['nf_projecttaskhistory']} WHERE project_id={$project_id} AND date_completed=0 AND status = 2");
        while ($histrec = DB_fetchArray($taskQuery, false)) {
            // Update the current outstanding task which have a status of on-hold - to now have a completed timestamp
            DB_query("UPDATE {$_TABLES['nf_projecttaskhistory']} SET date_completed = UNIX_TIMESTAMP() WHERE id='{$histrec['id']}'");
            // For these tasks, reset the assigned timestamp and flag the task as new
            $sql = "UPDATE {$_TABLES['nf_projecttaskhistory']} SET date_assigned = UNIX_TIMESTAMP(), ";
            $sql .= "date_started=0 WHERE project_id={$project_id} AND task_id='{$histrec['task_id']}' AND status=0";
            DB_query($sql);
            DB_query("UPDATE {$_TABLES['nf_queue']} SET createdDate = NOW() WHERE id={$histrec['task_id']}");
        }
    }
}
echo COM_refresh($_CONF['site_url'] . '/nexflow/index.php?taskuser=' . $usermodeUID);
exit;
Example #29
0
function MG_createUsers()
{
    global $_MG_CONF;
    if (!empty($_POST['user'])) {
        $numItems = count($_POST['user']);
        for ($i = 0; $i < $numItems; $i++) {
            plugin_user_create_mediagallery($_POST['user'][$i], 1);
        }
    }
    echo COM_refresh($_MG_CONF['admin_url'] . 'createmembers.php');
    exit;
}
Example #30
0
/**
* Continue a plugin upgrade that started in plugin_upload()
*
* @param    string  $plugin         plugin name
* @param    string  $pi_version     current plugin version
* @param    string  $code_version   plugin version to be upgraded to
* @return   string                  HTML refresh
* @see      function plugin_upload
*
*/
function continue_upgrade($plugin, $pi_version, $code_version)
{
    global $_CONF, $_TABLES;
    $retval = '';
    $msg_with_plugin_name = false;
    // simple sanity checks
    if (empty($plugin) || empty($pi_version) || empty($code_version) || $pi_version == $code_version) {
        $msg = 72;
    } else {
        // more sanity checks
        $result = DB_query("SELECT pi_version, pi_enabled FROM {$_TABLES['plugins']} WHERE pi_name = '" . addslashes($plugin) . "'");
        $A = DB_fetchArray($result);
        if (!empty($A['pi_version']) && $A['pi_enabled'] == 1 && $A['pi_version'] == $pi_version && $A['pi_version'] != $code_version) {
            // continue upgrade process that started in plugin_upload()
            $result = PLG_upgrade($plugin);
            if ($result === true) {
                PLG_pluginStateChange($plugin, 'upgraded');
                $msg = 60;
                // successfully updated
            } else {
                $msg_with_plugin_name = true;
                $msg = $result;
                // message provided by the plugin
            }
        } else {
            $msg = 72;
        }
    }
    $url = $_CONF['site_admin_url'] . '/plugins.php?msg=' . $msg;
    if ($msg_with_plugin_name) {
        $url .= '&amp;plugin=' . $plugin;
    }
    $retval = COM_refresh($url);
    return $retval;
}