Example #1
0
 /**
  * Parsing a message will mainly be convenient to automatically translate
  * the incoming message to a format this class can understand.
  *
  * @param string $message The message which should be parsed.
  * @return boolean Were we able to properly parse the message?
  */
 public function parse($message)
 {
     parent::parse($message);
     /**
      * @todo Implement this
      */
 }
Example #2
0
 public static function getMessages($errorlevel)
 {
     $_this = UserMessage::getInstance();
     $ret = array();
     foreach ($_this->messages as $message => $level) {
         if ($level == $errorlevel) {
             $ret[] = $message;
         }
     }
     return $ret;
 }
Example #3
0
 /**
  * On User delete, also delete all comments
  *
  * @param type $event
  */
 public static function onUserDelete($event)
 {
     Yii::import('application.modules.mail.models.*');
     // Delete all message entries
     foreach (MessageEntry::model()->findAllByAttributes(array('user_id' => $event->sender->id)) as $messageEntry) {
         $messageEntry->delete();
     }
     // Leaves all my conversations
     foreach (UserMessage::model()->findAllByAttributes(array('user_id' => $event->sender->id)) as $userMessage) {
         $userMessage->message->leave($event->sender->id);
     }
     return true;
 }
Example #4
0
        break;
    case 'bad_withdrawals':
        $result = sql_query('
			SELECT * FROM bad_withdrawals WHERE user_id="' . intval($_REQUEST['id']) . '"
		');
        $bads = array();
        while ($row = mysql_fetch_assoc($result)) {
            $bads[] = $row;
        }
        Project::getInstance()->getSmarty()->assign('bads', $bads);
        Project::getInstance()->getSmarty()->display('../default/admin/user_bad_withdrawals.tpl');
        break;
    case 'message':
        if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'send') {
            $_POST = sql_escapeArray($_POST);
            $message = new UserMessage();
            $message->setData($_POST);
            $message->user_id = intval($_REQUEST['id']);
            $message->stamp = Project::getInstance()->getNow();
            $message->save();
            location($_SERVER['PHP_SELF'] . '?action=profile&id=' . intval($_REQUEST['id']), '<p class=imp>Message <u>' . htmlspecialchars($message->title) . '</u> has been send!</p>');
        }
        Project::getInstance()->getSmarty()->assign('user_id', intval($_REQUEST['id']));
        Project::getInstance()->getSmarty()->display('../default/admin/user_message.tpl');
        break;
    default:
        $result_ips = sql_query('
			SELECT user_id, INET_NTOA(ip) as ip FROM visits GROUP BY user_id, ip
		');
        $ips = array();
        while ($row_ips = mysql_fetch_assoc($result_ips)) {
 public function ajax_updatenext()
 {
     $time_start = microtime(true);
     $response["error"] = "none";
     $response["file"] = "none";
     $response["nextId"] = null;
     if (!empty($_POST["id"])) {
         $id = intval($_POST["id"]);
         if ($id < 1) {
             $i = 1;
         }
         $history = new History();
         $themeInfo = $history->getFewInfo($id);
         if (!empty($themeInfo)) {
             $unzippath = TC_VAULTDIR . '/unzip/' . $themeInfo["hash"] . "/";
             if (file_exists($unzippath)) {
                 $nextId = $history->getNextId($themeInfo["id"]);
                 $response["nextId"] = $nextId;
                 $themeInfo = $history->loadThemeFromHash($themeInfo["hash"]);
                 // need an objet and not an array
                 $r = $themeInfo->initFromUnzippedArchive($unzippath, $themeInfo->zipfilename, $themeInfo->zipmimetype, $themeInfo->zipfilesize);
                 // merchant...
                 $this->fileValidator = new FileValidator($themeInfo);
                 $this->fileValidator->validate();
                 if (UserMessage::getCount(ERRORLEVEL_FATAL) > 0) {
                     $response["error"] = "fatal error:\n";
                     foreach (UserMessage::getMessages(ERRORLEVEL_FATAL) as $m) {
                         $response["error"] .= "\n" . $m;
                     }
                 } else {
                     if ($this->fileValidator->serialize(true)) {
                         if (UserMessage::getCount(ERRORLEVEL_FATAL) > 0) {
                             // at least one error occured while serializing (no thumbnail...)
                             $response["error"] = "fatal error, could not serialize validation results:\n";
                             foreach (UserMessage::getMessages(ERRORLEVEL_FATAL) as $m) {
                                 $response["error"] .= "\n" . $m;
                             }
                             foreach (UserMessage::getMessages(ERRORLEVEL_CRITICAL) as $m) {
                                 $response["error"] .= "\n" . $m;
                             }
                         } else {
                             $this->validationResults = $this->fileValidator->getValidationResults(I18N::getCurLang());
                             $themeInfo = $this->fileValidator->themeInfo;
                             $response["name"] = $themeInfo->name;
                         }
                     } else {
                         // at least one error occured while serializing (no thumbnail...)
                         if (UserMessage::getCount(ERRORLEVEL_CRITICAL) > 0) {
                             $response["error"] = "could not serialize validation results";
                         }
                         foreach (UserMessage::getMessages(ERRORLEVEL_CRITICAL) as $m) {
                             $response["error"] .= "\n" . $m;
                         }
                     }
                 }
             } else {
                 $response["error"] .= "No zip file " . $unzippath;
             }
         } else {
             if (UserMessage::getCount(ERRORLEVEL_FATAL) > 0) {
                 // at least one error occured while serializing (no thumbnail...)
                 $response["error"] = "could not execute validation:\n";
                 foreach (UserMessage::getMessages(ERRORLEVEL_FATAL) as $m) {
                     $response["error"] .= "\n" . $m;
                 }
                 foreach (UserMessage::getMessages(ERRORLEVEL_CRITICAL) as $m) {
                     $response["error"] .= "\n" . $m;
                 }
             } else {
                 $response["error"] = "could not execute validation (unknown error).";
             }
         }
     }
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     $response["duration"] = $time;
     //ob_clean();
     header('Content-Type: application/json');
     echo json_encode($response);
 }
Example #6
0
define("ERRORLEVEL_NONE", 0);
define("ERRORLEVEL_FATAL", 1);
// errors that prevent from running the tests
define("ERRORLEVEL_CRITICAL", 2);
// security threats or inacceptable errors
define("ERRORLEVEL_WARNING", 3);
define("ERRORLEVEL_SUCCESS", 4);
define("ERRORLEVEL_INFO", 5);
define("TC_CONTACT_MAIL", "*****@*****.**");
define("TC_CONTACT_NAME", "Guillaume Baudhuin");
date_default_timezone_set('UTC');
global $g_creationDate;
$g_creationDate = time();
if (!defined("USE_DB")) {
    define("USE_DB", true);
}
// True to save validation history in database. False to avoid history saving, but keep all other functionalities
// ****************************************************************************
// Init
// ****************************************************************************
if (USE_DB) {
    include_once TC_ROOTDIR . '/DB/History.php';
}
include_once TC_INCDIR . '/Route.php';
include_once TC_INCDIR . '/I18N.php';
// initialize I18N
$i18n = I18N::getInstance();
// initialize usermessages
include_once TC_INCDIR . '/UserMessage.php';
$userMessage = UserMessage::getInstance();
Example #7
0
 /**
  * Returns the Message Model by given Id
  * Also an access check will be performed.
  *
  * If insufficed privileges or not found null will be returned.
  *
  * @param int $id            
  */
 private function getMessage($id)
 {
     $message = Message::model()->findByAttributes(array('id' => $id));
     if ($message != null) {
         $userMessage = UserMessage::model()->findByAttributes(array('user_id' => Yii::app()->user->id, 'message_id' => $message->id));
         if ($userMessage != null) {
             return $message;
         }
     }
     return null;
 }
Example #8
0
 /**
  * Deletes a message, including all dependencies.
  */
 public function delete()
 {
     foreach (MessageEntry::model()->findAllByAttributes(array('message_id' => $this->id)) as $messageEntry) {
         $messageEntry->delete();
     }
     foreach (UserMessage::model()->findAllByAttributes(array('message_id' => $this->id)) as $userMessage) {
         $userMessage->delete();
     }
     parent::delete();
 }
Example #9
0
 /** 
  *		Generate a hash, move or copy the archive and return a ThemeInfo object
  **/
 public static function prepareThemeInfo($src_path, $src_name, $src_type, $isUpload = false)
 {
     $src_size = filesize($src_path);
     if (!($src_size > 100 || strpos($src_path, '/unittests/') !== false)) {
         $userMessage = UserMessage::getInstance();
         $userMessage->enqueueMessage(__('Files under 100 bytes are not accepted. Operation canceled.'), ERRORLEVEL_CRITICAL);
         return null;
     }
     $hash_md5 = md5_file($src_path);
     $sha1_file = sha1_file($src_path);
     $hash_alpha = base_convert($hash_md5, 16, 36);
     // shorten hash to shorten urls (better looking, less bandwidth)
     while (strlen($hash_alpha) < 25) {
         $hash_alpha = '0' . $hash_alpha;
     }
     $zipfilepath = self::hashToPathUpload($hash_alpha);
     if ($isUpload) {
         move_uploaded_file($src_path, $zipfilepath);
     } else {
         copy($src_path, $zipfilepath);
     }
     // copy the file (overwrites if already existing)
     try {
         $zip = new \ZipArchive();
         $path = TC_ROOTDIR . '/../themecheck_vault/unzip';
         if (!file_exists($path)) {
             trigger_error('Directory TC_ROOTDIR/../themecheck_vault/unzip does not exist', E_USER_ERROR);
         }
         $unzippath = $path . '/' . $hash_alpha . "/";
         $res = $zip->open($zipfilepath);
         if ($res === TRUE) {
             if (file_exists($unzippath)) {
                 ListDirectoryFiles::recursiveRemoveDir($unzippath);
             }
             // needed to avoid keeping old files that don't exist anymore in the new archive
             $zip->extractTo($unzippath);
             $zip->close();
         } else {
             UserMessage::enqueue(__("File could not be unzipped."), ERRORLEVEL_FATAL);
         }
     } catch (Exception $e) {
         UserMessage::enqueue(__("Archive extraction failed. The following exception occured : ") . $e->getMessage(), ERRORLEVEL_FATAL);
     }
     // create a theme info
     $themeInfo = new ThemeInfo($hash_alpha);
     $themeInfo->hash_md5 = $hash_md5;
     $themeInfo->hash_sha1 = $sha1_file;
     $r = $themeInfo->initFromUnzippedArchive($unzippath, $src_name, $src_type, $src_size);
     if (!empty($themeInfo->parentName)) {
         $history = new History();
         $fewInfo = $history->getFewInfoFromName($themeInfo->parentName);
         if (!empty($fewInfo["id"])) {
             $themeInfo->parentId = intval($fewInfo["id"]);
         }
         $themeInfo->parentNameSanitized = $fewInfo["namesanitized"];
         $themeInfo->parentThemeType = $fewInfo["themetype"];
     }
     if (!$r) {
         return null;
     }
     return $themeInfo;
 }
Example #10
0
 /**
  * Creates the Wall Widget
  */
 public function run()
 {
     $this->render('mailNotifications', array('newMailMessageCount' => UserMessage::getNewMessageCount()));
 }
Example #11
0
 public function actionRead($id)
 {
     $model = $this->loadModel($id);
     $userMessage = UserMessage::model()->find("user_id = " . Yii::app()->user->id . " AND message_id = {$id}");
     if (isset($userMessage)) {
         $userMessage->message_read = 1;
         $userMessage->save();
     }
     $comments = $model->userComments;
     $newComment = new UserComment();
     if (isset($_POST['UserComment'])) {
         $newComment->attributes = $_POST['UserComment'];
         $newComment->user_id = Yii::app()->user->id;
         $newComment->created = date('Y-m-d H:i:s');
         $newComment->message_id = $id;
         $newComment->modified = date('Y-m-d H:i:s');
         if ($newComment->validate()) {
             $newComment->save();
             $comments = $model->userComments;
             $newComment = new UserComment();
         } else {
             //                die(print_r($newComment->getErrors()));
         }
     }
     $this->render('readMessage', array('model' => $model, 'comments' => $comments, 'newComment' => $newComment));
 }
Example #12
0
<?php

$ACCESS_LEVEL = 1;
include_once DOC_ROOT . '/includes/authorization.php';
Project::getInstance()->getSmarty()->assign('user', Project::getInstance()->getCurUser());
if (isset($_REQUEST['id'])) {
    $message = new UserMessage(intval($_REQUEST['id']));
    if ($message->id) {
        if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'read') {
            Project::getInstance()->getSmarty()->assign('from', 'Support');
            Project::getInstance()->getSmarty()->assign('title', $message->title);
            Project::getInstance()->getSmarty()->assign('text', nl2br($message->message));
            Project::getInstance()->showPage('user/message.tpl');
            $message->readed = 1;
            $message->save();
        } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
            $message->delete();
            header('Location: /user/messages.php');
        }
    }
} else {
    $user_messages_list = new UserMessageList(Project::getInstance()->getCurUser());
    Project::getInstance()->getSmarty()->assign('messages', $user_messages_list->getList());
    Project::getInstance()->showPage('user/messages.tpl');
}
Example #13
0
<?php

