Ejemplo n.º 1
0
 public function attach_videoembed($video)
 {
     global $C;
     if (isset($this->attached['videoembed'])) {
         unset($this->attached['videoembed']);
     }
     $data = (object) array('in_tmpdir' => TRUE, 'src_site' => '', 'src_id' => '', 'title' => '', 'file_thumbnail' => time() . rand(100000, 999999) . '_thumb.gif', 'embed_code' => '', 'embed_w' => '', 'embed_h' => '', 'orig_url' => '', 'hits' => 0);
     $S = $C->NEWPOST_EMBEDVIDEO_SOURCES;
     foreach ($S as $k => $obj) {
         if (preg_match($obj->src_url_pattern, $video, $matches)) {
             $data->src_id = $matches[$obj->src_url_matchnum];
             $data->src_site = $k;
             break;
         } elseif (preg_match($obj->src_emb_pattern, $video, $matches)) {
             $data->src_id = $matches[$obj->src_emb_matchnum];
             $data->src_site = $k;
             break;
         }
     }
     if (empty($data->src_site) || empty($data->src_id)) {
         return FALSE;
     }
     $S = $S[$data->src_site];
     $data->embed_w = $S->embed_w;
     $data->embed_h = $S->embed_h;
     $data->embed_code = str_replace('###ID###', $data->src_id, $S->embed_code);
     $data->orig_url = str_replace('###ID###', $data->src_id, $S->insite_url);
     if (!empty($S->embed_thumb)) {
         $tmp = str_replace('###ID###', $data->src_id, $S->embed_thumb);
         if (copy($tmp, $C->TMP_DIR . $data->file_thumbnail)) {
             $res = copy_attachment_videoimg($C->TMP_DIR . $data->file_thumbnail, $C->TMP_DIR . $data->file_thumbnail, $C->ATTACH_VIDEO_THUMBSIZE);
             if (!$res) {
                 rm($C->TMP_DIR . $data->file_thumbnail);
             }
         }
     }
     if (!file_exists($C->TMP_DIR . $data->file_thumbnail)) {
         $data->file_thumbnail = '';
     }
     return $this->attached['videoembed'] = $data;
 }
Ejemplo n.º 2
0
$D->g =& $g;
$D->i_am_member = $this->user->if_follow_group($g->id);
$D->i_am_admin = FALSE;
$D->i_am_adming = FALSE;
if ($D->i_am_member) {
    $D->i_am_adming = $db->fetch('SELECT id FROM groups_admins WHERE group_id="' . $g->id . '" AND user_id="' . $this->user->id . '" LIMIT 1') ? TRUE : FALSE;
    $D->i_am_admin = $D->i_am_adming;
}
if (!$D->i_am_admin && $this->user->info->is_network_admin == 1) {
    $D->i_am_admin = TRUE;
}
$D->i_can_invite = $D->i_am_admin || $D->i_am_member && $g->is_public;
$D->g_avatar = md5($D->g->id . '-' . $D->g->avatar) . '.' . pathinfo($D->g->avatar, PATHINFO_EXTENSION);
if (!file_exists($C->TMP_DIR . $D->g_avatar)) {
    require_once $C->INCPATH . 'helpers/func_images.php';
    copy_attachment_videoimg($C->IMG_DIR . 'avatars/' . $D->g->avatar, $C->TMP_DIR . $D->g_avatar, 100);
}
$D->num_members = count($this->network->get_group_members($g->id));
$D->num_admins = intval($db->fetch_field('SELECT COUNT(*) FROM groups_admins WHERE group_id="' . $g->id . '" '));
$shows = array('updates', 'members', 'admins');
$D->show = 'updates';
if ($this->param('show') && in_array($this->param('show'), $shows)) {
    $D->show = $this->param('show');
}
if ($D->show == 'updates') {
    $D->num_results = 0;
    $D->start_from = 0;
    $D->posts_html = '';
    $q1 = 'SELECT COUNT(*) FROM posts WHERE group_id="' . $g->id . '"';
    $q2 = 'SELECT *, "public" AS `type` FROM posts WHERE group_id="' . $g->id . '" ORDER BY id DESC ';
    $D->num_results = $db2->fetch_field($q1);
Ejemplo n.º 3
0
             @chmod($path2 . $file, 0777);
         }
         closedir($dir);
         include_once INCPATH . '../../system/helpers/func_images.php';
         $C->IMAGE_MANIPULATION = 'gd';
         $path1 = INCPATH . '../../img/avatars/thumbs2/';
         $path2 = INCPATH . '../../i/avatars/thumbs3/';
         $dir = opendir($path1);
         while ($file = readdir($dir)) {
             if ($file == '.' || $file == '..') {
                 continue;
             }
             if (!is_file($path1 . $file)) {
                 continue;
             }
             copy_attachment_videoimg($path1 . $file, $path2 . $file, 30);
         }
         closedir($dir);
     }
 }
 if (!$error) {
     $config = @file_get_contents(INCPATH . 'conf_main_empty.php');
     if (!$config) {
         $error = TRUE;
         $errmsg = 'zbyB0a';
     }
     if (!$error) {
         $rndkey = substr(md5(time() . rand()), 0, 5);
         $config = config_replace_variable($config, '$C->DOMAIN', $s['DOMAIN']);
         $config = config_replace_variable($config, '$C->SITE_URL', $s['SITE_URL']);
         $config = config_replace_variable($config, '$C->RNDKEY', $rndkey);