コード例 #1
0
ファイル: functions.php プロジェクト: rtoews/meocracy
function ResultsLegislation($table, $entity_id)
{
    $result = mysql_query("select * from `{$table}` where `entity_id`='{$entity_id}'") or die(mysql_error());
    while ($row = mysql_fetch_array($result)) {
        $id = $row['id'];
        $shorttitle = myTruncate($row['title'], 200);
        $shortdescription = myTruncate($row['background'], 200);
        $chart_question = urlencode($row['question']);
        $feedback_support = $row['feedback_support'];
        $feedback_oppose = $row['feedback_oppose'];
        $feedback_total = $row['feedback_total'];
        $feedback_average = $row['feedback_average'];
        echo "<ul data-role='listview' data-inset='true' style='text-align:center'>\n<li><a href='legislation_edit_result?id=" . $id . "'>\n<h3>" . $shorttitle . "</h3>\n<p>" . $shortdescription . "</p><br clear='all'></li><center>";
        DrawVotesChart($table, $entity_id, $chart_question, $feedback_support, $feedback_oppose, $feedback_total, $feedback_average);
        echo "</center></a></ul>";
    }
}
コード例 #2
0
ファイル: functions.php プロジェクト: rtoews/meocracy
function ResultsLegislation($table, $entity_id)
{
    $result = mysql_query("select * from `{$table}` where `entity_id`='{$entity_id}'") or die(mysql_error());
    while ($row = mysql_fetch_array($result)) {
        $id = $row['id'];
        $shorttitle = myTruncate($row['title'], 10, "...");
        $shortdescription = myTruncate($row['background'], 20, "...");
        $chart_question = $row['question'];
        $feedback_support = $row['feedback_support'];
        $feedback_oppose = $row['feedback_oppose'];
        $feedback_total = $row['feedback_total'];
        $feedback_average = $row['feedback_average'];
        echo "<div class='row_clickable' onClick=\"document.location.href='legislation_edit?id=" . $id . "'\">\n\t<div class='row_icon'></div>\n\t<h3>" . $shorttitle . "</h3>\n\t<p>" . $shortdescription . "</p><div class='chart_wrapper'>";
        DrawVotesChart($id, $table, $entity_id, $chart_question, $feedback_support, $feedback_oppose, $feedback_total, $feedback_average);
        echo "</div></div>";
    }
}
コード例 #3
0
 /**
  * Save a Serialized Process from an object
  *
  * @param array $oData
  * @return $result an array
  */
 public function saveSerializedProcess($oData)
 {
     //$oJSON = new Services_JSON();
     //$data = $oJSON->decode($oData);
     //$sProUid = $data->process->PRO_UID;
     $data = unserialize($oData);
     $sProUid = $data->process['PRO_UID'];
     $path = PATH_DOCUMENT . 'output' . PATH_SEP;
     if (!is_dir($path)) {
         G::verifyPath($path, true);
     }
     $proTitle = substr(G::inflect($data->process['PRO_TITLE']), 0, 245);
     $proTitle = preg_replace("/[^A-Za-z0-9_]/", "", $proTitle);
     //Calculating the maximum length of file name
     $pathLength = strlen(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP);
     $length = strlen($proTitle) + $pathLength;
     if ($length >= 250) {
         $proTitle = myTruncate($proTitle, 250 - $pathLength, '_', '');
     }
     $index = '';
     $lastIndex = '';
     do {
         $filename = $path . $proTitle . $index . '.pm';
         $lastIndex = $index;
         if ($index == '') {
             $index = 1;
         } else {
             $index++;
         }
     } while (file_exists($filename));
     $proTitle .= $lastIndex;
     $filenameOnly = $proTitle . '.pm';
     $fp = fopen($filename . 'tpm', "wb");
     $fsData = sprintf("%09d", strlen($oData));
     $bytesSaved = fwrite($fp, $fsData);
     //writing the size of $oData
     $bytesSaved += fwrite($fp, $oData);
     //writing the $oData
     foreach ($data->dynaforms as $key => $val) {
         $sFileName = PATH_DYNAFORM . $val['DYN_FILENAME'] . '.xml';
         if (file_exists($sFileName)) {
             $xmlGuid = $val['DYN_UID'];
             $fsXmlGuid = sprintf("%09d", strlen($xmlGuid));
             $bytesSaved += fwrite($fp, $fsXmlGuid);
             //writing the size of xml file
             $bytesSaved += fwrite($fp, $xmlGuid);
             //writing the xmlfile
             $xmlContent = file_get_contents($sFileName);
             $fsXmlContent = sprintf("%09d", strlen($xmlContent));
             $bytesSaved += fwrite($fp, $fsXmlContent);
             //writing the size of xml file
             $bytesSaved += fwrite($fp, $xmlContent);
             //writing the xmlfile
         }
         $sFileName2 = PATH_DYNAFORM . $val['DYN_FILENAME'] . '.html';
         if (file_exists($sFileName2)) {
             $htmlGuid = $val['DYN_UID'];
             $fsHtmlGuid = sprintf("%09d", strlen($htmlGuid));
             $bytesSaved += fwrite($fp, $fsHtmlGuid);
             //writing size dynaform id
             $bytesSaved += fwrite($fp, $htmlGuid);
             //writing dynaform id
             $htmlContent = file_get_contents($sFileName2);
             $fsHtmlContent = sprintf("%09d", strlen($htmlContent));
             $bytesSaved += fwrite($fp, $fsHtmlContent);
             //writing the size of xml file
             $bytesSaved += fwrite($fp, $htmlContent);
             //writing the htmlfile
         }
     }
     /**
      * By <*****@*****.**>
      * here we should work for the new functionalities
      * we have a many files for attach into this file
      *
      * here we go with the anothers files ;)
      */
     //before to do something we write a header into pm file for to do a differentiation between document types
     //create the store object
     //$file_objects = new ObjectCellection();
     // for mailtemplates files
     $MAILS_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'mailTemplates' . PATH_SEP . $data->process['PRO_UID'];
     $isMailTempSent = false;
     $isPublicSent = false;
     //if this process have any mailfile
     if (is_dir($MAILS_ROOT_PATH)) {
         //get mail files list from this directory
         $file_list = scandir($MAILS_ROOT_PATH);
         foreach ($file_list as $filename) {
             // verify if this filename is a valid file, because it could be . or .. on *nix systems
             if ($filename != '.' && $filename != '..') {
                 if (@is_readable($MAILS_ROOT_PATH . PATH_SEP . $filename)) {
                     $sFileName = $MAILS_ROOT_PATH . PATH_SEP . $filename;
                     if (file_exists($sFileName)) {
                         if (!$isMailTempSent) {
                             $bytesSaved += fwrite($fp, 'MAILTEMPL');
                             $isMailTempSent = true;
                         }
                         //$htmlGuid    = $val['DYN_UID'];
                         $fsFileName = sprintf("%09d", strlen($filename));
                         $bytesSaved += fwrite($fp, $fsFileName);
                         //writing the fileName size
                         $bytesSaved += fwrite($fp, $filename);
                         //writing the fileName size
                         $fileContent = file_get_contents($sFileName);
                         $fsFileContent = sprintf("%09d", strlen($fileContent));
                         $bytesSaved += fwrite($fp, $fsFileContent);
                         //writing the size of xml file
                         $bytesSaved += fwrite($fp, $fileContent);
                         //writing the htmlfile
                     }
                 }
             }
         }
     }
     // for public files
     $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP . $data->process['PRO_UID'];
     //if this process have any mailfile
     if (is_dir($PUBLIC_ROOT_PATH)) {
         //get mail files list from this directory
         $file_list = scandir($PUBLIC_ROOT_PATH);
         foreach ($file_list as $filename) {
             // verify if this filename is a valid file, because it could be . or .. on *nix systems
             if ($filename != '.' && $filename != '..') {
                 if (@is_readable($PUBLIC_ROOT_PATH . PATH_SEP . $filename)) {
                     $sFileName = $PUBLIC_ROOT_PATH . PATH_SEP . $filename;
                     if (file_exists($sFileName)) {
                         if (!$isPublicSent) {
                             $bytesSaved += fwrite($fp, 'PUBLIC   ');
                             $isPublicSent = true;
                         }
                         //$htmlGuid    = $val['DYN_UID'];
                         $fsFileName = sprintf("%09d", strlen($filename));
                         $bytesSaved += fwrite($fp, $fsFileName);
                         //writing the fileName size
                         $bytesSaved += fwrite($fp, $filename);
                         //writing the fileName size
                         $fileContent = file_get_contents($sFileName);
                         $fsFileContent = sprintf("%09d", strlen($fileContent));
                         $bytesSaved += fwrite($fp, $fsFileContent);
                         //writing the size of xml file
                         $bytesSaved += fwrite($fp, $fileContent);
                         //writing the htmlfile
                     }
                 }
             }
         }
     }
     /*
     // for public files
     $PUBLIC_ROOT_PATH = PATH_DATA.'sites'.PATH_SEP.SYS_SYS.PATH_SEP.'public'.PATH_SEP.$data->process['PRO_UID'];
     //if this process have any mailfile
     if ( is_dir( $PUBLIC_ROOT_PATH ) ) {
         //get mail files list from this directory
         $files_list = scandir($PUBLIC_ROOT_PATH);
         foreach ($file_list as $filename) {
           // verify if this filename is a valid file, beacuse it could be . or .. on *nix systems
             if($filename != '.' && $filename != '..'){
                 if (@is_readable($PUBLIC_ROOT_PATH.PATH_SEP.$nombre_archivo)) {
                     $tmp = explode('.', $filename);
                     $ext = $tmp[1];
                     $ext_fp = fopen($PUBLIC_ROOT_PATH.PATH_SEP.$nombre_archivo, 'r');
                     $file_data = fread($ext_fp, filesize($PUBLIC_ROOT_PATH.PATH_SEP.$nombre_archivo));
                     fclose($ext_fp);
                     $file_objects->add($filename, $ext, $file_data,'public');
                 }
             }
         }
     }
     
     //So,. we write the store object into pm export file
     $extended_data = serialize($file_objects);
     $bytesSaved += fwrite( $fp, $extended_data );
     */
     /* under here, I've not modified those lines */
     fclose($fp);
     //$bytesSaved = file_put_contents  ( $filename  , $oData  );
     $filenameLink = 'processes_DownloadFile?p=' . $proTitle . '&r=' . rand(100, 1000);
     $result['PRO_UID'] = $data->process['PRO_UID'];
     $result['PRO_TITLE'] = $data->process['PRO_TITLE'];
     $result['PRO_DESCRIPTION'] = $data->process['PRO_DESCRIPTION'];
     $result['SIZE'] = $bytesSaved;
     $result['FILENAME'] = $filenameOnly;
     $result['FILENAME_LINK'] = $filenameLink;
     return $result;
 }