require_once "../blog/classes/clsUserMessage.php";
/* Job is to put data into an array and pass it to UserMessage */
if ($_POST['first_name']) {
    $user_data = array($_POST['first_name'], $_POST['last_name'], $_POST['message']);
    //print_r($user_data);
    // Add this to your UserMessage class, type is Comment
    $add_comment = new UserMessage($user_data, 'blog_comment');
    $didPost = $add_comment->didAddToDB();
    if ($didPost) {
        echo "Success <a href='/week_eight/what_now.php?mess=onto better things I guess.'>Next:</a>";
        //header("Location:/week_eight/what_now.php?mess=onto better things I guess.");
    } else {
        $mess = "<h3>Failed</h3><p>You have already added this message. If you want to add another one, please provide your information below.</p>";
        echo "Failed <a href='/week_eight/post_variables_part_1.php?mess={$mess}'>Next:</a>";
        //header("Location:/week_eight/post_variables_part_1.php?mess=$mess");
    }
} else {
    echo 'failed.';
}
Example #14
0
    private function renderRulesSet($themeInfo, $validationResults)
    {
        ?>
						<div class="row" style="color:#888;font-weight:normal;margin:30px 0 0 0;background:#F8F8F8;border-radius: 3px;">
						<div class="col-md-8 text-center" style="">
						<br/>
						<?php 
        $userMessage = UserMessage::getInstance();
        echo UserMessage::getInstance()->getMessagesHtml();
        $img = 'shieldperfect240.png';
        $color = 'a6af11';
        $text = sprintf(__('Validation score : %s%%'), intval($themeInfo->score));
        if ($themeInfo->score < 100.0) {
            if ($themeInfo->score > 95) {
                $img = "shieldgreen240.png";
                $color = 'cbd715';
            } else {
                if ($themeInfo->score > 80) {
                    $img = "shieldorange240.png";
                    $color = 'ff8214';
                } else {
                    $img = "shieldred240.png";
                    $color = 'ff1427';
                }
            }
            if ($themeInfo->criticalCount > 0) {
                $text = sprintf(__('Validation score : %s%% (%s critical alerts)'), intval($themeInfo->score), $themeInfo->criticalCount);
            } else {
                $text = sprintf(__('Validation score : %s%%'), intval($themeInfo->score));
            }
        }
        ?>
								<div class="shield1" style="width:201px;height:240px;background-image:url(<?php 
        echo TC_HTTPDOMAIN;
        ?>
/img/<?php 
        echo $img;
        ?>
);" title="<?php 
        echo $text;
        ?>
