Example #1
0
 function printServiceErrorMsg($errCode, $errMsg = null, $errorImg = "")
 {
     if ($errCode == null) {
         $errCode = 500;
     }
     if (is_numeric($errCode)) {
         $errorMessage = getErrorTitle($errCode);
     } else {
         $errorMessage = "";
     }
     if ($errMsg == null) {
         $errMsg = $errorMessage;
     }
     if ($errorImg != null && strlen($errorImg) > 0) {
         $errorImg = loadMedia($errorImg);
     } else {
         $errorImg = loadMedia("images/errors/msg_default.png");
     }
     $arr = array();
     $arr['ErrorCode'] = $errCode;
     $arr['Data'] = $errMsg;
     $arr['ErrorDescs'] = _replace($errorMessage);
     $arr['ErrorIcon'] = $errorImg;
     printServiceData($arr, null, $errCode);
 }
Example #2
0
 function getUserAvatar($params)
 {
     if (is_array($params)) {
         if (isset($params['avatar'])) {
             if (strpos("#" . $params['avatar'], "http://") || strpos("#" . $params['avatar'], "https://")) {
                 return $params['avatar'];
             } elseif (isset($params['avatar_type'])) {
                 return _service("avatar") . "&authorid={$data['avatar']}&method={$data['avatar_type']}";
             } elseif (is_numeric($data['avatar'])) {
                 return _service("avatar") . "&authorid={$data['avatar']}&method=photoid";
             } else {
                 return _service("avatar") . "&authorid={$data['avatar']}&method=email";
             }
         } elseif (isset($params['userid'])) {
             $params = $params['userid'];
         } else {
             return loadMedia("images/user.png");
         }
     }
     //SQL Type
     $sql = _db(true)->_selectQ(_dbTable("users", true), "avatar,avatar_type")->_where(array("blocked" => 'false', "userid" => $params));
     $res = _dbQuery($sql, true);
     $data = [];
     if ($res) {
         $data = _dbData($res, true);
         _dbFree($res, true);
         if (isset($data[0])) {
             $data = $data[0];
             return getUserAvatar($data);
         }
     }
     return loadMedia("images/user.png");
 }
Example #3
0
 function loadAllMedia($media, $relativeOnly = false, $defaultMedia = null)
 {
     if (strlen($media) <= 0) {
         return "";
     }
     $linkedApps = getConfig("LINKED_APPS");
     if (strlen($linkedApps) <= 0) {
         return loadMedia($media, $relativeOnly);
     }
     $linkedApps = explode(",", $linkedApps);
     $cachePath = _metaCache("MEDIA:ALL", $media);
     if (!$cachePath) {
         $paths = getLoaderFolders('mediaPaths', "");
         foreach ($linkedApps as $app) {
             $appDir = str_replace("#APPROOT#", APPROOT, $app) . "/";
             if (is_dir(ROOT . $appDir)) {
                 foreach ($mediaPaths as $mp) {
                     $f = $appDir . $mp . $media;
                     if (file_exists(ROOT . $f)) {
                         _metaCacheUpdate("MEDIA:ALL", $media, $f);
                         if (!$relativeOnly) {
                             return SiteLocation . $f;
                         } else {
                             return $f;
                         }
                     }
                 }
             }
         }
         return loadMedia($media, $relativeOnly);
     } else {
         if (!$relativeOnly) {
             return SiteLocation . $cachePath;
         } else {
             return $cachePath;
         }
     }
 }
/**
 * Smarty plugin
 *
 * @package    Smarty
 * @subpackage PluginsFunction
 * @author		Bismay Kumar Mohaptra
 */