コード例 #4
0
ファイル: lista.php プロジェクト: pay1bux/site-pc
        echo $cerere['nume'];
        ?>
                </td>
                <td>
                    <?php 
        echo $cerere['localitate'];
        ?>
                </td>
                <td>
                    <?php 
        echo $cerere['data'];
        ?>
                </td>
                <td>
                    <?php 
        echo myTruncate($cerere['continut'], 80);
        ?>
                </td>
                <td>
                    <?php 
        echo $cerere['public'] == 1 ? 'Da' : 'Nu';
        ?>
                </td>
                <td>
                    <center>
                        <a href="<?php 
        echo site_url("admin/sterge-cerere/" . $cerere['id']);
        ?>
"  class="sterge" ><button type="button" class="btn btn-danger btn-sm">Sterge</button></a>
                    </center>
                </td>
コード例 #5
0
    echo $blog->name;
    ?>
/"><?php 
    echo $blog->title;
    ?>
</a></h3>
      <small class="date">posted by <?php 
    echo $blog->author;
    ?>
 on <?php 
    echo $date;
    ?>
</small>
      <?php 
    $content = strip_tags($blog->content);
    $content = myTruncate($content, 350, ' ', "&nbsp;<a href=\"/blog/{$blog->name}\">[...]</a>");
    echo $content;
    ?>
    </div>
    <?php 
}
?>

    <div class="pager">
       <?php 
