public function run_import_item()
 {
     Loader::model($_REQUEST['importType'], 'problog_importer');
     $location = $_REQUEST['importLocation'];
     $ctID = $_REQUEST['selectedPageType'];
     $path = DIR_BASE . File::getRelativePathFromID($_REQUEST['importXml']);
     $xmlObject = simplexml_load_file($path, 'SimpleXMLElement');
     $i = $_REQUEST['i'];
     foreach ($xmlObject->channel->item as $item_object) {
         $t++;
         if ($t == $i) {
             $method = ucfirst($_REQUEST['importType']) . 'Item';
             $item = new $method($item_object);
             //var_dump($item);exit;
             $page = new CreateBlogPost($item, $location, $ctID);
             //print json_encode($child);
             if ($page) {
                 print json_encode(array('success' => 1));
             } else {
                 print json_encode(array('error' => t('There was a problem with your import.')));
             }
         }
     }
     exit;
 }
Example #2
0
 private function replaceFileID($match)
 {
     $fID = $match[1];
     if ($fID > 0) {
         $path = File::getRelativePathFromID($fID);
         return $path;
     }
 }
Example #3
0
function get_url_from_file_id($avatar_file_id, $def_url = '/files/images/icon-def-avatar.png')
{
    $avatar_url = File::getRelativePathFromID($avatar_file_id);
    if (strlen($avatar_url) < 10) {
        return $def_url;
    }
    return $avatar_url;
}
Example #4
0
 function getIconURL($icon_file_id)
 {
     $icon_url = File::getRelativePathFromID($icon_file_id);
     if (strlen($icon_url) < 10) {
         return self::DEF_ICON_URL;
     }
     return $icon_url;
 }
Example #5
0
$title = h($title);
if ($linkURL) {
    $title = '<a href="' . $linkURL . '">' . $title . '</a>';
}
?>
<div class="ccm-block-feature-item">
    <?php 