function smarty_function_logikscripts($params)
{
    include_once ROOT . API_FOLDER . "scripts.php";
    $s = "";
    $bg = getConfig("PAGE_BACKGROUND");
    if (strlen($bg) > 0) {
        if (substr($bg, 0, 7) == "http://" || substr($bg, 0, 8) == "https://") {
            $s = "background: url({$bg}) repeat;";
            $s = "body { {$s} }";
        } elseif (file_exists($bg)) {
            $bg = getWebPath($bg);
            $s = "background: url({$bg}) repeat;";
            $s = "body { {$s} }";
        } else {
            $s = "background: url(" . loadMedia($bg) . ") repeat;";
            $s = "body { {$s} }";
        }
    }
    if (strlen($s) > 0) {
        $s = "<style>{$s}</style>";
    }
    echo $s;
}
Example #5
0
				</div>
				<div class="form-group">
					<label>Long Description *</label> <small>(function parameters.return type description)</small>
					<a id="showHelp" class='fa fa-question-circle' style="cursor:pointer;float:right;font-size: 12px;line-height: 26px;">  Help <i fa  fa-question></i></a>
					<textarea class="form-control required" rows="3" name="descs_long" id="descs_long" required><?php 
    if (isset($apiDetails['descs_long'])) {
        echo $apiDetails['descs_long'];
    }
    ?>
</textarea>
				</div>
										
			
				<div class="form-group" id="descriptionHelp" style="display:none;">
					<img src="<?php 
    echo loadMedia('images/text-help.png');
    ?>
" style='max-width:100%;width:100%;' />
				</div>
				<hr/>
				
				<div class="form-inline">
					<div class="form-group">
						<label>Version Dependencies</label>
						
						<select class="form-control " name="min_vers" id="min_vers" value="<?php 
    if (isset($apiDetails['min_vers'])) {
        echo $apiDetails['min_vers'];
    } else {
        echo "*";
    }
Example #6
0
            $_REQUEST['category'] = $page[1];
            loadModuleLib("guides", "list");
        } else {
            ?>
			<div class="container-fluid">
				<?php 
            if (session_check(false)) {
                ?>
				<div id='toolbar' class="text-right">
					<a href="<?php 
                echo _link("guides/create");
                ?>
">Create</a>
				</div>
				<?php 
            }
            ?>
				<div class="row">
			            <h1 class="title">
							<img class=logoimg src='<?php 
            echo loadMedia("logos/logo-128.png");
            ?>
' alt='Logo Image' />
							<br/>
							Logiks GUIDES
						</h1>
			    </div>
			</div>
			<?php 
        }
}
Example #7
0
<div class="hea-navbar">
	  <ul>
		<?php 
$pg = $_REQUEST['page'];
$pg = explode("/", $pg);
if ($pg[0] == "home") {
    $pg[0] = "api";
}
foreach ($menuData as $n => $a) {
    $cls = $a['class'];
    if ($n == 0) {
        $cls .= " first";
    }
    $cls = trim($cls);
    if (strlen($a['iconpath']) > 0) {
        $icon = loadMedia($a['iconpath']);
        $icon = "<img src='{$icon}' />";
    } else {
        $icon = "";
    }
    if ($a['link'] == $_REQUEST['page'] || $a['link'] == $pg[0]) {
        $cls .= " active";
    }
    $a['link'] = _link($a['link']);
    $a['link'] = str_replace("//", "/", $a['link']);
    $a['link'] = str_replace(":/", "://", $a['link']);
    echo "<li class='{$cls}' title='{$a['tips']}' ><a href='{$a['link']}'>{$icon}{$a['title']}</a></li>";
}
?>
		<li class="dropdown">
          <?php 
Example #8
0
/**
 * Smarty plugin
 *
 * @package    Smarty
 * @subpackage PluginsFunction
 * @author		Bismay Kumar Mohaptra
 */