$p = 0;
$pages = $pages > 0 ? $pages - 1 : $pages;
while ($p < $pages) {
    $selected = $p == $page ? ' class="selected" ' : '';
    echo "<a {$selected} href='/blog/page/{$p}'>" . ($p + 1) . "</a>";
    $p++;
コード例 #6
0
ファイル: lista.php プロジェクト: pay1bux/site-pc
                <div class="i_details">
                    <p class="mic"><?php 
    echo prepareDateWithYear($devotional['data']);
    ?>
 -
                        <a href="<?php 
    echo site_url("devotional/autor/" . $devotional['nume_autor']);
    ?>
" style="text-decoration: underline; display: inline; font-size: 12px;"><?php 
    echo $devotional['nume_autor'];
    ?>
</a>
                    </p> <br/>

                    <p class="mic intins"><?php 
    echo myTruncate($devotional['continut'], 250, " ");
    ?>
</p>
                    <a href="<?php 
    echo linkDevotional($devotional["titlu"], $devotional["r_id"]);
    ?>
">
                        <p class="mic" style="text-align: right; text-decoration: underline;">Citește articolul</p>
                    </a>
                </div>
            </div>
        </div>
        <div class="clearBoth"></div>
        <?php 
}
?>
コード例 #7
0
ファイル: home_vechi.php プロジェクト: pay1bux/site-pc
</div>
-->
        <div id="live" class="dreptunghi"><a id="buton_live" href="#"></a></div>
        <div id="video" class="dreptunghi"><a class="buton_arhiva" href="#"></a></div>
        <div id="audio" class="dreptunghi"><a class="buton_arhiva" href="#"></a></div>
    </div>
    <div id="sub_buletin" style="width:224px; height:40px"><a id="buton_sub_buletin" href=""></a><input id="subscribe" type="text" name="buletin" value="Aboneaza-te la buletinul duminical" class="cleardefault" /> </div>
