Ejemplo n.º 1
0
 function unsetKeywords($filename)
 {
     if (empty($this->indexes['main'][$filename]) || !is_file(GALLERY_IMAGES_DIR . $filename)) {
         return false;
     }
     $keywords = explode(';', @$this->indexes['main'][$filename]['keywords']);
     if (!empty($keywords)) {
         foreach ($keywords as $keyword) {
             $keyword = trim($keyword);
             $k = @array_search($filename, $this->indexes['keywords'][$keyword]);
             @rcms_remove_index($k, $this->indexes['keywords'][$keyword], true);
         }
     }
     return true;
 }
Ejemplo n.º 2
0
function post_remove($id, $file = RCMS_GB_DEFAULT_FILE)
{
    global $_CACHE;
    $data =& $_CACHE['gbook'][$file];
    if (!isset($data)) {
        if (!is_readable($file) || !($data = unserialize(file_get_contents($file)))) {
            $data = array();
        }
    }
    rcms_remove_index($id, $data, true);
    if (file_write_contents($file, serialize($data))) {
        show_window('', __('Comment removed'));
    } else {
        show_window(__('Error'), __('Comment are not removed!'));
    }
}
Ejemplo n.º 3
0
function pm_post_remove($id, $file = RCMS_PM_DEFAULT_FILE)
{
    global $_CACHE;
    $data =& $_CACHE['gbook'][$file];
    if (!isset($data)) {
        if (!is_readable($file) || !($data = unserialize(file_get_contents($file)))) {
            $data = array();
        }
    }
    rcms_remove_index($id, $data, true);
    return file_write_contents($file, serialize($data));
}
Ejemplo n.º 4
0
 function deleteComment($cat_id, $art_id, $comment)
 {
     $cat_id = (int) $cat_id;
     $art_id = (int) $art_id;
     if (empty($this->container)) {
         $this->last_error = __('No section selected!');
         return false;
     }
     if ($this->container !== '#root' && $this->container !== '#hidden') {
         if (!($category = $this->getCategory($cat_id))) {
             return false;
         }
         $art_prefix = ARTICLES_PATH . $this->container . '/' . $cat_id . '/' . $art_id . '/';
     } else {
         $art_prefix = ARTICLES_PATH . $this->container . '/' . $art_id . '/';
     }
     if ($data = @unserialize(@file_get_contents($art_prefix . 'comments'))) {
         if (isset($data[$comment])) {
             rcms_remove_index($comment, $data, true);
             @file_write_contents($art_prefix . 'comments', serialize($data));
             $article_data = rcms_parse_ini_file($art_prefix . 'define');
             $article_data['comcount']--;
             @write_ini_file($article_data, $art_prefix . 'define');
         }
         if ($this->container !== '#root' && $this->container !== '#hidden') {
             $this->index[$cat_id][$art_id]['ccnt']--;
         } else {
             $this->index[$art_id]['ccnt']--;
         }
         $res = $this->saveIndex();
         return $res;
     } else {
         return false;
     }
 }
Ejemplo n.º 5
0
function guestbook_post_remove($id, $file = RCMS_GB_DEFAULT_FILE, $config = 'guestbook.ini')
{
    global $_CACHE;
    $config = parse_ini_file(CONFIG_PATH . $config);
    $data =& $_CACHE['gbook'][$file];
    if (!isset($data)) {
        if (!is_readable($file) || !($data = unserialize(file_get_contents($file)))) {
            $data = array();
        }
    }
    rcms_remove_index($id, $data, true);
    return file_write_contents($file, serialize($data));
}
Ejemplo n.º 6
0
            }
        } else {
            show_error(__('You cannot delete this topic'));
        }
    } else {
        show_error(__('There is no topic with this id'));
    }
} elseif ($action == 'del_post') {
    $topic_id = empty($_GET['t']) ? 0 : (int) $_GET['t'];
    $post_id = empty($_GET['p']) ? 0 : (int) $_GET['p'] - 2;
    if (!empty($topics[$topic_id])) {
        $posts = @unserialize(@file_get_contents(FORUM_PATH . 'topic.' . $topic_id . '.dat'));
        if (!empty($posts[$post_id])) {
            if ($system->checkForRight('FORUM') || $system->user['username'] != 'guest' && $system->user['username'] == $posts[$post_id]['author_name']) {
                $topics[$topic_id]['replies']--;
                rcms_remove_index($post_id, $posts, true);
                if ($topics[$topic_id]['replies'] != 0 && $topics[$topic_id]['last_reply_id'] == $post_id) {
                    $dates = array();
                    foreach ($posts as $post_id => $post) {
                        if (!empty($post)) {
                            $dates[$post['date']] = array($post_id, $post['date']);
                        }
                    }
                    krsort($dates, SORT_NUMERIC);
                    $keys = array_keys($dates);
                    $topics[$topic_id]['last_reply_id'] = $dates[$keys[0]][0];
                    $topics[$topic_id]['last_reply'] = $dates[$keys[0]][1];
                } elseif ($topics[$topic_id]['replies'] == 0) {
                    $topics[$topic_id]['last_reply_id'] = 0;
                    $topics[$topic_id]['last_reply'] = $topics[$topic_id]['date'];
                }
Ejemplo n.º 7
0
                    if (is_dir($file) && $file != "." && $file != "..") {
                        if (@rmdir($file)) {
                            $result .= __('Directory removed') . ': ' . $file . '<br/>';
                        }
                    }
                }
                if ($file != './') {
                    $result .= __('File removed') . ': ' . $file . '<br/>';
                } else {
                    $result .= '------------------------------------------------------<br/>' . __('Module removed') . ': ' . $name[0] . '<br/><br/>';
                }
                if (is_file($installerPath . $filename)) {
                    $installer[$name[0]] = $uninstaller[$name[0]];
                }
            }
            rcms_remove_index($name[0], $uninstaller, true);
            write_ini_file($installer, CONFIG_PATH . 'installer.ini', true);
            write_ini_file($uninstaller, CONFIG_PATH . 'uninstaller.ini', true);
        }
    }
    if (!empty($result)) {
        rcms_showAdminMessage($result);
    }
}
// Interface generation
// Show information from uninstaller.ini
$frm = new InputForm('', 'post', __('Submit'));
$frm->addbreak(__('Uninstall modules'));
if (!empty($uninstaller)) {
    $frm->addrow(__('Available modules'), __('Modules management'));
} else {