if ($title) {
    ?>
        <h4>
        
        <?php 
    if ($iconSvg) {
        ?>
              <i><img src="<?php 
        echo File::getRelativePathFromID($iconSvg);
        ?>
"></i> 
            <?php 
    } else {
        ?>
              <i class="fa fa-<?php 
        echo $icon;
        ?>
"></i> 
            <?php 
    }
    ?>
          <?php 
    echo $title;
    ?>
<?php

defined('C5_EXECUTE') or die("Access Denied.");
$u = new User();
$fp = FilePermissions::getGlobal();
if (!$fp->canAddFiles()) {
    die(t("Unable to add files."));
}
$cf = Loader::helper("file");
$valt = Loader::helper('validation/token');
$json = Loader::helper('json');
$id = Loader::helper('validation/identifier');
if ($_SERVER['REQUEST_METHOD'] == "GET" && $_GET['mode'] == "get_path") {
    if (is_numeric($_REQUEST['fID'])) {
        $path = File::getRelativePathFromID($_REQUEST['fID']);
        echo $json->encode($path);
        exit;
    }
} elseif (isset($_POST['thumbnail']) && strlen($_POST['thumbnail'])) {
    $thumb = base64_decode($_POST['thumbnail']);
    $file_path = Config::get('concrete.cache.directory') . "/composer_" . $id->getString() . ".jpg";
    $fp = fopen($file_path, "w");
    if ($fp) {
        fwrite($fp, base64_decode($_POST['thumbnail']));
        fclose($fp);
        $fi = new FileImporter();
        // if we're working with an existing image, grab the name from it for the new one
        if (is_numeric($_REQUEST['fID']) && $_REQUEST['fID'] > 0) {
            $f = File::getByID($_REQUEST['fID']);
            $fv = $f->getVersion();
            $fileName = $fv->getFileName();
Example #7
0
 /**
  * Renders a image input field.
  * @param string $key Input element's name and id
  * @param int|string $image Image fID or relative path to image
  * @param string|array $valueOrArray Either the default value (subject to be overridden by $_REQUEST) or $miscFields (see below)
  * @param array $miscFields A hash array with html attributes as key/value pairs (possibly including "class")
  * @return $html
  */
 public function image($key, $image, $valueOrArray = false, $miscFields = array())
 {
     if (is_numeric($image)) {
         $image_path = File::getRelativePathFromID($image);
     } else {
         $image_path = $image;
     }
     if (is_array($valueOrArray) || $valueOrArray === false) {
         $valueOrArray['src'] = $image_path;
     } else {
         $miscFields['src'] = $image_path;
     }
     return $this->inputType($key, 'image', $valueOrArray, $miscFields);
 }
Example #8
0
" 
							class="cd-btn"><?php 
        echo $ctatext[$x];
        ?>
</a>
				<!-- 	<a href="#0" class="cd-btn secondary">Learn More</a>  -->
				</div> 
				</div> 
				
			 <?php 
        if ($textLeftAlign[$x] == 0) {
            ?>
	
				<div class="cd-half-width cd-img-container">
					<img src="<?php 
            echo File::getRelativePathFromID($fID[$x]);
            ?>
"/>
				</div> <!-- .cd-half-width.cd-img-container -->
				
				<?php 
        }
        ?>
				
				<?php 
        if ($controller->checkIfVideo($fID[$x])) {
            ?>
 	
				<div class="cd-bg-video-wrapper" data-video="<?php 
            echo $controller->fileNameWithPath($fID[$x]);
            ?>
Example #9
0
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
defined('C5_EXECUTE') or die('Access Denied.');
require_once 'helpers/fsen/ProjectInfo.php';
$project_info = ProjectInfo::getBasicInfo($projectID);
if ($project_info == false) {
    echo "<p>no such project</p>";
} else {
    $icon_url = File::getRelativePathFromID($project_info['icon_file_id']);
    if (strlen($icon_url) < 10) {
        $icon_url = '/files/images/icon-fsen-144.png';
    }
    if ($project_info['repo_location'] == 'github') {
        $repo_frags = explode('.', $project_info['repo_name']);
        if (count($repo_frags) == 2) {
            $gh_user = $repo_frags[0];
            $gh_repo = $repo_frags[1];
        }
    }
    ?>

<div class="row">
	<section class="col-md-3">
			<img class="img-responsive"
Example #10
0
					<th></th>

				</tr>
				</thead>
				<tbody>
<!--				--><?php 
if (count($entries) > 0) {
    foreach ($entries as $club) {
        ?>
						<tr>
							<td class="message-cell">
								<div class="ccm-conversation-message-summary">
									<div class="message-output">
										<img src="<?php 
        if ($club->getImageId() != null) {
            $file = File::getRelativePathFromID($club->getImageId());
            echo $file;
        }
        ?>
" width="22"/>
									</div>
								</div>
							</td>
							<td class="message-cell">
								<div class="ccm-conversation-mgessage-summary">
									<div class="message-output">
										<?php 
        echo $club->getName();
        ?>
									</div>
								</div>
Example #11
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
$textHelper = Loader::helper("text");
$nh = Loader::helper('navigation');
?>
<h2><?php 
echo t('Related Posts');
?>
</h2>
<?php 
if (is_array($cArray)) {
    foreach ($cArray as $cobj) {
        //$cobj = $cArray[$i];
        $i++;
        $ak_g = CollectionAttributeKey::getByHandle('thumbnail');
        $image = $cobj->getCollectionAttributeValue($ak_g);
        if ($image->fID) {
            $thumbnail = File::getRelativePathFromID($image->fID);
        }
        if ($thumbnail) {
            echo '<img src="' . $thumbnail . '" alt="image thumbnail" width="70px" style="float: left; padding: 0 5px 5px 0px;"/>';
        }
        echo '<h3 class="related_page_titles"><a href="' . $nh->getLinkToCollection($cobj) . '">' . $cobj->getCollectionName() . '</a></h3>';
        echo '<p class="related_page_results">' . $textHelper->shorten($cobj->getCollectionDescription(), $controller->truncateChars) . '</p>';
        echo '<br style="clear: left;"/>';
        if ($i == $num) {
            break;
        }
    }
}