">
										<div class="shield2" style="color:#<?php 
        echo $color;
        ?>
;">			
									<?php 
        if ($themeInfo->score < 100.0) {
            echo intval($themeInfo->score);
        }
        ?>
										</div>	
								</div>
								<?php 
        echo '<p "color:#' . $color . '">' . __("validation score") . ' : ' . intval($themeInfo->score) . ' %</p>';
        echo '<p>' . sprintf(__("%s critical alerts. %s warnings."), $themeInfo->criticalCount, $themeInfo->warningsCount) . '</p>';
        if (!isset($_POST["donotstore"]) && UserMessage::getCount(ERRORLEVEL_FATAL) == 0) {
            ?>
									<br/><br/>
									<?php 
            echo __("Share this page with the following link :");
            ?>
									<p>
									<?php 
            echo '<a href="' . $this->samepage_i18n[I18N::getCurLang()] . '">' . $this->samepage_i18n[I18N::getCurLang()] . '</a>';
            ?>
									</p>
									<?php 
            echo __("Display this score on your website with the following HTML code that links to this page :");
            ?>
									<p style="color:red"><i>( corrected 2014-06-09 )</i></p>
									<pre style="font-size:11px;width:70%;margin:auto;"><?php 
            echo htmlspecialchars('<iframe src="' . TC_HTTPDOMAIN . '/score.php?lang=' . I18N::getCurLang() . '&id=' . $themeInfo->hash . '&size=big" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:240px; width:200px;" allowTransparency="true"></iframe>');
            ?>
</pre>		
									
									<button class="btn" data-toggle="collapse" data-target="#moreembedoptions" style="height:20px;padding:1px;font-size:12px">more options</button>
									<div id="moreembedoptions" class="collapse">
									<?php 
            displayShield($themeInfo, I18N::getCurLang(), 80, '#', TC_HTTPDOMAIN . '/');
            ?>
									<?php 
            echo __("Medium size icon (default) :");
            ?>
									<pre style="font-size:11px;width:70%;margin:auto;"><?php 
            echo htmlspecialchars('<iframe src="' . TC_HTTPDOMAIN . '/score.php?id=' . $themeInfo->hash . '" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:80px; width:67px;" allowTransparency="true"></iframe>');
            ?>
</pre>	
									<?php 
            displayShield($themeInfo, I18N::getCurLang(), 40, '#', TC_HTTPDOMAIN . '/');
            ?>
									<?php 
            echo __("Small size icon :");
            ?>
									<pre style="font-size:11px;width:70%;margin:auto;"><?php 
            echo htmlspecialchars('<iframe src="' . TC_HTTPDOMAIN . '/score.php?id=' . $themeInfo->hash . '" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:80px; width:40px;" allowTransparency="true"></iframe>');
            ?>
</pre>	
									<?php 
            echo htmlspecialchars(__("You can switch language with <strong>lang</strong> parameter in iframe's url. So far <strong>fr</strong> and <strong>en</strong> are supported. Default value is <strong>en</strong>."));
            ?>
									<pre style="font-size:11px;width:70%;margin:auto;"><?php 
            echo htmlspecialchars('<iframe src="' . TC_HTTPDOMAIN . '/score.php?lang=' . I18N::getCurLang() . '&id=' . $themeInfo->hash . '" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:80px; width:67px;" allowTransparency="true"></iframe>');
            ?>
</pre>	
									</div>
									<br/>
								<?php 
        } else {
            echo '<br>' . __("These results were not saved on themecheck.org servers and will be lost when you quit this page.");
        }
        ?>
						</div>
						<div class="col-md-4" style="border-radius: 3px;background:#444; overflow:hidden; font-size:12px">
							<?php 
        $characteristics = array();
        $characteristics[] = array(__("Theme name"), htmlspecialchars($themeInfo->name));
        if ($themeInfo->themetype == TT_WORDPRESS) {
            if (empty($themeInfo->cmsVersion)) {
                $characteristics[] = array(__("Theme type"), __("Wordpress theme"));
            } else {
                $characteristics[] = array(__("Theme type"), __("Wordpress theme") . ' ' . $themeInfo->cmsVersion);
            }
        } else {
            if ($themeInfo->themetype == TT_WORDPRESS_CHILD) {
                if (empty($themeInfo->cmsVersion)) {
                    $characteristics[] = array(__("Theme type"), __("Wordpress child theme"));
                } else {
                    $characteristics[] = array(__("Theme type"), __("Wordpress child theme") . ' ' . $themeInfo->cmsVersion);
                }
                if (!empty($themeInfo->parentName)) {
                    $url = TC_HTTPDOMAIN . '/' . Route::getInstance()->assemble(array("lang" => I18N::getCurLang(), "phpfile" => "results", "namesanitized" => $themeInfo->parentNameSanitized, "themetype" => $themeInfo->parentThemeType));
                    $characteristics[] = array(__("Parent theme name"), "<a href='" . $url . "'>" . htmlspecialchars($themeInfo->parentName) . "</a>");
                }
            } else {
                if ($themeInfo->themetype == TT_JOOMLA) {
                    if (empty($themeInfo->cmsVersion)) {
                        $characteristics[] = array(__("Theme type"), __("Joomla template"));
                    } else {
                        $characteristics[] = array(__("Theme type"), __("Joomla template") . ' ' . $themeInfo->cmsVersion);
                    }
                }
            }
        }
        $characteristics[] = array(__("File name"), htmlspecialchars($themeInfo->zipfilename, defined('ENT_HTML5') ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES));
        $characteristics[] = array(__("File size"), $themeInfo->zipfilesize . ' ' . __('bytes'));
        $characteristics[] = array(__("MD5"), strtolower($themeInfo->hash_md5));
        $characteristics[] = array(__("SHA1"), strtolower($themeInfo->hash_sha1));
        if (empty($themeInfo->licenseUri)) {
            if (!empty($themeInfo->licenseText)) {
                $characteristics[] = array(__("License"), ThemeInfo::getLicenseName($themeInfo->license) . '<br>' . htmlspecialchars($themeInfo->licenseText));
            } else {
                $characteristics[] = array(__("License"), ThemeInfo::getLicenseName($themeInfo->license));
            }
        } else {
            if (!empty($themeInfo->licenseText)) {
                $characteristics[] = array(__("License"), '<a href="' . $themeInfo->licenseUri . '" rel="nofollow">' . ThemeInfo::getLicenseName($themeInfo->license) . '</a>' . '<br>' . htmlspecialchars($themeInfo->licenseText));
            } else {
                $characteristics[] = array(__("License"), '<a href="' . $themeInfo->licenseUri . '" rel="nofollow">' . ThemeInfo::getLicenseName($themeInfo->license) . '</a>');
            }
        }
        $characteristics[] = array(__("Files included"), htmlspecialchars($themeInfo->filesIncluded, defined('ENT_HTML5') ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES));
        if (!empty($themeInfo->themeUri)) {
            if (strpos($themeInfo->themeUri, 'themeforest.net') !== false) {
                $characteristics[] = array(__("Theme URI"), '<a href="' . $themeInfo->themeUri . '?ref=peol">' . htmlspecialchars($themeInfo->themeUri) . '</a>');
            } else {
                $characteristics[] = array(__("Theme URI"), '<a href="' . $themeInfo->themeUri . '">' . htmlspecialchars($themeInfo->themeUri) . '</a>');
            }
        }
        if (!empty($themeInfo->version)) {
            $characteristics[] = array(__("Version"), htmlspecialchars($themeInfo->version));
        }
        if (!empty($themeInfo->authorUri)) {
            $characteristics[] = array(__("Author URI"), '<a href="' . $themeInfo->authorUri . '">' . htmlspecialchars($themeInfo->authorUri) . '</a>');
        }
        if (!empty($themeInfo->tags)) {
            $characteristics[] = array(__("Tags"), htmlspecialchars($themeInfo->tags));
        }
        if (!empty($themeInfo->layout)) {
            if ($themeInfo->layout == 1) {
                $characteristics[] = array(__("Layout"), __("Fixed"));
            } else {
                if ($themeInfo->layout == 2) {
                    $characteristics[] = array(__("Layout"), __("Fluid"));
                } else {
                    if ($themeInfo->layout == 3) {
                        $characteristics[] = array(__("Layout"), __("Responsive"));
                    }
                }
            }
        }
        if (!empty($themeInfo->copyright)) {
            $characteristics[] = array(__("Copyright"), htmlspecialchars($themeInfo->copyright));
        }
        if (!empty($themeInfo->creationDate)) {
            $characteristics[] = array(__("Creation date"), date("Y-m-d", $themeInfo->creationDate));
        }
        if (!empty($themeInfo->modificationDate)) {
            $characteristics[] = array(__("Last file update"), date("Y-m-d", $themeInfo->modificationDate));
        }
        if (!empty($themeInfo->validationDate)) {
            $characteristics[] = array(__("Last validation"), date("Y-m-d H:i", $themeInfo->validationDate));
        }
        foreach ($characteristics as $c) {
            echo '<p style="text-transform:uppercase;margin:0;margin-top:10px;">' . $c[0] . '</p><span style="color:#CCC">' . $c[1] . '</span>';
        }
        ?>
								
						</div>
					</div>

							<?php 
        echo '<div class="row"><div class="col-md-12">';
        if (count($validationResults->check_critical) > 0) {
            echo '<h2 style="line-height:100px;color:#D00;">' . __("Critical alerts") . '</h2>';
            echo '<ol>';
            foreach ($validationResults->check_critical as $check) {
                echo '<h4 style="color:#666;margin-top:40px;"><li>' . $check->title . ' : ' . $check->hint . '</li></h4>';
                if (!empty($check->messages)) {
                    echo '<p style="color:#c94b4b;">' . implode('<br/>', $check->messages) . '</p>';
                }
            }
            echo '</ol>';
        }
        if (count($validationResults->check_warnings) > 0) {
            echo '<h2 style="line-height:100px;color:#eea43a;">' . __("Warnings") . '</h2>';
            echo '<ol>';
            foreach ($validationResults->check_warnings as $check) {
                echo '<h4 style="color:#666;margin-top:40px;"><li>' . $check->title . ' : ' . $check->hint . '</li></h4>';
                if (!empty($check->messages)) {
                    echo '<p style="color:#eea43a;">' . implode('<br/>', $check->messages) . '</p>';
                }
            }
            echo '</ol>';
        }
        if (count($validationResults->check_info) > 0) {
            echo '<h2 style="line-height:100px;color:#00b6e3;">' . __("Info") . '</h2>';
            echo '<ol>';
            foreach ($validationResults->check_info as $check) {
                echo '<h4 style="color:#666;margin-top:40px;"><li>' . $check->title . ' : ' . $check->hint . '</li></h4>';
                if (!empty($check->messages)) {
                    echo '<p style="color:#00b6e3;">' . implode('<br/>', $check->messages) . '</p>';
                }
            }
            echo '</ol>';
        }
        echo '</div></div>';
    }