</div>


<div id="middle">
    <div class="promo">
        <div class="chenar" id="devotional">
            <p class="devotional">
                <?php 
echo myTruncate($eveniment["continut"], 120, " ");
?>
            </p>

            <a id="buton_devotional" href=""></a>
        </div>
        <div class="chenar" id="promovare">
            <a id="buton_promovare" href="#"></a>
        </div>
        <div class="clear"></div>
        <a href="#"><div id="mic1" class="chenar mic"></div></a>
        <a href="#"><div id="mic2" class="chenar mic"></div></a>
        <a href="<?php 
echo $buletin["url"];
?>
"><div id="mic3" class="chenar mic"></div></a>
コード例 #8
0
ファイル: products_grid.php プロジェクト: sean01/pokecart
			<? foreach($products->items as $product) : ?> 
				<div class="product thumbnail flex flex-column">
					<h3><?php 
echo $product->name;
?>
</h3>
					<a href="/pokecart/product/<?php 
echo $product->id;
?>
/view"><img src="/pokecart/<?php 
echo $product->image;
?>
" alt="" width="215" height="215"></a>
					<div class="caption flex flex-column flex-j-between flex-1">									
						<p><?php 
echo myTruncate($product->description, 200, " ");
?>
</p>
						<p><a href="/pokecart/product/<?php 
echo $product->id;
?>
/view">Read More</a></p>
						<p>
							<span class="btn btn-primary fixed-b fixed" role="button">$<?php 
echo number_format($product->price, 2, '.', '');
?>
</span>
							

							<? if(Auth::is_logged_in()) : ?>
							<a href="/pokecart/cart/add/<?php 
