Beispiel #1
0
function getPhotosFromTemp($p, $id = 0)
{
    $out = '';
    $f = 0;
    $photos = explode(',', $_REQUEST[$p]);
    //delete files---------------
    if ($id) {
        $lastPhotos = lookupField('tnews_tnews', 'id', 'photos', $id);
        $lastPhotosArray = explode(',', $lastPhotos);
        for ($i = 0; $i < count($lastPhotosArray); $i++) {
            if (!in_array($lastPhotosArray[$i], $photos)) {
                $folder = getPhotoFolder($lastPhotosArray[$i]);
                $files = '../../uploads/' . $folder . '/' . $lastPhotosArray[$i];
                @unlink($files);
            }
        }
    }
    //-------------------
    for ($i = 0; $i < count($photos); $i++) {
        $folder = getPhotoFolder($photos[$i]);
        $tempFile = '../../uploads/temp/' . $photos[$i];
        $path = '../../uploads/' . $folder . '/';
        if (!file_exists($path)) {
            mkdir($path, 0777);
        }
        $newFile = $path . $photos[$i];
        if (!file_exists($newFile)) {
            @copy($tempFile, $newFile);
        }
        if (file_exists($newFile)) {
            if ($f != 0) {
                $out .= ',';
            }
            $f = 1;
            $out .= $photos[$i];
        }
    }
    return $out;
}
Beispiel #2
0
function getWidget($widget_id, $page_id, $condition)
{
    $wid_settings = getWidgetSettings($widget_id);
    $widget_title = lookupField('cms_widgets', 'id', 'title', $widget_id);
    $module_id = lookupField('cms_widgets', 'id', 'module_id', $widget_id);
    $table_name = lookupField('cms_modules', 'id', 'table_name', $module_id);
    $temp_html = getTemplate($widget_id, $wid_settings['template_id']);
    $template_main_html = $temp_html['main_html'];
    $template_item_html = $temp_html['item_html'];
    $final_condition = $wid_settings['condition'];
    if ($final_condition && $condition) {
        $final_condition = $wid_settings['condition'] . ' AND ' . $condition;
    } elseif ($condition) {
        $final_condition = ' WHERE ' . $condition;
    }
    $widget_sql = "SELECT * FROM `{$table_name}` " . $final_condition . " " . $wid_settings['limit'];
    $widget_result = mysql_query($widget_sql);
    $widget_numrows = mysql_num_rows($widget_result);
    $widget_total_numrows = mysql_num_rows(mysql_query("SELECT * FROM `{$table_name}` " . $final_condition));
    if ($widget_numrows) {
        $s = 0;
        while ($s < $widget_numrows) {
            $sql = "SELECT * FROM cms_widget_fields wid_fields, cms_template_fields temp_fields \n\t\t\tWHERE wid_fields.widget_id='{$widget_id}' and temp_fields.id=wid_fields.template_field_id";
            $result = mysql_query($sql);
            $numrows = mysql_num_rows($result);
            if ($numrows) {
                $i = 0;
                $item_html = $template_item_html;
                while ($i < $numrows) {
                    $template_field_id = mysql_result($result, $i, 'wid_fields.template_field_id');
                    $template_field_title = mysql_result($result, $i, 'temp_fields.title');
                    $temp_feild_settings = getTempFieldSettings($template_field_id);
                    $module_field_id = mysql_result($result, $i, 'wid_fields.module_field_id');
                    $module_field_title = lookupField('cms_module_fields', 'id', 'title', $module_field_id);
                    $module_field_type = lookupField('cms_module_fields', 'id', 'type', $module_field_id);
                    $item_val = mysql_result($widget_result, $s, $module_field_title);
                    $sub_page_id = mysql_result($widget_result, $s, 'page_id');
                    $sub_page_title = lookupField('cms_pages', 'id', 'title', $sub_page_id);
                    $sub_page_link = _PREF . $_SESSION['pLang'] . '/page' . $sub_page_id . '/' . $sub_page_title;
                    if ($module_field_type == 'photo') {
                        if ($temp_feild_settings['resize_type'] == 'crop' || $temp_feild_settings['resize_type'] == 'resize') {
                            $thumb = viewPhoto($item_val, $temp_feild_settings['resize_type'], $temp_feild_settings['width'], $temp_feild_settings['height'], 'css', 1, $_SESSION['dots'], 0);
                        } else {
                            $thumb = viewPhoto($item_val, 'full', '', '', 'css', 1, $_SESSION['dots'], 0);
                        }
                        $thumb = str_replace(');', '', str_replace('background-image:url(', '', $thumb));
                        $item_val = $thumb;
                    } else {
                        if ($temp_feild_settings['limit']) {
                            $item_val = limit($item_val, $temp_feild_settings['limit']);
                        }
                    }
                    $item_html = str_replace("##{$template_field_title}##", $item_val, $item_html);
                    $item_html = str_replace("##sub_link##", $sub_page_link, $item_html);
                    $i++;
                }
                $extra_widgets_arr = getContents($item_html, '##wid_start##', '##wid_end##');
                foreach ($extra_widgets_arr as $widget_content) {
                    $sub_widget_id = getContents($widget_content, '##wid_id_start##', '##wid_id_end##')[0];
                    $widget_condition = getContents($widget_content, '##wid_con_start##', '##wid_con_end##')[0];
                    $con_fields_arr = getContents($widget_condition, '##', '##');
                    foreach ($con_fields_arr as $field) {
                        $widget_condition = str_replace("##{$field}##", mysql_result($widget_result, $s, $field), $widget_condition);
                    }
                    $extra_widgets = getWidget($sub_widget_id, '', $widget_condition);
                    $item_html = replaceContents($item_html, '##ws' . $sub_widget_id . '##', '##we' . $sub_widget_id . '##', $extra_widgets);
                    $item_html = str_replace('##ws' . $sub_widget_id . '##', '', str_replace('##we' . $sub_widget_id . '##', '', $item_html));
                }
                $widget_items_html .= $item_html;
            }
            $s++;
        }
    }
    $extra_widgets_arr = getContents($template_main_html, '##wid_start##', '##wid_end##');
    foreach ($extra_widgets_arr as $widget_content) {
        $widget_id = getContents($widget_content, '##wid_id_start##', '##wid_id_end##')[0];
        $widget_condition = getContents($widget_content, '##wid_con_start##', '##wid_con_end##')[0];
        $con_fields_arr = getContents($widget_condition, '##', '##');
        foreach ($con_fields_arr as $field) {
            $widget_condition = str_replace("##{$field}##", mysql_result($widget_result, 0, $field), $widget_condition);
        }
        $extra_widgets = getWidget($widget_id, '', $widget_condition);
        $template_main_html = replaceContents($template_main_html, '##ws' . $widget_id . '##', '##we' . $widget_id . '##', $extra_widgets);
        $template_main_html = str_replace('##ws' . $widget_id . '##', '', str_replace('##we' . $widget_id . '##', '', $template_main_html));
    }
    $link = _PREF . $_SESSION['pLang'] . '/page' . $page_id . '/pn^/' . $widget_title;
    $main_page_title = lookupField('cms_pages', 'id', 'title', $page_id);
    $final_html = str_replace("##main_page_title##", $main_page_title, $template_main_html);
    $final_html = str_replace("##site_pref##", _PREF, $final_html);
    $final_html = str_replace("##template_items##", $widget_items_html, $final_html);
    $final_html .= getPagination($wid_settings['pagination_id'], $widget_total_numrows, $wid_settings['limit_num'], $link);
    if (!$final_html) {
        $final_html = '';
    }
    return $final_html;
}
        ?>