Example #15
0
 /**
  *		Auto detect theme type
  **/
 public static function detectThemetype($unzippath)
 {
     $files = listdir($unzippath);
     $score_wordpress = 0;
     $score_joomla = 0;
     $hasparenttemplate = false;
     $stylecss = false;
     $indexphp = false;
     $templateDetails = false;
     if ($files) {
         foreach ($files as $key => $filename) {
             $path_parts = pathinfo($filename);
             $basename = $path_parts['basename'];
             if ($basename == 'style.css') {
                 $file_content = file_get_contents($filename);
                 if (preg_match('/[ \\t\\/*#]*Theme Name:/i', $file_content) | preg_match('/[ \\t\\/*#]*Description:/i', $file_content) | preg_match('/[ \\t\\/*#]*Author:/i', $file_content)) {
                     $score_wordpress++;
                 }
                 if (preg_match('/[ \\t\\/*#]*Template/i', $file_content)) {
                     $hasparenttemplate = true;
                 }
                 $stylecss = true;
             }
             if ($basename == 'screenshot.png') {
                 $score_wordpress++;
             }
             if ($basename == 'screenshot.jpg') {
                 $score_wordpress++;
             }
             if ($basename == 'templateDetails.xml') {
                 $score_joomla++;
                 $templateDetails = true;
             }
             if ($basename == 'templatedetails.xml') {
                 UserMessage::enqueue(__("Invalid joomla template. templatedetails.xml found. Please rename it templateDetails.xml (capital D)"), ERRORLEVEL_FATAL);
             }
             if ($basename == 'template_thumbnail.png') {
                 $score_joomla++;
             }
             if ($basename == 'template_preview.png') {
                 $score_joomla++;
             }
             if ($basename == 'index.php') {
                 $file_content = file_get_contents($filename);
                 if (preg_match('/get_header\\s?\\(\\s?\\)/', $file_content) && preg_match('/get_footer\\s?\\(\\s?\\)/', $file_content)) {
                     $score_wordpress++;
                 }
                 if (strpos($file_content, "'_JEXEC'") !== false) {
                     $score_joomla++;
                 }
                 $indexphp = true;
             }
         }
     }
     if ($score_joomla > $score_wordpress && $templateDetails) {
         return TT_JOOMLA;
     }
     if ($score_joomla < $score_wordpress && $stylecss) {
         if (!$indexphp && $hasparenttemplate) {
             return TT_WORDPRESS_CHILD;
         }
         return TT_WORDPRESS;
     }
     return TT_UNDEFINED;
 }