コード例 #9
0
ファイル: class.xpdl.php プロジェクト: nshong/processmaker
    /**
     * This function create the file .xpdl from a process
     * @param string $sProUid
     * @return void
     */
    function xmdlProcess($sProUid = '')
    {
        $oProcess = new Process();
        $oData->process = $this->getProcessRow($sProUid, false);
        $oData->tasks = $this->getTaskRows($sProUid);
        $oData->routes = $this->getRouteRows($sProUid);
        $oData->lanes = $this->getLaneRows($sProUid);
        $oData->inputs = $this->getInputRows($sProUid);
        $oData->outputs = $this->getOutputRows($sProUid);
        $oData->dynaforms = $this->getDynaformRows($sProUid);
        $oData->steps = $this->getStepRows($sProUid);
        $oData->triggers = $this->getTriggerRows($sProUid);
        $oData->taskusers = $this->getTaskUserRows($oData->tasks);
        $oData->groupwfs = $this->getGroupwfRows($oData->taskusers);
        $oData->steptriggers = $this->getStepTriggerRows($oData->tasks);
        $oData->dbconnections = $this->getDBConnectionsRows($sProUid);
        $oData->reportTables = $this->getReportTablesRows($sProUid);
        $oData->reportTablesVars = $this->getReportTablesVarsRows($sProUid);
        $oData->stepSupervisor = $this->getStepSupervisorRows($sProUid);
        $oData->objectPermissions = $this->getObjectPermissionRows($sProUid);
        $oData->subProcess = $this->getSubProcessRow($sProUid);
        $oData->caseTracker = $this->getCaseTrackerRow($sProUid);
        $oData->caseTrackerObject = $this->getCaseTrackerObjectRow($sProUid);
        $oData->stage = $this->getStageRow($sProUid);
        $oData->fieldCondition = $this->getFieldCondition($sProUid);
        $oData->event = $this->getEventRow($sProUid);
        $oData->caseScheduler = $this->getCaseSchedulerRow($sProUid);
        $path = PATH_DOCUMENT . 'output' . PATH_SEP;
        if (!is_dir($path)) {
            G::verifyPath($path, true);
        }
        $proTitle = substr(G::inflect($oData->process['PRO_TITLE']), 0, 245);
        $proTitle = preg_replace("/[^A-Za-z0-9_]/", "", $proTitle);
        //Calculating the maximum length of file name
        $pathLength = strlen(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP);
        $length = strlen($proTitle) + $pathLength;
        if ($length >= 250) {
            $proTitle = myTruncate($proTitle, 250 - $pathLength, '_', '');
        }
        $index = '';
        $lastIndex = '';
        do {
            $filename = $path . $proTitle . $index . '.xpdl';
            $lastIndex = $index;
            if ($index == '') {
                $index = 1;
            } else {
                $index++;
            }
        } while (file_exists($filename));
        $proTitle .= $lastIndex;
        $filenameOnly = $proTitle . '.xpdl';
        $xml = fopen($filename . 'tpm', "wb");
        $process = $oData->process;
        $coordinateMaximumY = 0;
        $coordinateMaximumX = 0;
        $lanes = $oData->lanes;
        foreach ($lanes as $keyLane => $valLane) {
            if ($valLane['SWI_TYPE'] == "TEXT") {
                $textLane = $valLane['SWI_TEXT'];
                $longText = strlen($textLane);
                $height = 0;
                $width = 0;
                if ($longText < 40) {
                    $height = 20;
                    $width = $longText * 10 + 10;
                }
                if ($longText > 40) {
                    $numberRows = $longText / 40;
                    $height = $numberRows * 20;
                    $width = 250;
                }
                $coordinateX = $valLane['SWI_X'] + $width;
                $coordinateY = $valLane['SWI_Y'] + $height;
                if ($coordinateX > $coordinateMaximumX) {
                    $coordinateMaximumX = $coordinateX;
                }
                if ($coordinateY > $coordinateMaximumY) {
                    $coordinateMaximumY = $coordinateY;
                }
            }
        }
        foreach ($oData->tasks as $keyLane => $val) {
            $coordinateX = $val['TAS_POSX'] + 160;
            $coordinateY = $val['TAS_POSY'] + 38;
            if ($coordinateX > $coordinateMaximumX) {
                $coordinateMaximumX = $coordinateX;
            }
            if ($coordinateY > $coordinateMaximumY) {
                $coordinateMaximumY = $coordinateY;
            }
        }
        $data = $this->createPool($process, $coordinateMaximumX + 60, $coordinateMaximumY + 60);
        fwrite($xml, '<?xml version="1.0" encoding="utf-8"?>');
        fwrite($xml, $data);
        $artifacts = '<Artifacts>';
        $artifacts .= $this->createArtifacts($lanes, '0');
        $dataProcess = '
   <WorkflowProcesses>';
        $dataProcess .= '
      <WorkflowProcess Id= "' . $process['PRO_UID'] . '" ' . 'Name="' . $process['PRO_TITLE'] . '">
      <RedefinableHeader>
      </RedefinableHeader>
      ';
        $activitySets = '<ActivitySets>';
        $subProcess = $oData->subProcess;
        $subProcesses = $this->createSubProcessesXpdl($subProcess, $oData->tasks);
        $activitySets .= $subProcesses['ACTIVITIES'];
        $activitySets .= '</ActivitySets>';
        $artifacts .= $subProcesses['ARTIFACTS'];
        $artifacts .= '
  </Artifacts>';
        fwrite($xml, $artifacts);
        fwrite($xml, $dataProcess);
        fwrite($xml, $activitySets);
        // Here are generated activities of a file. XPDL
        // for this use the process tasks
        $tasks = $oData->tasks;
        $events = $oData->event;
        $scheduler = $oData->caseScheduler;
        $dataTasks = $this->createActivitiesXpdl($tasks, $events, $scheduler);
        fwrite($xml, $dataTasks['ACTIVITIES']);
        $taskHidden = $dataTasks['TASK_HIDDEN'];
        $routes = $oData->routes;
        $dataRoutes = $this->createTransitionsXpdl($routes, $tasks, $taskHidden);
        fwrite($xml, $dataRoutes['ACTIVITIES']);
        $data = '
      </Activities>';
        fwrite($xml, $data);
        fwrite($xml, $dataTasks['TRANSITION']);
        fwrite($xml, $dataRoutes['TRANSITION']);
        $data = '
         </Transitions>
        <ExtendedAttributes />
      </WorkflowProcess>
    </WorkflowProcesses>
    <ExtendedAttributes />
</Package>';
        fwrite($xml, $data);
        fclose($xml);
        $filenameLink = 'processes_DownloadFileXpdl?p=' . $proTitle . '&r=' . rand(100, 1000);
        $result['FILENAMEXPDL'] = $proTitle . '.xpdl';
        $result['FILENAME_LINKXPDL'] = $filenameLink;
        return $result;
    }