function smarty_function_media($params)
{
    return loadMedia($params['src'], false);
}
Example #9
0
                if ($a == ".svg") {
                    $content = file_get_contents($f);
                    header('Content-type: image/svg+xml');
                    echo $content;
                } else {
                    $ax = substr($a, 1);
                    $content = file_get_contents($f);
                    header("Content-type: image/{$ax}\n");
                    header("Content-Transfer-Encoding: binary\n");
                    echo $content;
                }
            }
        }
        break;
    case "image":
        $f = loadMedia($bg);
        if (!file_exists($f)) {
            $f = ROOT . MEDIA_FOLDER . "cssbg/blank.gif";
        }
        $ext = end(explode(".", $bg));
        header("Content-type: image/{$ext}\n");
        header("Content-Transfer-Encoding: binary\n");
        readfile($f);
        break;
    case "gradient":
        break;
    case "color":
        break;
    case "random":
        break;
}
Example #10
0
function printDefaultAvatar()
{
    $f = ROOT . loadMedia("images/avatar.png", true);
    if (!file_exists($f)) {
        $f = ROOT . loadMedia("images/user.png", true);
    }
    header("content-type:image/png");
    readfile($f);
    exit;
}
Example #11
0
function uploadTmpFile()
{
    //return $_FILES['file'];
    if (!isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
        //check if this is an ajax request
        exit;
    }
    if (!isset($_FILES['file']) || !is_uploaded_file($_FILES['file']['tmp_name'])) {
        exit('Something wrong with uploaded file, something missing!');
    }
    $date = date('Y-m-d H:i:s');
    $file_name = $_FILES['file']['name'];
    $filename = $_FILES['file']['name'];
    $file_size = $_FILES['file']['size'];
    $file_src = $_FILES['file']['tmp_name'];
    $file_type = $_FILES['file']['type'];
    //return $_POST;
    $time_stamp = time();
    $file_name = str_replace(' ', '-', strtolower($file_name));
    $file_name = str_replace('(', '', strtolower($file_name));
    $file_name = str_replace(')', '', strtolower($file_name));
    $path_part = pathinfo($file_name);
    $file_ext = $path_part['extension'];
    $file_name = $path_part['filename'];
    $file_new_name = $file_name . '-' . $time_stamp . '.' . $file_ext;
    $plain_path = 'api_files/';
    $source_path = APPROOT . APPS_USERDATA_FOLDER . $plain_path;
    if (!file_exists($source_path)) {
        mkdir($source_path, 0777, true);
    }
    $file_dest_name = $source_path . $file_new_name;
    if (!move_uploaded_file($file_src, $file_dest_name)) {
        echo "failed to copy {$filename} src " . $file_src . " dest " . $file_dest_name;
    } else {
        /*echo json_encode($_FILES['file']);*/
        $_FILES['file']['path'] = loadMedia($plain_path . $file_new_name);
        //$_FILES['file']['path']=$plain_path.$file_new_name;
        return $_FILES['file'];
    }
}
Example #12
0
?>
" autocomplete='off'>
						<input name=onsuccess type=hidden value="<?php 
echo SiteLocation . SITENAME;
?>
" />
						<input name=onerror type=hidden value="*" />
						<input name=site type=hidden value="<?php 
echo SITENAME;
?>
" />
						<fieldset>
							<div class="row">
								<div class="center-block">
									<img class='profile-img' src="<?php 
echo loadMedia("images/loginUser.png");
?>
" />
								</div>
							</div>
							<div class="row">
								<div class="col-sm-12 col-md-10  col-md-offset-1 ">
									<div class="form-group">
										<div class="input-group">
											<span class="input-group-addon">
												<i class="fa fa-user"></i>
											</span> 
											<input class="form-control" placeholder="Username" name="userid" type="text" autofocus>
										</div>
									</div>
									<div class="form-group">
Example #13
0
function printDefaultImage()
{
    $media = ROOT . loadMedia("images/nocaptcha.png", true);
    if (file_exists($media)) {
        header("Expires: Wed, 1 Jan 1997 00:00:00 GMT");
        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
        header("Cache-Control: no-store, no-cache, must-revalidate");
        header("Cache-Control: post-check=0, pre-check=0", false);
        header("Content-Transfer-Encoding: binary");
        header("Pragma: no-cache");
        header("Content-type:image/png");
        readfile($media);
    } else {
        echo "No Captcha ID Found";
    }
    exit;
}