": function() {$(this).dialog("close");} 
	}
});
	
});
<?php 
    }
    ?>
</script>
<input name="des2" type="hidden" id="des2" value="d" size="100">
<?php 
    // Images Extentions
    $img_arr = array("jpg", "jpeg", "gif", "png", "JPG", "JPEG", "GIF", "PNG");
    $gid = $_SESSION['gid'];
    $ph = lookupField('galleries_galleries', 'id', 'photos', $gid);
    $photos = explode(',', $ph);
    $folder = $_REQUEST['folder'];
    $sql = "SELECT * FROM galleries_photos where folder='{$folder}' {$sort}  order by id DESC";
    $result = MYSQL_QUERY($sql);
    $numberOfRows = MYSQL_NUMROWS($result);
    $i = 0;
    while ($i < $numberOfRows) {
        $id = MYSQL_RESULT($result, $i, "id");
        $photo = MYSQL_RESULT($result, $i, "photo");
        $folder = MYSQL_RESULT($result, $i, "folder");
        $description = MYSQL_RESULT($result, $i, "description");
        $thumb = MYSQL_RESULT($result, $i, "thumb");
        $file_path = '../../../uploads/' . $folder . $photo;
        if (file_exists($file_path)) {
            if ($thumb != 'video') {
Beispiel #4
0
 function getNameForID($id)
 {
     global $default;
     $sName = lookupField($default->groups_table, "name", "id", $id);
     return $sName;
 }
Beispiel #5
0
     if (getPubPer($news_user_id, $idvalue, 'com') > 0) {
         if (mysql_query("UPDATE {$table} SET  {$fname} = '{$fvalue}' {$Q} WHERE {$idname} = '{$idvalue}'")) {
             echo $fvalue;
             if ($fvalue) {
                 $opr = 6;
             } else {
                 $opr = 7;
             }
             logNews($news_user_id, $opr, 0, $idvalue);
         } else {
             echo !$fvalue;
         }
     }
 } else {
     if (getPubPer($news_user_id, $idvalue, 'pub') > 0) {
         $user_publisher = lookupField('tnews_tnews', 'id', 'user_publisher', $idvalue);
         if ($user_publisher == 0) {
             $Q = " ,user_publisher='{$news_user_id}' , publish_date ='{$curr_date}'";
         }
         if (mysql_query("UPDATE {$table} SET  {$fname} = '{$fvalue}' {$Q} WHERE {$idname} = '{$idvalue}'")) {
             echo $fvalue;
             if ($fvalue) {
                 $opr = 4;
             } else {
                 $opr = 5;
             }
             logNews($news_user_id, $opr, $idvalue);
         } else {
             echo !$fvalue;
         }
     }
<?php

include 'gal_header.php';
if (!defined('GOOD')) {
    die;
}
if (checkGallogin()) {
    if (isset($_POST['id']) && isset($_POST['opr'])) {
        $id = $_POST['id'];
        $opr = $_POST['opr'];
        $gid = $_SESSION['gid'];
        $Q == '';
        $ph = lookupField('galleries_galleries', 'id', 'photos', $gid);
        $Mph = lookupField('galleries_galleries', 'id', 'main_photo', $gid);
        $photos = explode(',', $ph);
        if ($opr == 'add') {
            if ($ph != '') {
                $newPhotos = $ph . ',' . $id;
            } else {
                $newPhotos = $id;
                $sql2 = "update galleries_galleries set main_photo='{$id}' where id='{$gid}'";
                $res2 = mysql_query($sql2);
            }
        }
        if ($opr == 'del') {
            $first_id = '';
            $newPhotos = '';
            $first = 1;
            for ($i = 0; $i < count($photos); $i++) {
                if ($id != $photos[$i]) {
                    if ($first == 1) {
Beispiel #7
0
function getSPath($thisfile, $pageLang)
{
    switch ($thisfile) {
        case "viewNews":
            $id = $_REQUEST['id'];
            $query = "SELECT * FROM `news` where id={$id}";
            $result = mysql_query($query);
            $path = "";
            if (mysql_num_rows($result) > 0) {
                $mid = getMenuId("news/viewAllNews.php", $pageLang);
                $path = getMenuPath($mid);
                //$path.="<a href='"._PREF."forms/news/viewNews.php?id=$id'> ".getTitle("viewNews", $pageLang)." </a>";
            } else {
                $title = "";
            }
            break;
        case "viewEvents":
            $id = $_REQUEST['id'];
            $query = "SELECT * FROM `events` where id={$id}";
            $result = mysql_query($query);
            $path = "";
            if (mysql_num_rows($result) > 0) {
                $mid = getMenuId("events/viewAllEvents.php", $pageLang);
                $path = getMenuPath($mid);
                //$path.="<a href='"._PREF."forms/news/viewNews.php?id=$id'> ".getTitle("viewNews", $pageLang)." </a>";
            } else {
                $title = "";
            }
            break;
        case "viewTeam_work":
            $id = $_REQUEST['id'];
            $query = "SELECT * FROM `team_work` where id={$id}";
            $result = mysql_query($query);
            $path = "";
            if (mysql_num_rows($result) > 0) {
                $mid = getMenuId("team_work/viewAllTeam_work.php", $pageLang);
                $path = getMenuPath($mid);
            } else {
                $title = "";
            }
            break;
        case "viewJobs":
        case "jobsApply":
            $id = $_REQUEST['jobId'] == "" ? $_REQUEST['id'] : $_REQUEST['jobId'];
            $query = "SELECT * FROM `jobs` where id={$id}";
            $result = mysql_query($query);
            $path = "";
            if (mysql_num_rows($result) > 0) {
                $mid = getMenuId("jobs/viewAllJobs.php", $pageLang);
                $path = getMenuPath($mid);
                //$path.="<a href='"._PREF."forms/news/viewNews.php?id=$id'> ".getTitle("viewNews", $pageLang)." </a>";
            } else {
                $title = "";
            }
            break;
        case "viewModuleData":
            $id = $_REQUEST['module_id'];
            $query = "SELECT * FROM `modules` where `module_id`={$id}";
            $result = mysql_query($query);
            $path = "";
            if (mysql_num_rows($result) > 0) {
                $mid = getMenuId("cmodules/viewAllModuleData.php?module_id={$id}", $pageLang);
                $path = getMenuPath($mid);
            } else {
                $title = "";
            }
            break;
        case "viewGallery":
            $path = "<a href='" . _PREF . "'>" . Homepage . "</a>  <a href='" . _PREF . "all/viewAllGalleries.php'>" . Photos . "</a>  ";
            break;
        case "viewMembers":
            $path = "<a href='" . _PREF . "'>" . Homepage . "</a>  <a href='" . _PREF . "forms/members/viewAllMembers.php'>" . Members . "</a>  ";
            break;
        case "viewCompany":
            $path = "<a href='" . _PREF . "'>" . Homepage . "</a>  <a href='" . _PREF . "forms/company/viewAllCompany.php?c=1'>" . Directory . "</a>  ";
            break;
        case "viewAllLinks":
            $path = "<a href='" . _PREF . "'>" . Homepage . "</a>  <a href='#'>" . Links . "</a> ";
            break;
        case "viewAssociations":
            $path = "<a href='" . _PREF . "'>" . Homepage . "</a>  <a href='" . _PREF . "forms/associations/viewAllAssociations.php'>" . Associations . "</a>  ";
            break;
        case "viewAllCommittees":
            $path = "<a href='" . _PREF . "'>" . Homepage . "</a>  <a href='#'>" . Committees . "</a> ";
            break;
        case "viewCommittees":
            $path = "<a href='" . _PREF . "'>" . Homepage . "</a>  <a href='" . _PREF . "forms/committees/viewAllCommittees.php?com_type=perment'>" . Committees . "</a> ";
            break;
        case "viewArticles":
            $path = "<a href='" . _PREF . "'>" . Homepage . "</a>  <a href='" . _PREF . "forms/articles/viewAllArticles.php'>" . Articles . "</a> ";
            break;
        case "viewProducts":
            $pro_id = $_REQUEST['pro_id'];
            $query = "SELECT * FROM products where pro_id={$pro_id}";
            $result = mysql_query($query);
            $path = "";
            if (mysql_num_rows($result) > 0) {
                $cat_id = MYSQL_RESULT($result, 0, "cat_id");
                //$mid=getMenuId("products/viewAllProducts.php?cat=$cat_id",$pageLang);
                //$path=getMenuPath($mid);
                $path = "<a href='" . _PREF . "'>" . Homepage . "</a> ";
                $path .= "<a href='" . _PREF . "forms/products/viewAllProducts.php?cat={$cat_id}'> " . lookupField("products_categories", "cat_id", "cat_name_{$pageLang}", $cat_id) . " </a>";
                $path .= "<a href='" . _PREF . "forms/products/viewProducts.php?pro_id={$pro_id}'> " . getTitle("viewProducts", $pageLang) . " </a>";
            } else {
                $path = "";
            }
            break;
        case "viewAllProducts":
            $cat_id = $_REQUEST['cat'];
            $query = "SELECT * FROM products_categories where cat_id='{$cat_id}'";
            $result = mysql_query($query);
            $path = "";
            if (mysql_num_rows($result) > 0) {
                $cat_name = MYSQL_RESULT($result, 0, "cat_name_{$pageLang}");
                $path = "<a href='" . _PREF . "'>" . Homepage . "</a> ";
                $path .= "<a href='" . _PREF . "forms/products/viewAllProducts.php?cat={$cat_id}'> " . $cat_name . " </a>";
            } else {
                $path = "";
            }
            break;
        default:
            $path = "<a href='" . _PREF . "'>" . Homepage . "</a> ";
    }
    return $path;
}
Beispiel #8
0
	$photos=explode(',',$ph);
	if ($Folder = opendir($root)){
		$i=0;
		while (false !== ($file = readdir($Folder))){
			if ($file != "." && $file != "..") {
				$fileNameParts = explode(".",$file);
				$Ex =strtolower(end($fileNameParts));
				if(in_array($Ex,$img_arr)){
					if(!is_dir($root.$file)){
						$bgcol='fff';
						$inList=0;					
						if(in_array($file,$photos)){						
							$bgcol='abe799';
							$inList=1;
						}
						$img_name=lookupField('subjects_attach','attach','name',$file,"name!=''");
						if($img_name=='0')$img_name=$file;
						$icon='../css/images/filesTypes/'.$Ex.'.png';
						if(!file_exists($icon)){$icon='../css/images/filesTypes/x.png';}
						
						$img=resizeToFile($icon, 90, 90,'../../../uploads/cash/I90_'.$Ex.'.png'); 						
						if($img)$img='../../uploads/cash/I90_'.$Ex.'.png';
						?>
                        <div class="fl">										
                            <div class="l_attach" align="center" 
                            id="att<?php 
echo $i;
?>
" 
                            act="<?php 
echo $inList;