コード例 #10
0
ファイル: lista.php プロジェクト: pay1bux/site-pc
            <td style="background-color:#b6bb40;" class="lista">
                Delete
            </td>
        </tr>
        <?php 
foreach ($atasamente as $atasament) {
    ?>
        <tr>
            <td class="lista">
                <?php 
    echo $atasament['url'];
    ?>
            </td>
            <td class="lista">
                <?php 
    echo htmlentities(myTruncate($atasament['embed'], 80, " "));
    ?>
            </td>
            <td class="lista">
                <?php 
    echo $atasament['marime'];
    ?>
            </td>
            <td class="lista">
                <?php 
    echo $atasament['format'];
    ?>
            </td>
            <td class="lista">
                <center><a
                    href="<?php 
コード例 #11
0
ファイル: index.php プロジェクト: pay1bux/site-pc
                    </a>
                </li>
            </ul>
        </div>
        <div id="live" class="dreptunghi"><a id="buton_live" href="#"></a></div>
        <div id="video" class="dreptunghi"><a class="buton_arhiva" href="#"></a></div>
        <div id="audio" class="dreptunghi"><a class="buton_arhiva" href="#"></a></div>
    </div>
</div>

<div id="middle">
    <div class="promo">
        <div class="chenar" id="devotional">
            <p class="devotional">
                <?php 
echo myTruncate($devotional[0]->continut, 120, " ");
?>
                {elapsed_time}
            </p>
            
            <a id="buton_devotional" href="#"></a>
        </div>
        <div class="chenar" id="promovare">
            <a id="buton_promovare" href="#"></a>
        </div>
        <div class="clear"></div>
        <a href="#"><div id="mic1" class="chenar mic"></div></a>
        <a href="#"><div id="mic2" class="chenar mic"></div></a>
        <a href="<?php 
echo $buletin[0]->url;
?>
コード例 #12
0
function tap_facebook_feed()
{
    $cachetime = 60 * 60;
    // Seconds to cache files for
    $cachefile = dirname(__FILE__) . '/includes/facebook/cache/fb.txt';
    // connect to app
    $config = array();
    $config['appId'] = '388799311278680';
    $config['secret'] = 'a1a55787f17d6b2562799f93434fbab4';
    $config['fileUpload'] = false;
    // optional
    $cache_file_timestamp = file_exists($cachefile) ? filemtime($cachefile) : 0;
    // Show file from cache if still valid.
    if (time() - $cachetime < $cache_file_timestamp) {
        $cachedfeed = file_get_contents($cachefile);
        echo $cachedfeed;
    } else {
        $html = '';
        // instantiate
        $facebook = new Facebook($config);
        // set page id
        $pageid = "105085226191512";
        // now we can access various parts of the graph, starting with the feed
        $pagefeed = $facebook->api("/" . $pageid . "/feed");
        $html .= "<h4 class=\"fb\">Tapestry on Facebook</h4>";
        // set counter to 0, because we only want to display 10 posts
        $i = 0;
        foreach ($pagefeed['data'] as $post) {
            if ($post['type'] == 'status' || $post['type'] == 'link' || $post['type'] == 'photo') {
                // check if post type is a status
                if ($post['type'] == 'status') {
                    $html .= "<p>" . myTruncate($post['message'], 75) . "</p>";
                }
                // check if post type is a link
                if ($post['type'] == 'link') {
                    $html .= "<p>" . myTruncate($post['message'], 75) . " ";
                    $html .= "<a href=\"" . $post['link'] . "\" target=\"_blank\">" . "Read More" . "</a></p>";
                }
                // check if post type is a photo
                if ($post['type'] == 'photo') {
                    if (empty($post['story']) === false) {
                        $html .= "<p>" . $post['story'] . " ";
                    } elseif (empty($post['message']) === false) {
                        $html .= "<p>" . myTruncate($post['message'], 75) . " ";
                    }
                    $html .= "<a href=\"" . $post['link'] . "\" target=\"_blank\">View photo &rarr;</a></p>";
                }
                $i++;
                // add 1 to the counter if our condition for $post['type'] is met
            }
            //  break out of the loop if counter has reached 3
            if ($i == 3) {
                break;
            }
        }
        // end the foreach statement
        // Save the formatted tweet list to a file.
        $file = fopen($cachefile, 'w');
        fwrite($file, $html);
        fclose($file);
        echo $html;
    }
}
コード例 #13
0
ファイル: test2.php プロジェクト: robstoll/tins-benchmark
function combi1($x, $y, $z)
{
    $a = myTruncate($x, 12, 10, $z);
    $email = encode_email($a, 'blabla', 123);
    show_gravatar($email, $y, 'pic', 'good');
    return $a;
}
コード例 #14
0
 $proFields = $oProcess->serializeProcess($sProUid);
 $Fields = $oProcess->saveSerializedProcess($proFields);
 $pathLength = strlen(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP);
 $length = strlen($Fields['PRO_TITLE']) + $pathLength;
 foreach ($Fields as $key => $value) {
     if ($key == 'PRO_TITLE') {
         $Fields[$key] = myTruncate($value, 65, ' ', '...');
     }
     if ($key == 'FILENAME') {
         $Fields[$key] = myTruncate($value, 60, '_', '...pm');
     }
     if ($length >= 250) {
         if ($key == 'FILENAME_LINK') {
             list($file, $rest) = explode('p=', $value);
             list($filenameLink, $rest) = explode('&', $rest);
             $Fields[$key] = myTruncate($filenameLink, 250 - $pathLength, '_', '');
             $Fields[$key] = $file . "p=" . $Fields[$key] . '&' . $rest;
         }
     }
 }
 /* Render page */
 if (isset($_REQUEST["processMap"]) && $_REQUEST["processMap"] == 1) {
     $G_PUBLISH = new Publisher();
     $G_PUBLISH->AddContent("xmlform", "xmlform", "processes/processes_Export", "", $Fields);
     G::RenderPage("publish", "raw");
 } else {
     $xmlFrm = new XmlForm();
     $xmlFrm->home = PATH_XMLFORM . "processes" . PATH_SEP;
     $xmlFrm->parseFile("processes_Export.xml", SYS_LANG, true);
     $Fields["xmlFrmFieldLabel"] = array("title" => $xmlFrm->fields["TITLE"]->label, "proTitle" => $xmlFrm->fields["PRO_TITLE"]->label, "proDescription" => $xmlFrm->fields["PRO_DESCRIPTION"]->label, "size" => $xmlFrm->fields["SIZE"]->label, "fileName" => $xmlFrm->fields["FILENAME_LABEL"]->label);
     echo G::json_encode($Fields);
コード例 #15
0
ファイル: lista.php プロジェクト: pay1bux/site-pc
        echo $resursa['nume_autor'];
        ?>
 <br/></td>
                <td>
                    <?php 
        echo $resursa['nume_tip'];
        ?>
 <br/></td>
                <!--                <td class="lista">-->
                <!--                    --><?php 
        //echo $resursa['nume_categorie'];
        ?>
<!-- <br/></td>-->
                <td>
                    <?php 
        echo myTruncate($resursa['continut'], 80, " ");
        ?>
 <br/>
                </td>

                <td>
                    <?php 
        echo $resursa['data'];
        ?>
 <br/></td>
                <td>
                    <center> <a href="<?php 
        echo site_url('admin/adauga-atasament/' . $resursa['r_id']);
        ?>
"><span class="glyphicon glyphicon-plus"></span></a></center>
                </td>
コード例 #16
0
ファイル: lista.php プロジェクト: pay1bux/site-pc
foreach ($resurse as $resursa) {
    ?>
        <tr>
            <td>
                <?php 
    echo $resursa['titlu'];
    ?>
            </td>
            <td>
                <?php 
    echo $resursa['data'];
    ?>
            </td>
            <td>
                <?php 
    echo htmlentities(myTruncate($resursa['url'], 80, " "));
    ?>
            </td>
            <td>
                <?php 
    echo $resursa['marime'];
    ?>
 MB
            </td>
            <td>
                <center><a
                    href="<?php 
    echo site_url('admin/editeaza-buletin/' . $resursa['r_id']);
    ?>
"/><button type="button" class="btn btn-warning btn-sm">Editeaza</button>
                </center>
コード例 #17
0
foreach ($ListOfWorks as $key_minor => $value_minor) {
    $warning = "";
    $title = $result[$works_label][$key_minor][$works_title];
    if ($title) {
        // echo "->".$result[$works_label][$key_minor][$showwork]."<-";
        if ($result[$works_label][$key_minor][$showwork] === "true") {
        } else {
            $warning = "<span class='nicelink label label-warning'>Hidden</span>";
        }
        $stage_label = $result[$works_label][$key_minor][util::$KEY_STAGE];
        $stage_appearance_html_class = $result[util::$KEY_FOR_WORKSCREATED][util::$INDEX_SETTINGS_RECORD][$stage_label];
        //'label label-primary';
        $stage = sprintf("<span class='%s'>%s</span>", $stage_appearance_html_class, $stage_label);
        $work_id = $result[$works_label][$key_minor][util::$WORKID];
        $comment_str = $result[$works_label][$key_minor][util::$KEY_COMMENT];
        $comment_str_short = myTruncate($comment_str, 10);
        $comment = sprintf('<span class="label label-info">%s</span>', $comment_str_short);
        /* 		 $collapsiblecomment = sprintf('<div class="faq">
        			   <ul>
        			   <li><a href="#%s">%s</a>   
        			   <div id="%s">%s </div>
        			   </li>  </ul>  
        </div>',$key_minor,$comment,$key_minor,$comment_str); */
        $collapsiblecomment = "";
        if ($comment_str && $comment_str != "" && $comment_str != "comment") {
            $collapsiblecomment = sprintf("<input type='checkbox' style='display: none' id=l%s>\n<label for=l%s></label><div class='orangebox' style='color: white; font-size:0.7em;'>%s</div>", $key_minor, $key_minor, $comment_str);
        }
        // I put the ID = Title in here so that it would sort alphabetically.
        $results_array[$title] = sprintf("<h3> <span class='nicelink label label-default'><a id='%s' href='editor.php?record=%s'>%s</a></span> %s %s %s</h3> ", $title, $key_minor, $title, $stage, $warning, $collapsiblecomment);
    }
}
function buildTable($data)
{
    //print "<tr><th></th><th>Post</th><th>Synth</th><th>Item price</th><th>Item date</th>";
    $counter = 0;
    foreach ($data as $d) {
        $imageSources = $d->post_item_images;
        print "<div class='item'>";
        if (!empty($imageSources)) {
            $imageSources = explode(',', $imageSources);
            foreach ($imageSources as $imgSrc) {
                //$size = getimagesize($imgSrc);
                print "<a href='" . $d->link . "' target='_blank' class='tip_trigger' id='tooltip_" . $counter . "'>";
                print "<img src='" . $imgSrc . "'/>";
                print "<span id='data_tooltip_" . $counter . "' class='tip'>";
                print "<ul>";
                print "<li class='synth_name'>" . $d->post_item_name . "</li>";
                print "<li class='synth_searched'>Synth query: " . $d->synth_name . "</li>";
                print "<li class='manufacturer'>Manufacturer query: " . $d->manufacturer . "</li>";
                print "<li class='location'>" . $d->post_item_link . "</li>";
                print "<li class='price'>" . $d->post_item_price . "</li>";
                print "<li class='description'>" . myTruncate(strval($d->post_item_description), 300) . "</li>";
                print "<li class='click'>Click the image to read more.</li>";
                print "<li class='date'>" . $d->post_item_date . "</li>";
                print "</ul>";
                print "</span>";
                print "</a>";
                $counter++;
            }
        }
        print "</div>";
    }
}
コード例 #19
0
ファイル: homepage.php プロジェクト: pay1bux/site-pc
        echo prepareDate($eveniment["data"]);
        ?>
</div>
                        <div class="i_details">
                           <a href="<?php 
        echo site_url('lista-evenimente') . '/' . prepareDateDMY($eveniment['data']);
        ?>
" > <div class="ii_title"><?php 
        echo $eveniment["titlu"];
        ?>
<span style="color: gray;"><?php 
        echo '  ' . $eveniment["ora_inceput"] . ' - ' . $eveniment["ora_sfarsit"];
        ?>
</span> </div></a>
                            <div class="ii_text"><?php 
        echo myTruncate($eveniment["continut"], 100, " "), ' ';
        ?>
</div>
                        </div>
                        <div class="clearLeft"></div>
                    </div>
                    <?php 
    }
    ?>
                <?php 
} else {
    ?>
                <div class="ii_text">Nu există transmisii</div>
                <?php 
}
?>